Skip to content
RCE Write-up Intermediate

Old RCE worth $3362

An outdated Symfony framework exposed a development endpoint that allowed unauthenticated access to phpinfo and, via a known exploit, remote code execution. The attacker could run commands on the server.

nanwn Follow

Published on medium.com

Bounty$3,362 View original

Have you come across the article “RCE via Symfony Secret Fragments”? If not, there are numerous articles available on Medium.

nanwn, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

This is a story about finding an old remote code execution (RCE) issue in a Symfony application that was not listed on the bug bounty program's scope page. The target was a host under redacted.com, discovered through a favicon hash search rather than through the program's published asset list. The feature at the centre of it is the Symfony development front controller app_dev.php and its profiler, which in this deployment was reachable without authentication.

The report does not name the program beyond "Redacted Server Bug Bounty Program", and the hostnames and IP addresses are redacted throughout.

Setup

The tools used were:

  • httpx from ProjectDiscovery, to scan for favicons and collect their hashes.
  • Shodan, to search for hosts by favicon hash.
  • dirsearch, to enumerate paths on the IP that turned up.
  • A browser, plus a shell, to run the exploit.

The precondition that made the whole thing possible was an exposed development front controller, app_dev.php, on a Symfony install that was outdated. The report does not give the Symfony version.

Finding it

The researcher started from a favicon hash, not from Shodan directly. Scanning with httpx for random favicons produced a hit:

Text
https://retailersupport.redacted.com/favicon.ico [200] [Express,Node.js] [-2115385***]

The hash was obtained from a subdomain of the target. Searching Shodan for that hash:

Text
hash:favicon:-2115385***

returned exactly one IP address. That IP was interesting because it differed from the "official" IP address listed on the HackerOne program page, so the researcher kept investigating it.

From the original on medium.com

Next, dirsearch was run against the IP to look for more paths:

Bash
python3 dirsearch -u [redacted]

This surfaced an endpoint at https://[redacted]/app_dev.php/. A quick search showed that app_dev.php is associated with the Symfony framework, so the researcher began reading up on Symfony exploitation. Searching for "Symfony Framework RCE" returned a large number of articles and resources.

The endpoint had a weakness in which the phpinfo endpoint could be reached without authentication and would expose sensitive information. Navigating to:

Text
https://[redacted]/app_dev.php/_profiler/phpinfo

worked, and returned configuration output including the Apache version, the server administrator address, the hostname, the user and group the process ran as, and the server root:

At this point the researcher wrote up the finding as an information disclosure issue and did not check for other weaknesses, such as database credentials, that the same exposure might have revealed.

Exploitation

Step 1: Submit the information disclosure

The first report described the exposed phpinfo page. The HackerOne triage team replied that the reported asset was not in scope, and that they had asked the program team whether they wanted reports for it:

Hi @nanwn,

The reported asset is not in the scope of the program. Hence, I have sent a note to the Redacted Server Bug Bounty Program Team to check whether they are interested in receiving reports for this asset.

I will get back to you as soon as I hear back from them. Please bear with us in the meantime.

Thank you for your patience.

Cheers,

Step 2: Establish that the domain belongs to the target

After further research and several dead ends, the researcher found a PDF file that listed the target domain. That information was added to the report, and the program staff changed the status to Triaged.

Step 3: Identify the outdated framework and obtain an exploit

Further investigation showed that the Symfony framework on the server was outdated and vulnerable to RCE. The researcher downloaded an exploit from:

Text
https://github.com/ambionics/symfony-exploits

Step 4: Achieve RCE

RCE was achieved on the server from a bash screen and from the Chrome browser. The two proof-of-concept URLs recorded were:

The first calls the phpinfo controller through the _fragment endpoint, with what=-1 as its argument. The second sets _controller to shell_exec and passes cmd=id, which runs the id command on the server. Both carry a _hash parameter, which is the signature Symfony uses to validate the fragment path.

By the time the researcher realised the full impact, staff had already fixed the vulnerability and deleted the /app_dev.php/ file. A screenshot of the proof of concept had been taken beforehand.

Step 5: Triage and reward

Staff updated the severity from Critical to High (8.2). The program rewarded the researcher with a $3,362 bounty, with the following comment:

