Miscellaneous Applications
ColdFusion - Discovery & Enumeration
ColdFusion is a programming language and a web application development platform based on Java.
It is used to build dynamic and interactive web applications that can be connected to various APIs and databases such as MySQL, Oracle, and Microsoft SQL Server.
ColdFusion Markup Language (CFML
) is the proprietary programming language used in ColdFusion to develop dynamic web applications. It has a syntax similar to HTML, making it easy to learn for web developers. CFML includes tags and functions for database integration, web services, email management, and other common web development tasks. Its tag-based approach simplifies application development by reducing the amount of code needed to accomplish complex tasks. For instance, the cfquery
tag can execute SQL statements to retrieve data from a database:
Developers can then use the cfloop
tag to iterate through the records retrieved from the database:
Thanks to its built-in functions and features, CFML enables developers to create complex business logic using minimal code. Moreover, ColdFusion supports other programming languages, such as JavaScript and Java, allowing developers to use their preferred programming language within the ColdFusion environment.
Some of the primary purposes and benefits of ColdFusion include:
Benefits
Description
Developing data-driven web applications
ColdFusion allows developers to build rich, responsive web applications easily. It offers session management, form handling, debugging, and more features. ColdFusion allows you to leverage your existing knowledge of the language and combines it with advanced features to help you build robust web applications quickly.
Integrating with databases
ColdFusion easily integrates with databases such as Oracle, SQL Server, and MySQL. ColdFusion provides advanced database connectivity and is designed to make it easy to retrieve, manipulate, and view data from a database and the web.
Simplifying web content management
One of the primary goals of ColdFusion is to streamline web content management. The platform offers dynamic HTML generation and simplifies form creation, URL rewriting, file uploading, and handling of large forms. Furthermore, ColdFusion also supports AJAX by automatically handling the serialisation and deserialisation of AJAX-enabled components.
Performance
ColdFusion is designed to be highly performant and is optimised for low latency and high throughput. It can handle a large number of simultaneous requests while maintaining a high level of performance.
Collaboration
ColdFusion offers features that allow developers to work together on projects in real-time. This includes code sharing, debugging, version control, and more. This allows for faster and more efficient development, reduced time-to-market and quicker delivery of projects.
Despite being less popular than other web development platforms, ColdFusion is still widely used by developers and organisations globally.
Like any web-facing technology, ColdFusion has historically been vulnerable to various types of attacks, such as SQL injection, XSS, directory traversal, authentication bypass, and arbitrary file uploads. To improve the security of ColdFusion, developers must implement secure coding practices, input validation checks, and properly configure web servers and firewalls. Here are a few known vulnerabilities of ColdFusion:
CVE-2021-21087: Arbitrary disallow of uploading JSP source code
CVE-2020-24453: Active Directory integration misconfiguration
CVE-2020-24450: Command injection vulnerability
CVE-2020-24449: Arbitrary file reading vulnerability
CVE-2019-15909: Cross-Site Scripting (XSS) Vulnerability
ColdFusion exposes a fair few ports by default:
80
HTTP
Used for non-secure HTTP communication between the web server and web browser.
443
HTTPS
Used for secure HTTP communication between the web server and web browser. Encrypts the communication between the web server and web browser.
1935
RPC
Used for client-server communication. Remote Procedure Call (RPC) protocol allows a program to request information from another program on a different network device.
25
SMTP
Simple Mail Transfer Protocol (SMTP) is used for sending email messages.
8500
SSL
Used for server communication via Secure Socket Layer (SSL).
5500
Server Monitor
Used for remote administration of the ColdFusion server.
It's important to note that default ports can be changed during installation or configuration.
Enumeration
During a penetration testing enumeration, several ways exist to identify whether a web application uses ColdFusion. Here are some methods that can be used:
Method
Description
Port Scanning
ColdFusion typically uses port 80 for HTTP and port 443 for HTTPS by default. So, scanning for these ports may indicate the presence of a ColdFusion server. Nmap might be able to identify ColdFusion during a services scan specifically.
File Extensions
ColdFusion pages typically use ".cfm" or ".cfc" file extensions. If you find pages with these file extensions, it could be an indicator that the application is using ColdFusion.
HTTP Headers
Check the HTTP response headers of the web application. ColdFusion typically sets specific headers, such as "Server: ColdFusion" or "X-Powered-By: ColdFusion", that can help identify the technology being used.
Error Messages
If the application uses ColdFusion and there are errors, the error messages may contain references to ColdFusion-specific tags or functions.
Default Files
ColdFusion creates several default files during installation, such as "admin.cfm" or "CFIDE/administrator/index.cfm". Finding these files on the web server may indicate that the web application runs on ColdFusion.
NMap ports and service scan results
The port scan results show three open ports. Two Windows RPC services, and one running on 8500
. As we know, 8500
is a default port that ColdFusion uses for SSL. Navigating to the IP:8500
lists 2 directories, CFIDE
and cfdocs,
in the root, further indicating that ColdFusion is running on port 8500.
Navigating around the structure a bit shows lots of interesting info, from files with a clear .cfm
extension to error messages and login pages.
The /CFIDE/administrator
path, however, loads the ColdFusion 8 Administrator login page. Now we know for certain that ColdFusion 8
is running on the server.
Attacking ColdFusion
As we know, the version of ColdFusion running is ColdFusion 8
, and there are two results of interest. The Adobe ColdFusion - Directory Traversal
and the Adobe ColdFusion 8 - Remote Command Execution (RCE)
results.
Directory Traversal
Take the following ColdFusion code snippet:
In this code snippet, the ColdFusion cfdirectory
tag lists the contents of the uploads
directory, and the cfloop
tag is used to loop through the query results and display the filenames as clickable links in HTML.
However, the directory
parameter is not validated correctly, which makes the application vulnerable to a Path Traversal attack. An attacker can exploit this vulnerability by manipulating the directory
parameter to access files outside the uploads
directory.
In this example, the ../
sequence is used to navigate the directory tree and access the /etc/passwd
file outside the intended location.
CVE-2010-2861
is the Adobe ColdFusion - Directory Traversal
exploit discovered by searchsploit
. It is a vulnerability in ColdFusion that allows attackers to conduct path traversal attacks.
CFIDE/administrator/settings/mappings.cfm
logging/settings.cfm
datasources/index.cfm
j2eepackaging/editarchive.cfm
CFIDE/administrator/enter.cfm
These ColdFusion files are vulnerable to a directory traversal attack in Adobe ColdFusion 9.0.1
and earlier versions
. Remote attackers can exploit this vulnerability to read arbitrary files by manipulating the locale parameter
in these specific ColdFusion files.
With this vulnerability, attackers can access files outside the intended directory by including ../
sequences in the file parameter. For example, consider the following URL:
In this example, the URL attempts to access the mappings.cfm
file in the /CFIDE/administrator/settings/
directory of the web application with a specified en
locale. However, a directory traversal attack can be executed by manipulating the URL's locale parameter, allowing an attacker to read arbitrary files located outside of the intended directory, such as configuration files or system files.
In this example, the ../
sequences have been used to replace a valid locale
to traverse the directory structure and access the passwd
file located in the /etc/
directory.
Using searchsploit
, copy the exploit to a working directory and then execute the file to see what arguments it requires.
Coldfusion - Exploitation
The password.properties
file in ColdFusion is a configuration file that securely stores encrypted passwords for various services and resources the ColdFusion server uses. It contains a list of key-value pairs, where the key represents the resource name and the value is the encrypted password. These encrypted passwords are used for services like database connections
, mail servers
, LDAP servers
, and other resources that require authentication. By storing encrypted passwords in this file, ColdFusion can automatically retrieve and use them to authenticate with the respective services without requiring the manual entry of passwords each time. The file is usually in the [cf_root]/lib
directory and can be managed through the ColdFusion Administrator.
By providing the correct parameters to the exploit script and specifying the path of the desired file, the script can trigger an exploit on the vulnerable endpoints mentioned above. The script will then output the result of the exploit attempt:
As we can see, the contents of the password.properties
file have been retrieved, proving that this target is vulnerable to CVE-2010-2861
.
Unauthenticated RCE
Unauthenticated Remote Code Execution (RCE
) is a type of security vulnerability that allows an attacker to execute arbitrary code
on a vulnerable system without requiring authentication
.
In the context of ColdFusion web applications, an Unauthenticated RCE attack occurs when an attacker can execute arbitrary code on the server without requiring any authentication. This can happen when a web application allows the execution of arbitrary code through a feature or function that does not require authentication, such as a debugging console or a file upload functionality. Take the following code:
In the above code, the cmd
variable is created by concatenating the cgi.query_string
variable with a command to be executed. This command is then executed using the cfexecute
function, which runs the Windows cmd.exe
This code is vulnerable to an unauthenticated RCE attack because it does not properly validate the cmd
variable before executing it, nor does it require the user to be authenticated. An attacker could simply pass a malicious command as the cgi.query_string
variable, and it would be executed by the server.
This URL includes a semicolon (%3B
) at the beginning of the query string, which can allow for the execution of multiple commands on the server. This could potentially append legitimate functionality with an unintended command. The included echo
command prints a message to the console, and is followed by a redirection command to write a file to the C:
directory with a message indicating that the server has been compromised.
An example of a ColdFusion Unauthenticated RCE attack is the CVE-2009-2265
vulnerability that affected Adobe ColdFusion versions 8.0.1 and earlier.
The vulnerability exists in the FCKeditor package, and is accessible on the following path:
CVE-2009-2265
is the vulnerability identified by our earlier searchsploit search as Adobe ColdFusion 8 - Remote Command Execution (RCE)
. Pull it into a working directory.
Searchsploit
A quick cat
review of the code indicates that the script needs some information. Set the correct information and launch the exploit.
The exploit will take a bit of time to launch, but it eventually will return a functional remote shell
Exploitation
IIS Tilde Enumeration
IIS tilde directory enumeration is a technique utilised to uncover hidden files, directories, and short file names (aka the 8.3 format
) on some versions of Microsoft Internet Information Services (IIS) web servers. This method takes advantage of a specific vulnerability in IIS, resulting from how it manages short file names within its directories.
When a file or folder is created on an IIS server, Windows generates a short file name in the 8.3 format
, consisting of eight characters for the file name, a period, and three characters for the extension. Intriguingly, these short file names can grant access to their corresponding files and folders, even if they were meant to be hidden or inaccessible.
The tilde (~
) character, followed by a sequence number, signifies a short file name in a URL. Hence, if someone determines a file or folder's short file name, they can exploit the tilde character and the short file name in the URL to access sensitive data or hidden resources.
IIS tilde directory enumeration primarily involves sending HTTP requests to the server with distinct character combinations in the URL to identify valid short file names. Once a valid short file name is detected, this information can be utilised to access the relevant resource or further enumerate the directory structure.
Assume the server contains a hidden directory named SecretDocuments. When a request is sent to http://example.com/~s
, the server replies with a 200 OK
status code, revealing a directory with a short name beginning with "s". The enumeration process continues by appending more characters:
For the request http://example.com/~se
, the server returns a 200 OK
status code, further refining the short name to "se". Further requests are sent, such as:
The server delivers a 200 OK
status code for the request http://example.com/~sec
, further narrowing the short name to "sec".
Continuing this procedure, the short name secret~1
is eventually discovered when the server returns a 200 OK
status code for the request http://example.com/~secret
.
Once the short name secret~1
is identified, enumeration of specific file names within that path can be performed, potentially exposing sensitive documents.
For instance, if the short name secret~1
is determined for the concealed directory SecretDocuments, files in that directory can be accessed by submitting requests such as:
The same IIS tilde directory enumeration technique can also detect 8.3 short file names for files within the directory. After obtaining the short names, those files can be directly accessed using the short names in the requests.
In 8.3 short file names, such as somefi~1.txt
, the number "1" is a unique identifier that distinguishes files with similar names within the same directory. The numbers following the tilde (~
) assist the file system in differentiating between files that share similarities in their names, ensuring each file has a distinct 8.3 short file name.
For example, if two files named somefile.txt
and somefile1.txt
exist in the same directory, their 8.3 short file names would be:
somefi~1.txt
forsomefile.txt
somefi~2.txt
forsomefile1.txt
Enumeration
IIS 7.5 is running on port 80. Executing a tilde enumeration attack on this version could be a viable option.
Tilde Enumeration using IIS ShortName Scanner
Manually sending HTTP requests for each letter of the alphabet can be a tedious process. Fortunately, there is a tool called IIS-ShortName-Scanner
that can automate this task. You can find it on GitHub at the following link: IIS-ShortName-Scanner. To use IIS-ShortName-Scanner
, you will need to install Oracle Java on either Pwnbox or your local VM. Details can be found in the following link. How to Install Oracle Java
When you run the below command, it will prompt you for a proxy, just hit enter for No.
Generate Wordlist
The pwnbox image offers an extensive collection of wordlists located in the /usr/share/wordlists/
directory, which can be utilised for this purpose.
This command combines egrep
and sed
to filter and modify the contents of input files, then save the results to a new file.
Command Part
Description
egrep -r ^transf
The egrep
command is used to search for lines containing a specific pattern in the input files. The -r
flag indicates a recursive search through directories. The ^transf
pattern matches any line that starts with "transf". The output of this command will be lines that begin with "transf" along with their source file names.
|
The pipe symbol (|
) is used to pass the output of the first command (egrep
) to the second command (sed
). In this case, the lines starting with "transf" and their file names will be the input for the sed
command.
sed 's/^[^:]*://'
The sed
command is used to perform a find-and-replace operation on its input (in this case, the output of egrep
). The 's/^[^:]*://'
expression tells sed
to find any sequence of characters at the beginning of a line (^
) up to the first colon (:
), and replace them with nothing (effectively removing the matched text). The result will be the lines starting with "transf" but without the file names and colons.
> /tmp/list.txt
The greater-than symbol (>
) is used to redirect the output of the entire command (i.e., the modified lines) to a new file named /tmp/list.txt
.
Gobuster Enumeration
Once you have created the custom wordlist, you can use gobuster
to enumerate all items in the target. GoBuster is an open-source directory and file brute-forcing tool written in the Go programming language. It is designed for penetration testers and security professionals to help identify and discover hidden files, directories, or resources on web servers during security assessments.
LDAP
LDAP
(Lightweight Directory Access Protocol) is a protocol
used to access and manage directory information
. A directory
is a hierarchical data store
that contains information about network resources such as users
, groups
, computers
, printers
, and other devices. LDAP provides some excellent functionality:
Functionality
Description
Efficient
Efficient and fast queries and connections to directory services, thanks to its lean query language and non-normalised data storage.
Global naming model
Supports multiple independent directories with a global naming model that ensures unique entries.
Extensible and flexible
This helps to meet future and local requirements by allowing custom attributes and schemas.
Compatibility
It is compatible with many software products and platforms as it runs over TCP/IP and SSL directly, and it is platform-independent
, suitable for use in heterogeneous environments with various operating systems.
Authentication
It provides authentication
mechanisms that enable users to sign on once
and access multiple resources on the server securely.
However, it also suffers some significant issues:
Compliance
Directory servers must be LDAP compliant
for service to be deployed, which may limit the choice
of vendors and products.
Complexity
Difficult to use and understand
for many developers and administrators, who may not know how to configure LDAP clients correctly or use it securely.
Encryption
LDAP does not encrypt its traffic by default
, which exposes sensitive data to potential eavesdropping and tampering. LDAPS (LDAP over SSL) or StartTLS must be used to enable encryption.
Injection
Vulnerable to LDAP injection attacks
, where malicious users can manipulate LDAP queries and gain unauthorised access
to data or resources. To prevent such attacks, input validation and output encoding must be implemented.
LDAP is commonly used
for providing a central location
for accessing
and managing
directory services. Directory services are collections of information about the organisation, its users, and assets–like usernames and passwords. LDAP enables organisations to store, manage, and secure this information in a standardised way. Here are some common use cases:
LDAP is commonly used
for providing a central location
for accessing
and managing
directory services. Directory services are collections of information about the organisation, its users, and assets–like usernames and passwords. LDAP enables organisations to store, manage, and secure this information in a standardised way. Here are some common use cases:
Use Case
Description
Authentication
LDAP can be used for central authentication
, allowing users to have single login credentials across multiple applications and systems. This is one of the most common use cases for LDAP.
Authorisation
LDAP can manage permissions
and access control
for network resources such as folders or files on a network share. However, this may require additional configuration or integration with protocols like Kerberos.
Directory Services
LDAP provides a way to search
, retrieve
, and modify data
stored in a directory, making it helpful for managing large numbers of users and devices in a corporate network. LDAP is based on the X.500 standard
for directory services.
Synchronisation
LDAP can be used to keep data consistent
across multiple systems by replicating changes
made in one directory to another.
There are two popular implementations of LDAP: OpenLDAP
, an open-source software widely used and supported, and Microsoft Active Directory
, a Windows-based implementation that seamlessly integrates with other Microsoft products and services.
Although LDAP and AD are related
, they serve different purposes
. LDAP
is a protocol
that specifies the method of accessing and modifying directory services, whereas AD
is a directory service
that stores and manages user and computer data. While LDAP can communicate with AD and other directory services, it is not a directory service itself. AD offers extra functionalities such as policy administration, single sign-on, and integration with various Microsoft products.
LDAP
Active Directory (AD)
A protocol
that defines how clients and servers communicate with each other to access and manipulate data stored in a directory service.
A directory server
that uses LDAP as one of its protocols to provide authentication, authorisation, and other services for Windows-based networks.
An open and cross-platform protocol
that can be used with different types of directory servers and applications.
Proprietary software
that only works with Windows-based systems and requires additional components such as DNS (Domain Name System) and Kerberos for its functionality.
It has a flexible and extensible schema
that allows custom attributes and object classes to be defined by administrators or developers.
It has a predefined schema
that follows and extends the X.500 standard with additional object classes and attributes specific to Windows environments. Modifications should be made with caution and care.
Supports multiple authentication mechanisms
such as simple bind, SASL, etc.
It supports Kerberos
as its primary authentication mechanism but also supports NTLM (NT LAN Manager) and LDAP over SSL/TLS for backward compatibility.
LDAP works by using a client-server architecture
. A client sends an LDAP request to a server, which searches the directory service and returns a response to the client. LDAP is a protocol that is simpler and more efficient than X.500, on which it is based. It uses a client-server model, where clients send requests to servers using LDAP messages encoded in ASN.1 (Abstract Syntax Notation One) and transmitted over TCP/IP (Transmission Control Protocol/Internet Protocol). The servers process the requests and send back responses using the same format. LDAP supports various requests, such as bind
, unbind
, search
, compare
, add
, delete
, modify
, etc.
LDAP requests
are messages
that clients send to servers to perform operations
on data stored in a directory service. An LDAP request is comprised of several components:
Session connection
: The client connects to the server via an LDAP port (usually 389 or 636).Request type
: The client specifies the operation it wants to perform, such asbind
,search
, etc.Request parameters
: The client provides additional information for the request, such as thedistinguished name
(DN) of the entry to be accessed or modified, the scope and filter of the search query, the attributes and values to be added or changed, etc.Request ID
: The client assigns a unique identifier for each request to match it with the corresponding response from the server.
Once the server receives the request, it processes it and sends back a response message that includes several components:
Response type
: The server indicates the operation that was performed in response to the request.Result code
: The server indicates whether or not the operation was successful and why.Matched DN:
If applicable, the server returns the DN of the closest existing entry that matches the request.Referral
: The server returns a URL of another server that may have more information about the request, if applicable.Response data
: The server returns any additional data related to the response, such as the attributes and values of an entry that was searched or modified.
After receiving and processing the response, the client disconnects from the LDAP port.
ldapsearch
This command can be broken down as follows:
Connect to the server
ldap.example.com
on port389
.Bind (authenticate) as
cn=admin,dc=example,dc=com
with passwordsecret123
.Search under the base DN
ou=people,dc=example,dc=com
.Use the filter
(mail=john.doe@example.com)
to find entries that have this email address.
The server would process the request and send back a response, which might look something like this:
This response includes the entry's distinguished name (DN)
that matches the search criteria and its attributes and values.
LDAP Injection
LDAP injection
is an attack that exploits web applications that use LDAP
(Lightweight Directory Access Protocol) for authentication or storing user information. The attacker can inject malicious code
or characters
into LDAP queries to alter the application's behaviour, bypass security measures
, and access sensitive data
stored in the LDAP directory.
To test for LDAP injection, you can use input values that contain special characters or operators
that can change the query's meaning:
*
An asterisk *
can match any number of characters
.
( )
Parentheses ( )
can group expressions
.
|
A vertical bar |
can perform logical OR
.
&
An ampersand &
can perform logical AND
.
(cn=*)
Input values that try to bypass authentication or authorisation checks by injecting conditions that always evaluate to true
can be used. For example, (cn=*)
or (objectClass=*)
can be used as input values for a username or password fields.
LDAP injection attacks are similar to SQL injection attacks
but target the LDAP directory service instead of a database.
For example, suppose an application uses the following LDAP query to authenticate users:
In this query, $username
and $password
contain the user's login credentials. An attacker could inject the *
character into the $username
or $password
field to modify the LDAP query and bypass authentication.
If an attacker injects the *
character into the $username
field, the LDAP query will match any user account with any password. This would allow the attacker to gain access to the application with any password, as shown below:
Alternatively, if an attacker injects the *
character into the $password
field, the LDAP query would match any user account with any password that contains the injected string. This would allow the attacker to gain access to the application with any username, as shown below:
LDAP injection attacks can lead to severe consequences
, such as unauthorised access
to sensitive information, elevated privileges
, and even full control over the affected application or server
. These attacks can also considerably impact data integrity and availability, as attackers may alter or remove data
within the directory service, causing disruptions to applications and services dependent on that data.
To mitigate the risks associated with LDAP injection attacks, it is crucial to thoroughly validate
and sanitize user input
before incorporating it into LDAP queries. This process should involve removing LDAP-specific special characters
like *
and employing parameterised queries
to ensure user input is treated solely as data
, not executable code.
Enumeration
nmap detects ldap
server running on port 389
Web Mass Assignment Vulnerabilities
This vulnerability happens when a programmer takes ALL arguments from a request and assigns them to stored values (this is the Mass Assignment) without checking for the correctness or filtering extra parameters.
Prevention
To prevent this type of attack, one should explicitly assign the attributes for the allowed fields, or use whitelisting methods provided by the framework to check the attributes that can be mass-assigned. The following example shows how to use strong parameters in the User
controller.
In the example above, the user_params
method returns a new hash that includes only the username
and email
attributes, ignoring any more input the client may have sent. By doing this, we ensure that only explicitly permitted attributes can be changed by mass assignment.
Attacking Applications Connecting to Services
Applications that are connected to services often include connection strings that can be leaked if they are not protected sufficiently. In the following paragraphs, we will go through the process of enumerating and exploiting applications that are connected to other services in order to extend their functionality. This can help us collect information and move laterally or escalate our privileges during penetration testing.
ELF Executable Examination
Example: The octopus_checker
binary is found on a remote machine during the testing. Running the application locally reveals that it connects to database instances in order to verify that they are available.
Using tools like PEDA (Python Exploit Development Assistance for GDB) we can further examine the file. This is an extension of the standard GNU Debugger (GDB), which is used for debugging C and C++ programs. (Or GEF)
Once the binary is loaded, we set the disassembly-flavor
to define the display style of the code, and we proceed with disassembling the main function of the program.
This reveals several call instructions that point to addresses containing strings. They appear to be sections of a SQL connection string, but the sections are not in order, and the endianness entails that the string text is reversed. Endianness defines the order that the bytes are read in different architectures. Further down the function, we see a call to SQLDriverConnect.
Adding a breakpoint at this address and running the program once again, reveals a SQL connection string in the RDX register address, containing the credentials for a local database instance.
Apart from trying to connect to the MS SQL service, penetration testers can also check if the password is reusable from users of the same network.
DLL File Examination
A DLL file is a Dynamically Linked Library
and it contains code that is called from other programs while they are running. The MultimasterAPI.dll
binary is found on a remote machine during the enumeration process. Examination of the file reveals that this is a .Net assembly.
Using the debugger and .NET assembly editor dnSpy, we can view the "source code" directly.
This tool allows reading, editing, and debugging the source code of a .NET assembly (C# and Visual Basic). Inspection of MultimasterAPI.Controllers
-> ColleagueController
reveals a database connection string containing the password.
Apart from trying to connect to the MS SQL service, attacks like password spraying can also be used to test the security of other services.
Other Notable Applications
That being said, here are a few other applications that we have come across during assessments and are worth looking out for:
Nagios is another system and network monitoring product. Nagios has had a wide variety of issues over the years, including remote code execution, root privilege escalation, SQL injection, code injection, and stored XSS. If you come across a Nagios instance, it is worth checking for the default credentials nagiosadmin:PASSW0RD
and fingerprinting the version.
Wikis/Intranets
We may come across internal Wikis (such as MediaWiki), custom intranet pages, SharePoint, etc. These are worth assessing for known vulnerabilities but also searching if there is a document repository. We have run into many intranet pages (both custom and SharePoint) that had a search functionality which led to discovering valid credentials.
Once again, this is not an exhaustive list but just more examples of the many things we may come across in a corporate network. As shown here, often, a default password and built-in functionality are all we need.
Application Hardening
The first step for any organization should be to create a detailed (and accurate) application inventory of both internal and external-facing applications. This can be achieved in many ways, and blue teams on a budget could benefit from pentesting tools such as Nmap and EyeWitness to assist in the process. Various open-source and paid tools can be used to create and maintain this inventory.
Without knowing what exists in the environment, we won't know what to protect! Creating this inventory may expose instances of "shadow IT" (or unauthorized installs), deprecated applications that are no longer needed, or even issues such as a trial version of a tool being converted to a free version automatically (such as Splunk when it no longer requires authentication).
General Hardening Tips
The applications discussed in this section should be hardened to prevent compromise using these techniques and others. Below are some important measures that can help secure deployments of WordPress, Drupal, Joomla, Tomcat, Jenkins, osTicket, GitLab, PRTG Network Monitor, and Splunk in any environment.
Secure authentication
: Applications should enforce strong passwords during registration and setup, and default administrative account passwords should be changed. If possible, the default administrative accounts should be disabled, with new custom administrative accounts created. Some applications inherently support 2FA authentication, which should be made mandatory for at least administrator-level users.Access controls
: Proper access control mechanisms should be implemented per application. For example, login pages should not be accessible from the external network unless there is a valid business reason for this access. Similarly, file and folder permissions can be configured to deny uploads or application deployments.Disable unsafe features
: Features such as PHP code editing in WordPress can be disabled to prevent code execution if the server is compromised.Regular updates
: Applications should be updated regularly, and patches supplied by vendors should be applied as soon as possible.Backups
: System administrators should always configure website and database backups, allowing the application to be quickly restored in case of a compromise.Security monitoring
: There are various tools and plugins that can be used to monitor the status and various security-related issues for our applications. Another option is a Web Application Firewall (WAF). While not a silver bullet, a WAF can help add an extra layer of protection provided all the measures above have already been taken.LDAP integration with Active Directory
: Integrating applications with Active Directory single sign-on can increase ease of access, provide more auditing functionality (especially if synced with Azure), and make managing credentials and service accounts more streamlined. It also decreases the number of accounts and passwords that a user will have to remember and give fine-grained control over the password policy.
Every application that we discussed in this module (and beyond) should be following key hardening guidelines such as enabling multi-factor authentication for admins and users wherever possible, changing default admin user account names, limiting the number of admins, and how admins can access the site (i.e., not from the open internet), enforce the principle of least privilege throughout the application, perform regular updates to address security vulnerabilities, taking regular backups to a secondary location to be able to recover quickly in the event of an attack and implement security monitoring tools that can detect and block malicious activity and account brute-forcing, among other attacks.
Finally, we should be careful with what we expose to the internet. Does that GitLab repo really need to be public? Does our ticketing system need to be accessible outside the internal network? With these controls in place, we will have a solid baseline to apply to all applications regardless of their function.
We should also perform regular checks and updates to our application inventory to ensure that we are not exposing applications on the internal or external network that are no longer needed or have severe security flaws. Finally, perform regular assessments to look for security vulnerabilities and misconfigurations as well as sensitive data exposure. Follow through on remediation recommendations included in your penetration testing reports and periodically check for the same types of flaws discovered by your penetration testers. Some could be process-related, requiring a mindset shift for the organization to become more security conscious.
Application-Specific Hardening Tips
Though the general concepts for application hardening apply to all applications that we discussed in this module and will encounter in the real world, we can take some more specific measures. Here are a few:
Security monitoring
Access controls
Access controls
Access controls
Limit access to the Tomcat Manager and Host-Manager applications to only localhost. If these must be exposed externally, enforce IP whitelisting and set a very strong password and non-standard username.
Access controls
Regular updates
Make sure to change the default password and ensure that Splunk is properly licensed to enforce authentication
Secure authentication
Make sure to stay up-to-date and change the default PRTG password
osTicket
Access controls
Limit access from the internet if possible
Secure authentication
Enforce sign-up restrictions such as requiring admin approval for new sign-ups, configuring allowed and denied domains
Last updated