About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>/ X; Y  p$ g+ D+ u
<TBODY>
7 G. E8 w4 ~& N# _<TR>0 [8 l; I. O( F
<TD><PRE>Method 01
$ s  Z* u2 X( Z* g3 O=========7 ^4 \  R6 D% ]) n/ n
0 n( H+ D: n: W) L9 K6 H, \
This method of detection of SoftICE (as well as the following one) is
$ ^  `9 S# D9 D4 r/ wused by the majority of packers/encryptors found on Internet.! M3 g0 |) a" w! k! t5 q- H
It seeks the signature of BoundsChecker in SoftICE6 \* o8 p8 I  u4 ^8 m3 s* j

& f7 A- {4 w+ a! l8 H    mov     ebp, 04243484Bh        ; 'BCHK'4 Q% ?: _% v  j
    mov     ax, 04h
8 ~, A. r# C6 D7 Y; A: f1 N! R# C    int     3      
0 p8 g3 W+ ^( A5 s    cmp     al,4
! W; k9 Y$ F2 ^$ L- d    jnz     SoftICE_Detected
$ {2 b! i) @$ w3 o  ~
/ L' R4 _: K) E6 R& z, Q) H0 E___________________________________________________________________________
4 i& L. @$ J3 C' O; v
6 \5 l) O+ d5 zMethod 02! S# }, c  I8 b9 ~
=========
7 N4 h- f0 I- }# s/ y4 o5 e/ H  P: s6 t. A4 ?. |
Still a method very much used (perhaps the most frequent one).  It is used+ |& Z: t) {4 `+ h7 w/ k
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; D1 O! P8 l2 D) F( Hor execute SoftICE commands...
! Z# l+ L1 ?4 Y2 b- n. a, zIt is also used to crash SoftICE and to force it to execute any commands
0 x! E' W' ^" M7 _0 k% o: w1 w(HBOOT...) :-((  
0 G5 Q) ~5 ]8 k2 {& z* x, o+ D) e. g" `& N
Here is a quick description:& {' }. Q2 U2 Q! \
-AX = 0910h   (Display string in SIce windows)' y! X' F+ I. e/ ~! q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! D) l  i( b% Y4 [0 m: |
-AX = 0912h   (Get breakpoint infos)5 @) Z. V0 T) }" d2 z7 K3 T- ?
-AX = 0913h   (Set Sice breakpoints)7 F" x7 U2 E- N  T: u& z) x
-AX = 0914h   (Remove SIce breakoints)
; X$ d4 W/ A5 @$ n: r" q( u* S/ e7 z, J
Each time you'll meet this trick, you'll see:
  V) U5 K2 l. }/ g! v* S, x, X-SI = 4647h% o( T! q! M4 m# o5 {
-DI = 4A4Dh4 W! Z2 ^. D8 j* d
Which are the 'magic values' used by SoftIce.
3 e* L5 P8 C2 b. v: U. CFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& W' Y! R* S4 e- M6 x: w4 w* K3 x5 F( y5 O' d; @. p: K& n
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, i+ ]! m* ~# zEnvelope utility use to protect DOS applications:1 f7 m$ ~9 Y( G, w

