About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) V$ i7 X; h3 V+ J0 L3 k3 ]
<TBODY>
7 W: Z; Z: P) ^! Q7 I" B<TR>
& q) @9 ^8 L3 M6 M% x( j<TD><PRE>Method 01 ; V* d: V$ ~; Y
=========
9 V  u. t- h& R' i4 r  z
: X) B' k: D* hThis method of detection of SoftICE (as well as the following one) is# r# q' o5 Q1 G, K( Z2 X0 K
used by the majority of packers/encryptors found on Internet.
( }* }# z9 T9 mIt seeks the signature of BoundsChecker in SoftICE
+ P% Z; q9 w; ]; M% s
0 t$ J# _6 a6 g0 r2 F    mov     ebp, 04243484Bh        ; 'BCHK'7 @, O/ |1 y- E! F) d: R$ w
    mov     ax, 04h
, O! v' D! X8 m. y9 M. j9 `0 B3 Y    int     3      
- v1 V0 \! G% A$ W: V: ?" A    cmp     al,4. n; t+ k) L* X- q  P0 c- S
    jnz     SoftICE_Detected
* f' r1 [% o4 e- ?& |7 z' [' \2 A- ?) w% C" g$ q5 g
___________________________________________________________________________
% f* }# L; p3 N1 h  g' v, n: i" J5 ~  P
Method 02
- I: b0 M# p' A' o=========, c) ~& Y9 x2 D
* U) v3 V4 h+ x4 d+ R
Still a method very much used (perhaps the most frequent one).  It is used/ D) R' \* ~& R0 p
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,! W, _# k6 x: P8 k* h$ `
or execute SoftICE commands...4 j6 r5 N- g* H
It is also used to crash SoftICE and to force it to execute any commands
, B; z" r0 w# ?* s(HBOOT...) :-((  ) K1 X, B( Q1 f3 O3 t4 T

+ Z+ @4 y/ Y+ b7 ?7 v/ LHere is a quick description:
: l. G" j# ?  m" T1 @( W4 f-AX = 0910h   (Display string in SIce windows)8 o5 J. E  t# o- ^% X7 F8 ^
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)4 L& [: t" ?0 ~2 r! C1 Y' D
-AX = 0912h   (Get breakpoint infos); h* R8 x: C* C
-AX = 0913h   (Set Sice breakpoints). T0 n' s8 e- Q0 d4 |0 D+ V' }
-AX = 0914h   (Remove SIce breakoints)
2 T1 ^6 R8 o0 K5 H2 u4 a3 T6 w. o6 y  h. b: ^" a, T1 Z
Each time you'll meet this trick, you'll see:% D4 u% ~8 Y7 i/ B6 ?+ q( t, O) |
-SI = 4647h
1 \0 G2 z# w5 S' W6 M( O( W/ A-DI = 4A4Dh
0 D3 D) O0 n4 j# W4 \( u! {  zWhich are the 'magic values' used by SoftIce.% ]6 H/ N1 \* c' X# {) O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.. J) ~  ?9 u4 g! R* O

  q8 Y! d- q7 x" AHere is one example from the file "Haspinst.exe" which is the dongle HASP7 {4 g+ s* Z) ~/ A4 l* W  v2 Y
