GoAhead Developers Fix Null Byte Injection Vulnerability in Embedded Web Server

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 may result in the delivery of an incorrect file with a truncated filename,” one reads. security advisory on GitHub document 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.

“Unlikely configuration”

The fault was discovered by Luc Rindel, an infosec master’s student at Carnegie Mellon University, during a PlaidCTF 2021 challenge earlier this month that involved manipulating the values ​​of IoT cameras and sensors.

“The vulnerability abuses the mismatch between the route extension scan and the decoded filename to trick GoAhead into believing that a file should be sent to the JST [JavaScript Template] manager even if it has an incorrect extension, ”says Rindels The daily sip.

“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 reached XSS via a CSP bypass, it was done, he conceded, “using a highly personalized and unlikely setup.”

With the correct incorrect device configurations and the “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 uploads to a directory that also allows JST templates to run” and a JST template must be uploaded “to a file in the upload 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.

Patching, attenuation

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 have file uploads in a directory that allows content to be served and JST templates to be processed ”.

Seller says Go ahead is the world’s most popular embedded web server, hosting “dynamic embedded web applications via an event-driven single-threaded kernel” in medical devices, network equipment, and factory automation systems, 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: Clickless Zoom feat among winners as payout record in full swing

Source link

Comments are closed.