Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

[Honeypot Alert] PHP-CGI Vuln Targeted For Database Dumping

Thanks to my SpiderLabs Research colleague @claudijd for collaborating with this analysis.

In a previous blog post, we highlighted how the PHP-CGI vulnerability is actively being targeted by attackers. Attackers often have the same set of goals or outcomes for their attacks (botnet recruitment, exfiltration of user data, etc...) but the specific attack vectors are "hot swapable." They simply monitor for new vulnerabilities and then try to use the same attacks against the new vectors. In this blog post, we will highlight an interesting attack that leveraged the PHP-CGI vulnerability.

PHP-CGI Attack Payload

On Friday, our web-based honeypots picked up the following attack targeting the PHP-CGI vulnerability:

10993_a359ea55-b871-4720-b4bf-faa3f4f10665
The php "-dauto_prepend_file" argument levarages the PHP-CGI vulnerablity and tells the php program to download the code on the remote site and execute it before any local code. In this case, the "versions.txt" file on the remote hacker site contains the following php code:

11027_a4caa0e8-714a-4731-95db-903b150a7985
This code will take the POST parameter "d" payload and loop though it 100 characters at a time and convert it into the following php code:

12553_ee7a2277-184c-44f1-9b73-3c9fbe794bd7

The initial section of code can be decoded to the following:

11357_b50b997f-79ac-48f3-91b3-acd4401eb1db
This will essentially take the data sent within the POST parameter "p1", execute it and then format the data for the html response. This section of code is taken from larger webshell/backdoors that we have captured from our web honeypots.

Sypex Dumper

When this php code executes, the resulting output includes something similar to this:

[..[..[SypexDumper/cfg.php?w7373t=1]..]..]

Sypex Dumper is described as:

Sypex Dumper is a PHP-script, which can help you create a backup (dump) of a MySQL database, and also restore the database from the backup if needed.

It contains the cfg.php file we saw referenced in the output above and here are the default configuration contents:

9099_4a2e305c-19c5-4501-85ba-083574a49fdf

As you can see, this is a configuration for the DB backup process. In this case, the attackers are of course initiating illegal backups or data dumps. During our web honeypot research, we have identified examples of other sites being compromised and even found SQL database dump files of successful exfiltration using similar tools.

We highly recommend that sites review their SQL database configuration to verify that default username/passwords and access permissions have been updated.

Latest SpiderLabs Blogs

Cloudy with a Chance of Hackers: Protecting Critical Cloud Workloads

If you've been following along with David's posts, you'll have noticed a structure to the topics: Part I: The Plan, Part II: The Execution and now we move into Part III: Security Operations. Things...

Read More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update

Trustwave is proactively assessing and monitoring our clients who may have been impacted by CrowdStrike’s recently rolled-out update for its Windows users. The critical issue identified with...

Read More

Using AWS Secrets Manager and Lambda Function to Store, Rotate and Secure Keys

When working with Amazon Web Services (AWS), we often find that various AWS services need to store and manage secrets. AWS Secrets Manager is the go-to solution for this. It's a centralized service...

Read More