From phpinfo page to many P1 bugs and RCE. [Symfony]
A publicly reachable phpinfo page exposed the Symfony APP_SECRET value. With that secret, the author could sign requests to the /_fragment endpoint and make the server run PHP functions such as phpinfo and phpcredits, which the text frames as a route to remote code execution.
Published on u-itachi.medium.com
[Symfony]: is a set of reusable PHP components and a PHP framework to build web applications, APIs, microservices and web services
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
Symfony is a set of reusable PHP components and a PHP framework for building web applications, APIs, microservices and web services. This write-up is about what happens when a Symfony application exposes a phpinfo page and the APP_SECRET value leaks through it. On its own, a phpinfo page is usually treated as a P4 finding. The researcher's point is that the file can contain the material needed to turn that low-severity disclosure into something much worse, including remote code execution through Symfony's fragment handling.
Setup
No accounts, roles or specific product versions are described. The work was done during hunting against hosts that exposed a phpinfo page. The tools used were:
- A custom Python script,
matchizer, written by the researcher to collect hosts that return a specific response on a specific path. - A public exploit script,
secret_fragment_exploit.pyfrom theambionics/symfony-exploitsrepository, run with the recoveredAPP_SECRETas the-secretparameter.
The precondition for the whole chain is a Symfony application that exposes phpinfo output and whose APP_SECRET appears in that output.
Finding it
While hunting, the researcher found a phpinfo page, which is normally considered a P4 bug. Rather than stopping there, the decision was to look for higher impact in the same file, specifically database credentials or keys, because sensitive data such as DB credentials and sensitive tokens is often present in it.

The screenshot shows sensitive data leakage in the phpinfo output. The same finding was triaged as a P1 bug.


While reading the output, the researcher found the app_secret. The APP_SECRET environment variable is required to generate CSRF tokens. By default, symfony/framework-bundle generates one when it is installed via Symfony Flex.
After reading the phpinfo file, the app_secret token was found.

The image shows the leaked app_secret token.

Exploitation
Step 1: use the secret against the fragment path
The secret can be used with the /_fragment path. That path can be exploited to call the System() function, which allows the execution of system commands on the server. Normally the path returns 403 Forbidden with a response like Oops! An Error Occurred.

Step 2: find hosts that expose the fragment path
The researcher wrote a tool to gather all hosts that have this path with the specific response Oops! An Error Occurred. The tool is published on GitHub as matchizer_Tool:
python3 matchizer.py -urls hosts.txt -URL /_Fragment -match ‘Oops! An Error Occurred’ -include
The command reads hosts from hosts.txt, requests the /_Fragment path and matches the response Oops! An Error Occurred.

Many of the hosts found this way run the Symfony framework. The researcher then used the public script automate-exploit (secret_fragment_exploit.py) to automate the exploitation, adding the recovered app_secret token as the -secret parameter.
Step 3: run the exploit with the recovered secret
python3 exploit.py ‘http://sub.website.com/_fragment' — method 1 — secret ‘<seceret>’ — algo ‘sha256’ — internal-url ‘http://sub.website.com/_fragment' — function phpinfo — parameters what:-1
The command runs the exploit against the target's /_fragment endpoint with the recovered secret, the sha256 algorithm, the phpinfo function and the parameter what:-1. The script returns the full path needed to execute functions.

Step 4: confirm function execution
With the path returned by the script, the phpinfo function was executed.

The phpcredits function was executed as well.

