About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
5 X; w6 f% W' p<TBODY>; v5 C4 |) w: n7 d4 l1 [
<TR>6 G$ M: `/ X7 K% a
<TD><PRE>Method 01 " R6 \0 S( m0 k. B" p
=========
" x' ?: Y/ S4 k4 M5 `; H* C3 s4 f! ?& O% \
This method of detection of SoftICE (as well as the following one) is
' z: M% z3 I  g, o9 B7 Sused by the majority of packers/encryptors found on Internet.
9 p' B' M- _4 S; R* ^1 @5 S8 K$ X; MIt seeks the signature of BoundsChecker in SoftICE
0 Y" M3 f- H. V
+ e3 u% X! i' q/ i% y5 D    mov     ebp, 04243484Bh        ; 'BCHK'' a% G2 \* J6 k# k. |% m
    mov     ax, 04h* v* s7 d! Y& W# |3 g! G. ]
    int     3       0 u0 \* `) ~9 {1 e, @0 h0 @. X8 ]) c
    cmp     al,4
) z, I2 R' c: @' B$ o' s6 O: a2 K8 R    jnz     SoftICE_Detected7 g) C2 Y$ s, ^5 E$ a9 k6 M' v
7 S- H+ \% ?6 S! }' R
___________________________________________________________________________
9 O# F  a6 i: m$ x; ~$ m' _! N& S! P9 y$ |4 I( m- u
Method 02
, U/ {  w. {: E9 T# V=========
4 }. J: W, S, d5 A' z6 V' S
+ f9 b+ S+ p- k! F" g& |- `Still a method very much used (perhaps the most frequent one).  It is used8 d% A; p4 ^% K2 S9 t
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ S% I, ?7 P1 J0 [or execute SoftICE commands...
! ^- x9 `1 d) K3 I- KIt is also used to crash SoftICE and to force it to execute any commands
$ Q$ t5 x6 D% W5 [(HBOOT...) :-((    X) c, s7 w- o! ^+ c

5 L  i( f" u/ B+ {; V; L' A+ sHere is a quick description:
9 `# u1 n8 o$ }/ R# f7 X! Y-AX = 0910h   (Display string in SIce windows)9 k* L& R* ]) a0 e. h5 v! i
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" e/ k& x2 d3 `6 V) j/ `/ k
-AX = 0912h   (Get breakpoint infos)! g# p, S( Z# ~1 D. p% r
-AX = 0913h   (Set Sice breakpoints)+ J" a& C$ Y- G' j) ~# H3 ]
-AX = 0914h   (Remove SIce breakoints)5 A- P2 n7 `9 z) u$ }
5 `7 f0 r/ E% a, B. C
Each time you'll meet this trick, you'll see:& N1 V5 S  R, e, _' J# i
-SI = 4647h
7 J1 l- M1 N8 Q. ]1 _8 Z; z& O-DI = 4A4Dh- n2 |# r8 t: E, n" a
Which are the 'magic values' used by SoftIce.
2 A% G$ W4 B5 Q1 G5 p- e; rFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.8 ?8 X& C) j- \' u
3 B) b" w) F( `, L8 @  [
Here is one example from the file "Haspinst.exe" which is the dongle HASP
* g+ d8 M: p. cEnvelope utility use to protect DOS applications:
" w0 ~, p* u' M' T
/ o, D8 \2 G4 W9 s7 {$ O8 g; M# ~4 U1 r
4C19:0095   MOV    AX,0911  ; execute command.
8 z- e# C. b, f2 E  t& K4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  R- s! X; W0 O% t* J) R
4C19:009A   MOV    SI,4647  ; 1st magic value.  N" Q3 i9 b6 M) W/ E
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 \8 `3 O8 b1 `, M7 n+ I/ Q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 S9 u$ d% _& ^6 b- u
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# Y$ [* i4 x4 @( F0 v$ l/ f$ |2 d2 ~- v4C19:00A4   INC    CX8 F/ S; ~$ ^) S7 P/ e3 X! G
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ S' {; F& R8 [4 B% p3 u$ Q
4C19:00A8   JB     0095     ; 6 different commands.
' R  E9 N! g* B9 O% P4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- J( X8 Z: G; t! I/ \  x& @8 d
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :): l! n" z! T' n* F. G, Q
7 p! t  d. U( s& y/ f
The program will execute 6 different SIce commands located at ds:dx, which
' L: \6 _/ M  Xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! A- ], S5 o& A
! V. `4 r5 r1 @1 j# J( b* u) _* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
# d/ }( k3 E/ i! E: T1 v9 ~___________________________________________________________________________
2 E1 C8 J* D; ]! ?4 f
1 g9 Z- D! q  J7 r( Z
4 N. m" y$ h) @; w9 ^7 wMethod 037 R0 U, N. L) B) T- M
=========9 g6 N6 _' [: M% s/ F$ Y- R

2 J% }& E; b( YLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  j5 b# X, n1 D. n; G& {/ c0 s6 w
(API Get entry point)
% Z2 r" V. C: K* P* @        % t/ }* S( F4 ~/ O8 i  Z
) H# W0 R( G' g# F# c/ M
    xor     di,di6 X# R# D- J, k) e! p2 |" @
    mov     es,di
0 Q9 b* l4 Y& J8 p, `" J- ]    mov     ax, 1684h      
0 a5 Q. h. i3 J    mov     bx, 0202h       ; VxD ID of winice
2 c  z9 r$ _! l+ o% F$ p    int     2Fh4 _; v' x7 G5 x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 V* Z# V5 t9 w- U" X    add     ax, di! O! S+ x) C5 R* p
    test    ax,ax
& ?2 F+ i8 Y  Y& c. a" E6 }2 y    jnz     SoftICE_Detected
( B9 L( \) T( @$ v0 u$ Q# N8 K5 j2 W* I$ n; d& _5 R9 f% d
___________________________________________________________________________  }* @& q/ T% {/ D
' ^4 Y7 X+ ^- V8 s
Method 049 K+ z. q4 B9 p, B# _- f& d. p
=========
1 E  F5 }( l( f7 f- H6 B
: @9 j  x% E+ C5 HMethod identical to the preceding one except that it seeks the ID of SoftICE
* z' Z0 v* z9 w# W4 xGFX VxD.
6 {) I9 ]% U1 X9 L  C
  K1 C& n. Z' T, x0 D' P5 e    xor     di,di$ I4 R) x( h# I1 S5 j# u8 j) A
    mov     es,di
& p9 ^' h$ k, T& v    mov     ax, 1684h       2 I, @! P) |- K! I1 K
    mov     bx, 7a5Fh       ; VxD ID of SIWVID* D% x1 B8 n7 `/ @
    int     2fh
7 Z) U3 d$ J" G5 A3 `* |    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( r0 u( B: ~9 z8 i8 \2 t    add     ax, di! y, N- |7 ^$ D
    test    ax,ax) F$ ]: j% O5 o! x4 X
    jnz     SoftICE_Detected, I* @# q* ]& n. P3 y5 n8 ?9 c4 D, n
& L# k4 @1 k& c6 @/ i
__________________________________________________________________________$ w. O  a2 z8 d4 }5 b
+ v- [  ]: @" Z% y6 {
0 t8 N, G$ h- l) z' ]4 ]  n
Method 059 N8 N) U6 E8 R- }) h: s, v( u/ w, I
=========4 D# g2 ^3 y7 M- {7 x; a# b
. ^8 U. v8 T/ o' m+ x% ^, B# |
Method seeking the 'magic number' 0F386h returned (in ax) by all system6 @2 s$ C* V% d- @/ R/ ~
debugger. It calls the int 41h, function 4Fh.: K/ i/ k, |+ ]2 Y( l, ~
There are several alternatives.  
5 Z' u- [0 U# Q/ q/ p0 L# i- k+ C- ]) R
The following one is the simplest:
$ T( T' B/ z5 H# ]6 b8 x# m) @: g2 I" z: S  ?
    mov     ax,4fh
! c" y# f1 ?, }+ F    int     41h" w4 v4 X5 c! F* N
    cmp     ax, 0F386
) w5 b! a7 J/ ~5 ]% o/ @    jz      SoftICE_detected
$ o% Z$ _) n* G9 k
9 v. r2 F: |: ]: \, r# P' j/ ]8 {+ ]0 K
Next method as well as the following one are 2 examples from Stone's 4 C! q/ R% N5 J6 [' X& V) u# [& ^
"stn-wid.zip" (www.cracking.net):
3 z% _( E1 h' @" P4 u$ ]) y( k9 U; l) H+ Z' y
    mov     bx, cs. k' e7 [2 K, V5 I: \8 u
    lea     dx, int41handler26 F/ J+ i3 z' e3 d, y6 w& ?
    xchg    dx, es:[41h*4]; D0 k- D5 f; _  l( ?3 x
    xchg    bx, es:[41h*4+2]* x: N, |. Y8 |7 A/ V; i  M
    mov     ax,4fh
' T/ b" t+ }' b% Y$ s2 J! P9 W    int     41h
$ H% p+ A) Q9 m9 ^! X    xchg    dx, es:[41h*4]/ n% u0 w% S7 F  G& T# I9 Z
    xchg    bx, es:[41h*4+2]
2 }& y. {5 }$ W  D    cmp     ax, 0f386h( ^$ s9 e1 X3 Q# F3 q
    jz      SoftICE_detected) q1 r/ q2 s. U% f! f9 r% r