@nanwn, Thanks for the great finding. We look forward to future submissions from you. Happy Hunting!

From the original on medium.com

Root cause

The development front controller app_dev.php was reachable on a production-facing host. In Symfony, the dev environment exposes the profiler, including _profiler/phpinfo, without authentication. The framework version was outdated and vulnerable to the fragment RCE technique, in which a crafted _fragment request with a valid _hash can invoke arbitrary controllers, here shell_exec with a cmd argument.

The asset was not on the program's scope list, and the dev controller was left in place on a host reachable from the internet.

Impact

An unauthenticated attacker could read sensitive configuration through phpinfo, including the Apache version, the server administrator address, the hostname, the user and group the process ran as (www-data), and the server root. With the outdated framework, the attacker could go further and execute commands on the server, as demonstrated with id through shell_exec.

Fix

Staff fixed the vulnerability and deleted the /app_dev.php/ file. In general terms, a development front controller should not be reachable on an internet-facing host, and the framework should be kept up to date so that the fragment signing and controller invocation cannot be abused.

Variants to test

  • Search Shodan by favicon hash for hosts that differ from the IPs listed on a program's scope page. A positive result is a host that responds with the same favicon hash.
  • Run dirsearch against such hosts and look for app_dev.php, app.php or similar front controllers. A positive result is a 200 response on the dev controller.
  • Request /_profiler/phpinfo on the dev controller. A positive result is a page of PHP configuration output.
  • Check the framework version against known fragment RCE issues, and try a _fragment request with a _controller and _hash. A positive result is a response that reflects the controller's output, such as the result of id.
  • Look for other weaknesses the same exposure might reveal, such as database credentials, which the researcher here did not check.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

A security researcher found a way to run commands on a company's web server without logging in. This is called remote code execution, or RCE for short: "remote" because it happens over the internet, "code execution" because the attacker's own instructions get run by the server. Think of it as finding a service door at the back of a shop that was left unlocked, and discovering that behind it there is a control panel for the whole building.

The interesting part is how the researcher found the door. The company runs a bug bounty programme: a public offer that pays people for reporting security problems in their systems. Such programmes usually publish a list of which websites and servers are fair game, called the scope. The server in this story was not on that list. The researcher found it anyway, by searching the internet for a small fingerprint that websites leave behind, and the company ended up paying a $3,362 bounty for the report.

The report does not name the company beyond "Redacted Server Bug Bounty Program", and the hostnames and IP addresses are hidden throughout.

The pieces you need to know

Before the steps make sense, here are the few ideas the whole story rests on.

A favicon and its hash. A favicon is the tiny picture shown in a browser tab next to a website's title. Many websites use the same picture file, and the file's contents can be boiled down to a short string of characters called a hash. A hash works like a fingerprint: the same file always gives the same string, and a different file gives a different one. If you know the fingerprint of a picture, you can search for every server on the internet that serves that same picture.

Shodan. Shodan is a search engine for internet-connected machines rather than for web pages. Instead of indexing page text, it records what services and devices answer on the internet, and you can search it with filters. One of those filters lets you search by favicon hash.

httpx. httpx is a command-line tool from a project called ProjectDiscovery. It takes a list of addresses and probes them, reporting what answers and some details about each one, including the favicon hash.

dirsearch. dirsearch is a tool that tries a long list of common file and folder names against a website, one after another, and reports which ones exist. It is like walking down a corridor trying every door handle to see which doors open.

Symfony and app_dev.php. Symfony is a popular toolkit, called a framework, that programmers use to build web applications in the PHP language. Symfony applications have an entry point, a front controller, which is the file every request passes through. There is normally one for the live site and a separate one for development, and the development one is called app_dev.php. The development entry point is meant for programmers working on the site: it switches on helpful debugging features, including a profiler that records details about each request. Those features are useful while building and dangerous once the site is live, because they are not meant to be seen by strangers.

phpinfo. phpinfo is a standard PHP page that prints a long list of facts about the server: software versions, file paths, settings, and sometimes more. It is a diagnostic page, and on a public server it hands an attacker a map of the system.

Authentication. Authentication simply means proving who you are, usually by logging in. Something reachable "without authentication" can be opened by anyone with a browser and the address, no account needed.