Root cause
Two exposures combine. First, the phpinfo page is reachable and prints environment values, including APP_SECRET. Second, the Symfony application exposes the /_fragment path, which can be exploited with the leaked APP_SECRET. Anyone who knows the secret can produce a valid signature and ask the fragment handler to call a function. The report does not describe the application code or configuration beyond this; the mechanism is the fragment signature being keyed on a value that leaked through a separate, low-severity page.
Impact
With the leaked secret, an attacker can reach the /_fragment path and call functions such as phpinfo and phpcredits, and the report states the path can be exploited to call System(), which allows execution of system commands on the server. The leaked data was triaged as a P1 bug, and the report states the path can be exploited to call System(). The chain requires a host that exposes phpinfo with the secret in it and a Symfony application whose fragment path behaves as described.
Fix
- Disable ESI (Edge-Side Includes) and change the Symfony application secret (
APP_SECRET). - Disable the
phpinfofile.
Variants to test
- Look for other
phpinfopages on hosts in scope and search the output forDB_USER,DB_PASSWORD,SECURE_AUTH_KEY,AUTH_SALT,SECURE_AUTH_SALTandAPP_SECRET. A positive result is any of these values appearing in the page. - Run the host-matching step against a list of hosts with the
/_Fragmentpath and theOops! An Error Occurredmatch. A positive result is a host that returns that response on the/_Fragmentpath. - Where a secret is recovered, run the fragment exploit with the
phpinfofunction and thewhat:-1parameter. A positive result is the script returning the full path to execute functions. - Try the same with the
phpcreditsfunction to confirm execution beyond a single function.
The researcher's closing tip is to treat a phpinfo page as a starting point rather than a P4: read the file, search for sensitive values, and use them to reach P1 submissions or RCE through Symfony.
What happened, in plain words
A security researcher was looking at websites as part of a bug bounty programme. In a bug bounty, companies invite people to test their systems and pay for real problems they find, so the tester reports the issue instead of using it for harm. While testing, the researcher found a page called phpinfo. That page is a diagnostic page that PHP, a programming language used to build websites, can print out. It lists lots of details about how the server is set up. Normally a page like this is treated as a very minor problem, a P4, because it only shows information. The researcher's idea was that the information on it might be worth much more than P4. It might contain passwords, keys or secrets that let someone do something far more serious.
That is exactly what happened. The page contained a value called APP_SECRET. In the Symfony framework, which is a toolkit for building web applications in PHP, that value is used to sign certain requests so the application can tell they are genuine. If an outsider knows the secret, they can create their own signed requests. The researcher used the secret against a special path, /_fragment, and was able to make the server run functions such as phpinfo and phpcredits. That is remote code execution, often shortened to RCE: an attacker can make the server run commands of their choosing. The same leaked data was also triaged as a P1 bug.
This article walks through the whole chain in the order it happened: finding the page, reading it, spotting the secret, finding other hosts with the same behaviour, and running the exploit. Every command and payload is copied exactly as it appeared.
Background you need first
A few ideas come up again and again, so here they are from zero.
PHP and Symfony. PHP is a programming language that runs on web servers and produces the pages your browser shows. Symfony is a collection of ready-made PHP code that developers use to build web applications faster. Instead of writing everything themselves, they assemble Symfony's building blocks. The report describes Symfony as "a set of reusable PHP components and a PHP framework to build web applications, APIs, microservices and web services".
API. An API is a way for one piece of software to talk to another, like a waiter taking your order to the kitchen and bringing back the food. You ask in a defined way, and you get a defined answer, without needing to know what happens in the kitchen.
Host. A host is simply a machine (or a website name that points to a machine) that serves something. When the report says it gathered "hosts", it means a list of website addresses to test.
Token and secret. A token is a short piece of text that acts like a key or a ticket. A secret is a value that is supposed to stay private, because anyone who knows it can prove they are trusted. Think of a secret as the stamp a club uses on your hand: if you can copy the stamp, you can get back in without paying.
CSRF token. CSRF stands for Cross-Site Request Forgery. It is an attack where a malicious site tricks your browser into sending a request to another site where you are already logged in. To stop it, applications attach a CSRF token to forms: a value the server generated and can check. If the token is missing or wrong, the request is refused. The APP_SECRET is the value Symfony uses to generate those tokens.
phpinfo. phpinfo is a built-in PHP function that prints a long page describing the PHP installation: settings, loaded modules, and often environment variables. Environment variables are named values the server passes to the application, and they frequently hold configuration such as database usernames and passwords. That is why a phpinfo page is interesting: it can accidentally show things that were meant to stay private.
ESI and fragments. ESI stands for Edge-Side Includes. It is a feature that lets a page include small pieces (fragments) fetched separately, so parts of a page can be cached or built independently. Symfony has a /_fragment path that serves those pieces. Symfony serves fragments through the /_fragment path, which can be exploited with the leaked APP_SECRET. If you know the secret, you can sign your own fragment requests, and the application will trust them.
P1 and P4. Bug bounty programmes rank findings by severity. P1 is the most serious, P4 the least. A phpinfo page alone is usually P4. The point of this story is that it can be the first step towards P1.
Setup
The report does not describe any accounts, roles or specific product versions. The work was done while hunting, against hosts that exposed a phpinfo page. Two tools were used:
- A custom Python script called
matchizer, written by the researcher, to collect hosts that return a particular response on a particular path. Python is a programming language often used for small automation scripts. - A public exploit script,
secret_fragment_exploit.py, from theambionics/symfony-exploitsrepository, run with the recoveredAPP_SECRETpassed as the-secretparameter.
The one precondition for the whole chain is a Symfony application that exposes phpinfo output and whose APP_SECRET appears in that output.
Finding it
While hunting, the researcher found a phpinfo page, normally considered a P4 bug. Rather than stopping there, the decision was to look for higher impact in the same file, specifically database credentials or keys, because sensitive data such as database credentials and sensitive tokens is often present in it.

