FreshTomato httpd logs/view.cgi OS command injection vulnerability
The FreshTomato httpd logs/view.cgi endpoint fails to properly sanitise the 'find' parameter, allowing an attacker to inject arbitrary OS commands. An authenticated attacker can send a crafted HTTP request to execute commands on the router.
Originally disclosed on Cisco Talos
An OS command injection vulnerability exists in the httpd logs/view.cgi functionality of FreshTomato 2022.5. A specially crafted HTTP request can lead to arbitrary command execution.
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 'find' parameter is only partially escaped (backslashes added before some characters) but not sufficiently to prevent command injection when passed to a shell command via popen.
Impact
An authenticated attacker could execute arbitrary commands on the router, leading to full compromise.
What the attacker needed
Authenticated access to the web interface
The fix
The vendor released a patch on 2022-11-08.
How it was found
- Authenticate to the FreshTomato web interface.
- Send an HTTP request to logs/view.cgi with a crafted 'find' parameter containing shell metacharacters.
- The server executes the injected command and returns the output.
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.
This router's web interface has a log-viewing feature that takes a search term from the user and passes it to a system command without cleaning it properly. An attacker who can log in can include special characters that make the system run extra commands of their choosing, giving them control over the router.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.