views:

409

answers:

2

I came across the following exploit due to a warning from my AV software. It originated from an adserver delivering banner ads on one of my sites.

I have retrieved the content with Wget and copied to pastebin.

http://pastebin.com/m6fa38fac
[Warning: Link may contain malware - Do not visit from vulnerable PC.]

Please note that you have to scroll horizontally on pastebin as the code is all on one line.

Can anyone find out what the exploit actually does?

Thank you.

+9  A: 

Not quite, as it includes (the equivalent of):

var mtime= new Date(document.lastModified).toUTCString().split(' ')[4].split(':');

it then uses the minutes and seconds of the last-modified time of the document containing it as a key to decode the array. If you can't still retrieve that javascript:alert(document.lastModified) time we'd have to brute-force it.

ETA: ah, actually it only uses the first digit of the minutes, and from the way it uses it we can guess it's supposed to be 1. That's leaves only sixty possibilities, and a quick loop reveals that meaningful javascript only comes out for 16 seconds.

I've put the decoded script here; it will probably also ping your anti-virus. Summary: it runs exploits against the Java, Flash and Acrobat plugins, running a payload from googleservice.net which is (surprise surprise) a Russian attack site.

bobince
Is there some kind of tool or library that could be used to parse it first and then simply output the resulting code?
mr-euro
@mr-euro: please break the URL in this comment and the other one eg. by losing the http. In comments, URLs are auto-linked, and unlike the pastebin link this really is a link to a live exploit!
bobince
So is this really only affecting people with obsolete versions of Java, Acrobat and Flash plugins? All browsers too?
mr-euro
Correct, the URI revealed in the AV software in question is exactly: googleservice.net/info/news.php (usually with some GUID as the query string).
mr-euro
Yes. Plugins are the #1 exploit target at the moment: browsers typically check themselves for updates, plugins less so, so they're very often out of date. Acrobat is a particularly bad offender because people don't realise they're getting a plug-in when they install a PDF reader application. Note that the exploits served from these sites often depend on the User-Agent string passed in; if you'd downloaded that script from IE you might have got different results.
bobince
+3  A: 

This ussualy works to print de-obfuscated code

eval = alert;

in firefox with firebug, i solved it like this:

var lpsy16=lpsy;
eval = console.log; // This line was added
eval(lpsy+parseInt(gouy[0]));

Output is here: --deleted due to zoidberg's comment--

yedpodtrzitko
Can you elaborate on how to actually do that? Where would that be inserted?
mr-euro
I wouldn't post the URL, last thing we want is google spiders picking up Stackoverflow linking to exploit sites!
Zoidberg