The screenshot shows sensitive data leakage in the phpinfo output. The same finding was triaged as a P1 bug.


While reading the output, the researcher found the app_secret. The APP_SECRET environment variable is required to generate CSRF tokens. By default, symfony/framework-bundle generates one when it is installed via Symfony Flex. Symfony Flex is the installer that sets up Symfony projects and creates default configuration for you.
After reading the phpinfo file, the app_secret token was found.

The image shows the leaked app_secret token.

Why this step matters: the page was not reported straight away as a minor issue. It was read carefully, looking for values that grant trust. The APP_SECRET is exactly such a value, because it is the key behind the signatures on fragment requests.
Exploitation
Step 1: use the secret against the fragment path
The secret can be used with the /_fragment path. That path can be exploited to call the System() function, which allows the execution of system commands on the server. Normally the path returns 403 Forbidden with a response like Oops! An Error Occurred. 403 Forbidden is the standard web response meaning "you are not allowed to see this".

Step 2: find hosts that expose the fragment path
The researcher wrote a tool to gather all hosts that have this path with the specific response Oops! An Error Occurred. The tool is published on GitHub as matchizer_Tool:
python3 matchizer.py -urls hosts.txt -URL /_Fragment -match ‘Oops! An Error Occurred’ -include
Line by line:
python3runs the Python 3 interpreter, which executes the script that follows.matchizer.pyis the script itself.-urls hosts.txttells it to read the list of hosts to test from a file calledhosts.txt, one per line.-URL /_Fragmenttells it which path to request on each host. Note the capital F here, as written in the report.-match ‘Oops! An Error Occurred’tells it to keep only hosts whose response contains that exact text.-includeis an option of the tool as written in the report.
The command reads hosts from hosts.txt, requests the /_Fragment path and matches the response Oops! An Error Occurred. The reason for this filter is practical: on a large list of hosts, you want to narrow down to the ones that behave like a Symfony fragment endpoint before spending time on each.

Many of the hosts found this way run the Symfony framework. The researcher then used the public script automate-exploit (secret_fragment_exploit.py) to automate the exploitation, adding the recovered app_secret token as the -secret parameter.
Step 3: run the exploit with the recovered secret
python3 exploit.py ‘http://sub.website.com/_fragment' — method 1 — secret ‘<seceret>’ — algo ‘sha256’ — internal-url ‘http://sub.website.com/_fragment' — function phpinfo — parameters what:-1
Line by line:
python3 exploit.pyruns the exploit script.‘http://sub.website.com/_fragment'is the target: the fragment path on the host being tested.— method 1selects the method the script should use, as written in the report.— secret ‘<seceret>’supplies the leakedAPP_SECRET. The placeholder stands for the real value, which is not published.— algo ‘sha256’says which hashing algorithm to use when producing the signature. A hash is a one-way fingerprint of data: the same input always gives the same fingerprint, but you cannot work backwards from the fingerprint to the input.sha256is one such algorithm.— internal-url ‘http://sub.website.com/_fragment'sets the internal URL the fragment handler should use.— function phpinfoasks the fragment handler to call thephpinfofunction.— parameters what:-1passes the parameterwhatwith the value-1to that function.
The command runs the exploit against the target's /_fragment endpoint with the recovered secret, the sha256 algorithm, the phpinfo function and the parameter what:-1. The script returns the full path needed to execute functions.