& D# ~5 g$ l4 y! y, d+ g5 z/ b2 i7 n: R, J' `/ |& \9 Y# w
4C19:0095   MOV    AX,0911  ; execute command.
2 u: ]& M% B  X4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 U4 k5 F' I& p) t6 }- k! A
4C19:009A   MOV    SI,4647  ; 1st magic value.. A/ i/ X- l  b! K6 K
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& ]! t: Y0 g4 ~) ~' S! |4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ L: y7 C! V6 R. R$ Y+ w8 P4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute; s( P* S* U5 B5 C- y" ?4 l: f
4C19:00A4   INC    CX
5 V$ s8 B4 p! f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# Z1 C7 a8 g3 T3 }: u( Y$ P4C19:00A8   JB     0095     ; 6 different commands.: z* K) N# e! k$ E- i; f/ `; r
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 v  y: r9 v8 c! I
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 Q' r) t$ F$ s9 B! a1 T
5 x6 E! p& ~9 m  b; P' YThe program will execute 6 different SIce commands located at ds:dx, which; a5 ]* v" w3 o8 ^4 ]/ S( i
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ g3 l5 {, P9 A* [/ H4 p3 y7 J5 v
( G9 t, ~6 V6 w1 C* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
0 V  t% V  S7 W* X6 P___________________________________________________________________________3 j) e( o5 ~, R+ Y; [% k! }

# G' ]; T3 @, C% V  ]
; P* M" [0 C8 l2 JMethod 03
9 u/ F0 N1 l( N5 j9 c4 J( L=========3 }4 h, S, l* e

3 s0 K. s2 [( i  }9 z9 tLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* ]& |2 H! q, e(API Get entry point)8 J" D7 F6 i- y9 h' i
        ; o! D! L3 K3 T4 y% I

* |7 m0 M; o* N8 B    xor     di,di0 w" u, I' i, ^/ l
    mov     es,di
- |- V* T: S! K4 N    mov     ax, 1684h       0 Q! B2 P& y8 U- P- P0 _
    mov     bx, 0202h       ; VxD ID of winice" d4 U. f  L1 o) m/ |: u' k
    int     2Fh  b0 G0 q# @  a" l3 e& _0 E5 h
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- k* E* s1 q) F7 ~9 N- n  [% Z    add     ax, di
$ H1 i, F  I, G    test    ax,ax
  C# z$ h+ @+ c' `' d$ c    jnz     SoftICE_Detected; a6 i: j) V, p5 k9 r  I5 l; e
& r. N) b. @3 T9 m$ K* d. }# a
___________________________________________________________________________: U: o, ~' J" Q) o2 l
# c, U8 w- X* D5 D- {+ Q' @' M
Method 04
% T' }  s; w' c' g! Y* W) {7 j1 t, P=========
2 R/ E4 P3 j6 C! n, g# ?9 \
/ }/ e2 t3 X/ S" g9 @Method identical to the preceding one except that it seeks the ID of SoftICE
& T. J- p4 ~# r$ aGFX VxD.
' g. _, p) u) Q' @2 f
0 T" v  t+ M! m! u1 \4 ]; ^    xor     di,di
% _) Z, D% V& u$ h$ M5 p( `5 J    mov     es,di
) b% A2 w# X8 \) [    mov     ax, 1684h      
8 B9 q; X% `! W    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 v, N4 m" c5 V4 ~% O+ d    int     2fh
, @) `% x7 P$ @' A( h    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 ~1 N9 i. m: [
    add     ax, di/ h# g7 P. r) S* T; z% C- E$ i
    test    ax,ax
( S/ s4 @& B6 q  |4 B" j, E- e    jnz     SoftICE_Detected
* D: _2 [7 d0 G  z* s' V
5 h7 {7 P4 H8 `, h- p& c! W__________________________________________________________________________
! n  ^8 K" A  ~/ l) m3 r
3 I% ?, o$ A* N; ]. B$ o! X$ e5 f" T5 Y5 [3 u
Method 05
+ e2 y6 M* a1 O3 z0 ], H3 @8 u' i2 [=========
& v1 G  w# U6 P6 }5 A! [) }: l. Y, {6 j& U' a' ?; S- q6 p+ o2 [
Method seeking the 'magic number' 0F386h returned (in ax) by all system7 K/ J3 z. h7 z9 f% Q
debugger. It calls the int 41h, function 4Fh.
; e' `& Y- F1 s8 `% l/ H) [There are several alternatives.  ' t. I6 `! g5 Z; f

8 k) X6 Z: s9 f/ s. z5 i7 bThe following one is the simplest:2 X0 ^! R* ^" Q; N" d+ g( j

0 t! @. k. w5 ]3 r. r5 n% @/ v    mov     ax,4fh0 m& C; m( v' ~& [' S& y
    int     41h$ Z% V3 P8 f9 g4 x
    cmp     ax, 0F3863 c7 ^' Y. S( [6 C
    jz      SoftICE_detected
( ?# W4 G6 k7 {: I4 y5 O% M- T8 W
; Q) l$ y0 r- Z& g% z% J% {/ u/ b
% f* \& ^0 s, E0 INext method as well as the following one are 2 examples from Stone's 6 c& I5 h/ T0 Y2 Z: w4 N
"stn-wid.zip" (www.cracking.net):1 b- @# l$ a" ]+ f4 W& J

1 c+ c' g, \4 l& \- w1 Y/ E/ f; S! G- n    mov     bx, cs2 B/ n$ g! y* w' O  c
    lea     dx, int41handler2$ M# o8 l" }, d1 R) x
    xchg    dx, es:[41h*4]
/ w/ B/ _& y% d, J# e6 h  x    xchg    bx, es:[41h*4+2]
) s  G1 T2 f: d    mov     ax,4fh
) M) R9 g- h; C& O0 c    int     41h
' Q. j3 F1 t6 E: d( x    xchg    dx, es:[41h*4]# h; ]- l# {6 m. Z$ V/ A- V
    xchg    bx, es:[41h*4+2]  @$ F5 p% F- p5 b  V8 L
    cmp     ax, 0f386h/ S+ W+ S* P8 |# R
    jz      SoftICE_detected
  q  {6 i8 i- U/ @- B! b4 m8 [% T. n( R0 f! p0 J0 `. l8 E. U0 g
