Jump to content
Nytro

PHP Infector

Recommended Posts

Posted

[h=1]PHP Infector[/h]

Posted on October 12, 2013 by darryl

A reader wanted me to analyze a PHP file that was found on his hacked WordPress site. The script is made up of three parts as you can see.

724x751x20131012_01.png.pagespeed.ic.2YFdzl0Zpx.png

The top two sections contain an array of Base64-encoded strings. The bottom section references the arrays and performs the main functions.

My first thought was to replace each of the array variables with the actual decoded strings. Then I could read the script at the bottom and figure out what it’s doing. But replacing each of the variable names with the values from the array manually would be a pain! (Anyone got a better idea? If so, let me know.)

Whenever I come across a problem, I try to find a generic solution that I can keep using in the future. Here’s what I came up with…

First I take each of the top two sections and separate the encoded values by rows. So I take this:

803x256x20131012_02.png.pagespeed.ic.GD7jInb5Uh.png

And use search/replace to make it look like this:

387x494x20131012_03.png.pagespeed.ic.yvb0ZUgo5Y.png

Then I modified Converter to base64-decode each row separately:

548x440x20131012_04.png.pagespeed.ic.9XsX-O1oOz.png

Then I replaced each row with a pipe delimiter (since it wasn’t being used anywhere):

736x112x20131012_05.png.pagespeed.ic.Qpdk7n0uA8.png

I did the same for the second section:

740x150x20131012_06.png.pagespeed.ic.Fp-AA4N8q0.png

I wrote a program that does a search and replace of the array values. I entered the search string that corresponded to the top section and pasted in the decoded strings with the pipe delimiter to get the result.

699x609x20131012_07.png.pagespeed.ic.r3FsRGsTyE.png

The second section was next.

701x609x20131012_08.png.pagespeed.ic.iv9B7yRfkl.png

All done! This script probably won’t execute properly because some of the strings need to be quoted but at least you can get a much better idea of what’s going on.

805x611x20131012_09.png.pagespeed.ic._G9wGnAIen.png

Basically this downloads a file from a website, gets the URL and visits it. It essentially serves up a drive-by link to unsuspecting visitors.

935x99x20131012_10.png.pagespeed.ic.SGaR3Cslb5.png

The iframe link is the landing page of Sweet Orange. The link changes every couple of minutes or so.

I’ll need to think about this more and see if there’s another generic solution. If not, I’ll add this method to Converter in the future.

Sursa: PHP Infector | Kahu Security

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...