FreshTomato httpd update.cgi directory traversal vulnerability
The update.cgi endpoint in FreshTomato's httpd allows an attacker to read arbitrary files by supplying a crafted filename to the notice API, which is used without sanitisation to build a file path. An authenticated attacker can exploit this to read any file on the device.
Originally disclosed on Cisco Talos
A directory traversal vulnerability exists in the httpd update.cgi functionality of FreshTomato 2022.5. A specially crafted HTTP request can lead to arbitrary file read.
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 filename parameter passed to the notice API is used directly to build a file path without any sanitisation, allowing directory traversal.
Impact
An authenticated attacker could read arbitrary files on the device, potentially exposing sensitive information.
What the attacker needed
Authentication to the router's web interface
The fix
The vendor released a patch, but the text does not describe the fix details.
How it was found
- Send an HTTP request to update.cgi with the exec parameter set to 'notice'.
- Include an argument that contains a path traversal sequence to point outside /var/notice.
- The server reads the file and returns its contents.
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 feature that reads a file from a fixed folder and shows its contents. The code that builds the file path does not check for special characters like '../', which let you climb out of that folder. So someone who can log in to the router can trick it into reading any file on the device, such as password files.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.