A remotely exploitable vulnerability has been discovered in bash on Linux. The vulnerability has the CVE identifier CVE-2014-6271. The major attack vectors that have been identified in this case are HTTP requests and CGI scripts. Another attack surface is OpenSSH through the use of AcceptEnv variables. Also through TERM and SSH_ORIGINAL_COMMAND. An environmental variable with an arbitrary name can carry a nefarious function which can enable network exploitation.
A typical attack goes via the User-Agent string, because that one can contain spaces without the need to do URL encoding. Take a look at the following request which exploits this bug.
GET /script.sh HTTP/1.0 Host: localhost User-Agent: () { ignored; }; echo -e "Content-Type: text/plain\r\n\r"; /usr/bin/id
Although any HTTP header can be used to exploit this bug, my guess is that many exploit scripts will use common headers like User-Agent and Referer. You can use this to block the attack in Hiawatha via the following configuration.
UrlTookit { ToolkitID = block_bash_exploit Header User-Agent \(\)\s*\{ DenyAccess Header Referer \(\)\s*\{ DenyAccess }
The next version of Hiawatha will accept a wildcard for the Header option, which allows you to check all HTTP headers for the pattern. This will completely block the exploit.
I don't agree with the statement that this is 'the next heartbleed'. I don't think that many people use bash these days for their websites. And if a shell script is present on a webserver, it's often that /bin/sh is being used which can also point to other shells like dash.
P.S.
My previous claim that this bug can't be exploited via Hiawatha turned out to be false. I focused too much on the URL and forgot about other possible attack vectors.
I updated this post with the latest logs. Looks like I was right about the User-Agent and Referer header.
curl -A '() { :; }; echo; echo vulnerable; exit' http://localhost/test.cgi
curl -e '() { :; }; echo; echo vulnerable; exit' http://localhost/test.cgi
Are you stating above that currently Hiawatha is currently vulnerable and needs immediate patching
OR
Are you saying that people are trying to breach but Hiawatha is still secure but that you are surprise of other attack surfaces.
Cheers,
md
This will be exported via the HTTP_X_EXPLOIT variable.
Should those run php-fpm be concerned? Or ONLY CGI people?
So, unless you enabled Hiawatha to allow the execution of CGI scripts via CGIextension or CGIhandler and a bash script is available in one of your websites, you have nothing to worry about.
You Sir, Are a scholar and a gentleman....
Thanks for continued efforts of the super lightweight Hiawatha!