InHand Networks InRouter302 httpd upload.cgi file write vulnerability
The upload.cgi API in InHand Networks InRouter302 fails to properly sanitise the uploaded filename, allowing path traversal, and does not delete the temporary file if the 'type' parameter is omitted. An attacker could upload or overwrite any writable file on the device.
Originally disclosed on Cisco Talos
A file write vulnerability exists in the httpd upload.cgi functionality of InHand Networks InRouter302 V3.5.4. A specially-crafted HTTP request can lead to arbitrary file upload.
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
Likely the filename from the multipart request is used directly in a file path without sanitisation, and the temporary file is only deleted when a valid 'type' parameter is provided.
Impact
An attacker could upload and/or overwrite any writable file on the device, potentially leading to further compromise.
What the attacker needed
Authenticated access to the web interface
The fix
The vendor has released a patch; the report does not detail the fix, but it should sanitise filenames and always delete temporary files.
How it was found
- Log in to the router's web interface.
- Send a POST request to upload.cgi with a multipart form containing a file and a filename that includes path traversal sequences.
- Omit the 'type' parameter so the temporary file is not deleted.
- The uploaded file is written to an arbitrary writable location on the device.
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 file upload feature takes the filename from the user and saves it to a temporary folder without checking for '..' sequences, so an attacker can use a filename like '../../etc/passwd' to write files outside that folder. Also, if the upload type is missing, the temporary file is never deleted, leaving malicious files on the system. This lets an attacker replace important files and take control of the device.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.