Sophos UTM Preauth RCE: A Deep Dive into CVE-2020-25223
An unauthenticated remote command execution vulnerability existed in Sophos UTM's WebAdmin interface because user-supplied session ID was passed to Perl's open() function, allowing command injection. An attacker could exploit this to execute arbitrary commands as root, but a web server input filter initially blocked the payload; bypassing it via an alternate endpoint achieved RCE.
atredis.com
Published on atredis.com
Note: Sophos fixed this issue in September 2020. Information about patch availability is in their security advisory.
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 user-controlled SID value was passed directly to Perl's open() function without sanitisation, enabling command injection.
What the attacker needed
Network access to the webadmin interface; vulnerable Sophos UTM version
The fix
The vulnerability was fixed by adding a check in the switch_session subroutine to ensure the SID contains only alphanumeric characters.
How it was found
- Send an HTTP POST request to /webadmin.plx with a malicious SID value containing a command injection payload.
- Observe that the input filter replaces the payload, preventing execution.
- Discover that the /var endpoint maps to the same handler but bypasses the filter.
- Send the same malicious request to /var instead of /webadmin.plx.
- The command executes as root, creating a file.
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.
This is a bug in a security appliance's web interface. The web server took a value from the user (the session ID) and used it in a way that let an attacker run system commands. The attacker could then take full control of the device as the root user.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.