int41handler2 PROC
3 |3 N- [+ B9 d$ k6 v3 b    iret
1 m5 v' a: w$ {" ~" Aint41handler2 ENDP
. c  m0 b  Z. s  d; {% ~2 r+ A
5 a3 \+ P  `. \' O7 J2 z6 G6 W
) o6 j9 z5 C! Z2 Y5 v0 ?  d_________________________________________________________________________5 ^0 O! d' V9 `1 W/ f1 p
; h/ p. ]/ n- t0 s% q+ U$ d" M
$ b" K/ J0 [  H% i, [' ?
Method 069 A  s" Y: R6 y& q
=========- S# c7 C- ~3 }8 ]8 \$ U0 c0 S1 `
( N& q# h$ L3 ]

- B4 J0 p/ H% C% q$ e+ S# z& y4 @8 w2nd method similar to the preceding one but more difficult to detect:
7 |- g9 n9 G' }4 c* g  B6 Q/ u  E* b; {) ?( q$ V. R+ ~
* }6 W1 D& _) u: B6 G* o
int41handler PROC
# z" D( {% f3 E! g1 l8 L  w" U    mov     cl,al
, B" q+ Q" H2 _/ {+ J4 j9 ~    iret
% n* X$ g+ Y$ O$ \4 z( rint41handler ENDP
* a5 q4 F) J& ^9 H; b  r& n: b& J" b5 e) t1 C/ j

, K5 E' G1 [/ x* {4 u7 Z    xor     ax,ax0 w3 K- C) f8 z7 q+ A6 y* K$ w$ b
    mov     es,ax9 N/ l" {+ Y# P9 J, C
    mov     bx, cs
# [: G* M: h8 W/ z    lea     dx, int41handler  a1 s. Q1 O# k. j2 D
    xchg    dx, es:[41h*4]
  ?3 O8 `6 q9 k0 p6 F$ X! d    xchg    bx, es:[41h*4+2]! |! r3 n2 @8 C
    in      al, 40h
% |. F9 D) l6 ^2 d    xor     cx,cx2 Y+ d- X% ?3 j. I: O+ T. v0 w
    int     41h, `( p! q# [7 J% }
    xchg    dx, es:[41h*4]
  B9 A7 m( o1 H( E# L: `" M    xchg    bx, es:[41h*4+2], q  H1 X% m! o! D% d
    cmp     cl,al
+ I. [3 D( d5 `! _% @* h2 y    jnz     SoftICE_detected* w2 d- C. `2 p& h% O4 {; R% v

4 M9 b, |( ^$ B) H' u* f0 y4 G_________________________________________________________________________! e  s$ G, n# P; d% T# u* {* {! z

" x9 z+ \0 P1 W) o8 m+ d1 lMethod 07- Z* r+ c- R1 m" |* m6 c5 p% D  X- h
=========
- a, s9 C9 I% w
& p3 R& s" h9 [/ L$ N! e' LMethod of detection of the WinICE handler in the int68h (V86)
- ~: h; Q% I0 @- o
* Q' e/ }7 c$ y! M  B    mov     ah,43h
$ G( P/ k2 @! Z1 M    int     68h
1 ?: u. r/ W2 {- n    cmp     ax,0F386h
$ J% z. l3 o. ~9 g. H8 h    jz      SoftICE_Detected1 y6 O7 H4 X, g% Q
8 o( F4 G4 ]" u8 p
1 M7 \. ?$ J' p8 n# {- I* Q
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 p- B$ b6 i$ F6 T: a* \+ A   app like this:$ e+ G  F; r. E2 k1 u5 N. `

0 c9 Z- {6 u2 [( G: g   BPX exec_int if ax==68) Z8 {. `. h6 Z+ Q3 @9 s. `
   (function called is located at byte ptr [ebp+1Dh] and client eip is
# e8 ]- v$ i/ {+ ?! M: ?* Y   located at [ebp+48h] for 32Bit apps)) ]( h. v( F6 G2 g
__________________________________________________________________________
. T8 P" z) u5 r( u8 `6 J& @
, b4 p$ D6 V/ \$ R3 X' s" G9 T& y) g7 I% l/ F( A% d* u& }
Method 082 ]! j/ w# k7 B2 m; V' m
=========" X3 A' X2 g' s/ A+ M

$ @% K2 O! G% A$ j, pIt is not a method of detection of SoftICE but a possibility to crash the
( M7 U8 `- p( O- u* Osystem by intercepting int 01h and int 03h and redirecting them to another# I  ~  M% Q5 C  ^# T
routine.
7 _: H7 r* l* ?4 m+ u6 ]It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 _) l/ I+ H% v1 ^
to the new routine to execute (hangs computer...)
+ L: |6 C3 z' W1 c% W: C
. {( N6 |& m" B9 L    mov     ah, 25h% P8 [' |  ?  T+ ^. B* T" ~& E
    mov     al, Int_Number (01h or 03h)1 T, |. }# f" p0 }
    mov     dx, offset New_Int_Routine2 o- B" R* ?5 w
    int     21h( b) H! m* E4 h; m2 i" i& H( B

7 T6 @% G2 r  v) [2 x8 h9 q" ?8 A__________________________________________________________________________* f- Z5 b) I8 h
+ w# r/ s/ p; M
Method 092 y9 I- ?: K5 d1 n1 r& F: c
=========1 V; B7 X  p+ U+ k" q

# {: ~) j* a8 \: JThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& d( t7 g' c2 P) t$ rperformed in ring0 (VxD or a ring3 app using the VxdCall).
# W) P5 M4 D9 w6 qThe Get_DDB service is used to determine whether or not a VxD is installed% o0 @  i) L5 `. ^$ k0 x
for the specified device and returns a Device Description Block (in ecx) for
3 f1 Q7 G8 ?4 g# t% qthat device if it is installed.
$ H; P. N! p  `9 i! X6 J9 V; n% `, t; }! i9 v' ^/ E
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: P2 x; `- S4 h* a   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' f9 `5 B* r+ i5 k. F) R   VMMCall Get_DDB# P: i5 n! L7 x* z' i9 a
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- C8 b) u( W+ |" J6 H  O6 Z
* M" h7 Y  {' h5 j/ ?# Z) XNote as well that you can easily detect this method with SoftICE:$ W+ B! p7 W* V( j0 V7 ~2 \
   bpx Get_DDB if ax==0202 || ax==7a5fh
2 b3 i! F3 \  F  r6 D7 J' V0 O) o
__________________________________________________________________________% r% s- Z0 v) E) K; s0 Y  h1 P* i

/ u9 ~0 Y2 W* w- L, u5 C0 \Method 10
: u1 _/ }, A4 [2 D( c$ _, t=========
6 p7 D$ E5 P$ A2 p
) I* g3 O7 C0 z0 ], C* ^( w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 P  f% K  O- c4 C% C) }  SoftICE while the option is enable!!
% k! g% t/ b9 G; c
$ _1 o4 k6 f$ w8 I& c1 ^, m6 KThis trick is very efficient:
% [5 f. ~1 F1 D" ~, T% \: d- Eby checking the Debug Registers, you can detect if SoftICE is loaded
5 j) u  `6 j% b9 h! m(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) G- m$ s$ P. c0 `  p* V
there are some memory breakpoints set (dr0 to dr3) simply by reading their% u' j. z) w, j6 G' M) R
value (in ring0 only). Values can be manipulated and or changed as well
1 r  h9 y3 J1 L( f1 F, m$ z(clearing BPMs for instance)
1 D. P. U7 ~5 \) ]+ O
: i% h3 i& W% _" u. O__________________________________________________________________________
; H. }4 g/ U9 R1 F; U, P
. E% @1 o( }5 H/ q  `Method 11
: y$ F' X# C9 X- [. T& |$ ]2 [$ \=========1 L/ t/ c- @) C4 g  p8 W5 f
# A5 E  L9 o  [% b4 k
This method is most known as 'MeltICE' because it has been freely distributed; w* q. m0 I, r% P4 r) X9 a
via www.winfiles.com. However it was first used by NuMega people to allow4 I" R# W# z6 ?% z6 L  _
Symbol Loader to check if SoftICE was active or not (the code is located
+ \# V. ]0 `) Y# V) Y1 Cinside nmtrans.dll).
* P' ~6 u/ W& r& H5 d3 x
2 [& H, p7 a$ }5 ~The way it works is very simple:
$ @) w# f/ R  VIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. |1 p" G$ S- ?# L: Z2 m1 SWinNT) with the CreateFileA API.1 k; a' V. D( S& A. y

