Web PHP obfuscator quietly appends a backdoor to the code it returns

A reader flagged obfuscator[.]tools to SANS: the output keeps your original code, adds a call home and a file upload triggered by a URL parameter.

On this page
Close-up view of a green circuit board with components
Photo by Albert Stoynov on Unsplash

What happened

A reader, Patrick Scholing of DNSBunker.org, spotted a PHP obfuscation site that does more than obfuscate. The site is obfuscator[.]tools, and SANS Internet Storm Center wrote it up on Sunday, Nov 29th. Johannes B. Ullrich ran a short PHP snippet through it, picked the "Legacy STT" method, and got back something longer than what went in.

That alone isn't suspicious. Obfuscation usually inflates code. The problem is what the extra lines do.

The mechanism

The output is a base64/gzip wrapper around an eval. Ullrich swapped eval for print to see the payload without running it. Two things sit in there.

First, the code builds the full URL of the current page from the host and request URI, POSTs it as file_url to a hardcoded address, and decodes that address from base64. The decoded value is https://siyahi.top/ghost/. So every page that includes the obfuscated file reports itself back to that host.

Second, if the request carries a mrz parameter, the code fetches whatever URL is in a file parameter, base64-encodes the response, then writes it out as mrz.php. The script prints "File : mrz.php Success !" and exits. That's an arbitrary file upload reachable over HTTP, with no authentication in the snippet shown.

The original code stays at the end as the last line, so the file still behaves as expected. The site looks like it works. That's the part that makes this worth reading: the developer has no obvious reason to look further.

On the command host, Ullrich notes that siyahi.top appears to be a compromised construction company website, and that the default mailing address and boilerplate look like they could be a decoy to survive a quick glance. He also says he tried to seed the collection script with a specific URL to see whether a request came back, and about an hour later hadn't seen one. That's a single observation on a short window, not a measurement of how many sites are caught.

HackZoneLabs assessment

The interesting thing here isn't the payload. It's the trust boundary. Anyone reaching for a web obfuscator is already handling code they'd rather not show, and they're handing it to a stranger's server. Whatever comes back is now part of their application, and they can't read it, which is the whole point of the service. A backdoor added at that step is close to undetectable by the person who asked for the obfuscation.

In our view, the "Legacy STT" label is a detail worth keeping. It suggests the site offers several methods, and the write-up only shows what one of them returned. We wouldn't assume the others are clean, and we wouldn't assume they're dirty either. Nobody has published a broader sample.

We'd also treat the decoy theory as plausible but unproven. A compromised legitimate site and a purpose-built front can look the same from the outside, and the write-up doesn't settle which this is.

What remains unknown

The post doesn't say who runs obfuscator[.]tools, when the site went up, or how long the extra code has been in its output. It doesn't say whether the injected lines appear in every method or only some. There's no count of affected sites, and no evidence yet that the collection endpoint has received callbacks from real deployments.

Defensive priorities the evidence supports

If anyone on your team has run PHP through a third-party web obfuscator, pull the output and read it. The pattern to look for is a base64_decode of a URL string, a file_get_contents or stream_context_create call, and a file_put_contents writing a .php file. Ullrich's trick of replacing eval with print is the cheap way to see what a wrapper actually contains before it runs.

Check web logs for requests carrying an mrz parameter, and for outbound POSTs to siyahi.top. A file named mrz.php in a web root is worth explaining.

More generally, obfuscation you can't reverse isn't protection, it's a dependency on whoever produced it. If the code has to be hidden, hide it with something you run yourself.

Sources

  1. Backdoored PHP Obfuscator, (Sun, Nov 29th)Primaryisc.sans.edu

If something here is wrong, tell us. Every correction is listed on the corrections page.

Don’t Just Read About Cyberattacks. Learn How They Work.

Go beyond the headlines. Explore hands-on cybersecurity labs, understand real-world vulnerabilities, and build practical security skills with HackZoneLabs.

Start Learning