About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 s) m( t6 w9 o! t/ Y
<TBODY>) H! j+ v  S5 c5 |( ~& N2 O! F! ~
<TR>
# l0 j6 R! Y( z1 E& A<TD><PRE>Method 01 : Y6 P' }8 Y0 P. K8 b
=========
5 C( n! B6 z: @5 \3 P& i' [: Z* e4 k2 l6 p( f; C
This method of detection of SoftICE (as well as the following one) is
: t/ m* x! Z9 k; Iused by the majority of packers/encryptors found on Internet.+ s' |1 G' s' e/ }$ z" K6 }
It seeks the signature of BoundsChecker in SoftICE
  ~. v- ^% `. I, a7 w# Y/ \  x
+ l; l1 i+ h8 B. h; i: [# S" S    mov     ebp, 04243484Bh        ; 'BCHK'  [& _- D% |7 G6 h; d9 h" ~, y
    mov     ax, 04h
- r8 I8 x, }. @% ]    int     3      
) S+ r) r4 k4 S3 t$ t; I    cmp     al,4
* q% ]0 I4 d; J    jnz     SoftICE_Detected* ]7 E7 G1 z/ [- N4 T
* d3 \9 \/ u5 b" B+ N& q7 S% m
___________________________________________________________________________" X5 o+ `# H8 ]: ?& h

; a1 {8 S9 i) t  C' f# FMethod 027 l0 w- Y. G$ x# @
=========
& f7 H, K! R8 @7 f3 p' \" w! N& `
Still a method very much used (perhaps the most frequent one).  It is used9 }* |) L' ^9 i9 Q1 w
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ Y! ]8 {# j, U9 j! c+ a- qor execute SoftICE commands...2 H( ]+ ]; F* F/ `
It is also used to crash SoftICE and to force it to execute any commands
* |" D: t  t" @(HBOOT...) :-((  
! ]: J. h5 @! |5 y, H& G+ |4 t. I' \; U- j4 J8 ^6 K5 R# ~2 B
Here is a quick description:
8 V2 S6 }" Q4 [2 a' j6 b-AX = 0910h   (Display string in SIce windows)$ a& Z" r. ^% r1 d
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)2 k. ?% E1 s; T4 {4 Q9 C% A9 d. m" X7 v% y
-AX = 0912h   (Get breakpoint infos)
  R! q. V8 [7 q7 U  M0 z+ E% N-AX = 0913h   (Set Sice breakpoints)- A5 l! C% W! s2 {
-AX = 0914h   (Remove SIce breakoints)) e$ c/ V' c: o/ ]

, x2 N, Q6 J# U/ m9 `- REach time you'll meet this trick, you'll see:
* g, ^. H+ I$ G( O5 ^-SI = 4647h$ F# m6 B6 K$ X
-DI = 4A4Dh
  Q8 k& P& ?9 U* Q* yWhich are the 'magic values' used by SoftIce.
( g! u* E  q4 T/ iFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ X3 {1 c9 L% q: u

1 S' r' S# c1 [$ K1 C' `; {. D3 fHere is one example from the file "Haspinst.exe" which is the dongle HASP& `5 y# l% {) s  _7 E4 I
Envelope utility use to protect DOS applications:- y# d+ S; T( I: {6 D4 X2 W
! }3 Z0 F9 }  `0 L: i2 W+ h( {8 k: r

9 o0 z! E" y: A4C19:0095   MOV    AX,0911  ; execute command.( [' s. {  |6 b/ U- L8 U, N  c( x1 e
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
( d) h) V  x5 k9 [; z4C19:009A   MOV    SI,4647  ; 1st magic value.
, I7 t# c5 \5 Y' k, B% C7 p4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 S: }3 c! y0 S* {
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 |  W' F5 T9 w/ p
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( `  u9 V! k6 F! r5 u8 S
4C19:00A4   INC    CX
# e% J! i0 O7 H3 Q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute& c7 |' K9 p' h5 r
4C19:00A8   JB     0095     ; 6 different commands.
+ O0 Q1 @' j) N4 d$ x4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 D7 s+ X4 y) u' n/ Q) s, a4 h
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, X1 t- x; |/ A, ], L2 o( }: Y& n6 T6 d/ x' F4 \2 i- |; \/ M
The program will execute 6 different SIce commands located at ds:dx, which
3 e9 V+ w' I8 r, C0 ~8 g8 e' Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  P. N" j* A6 N. ~0 }4 H; {; k! e5 C% @0 [3 ~$ I
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." B) a' H) R" v5 s' M1 x
___________________________________________________________________________
9 V, L  c2 e3 r( j2 Y& ?; Z; R) f: z! j/ J6 b, G

  g2 M5 m4 P+ }1 S" T& |) U3 |Method 03
