找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 |$ }2 s7 C3 \1 a' C! P) F<TBODY>" \* u% F1 W% b/ f: [1 N
<TR>; X. H- `0 ]" P
<TD><PRE>Method 01
) {& E* ~/ v% `+ N: {=========
" t$ x, V% ]2 d& ~" ]  L6 h" n2 ?& \  K6 @* ^1 A
This method of detection of SoftICE (as well as the following one) is( c% _) ?$ w! o8 O4 h0 H
used by the majority of packers/encryptors found on Internet.& G; z" W% x1 {# i
It seeks the signature of BoundsChecker in SoftICE
7 m) L! l. n+ l8 b: d+ T: c7 ^0 {/ b8 M; n1 e' n& B$ d
    mov     ebp, 04243484Bh        ; 'BCHK'
+ R7 ]9 s3 b- `6 X7 `    mov     ax, 04h& N1 }- ~0 n& [3 A( Q$ j
    int     3       0 Y1 O$ S: W/ j4 |  p8 Z! Y) b9 o7 P
    cmp     al,4
# Q2 p  A" z, W5 e" n    jnz     SoftICE_Detected3 V" I: z, C4 ^8 T( c. j
; a# i0 C) P# \! K" I* D
___________________________________________________________________________/ [9 C, ?# s# P1 r

7 v9 a- F/ Q, ]1 E% [0 ?+ u! ^* B% wMethod 02
- d% f4 {. C- w' }=========# {& n  [% e; y! W2 _$ c+ U

, [$ D1 t4 s( C. W$ ]5 ]2 zStill a method very much used (perhaps the most frequent one).  It is used
$ F& P5 r% j( Kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,( K$ i; I( q! D6 R0 o
or execute SoftICE commands...
/ Q/ S. {5 x1 U/ EIt is also used to crash SoftICE and to force it to execute any commands3 t& C" P( ^5 M. e
(HBOOT...) :-((  ' N6 M3 U0 J+ y1 q) Q, R
( o  I% L! j9 E) B
Here is a quick description:
, V/ G  d1 H9 m& M8 W% C-AX = 0910h   (Display string in SIce windows)
6 m1 V% h, p3 }( V0 Y( D-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); W$ c! q3 K- y& ~& b
-AX = 0912h   (Get breakpoint infos)
' H3 o2 o, y, R5 D-AX = 0913h   (Set Sice breakpoints)
  ]/ N' ]. J9 u7 {& E. g$ t" L-AX = 0914h   (Remove SIce breakoints)7 }8 C! E+ n( ^: `# {! ^

. c8 _: N2 t2 S, _Each time you'll meet this trick, you'll see:
/ S; G9 O9 {" O-SI = 4647h6 F! j' @- l) V) J% x# r8 l
-DI = 4A4Dh
) `( |, {/ i" d$ l; ]2 \& |$ ~Which are the 'magic values' used by SoftIce.6 X6 w# L5 L+ Q3 N9 k# `
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 V1 \* W3 V: l' G$ N" Q) v

4 Y, X+ g+ Z+ p" A0 p* NHere is one example from the file "Haspinst.exe" which is the dongle HASP
) F. V3 D( K' y7 Y5 W: c$ xEnvelope utility use to protect DOS applications:
+ ]$ ]" |) b1 G( b8 j6 \- e: `3 N4 @# k

) C& d% O6 c9 a# H7 M4C19:0095   MOV    AX,0911  ; execute command.
9 M3 Z1 x3 _$ ]* y% f4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! o$ A. `5 H9 T7 ], E/ v4C19:009A   MOV    SI,4647  ; 1st magic value.
& @" C9 E: n$ n0 W- f0 a4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 F3 z0 ?. W1 A& F3 P+ f3 f4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) N  f! @- H: U7 \6 d; B
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ v# z) T7 _: R4C19:00A4   INC    CX0 t9 Y! q2 ]7 ^, ]3 O
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( l) c9 G. s4 P1 S  g7 o
4C19:00A8   JB     0095     ; 6 different commands.
0 Z, n! G9 Q0 v+ E& ^4C19:00AA   JMP    0002     ; Bad_Guy jmp back.. \! ?/ l0 F8 q0 T: e
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' u6 Y; t# @7 o' [
/ v/ T7 j0 G0 `# |% zThe program will execute 6 different SIce commands located at ds:dx, which
8 a7 t. V% @# V% ^  z1 P6 xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 ]; H* W& o) X* b6 ~( L: j/ e, ~! I6 G+ w% A5 o' l/ f
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* \0 T6 C# O8 n8 f& M( j
___________________________________________________________________________, k, F. }. M, t; F; l- b6 x

4 Y, c4 |2 \& X( n9 N; ?" i  z2 O7 Y' W8 U) \* _
Method 03
5 x4 A: i2 J3 y* T! n=========! D2 ^+ _0 V0 P5 D7 U& c6 Q2 J/ j
: h! C- H3 O, a$ H- \
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 x; c: J( A# ](API Get entry point)
9 t5 A  Q: y$ r" h        
5 {- _- ~  a+ R/ Q; v
: Z$ }; J" y' {. n5 X- D    xor     di,di# H+ Q- j1 M% ?3 `2 T* y
    mov     es,di- ]4 l$ H5 r- T* S! K& I; ^
    mov     ax, 1684h      
- E+ g+ s/ a( r$ F4 S% A2 |. w    mov     bx, 0202h       ; VxD ID of winice
, l9 Y* x8 Y+ p& d3 Y% s    int     2Fh# f6 Y3 i$ c2 b+ E4 W8 t" Z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" L9 U+ x! L. f7 m( Z    add     ax, di7 }$ P# Y5 N3 w+ o: c1 V
    test    ax,ax
% s5 V( Y; j+ D, O    jnz     SoftICE_Detected
% _" f! M, }  H' `. N  E) Q9 c8 V$ J2 y1 V  ~7 R9 l% d8 g
___________________________________________________________________________
8 c! o; r2 n* \
0 {, r4 Y0 G7 J6 u8 t, CMethod 04
( I4 ]$ T- Q* w- b=========
6 V# a3 {& ^/ k1 n, H6 I; y
0 G( c5 n( D, j, YMethod identical to the preceding one except that it seeks the ID of SoftICE9 D" p9 j% l/ A1 ?, h6 p2 n
GFX VxD.
0 ^9 D2 [- N$ l) q  B% Y9 q: r7 {. o- F' R) p3 S( [
    xor     di,di3 b) b% d+ N" ^- Y5 p. k
    mov     es,di1 o- e& `3 L9 N& g: B. q# W
    mov     ax, 1684h      
8 I. R4 V" ]0 S" [* m7 v" l) j% i    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 U* ?- m1 V0 A    int     2fh
3 R2 W' E% |. e# J' K2 r; d    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' u/ C  m% Q. o    add     ax, di; e: _6 |( u% a; @- E
    test    ax,ax
. h! Y( j9 q. `0 P9 J    jnz     SoftICE_Detected9 z# G4 d$ E% N1 Z* T

5 i; x3 Q( U& q- W, b2 `% A/ ~__________________________________________________________________________
) N5 _* t! c( ]: p2 @& J
; R9 r2 U4 ~! ?% @$ s" u% z6 ^. m9 x; z
Method 05
( E$ ?6 u3 d4 g$ ?8 D) }=========; T2 M2 K% T4 z7 G2 z

( G. u5 f" E. t6 l9 g; M: Z- o6 ]Method seeking the 'magic number' 0F386h returned (in ax) by all system0 s! J& |) v1 D2 N
debugger. It calls the int 41h, function 4Fh.
  K' P  B: z3 Y- W* b8 B9 RThere are several alternatives.  : M( e% u5 [# U

3 s5 P8 O% j* ^3 S  w3 GThe following one is the simplest:4 ^# L: s+ P0 c9 \. [5 h3 {9 U8 i

9 l9 O8 m  R$ x7 T    mov     ax,4fh% D8 h" F* |/ X- r- ?: ]
    int     41h
" y: ?: G1 ?( g    cmp     ax, 0F386
  Z: ^. w* h  A$ s    jz      SoftICE_detected
' x. V! G( S0 R) p1 W/ X
* t3 D- K; e2 g4 L8 i# X/ u$ I8 Y8 d- n2 o% e9 X
Next method as well as the following one are 2 examples from Stone's + j! p/ J5 k4 N' C5 E, E
"stn-wid.zip" (www.cracking.net):
8 n4 E! R3 R2 M1 n: l1 G; E* p& o6 m9 d- S4 t5 h0 I
    mov     bx, cs  B4 O( E: K( S
    lea     dx, int41handler20 H# ?: p, M, Y: G# x6 y$ F  W9 e
    xchg    dx, es:[41h*4]7 E* W& E% M) v$ f
    xchg    bx, es:[41h*4+2]2 Y3 i7 [) ~  C0 I
    mov     ax,4fh
4 h& l& O+ b( X& m& Z1 \    int     41h4 }2 a% u1 |! c+ D* [: i
    xchg    dx, es:[41h*4], T; X7 z; [1 o8 C% V
    xchg    bx, es:[41h*4+2]2 a8 u9 v' D0 d, X2 K6 M
    cmp     ax, 0f386h
: w6 S- m% l7 l$ R) i    jz      SoftICE_detected
9 A: l' _! W7 M' B  l$ T
; d6 n: k5 n9 u, }int41handler2 PROC
) }2 F! R) f" y! x  @    iret
  W7 t! f% Z. K1 rint41handler2 ENDP" I* m' v, L6 {( q3 i5 G0 C
- a# d9 Z; C0 K' U, X$ A
$ T# s+ g$ J& A; J& E6 I( V# C
_________________________________________________________________________/ i. F% ]" y5 q+ [0 A8 n
5 d9 M( W+ o6 T5 B  I) l% Y: a! d

+ x5 v; V$ x! M: y* `, b$ F# \# }" eMethod 06
& r/ P- @5 K% s! f=========; A% d  S" [7 i( I& a: l* i

5 E2 @4 i8 p+ \; M  H) O8 x8 A0 R
. \* N2 D& c" Z9 X/ G: ^2nd method similar to the preceding one but more difficult to detect:
1 U+ A( {& f- J: Y8 w/ T$ E8 [0 L; L! B  q8 H5 c7 s; a, }6 \" b( r

3 w0 h8 c  C# j. `int41handler PROC
- L. S3 p# o& W4 p    mov     cl,al
" e5 a" s6 I5 J$ e* l. `    iret
3 ], U8 U$ Y( E6 J" dint41handler ENDP4 i" n1 h' P9 s" ?  L/ g8 j
7 T  }8 l7 `0 \
1 B$ d# i' ?9 i1 I
    xor     ax,ax/ Z+ N8 ^0 H, S2 o+ y
    mov     es,ax
) I4 l+ s" S& O8 Z, ^$ y, l1 z    mov     bx, cs
0 z" X% D$ y: @3 ]! R2 v    lea     dx, int41handler
" n% ]; m- G/ S, b+ F  {! `( E, @    xchg    dx, es:[41h*4]8 q: f. D* D  j
    xchg    bx, es:[41h*4+2]
0 g% P- ^5 {8 W0 T+ j8 F; ]; A& o    in      al, 40h* f2 h* |# z/ `; N
    xor     cx,cx
/ \5 M8 k- O4 h4 D# d) Q% t    int     41h
+ R: W, Q5 h2 y. Z    xchg    dx, es:[41h*4]1 y' x  z8 P8 k. F
    xchg    bx, es:[41h*4+2]" c: _& M) Q" ]8 ]9 w0 s* D
    cmp     cl,al
; ?1 q+ X  Z, X; [. B0 W% G    jnz     SoftICE_detected5 \$ {) }. i4 u

. j1 z1 H7 i. `( ], e+ y3 b+ B_________________________________________________________________________
5 r9 ^& ~; H( Z8 p$ Y' K- J; B4 B! g, o  v5 \4 I! `9 I
Method 07
5 [1 O8 g. I; g. E6 G=========( ~) I& l' _5 n6 a/ n

) Z9 k1 G" M+ p9 r$ C6 HMethod of detection of the WinICE handler in the int68h (V86)
+ e: G, h- N% d. ^5 E' x7 F! h: j3 S
, S1 ?7 p; G) c    mov     ah,43h
& [1 N% o# e& j6 |    int     68h/ X/ Z. U& b7 [" A$ U* q8 K4 i. F
    cmp     ax,0F386h7 z+ V0 H& a5 t
    jz      SoftICE_Detected2 p/ Q  g! m9 x8 N/ V: Y, d. H

, }4 _7 A4 }6 i5 q4 ~$ l2 H9 ]/ X/ J1 t& m. R3 Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ l1 W+ H# C7 i( R6 d5 d! j1 m4 p
   app like this:
5 g! A9 y" w& v% @+ |5 H- B1 K8 G' R1 Q
   BPX exec_int if ax==68! N( p; k. S9 g0 b
   (function called is located at byte ptr [ebp+1Dh] and client eip is
: H. U$ i3 V* M  s5 G( V   located at [ebp+48h] for 32Bit apps)) ^7 L& K) q5 b" [
__________________________________________________________________________
% a& [, T2 d' ^
- A- d4 G3 U8 Y* x+ k, l: }
; k) B% A& m' q% pMethod 08- ^. D" J( L, a+ w! g
=========
/ L0 ?! M/ O5 f, U2 o! ]. v) z
# j( r* f8 b! K& R/ Y% D, _It is not a method of detection of SoftICE but a possibility to crash the% r: P9 M# j- _* e6 k% P
system by intercepting int 01h and int 03h and redirecting them to another: j9 u% e* b8 v
routine.
1 I3 G5 c4 @! W' I4 v, S/ sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
8 X/ }0 G$ q5 K/ c4 U' t( Gto the new routine to execute (hangs computer...), X0 m) Q8 _0 t. B( T

' Z3 l5 r6 j6 Y& M: X0 e! e    mov     ah, 25h
( Q  E  s$ \/ m' a) _0 w    mov     al, Int_Number (01h or 03h)" `7 i& O; E" G( f( z+ ]* X2 ]  y, e
    mov     dx, offset New_Int_Routine
  V+ @( G$ h& F, E' B3 |: ?    int     21h! A5 o, B# A. a7 W% X* F8 N1 j0 P

- `8 t: f1 |* U. A3 p- o__________________________________________________________________________
2 ~  Q. {! x* Z# V; s/ E0 j6 W% ^
Method 09& c" G) F" _" ^0 \& f$ I
=========- I3 ^- X* P0 b8 J7 i# J
2 Q# D( D2 n/ r  I" F
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only$ |% c. D/ c  D. Z% L2 _' |9 R
performed in ring0 (VxD or a ring3 app using the VxdCall).
9 W/ M+ b! y7 [4 e1 p: b" iThe Get_DDB service is used to determine whether or not a VxD is installed* O* W; V  \0 d
for the specified device and returns a Device Description Block (in ecx) for. j- X# D* J8 E0 u& c6 t! J
that device if it is installed./ [+ T/ A: Y- l8 C5 T3 Q

. Q4 c: H$ L/ }   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 F1 ~8 ^' D( m% `2 ^$ _8 \
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)! [5 N3 M# c0 \' b( R% O. G
   VMMCall Get_DDB
: K- Y2 J- h1 A2 X2 m   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
0 B$ ?* G2 d3 x) j, \8 [3 _* ~0 I/ _* i1 a+ O! T0 F+ B
Note as well that you can easily detect this method with SoftICE:( s5 L* T2 R1 ^
   bpx Get_DDB if ax==0202 || ax==7a5fh
3 I9 D1 M7 i9 l, q$ q6 d: |3 x8 P% V2 J) u2 B* p
__________________________________________________________________________; X+ `+ C. S3 y

0 m0 Y3 _; e/ q& M" t1 S8 cMethod 10$ l9 M- U; H3 q3 J
=========# o/ X1 S' R/ d" |! C( F# w

$ B+ o) I6 V0 X: v$ T  ]0 f=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with$ M# {1 i' ^. M
  SoftICE while the option is enable!!9 V" F9 t" H0 P

$ F' O/ y- r* Z! j  eThis trick is very efficient:
7 ?! j# S; s. l" Tby checking the Debug Registers, you can detect if SoftICE is loaded
) C; [9 M" y% `. Y6 p(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( |, S; D9 ^* L3 J7 P) K7 d0 t4 i
there are some memory breakpoints set (dr0 to dr3) simply by reading their
  c& [1 r$ k3 C  n- g/ H" W  O6 Pvalue (in ring0 only). Values can be manipulated and or changed as well
  n% i; f) P: y, {7 E8 t" n(clearing BPMs for instance)
9 `$ P/ u! J7 e1 Y" T$ j; }* m1 \% ?
; I3 p0 z) A2 G__________________________________________________________________________
- `) v+ V) ^5 R- f+ ]+ t2 X% Q* r+ G/ E9 k
Method 110 X# H8 w0 w" j/ r4 @2 {3 }
=========: W4 {$ t5 v8 F8 H) h

, {/ M& O* i4 I& Z$ n0 Z& R$ t4 \This method is most known as 'MeltICE' because it has been freely distributed! i& N2 W9 |$ r+ a
via www.winfiles.com. However it was first used by NuMega people to allow) a: ?! J! L. |* K
Symbol Loader to check if SoftICE was active or not (the code is located
( ^# H$ }; a' a, Iinside nmtrans.dll).* j8 l! J# X" d5 {% V

2 \! K9 O& [1 @The way it works is very simple:: j# L/ s# m! \# d
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- w4 b1 b4 ]  [' ~
WinNT) with the CreateFileA API.
' Q# ^) j, t& ]5 X* c2 ?# K& ~! }( S: @
Here is a sample (checking for 'SICE'):% `: U  Q! `+ F
( P* K% r0 t9 B
BOOL IsSoftIce95Loaded()
2 M! n1 J1 N! v* i7 `1 j/ y2 q1 w{' G' w  |- j: |4 r; j' ^
   HANDLE hFile;  9 o0 K; C& |& r
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* U* d; E! o7 A" b2 A( W1 {2 `
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- ]" d. o* ^) b- f; A                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  q3 b2 `" M( @
   if( hFile != INVALID_HANDLE_VALUE )
( I) t7 @6 H& e7 T0 h   {+ k/ {4 w2 D( m+ Z/ J. @( N
      CloseHandle(hFile);
7 f# @6 M0 a% n6 z! H      return TRUE;8 s! p6 X% j& l
   }: {  d6 j0 B4 r. q) g. Z' s5 w
   return FALSE;
! K2 z+ K6 d1 @( d}
9 `4 z/ l" g5 \% C* c& M/ m; i0 Z+ B8 u5 r7 q5 ]
Although this trick calls the CreateFileA function, don't even expect to be
$ R3 F3 G+ @7 N+ A: o' fable to intercept it by installing a IFS hook: it will not work, no way!
8 U2 v$ E1 ~: v  G, ?In fact, after the call to CreateFileA it will get through VWIN32 0x001F1 L" `$ p/ m0 }
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); d! J! M1 z7 D- v
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
# `' k# x3 S  V8 }1 Vfield.
/ e8 x$ t5 I- v, I$ S8 ?+ wIn fact, its purpose is not to load/unload VxDs but only to send a ( O- l( [' h( {, q: R' }- ?
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- s) W3 O* {9 a6 xto the VxD Control_Dispatch proc (how the hell a shareware soft could try, g/ C0 ]. M$ E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) O- U: K3 u2 l2 k( AIf the VxD is loaded, it will always clear eax and the Carry flag to allow# R% h& |3 }: }" o; u
its handle to be opened and then, will be detected.
9 V5 g" C- f# d1 Y; o9 W+ cYou can check that simply by hooking Winice.exe control proc entry point
8 R) Z6 A3 q. wwhile running MeltICE.1 k# q4 e3 M7 o- B. m/ L

* [6 H- D1 L1 z! b6 c0 _8 [% C9 W  j9 E+ d% r8 s9 J* s' O/ Z, s
  00401067:  push      00402025    ; \\.\SICE& S5 |: F2 [% _9 o
  0040106C:  call      CreateFileA
% J' T0 N3 i9 h5 O3 P2 E# {  00401071:  cmp       eax,-0012 T4 M+ p- t, G0 w
  00401074:  je        00401091+ p& w, T; {- g' o$ f( f

- f* p! w" C# l& K$ y/ I+ M
, V( E3 {; x0 L# EThere could be hundreds of BPX you could use to detect this trick.$ }, j( d9 V. Y1 X' r5 Z$ _3 t
-The most classical one is:5 K5 c' e4 P( @  p! P8 v( K' ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% I. K5 v1 [! F  X, B  _    *(esp-&gt;4+4)=='NTIC'8 |5 {- d: T( ?2 w  X
# |" y; Z/ T& |; h8 o% z
-The most exotic ones (could be very slooooow :-(
% o# [+ i3 d4 f/ Y& M1 ]7 p   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 s) L3 B0 d! @* E
     ;will break 3 times :-(
7 _4 \& W$ o. g+ h) s9 D/ k5 j4 f3 ^! d  h, y. _
-or (a bit) faster: ! }8 W+ T  `. E7 l+ q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 p$ [' {0 E* F1 T* ?( n( `4 h, X5 B% k6 E% J
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 L1 ?4 s. B% R( g; l( r6 M  m
     ;will break 3 times :-(
! U0 _# m; z# B8 U4 x  \# r. B5 W; `  H; p, A
-Much faster:
. [/ N: N7 D9 E2 i  }: ~! ~3 S2 `   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 @/ }$ Q2 M, k" a% r7 h

( Y& D5 _: A) iNote also that some programs (like AZPR3.00) use de old 16-bit _lopen# S$ P8 o: h; o, q
function to do the same job:
* y0 B: g# e# x! k3 v9 {& A
4 v3 x& s  |* _7 q* y% [5 R- Z   push    00                        ; OF_READ8 ~; M4 @3 j8 \9 }
   mov     eax,[00656634]            ; '\\.\SICE',0  h2 _5 }7 R+ N7 i2 s* }" T
   push    eax( c7 d4 j" |( `: S1 F
   call    KERNEL32!_lopen# M% N  k" O! H/ F3 G
   inc     eax
  P8 \1 w0 E' W% ~# Y# I   jnz     00650589                  ; detected0 o* L5 {: T- n2 e
   push    00                        ; OF_READ
3 C: r5 `# Z2 P1 F. s" ]$ F   mov     eax,[00656638]            ; '\\.\SICE'! z/ `' Q3 e- Q
   push    eax" {7 k; k! H8 m* f+ j2 l
   call    KERNEL32!_lopen4 |; s+ x" g! X- W- b3 d
   inc     eax
) u7 |. Z. N2 j& D   jz      006505ae                  ; not detected
- ]: ^% q* i7 C+ `. ?) h# N! D' D8 K- E

6 G6 F% k3 j+ G( G2 b) g& s__________________________________________________________________________
! {! I4 I& U* c; f1 z, H
6 W8 S7 {' B8 j5 f1 |' c+ B" g( wMethod 12
* O/ i. b3 K1 G( l2 j) Y* \3 o# Y=========6 L2 G6 P9 _+ J# n- S
0 T! J' F. y; `& x
This trick is similar to int41h/4fh Debugger installation check (code 052 j$ v' _$ b1 o; z1 N
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
9 y; I/ j+ P$ F9 `  Z7 {as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# o6 o/ a+ p( U4 ]' S0 x* z# L
! o" B. f5 ?' T9 A   push  0000004fh         ; function 4fh% I9 ^8 M" o5 e9 t% X; V
   push  002a002ah         ; high word specifies which VxD (VWIN32)/ \) d/ ^8 H" g5 `& P
                           ; low word specifies which service
' I* t! b! A+ }8 V9 |: H6 Y' w                             (VWIN32_Int41Dispatch)
1 \* x, ~* [( ?* l4 \) p   call  Kernel32!ORD_001  ; VxdCall
0 ~! u9 y# f5 u5 ?4 S- X7 H" \   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 {; y! b, [# k" J   jz    SoftICE_detected
+ T9 O+ ~2 l! d8 H& T, o8 u, R( P
9 [- N6 ?4 B. m, oHere again, several ways to detect it:9 ]3 k7 |9 ~9 b, t4 f* A
: a: J6 W  r1 @6 N  q
    BPINT 41 if ax==4f
) K( g% V! F' j0 D$ J+ Q8 d
" S, R( p3 i) P* z& S' k4 j7 P2 Q' R    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 W- ]/ `3 }+ D# Q; Q2 b2 Z
8 J; V% N' v8 |9 Q, _    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 v0 X6 R* d6 Q! {$ o3 ?2 S% j: D% j6 K: {" f
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. }; @8 Z8 e0 u% L5 f
+ O% n9 }6 P4 `1 E__________________________________________________________________________
+ H* k5 N6 z: i. ~7 M* V6 k  ^
& @+ \- _: m8 T# dMethod 13+ s* o; _9 L! q5 O
=========
4 O/ e4 W" n. v  t2 Q& T/ o. _( G9 f, L# k' n2 ^
Not a real method of detection, but a good way to know if SoftICE is* s6 {2 m! e5 [* _' t% f, `
installed on a computer and to locate its installation directory.1 }1 |0 X+ K9 |& D4 q
It is used by few softs which access the following registry keys (usually #2) :" C8 u, H: T  X

% {. F( k4 N8 A/ L-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' a5 }: J% M; \+ s( b+ {
\Uninstall\SoftICE( _3 l5 k2 t! i3 Z+ K: H
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE2 W  N$ E1 \2 \5 h; L$ z& B
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. e) H2 h7 ?/ ?0 }, i* M\App Paths\Loader32.Exe
7 I" ~8 f( d8 t0 ~. t: W
5 j8 d; [) y' o) v3 s- N5 O  I$ ^( T6 o6 V
Note that some nasty apps could then erase all files from SoftICE directory- ^6 o5 e# {5 U* c5 R0 V
(I faced that once :-(
+ ^! a/ A% F7 Z, Q
9 \5 R3 l" Z' OUseful breakpoint to detect it:
7 d2 F  Z. Y* t" c2 r
( y2 L5 X: U3 x; `  s7 V8 I! [     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* B: P& [( s8 v' j/ K
2 Q. z8 p9 D+ J: `( W6 u% ^2 s  N__________________________________________________________________________
" Z+ b+ o$ u) g; d
$ O2 ^' J* F. j$ Y  B, S6 X! r8 o: o. s$ T2 _. W7 o( u$ R3 x
Method 14 0 N. [$ h; L" L( a; K, r0 H
=========( O$ X: Q( W- d: r8 R
% E7 D' s1 d) Q3 m
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose' x: k" u6 C) _& J4 Y
is to determines whether a debugger is running on your system (ring0 only).
: p' x7 u: h* u) C8 E; x( f! ?$ |5 T+ @/ C# a; Y0 i
   VMMCall Test_Debug_Installed! R, e" p+ b6 ]  u; x' v
   je      not_installed
5 Z; M% U: H2 @) o" y' j8 G
1 x3 t) t0 K6 M; g/ `This service just checks a flag.: }& B3 E1 j% {3 D1 x% K9 z  P0 A
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-7-27 01:04

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表