5 D5 {. t5 P& V/ F, Bint41handler2 PROC' ]2 q; R0 `* F' [6 e- F9 K
    iret
( I( C8 A7 z2 _* o4 qint41handler2 ENDP1 Q$ {" P5 |7 V9 s- X9 v) Y' A+ D. V

) K0 L- G5 }7 R+ x% ^2 |1 F% ^' h7 v) m% \- j' e( q2 [
_________________________________________________________________________
' x2 y9 w! W+ O8 Y) V8 ?! Z
& J, B3 s; e9 b4 H* A
# ], [! R! n3 A& N  PMethod 06
* X& q+ l6 s; R3 M3 b( t. K9 d=========
% h$ b. A1 a5 n' Z; Z0 _# P
9 t2 C8 q$ h3 R. j! J4 [5 f) h- @. D8 b! N1 ?2 ]2 q5 g* \
2nd method similar to the preceding one but more difficult to detect:
* G, _" b: M" |# O/ X) s3 T
* A8 @' e9 x/ z0 n/ Y! p* ^1 e- k: l/ e  k2 I
int41handler PROC
/ C% h& |, s2 O# ^' J$ {    mov     cl,al8 s* Q2 A1 Z/ e" f" z
    iret8 q9 E4 V. i) F/ V5 M! L7 o& b
int41handler ENDP
+ ]& n$ Q( z' k& Q. L: X& J3 j4 |" D/ m( b1 v

7 {: D1 N$ ~; O) w# D2 Z! ^    xor     ax,ax
0 n! p" i3 ]( {0 d* D* ?) o# H    mov     es,ax
+ U  h- k0 @2 T7 ]. f    mov     bx, cs
5 o/ K# j! D3 E! l8 A    lea     dx, int41handler* Y  O4 w' r: j9 c' O  U$ C
    xchg    dx, es:[41h*4]
, j( b0 y5 ]5 I) t) W9 i; i, N    xchg    bx, es:[41h*4+2]
5 @: H! Q' s6 ]/ ^, b    in      al, 40h* q- R7 V2 d2 ^1 c; E8 ?  z
    xor     cx,cx
4 R* v" y8 F; L- [% R. ^+ a    int     41h
3 k# R6 M. [' g. q  F    xchg    dx, es:[41h*4]5 s: ]3 y' V! ]! P
    xchg    bx, es:[41h*4+2]
: b$ t' c, n4 O, R5 W1 f) ~) B: x    cmp     cl,al( j7 y' ]' Q9 i% ]( `
    jnz     SoftICE_detected