Information disclosure. This is the security term for a bug that leaks information the visitor should not see. On its own it may look harmless, but it often gives an attacker the details needed for a more serious attack, which is exactly what happened here.

RCE and the fragment trick. RCE, remote code execution, means an attacker gets the server to run commands of their choosing. The specific technique here abuses a Symfony feature called fragments. A fragment is a way for one part of a page to be built by a separate internal request. Symfony signs that internal request with a value called a hash so it can tell a genuine internal request from a forged one. If the signing can be bypassed, an attacker can craft a fragment request that names which internal function should run, and the server obliges.

Severity and CVSS. Bug bounty platforms rate reports by severity, often with a score called CVSS. Critical and High are the two most serious bands.

Step 1: Start from a favicon, not from Shodan

The researcher did not begin by browsing Shodan. The starting point was a scan for favicons with httpx, run across many addresses to collect the hashes of the pictures they serve. During that scan one target stood out:

Text
https://retailersupport.redacted.com/favicon.ico [200] [Express,Node.js] [-2115385***]

Reading this line from left to right: the address of the favicon file; [200] is the HTTP status code meaning the request succeeded, the same code a browser gets when a page loads normally; [Express,Node.js] is a hint about the software the server appears to be running; and the last bracket holds the favicon hash, partly hidden here. The hash had been picked up from a subdomain of the target, that is, from a name that sits under the company's main domain.

Why start here? Because a favicon hash is a way to find servers that belong to an organisation without relying on the organisation's own published list. If a company reuses the same tab icon across its sites, the fingerprint leads you to machines that the scope page never mentions.

From the original on medium.com

Step 2: Search Shodan for that fingerprint

With the hash in hand, the researcher searched Shodan for it:

Text
hash:favicon:-2115385***

This is a Shodan query. hash:favicon: tells Shodan to look at the favicon fingerprint of the machines it has recorded, and the value after the colon is the fingerprint to match. The search returned exactly one IP address. An IP address is the numeric label that identifies a machine on the internet, the equivalent of a street address for a computer.

That single result was worth pursuing for a specific reason: the address was different from the "official" IP address printed on the HackerOne programme page. HackerOne is one of the platforms where companies run their bug bounty programmes. If the official address is the one everyone tests, a second address serving the same fingerprint is a machine that has probably had far less attention.

Step 3: Look for doors with dirsearch

Next the researcher ran dirsearch against that address to see which paths existed on it:

Bash
python3 dirsearch -u [redacted]

Line by line: python3 runs the Python interpreter, version 3; dirsearch is the name of the script being run; -u is the option that supplies the target address; and [redacted] is the address being tested, shown here in its redacted placeholder form. In plain terms: "take this address and try a long list of common file and folder names against it, then tell me which ones answer."

This is a sensible next step after finding an unknown machine, because you cannot guess your way through a server's file layout. You let a tool try the usual names and report the hits. One of the hits was an endpoint, meaning a specific addressable path on the server, at https://[redacted]/app_dev.php/.

Step 4: Work out what app_dev.php is

A quick web search showed that most of the pages mentioning app_dev.php were about the Symfony framework. The researcher then read up specifically on exploiting Symfony, and a search for "Symfony Framework RCE" turned up a large number of articles and resources. The volume of material was surprising.

Why does this matter? Because a filename that appears in many exploitation articles is a signal. It tells you the file is a known weak point, and that other people have already worked out what can go wrong when it is left exposed. Reading before poking is what turns a random hit into a plan.

Step 5: Reach the profiler's phpinfo page

The endpoint had a weakness: the phpinfo page could be reached without authentication and would expose sensitive information. The researcher navigated to:

Text
https://[redacted]/app_dev.php/_profiler/phpinfo

Reading the address: https:// is the encrypted web protocol; [redacted] is the redacted host; /app_dev.php is the development front controller; /_profiler is the debugging profiler that the development mode switches on; and /phpinfo is the diagnostic page inside it. In other words, the address asks the development entry point to show its debugging profiler's copy of the PHP information page. It worked, and returned configuration output:

What this block tells an attacker, piece by piece: the web server software is Apache, version 2.4.18 on Ubuntu, with mod_fcgid 2.3.9 and OpenSSL 1.0.2g; the Apache API version is 20120211; the server administrator contact is an address at dev.redacted.co.uk; the hostname is dev.redacted.co.uk; the process runs as the user and group www-data with numeric id 33; the request and connection limits are listed; the machine is a virtual server; and the server root, the top folder of the web server's configuration, is /etc/apache2.

