Targeting message transfer agents (MTAs), and mail delivery agents (MDAs), criminals are using Shellshock as a means to create botnets. The process is slow, but working, thanks to unpatched installations of Bash or certain implementations of it.

It didn't take long, days in fact, before criminals latched on to the issue. On September 27, researchers at FireEye released details on a number of proof-of-concept scripts related to Shellshock.

"We suspect bad actors may be conducting an initial dry run, in preparation for a real, potentially larger-scale attack. We believe it’s only a matter of time before attackers exploit the vulnerability to redirect users to malicious hosts, which can result in further compromise," FireEye wrote at the time.

How right they were. Among the findings from FireEye was a proof-of-concept script that created an IRC-based (Internet Relay Chat) botnet, capable of sending spam, initiating a DDoS attack, or performing remote command execution on the compromised host.

On Friday, CSO became aware of a Shellshock-based campaign targeting organizations in Europe and the United States. It spreads via email, using Shellshock exploitation code in the message header fields. If successful, it delivers a simple Perl script as the payload, which adds the host to a botnet commanded form IRC.

THE MESSAGE:

The Shellshock campaign targets mail servers, searching for vulnerable MTAs / MDAs. The messages themselves are blank, but the code needed to exploit the Shellshock vulnerability is placed into the message's headers.

The person(s) behind the spam blasts are including the following code in several message fields, including the "To:" field, "From:" field, "Subject" field, "Date:" field, "Message ID:" and others.

A sample of one of the email messages - complete with headers - is available here, thanks to Benjamin Sonntag, the co-founder of citizen advocacy group La Quadrature du Net.

THE SERVER:

The IRC server identified by CSO is just one of several. It's installed on a previously compromised Web server that exists on the OVH network, and is maintained by a French IT firm focusing network integration and information security.

While conducting research for this story, the person controlling the bots discovered us, and promptly issued a KLine, banning us from the server.

Given that the IRCd (IRC Daemon) exists on the compromised host and is accessed via Telnet (port 23); it's unlikely the firm is aware of the status of their server. CSO has contacted the IT firm, their web host, and OVH to report the matter.

NOTE:By the time this story went to press, none of those contacted had responded to the issue. The IRCd was off limits to us, but responded to pings. The domain serving the malicious payload was still active.

There is evidence of a second server, existing on a network in Germany, which hosted more than 600 bots earlier this month. The connection between this earlier server and the recently discovered server in France is the IRCd, network naming conventions, and the fact that the same people managed both (based on login details).

The following IP addresses have been linked to incidents leveraging Shellshock as an attack vector.

62.193.210.216

178.254.31.165

190.94.251.41

87.118.84.123

These addresses either hosted a malicious IRC network, or were used to deliver malicious payloads. In the attack examples seen by CSO, the host was called by IP directly over HTTP (port 80) via cURL. If a domain is used to resolve the host's IP, the attackers tend to use free services, such as rima.tde.net.

In addition to checking the server logs for the aforementioned IP addresses, administrators should also check to see if any unknown scripts are running on the server. The bots in this campaign are all managed by a Perl script, which will contain strings in its code that are easily found in a grep of the /tmp directory:

Legend Bot [2011]

Legend IRC [2010]

legend.rocks

@admins=("god","ARZ","Zax");

"Installing Mocks please wait"

THE SCRIPT

The script that powers the botnet behind this recent campaign is called Legend, and it has existed for several years now. The Legend script is simplistic, but effective once installed on a system. It isn't designed to be clandestine, so it's often discovered during a scan of running processes, TMP directories, or network traffic.

With Legend, a compromised host can be called upon to do a number of things, including open a reverse shell, send spam, initiate a DDoS attack, scan a network with NMAP, or conduct basic Denial of Service via HTTP, TCP, UDP, or SQL. The script can also reveal sensitive information about the host, or turn it into a proxy.

Once installed, Legend will connect the compromised host to a pre-configured IRC server, where the attacker can issue commands individually or as a group. CSO has seen evidence of two Legend scripts circulating online. The source code for the first script, seen in late September and early October, is available here. The second, more recent script can be viewed here.

Depending on how it is configured, Sendmail is vulnerable. This is especially true for web scripts that call Sendmail. One example of such a script is sendmail-wrapper, which logs and throttles email sent by PHP. It was patched against Shellshock shortly after it was disclosed.

Above all else, the most important mitigation step is patching Bash to ensure that systems are updated with the latest version. All major vendors and Linux distributions have released patches against Shellshock, including Red Hat, IBM, Juniper, Cisco, Debian, Ubuntu, VMware, McAfee, and HP.

This story, "Report: Criminals Use Shellshock Against Mail Servers to Build Botnet" was originally published by
CSO.