About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
5 O; f1 d! I7 s<TBODY>
9 r6 L  g2 L  ^9 \& h' W. ]7 A8 o/ b<TR>$ L" _  t8 \* H6 W3 f) T
<TD><PRE>Method 01 / Z: N# }5 c; n& `9 Q# m% J- c
=========5 X6 m# d/ x( v7 Q" H- M

$ n$ X% S2 y( J/ P3 o& d2 m' VThis method of detection of SoftICE (as well as the following one) is! n  g7 u3 a' z( \& A
used by the majority of packers/encryptors found on Internet.
. e& s9 E0 o% ~2 ?It seeks the signature of BoundsChecker in SoftICE- S! V* n1 ~' Z' v+ t5 H9 N
& J- r, p+ r$ s4 K* d) n. {
    mov     ebp, 04243484Bh        ; 'BCHK'- ~% p& {, R% m( T6 F, s: Y9 q
    mov     ax, 04h
" f, ~( x, L( K( u& O0 {    int     3       : q/ b; {  {  O# z" W& _& r3 z
    cmp     al,4; S( l4 d) Q2 V
    jnz     SoftICE_Detected
: H3 `1 L3 h& U$ T; X; i; Z0 X9 M9 ^9 G6 f# H6 m$ w' v% A0 D# x. {0 O
___________________________________________________________________________
& ^2 n. T' w( g, \% U6 O9 v- V, W& C7 t4 P
Method 02; i: G: ?, G" H
=========+ i; p/ |; ~9 K+ v7 U

4 j2 E; h) }  M: s4 g0 N8 @Still a method very much used (perhaps the most frequent one).  It is used
+ K9 ]; _/ T$ X5 i- Q9 q) b" xto get SoftICE 'Back Door commands' which gives infos on Breakpoints,: }7 [2 O6 S5 X
or execute SoftICE commands...
) l6 C$ j0 i3 p7 _+ |It is also used to crash SoftICE and to force it to execute any commands
, I! m8 U1 L, ^7 C) S+ ]2 H(HBOOT...) :-((  - R0 @6 e& l: K8 ]
: D2 \+ ]& r7 J. g# ^
Here is a quick description:
5 M% E& J1 x' x-AX = 0910h   (Display string in SIce windows)
7 i2 L+ B5 X. m# M" L4 n4 L$ ~7 `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 v$ W" R9 a+ Z6 Z  B  i
-AX = 0912h   (Get breakpoint infos)$ F' P7 R9 c6 o. n
-AX = 0913h   (Set Sice breakpoints)
* S" w$ {, y  p3 j, b6 k-AX = 0914h   (Remove SIce breakoints)7 _( `; V  q7 T% U
! J) z& C5 g) x) B9 F7 l: |7 l
Each time you'll meet this trick, you'll see:6 m( B# n2 h- ]0 Q8 w- h
-SI = 4647h( d1 q: @* I* T) @$ Q' a8 b) i
-DI = 4A4Dh/ r# C& X0 q0 t5 e: k0 z: C
Which are the 'magic values' used by SoftIce.5 {5 U* L( ?+ l: |
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
5 H' q& X1 `; w9 k. I4 {2 D$ p4 D& k2 o" W9 j3 H
Here is one example from the file "Haspinst.exe" which is the dongle HASP; A' P. g1 \" e+ h
Envelope utility use to protect DOS applications:
2 q4 u* c9 L( j+ ?: |5 z
- C. i* x  G  m6 q1 a
5 A2 _9 F* T" x2 H* ]4C19:0095   MOV    AX,0911  ; execute command.
3 v% D2 G- L, c, b: \9 e  J4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
' ^9 o) a7 n0 G9 G8 k6 f9 U4C19:009A   MOV    SI,4647  ; 1st magic value.$ D8 ]0 m2 }/ k' h' N0 R+ N. B8 X6 q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( z; F) x# c( e4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 b6 U: k4 V: ^2 M9 t, x4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ j# \& j1 s# J- K9 I
4C19:00A4   INC    CX
9 E6 I, E8 D+ N0 w# i2 f) u4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
$ s8 g" v! S! N- Y( X. v0 t; J+ Q4C19:00A8   JB     0095     ; 6 different commands.
. Z6 z5 ?& x+ A' {5 Q6 e# q4 s4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
# _: m% `/ Y  m$ e2 Y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' P1 c% i% m' q" L5 ~
1 ]+ L2 A' o/ I- \+ y
The program will execute 6 different SIce commands located at ds:dx, which, z" G8 Z# G. s* E
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 H4 B; n$ C/ R) c* Q2 w7 [

: Y7 p1 U+ G; j; P& v% C. R* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: n" V6 F8 W  \1 X0 o, {, Z' W5 B___________________________________________________________________________
! x; a1 l3 b6 e% h8 t) H$ `2 V+ [6 {) o0 C
! ?! w9 E% m4 _7 S' c$ X" j
Method 03% z" B) Z' x1 l3 N
=========
4 n% X* H3 g6 P( i' t
- C& h1 t" u$ f9 V& RLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 |  x, b1 G* m) @8 B- }, Q! D(API Get entry point)4 \5 ~' U  I0 `; l
        % v4 ~, U, ?$ Z0 F
/ ^( R5 \: ~4 l7 a
    xor     di,di2 d* o+ P' K' y0 b6 G
    mov     es,di/ o8 v* z  V$ C) _7 A" a! L
    mov     ax, 1684h      
8 D, {: z" B8 b. `' F    mov     bx, 0202h       ; VxD ID of winice
8 J! q! |- o$ k2 J5 e    int     2Fh% _1 S  j9 g9 l  A3 c( d1 x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& R( q* R: ~( ~  O    add     ax, di6 x6 r9 x4 D* O! J
    test    ax,ax
/ \  t6 B0 ]+ K; E    jnz     SoftICE_Detected
3 y# i7 W2 [9 b/ X2 g
. `% Q4 R# q4 \! O4 n5 @9 N___________________________________________________________________________" K, s! `- z" C; p6 u' G/ z

6 i' c: _8 Y, ]! [2 i- u  p2 R% G" @Method 04
* s- h  i5 L5 M3 b. q=========  E9 W9 A& ]0 A6 i3 k! n
! y, I- ^* S& u
Method identical to the preceding one except that it seeks the ID of SoftICE! _) L8 @' E2 [8 f
GFX VxD.
- X3 q' G. p$ R$ [2 E! o) |; g; f& \! B1 A, I
    xor     di,di
/ [9 X0 H$ W& B% Q; N    mov     es,di
1 ?; c" L6 w& G6 }4 D0 I+ d/ X* a    mov     ax, 1684h      
! N  `7 l# W1 ~  Y% ?4 U4 }    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 U2 R: _- D$ v
    int     2fh% b. A' o, @6 I5 ]$ b5 _( u
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, E0 n6 W0 `' w' a5 l  j8 N: k    add     ax, di4 c8 l' R2 |' T2 `' i8 F
    test    ax,ax
: \1 R$ M* p/ [# c7 c5 g    jnz     SoftICE_Detected
0 u" ?( _6 w& d8 A+ `3 f, K4 ]3 I8 W/ G2 p, p. t8 z0 |
__________________________________________________________________________
8 c& Y6 C+ k, B2 W
8 a5 N5 W# G& @; H3 z  S8 V  V! K
Method 05
& ~! x( \$ u" w* s. F0 @' A=========
: a7 q* Y' ^1 D$ |. [
5 e+ t! t+ c1 r$ PMethod seeking the 'magic number' 0F386h returned (in ax) by all system, n: a# }6 j7 D7 h! U( l
debugger. It calls the int 41h, function 4Fh.
; u- t1 e5 ], hThere are several alternatives.  
2 H$ ~: ~# f% N0 m3 l8 Q4 N+ P1 X% G8 r: l
The following one is the simplest:7 }4 \/ k: R( u

# C1 A8 K1 M) v* ^    mov     ax,4fh
& \% s2 n. f+ Z) T0 ]. K5 R    int     41h
: n# `7 V+ {; r' {" F# q8 u    cmp     ax, 0F386( t" l7 y$ s3 A" }
    jz      SoftICE_detected6 D6 q3 Z* ^$ Q* J" f$ p( W  B
1 s- k% A- g" u4 c/ N

) B2 ^% v% p) c& ~Next method as well as the following one are 2 examples from Stone's / Q* i& {4 N% E$ ^$ p
"stn-wid.zip" (www.cracking.net):
- s. I1 g  J  ~8 _- h; b3 F
: |8 U4 B& N6 o    mov     bx, cs
4 d" {: C) Q* E    lea     dx, int41handler2
& x) }; I$ ^, Z4 t; Z/ ~    xchg    dx, es:[41h*4]# Q/ [% v- T2 _' W. R+ U, m3 d' D7 [3 P
    xchg    bx, es:[41h*4+2]& M& p. u* l5 w6 e) K+ B& O
    mov     ax,4fh