Each of those facts is a small gift to an attacker. The software versions can be compared against known bugs. The user www-data tells you which account any command would run as. The paths tell you how the machine is laid out. This is why information disclosure is treated seriously even when nothing is changed or stolen.

At this point the researcher wrote up the finding as an information disclosure issue, and did not check for other weaknesses, such as database credentials, that the same exposure might have revealed.

Step 6: Submit, and hit the scope wall

The first report described the exposed phpinfo page. The HackerOne triage team replied that the reported asset was not in scope, and that they had asked the programme team whether they wanted reports for it:

Hi @nanwn,

The reported asset is not in the scope of the program. Hence, I have sent a note to the Redacted Server Bug Bounty Program Team to check whether they are interested in receiving reports for this asset.

I will get back to you as soon as I hear back from them. Please bear with us in the meantime.

Thank you for your patience.

Cheers,

"Not in scope" means the asset is not on the programme's published list of things it accepts reports about. Triage is the first stage of handling a report, where a platform's staff check it is real and relevant before passing it to the company. The reply is not a rejection: the team forwarded the question to the programme and asked the researcher to wait.

Step 7: Show that the domain belongs to the target

After more research and several dead ends, the researcher found a PDF file that listed the target domain. That information was added to the report, and the programme staff quickly changed the status to Triaged. Triaged means the report has been accepted as valid.

The PDF listed the target domain, and after it was added to the report the status changed to Triaged.

Step 8: Find out the framework is old, and fetch an exploit

Further investigation showed that the Symfony framework on the server was outdated and vulnerable to RCE. The researcher downloaded an exploit from:

Text
https://github.com/ambionics/symfony-exploits

An exploit is existing code that carries out a known attack, so you do not have to write the attack yourself. GitHub is where such code is commonly published. "Outdated" is the key word: the framework on the server was old and vulnerable to RCE.

Step 9: Run commands on the server

RCE was achieved on the server from a bash screen and from the Chrome browser. A bash screen here means a terminal session, a text window where you type commands. The two proof-of-concept addresses recorded were:

These look like nonsense, so it is worth unpacking them slowly. Both are ordinary web addresses with a question mark in the middle. Everything after the ? is the query string, a list of name and value pairs separated by &, which is how a browser sends extra details along with a request. The %3D, %26 and %2F sequences are percent encoding: a way of writing characters that would otherwise be ambiguous in a URL, where %3D stands for =, %26 stands for &, and %2F stands for /.

The first address:

  • https://redacted/_fragment is the fragment endpoint, the internal-request feature described earlier.
  • _path is the parameter that says what the internal request should do. Decoded, its value is _controller=phpinfo&what=-1, meaning: run the phpinfo controller, with what set to -1.
  • _hash is the signature Symfony uses to check that the fragment path is genuine. Here it is a long encoded string.

The second address:

  • Again it targets /_fragment.
  • _path decodes to cmd=id&_controller=shell_exec, meaning: run the shell_exec controller, which executes a shell command, and pass it cmd=id.
  • id is a standard command on Linux and similar systems that prints which user the command is running as. It is the classic way to prove code execution without doing any harm.
  • _hash is again the signature, a different value this time.

So the first address proves the fragment mechanism can be steered at all, and the second proves it can be steered into running a command on the machine. Both carry a _hash, which is the signature Symfony uses to validate the fragment path.

By the time the researcher realised the full impact, staff had already fixed the vulnerability and deleted the /app_dev.php/ file. A screenshot of the proof of concept had been taken beforehand, which is why the evidence survived the fix.

Step 10: Triage and reward

Staff updated the severity from Critical to High (8.2). Severity is the platform's rating of how serious a bug is, and 8.2 is a CVSS score, a number on a scale where higher means worse. The programme rewarded the researcher with a $3,362 bounty, with the following comment:

@nanwn, Thanks for the great finding. We look forward to future submissions from you. Happy Hunting!

From the original on medium.com

Why it worked