8 Q! N/ e1 ?, A7 F' ~  U7 V=========- k, N% O$ K# B- Z+ D

( J# V" c- F5 y  e- BLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  U! W1 V, R* u  G) P
(API Get entry point)
5 `' ?% g( z; A  n        
- q0 N* s: s# q/ W+ W& M) I
/ S0 r* v1 Z( D3 `1 @/ z    xor     di,di
4 T$ p3 c0 F  ?4 A4 e  ^    mov     es,di7 m# ^: _) I0 |( c0 P
    mov     ax, 1684h       3 b3 A  j  L5 j. f9 j' E
    mov     bx, 0202h       ; VxD ID of winice) c0 K  T! J" d3 \6 }/ M
    int     2Fh4 d2 O! E' o4 ]; r! T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 W" V2 N9 _$ G* Z
    add     ax, di
1 m7 v/ p& Y/ X- ?1 G0 w7 m    test    ax,ax7 w1 K5 j, n" A( v) W
    jnz     SoftICE_Detected
0 K8 B8 I: T" U4 X  R" X7 l
! a2 j0 t% o" D+ C___________________________________________________________________________- \: g: |" e4 n9 Y5 X4 K1 n! W9 `

$ O! k( S1 S4 ~Method 04
% G" t$ j! Z( w8 e/ G( l/ h=========
7 w1 A  {9 M, I  A# q$ }
$ e7 C" N6 [8 P! _" }6 g3 H1 oMethod identical to the preceding one except that it seeks the ID of SoftICE
( v" l8 T8 |0 M; w+ \2 uGFX VxD.) o. S  U4 j+ i7 W+ w' x0 }& x  v: x) p

. d1 Q9 o( O9 a    xor     di,di3 e  h' x0 ~+ U  l. ?: _; b! S
    mov     es,di
6 I: c0 _* S& C+ P& X    mov     ax, 1684h       0 p- I( `. Y! B% P
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  D5 S0 B' n& s+ H* ~0 i    int     2fh& M' k& ?, C) z) P6 |" _6 W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' ?# j$ ?+ W  j/ g
    add     ax, di
