A critical finding by a reader of SANS ISC reveals that the seemingly benign online PHP obfuscation service, obfuscator[.]tools, has been injecting malicious code into user-submitted PHP scripts. This backdoor facilitates covert URL exfiltration and enables arbitrary file uploads, culminating in the deployment of webshells on affected servers.
How the Backdoor Operates: A Technical Breakdown
The obfuscator[.]tools website, when utilizing the “Legacy STT” method, prepends a sophisticated, obfuscated PHP backdoor to the user’s original code. While the obfuscation method itself involves a simple base64/gzip combination, the injected code is designed to evade casual detection, allowing the legitimate PHP functionality to appear undisturbed. Analysis of the deobfuscated code reveals two primary malicious functions:
- URL Exfiltration: The injected script captures the full URL of the page where the obfuscated code is deployed and transmits it via an HTTP POST request to
https://siyahi.top/ghost/. - Arbitrary File Upload: A backdoor file upload mechanism is introduced, activated by the presence of the
mrzURL parameter. Ifmrzis present, the script fetches content from afileURL parameter and attempts to save it locally asmrz.php. This allows an attacker to remotely upload and execute arbitrary PHP code.
The SANS ISC analyst successfully demonstrated this arbitrary file upload feature, leading to the deployment of an older PHP webshell attributed to “Solevible/Alfa-Team.” The command and control (C2) server, siyahi.top, initially appeared to be a compromised construction company website, potentially serving as a decoy to mask its malicious intent. The upload request originated from 54.38.58.236, identified as a known VPN endpoint.
Addressing the Threat: Detecting Malicious PHP Obfuscation
Organizations need to prioritize identifying instances where obfuscator[.]tools might have been used for code obfuscation. The risk of undetected webshells, leading to remote code execution and potential full data compromise, is substantial. Defenders seeking to detect malicious PHP obfuscation should perform thorough code reviews for files processed by this service.
Key indicators of the backdoor include:
- Unexpected
eval(gzinflate(base64_decode($stt1)))or similar constructs at the beginning of PHP files. - Outbound HTTP POST requests from web servers to
https://siyahi.top/ghost/. - The presence of the
mrz.phpfile or other unauthorized, newly created PHP files on the server, especially if triggered by URL parameters.
Manual deobfuscation, replacing eval with print for inspection, is an effective way to reveal the hidden code. Furthermore, logging and monitoring outbound network connections from web servers can help identify the C2 communication attempts.
Mitigation and Response for Backdoored PHP Code
Immediate action is required for any environment where PHP code has been processed by obfuscator[.]tools. Effective PHP webshell mitigation steps include:
- Code Audit: Systematically review all PHP application code that may have been obfuscated using
obfuscator[.]toolsfor the injected malicious snippets. - File Integrity Monitoring (FIM): Implement or enhance FIM solutions to detect unauthorized file creations or modifications on web servers, specifically looking for files like
mrz.php. - Network Segmentation and Egress Filtering: Restrict outbound network connections from web servers to only necessary services. This can help prevent successful C2 communication and data exfiltration.
- Web Application Firewall (WAF): Configure WAFs to detect and block suspicious URL parameters like
mrzthat could trigger the file upload functionality. - Incident Response: If a webshell is confirmed, follow established incident response procedures to isolate the compromised system, eradicate the malware, and restore from trusted backups.
By following these recommendations, security teams can significantly reduce their exposure to threats posed by compromised development tools and obfuscator[.]tools backdoor analysis findings.
Related: PEEP Backdoor Turns Browsers into OS Command Execution Tools, ClingSTUN Linux Backdoor Exploits Dozens of Flaws via STUN Protocol