The development front controller app_dev.php was reachable on a host facing the internet. In Symfony, the development environment exposes the profiler, including _profiler/phpinfo, without authentication. The framework version was outdated and vulnerable to the fragment RCE technique, in which a crafted _fragment request with a valid _hash can invoke arbitrary controllers, here shell_exec with a cmd argument. The report does not describe the exact code path or the signing secret that made the hash valid; it only shows the working addresses.

The asset was not on the programme's scope list, so it had not been reviewed through that channel, and the development controller had been left in place on a host reachable from the internet.

What an attacker could do

An unauthenticated attacker could read sensitive configuration through phpinfo, including the Apache version, the server administrator address, the hostname, the user and group the process ran as (www-data), and the server root. With the outdated framework, the attacker could go further and execute commands on the server, as demonstrated with id through shell_exec.

The fix

Staff fixed the vulnerability and deleted the /app_dev.php/ file. In general terms, a development front controller should not be reachable on an internet-facing host, and the framework should be kept up to date so that the fragment signing and controller invocation cannot be abused.

Things worth trying yourself

These are the same checks, phrased as things to look for and what a hit looks like.

  1. Search Shodan by favicon hash for hosts that differ from the addresses listed on a programme's scope page. A positive result is a host that responds with the same favicon hash.
  2. Run dirsearch against such hosts and look for app_dev.php, app.php or similar front controllers. A positive result is a 200 response on the development controller.
  3. Request /_profiler/phpinfo on the development controller. A positive result is a page of PHP configuration output.
  4. Check the framework version against known fragment RCE issues, and try a _fragment request with a _controller and _hash. A positive result is a response that reflects the controller's output, such as the result of id.
  5. Look for other weaknesses the same exposure might reveal, such as database credentials, which the researcher here did not check.

Glossary

  • Authentication: proving who you are, usually by logging in; something reachable without it can be opened by anyone.
  • Bash screen: a terminal session, a text window where you type commands.
  • Bug bounty programme: a public offer by an organisation to pay people for reporting security problems in its systems.
  • Bounty: the money paid for a valid report.
  • Controller: in a web framework, the piece of code that handles a particular request and produces the response.
  • CVSS: a scoring system that rates the severity of a security issue as a number; higher is worse.
  • dirsearch: a tool that tries many common file and folder names against a website and reports which exist.
  • Endpoint: a specific addressable path on a server that does something.
  • Exploit: existing code that carries out a known attack.
  • Favicon: the small picture shown in a browser tab next to a site's title.
  • Fragment: a Symfony feature where part of a page is built by a separate internal request, signed with a hash.
  • Framework: a toolkit of ready-made code that programmers build an application on top of; Symfony is one for PHP.
  • Front controller: the single entry file that every request to an application passes through.
  • Hash (favicon): a short string derived from a file's contents, acting as a fingerprint so identical files can be found.
  • Hash (_hash): the signature Symfony attaches to a fragment request to prove it is genuine.
  • HackerOne: a platform where organisations run bug bounty programmes and receive reports.
  • httpx: a command-line tool from ProjectDiscovery that probes addresses and reports details such as favicon hashes.
  • Information disclosure: a bug that leaks information the visitor should not see.
  • IP address: the numeric label identifying a machine on the internet.
  • Percent encoding: a way of writing characters in a URL using % codes, such as %3D for =.
  • phpinfo: a standard PHP page that prints detailed facts about the server.
  • Profiler: a Symfony debugging feature, active in development mode, that records details about requests.
  • Query string: the part of a URL after ?, holding name and value pairs separated by &.
  • RCE (remote code execution): a flaw that lets an attacker make a server run commands of their choosing.
  • Scope: the published list of assets a bug bounty programme accepts reports about.
  • Severity: the rating of how serious an issue is, such as Critical or High.
  • Shodan: a search engine for internet-connected machines rather than web pages.
  • shell_exec: a function that runs a shell command and returns its output.
  • Status code: the number a server returns with a response; 200 means success.
  • Subdomain: a name that sits under a main domain, such as a department name in front of the company's domain.
  • Symfony: a popular framework for building web applications in PHP.
  • Triage: the first stage of handling a report, where it is checked as real and relevant; "Triaged" means accepted as valid.
  • www-data: the user account that web server processes commonly run as on Linux.

More by nanwn

View all

4 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.