Exploitation requires additional vulnerability or device misconfiguration
UPDATE Embedthis fixed a null byte injection vulnerability in GoAhead, the embedded web server deployed in hundreds of millions of devices.
“A specially crafted URL with an embedded character before the extension can result in an incorrect file with a truncated filename serving,” read a security advisory on GitHub documenting the bug.
Quoting the hypothetical URL https://example.com/example%00.html, the notice states that “the is decoded to be NULL”, causing the file manager to serve as “example” instead of ” example.html ”.
As a result, “remote attackers could access documents whose names are strict subsets of longer valid URLs.”
The advisory nonetheless describes the severity of the bug as “low” because “an exploit requires [either] additional vulnerability via downloaded malicious files ”or device configuration errors.
The fault was discovered by Luc Rindel, infosec master’s student at Carnegie Mellon University, during a 2021 PlaidCTF challenge earlier this month that involved manipulating the values of the camera and IoT sensor.
“GoAhead should only send .html files to the JST manager, but the vulnerability allows any file to be sent to the JST manager.”
While Rindels achieved XSS via a CSP bypass, it was done, he conceded, “using a highly personalized and unlikely setup.”
With the correct incorrect device configurations and ‘combined vulnerabilities required – this could cause a DoS or [an attacker to] take unwanted control of the device, ”said Michael O’Brien, CEO and founder of Embedthis. The daily sip.
Obstacles to exploitation
However, real-world exploitation appears to be an unlikely scenario.
The server must be misconfigured to “allow file downloads to a directory that can also run JST templates” and a JST template must be uploaded “to a file in the download directory of the same base name without the extension, ”before the file is served with it, O’Brien explains.
But “if an attacker can modify the configuration of the route, he already has access to the whole server and documents anyway”.
Keep up to date with the latest infosec research news
Additionally, the vulnerability “requires that a file with the same base name without an extension be present.” i.e. ‘example’ and example.html. Needless to say, most device manufacturers don’t and [it] It would be rather strange to do it on purpose.
JST expressions are also device-specific, he adds, so source code access is likely required as well.
Find the loophole
While looking for evidence of an incorrect extension analysis during CTF, Rindels realized that “the request URL must have been decoded, otherwise it couldn’t call with and delimiters,” Rindels says in a blog post published yesterday (April 26).
He suspected that a null byte exploit would fail, perhaps because “dangerous URL encodings like” would not be allowed or decoded, resulting in an error or an “attempt to serve.”
Alternatively, he speculated, “if the is decoded, in an extension request will simply be cut. There will be no overtime and GoAhead will attempt to serve.”
Undeterred, he downloaded a snapshot with the name containing, issued a request for, “and to my amazement the nuncio was there!”
Incidentally, the exploit failed to secure the CTF flag because Chrome blocks “URL encoded null bytes” but could pave the way for Rindels’ very first CVE.
Embedthis fixed the vulnerability in GoAhead versions 4.1.4 and 5.1.2. Version 2.2 is not affected.
Embedthis “responded very quickly,” correcting the flaw on April 5, four days after it was reported, Rindels said.
In addition to applying the update, O’Brien urges users to avoid serving JST templates “from directories that do not overlap with download directories.” You should NEVER upload files to a directory that allows content to be served and JST models to be processed ”.
Vendor Says GoAhead is the World’s Most Popular Embedded Web Server, Hosting “Dynamic Embedded Web Applications Through a Single-Threaded, Event-Driven Kernel” in medical devices, network equipment and automation systems factory, among other devices.
This article was updated on April 28 with comments from Embedthis CEO Michael O’Brien.
DON’T FORGET TO READ Pwn2Own 2021: Zoom exploit without click among winners as payout record was broken