<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3625483383667122940</id><updated>2011-07-28T20:21:17.317-07:00</updated><category term='reverse engineering'/><category term='binary static analysis'/><category term='intermediate representation'/><category term='security'/><title type='text'>BinStat - An Open Source Binary Static Analysis Framework</title><subtitle type='html'>These words document the construction of a binary static analysis framework.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rcos-binstat.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rcos-binstat.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alex Rad</name><uri>http://www.blogger.com/profile/16317387272669249759</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_oJKuDOvy2uE/SZyfbo4Y8jI/AAAAAAAAAAQ/Tuu6w1lNJeg/S220/n1266930035_30044815_2331.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3625483383667122940.post-1766299637166189956</id><published>2010-04-11T12:26:00.000-07:00</published><updated>2010-04-11T12:53:42.862-07:00</updated><title type='text'>Reverse Engineering</title><content type='html'>To start off I'd like to point at a fellow student&lt;br /&gt;who is doing some really good work, John.&lt;br /&gt;&lt;br /&gt;Read about his Universal Decompiler project &lt;a href="http://uvudec.blogspot.com/"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Get the &lt;a href="http://github.com/johndmcmaster/uvudec/"&gt;source code here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;AND for more RCOS projects be sure to visit &lt;a href="http://dashboard.rcos.cs.rpi.edu/"&gt;this link&lt;/a&gt;&lt;br /&gt;================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;He's also been working on &lt;a href="http://uvicrec.blogspot.com/"&gt;a different kind of reverse engineering&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Years ago I saw a presentation at Hope 2008 by Karsten Nohl on reversing chips. Using some space alien technologies such as "Sandpaper" and "MATLAB" they were able to break proprietary RFID cryptography. Wow! Most hackers would have just called up a secretary or something.&lt;br /&gt;&lt;br /&gt;Read Karsten Nohl, Starbug, Henryk Plötz, and David Evans fascinating USENIX paper &lt;a href="http://www.cs.virginia.edu/~evans/pubs/usenix08/usenix08.pdf"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And another &lt;a href="http://cansecwest.com/csw08/csw08-nohl.pdf"&gt;nice presentation&lt;/a&gt; was given at cansecwest&lt;br /&gt;&lt;br /&gt;While the skilled might be able to read &lt;a href="http://www.siliconzoo.org/"&gt;www.siliconzoo.org&lt;/a&gt; like a coloring book,&lt;br /&gt;I can not. I'm sure that maybe to VLSI CAD researchers and others it's a breeze. But a  blog post over at &lt;a href="http://www.flylogic.net/blog/?p=32"&gt;flylogic&lt;/a&gt; left me equally confused. I needed something easier for a newbie like me. I kept getting my parallels vs series pretty darn wrong. So I emailed Dr. Nohl who kindly responded.&lt;br /&gt;&lt;br /&gt;So once you see it, it's pretty magical. Sort of. I haven't worked my way through all of the zoo just yet.&lt;br /&gt;&lt;br /&gt;Enjoy this educational visual inspection of 2-input CMOS NOR and NAND gates.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_oJKuDOvy2uE/S8Iny501Z6I/AAAAAAAAAB4/vE2hg-v7WEQ/s1600/m7BWE.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_oJKuDOvy2uE/S8Iny501Z6I/AAAAAAAAAB4/vE2hg-v7WEQ/s400/m7BWE.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5458969453795829666" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3625483383667122940-1766299637166189956?l=rcos-binstat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcos-binstat.blogspot.com/feeds/1766299637166189956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcos-binstat.blogspot.com/2010/04/reverse-engineering.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/1766299637166189956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/1766299637166189956'/><link rel='alternate' type='text/html' href='http://rcos-binstat.blogspot.com/2010/04/reverse-engineering.html' title='Reverse Engineering'/><author><name>Alex Rad</name><uri>http://www.blogger.com/profile/16317387272669249759</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_oJKuDOvy2uE/SZyfbo4Y8jI/AAAAAAAAAAQ/Tuu6w1lNJeg/S220/n1266930035_30044815_2331.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_oJKuDOvy2uE/S8Iny501Z6I/AAAAAAAAAB4/vE2hg-v7WEQ/s72-c/m7BWE.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3625483383667122940.post-1433620009324144505</id><published>2010-04-11T12:07:00.000-07:00</published><updated>2010-04-11T12:23:55.767-07:00</updated><title type='text'>Whoaaa</title><content type='html'>Hello from one year in the future.&lt;br /&gt;&lt;br /&gt;I have not worked on RCOS-Binstat since last April. When we left off I realized I did not have enough formal background. I had implemented incomplete disassemblers for x86 and MIPS with basic value propagation for constant folding, some simple SSA, and rudimentary analysis for doing things such as resolving function arguments. Just that alone was actually useful for finding real life bugs.&lt;br /&gt;&lt;br /&gt;That code is still available here: &lt;a href="http://github.com/adc/rcos-binstat"&gt;http://github.com/adc/rcos-binstat&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It sucks.&lt;br /&gt;&lt;br /&gt;Hopefully I will get back to it soon. Currently I'm searching around for a language with good features and no bad ones. Something painfully simple and powerful with a low learning curve.&lt;br /&gt;&lt;br /&gt;The next thing is to analyze the tremendous amount of projects that have advanced and been created and released to the public in this past year alone.&lt;br /&gt;&lt;br /&gt;So what have I been doing in all my free-time? I spent the summer with some very good friends in the land of pirates.&lt;br /&gt;&lt;br /&gt;Then stuff happened when I got back to school. My computer engineering classes have picked up, landing me an infinite well of excuses. And just when I thought it got better, the club started teaching a class: &lt;a href="http://www.cs.rpi.edu/academics/courses/spring10/csci4971/"&gt;www.cs.rpi.edu/academics/courses/spring10/csci4971/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;At least last Fall I finally learned what a transistor is. After all, the university I attend once digested and emitted Teddy Hoff, the father of the microprocessor and Intel employee #12.&lt;br /&gt;&lt;br /&gt;I also got some significant appreciation for Shannon's work on boolean logic.  A Jean-Claude vs Claude deathmatch will obviously show Shannon as one mighty dude. &lt;div&gt;&lt;br /&gt;Someone should report back on Shannon's work with genetic computing.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3625483383667122940-1433620009324144505?l=rcos-binstat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcos-binstat.blogspot.com/feeds/1433620009324144505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcos-binstat.blogspot.com/2010/04/whoaaa.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/1433620009324144505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/1433620009324144505'/><link rel='alternate' type='text/html' href='http://rcos-binstat.blogspot.com/2010/04/whoaaa.html' title='Whoaaa'/><author><name>Alex Rad</name><uri>http://www.blogger.com/profile/16317387272669249759</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_oJKuDOvy2uE/SZyfbo4Y8jI/AAAAAAAAAAQ/Tuu6w1lNJeg/S220/n1266930035_30044815_2331.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3625483383667122940.post-3280432338605430546</id><published>2009-05-01T15:16:00.000-07:00</published><updated>2009-05-01T16:39:10.145-07:00</updated><title type='text'>rcos ppt</title><content type='html'>I was asked to make a presentation on current progress. Here it is: &lt;a href="http://rpisec.net/attachments/download/21/go.pdf"&gt;http://rpisec.net/attachments/download/21/go.pdf&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3625483383667122940-3280432338605430546?l=rcos-binstat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcos-binstat.blogspot.com/feeds/3280432338605430546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcos-binstat.blogspot.com/2009/05/rcos-ppt.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/3280432338605430546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/3280432338605430546'/><link rel='alternate' type='text/html' href='http://rcos-binstat.blogspot.com/2009/05/rcos-ppt.html' title='rcos ppt'/><author><name>Alex Rad</name><uri>http://www.blogger.com/profile/16317387272669249759</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_oJKuDOvy2uE/SZyfbo4Y8jI/AAAAAAAAAAQ/Tuu6w1lNJeg/S220/n1266930035_30044815_2331.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3625483383667122940.post-40536454919765271</id><published>2009-03-12T08:23:00.000-07:00</published><updated>2009-04-17T14:52:32.458-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='intermediate representation'/><category scheme='http://www.blogger.com/atom/ns#' term='reverse engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='binary static analysis'/><title type='text'>The Intermediate Representation</title><content type='html'>In this post I will show an example of the Intermediate Language previously described. &lt;div&gt;&lt;br /&gt;&lt;div&gt;As previously mentioned there are more or less four basic operations.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;1. operation()             &lt;- for math, takes operands and operators &lt;/li&gt;&lt;li&gt;2. load $register        &lt;- implicitly retrieves data from the memory address resulting from the previous operation and puts it into $register &lt;/li&gt;&lt;li&gt;3. store $register      &lt;- stores $register into the implicit result of the previous operat &lt;/li&gt;&lt;li&gt;4. branch_true           &lt;- branch if the previous operation is != 0 , otherwise fall through &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For now call and ret operations are also used to make function detection more manageable. In the future these will be removed, as they can be derived from combinations of load/branch. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is some sample output from the MIPS translator on the print2lpr binary. In addition some basic analysis has been performed to resolve GOT entries and strings. This is fully automated but register propagation is very basic at the moment. Be sure to check out the code at &lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);   font-family:'trebuchet ms';font-size:13px;"&gt;http://rpisec.net/repositories/show/rcosbinstat. &lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   font-family:Georgia;font-size:16px;"&gt;The majority of that code is in the libtransform function in mips_translator.py &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);  font-family:'trebuchet ms';font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);   font-family:'trebuchet ms';font-size:13px;"&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023ec ($28, '+', -32460)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023ec LOAD $25     ### getenv&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023f0 ($4, '=', $4, '+', 1588)     %%%% "LPUSER"&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023f4 ($0, '=', $0, '&lt;&lt;', $0)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023f8 ($31, '=', $32, '+', 4)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023f8 CALL $25     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023fc ($29, '+', 48)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x4023fc LOAD $28     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402400 ($6, '=', $2, '|', $0)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402404 ($2, '==', $0)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402404 BRANCH loc_0x402428     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;---end of block---&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;--- block 402408 -&gt; 402424:13--&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;parents:  []&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;branches:  0x402428 0x0&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402408 ($28, '+', -32692)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402408 LOAD $5     %% (10000000)&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x40240c ($28, '+', -32556)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x40240c LOAD $25     ### sprintf&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402410 ($4, '=', $16, '|', $0)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402414 ($5, '=', $5, '+', 1596)     %%%% "P%s&lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402418 ($31, '=', $32, '+', 4)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402418 CALL $25     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x40241c ($29, '+', 48)     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x40241c LOAD $28     &lt;/div&gt;&lt;div id="smartPaste" contenteditable="true" style="overflow-x: hidden; overflow-y: hidden; "&gt;0x402420 ($16, '=', $16, '+', $2)     &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;On MIPS arguments are passed in registers $4 - $8 and then the stack. It would be nice to automate that translation but I haven't had a chance to. Anyway, let's look at how the sprintf function is being called.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that register $16 points to a global write buffer in the BSS. sprintf takes 2 arguments and then a variable number of arguments:  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;sprintf(dest, fmt, .... ) &lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;$4 is the destination &lt;- $16 = global write buffer&lt;/div&gt;&lt;div&gt;$5 is the format string &lt;- "P%s"&lt;/div&gt;&lt;div&gt;$6 is $2. &lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Return values on MIPS are placed in $v1/$v2 which are registers $1/$2.  Looking up at the previous code block the last call was to getenv("LPBUF"); &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Our code is then&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;write_buf += sprintf(write_buf, "P%s", getenv("LPBUF")); &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We are still quite a ways from automating that higher level translation, but having automated string and library resolution is certainly nice.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;By the way, this particular code segment was not exploitable as there is nothing good after the global BSS buffer. If you're really interested in Irix bugs, get a life, or contact me :-).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Back to the topic at hand. The IR looks to be painfully simple. This is to make analysis very easy in the long term. In addition forcing this simplicity makes translation from other architectures better possible. Analysis tools will then be much more useful as platforms change and so on. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3625483383667122940-40536454919765271?l=rcos-binstat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcos-binstat.blogspot.com/feeds/40536454919765271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcos-binstat.blogspot.com/2009/03/intermediate-representation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/40536454919765271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/40536454919765271'/><link rel='alternate' type='text/html' href='http://rcos-binstat.blogspot.com/2009/03/intermediate-representation.html' title='The Intermediate Representation'/><author><name>Alex Rad</name><uri>http://www.blogger.com/profile/16317387272669249759</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_oJKuDOvy2uE/SZyfbo4Y8jI/AAAAAAAAAAQ/Tuu6w1lNJeg/S220/n1266930035_30044815_2331.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3625483383667122940.post-1235617139388459147</id><published>2009-02-18T15:01:00.000-08:00</published><updated>2010-05-06T20:20:13.013-07:00</updated><title type='text'>Why Pink?</title><content type='html'>Because there are no other static analysis blogs decorated with pink. Roughly 20 days have passed and this project is finally rolling. Please check out the &lt;a style="COLOR: rgb(51,102,204); FONT-WEIGHT: bold" href="http://rpisec.net/projects/show/rcosbinstat"&gt;project&lt;/a&gt; in progress and play with the Wiki and forums.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm1.static.flickr.com/52/158392392_83ce9599b8.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 500px; FLOAT: left; HEIGHT: 375px; CURSOR: hand" border="0" alt="" src="http://farm1.static.flickr.com/52/158392392_83ce9599b8.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Alright. It's 5 minutes to go, you're me, and you need to show your boss all the work you've done. Close the lolcat tabs. Oh gosh, I really meant to save that one, thank you oh mighty and omnipotent firefox recently closed tabs history menu.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On your sketch pad you write down:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;While surfing the chaos I have built up the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A notion of a higher level IR that no longer resembles asm&lt;br /&gt;&lt;/li&gt;&lt;li&gt;An almost complete MIPS translator into this IR&lt;/li&gt;&lt;li&gt;Really basic procedure detection and inter+intra procedure flow graphs on mips-code-generated IR&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Now this one is the easiest but the most important. The &lt;span style="FONT-WEIGHT: bold" class="Apple-style-span"&gt;I&lt;/span&gt;ntermediate&lt;span style="FONT-WEIGHT: bold" class="Apple-style-span"&gt; R&lt;/span&gt;epresentation is the basis for what the code from all of the other architectures is translated into. Originally something along the lines of U-Code was envisioned. Now, UCode works well for writing a compiler. UCode has a concept of a stack, a heap, global variables, and so on, it's nifty! But overly complicated for what I think is needed. We need something super simple. Here it is:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There are 4 staple operations in the IR:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;operation(...)     (... =  list of operands and operators)&lt;/li&gt;&lt;li&gt;load   [destination]&lt;/li&gt;&lt;li&gt;store  [source]&lt;/li&gt;&lt;li&gt;branch_true [destination]&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;#1 covers all of the bit twiddling and math instructions. #2/#3/#4 use an implicit value which is the result of the previous operation(). For example, load is implicitly given a source memory address.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In terms of analysis #4 covers many contexts, so this one has actually been re-complicated back into &lt;span style="FONT-WEIGHT: bold" class="Apple-style-span"&gt;jump&lt;/span&gt;, &lt;span style="FONT-WEIGHT: bold" class="Apple-style-span"&gt;call&lt;/span&gt;, and &lt;span style="FONT-WEIGHT: bold" class="Apple-style-span"&gt;branch_true&lt;/span&gt;. And, call also has a corresponding &lt;span style="FONT-WEIGHT: bold" class="Apple-style-span"&gt;ret&lt;/span&gt; instruction. For what purpose? Procedure detection. What's the difference between a call and a jump? A return address. A jump and a branch_true? It's philosophical but I consider it to be locality.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The next blog post will elaborate more on the IR, how the operands work, and other instruction abstractions that are created to ease analysis. If you can't wait, I encourage you to &lt;a href="http://rpisec.net/repositories/entry/rcosbinstat/ir.py"&gt;glance at the code&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Upcoming Milestones&lt;br /&gt;&lt;ul&gt;&lt;li&gt;x86 translator!&lt;/li&gt;&lt;li&gt;integer under and overflow hot-spot detection&lt;/li&gt;&lt;li&gt;unchecked return values, double frees&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;What's needed after those&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A GUI is needed to play with these graphs, Processing? Any suggestions? Readers please help&lt;/li&gt;&lt;li&gt;PE file format support&lt;/li&gt;&lt;li&gt;IR Transformation gadgets -- an interface to the IR for applying easy transformations for detecting external library calls, function prologues and epilogues, specialized integer operations, and ....&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3625483383667122940-1235617139388459147?l=rcos-binstat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcos-binstat.blogspot.com/feeds/1235617139388459147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcos-binstat.blogspot.com/2009/02/why-pink.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/1235617139388459147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/1235617139388459147'/><link rel='alternate' type='text/html' href='http://rcos-binstat.blogspot.com/2009/02/why-pink.html' title='Why Pink?'/><author><name>Alex Rad</name><uri>http://www.blogger.com/profile/16317387272669249759</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_oJKuDOvy2uE/SZyfbo4Y8jI/AAAAAAAAAAQ/Tuu6w1lNJeg/S220/n1266930035_30044815_2331.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm1.static.flickr.com/52/158392392_83ce9599b8_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3625483383667122940.post-2171474704766107841</id><published>2009-01-26T08:36:00.000-08:00</published><updated>2009-01-26T12:03:14.596-08:00</updated><title type='text'>Hello Blogosphere</title><content type='html'>Hi there, &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm proud to announce an open-source binary static analysis project. The name will come later, once the frustration factor is better scoped out.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are quite a few impressive pieces of software out there. First, you have IDA Pro and the development of the &lt;a href="http://www.hex-rays.com/"&gt;hex-rays&lt;/a&gt; plugin which produces rather good looking higher-level output from machine code. There is even an SDK for this decompiler, pretty good stuff. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Second, you have projects like &lt;a href="http://bitblaze.cs.berkeley.edu/"&gt;BitBlaze&lt;/a&gt; which do some great anti-malware work and make some pretty scary, although entirely plausible threats. For example I like "Automated Patch-Based Exploit Generation" a.k.a. &lt;a href="http://bitblaze.cs.berkeley.edu/papers/apeg.pdf"&gt;skynet&lt;/a&gt;. No worries, do not panic computer scientists, they also acknowledge that they too have not yet solved the halting problem and the machine uprising still has some homework to do.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And third, you have one of the oldest tools that was free as in beer, REC - &lt;a href="http://www.backerstreet.com/rec/rec.htm"&gt;The Reverse Engineering Compiler.&lt;/a&gt; REC is nice, it works, the output almost compiles. It was the first such tool I had experience with and I greatly appreciate it. The newer version looks to reach for interactive RE work, very good stuff. And it supports x86, m68k, ppc, and mips (no IDA but pretty good).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I should also mention that the &lt;a href="http://llvm.org/"&gt;LLVM&lt;/a&gt; project has an x86 translator in progress, but it has quite a bit of work left. There are also about one hundred or so papers out there on binary static analysis. I'll be compiling a full listing as I find them, they'll be dumped on the wiki, so the general public can more easily observe their concepts, terminology, and ideas.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So what's the problem with some of these tools? (1) is pay software, and the SDK is probably nice (wouldn't know), but it's still not completely open and limits flexibility. (2) has yet to release source. And (3) is very nifty but has been targeted specifically for C-style RE but does support a few very different platforms. And although (3) is free as in beer, the source is closed. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So what's the point of this one? Why an open source alternative? The point is to give the reverse engineering community the freedom to build crazier and cooler projects without as much grunt work. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The projects will build a whole suite of APIs and tools for reverse engineering work. You want graphs for your obscure embedded microcontroller? You want a subgraph of all network I/O  handling related code? Easy mode. How about for bytecode for this whole new interpreted ju-JIT-su language that just came out? No problem, just get a translator in for your architecture and you're all set. You want to find bugs? How about applying some theorem solvers using tools that have already been written like these guys (2). You want higher level output? Why not take advantage of already implemented techniques for building syntax trees. Let some code that has already been written optimize those trees for your higher-level language output so that any programmer out there can recognize it (except die-hard asm masochists). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that this project is made possible by the Rensselaer Center for Open Source which was very kindly created with a grant from Sean O' Sullivan, an alumn from '85. I am very grateful to RCOS for motivating  me to make this concept a free software reality. &lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So let's start to build this thing. It might take quite a few lines of code and more than one language though,  so please re /join us after this commercial break. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And Thanks,&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Alex&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3625483383667122940-2171474704766107841?l=rcos-binstat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcos-binstat.blogspot.com/feeds/2171474704766107841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcos-binstat.blogspot.com/2009/01/hello-blogosphere.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/2171474704766107841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3625483383667122940/posts/default/2171474704766107841'/><link rel='alternate' type='text/html' href='http://rcos-binstat.blogspot.com/2009/01/hello-blogosphere.html' title='Hello Blogosphere'/><author><name>Alex Rad</name><uri>http://www.blogger.com/profile/16317387272669249759</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='26' src='http://1.bp.blogspot.com/_oJKuDOvy2uE/SZyfbo4Y8jI/AAAAAAAAAAQ/Tuu6w1lNJeg/S220/n1266930035_30044815_2331.jpg'/></author><thr:total>1</thr:total></entry></feed>