Step 4: confirm function execution
With the path returned by the script, the phpinfo function was executed.

The phpcredits function was executed as well. phpcredits is another built-in PHP function that prints a page of credits.

Root cause
Two exposures combine. First, the phpinfo page is reachable and prints environment values, including APP_SECRET. Second, the Symfony application exposes the /_fragment path, which can be exploited with the leaked APP_SECRET. Anyone who knows the secret can produce a valid signature and ask the fragment handler to call a function. The report does not describe the application code or configuration beyond this; the mechanism is the fragment signature being keyed on a value that leaked through a separate, low-severity page.
A simple comparison: a nightclub stamps your hand so the doorman recognises you. If the club also leaves the stamp design lying on the pavement outside, anyone can copy it and walk in. The phpinfo page is the stamp design on the pavement; /_fragment is the doorman.
Impact
With the leaked secret, an attacker can reach the /_fragment path and call functions such as phpinfo and phpcredits, and the report states the path can be exploited to call System(), which allows execution of system commands on the server. The leaked data was triaged as a P1 bug, and the report states the path can be exploited to call System(). The chain requires a host that exposes phpinfo with the secret in it and a Symfony application whose fragment path behaves as described.
Fix
- Disable ESI (Edge-Side Includes) and change the Symfony application secret (
APP_SECRET). - Disable the
phpinfofile.
Changing the secret matters because the old one may already be known; disabling the page matters because it is how the secret escaped in the first place.
Variants to test
- Look for other
phpinfopages on hosts in scope and search the output forDB_USER,DB_PASSWORD,SECURE_AUTH_KEY,AUTH_SALT,SECURE_AUTH_SALTandAPP_SECRET. A positive result is any of these values appearing in the page. - Run the host-matching step against a list of hosts with the
/_Fragmentpath and theOops! An Error Occurredmatch. A positive result is a host that returns that response on the/_Fragmentpath. - Where a secret is recovered, run the fragment exploit with the
phpinfofunction and thewhat:-1parameter. A positive result is the script returning the full path to execute functions. - Try the same with the
phpcreditsfunction to confirm execution beyond a single function.
The researcher's closing tip is to treat a phpinfo page as a starting point rather than a P4: read the file, search for sensitive values, and use them to reach P1 submissions or RCE through Symfony.


Glossary
- API: a defined way for one piece of software to ask another for data or actions, like a waiter carrying orders between you and the kitchen.
- APP_SECRET: a private value Symfony uses to sign things such as CSRF tokens and fragment requests; anyone who knows it can produce trusted signatures.
- Bug bounty: a programme where organisations invite testers to find and report security problems in exchange for rewards.
- CSRF (Cross-Site Request Forgery): an attack that tricks a logged-in user's browser into sending an unwanted request to another site; applications defend against it with CSRF tokens.
- CSRF token: a value the server generates and checks on form submissions so it can tell genuine requests from forged ones.
- Environment variable: a named value the server passes to an application, often holding configuration such as credentials.
- ESI (Edge-Side Includes): a feature that lets a page include separately fetched fragments, so parts can be built or cached independently.
- Fragment: a small piece of a page fetched separately, served in Symfony through the
/_fragmentpath. - Hash / sha256: a one-way fingerprint of data; the same input always gives the same output, and
sha256is one such algorithm. - Host: a machine or website name that serves content; in this report, an entry in a list of sites to test.
- P1 / P4: severity levels in a bug bounty programme, P1 being the most serious and P4 the least.
- phpcredits: a built-in PHP function that prints a page of credits; running it shows the server executes functions on request.
- phpinfo: a built-in PHP function that prints a long page of configuration and environment details, which can leak secrets.
- PHP: a programming language commonly used to build websites.
- Python: a programming language often used for small automation and scripting tasks.
- RCE (Remote Code Execution): a flaw that lets an attacker make a server run commands or code of their choosing.
- Secret: a value meant to stay private because knowing it grants trust.
- Symfony: a set of reusable PHP components and a framework for building web applications, APIs, microservices and web services.
- Symfony Flex: the installer that sets up Symfony projects and creates default configuration, including a default
APP_SECRET. - Token: a short piece of text that acts like a key or ticket, proving something to a system.
- 403 Forbidden: the standard web response meaning the server understood the request but refuses to allow it.