4 {7 \8 n) ~* E# n) G: M1 `Here is a sample (checking for 'SICE'):
9 V0 @% _4 Q! a1 o+ x7 ^  p2 [8 f6 s' L; r% b- R7 K9 ^% Z5 y
BOOL IsSoftIce95Loaded()6 a0 o" z' G, j( Y9 L
{
* |7 D5 j2 P9 u, Z   HANDLE hFile;  ; Q% s- y; k6 V' E. z/ ]
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ `; L' M$ z! h) J: k$ N1 a                      FILE_SHARE_READ | FILE_SHARE_WRITE,
$ A- w% @; N0 A$ g                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ k( P4 P8 R4 n/ t: t
   if( hFile != INVALID_HANDLE_VALUE )5 a. B4 `. ]! K- ]5 c$ Q7 v% H
   {+ {$ d( ]1 R* @( `+ O
      CloseHandle(hFile);' Q6 q# K- C( F+ Z' d# k' _' q$ U
      return TRUE;
* p5 Y1 j# f8 c) _' D8 H   }
' }6 ], `6 u7 f   return FALSE;# t! Q4 I8 z  {' Y# u& S
}
, \' z( h5 R9 ]  B8 ^7 m
# v& V" a1 y5 ?9 ?; v- J' Z( Q* _Although this trick calls the CreateFileA function, don't even expect to be. b8 E# Y2 P6 v" S
able to intercept it by installing a IFS hook: it will not work, no way!
1 y2 f# S6 g# c& A1 UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
( S, ~2 ?3 f: s( Z, j( S' s) V; Zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 R4 b% v# ]/ ]and then browse the DDB list until it find the VxD and its DDB_Control_Proc
% W* q! S7 h& V2 l  P7 ~field.
, ?2 e5 Q7 }2 XIn fact, its purpose is not to load/unload VxDs but only to send a
4 p7 Q  U3 ^) T" K* \: S% nW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 N# ^% s5 h- S! D& z& `9 z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try; K& a8 D5 u! S+ c
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ ?- i3 I, [7 T7 n  eIf the VxD is loaded, it will always clear eax and the Carry flag to allow+ X# B- i+ o0 d3 `
its handle to be opened and then, will be detected.! `& i! D% Z# k; A  D
You can check that simply by hooking Winice.exe control proc entry point: }0 A  z- ^4 ~- \/ d" ~/ I2 |7 A, L
while running MeltICE.1 q( ?7 S; Q) p8 s5 A) T6 w* t
! b6 Y+ P( n# Y, B  Q: v- N
8 y1 o  U! z; Q' {. g9 `
  00401067:  push      00402025    ; \\.\SICE
8 A4 v$ Z) S. a" ^; _- t  _  0040106C:  call      CreateFileA
1 i/ l$ i- y( c2 X  00401071:  cmp       eax,-001
. X+ g* m5 u5 Y. b; ^' p0 d  00401074:  je        00401091
" Q' @- }# k9 w$ c4 D; a- y, {) Z9 Q  \! _7 ~, A
7 M) m. G/ z' C% F5 r7 ~0 v' R) \
There could be hundreds of BPX you could use to detect this trick.; |, k0 s$ n& P' M
-The most classical one is:6 K; G# v9 A" [1 S2 k, I
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% a4 D. q$ C+ P4 E4 \    *(esp-&gt;4+4)=='NTIC'
) U% Q, e. u# ?( o1 Z# K6 i/ B& t* Y3 l+ ]9 Q( r8 `* M. M! k1 a# j
-The most exotic ones (could be very slooooow :-(% F$ N# B$ \& x  J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 }+ M0 ?0 {/ c     ;will break 3 times :-(
4 Q$ M3 B; m5 n$ K) v0 x* Q' x/ O( c% D9 x9 P" X
-or (a bit) faster:
1 F5 c4 d$ s$ ?( y5 [$ ?   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')5 C8 E! u- T- I7 [- {9 ~/ I9 {+ u

6 D! R: h  T* w/ {8 ^   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( I/ I; T; x9 n8 A4 w2 T     ;will break 3 times :-(
% q8 ~" ]3 I3 y6 M% U" d# I. r; S; x) [: b% J5 Y7 v
-Much faster:
& G1 e$ t6 r9 k  Y/ x! f3 |   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
  ?" o3 G3 S2 `) i$ v& e" q! {% A  q+ K) C! {3 f+ t" y; _0 k
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ L3 o) S+ \3 Rfunction to do the same job:# O. }9 ^: z% Z
" L" O/ d8 n  o' h8 q& O8 G
   push    00                        ; OF_READ2 [6 W2 K3 n% T
   mov     eax,[00656634]            ; '\\.\SICE',0
1 [; r: P& _1 d5 Z- C: w- O6 L   push    eax
, o; y- C5 |1 X+ k5 w7 I   call    KERNEL32!_lopen
: i- C# N9 v  n7 r. S7 ~   inc     eax
7 X8 y- H# Q$ a9 E8 ]# Z   jnz     00650589                  ; detected) A1 A; |2 Z/ r
   push    00                        ; OF_READ
3 H$ ?6 y+ K# x6 }   mov     eax,[00656638]            ; '\\.\SICE'
4 p; B. ]# X8 V   push    eax9 f. D8 k! Z/ r% H0 ^" ^. e. }
   call    KERNEL32!_lopen- G* b2 _( b* s" {- G1 f' }$ F
   inc     eax& e( d4 T9 W* n8 m2 L
   jz      006505ae                  ; not detected5 |: v- j8 m' F& t7 K

1 t) f/ |, |* b( A" {0 L
4 Z( j. M2 V; n  [: q6 L1 W# i__________________________________________________________________________8 C  H  k3 S+ U) h9 j7 f1 I
. P2 U' Y) S# o. r
Method 12
% a8 G2 k) H1 {: g4 N" w( C) d=========9 l' ^( p: ?& u2 H6 d) p& ?5 k. e. L

$ j9 D4 I0 q3 F  M' e: u2 lThis trick is similar to int41h/4fh Debugger installation check (code 05+ t2 {6 {# [% u8 m0 y$ q9 c
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 k8 ^+ Q1 A3 b2 v6 Las it uses the VxDCall backdoor. This detection was found in Bleem Demo.
' V' Y0 P( D& r# q, M) x6 E+ y, |! _
   push  0000004fh         ; function 4fh+ K! J8 L- {- p$ U+ Z
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 A- C: {. B5 B2 D# \& b
                           ; low word specifies which service
5 z; }  x8 y' J; `5 D                             (VWIN32_Int41Dispatch)
' L; \, l7 J8 E1 a/ E4 f   call  Kernel32!ORD_001  ; VxdCall; W- ^. h9 b1 \+ r5 g
   cmp   ax, 0f386h        ; magic number returned by system debuggers
: w9 a' ]8 i" n% m   jz    SoftICE_detected% O9 a, a$ ~* `6 ?% w" P

: F% U7 l  E8 h& d" IHere again, several ways to detect it:% Y: o/ [9 z9 V  e0 m

/ R, p; a  D; e0 X5 q: ^; ^4 v) w    BPINT 41 if ax==4f
% m1 Y( S; g' p4 m
5 U* ]0 n3 K" @! `# |    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
$ G7 I1 a& H7 f# X6 I3 y& |/ ?5 A. @- B- [/ a$ R9 ]9 I
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! ~$ F( I2 h, A  k* P7 j, }

& v2 r0 t# Z* J% \7 e0 v$ \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& t$ Z8 z3 R2 `+ R' J% b
. l  ?$ S. {3 B/ _/ j3 w8 V& ^
__________________________________________________________________________: v! ?5 B4 ~1 G* F8 O0 V

9 \" J- |: d& q2 X( CMethod 13: U: {" V1 @( r7 [4 V' c/ f
=========2 E5 G2 |6 o) Z; m' r9 }2 t9 L; h4 s

* }# q/ ~6 D3 N- S9 E1 ~Not a real method of detection, but a good way to know if SoftICE is
9 Q8 Q( O: {6 _( M, ]! k, N$ ninstalled on a computer and to locate its installation directory.
" j7 @+ ]8 P- {6 e  EIt is used by few softs which access the following registry keys (usually #2) :- E* L1 O# ~( q- X8 c, d1 ]: u

7 D) S% e% W$ _; G2 s5 J. W7 d-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 B) S6 C: k. c- g\Uninstall\SoftICE/ j5 l( O0 C9 U
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( E, a0 e0 M) O. ?. u-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 Z" n# H. G6 E% D* E* A, M1 Q\App Paths\Loader32.Exe
/ T8 P" j& M5 ?, R0 r9 v1 t5 Q
* \" @4 ^' U; S: D# E$ _/ Y; H$ G4 ^* i& b. k- U& H
Note that some nasty apps could then erase all files from SoftICE directory2 N8 }$ M- X* B" @4 i2 ]
(I faced that once :-(# ~7 }" J' C0 _" B" w7 W6 o8 ]# J$ f

. }5 C, B9 a9 M2 W; _- R9 {) z) R, E# L2 ]Useful breakpoint to detect it:1 v& @/ Y2 V9 L. [1 Z# [' K  E

3 [: j3 C/ U, L& Y. ^     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, }/ H/ A- @4 n: j1 ?/ D$ v* b3 r% h2 a: J
__________________________________________________________________________- `! L5 y$ `; u" C4 C, N2 T, K: W! e7 {
  Q1 |" T8 P1 g7 E* F; A2 ^
8 h# o5 s  a4 F# o; r8 K* v
Method 14 8 }: K' f& E3 I1 c6 d
=========
5 D8 J0 m+ f+ o6 S5 N( O, z& Q! d5 m7 n- z5 f! U: z1 q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! e9 q  o- s- a  |1 J( E( Jis to determines whether a debugger is running on your system (ring0 only).
2 p8 D0 b) A8 F( d* l$ p9 R
3 i# }2 j9 }/ B0 z3 ~! k   VMMCall Test_Debug_Installed
2 ~) O" A8 t0 q' C5 a' t' W   je      not_installed3 G8 `8 B* Q: H$ P' e9 g+ ~6 O

; o3 E- ?  e0 cThis service just checks a flag.
3 \7 o  `: E/ D: ~5 T! S</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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