* }3 x0 N5 \  H
0 T* h4 i3 D0 e+ L_________________________________________________________________________* w$ |' w, T, j+ E

6 G5 H$ [4 y: w+ l9 ^0 H6 ZMethod 07" Q& D' h9 I4 |  G$ ]. ~
=========8 A3 Z* U  F; Q9 E

; O: e4 k5 B0 i8 d( n0 EMethod of detection of the WinICE handler in the int68h (V86)8 z6 }9 [- f8 P* K; Y; S1 N
3 K- N  j" e- x. ]8 p( U
    mov     ah,43h
, P. I. b/ |' p) c; Z    int     68h
9 I7 n7 U& M* c3 l( f( S3 C    cmp     ax,0F386h+ x" k% `/ c( m. D- D6 {2 e
    jz      SoftICE_Detected
7 D% o3 b, k2 ?' I& o4 T
) I' P# [5 k, {( b* f, {9 E/ ~: ?9 t0 c/ W6 S* U
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit( Z6 L8 Z  x( P9 B5 D3 V- \! F! h
   app like this:. y0 h% A& X; u0 s
$ D5 ~; X" d. C) N6 I
   BPX exec_int if ax==68! p- V; E  l( Q( a/ z& u4 D, B
   (function called is located at byte ptr [ebp+1Dh] and client eip is) J* R, Z! T8 w9 y+ d+ I$ F' m" P
   located at [ebp+48h] for 32Bit apps)
/ g( j8 V/ K5 S9 l) v__________________________________________________________________________
; P2 }6 n+ C' e5 G! Z8 o6 C- A) h4 i0 N2 z. v/ L" [- t7 Z

- w; Q' p5 {$ C* o/ G# T% |( `Method 088 z/ |3 _3 l3 L
=========. |  z8 O" C  x% y+ B
( {5 ^; u- E. A+ n' K1 d3 n/ |
It is not a method of detection of SoftICE but a possibility to crash the  F; x/ _' O/ N# {) e- v
system by intercepting int 01h and int 03h and redirecting them to another. v( B9 k2 ]9 A% o' F- W! C
routine./ ]3 W/ h% D. _
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points: W5 \" g4 u$ y6 x7 I
to the new routine to execute (hangs computer...)% y& \+ h4 ]+ _9 l
/ h% o! W% M* O9 F5 ~
    mov     ah, 25h
9 s6 @' q: e* e( c    mov     al, Int_Number (01h or 03h)% w: h% J2 A" I
    mov     dx, offset New_Int_Routine+ Y9 W  b& N8 d! ^. o# V0 z
    int     21h
6 g0 M* M) j) c* z( w3 O, M  B% R7 \1 f) b2 N; T9 m  F* _
__________________________________________________________________________1 k) ?7 C) w* ~' }2 W
- X5 j$ U0 s& C( G
Method 09
$ v3 _3 E) m# P+ Q=========1 J8 o; c" o# k1 M) q' H0 H* J

9 S1 @7 L' g9 t+ O4 R" |( e1 Z! I$ LThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
  d/ C2 F, g, D/ c4 d( _5 bperformed in ring0 (VxD or a ring3 app using the VxdCall).; B7 I; E; I8 E' f
The Get_DDB service is used to determine whether or not a VxD is installed9 b) N* M- ~  J8 ~- f  z5 c: p! T$ o
for the specified device and returns a Device Description Block (in ecx) for! z6 C* w' t7 U! A9 E6 r
that device if it is installed.% G$ U7 z/ p. O! s7 O
  ]4 @& P1 P! x
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: k: ?  Y2 I( e- ^
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
8 }0 H$ N4 r& P' ~9 U   VMMCall Get_DDB; ~4 _' T" f/ f7 g/ a6 \% z
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, E, ?/ y! L1 x' F, s
5 I! w1 u! \* ?9 [% p1 y+ iNote as well that you can easily detect this method with SoftICE:
3 s! e3 e  {( j0 ^# o   bpx Get_DDB if ax==0202 || ax==7a5fh/ S  o: q$ X5 s5 H4 \: m. Q" O
( p7 o2 l1 T  C6 Z1 P# z
__________________________________________________________________________: R% b7 l- r3 m7 r

  p6 a; u# ^( Z8 K/ ?. ^  ?) oMethod 10
7 v3 v- c6 F/ V, }* @) W=========
. v! o1 }: @3 O1 m0 g
! l* A# o; ^1 C=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ m+ e/ L* b! |- m- \
  SoftICE while the option is enable!!
. ]8 E+ C& l7 m) Y! ~6 y% K8 W9 B* H4 Z& y2 F$ l/ a
This trick is very efficient:4 V5 ]8 w6 {7 H, ]7 s7 B% H4 J
by checking the Debug Registers, you can detect if SoftICE is loaded* Y7 s+ h' C  ]$ `
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: M6 Q  o- F. R' [. u& wthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 y; i1 X* U- V- S) ^; f( D
value (in ring0 only). Values can be manipulated and or changed as well6 g9 ~3 r* a1 y* G0 M& W8 ]  H
(clearing BPMs for instance)2 `) \' O4 A) N- H3 m2 n, k6 U) F

. K  f9 L5 M" C& o; a/ l, u__________________________________________________________________________
4 u7 g$ }- t- i5 G1 J0 }8 t3 q# @3 P: C
Method 11- f5 E+ n8 t5 m; k
=========# T) {# @3 w9 d/ |
2 J, I( w  n; q; M2 J
This method is most known as 'MeltICE' because it has been freely distributed9 y) c  {7 Q2 ~- L" q( W2 P
via www.winfiles.com. However it was first used by NuMega people to allow: M  S4 `, Q1 _) t' B( P. I* s
Symbol Loader to check if SoftICE was active or not (the code is located
( L  L& d# M. f) Z; S  Zinside nmtrans.dll).8 P1 _5 s& d2 @) v

# T1 Z8 W  K: J6 i' G! yThe way it works is very simple:
3 N5 E/ ^; H; e. d8 V. z6 IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for6 Q4 E, X! T4 ?' V, t1 t
WinNT) with the CreateFileA API.
% I6 L7 {1 [! K9 H7 e9 T, a* j% R' D! K) y5 e1 `* s# Z% i
Here is a sample (checking for 'SICE'):, c% m2 |, B1 j) q; }1 m6 s: [

) x' d7 k. _% Z$ \; T& r4 ?BOOL IsSoftIce95Loaded()
" V* a8 ]0 S+ [{
9 l) x8 f! q5 {7 `   HANDLE hFile;  , k1 r1 O$ F4 L
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ C$ v& q- d  k/ E
                      FILE_SHARE_READ | FILE_SHARE_WRITE,; `: i6 K- N2 u8 k. r! C
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ v3 g: N# k( S# Z: j6 n$ E$ M   if( hFile != INVALID_HANDLE_VALUE )0 H6 X  n! G) n1 c1 n) K
   {1 h5 }4 d! X3 K) _
      CloseHandle(hFile);
