Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Our web honeypots picked up some interesting attack traffic. The initial web application attack vector (PHP-CGI vulnerability) is not new, the malware payload is. We wanted to get this information out to the community quickly due to the following combined threat elements -
Update - Another security researcher has also seen similar activity in his ModSecurity honeypots back on August 26. Some of the tactics have changed but the core of the attack seems the same.
We have already discussed the initial PHP-CGI vuln attack/exploit vector in a previous blog post. What is interesting in these attacks are the actual tools installed if the attack is successful. Here is the initial screen shot of the attack payloads taken from the ModSecurity audit log file on the honeypot:
We cross referenced this attack with our own IDS alerts from Trustwave MSS team and have seen a definite increase in scanning activity for the inital web application attack vector (PHP-CGI) within the last month:
Keep in mind that exploit vectors and payloads are separate ecosystems. They are often interchanged with each other. For example, we often see new PHP command injection vectors used within botnet code that execute or install the same backend malware code. The initial URL encoded data in the QUERY_STRING decodes to:
The final "auto_prepend_file=php://input -a" data tells php to take the info from the POST payload and append it to any existing code and execute it. If we look at the complete PHP code in the request body, we see that there are actually 2 different variables that contain base64 encoded data.
This data is then later decoded and places into temp files and then executed.
What are these files? If we base64 decode the variable data, we can see that they are in fact ELF binaries that are packed with UPX -
Here is some quick static analysis -
The files are essentially the same, however one is 32-bit and one is 64-bit. The attacker isn't even bothering with checking the web server OS version... they are just trying to execute both to see which one might work. Checking this file over on VirusTotal shows that only 4 AV vendor currently detects this file as malicious:
Note - We have internally verified that Trustwave AV does detect this file as malicious.
The file contains many clear text URLs that have been associated with Botnet C&C activity:
srv5050.co
ka3ek.com
ircqfrum.com
8rb.su
Once we see the IRC botnet code, we get a clearer idea of what we are dealing with here:
There are many IRC commands here. IRC botnet code installs are nothing earth-shatteringly new however most of the variants we capture are written in Perl, PHP, etc... This one is binary C code. One interesting tactical note - the destination IRC port on these C&C servers is 53. This is a smart move from the attacker's perspective as DMZ network firewalls may allow web servers to initiate outbound DNS queries.
Additionally, we see the highlighted section of code which seems to identify this code as: BoSSaBoTv2. After some searching, we were able to find that this code is actively being sold on underground forums. Here are some example screenshots:
Notice some of these features including bundling a Bitcoin Miner program. This is interesting as this shows another aspect how an attacker is looking to abuse their access to a compromised web server. They can siphon off local system resources such as CPU and RAM in attempts to create Bitcoins. Here are some of the commands for downloading and running the Bitcoin miner -
We also see on the hacker forum that this malware is for sale at affordable prices:
We wanted to get this information out to the community quickly due to the following combined threat elements -
Here are a few defensive steps:
All too often, we see weak or non-existent egress firewall rules. As an example of why you need them - during our research, we saw the IRC botnet master send down commands to have the malware update itself by downloading a new version -
If you can block outbound connections from your web servers to 3rd party hosts, you can significantly help to reduce an attacker's ability to expand their breach.
Our honeypots picked this up due to alerts from our ModSecurity WAF rules. The Trustwave WAF also detects these attacks. Not only will this give you some base protections, but it also provides better logging vs. standard web server log files. Speaking of web server log files....
Review your web server log files to see if you have been receiving these initial PHP-CCI attacks.
Pay close attention to the HTTP Response Status Codes. Anything other than a 404 - Not Found could indicate trouble.
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.