1 |1 W: D; }: o0 I+ {  P    int     41h. c/ T) g! }" G# z( V
    xchg    dx, es:[41h*4]
2 b3 A2 w" u  y+ Q4 v    xchg    bx, es:[41h*4+2]
$ |, b- J3 @9 ~1 j: k/ L    cmp     ax, 0f386h2 g8 B) `# C8 b0 b  |: ^  D, c
    jz      SoftICE_detected; `2 a+ J; g) r

/ y1 ^8 I' [- W' C, }8 Wint41handler2 PROC: a: X3 W+ X/ G, I, a9 k$ e
    iret
/ b; p$ O  t+ D9 yint41handler2 ENDP
  [% b7 ^0 d4 V/ w- K; R8 G+ ?+ G/ A6 D7 [% w

7 z+ F1 d9 E+ x6 q) H' N, v4 Y( o* z_________________________________________________________________________
, ^+ a2 h' W! E) d' f# m- H1 N; `; }: q* f  S: g

3 C7 T( Y6 o; ^% E6 z0 x  Q8 R" ]Method 06
2 e' ?$ ?  H, Y  E5 c=========( ?* e7 z# W' D2 i. B

! z% |+ E" J: K* B0 B5 O* V- ~- u; w1 K
2nd method similar to the preceding one but more difficult to detect:
! q( Q+ l2 h. e9 q9 g* P0 t0 `( D2 n# o: T+ c+ Q8 f: d9 S9 {
- m4 S! Y: w% m; D0 A$ B4 _, K
int41handler PROC) x2 s9 l9 D! X6 t. D4 F/ h4 {
    mov     cl,al" D1 U  ~* P0 j( X. j' k0 ?
    iret
( Y, y$ ^; f" D8 ]3 k, L. s% U0 g' c) Xint41handler ENDP
. \+ w3 k- U$ E% y  A* g0 \# j6 C! }+ u  s( k" I5 ?! H
# c6 U0 t0 ]# F) B4 E* n! H9 `
    xor     ax,ax
0 Y' G0 |8 S8 \8 u7 p    mov     es,ax7 z9 K  |, g2 n, r
    mov     bx, cs: Y) R* z5 E" k% g/ A8 g% D0 V7 ^
    lea     dx, int41handler
) g0 X. c9 ^- g# k    xchg    dx, es:[41h*4]5 e. \. D" n1 j& F, C, ]
    xchg    bx, es:[41h*4+2]
* x; v( C" j+ Q    in      al, 40h
$ m+ F, g# r5 l$ ^/ O    xor     cx,cx
# z$ f+ ~, U+ Q  L" i    int     41h( ~! B$ c1 D  y" S4 D# b* D: t* d
    xchg    dx, es:[41h*4]
2 O( F8 h! P5 m/ A: ]8 F* Z# a    xchg    bx, es:[41h*4+2]
. j- P1 c; ]- E* Q/ F- m    cmp     cl,al
# k# U) V8 H. f    jnz     SoftICE_detected
& Y( g. B$ W1 w( }( z! Z- g2 j, ?% F1 w* x- g% A1 r
_________________________________________________________________________2 {& v! c% ^& n5 L
, R2 w: X% l5 D  ~0 g, ?  W- Z: ]
Method 07
1 G* G& a6 ]; T# \4 L=========
* `3 G5 W3 q9 j* o" x5 |3 o5 J% ]! |, C0 z7 A0 U
Method of detection of the WinICE handler in the int68h (V86)
/ E) w( E* a$ D0 d5 b3 Y7 n
; x9 C* o" B9 A8 M; {2 q7 N+ p    mov     ah,43h0 m4 J8 n5 w5 v4 r# \0 Q: G
    int     68h% U; W" W$ n7 _/ M" J2 i
    cmp     ax,0F386h' ]  E* `! [% Q8 m1 S
    jz      SoftICE_Detected
2 M! Z: F3 M& L* ~( ~0 e! V/ ^5 Q7 l$ @: M3 M/ \
# Q, L6 W3 M, X* ^4 f/ {3 o, \
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# f$ L+ E# a" r2 |/ X# l   app like this:- H: l% Y4 g5 c0 J  k  P7 h

1 ~/ A2 G4 n; L- }   BPX exec_int if ax==68
3 ?7 d6 Q% J7 T  C   (function called is located at byte ptr [ebp+1Dh] and client eip is3 L8 `7 |1 d! Z9 n1 W
   located at [ebp+48h] for 32Bit apps)
  e" M2 ]' L9 R+ D! Y& t0 q__________________________________________________________________________4 w, |- \5 J5 S/ k8 d5 F
+ }) t1 S0 F. J9 e1 S/ y7 s& t

$ T  p4 B" p0 J. }6 m; z9 ]5 u! PMethod 089 v% h4 y9 ~1 @1 K$ \
=========
* L5 Z; A' ]1 c1 Y
/ h2 ?) _0 ^8 k/ Q8 I0 N# ?It is not a method of detection of SoftICE but a possibility to crash the$ v; k$ X! T6 ^
system by intercepting int 01h and int 03h and redirecting them to another
4 T- {" w# R6 W; C) Aroutine.. Z% [; W  m# _' H  f6 l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
. E' z3 _6 C. N4 p$ u* d( @to the new routine to execute (hangs computer...)" W$ U% n, I4 o* {6 k; h9 X3 T: Z' k/ k# C
  }9 K7 v. A. L+ ~) E
    mov     ah, 25h8 b( Q. O& F1 p' j; d& Q3 }
    mov     al, Int_Number (01h or 03h)3 W+ f6 q. I7 j; X6 I
    mov     dx, offset New_Int_Routine; [6 R) ^% P) y/ m! a7 X6 c  l5 P
    int     21h
/ y  s; V0 p/ {4 J/ h% {# g* P/ a' B; f8 H
__________________________________________________________________________- D5 K# \% u. V! |, Y% x2 p" g/ P

; Q1 g- E: u6 w8 |% J! OMethod 09
2 w( ^! j/ Y9 `, t% o% @2 h* u=========6 r4 m1 F5 q0 n1 @

6 G% S- Y3 e4 X; a2 B, Y6 s9 [$ ]8 N. @This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: ]. H& B" g# y
performed in ring0 (VxD or a ring3 app using the VxdCall).7 U$ b" p5 @: V1 W% p$ o* f
The Get_DDB service is used to determine whether or not a VxD is installed( ~% U, ?7 F6 w( I" ]8 \( d1 ^# r9 v+ T
for the specified device and returns a Device Description Block (in ecx) for
8 i+ `) _8 m- \$ wthat device if it is installed.& U2 p5 b8 b9 S9 P, J  m; |

/ K8 C- L% t* u; Z: Q   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. ]7 ]; ]1 x# w9 i
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% f" [$ J% p; ~( ^4 `7 C# }* Z! t7 z   VMMCall Get_DDB
$ G% n7 t- c  Z( i; b+ Y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 b& a" D5 A. g. H2 E1 U

6 E2 M1 Q+ \4 @5 G6 m+ lNote as well that you can easily detect this method with SoftICE:1 U- h1 u0 z& @4 @3 {7 b
   bpx Get_DDB if ax==0202 || ax==7a5fh  [" @" ^# s3 ~& h" ]2 L0 m0 V
2 X1 M! Y$ l. b; H4 A5 X9 Y5 O
__________________________________________________________________________
7 O/ E- Z; o4 [" s) H) _; V2 V) A& a, b" a5 Q
Method 108 D- i( B# B$ f( I+ B2 `5 y- H  \
=========
0 l: `% _9 h, L/ n% ]" v7 \1 O( Q* d1 b* W! S
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# s: h0 \: V. |2 P2 T
  SoftICE while the option is enable!!* i% U" M6 s1 o3 Y# W# {6 V% m

# P! s: |* \0 K; h9 D* e' w4 G6 bThis trick is very efficient:
$ I2 y0 h: Y4 u9 Gby checking the Debug Registers, you can detect if SoftICE is loaded+ f; v' }0 N* e, G& [; T4 o; R" _8 j5 J4 M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 r! k' {  B6 v6 R* @there are some memory breakpoints set (dr0 to dr3) simply by reading their9 u6 K: j. D) d, y
value (in ring0 only). Values can be manipulated and or changed as well# s, A; |! b4 {  d9 ^! k
(clearing BPMs for instance)
6 c" J; _4 l% ?2 q% `
) u' a8 T; T1 C; S2 N__________________________________________________________________________
- \- u+ a0 O: R7 c- k+ B3 K& w+ W( b6 h3 W3 m9 x( ], v, c2 ?% z
Method 11' G9 R) B" \/ q' C
=========6 x: X1 w( r: B2 n  r' l( g

; m. Z- z7 p0 C/ N; a, {: IThis method is most known as 'MeltICE' because it has been freely distributed
3 B/ W% e% {1 W$ ?via www.winfiles.com. However it was first used by NuMega people to allow3 m6 h& g  O" }$ j$ h* o4 R
Symbol Loader to check if SoftICE was active or not (the code is located- }4 x$ p0 m, k' b. v5 |0 ]
inside nmtrans.dll).
$ W# G- ^* Q7 U8 Q' o) [( L8 u2 ]& X$ j/ ^0 T4 v5 k$ M1 ^4 c9 j
The way it works is very simple:
, R4 b% g" K  W! a0 r4 HIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: v7 {7 c! Y/ t9 x; _& wWinNT) with the CreateFileA API.
% w8 Q3 d7 ?/ i1 U! t0 K# w. ]6 J% X6 Z+ n8 c" x
Here is a sample (checking for 'SICE'):
, m: _) e6 S, t1 ]% i
- g* z# d2 |3 q" Z# i9 g  bBOOL IsSoftIce95Loaded()
8 G7 V+ M- Z* |* s7 F& R4 ]( N: u1 O{
' u: ~; J; s* f( F: o, n: Q' C8 q   HANDLE hFile;  
7 Z1 O! P' K2 h   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ i; \0 ?6 _7 x7 K8 f) i
                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 t% V# a" J  u# |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' C8 o  K! @7 [   if( hFile != INVALID_HANDLE_VALUE )
; o2 b- W; l7 `8 P   {% a' @! O$ I# n5 v! p
      CloseHandle(hFile);
  r0 `. L) P* w9 v      return TRUE;  y9 X2 D# d6 q4 e
   }' m; A$ {3 W2 [" e! M, M' l: T
   return FALSE;( U# D: d5 ?% n0 s' T( |7 z/ G- S
}
/ x  X8 }$ y& W5 Y! u
& J( }9 y' w! p+ RAlthough this trick calls the CreateFileA function, don't even expect to be
9 ?& t0 T$ h8 \+ E" Fable to intercept it by installing a IFS hook: it will not work, no way!
. T- V4 ^6 B* N/ K7 d- @- fIn fact, after the call to CreateFileA it will get through VWIN32 0x001F  m  J; J/ S4 e# r
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
' z: U% `& D% F& ~1 U; iand then browse the DDB list until it find the VxD and its DDB_Control_Proc* y  A2 j8 V( O) J8 n
field.3 s* B- O: x1 E1 v; P% d
In fact, its purpose is not to load/unload VxDs but only to send a
: e. o. G7 b) [" f3 yW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)) P' ?3 u1 ~2 P# [1 p
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 H) `2 V$ D. a# f9 w  C3 d7 Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 e+ q, d) y( C' f; G+ sIf the VxD is loaded, it will always clear eax and the Carry flag to allow
8 G% ~' A4 ]# F1 g6 Sits handle to be opened and then, will be detected.
, Q1 f, E4 W7 j' yYou can check that simply by hooking Winice.exe control proc entry point
$ }& Y+ k7 C$ D. @  {3 nwhile running MeltICE.
+ g# N. k+ C' Y2 g7 b$ m% m- `  D5 `4 w
, I5 v1 T5 j4 i" e
, `* ^- |6 D& J& s! K8 J. g" R  00401067:  push      00402025    ; \\.\SICE
0 ?( h1 S! j9 h( f* y+ `& `  0040106C:  call      CreateFileA9 V# h  i5 |& i9 ]! E" ~5 g$ i& j6 x3 ]
  00401071:  cmp       eax,-0014 e$ U$ P& `$ n
  00401074:  je        00401091
6 p9 f) l  Y3 U1 ]  b5 L; Y" e
  e/ Q2 r& D- M& x
* X4 s8 y6 I  bThere could be hundreds of BPX you could use to detect this trick.4 c* t8 I8 r; @
-The most classical one is:$ k' s( j0 p/ b7 O. }  L" ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||# M. q- T* C8 s( p' f& A
    *(esp-&gt;4+4)=='NTIC'3 h4 |" g5 b9 @" `

( p( K/ j8 x& {-The most exotic ones (could be very slooooow :-(% C: W) ~* U! c2 ]( J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! L- k+ W; I1 q# J, W( r     ;will break 3 times :-(1 f/ D2 J8 S) |4 H  ?7 }( H
: f7 l. u2 q8 S6 I* f
-or (a bit) faster: 0 L8 i' V1 S6 z" q, e" x8 b
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" i) `( d4 j# D: L  h
. T* T, j# Y, c) s7 K0 q) i) Q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 p! A# T7 r8 [6 z# x6 j' y
     ;will break 3 times :-(
1 V/ F& h7 S9 T7 D8 W
( M4 r+ @3 u& d1 N' L% K7 B- N-Much faster:  E" g6 K1 Y0 U6 [9 k( I
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'+ @' A, b/ i: z; R

( T; _6 _, ~- K2 i# xNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% \; k  ]2 b- t+ a- h1 Z$ U" z
function to do the same job:
, N9 |5 k4 x9 ]) W' ]- a9 K; o. J, t1 [, S3 `; G; }1 z
   push    00                        ; OF_READ; a% |  \4 g: o1 t& _$ Q( e
   mov     eax,[00656634]            ; '\\.\SICE',0- J9 Q* C4 D, f* O/ T: M/ E! S4 i
   push    eax  j( W' M& _7 i, f8 _4 p  _1 x
   call    KERNEL32!_lopen
' }7 C" J% M& u8 G3 d' o. i" N4 ^* w   inc     eax
8 o$ }2 ~+ p% h- e" E3 i/ \  m( i   jnz     00650589                  ; detected# f) B8 {. H0 K9 s* p$ a
   push    00                        ; OF_READ# u0 F8 m) u5 e  x: r. g! R2 i( }
   mov     eax,[00656638]            ; '\\.\SICE'
* B9 [/ ^7 J/ Y   push    eax
. h: X: {, Y- d7 m! P" x& U   call    KERNEL32!_lopen, `6 h: `2 h/ }5 U2 W
   inc     eax
# y- c7 Y& j! I0 c  `+ F4 _   jz      006505ae                  ; not detected- l& ?( O! u- E- a
& N: X& [3 O: t! f% m5 l' Z
1 j3 U$ o0 Z- m. w' E( z; W& h
__________________________________________________________________________. z! n1 _7 Q6 O

+ K  ]6 H/ L& s' X2 TMethod 12
. K3 a6 r1 Y5 T$ b% k) R0 z=========
3 d7 f8 F1 x7 u% }* y0 c1 @
8 h* K& ~" Y" U- I$ `5 lThis trick is similar to int41h/4fh Debugger installation check (code 05  g8 t9 J4 p/ C% h6 |8 N( B
&amp; 06) but very limited because it's only available for Win95/98 (not NT)2 k4 ?+ {/ X0 Q: U+ e
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" h/ A# ?4 H: _4 W7 ?
! ^3 }1 ~! l+ c0 j  x7 }   push  0000004fh         ; function 4fh
% T0 h1 l) ~" v- O' f* o   push  002a002ah         ; high word specifies which VxD (VWIN32)
. z5 y, y1 j8 o. ~2 B( Y3 s                           ; low word specifies which service$ j4 b& m1 q: R
                             (VWIN32_Int41Dispatch)
' s, u3 u% m) n   call  Kernel32!ORD_001  ; VxdCall6 `' w5 E3 ?; b+ b* z0 E
   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ I9 z  u( ]8 q3 k4 t   jz    SoftICE_detected
+ w( E) N7 Y* O3 z4 J6 O: @
* \; y$ N! j# X$ y9 ?6 R, tHere again, several ways to detect it:
: {. Z1 _6 q( E: M) d: |' i, V: n5 V: f5 [. h
    BPINT 41 if ax==4f
5 d; Q$ B/ b( O1 Q, t' _2 i* M, F4 N5 @( Y
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
/ ]+ \8 h; B* X# E" k% j
0 Q5 x( c+ l* d! J0 J; o    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& z9 q/ X' u+ \" [& L$ Y6 O4 A

6 o/ f; J5 X$ j9 t8 Y4 @% I5 e+ R- o; A    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 _3 s( Q$ g/ b9 c, g0 c" J
' U9 s9 S0 l2 b2 Z
__________________________________________________________________________# h( l! p9 x3 A( R+ G5 ~# l, B
9 m5 q" H) n. S
Method 13- f& v% u/ f6 ~# j
=========$ x/ |" P1 b% |7 M

  O! B, X. B1 T5 r/ INot a real method of detection, but a good way to know if SoftICE is
: `+ s1 O' y+ ginstalled on a computer and to locate its installation directory.
" U" f+ x" f* {It is used by few softs which access the following registry keys (usually #2) :! ?& G' E6 s4 e+ P, O  P( y
# K3 ]' q. D2 l5 M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; W9 X6 J8 ?& W# E3 n\Uninstall\SoftICE
( [5 r% N" }. X' ^& C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# T/ [! i" n. }1 U" E3 }
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* {1 K( q6 b: n$ t5 H, _
\App Paths\Loader32.Exe. Q$ M% q0 O" P7 b1 n4 g/ Z: }" u

# f$ s7 j, m4 V+ t
' p. }1 Z- \( o& L& D8 `Note that some nasty apps could then erase all files from SoftICE directory
7 P) Q! C0 W+ p. S+ [6 z! Q(I faced that once :-(1 U) l5 s: R9 W3 M- U

7 a6 _9 e+ \* KUseful breakpoint to detect it:
5 O2 v; i7 f/ k# w; U, \' O( D6 P" R6 j
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'# \! w9 V2 A1 e8 D1 I" `
/ y% h$ z4 Y9 h  c& I6 ]
__________________________________________________________________________
4 c# v) c; f  I- Y/ `2 P- |. H9 t& F3 O" s  {9 j' E. u
/ ?- M% t9 l* {4 s8 W6 _/ O
Method 14 ! ~' C2 @/ `2 n4 r% }6 S
=========
$ s+ m, I( k) g0 ]- ~5 r9 Y$ i/ V6 t6 v7 z, y, T. z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! d0 p$ H7 I6 ~' g
is to determines whether a debugger is running on your system (ring0 only).
4 W+ W8 j. C9 {% k  R
8 `. ]# d- a) j4 k6 Z7 U   VMMCall Test_Debug_Installed4 c  _! O) G+ |/ E4 }# E( H
   je      not_installed% S" m; b# v& P
7 y5 `( A! K! P  P
This service just checks a flag.
" K' C7 u% Y5 d8 f4 f- }$ ~; |) c</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|鲁ICP备19052200号-1

在本版发帖
关注公众号
QQ客服返回顶部