GHSL-2023-025: Drive-by command injection in SRS's api-server - CVE-2023-34105
The SRS api-server's /api/v1/snapshots endpoint takes a JSON body and uses the app value to build a shell command without sanitisation. An attacker could send a crafted POST request to execute arbitrary commands on the server.
Originally disclosed on GitHub Security Lab
The api-server server is vulnerable to command injection. An attacker may send a request to the /api/v1/snapshots endpoint containing any commands to be executed as part of the body of the POST request.
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 application builds a shell command by interpolating untrusted user input (the app field) without sanitisation, then executes it with /bin/bash -c.
Impact
This issue may lead to Remote Code Execution (RCE).
What the attacker needed
Network access to the api-server; ability to send POST requests
The fix
The issue was fixed in versions v5.0.157 and v6.0.48.
How it was found
- Send a POST request to /api/v1/snapshots with a JSON body containing a crafted app value.
- The server unmarshals the body and calls sw.Create with the untrusted data.
- The Create method builds an RTMP URL using the app value and starts a snapshot job.
- The job interpolates the URL into a shell command and executes it with /bin/bash -c, running the injected commands.
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 server takes a value from a web request and puts it directly into a command that it runs on the operating system. Because it does not check or clean that value, someone can include extra shell commands and the server will run them. This lets an attacker run their own code on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.