21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

To demonstrate the effect this macro has on disassemblers, the following source<br />

code was compiled and disassembled:<br />

void my_func(void) {<br />

int x;<br />

NULLPAD_10;<br />

for (x = 0; x < 10; x++) printf("%x\n", x);<br />

}<br />

DataRescue’s IDA Pro disassembler creates a code/data boundary at the start of the<br />

NULL bytes, and completely ignores the instructions that follow:<br />

08048374 my_func:<br />

08048374 55 push ebp<br />

08048375 89 E5 mov ebp, esp<br />

08048377 83 EC 08 sub esp, 8<br />

0804837A 50 push eax<br />

0804837B 89 E0 mov eax, esp<br />

0804837B ; ------------------------------------------------------------------<br />

0804837D 00 db 0 ;<br />

0804837E 00 db 0 ;<br />

0804837F 00 db 0 ;<br />

08048380 00 db 0 ;<br />

08048381 00 db 0 ;<br />

08048382 00 db 0 ;<br />

08048383 00 db 0 ;<br />

08048384 00 db 0 ;<br />

08048385 00 db 0 ;<br />

08048386 00 db 0 ;<br />

08048387 58 db 58h ; X<br />

08048388 C7 db 0C7h ; +<br />

08048389 45 db 45h ; E<br />

0804838A FC db 0FCh ; n<br />

0804838B 00 db 0 ;<br />

0804838C 00 db 0 ;<br />

0804838D 00 db 0 ;<br />

The GNU objdump utility ignores the NULL bytes, though the rest of the disassembly<br />

was not affected:<br />

08048374 :<br />

8048374: 55 push %ebp<br />

8048375: 89 e5 mov %esp,%ebp<br />

8048377: 83 ec 08 sub $0x8,%esp<br />

804837a: 50 push %eax<br />

804837b: 89 e0 mov %esp,%eax<br />

...<br />

8048385: 00 00 add %al,(%eax)<br />

8048387: 58 pop %eax<br />

8048388: c7 45 fc 00 00 00 00 movl $0x0,0xfffffffc(%ebp)<br />

804838f: 83 7d fc 09 cmpl $0x9,0xfffffffc(%ebp)<br />

8048393: 7e 02 jle 8048397 <br />

8048395: eb 1a jmp 80483b1 <br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.<br />

Countering Disassembly | 689

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!