A vulnerability found in Apache HTTP Server (httpd) can cause certain systems to leak potentially sensitive data in response to HTTP OPTIONS requests, a researcher warned.
The flaw was discovered by freelance journalist and security researcher Hanno Böck, who has dubbed it “Optionsbleed.” Despite having a fancy name that is similar to the critical OpenSSL vulnerability known as Heartbleed due to them both “bleeding” memory contents, Optionsbleed is not as severe or as widespread.
Böck was analyzing HTTP methods in an effort to determine if they have any vulnerabilities when he noticed that requests with the OPTIONS method, which allows a client to ask a server which HTTP methods it supports, were returning what appeared to be corrupted data via the “Allow” header.
Typically, responses to OPTIONS requests should contain a list of supported HTTP methods in the Allow header (e.g. “Allow: GET, POST, OPTIONS, HEAD”). However, some of the responses to the researcher’s requests looked like this:
Allow: POST,OPTIONS,,HEAD,:09:44 GMT
Allow: GET,HEAD,OPTIONS,,HEAD,,HEAD,,HEAD,, HEAD,,HEAD,,HEAD,,HEAD,POST,,HEAD,, HEAD,!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”
Allow: GET,HEAD,OPTIONS,=write HTTP/1.0,HEAD,,HEAD,POST,,HEAD,TRACE
Further analysis revealed that Apache leaked server memory due to a use-after-free bug. The flaw, which could result in the exposure of sensitive data, has been assigned the CVE identifier CVE-2017-9798.
What makes the Optionsbleed flaw less severe is the fact that the targeted system needs to be configured in a certain way for an attack to work, and the response doesn’t always contain other data. Requests sent by the expert to the Alexa Top 1 Million websites resulted in corrupted Allow headers from only 466 of them.
Apache is one of the most widely used web servers. Data from Netcraft shows that Apache was used by roughly 40 percent of the top million most visited websites in August.
With help from Apache developer Jacob Champion, Böck determined that the flaw only affects specific configurations.
“Apache supports a configuration directive Limit that allows restricting access to certain HTTP methods to a specific user. And if one sets the Limit directive in an .htaccess file for an HTTP method that’s not globally registered in the server then the corruption happens,” the researcher explained. “Setting a Limit directive for any invalid HTTP method in an .htaccess file caused a use after free error in the construction of the Allow header which was also detectable with Address Sanitizer.”
While the security bug does not pose a risk for a majority of websites using Apache, it could represent a serious problem in shared hosting environments.
“The corruption is not limited to a single virtual host. One customer of a shared hosting provider could deliberately create an .htaccess file causing this corruption hoping to be able to extract secret data from other hosts on the same system,” Böck warned.
The expert pointed out that the leaks were evident in a paper on support for HTTP methods that was published in May 2014, roughly one month after Heartbleed came to light, but no one noticed the problem at the time.
Böck said the Apache security team could not provide an estimated date for when a patch would become available, so he decided to make his findings public before a fix was included in a new Apache httpd release. Optionsbleed can still be patched by making source code changes. Several Linux distributions have also started releasing fixes.