<?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>The Cover of Night</title>
	<atom:link href="http://www.thecoverofnight.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.thecoverofnight.com/blog</link>
	<description>Exploiting and Explaining Security for the People</description>
	<lastBuildDate>Wed, 25 Aug 2010 03:05:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Note to self, interesting stuff</title>
		<link>http://www.thecoverofnight.com/blog/?p=359</link>
		<comments>http://www.thecoverofnight.com/blog/?p=359#comments</comments>
		<pubDate>Wed, 25 Aug 2010 03:05:28 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=359</guid>
		<description><![CDATA[Just some links I accumulated for class to share with the students. Not complete but its good enough. [Web Sites] https://blog.mandiant.com/ &#8212; Mandiant http://www.cyberwart.com/blog/ &#8212; Matt Wollenweber http://www.gnucitizen.org/categories/blog/ &#8212; Dont know this guy, but interesting stuff no less http://www.openrce.org/articles/ &#8212; OpenRCE (Reversing) http://blog.rapid7.com/ &#8212; Rapid7 http://dontstuffbeansupyournose.com/ &#8212; S7ephen and Lawler http://carnal0wnage.attackresearch.com/ &#8212; attackresearch.com http://www.offensivecomputing.net/ &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>Just some links I accumulated for class to share with the students.  Not complete but its good enough.</p>
<p>[Web Sites]<br />
https://blog.mandiant.com/ &#8212; Mandiant<br />
http://www.cyberwart.com/blog/ &#8212; Matt Wollenweber<br />
http://www.gnucitizen.org/categories/blog/ &#8212; Dont know this guy, but interesting stuff no less<br />
http://www.openrce.org/articles/ &#8212; OpenRCE (Reversing)<br />
http://blog.rapid7.com/ &#8212; Rapid7<br />
http://dontstuffbeansupyournose.com/ &#8212; S7ephen and Lawler<br />
http://carnal0wnage.attackresearch.com/ &#8212; attackresearch.com<br />
http://www.offensivecomputing.net/ &#8212; Malware, Malware, Malware, and very good posts supporting analysis<br />
http://ha.ckers.org/ &#8212; RSnake, CEO of SecTheory (Web Security)<br />
http://jeremiahgrossman.blogspot.com/, &#8212; Jerimiah Grossman, CEO of White Hat (Web Security)<br />
http://blog.zynamics.com/ &#8212; Zynamics, Reverse Engineering and Malware Profiling<br />
http://intrepidusgroup.com/insight/ &#8212; Intrepidus, Mobile Security<br />
http://threatpost.com/en_us/blog-list &#8212; Collection of Security News and Posts<br />
http://phed.org/ &#8212; Mike Eddington, Creator of Peach Fuzz<br />
http://dvlabs.tippingpoint.com/blog/ &#8212; Tipping Point DVL and ZDI, good reversing posts<br />
http://codypierce.com/ &#8212; Previously at TP<br />
http://www.avertlabs.com/research/blog/ &#8212; McAfee<br />
https://mattoh.wordpress.com/ &#8212; Matt Oh Creator of Darun Grim<br />
http://trailofbits.com/ &#8212; Dino Dai Zovi, Mac Hacker<br />
http://www.phreedom.org/ &#8212; Alex Sotirov, One of the Guys who helped break SSL<br />
http://strydehax.blogspot.com/ &#8212; Stryde Hax, Good demonstration of security skills to  benefit society<br />
http://www.honeynet.org/ &#8212; Honeynet Research Alliance<br />
http://www.praetorian.com/blog/ &#8212; Praetorian<br />
http://sunbeltblog.blogspot.com/ &#8212; SunBelt Software<br />
http://fishbowl.pastiche.org/ &#8212; Charlie Miller, the Guy who hacked the IPhone, a few times<br />
http://schmoil.blogspot.com/ &#8212; Another Guy who has helped beat down SSL CA&#8217;s<br />
http://contagiodump.blogspot.com/ &#8212; Mila, Cool place to get custom, under the radar malware<br />
http://research.pandasecurity.com/ &#8212; Another cool place to see malware torn apart<br />
http://www.inreverse.net/ &#8212; Yet a better place to see the malware torn apart</p>
<p>[Mailinglist]<br />
DailyDave Mailing List &#8212; Dave Aitel&#8217;s Daily Dave (Sometimes interesting things get debated here, sometimes interesting ppl get insulted&#8230;fun to watch.)</p>
<p>[Twitter]<br />
Twitter is also a good place to see whats going on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=359</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Note to myself, setting up Ether</title>
		<link>http://www.thecoverofnight.com/blog/?p=354</link>
		<comments>http://www.thecoverofnight.com/blog/?p=354#comments</comments>
		<pubDate>Wed, 25 Aug 2010 02:57:02 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=354</guid>
		<description><![CDATA[Sorry, I have not posted in a while been busy&#8230;. For those of you who don&#8217;t know, I went back to school. In the past few months, I have been actively entertained by work, writing code, writing a presentation, and publishing said results. Then I rolled off work into school, and now I am a [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry, I have not posted in a while been busy&#8230;.  For those of you who don&#8217;t know, I went back to school.  In the past few months, I have been actively entertained by work, writing code, writing a presentation, and publishing said results.  Then I rolled off work into school, and now I am a TA&#8230;Funny how life works.  I have decided to start looking at Hypervisors, because thats what every one does when they are bored right?!?</p>
<p>Yeah, well, I do.  I decided to install Ether so here are some quick notes to myself.</p>
<p><strong>Getting ramped up with Ether.</strong></p>
<p>Step 1 ) Install Debian Lenny.<br />
Step 2 ) Update /etc/apt/sources<br />
Step 3 ) add self to sudoers, <code>sudo apt-get install gcc g++ make vim emacs linux-headers-2.6-amd64-all screen openssh-server linux-image-2.6.26-2-xen-amd64 wget gcc-4.1</code><br />
Step 4 ) <code>wget http://www.offensivecomputing.net/ether/ether-0.1.deb # thank you Offensive Computing guys, huge life saver</code><br />
Step 5 ) <code>dpkg -i ether-0.1.deb</code><br />
Step 6 ) Enter Bios, turn on VT # blast you joanna and your pills<br />
Step 7 ) Reboot, make sure grub, menu.lst set itself up right<br />
Step 8 ) Installing Nvidia drivers for Xen: <code>export IGNORE_XEN_PRESENCE=1 # now run install package, http://www.nvnews.net/vbulletin/showthread.php?p=1710997</code><br />
Step 9 ) Be proud, thy coud be nursingg an ulcer due to 2 weeks of work stacked with a lightning strike induced service failure.<br />
Step 10) start working on the real work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=354</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HAHA Meeting Preso: My Rapid Toolsmithing Process</title>
		<link>http://www.thecoverofnight.com/blog/?p=346</link>
		<comments>http://www.thecoverofnight.com/blog/?p=346#comments</comments>
		<pubDate>Thu, 15 Apr 2010 18:27:17 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[ASIO]]></category>
		<category><![CDATA[Boost]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[HAHA]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=346</guid>
		<description><![CDATA[Last night was the third meeting of HAHA!, and it went very well. There were several presentations and good times held by all. I spoke to my prototyping process when it comes to writing tools and developing software. I basically discussed the start to finish process I go through when I want to write a [...]]]></description>
			<content:encoded><![CDATA[<p>Last night was the third meeting of HAHA!, and it went very well.  There were several presentations and good times held by all.  I spoke to my prototyping process when it comes to writing tools and developing software.  I basically discussed the start to finish process I go through when I want to write a tool, and then how I integrate previous work and code into my development so that I can save time and focus on my tasks.  I used a case study of some multi-threaded software that I had been working on for the past 2.5 weeks.  </p>
<p>Additionally, I found a bug in the business logic of the &#8220;free wireless&#8221; registration process.  Basically, a user can register with spoofed email and info, and the application will give the user 10 minutes to complete registration by going to their email and confirming the account.  Well, there is an option that resends the email, and consequently resets the timer, giving the user 10 more minutes to check their email.  This means the application does not track the number of resends, nor does it prevent an infinite number of resends.  Thus, with ten lines of Python, the user won&#8217;t ever have to register while they are using the &#8220;free wireless&#8221; (-:</p>
<p>Anyway, for those interested, here are the slides.</p>
<p><a href="http://thecoverofnight.com/presentations/rapid_prototyping.pdf">Rapid Prototyping Tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=346</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The First Step of Rapid Tool Smithing</title>
		<link>http://www.thecoverofnight.com/blog/?p=319</link>
		<comments>http://www.thecoverofnight.com/blog/?p=319#comments</comments>
		<pubDate>Fri, 02 Apr 2010 20:07:10 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[toolsmithing]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=319</guid>
		<description><![CDATA[So I have not been to productive in a traditional sense over the last few months. I have been excercising my C++ development skills and spending a few weeks prototyping tools, based on interest and needs. Only knowledge has been the real product of my work. I have been focusing and learning a about how [...]]]></description>
			<content:encoded><![CDATA[<p>So I have not been to productive in a traditional sense over the last few months.  I have been excercising my C++ development skills and spending a few weeks prototyping tools, based on interest and needs.  Only knowledge has been the real product of my work.  I have been focusing and learning a about how to perform rapid prototyping along with learning to augment functionality from other open sources of code.</p>
<p>Research is a slippery slope and it is hard to quantify a rate of return.  This goes for any type of research in any industry.  The idea is that to be novel, you must invest time and effort, so identifying as many shortcuts as possible is a valuable skill.  For instance, if I want to implement a DNS scanner, I don&#8217;t want to rewrite the entire DNS protocol, nor do I want write the network code, threading, etc.  I want to leverage existing sources and frameworks for those elements.  Additionally, programming languages should be seriously considered.  In this case, I am looking at C++, however, higher level programming languages such Python or Ruby could serve most beneficial in a very rapid PoC environment.  This post will detail some of the preliminary decisions that a researcher may encounter and then give an overview into how to work through various vague compilation and linker errors, showing the time savings from short cuts.<br />
<span id="more-319"></span><br />
First, what I generally do determine which language will be most convenient.  Higher level languages are very easy to prototype in, and there are a number of libraries, modules, and frameworks.  However, the level of control and platform speed will dictate whether these languages can be used.  For example if I am looking for functionality versus performance, I would use Python over C/C++, and this decision may even be tied to the available resources such as source code.  </p>
<p>In this case I chose C++, because I want to achieve performance gains, so now I need to track down sources or projects.  After a quick search for DNS projects, Bind appeared to dominate a majority of the results.  So, I decided to start by reviewing the Bind projects capabilities.  After I downloaded the latest branch, I reviewed the code looked at what I knew would be important to me.  As it turns out the code base was fairly complete, however, the branch was not made to compile in Visual Studio, yet.</p>
<p>This is one of those forks in the road.  Do I stick with what I have, derive something, or build something from scratch?  This question should always be first and foremost in your mind, and with experience it gets easier to answer.  There are a number of complexities that may arise ranging from programming language eccentrities, platform capabilities, functional needs, development time, along with a myriad of other variables, and with each project, the experience and knowledge accumulates, which allows someone to follow that path of least resistance to meet the next milestone.  </p>
<p>Before I continue on, I want to stress why I chose the Bind 10 development branch.  Ready, it was the path of least resistance.  If you review development and compilation docs for Bind 9, it requires alot of dependencies which means lots more effort.  Bind 10 requires Boost Libraries for cpp, which is relatively easy to download and install, or at the very least compile.  Note: If you are using Visual Studio 2010 Beta, you need to compile from source, and this is actually very easy if you follow the instructions on the tutorial.  Once I found Bind 10, I developed a sort of tunnel vision, so I did not seek out any other candidate projects, and in this process, time is precious and a resource you can not waste.</p>
<p>Continuing on to the next battle in rapid tool smithing.  The desired functionality was in the DNS and Exception source directories, so I copied the libs directory, added the required VS filters, and then the source files in those filters. Now, I write my main file, include the message.h, compile, and fail.</p>
<p>The first reason I failed was because there are some missing source code files that needed to be generated from a script and inclusions for <strong>&#8220;config.h&#8221;</strong> which is an artifact of the auto configuration process.  To address the missing source files, I used intuition.  I am not quite sure how, but I ended up looking at one file in particular, <strong>&#8220;gen-rdatacode.py&#8221;</strong>.  Basically, I peeked at the file, renamed it to a python script, tried to run it, and failed again.  No problem, I read over the file and realized it was relying on the auto configuration process, so I just went through and updated all auto generation tags (e.g. <strong>&#8220;@src@&#8221;</strong> with <strong>&#8220;.\&#8221;</strong>).  Then I ran the script, encountered some minor fails, but persisted and got the &#8220;real&#8221; missing source files generated.  I also commented out all the <strong>&#8216;#include &#8220;config.h&#8221;&#8216;</strong> requirements in other source files, followed by updating the project&#8217;s source files.</p>
<p>Ok, time to compile again, now I found some inconsistencies in the <strong>inet_pton</strong> and the <strong>inet_ntop</strong>, which are declared in *nix headers, which are not present on Windows (without cygwin). So, I just added the WinTcpIp.h include and added some preprocessor logic, to jump over the *nix includes.  I also got errors that the <strong>inet_ntop</strong> and <strong>inet_pton</strong> are not defined, which was an indicator that I needed to turn off the Unicode compilation for the project, after which I attempted another compile.  Note that <strong>inet_ntop</strong> and <strong>inet_pton</strong> are part of the ANSI specification, thus if Unicode is enabled, the two functions are not defined.</p>
<p>After this I compiled and got one of the most obscure errors ever:<br />
<code>cannot convert from 'std::_Tree_const_iterator&lt;_Mytree&gt;' to 'std::_Tree_const_iterator&lt;_Mytree&gt;' c:\code\fiercplusplus\fiercplusplus\src\lib\dns\messagerenderer.cc 262</code></p>
<p>Then I looked at the issue much more closely:<br />
<code>1&gt;          while trying to match the argument list '(std::_Tree_const_iterator&lt;_Mytree&gt;, std::_Tree_const_iterator&lt;_Mytree&gt;)'<br />
1&gt;          with<br />
1&gt;          [<br />
1&gt;              _Mytree=std::_Tree_val&lt;std::_Tset_traits&lt;isc::dns::`anonymous-namespace'::NameCompressNode,isc::dns::`anonymous-namespace'::NameCompare,std::allocator&lt;isc::dns::`anonymous-namespace'::NameCompressNode&gt;,false&gt;&gt;<br />
1&gt;          ]<br />
1&gt;          and<br />
1&gt;          [<br />
1&gt;              _Mytree=std::_Tree_val&lt;std::_Tset_traits&lt;isc::dns::`anonymous-namespace'::NameCompressNode,std::less&lt;isc::dns::`anonymous-namespace'::NameCompressNode&gt;,std::allocator&lt;isc::dns::`anonymous-namespace'::NameCompressNode&gt;,false&gt;&gt;<br />
1&gt;          ]</code></p>
<p>Someone with a sharp eye will notice that the top description includes <strong>&#8220;std::less&lt;isc::dns::`anonymous-namespace&#8217;&#8221;</strong> and the bottom type description does not look like the top one.  As it turns out, the default template declaration uses the <strong>std::less&lt;T&gt;</strong> to make the comparison, rather than the <strong>struct NameCompare</strong> which what should be used to make the comparison, thus the ambiguity of <strong>&#8216;std::_Tree_const_iterator&lt;_Mytree&gt;&#8217; to &#8216;std::_Tree_const_iterator&lt;_Mytree&gt;&#8217;</strong> melts away.  The error is simply fixed by changing the definition/declaration in the following manner:<br />
<code>from:  std::set&lt;NameCompressNode&gt;::const_iterator notfound = impl_-&gt;nodeset_.end();<br />
to:     std::set&lt;NameCompressNode, NameCompare&gt;::const_iterator notfound = impl_-&gt;nodeset_.end();</code></p>
<p>This issue alone took me about 1-2 hours to resolve.  Googling was less than helpful, and this is the reason the resolution took so long.  Contrary to popular belief Topeka, does not have all the answers.  So, stepping back from the problem is sometimes the best way to step closer to the problem.</p>
<p>Much closer to compiling now.  Now we are getting linker errors, which means we are very close.  The errors I encountered are linker ones, where symbols cannot be identified.  The issue was initially perplexing, because the code is part of the project sources and not an external lib.  So, I go back and review yet another vague linker warning, <strong>&#8220;warning LNK4042: object specified more than once; extras ignored	Debug\objs\exceptions.obj&#8221;</strong>.  The warning is very explicit and tells me what happened, meaning two files will compile to the same object filename.  What does not make sense, the filename collision (e.g. exceptions.cc) happens with two files in different directories.  The warning and MSDN description does not give me no direction about how to resolve this issue.  I actually used a life line, and asked a friend, who helped me identify the solution.  Essentially, I had to update the intermediate output directory for the source files.  The solution was found on <a href="http://stackoverflow.com/questions/1999150/is-it-possible-to-have-identically-named-source-files-in-one-visual-studio-c-pr">stack overflow</a>, and my Topekaing skills did not come up with any results that detailed this process.  <strong>Special Thanks to Rudolph Araujo for helping out on that one.</strong></p>
<p>After working through all that in about 5-6 hours, there is an immediate realization of time savings versus if I had had been ambitious and tried to develop and test my own stuff from scratch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=319</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keeping Old School Tactics Current: Google, Telnet, and Echo FTW</title>
		<link>http://www.thecoverofnight.com/blog/?p=291</link>
		<comments>http://www.thecoverofnight.com/blog/?p=291#comments</comments>
		<pubDate>Tue, 02 Feb 2010 20:59:17 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[exploitation]]></category>
		<category><![CDATA[Hacking Tool]]></category>
		<category><![CDATA[Software Security]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=291</guid>
		<description><![CDATA[This is the second part in a two part blog.  In the initial installment, I illustrated how vague configuration settings and default and hardcoded credentials could lead to tragedy.  In this installment, I will show you that tragedy.  Armed with a dash of Google, a hearty helping of telnet, and a smidgin of echo along [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second part in a two part blog.  In the initial installment, I illustrated how vague configuration settings and default and hardcoded credentials could lead to tragedy.  In this installment, I will show you that tragedy.  Armed with a dash of Google, a hearty helping of <strong>telnet</strong>, and a smidgin of <strong>echo</strong> along with some <strong>LUA </strong>trickery, I was able to roll through a misconfigured installation of FreeSWITCH.</p>
<p><span id="more-291"></span></p>
<p>As I mentioned in my initial post, this scenario was blackbox, meaning zero knowledge of the device and configuration.  My approach here is simple.  First, I plug the device in to the network, and then perform <strong>nmap</strong> to identify any interesting ports or communication channels.  When Nmap completed the port scan, I noted standard ports 80 (http) and 53 (DNS), but then I noticed some other ports such as 8021.  I actually chose to dig deeper into the purpose of 8021, which meant I needed to probe it with a socket.</p>
<p>Generally, connecting to and probing sockets can be done with tools such as <strong>netcat</strong> or <strong>socat</strong>, I usually opt to use IPython, a nice Python Command Interface and use a basic socket.  In this case, I basically connected to the port and received whatever data was sent.  In this case, I received an interesting message, seen below in the image.</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 431px"><img class="  " title="IPython Connecting to Server Port 8021" src="http://www.thecoverofnight.com/img/freeswitch/python_initial_connect0.png" alt="" width="421" height="238" /><p class="wp-caption-text">Using IPython to connect to port 8021 and identify the service.</p></div>
</div>
<p>My initial assertion was that this was a strange HTTP header, but given the vague context, I turned to Google.   I used the following search query “port 8021 Content-type auth/request”, which in turn gives FreeSWITCH.  After a few minutes of quickly reviewing the results and documentation, I found that FreeSWITCH has a default password, <strong>ClueCon </strong>and a command interface.</p>
<p>From here, I downloaded the source, compiled a sample client, and then I connected to FreeSWITCH.  Generally, I enjoy adventure and discovery, so rather than read the documentation to see that there was a <strong>system</strong> command in the interface, I stumbled on to it.  Whenever I am presented with a command interface, I like to play around with the commands and look at the help I am presented with either from error messages or from help menus.</p>
<p>Once I found the <strong>system</strong> command, my initial reaction was to perform commands such as <strong>whoami</strong>, <strong>ps</strong>, <strong>pwd</strong>, <strong>cd</strong>, etc., but when I executed the command with the aforementioned commands as arguments, I received no result.  Filled with a little frustration, I decided to try <strong>ping</strong> against my host and that frustration melted away and turned into school girl giddiness (yay!).</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 676px"><img class=" " title="OS Command Execution with FreeSWITCH" src="http://www.thecoverofnight.com/img/freeswitch/re_os_system_ping.png" alt="" width="666" height="315" /><p class="wp-caption-text">OS ping command is executing via FreeSWITCH.  Note the ARP for 172.*.*.2</p></div>
</div>
<p>My next thought from here was if I can <strong>ping</strong>, can I <strong>telnet</strong>?  Yes, yes, I can.  After this finding, it only took me a few minutes to figure out how to redirect <strong>stderr</strong> and <strong>stdout</strong> to a listening port on my host.</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 492px"><img class="         " title="Telnet, Echo, PIPES, yaa~ay yay!" src="http://www.thecoverofnight.com/img/freeswitch/command_execution0.png" alt="" width="482" height="197" /><p class="wp-caption-text">Piping OS command output and errors through telnet to my host.</p></div>
</div>
<p>At this point, I simply opened a port open on my machine, and telnet’ed command results back to host.  Once I had command access on the device, the first check was to identify my privileges, which turned out to be <strong>root</strong>.</p>
<p>After this moment, the game changed significantly.  First, the client I had to use was great, but it was not an attacker’s client.  So rather than playing fairly, I created my own rules and in the process my own client.  I basically wrote a command shell that wrapped FreeSWITCH command with <strong>telnet</strong> and <strong>echo</strong> to execute, write, or read the files from the remote host.  <strong>Game on.</strong></p>
<p>After I finished my basic client, I went through and enumerated file mounts, directory structures, and executables on the system.  My next step was to look at binaries and see what they could offer in the form of intelligence and stuff like that, but there were no tools on the host to perform these tasks, and a knowledgeable person would observe that <strong>telnet</strong> and <strong>echo</strong> are not ideal for moving <em>binary</em> files back and forth across the network, so I surveyed the host for any viable interpreters and shell functionality.  I tried several shell ninja hacks, but no progress was made.</p>
<p>Then I found a LUA interpreter, and the game got more fun.  In order to support binary file transfers, I simply converted the binary file to ACII hex strings, and then I could transfer the binaries using my established methods.  Again, I augmented my attacker’s shell.  <strong>Game on.</strong></p>
<p>While I was on the device, I also identified several block devices of interested that I wanted to pull data from.  To access these data points, I used <strong>dd if=&lt;device&gt; of=/dev/null bs=1</strong> to get the devices size.  Then performed <strong>dd</strong> into a writeable temporary file, hexlified the data, and sent it across the network.  I repeated this process until I reached the size of the file.  <strong>Game Over! </strong></p>
<p>Below is an image of my FreeSWITCH attacker client.  Its hacker quality code, so mileage will vary.  Also below are a few of the LUA scripts that I used to facilitate the file transfer and hexlification process.</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 622px"><img class=" " title="Ye, Olde Attacker Command Interface" src="http://www.thecoverofnight.com/img/freeswitch/freeswitch_attackclient0.png" alt="" width="612" height="192" /><p class="wp-caption-text">Attack client developed to facilitate the 0wning of the FreeSWITCH installation.</p></div>
</div>
<p><strong>Show me some codez:</strong></p>
<p>FreeSWITCH Command interface:  <a href="http://www.thecoverofnight.com/projects/code/freeswitch/cmd_interface.py">cmd_interface.py</a></p>
<p>Hexlified Image Capture Server:  <a href="http://www.thecoverofnight.com/projects/code/freeswitch/mini_image_cap_server.py">mini_image_cap_server.py</a></p>
<p>(Un)Hexlify LUA Script:  <a href="http://www.thecoverofnight.com/projects/code/freeswitch/hexlify.lua">hexlify.lua</a></p>
<p>DD to Hexlify to Echo to Telnet Madness:  <a href="http://www.thecoverofnight.com/projects/code/freeswitch/dd_remote.lua">dd_remote.lua</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=291</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Hardcoded, Insecure Defaults can Lead to Problems</title>
		<link>http://www.thecoverofnight.com/blog/?p=269</link>
		<comments>http://www.thecoverofnight.com/blog/?p=269#comments</comments>
		<pubDate>Tue, 02 Feb 2010 20:39:31 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[default password]]></category>
		<category><![CDATA[Information Security]]></category>
		<category><![CDATA[misconfiguration]]></category>
		<category><![CDATA[secure-by-default]]></category>
		<category><![CDATA[Software Security]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=269</guid>
		<description><![CDATA[A few weeks ago I was playing with a blackbox, and I found several problems that cascaded, giving me command execution as root. Since the issue impact open source software and my research was free, I decided to provide a two part analysis of illustrating my research. In this post, I want to illustrate some [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I was playing with a blackbox, and I found several problems that cascaded, giving me command execution as <strong>root</strong>.  Since the issue impact open source software and my research was free, I decided to provide a two part analysis of illustrating my research.  In this post, I want to illustrate some how hardcoded default configuration settings can inhibit security.  The second part to this post will look at the how I identified the issue on the blackbox and successfully exploited the issue.<br />
<span id="more-269"></span></p>
<p>First of all, default passwords among elements are often common place in the open source world.  This post is focused on showing why these defaults can be bad.  The thesis is simple:</p>
<ul>
<li><strong>Developers:</strong> Always make the user change the password after installation.  </li>
<li><strong>Administrators and users:</strong> Always change the default password if the service offers authentication of some type </li>
</ul>
<p>Now lets examine the issue that was discovered.  Take a look at the following image captured from a configuration and source code file of the 1.04 branch of FreeSWITCH.  Try to understand what the code is doing based on the limited context you are presented.</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 625px"><img alt="" src="http://www.thecoverofnight.com/img/freeswitch/freeswitch_default_creds.png" title="Service Defaults for the Socket Event Module" width="615" height="528" /><p class="wp-caption-text">Service defaults for mod_event_socket found in the config (top) and source (bottom) files.</p></div>
</div>
<p><strong>Do you See What I See?</strong><br />
After examining these excerpts, the reader should be able to discern 2 things.  First, by default the password is ClueCon and listens on the 127.0.0.1 as shown in the configuration file.  The other observation that should be noted is the default password and default listening IP address are hardcoded.  This fact can be insinuated, because if the result of switch_strlen_zero  is TRUE then these default values are used instead, respectively.  This means that if configuration file is missing the required element, it will be replaced by the default.  In a way, this means the module will always be listening, rather than failing.  Unless the administrator is aware of these security implications, they are not likely to give these issues a second glance, hence my posts.    </p>
<p><strong>Why is this bad?</strong><br />
The default password in every configuration will be ClueCon unless it is changed.  If the password is not set, then it is still going to be ClueCon.  </p>
<p><strong>But wait doesn’t this run on 127.0.0.1, which is not even accessible from the Internet?</strong><br />
Yes, that is correct, but this fact can lead to a false sense of security, which leads to the next issue at hand.</p>
<p>Apart from the default credentials, there is a command module (mod_commands) that provides a command interface to FreeSWITCH that is also enabled by default.  This command interface provides ways to manage calls, service settings, and the best part, execute OS commands.  So, if a local or network user knows the password, they can access the interface and execute commands as the FreeSWITCH service user, which could be bad.  </p>
<p><strong>How bad?</strong><br />
If FreeSWITCH is running as root, then a local user can run OS commands as <strong>root</strong> which will escalate into something much worse, like this for <a href="http://tinyurl.com/2g9mqh">example</a>.  In the next post, I will discuss the details of how I leveraged this issue to get <strong>root</strong> command access.  (hehe.)</p>
<p><strong>Ok &#8220;Mr. Rock&#8217;in Rick Roller&#8221;, what do you recommend for a mitigation or some kind of remediation?</strong><br />
There are several ways of reducing the likelihood of the issue.  The easiest method is to change the password in the configuration file.  When an administrator sets the password, they should not use any passwords that are used on any other systems, because the password is sent to the remote service in the clear and unencrypted.  If the module is not needed, simply disable it by commenting out or removing the mod_event_socket from the modules.xml in the FreeSWITCH conf directory.  Another course of action is to disable mod_commands if they are not needed.  Unfortunately, I have not had time to sit down and identify the most reasonable security settings for FreeSWITCH, but these seem like the most feasible at the moment</p>
<p>For long-term mitigation, I would suggest removing default credentials from the configuration file, and causing the application to fail closed when credentials and password are not set in the configuration.  Additionally, an error message should be printed to the log or console informing the service administrator of the issue.  This behavior would have more secure side effects than simply setting the hardcoded credentials.</p>
<p><strong> What is justification for releasing this in the public and why did you not contact the developer?</strong><br />
Yeah, I am sure one way or another this will come up one way or another in my future.  I notified the developer, but the conclusion of that communication was this issue is the responsibility of the user or administrator.  They felt there were adequate protections in place to prevent the problem.  </p>
<p>This blog post and the next will serve as an education tool for those administrators or users who may not be aware of the potential ease of misconfiguring their installations of FreeSWITCH.  Additionally, this work was free, so I am donating my effort to the open source community as a means of understanding the security implications brought on by a lack of prevention (<em>e.g.</em> <em>secure-by-default</em>) and bad default configuration practices.  Remember security is only as strong as the weakest link.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=269</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>12 Years ago today&#8230;.</title>
		<link>http://www.thecoverofnight.com/blog/?p=312</link>
		<comments>http://www.thecoverofnight.com/blog/?p=312#comments</comments>
		<pubDate>Tue, 02 Feb 2010 20:34:13 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=312</guid>
		<description><![CDATA[So this is just one of those brief moments of emotion. 12 years ago today, I signed up for the Army as an infantry soldier. While my time in service was very brief, the moments and experience will last a life time. It is probably one of the single most important decisions in my life. [...]]]></description>
			<content:encoded><![CDATA[<p>So this is just one of those brief moments of emotion.  </p>
<p>12 years ago today, I signed up for the Army as an infantry soldier.  While my time in service was very brief, the moments and experience will last a life time.  It is probably one of the single most important decisions in my life.  </p>
<p>A special thanks goes out to all those who have served, are serving, are committed to serve, and those who have given their lives.  Most importantly, I would like to say THANK YOU to all those who support service members and have had to endure the loss of a friend, family member, and loved one.      </p>
<p>gr33tz.</p>
<p>~dsoftware</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=312</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing with ARM Binaries: Mapping Relocations to Function Names</title>
		<link>http://www.thecoverofnight.com/blog/?p=259</link>
		<comments>http://www.thecoverofnight.com/blog/?p=259#comments</comments>
		<pubDate>Tue, 02 Feb 2010 04:26:07 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[binary analysis]]></category>
		<category><![CDATA[Code Analysis]]></category>
		<category><![CDATA[ELF]]></category>
		<category><![CDATA[IDA Pro]]></category>
		<category><![CDATA[ida python]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=259</guid>
		<description><![CDATA[Playing with ARM binaries in IDA Pro I have been expanding my view of the world, and I decided to play with some ARM ELF binaries, but I ran into a problem with relocations, symbols, and the corresponding function strings being properly matched in IDA Pro.  Below is a method I used on 2 binaries [...]]]></description>
			<content:encoded><![CDATA[<p>Playing with ARM binaries in IDA Pro</p>
<p>I have been expanding my view of the world, and I decided to play with some ARM ELF binaries, but I ran into a problem with relocations, symbols, and the corresponding function strings being properly matched in IDA Pro.  Below is a method I used on 2 binaries (yes, testing is a hardcore part of my diet) in order to get the function name relocated and named correctly on the PLT entries and the corresponding functions.</p>
<p><span id="more-259"></span></p>
<p>In order to address this problem, I had to do several things:</p>
<ol>
<li>Import the ELF definitions into IDA Pro</li>
<li>Read ELF standard and ARM ELF Format</li>
<li>Parse the ARM ELF and Identify the Dynamic Section from the Program Header</li>
<li>Identify the String Table, the Symbol Table, the Program Linkage Table, and Relocations</li>
<li>Merge the Symbol Table Data and Relocation Address Information</li>
<li>Name each corresponding sub routine name with the value in the</li>
</ol>
<p>I actually worked on 1 and 2 for some time.  In order for me to grasp all the indirection, I used IDA Pro to create the various sections, and I would just jump around to the values being referenced or cross referenced.  It was not the most optimal method, but when it all clicked, it only took me a few hours to put together the Python Script.</p>
<p>Below are the first steps.  First edit the elf.h from any *nix system.  Some commenting may be required, because IDA may complain about missing header files or types with the same names.  Thy must sweat and grunt alittle to get some respect.  This is left a character building exercise for the reader.  Next, open the &#8220;Local Types&#8221; subview,  select all the types, right click, and &#8220;Synchronize to idb&#8221;.</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 636px"><img title="Importing ELF Header" src="http://www.thecoverofnight.com/img/arm_relocs/import_elf_header.png" alt="" width="626" height="256" /><p class="wp-caption-text">Importing ELF C-Header into IDA Pro</p></div></p>
<div class="wp-caption alignnone" style="width: 796px"><img title="Synchronize the Local Types with IDB" src="http://www.thecoverofnight.com/img/arm_relocs/sync_idb.png" alt="" width="786" height="460" /><p class="wp-caption-text">Synchronize the Local Types with IDB</p></div>
</div>
<p>Run the script, and it prompts you for the starting address of the file.  I recommend you scroll all the way up to the top of the file, put the cursor on the very first address, and just enter <strong>ScreenEA()</strong>. But to each his or her own.</p>
<p>Now for the functionality of the script.  The biggest challenge was wrapping ye old mind around the relocations and seeing how the names were magically resolved.  Once I realized this third dimension of reference, everything came together like a Vulcan Mind Meld….and I was one with the binary.</p>
<p>The script works by creating the ELF <strong>Ehdr</strong> at the beginning of the file, and then reads the Dwords of the offset to the corresponding <strong>Phdr</strong>s.  From there, I jump to the Phdr address and create the Phdr structures.  If the Phdr structure is <strong>PT_DYNAMIC</strong>, I note the section size jump to that section and create all the <strong>Dyn</strong> structures until I reach end of memory.  After I create all the <strong>Dyn</strong> stuctures, I jump to the <strong>DT_STRTAB</strong> use MakeStr on all the strings up to the <strong>DT_STRSZ</strong>.  After this, I jump back to the <strong>PT_DYNAMIC</strong> section and then process the symbol table, <strong>DT_SYMTAB</strong> converting all the relocations and the symbol table simultaneously.  The relocations include the <strong>DT_REL</strong> and <strong>DT_JMPREL</strong> respectively and they have a corresponding size, <strong>DT_RELSZ</strong> and <strong>DT_PLTRELSZ</strong>.  I also find the <strong>DT_SYMTAB</strong> and the <strong>DT_STRTAB</strong> values and then process the relocations.</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 922px"><img title="DYNAMIC Segment with Processed Dyn Structures" src="http://www.thecoverofnight.com/img/arm_relocs/ida_elf_parsing_kinda.png" alt="DYNAMIC Segment with Processed Dyn Structures" width="912" height="542" /><p class="wp-caption-text">DYNAMIC Segment with processed Dyn structures</p></div></p>
</div>
<p>The relocations are processed in the following manner.  First I create the relocation structures up to the  <strong>DT_PLTRELSZ </strong>or <strong>DT_RELSZ</strong> bytes.  Then I walk through the relocations structures and read its symbol table index.  I create a <strong>Sym</strong> structure at that location, and then get the symbols name (<strong>st_name</strong>) index into the string table.  From here I just rename the symbol, the relocation, and the actual function that corresponds to the function call that will jump to the relocation.  Below is an image depicting my final result and below that is a link to the code.</p>
<div align="center">
<div class="wp-caption alignnone" style="width: 1031px"><img title="Imports named (left) and function names (far-right)" src="http://www.thecoverofnight.com/img/arm_relocs/jmp_table_entry.png" alt="" width="1021" height="188" /><p class="wp-caption-text">Imports named (left) and function names (far-right)</p></div>
</div>
<p>IDA Pro code for processing the ARM Elf Binary: <a href="http://www.thecoverofnight.com/projects/code/elf_processing/ida_pro_process_elf_hdrs.py">ida_pro_process_elf_hdrs.py</a><br />
IDA Pro code for processing the Elf Relocs Section: <a href="http://www.thecoverofnight.com/projects/code/elf_processing/ida_pro_process_reloc.py">ida_pro_process_reloc.py</a><br />
IDA Pro code for processing the Elf Sym Section: <a href="http://www.thecoverofnight.com/projects/code/elf_processing/ida_pro_process_sym.py">ida_pro_process_reloc.py</a></p>
<p>For those interested information on the ELF Specification: <a href="http://en.wikipedia.org/wiki/Executable_and_Linkable_Format"> Wikipedia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=259</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reversing the Plague Bot, will the Real Snipa Please Stand-up</title>
		<link>http://www.thecoverofnight.com/blog/?p=214</link>
		<comments>http://www.thecoverofnight.com/blog/?p=214#comments</comments>
		<pubDate>Wed, 20 Jan 2010 22:11:31 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[IDA Pro]]></category>
		<category><![CDATA[Immunity Debuger]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[phun]]></category>
		<category><![CDATA[plague]]></category>
		<category><![CDATA[snipa]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=214</guid>
		<description><![CDATA[Since Friday, I have been having fun reverse engineering this piece of malware called Plague bot. Overall the bot has the typical suite of functionality including the MSN spreader, USB infector, DDoSer, SSyn along with download and updating capabilities. The initial binary was encrypted/obfuscated using a VB 6.0 compiled program. This wraps the binary in [...]]]></description>
			<content:encoded><![CDATA[<p><strong> Since Friday, I have been having fun reverse engineering</strong> this piece of malware called Plague bot.  Overall the bot has the typical suite of functionality including the MSN spreader, USB infector, DDoSer, SSyn along with download and updating capabilities.   The initial binary was encrypted/obfuscated using a VB 6.0 compiled program. This wraps the binary in a VB virtual machine – effectively hiding the true binary. This fact was apparent because very few strings were visible and the binary itself imported the MSVBVM60.dll.  Because of the P-Code wrapping, initial static analysis provided little use. Therefore we used dynamic  reversing extract the binary.</p>
<p><span id="more-214"></span></p>
<p><strong> </strong></p>
<div align="center">
<div class="wp-caption alignnone" style="width: 563px"><img title="MSVBVM60 Dll Imports" src="http://www.thecoverofnight.com/img/plague/triage_binary_0.png" alt="" width="553" height="458" /><p class="wp-caption-text">Image shows imports for VB Virtual Machine.</p></div></p>
</div>
<p><strong> </strong></p>
<p><strong>Extracting the binary</strong> was accomplished by placing a breakpoint on the CreateProcess and waiting for the process to call itself.  I attempted to dump the binary after it was executing, using the <a href="https://www.openrce.org/blog/view/1135/Basic_tutorial_about_how_to_dump_a_process_and_update_the_IAT_using_Immunity_Debug,_LordPE,_and_ImpRec">instructions here</a>.  This failed to give me a usable binary, which was my initial goal, so I looked at the resulting Plague bots system image while it was executing, and I found a number of interesting strings that are shown below.</p>
<div align="center"><strong>Table 1: Strings used to identify analysis tools.</strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">BitDefender Firewall Alert<br />
Windows Security Alert<br />
andy<br />
nepenthes<br />
currentuser<br />
vmware<br />
honey<br />
sandbox<br />
InsideTm<br />
TU-4NH09SMCG1HC<br />
SbieDll.dll<br />
Ether Detect<br />
The Wireshark Network Analyzer<br />
Project 1 &#8211; Packet Analyzer &#8211; Colasoft Capsa<br />
TCPView &#8211; Sysinternals: www.sysinternals.com<br />
Process Monitor &#8211; Sysinternals: www.sysinternals.com<br />
Process Explorer &#8211; Sysinternals: www.sysinternals.com<br />
File Monitor &#8211; Sysinternals: www.sysinternals.com</td>
</tr>
</tbody>
</table>
</div>
<div align="center"><strong>Table 2: Strings used to disable AV updates by resolving vendor names to 127.0.0.1</strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">127.0.0.1              www.pandasoftware.com<br />
127.0.0.1              www.norton.com<br />
127.0.0.1              www.nod32.com<br />
127.0.0.1              www.microsoft.com<br />
127.0.0.1              www.macafee.com<br />
127.0.0.1              www.kaspersky-labs.com<br />
127.0.0.1              www.hotmail.com<br />
127.0.0.1              www.download.mcafee.com<br />
127.0.0.1              pandasoftware.com<br />
127.0.0.1              norton.com<br />
127.0.0.1              nod32.com<br />
127.0.0.1              microsoft.com<br />
127.0.0.1              macafee.com</td>
</tr>
</tbody>
</table>
</div>
<p><strong>During the extraction process</strong>, I was initially going to trace the VB 6.0 code until CreateProcess was called, but after I found these strings, I decided to step it up and write a BPHook for Immunity Debugger.  The hook works by placing BPs on user requested addresses or Module Functions, and when the BP is hit a user provided string is searched in the current processes memory.  If the string is found, then the code will try to find the executable’s header and dump the image to disk, before it is executed.  In this particular case, I do not calculate the images size, and I just look for a tail value at the end of the allocated memory after the binary.  If I ever have to do this again, I will figure out how to calculate the image’s size.  Before I automated this process, I was dumping the image as shown below, using the Python Interpreter shell in the debugger.</p>
<p><strong> </strong></p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 674px"><img title="Dumping Malware Executable from Memory" src="http://www.thecoverofnight.com/img/plague/dumping_malware_process.png" alt="" width="664" height="377" /><p class="wp-caption-text">Dumping Malware Executable from Memory with Immunity Debugger</p></div>
</div>
<p><strong> </strong></p>
<p><strong>Analysis of the bot at </strong>this point static analysis was employed using IDA Pro; some dynamic analysis was used to get a clear picture of the memory and data.  When the binary runs, the first action performed is check for common malware analysis tools, and the checks appeared to <strong>FAIL</strong> in some cases.  The bit basically checks Window Titles to see if a tool is working.  For example, I was running SysInternals Process Explorer, and the check still passed and the program continued executing.  In any case, I merely converted all the strings to ‘A\x00’ using the debuggers Python shell, with the following snippet:</p>
<ul> f = imm.writeMemory(0x40c1b8, &#8216;A\x00&#8242;*0&#215;504)</ul>
<p><strong> </strong></p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 906px"><img title="IDA Pro Showing Plague's Attempt to Look For Analyst's Tools " src="http://www.thecoverofnight.com/img/plague/tool_check.png" alt="" width="896" height="479" /><p class="wp-caption-text">IDA Pro Showing Plague&#39;s Attempt to Look For Analyst&#39;s Tools</p></div>
</div>
<p><strong> </strong></p>
<p>After passing all the “security” checks, the bot looks to see if it is installed in the windows directory as <strong>svchost.exe</strong>.  If not, then the executable copies itself into <strong>%windir%\svchos.exe</strong> and create an autorun registry key.  If the executable is present in the directory, the bot will proceed to initialize the IRC server and call out to <strong>vteamunix.info</strong>, which resolves too <strong>174.133.63.91</strong>.</p>
<p><strong> </strong></p>
<p>While the string did not present any real protection measures, it did employ encoded strings.  To counter this obfuscation, I just looked over the code used to encode the strings.  The code basically used a string of 37 characters, and XOR’ed each against the encoded character in the obfuscated in the string.  I wrote an IDA script that decoded each string, renamed, and then added a comment to the IDA reference.</p>
<p><strong> </strong></p>
<div align="center">Table 3:  Output from the Decode Strings Script</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">Decoded string successfully:   &#8216;\xb8\xb8\xaf\xaf\xb8\xaf\xb6\xa4\xb3\x84\xbc\xa2\x8d\x8d\xaf\xb8\xb6\xa4\xb3\xaf\xaf\xb8\xb8&#8242;   = ooxxoxasdSkuZZxoasdxxoo<br />
Decoded string successfully:   &#8216;\x84\x9c\xa2\x8d\x8d\x8d\x8d\x8d\x8d\xad\xaf\xaf&#8217; = SKuZZZZZZzxx<br />
Decoded string successfully: &#8216;\xa4\xa1\xb4\xbf\xb8\xa4\xa3&#8242; = svchost<br />
Decoded string successfully: &#8216;\xf2\xa0\xbe\xb9\xb3\xbe\xa5\xf2&#8242; =   %windir%<br />
Decoded string successfully:   &#8216;\xa4\xa1\xb4\xbf\xb8\xa4\xa3\xf9\xb2\xaf\xb2&#8242; = svchost.exe<br />
Decoded string successfully:   &#8216;\x96\xa2\xa3\xb8\x85\xa2\xb9\xf9\xb2\xaf\xb2&#8242; = AutoRun.exe<br />
Decoding string: &#8216;!\x00&#8242;<br />
Decoded string successfully: &#8216;\xa0\xbe\xb9\xe4\xe5&#8242; = win32<br />
Decoded string successfully: &#8216;\xfd\x97\xb6\xb3\xba\xbe\xb9&#8242; = *@admin<br />
Decoded string successfully: &#8216;\xa7\x9b\xb6\xb0\x82\xb2&#8242; = pLagUe<br />
Decoded string successfully: &#8216;\xa7\x9b\xb6\xb0\x82\xb2&#8242; = pLagUe<br />
Decoded string successfully:   &#8216;\xa7\x9b\xb6\xb0\x82\xb2\xf7\xb5\xb8\xa3\xf7\xe5\xf9\xe1\xf7\xb8\xb1\xb1\xbe\xb4\xbe\xb6\xbb&#8217;   = pLagUe bot 2.6 official<br />
Decoded string successfully:   &#8216;\xd4\xe3\xd5\xa7\x9b\xb6\xb0\x82\xb2\xf7\xe5\xf9\xe1\xf9\xf7\x81\xbe\xb6\xf7\x9a\x84\x99\xf9&#8242;   = 4pLagUe 2.6. Via MSN.<br />
Decoded string successfully: &#8216;\xf4&#8242; = #<br />
Decoded string successfully: &#8216;\xf4&#8242; = #<br />
Decoded string successfully: &#8216;\xf4&#8242; = #<br />
Decoded string successfully:   &#8216;\xf4\xa7\xb6\xa4\xa4\xa0\xb8\xa5\xb3\xa4&#8242; = #passwords<br />
Decoded string successfully:   &#8216;\xa1\xa3\xb2\xb6\xba\xa2\xb9\xbe\xaf\xf9\xbe\xb9\xb1\xb8&#8242; = vteamunix.info<br />
Finished converting and decoding strings to strings.</td>
</tr>
</tbody>
</table>
</div>
<p>For good measure, I have also included what the strings looked like in IDA Pro after the decoding process.</p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 744px"><img title="Decoded Strings from Plague Bot in IDA Pro" src="http://www.thecoverofnight.com/img/plague/decoded_strings.png" alt="" width="734" height="836" /><p class="wp-caption-text">Decoded Strings from Plague Bot in IDA Pro</p></div>
</div>
<p>At this point, I dug a little further and identified the code responsible for the MSN spreading and USB infection process.  The USB infector functionality was very easy to reverse.  First I found the USB infector function, which is actually started in a thread called when the binary starts.  The function was identified by using the encoded string reference.  Additionally, Matt and I noticed the infector makes no distinction about whether a drive is a USB, Network, or any other drive.  Thus, by some accident they manage to successfully infect drives other drives with the bot.  The observed function does the following things:</p>
<div align="center"><strong> </strong><strong>Table 4:  Windows Drive and USB Propagation </strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">1) Create the following directory:<br />
<strong>\\cold\\hott</strong></p>
<p>2) Create the file Desktop.ini in the directory and write the following into it to make it look like the Recycling Bin:<br />
<code>[.ShellClassInfo]<br />
CLSID={645FF040-5081-101B-9F08-00AA002F954E}</code></p>
<p>3) Copy the svchost.exe binary image into the directory.</p>
<p>4) Write \\autorun.inf<br />
<code>autorun]<br />
[autorun[<br />
[autorun]<br />
open=svchost.exe<br />
icon=%SystemRoot%\system32\SHELL32.dll,4<br />
action=Open?folder?to?view files<br />
UseAuTOPLAY=1<br />
shell\\open\\command=svchost.exe</code></p>
<p>5) Sends a message saying it infected a drive and continues running</td>
</tr>
</tbody>
</table>
</div>
<p>After looking at the USB infector, I turned my attention to the MSN functionality.  At this point, I felt dynamic analysis would be more beneficial to my cause, but I was unable to figure out how to call the necessary function with the right variable types and values.  At this point I turned to Google and found code for an MSN Spread <a href="http://www.opensc.ws/c-c/6823-msn-spread.html">here</a>, which closely matches the plague bot.  In summary, below are some of the commands we enumerated in the binary.  The list may not be complete due to time constraints, but it is representative of the bot’s other capabilities.</p>
<div align="center"><strong>Table 5:  Sample of Identified Commands</strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">msn/msnoff<br />
visit<br />
update<br />
byefor3ver<br />
likeomgletsupdatemannnn<br />
likeomgletsdownloadmannnn<br />
ps2<br />
ddos<br />
udp<br />
http<br />
ff<br />
remove<br />
stop</td>
</tr>
</tbody>
</table>
</div>
<p><strong>Associating a face to the name </strong>was the most fruitful experience in this analysis.  Since Google yielded great results for the MSN Spreader, I decided to search for “Plague Bot” and found a number of posts dating back to September in the HackForums.net.  Most notably, the author,  <strong>tuSnipa</strong> boasted about features in the bot.  Below is an capture of his post in the <a href="http://74.125.95.132/search?q=cache:PzDaZSjZAMAJ:www.hackforums.net/showthread.php%3Ftid%3D219205+snipa+plague+bot&amp;cd=1&amp;hl=en&amp;ct=clnk&amp;gl=us">forum</a>.</p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 1001px"><img title="Snipa Selling the Plague Bot on HackForum.net" src="http://www.thecoverofnight.com/img/plague/plague_bot_info.png" alt="" width="793" height="564" /><p class="wp-caption-text">Snipa Selling the Plague Bot on HackForum.net</p></div>
</div>
<p>Additionally, he claims to run the IRC servers and distribute binaries for each binary.  Below is a  screen capture from Wireshark, and it shows the network traffic between the client and the IRC server.  <strong>Note the Snipa.gov MOTD.</strong></p>
<div align="center">
<div class="wp-caption aligncenter" style="width: 718px"><img title="Bot joing the IRC channel &quot;Seeing Nothing&quot; at snipa.gov" src="http://www.thecoverofnight.com/img/plague/irc_join.png" alt="" width="708" height="424" /><p class="wp-caption-text">Bot joing the IRC channel &quot;Seeing Nothing&quot; at snipa.gov</p></div>
</div>
<p>Overall this was a fun piece of malware to reverse especially to get back into the swing of things.  I wrote several scripts for IDA and Immunity Debugger:</p>
<ul>
<li><a href="http://www.thecoverofnight.com/projects/code/plaguebot/ida_pro_runtime_imports.py">ida_pro_runtime_imports.py</a> – basic renaming script to rename some runtime function imports  in the binary</li>
<li><a href="http://www.thecoverofnight.com/projects/code/plaguebot/ida_pro_remove_all_names_in_function.py">ida_pro_remove_all_names_in_function.py</a> – basic script/command to remove all the names on “DataXrefsFrom” in the function</li>
<li><a href="http://www.thecoverofnight.com/projects/code/plaguebot/ida_pro_decode_strings.py">ida_pro_decode_strings.py</a> – script to decode, name, and add comments regarding the strings</li>
<li><a href="http://www.thecoverofnight.com/projects/code/plaguebot/bp_dump_image.py">bp_dump_image.py</a> – Immunity Debugger script to dump an executable image with a special string.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=214</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Remote Cmd Server for Android</title>
		<link>http://www.thecoverofnight.com/blog/?p=207</link>
		<comments>http://www.thecoverofnight.com/blog/?p=207#comments</comments>
		<pubDate>Mon, 23 Nov 2009 06:09:54 +0000</pubDate>
		<dc:creator>apridgen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.thecoverofnight.com/blog/?p=207</guid>
		<description><![CDATA[I had the opportunity to get a new phone a few weeks ago, and like everything I get, I sat down with some docs, how-tos, and examples.  The end result is a basic command server that listens  a selected port and  IP address assigned to the device, either the wireless address or the ppp0. There [...]]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity to get a new phone a few weeks ago, and like everything I get, I sat down with some docs, how-tos, and examples.  The end result is a basic command server that listens  a selected port and  IP address assigned to the device, either the wireless address or the ppp0. There is also a basic GUI that allows the user to input and execute unprivileged OS commands on the device.</p>
<p>The server itself will receive commands such as put, get, exec, and a few undocumented ones.  Below are some of the commands:</p>
<ol>
<li>&#8220;put /path/filename b64_data_string&#8221; will put a file on the remote android phone (untested)</li>
<li>&#8220;get /path/filename&#8221; will get a file on the remote android phone</li>
<li>&#8220;exec &#8221; will execute a command on the remote android phone</li>
</ol>
<p>The results of the commands all come in the form of:</p>
<ol>
<li>&lt;SUCCESS,size_result:int,b64_result:string&gt;</li>
<li>&lt;FAIL,size_result:int,b64_result:string&gt;</li>
</ol>
<p>Here is a link to the project for those interested:  http://code.google.com/p/aremoteserver/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thecoverofnight.com/blog/?feed=rss2&#038;p=207</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

