I am Groot
A pre-authentication SQL injection in Sophos XG Firewall allowed attackers to execute arbitrary SQL statements, and a second SQL injection was found in a quarantine email release function that bypassed input escaping. The first could be chained to remote code execution when central management and auto-updates were enabled.
On April 25, 2020, Sophos published a knowledge base article (KBA) 135412 which warned about a pre-authenticated SQL injection (SQLi) vulnerability, affecting the XG Firewall product line. According to Sophos this issue had been actively exploited at least since April 22, 2020.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely user-controlled parameters reached SQL statements without prepared statements, and one function decoded a Base64 parameter after the global escaping step, so special characters slipped through.
Impact
An unauthenticated attacker could read or modify the database, and in configurations with central management and automatic hotfixes enabled, could achieve code execution; the race with hotfix installation limited exploitation.
What the attacker needed
Network access to the web interface; no authentication required; central management enabled for RCE chain; automatic hotfixes enabled for RCE chain
The fix
Sophos issued hotfixes and new firmware versions that restricted unauthenticated modes and addressed the injection.
How it was found
- Send a request to the web console controller endpoint with a mode that is callable without authentication.
- Craft the JSON body so the request type stays ORM and includes a name value and a query value.
- The query value is executed as a SQL statement against the database.
- For the second issue, send a release parameter as a Base64 string containing a crafted file path value.
- The decoded value is inserted into a SELECT statement, allowing a time delay to confirm injection.
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 write-up has not been written yet. The Original tab links to the source.
The firewall's web interface passed user input into database queries without proper safety checks, so an attacker could trick it into running their own database commands. In some setups this could be extended to running commands on the device itself.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.