FreshTomato httpd unescape memory corruption vulnerability
The URL-decoding helper in FreshTomato's httpd assumes every percent sign is followed by two hex characters. A crafted HTTP request ending in a bare percent sign causes an out-of-bounds read and write, leading to memory corruption.
Originally disclosed on Cisco Talos
A memory corruption vulnerability exists in the httpd unescape functionality of FreshTomato 2022.1. A specially-crafted HTTP request can lead to memory corruption.
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 unescape routine does not validate that two characters follow a percent sign before shifting the string left, causing an out-of-bounds read and write.
Impact
An unauthenticated remote attacker could send a crafted request to corrupt memory, though the advisory's CVSS vector rates only integrity impact as low and no confidentiality or availability impact.
What the attacker needed
Network access to the router's httpd; no authentication needed
The fix
The vendor released a patch, and the decoder should be fixed to check that two characters follow a percent sign before decoding.
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.
Web servers often decode percent-encoded text in URLs, where a percent sign followed by two hex digits stands for one character. This firmware's decoder never checks that those two characters are actually present, so a request ending in a lone percent sign makes it read and write past the end of its buffer. That kind of out-of-bounds access can crash the router's web server or corrupt memory.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.