r/PHPhelp • u/SnapSnapGrinGrin • Jul 23 '26
Unobsfucating a PHP script
Attackers leveraging the wp2shell exploit added about 22k of obsfucated PHP to index.php on a site I've been asked to have a look at.
Labels and function names are ten random characters and control path is done by jumping to TrQ7yZISyM: etc and there seem to be a lot of (unnecessary?) jumps.
What's the best way to unobsfucate it?
0
Upvotes
4
u/Evening_Leather5101 Jul 23 '26
You check out the last version from GIT. There is no good way to unobfuscate it if you don't know how it was obfuscated.
13
u/martinbean Jul 23 '26
What is the value in unobfuscating it? You just need to remove affected files, and patch the exploit to stop whatever bot/bad actor immediately re-pwning your site.
3
u/Sejiko Jul 23 '26
If you curios throw it at ai they are good for such things...
1
u/pyxsoft 12d ago
https://www.pyxsoft.com/tools/php-deobfuscator
Deobfuscates most php files
1
u/Takeoded Jul 24 '26
OpenAI Codex CLI should do a great job of unobfuscating it.
Would you mind sharing the code?
1
u/peperinna Jul 24 '26
Lo primero es hacer un backup.
Segundo, instalar wordpress sobreescribiendo los archivos, y revisar permisos chmod.
Actualizar plugins y themes.
En experiencia, mejor hacer todo esto a mano, desde ftp. Algunos scripts interceptan las actualizaciones automáticas y secuestran los módulos, entonces el problema sigue.
Habla con el web hosting, pide que configuren WAF y inmunify, con las reglas para wordpress.
Configura Cloudflare, ayuda bastante.
Monitorea 48hs.
Importante: es importante y útil utilizar github, para el backups, para una copia de cada etapa de las que hablé. Ahí podrás ver de forma masiva y fácil las diferencias entre archivos, cada cambio.
Si no se resuelve, avisa aquí de nuevo.