About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 ^' }6 F' J: K+ B
<TBODY>
: d6 I8 o* b0 p% X) m<TR>
( K+ l3 I7 V" p# p) i2 o. d* @: n  ]<TD><PRE>Method 01
! ]5 n5 }( n, u, G; W$ N/ u$ O=========
! q- ]7 `6 R* \0 U! L$ u
: `6 L& y* u" w+ ~* }) Y3 x" E3 AThis method of detection of SoftICE (as well as the following one) is
# \: `2 ?+ _! [; C: v, c/ u7 Lused by the majority of packers/encryptors found on Internet.; H1 d7 d& O* X8 u" z6 p
It seeks the signature of BoundsChecker in SoftICE# _/ X. w8 l6 X) w
+ ^7 r) J% ]- ^+ x4 \5 b
    mov     ebp, 04243484Bh        ; 'BCHK'9 M. u# ]% }1 C/ X3 i! r7 B, m. @
    mov     ax, 04h
, i. @* u: V4 ?) f    int     3       # t" }& H* Q7 D: _
    cmp     al,4$ q* h' }) b+ X6 h7 q
    jnz     SoftICE_Detected8 p  a& |9 Z+ l+ Q4 x7 \
) g3 A; k2 C0 O7 m" |9 s
___________________________________________________________________________
2 ^; _" d$ W& Q  J% z* L) R6 y& C7 z* ?& B: m! j7 Q8 F! b) U! R
Method 02' O; l( i( O5 z) f9 w
=========0 J$ D% A" X' X( p2 f/ _

