<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>Hex blog</title>
      <link>http://hexblog.com/</link>
      <description>About IDA Pro, decompilation, programming, binary program analysis, information security.</description>
      <language>en</language>
      <copyright>Copyright 2010</copyright>
      <lastBuildDate>Fri, 05 Feb 2010 20:31:30 +0100</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/?v=3.2</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

            <item>
         <title>New IDC improvement in IDA Pro 5.6</title>
         <description><![CDATA[Scripting with IDA Pro has always been a very handy feature, not only when used in scripts but also in expressions, breakpoint conditions, form fields, etc...<br/>
In IDA Pro 5.6 we improved the IDC language and made it more convenient to use by adding objects, exceptions, support for strings with embedded zeroes, string slicing and references.<br/>]]></description>
         <link>http://hexblog.com/2010/02/new_idc_improvement_in_ida_pro_1.html</link>
         <guid>http://hexblog.com/2010/02/new_idc_improvement_in_ida_pro_1.html</guid>
         <category>IDA Pro</category>
         <pubDate>Fri, 05 Feb 2010 20:31:30 +0100</pubDate>
      </item>
            <item>
         <title>Hex-Rays against Aurora</title>
         <description><![CDATA[<p>As everyone knows, Google and some other companies were under a targeted attack a few days ago. A vulnerability in the Internet Explorer was used to penetrate the computers.</p>

<p>An IDA user very kindly sent us the following link </p>

<p><a href="http://www.avertlabs.com/research/blog/index.php/2010/01/18/an-insight-into-the-aurora-communication-protocol/ ">http://www.avertlabs.com/research/blog/index.php/2010/01/18/an-insight-into-the-aurora-communication-protocol/ </a></p>]]></description>
         <link>http://hexblog.com/2010/01/hexrays_against_aurora.html</link>
         <guid>http://hexblog.com/2010/01/hexrays_against_aurora.html</guid>
         <category>Decompilation</category>
         <pubDate>Wed, 20 Jan 2010 13:30:17 +0100</pubDate>
      </item>
            <item>
         <title>Practical Appcall examples</title>
         <description><![CDATA[Last week we introduced the new <a href="http://hexblog.com/2010/01/introducing_the_appcall_featur_1.html">Appcall feature</a> in IDA Pro 5.6. Today we will talk a little about how it's implemented and describe some of the uses of Appcall in various scenarios.</p>

<h2>How Appcall works</h2>

Given a function with a correct prototype, the Appcall mechanism works like this:
<ol>
  <li>Save the current thread context
  <li>Serialize the parameters (we do not allocate memory for the parameters, we use the debuggee's stack)
  <li>Modify the input registers in question
  <li>Set the instruction pointer to the beginning of the function to be called
  <li>Adjust the return address so it points to a special area where we have a breakpoint (we refer to it as <i>control breakpoint</i>)
  <li>Resume the program and wait until we get an exception or the control breakpoint (inserted in the previous step)
  <li>Deserialize back the input (only for parameters passed by reference) and save the return value
</ol>

In the case of a manual Appcall, the debugger module will do all but the last two steps, thus giving you a chance to debug interactively the function in question.<br/>
When you encounter the control breakpoint:<br/>
<blockquote><img src="http://hexblog.com/ida_pro/pix/appcall_manual_control.gif"></blockquote><br/>
you can issue the <b>CleanupAppcall()</b> IDC command to restore the previously saved thread context and resume your debugging session.]]></description>
         <link>http://hexblog.com/2010/01/practical_appcall_examples_1.html</link>
         <guid>http://hexblog.com/2010/01/practical_appcall_examples_1.html</guid>
         <category>IDA Pro</category>
         <pubDate>Sat, 16 Jan 2010 17:00:31 +0100</pubDate>
      </item>
            <item>
         <title>Introducing the Appcall feature in IDA Pro 5.6</title>
         <description><![CDATA[In this blog entry we are going to talk about the new Appcall feature that was introduced in IDA Pro 5.6.
Briefly, Appcall is a mechanism used to call functions inside the debugged program from the debugger or your script as if it were a built-in function. If you've used GDB (call command), VS (Immediate window), or Borland C++ Builder then you're already familiar with such functionality.
<br/>
<a href="http://hexblog.com/ida_pro/pix/appcall_intro.jpg"><img src="http://hexblog.com/ida_pro/pix/appcall_intro-thumb.jpg" width="500" height="294" /></a><br/>
(Screenshot showing how we called three functions (printf, MessageBoxA, GetDesktopWindow) using IDC syntax)

<p>
Before diving in, please keep in mind that this blog entry is a short version of the full Appcall reference found <a href="http://hex-rays.com/idapro/debugger/appcall.pdf">here</a>.
</p>]]></description>
         <link>http://hexblog.com/2010/01/introducing_the_appcall_featur_1.html</link>
         <guid>http://hexblog.com/2010/01/introducing_the_appcall_featur_1.html</guid>
         <category>IDA Pro</category>
         <pubDate>Tue, 12 Jan 2010 17:04:46 +0100</pubDate>
      </item>
            <item>
         <title>Debugging ARM code snippets in IDA Pro 5.6 using QEMU emulator</title>
         <description><![CDATA[<h2>Introduction</h2>
<p>IDA Pro 5.6 has a new feature: automatic running of the QEMU emulator. It can be used to debug small code snippets directly from the database.
In this tutorial we will show how to dynamically run code that can be difficult to analyze statically.</p>
<h2>Target</h2>
<p>As an example we will use shellcode from the article <a href="http://www.phrack.com/issues.html?issue=66&id=12">"Alphanumeric RISC ARM Shellcode"</a> in Phrack 66.
It is self-modifying and because of alphanumeric limitation can be quite hard to undestand. So we will use the debugging feature to decode it.</p>]]></description>
         <link>http://hexblog.com/2010/01/debugging_arm_code_snippets_in_1.html</link>
         <guid>http://hexblog.com/2010/01/debugging_arm_code_snippets_in_1.html</guid>
         <category>IDA Pro</category>
         <pubDate>Fri, 08 Jan 2010 18:46:43 +0100</pubDate>
      </item>
            <item>
         <title>PDF file loader to extract and analyse shellcode</title>
         <description><![CDATA[One of the new features in <a href="http://www.hex-rays.com/idapro/56/index.htm">IDA Pro 5.6</a> is the possibility to write file loaders using scripts such as IDC or Python.<br/>
To illustrate this new feature, we are going to explain how to write a file loader using IDC and then we will write a file loader (in Python) that can extract shell code from malicious PDF files.<br/>

<img src="http://hexblog.com/ida_pro/pix/pdf_loader.gif" width="497" height="462" />]]></description>
         <link>http://hexblog.com/2010/01/pdf_file_loader_to_extract_and_1.html</link>
         <guid>http://hexblog.com/2010/01/pdf_file_loader_to_extract_and_1.html</guid>
         <category>IDA Pro</category>
         <pubDate>Wed, 06 Jan 2010 10:58:07 +0100</pubDate>
      </item>
            <item>
         <title>Hex-Rays Plugin Contest</title>
         <description><![CDATA[<p>We are glad to announce the results of our first plugin contest! For the contest rules, please check this page:</p>

<p><a href="http://www.hex-rays.com/contest.shtml">http://www.hex-rays.com/contest.shtml</a></p>

<p>Or you may directly go to the contest results and check out some cool plugins:</p>

<p><a href="http://www.hex-rays.com/contest2009">http://www.hex-rays.com/contest2009</a></p>

<p>It was our first contest, but we are happy with the results and will repeat it in the near future.<br />
Have fun!</p>]]></description>
         <link>http://hexblog.com/2009/11/hexrays_plugin_contest.html</link>
         <guid>http://hexblog.com/2009/11/hexrays_plugin_contest.html</guid>
         <category>IDA Pro</category>
         <pubDate>Fri, 20 Nov 2009 15:42:45 +0100</pubDate>
      </item>
            <item>
         <title>Hex-Rays is hiring</title>
         <description><![CDATA[<p>We are looking for someone to join our team and participate in the development of unique software security tools. The candidates must know low-level details of modern software as well as high-level data structures and algorithms.</p>

<p>Requirements:</p>

<p>* strong knowledge of C/C++<br />
*<strong> experience with Qt and GUI development is a big PLUS</strong><br />
* knowledge of x86 assembler and unwillingness to use it in development<br />
* cross platform development (Windows/Linux/Mac) is a plus<br />
* knowing the graph theory and how compilers work is a plus<br />
* ability and willingness to write secure yet fast code<br />
* good problem solving and communication skills</p>

<p>To apply, please send your resume to info@hex-rays.com<br />
Code samples and links to implemented projects are welcome.<br />
</p>]]></description>
         <link>http://hexblog.com/2009/10/hexrays_is_hiring.html</link>
         <guid>http://hexblog.com/2009/10/hexrays_is_hiring.html</guid>
         <category>IDA Pro</category>
         <pubDate>Wed, 21 Oct 2009 13:22:43 +0100</pubDate>
      </item>
            <item>
         <title>Hex-Rays Decompiler primer</title>
         <description><![CDATA[<p>The <a href="http://www.hex-rays.com/decompiler.shtml">Hex-Rays Decompiler</a> 1.0 was released more than two years ago.
Since then it has improved a lot and does a great job decompiling real-life code, but sometimes there are additional things that you might wish to do with its output.
For that purpose we have released the Hex-Rays <a href="http://hexblog.com/2007/10/hexrays_sdk_is_ready.html">Decompiler SDK</a> and several sample plugins.
However, the header files alone do not give a complete picture and it can be difficult to see where to start.</p>

In this post we will outline the architecture of the Hex-Rays Decompiler SDK, cover some principles and finally wrap everything we discussed and write a small plugin.]]></description>
         <link>http://hexblog.com/2009/10/hexrays_decompiler_primer.html</link>
         <guid>http://hexblog.com/2009/10/hexrays_decompiler_primer.html</guid>
         <category>Decompilation</category>
         <pubDate>Thu, 15 Oct 2009 13:36:32 +0100</pubDate>
      </item>
            <item>
         <title>SEH Graph</title>
         <description><![CDATA[It is <a href="http://en.wikipedia.org/wiki/A_picture_is_worth_a_thousand_words">said</a> that a picture is worth a thousand words, and similarly many reversers would agree that a graph is worth a thousand lists! ;)</br>
<p>
Recently, we added graphing support into IDAPython and now Python scripts can build interactive graphs.<br/>
To demonstrate this new addition, we will write a small script that graphs the structured exception handlers of a given process.<p/>
<br/>
<img alt="sehgraph_small.png" src="http://hexblog.com/ida_pro/pix/sehgraph_small.png" width="455" height="393" />
<br/>]]></description>
         <link>http://hexblog.com/2009/10/seh_graph.html</link>
         <guid>http://hexblog.com/2009/10/seh_graph.html</guid>
         <category>IDA Pro</category>
         <pubDate>Mon, 05 Oct 2009 17:08:45 +0100</pubDate>
      </item>
            <item>
         <title>Finding instructions</title>
         <description><![CDATA[Searching for instructions and opcodes is a basic necessity for security researchers, therefore to address this issue IDA Pro provides many search facilities, among them we list:<br/>
<ul>
<li>Text search: Used to search the listing for text patterns (regular expressions are allowed). One can write a regular expression to find any assignment to the eax register (with the <i>mov</i> instruction)<br/>
<img src="http://hexblog.com/ida_pro/pix/findinst_text.jpg"/><br/>
<li>Binary search: Allows you to search for binary patterns with wildcard support. It is also possible to search for strings alongside with the binary patterns.<br/>
<img src="http://hexblog.com/ida_pro/pix/findinst_bin.jpg" width="429" height="361" /><br/>
<li>Immediate search: Very useful to find constants and magic numbers used in the program.
<li>Please refer to the search menu for other search facilities
</ul>

None of the existing search facilities allow us to readily search for instructions and opcodes. In order to do that, one has to assemble the instruction in question then use the <i>Binary Search</i> to find the pattern.<br/><br/>

Each processor module in IDA can implement the <i>assemble</i> notification callback:
<pre><blockquote style="background-color:lightblue">assemble,               // Assemble an instruction
                        // (display a warning if an error is found)
                        // args:
                        //  ea_t ea -  linear address of instruction
                        //  ea_t cs -  cs of instruction
                        //  ea_t ip -  ip of instruction
                        //  bool use32 - is 32bit segment?
                        //  const char *line - line to assemble
                        //  uchar *bin - pointer to output opcode buffer
                        // returns size of the instruction in bytes
</blockquote></pre>

Once this callback is implemented by the processor module one can then assemble instructions by calling the <i>ph.notify()</i> with the <i>assemble</i> notification code (please check this forum discussion <a href="http://hex-rays.com/forum/viewtopic.php?f=8&t=2103&p=8834&hilit=assemble#p8834">here</a>).<br/>

Currently, only the <i>pc</i> processor module implements this callback and provides a very basic assembler.<br/>

We wrote a script that allows you to search for opcodes and assembly statements, so for example to find the "33 c0" (xor eax, eax), followed by "pop ebp" and followed by "ret" we could search like this:
<pre><blockquote style="background-color:lightblue">find("33 c0;pop ebp;ret")</blockquote></pre><br/>

That's the script operation in brief:
<ol>
<li>Do some input initial validation
<li>Split the patterns
<li>Loop:
	<ol>
	  <li>Determine if the pattern is an assembly instruction or opcode list (using a simple regular expression)
  	  <li>If pattern is an instruction then assemble it
	  <li>Accumulate the assembled (or converted opcodes) into a single buffer
	</ol>
<li>Now that we have one single binary buffer we can search for it with FindBinary()
<li>Display the result
</ol>

<img src="http://hexblog.com/ida_pro/pix/findinst_demo.jpg" />
<br/>
The <a href="http://hexblog.com/ida_pro/files/FindInstructions.py">script</a> uses the Assemble() function (available in IdaPython <a href="http://code.google.com/p/idapython">r233</a> and above). Comments and suggestions are welcome.<br/><br/>]]></description>
         <link>http://hexblog.com/2009/09/assembling_and_finding_instruc.html</link>
         <guid>http://hexblog.com/2009/09/assembling_and_finding_instruc.html</guid>
         <category>IDA Pro</category>
         <pubDate>Tue, 22 Sep 2009 16:47:42 +0100</pubDate>
      </item>
            <item>
         <title>An attempt to reconstruct the call stack</title>
         <description><![CDATA[Walking the stack and trying to reconstruct the call stack is a challenge (especially if no or little symbolic information is present) and there are many questions to be answered in order to have a correct call stack:
<ul>
	<li>Determining return address
	<li>Determining the boundary of the caller function
	<li>Distinguishing between pointers to callbacks and return addresses
	<li>Determining stack frames
	<li>...
</ul>

In this post, we are going to implement the method entitled "<a href="http://msdn.microsoft.com/en-us/library/cc267826.aspx">Manually Walking a Stack</a>" described in the MSDN.<br/>
While this approach does not always give accurate results, it is still possible to get a fairly correct call stack.<br/>]]></description>
         <link>http://hexblog.com/2009/09/an_attempt_to_reconstruct_the.html</link>
         <guid>http://hexblog.com/2009/09/an_attempt_to_reconstruct_the.html</guid>
         <category>IDA Pro</category>
         <pubDate>Fri, 18 Sep 2009 12:13:42 +0100</pubDate>
      </item>
            <item>
         <title>Develop your master boot record and debug it with IDA Pro and the Bochs debugger plugin</title>
         <description><![CDATA[Writing boot code is useful for many reasons, whether you are:
<ul>
<li>Developing your own operating system
<li>Developing disk encryption systems
<li>Experimenting and researching
<li>Or even writing a bootkit
</ul>]]></description>
         <link>http://hexblog.com/2009/09/develop_your_master_boot_recor.html</link>
         <guid>http://hexblog.com/2009/09/develop_your_master_boot_recor.html</guid>
         <category>IDA Pro</category>
         <pubDate>Thu, 10 Sep 2009 16:27:07 +0100</pubDate>
      </item>
            <item>
         <title>Driver dispatch-table viewer</title>
         <description><![CDATA[<p>With IDA, one can use the command line interface (CLI) not only to type scripting related commands but also to send debugger specific commands to the current debugger plugin.<br />
Although the topic mentions device drivers, you do not have to know much about drivers to learn something new from this post.</p>]]></description>
         <link>http://hexblog.com/2009/09/drivers_dispatch_table_viewer_1.html</link>
         <guid>http://hexblog.com/2009/09/drivers_dispatch_table_viewer_1.html</guid>
         <category>IDA Pro</category>
         <pubDate>Fri, 04 Sep 2009 16:56:58 +0100</pubDate>
      </item>
            <item>
         <title>Javascript for IDA Pro</title>
         <description><![CDATA[<img src="http://hexblog.com/ida_pro/pix/jshello.gif" align=left>Just a quick post to share the joy of having more expressiveness and freedom in IDA Pro. A few days ago we implemented a JavaScript plugin. This means that there is yet one more languauge to write scripts in IDA, and a very powerful one.
<p>
All usual methods of accessing the language work: you may execute scripts, standalone statements, or even completely replace IDC with JavaScript.
<p>
All IDC functions are availalble in JavaScript (in fact, we just exported them one-to-one). In the future, we will export IDA objects into JavaScript and this will make programming it even easier.
<p>
Download the plugin here: 
<a href="http://hexblog.com/ida_pro/files/js.zip">http://hexblog.com/ida_pro/files/js.zip</a>
<p>
If you notice anything unusual, send us a note, thank you!
<p>
Elias will blog more about the plugin in the coming days, and maybe present something handy, as he already <a href="http://hexblog.com/2009/06/function_call_graph_plugin_sam.html">did</a> in the past ;)
<p>
<small>P.S. I subscribed to twitter a few days ago - it is so dynamic. Will probably switch to it, at least partially</small>]]></description>
         <link>http://hexblog.com/2009/08/javascript_for_ida_pro.html</link>
         <guid>http://hexblog.com/2009/08/javascript_for_ida_pro.html</guid>
         <category>IDA Pro</category>
         <pubDate>Fri, 07 Aug 2009 17:59:37 +0100</pubDate>
      </item>
      
   </channel>
</rss>