Envelope utility use to protect DOS applications:
- n- C" |# }" B. T! W( K1 k  K, E$ {/ a" E+ o0 Q$ \  z

; P; C/ x- j, V7 n4 x# g4C19:0095   MOV    AX,0911  ; execute command.4 h5 {. ~; ^+ _. B
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 N# J. q$ q* l0 |! N
4C19:009A   MOV    SI,4647  ; 1st magic value." n3 `, r  ~3 ~) ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 R- x* J/ z$ E0 O/ |% s8 Z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- k, F- u& z! m6 V3 @9 }% ~% B0 q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
2 }; d3 U" F& J/ \+ a- f4C19:00A4   INC    CX
+ A+ Q% g) V* S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& t* _" p7 E" _+ O! b6 r4C19:00A8   JB     0095     ; 6 different commands.
8 q7 ^) y) r/ e9 e# C1 R4 s- ~4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  l. L: O: B$ v  w4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
! c, E5 q. W0 t" ]; i7 o& @2 o( n8 ^: J3 [
The program will execute 6 different SIce commands located at ds:dx, which
& i: O: w4 s, ]are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.# u  @. s2 K- q2 q/ a$ k7 k
  o7 H) y. \1 H' A6 M
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  C3 T: p6 n2 o; q+ R  X
___________________________________________________________________________
3 P9 q- D  Z4 t" [% j5 c7 s% P2 O) R2 S
5 o" `/ m6 a! o
Method 03
3 W8 L% Z" |- T=========
' w! w5 Q8 e+ q4 g; @+ k  n
4 \, ^' J. D* o+ ]4 {: LLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( r6 ~% ]8 ^# [: R
(API Get entry point)# p0 Z, k( G2 s% K) J
        6 [0 |( T- b1 [2 a+ L  z
" l3 F' z8 F: g" Z! t# p0 {
    xor     di,di/ R% \5 w7 X& d& G/ {2 }. g
    mov     es,di9 W1 d# }) e# J' ~; X
    mov     ax, 1684h      
; ]" F* K% x6 K- R8 }7 Z    mov     bx, 0202h       ; VxD ID of winice- q8 z; ~1 ?% G+ O" C, @- r8 G
    int     2Fh- E* |" Z9 ~, g. x3 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 _- b3 A2 H/ t7 n' p4 s3 W# R/ U
    add     ax, di
0 A" u' k5 P6 l; ~    test    ax,ax
  r; d' M" i1 x    jnz     SoftICE_Detected
  m/ U/ V$ a' L8 M
7 h4 [' W; C0 G6 Z# Q___________________________________________________________________________* g  Z: S' j/ z, Q$ Y5 C1 i+ O  r; A
! W0 X4 z; ]- \7 f
Method 047 O9 n* @$ n1 Z- D" w9 w3 X
=========- b0 _" l7 q  @( f! r6 S( O, O
  e, B$ h+ S- h" m# r+ _- O# a) F
Method identical to the preceding one except that it seeks the ID of SoftICE
. \5 h. Z  X$ `, b: _& q2 E5 YGFX VxD.- U9 C7 p+ U. k5 e. n- D( b
% S3 I' G# A0 o( Z
    xor     di,di6 X9 N! }$ W2 }* N8 ?/ G+ s+ t
    mov     es,di* U5 z$ A1 K' }. O% q
    mov     ax, 1684h      
( J" H! @# N' r2 B- V6 U* o    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 m; p, z7 ], E# K: [8 l( b, f    int     2fh" ~+ y3 G4 ?; J+ X) n
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ E: C# z' a- m3 b" ^5 z    add     ax, di
  y' U0 |8 q% d    test    ax,ax
& O: `1 d! c) e9 I1 L8 C    jnz     SoftICE_Detected+ I2 {% h, H2 d* D

: ~; u! l* X$ u3 Y( E9 s: P6 E__________________________________________________________________________, n  B5 J! H9 I6 V  i! C4 W' X
" A; b; h7 H2 a/ Y! ^) h: P
  e( f; v0 j9 o
Method 05: M- U0 n, r+ ?$ [
=========
) H: P% P1 L0 x* \1 _& |( o% J. Y; G7 J5 u" s6 w+ P
Method seeking the 'magic number' 0F386h returned (in ax) by all system5 p- }1 `  g' S7 _/ c1 j7 q& A  e, H# _
debugger. It calls the int 41h, function 4Fh.
) _7 `2 O% D5 `- _4 T, }1 Q; qThere are several alternatives.  
4 d# O3 @7 m( D  I& c0 ]
# v( ~- L3 B  Y2 s/ GThe following one is the simplest:
3 V5 u/ n* j2 z+ ^
1 }* V9 L- p: H) e6 R    mov     ax,4fh) \  t/ [. }9 M  ~% o( [6 c8 L
    int     41h
/ d7 h0 y% U: c0 C, l    cmp     ax, 0F386/ b% h; b2 m7 T# @0 @; _5 m; a1 x
    jz      SoftICE_detected
! }8 I+ g( H: X: `2 f6 ]) u
  x  I3 b5 M1 o# [; K2 i6 p8 f1 V. b- D; `
Next method as well as the following one are 2 examples from Stone's $ ~( v8 r+ x+ t2 d& b, Y" r1 Q: S
"stn-wid.zip" (www.cracking.net):
6 g8 G, m( G+ E9 v; p- o
" _6 c7 ?* F. E8 h0 l: {    mov     bx, cs, ^# O9 r& x0 H* o
    lea     dx, int41handler2$ t7 K5 S1 o  n9 o
    xchg    dx, es:[41h*4]
8 [7 ?2 C) n4 m$ X0 X% W    xchg    bx, es:[41h*4+2]
) T1 @8 R$ d+ D" J; W7 `    mov     ax,4fh  g. l8 Y- M& c4 L
    int     41h5 V9 v$ v/ w8 y- X& h, A
    xchg    dx, es:[41h*4]
+ O9 ?/ z  G4 W+ A$ Q- L% o& l- n- l    xchg    bx, es:[41h*4+2]
9 j& V) S8 N: O# y: |6 `& o    cmp     ax, 0f386h
8 T( J/ y, E; t* [    jz      SoftICE_detected
2 U' R- V; T+ J9 J8 Q7 J3 {% ^% ?9 S' O
int41handler2 PROC: [$ P( k+ l8 ?; V8 G' T5 `
    iret
2 t+ Y# w% `6 Y/ H% K4 yint41handler2 ENDP
$ w5 t% E, ^1 |5 U9 [% C; K* y2 _! _, e, E. u

& Y. t2 }/ F  M2 h/ ?/ G/ {_________________________________________________________________________- ?! t0 B  G' P3 S# H3 K" R; P6 u/ l; z
0 g6 F- R& i: E8 }# c0 M$ x% C8 Z" I
0 ~( \, Z9 ]4 O& ]6 L- M
Method 06
6 K8 H% d8 i2 K0 V. \* X- Q=========. e3 `$ h# T# \5 @
; X% \7 q7 V! B$ q: d1 O. W+ B

- V8 ^9 }. i% E, P2nd method similar to the preceding one but more difficult to detect:
, c! s* [5 E; M: G
1 b: [& I$ ?2 o( b1 d; L7 {% w( }: U1 ^$ G
int41handler PROC! Y# b$ Y; C; v8 v+ r+ u5 R7 g
    mov     cl,al
: x6 ~, ~  l% i3 _  C    iret  }: L7 a) D: m. k
int41handler ENDP- r* V2 `. ?/ e

: D& P( T+ w/ t# ]: S5 Y$ H  u, @- G6 G; t1 ?' ^4 A) q9 i0 y
    xor     ax,ax3 f: a7 q' Z5 l, o
    mov     es,ax8 P6 r0 L3 r" ]( q
    mov     bx, cs0 X1 o# _) b# J0 |5 c/ Y# a# q
    lea     dx, int41handler
" Z5 Q* E- w1 y3 Q    xchg    dx, es:[41h*4]4 U, z' y0 A! r% L: p. j
    xchg    bx, es:[41h*4+2]
6 _' }7 u2 X/ c7 k    in      al, 40h
9 G+ p. N1 p( l8 `    xor     cx,cx$ Q* _1 l& g2 F: E3 J7 W, ~# a- @
    int     41h
# c$ W4 N7 ~: H6 b    xchg    dx, es:[41h*4]
. [. W1 `. F( `* J! Q    xchg    bx, es:[41h*4+2]
: D8 [  a$ i2 n0 d& d! G3 X    cmp     cl,al. w. e. d1 `5 H; K; E6 c& _
    jnz     SoftICE_detected$ E9 p5 E7 B/ u/ `4 Q
( J: s; X* c/ ]; ~& C7 Z2 p
_________________________________________________________________________
/ F: ?6 y0 d' m1 |. i3 o4 k, ]
2 k" d2 Q0 Y& h' J4 T. o7 wMethod 07
+ R; o8 m0 W" b" F* i" W: p=========5 e2 Z! ?7 r2 k$ ^

1 B8 ]' Q+ V5 U$ _/ }Method of detection of the WinICE handler in the int68h (V86)
8 P7 c* b- I; i3 E) Y7 a4 _
& y0 B( D( v8 q. @0 J( W    mov     ah,43h
% }2 w1 r, I* f" G: U' r    int     68h- v' g2 ~# h* }8 I8 @* C+ I
    cmp     ax,0F386h: A; X" V7 c# e0 j# H) e  v1 S% r
    jz      SoftICE_Detected3 Z% m$ q; o% V+ l. ^; P
; D0 L/ s, T8 Q+ M* V
. y- G% U2 ]! J+ {$ U
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 c% }$ e) c+ l3 \8 s2 ]" [
   app like this:
! U# ?( N: B" z8 Z- _
& d2 r3 r' T0 V   BPX exec_int if ax==684 s+ q* c+ ^0 v: v9 n
   (function called is located at byte ptr [ebp+1Dh] and client eip is- F) S7 \3 m5 c: F+ d+ k  j
   located at [ebp+48h] for 32Bit apps)# p/ I6 P4 o. L- m: i% `
__________________________________________________________________________8 S% X3 T1 D1 N% z( _

- k/ M" n; _# O+ X' i
  d8 ?& [0 e9 U/ F9 a) x3 O- TMethod 08
7 E  _# ], v+ Y+ B3 d9 {/ {, K=========
0 S8 X/ G: i( n# X: d7 a0 _9 R* ~( g1 W2 s6 \
It is not a method of detection of SoftICE but a possibility to crash the* K5 k0 j3 I$ q8 X; N+ f
system by intercepting int 01h and int 03h and redirecting them to another
8 Q: A1 p" _2 t; A; v+ ?, `routine.
$ U  }5 o# _; J1 c' I# Y/ I  T9 R. nIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 d9 v/ T; P2 m6 k# d9 G4 W
to the new routine to execute (hangs computer...)
! a- ?/ d1 {+ ]- ]7 S# d- x' o
. w5 n( k! k7 ^, S- N    mov     ah, 25h% U$ R5 h* p7 n  _
    mov     al, Int_Number (01h or 03h)
! t/ ]% A* u& D. b    mov     dx, offset New_Int_Routine
+ x- ~& {; l4 g, @! B+ N$ }' Q    int     21h
1 c2 T2 N" O3 J- g( ^8 z$ W% m' `7 y( f2 L2 }1 ]7 m8 q  I5 {
__________________________________________________________________________6 W3 x( F3 U1 W( \! U+ R+ m
( @3 j  ]: K; D0 K8 M
Method 09/ t2 f8 s3 w# ?3 y: l  X  F/ e; L
=========
0 k& e# r9 u, [/ k2 p
- x! f; D6 y$ }2 B' ~6 vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* R9 F1 p# K- m+ k5 f6 _
performed in ring0 (VxD or a ring3 app using the VxdCall)., V: w  T6 V3 u: W; z! u; a
The Get_DDB service is used to determine whether or not a VxD is installed" ~1 }/ |3 t: x: H
for the specified device and returns a Device Description Block (in ecx) for# V: f! h" F+ U/ [( j) B2 R7 W( P
that device if it is installed./ l" g8 t% i" A4 }) c2 s! Q

' Z! w  X/ D6 c9 m( _   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ v( x/ S- _- b+ ~  x/ ^
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  C; l6 S9 }3 @7 a  [& @! T- e   VMMCall Get_DDB( s9 c9 x1 P8 a8 n* B
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. ?7 I/ E7 U9 a, Q/ _3 e- `# r+ Y# x
0 w  S+ U4 m- |5 }0 s5 a. oNote as well that you can easily detect this method with SoftICE:
7 b% l9 U5 y8 x1 H1 X7 O   bpx Get_DDB if ax==0202 || ax==7a5fh
( ]& Z. I7 t+ {) A8 B
9 c" b5 c7 e% z5 Z/ I4 a__________________________________________________________________________
9 g1 f$ ~$ K1 ]' Z- v/ e! Y
  Z( T4 I3 m7 T. X9 ?Method 10
; r/ O/ n* i; w* p=========
! N/ y4 h( T: X$ \' C
  U! b& a: p9 o# b# k, Q=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ J* C% f4 T& \6 k1 D/ I) l  SoftICE while the option is enable!!
/ z6 q( ]+ g; p$ n/ Q' u
5 B; w; M2 T, k; G- wThis trick is very efficient:
) d- Y/ d0 Y- ]& Vby checking the Debug Registers, you can detect if SoftICE is loaded
* v6 |* V6 p9 t- R5 Z* X; `, z(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if: z" h) G" I4 J: a* h/ Q# o
there are some memory breakpoints set (dr0 to dr3) simply by reading their
+ _+ D  q2 Q  ]7 m5 _+ Bvalue (in ring0 only). Values can be manipulated and or changed as well8 j. @8 w( |' `, Q6 Q
(clearing BPMs for instance)
. r  W, [+ e8 S
/ M5 L. g+ @, r8 O4 [# O__________________________________________________________________________
. ^( w2 Y: ^, b2 }  O- R
0 C5 S, G) ^) r* _Method 11
8 w0 w0 m# Q! C5 R5 y& r=========
6 [# t; J7 R( D
( o+ c. j6 ?$ T: bThis method is most known as 'MeltICE' because it has been freely distributed
" V2 T1 k2 d. r$ L; Ovia www.winfiles.com. However it was first used by NuMega people to allow
7 }6 g' R" c; M6 KSymbol Loader to check if SoftICE was active or not (the code is located0 J1 U/ ^' \% N( ?0 o5 Q4 v
inside nmtrans.dll).
7 y3 Z" v0 C. R% Z& k- W. Y; p9 Q3 T! e+ G
The way it works is very simple:
6 W" p. ^# |5 r) W& [, O3 e$ t( U& wIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
9 @; N; g& b4 b/ z7 gWinNT) with the CreateFileA API.
8 _6 {4 H+ h4 [3 R/ |0 w! h# ?( S0 l, |. v4 o
Here is a sample (checking for 'SICE'):
) N7 }" ?. _! D+ L- \8 l9 m- m; ^3 i- i! r
BOOL IsSoftIce95Loaded()( n5 k3 z! x( v: `9 g9 ^; b
{
1 \) e+ w9 H9 F% r) c1 U% c2 l" ~   HANDLE hFile;  
0 K3 o) x7 B6 [% e8 H   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,5 |+ h5 D! |: O" N) Z- O% A
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 ?3 x7 w# [  _2 m' F" z6 E                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 U, o) M0 R: c5 @& \# J7 b   if( hFile != INVALID_HANDLE_VALUE )
- r, u) f: ^( H" w! S& q1 w   {3 R4 C" u4 a& R; k& ^
      CloseHandle(hFile);
$ G# S& Z  c: O9 b& |9 K1 v) o      return TRUE;
* m! t1 @4 s+ V( @$ G5 Q% A   }4 X4 g+ c6 N% H4 Q, o& K
   return FALSE;
+ ^6 j5 O6 i) X/ L}
6 S3 P8 m, \! l: j2 Q- Y- V% f( t
Although this trick calls the CreateFileA function, don't even expect to be
! G2 E! Q7 a9 `able to intercept it by installing a IFS hook: it will not work, no way!
, e% z9 x, ^  j1 D/ v, q& b' zIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
$ T% I' _% T9 n2 _- pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 ^% Q( ^' D, q* m, _" v8 \! e( v
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
* O* o' y1 ], c: Y- dfield.  r5 k( `$ s! _& ~- |
In fact, its purpose is not to load/unload VxDs but only to send a
- {7 m6 `3 ]: v- i9 ~' NW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 v, t) k4 e, u  J; _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try" J1 I% J; L9 b
to load/unload a non-dynamically loadable driver such as SoftICE ;-).6 Z4 M0 C+ |6 ]
If the VxD is loaded, it will always clear eax and the Carry flag to allow
+ Y) I! K* n7 j. M! }- ?# I+ Nits handle to be opened and then, will be detected.6 G4 ~& O& |( q- F$ A
You can check that simply by hooking Winice.exe control proc entry point( Y/ Z% [" }+ s' f4 t- y
while running MeltICE.) u5 X' b5 V7 ~/ L1 Z" e

8 w1 C3 H+ Z5 U9 L4 ^
+ U# n( b2 ?0 V; e4 s) Z$ y  00401067:  push      00402025    ; \\.\SICE) H6 r. H- C& b
  0040106C:  call      CreateFileA
1 d" l  T. y& j) T3 R4 {  00401071:  cmp       eax,-001
* t/ R. J/ p) K3 C  00401074:  je        00401091( [& r8 P+ k; X; v3 P% ~0 y" m2 e8 Y
+ ^! X* o6 U+ ^0 B
+ G$ l  y+ x  R3 c! Q  Q0 X5 h: ?
There could be hundreds of BPX you could use to detect this trick.+ N+ p. @( e6 x; K7 h& c  q, F/ H
-The most classical one is:
# x1 X+ `* l/ R" ]( S9 j( \8 D  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 B( _- d- e( L6 |- r    *(esp-&gt;4+4)=='NTIC'* B% B5 m8 f# A2 g' U
+ W- t! \; D: ?) b  S) R' Y! H% m
-The most exotic ones (could be very slooooow :-(' y% {* P. P: Z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 G! F9 s1 \$ R" R4 f- N4 k     ;will break 3 times :-(! ~' a, F4 {; ^% d- t) G
" _" e1 @2 J& l9 D5 H- R
-or (a bit) faster:
! {6 [* [% j+ N6 m+ ]$ \% z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ [% L2 P' @3 ?5 \5 `
- P: d. h6 G( q   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  6 M6 T" [! O( Q! U- c4 q+ R. J$ @
     ;will break 3 times :-(
: e4 {9 p, M' R9 a* m& q0 e6 M5 _
. W% _, P, W$ |# x" g-Much faster:! c6 ^$ D- D8 o
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% Z2 M& ]2 [" {1 u' @* D7 c6 G5 j; A& q7 p0 z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen- _* w% N1 a# T" M7 Q
function to do the same job:% o$ l# u/ h( Q5 }7 }1 J7 ^! X

" G$ r9 v: T# p) E4 R6 t1 m) [   push    00                        ; OF_READ0 Y5 J" F2 m6 z+ k
   mov     eax,[00656634]            ; '\\.\SICE',0
, v! C& i+ X, p, u( M   push    eax0 O# v6 L9 ]9 J# f
   call    KERNEL32!_lopen
, ~" O; }' q6 q4 k- Z   inc     eax
+ Z- f4 {9 R2 i  I( j   jnz     00650589                  ; detected6 m- w0 C- H, v
   push    00                        ; OF_READ2 G/ P$ z6 ?- |. n3 K
   mov     eax,[00656638]            ; '\\.\SICE'6 u( s! f/ r" I6 A. @
   push    eax5 R+ Y, W% [8 r& @. b" y7 {' j' f- W- T5 z
   call    KERNEL32!_lopen
+ U* W: m5 P7 l) ]2 E   inc     eax8 A& a! x9 @4 `+ \+ k) N5 i' R( d
   jz      006505ae                  ; not detected
0 d2 Z+ v( x/ m% N- F7 v$ Z0 l+ T; {2 }3 B9 }( H; T
* c) e# m* s$ g3 f" X3 ?
__________________________________________________________________________
0 r+ m' P2 y) d" Q) @: Q7 S  Q6 H  Y0 }6 r/ T% X0 _3 c3 q
Method 129 {  e" L6 U" ?' A: d3 f
=========9 @/ S9 t# v) s) D! z6 x
2 @8 V* X& o6 i( `& |
This trick is similar to int41h/4fh Debugger installation check (code 05, @% [# C6 t1 i$ D1 m
&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 M1 S4 @6 K* Q2 p" y1 R; O* K& g
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
' J/ @" U4 C! x$ D. R' C6 W3 n9 H" {# n
   push  0000004fh         ; function 4fh
' i% T7 i6 o5 R3 \$ ?# @   push  002a002ah         ; high word specifies which VxD (VWIN32)
& e2 ~5 h# _  L* G: E4 R2 F  X                           ; low word specifies which service
' ~: a# r1 P) B" R' Z4 b                             (VWIN32_Int41Dispatch)
; B1 v+ Q4 U+ Z9 M2 ]: Q   call  Kernel32!ORD_001  ; VxdCall; z9 S, ^/ ]; T1 ]; g/ c: ?
   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 A" v* J. W9 a0 O   jz    SoftICE_detected
  c6 X1 b) [& I' S7 }8 H) [" D$ \6 s$ c. P0 N# d5 X
Here again, several ways to detect it:% i+ N/ s2 e/ H& |: P
+ }# H- u% f: _
    BPINT 41 if ax==4f1 o" [- y- g+ [6 o1 P8 v

  p) v% x0 P( z+ p( V7 l$ h    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
. Z$ s2 l  f' |; Z; C% ?
5 p1 V" m2 n- @) X2 o    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A6 \, m* _0 T3 U7 h+ }' X! m
3 ^8 a; Q7 e/ d, E( n
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 }8 I* l* g/ L) }2 @3 f3 d/ ^+ w% G: @3 o3 \  n
__________________________________________________________________________
3 @- [% C. t/ Y3 o- O
$ V2 U1 _  ]! d; TMethod 134 Q1 j3 X9 \6 Q3 G, ~4 H  G
=========
0 K8 z  A1 c& C% ?( m- E; C+ x3 n& U' u+ \
Not a real method of detection, but a good way to know if SoftICE is
- W7 _2 @. O0 l- V7 {: t) w) A" I. [installed on a computer and to locate its installation directory.
. U$ r. `2 J2 l7 Q3 A# {" tIt is used by few softs which access the following registry keys (usually #2) :
# E  [, [7 \, n
2 W( w# p: g* {5 v* N& P7 x: Y-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) ~+ u* ?4 ~+ t( {: _: e) Z9 u\Uninstall\SoftICE
" g3 i7 a( U! [% F0 a, C; }: S-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! Z+ A' I$ p* E: K: E$ k-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 v) u6 V. M2 t# r
\App Paths\Loader32.Exe5 \; ~0 a6 I) c& M& E' K! R
  K& q0 [5 z" V' p! V2 \

4 J/ f( Z7 \, T; CNote that some nasty apps could then erase all files from SoftICE directory
6 W$ {( g5 Z4 p(I faced that once :-(8 M; [# W* A3 x/ P/ b& U
- S* S' B& \. R8 _# R6 C) p
Useful breakpoint to detect it:
# H) F  R: K& ~) W$ M( V) n
6 u& f: _9 ?, Z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; d) b$ ?( p" y  K% s* W. M

. A; P- r! C9 b! a, a__________________________________________________________________________6 ^6 i9 r! q/ t
- c1 W( e# I8 X. s& l
5 U$ L) b& r6 S& J  f& i
Method 14 9 o- P0 v; I6 O. ~0 u. }, X
=========
' h& b  S: O4 Q* ^( ^7 c" T% A. A4 o, y! D  Q8 R2 V
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) p7 U8 l, c8 w# j2 g+ r  H* s
is to determines whether a debugger is running on your system (ring0 only).
+ p7 V- r# E( t! @' d
5 t% S! }6 X" m: O0 {3 g   VMMCall Test_Debug_Installed
8 G8 W( C$ [! L9 }2 F   je      not_installed
  V0 O- G! k% m! ^/ ^5 k) t- X9 f+ Y2 @  g' _& s" r
This service just checks a flag.0 ?% d5 `5 B) Q& h$ M( J/ d1 |! C% D
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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