<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Security Ripcord</title>
	<atom:link href="http://www.cutawaysecurity.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cutawaysecurity.com/blog</link>
	<description>Cutaway's Observations, Opinions, Rants, Raves, Tantrums, and Tirades</description>
	<pubDate>Sun, 11 May 2008 19:02:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
	http://creativecommons.org/licenses/by-nc-sa/3.0/<creativeCommons:license></creativeCommons:license>	<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9; </copyright>
		<managingEditor>podcast@cutawaysecurity.com ()</managingEditor>
		<webMaster>podcast@cutawaysecurity.com()</webMaster>
		<category></category>
		<ttl>1440</ttl>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>Cutaway's Observations, Opinions, Rants, Raves, Tantrums, and Tirades</itunes:summary>
		<itunes:author></itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name></itunes:name>
			<itunes:email>podcast@cutawaysecurity.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://www.cutawaysecurity.com/images/cutaway_security_144x144.png" />
		<image>
			<url>http://www.cutawaysecurity.com/images/cutaway_security_144x144.png</url>
			<title>Security Ripcord</title>
			<link>http://www.cutawaysecurity.com/blog</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>The Price of Disassembly</title>
		<link>http://www.cutawaysecurity.com/blog/archives/248</link>
		<comments>http://www.cutawaysecurity.com/blog/archives/248#comments</comments>
		<pubDate>Sun, 11 May 2008 19:02:39 +0000</pubDate>
		<dc:creator>cutaway</dc:creator>
		
		<category><![CDATA[Disassembly]]></category>

		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[atlas]]></category>

		<category><![CDATA[Amazon]]></category>

		<category><![CDATA[Don C. Weber]]></category>

		<category><![CDATA[Learn Security Online]]></category>

		<category><![CDATA[LSO]]></category>

		<category><![CDATA[Security Ripcord]]></category>

		<guid isPermaLink="false">http://www.cutawaysecurity.com/blog/?p=248</guid>
		<description><![CDATA[I was checking prices for a few books that atlas mentioned in his interview on Learn Security Online.  I was not expecting to pay this much for any of the books.  I think I&#8217;ll wait.  Those of you who are done with your versions might think about becoming a reseller.  Or, [...]]]></description>
			<content:encoded><![CDATA[<p>I was checking prices for a few books that <a href="Hacker Disassembling Uncovered" target="_blank">atlas</a> mentioned in his interview on <a title="Interview with Atlas" href="http://www.learnsecurityonline.com/index.php?option=com_content&amp;task=view&amp;id=237&amp;Itemid=1" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.learnsecurityonline.com');">Learn Security Online</a>.  I was not expecting to pay this much for any of the books.  I think I&#8217;ll wait.  Those of you who are done with your versions might think about becoming a reseller.  Or, you can contact me if you are willing to make a donation.</p>
<p><a href="http://www.cutawaysecurity.com/blog/wp-content/uploads/2008/05/hacker_disass_book.png" ><img class="aligncenter size-medium wp-image-246" title="hacker_disass_book" src="http://www.cutawaysecurity.com/blog/wp-content/uploads/2008/05/hacker_disass_book.png" alt="Hacker Disassembling Uncovered" /></a></p>
<p><a href="http://www.cutawaysecurity.com/blog/wp-content/uploads/2008/05/hacker_disass_book1.png" ><img class="aligncenter size-medium wp-image-247" title="hacker_disass_book1" src="http://www.cutawaysecurity.com/blog/wp-content/uploads/2008/05/hacker_disass_book1.png" alt="Hacker Disassembling Uncovered Prices" /></a></p>
<p>Go forth and do good things,</p>
<p>Don C. Weber</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cutawaysecurity.com/blog/archives/248/feed</wfw:commentRss>
		</item>
		<item>
		<title>Keep Your Heads Up In The Stack</title>
		<link>http://www.cutawaysecurity.com/blog/archives/244</link>
		<comments>http://www.cutawaysecurity.com/blog/archives/244#comments</comments>
		<pubDate>Thu, 08 May 2008 02:39:13 +0000</pubDate>
		<dc:creator>cutaway</dc:creator>
		
		<category><![CDATA[Leadership]]></category>

		<category><![CDATA[Management]]></category>

		<category><![CDATA[Professionalism]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[USMC]]></category>

		<category><![CDATA[Don C. Weber]]></category>

		<category><![CDATA[Security Ripcord]]></category>

		<guid isPermaLink="false">http://www.cutawaysecurity.com/blog/?p=244</guid>
		<description><![CDATA[I&#8217;ve been doing a little running lately getting ready for the Corpus Christi Beach to Bay Relay.  Today, instead of our usual four mile run, we decided to work on some sprints.  We ran a mile and then started a series of 100 yard sprints with a 100 yard walk in between.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a little running lately getting ready for the <a href="http://maps.google.com/maps?q=corpus+christi&amp;ie=UTF8&amp;oe=utf-8&amp;client=firefox-a&amp;t=h&amp;z=10&amp;iwloc=addr" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/maps.google.com');">Corpus Christi</a> <a href="http://beachtobayrelay.com/" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/beachtobayrelay.com');">Beach to Bay Relay</a>.  Today, instead of our usual four mile run, we decided to work on some sprints.  We ran a mile and then started a series of 100 yard sprints with a 100 yard walk in between.  Needless to say that the walking reset was filled full of huffing and puffing.  At one point I noticed that I was hanging my head like most people do when they are tired.  When I realized this I did what I always do, what I taught myself in the Marines after long runs and forced marches, I raised my head and started looking around.  I use to do this because whenever you are the most tired is when you are the most vulnerable.  You are not paying attention, you are breathing heavy, and you are doing everything you can just to take a break for a minute or two.  Fortunately, the repercussions of me doing this now are not the same as they were back then.</p>
<p>All of this got me thinking about how we react to situations as a whole.  I started thinking about how through training and effort we can begin to overcome  hardships.  I started thinking about how diligent practice can instill good habits and create muscle memory in any individual.  Muscle memory is a condition where a body reacts without, or more precisely with only a little, thinking.  You can see this by reviewing <a href="http://securosis.com/2008/05/02/react-faster-and-better-with-the-a-b-cs/" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/securosis.com');">Rich Mogull&#8217;s posts</a> on <a href="http://securosis.com/2008/04/28/just-because-youre-an-expert-doesnt-make-you-an-expert/" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/securosis.com');">how he handled</a> several car accidents after being out of the paramedics for a while.  Rich did what came natural to him.  He just reacted and, I&#8217;m sure, did a great job and a service.</p>
<p>&#8220;Yes, yes,&#8221; you are thinking to yourself right now.  We have heard this all before.  Practice makes perfect.  Practice your incident response.  Practice your backup procedures.  Practice your disaster recovery.  Practice makes perfect. Practice, Practice, Practice.  Blah, blah, blah.  Yes, I am tell you that.  But what I want to emphasize is that you can train yourselves all day long and still make mistakes.</p>
<p>Running with my head down took me back to the days of running through the hills of <a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=Camp+Pendleton,+Ca&amp;sll=36.798907,-75.973806&amp;sspn=0.038282,0.069866&amp;ie=UTF8&amp;t=h&amp;z=10&amp;iwloc=addr" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/maps.google.com');">Camp Pendleton</a> and training myself to keep my head up and aware of my surroundings no matter how tired I was at the time.  But what it really got me thinking about was being in the stack.  Not the stack you are use to hearing about, the stack of Marines that are just about to enter a building or room that may contain hostiles.  It didn&#8217;t matter where we were, once people started lining up and getting ready to move to action, their heads dropped.  Not because they were tired or lazy, but because they were focused and waiting.  Like a spring ready to uncoil all of its power.  This occurred so often that it was not surprising to hear, &#8220;Keep your heads up in the stack!&#8221; whispered over the radio.  Or have someone give you a quick rap on the helmet as a reminder.  Everybody did it, everybody got sucked into it, and everybody was aware of it and watched out for their buddy, because that person was watching out for them.</p>
<p>So, how does this apply to us?  Well, security professionals have a lot to accomplish on any given day.  Logs to review, servers to patch, incidents to respond to, training to develop and give (and that is just the short list).  Let&#8217;s face it.  We are swamped with responsibility and duties.  Everybody groans when we walk into a room but everybody notices when our duties start falling behind because it directly affects their business.  With all of this activity, with all of this responsibility, it is very easy to get set into a common routine or mode.  It is very easy for our heads to drop into our computers, logs, management consoles, spreadsheets, etc.  We are doing our jobs and we are getting it done, but are we aware of our surroundings.  Are we aware of the common sights and sounds of the office environment and server room.  Are we listening to people talk when they need our guidance, input, or for us to listen for listening&#8217;s sake?</p>
<p>If you are, then good on you.  Now look around and see who is not.  Please, tap them on the head and tell them, &#8220;Keep your head up in the stack!&#8221;</p>
<p>Go forth and do good things,</p>
<p>Don C. Weber</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cutawaysecurity.com/blog/archives/244/feed</wfw:commentRss>
		</item>
		<item>
		<title>Assembly Debugging with VTrace</title>
		<link>http://www.cutawaysecurity.com/blog/archives/242</link>
		<comments>http://www.cutawaysecurity.com/blog/archives/242#comments</comments>
		<pubDate>Sun, 04 May 2008 20:40:47 +0000</pubDate>
		<dc:creator>cutaway</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[assembly]]></category>

		<category><![CDATA[debugging]]></category>

		<category><![CDATA[idle]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[Security Ripcord]]></category>

		<category><![CDATA[segmentation fault]]></category>

		<category><![CDATA[VDB]]></category>

		<category><![CDATA[VTrace]]></category>

		<guid isPermaLink="false">http://www.cutawaysecurity.com/blog/?p=242</guid>
		<description><![CDATA[Although my last foray into assembly via a Hello World program was helpful, it only scratched the surface.  I was thinking about moving onto some user input programs next when I realized that it might be more helpful if I learned how to do some quick arithmetic using assembly.  To do this I [...]]]></description>
			<content:encoded><![CDATA[<p>Although my <a href="http://www.cutawaysecurity.com/blog/archives/240" target="_blank" >last foray </a>into assembly via a Hello World program was helpful, it only scratched the surface.  I was thinking about moving onto some user input programs next when I realized that it might be more helpful if I learned how to do some quick arithmetic using assembly.  To do this I located some additional resources to help my understanding of assembly.</p>
<ul>
<li><a href="http://asm.sourceforge.net/articles/linasm.html" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/asm.sourceforge.net');">Using Assembly Language in Linux</a></li>
<li><a href="http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/docs.cs.up.ac.za');">Linux System Call Table</a></li>
<li><a href="http://staff.ustc.edu.cn/~xlanchen/EmbeddedOperatingSystems2006Spring/materials/x86%20Assembly%20Programming.htm" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/staff.ustc.edu.cn');">x86 Assembly Programming</a></li>
</ul>
<p>Together with my old version of Hello World I created an assembly program that would print out a &#8220;Number is 0&#8243; and then &#8220;Number is 1&#8243;.  My intention was to set a register to 0 and then to increment the register so that it equaled 1.  The following is the program.</p>
<p><span style="color: red;"><strong><em>DISCLAIMER UPDATE:  The following assembly code does not work.  That is the point.  The walk through after the code, however, does help.</em></strong><br />
</span></p>
<blockquote><p>// Assembly Arithmetics</p>
<p>.data<br />
NUMS:<br />
.string &#8220;Number is &#8221;<br />
NUMSLEN:<br />
.short $-NUMS<br />
EOL:<br />
.string &#8220;\n&#8221;<br />
EOLLEN:<br />
.short $-EOL</p>
<p>.text<br />
.globl  _start</p>
<p>_start:<br />
//Print NUMSTRING<br />
movl $4,%eax<br />
movl $1,%ebx<br />
movl $NUMS,%ecx<br />
movl $NUMSLEN,%edx<br />
int $0&#215;80</p>
<p>//Make a register equal to zero and print<br />
xor %ecx,%ecx<br />
xor %edx,%edx<br />
inc %edx<br />
int $0&#215;80</p>
<p>//Print EOL<br />
movl $EOL,%ecx<br />
movl $EOLLEN,%edx<br />
int $0&#215;80</p>
<p>//Print NUMSTRING<br />
movl $NUMS,%ecx<br />
movl $NUMSLEN,%edx<br />
int $0&#215;80</p>
<p>//Increment register from zero to one<br />
xor %ecx,%ecx<br />
xor %edx,%edx<br />
inc %ecx<br />
inc %edx<br />
int $0&#215;80</p>
<p>//Print EOL<br />
movl $EOL,%ecx<br />
movl $EOLLEN,%edx<br />
int $0&#215;80</p>
<p>//Exit<br />
ret</p></blockquote>
<p>To help me compile this I also created a quick Makefile.</p>
<blockquote><p>arth.as: arth.as.o<br />
ld arth.as.o -o arth.as.exe<br />
arth.as.o: arth.as.s<br />
as arth.as.s -o arth.as.o</p></blockquote>
<p>This Makefile allowed me to just type &#8220;make&#8221; every time that I needed to make a change to the assembly program.  This happened several times before I came to the assembly program above.  Once I had the executable, I thought I was good to go.  Unfortunately.</p>
<blockquote><p><span style="color: red;">bt</span> <span style="color: blue;">as #</span> ls<br />
Makefile  arth.as.s<br />
<span style="color: red;">bt</span> <span style="color: blue;">as #</span> make<br />
as arth.as.s -o arth.as.o<br />
ld arth.as.o -o arth.as.exe<br />
<span style="color: red;">bt</span> <span style="color: blue;">as #</span> ls<br />
Makefile  arth.as.exe*  arth.as.o  arth.as.s<br />
<span style="color: red;">bt</span> <span style="color: blue;">as #</span> ./arth.as.exe<br />
Number is</p>
<p><strong>Segmentation fault</strong><br />
<span style="color: red;">bt</span> <span style="color: blue;">as #</span></p></blockquote>
<p>Dang ol&#8217; Seg fault.  What do I do now?  Well, I was going to start moving things around and checking against other simple programs available via Google when I remembered that I could step through the executable using VTrace.  After a little trial and error I taught myself to attach to the executable, step through each instruction, pull all of the registry values, pull selected registry values, and run the program all of the way through.  The following output shows each of these steps.  You will notice that I decided to start using several arrays to help me consistently output the values of the registers.</p>
<blockquote><p>IDLE 1.1.3<br />
<span style="color: red;">&gt;&gt;&gt;</span> import vtrace<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr = vtrace.getTrace()<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.execute(&#8217;/root/Development/test_programs/c/misc/as/c_stuff.as.exe&#8217;)<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.getPid()<br />
11683<br />
<span style="color: red;">&gt;&gt;&gt;</span> arrRegs = ['eax','ebx','ecx','edx']<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 0<br />
ebx : 0<br />
ecx : 0<br />
edx : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> arrAllRegs = tr.getRegisters()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for key in arrAllRegs:<br />
print &#8220;%s : %s&#8221; % (key,arrAllRegs[key])</p>
<p>debug1 : 0<br />
debug0 : 0<br />
debug3 : 0<br />
debug2 : 0<br />
debug5 : 0<br />
debug4 : 0<br />
debug7 : 0<br />
debug6 : 0<br />
edi : 0<br />
eax : 0<br />
cs : 115<br />
fs : 0<br />
ebp : 0<br />
__fs : 0<br />
__cs : 0<br />
gs : 0<br />
edx : 0<br />
ebx : 0<br />
ds : 123<br />
__es : 0<br />
ecx : 0<br />
eip : 134512756<br />
esp : 3213311088<br />
ss : 123<br />
__ds : 0<br />
__ss : 0<br />
__gs : 0<br />
eflags : 2097798<br />
es : 123<br />
orig_eax : 11<br />
esi : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.run()<br />
<span style="color: red;">&gt;&gt;&gt;</span> arrAllRegs = tr.getRegisters()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for key in arrAllRegs:<br />
print &#8220;%s : %s&#8221; % (key,arrAllRegs[key])</p>
<p>debug1 : 0<br />
debug0 : 0<br />
debug3 : 0<br />
debug2 : 0<br />
debug5 : 0<br />
debug4 : 0<br />
debug7 : 0<br />
debug6 : 0<br />
edi : 0<br />
eax : 4294967258<br />
cs : 115<br />
fs : 0<br />
ebp : 0<br />
__fs : 0<br />
__cs : 0<br />
gs : 0<br />
edx : 134516943<br />
ebx : 1<br />
ds : 123<br />
__es : 0<br />
ecx : 134516941<br />
eip : 1<br />
esp : 3213311092<br />
ss : 123<br />
__ds : 0<br />
__ss : 0<br />
__gs : 0<br />
eflags : 2163202<br />
es : 123<br />
orig_eax : 4294967295<br />
esi : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258  <em><strong>&lt;- NOTE: Remember these values for later</strong></em><br />
ebx : 1<br />
ecx : 134516941<br />
edx : 134516943<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.detach()<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.getPid()<br />
0<br />
<span style="color: red;">&gt;&gt;&gt;</span></p></blockquote>
<p>Okay, that didn&#8217;t help.  I guess I need to step through using &#8220;tr.stepi()&#8221; and output the registry value after each step.  Let&#8217;s see if it helps.  I have inserted the assembly code as <em><strong>NOTE:</strong></em> throughout the output.</p>
<blockquote><p>IDLE 1.1.3<br />
<span style="color: red;">&gt;&gt;&gt;</span> import vtrace<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr=vtrace.getTrace()<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.getPid()<br />
0<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.execute(&#8217;/root/Development/test_programs/c/misc/as/arth.as.exe&#8217;)<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.getPid()<br />
14727<br />
<span style="color: red;">&gt;&gt;&gt;</span> arrAllRegs = tr.getRegisters()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for key in arrAllRegs:<br />
print &#8220;%s : %s&#8221; % (key,arrAllRegs[key])</p>
<p>debug1 : 0<br />
debug0 : 0<br />
debug3 : 0<br />
debug2 : 0<br />
debug5 : 0<br />
debug4 : 0<br />
debug7 : 0<br />
debug6 : 0<br />
edi : 0<br />
eax : 0<br />
cs : 115<br />
fs : 0<br />
ebp : 0<br />
__fs : 0<br />
__cs : 0<br />
gs : 0<br />
edx : 0<br />
ebx : 0<br />
ds : 123<br />
__es : 0<br />
ecx : 0<br />
eip : 134512756<br />
esp : 3220532048<br />
ss : 123<br />
__ds : 0<br />
__ss : 0<br />
__gs : 0<br />
eflags : 2097798<br />
es : 123<br />
orig_eax : 11<br />
esi : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> arrRegs = ['eax','ebx','ecx','edx']<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 0   <em><strong>&lt;- NOTE: All registers appear to start clean</strong></em><br />
ebx : 0<br />
ecx : 0<br />
edx : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4   <em><strong>&lt;- NOTE: movl $4,%eax</strong></em><br />
ebx : 0<br />
ecx : 0<br />
edx : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4<br />
ebx : 1   <em><strong>&lt;- NOTE: movl $1,%ebx</strong></em><br />
ecx : 0<br />
edx : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span><br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4<br />
ebx : 1<br />
ecx : 134516928   <em><strong>&lt;- NOTE: movl $NUMS,%ecx</strong></em><br />
edx : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4<br />
ebx : 1<br />
ecx : 134516928<br />
edx : 134516939   <em><strong>&lt;- NOTE: movl $NUMSLEN,%edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 2048   <em><strong>&lt;- NOTE: int $0&#215;80   I&#8217;m not sure why this register changed </strong><span style="color: red;">UPDATE: Confirmed, this register is changed with the result of &#8220;int $0&#215;80&#8243;, which means the next &#8220;int $0&#215;80&#8243;  will do the system call assigned to 2048 or $0&#215;800 </span></em><br />
ebx : 1<br />
ecx : 134516928<br />
edx : 134516939<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 2048<br />
ebx : 1<br />
ecx : 0   <em><strong>&lt;- NOTE: xor %ecx,%ecx</strong></em><br />
edx : 134516939<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 2048<br />
ebx : 1<br />
ecx : 0<br />
edx : 0   <em><strong>&lt;- NOTE: xor %edx,%edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 2048<br />
ebx : 1<br />
ecx : 0<br />
edx : 1   <em><strong>&lt;- NOTE: inc %edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<em><strong> &lt;- NOTE: int $0&#215;80   Okay, this is probably the segfault, but VTrace doesn&#8217;t stop stepping here </strong></em><br />
ebx : 1<br />
ecx : 134516941  <em><strong>&lt;- NOTE: movl $EOL,%ecx     I&#8217;m also not sure why it seems like it stepped twice and executed the next instruction</strong></em><br />
edx : 1<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 134516941<br />
edx : 134516943   <em><strong>&lt;- NOTE: movl $EOLLEN,%edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 134516928<em><strong> &lt;- NOTE: movl $NUMS,%ecx</strong></em><br />
edx : 134516943<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 134516928<br />
edx : 134516939   <em><strong>&lt;- NOTE: movl $EOLLEN,%edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 0   <em><strong>&lt;- NOTE: xor %ecx,%ecx</strong></em><br />
edx : 134516939<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 0<br />
edx : 0   <em><strong>&lt;- NOTE: xor %edx,%edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 1   <em><strong>&lt;- NOTE: inc %ecx</strong></em><br />
edx : 0<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 1<br />
edx : 1   <em><strong>&lt;- NOTE: inc %edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 134516941   <em><strong>&lt;- NOTE: movl $EOL,%ecx</strong></em><br />
edx : 1<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258   <em><strong>&lt;- NOTE: Complete run through stopped here</strong></em><br />
ebx : 1<br />
ecx : 134516941<br />
edx : 134516943   <em><strong>&lt;- NOTE: movl $EOLLEN,%edx</strong></em><br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258<br />
ebx : 1<br />
ecx : 134516941<br />
edx : 134516943<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.stepi()<br />
<span style="color: red;">&gt;&gt;&gt;</span> for i in arrRegs:<br />
print &#8220;%s : %s&#8221; % (i,tr.getRegisterByName(i))</p>
<p>eax : 4294967258  <em><strong>&lt;- NOTE: Step through stops here as well</strong></em><br />
ebx : 1<br />
ecx : 134516941<br />
edx : 134516943<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.detach()<br />
<span style="color: red;">&gt;&gt;&gt;</span> tr.getPid()<br />
0<br />
<span style="color: red;">&gt;&gt;&gt;</span></p></blockquote>
<p>Not much help there. Basically, VTrace will step right through a segmentation fault.  Although, now that I run through the program step by step I think I can see where the program failed.  I guess the &#8220;int $0&#215;80&#8243; changes the register $eax.  I believe this means that I have to reset this value before writing.</p>
<p>What still bothers me though is the fact that VTrace did not stop on the segmentation fault.  I thought debuggers did this.  That is when I realized that VTrace is not necessarily a debugger.  Actually VDB is a debugger and I should have used that instead of troubleshooting with VTrace.  I guess I could just reset the register before telling it to print, I think I&#8217;ll try VDB to see if it will help me identify the exact step where the executable stops.</p>
<p>More assembly soon!!</p>
<p><span style="color: red;">UPDATE:  As I mentioned inline, the call &#8220;int $0&#215;80&#8243; writes it&#8217;s return value to %eax.  This means that I will l have to update %eax with a decimal 4 every time I want to write out.  Also, I have come to realize that whether I use VTrace, VDB, or GDB no debugger is going to help me overcome bad code.  I guess I need a book because online resources don&#8217;t seem to be cutting it for me.  I did find one resource that mentioned that the values in the registers are not necessarily ASCII and that they will need to be converted before being output.  But then the same resource went straight into memory modification to write the number with the original string instead of outputting them one at a time like I have here.  I&#8217;m going to try and get a grasp on this before I start delving into memory modification.</span></p>
<p>Go forth and do good things,</p>
<p>Don C. Weber</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cutawaysecurity.com/blog/archives/242/feed</wfw:commentRss>
		</item>
		<item>
		<title>Organized Security</title>
		<link>http://www.cutawaysecurity.com/blog/archives/241</link>
		<comments>http://www.cutawaysecurity.com/blog/archives/241#comments</comments>
		<pubDate>Sun, 04 May 2008 08:39:44 +0000</pubDate>
		<dc:creator>cutaway</dc:creator>
		
		<category><![CDATA[Leadership]]></category>

		<category><![CDATA[Management]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[C&amp;A]]></category>

		<category><![CDATA[CAPM]]></category>

		<category><![CDATA[CMMI]]></category>

		<category><![CDATA[FISMA]]></category>

		<category><![CDATA[ISO 27001:2005]]></category>

		<category><![CDATA[ITIL]]></category>

		<category><![CDATA[PgMP]]></category>

		<category><![CDATA[PMP]]></category>

		<category><![CDATA[process]]></category>

		<category><![CDATA[process management]]></category>

		<category><![CDATA[program management]]></category>

		<category><![CDATA[Program Management Institute]]></category>

		<category><![CDATA[Security Ripcord]]></category>

		<guid isPermaLink="false">http://www.cutawaysecurity.com/blog/?p=241</guid>
		<description><![CDATA[Work has been quite an experience over the last couple of months.  I have spent my time in the usual security professional mode - Firefighter.  It is especially aggravating when much of that firefighting is documentation for certification and accreditation of a system (that could be quickly improved with the same level of [...]]]></description>
			<content:encoded><![CDATA[<p>Work has been quite an experience over the last couple of months.  I have spent my time in the usual security professional mode - Firefighter.  It is especially aggravating when much of that firefighting is <a href="http://taosecurity.blogspot.com/2006/03/fisma-is-joke-thanks-to-sans-newsbites.html" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/taosecurity.blogspot.com');">documentation for certification and accreditation</a> of a system (that could be quickly improved with the same level of effort) or collecting information through what could be considered broken processes. Security Blog readers hear about both of those concerns all of the time as they peruse the Security Blogscape.  Security professionals wishing that they could make a difference within their organization.  Wishing that the managers of the system and network administrators would just listen and implement.  Hoping that the executive management will empower the security professionals within their organization by conveying to the rest of the company the importance of secure operations.  Let&#8217;s face though, when we start talking about security within our different organizations the majority of what we want is for our organizations to follow good business practices.  Companies who have a firm grasp on how their technology operates and have a process for change through open communications are much more secure that the companies that buy security products to act as stop gaps and try to prove or give the illusion of compliance.</p>
<p>The <a href="http://www.securitycatalyst.org/forums/" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.securitycatalyst.org');">next generation of security professionals</a> need to recognize this fact.  Certainly we train them to know that their companies should be following industry standards like <a href="http://en.wikipedia.org/wiki/ISO/IEC_27001" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/en.wikipedia.org');">ISO 27001:2005</a> as I have <a href="http://www.cutawaysecurity.com/blog/archives/144" target="_blank" >already pointed out</a>.  But have we really started providing them with the abilities to integrate this into <a href="http://en.wikipedia.org/wiki/ITIL_v3" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/en.wikipedia.org');">ITIL</a> or <a href="http://en.wikipedia.org/wiki/CMMI" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/en.wikipedia.org');">CMMI</a>.  No, that is because for a business to achieve these standard they need to have business professionals to guide them through the process.  Unfortunately, these business professionals have not been trained on how the security frameworks will fit into the organization and their compliance efforts.  So, there is a gap.  And when there is a gap that people don&#8217;t understand they tend to do one of two things:</p>
<ul>
<li>Ignore it.</li>
<li>Throw money at it until they wish they had gone with the other method.</li>
</ul>
<p>We&#8217;ll let me let all of you in on a little secret.  It is something that you can take back to your organization and begin to implement immediately and it will not affect anybody outside of the security group, at first.  Are you ready????  You might just hate this answer, so stop reading if you cannot handle it.   Okay, I want you to <strong>&#8220;Document Your Processes!&#8221;</strong> <em>*Gasps are heard around the world*</em> Yes, documentation will get you over the hump.  I&#8217;m not talking long, drawn out documentation that makes you stop everything that you are doing.  No, I am talking about quickly documenting the steps you take to address any issue you devote time to repeatedly.  I am also talking about creating process flow diagrams that show where and how tasks touch other departments within your organization.  Don&#8217;t spend a lot of time on it at first.  Just get it written down and saved into a location that all of your team members can access it.  Then print them out and put them in a binder that will become your Standard Operating Procedures (dang, how did SOP slip in there?). As this binder starts to fill up, make copies and deliver a a copy to your boss and the other managers of the departments you deal with on a regular basis.</p>
<p>Now the ITIL and CMMI experts are ready to jump in here and tell us, &#8220;This is not enough to be compliant.&#8221;  They would be correct.  But each of them will have to admit that it is one way to start down the path.  It is a necessary step that they will be looking for as they go down their checklists.  See, a few of the things that they want to see from you and your department are:</p>
<ul>
<li>Does your department have documented processes and procedures?</li>
<li>Does your department control their efforts through some type of program or project management method?</li>
<li>Does your department have methods to analyze and improve the processes and procedures?</li>
<li>Does your department make these process and procedures available to other departments within the organization?</li>
</ul>
<p>By documenting how you approach each one of your department&#8217;s responsibilities you will start down a path that can be successfully integrated into the organization&#8217;s business processes.  Managers will be able to start looking at your productivity and perform metrics on your duties which will help them determine many things, such as your value to the whole organization or whether your department is short handed.  And what does it do for your department as a whole?  You become more effective and efficient because you start doing things the same way every time (until it does not make sense to).  You have opened communications to the rest of the organization and provided them with a method to take your example and some of your ideas and turn them into their own ideas (oh, the power of suggestion). All of this documentation you will help you and other members of your department quickly determine where your processes need improvement. Process documentation is  an excellent tool when it comes time to point out issues to the members of your department.  It drives straight to the heart of the problem in a manner that is easy for them to understand and provides them with the opportunity to make visible and fulfilling improvements.</p>
<p>Is all of this enough to &#8220;fill the gap&#8221; that I spoke of earlier?  Of course not.  It is just a start.  One of the things that I am starting to consider are classes and certifications in program/process management.  For this I have been pointed to the <a href="http://www.pmi.org/Pages/default.aspx" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.pmi.org');">Program Management Institute</a> by several security professionals and bloggers.  I really don&#8217;t think it is going to hurt any security professional if they add <a href="http://www.pmi.org/CareerDevelopment/Pages/Obtaining-Credential.aspx#pgmp" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.pmi.org');">PgMP</a>, <a href="http://www.pmi.org/CareerDevelopment/Pages/Obtaining-Credential.aspx#pmp" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.pmi.org');">PMP</a>, or <a href="http://www.pmi.org/CareerDevelopment/Pages/Obtaining-Credential.aspx#capm" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.pmi.org');">CAPM</a> to their alphabet soup.  In fact, as individuals begin to progress through their careers these or similar education may become necessary.  Many of our technical Brethern (who are still reading) are shifting uncomfortably in their seats because dreams of management duties are starting to fill their heads.  Those, at least, that don&#8217;t come from a structured software or hardware development background.  And they shouldn&#8217;t.  Because these are the skill sets that are also necessary for technical engineers to improve how they do their business as much as it is a means for the managers to improve the department or organization.</p>
<p>Open communications is one of the things that we promote within our organizations.  If your organization is &#8220;open communications challenged&#8221; then you must first start looking at yourself before you start pointing fingers or stomping feet.  You must set the example.  Live the lifestyle you preach.  Hopefully it will make a difference.  If it does not, well, then at least you have improved yourself and your department.  The people around you will be more prepared for the next thing that comes along.</p>
<p>Go forth and do good things,</p>
<p>Don C. Weber</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cutawaysecurity.com/blog/archives/241/feed</wfw:commentRss>
		</item>
		<item>
		<title>Hello World Assembly Compiling</title>
		<link>http://www.cutawaysecurity.com/blog/archives/240</link>
		<comments>http://www.cutawaysecurity.com/blog/archives/240#comments</comments>
		<pubDate>Sun, 27 Apr 2008 06:55:14 +0000</pubDate>
		<dc:creator>cutaway</dc:creator>
		
		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[atlas]]></category>

		<guid isPermaLink="false">http://www.cutawaysecurity.com/blog/archives/240</guid>
		<description><![CDATA[I have moved on from C code to Assembly.  Certainly I broke down the C into Assembly earlier, but this time I wanted to write and compile from an Assembly file.  This proved more difficult than I expected.  This is not because doing so is hard, it is because of the differences [...]]]></description>
			<content:encoded><![CDATA[<p>I have moved on from C code to Assembly.  Certainly I broke down the C into Assembly earlier, but this time I wanted to write and compile from an Assembly file.  This proved more difficult than I expected.  This is not because doing so is hard, it is because of the differences between the INTEL and AT&amp;T syntaxs.  I didn&#8217;t realize that this was going to be a problem until I tried to use NASM to compile the hello.s file.  NASM expects INTEL syntax while GCC output a file in AT&amp;T syntax.  The following is an example of the error messages I received.</p>
<blockquote><p><font color="red">bt</font> <font color="blue">hello</font> # nasm -f elf hello.s<br />
hello.s:1: error: attempt to define a local label before any non-local labels<br />
hello.s:1: error: parser: instruction expected<br />
hello.s:2: error: attempt to define a local label before any non-local labels<br />
hello.s:2: error: parser: instruction expected<br />
hello.s:3: error: attempt to define a local label before any non-local labels<br />
hello.s:4: error: attempt to define a local label before any non-local labels<br />
hello.s:4: error: parser: instruction expected<br />
hello.s:5: error: attempt to define a local label before any non-local labels<br />
hello.s:6: error: attempt to define a local label before any non-local labels<br />
hello.s:6: error: parser: instruction expected<br />
hello.s:7: error: attempt to define a local label before any non-local labels<br />
hello.s:7: error: parser: instruction expected<br />
hello.s:9: error: parser: instruction expected<br />
hello.s:10: error: parser: instruction expected<br />
hello.s:11: error: parser: instruction expected<br />
hello.s:12: error: parser: instruction expected<br />
hello.s:13: error: symbol `movl&#8217; redefined<br />
hello.s:13: error: parser: instruction expected<br />
hello.s:14: error: parser: instruction expected<br />
hello.s:15: error: symbol `addl&#8217; redefined<br />
hello.s:15: error: parser: instruction expected<br />
hello.s:16: error: parser: instruction expected<br />
hello.s:17: error: parser: instruction expected<br />
hello.s:18: error: symbol `subl&#8217; redefined<br />
hello.s:18: error: parser: instruction expected<br />
hello.s:19: error: symbol `subl&#8217; redefined<br />
hello.s:19: error: parser: instruction expected<br />
hello.s:20: error: symbol `pushl&#8217; redefined<br />
hello.s:20: error: parser: instruction expected<br />
hello.s:22: error: symbol `addl&#8217; redefined<br />
hello.s:22: error: parser: instruction expected<br />
hello.s:23: error: symbol `movl&#8217; redefined<br />
hello.s:23: error: parser: instruction expected<br />
hello.s:26: error: parser: instruction expected<br />
hello.s:27: error: parser: instruction expected<br />
hello.s:28: error: parser: instruction expected<br />
<font color="red">bt</font> <font color="blue">hello</font> #</p></blockquote>
<p>It wasn&#8217;t after a lot of reading that I realized that the two syntaxes are completely different.  This explained why my attempts at correcting these errors did not work at all.  Of course, hunting for the problem lead me to some very useful resources.</p>
<ul>
<li> <a href="http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/24592.pdf" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.amd.com');">AMD64 Architecture Programmer&#8217;s Manual Volume 1: Application Programming</a></li>
<li><a href="http://asm.sourceforge.net/articles/linasm.html" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/asm.sourceforge.net');">Using Assembly Language in Linux.</a></li>
<li><a href="http://members.save-net.com/jko@save-net.com/asm/h_code_tut.htm" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/members.save-net.com');">Linux Assembly Tutorial: Step-by-Step Guide</a></li>
<li><a href="http://home.comcast.net/~fbkotler/nasmdoc0.html" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/home.comcast.net');">The Netwide Assembler: NASM</a></li>
<li><a href="http://sig9.com/articles/att-syntax" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/sig9.com');">AT&amp;T Assembly Syntax</a></li>
</ul>
<p>From these resources I determined there were three ways to compile and run the Hello World assembly code program.  For the AT&amp;T syntax a developer could use the GCC command or a combination of the AS and LD commands (yes, as I am working on Linux, case sensitivity does matter, but I am using caps for emphasis).  The INTEL syntax requires the use of NASM and LD.  The following output shows the compilation performed in each case.  Note the size of the executable generated by the GCC command (ouch!!).</p>
<blockquote><p><strong>NASM Command</strong></p>
<p><font color="red">bt</font> <font color="blue">nasm</font> # nasm -f elf hello.asm<br />
<font color="red">bt</font> <font color="blue">nasm</font> # ld -s -o hello_nasm.exe hello.o<br />
<font color="red">bt</font> <font color="blue">nasm</font> # ./hello_nasm.exe<br />
Hello World<br />
<font color="red">bt</font> <font color="blue">nasm</font> # ls -al<br />
total 20<br />
drwxr-xr-x 2 root root 4096 Apr 26 23:46 ./<br />
drwxr-xr-x 3 root root 4096 Apr 26 23:39 ../<br />
-rw-r&#8211;r&#8211; 1 root root  685 Apr 26 23:46 hello.asm<br />
-rw-r&#8211;r&#8211; 1 root root  720 Apr 26 23:46 hello.o<br />
-rwxr-xr-x 1 root root  <strong>536</strong> Apr 26 23:46 <strong>hello_nasm.exe*</strong><br />
<font color="red">bt</font> <font color="blue">nasm</font> #</p>
<p><strong>AS Command</strong></p>
<p><font color="red">bt</font> <font color="blue">as</font> # as -o hello_as.o hello_as.s<br />
<font color="red">bt</font> <font color="blue">as</font> # ld -s -o hello_hello_as.o<br />
<font color="red">bt</font> <font color="blue">as</font> # ./hello_as.exe<br />
Hello World</p>
<p><font color="red">bt</font> <font color="blue">as</font> # ls -al<br />
total 20<br />
drwxr-xr-x 2 root root 4096 Apr 27 00:00 ./<br />
drwxr-xr-x 4 root root 4096 Apr 26 23:55 ../<br />
-rwxr-xr-x 1 root root  <strong>444</strong> Apr 27 00:00 <strong>hello_as.exe*</strong>    <em><strong>&lt;-NOTE: Size Winner Is AS</strong></em><br />
-rw-r&#8211;r&#8211; 1 root root  620 Apr 27 00:00 hello_as.o<br />
-rw-r&#8211;r&#8211; 1 root root  770 Apr 27 00:00 hello_as.s<br />
<font color="red">bt</font> <font color="blue">as</font> #</p>
<p><strong>GCC Command</strong></p>
<p><font color="red">bt</font> <font color="blue">hello</font> # gcc -o hello.exe hello.s<br />
<font color="red">bt</font> <font color="blue">hello</font> # gcc -s -o hello_stripped.exe hello.s<br />
<font color="red">bt</font> <font color="blue">hello</font> # ls -al<br />
total 32<br />
drwxr-xr-x  4 root root 4096 Apr 27 00:48 ./<br />
drwxr-xr-x 12 root root 4096 Apr 23 20:19 ../<br />
drwxr-xr-x  2 root root 4096 Apr 27 00:00 as/<br />
-rwxr-xr-x  1 root root <strong>7932</strong> Apr 27 00:48 <strong>hello.exe*</strong><br />
-rw-r&#8211;r&#8211;  1 root root  766 Apr 26 22:59 hello.s<br />
-rwxr-xr-x  1 root root <strong>2808</strong> Apr 27 00:48 <strong>hello_stripped.exe*</strong>    <em><strong>&lt;-NOTE: Even stripped GCC is bigger</strong></em><br />
drwxr-xr-x  2 root root 4096 Apr 26 23:54 nasm/<br />
<font color="red">bt</font> <font color="blue">hello</font> # ./hello.exe<br />
Hello World</p>
<p><font color="red">bt</font> <font color="blue">hello</font> # ./hello_stripped.exe<br />
Hello World</p>
<p><font color="red">bt</font> <font color="blue">hello</font> #</p></blockquote>
<p>It is very easy to see that how you compile the assembly code leads directly to the size of the executable and, perhaps, the speed and stability as well.  Of course I cannot prove either of these theories, but I will take this guess because of the additional systems calls that go into the GCC version.</p>
<p>What I can do, in the meantime, is show you how these programs appear after they have been run through a disassembler.  The versions compiled via AS and NASM are amazingly similar.  The version compiled through GCC, however, is not even close.  It&#8217;s output really shows how the additional libraries play a roll in the overall size of this executable.  To disassemble these programs I will use the latest version of atlas&#8217; <a href="http://atlas.r4780y.com/resources/disass-3.0-080424.tgz" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/atlas.r4780y.com');">Disass-3.0</a>.  I&#8217;ll leave the download and installation of this tool up to you.</p>
<blockquote><p><strong>NASM</strong></p>
<p><font color="red">bt</font> <font color="blue">nasm</font> # disass-cli hello_nasm.exe<br />
VirtualMemory:init:section:  .text<br />
BEGIN Processing Sub: ELF Start, .text (8048080)   &#8230;..END Processing Sub: ELF Start, .text (8048080)<br />
disass v3.00 Enhanced Disassembler<br />
ELF HEADER OBJECT:hello_nasm.exe<br />
= Intimate Details:<br />
==Magic:                                ELF<br />
==Type:                                 Executable file<br />
==Machine Arch:                         Intel 80386<br />
==Version:                              1<br />
==Entry:                                0&#215;08048080<br />
==Program Headers(offset):              52 (0&#215;34) bytes<br />
==Section Headers(offset):              256 (0&#215;100) bytes<br />
==Flags:                                0L<br />
==Elf Header Size:                      52 (0&#215;34 bytes)<br />
==Program Header Size:                  32 (0&#215;20 bytes)<br />
==Program Header Count:                 2 (0&#215;2)<br />
==Section Header Size:                  40 (0&#215;28 bytes)<br />
==Section Header Count:                 7 (0&#215;7)<br />
==Section Header String Index           6 (0&#215;6 bytes)</p>
<p>= Sections:<br />
Elf Section: [                    ] VMA: 0&#215;00000000  offset:        0  ent/size:        0/       0  align:        0<br />
Elf Section: [               .text] VMA: 0&#215;08048080  offset:      128  ent/size:        0/      35  align:       16<br />
Elf Section: [            .got.plt] VMA: 0&#215;080490a4  offset:      176  ent/size:        0/       0  align:        1<br />
Elf Section: [               .data] VMA: 0&#215;080490a4  offset:      164  ent/size:        0/      12  align:        4<br />
Elf Section: [                .bss] VMA: 0&#215;080490b0  offset:      176  ent/size:        0/       0  align:        1<br />
Elf Section: [            .comment] VMA: 0&#215;00000000  offset:      176  ent/size:        0/      31  align:        1<br />
Elf Section: [           .shstrtab] VMA: 0&#215;00000000  offset:      207  ent/size:        0/      46  align:        1</p>
<p>= Program Headers:<br />
[           Loadable program segment] VMA: 0&#215;08048000  offset:        0  memsize:      163  align:     4096  (filesz:      163)  flags: 5<br />
[           Loadable program segment] VMA: 0&#215;080490a4  offset:      164  memsize:       12  align:     4096  (filesz:       12)  flags: 6<br />
Dynamics:</p>
<p>Virtual Memory: hello_nasm.exe,          start: 8048080,         flags: 0</p>
<p><strong>====== Section Header:       .text ======<br />
======  Starting Address:       0&#215;08048080      Length:         0&#215;0023<br />
======  File Offset:            0&#215;0080          Size in File:   0&#215;0023<br />
======  Size in Memory:         0&#215;0000<br />
==================</strong></p>
<p>Subroutine: ELF Start, .text (8048080)   9 lines         0&#215;23 bytes<br />
Starting address: 8048080               Ending address: 80480a2</p>
<p>;       ELF Start, .text<br />
<strong> 8048080:                   \xb8\x04\x00\x00\x00        mov           $0&#215;4, %eax<br />
8048085:                   \xbb\x01\x00\x00\x00        mov           $0&#215;1, %ebx<br />
804808a:                   \xb9\xa4\x90\x04\x08        mov           $0&#215;80490a4, %ecx             ;  .got.plt, .data, &#8216;Hello World<br />
&#8216; (.data)<br />
804808f:                   \xba\x0c\x00\x00\x00        mov           $0xc, %edx<br />
8048094:                               \xcd\x80        int           $0&#215;80<br />
8048096:                   \xb8\x01\x00\x00\x00        mov           $0&#215;1, %eax<br />
804809b:                   \xbb\x00\x00\x00\x00        mov           $0&#215;0, %ebx<br />
80480a0:                               \xcd\x80        int           $0&#215;80<br />
80480a2:                                   \xc3        ret</strong><br />
End Subroutine: ELF Start, .text (8048080)       9 lines         0&#215;23 bytes<br />
8048080: ELF Start, .text<br />
80490a4: .got.plt, .data, &#8216;Hello World<br />
&#8216; (.data)<br />
80490b0: .bss</p>
<p><font color="red">bt</font> <font color="blue">nasm</font> #</p>
<p><strong>AS</strong></p>
<p><font color="red">bt</font> <font color="blue">as</font> # disass-cli hello_as.exe<br />
VirtualMemory:init:section:  .text<br />
BEGIN Processing Sub: ELF Start, .text (8048074)   &#8230;..END Processing Sub: ELF Start, .text (8048074)<br />
disass v3.00 Enhanced Disassembler<br />
ELF HEADER OBJECT:hello_as.exe<br />
= Intimate Details:<br />
==Magic:                                ELF<br />
==Type:                                 Executable file<br />
==Machine Arch:                         Intel 80386<br />
==Version:                              1<br />
==Entry:                                0&#215;08048074<br />
==Program Headers(offset):              52 (0&#215;34) bytes<br />
==Section Headers(offset):              204 (0xcc) bytes<br />
==Flags:                                0L<br />
==Elf Header Size:                      52 (0&#215;34 bytes)<br />
==Program Header Size:                  32 (0&#215;20 bytes)<br />
==Program Header Count:                 2 (0&#215;2)<br />
==Section Header Size:                  40 (0&#215;28 bytes)<br />
==Section Header Count:                 6 (0&#215;6)<br />
==Section Header String Index           5 (0&#215;5 bytes)</p>
<p>= Sections:<br />
Elf Section: [                    ] VMA: 0&#215;00000000  offset:        0  ent/size:        0/       0  align:        0<br />
Elf Section: [               .text] VMA: 0&#215;08048074  offset:      116  ent/size:        0/      35  align:        4<br />
Elf Section: [            .got.plt] VMA: 0&#215;08049098  offset:      167  ent/size:        0/       0  align:        1<br />
Elf Section: [               .data] VMA: 0&#215;08049098  offset:      152  ent/size:        0/      15  align:        4<br />
Elf Section: [                .bss] VMA: 0&#215;080490a8  offset:      167  ent/size:        0/       0  align:        4<br />
Elf Section: [           .shstrtab] VMA: 0&#215;00000000  offset:      167  ent/size:        0/      37  align:        1</p>
<p>= Program Headers:<br />
[           Loadable program segment] VMA: 0&#215;08048000  offset:        0  memsize:      151  align:     4096  (filesz:      151)  flags: 5<br />
[           Loadable program segment] VMA: 0&#215;08049098  offset:      152  memsize:       16  align:     4096  (filesz:       15)  flags: 6<br />
Dynamics:</p>
<p>Virtual Memory: hello_as.exe,    start: 8048074,         flags: 0</p>
<p><strong>====== Section Header:       .text ======<br />
======  Starting Address:       0&#215;08048074      Length:         0&#215;0023<br />
======  File Offset:            0&#215;0074          Size in File:   0&#215;0023<br />
======  Size in Memory:         0&#215;0000<br />
==================</strong></p>
<p>Subroutine: ELF Start, .text (8048074)   9 lines         0&#215;23 bytes<br />
Starting address: 8048074               Ending address: 8048096</p>
<p>;       ELF Start, .text<br />
<strong> 8048074:                   \xb8\x04\x00\x00\x00        mov           $0&#215;4, %eax<br />
8048079:                   \xbb\x01\x00\x00\x00        mov           $0&#215;1, %ebx<br />
804807e:                   \xb9\x98\x90\x04\x08        mov           $0&#215;8049098, %ecx             ;  .got.plt, .data, &#8216;Hello World<br />
&#8216; (.data)<br />
8048083:                   \xba\xa5\x90\x04\x08        mov           $0&#215;80490a5, %edx             ;  &#8216;\x0c&#8217; (.data)<br />
8048088:                               \xcd\x80        int           $0&#215;80<br />
804808a:                   \xb8\x01\x00\x00\x00        mov           $0&#215;1, %eax<br />
804808f:                   \xbb\x00\x00\x00\x00        mov           $0&#215;0, %ebx<br />
8048094:                               \xcd\x80        int           $0&#215;80<br />
8048096:                                   \xc3        ret</strong><br />
End Subroutine: ELF Start, .text (8048074)       9 lines         0&#215;23 bytes<br />
8048074: ELF Start, .text<br />
8049098: .got.plt, .data, &#8216;Hello World<br />
&#8216; (.data)<br />
80490a5: &#8216;\x0c&#8217; (.data)<br />
80490a8: .bss</p>
<p><font color="red">bt</font> <font color="blue">as</font> #</p>
<p><strong>GCC</strong></p>
<p><font color="red">bt</font> hello # disass-cli hello.exe<br />
VirtualMemory:init:section:  .init<br />
BEGIN Processing Sub: .init, (), _init(), , _init (8048260)   &#8230;..END Processing Sub: .init, (), _init(), , _init (8048260)<br />
VirtualMemory:init:section:  .plt<br />
BEGIN Processing Sub: .plt, (),  (8048278)   &#8230;..END Processing Sub: .plt, (),  (8048278)<br />
BEGIN Processing Sub: __libc_start_main()  (PLT) (8048288)   &#8230;..END Processing Sub: __libc_start_main()  (PLT) (8048288)<br />
VirtualMemory:init:section:  .text<br />
BEGIN Processing Sub: ELF Start, .text, (), _start(), , _start (80482a0)   &#8230;..END Processing Sub: ELF Start, .text, (), _start(), , _start (80482a0)<br />
BEGIN Processing Sub: __libc_csu_fini(), __libc_csu_fini (8048400)   &#8230;..END Processing Sub: __libc_csu_fini(), __libc_csu_fini (8048400)<br />
BEGIN Processing Sub: __libc_csu_init(), __libc_csu_init (80483a0)   &#8230;..END Processing Sub: __libc_csu_init(), __libc_csu_init (80483a0)<br />
BEGIN Processing Sub: __do_global_ctors_aux(), __do_global_ctors_aux (8048450)   &#8230;..END Processing Sub: __do_global_ctors_aux(), __do_global_ctors_aux (8048450)<br />
BEGIN Processing Sub: frame_dummy(), frame_dummy (8048340)   &#8230;..END Processing Sub: frame_dummy(), frame_dummy (8048340)<br />
BEGIN Processing Sub: call_gmon_start(), call_gmon_start (80482d0)   &#8230;..END Processing Sub: call_gmon_start(), call_gmon_start (80482d0)<br />
BEGIN Processing Sub: __do_global_dtors_aux(), __do_global_dtors_aux (8048300)   &#8230;..END Processing Sub: __do_global_dtors_aux(), __do_global_dtors_aux (8048300)<br />
VirtualMemory:init:section:  .fini<br />
BEGIN Processing Sub: .fini, (), _fini(), , _fini (8048480)   &#8230;..END Processing Sub: .fini, (), _fini(), , _fini (8048480)<br />
disass v3.00 Enhanced Disassembler<br />
ELF HEADER OBJECT:hello.exe<br />
= Intimate Details:<br />
==Magic:                                ELF<br />
==Type:                                 Executable file<br />
==Machine Arch:                         Intel 80386<br />
==Version:                              1<br />
==Entry:                                0&#215;080482a0<br />
==Program Headers(offset):              52 (0&#215;34) bytes<br />
==Section Headers(offset):              3484 (0xd9c) bytes<br />
==Flags:                                0L<br />
==Elf Header Size:                      52 (0&#215;34 bytes)<br />
==Program Header Size:                  32 (0&#215;20 bytes)<br />
==Program Header Count:                 7 (0&#215;7)<br />
==Section Header Size:                  40 (0&#215;28 bytes)<br />
==Section Header Count:                 34 (0&#215;22)<br />
==Section Header String Index           31 (0&#215;1f bytes)</p>
<p>= Sections:<br />
Elf Section: [                    ] VMA: 0&#215;00000000  offset:        0  ent/size:        0/       0  align:        0<br />
Elf Section: [             .interp] VMA: 0&#215;08048114  offset:      276  ent/size:        0/      19  align:        1<br />
Elf Section: [       .note.ABI-tag] VMA: 0&#215;08048128  offset:      296  ent/size:        0/      32  align:        4<br />
Elf Section: [               .hash] VMA: 0&#215;08048148  offset:      328  ent/size:        4/      40  align:        4<br />
Elf Section: [             .dynsym] VMA: 0&#215;08048170  offset:      368  ent/size:       16/      80  align:        4<br />
Elf Section: [             .dynstr] VMA: 0&#215;080481c0  offset:      448  ent/size:        0/      89  align:        1<br />
Elf Section: [        .gnu.version] VMA: 0&#215;0804821a  offset:      538  ent/size:        2/      10  align:        2<br />
Elf Section: [      .gnu.version_r] VMA: 0&#215;08048224  offset:      548  ent/size:        0/      32  align:        4<br />
Elf Section: [            .rel.dyn] VMA: 0&#215;08048244  offset:      580  ent/size:        8/       8  align:        4<br />
Elf Section: [            .rel.plt] VMA: 0&#215;0804824c  offset:      588  ent/size:        8/       8  align:        4<br />
Elf Section: [               .init] VMA: 0&#215;08048260  offset:      608  ent/size:        0/      23  align:       16<br />
Elf Section: [                .plt] VMA: 0&#215;08048278  offset:      632  ent/size:        4/      32  align:        4<br />
Elf Section: [               .text] VMA: 0&#215;080482a0  offset:      672  ent/size:        0/     480  align:       16<br />
Elf Section: [               .fini] VMA: 0&#215;08048480  offset:     1152  ent/size:        0/      27  align:       16<br />
Elf Section: [             .rodata] VMA: 0&#215;0804849c  offset:     1180  ent/size:        0/       8  align:        4<br />
Elf Section: [           .eh_frame] VMA: 0&#215;080484a4  offset:     1188  ent/size:        0/       4  align:        4<br />
Elf Section: [              .ctors] VMA: 0&#215;080494a8  offset:     1192  ent/size:        0/       8  align:        4<br />
Elf Section: [              .dtors] VMA: 0&#215;080494b0  offset:     1200  ent/size:        0/       8  align:        4<br />
Elf Section: [                .jcr] VMA: 0&#215;080494b8  offset:     1208  ent/size:        0/       4  align:        4<br />
Elf Section: [            .dynamic] VMA: 0&#215;080494bc  offset:     1212  ent/size:        8/     200  align:        4<br />
Elf Section: [                .got] VMA: 0&#215;08049584  offset:     1412  ent/size:        4/       4  align:        4<br />
Elf Section: [            .got.plt] VMA: 0&#215;08049588  offset:     1416  ent/size:        4/      16  align:        4<br />
Elf Section: [               .data] VMA: 0&#215;08049598  offset:     1432  ent/size:        0/      28  align:        4<br />
Elf Section: [                .bss] VMA: 0&#215;080495b4  offset:     1460  ent/size:        0/       4  align:        4<br />
Elf Section: [            .comment] VMA: 0&#215;00000000  offset:     1460  ent/size:        0/     108  align:        1<br />
Elf Section: [      .debug_aranges] VMA: 0&#215;00000000  offset:     1568  ent/size:        0/     136  align:        8<br />
Elf Section: [     .debug_pubnames] VMA: 0&#215;00000000  offset:     1704  ent/size:        0/      37  align:        1<br />
Elf Section: [         .debug_info] VMA: 0&#215;00000000  offset:     1741  ent/size:        0/     642  align:        1<br />
Elf Section: [       .debug_abbrev] VMA: 0&#215;00000000  offset:     2383  ent/size:        0/     118  align:        1<br />
Elf Section: [         .debug_line] VMA: 0&#215;00000000  offset:     2501  ent/size:        0/     511  align:        1<br />
Elf Section: [          .debug_str] VMA: 0&#215;00000000  offset:     3012  ent/size:        1/     174  align:        1<br />
Elf Section: [           .shstrtab] VMA: 0&#215;00000000  offset:     3186  ent/size:        0/     295  align:        1<br />
Elf Section: [             .symtab] VMA: 0&#215;00000000  offset:     4844  ent/size:       16/    1984  align:        4<br />
Elf Section: [             .strtab] VMA: 0&#215;00000000  offset:     6828  ent/size:        0/    1104  align:        1</p>
<p>= Program Headers:<br />
[      Entry for header table itself] VMA: 0&#215;08048034  offset:       52  memsize:      224  align:        4  (filesz:      224)  flags: 5<br />
[                Program interpreter] VMA: 0&#215;08048114  offset:      276  memsize:       19  align:        1  (filesz:       19)  flags: 4<br />
[           Loadable program segment] VMA: 0&#215;08048000  offset:        0  memsize:     1192  align:     4096  (filesz:     1192)  flags: 5<br />
[           Loadable program segment] VMA: 0&#215;080494a8  offset:     1192  memsize:      272  align:     4096  (filesz:      268)  flags: 6<br />
[        Dynamic linking information] VMA: 0&#215;080494bc  offset:     1212  memsize:      200  align:        4  (filesz:      200)  flags: 6<br />
[              Auxiliary information] VMA: 0&#215;08048128  offset:      296  memsize:       32  align:        4  (filesz:       32)  flags: 4<br />
[      Indicates stack executability] VMA: 0&#215;00000000  offset:        0  memsize:        0  align:        4  (filesz:        0)  flags: 7<br />
Dynamics:<br />
libc.so.6 Name of needed library<br />
0&#215;8048260L Address of init function<br />
0&#215;8048480L Address of termination function<br />
0&#215;8048148L Address of symbol hash table<br />
0&#215;80481C0L Address of string table<br />
0&#215;8048170L Address of symbol table<br />
0&#215;59L Size of string table<br />
0&#215;10L Size of one symbol table entry<br />
0&#215;0L For debugging; unspecified<br />
0&#215;8049588L Processor defined value<br />
0&#215;8L Size in bytes of PLT relocs<br />
0&#215;11L Type of reloc in PLT<br />
0&#215;804824CL Address of PLT relocs<br />
0&#215;8048244L Address of Rel relocs<br />
0&#215;8L Total size of Rel relocs<br />
0&#215;8L Size of one Rel reloc<br />
0&#215;8048224L Unknown: 0&#215;6FFFFFFEL<br />
0&#215;1L Unknown: 0&#215;6FFFFFFFL<br />
0&#215;804821AL Unknown: 0&#215;6FFFFFF0L<br />
0&#215;0L Marks end of dynamic section</p>
<p>Virtual Memory: hello.exe,       start: 80482a0,         flags: 0</p>
<p>====== Section Header:       .init ======<br />
======  Starting Address:       0&#215;08048260      Length:         0&#215;0017<br />
======  File Offset:            0&#215;0260          Size in File:   0&#215;0017<br />
======  Size in Memory:         0&#215;0000<br />
==================</p>
<p>Subroutine: .init, (), _init(), , _init (8048260)        8 lines         0&#215;17 bytes<br />
Starting address: 8048260               Ending address: 8048276</p>
<p>;       .init, (), _init(), , _init<br />
Called from: __libc_csu_init(), __libc_csu_init (80483a0)   at 80483b6<br />
8048260:                                   \x55        push          %ebp<br />
8048261:                               \x89\xe5        mov           %esp, %ebp<br />
8048263:                           \x83\xec\x08        sub           $0&#215;8, %esp<br />
8048266:                   \xe8\x65\x00\x00\x00        call          0&#215;80482d0                         ;  call_gmon_start(), call_gmon_start<br />
804826b:                   \xe8\xd0\x00\x00\x00        call          0&#215;8048340                         ;  frame_dummy(), frame_dummy<br />
8048270:                   \xe8\xdb\x01\x00\x00        call          0&#215;8048450                         ;  __do_global_ctors_aux(), __do_global_ctors_aux<br />
8048275:                                   \xc9        leave<br />
8048276:                                   \xc3        ret<br />
End Subroutine: .init, (), _init(), , _init (8048260)    8 lines         0&#215;17 bytes</p>
<p>====== Section Header:       .plt ======<br />
======  Starting Address:       0&#215;08048278      Length:         0&#215;0020<br />
======  File Offset:            0&#215;0278          Size in File:   0&#215;0020<br />
======  Size in Memory:         0&#215;0004<br />
==================</p>
<p>Subroutine: .plt, (),  (8048278)         4 lines         0&#215;10 bytes</p>
<p>;       .plt, (),<br />
JMPed from: __libc_start_main()  (PLT) (8048288)   at 8048293<br />
8048278:               \xff\x35\x8c\x95\x04\x08        pushl         0&#215;804958c                         ;  &#8216;\x00\x00\x00\x00\x00&#8242;&#8230; (.got.plt+0&#215;4)<br />
804827e:               \xff\x25\x90\x95\x04\x08        jmpl          *0&#215;8049590                        ;  &#8216;\x00\x00\x00\x00\x8e\x82\x04\x08&#8242;&#8230; (.got.plt+0&#215;8)<br />
8048284:                               \x00\x00        add           %al, (%eax)<br />
8048286:                               \x00\x00        add           %al, (%eax)<br />
End Subroutine: .plt, (),  (8048278)     4 lines         0&#215;10 bytes</p>
<p>Subroutine: __libc_start_main()  (PLT) (8048288)         3 lines         0&#215;10 bytes</p>
<p>;       __libc_start_main()  (PLT)<br />
Called from: ELF Start, .text, (), _start(), , _start (80482a0)   at 80482bc<br />
8048288:               \xff\x25\x94\x95\x04\x08        jmpl          *0&#215;8049594                        ;  __libc_start_main()<br />
804828e:                   \x68\x00\x00\x00\x00        push          $0&#215;0<br />
8048293:                   \xe9\xe0\xff\xff\xff        jmp           0&#215;8048278                         ; jmp .plt, (),  (8048278)  :-1b:<br />
End Subroutine: __libc_start_main()  (PLT) (8048288)     3 lines         0&#215;10 bytes</p>
<p><strong>====== Section Header:       .text ======<br />
======  Starting Address:       0&#215;080482a0      Length:         0&#215;01e0<br />
======  File Offset:            0&#215;02a0          Size in File:   0&#215;01e0<br />
======  Size in Memory:         0&#215;0000<br />
==================</strong></p>
<p>Subroutine: ELF Start, .text, (), _start(), , _start (80482a0)   28 lines        0&#215;30 bytes<br />
Starting address: 80482a0               Ending address: 80482cf</p>
<p>;       ELF Start, .text, (), _start(), , _start<br />
<strong> 80482a0:                               \x31\xed        xor           %ebp, %ebp<br />
80482a2:                                   \x5e        pop           %esi<br />
80482a3:                               \x89\xe1        mov           %esp, %ecx<br />
80482a5:                           \x83\xe4\xf0        and           $0xf0, %esp<br />
80482a8:                                   \x50        push          %eax<br />
80482a9:                                   \x54        push          %esp<br />
80482aa:                                   \x52        push          %edx<br />
80482ab:                   \x68\x00\x84\x04\x08        push          $0&#215;8048400                        ; push __libc_csu_fini(), __libc_csu_fini (8048400)  :+155:<br />
80482b0:                   \x68\xa0\x83\x04\x08        push          $0&#215;80483a0                        ; push __libc_csu_init(), __libc_csu_init (80483a0)  :+f0:<br />
80482b5:                                   \x51        push          %ecx<br />
80482b6:                                   \x56        push          %esi<br />
80482b7:                   \x68\x74\x83\x04\x08        push          $0&#215;8048374                        ; push frame_dummy(), frame_dummy (8048340) (+0&#215;34)  :+bd:<br />
80482bc:                   \xe8\xc7\xff\xff\xff        call          0&#215;8048288                         ; call __libc_start_main()  (PLT) (8048288)  :-34:<br />
80482c1:                                   \xf4        hlt</strong><br />
80482c2:                                   \x90        nop<br />
80482c3:                                   \x90        nop<br />
80482c4:                                   \x90        nop<br />
80482c5:                                   \x90        nop<br />
80482c6:                                   \x90        nop<br />
80482c7:                                   \x90        nop<br />
80482c8:                                   \x90        nop<br />
80482c9:                                   \x90        nop<br />
80482ca:                                   \x90        nop<br />
80482cb:                                   \x90        nop<br />
80482cc:                                   \x90        nop<br />
80482cd:                                   \x90        nop<br />
80482ce:                                   \x90        nop<br />
80482cf:                                   \x90        nop<br />
End Subroutine: ELF Start, .text, (), _start(), , _start (80482a0)       28 lines        0&#215;30 bytes</p>
<p>Subroutine: call_gmon_start(), call_gmon_start (80482d0)         26 lines        0&#215;30 bytes<br />
Starting address: 80482d0               Ending address: 80482ff</p>
<p>;       call_gmon_start(), call_gmon_start<br />
80482d0:                                   \x55        push          %ebp<br />
80482d1:                               \x89\xe5        mov           %esp, %ebp<br />
80482d3:                                   \x53        push          %ebx<br />
80482d4:                           \x83\xec\x04        sub           $0&#215;4, %esp<br />
80482d7:                   \xe8\x16\x00\x00\x00        call          0&#215;80482f2                         ; call (local)  :+1b:<br />
80482dc:               \x81\xc3\xac\x12\x00\x00        add           $0&#215;12ac, %ebx<br />
80482e2:               \x8b\x83\xfc\xff\xff\xff        mov           0xfffffffc(%ebx), %eax<br />
80482e8:                               \x85\xc0        test          %eax, %eax<br />
80482ea:                               \x74\x02        jz            0&#215;80482ee                         ; jz  (local)  :+4:<br />
80482ec:                               \xff\xd0        call          *%eax</p>
<p>Referenced by: (local)   at 80482ea<br />
80482ee:                                   \x58        pop           %eax<br />
80482ef:                                   \x5b        pop           %ebx<br />
80482f0:                                   \x5d        pop           %ebp<br />
80482f1:                                   \xc3        ret</p>
<p>;       __i686.get_pc_thunk.bx(), __i686.get_pc_thunk.bx<br />
Called from: __libc_csu_fini(), __libc_csu_fini (8048400)   at 8048409<br />
Called from: __libc_csu_init(), __libc_csu_init (80483a0)   at 80483ab<br />
Called from: (local)   at 80482d7<br />
Called from: .fini, (), _fini(), , _fini (8048480)   at 8048487<br />
80482f2:                           \x8b\x1c\x24        mov           (%esp), %ebx<br />
80482f5:                                   \xc3        ret<br />
80482f6:                                   \x90        nop<br />
80482f7:                                   \x90        nop<br />
80482f8:                                   \x90        nop<br />
80482f9:                                   \x90        nop<br />
80482fa:                                   \x90        nop<br />
80482fb:                                   \x90        nop<br />
80482fc:                                   \x90        nop<br />
80482fd:                                   \x90        nop<br />
80482fe:                                   \x90        nop<br />
80482ff:                                   \x90        nop<br />
End Subroutine: call_gmon_start(), call_gmon_start (80482d0)     26 lines        0&#215;30 bytes</p>
<p>Subroutine: __do_global_dtors_aux(), __do_global_dtors_aux (8048300)     31 lines        0&#215;40 bytes<br />
Starting address: 8048300               Ending address: 804833f</p>
<p>;       __do_global_dtors_aux(), __do_global_dtors_aux<br />
Called from: .fini, (), _fini(), , _fini (8048480)   at 8048492<br />
8048300:                                   \x55        push          %ebp<br />
8048301:                               \x89\xe5        mov           %esp, %ebp<br />
8048303:                           \x83\xec\x08        sub           $0&#215;8, %esp<br />
8048306:           \x80\x3d\xb4\x95\x04\x08\x00        cmpb          $0&#215;0, 0&#215;80495b4                   ;  .bss, (), completed.1(), __bss_start(), _edata(), , completed.1, __bss_start, _edata<br />
804830d:                               \x74\x1b        jz            0&#215;804832a                         ; jz  (local)  :+1d:<br />
804830f:                               \xeb\x2b        jmp           0&#215;804833c                         ; jmp (local)  :+2d:<br />
8048311:                               \xeb\x0d        jmp           0&#215;8048320                         ; jmp (local)  :+f:<br />
8048313:                                   \x90        nop<br />
8048314:                                   \x90        nop<br />
8048315:                                   \x90        nop<br />
8048316:                                   \x90        nop<br />
8048317:                                   \x90        nop<br />
8048318:                                   \x90        nop<br />
8048319:                                   \x90        nop<br />
804831a:                                   \x90        nop<br />
804831b:                                   \x90        nop<br />
804831c:                                   \x90        nop<br />
804831d:                                   \x90        nop<br />
804831e:                                   \x90        nop<br />
804831f:                                   \x90        nop</p>
<p>Referenced by: (local)   at 8048333<br />
JMPed from: (local)   at 8048311<br />
8048320:                           \x83\xc0\x04        add           $0&#215;4, %eax<br />
8048323:                   \xa3\xa0\x95\x04\x08        mov           %eax, 0&#215;80495a0<br />
8048328:                               \xff\xd2        call          *%edx</p>
<p>Referenced by: (local)   at 804830d<br />
804832a:                   \xa1\xa0\x95\x04\x08        mov           0&#215;80495a0, %eax<br />
804832f:                               \x8b\x10        mov           (%eax), %edx<br />
8048331:                               \x85\xd2        test          %edx, %edx<br />
8048333:                               \x75\xeb        jnz           0&#215;8048320                         ; jnz (local)  :-13:<br />
8048335:           \xc6\x05\xb4\x95\x04\x08\x01        movb          $0&#215;1, 0&#215;80495b4                   ;  .bss, (), completed.1(), __bss_start(), _edata(), , completed.1, __bss_start, _edata</p>
<p>JMPed from: (local)   at 804830f<br />
804833c:                                   \xc9        leave<br />
804833d:                                   \xc3        ret<br />
804833e:                               \x89\xf6        mov           %esi, %esi<br />
End Subroutine: __do_global_dtors_aux(), __do_global_dtors_aux (8048300)         31 lines        0&#215;40 bytes</p>
<p>Subroutine: frame_dummy(), frame_dummy (8048340)         37 lines        0&#215;60 bytes<br />
Starting address: 8048340               Ending address: 804839f</p>
<p>;       frame_dummy(), frame_dummy<br />
8048340:                                   \x55        push          %ebp<br />
8048341:                               \x89\xe5        mov           %esp, %ebp<br />
8048343:                           \x83\xec\x08        sub           $0&#215;8, %esp<br />
8048346:                   \xa1\xb8\x94\x04\x08        mov           0&#215;80494b8, %eax<br />
804834b:                               \x85\xc0        test          %eax, %eax<br />
804834d:                               \x74\x21        jz            0&#215;8048370                         ; jz  (local)  :+23:<br />
804834f:                   \xb8\x00\x00\x00\x00        mov           $0&#215;0, %eax<br />
8048354:                               \x85\xc0        test          %eax, %eax<br />
8048356:                               \x74\x18        jz            0&#215;8048370                         ; jz  (local)  :+1a:<br />
8048358:                           \x83\xec\x0c        sub           $0xc, %esp<br />
804835b:                   \x68\xb8\x94\x04\x08        push          $0&#215;80494b8                        ;  .jcr, (), __JCR_LIST__(), __JCR_END__(), , __JCR_LIST__, __JCR_END__<br />
8048360:                   \xe8\x9b\x7c\xfb\xf7        call          0&#215;0<br />
8048365:                           \x83\xc4\x10        add           $0&#215;10, %esp<br />
8048368:                                   \x90        nop<br />
8048369:           \x8d\xb4\x26\x00\x00\x00\x00        lea           0&#215;0(%esi), %esi</p>
<p>Referenced by: (local)   at 804834d<br />
Referenced by: (local)   at 8048356<br />
8048370:                                   \xc9        leave<br />
8048371:                                   \xc3        ret<br />
8048372:                                   \x90        nop<br />
8048373:                                   \x90        nop</p>
<p>;       main(), main<br />
Referenced by: ELF Start, .text, (), _start(), , _start (80482a0)   at 80482b7<br />
8048374:                   \xb8\x04\x00\x00\x00        mov           $0&#215;4, %eax<br />
8048379:                   \xbb\x01\x00\x00\x00        mov           $0&#215;1, %ebx<br />
804837e:                   \xb9\xa4\x95\x04\x08        mov           $0&#215;80495a4, %ecx                  ;  hello(), hello<br />
8048383:                   \xba\xb1\x95\x04\x08        mov           $0&#215;80495b1, %edx                  ;  &#8216;\x0c&#8217; (.data) , hlen(), hlen<br />
8048388:                               \xcd\x80        int           $0&#215;80<br />
804838a:                   \xb8\x01\x00\x00\x00        mov           $0&#215;1, %eax<br />
804838f:                   \xbb\x00\x00\x00\x00        mov           $0&#215;0, %ebx<br />
8048394:                               \xcd\x80        int           $0&#215;80<br />
8048396:                                   \xc3        ret<br />
8048397:                                   \x90        nop<br />
8048398:                                   \x90        nop<br />
8048399:                                   \x90        nop<br />
804839a:                                   \x90        nop<br />
804839b:                                   \x90        nop<br />
804839c:                                   \x90        nop<br />
804839d:                                   \x90        nop<br />
804839e:                                   \x90        nop<br />
804839f:                                   \x90        nop<br />
End Subroutine: frame_dummy(), frame_dummy (8048340)     37 lines        0&#215;60 bytes</p>
<p>Subroutine: __libc_csu_init(), __libc_csu_init (80483a0)         35 lines        0&#215;60 bytes<br />
Variables:<br />
fffffff0 (   10) _____________________________________________________<br />
Starting address: 80483a0               Ending address: 80483ff</p>
<p>;       __libc_csu_init(), __libc_csu_init<br />
Referenced by: ELF Start, .text, (), _start(), , _start (80482a0)   at 80482b0<br />
80483a0:                                   \x55        push          %ebp<br />
80483a1:                               \x89\xe5        mov           %esp, %ebp<br />
80483a3:                                   \x57        push          %edi<br />
80483a4:                                   \x56        push          %esi<br />
80483a5:                               \x31\xf6        xor           %esi, %esi<br />
80483a7:                                   \x53        push          %ebx<br />
80483a8:                           \x83\xec\x0c        sub           $0xc, %esp<br />
80483ab:                   \xe8\x42\xff\xff\xff        call          0&#215;80482f2                         ; call call_gmon_start(), call_gmon_start (80482d0) (+0&#215;22)  :-b9:<br />
80483b0:               \x81\xc3\xd8\x11\x00\x00        add           $0&#215;11d8, %ebx<br />
80483b6:                   \xe8\xa5\xfe\xff\xff        call          0&#215;8048260                         ; call .init, (), _init(), , _init (8048260)  :-156:<br />
80483bb:               \x8d\x83\x20\xff\xff\xff        lea           0xffffff20(%ebx), %eax<br />
80483c1:               \x8d\x93\x20\xff\xff\xff        lea           0xffffff20(%ebx), %edx<br />
80483c7:                           \x89\x45\xf0        mov           %eax, 0xfffffff0(%ebp)<br />
80483ca:                               \x29\xd0        sub           %edx, %eax<br />
80483cc:                           \xc1\xf8\x02        sar           $0&#215;2, %eax<br />
80483cf:                               \x39\xc6        cmp           %eax, %esi<br />
80483d1:                               \x73\x1f        jnc           0&#215;80483f2                         ; jnc (local)  :+21:<br />
80483d3:                               \x89\xd7        mov           %edx, %edi<br />
80483d5:                       \x8d\x74\x26\x00        lea           0&#215;0(%esi), %esi<br />
80483d9:           \x8d\xbc\x27\x00\x00\x00\x00        lea           0&#215;0(%edi), %edi</p>
<p>Referenced by: (local)   at 80483f0<br />
80483e0:                           \xff\x14\xb2        calll         *(%edx, %esi, 4)<br />
80483e3:                           \x8b\x4d\xf0        mov           0xfffffff0(%ebp), %ecx<br />
80483e6:                                   \x46        inc           %esi<br />
80483e7:                               \x89\xfa        mov           %edi, %edx<br />
80483e9:                               \x29\xf9        sub           %edi, %ecx<br />
80483eb:                           \xc1\xf9\x02        sar           $0&#215;2, %ecx<br />
80483ee:                               \x39\xce        cmp           %ecx, %esi<br />
80483f0:                               \x72\xee        jc            0&#215;80483e0                         ; jc  (local)  :-10:</p>
<p>Referenced by: (local)   at 80483d1<br />
80483f2:                           \x83\xc4\x0c        add           $0xc, %esp<br />
80483f5:                                   \x5b        pop           %ebx<br />
80483f6:                                   \x5e        pop           %esi<br />
80483f7:                                   \x5f        pop           %edi<br />
80483f8:                                   \x5d        pop           %ebp<br />
80483f9:                                   \xc3        ret<br />
80483fa:               \x8d\xb6\x00\x00\x00\x00        lea           0&#215;0(%esi), %esi<br />
End Subroutine: __libc_csu_init(), __libc_csu_init (80483a0)     35 lines        0&#215;60 bytes</p>
<p>Subroutine: __libc_csu_fini(), __libc_csu_fini (8048400)         30 lines        0&#215;50 bytes<br />
Variables:<br />
fffffffc (    4) _____________________________________________________<br />
fffffff8 (    4) _____________________________________________________<br />
fffffff4 (    4) _____________________________________________________<br />
Starting address: 8048400               Ending address: 804844f</p>
<p>;       __libc_csu_fini(), __libc_csu_fini<br />
Referenced by: ELF Start, .text, (), _start(), , _start (80482a0)   at 80482ab<br />
8048400:                                   \x55        push          %ebp<br />
8048401:                               \x89\xe5        mov           %esp, %ebp<br />
8048403:                           \x83\xec\x18        sub           $0&#215;18, %esp<br />
8048406:                           \x89\x5d\xf4        mov           %ebx, 0xfffffff4(%ebp)<br />
8048409:                   \xe8\xe4\xfe\xff\xff        call          0&#215;80482f2                         ; call call_gmon_start(), call_gmon_start (80482d0) (+0&#215;22)  :-117:<br />
804840e:               \x81\xc3\x7a\x11\x00\x00        add           $0&#215;117a, %ebx<br />
8048414:                           \x89\x7d\xfc        mov           %edi, 0xfffffffc(%ebp)<br />
8048417:               \x8d\x83\x20\xff\xff\xff        lea           0xffffff20(%ebx), %eax<br />
804841d:               \x8d\xbb\x20\xff\xff\xff        lea           0xffffff20(%ebx), %edi<br />
8048423:                           \x89\x75\xf8        mov           %esi, 0xfffffff8(%ebp)<br />
8048426:                               \x29\xf8        sub           %edi, %eax<br />
8048428:                           \xc1\xf8\x02        sar           $0&#215;2, %eax<br />
804842b:                           \x8d\x70\xff        lea           0xffffffff(%eax), %esi<br />
804842e:                               \xeb\x04        jmp           0&#215;8048434                         ; jmp (local)  :+6:</p>
<p>Referenced by: (local)   at 8048437<br />
8048430:                           \xff\x14\xb7        calll         *(%edi, %esi, 4)<br />
8048433:                                   \x4e        dec           %esi</p>
<p>JMPed from: (local)   at 804842e<br />
8048434:                           \x83\xfe\xff        cmp           $0xffffffff, %esi<br />
8048437:                               \x75\xf7        jnz           0&#215;8048430                         ; jnz (local)  :-7:<br />
8048439:                   \xe8\x42\x00\x00\x00        call          0&#215;8048480                         ;  .fini, (), _fini(), , _fini<br />
804843e:                           \x8b\x5d\xf4        mov           0xfffffff4(%ebp), %ebx<br />
8048441:                           \x8b\x75\xf8        mov           0xfffffff8(%ebp), %esi<br />
8048444:                           \x8b\x7d\xfc        mov           0xfffffffc(%ebp), %edi<br />
8048447:                               \x89\xec        mov           %ebp, %esp<br />
8048449:                                   \x5d        pop           %ebp<br />
804844a:                                   \xc3        ret<br />
804844b:                                   \x90        nop<br />
804844c:                                   \x90        nop<br />
804844d:                                   \x90        nop<br />
804844e:                                   \x90        nop<br />
804844f:                                   \x90        nop<br />
End Subroutine: __libc_csu_fini(), __libc_csu_fini (8048400)     30 lines        0&#215;50 bytes</p>
<p>Subroutine: __do_global_ctors_aux(), __do_global_ctors_aux (8048450)     30 lines        0&#215;30 bytes<br />
Starting address: 8048450               Ending address: 804847f</p>
<p>;       __do_global_ctors_aux(), __do_global_ctors_aux<br />
8048450:                                   \x55        push          %ebp<br />
8048451:                               \x89\xe5        mov           %esp, %ebp<br />
8048453:                                   \x53        push          %ebx<br />
8048454:                                   \x52        push          %edx<br />
8048455:                   \xbb\xa8\x94\x04\x08        mov           $0&#215;80494a8, %ebx                  ;  .ctors, &#8216;\xff\xff\xff\xff&#8217; (.ctors) , (), __CTOR_LIST__(), __fini_array_end(), __fini_array_start(), __init_array_end(), __init_array_start(), , __CTOR_LIST__, __fini_array_end, __fini_array_start, __init_array_end, __init_array_start<br />
804845a:                   \xa1\xa8\x94\x04\x08        mov           0&#215;80494a8, %eax<br />
804845f:                               \xeb\x16        jmp           0&#215;8048477                         ; jmp (local)  :+18:<br />
8048461:                               \xeb\x0d        jmp           0&#215;8048470                         ; jmp (local)  :+f:<br />
8048463:                                   \x90        nop<br />
8048464:                                   \x90        nop<br />
8048465:                                   \x90        nop<br />
8048466:                                   \x90        nop<br />
8048467:                                   \x90        nop<br />
8048468:                                   \x90        nop<br />
8048469:                                   \x90        nop<br />
804846a:                                   \x90        nop<br />
804846b:                                   \x90        nop<br />
804846c:                                   \x90        nop<br />
804846d:                                   \x90        nop<br />
804846e:                                   \x90        nop<br />
804846f:                                   \x90        nop</p>
<p>Referenced by: (local)   at 804847a<br />
JMPed from: (local)   at 8048461<br />
8048470:                           \x83\xeb\x04        sub           $0&#215;4, %ebx<br />
8048473:                               \xff\xd0        call          *%eax<br />
8048475:                               \x8b\x03        mov           (%ebx), %eax</p>
<p>JMPed from: (local)   at 804845f<br />
8048477:                           \x83\xf8\xff        cmp           $0xffffffff, %eax<br />
804847a:                               \x75\xf4        jnz           0&#215;8048470                         ; jnz (local)  :-a:<br />
804847c:                                   \x58        pop           %eax<br />
804847d:                                   \x5b        pop           %ebx<br />
804847e:                                   \x5d        pop           %ebp<br />
804847f:                                   \xc3        ret<br />
End Subroutine: __do_global_ctors_aux(), __do_global_ctors_aux (8048450)         30 lines        0&#215;30 bytes</p>
<p>====== Section Header:       .fini ======<br />
======  Starting Address:       0&#215;08048480      Length:         0&#215;001b<br />
======  File Offset:            0&#215;0480          Size in File:   0&#215;001b<br />
======  Size in Memory:         0&#215;0000<br />
==================</p>
<p>Subroutine: .fini, (), _fini(), , _fini (8048480)        11 lines        0&#215;1b bytes<br />
Starting address: 8048480               Ending address: 804849a</p>
<p>;       .fini, (), _fini(), , _fini<br />
8048480:                                   \x55        push          %ebp<br />
8048481:                               \x89\xe5        mov           %esp, %ebp<br />
8048483:                                   \x53        push          %ebx<br />
8048484:                           \x83\xec\x04        sub           $0&#215;4, %esp<br />
8048487:                   \xe8\x66\xfe\xff\xff        call          0&#215;80482f2                         ; call call_gmon_start(), call_gmon_start (80482d0) (+0&#215;22)  :-195:<br />
804848c:               \x81\xc3\xfc\x10\x00\x00        add           $0&#215;10fc, %ebx<br />
8048492:                   \xe8\x69\xfe\xff\xff        call          0&#215;8048300                         ; call __do_global_dtors_aux(), __do_global_dtors_aux (8048300)  :-192:<br />
8048497:                                   \x5a        pop           %edx<br />
8048498:                                   \x5b        pop           %ebx<br />
8048499:                                   \x5d        pop           %ebp<br />
804849a:                                   \xc3        ret<br />
End Subroutine: .fini, (), _fini(), , _fini (8048480)    11 lines        0&#215;1b bytes<br />
0: (), (), (), (), (), (), (), (), (), (), (), <command>(), ./../include/libc-symbols.h(), ./../include/libc-symbols.h(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/config.h(), ./../include/libc-symbols.h(), <command>(), <built-in>(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/csu//(), abi-note.S(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/abi-tag.h(), abi-note.S(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/config.h(), abi-note.S(), <command>(), ./../include/libc-symbols.h(), ./../include/libc-symbols.h(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/config.h(), ./../include/libc-symbols.h(), <command>(), <built-in>(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/csu//(), abi-note.S(), init.c(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/crti.S(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/defs.h(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/defs.h(), initfini.c(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/crti.S(), <command>(), ./../include/libc-symbols.h(), ./../include/libc-symbols.h(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/config.h(), ./../include/libc-symbols.h(), <command>(), <built-in>(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/crti.S(), crtstuff.c(), crtstuff.c(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/crtn.S(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/defs.h(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/defs.h(), initfini.c(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/crtn.S(), <command>(), ./../include/libc-symbols.h(), ./../include/libc-symbols.h(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/config.h(), ./../include/libc-symbols.h(), <command>(), <built-in>(), /glibc-tmp-91a3c13f482c0e54fcb31801829d957b/glibc-2.3.6/build-glibc-2.3.6/csu/crtn.S(), __libc_start_main@@GLIBC_2.0(), _Jv_RegisterClasses(), __gmon_start__(), (), __libc_start_main(), _Jv_RegisterClasses(), __gmon_start__()<br />
8048114: .interp, &#8216;/lib/ld-linux.so.2&#8242; (.interp) , (),<br />
8048128: .note.ABI-tag, &#8216;\x04&#8242; (.note.ABI-tag) , (),<br />
804812c: &#8216;\x10&#8242; (.note.ABI-tag)<br />
8048130: &#8216;\x01&#8242; (.note.ABI-tag)<br />
8048134: &#8216;GNU&#8217; (.note.ABI-tag)<br />
804813c: &#8216;\x02&#8242; (.note.ABI-tag)<br />
8048140: &#8216;\x04&#8242; (.note.ABI-tag)<br />
8048144: &#8216;\x01&#8242; (.note.ABI-tag)<br />
8048148: .hash, &#8216;\x03&#8242; (.hash) , (),<br />
804814c: &#8216;\x05&#8242; (.hash)<br />
8048150: &#8216;\x04&#8242; (.hash)<br />
8048154: &#8216;\x01&#8242; (.hash)<br />
8048158: &#8216;\x02&#8242; (.hash)<br />
804816c: &#8216;\x03&#8242; (.hash)<br />
8048170: .dynsym, (),<br />
8048180: &#8216;=&#8217; (.dynsym)<br />
8048188: &#8216;\xde&#8217; (.dynsym)<br />
804818c: &#8216;\x12&#8242; (.dynsym)<br />
8048190: &#8216;.&#8217; (.dynsym)<br />
8048194: &#8216;\xa0\x84\x04\x08\x04&#8242; (.dynsym)<br />
804819c: &#8216;\x11&#8242; (.dynsym)<br />
804819e: &#8216;\x0e&#8217; (.dynsym)<br />
80481a0: &#8216;\x01&#8242; (.dynsym)<br />
80481ac: &#8216; &#8216; (.dynsym)<br />
80481b0: &#8216;\x15&#8242; (.dynsym)<br />
80481bc: &#8216; &#8216; (.dynsym)<br />
80481c0: .dynstr, (),<br />
80481c1: &#8216;_Jv_RegisterClasses&#8217; (.dynstr)<br />
80481d5: &#8216;__gmon_start__&#8217; (.dynstr)<br />
80481e4: &#8216;libc.so.6&#8242; (.dynstr)<br />
80481ee: &#8216;_IO_stdin_used&#8217; (.dynstr)<br />
80481fd: &#8216;__libc_start_main&#8217; (.dynstr)<br />
804820f: &#8216;GLIBC_2.0&#8242; (.dynstr)<br />
804821a: .gnu.version, (),<br />
804821c: &#8216;\x02&#8242; (.gnu.version)<br />
804821e: &#8216;\x01&#8242; (.gnu.version)<br />
8048224: .gnu.version_r, &#8216;\x01&#8242; (.gnu.version_r) , (),<br />
8048226: &#8216;\x01&#8242; (.gnu.version_r)<br />
8048228: &#8216;$&#8217; (.gnu.version_r)<br />
804822c: &#8216;\x10&#8242; (.gnu.version_r)<br />
&#8216; (.gnu.version_r)<br />
804823a: &#8216;\x02&#8242; (.gnu.version_r)<br />
804823c: &#8216;O&#8217; (.gnu.version_r)<br />
8048244: .rel.dyn, &#8216;\x84\x95\x04\x08\x06\x04&#8242; (.rel.dyn) , (),<br />
804824c: .rel.plt, &#8216;\x94\x95\x04\x08\x07\x01&#8242; (.rel.plt) , (),<br />
8048260: .init, (), _init(), , _init<br />
8048278: .plt, (),<br />
8048288: __libc_start_main()  (PLT)<br />
80482a0: ELF Start, .text, (), _start(), , _start<br />
80482d0: call_gmon_start(), call_gmon_start<br />
80482f2: __i686.get_pc_thunk.bx(), __i686.get_pc_thunk.bx<br />
8048300: __do_global_dtors_aux(), __do_global_dtors_aux<br />
8048340: frame_dummy(), frame_dummy<br />
8048374: main(), main<br />
80483a0: __libc_csu_init(), __libc_csu_init<br />
8048400: __libc_csu_fini(), __libc_csu_fini<br />
8048450: __do_global_ctors_aux(), __do_global_ctors_aux<br />
8048480: .fini, (), _fini(), , _fini<br />
804849c: .rodata, &#8216;\x03&#8242; (.rodata) , (), _fp_hw(), , _fp_hw<br />
80484a0: &#8216;\x01&#8242; (.rodata) , _IO_stdin_used(), _IO_stdin_used(), _IO_stdin_used<br />
80484a2: &#8216;\x02&#8242; (.rodata)<br />
80484a4: .eh_frame, (), __FRAME_END__(), , __FRAME_END__<br />
80494a8: .ctors, &#8216;\xff\xff\xff\xff&#8217; (.ctors) , (), __CTOR_LIST__(), __fini_array_end(), __fini_array_start(), __init_array_end(), __init_array_start(), , __CTOR_LIST__, __fini_array_end, __fini_array_start, __init_array_end, __init_array_start<br />
80494ac: __CTOR_END__(), __CTOR_END__<br />
80494b0: .dtors, &#8216;\xff\xff\xff\xff&#8217; (.dtors) , (), __DTOR_LIST__(), , __DTOR_LIST__<br />
80494b4: __DTOR_END__(), __DTOR_END__<br />
80494b8: .jcr, (), __JCR_LIST__(), __JCR_END__(), , __JCR_LIST__, __JCR_END__<br />
80494bc: .dynamic, &#8216;\x01&#8242; (.dynamic) , (), _DYNAMIC(), , _DYNAMIC<br />
80494c0: &#8216;$&#8217; (.dynamic)<br />
80494c4: &#8216;\x0c&#8217; (.dynamic)<br />
80494c8: &#8216;\x60\x82\x04\x08\x0d&#8217; (.dynamic)<br />
80494d0: &#8216;\x80\x84\x04\x08\x04&#8242; (.dynamic)<br />
80494d8: &#8216;\x48\x81\x04\x08\x05&#8242; (.dynamic)<br />
80494e0: &#8216;\xc0\x81\x04\x08\x06&#8242; (.dynamic)<br />
80494e8: &#8216;\x70\x81\x04\x08\x0a&#8217; (.dynamic)<br />
80494f0: &#8216;Y&#8217; (.dynamic)<br />
80494f4: &#8216;\x0b&#8217; (.dynamic)<br />
80494f8: &#8216;\x10&#8242; (.dynamic)<br />
80494fc: &#8216;\x15&#8242; (.dynamic)<br />
8049504: &#8216;\x03&#8242; (.dynamic)<br />
8049508: &#8216;\x88\x95\x04\x08\x02&#8242; (.dynamic)<br />
8049510: &#8216;\x08&#8242; (.dynamic)<br />
8049514: &#8216;\x14&#8242; (.dynamic)<br />
8049518: &#8216;\x11&#8242; (.dynamic)<br />
804951c: &#8216;\x17&#8242; (.dynamic)<br />
8049520: &#8216;\x4c\x82\x04\x08\x11&#8242; (.dynamic)<br />
8049528: &#8216;\x44\x82\x04\x08\x12&#8242; (.dynamic)<br />
8049530: &#8216;\x08&#8242; (.dynamic)<br />
8049534: &#8216;\x13&#8242; (.dynamic)<br />
8049538: &#8216;\x08&#8242; (.dynamic)<br />
804953c: &#8216;\xfe\xff\xff\x6f\x24\x82\x04\x08\xff\xff\xff\x6f\x01&#8242; (.dynamic)<br />
804954c: &#8216;\xf0\xff\xff\x6f\x1a\x82\x04\x08&#8242; (.dynamic)<br />
8049584: .got, __gmon_start__(), (),<br />
8049588: .got.plt, (), _GLOBAL_OFFSET_TABLE_(), , _GLOBAL_OFFSET_TABLE_<br />
804958c: &#8216;\x00\x00\x00\x00\x00&#8242;&#8230; (.got.plt+0&#215;4)<br />
8049590: &#8216;\x00\x00\x00\x00\x8e\x82\x04\x08&#8242;&#8230; (.got.plt+0&#215;8)<br />
8049594: __libc_start_main()<br />
8049598: .data, (), data_start(), __data_start(), , data_start, __data_start<br />
804959c: __dso_handle(), __dso_handle<br />
80495a0: &#8216;Hello World<br />
&#8216; (.data) , p.0(), p.0<br />
80495a4: hello(), hello<br />
80495b1: &#8216;\x0c&#8217; (.data) , hlen(), hlen<br />
80495b4: .bss, (), completed.1(), __bss_start(), _edata(), , completed.1, __bss_start, _edata<br />
80495b5: &#8216;GCC&#8217; (.bss)<br />
80495b8: _end(), _end</built-in></command></command></built-in></command></command></built-in></command></command></built-in></command></command></p>
<p><font color="red">bt</font> <font color="blue">hello #</font></p></blockquote>
<p>Dang, the GCC output is so big and convoluted, I couldn&#8217;t keep up with it.</p>
<p>Now that we have seen the output of these files, you are probably asking yourself, &#8220;Why are disassemblers important?&#8221; Well, they analyze the executable for us so that we do not have to open the file in a hex editor and then begin decrypting the system calls and opcodes.  It also provides us with the locations of various interesting instructions and data within the virtual memory.  I am certain that <a href="http://atlas.r4780y.com/cgi-bin/atlas" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/atlas.r4780y.com');">atlas</a> has programmed in more features that I have not implemented here and I&#8217;m willing to place a bet that he has something very interesting in the works for future versions of <a href="http://atlas.r4780y.com/resources/disass-3.0-080424.tgz" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/atlas.r4780y.com');">Disass-3</a>.  For now we are just going to have to wait.</p>
<p>Of course I know that none of this is very exciting.  Just so you know, I did try to think of something that would liven it up a little bit.  Alas, it did not happen.  But at least I did learn a thing or two about Assembly.  Hopefully you did as well.</p>
<p>Go forth and do good things,</p>
<p>Don C. Weber</p>
<span class="ttag"><img src="http://www.cutawaysecurity.com/blog/wp-content/plugins/technobubble.gif" alt="Technorati Tags" /> <a href="http://www.technorati.com/tag/assembly" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">assembly</a>, <a href="http://www.technorati.com/tag/programming" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">programming</a>, <a href="http://www.technorati.com/tag/gcc" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">gcc</a>, <a href="http://www.technorati.com/tag/c" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">c</a>, <a href="http://www.technorati.com/tag/nasm" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">nasm</a>, <a href="http://www.technorati.com/tag/ld" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">ld</a>, <a href="http://www.technorati.com/tag/Disass-3.0" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">Disass-3.0</a>, <a href="http://www.technorati.com/tag/Security+Ripcord" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">Security Ripcord</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.cutawaysecurity.com/blog/archives/240/feed</wfw:commentRss>
		</item>
		<item>
		<title>Hello Sleep - C I H4K U</title>
		<link>http://www.cutawaysecurity.com/blog/archives/239</link>
		<comments>http://www.cutawaysecurity.com/blog/archives/239#comments</comments>
		<pubDate>Fri, 25 Apr 2008 04:27:12 +0000</pubDate>
		<dc:creator>cutaway</dc:creator>
		
		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.cutawaysecurity.com/blog/archives/239</guid>
		<description><![CDATA[Here is the latest exercise I worked on.  This time I have taken the Hello World c-program I demonstrated in the Hello World - C to Assembly post and added a sleep to it.  The sleep command paused the program long enough so that I was able to locate the memory allocated to [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the latest exercise I worked on.  This time I have taken the Hello World c-program I demonstrated in the <a href="http://www.cutawaysecurity.com/blog/archives/238" target="_blank" >Hello World - C to Assembly</a> post and added a sleep to it.  The sleep command paused the program long enough so that I was able to locate the memory allocated to the program and change the value of the output.  Of course I would have liked to have figured out a way to detect the code involved with the program instead of the actual string to be output because this might not be known.  But, I guess I am going to have to deal with this for now.</p>
<p>This first section will demonstrate the modifications that were made to the c-program to turn it into hello_sleep.c.  I diffed the assembly file with the version from yesterday so that you and I could see the difference.</p>
<blockquote><p><font color="red">bt</font> <font color="blue">hello_sleep</font> # cat hello_sleep.c<br />
#include &lt;stdio.h&gt;<br />
#include &lt;unistd.h&gt; //Required for sleep cmd</p>
<p>main(){</p>
<p>//Declare local variables<br />
unsigned int sec = 300; // 5 Minutes</p>
<p>sleep(sec);<br />
printf(&#8221;Hello World\n&#8221;);<br />
return(0);<br />
}<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ls<br />
Makefile  hello_sleep.c<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # make hello_sleep.s<br />
cc -S hello_sleep.c<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ls<br />
Makefile  hello_sleep.c  hello_sleep.s<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # cat hello_sleep.s<br />
.file   &#8220;hello_sleep.c&#8221;<br />
.section        .rodata<br />
.LC0:<br />
.string &#8220;Hello World\n&#8221;<br />
.text<br />
.globl main<br />
.type   main, @function<br />
main:<br />
pushl   %ebp<br />
movl    %esp, %ebp<br />
subl    $8, %esp<br />
andl    $-16, %esp<br />
movl    $0, %eax<br />
addl    $15, %eax<br />
addl    $15, %eax<br />
shrl    $4, %eax<br />
sall    $4, %eax<br />
subl    %eax, %esp<br />
movl    $300, -4(%ebp)<br />
subl    $12, %esp<br />
pushl   -4(%ebp)<br />
call    sleep<br />
addl    $16, %esp<br />
subl    $12, %esp<br />
pushl   $.LC0<br />
call    printf<br />
addl    $16, %esp<br />
movl    $0, %eax<br />
leave<br />
ret<br />
.size   main, .-main<br />
.section        .note.GNU-stack,&#8221;",@progbits<br />
.ident  &#8220;GCC: (GNU) 3.4.6&#8243;<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # diff hello_sleep.s ../hello/hello.s<br />
1c1<br />
&lt;       .file   &#8220;hello_sleep.c&#8221;<br />
&#8212;<br />
&gt;       .file   &#8220;hello.c&#8221;<br />
19,23d18<br />
&lt;       movl    $300, -4(%ebp)<br />
&lt;       subl    $12, %esp<br />
&lt;       pushl   -4(%ebp)<br />
&lt;       call    sleep<br />
&lt;       addl    $16, %esp<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # make<br />
cc -c hello_sleep.c<br />
cc hello_sleep.o -o hello_sleep.exe<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ls<br />
Makefile  hello_sleep.c  hello_sleep.exe*  hello_sleep.o  hello_sleep.s<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ./hello_sleep.exe<br />
Hello World<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ./hello_sleep.exe</p></blockquote>
<p>While this was running I opened another terminal and went to work.  Of course I had already set up my tools - <a href="http://atlas.r4780y.com/cgi-bin/atlas/2007/01/16#070116-FelizNavidad-d00d" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/atlas.r4780y.com');">VTrace</a> which is now a part of <a href="http://kenshoto.com/vtrace/" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/kenshoto.com');">VDB</a>.  I also installed the <a href="http://atlas.r4780y.com/cgi-bin/atlas/2008/04/24#080424-released" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/atlas.r4780y.com');">latest version of libdisassemble and disass-3</a> which <a href="http://atlas.r4780y.com" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/atlas.r4780y.com');">@</a> just released today.  I&#8217;ll leave the installation process to you this time.  I have highlighted some key information and if you see a &#8220;<strong><em>&lt;- NOTE:</em></strong> &#8221; it is an added comment.</p>
<blockquote><p><font color="red">bt</font> <font color="blue">dev</font> # python        <strong><em>&lt;- NOTE: Time to learn Python</em></strong><br />
Python 2.4.3 (#1, Apr  3 2006, 14:02:53)<br />
[GCC 3.4.6] on linux2<br />
Type &#8220;help&#8221;, &#8220;copyright&#8221;, &#8220;credits&#8221; or &#8220;license&#8221; for more information.<br />
<font color="red">&gt;&gt;&gt;</font> import vtrace                            <em><strong>&lt;- NOTE: Pull in the VTrace functions and objects</strong></em><br />
<font color="red">&gt;&gt;&gt;</font> tr = vtrace.getTrace()            <em><strong>&lt;- NOTE: Create an object that will do the work</strong></em><br />
<font color="red">&gt;&gt;&gt;</font> tr.ps()                                            <em><strong>&lt;- NOTE:  Output the process list.  This could be scripted for future dynamic results.</strong></em><br />
[(1, 'init [3]   &#8216;), (1008, &#8216;/sbin/udevd &#8211;daemon &#8216;), (2178, &#8216;/usr/sbin/syslogd &#8216;), (2181, &#8216;/usr/sbin/klogd -c 3 -x &#8216;), (2198, &#8216;/sbin/dhcpcd -d -t 10 eth0 &#8216;), (2227, &#8216;/usr/sbin/cupsd &#8216;), (2238, &#8216;/usr/sbin/crond -l10 &#8216;), (2274, &#8216;/usr/sbin/gpm -m /dev/mouse -t ps2 &#8216;), (2543, &#8216;/bin/bash /usr/bin/fstab-update &#8211;daemon &#8216;), (2841, &#8216;-bash &#8216;), (2842, &#8216;/sbin/agetty 38400 tty2 linux &#8216;), (2843, &#8216;/sbin/agetty 38400 tty3 linux &#8216;), (2844, &#8216;/sbin/agetty 38400 tty4 linux &#8216;), (2845, &#8216;/sbin/agetty 38400 tty5 linux &#8216;), (2846, &#8216;/sbin/agetty 38400 tty6 linux &#8216;), (2884, &#8216;/bin/sh /usr/X11R6/bin/startx &#8216;), (2902, &#8216;/usr/X11R6/bin/xinit /usr/X11R6/lib/X11/xinit/xinitrc &#8212; -auth /root/.serverauth.2884 &#8216;), (2903, &#8216;X :0 -auth /root/.serverauth.2884 &#8216;), (2919, &#8216;/bin/sh /usr/X11R6/lib/X11/xinit/xinitrc &#8216;), (2923, &#8216;/bin/sh /opt/kde/bin/startkde &#8216;), (2957, &#8216;kdeinit Running&#8230;                     &#8216;), (2962, &#8216;dcopserver [kdeinit] &#8211;nosid           &#8216;), (2964, &#8216;klauncher [kdeinit] &#8211;new-startup      &#8216;), (2966, &#8216;kded [kdeinit] &#8211;new-startup           &#8216;), (2975, &#8216;kwrapper ksmserver &#8216;), (2977, &#8216;ksmserver [kdeinit]                    &#8216;), (2978, &#8216;kwin [kdeinit] -session 10736c6178000117232847800000030170000_1208991555_703768&#8242;), (2980, &#8216;kdesktop [kdeinit]                     &#8216;), (2984, &#8216;kicker [kdeinit]                       &#8216;), (2987, &#8216;kio_file [kdeinit] file /tmp/ksocket-root/klauncherPvcYNb.slave-socket /tmp/ksocket-root/kdesktopnUuTnb.slave-socket&#8217;), (2991, &#8216;kxkb [kdeinit]                         &#8216;), (2995, &#8216;artsd -F 10 -S 4096 -a alsa -m artsmessage -c drkonqi -l 3 -f &#8216;), (2999, &#8216;kaccess [kdeinit]                      &#8216;), (3002, &#8216;krandrtray -session 10736c6178000117232848400000030170007_1208991555_690824 &#8216;), (3006, &#8216;kmix [kdeinit] -session 10736c6178000117232848400000030170008_1208991555_687965&#8242;), (3007, &#8216;konsole [kdeinit] -session 10627400000120899154700000029640010_1208991555_692031 &#8211;ls&#8217;), (3011, &#8216;knotify [kdeinit]                      &#8216;), (3012, &#8216;konsole [kdeinit] &#8211;ls                 &#8216;), (3016, &#8216;konsole [kdeinit] &#8211;ls                 &#8216;), (3017, &#8216;-bash &#8216;), (3027, &#8216;-bash &#8216;), (3044, &#8216;-bash &#8216;), (3125, &#8216;/bin/sh /usr/bin/firefox &#8216;), (3137, &#8216;/bin/sh /opt/firefox/run-mozilla.sh /opt/firefox/firefox-bin &#8216;), (3142, &#8216;/opt/firefox/firefox-bin &#8216;), (3159, &#8216;/usr/local/libexec/gconfd-2 14 &#8216;), (21770, &#8216;/usr/bin/python /usr/bin/pydoc vtrace &#8216;), (21776, &#8216;less &#8216;), <strong>(22462, &#8216;./hello_sleep.exe &#8216;)</strong>, (22936, &#8216;python &#8216;), (23047, &#8217;sleep 1 &#8216;)]<br />
<font color="red">&gt;&gt;&gt;</font> tr.attach(22462)                        <em><strong>&lt;- NOTE:  Attach to the running process.  It is sleeping so be very quite.</strong></em><br />
<font color="red">&gt;&gt;&gt;</font> tr.searchMemory(&#8217;Hello&#8217;)    <em><strong>&lt;- NOTE:  Search the memory for, well, Hello</strong></em><br />
[134513956L, 134518052L]           <em><strong>&lt;- NOTE:  Those are the memory addresses in decimal  form.  The &#8220;L&#8221; means that it is a long integer.</strong></em><br />
<font color="red">&gt;&gt;&gt;</font> tr.readMemory(134513956L,14)  <em><strong>  &lt;- NOTE: Read the memory location</strong></em><br />
&#8216;Hello World\n\x00\x00&#8242;<br />
<font color="red">&gt;&gt;&gt;</font> tr.readMemory(134518052L,14)<br />
&#8216;Hello World\n\x00\x00&#8242;<br />
<font color="red">&gt;&gt;&gt;</font> tr.writeMemory(134513956L,&#8217;h4k3d&#8217;)    <em><strong>&lt;- NOTE: Change the memory location</strong></em><br />
<font color="red">&gt;&gt;&gt;</font> tr.writeMemory(134518052L,&#8217;h4k3d&#8217;)<br />
<font color="red">&gt;&gt;&gt;</font> tr.readMemory(134513956L,14)                <em><strong>&lt;- NOTE: Check your work</strong></em><br />
&#8216;h4k3d World\n\x00\x00&#8242;<br />
<font color="red">&gt;&gt;&gt;</font> tr.readMemory(134518052L,14)<br />
&#8216;h4k3d World\n\x00\x00&#8242;<br />
<font color="red">&gt;&gt;&gt;</font> tr.detach()                        <em><strong>&lt;- NOTE: Step away very quitely</strong></em></p>
<p><font color="red">&gt;&gt;&gt;</font><br />
<font color="red">bt</font> <font color="blue">dev</font> #</p></blockquote>
<p>Did you wake it?  No??&#8230;Good.  Now just sit back and wait for it.  It will wake up on its own.  You actually have to wait the full amount of time.  The method I used above blocks the process from running once VTrace attaches to the process.  I believe that it can be done without blocking but that is for another time.  Ohhhhh, here is the return value.  I&#8217;ll include a few of previous lines that I have already shown so you can remember where we were at.</p>
<blockquote><p><font color="red">bt</font> <font color="blue">hello_sleep</font> # make<br />
cc -c hello_sleep.c<br />
cc hello_sleep.o -o hello_sleep.exe<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ls<br />
Makefile  hello_sleep.c  hello_sleep.exe*  hello_sleep.o  hello_sleep.s<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ./hello_sleep.exe<br />
Hello World<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> # ./hello_sleep.exe<br />
h4k3d World<br />
<font color="red">bt</font> <font color="blue">hello_sleep</font> #</p></blockquote>
<p>Sweet!!!</p>
<p>Go forth and do good things,</p>
<p>Don C. Weber</p>
<span class="ttag"><img src="http://www.cutawaysecurity.com/blog/wp-content/plugins/technobubble.gif" alt="Technorati Tags" /> <a href="http://www.technorati.com/tag/@" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">@</a>, <a href="http://www.technorati.com/tag/atlas" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">atlas</a>, <a href="http://www.technorati.com/tag/libdisassemble" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">libdisassemble</a>, <a href="http://www.technorati.com/tag/disass-3" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">disass-3</a>, <a href="http://www.technorati.com/tag/python" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">python</a>, <a href="http://www.technorati.com/tag/c" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">c</a>, <a href="http://www.technorati.com/tag/programming" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">programming</a>, <a href="http://www.technorati.com/tag/memory" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">memory</a>, <a href="http://www.technorati.com/tag/Security+Ripcord" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">Security Ripcord</a>, <a href="http://www.technorati.com/tag/Hello+World" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/www.technorati.com');">Hello World</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.cutawaysecurity.com/blog/archives/239/feed</wfw:commentRss>
		</item>
		<item>
		<title>Hello World - C To Assembly</title>
		<link>http://www.cutawaysecurity.com/blog/archives/238</link>
		<comments>http://www.cutawaysecurity.com/blog/archives/238#comments</comments>
		<pubDate>Thu, 24 Apr 2008 03:48:11 +0000</pubDate>
		<dc:creator>cutaway</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.cutawaysecurity.com/blog/archives/238</guid>
		<description><![CDATA[Just a little work I have been doing.
Hello World - C
The following shows a Hello World file written in C along with a quick Makefile that helps compile.

The Hello World Collection - Every language you can think of.  If you think of more&#8230;.add to the list.
Make - a tutorial - A great, low level [...]]]></description>
			<content:encoded><![CDATA[<p>Just a little work I have been doing.</p>
<p><strong>Hello World - C</strong></p>
<p>The following shows a Hello World file written in C along with a quick Makefile that helps compile.</p>
<ul>
<li><a href="http://www.roesler-ac.de/wolfram/hello.htm" title="Hello World!" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.roesler-ac.de');">The Hello World Collection</a> - Every language you can think of.  If you think of more&#8230;.add to the list.</li>
<li><a href="http://www.eng.hawaii.edu/Tutor/Make/" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.eng.hawaii.edu');">Make - a tutorial</a> - A great, low level overview of Makefiles.  VERY GOOD for beginners.</li>
</ul>
<blockquote><p><font color="red">bt</font> <font color="blue">hello</font> # ls<br />
Makefile  hello.c<br />
<font color="red">bt</font> <font color="blue">hello</font> # cat Makefile<br />
hello: hello.o<br />
cc hello.o -o hello.exe<br />
hello.o: hello.c<br />
cc -c hello.c<br />
hello.s: hello.c<br />
cc -S hello.c<br />
<font color="red">bt</font> <font color="blue">hello</font> # cat hello.c<br />
#include &lt;stdio.h&gt;</p>
<p>main(){<br />
printf(&#8221;Hello World\n&#8221;);<br />
return(0);<br />
}<br />
<font color="red">bt</font> <font color="blue">hello</font> # make<br />
cc -c hello.c<br />
cc hello.o -o hello.exe<br />
<font color="red">bt</font> <font color="blue">hello</font> # ls<br />
Makefile  hello.c  hello.exe*  hello.o<br />
<font color="red">bt</font> <font color="blue">hello</font> # ./hello.exe<br />
Hello World<br />
<font color="red">bt</font> <font color="blue">hello</font> #</p></blockquote>
<p><strong>Disassemble Hello World - C</strong></p>
<p>This next set of commands shows how I disassembled the Hello World - C program.  It also shows how to halt the compilation of the program so that a file with the assembly code is produced.  I did this to compare with the output of the disassembler and verify that I was looking at the correct information.  The disassembler I used is the <a href="http://www.python.org/" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.python.org');">Python</a> disassembler called <a href="http://www.immunityinc.com/downloads/libdisassemble2.0.tar.gz" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.immunityinc.com');"><em>libdisassembly</em></a> which can be found in <a href="http://www.immunityinc.com/resources-freesoftware.shtml" target="_blank" onclick="javascript:urchinTracker ('/outbound/article/www.immunityinc.com');">IMMUNITY&#8217;s Free Software</a> repository.</p>
<p>I&#8217;ve <strong>bolded</strong> some key information. The first is the File Offset and Size information where the assembly code is located in the object file.  The second is an error message that keeps showing up at the end of the disassembly.  I bolded it because I am not sure what it is or means.  Please update the comments if you have any idea.</p>
<blockquote><p><font color="red">bt</font> <font color="blue">test_programs</font> # wget http://www.immunityinc.com/downloads/libdisassemble2.0.tar.gz<br />
&#8211;22:10:35&#8211;  http://www.immunityinc.com/downloads/libdisassemble2.0.tar.gz<br />
=&gt; `libdisassemble2.0.tar.gz&#8217;<br />
Resolving www.immunityinc.com&#8230; 66.175.114.214<br />
Connecting to www.immunityinc.com|66.175.114.214|:80&#8230; connected.<br />
HTTP request sent, awaiting response&#8230; 200 OK<br />
Length: 44,801 (44K) [application/x-gzip]</p>
<p>100%[===================================================================&gt;] 44,801       182.57K/s</p>
<p>22:10:35 (182.48 KB/s) - `libdisassemble2.0.tar.gz&#8217; saved [44801/44801]</p>
<p><font color="red">bt</font> <font color="blue">test_programs</font> # ls<br />
assembly/  c/  c++/  libdisassemble2.0.tar.gz  perl/  python/  ruby/<br />
<font color="red">bt</font> <font color="blue">test_programs</font> # tar zxvf libdisassemble2.0.tar.gz<br />
libdisassemble/<br />
libdisassemble/disassemble.py<br />
libdisassemble/opcode86.py<br />
libdisassemble/README<br />
libdisassemble/LICENSE<br />
libdisassemble/opcode86.pyc<br />
<font color="red">bt</font> <font color="blue">test_programs</font> # ls<br />
assembly/  c/  c++/  libdisassemble/  perl/  python/  ruby/<br />
<font color="red">bt</font> <font color="blue">test_programs</font> # ls libdisassemble/<br />
LICENSE  README  disassemble.py*  opcode86.py  opcode86.pyc<br />
<font color="red">bt</font> <font color="blue">test_programs</font> # cd c/hello/<br />
<font color="red">bt</font> <font color="blue">hello</font> # ls<br />
Makefile  hello.c  hello.exe*  hello.o<br />
<font color="red">bt</font> <font color="blue">hello</font> # objdump -x hello.o</p>
<p>hello.o:     file format elf32-i386<br />
hello.o<br />
architecture: i386, flags 0&#215;00000011:<br />
HAS_RELOC, HAS_SYMS<br />
start address 0&#215;00000000</p>
<p>Sections:<br />
Idx Name          <strong>Size</strong>      VMA       LMA       File <strong>off</strong>  Algn<br />
0 .text         0000<strong>0033</strong>  00000000  00000000  0000<strong>0034</strong>  2**2<br />
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE<br />
1 .data         00000000  00000000  00000000  00000068  2**2<br />
CONTENTS, ALLOC, LOAD, DATA<br />
2 .bss          00000000  00000000  00000000  00000068  2**2<br />
ALLOC<br />
3 .rodata       0000000d  00000000  00000000  00000068  2**0<br />
CONTENTS, ALLOC, LOAD, READONLY, DATA<br />
4 .note.GNU-stack 00000000  00000000  00000000  00000075  2**0<br />
CONTENTS, READONLY<br />
5 .comment      00000012  00000000  00000000  00000075  2**0<br />
CONTENTS, READONLY<br />
SYMBOL TABLE:<br />
00000000 l    df *ABS*  00000000 hello.c<br />
00000000 l    d  .text  00000000<br />
00000000 l    d  .data  00000000<br />
00000000 l    d  .bss   00000000<br />
00000000 l    d  .rodata        00000000<br />
00000000 l    d  .note.GNU-stack        00000000<br />
00000000 l    d  .comment       00000000<br />
00000000 g     F .text  00000033 main<br />
00000000         *UND*  00000000 printf</p>
<p>RELOCATION RECORDS FOR [.text]:<br />
OFFSET   TYPE              VALUE<br />
00000020 R_386_32          .rodata<br />
00000025 R_386_PC32        printf</p>
<p><font color="red">bt</font> <font color="blue">hello</font> # ../../libdisassemble/disassemble.py hello.o 0034 0033</p>
<p>Disassembling file hello.o at offset: 0&#215;34<br />
00000034:   push          %ebp<br />
00000035:   mov           %esp, %ebp<br />
00000037:   sub           $0&#215;8, %esp<br />
0000003A:   and           $0xf0, %esp<br />
0000003D:   mov           $0&#215;0, %eax<br />
00000042:   add           $0xf, %eax<br />
00000045:   add           $0xf, %eax<br />
00000048:   shr           $0&#215;4, %eax<br />
0000004B:   shl           $0&#215;4, %eax<br />
0000004E:   sub           %eax, %esp<br />
00000050:   sub           $0xc, %esp<br />
00000053:   push          $0&#215;0<br />
00000058:   call          0&#215;1<br />
0000005D:   add           $0&#215;10, %esp<br />
00000060:   mov           $0&#215;0, %eax<br />
00000065