About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  Z6 d6 e) H  T! p* D4 N<TBODY>
5 T/ R! P. W7 W# [* G2 c+ l) ]<TR>
+ w3 U& w! A" ^  G& t<TD><PRE>Method 01 0 a, |6 A' Z& S% d  |
=========  ^5 A0 V2 e; x9 S; f* v  S
/ |0 g+ b! n8 D# O5 D# T* `
This method of detection of SoftICE (as well as the following one) is
2 H# v5 R- _7 v$ H& Q- \  Hused by the majority of packers/encryptors found on Internet.
( s  n0 w& o; g3 g1 F2 h5 |# jIt seeks the signature of BoundsChecker in SoftICE6 B7 ]. D( t& H- x
& ?+ y  ~* T) o1 V# j4 s3 W
    mov     ebp, 04243484Bh        ; 'BCHK'" ^! w6 X& u. R
    mov     ax, 04h( u* M6 o$ i% f: T5 }
    int     3      
9 b6 k: D0 y% w0 E/ G7 g4 t    cmp     al,4
( F# f' J' C# Y4 @0 w    jnz     SoftICE_Detected0 h4 [7 c! `# q9 [( {( ?/ r
- t; Q& q! s3 ?& y
___________________________________________________________________________
4 y$ c2 I% m, [9 N& {, l  \% }) b- n& I
. a5 T( ?2 S" P/ |& cMethod 02
; t3 h* u3 C& T7 h3 E* N=========
' {' q0 Z4 v, f
5 V0 p  U% {5 g" f5 Q- nStill a method very much used (perhaps the most frequent one).  It is used3 {, w2 F( l( h7 ^
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 t1 O+ L2 Y$ M2 h' @+ por execute SoftICE commands...
6 x2 P7 T; l$ n( B; }0 z1 |It is also used to crash SoftICE and to force it to execute any commands8 F6 G% _  n) E3 R9 U6 Z9 a
(HBOOT...) :-((  - Q* |3 [' l  y2 H# c' P

( @, o' L# P* G5 D5 KHere is a quick description:$ S3 W, n  @1 d; L$ _/ p* ^* a
-AX = 0910h   (Display string in SIce windows)
4 i' K" d2 d4 r$ N8 P" B# \-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 B0 P& O8 j2 j2 w# v
-AX = 0912h   (Get breakpoint infos)
. Z4 Q# `# N4 P+ X" Z; w-AX = 0913h   (Set Sice breakpoints)
$ g. s" ?2 w7 _8 C8 e-AX = 0914h   (Remove SIce breakoints), R+ @6 ^& |8 [4 |7 Z' ^" e3 E5 B4 K5 ~
& s1 j9 u# ]* |. Y# Y/ K  p
Each time you'll meet this trick, you'll see:% c5 i* E0 ]/ ^' W: L
-SI = 4647h
8 r1 ~- i7 H  x6 O-DI = 4A4Dh% t' Z8 ?  ?0 z/ b9 @
Which are the 'magic values' used by SoftIce.
# E. u3 i& m( b) u9 C7 YFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.) K% N/ v- B  H: O  ]- `

. t! O1 t+ C5 S1 c4 @Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 J: U0 A% u. u1 _9 q# P! jEnvelope utility use to protect DOS applications:
+ q( t4 a5 n& K- k" d
/ z$ q3 G/ O: `4 l
" Z/ \2 b  I# u5 L; e" U. Q" [% t# V, F4C19:0095   MOV    AX,0911  ; execute command.1 C- [. }. B8 ?/ O8 U, G
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: E" u6 k+ v3 U7 P9 H2 u( j1 {4C19:009A   MOV    SI,4647  ; 1st magic value.+ y+ u' ~- F' J2 f# e7 }/ X
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; U  W5 V* [$ e, F/ C+ V4 c( h4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* z# Q+ o6 e' Y9 z7 b
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 u4 ~2 q* O' ~& i9 ^4C19:00A4   INC    CX
3 Q- u" O) k8 o5 E8 f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 t8 V/ F3 N: R7 R$ I5 h: b4C19:00A8   JB     0095     ; 6 different commands.
5 ], m3 j" f' F2 x9 `# \/ F! [! L4C19:00AA   JMP    0002     ; Bad_Guy jmp back./ B9 c, i- j8 f9 T5 Y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! V$ _. R4 ~) p( x4 ]! V% g
: I% y+ ?6 x/ L4 p$ \
The program will execute 6 different SIce commands located at ds:dx, which
. g7 K5 d1 C5 Zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 @8 M+ [  ?8 R6 u. y/ h. |
0 X) }6 q9 P  l3 x3 p7 ]' e* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ D5 a" r( |4 r6 K2 @; K! j___________________________________________________________________________  E. @; F3 }8 p/ \' _, P9 ], H( u
$ {# _$ a2 ~" N9 ~
6 U+ L' _$ p# w- D
Method 03$ K( S9 ?9 Q9 w; ~! j0 _- p
=========
# S4 X. W1 H1 `# m; K( }6 {" n2 W! H" }# z- q
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 s9 Z% A3 ?0 H' g$ s3 Y: K# j(API Get entry point)& y6 c0 U% `, D4 V6 Q
        8 I5 j. m" g1 r( t6 F

; R* L, _6 f  X. K9 m' E    xor     di,di
. P) u2 a2 r- I2 \  f. d    mov     es,di
1 H% ?  p1 f0 W" r: d7 p    mov     ax, 1684h      
+ z# v. E0 S+ N7 a+ E/ z* G) K    mov     bx, 0202h       ; VxD ID of winice
6 j; C. d% D2 G    int     2Fh; E- e" R! S: ]9 x+ B' W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! c/ D$ ?1 A" I- P    add     ax, di/ v8 [3 d9 y3 y& _* X$ K$ d
    test    ax,ax7 p( v( T; L  G$ [9 V
    jnz     SoftICE_Detected4 w: `5 y9 ]- ~8 O; _
. A4 i, D" `# b9 R5 |
___________________________________________________________________________* |! c% e! Y! {- n2 y

6 e( o4 G/ Y; YMethod 04
' K/ G' N6 \- R=========5 u3 n, L$ p. Y. w  }/ j6 s
0 A# [& s9 D+ f
Method identical to the preceding one except that it seeks the ID of SoftICE
: |, ^) o- \# TGFX VxD.$ p5 \: m: p& ?5 r: B5 e- q5 k

4 A8 \2 e" R6 f2 D. t    xor     di,di
+ n1 H1 L% V, i    mov     es,di
' j- b9 p& f$ A" I    mov     ax, 1684h      
% M8 a6 N3 c/ C% \5 \" z3 Q/ T& h    mov     bx, 7a5Fh       ; VxD ID of SIWVID  d* P' {4 c2 Q  ?/ B* ?  `. r/ O& ?  M
    int     2fh+ P+ G7 l- s: ]% Z  e0 G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 X# K4 c+ j% T0 B7 Y    add     ax, di% u9 x; i- H- B: Q7 N5 Q% c2 Y
    test    ax,ax
+ w6 N5 Z/ M) w% h- o    jnz     SoftICE_Detected% m  c, c" ^2 w
1 i0 Q) W3 g3 q+ x/ s
__________________________________________________________________________
8 s: x% C/ R0 {1 j& o! u# F
1 m$ g0 A: _+ E$ ?2 l
( A' s/ x4 [& [& ^- _2 eMethod 05
  Q$ E9 n% u; ^2 v=========  o( C. s+ O: `1 q( w5 }3 B
8 p# V8 ~; v" h! `; E6 J1 B# F
Method seeking the 'magic number' 0F386h returned (in ax) by all system; s' F! O* x' N* x; B. p! g
debugger. It calls the int 41h, function 4Fh.8 x( N' E6 k$ c2 X# U( @. O
There are several alternatives.  
3 ~& J% m/ u" }5 c! c7 F8 P% F% q. I, y
The following one is the simplest:
& T1 v. |/ _6 h! L# C% V
0 \( Z; }0 m1 G9 L" j% ^' t    mov     ax,4fh
0 D; k4 x' I/ X7 ]* ~1 \5 t) F    int     41h
8 J) T5 K% x& r5 Q; B0 A4 ]    cmp     ax, 0F3866 \+ {* c& m7 q3 p/ D2 @2 N
    jz      SoftICE_detected
+ W' [6 ^$ O4 u. a  z( o
; X- M  j% i5 P3 E6 G& E. b# N$ u- K) V
Next method as well as the following one are 2 examples from Stone's 1 u1 i1 z2 @+ q" c
"stn-wid.zip" (www.cracking.net):% Q. S' F) {! T1 i
* j% F/ ?+ H$ z; G' F& w
    mov     bx, cs
) O$ U" S# y8 ^& d6 i' w    lea     dx, int41handler2
* C1 S" h  M5 u' ?% ^/ \" j5 n    xchg    dx, es:[41h*4]) [' L. R0 E* Q  [/ B
    xchg    bx, es:[41h*4+2]. U: S1 I" B5 f. h  m' V
    mov     ax,4fh& M6 h; L* \2 g5 [6 i! l
    int     41h4 \0 l  J! V( v9 H. m- H) t
    xchg    dx, es:[41h*4]
3 l6 q4 f$ {6 I- z9 }    xchg    bx, es:[41h*4+2]
. a0 t1 w* Q2 D# E- g    cmp     ax, 0f386h$ @( n$ C9 p) X9 \& b8 U# D  q9 U
    jz      SoftICE_detected
8 q% D8 a( c: t5 ^
/ J. X  h2 v0 r  J% q- \* Wint41handler2 PROC
4 H- \4 u0 \3 T' I$ V, `  x. ~' y    iret
: m* _+ @( O' U' N. P5 z' yint41handler2 ENDP
: d  v, F6 `8 s- r2 U: f2 ]: e: W

; C1 j6 H% E! t" j2 E7 ^_________________________________________________________________________
  z7 m# F9 i% M
& O2 r! c: z/ n5 |4 l  U7 e+ m0 ^4 D2 t9 M& h
Method 06, P+ F3 c+ U- Q. r3 q
=========% ?1 P7 g9 Y6 M! t; {# z

8 Z" o9 A3 N7 s6 y4 t
, S, B( \) Y7 v2nd method similar to the preceding one but more difficult to detect:
5 `5 i; o- z6 Y' A8 @
2 _+ a3 l  D2 {. `5 q
& I5 R- q  _$ H! ]$ n$ yint41handler PROC; @2 J2 }) x8 p
    mov     cl,al- X% h* }1 I& U0 ^5 B2 L8 Z. X
    iret
) T8 N3 J, B* Jint41handler ENDP
6 ]$ j' ~$ h( y6 X: e5 U# X* v( S' g" @) _  q. z5 M

1 P( Y0 e$ Y* f+ g* N    xor     ax,ax
) U6 t2 ?; l+ \    mov     es,ax
1 g8 L( s- z( [0 U) X    mov     bx, cs
$ V4 R/ ^  g4 t6 x    lea     dx, int41handler
: |7 |2 Q9 D* `* n    xchg    dx, es:[41h*4]
# }( Z' O5 {5 Z" c7 m. U- |; @" Q    xchg    bx, es:[41h*4+2]
3 a" a- k* m) c% R9 D, G- i6 A6 a    in      al, 40h8 q) k+ q& {$ X& b, D' \) m5 D# Y( ?
    xor     cx,cx
  A+ G" C, M) V* Q    int     41h
2 v" e) H: L- p' Z# E) Z4 i    xchg    dx, es:[41h*4]$ k# E- P1 z# F# [) p
    xchg    bx, es:[41h*4+2]
# V8 P5 \1 J: M4 m& ~0 q6 ^, ~- H    cmp     cl,al  ~  v' J# ?% h+ D- m" J( c
    jnz     SoftICE_detected
4 z' a3 ^5 H. P4 Q( w/ B) L: S7 G+ q2 F9 Z; c# o' |
_________________________________________________________________________
. m4 u* ~4 h! _9 Z9 P( ~/ j* O4 J& E, c4 O4 x
Method 07
3 K* E* r, R7 ~( D" o; t=========& M* N5 z, \- t& g- A( X1 x* |
8 F9 G* l4 g( h9 }
Method of detection of the WinICE handler in the int68h (V86)
) c. W) j+ u' j# j+ j- _" u
! F7 ]. k. `6 |6 \4 V% R' F    mov     ah,43h2 v& E$ o- A8 z5 {) }8 _( a: t- h
    int     68h
; u) H% Y' v( q' b% m* Y    cmp     ax,0F386h0 U( d8 O' e' [0 v+ g& I
    jz      SoftICE_Detected, s" H. A# [& e' [/ Q7 U% i
+ n' p# u5 I, y- F0 V$ t, E/ v
7 b0 S8 n% k% _; N/ Y
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. d* ?, z/ ]( d: Y) e) Q* e   app like this:
& W2 p9 y7 B7 v, l7 G" X. k0 p1 a7 k6 o6 j( o5 n2 |' s
   BPX exec_int if ax==689 }- l3 p# b- ^& U# b! V
   (function called is located at byte ptr [ebp+1Dh] and client eip is' z: K: F& K) X/ d& j7 y6 p7 S
   located at [ebp+48h] for 32Bit apps)
9 R  f, n. a  e$ }6 A1 g__________________________________________________________________________
! k+ T/ ]9 ~/ V" I0 |- y! F/ b! W: R
& o& Y. Q5 e% ~6 A  w" j
8 @' ^1 l; s$ d* LMethod 08
! T2 G2 D7 n1 T5 r/ N4 r* O=========$ E( ~: t3 w! G
1 X& a' x# _% m9 o: a$ q1 P
It is not a method of detection of SoftICE but a possibility to crash the
8 s: }" S. p" }9 m1 P* }8 Usystem by intercepting int 01h and int 03h and redirecting them to another
% u2 {2 n* p" r; o2 y1 proutine.
$ K) [4 i: H9 LIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, u5 \3 x# I2 b/ W, `to the new routine to execute (hangs computer...)
, G' v) J4 ]" [2 @; r  G5 y# u" z; B4 l' j6 f6 j
    mov     ah, 25h% ]2 |9 g' D5 K- [# a& ^
    mov     al, Int_Number (01h or 03h)
6 l# g0 Q' f; p- D* r    mov     dx, offset New_Int_Routine! i, s2 I* R8 l$ Y
    int     21h! {/ G! y% d/ K$ v" r1 V
$ Y0 U5 I+ G/ x' @0 _# @  `
__________________________________________________________________________( s5 U8 \. ?/ q2 m) @7 q# X

: a" T( t7 _+ S0 f! [* H" E/ q5 `! K) {# @Method 09
3 _, R' I( A+ B) U=========
* i$ a% f# a. [% D+ O
9 E9 Z# w" P1 S& q' v2 |9 m& e# h9 tThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 H, C7 r' k9 v' a# _& u% t' m, @performed in ring0 (VxD or a ring3 app using the VxdCall).
  v! X. j% j, z1 B5 k& p: i( HThe Get_DDB service is used to determine whether or not a VxD is installed5 q6 `5 Q( B9 @5 G9 x
for the specified device and returns a Device Description Block (in ecx) for. r  V' j; S6 K0 l
that device if it is installed.
; l8 h8 A& }8 n, a! B! E  x2 }5 W
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 ?# E' X) O) l   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 @/ R! i1 {4 K
   VMMCall Get_DDB
/ y7 A4 ^4 p- k; J) F, F% r   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& b$ a, q' U( R8 d6 C4 J! X' y" w2 S4 P6 D+ R
Note as well that you can easily detect this method with SoftICE:- t. H9 d/ I2 k
   bpx Get_DDB if ax==0202 || ax==7a5fh- P7 T! E% V8 d& ^, O" ]0 K4 f1 J

! J4 O. D' N5 r7 _9 Y# S; G5 ^: \__________________________________________________________________________
" W7 x( R! }& `+ v  @1 J1 D2 C8 F6 E5 Y/ y
Method 10: R. ~, l* F9 w5 n1 z
=========) E# {- Q& O" G
% T  t. x  Y, s' j6 q9 t2 `: A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" b) A! T; C& d  SoftICE while the option is enable!!
5 r8 Q5 G; v$ H: c0 q- Y5 j% q
9 b' w5 f; P8 @$ ]This trick is very efficient:
1 n, Q  v& _8 a! Nby checking the Debug Registers, you can detect if SoftICE is loaded
  D% O; Y- n8 ]% w/ }8 w! O* d(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! J9 R4 l, Z4 s, @" k
there are some memory breakpoints set (dr0 to dr3) simply by reading their9 i% i9 h: |2 Q" t2 N
value (in ring0 only). Values can be manipulated and or changed as well" M$ P0 @, k1 M; S4 O! P
(clearing BPMs for instance)  `' i9 f4 k: A' }. ]
3 }# p8 W- ]: k. w. U/ D, f+ y
__________________________________________________________________________
" L& u7 X. E* z4 S- \4 t3 t  I5 a7 I( b, g
Method 113 i1 u( Y5 f5 Q# c5 Y
=========; z: x, F3 g$ L: _% U" Y5 ?

7 n: p: L7 C3 v# N( qThis method is most known as 'MeltICE' because it has been freely distributed
/ f* H9 {. K& U2 Q% }: zvia www.winfiles.com. However it was first used by NuMega people to allow# ?" @; c8 z% g2 k* J
Symbol Loader to check if SoftICE was active or not (the code is located
  L0 _  ~# r' F, N- V$ \. iinside nmtrans.dll).
) z. D3 U* }+ ~: `* _8 c% N1 m2 `" `, a3 D# P9 Y$ T! H  E
The way it works is very simple:
* Q; g3 e) B2 o* X# l% ~) n" W5 NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% a" E+ a2 C9 XWinNT) with the CreateFileA API.
2 X( f7 x0 n1 g; |- ?0 x  U
( R" ^! P, [- gHere is a sample (checking for 'SICE'):" H7 B* ~$ r+ _+ j1 G" R* S$ i$ y

; D0 o0 @- C& f- W4 J# ]; nBOOL IsSoftIce95Loaded()
, ?, b( {! s: t7 }( l! q$ F{0 u% }0 s5 J7 a% n- V* w: e! n
   HANDLE hFile;  ; A! m$ |" z; l; x
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* W% s8 [) ^: c% j5 R6 u; X+ o7 i9 _
                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 ]+ T: j+ U& ^% t4 I5 F
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 L0 u3 x9 ~: P8 j; z4 ?7 o; `
   if( hFile != INVALID_HANDLE_VALUE ), V* m5 u' y6 s% D! I! \
   {5 z* V" L/ o3 O5 Q' w4 t
      CloseHandle(hFile);: x4 S# j+ u& c% G
      return TRUE;% V! S: Z0 s1 z# D5 W$ [
   }3 c+ w( ]  A5 M
   return FALSE;
0 A* |) b8 ]8 y) z7 \' ]7 ]}
- \1 w$ T8 _2 m$ z+ Z' j
' v! H! p2 O5 H7 ?Although this trick calls the CreateFileA function, don't even expect to be
+ Q# G* W% p% X$ G# p2 G5 bable to intercept it by installing a IFS hook: it will not work, no way!# K7 R. k1 S1 @. c0 T8 }! k' M
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 m, ~- B  `/ z: ~service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ v6 D- ~1 _/ \$ j! l9 I/ sand then browse the DDB list until it find the VxD and its DDB_Control_Proc9 h2 }% p1 F  B# ]1 r+ G+ u  }' I
field.! M" i+ R! J* _. v0 x! ?7 e1 e6 G. x; E
In fact, its purpose is not to load/unload VxDs but only to send a
/ t% S# [0 y) p6 K9 iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( D; p) [3 r+ t% x; H; ^
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' Q0 X4 }+ z) k
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
* ~1 G; S0 D- C/ d: ZIf the VxD is loaded, it will always clear eax and the Carry flag to allow. `3 }& l% \5 W9 h7 L7 N9 W
its handle to be opened and then, will be detected.- M" z& Z2 ^; N: F% p
You can check that simply by hooking Winice.exe control proc entry point8 Z9 r& Z2 _$ p. u" S2 B
while running MeltICE., z  o% U1 I# m2 e- x5 }

5 q3 z) }, P4 e: s* }1 D2 ~
- L. a; W& U8 i/ ~! x0 U  00401067:  push      00402025    ; \\.\SICE/ D; T9 ^8 q5 [! y- z# B# ?
  0040106C:  call      CreateFileA
5 X1 h# ?  O& d" ]  00401071:  cmp       eax,-001
8 k5 t) b6 x8 {3 t/ I  00401074:  je        00401091
; }; o) s2 m: v. B- e
8 ]# x- G: k2 I3 t6 Q. {5 V( d; _0 y/ d; b, ^  |' Q
There could be hundreds of BPX you could use to detect this trick.
% y$ K" @' w; {-The most classical one is:
$ S& M2 R' d' H4 W; M  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' u# ]" u) [1 X! M4 V' q    *(esp-&gt;4+4)=='NTIC'9 D) D/ i( Y: V# Q" o, c, E8 B
8 W1 ~; H5 E1 s1 Q
-The most exotic ones (could be very slooooow :-(
+ q* ~/ c3 y; ~- a+ y1 J4 q   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    T- k4 d) M+ w6 F% G+ K2 n
     ;will break 3 times :-(* g6 [9 I! g+ ~6 B4 D8 q
7 t1 Y: z  W, G9 u3 k
-or (a bit) faster: 5 ?; b6 l' A0 w! G& E/ ~2 K; f
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), ~2 a5 Z! o2 ?+ E' t6 }
. a  f1 S- `, q5 I2 e' q( U! T/ i
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 C# O' a5 w7 ?$ ^- c6 n" H9 k     ;will break 3 times :-(
, ]# u' ?9 m, o/ V$ ?) ~8 S! w0 N- W$ |3 E8 q7 h" [6 n+ ?
-Much faster:
- V& x9 a8 W1 d# c* j   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% l2 h7 R+ h1 m+ G+ C# \% P3 l" ~, E' ~3 k0 `) m- ?5 t
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# y/ C1 i; a$ V2 e9 j4 X, m6 w
function to do the same job:1 Y6 l' A( g. x
) _- \( c, h* G1 N% @) j1 ~  B
   push    00                        ; OF_READ
6 Q, E* T: Q$ D, [& o   mov     eax,[00656634]            ; '\\.\SICE',0% L7 e1 n( |9 W/ y4 \
   push    eax
: O- H  F. j* z% ~" L   call    KERNEL32!_lopen* \* G- a5 L& v3 C# {% z. m+ g! q
   inc     eax! q. a* L& T1 w; p, g: h
   jnz     00650589                  ; detected
. |7 ?; ?8 w. Y+ D2 Y   push    00                        ; OF_READ
8 Y+ I  e+ S3 z3 |& h+ D  q4 E   mov     eax,[00656638]            ; '\\.\SICE'
1 y) Y& h7 x2 M1 b- |3 D   push    eax+ J' M; ?( l* I8 u
   call    KERNEL32!_lopen) J- }+ ^: `( x7 j$ |, Z" E4 p5 s
   inc     eax- B8 F- r  ]. o
   jz      006505ae                  ; not detected
- h! e% P* [% ?/ a$ }# i; [7 m3 J/ X, \
3 ~& j5 m. u% ]9 N4 E7 c0 j3 G* _% g
__________________________________________________________________________
9 i9 K( _9 Q" h, l4 m
6 G1 n/ K9 ~1 C) T9 e) KMethod 12
9 i* `3 H, B- n# N6 f=========
/ d3 ?* m1 m2 U+ d
+ U9 c8 @5 N8 f6 y" t- y3 UThis trick is similar to int41h/4fh Debugger installation check (code 05
" t$ W7 X1 V' q: \$ U" H&amp; 06) but very limited because it's only available for Win95/98 (not NT)5 ^1 {4 y" }: Z$ A
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.$ n) Q9 x/ |8 n, g3 ?$ l! X- n' y) v

2 b8 W% G8 z( j2 O( h, X   push  0000004fh         ; function 4fh5 d- Q4 U1 y8 z  e
   push  002a002ah         ; high word specifies which VxD (VWIN32)' P& w# e  t9 b, q
                           ; low word specifies which service3 A% i6 [8 `% T4 X# X
                             (VWIN32_Int41Dispatch)
6 N7 [# y2 ?' v$ o" Z   call  Kernel32!ORD_001  ; VxdCall
6 r: \: L1 f; c9 u4 K   cmp   ax, 0f386h        ; magic number returned by system debuggers9 Z+ I9 B3 _  r
   jz    SoftICE_detected$ O' H9 H! c5 X) t$ K
9 W9 |1 U3 Y; C* L/ ^) }
Here again, several ways to detect it:/ v7 n( e! _* y+ W) J' g7 r0 c5 h7 P- |

  q- i. F/ G* [/ N* ?    BPINT 41 if ax==4f% \! I* b8 B3 C* I; s

, f3 G% t2 k+ W" g  d$ n    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& i; g. r( \7 X4 L9 ]
% D  B' y; _& u
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 x, w9 G, y( l; A/ |! G  z, M" |: F/ o: q% k; p: @1 i
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' l6 }( g0 k6 t+ b4 G* @" I* Y
__________________________________________________________________________+ n1 ]6 r% _. J" N2 \% l
2 V; j9 Q8 y/ B0 }* }
Method 13
0 A9 K' {/ O0 [# N: a% p=========9 ]4 y* O; T! A5 C4 V
6 m, W2 r4 r7 q% Z( [% C# l
Not a real method of detection, but a good way to know if SoftICE is! l6 F  q1 D, \: h1 m7 Z' H
installed on a computer and to locate its installation directory.& I3 R) V1 I8 L4 L
It is used by few softs which access the following registry keys (usually #2) :
9 z4 S) x' c. `  @9 I, \0 W" R! f% u! M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. N3 v0 K$ Z: f, F2 {) \& `! ?\Uninstall\SoftICE
+ I/ W/ F, s: @; N9 O-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' t3 q8 `! q$ [/ E5 S5 w-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ Z5 n( T$ K% C) C4 Q
\App Paths\Loader32.Exe; a. ?& {* v& c9 V

" V1 y- P. d. w7 N: }: l3 h7 i: T+ y0 B+ K8 S# |: E4 B9 K
Note that some nasty apps could then erase all files from SoftICE directory; [* ~# v# s, y1 y. U( e8 X
(I faced that once :-(8 X: t$ h1 ?* ]- ?3 x, V* M* z

( R+ M% a. v* z4 rUseful breakpoint to detect it:4 c) t& P4 W  K

7 r7 ~5 y+ Y( }3 C9 {     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  Y9 T$ i5 S9 G4 |. g, h, A* K* u: b4 s/ ^, b( G) ], i0 h0 Y
__________________________________________________________________________
, u/ o* {: ?# ~4 Q% h$ t
& f+ P3 A0 _+ C0 I: e4 S  A) i. D2 a7 R* f% H4 ^* _
Method 14 : X/ M: H# B# \! c
=========
$ T! H. O- j$ M4 Y# ~
; R- l+ ~$ h" [$ z6 A; t# ^A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose; W( L/ Y4 f0 P  c+ y# g7 q5 B
is to determines whether a debugger is running on your system (ring0 only).
& o% X3 Y4 O+ |% l7 x& e1 i! h1 n" S, D
   VMMCall Test_Debug_Installed1 k* |( u3 c( u, n9 K
   je      not_installed
( o( n0 ?: L6 G: F- b  c9 C$ c8 v7 r
This service just checks a flag.
8 L  `* B2 T9 w+ n( {/ C</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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