Synology SRM SafeAccess 1.2.1-0220 code execution Vvulnerability
The SafeAccess package on Synology SRM builds an SQL query by inserting the user-supplied domain parameter without escaping, allowing SQL injection. An attacker can send a crafted HTTP request to execute arbitrary SQL, and because the web server runs as root, this can lead to code execution.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the SafeAccess 1.2.1-0220 package of Synology SRM 1.2.3 RT2600ac 8017-5. A specially crafted domain access request can lead to an SQL injection.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The domain parameter is inserted into an SQL query without escaping or parameterisation.
Impact
An attacker could execute arbitrary code on the device because the httpd server runs as root; the proof-of-concept also shows session cookie theft via stored XSS.
What the attacker needed
SafeAccess package installed; attacker on local network; victim (admin) views logs/profiles
How it was found
- Send an HTTP GET request to /cgi/request.cgi with a crafted domain parameter containing SQL injection.
- The request.cgi binary passes the domain to the logging library, which builds an SQL query.
- The query is executed by SQLite::Database::exec, allowing stacked queries.
- Use the SQL injection to attach another database and update a profile name with malicious JavaScript.
- When an administrator views the SafeAccess logs or profiles, the injected script executes and can steal the session cookie.
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.
The router's SafeAccess feature logs requests to visit blocked websites. It puts the website name directly into a database command without cleaning it first. This lets an attacker sneak in extra database commands, and since the web server runs with high privileges, they could take over the device.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.