Anda di halaman 1dari 34

Debugging Loop de Debugging RCFast

Un Micro Deburguer en Python


Joshep Joel Cortez Sachez n

December 13, 2012

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Que es un debugger?

Es un programa cuyo objetivo es analizar algn programa. u Objetivo Principal Encontrar errores(bugs) en los programas. Pero se puede usar tambin para entender el comportamiento e cuando no se tiene el cdigo fuente. o

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Que es un debugger?

Es un programa cuyo objetivo es analizar algn programa. u Objetivo Principal Encontrar errores(bugs) en los programas. Pero se puede usar tambin para entender el comportamiento e cuando no se tiene el cdigo fuente. o

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Que es un debugger?

Es un programa cuyo objetivo es analizar algn programa. u Objetivo Principal Encontrar errores(bugs) en los programas. Pero se puede usar tambin para entender el comportamiento e cuando no se tiene el cdigo fuente. o

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Funciones Principales

Single stepping Breaking Read/Write memory and context Remote debugging

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Ejemplos

Gdb OllyDbg InmunittyDbg WinDbg Dbx Otros(pydbg,winappdbg,vtrace)...

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Hay tantas cosas buenas... Para que reinventar la rueda?

La idea fu entender lo que ocurre a bajo nivel y entender la e magia oscura que hay por detras de un loop de debug. La intencin fue meramente de aprendizaje, no se trata de o hacer un debugger completo, para eso hay gente ya haciendolo por mi.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Hay tantas cosas buenas... Para que reinventar la rueda?

La idea fu entender lo que ocurre a bajo nivel y entender la e magia oscura que hay por detras de un loop de debug. La intencin fue meramente de aprendizaje, no se trata de o hacer un debugger completo, para eso hay gente ya haciendolo por mi.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Hay tantas cosas buenas... Para que reinventar la rueda?

La idea fu entender lo que ocurre a bajo nivel y entender la e magia oscura que hay por detras de un loop de debug. La intencin fue meramente de aprendizaje, no se trata de o hacer un debugger completo, para eso hay gente ya haciendolo por mi.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Que hicimos?

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Idea de nuestro loop:

Ser minimalista y autocontenido Detectar cualquier crash Soportar timeout Soportar keystrokes Backup de archivos y registros.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Idea de nuestro loop:

Ser minimalista y autocontenido Detectar cualquier crash Soportar timeout Soportar keystrokes Backup de archivos y registros.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Idea de nuestro loop:

Ser minimalista y autocontenido Detectar cualquier crash Soportar timeout Soportar keystrokes Backup de archivos y registros.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Idea de nuestro loop:

Ser minimalista y autocontenido Detectar cualquier crash Soportar timeout Soportar keystrokes Backup de archivos y registros.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Idea de nuestro loop:

Ser minimalista y autocontenido Detectar cualquier crash Soportar timeout Soportar keystrokes Backup de archivos y registros.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Dependencias

ctypes distorm pywin

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Dependencias

ctypes distorm pywin

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Ctypes

Es una foreign function library. Funciona como una interfaz con las dlls. Nos permite crear estructuras y uniones como las de C. A nosotros nos permitir llamar funciones como a kernel32.CreateProcess y denir las estructuras necesarias para llamarlas.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Ctypes

Es una foreign function library. Funciona como una interfaz con las dlls. Nos permite crear estructuras y uniones como las de C. A nosotros nos permitir llamar funciones como a kernel32.CreateProcess y denir las estructuras necesarias para llamarlas.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Ctypes

Es una foreign function library. Funciona como una interfaz con las dlls. Nos permite crear estructuras y uniones como las de C. A nosotros nos permitir llamar funciones como a kernel32.CreateProcess y denir las estructuras necesarias para llamarlas.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Deniendo estructuras
La signatura de CreateProcess es:

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Deniendo estructuras
C++ En python con Ctypes

130-100

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Deniendo estructuras
C++ En python con Ctypes

130-100

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Que mas hay que saber?


Debug Event Posibles eventos Excepciones

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Que mas hay que saber?

Debug Event Posibles eventos Excepciones Eventos CREATE PROCESS EXIT PROCESS CREATE THREAD EXIT THREAD LOAD DLL RIP OUTPUT UNLOAD DLL EXCEPTION

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Que mas hay que saber?

Debug Event Posibles eventos Excepciones Excepciones ACCESS VIOLATION ARRAY BOUNDS EXCEEDED BREAKPOINT DATATYPE MISALIGNMENT ILLEGAL INSTRUCTION IN PAGE ERROR NONCONTINUABLE PRIV INSTRUCTION STACK OVERFLOW

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

DEMO!

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Todo muy lindo

Algo ms? a

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Jorge Han Laboratories e

Surgi una idea brillante. o Encontrar el crash m nimo basado en un crash ya existente.

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

OTRA DEMO!

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Debilidades

Necesita que el crash sea fabricado de un archivo que no crashee (normal) El crash y el normal deben tener el mismo tamao. n

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Debilidades

Necesita que el crash sea fabricado de un archivo que no crashee (normal) El crash y el normal deben tener el mismo tamao. n

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

Preguntas?

Joshep Joel Cortez Sachez n

Deburgging in Python

Debugging Loop de Debugging RCFast

GRACIAS JORGE!

Joshep Joel Cortez Sachez n

Deburgging in Python

Anda mungkin juga menyukai