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.

The int3 interface can also be used to issue commands to SoftICE by setting the esi<br />

and edi registers to magic values, then invoking function 0x911:<br />

#include <br />

char *sice_cmd = "hboot";<br />

BOOL spc_softice_command(char *cmd) {<br />

__asm {<br />

push esi<br />

mov esi, 0x4647 ; "FG"<br />

push edi<br />

mov edi, 0x4A4D ; "JM"<br />

push edx<br />

mov edx, [cmd] ; command (string) to execute<br />

mov ax, 0x0911 ; function 911: execute SOFTICE command<br />

int 3<br />

pop edx<br />

pop edi<br />

pop esi<br />

}<br />

}<br />

Finally, the presence of SoftICE can be detected by invoking function 0x43 of interrupt<br />

0x68:<br />

#include <br />

__declspec(naked) BOOL spc_softice_ispresent(void) {<br />

__asm {<br />

mov ah, 0x43<br />

int 0x68<br />

cmp ax, 0xF386<br />

jnz debugger_not_present<br />

mov eax, 1<br />

ret<br />

debugger_not_present:<br />

xor eax, eax<br />

ret<br />

}<br />

}<br />

SoftICE detection and counterdetection is a continuously evolving field. Different<br />

versions of SoftICE have different memory footprints and runtime behavior that can<br />

be used to detect them; however, because most software protection crackers have<br />

modified their versions of SoftICE to foil known detection methods, it is advisable<br />

not to rely entirely on SoftICE detections for protection.<br />

See Also<br />

• “About Anti-SoftICE Tricks” by Frog’s Print: http://www.crackstore.com/003.htm<br />

• “Anti-Debugging Tricks” by Black Fenix: http://in.fortunecity.com/skyscraper/<br />

browser/12/sicedete.html<br />

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

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

Detecting SoftICE | 687

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

Saved successfully!

Ooh no, something went wrong!