. H% A& b& f" f' ?4 j$ M0 _- kStill a method very much used (perhaps the most frequent one).  It is used
/ H* L/ t8 o5 ~. g: Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 |) z4 O1 B& O# N- i% X  _or execute SoftICE commands...5 r  d. ]( ^7 b+ N( v
It is also used to crash SoftICE and to force it to execute any commands
! u! T7 j, A  }* ?* m(HBOOT...) :-((  
* ~" w" |* S2 \1 H. E) G, o+ m4 C( K; X  I+ x
Here is a quick description:
7 v0 n$ C7 J. ^3 J. X+ S-AX = 0910h   (Display string in SIce windows)! x: X5 b9 s. L: |, v! N
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 {7 ~9 T, q% x9 p-AX = 0912h   (Get breakpoint infos)
* i! Y% }) Y5 m! L4 F-AX = 0913h   (Set Sice breakpoints)
7 I, F0 w7 R: A6 q4 W- i-AX = 0914h   (Remove SIce breakoints)
. G9 U8 K: z: ]! F$ P/ x, t) j, d. q) S' P* B5 B2 K
Each time you'll meet this trick, you'll see:3 @% ~+ H: u8 n4 P: o% L! h8 x7 O
-SI = 4647h
" ^' |7 }& @  y# W-DI = 4A4Dh
5 w# q# m  F: ]$ d) KWhich are the 'magic values' used by SoftIce.2 W* ~: `4 e6 b2 @0 c2 D2 m1 k6 ~0 ~
For more informations, see "Ralf Brown Interrupt list" chapter int 03h., A: u; F2 o7 m# G
5 u$ [' H" [7 W0 I9 A
Here is one example from the file "Haspinst.exe" which is the dongle HASP
: ]& z7 O: J  d+ mEnvelope utility use to protect DOS applications:* {, n# f: `. F4 C. `
8 I4 C9 v4 `9 t- B0 m/ m
. z2 u! v- v/ s: a
4C19:0095   MOV    AX,0911  ; execute command.8 g. ~( H/ u2 x' ^8 Q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." U( m; e' h, H7 I0 a
4C19:009A   MOV    SI,4647  ; 1st magic value.
9 O, X- c% o2 R+ `4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; B$ a3 C5 t4 T/ i. h' l4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' }4 {2 }, d+ J3 P# i( v3 A# i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 j; ^  i1 |8 r0 d4C19:00A4   INC    CX: C0 @! C4 u4 B6 K
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute4 o, T& w) O9 o. i6 W9 M% w) I. f: a
4C19:00A8   JB     0095     ; 6 different commands.  N$ J8 u* p# i
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
( |9 n+ X; ~# Q7 M  P* z+ S4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)* f% [# Y/ v+ ~0 r

, [- ^9 }! [+ s" U. _; o) `The program will execute 6 different SIce commands located at ds:dx, which. j0 g1 E* ]# a5 G/ |0 ^
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% R9 L6 \  Q- `( Z  s% D: T/ D( Z+ C8 V9 Z  t3 d! @. r, J6 w
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' W$ o3 A3 b: Z# \___________________________________________________________________________
) k0 D/ `& K5 a
! u3 Q( {) u; g$ n0 s8 `* f* l- ~% L- {4 o
Method 03
$ Q/ I) s1 V8 f) N=========7 G* n, v" {$ U( J; a9 p, s. {( v: x( L5 [

7 ~' z5 U7 S5 v, }: d# b' E/ ZLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& P; d  l3 m+ I3 A+ R(API Get entry point)
8 u- E+ Z9 X8 V        
  Y. d- Q$ X" h1 E& z8 i) J  c5 F6 z8 w, ?4 H4 ^) Y
    xor     di,di+ |& b  ^: A  T9 M% V$ i. f$ {3 V
    mov     es,di( r2 y1 S! F; P" B
    mov     ax, 1684h      
# z: ?4 i  v) ^    mov     bx, 0202h       ; VxD ID of winice# c% r6 t( E( K7 z& L
    int     2Fh
, C5 g% X1 X: S7 D' b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 I2 @; z3 K' S8 i    add     ax, di% ?3 Z, o2 }  ^% W) y& U8 A- e
    test    ax,ax: K# Y& Q# W: ]# r" D
    jnz     SoftICE_Detected
# J* q' ~! d% H1 _! ?. H, F8 F9 u! \4 n6 l7 g& e
___________________________________________________________________________1 \+ E, P, b+ J

- \! @$ w5 F1 O8 m& m/ ~Method 04
  Q' f$ U& L4 o; L- m( y4 Z=========0 F; ]& u. b8 {4 Z

; G/ C6 {" d4 E0 QMethod identical to the preceding one except that it seeks the ID of SoftICE
7 {( I# o' K/ w% P, @/ S! P8 w. eGFX VxD.
9 L; {1 _& G* G" G. d. M
" x/ N7 g6 u) y( E* y    xor     di,di
+ Z3 }5 x+ I4 S$ Y, U& A- W% z    mov     es,di
+ s0 D8 R3 |: n* o3 \4 d" N+ K    mov     ax, 1684h      
, a4 C& P* B( w) I    mov     bx, 7a5Fh       ; VxD ID of SIWVID- X1 u- f9 h% Z1 K9 T7 e
    int     2fh
) E! B" H3 X1 R5 q$ i& @% B    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& [) `7 P$ E* N2 @- w! d2 q    add     ax, di7 @4 ^' c6 E& `1 s! c
    test    ax,ax
' K# W' [3 c! M( @& {    jnz     SoftICE_Detected6 }: e, F( y9 m# z0 g2 q6 G# j9 j: Z1 ^

4 T. N8 S7 @% l__________________________________________________________________________; \  M% K8 q, l

: s* T$ @1 ^! v; F
6 ?% L* F( i. v) FMethod 05
- u" A0 y1 `- z' Y$ Q6 b=========
9 M" v5 o, \% w. M
8 Q4 v/ ]+ J! ?, v+ c$ b, a: O& I, kMethod seeking the 'magic number' 0F386h returned (in ax) by all system
- G. Y; i0 d8 P8 w% W6 @" {debugger. It calls the int 41h, function 4Fh.
3 i! p8 Z8 w  L6 D5 c" XThere are several alternatives.  % H2 c- T2 X( T6 r2 p' H+ `

. f2 E' ]9 d+ z( P  l: f9 b+ f) jThe following one is the simplest:( I- i. Q8 I1 l/ v

9 ?" c- c# i: L! w4 X# p    mov     ax,4fh
% r0 F- A) L5 U4 y7 B" w+ e    int     41h
* k. w: V2 t! g) J6 @    cmp     ax, 0F386
* g& g; S$ W7 }" I% ?7 F8 M# m    jz      SoftICE_detected
5 K4 A  P$ w( Y3 |6 j; b; q
9 D9 v' Y* p8 t$ S) E' |1 I% S! l" h0 [. T
Next method as well as the following one are 2 examples from Stone's
4 L$ U/ m9 ^1 o. ^"stn-wid.zip" (www.cracking.net):
. n, m1 C4 H7 J
0 h: m2 g7 a; V6 }, P    mov     bx, cs3 G1 ?  M  w; y- p7 U2 b
    lea     dx, int41handler2! n8 ]4 h& E9 F# M3 H  Y% \
    xchg    dx, es:[41h*4]. c+ @, G$ j; g* m9 z% I
    xchg    bx, es:[41h*4+2]* [/ g- t6 p7 ?4 \' H. w
    mov     ax,4fh! r; N7 y9 ^/ N# v4 P) d
    int     41h
# o/ J4 u1 |5 }- N8 V, }& p- G    xchg    dx, es:[41h*4]
( ~& o, V. E. c; Q  i# ^  B    xchg    bx, es:[41h*4+2]
1 w6 C/ {* D/ I% _1 p    cmp     ax, 0f386h1 O, x+ c+ i6 `. u/ g$ ]9 }2 u- h+ r4 U
    jz      SoftICE_detected3 Q' E( _& n: M

- j- g" W! H8 d6 {: A. N; Cint41handler2 PROC
; l) e# @4 l8 R5 {    iret1 v5 f8 ~! c* K0 T, r" U' I) y
int41handler2 ENDP6 f- h* U' t5 r; h4 S8 a

2 M9 f, m% ^/ O- m
- }. U9 y) n6 K! ]7 __________________________________________________________________________
4 }$ j3 t' x: B' J
$ ]* {7 u# I7 }/ Z) i+ o  `% j4 J/ p7 S. o9 {3 \$ u
Method 06( W0 c! Q+ l8 E1 D
=========' u4 j: C2 u; P! p; e9 Q1 m
8 ?3 Q# f) J' i2 T. N/ t: a

8 B% f( I) U& A  p2nd method similar to the preceding one but more difficult to detect:% s# A) b5 [+ j, ^/ X

3 C2 c% x% f% `" t( Y3 u
. m% }9 Q  g% R+ C" l- qint41handler PROC2 ~# i7 q5 G% ]1 E* z; s; l4 x! ~
    mov     cl,al9 q# |8 L" {7 p1 ~" E! u+ B
    iret
3 |/ T& K- P9 P6 Iint41handler ENDP
' q3 U' o0 x+ G4 g* x' Y8 @' \0 L3 z& S) s( _* Q, f% y- ~
* f" _0 y" ^8 i" A2 P0 k" e. t/ T
    xor     ax,ax' U% V) G- `2 K8 [3 A: ?) |
    mov     es,ax
. J8 l! S+ O4 u1 t. m3 z    mov     bx, cs7 v2 h8 q) U6 P3 {* X7 L8 c- G; n
    lea     dx, int41handler
8 |5 a" Q- Y+ O) B    xchg    dx, es:[41h*4]4 u! m2 N. N5 `6 {4 C: u+ h
    xchg    bx, es:[41h*4+2]
2 C. S3 {( h0 L0 B8 Z% _4 E9 K    in      al, 40h
: N+ C  X1 Z3 D    xor     cx,cx# H0 C, V# N3 z# P, h# j, _; U
    int     41h
1 j# V- C/ {# J0 s3 a    xchg    dx, es:[41h*4]
+ _* A$ I" W1 E7 c6 z/ s* D    xchg    bx, es:[41h*4+2]" j3 |0 Z5 D6 p) {- E5 ~
    cmp     cl,al
: p2 N$ ~. e' Q* ^7 c- V    jnz     SoftICE_detected
  L% L& r  D5 F: s' k# H% L1 h0 h; f0 P3 J) h! D
_________________________________________________________________________
( k0 n' C1 Q0 t$ j: }) Y3 \/ ]8 U9 P4 |) a" k5 e
Method 07
$ M9 ?! l) m9 W: c  A; g. L=========: v% h8 Y) ^! N; c/ K$ B4 \6 N& x) {

9 Q' F! _8 h2 ?! T1 DMethod of detection of the WinICE handler in the int68h (V86)
9 Y' {$ h- a8 w5 n$ G% Q5 H9 [# x# H2 K+ f9 l, @5 S
    mov     ah,43h
6 D! U8 H* G% Q4 D" B6 L    int     68h
. ~) X7 M5 C! x    cmp     ax,0F386h
1 ~9 N7 {; i) k6 i    jz      SoftICE_Detected
0 M) ?: W+ S% Q7 @- ?* w3 y! z, W5 p& I

3 y$ n2 T* U9 j. _* K=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit. \. X$ f' D- s" u
   app like this:
& e5 ~/ J  ]+ i( z1 ]9 }8 `% U
* E' I- m* a1 ~& C7 ^. ]   BPX exec_int if ax==68
% R! K8 G. C2 E4 d   (function called is located at byte ptr [ebp+1Dh] and client eip is
) M  P2 ]5 M6 O& h   located at [ebp+48h] for 32Bit apps)
1 y4 {- D4 F9 y# M2 N! s5 P; b__________________________________________________________________________
: Q! i/ t% X/ u- A" i5 O7 q
. x- Z* |, c0 e
) V% N! U( S* lMethod 081 b" W$ T0 Q6 C6 p3 G0 d6 c
=========
1 o+ ]# h4 F& G. ~' ~2 }* U, V2 d* j3 S& q: j1 e9 }! X9 f
It is not a method of detection of SoftICE but a possibility to crash the  S& O. S3 Z8 i7 d- v. F0 \9 U2 o6 N
system by intercepting int 01h and int 03h and redirecting them to another
: x  e( }+ @5 ~# b  jroutine.7 W( K7 M& x+ G9 d/ L# _" l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 K# u7 V8 ]9 G" Wto the new routine to execute (hangs computer...)
- p3 e) D! s8 x/ l7 l- Q
( b& }" a8 M% _% e0 `    mov     ah, 25h
+ {: Q, v+ ?: `( D, R    mov     al, Int_Number (01h or 03h)
. G# j' V: e) U$ W1 T    mov     dx, offset New_Int_Routine
7 [# [# y' X% b6 m$ N4 e2 a3 A    int     21h8 t$ Q4 m# ~5 [0 g/ B0 w2 W
1 `$ a4 A8 t; p* [! B" V6 [1 D6 E
__________________________________________________________________________' B4 H( x- U! {" \! j; \
. v2 Y" C% S7 ]8 o7 g) i+ h
Method 09
5 D* D! H$ ~: E; M1 S  E=========
8 ~$ ^! B1 H& U+ M; Z0 G0 l
9 ^/ G! D3 H- X- Y0 eThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! i5 ]; i9 w: M! |* s: }performed in ring0 (VxD or a ring3 app using the VxdCall).0 z: Q' O4 y, }+ V+ e
The Get_DDB service is used to determine whether or not a VxD is installed
, u0 J( g4 R' q& d# ~* Jfor the specified device and returns a Device Description Block (in ecx) for
* l3 w, {2 k! |  A% s) jthat device if it is installed.
2 u5 _9 e! B& A' P8 y+ D, E$ m1 {! F" w  g
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- y0 E: T; p) \& w6 K! }; X   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)) E0 W3 v8 f: b
   VMMCall Get_DDB- h2 g( U: y$ X- Q& V5 N
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
% e9 J; }; j6 m) v' a; ]$ D" B6 L* O( ~0 c8 n! Z
Note as well that you can easily detect this method with SoftICE:7 p8 c( g! b; D8 q2 R# |" t
   bpx Get_DDB if ax==0202 || ax==7a5fh8 ]9 U* e, ?, @& ]8 I

