Skip to content
RCE Write-up Advanced

CVE-2022-3236: Sophos Firewall User Portal and Web Admin Code Injection

Sophos Firewall failed to properly validate JSON keys in the 'json' parameter sent to the Controller endpoint, allowing an attacker to inject arbitrary Perl code via the '_discriminator' key. A remote, unauthenticated attacker could exploit this to execute code as root.

Guy Lederfein Follow

Published on zerodayinitiative.com

Sophos recently patched a code injection vulnerability in Sophos Firewall v19.0 MR1 (19.0.1) and previous. This vulnerability is due to improper validation of JSON keys submitted in the “json” parameter sent to the Controller endpoint.

Guy Lederfein (@glederfein), Dusan Stevanovic, on zerodayinitiative.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.

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 the application passed user-controlled JSON keys into a Perl eval() call without sanitising them, allowing code injection.

Impact

Successful exploitation could result in remote code execution with root privileges; the text notes that the vulnerability is being used to target a small group of organisations.

What the attacker needed

Network access to ports 443 or 4444; no authentication required

How it was found

  1. Send a crafted HTTP request to the Controller endpoint on port 443 or 4444.
  2. Include a 'json' parameter containing a '_discriminator' key with a malicious mapping.
  3. The request reaches the CSC server, which calls validateJSON() and then getValidationHash().
  4. The malicious object name is concatenated into an eval() call, executing arbitrary Perl code.

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 accepted a special JSON field called '_discriminator' without checking it properly. That field was later used in a Perl 'eval' function, which runs code, so an attacker could sneak in their own commands. Because no login was needed, anyone who could reach the interface could try to take over the device.

What is RCE?

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

More from Sophos

View all

The newest disclosed reports for this program.

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.