8 P: s% m1 a) w, \    test    ax,ax
0 g3 v3 [. e- W' W( `    jnz     SoftICE_Detected
" \: `$ y5 I1 G) v7 [0 u3 p0 i( w6 v' O1 g- c2 v
__________________________________________________________________________
4 j% Y! z% M7 M4 e- f% s" ^5 R) i! ]' J& m6 l2 d

5 f& P7 y( l% J! Q! ?; j& ~Method 05
+ U3 V* X! s. }- P=========
2 a* T0 }1 ?- g: j3 a/ x. h( f# v7 |: y. x6 z+ p/ y
Method seeking the 'magic number' 0F386h returned (in ax) by all system: n$ u( y, e% s* G
debugger. It calls the int 41h, function 4Fh.
6 p* _5 g" r8 Y7 J2 y( O4 i; z9 FThere are several alternatives.  
1 r* B: X# T/ M. G+ A8 d1 r$ u. m, S: X1 r  D, b
The following one is the simplest:
! I" m. q2 T& F9 b6 r4 c- \! Q- M  s0 |8 [% r4 f  m' a6 t
    mov     ax,4fh& o# [3 O, L  t  x7 k7 u
    int     41h. ^% u$ ~/ t/ r
    cmp     ax, 0F386
* c( {+ L1 h% W    jz      SoftICE_detected1 c7 i  y* P! M# W. _1 y, O

+ O) q/ o  Q& [8 X" O; C7 V' z- g) o. q" c$ E
Next method as well as the following one are 2 examples from Stone's 9 K# y9 c; t+ h5 I; b" p; O
"stn-wid.zip" (www.cracking.net):5 Q1 m6 M( h9 N
( G$ H/ l, m  H3 }
    mov     bx, cs! i, B3 @: E! P7 x+ i( Q0 a9 F
    lea     dx, int41handler2* |0 O  }7 Y- r
    xchg    dx, es:[41h*4]
: H+ ~- f( S% P3 ?4 L" }    xchg    bx, es:[41h*4+2]
. b& j# l& h) C9 v5 d5 w, R  Q    mov     ax,4fh% G0 S( u% h; }  {( C  ~% m6 r* V
    int     41h) `. G/ `# a$ q7 Y( k- X
    xchg    dx, es:[41h*4]
8 B+ W  u9 a3 d  B' E, ?    xchg    bx, es:[41h*4+2]3 U2 I8 B! G2 ?+ g: d
    cmp     ax, 0f386h
& Q2 A) j3 _& v/ u( O2 i( b    jz      SoftICE_detected5 `% K' f) l& X  B2 B% u! J

, }6 G9 F) X5 X/ P' r- E$ {int41handler2 PROC
3 l% v' P  q# U4 w9 T    iret0 I8 p+ x4 N# o0 x
int41handler2 ENDP* K  Q" N! t- p  ?! G$ o2 |  U1 b
2 u) e4 s- {+ n+ w# L, l+ D
; q' I- [, E2 f2 q2 c3 {) ~0 l
_________________________________________________________________________
* h. ~) U. f) k) f) K
" t  M, o+ V% P1 X% F5 k
1 c* G# t) o  G; yMethod 06
8 M+ L5 y3 p% r; K5 s4 V=========, Y8 g4 j4 g, M; d: q& w3 K

1 c) R, P$ e; k( A$ K; t4 g- N1 h/ F$ Z& `7 Z$ s! L
2nd method similar to the preceding one but more difficult to detect:
; `9 R: r3 S9 I9 F
3 m7 ?% w: Q# i: ]% O  ^
! E0 b7 o1 A- a) bint41handler PROC  L" z, G8 j5 N, u
    mov     cl,al
# o5 F1 J+ p" Z1 L2 ^/ q    iret
. N. n% E: i9 l3 O2 aint41handler ENDP
. }" K# Y( S6 r6 I
7 K/ L1 h$ b7 B! P% @( e
* `+ B/ W6 ]2 W% x" R  u    xor     ax,ax
' g7 m, y2 N: N( X9 o( \8 a1 p    mov     es,ax
+ j3 l7 H7 i7 E6 g  Q  _6 `% c1 c; n    mov     bx, cs4 ]+ {: y& F/ P8 c6 K+ j
    lea     dx, int41handler
, g+ }+ ]' f) l, b- T    xchg    dx, es:[41h*4]
$ T6 V( ~  |+ y1 G- J    xchg    bx, es:[41h*4+2]
% b( X1 R& ~( r- T    in      al, 40h  ^* ^' z( Y3 @, i' Z8 H! D
    xor     cx,cx
, U0 i5 J# i% c+ F& T; R/ n* F6 `    int     41h
0 {! z, y7 m1 H! ], T1 O3 M: r    xchg    dx, es:[41h*4]% P- T4 k% h9 N) l
    xchg    bx, es:[41h*4+2]4 }5 U, W/ O; V/ A1 x% r
    cmp     cl,al" h+ N7 j5 z0 M' X" d
    jnz     SoftICE_detected
, Z- [3 L; K0 e$ ?5 y
% ]- Z4 n- K8 W_________________________________________________________________________
1 S: M8 b/ c. I
4 N; Q8 X4 {4 g! F/ JMethod 07
4 q- Y# H2 p" u. W! x) ^/ y& f! R=========
4 p- \" t" ]  v4 H0 G* ]4 N
7 P" r' v  V% ^* L+ [. \Method of detection of the WinICE handler in the int68h (V86)
6 s* |; c: w$ G! G/ E) h) P/ C
) z+ M( ^/ s: d, ]) \+ G    mov     ah,43h
1 @7 k  P" S8 b! |$ t( \. \    int     68h
* N* Z" B9 L( u- B. [! m+ p    cmp     ax,0F386h9 _9 R- f, w& S7 T
    jz      SoftICE_Detected1 x2 a0 {+ K- B1 G  ]' L+ D