1 [- e  E9 I& |; H" W3 P3 l  g3 K( b! l__________________________________________________________________________
4 K9 J% w+ J; ?* `+ B) t, ~
# j. F( ~8 Q, q7 UMethod 10
( B, E2 v$ L! `3 m=========4 Y; d' b2 L2 V( t# ]# c( W0 T

. ?, C, G( F0 I/ h1 G. G=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ S9 R& b- x- }# U6 [5 ~  SoftICE while the option is enable!!! m5 X; `; M  r: O, N4 ~- `8 A4 W

4 a$ [1 b, q/ z# @# C; m% u) i+ i8 fThis trick is very efficient:
, l, D; Y: G3 W  Uby checking the Debug Registers, you can detect if SoftICE is loaded( U& F2 u! _$ G9 \" f" `1 W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* \- v3 h8 v- `4 b8 ]4 [3 @there are some memory breakpoints set (dr0 to dr3) simply by reading their
* x% }" [9 X* f. |; g' s# A  dvalue (in ring0 only). Values can be manipulated and or changed as well5 ~# H8 Q: F! p1 z9 L  E' w
(clearing BPMs for instance)# g5 J" \# M6 ]( ^: G
0 _+ x' E+ A! y1 ^# ]
__________________________________________________________________________
! d9 q$ E( g7 G7 R, h0 Z* t: Y
4 V- v% [3 ?# {* C2 i7 I4 ^, `5 ~, j% QMethod 11
4 F- C: p! ]8 e& J3 O" y4 h=========
& z" Q4 \/ v; K" V% O
7 ~/ U. B* T1 }$ J. o* ZThis method is most known as 'MeltICE' because it has been freely distributed4 V' _8 l) s! O. u
via www.winfiles.com. However it was first used by NuMega people to allow) ~& x/ ]! M" u. f) Y! G' t
Symbol Loader to check if SoftICE was active or not (the code is located
+ D/ F8 G2 X/ w  d; Uinside nmtrans.dll).- _% ^& e( F5 b8 ^$ C
  Q6 y+ i; O, I
The way it works is very simple:
9 ?" `7 L( @5 W" y( b7 HIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for$ q7 [% _3 s+ N! n
WinNT) with the CreateFileA API.
# T- ^5 Q% B- N) b) D% j. k) W: b% Z6 e/ S1 ~7 Y7 g- l& f
Here is a sample (checking for 'SICE'):
3 I8 f6 e. p% K/ I. j0 B( _/ i: ~6 I; L* Z5 H/ {2 t" r
BOOL IsSoftIce95Loaded()
  y" c! o+ M! R0 U$ K7 I5 ^& ?{/ P) s# x2 g6 M. X4 Y1 W3 J
   HANDLE hFile;  
1 S6 H, f2 r# O& k, U+ B+ }2 y   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) u8 O0 v: n; j% s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 D# o7 t2 s( m8 c: t; |9 R' C
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( H7 s, d. I  ^. D0 N
   if( hFile != INVALID_HANDLE_VALUE )- N# @! {" ~- Z  i
   {/ {4 ?' w5 b9 I- W' g8 Y7 F
      CloseHandle(hFile);
$ m5 S1 t7 K7 x$ ]5 W1 |" Z      return TRUE;0 t* O1 Y; @- y+ S1 T" L
   }
! T- S  h1 S- X' m. J, @5 y   return FALSE;' f/ Y  ]2 m8 B, w+ ^7 A, y( r; V
}
, F* k" a8 e8 }7 v6 K+ s; h
  w! [$ T- `9 W* l: Q7 h3 m* WAlthough this trick calls the CreateFileA function, don't even expect to be
2 v. h, X" |$ V8 o* v* Aable to intercept it by installing a IFS hook: it will not work, no way!
6 w8 v! Q( q9 p; S* |# P! C0 A9 l1 RIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
* A7 {& \4 y/ a% Wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 F+ H. z% Y" H5 U& C. Z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc1 w* @4 R; ^2 d8 t
field., i  N# m9 y1 ~* s; r
In fact, its purpose is not to load/unload VxDs but only to send a
* `/ Z" Z, E+ H# {W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 R, f7 m- J- q0 C+ K) y* b
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" j9 i$ J1 r: D: I( t/ Dto load/unload a non-dynamically loadable driver such as SoftICE ;-).
: t0 a& {' D- o/ t+ k( k5 |8 KIf the VxD is loaded, it will always clear eax and the Carry flag to allow
0 d& z6 x; `! d. L- y% b4 {its handle to be opened and then, will be detected.
' u$ ?; G" l) F3 d- g. ?You can check that simply by hooking Winice.exe control proc entry point: j5 P$ T- T% z" D, a7 Q
while running MeltICE.
$ W" G6 Z: a" e
( c3 ]: ?8 {: d3 Z" ]
4 ?. D  i0 k0 i/ t, u  00401067:  push      00402025    ; \\.\SICE
* R& a" p9 Q5 q* g+ J  0040106C:  call      CreateFileA
# A& K; R2 o0 I* m  00401071:  cmp       eax,-001
4 [6 u: P$ ^1 L' U# K2 w! E* X- C$ o  00401074:  je        004010916 A% V7 G" w' n; W

4 y5 j( b! P' q' c- x: F
* F" P4 n# h% W4 I& c# V6 jThere could be hundreds of BPX you could use to detect this trick.# [. V) B8 D  y
-The most classical one is:
7 [1 {0 J" g/ n% u7 @, ]# s* X  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ [! M, ~6 \9 j" F6 c# z6 ~    *(esp-&gt;4+4)=='NTIC'
1 }0 `4 v5 T" D, f/ {4 C" d- n1 d& Z8 N! ?! [, b
-The most exotic ones (could be very slooooow :-(
: E+ R& d) B) m3 O* v   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( ]3 I. a& J/ T: }5 D) E
     ;will break 3 times :-(" Y) p$ [1 R5 @* A3 B1 B  Q! r

" M% X0 o1 T- y' P% U: D-or (a bit) faster: $ r! p! y6 t; s5 B
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 ]4 z/ ?+ Z1 `5 r; s% T
0 v% L6 \; a3 N   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  " Y+ e% v. k) ^5 S) P. {
     ;will break 3 times :-(' n! U, B6 o; {3 e: m

9 L4 O# j4 s7 n* R-Much faster:9 X( k, B! o2 S" h" M1 K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; g3 B' [+ m) N/ W! v! p
* B, ^1 I/ m. i; o- p7 S3 `# JNote also that some programs (like AZPR3.00) use de old 16-bit _lopen1 i9 Z6 t! O' I* f
function to do the same job:# v: O1 q: g* s# g

8 Q5 [" s. A3 ?+ H1 P   push    00                        ; OF_READ
6 T: m  r1 F1 G9 i   mov     eax,[00656634]            ; '\\.\SICE',0
# S; O7 ~6 Q, L+ L4 s9 w/ Q# T   push    eax
" {3 d( t( L( }3 i   call    KERNEL32!_lopen
7 z3 t$ F2 P, ?" Q  Y   inc     eax  H  H% ?9 A3 l% i7 b
   jnz     00650589                  ; detected2 j. h; _) t  L: Y
   push    00                        ; OF_READ
0 j5 L4 Z7 w, x/ r   mov     eax,[00656638]            ; '\\.\SICE'
9 [+ G& ]2 ]' O   push    eax5 ?% }$ o5 r5 e0 ?5 K
   call    KERNEL32!_lopen; [: B! S# j9 S3 W8 H9 W
   inc     eax- k% d( _/ J2 f( ^
   jz      006505ae                  ; not detected
3 c) P/ D! W, z5 B# U/ Y* ?% E+ E. `) p& X" U% B

5 ]; x4 P2 \& W/ ]2 O3 D+ p" o__________________________________________________________________________  H; }0 T. b4 \6 X* V# J

8 y% v5 ~* z6 a1 TMethod 12
; T, F2 z" j5 X: f# `, H( }! N0 k=========2 F: h8 B4 _( H: d/ T& C
, [) K5 z& f7 Z
This trick is similar to int41h/4fh Debugger installation check (code 05
) n* w5 ]# [4 v&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 q' ^( a" C# u% B8 ]as it uses the VxDCall backdoor. This detection was found in Bleem Demo.0 u/ ~* Y) E/ S

- ^" b; I: w. G' L0 I2 L$ e   push  0000004fh         ; function 4fh
4 _; b) x( N) e9 F6 E. E   push  002a002ah         ; high word specifies which VxD (VWIN32)
7 I' A* i% C* B& N: [! j- g                           ; low word specifies which service
! n5 B* l2 S) W0 u2 k' H9 ~                             (VWIN32_Int41Dispatch), k; `3 f) n' \) _3 U3 U) t( G" f, f
   call  Kernel32!ORD_001  ; VxdCall- M' f" ~4 k6 o1 q  j$ Q
   cmp   ax, 0f386h        ; magic number returned by system debuggers
- W& A# Q3 c) [/ Y8 E6 u. b   jz    SoftICE_detected
, \+ L) K. U0 ~2 J$ N. ^2 l% v( K. M+ T. y5 A8 r
Here again, several ways to detect it:" A8 x8 g: V$ v8 ~

4 w  }/ z; N0 N3 h6 c    BPINT 41 if ax==4f
1 y, d8 K" D! Y! j$ D7 F' T( Z" }0 |" g6 B3 ~! O# p" q7 C' s
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 }9 a- v" ~0 b5 b4 I
2 f$ O+ E0 L3 V: w4 {    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 _4 B- E7 t0 N

; \$ k8 Y0 F/ j8 [* l; O" t    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
  W5 y4 X  ~* \1 o) c' b' Y) z! l2 J4 D+ f  `* @7 K8 ?; q
__________________________________________________________________________  m& H$ Q  V9 L" d

$ }0 E4 i" H  w% Z" sMethod 13
/ A1 ^" s9 S& e. f2 _=========
# T2 E, X" a) `+ q: h( x& k
* ]7 }+ a! S8 E! i/ s% FNot a real method of detection, but a good way to know if SoftICE is
  ]* u8 X. \6 v, W( n$ z1 ]: [installed on a computer and to locate its installation directory.% X3 Y6 h& T1 q* g; U7 |
It is used by few softs which access the following registry keys (usually #2) :% K9 V; @/ w3 X6 O& R8 [
& @; w* j3 _  `: R
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; Y* M/ E+ z. p" g; \% n
\Uninstall\SoftICE
5 N+ Q# ]4 Q7 G2 K& `- v* r-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
) B1 A# P1 z/ K4 E% X; e  R% `1 ?$ `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' M) k, x. P3 k% L0 J
\App Paths\Loader32.Exe
# b, k5 h2 j( G$ O) W
8 E4 A) ?: f( i9 ]5 |! n! v. g2 j1 ]5 \7 p
Note that some nasty apps could then erase all files from SoftICE directory
/ v$ v, y  A5 \$ A" \  @+ x(I faced that once :-(2 R7 L- W2 |1 e, a8 g7 f
7 W  H7 M0 B- m: d
Useful breakpoint to detect it:
9 P* G# w, T$ J, T+ q2 f2 R
& c/ }- R$ _5 Q1 @% [( M3 f     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; `9 z9 W% l# W2 ?) G5 k1 l2 Z
8 c7 @% ]  [; i: O4 W
__________________________________________________________________________
/ X5 A4 D: B. i
% L. [, W+ A0 T) q' A$ R6 c0 {! c
Method 14
6 h( i7 a- ~1 F% m=========
" D1 o! ~! V" K3 |9 Z. J. `4 X
% {& Z! k" f; G+ sA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! v$ y$ P; F" w1 x) [( P
is to determines whether a debugger is running on your system (ring0 only).
7 R0 d; ?+ W' _6 U( q/ C% u! D& m* c
   VMMCall Test_Debug_Installed  D+ X0 ]) \2 s7 m, o% j% W
   je      not_installed( S7 l# ^: T# X. ?- P
5 n7 P) n! @) C
This service just checks a flag.
/ [1 R4 r0 A5 t; y  y1 V' n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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