6 b' Z% E+ B1 H! p      return TRUE;3 @2 H" j& \* y7 X0 A1 c
   }; k0 ~8 p# M: `) _
   return FALSE;
  L- h9 w8 C8 r6 ^( X}7 H1 P7 s# L5 i- D) o6 D! _$ S

5 U* D. x; i! U$ Z& hAlthough this trick calls the CreateFileA function, don't even expect to be+ a: q; x+ ^( e8 n. O# [
able to intercept it by installing a IFS hook: it will not work, no way!
0 V* m; i" f4 G( [* z( {8 T- b; sIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
4 I3 o1 w6 G5 J: A7 k  yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function), H* j6 q! A  g
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 y/ }: v/ t5 j( h& X- b
field.
) ]" {! L8 F( \+ y' zIn fact, its purpose is not to load/unload VxDs but only to send a
+ E1 D# u( ]0 M: p2 p: o2 _W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 r5 U0 F8 R7 ato the VxD Control_Dispatch proc (how the hell a shareware soft could try$ \7 a6 N# i0 e7 R
to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 m1 b; H9 Q, Z! r1 S. {
If the VxD is loaded, it will always clear eax and the Carry flag to allow
) Y& N) f1 H- M- c! a" wits handle to be opened and then, will be detected.
9 a, m2 A, E# U# [5 K7 XYou can check that simply by hooking Winice.exe control proc entry point/ p' Y' P7 i' }8 s- l5 `
while running MeltICE.
# P- y  T! ]" ^4 T: e& _; ?+ I0 f( m3 c& s& p9 P5 r3 J$ C