4 [! e  w9 s3 i  F& e+ o
+ v% p0 K* B2 p5 d" X; e=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ d1 m% U! o: f) ~# R. u, l# B
   app like this:
0 D. ?8 M5 O$ m' t# e* z: i1 q- [6 }9 r! R: B) u
   BPX exec_int if ax==68* f- s( z" @$ r& z: z9 j2 q
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 W7 u+ x3 T5 K! i; a# D
   located at [ebp+48h] for 32Bit apps)
! g) E+ w( Y1 H) d6 J+ G# f* l__________________________________________________________________________/ J8 r5 ~, W3 h* X0 i
  x; c, B3 N# e/ }/ l$ c6 X

3 v" ?! F. e5 `' I& k4 fMethod 08
6 P! B  q1 F7 O# f0 b8 R=========
; A) w6 U' f' ~9 m: ]8 Q) |
) \) G  K! d' Q1 A! n% yIt is not a method of detection of SoftICE but a possibility to crash the
" S, r9 I% o; G+ s+ Ysystem by intercepting int 01h and int 03h and redirecting them to another
+ Q' u; x# }0 g# nroutine.6 _7 M0 }% u/ Q6 M' F$ a  }6 K
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ f6 m' v9 p4 T3 I: P6 E" a
to the new routine to execute (hangs computer...)( ^; O* Z- C5 k7 {) P  ?

% B' t# ^; a2 ?# a  k    mov     ah, 25h2 I1 x5 S5 q1 l2 Y! u$ |
    mov     al, Int_Number (01h or 03h)- ^4 h0 R7 v3 m( M9 k; M/ H
    mov     dx, offset New_Int_Routine
; \& W  G5 d- B$ G& P    int     21h5 ?( L3 R% H9 c; f" b+ o) g+ Q

" _  V* H: z- q  @8 B__________________________________________________________________________3 \! n% }! h! P. a# v5 g3 E% K
7 O, Z9 V' v& g# Q
Method 09
2 H& K8 O% f% u. [8 j! ]=========# j5 }$ [& |8 ]. L* M
( O2 S3 B! k0 h; W
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 Z* l% n, n8 m. B
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 A# v/ B  R- V- H& C/ gThe Get_DDB service is used to determine whether or not a VxD is installed
1 ~. |0 j# S+ n1 v. Z  h: pfor the specified device and returns a Device Description Block (in ecx) for
; K6 Z/ d# E1 a5 F4 d* g5 o% Nthat device if it is installed.
- C2 n# S( n4 b2 U
% U9 t" f- Q% v" ~   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 ~) D' ]4 V  N5 g7 U   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' N% j' h" P; O+ h- O2 [1 d   VMMCall Get_DDB( C! e; b! L" e! n
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 C+ |8 i. ^0 ^1 B. i' V8 {
( U9 s6 L- Z7 [
Note as well that you can easily detect this method with SoftICE:4 \5 H+ s/ U: ?' ]6 T: g$ d
   bpx Get_DDB if ax==0202 || ax==7a5fh
+ k8 s: u! S9 M/ q0 B- @! m( M+ l; J- J" H
__________________________________________________________________________
+ D' \5 W: ]7 b& R& z$ t6 o+ q4 u5 M) @' ~+ z, n
Method 10- m* [  [3 {' Q. T- X3 {
=========
/ ]# j& m2 @1 `$ C" R, |
: F6 q9 L, B& A7 [. b5 Y=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, C# H% E1 U4 q( W8 D8 ~8 r
  SoftICE while the option is enable!!, p! M5 C' d% c6 n1 V. r

0 G6 I, z) ?! A) j6 E" DThis trick is very efficient:! a9 B7 f. U) C  y
by checking the Debug Registers, you can detect if SoftICE is loaded
$ W- C3 ~# d9 a7 a2 N# _(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% e, y3 I& H: o0 t* U% E
there are some memory breakpoints set (dr0 to dr3) simply by reading their( t9 c% w6 _' v5 U+ U# Z6 Q
value (in ring0 only). Values can be manipulated and or changed as well
9 i! u5 P5 S7 l: k; Z9 G( r5 j/ L(clearing BPMs for instance)3 c( K4 b$ C( V5 [
* V9 o9 K9 D. W* \% X0 d, I1 s* M
__________________________________________________________________________
; Y0 `- e+ B- B
) q8 L# \" ^% w4 i, GMethod 11
1 A0 p: t4 t) k) w$ ~) ~=========
8 a) n) j8 \5 V1 ]/ K! I5 {2 O) R; W4 O5 i% u
This method is most known as 'MeltICE' because it has been freely distributed) C% W1 x0 g, v! U4 a- Q# r1 l6 {
via www.winfiles.com. However it was first used by NuMega people to allow
; }+ k3 h- G, \3 q: B0 K1 ESymbol Loader to check if SoftICE was active or not (the code is located
4 S# i# y3 B% w4 u+ @inside nmtrans.dll).2 F2 j, }: F( y" c9 T
" r/ K6 }! Y8 q: h/ ~7 L& k0 K
The way it works is very simple:
- }+ v0 ~7 X5 \( t9 R$ o: nIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) v% b) f8 p9 h! U+ R
WinNT) with the CreateFileA API.1 w, i; r6 N# W
0 M7 Q! s0 V$ l, h- ^+ T
Here is a sample (checking for 'SICE'):! J. R1 E8 X& G2 _9 X* \

$ i! q) j" v0 ^  W/ ^; dBOOL IsSoftIce95Loaded(): ^. e2 E% B) [) ^0 V. U6 q) a
{
8 ?- V0 F5 i6 m" l# ^   HANDLE hFile;  
3 y( ?* W" o' Y6 k' D$ H   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
8 P0 X( G% d- I% E; ^                      FILE_SHARE_READ | FILE_SHARE_WRITE,& Q1 P/ X" A" G9 j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);" V5 Q4 {$ P3 J, r( ~6 a& ~- b
   if( hFile != INVALID_HANDLE_VALUE )
. m( [9 b2 i9 u4 Q6 `/ u   {
# b& c5 U' {$ o9 H" r      CloseHandle(hFile);2 z% _3 K; Z! b3 A0 t
      return TRUE;- A! Y% K8 o6 G$ ^5 ^
   }
0 A+ S. c) q  q) W' ~# l& {, E3 Q   return FALSE;( q9 P# B9 C- m# ], y8 ~. h
}" C' H. a$ g8 P( m' M1 h; q' t! E
: j( {. H1 j2 L' Q3 h1 @/ _
Although this trick calls the CreateFileA function, don't even expect to be* L( @- Y8 f0 J, @8 C: r
able to intercept it by installing a IFS hook: it will not work, no way!
) R4 y, l5 C7 _In fact, after the call to CreateFileA it will get through VWIN32 0x001F
" ]4 h1 k2 S+ m$ ^( Dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 i/ C' B6 h& D/ n" d( M. h1 x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
# V. t) R# n  Z! l1 H' pfield.
; N7 {9 o) J7 \9 H1 y) H8 u+ Y, i; ^0 t5 aIn fact, its purpose is not to load/unload VxDs but only to send a . q: e( I( L# _8 B, K
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), ~/ K4 C' W2 n0 o/ |* u' E
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- T( Y7 @0 W2 u& ]4 kto load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ {4 X3 Y0 u3 t% @5 M4 GIf the VxD is loaded, it will always clear eax and the Carry flag to allow
6 y7 `5 ^/ K1 }5 x1 P, Y8 |$ ~its handle to be opened and then, will be detected.- I5 V# F8 t  ]7 ]7 t- m& @
You can check that simply by hooking Winice.exe control proc entry point  X$ x* E8 k- q, m+ X+ \" M  o: x1 J: v
while running MeltICE.  X2 D7 z+ o' t7 v9 C9 c

7 _  E- K% u0 J7 Q3 b
  M; a. U( Y& j  00401067:  push      00402025    ; \\.\SICE
7 X9 y0 v6 Z& L0 o1 I: X) i! E  0040106C:  call      CreateFileA  t  {8 ]/ ^- W! g6 v5 N8 l0 X3 X" k
  00401071:  cmp       eax,-0015 R# n- u5 g/ Y( J; Z
  00401074:  je        00401091
8 k" \& O9 P- E' Z7 K5 j
4 f' y5 A* p3 P+ t6 m
* B) e: I$ v( \2 Q& y. v8 l! \2 wThere could be hundreds of BPX you could use to detect this trick., z/ ^* ^: W4 Q4 J& o+ ^
-The most classical one is:4 L! o; y/ P5 B- {3 ^6 o" T
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- E5 B! D$ W% m0 D
    *(esp-&gt;4+4)=='NTIC'
6 l9 z) P: t9 s  q. ~5 N
- E, S2 \& u! N2 V* x-The most exotic ones (could be very slooooow :-(" W/ h- k- c* V  G7 D; j4 A
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - P2 o- q+ l3 m8 a( H4 U
     ;will break 3 times :-(- I! P5 d- a; G" u
. L, Y0 m! a% W0 ^3 t3 U/ G
-or (a bit) faster:
# ]8 z# Y; d0 c5 L   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
* Z* [% o" o& x9 h7 l
; y5 Q# M9 W1 r/ p" q/ i  o. X8 B   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 l2 m# }2 d8 x. Z( j3 D- G: ~, W/ v     ;will break 3 times :-(
& T0 |( L* u. O3 {. \) O
; p! [' `9 C) d0 W-Much faster:
# L  t3 h! p5 u3 e* e   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 {3 U1 s# N8 a( i! ^1 V# ?& b, h1 P# O$ E
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# F& m) O$ |3 u& l& N
function to do the same job:0 T2 g1 `! j  S! u% s

2 C" ~/ W  U$ W) ]! F0 o   push    00                        ; OF_READ) z1 z1 i6 C. L
   mov     eax,[00656634]            ; '\\.\SICE',0( A9 V  i8 o& F" {, Y) r1 Q$ F' ?
   push    eax  @- O9 J# }% a, w. ~
   call    KERNEL32!_lopen
$ L4 s' }& `/ \* O9 D   inc     eax- ~) p7 G. _+ E9 N: q$ G- p
   jnz     00650589                  ; detected
- i$ |  e/ i" |: Y" b3 w   push    00                        ; OF_READ
0 K: ~/ W& |" U  S$ |+ R   mov     eax,[00656638]            ; '\\.\SICE'& |7 U$ j- o$ k+ p1 _! |
   push    eax2 F; e, y  u4 W9 Z0 q! x0 C
   call    KERNEL32!_lopen$ ~- Q5 M0 G5 u: F! D
   inc     eax
/ _1 e$ ?- ?/ [) |% P0 ^1 R( I   jz      006505ae                  ; not detected
  k2 x4 I8 T7 N% O- E+ d) t+ ^6 @( K
0 i" ]/ V3 {8 j. a7 T* ^+ Q- U: ]" Y* B) M
__________________________________________________________________________
% B/ ^9 x8 S( W! M. w* s8 R9 J. a+ g4 f+ E1 t6 L( y
Method 12
3 K7 _) J% X# w=========' a! e, C! V9 W7 J$ ]3 a& O" D

! V' A8 M7 `1 E, {; pThis trick is similar to int41h/4fh Debugger installation check (code 05
2 S. g! h0 x- r1 v8 k- x8 \&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 [7 F1 C0 H4 O% cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 B1 |+ K% j) e( S& i

# N3 B; M- ^- z   push  0000004fh         ; function 4fh6 K, N3 E2 j9 ?* E8 i0 g  z( \( q
   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 m6 j* T, N! y: Y$ s                           ; low word specifies which service+ m, J( b2 a, P( ^
                             (VWIN32_Int41Dispatch)# p& O; x' {( t4 |! `5 X& A3 [
   call  Kernel32!ORD_001  ; VxdCall
: i, B" X3 g. s   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 Z2 T8 ^) w% y( {9 a   jz    SoftICE_detected# V2 ]9 m6 C5 y4 s5 Y8 ~" V% u6 i
( D: x; r/ P, h! T* K# K. c
Here again, several ways to detect it:
1 }8 D8 y* ?* u: k4 k1 F( q5 |/ V2 a: K, r- ^( i
    BPINT 41 if ax==4f
% f/ ^8 M- m8 r  V- h% q! b* U
- R! L# W; X2 s  A3 C: L5 C5 w) l    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
9 h/ w! r7 L5 ]: f! Y" I  L8 ]1 }3 h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: b, _6 `8 \) {) p
! j+ Z; }0 R, t2 d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) v$ r' C5 h8 N9 C$ ~% ]; P) Q, r/ C
__________________________________________________________________________) s1 G6 E0 h' p- X$ u* ]: o

/ n* o1 j1 a' n5 Q# RMethod 13
4 b6 _0 r# ?& P=========: R2 V9 q  `) j0 {: D2 V
. c) q) _/ r3 o# B7 n
Not a real method of detection, but a good way to know if SoftICE is0 I; h& Z; N$ w/ e8 F2 e# H1 H
installed on a computer and to locate its installation directory.7 ]3 E8 O: d/ K6 T
It is used by few softs which access the following registry keys (usually #2) :4 @# @1 I2 p" j6 A
3 e; h7 a, G* N( U2 g9 V
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) V; y; a- ^) I) L6 s# Q\Uninstall\SoftICE
# X) T0 m: p! s, J6 t9 w& `; x-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; ~4 `3 M! n9 O% Y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ L: R4 g( `6 F$ n% |
\App Paths\Loader32.Exe5 B" k. l9 r9 l& P- V- r
8 j* [8 N& J5 {8 W% S# J

3 L/ t- w% j$ }( G: p% O' i7 oNote that some nasty apps could then erase all files from SoftICE directory* L' X! o1 _$ x
(I faced that once :-(
4 v9 D' X4 ?+ p. C. |" v
& {7 F. _6 ^9 I& s+ j$ GUseful breakpoint to detect it:$ O4 z! y6 t) @

4 y; i" O$ `6 i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% [/ A' D1 ~: H  z6 X' g8 K) }

% V" p) g, l( ]7 [7 j. N__________________________________________________________________________
2 k; D$ I/ n% Q, v) R( a
& \( \. r: e. G( i2 M& U, O
' A  b$ ]  @# A4 i" l' H! i, dMethod 14 ! k! V- n4 z% x% v% O# v) V
=========
: e5 ~: R) y9 y# C" O# @
! O' k# A0 S( n' w/ Z, t; SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ I8 M. h7 O, T; \
is to determines whether a debugger is running on your system (ring0 only).
& t4 o* c9 j! F, c, W& @
( |) B3 o& j) h/ P   VMMCall Test_Debug_Installed
8 |4 f5 c2 M: F5 t* v7 x4 n   je      not_installed0 G. h1 Y- J/ O) t3 [) E0 G) L

! X" g$ _- g6 C, JThis service just checks a flag.; B0 u- j$ L+ f' ^
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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