r/PHPhelp • u/Avalonn42 • Mar 24 '25
Is this php file safe?
Hello,
A complete newbie here and I'm afraid I don't know much about PHP, but I thought that I might find the answer to my question in this group.
Recently I was contacted by an advertising agency that offers a decent amount of money if I place their banner on my high traffic blog.
However, they also require that I place a PHP file in the root domain of my server. That PHP file is called adblock1.php and it is supposed to block the ad blockers (browser plugins that block ads - if I understand them correctly).
Could someone please just go through the code of this file and see if it is safe? And whether it indeed does only what it purports to do, i.e. block adblockers, without putting my server and its contents at risk?
This is the content of that file:
Thanks in advance!
8
u/martinbean Mar 24 '25
Only a shady agency wanting a backdoor to your server would ask you to put files on your server.
8
u/far2 Mar 24 '25
Don't install that, it's just one big backdoor.
For example:
That string, 'twzs_ush_qcbhsbhg', gets run through a caesar cypher and comes out as "file_get_contents". It's hiding the fact that it's gonna read (and almost definitely write) files on your server.
Block whoever asked you to install it.
7
u/[deleted] Mar 24 '25
No, it looks like the build_query_vars_from_query_block function could write files to your server, which could then be used to do whatever php can do. It looks very much like a backdoor.
1
u/NickstaDB Mar 25 '25
Who asked you to upload this?
4
u/YahenP Mar 24 '25
This is WordPress. Such, if I may say so, crap is considered the norm.
Yes. There is a backdoor in this code. Or rather, two. One was made deliberately. And the second was created by accident - simply because this is crap code. I think the author of this creation is not even aware of the second.
Drive this "agency" to hell. And it's not even about the backdoor. These are just some schoolchildren looking for suckers whose site they can ruin.
2
u/Jackson_Polack_ Mar 24 '25
It's a malicious script and the reason you can't read the code is because it's obfuscated. It's trying to hide the fact it's executing remote code.
2
u/john_mohl Mar 25 '25
Uses part of the code of an outdated WP plugin (https://wordpress.org/plugins/pro-adblock/) and mixes it with malicious code.
3
u/No_Astronomer9508 Mar 24 '25
PHP ist server side.Html and Adblocker ist client side.PHP can generate HTML and send it to the client, but can not read client side code.Only with Javascript which runs client side too, you can scan for Adblocker.The PHP looks like a backdoor in my opinion.
2
u/MateusAzevedo Mar 24 '25
In my opinion it's odd they want you to add a file to your site instead of installing a Wordpress plugin.
I don't have experience with Wordpress to have a decent understanding of what this files is doing, so I'd recommend asking in /r/wordpress and ask if this is a common practice. People there will have more experience, including with anti ad-blockers plugins.
0
u/Striking-Bat5897 Mar 24 '25
It's wordpress ? Then no :P