script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

Pfft.. I got TCP/IP Down. SYN, SYN ACK, ACK… EASY!

May 16th, 2008

<meta name="GENERATOR" content="OpenOffice.org 2.0 (Linux)" /><meta name="CREATED" content="20080516;9570800" /><meta name="CHANGED" content="20080516;10252800" /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style></p> <p style="margin-bottom: 0in">Roughly 6 months ago when I started a new position at my current company I was asked if I knew TCP/IP and OS Fingerprinting. I was quick to snap back “Sure, I was doing pen testing for 3 years before this I got that down.” I tell ya what, I couldn’t have been more naive in that answer. My actual understanding of TCP/IP and OS Fingerprinting was sub par but I had no idea. Grasping those basics of SYN – SYN ACK – ACK was lame, as was running Nmap, xprobe, or any other automated fingerprinting utility. Granted the knowledge I obtained from my last position doing pen testing helped me quite a bit in some of the stuff I’m doing these day’s. The bottom line however was, I didn’t know jACK!</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Either way, in the last 6 months I’ve read RFC 793[1] and RFC 1180[2] about 10 times, RFC 1323 [3] about 4 times, and multiple other TCP / IP related RFC’s. I’ve read the TCP/IP Illustrated a few times over as well. Each time I grasp a little more. At this point I think I have a fairly good understanding of TCP/IP and a hell of a lot more knowledge on Nmap OS Fingerprints. After all, at this point I’ve read all of Fyoders old Phrack Articles, and can interpret an Nmap OS signature output and tell you what all the stuff means.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">I’ve been absent from the blog over the last month because I’ve been fairly busy doing research into the internals of the BSD Operating System and Mac OSX, Embedded systems programming, debugging and analysis research, and learning the Instruction set for Power PC. If that weren’t enough, I also started up a new side company for personal finance, i’ve been trying to drive traffic towards that as well as write articles. If that wasn’t enough I also started back up on my graduate degree since I’m so close to the finish line. Which is where this post comes into play.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Last evening we were having a lecture about Authentication Mechanisms in Wireless networks, one thing I really enjoy about this class is it’s divergence from the normal curriculum my college seems to have which is either material from the prehistoric Internet ages, or it’s solid theory. No this course is different in the sense that it drives down into the RFC’s. So as the professor was lecturing I began wondering how many vendors had bad implementations of authentication protocols. Last year there was a lot of kernel vulnerabilities that came out in client side wireless drivers but I didn’t recall seeing too many from the Access Point, point of view. I started researching into a little and found there was a few things done but nothing that I saw having to do with the Protocols I wanted to test vendor implementations on. The Next step was Packet crafting. Despite how many pursuits I have going I’m actually pretty lazy and I’m not about reinventing wheels. Talking with Tebo he recalled Scapy[4] having some type of implementation for the protocol I was curious about. Running over and getting a feel for it… SCAPY KICKS ASS! You could really do some hard core OS Fingerprinting with this, Fuzzing, you name it!</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">>>> ls()</p> <p style="margin-bottom: 0in">ARP : ARP</p> <p style="margin-bottom: 0in">ASN1_Packet : None</p> <p style="margin-bottom: 0in">BOOTP : BOOTP</p> <p style="margin-bottom: 0in">CookedLinux : cooked linux</p> <p style="margin-bottom: 0in">DHCP : DHCP options</p> <p style="margin-bottom: 0in">DNS : DNS</p> <p style="margin-bottom: 0in">DNSQR : DNS Question Record</p> <p style="margin-bottom: 0in">DNSRR : DNS Resource Record</p> <p style="margin-bottom: 0in">Dot11 : 802.11</p> <p style="margin-bottom: 0in">Dot11ATIM : 802.11 ATIM</p> <p style="margin-bottom: 0in">Dot11AssoReq : 802.11 Association Request</p> <p style="margin-bottom: 0in">Dot11AssoResp : 802.11 Association Response</p> <p style="margin-bottom: 0in">Dot11Auth : 802.11 Authentication</p> <p style="margin-bottom: 0in">Dot11Beacon : 802.11 Beacon</p> <p style="margin-bottom: 0in">Dot11Deauth : 802.11 Deauthentication</p> <p style="margin-bottom: 0in">Dot11Disas : 802.11 Disassociation</p> <p style="margin-bottom: 0in">Dot11Elt : 802.11 Information Element</p> <p style="margin-bottom: 0in">Dot11ProbeReq : 802.11 Probe Request</p> <p style="margin-bottom: 0in">Dot11ProbeResp : 802.11 Probe Response</p> <p style="margin-bottom: 0in">Dot11QoS : 802.11 QoS</p> <p style="margin-bottom: 0in">Dot11ReassoReq : 802.11 Reassociation Request</p> <p style="margin-bottom: 0in">Dot11ReassoResp : 802.11 Reassociation Response</p> <p style="margin-bottom: 0in">Dot11WEP : 802.11 WEP packet</p> <p style="margin-bottom: 0in">Dot1Q : 802.1Q</p> <p style="margin-bottom: 0in">Dot3 : 802.3</p> <p style="margin-bottom: 0in">EAP : EAP</p> <p style="margin-bottom: 0in">EAPOL : EAPOL</p> <p style="margin-bottom: 0in">Ether : Ethernet</p> <p style="margin-bottom: 0in">GPRS : GPRSdummy</p> <p style="margin-bottom: 0in">GRE : GRE</p> <p style="margin-bottom: 0in">HCI_ACL_Hdr : HCI ACL header</p> <p style="margin-bottom: 0in">HCI_Hdr : HCI header</p> <p style="margin-bottom: 0in">HDLC : None</p> <p style="margin-bottom: 0in">HSRP : HSRP</p> <p style="margin-bottom: 0in">ICMP : ICMP</p> <p style="margin-bottom: 0in">ICMPerror : ICMP in ICMP</p> <p style="margin-bottom: 0in">IP : IP</p> <p style="margin-bottom: 0in">IPerror : IP in ICMP</p> <p style="margin-bottom: 0in">IPv6 : IPv6 not implemented here.</p> <p style="margin-bottom: 0in">ISAKMP : ISAKMP</p> <p style="margin-bottom: 0in">ISAKMP_class : None</p> <p style="margin-bottom: 0in">ISAKMP_payload : ISAKMP payload</p> <p style="margin-bottom: 0in">ISAKMP_payload_Hash : ISAKMP Hash</p> <p style="margin-bottom: 0in">ISAKMP_payload_ID : ISAKMP Identification</p> <p style="margin-bottom: 0in">ISAKMP_payload_KE : ISAKMP Key Exchange</p> <p style="margin-bottom: 0in">ISAKMP_payload_Nonce : ISAKMP Nonce</p> <p style="margin-bottom: 0in">ISAKMP_payload_Proposal : IKE proposal</p> <p style="margin-bottom: 0in">ISAKMP_payload_SA : ISAKMP SA</p> <p style="margin-bottom: 0in">ISAKMP_payload_Transform : IKE Transform</p> <p style="margin-bottom: 0in">ISAKMP_payload_VendorID : ISAKMP Vendor ID</p> <p style="margin-bottom: 0in">IrLAPCommand : IrDA Link Access Protocol Command</p> <p style="margin-bottom: 0in">IrLAPHead : IrDA Link Access Protocol Header</p> <p style="margin-bottom: 0in">IrLMP : IrDA Link Management Protocol</p> <p style="margin-bottom: 0in">L2CAP_CmdHdr : L2CAP command header</p> <p style="margin-bottom: 0in">L2CAP_CmdRej : L2CAP Command Rej</p> <p style="margin-bottom: 0in">L2CAP_ConfReq : L2CAP Conf Req</p> <p style="margin-bottom: 0in">L2CAP_ConfResp : L2CAP Conf Resp</p> <p style="margin-bottom: 0in">L2CAP_ConnReq : L2CAP Conn Req</p> <p style="margin-bottom: 0in">L2CAP_ConnResp : L2CAP Conn Resp</p> <p style="margin-bottom: 0in">L2CAP_DisconnReq : L2CAP Disconn Req</p> <p style="margin-bottom: 0in">L2CAP_DisconnResp : L2CAP Disconn Resp</p> <p style="margin-bottom: 0in">L2CAP_Hdr : L2CAP header</p> <p style="margin-bottom: 0in">L2CAP_InfoReq : L2CAP Info Req</p> <p style="margin-bottom: 0in">L2CAP_InfoResp : L2CAP Info Resp</p> <p style="margin-bottom: 0in">L2TP : None</p> <p style="margin-bottom: 0in">LLC : LLC</p> <p style="margin-bottom: 0in">MGCP : MGCP</p> <p style="margin-bottom: 0in">MobileIP : Mobile IP (RFC3344)</p> <p style="margin-bottom: 0in">MobileIPRRP : Mobile IP Registration Reply (RFC3344)</p> <p style="margin-bottom: 0in">MobileIPRRQ : Mobile IP Registration Request (RFC3344)</p> <p style="margin-bottom: 0in">MobileIPTunnelData : Mobile IP Tunnel Data Message (RFC3519)</p> <p style="margin-bottom: 0in">NBNSNodeStatusResponse : NBNS Node Status Response</p> <p style="margin-bottom: 0in">NBNSNodeStatusResponseEnd : NBNS Node Status Response</p> <p style="margin-bottom: 0in">NBNSNodeStatusResponseService : NBNS Node Status Response Service</p> <p style="margin-bottom: 0in">NBNSQueryRequest : NBNS query request</p> <p style="margin-bottom: 0in">NBNSQueryResponse : NBNS query response</p> <p style="margin-bottom: 0in">NBNSQueryResponseNegative : NBNS query response (negative)</p> <p style="margin-bottom: 0in">NBNSRequest : NBNS request</p> <p style="margin-bottom: 0in">NBNSWackResponse : NBNS Wait for Acknowledgement Response</p> <p style="margin-bottom: 0in">NBTDatagram : NBT Datagram Packet</p> <p style="margin-bottom: 0in">NBTSession : NBT Session Packet</p> <p style="margin-bottom: 0in">NTP : NTP</p> <p style="margin-bottom: 0in">NetBIOS_DS : NetBIOS datagram service</p> <p style="margin-bottom: 0in">NetflowHeader : Netflow Header</p> <p style="margin-bottom: 0in">NetflowHeaderV1 : Netflow Header V1</p> <p style="margin-bottom: 0in">NetflowRecordV1 : Netflow Record</p> <p style="margin-bottom: 0in">NoPayload : None</p> <p style="margin-bottom: 0in">PPP : PPP Link Layer</p> <p style="margin-bottom: 0in">PPP_ECP : None</p> <p style="margin-bottom: 0in">PPP_ECP_Option : PPP ECP Option</p> <p style="margin-bottom: 0in">PPP_IPCP : None</p> <p style="margin-bottom: 0in">PPP_IPCP_Option : PPP IPCP Option</p> <p style="margin-bottom: 0in">PPPoE : PPP over Ethernet</p> <p style="margin-bottom: 0in">PPPoED : PPP over Ethernet Discovery</p> <p style="margin-bottom: 0in">Packet : None</p> <p style="margin-bottom: 0in">Padding : Padding</p> <p style="margin-bottom: 0in">PrismHeader : Prism header</p> <p style="margin-bottom: 0in">RIP : RIP header</p> <p style="margin-bottom: 0in">RIPEntry : RIP entry</p> <p style="margin-bottom: 0in">RTP : RTP</p> <p style="margin-bottom: 0in">RadioTap : RadioTap dummy</p> <p style="margin-bottom: 0in">Radius : Radius</p> <p style="margin-bottom: 0in">Raw : Raw</p> <p style="margin-bottom: 0in">SMBMailSlot : SMB Mail Slot Protocol</p> <p style="margin-bottom: 0in">SMBNegociate_Protocol_Request_Header : SMBNegociate Protocol Request Header</p> <p style="margin-bottom: 0in">SMBNegociate_Protocol_Request_Tail : SMB Negociate Protocol Request Tail</p> <p style="margin-bottom: 0in">SMBNegociate_Protocol_Response_Advanced_Security : SMBNegociate Protocol Response Advanced Security</p> <p style="margin-bottom: 0in">SMBNegociate_Protocol_Response_No_Security : SMBNegociate Protocol Response No Security</p> <p style="margin-bottom: 0in">SMBNegociate_Protocol_Response_No_Security_No_Key : None</p> <p style="margin-bottom: 0in">SMBNetlogon_Protocol_Response_Header : SMBNetlogon Protocol Response Header</p> <p style="margin-bottom: 0in">SMBNetlogon_Protocol_Response_Tail_LM20 : SMB Netlogon Protocol Response Tail LM20</p> <p style="margin-bottom: 0in">SMBNetlogon_Protocol_Response_Tail_SAM : SMB Netlogon Protocol Response Tail SAM</p> <p style="margin-bottom: 0in">SMBSession_Setup_AndX_Request : Session Setup AndX Request</p> <p style="margin-bottom: 0in">SMBSession_Setup_AndX_Response : Session Setup AndX Response</p> <p style="margin-bottom: 0in">SNAP : SNAP</p> <p style="margin-bottom: 0in">SNMP : None</p> <p style="margin-bottom: 0in">SNMPbulk : None</p> <p style="margin-bottom: 0in">SNMPget : None</p> <p style="margin-bottom: 0in">SNMPinform : None</p> <p style="margin-bottom: 0in">SNMPnext : None</p> <p style="margin-bottom: 0in">SNMPresponse : None</p> <p style="margin-bottom: 0in">SNMPset : None</p> <p style="margin-bottom: 0in">SNMPtrapv1 : None</p> <p style="margin-bottom: 0in">SNMPtrapv2 : None</p> <p style="margin-bottom: 0in">SNMPvarbind : None</p> <p style="margin-bottom: 0in">STP : Spanning Tree Protocol</p> <p style="margin-bottom: 0in">SebekHead : Sebek header</p> <p style="margin-bottom: 0in">SebekV1 : Sebek v1</p> <p style="margin-bottom: 0in">SebekV2 : Sebek v3</p> <p style="margin-bottom: 0in">SebekV2Sock : Sebek v2 socket</p> <p style="margin-bottom: 0in">SebekV3 : Sebek v3</p> <p style="margin-bottom: 0in">SebekV3Sock : Sebek v2 socket</p> <p style="margin-bottom: 0in">Skinny : Skinny</p> <p style="margin-bottom: 0in">TCP : TCP</p> <p style="margin-bottom: 0in">TCPerror : TCP in ICMP</p> <p style="margin-bottom: 0in">TFTP : TFTP opcode</p> <p style="margin-bottom: 0in">TFTP_ACK : TFTP Ack</p> <p style="margin-bottom: 0in">TFTP_DATA : TFTP Data</p> <p style="margin-bottom: 0in">TFTP_ERROR : TFTP Error</p> <p style="margin-bottom: 0in">TFTP_OACK : TFTP Option Ack</p> <p style="margin-bottom: 0in">TFTP_Option : None</p> <p style="margin-bottom: 0in">TFTP_Options : None</p> <p style="margin-bottom: 0in">TFTP_RRQ : TFTP Read Request</p> <p style="margin-bottom: 0in">TFTP_WRQ : TFTP Write Request</p> <p style="margin-bottom: 0in">UDP : UDP</p> <p style="margin-bottom: 0in">UDPerror : UDP in ICMP</p> <p style="margin-bottom: 0in">X509Cert : None</p> <p style="margin-bottom: 0in">X509RDN : None</p> <p style="margin-bottom: 0in">X509v3Ext : None</p> <p style="margin-bottom: 0in">_IPv6OptionHeader : IPv6 not implemented here.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">I’ve been playing with it a little today doing some packet manipulation but I can’t wait to take it for a drive with some protocol fuzzing for some of the wireless stuff. I did notice there are a few people out there that have existing fuzz scripts that use scapy, but I couldn’t seem to locate them. Anyway, its a far better learning experience when you play with it yourself versus using someone else’s scripts / fuzzers.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">[1] - <a href="http://www.faqs.org/rfcs/rfc793.html">http://www.faqs.org/rfcs/rfc793.html</a></p> <p style="margin-bottom: 0in">[2] - <a href="http://www.faqs.org/rfcs/rfc1180.html">http://www.faqs.org/rfcs/rfc1180.html</a></p> <p style="margin-bottom: 0in">[3] - http://tools.ietf.org/html/rfc1323</p> <p style="margin-bottom: 0in">[4] - http://www.secdev.org/projects/scapy/</p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=1" title="View all posts in General" rel="category tag">General</a>, <a href="http://hamsterswheel.com/techblog/?cat=18" title="View all posts in on the wire" rel="category tag">on the wire</a> | <a href="http://hamsterswheel.com/techblog/?p=66#comments" title="Comment on Pfft.. I got TCP/IP Down. SYN, SYN ACK, ACK... EASY!">1 Comment »</a></p> </div> <div class="post" id="post-65"> <h2><a href="http://hamsterswheel.com/techblog/?p=65" rel="bookmark" title="Permanent Link to Wordnet 2.1 sprintf(buf, argv[1]) WTF!">Wordnet 2.1 sprintf(buf, argv[1]) WTF!</a></h2> <small>May 13th, 2008 <!-- by Eric --></small> <div class="entry"> <p>Cool Stuff. Like the dude that found it said what a clasic!</p> <p><a href="http://wordnet.princeton.edu/2.1/WordNet-2.1.exe">http://wordnet.princeton.edu/2.1/WordNet-2.1.exe</a></p> <p><code><br /> in the function 'searchwn()', called from 'main()', there is a static 'char<br /> tmpbuf[256]' into which an invalid command line option is copied using<br /> sprintf():</code><code> }</code><code> else {</code></p> <p>sprintf(tmpbuf, “wn: invalid search option: %s\n”, av[j]);<br /> display_message(tmpbuf);<br /> errcount++;<br /> }</p> <p>So, you call wn.exe from the command line with an argument of -bleh you get:C:\Documents and Settings\e\My Documents\Visual Studio Projects\wordnet-sploit\D<br /> ebug>wn -bleh<br /> wn: invalid search word</p> <p>C:\Documents and Settings\e\My Documents\Visual Studio Projects\wordnet-sploit\D<br /> ebug>wn -bleh %s<br /> wn: invalid search option: ïD$(<a href="mailto:â─►@ëD$↑ït$">â─►@ëD$↑ït$</a> ïF♦â╞♦;╟ët$ ☼à☺ ïD$↑;╟t↓^[_≈╪]ïî$¶☺</p> <p>Or….</p> <p>-bleh `python -c ‘print “A”*500′`</p> <p>will crash it!</p> <p><img src="http://hamsterswheel.com/blogpics/wordnet.JPG" /></p> <p>Using msfpattercreate we find that we overwrite the SEH Frame 357 bytes in.</p> <p>buffer: A*353 + “BBBB” + “C”*400</p> <p>Will overwrite the SEH Frame:</p> <p><img src="http://hamsterswheel.com/blogpics/seh.JPG" /></p> <p>Since I’m on XP SP2, you can’t just do a call/jmp EBX so we need a pop/pop/ret. Get yours from kernel32.dll.</p> <p>I used msfpescan to look for a universal, but all the pop/pop/ret’s I found had a null char in it <img src='http://hamsterswheel.com/techblog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p> <p>Your buf is gonna look like this when all is said and done:</p> <p>buffer: A*353 + \x06\xeb\x90\x90\ + pop\pop\ret + shellcode.</p> <p>Overflow the buffer, short jump forward, follow it up with a pop reg pop reg return into the shellcode.<br /> Non working (Stack corruption in the sploit buf ) <a href="http://hamsterswheel.com/wn.zip">here</a>. </p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=10" title="View all posts in exploits" rel="category tag">exploits</a> | <a href="http://hamsterswheel.com/techblog/?p=65#respond" title="Comment on Wordnet 2.1 sprintf(buf, argv[1]) WTF!">No Comments »</a></p> </div> <div class="post" id="post-64"> <h2><a href="http://hamsterswheel.com/techblog/?p=64" rel="bookmark" title="Permanent Link to HITB Material">HITB Material</a></h2> <small>May 6th, 2008 <!-- by Eric --></small> <div class="entry"> <p>Noticed this morning a link on google reader about the HITB Dubai material is up. Good stuff, Particularly Adrian Pastor’s presentation Cracking into embedded Devices and beyond.</p> <p><a href="http://conference.hitb.org/hitbsecconf2008dubai/materials/">Material </a> </p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=1" title="View all posts in General" rel="category tag">General</a> | <a href="http://hamsterswheel.com/techblog/?p=64#respond" title="Comment on HITB Material">No Comments »</a></p> </div> <div class="post" id="post-63"> <h2><a href="http://hamsterswheel.com/techblog/?p=63" rel="bookmark" title="Permanent Link to Over the Wire Tut">Over the Wire Tut</a></h2> <small>May 6th, 2008 <!-- by Eric --></small> <div class="entry"> <p>Apparently I missed this two months ago but there is a tutorial to help anyone trying to jump into the Over the Wire(pulltheplug) wargames servers.</p> <p><a href="http://www.overthewire.org/node/399">Here. </a> </p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=1" title="View all posts in General" rel="category tag">General</a> | <a href="http://hamsterswheel.com/techblog/?p=63#respond" title="Comment on Over the Wire Tut">No Comments »</a></p> </div> <div class="post" id="post-62"> <h2><a href="http://hamsterswheel.com/techblog/?p=62" rel="bookmark" title="Permanent Link to Playing with firmware">Playing with firmware</a></h2> <small>May 1st, 2008 <!-- by Eric --></small> <div class="entry"> <p>Half assed brief intro into messing with firmware presentation that I have at AHA! last night. <a href="http://hamsterswheel.com/embedded-sec.pdf">HERE</a> </p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=13" title="View all posts in Reversing" rel="category tag">Reversing</a> | <a href="http://hamsterswheel.com/techblog/?p=62#respond" title="Comment on Playing with firmware">No Comments »</a></p> </div> <div class="post" id="post-61"> <h2><a href="http://hamsterswheel.com/techblog/?p=61" rel="bookmark" title="Permanent Link to LSO Crackme 0×03 Solution">LSO Crackme 0×03 Solution</a></h2> <small>April 27th, 2008 <!-- by Eric --></small> <div class="entry"> <p><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080427;15494200" name="CREATED" /><meta content="20080427;16445500" name="CHANGED" />  <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style></p> <p style="margin-bottom: 0in">Learnsecurityonline.com released Crackme 0×03 at the beginning of the month and I ended up knocking it out in about 20-30 minutes after it was posted and posting a screen shot on the blog. This is the write up following that screen shot with the method of how I approached the crackme.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">All we had was a binary, and we did not know much about it. Our goal was to solve the Crackme via the given binary. The instructions were vague, the functionality was vague. We are forced to execute the program to determine both it’s functionality and our objective. When we start the binary we are shown a small window with three buttons and the instructions “Find a way to play the above tones to pass”.</p> <p style="margin-bottom: 0in"> <img src="http://hamsterswheel.com/pictures/blog/crackme3-1.JPG" /></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Pressing the button play tone delivers us a MessageBox that tells us the tones don’t match. Listening to the tones from the three buttons, and having pressed the “play this tone” button you can tell that the tones are by no way the same. This means it’s impossible to generate the stored tone with the buttons provided.</p> <p style="margin-bottom: 0in">At this point I wanted to open up the binary and take a look at how it was doing its magic. Checking it for a Packer revealed nothing with the standard PE identifiers. I ran it through my standard three, none of which came up with anything. PEID did however, mention that it was built in Visual Studio using .net. Instead of loading it up with Ida Pro or Ollydbg I decided to open it with .Net Reflector[1]. I then chose to Disassemble the Binary. As I was walking through the disassembled code I noticed class references to NetZ. Curious as to what the hell it was I googled Netz and found out that the binary was after all Compressed with this Open Source .Net Packer called Netz and that the disassembly code I was looking at was the code for the Packer. Ok, back to google I ended up searching real quick for an Unpacker for Netz. Nothing turned up. SHIT!</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Tebo mentioned that the RSS feed for Woodmann’s collaborative RCE tools had popped up a Generic .Net Unpacker[2]. My only other option was to Manually unpack the binary… Well screw that I will give this Generic .Net Unpacker a shot. It ended up working great, and I was able to load up one of the output binaries into .Net Reflector and disassemble it to about 90% of the original source. That’s truly the beauty of .Net code and .Net Reflector, you don’t have to muck around in too much assembly because you can disassemble straight to source, minus the variable names some times. Going through the code for Form 1, we find the Play_Click function and take a peak at the functionality.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"><img src="http://hamsterswheel.com/pictures/blog/crackme3-2.JPG" /></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">If you take notice, there is a single if statement that checks the values of the NumArray2[] to be set too 300,600,900. But if you pay attention the values set to numArray2[] are 250,500, and 0×3e8. No where in the code is there a place to change the tone values on that Array (which in case you weren’t paying attention correspond to Button 1, 2 and 3.)</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">At this point I knew I needed to change the values in that array. But I am lazy.. Real lazy so I didn’t feel like walking through it with Ollydbg, and manually changing the value. I found something called Reflexil[3] which is an assembly editor that runs as a plugin for .Net reflector. This tool allowed me to go in and modify the values in that array to what we needed, then save the program with the modifications.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"><img src="http://hamsterswheel.com/pictures/blog/crackme3-3.JPG" /></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Turning around and saving the file, we can then run the program and just press play. Pushing buttons 1,2, and 3 doesn’t really matter because the logic in the program doesn’t even check to see if you pushed any buttons.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">And we get our Win!</p> <p style="margin-bottom: 0in"> <img src="http://hamsterswheel.com/re/crackme3.JPG" /></p> <p>[1] .Net Reflector - http://www.aisto.com/roeder/dotnet/</p> <p>[2] Generic .Net Unpacker - http://www.woodmann.net/collaborative/tools/index.php/.NET_Generic_Unpacker</p> <p>[3] Reflexil - http://sebastien.lebreton.free.fr/reflexil/ </p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=13" title="View all posts in Reversing" rel="category tag">Reversing</a>, <a href="http://hamsterswheel.com/techblog/?cat=14" title="View all posts in Crackme" rel="category tag">Crackme</a> | <a href="http://hamsterswheel.com/techblog/?p=61#respond" title="Comment on LSO Crackme 0x03 Solution">No Comments »</a></p> </div> <div class="post" id="post-60"> <h2><a href="http://hamsterswheel.com/techblog/?p=60" rel="bookmark" title="Permanent Link to Damn thought I had one.">Damn thought I had one.</a></h2> <small>April 15th, 2008 <!-- by Eric --></small> <div class="entry"> <p><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080415;7265400" name="CREATED" /><meta content="16010101;0" name="CHANGED" /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style></p> <p style="margin-bottom: 0in">Been busy running around lately, and now the mother in law and family is in town, theoretically the wife will be occupied with that. I created a pop3 request for Sulley and I’ve been back tracking and hitting the pop3 service on a few of the Mail servers that I have downloaded and hit with the SMTP requests. Last week I discovered a weird bug that seemed random at best and after a while of getting frustrated I asked MC for an assist. MC Tracked down the bug despite not being able to get it to crash. Turned out there was already an advisory on it, and it was an incorrect handling of connections. Basically the Application (baby pop3) was not handling multiple connections from the same host correctly and would result in a crash. On the vendors website there were quite a few other applications in this baby series and I’m pretty sure they are using the same template for code because I was able to get the web server to crash also.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Last night I discovered an XSS bug in a vendor site. I actually completely stumbled on it. I was messing with a mail server, browsing around and looking for inputs (this thing opens about 12 ports upon install) and I came across the web application on port 7026. Most of the pages required authentication, but the help pages didn’t. Within the Help index there was a search box for “on line search.” When you put Javascript into the search box and hit enter, you are taken to the vendors site (shown your alert text box) and then get some errors on search string not found. I kicked off an email to the vendor and they responded back in like 15 minutes, but have yet to ACK FIN saying it was fixed.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">I continue hitting up that same application, It’s got an smtp, a pop3 and about 4 web interfaces. I noticed that the webmail is actually accessible via a path that leads to webmail.exe?cmd= . Currently fuzzing the admin.cgi ones, but I plan to start fuzzing the webmail.exe input this evening when I get home.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">I need to start working on a short presentation for AHA! I’m debating on talking about the Fuzzing ( a lot of those guys work for dvlabs so I dunno) or I can talk about embedded debugging. On one hand, If i talk about fuzzing, I can segway that into the question of “How can I analyze these crashes better” because the scripts with sulley haven’t been working out for me. Or the “Has anyone done any Fuzzing on embedded systems, and if so how did you go about analyzing the crash.” On the other hand, I can just go straight into Embedded debugging and ask that question anyway. Of course I still need a few hundred bucks from Dean to sponsor more research….</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Thanks again to MC for checking out that bug.</p> <p style="margin-bottom: 0in"> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=9" title="View all posts in Vulnerabilities" rel="category tag">Vulnerabilities</a>, <a href="http://hamsterswheel.com/techblog/?cat=11" title="View all posts in Research" rel="category tag">Research</a>, <a href="http://hamsterswheel.com/techblog/?cat=15" title="View all posts in Fuzzing" rel="category tag">Fuzzing</a> | <a href="http://hamsterswheel.com/techblog/?p=60#respond" title="Comment on Damn thought I had one.">No Comments »</a></p> </div> <div class="post" id="post-59"> <h2><a href="http://hamsterswheel.com/techblog/?p=59" rel="bookmark" title="Permanent Link to LSO Crackme 0×03">LSO Crackme 0×03</a></h2> <small>April 8th, 2008 <!-- by Eric --></small> <div class="entry"> <p>LSO Just posted the Third <a href="http://learnsecurityonline.com/index.php?option=com_content&task=view&id=298&Itemid=1">crackme</a> not too long ago. I took a stab at it this evening. Shouts to Tebo for hooking up the unpacking script and saving my ass from having to MUP it.</p> <p>I promised the author I wouldn’t release the solution for a few weeks since it literally just got posted, so here’s a teaser.</p> <p><img src="http://hamsterswheel.com/re/crackme3.JPG" /> </p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=13" title="View all posts in Reversing" rel="category tag">Reversing</a> | <a href="http://hamsterswheel.com/techblog/?p=59#respond" title="Comment on LSO Crackme 0x03">No Comments »</a></p> </div> <div class="post" id="post-58"> <h2><a href="http://hamsterswheel.com/techblog/?p=58" rel="bookmark" title="Permanent Link to Awww Shixxnote">Awww Shixxnote</a></h2> <small>April 6th, 2008 <!-- by Eric --></small> <div class="entry"> <p><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080405;23434700" name="CREATED" /><meta content="20080405;23592900" name="CHANGED" /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style></p> <p style="margin-bottom: 0in">Recently I watched a Keynote by Dave Aitel, in it he discussed the Hacker mindset. One of the things he pointed out was when a new vulnerability comes out to make sure your fuzzer can pick it up, and if not figure out why and then make the fuzzer pick up the vuln. Shixxnote 6.net had a <a href="http://secunia.com/advisories/12822/">buffer overflow</a>  quite a while ago by Luigi A who is amazing at finding vulns, I’ve Rss’ed to his site and That dude kicks out an average of two per day. I still had the software in my vuln software bank and I decided I’d break it out and play with it for the evening.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">The concept behind shixxnote is simple, you can create notes for yourself and even send them to other uses on a network. If the other user doesn’t have the software, it will default to sending it via the Messenger service. You can assume it runs over messenger service, but in reality it does that by default and has it’s own little protocol going on. No documentation available we turn to wireshark. Wireshark has this amazing ability at decoding data/ protocols. Unfortunately Wireshark had no f00 when it came to shixxnote. I installed shixxnote on two different boxes and sent a message to each other and sniffed the traffic. This is what I got:</p> <p style="margin-bottom: 0in"><img src="http://hamsterswheel.com/blogpics/wireshark.jpeg" /></p> <p style="margin-bottom: 0in">What I did was try to break it down as best as I could into a Sulley request. It ended up being too large to run on my VM image so I had to find some more ram for the only box in the house running windows. Eventually I got it up and going, and Sulley started kicking out the Fuzz! Somewhere around 618, and in the low 2000’s Shixxnote crashed. I’ve since started Sulley’s processmon and am monitoring for the exact cause of the crash. Anyway, I found it kind of cool taking apart the protocol (even though its not really a protocol per say, just a format of data sent over the wire)</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Request can be found <a href="http://hamsterswheel.com/code/sulley/shixxnote.py">here</a></p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=11" title="View all posts in Research" rel="category tag">Research</a>, <a href="http://hamsterswheel.com/techblog/?cat=15" title="View all posts in Fuzzing" rel="category tag">Fuzzing</a> | <a href="http://hamsterswheel.com/techblog/?p=58#respond" title="Comment on Awww Shixxnote">No Comments »</a></p> </div> <div class="post" id="post-57"> <h2><a href="http://hamsterswheel.com/techblog/?p=57" rel="bookmark" title="Permanent Link to Too many security books">Too many security books</a></h2> <small>April 5th, 2008 <!-- by Eric --></small> <div class="entry"> <p><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080404;23090500" name="CREATED" /><meta content="20080404;23304600" name="CHANGED" /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style></p> <p style="margin-bottom: 0in">Cg has been doing quite a few book reviews lately on Amazon and on his <a href="http://www.carnal0wnage.blogspot.com">blog</a>, Tebo who I’ve recently befriended on IRC was bashing the reading of all these books basically saying the more time you spend reading the less time you spend doing practical work. MC used to tell me all the time to stop reading books and start putting my fingers on the keyboard, basically under the same logic. One of my past times is going to barnes and noble with my son on Tuesdays. I grab a coffee and then take him over to the kids section and let him play with the Thomas the engine set they have in there. He has fun, we spend quality time and the single moms check me out. On my way out though I stop in the computer books section and check out what’s going on. For the tax year 2005 I spent (according to my schedule C that I filed) roughly $3500 on books, and that figure does not include college text books. Anyway, So far this year I’ve spent 35 dollars on books, but it was an investing book and a business book so I guess that doesn’t count. I stopped purchasing books last year sometime, I realized that MC and Tebo are right. But the main focus of this post is that tech books are starting to suck.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Suggest you want to learn python. You walk into Borders and goto the programming shelf and there are about 30 books that say python. Which one do you choose? As you start to pull them off the shelf to compare and contrast them you realize they are all the same. But the programming books are much different from the networking books and by networking books I mean the security books. Lately I’ve been very disappointed with the security books on the shelf, there are only a few exceptions so don’t flame me just yet. Most of the security books are the same through and through. They introduce you to some low level concepts that you could have pulled from the RFC had you taken the time to read it, and then they start going through tools. They don’t really teach you the fundamentals of anything, just the syntax of the tool. The worst of them are the Hacking exposed series. Every time I see someone handling them I just have to laugh to myself. The reason I say Hacking exposed is the worse is because from what I’ve seen they are generally a few years behind. By the time they are published, the material is already outdated and no longer works, or is picked up by AV or IDS.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">There are of course a few exceptions on the books. Take for example the Shell coders Hand Book, or Fuzzing. The Shellcoders handbook is good because it goes into low level principles and makes an effort to discuss the material and logic behind it, not just a run this tool and be done with it. Fuzzing is another example. Cg in his review mentioned that it didn’t have enough application examples in the book, but man it’s great on delivering the theory of it. One good thing I’m starting to see from publishers is the publishing of very specific topics. Fuzzing, Shell coding, Software Security Assessment, and Johnny Long’s Google / no tech hacking are perfect examples.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Don’t get me wrong, I’m not bashing authors. I’m just saying that I’m not longer buying any books. You can go broke doing so, and I have better things to spend my money on. All the information in those books can easily be obtained from quality sites like phrack, uninformed, hick, nologin, et cetera. MC told me I was lucky, cause now a day’s everything is printed in books but back when he was learning, there were not books on this stuff.</p> <p><script type="text/javascript"><!-- google_ad_client = "pub-9774791470740882"; //468x60, created 1/23/08 google_ad_slot = "8394351893"; google_ad_width = 468; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </p> </div> <p class="postmetadata">Posted in <a href="http://hamsterswheel.com/techblog/?cat=1" title="View all posts in General" rel="category tag">General</a> | <a href="http://hamsterswheel.com/techblog/?p=57#comments" title="Comment on Too many security books">3 Comments »</a></p> </div> <div class="navigation"> <div class="alignleft"><a href="http://hamsterswheel.com/techblog/index.php?paged=2">« Previous Entries</a></div> <div class="alignright"></div> </div> </div> <hr /> <div id="footer"> <p> φοίνιξ is proudly powered by <a href="http://wordpress.org/">WordPress</a> using the blacknblue theme by <a href=”http://www.surfthemind.com/”>Wendy Woudstra</a> <br /><a href="feed:http://hamsterswheel.com/techblog/?feed=rss2">Entries (RSS)</a> and <a href="feed:http://hamsterswheel.com/techblog/?feed=comments-rss2">Comments (RSS)</a>. <!-- 10 queries. 0.508 seconds. --> </p> </div> </div> <!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/kubrick/ --> </body> </html>