ShmooCon 20062006-01-06

Make / View Comments

It took a few days of (interspersed) debugging but I finally got memory breakpoints implemented in the Python Win32 debugging engine I wrote last weekend. It's built on the Python ctypes module, which I'm very fond of. Many thanks to the people I leaned on at various times while pulling my hair out trying to figure out what was wrong (hoglund, spoon, skape, drew ...). I'll make it available at some point, it's currently way too ugly but very functional:

    def attach:
    def bp_del:
    def bp_del_mem:
    def bp_is_ours:
    def bp_is_ours_mem:
    def bp_set:
    def bp_set_mem:
    def cleanup:
    def debug_event_loop:
    def detach:
    def disasm:
    def dump_context:
    def enumerate_threads:
    def exception_handler_breakpoint:
    def exception_handler_guard_page:
    def exception_handler_single_step:
    def func_resolve:
    def get_thread_context:
    def hex_dump:
    def hide_debugger:
    def is_address_on_stack:
    def is_printable_ascii:
    def is_printable_unicode:
    def little_endian:
    def load:
    def process_restore:
    def process_snapshot:
    def read_process_memory:
    def resume_thread:
    def set_callback:
    def set_register:
    def set_thread_context:
    def single_step:
    def smart_dereference:
    def stack_range:
    def suspend_thread:
    def terminate_process:
    def virtual_protect:
    def virtual_query:
    def write_process_memory:
    
It's interesting being able to quickly prototype various debugging based ideas in Python:
    pydbg = pydbg()
    
    pydbg.set_callback(EXCEPTION_BREAKPOINT,       h_bp)
    pydbg.set_callback(EXCEPTION_ACCESS_VIOLATION, h_av)
    
    try:
        pydbg.attach(pid)
    
        recv     = pydbg.func_resolve("ws2_32",  "recv")
        recvfrom = pydbg.func_resolve("ws2_32",  "recvfrom")
    
        pydbg.bp_set(recv)
        pydbg.bp_set(recvfrom)
    
        pydbg.debug_event_loop()
    except pdx, x:
        sys.stderr.write(x.__str__() + "\n")
There is still an oustanding question of how exactly Windows deals with guard pages. I put that question up in the forums so people can respond to it:

http://www.openrce.org/forums/posts/110

Make / View Comments

Debugger Debugging Madness2005-11-02

Make / View Comments

Recently, I was setting up a new installation of IDA and decided to document all of my customizations for ease of portability. I am curious to hear about what other customizations people use / have come across. Should make for an interesting dialog. Here are the customizations I use:

---------- ida.idc ----------
#include 
#include 
#include 
#include 

static main(void) {

//
// This function is executed when IDA is started.
//
// Add statements to fine-tune your IDA here.
//

    AddHotkey("Ctrl-Shift-X",     "export_disassembly");
    AddHotkey("Ctrl-Shift-J",     "jump_to_func_top");
    AddHotkey("Ctrl-Shift-Enter", "track_follow");
    AddHotkey("Ctrl-Shift-N",     "track_name");
...

---------- ida.cfg ----------
Some of these customizations were gleaned from Nicolas Brulez

// This prefix is used when a new
// name is generated
// changed this from 'a' to 'str->'
ASCII_PREFIX = "str->"

// Maximal length of new names
// (you may specify values up to 511)
// increased this to 128
MAX_NAMES_LENGTH = 128

// asm specific character, added '-' and '>'
NameChars = "$?@->"

SHOW_XREFS        = 4
SHOW_BASIC_BLOCKS = YES
SHOW_SP           = YES

---------- idagui.cfg ----------
HELPFILE = "c:\\OPCODES.HLP"

// Display the Edit,Patch submenu
DISPLAY_PATCH_SUBMENU = YES

// Display the expressions/IDC command line
DISPLAY_COMMAND_LINE  = YES

// display referenced items
"ChartXrefsTo"   = "Ctrl-Shift-T"

// display referencing items
"ChartXrefsFrom" = "Ctrl-Shift-F"

// lock the current highlighted text
"LockHighlight"  = "Ctrl-H"

All of the above referenced files are available from my file respository on OpenRCE.

Make / View Comments

IDA Disassembly and Graph Coloring2005-09-20

Make / View Comments

ToorCon was awesome. This was my first time out to that con (as well as San Diego for that matter) and it more then lived up to expectations. The venue was good, the weather was great and the party was successful, thanks in no small part due to a financial contribution from Microsoft I'm sure.

There were a number of good talks there. Among the more unique/interesting was Skape's presentation on "temporal return addresses" and Christopher Abad's talk where he cracked basic crypto with Photoshop and demo-ed a multi-color ASCII "video" streamer he wrote. Some of Christopher's work can be found at http://the-mathclub.net.

Make / View Comments

IDA Customizations2005-08-01

Make / View Comments

Still recovering from a week in Vegas. I have a new founded respect for teachers/professors. The two day intermediate malware analysis course I gave put my voice out of commission. I don't know how it's possible to maintain that for months on end. Talking over loud music definetely didn't help the situation. Vegas was a blast. Caught some good talks at Blackhat, put a lot of faces to names at the various parties- the most amazing of which was the 3Com/TippingPoint party held on Wednesday night at the Hard Rock. There must have been almost a thousand people there and the place was out of control. Who would have guessed that the dance floor of a security conference party would ever fill up. In my (currently unbiased) opinion this party was the best of the week.

Speaking of currently unbiased. I will be transitioning to TippingPoint over the balance of this month and am excited about the career change. Once I get settled in I will start tackling the long list of feature requests for OpenRCE. Including: adding an events section, the ability to edit posts, a new (and very cool) reference library feature that Greg Hoglund may potentially contribute, blog comments etc...

The re-architecting and development of IDA Sync will follow shortly after the updates to OpenRCE. Once the ground work is laid out I will poll the users via the forums for comments, criticisms and suggestions.

Make / View Comments

Process Stalker Tool Release2005-07-06

I released Process Stalker publicly today, open source and available for download from http://labs.idefense.com. Process Stalking is a term coined to describe the combined process of run-time profiling, state mapping and tracing. Consisting of a series of tools and scripts the goal of a successful stalk is to provide the reverse engineer with an intuitive visual interface to filtered, meaningful, run-time block-level trace data.

A step-by-step example walkthrough of Process Stalker vs the Microsoft MS05-030 security bulletin is available at http://www.openrce.org. Binaries, source code and in-depth documentation are available in the bundled archive. Relevant slideshows from Process Stalker presentations are available on the past speaking engagements page.

The IDA Function Analyzer component was used and extended in the development of Process Stalker. The biggest change is the addition of the gml_export() routine for generating GML graphs.