4 r- S# @% L$ ]7 O% O# c  00401067:  push      00402025    ; \\.\SICE+ Z0 W+ k, T- b( }8 z
  0040106C:  call      CreateFileA
+ h- v' a5 e; _/ ]& o2 ?  00401071:  cmp       eax,-001# I1 U, D% L+ ?- b4 }0 G
  00401074:  je        00401091/ ?' ]7 r7 A% M

0 O+ ]. |6 S0 W& l0 l
. j; w) V4 N3 A! E+ Y0 ?There could be hundreds of BPX you could use to detect this trick.
  R+ e( T' {2 q-The most classical one is:9 |& ]/ k2 P' _$ @5 a; z; p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ x# l; w' E+ y& M
    *(esp-&gt;4+4)=='NTIC'
' R9 s' Y1 Z5 y9 R2 }8 J* U  {9 i4 ^% w4 M, m% Y
-The most exotic ones (could be very slooooow :-(. p" K1 q6 T+ f, T
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + ?. o. F( R1 F! t( z- O
     ;will break 3 times :-(% j; w0 @; x6 s* I/ p9 j$ L8 d
6 ?" c( K# F9 H& f4 E* C
-or (a bit) faster:
: k6 C0 q, K% u9 L0 [   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 `, T7 C2 s. u3 ?
* j& i! ~; E. V1 G% s4 C5 h6 `( J   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" `* ?3 q7 Y; f4 A1 {4 R, q# ^3 b$ u% W     ;will break 3 times :-(
( ~" C, Q4 A: M* t
) X2 D+ w1 w3 k) s% y-Much faster:, \. d, v" M2 ]; A# I' \
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'  C; H# M9 H! T6 w6 |6 z2 B5 J! k

6 G' [( r/ D9 q0 n6 Y& _5 H, ]Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
" ^2 `( u1 c& s, g. [function to do the same job:
0 N4 e: p2 o1 {' G
7 k+ R1 h( e- J$ [5 j1 H+ z   push    00                        ; OF_READ
" N  L: |5 J. `* P8 W- U* Y   mov     eax,[00656634]            ; '\\.\SICE',0$ \5 A% p( |6 y/ ^# G6 h, J% C
   push    eax" v# F4 ^- n6 b& d7 K
   call    KERNEL32!_lopen
: l( x1 \: j# s& I5 E; ?   inc     eax
# l! F  Z$ K" x- t  p   jnz     00650589                  ; detected4 {0 b/ }( H, m6 D/ W+ I
   push    00                        ; OF_READ
& r  ^& ?. w( z) c+ R0 m( _   mov     eax,[00656638]            ; '\\.\SICE'
6 C3 z8 }1 z1 a3 M- G8 r  `   push    eax; v7 L" K. a8 y/ B6 t
   call    KERNEL32!_lopen/ c7 f+ q- o2 k/ }* |
   inc     eax# ^5 v* u' k- D% U% c9 w
   jz      006505ae                  ; not detected
) m3 s2 x6 I9 }# T6 J% [* J' x* }+ w& g7 ?/ P( }2 J: V& k- Q

7 q/ [) q4 _! [: M( ?( t__________________________________________________________________________
. P2 {& F  l  B& {$ @
* N: L* h, o: _# @: W0 UMethod 12
- B2 @- o6 o# P0 ?! v=========, Y1 Y! d6 |# K. Q! K: V  P; z
. ?- o1 c3 a" O  r4 s1 q
This trick is similar to int41h/4fh Debugger installation check (code 05/ s( o) G* `7 X' a! S
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  p1 U6 e6 u- {3 C- M- i$ Z# X1 ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.7 f6 ]  _% c4 C8 h% c8 b) a. j

6 L1 L9 \/ p& `   push  0000004fh         ; function 4fh  q0 D. y" o. ?/ l& _. O
   push  002a002ah         ; high word specifies which VxD (VWIN32); v& ~# n. H) F- s: r! ]
                           ; low word specifies which service
1 K7 P3 _0 z! M0 B. }0 ]( f  o                             (VWIN32_Int41Dispatch)
7 q! z( `' R& Z* }& r( Z1 Y9 ?   call  Kernel32!ORD_001  ; VxdCall
8 @1 z* \1 u( a   cmp   ax, 0f386h        ; magic number returned by system debuggers
, ?0 z3 T; U/ n( D% j3 [% N4 d/ X- A   jz    SoftICE_detected
8 w3 t5 G$ Y: X) a& x
) d$ d3 ^7 j  PHere again, several ways to detect it:
3 g# n# T! ^8 D, _
3 S1 ^' o7 _" G; d2 d4 c  u    BPINT 41 if ax==4f9 X( b+ d% p0 x- c# v' _

9 A* o- ~+ q# g7 L# u5 F# ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 ?( m. d, y3 j
2 z( p% G+ l$ ]( P# l
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) u5 `2 ?. L/ ?# b- m" u

8 O% ]8 w% p% g* Z/ S    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 M0 D3 R& R9 u+ x
! M3 s* x8 m; i" u; d' s2 k__________________________________________________________________________( `$ P4 j/ b" [* q! d! T- ~

- t" J  B! y6 D# c' qMethod 13
5 z3 ^: @1 Q. V4 u! u7 c=========
2 U$ Q' R+ v6 H; Q6 X
$ w+ |& ]: @5 @( @9 P' P4 ~Not a real method of detection, but a good way to know if SoftICE is
2 G; E$ D) N; O  G$ Y, ]  Yinstalled on a computer and to locate its installation directory.
1 t, N5 s! J1 ?/ n, p; G: HIt is used by few softs which access the following registry keys (usually #2) :
! p/ _, ^0 a& e
" D( g; v5 C7 L/ l-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 n! F* Q6 A. V7 M# m9 p9 o
\Uninstall\SoftICE
; U: F! H; X1 [& y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 @% r# e+ p1 ]  I4 `
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ @/ B7 ?+ F, \3 d6 O) w
\App Paths\Loader32.Exe
+ |" W( `1 }$ k7 \. p1 r: I. Y3 [) u' M5 {
( ?0 J1 p) a* a; i+ F7 d
Note that some nasty apps could then erase all files from SoftICE directory- k0 a# v8 _1 J8 F
(I faced that once :-(4 a& I) I: y4 P2 d" E0 M

  m# O" E5 K  K, G) `# gUseful breakpoint to detect it:
3 ]- M! k% S2 \/ w) S5 x
# j) a. N2 n: m- R  b- [     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, v4 Y/ M' h2 J2 x& \2 g
; {- ]& S0 C$ W! p! {__________________________________________________________________________& a0 G9 e* h5 W! l, t' @) j+ v

! _, ~9 \( c0 u# L) H+ v' ]4 b; w: F
Method 14
( r0 F- f. ^0 Q+ u6 E' O) k=========. h4 W8 r: o" U
& T8 M$ P+ q" l8 H7 [& y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 W  C4 Q! B% M, Z" x
is to determines whether a debugger is running on your system (ring0 only).8 c+ E1 K* L1 a$ G+ y1 k
% {, s; @& w7 ]3 N- l2 f
   VMMCall Test_Debug_Installed, _" Y7 p; s: n2 [9 Q
   je      not_installed
3 a- J  N4 w$ u
0 j+ Z3 A* V' g3 GThis service just checks a flag.
: Q/ x& r6 B! N0 W0 K6 y</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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