About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, S5 \" z; v' m1 F- ]( N5 H- y<TBODY>
2 h. H! {* y8 F# ^/ J& t1 x& R<TR>
, K7 [% C) G2 _5 f<TD><PRE>Method 01 , q% u) j4 H0 J9 B! j6 j/ s6 @
=========
7 Z  c# d- e" A/ G7 U) H: T. X9 F+ K/ J( I6 U# o! e. E$ `
This method of detection of SoftICE (as well as the following one) is3 K# s6 f( \, }% d# t5 E: A- n; z
used by the majority of packers/encryptors found on Internet.% d  k$ _) ]% j- |; U
It seeks the signature of BoundsChecker in SoftICE2 q& a0 s% ?% f3 ^. W

9 u8 |& m, L" N% ~    mov     ebp, 04243484Bh        ; 'BCHK'
- q7 |( A# D4 Q) t2 L! U! L    mov     ax, 04h  r2 c! j! r) U* ^
    int     3      
/ c3 e9 o* O+ b    cmp     al,49 @+ J5 i) ^& G* h; G, D! P
    jnz     SoftICE_Detected
7 @$ @/ ~% R) z' m
. y' `# e0 v  W  s' {___________________________________________________________________________( r6 O$ e) P' I7 N

- I9 _- `& U6 T- WMethod 02
( M) f& L5 ?. v6 P0 H' k8 q% b=========* f7 A2 C) K3 \- v! P) \! a
, `/ K% y$ G1 Z! a8 f/ r
Still a method very much used (perhaps the most frequent one).  It is used
/ W8 |$ n# g0 I# h0 d  Lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 t- u5 d# B7 ^4 o& M& g7 p0 h0 Z
or execute SoftICE commands...% ^- l& r- c. k" z3 a
It is also used to crash SoftICE and to force it to execute any commands! W6 \3 [! q( {8 t
(HBOOT...) :-((  
; b) P+ _$ }9 `+ [
( {$ a% p; s; c4 C$ THere is a quick description:
$ ~5 ]: S3 Z2 o& H: h2 F/ Y$ m  }-AX = 0910h   (Display string in SIce windows)4 D3 E0 T* ]+ y9 ]1 N. V1 Y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& a5 j, ?$ m+ l0 w4 u& k$ [# ^( u# B-AX = 0912h   (Get breakpoint infos)9 i8 V8 g3 U/ u* S. X
-AX = 0913h   (Set Sice breakpoints)
/ h8 q6 |( x/ ^  t-AX = 0914h   (Remove SIce breakoints). F" _1 o- @& I+ @4 u8 _* ?

. {5 X# b9 @% z, w7 F9 jEach time you'll meet this trick, you'll see:# K4 e+ B! z5 }# M" z
-SI = 4647h
0 N, \- O  W# o1 I9 `0 }4 a-DI = 4A4Dh1 O$ \7 Q. T8 o7 u' i- C% A$ v2 N
Which are the 'magic values' used by SoftIce.
( D) l( r0 C" ?7 L! @8 E" B! gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
* o( Z, K5 W+ Q8 ~* b7 K* q0 X! K. Q# {
" s1 N2 F: Y6 W! i2 R: N2 BHere is one example from the file "Haspinst.exe" which is the dongle HASP
: k  ]: [6 x; TEnvelope utility use to protect DOS applications:
1 U! D: b; I, s4 P8 _; m' J/ H4 Q3 }' L: a$ R( k) Z/ Q

% d8 u0 W) s2 ~$ u) W6 M  l4C19:0095   MOV    AX,0911  ; execute command.
2 l4 e/ H% y# y9 f' _: q4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).! K. a6 T7 b. ~5 d# }
4C19:009A   MOV    SI,4647  ; 1st magic value.
/ x1 k' [! V9 X4 u: z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- T6 m/ G( [6 y1 K  B, i* i/ T
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' b9 e, U* v# l% q" ~8 I5 h/ W9 Y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute1 s" }. z; _3 j. j6 X
4C19:00A4   INC    CX
2 A) M+ l2 N- b5 D4 n5 e/ P4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 K( h1 @8 U$ y& X0 ^
4C19:00A8   JB     0095     ; 6 different commands., Q% Q  b8 u( k+ m1 u8 ^6 z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 M% D* A# ^3 g7 Z' r* ?) G4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% Q6 ]/ J$ W: _( W; I9 G
8 ]/ {1 p4 g* x- ^; \2 B
The program will execute 6 different SIce commands located at ds:dx, which
7 P' H/ k) g5 Y$ z% dare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.  V6 \% R4 y2 y; \: x

9 m7 {4 o: z1 [0 t* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.+ G$ R6 t; |! |# I4 l
___________________________________________________________________________$ w% Q( Y9 r1 k7 t
8 n& a: W, k5 |. n9 J7 \, C
. O; |* K, u$ Z4 T
Method 03
5 b1 C; h: V) C7 m=========
/ J) O# }, [" E' k3 l9 k6 g( g) Z* q; s9 f, t( s+ {
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 u7 K2 b1 [4 v$ P8 O3 J9 \(API Get entry point)
0 W7 C4 e5 s! M- ?; ]- x: r        8 l0 B+ F% l4 F! L8 f+ Q4 m

8 V5 m, v1 `/ r9 l' ]    xor     di,di8 @$ y- W) \7 i
    mov     es,di9 O: O1 Z- |- C2 b
    mov     ax, 1684h      
1 q4 n, R' A# N& Z7 l    mov     bx, 0202h       ; VxD ID of winice
0 @6 g! U5 W# D' P5 x5 T/ D    int     2Fh: V3 V9 V: c7 I5 Y. }! j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* N3 V. U; W6 e$ V8 e
    add     ax, di
4 r4 k" f6 L9 Y9 b. ~: q    test    ax,ax7 H, ~3 o' q0 t- y# ~6 L
    jnz     SoftICE_Detected' E2 G# a7 v3 i* S5 |: X4 y
( f! {* ~9 c2 \( ]+ k7 V" X
___________________________________________________________________________8 c6 w0 _- z2 m2 i* Z2 x
( }8 }9 c7 ~+ _) S  h
Method 04
' q, H1 Q" w& y+ s4 q( [2 O- G=========- B; A( \7 t1 x+ `/ }
9 t" k1 E0 I5 {5 x
Method identical to the preceding one except that it seeks the ID of SoftICE
# i" k9 @. D" t' C! lGFX VxD.
: d: z8 e1 Z' v& f& D' ^3 y1 A& D7 T$ A8 o- \" Q5 c
    xor     di,di1 Z+ U1 [* w( p+ i& d) r
    mov     es,di
- D  Y5 ^) @$ I7 u    mov     ax, 1684h       % x4 v5 b% s; c3 E0 z. z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 h3 V, X+ R! ~8 X' N+ ]    int     2fh( ~4 y" m; X' g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; Z/ c6 R4 U3 L4 L2 B4 C& N; |    add     ax, di! r( Z0 R1 O& d) |
    test    ax,ax
0 E2 _' d: O  c2 X+ u    jnz     SoftICE_Detected! v; L/ r! f& `

. L" }7 S* t1 H6 P! ]' ~; P& D3 k__________________________________________________________________________
9 |+ [3 Y$ ~% C, b/ h! W; U3 r1 ], V3 w
: w  n+ L$ E: @  i% L
Method 05
! v  i" A3 _" O' L=========' ]( A% y" W& @& N2 t$ n
1 p  x. y8 U* n( f, I
Method seeking the 'magic number' 0F386h returned (in ax) by all system. S4 g5 _8 ?, i* M! @( _/ f2 R
debugger. It calls the int 41h, function 4Fh.
+ M5 d% T' ~  Z+ YThere are several alternatives.  
- P+ V; L, D: W
: {, @# ~  a: s) W! v! @) gThe following one is the simplest:! g* w; f) h: M- g
" Z4 v$ Y) s& ]
    mov     ax,4fh
4 z6 i0 Q7 C! r/ x% Q$ t    int     41h2 B4 P/ s5 N0 M" p5 ]7 r& Z
    cmp     ax, 0F386* y: p+ U( R" @" r& |! p* g
    jz      SoftICE_detected9 p8 ^/ D; A: a& v3 _
! |6 B6 L% X4 ?6 w6 D6 ?( @% m

/ h2 J' v' I! ?/ b* jNext method as well as the following one are 2 examples from Stone's
3 a! [* p9 C/ z+ d& l' u+ _"stn-wid.zip" (www.cracking.net):2 _0 `4 E* E5 u( C* i& g

2 d$ W0 Q% v1 H( D    mov     bx, cs
! {, M! R& G% m    lea     dx, int41handler2
5 g6 F0 @5 o! Y, Z    xchg    dx, es:[41h*4]
0 g$ u0 \' F' M4 s! k8 `: G: ^    xchg    bx, es:[41h*4+2]
* ^, C3 j5 J0 O4 m" s    mov     ax,4fh- b9 |4 B/ o8 X) u
    int     41h
, ^4 ~9 C; T& V0 j$ x" D3 z: F    xchg    dx, es:[41h*4]* ~" |3 Y3 G  f; D* P* I2 y
    xchg    bx, es:[41h*4+2]
; `, }9 _* T0 w( c& ^$ K/ |% d    cmp     ax, 0f386h3 O" s1 o2 I7 i& V5 z. p
    jz      SoftICE_detected  V* @+ X# `  T$ M% u2 J

7 Q3 @9 R8 k+ y, Hint41handler2 PROC
' J( G# b3 s7 {2 ~+ L    iret
5 t/ N" v' e& _1 f5 ?int41handler2 ENDP
# ?. W! Y' g( G: r2 f( u7 {! O0 E4 z9 |' ~- @. ^" u
$ m$ v) b, c' h
_________________________________________________________________________
- S( j5 E5 D5 e5 O% ?% b3 O* d1 y% N6 e7 u6 y
( c! o' O" X* b  w6 G' i' a& M, e
Method 06
* {- A. D; P; Q6 P5 R5 ~=========) O* H& ~! N6 p- H

# A  D0 H" j: V. V& U7 i8 F  c: j1 X0 v( f) }
2nd method similar to the preceding one but more difficult to detect:
) Z# u! p3 d5 {' _) i0 R: D: o% N: h
: y6 m9 N; k; o; v1 r; X) O
int41handler PROC
$ Y8 c& o5 n6 z7 t    mov     cl,al  b" o3 R- L6 V$ @' {8 q8 [
    iret% B! D  E' m( X( d" }% u  ~
int41handler ENDP
% }  M4 K  d( n7 G$ `- t9 p0 k0 t( i0 J

' N5 z: N& b; H& d5 N    xor     ax,ax
: U9 z& j. j) D5 {5 w. U8 |    mov     es,ax
( N6 E, [/ |# r  C    mov     bx, cs
5 N1 m5 F0 }$ L3 F% P/ W/ ^1 Z' U3 {    lea     dx, int41handler
' l0 w  U2 Y& `$ @  G  a    xchg    dx, es:[41h*4]
5 ]6 Q$ M6 y! {* W$ }$ z. X" [4 F" b    xchg    bx, es:[41h*4+2]( _+ p  |3 V8 Y1 q' P  p
    in      al, 40h
! M& w2 Y- U4 d5 a+ m; e    xor     cx,cx
+ H1 ]" F' F6 ~' V2 {$ z% {* U: Q* D& k    int     41h; v( `) f1 H6 w& q
    xchg    dx, es:[41h*4]
8 M- S3 Z/ Q+ V3 }    xchg    bx, es:[41h*4+2]9 f- V7 c! `4 M2 y
    cmp     cl,al+ a4 }3 B# L3 B8 b  p
    jnz     SoftICE_detected
& N2 H/ J2 \" Y% T7 }
- Y9 }6 g$ ~% Y( W  J_________________________________________________________________________
6 w# t6 `" D& e, W, t7 s
# T( S: ]0 r7 V, l- h/ _& ]Method 07
% X" n% L) ?8 t" e; m% p& A6 H=========; ?! I0 O" f+ X' ~3 ?
4 u7 h2 v  s  Z, g
Method of detection of the WinICE handler in the int68h (V86)5 ?1 t: J( j" N& Z; c0 G
  j) T+ A) V5 O3 O8 C
    mov     ah,43h; f- {, y$ v% g. d2 `  e6 S5 X
    int     68h
2 U; L  j: I( e* g    cmp     ax,0F386h' |% ~7 o3 k6 ~# ^" q9 e: E5 R
    jz      SoftICE_Detected
% Y$ S& a: |* V9 T# a% T) b7 d0 k4 F# Y5 X3 |- q+ P" M7 b# }" _

% Z( [: S9 y5 a# k0 V) |' ~0 \; l, V=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
+ J/ V7 E9 J2 l5 @9 [, @   app like this:' D1 e2 ?: [& q$ i
; p$ [; r, `$ O% F/ P5 |
   BPX exec_int if ax==68
, Q. s2 y8 g6 s0 t1 }- {   (function called is located at byte ptr [ebp+1Dh] and client eip is# f- T% d0 N$ b0 ?0 f
   located at [ebp+48h] for 32Bit apps)
8 Z2 a* C' ~1 z' e9 k) j__________________________________________________________________________$ j& b2 E1 j% }0 ]0 \

1 N( g& W0 B) y6 b, B: d
' w% S. \0 o8 h. Y$ U0 W. q/ U7 r: uMethod 08, [( f: i6 H" {% J" T( P) E
=========
1 J3 N- I  q' q! X* g% z3 I' {8 \% x5 {* R( ?+ l; i( ~
It is not a method of detection of SoftICE but a possibility to crash the7 X7 P4 T; X* F0 Y0 S: {5 z
system by intercepting int 01h and int 03h and redirecting them to another
& c7 A$ k) D4 l$ @0 proutine.
! q- N) o6 C7 f8 iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* g& y5 h; {* P& j5 }
to the new routine to execute (hangs computer...)
$ w6 }0 C6 S, H8 W1 b- a0 B) R9 Z) K; B" [8 D/ a( m7 l& t% D
    mov     ah, 25h+ o% G4 F. u  J
    mov     al, Int_Number (01h or 03h): Q7 |+ }) O7 Q! P/ ]
    mov     dx, offset New_Int_Routine- d+ I2 ], [/ Q
    int     21h, ~# V* z* s7 @' j+ r' D
6 F& P* e$ }* m9 w& E/ r+ t/ D
__________________________________________________________________________
% ]' R% @5 g# Y; K+ w+ p- Q7 h7 E, R6 ]. |" R
Method 09* r, c) v  H: S- ^
=========: [- u" n4 L' @* c7 f, k6 K
: r" a+ ?* A( D+ j/ e9 L
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ z8 w1 x, ]( H- j) }/ \1 v/ `performed in ring0 (VxD or a ring3 app using the VxdCall).
$ A3 ?6 _' r$ ]0 o; ^( f+ WThe Get_DDB service is used to determine whether or not a VxD is installed/ m8 a* o& S0 m" ~6 j' _7 v
for the specified device and returns a Device Description Block (in ecx) for$ `9 E) L# y. ^  P( a, T$ m' C" `3 R
that device if it is installed.
7 {3 f9 s+ x' t0 a. W. q
. u4 ]6 h/ A- o" r7 Z% E0 `* `   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( t; w) |7 P% d/ r1 _  e4 Q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)7 U- W& E9 T- F1 J1 S
   VMMCall Get_DDB
6 X( ~( v7 q# u5 P1 z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 w, B& x1 ?8 m' p
6 P9 j) R, `5 Z5 k# k% ?" ?
Note as well that you can easily detect this method with SoftICE:
, o* F3 ^) ], l& }& N   bpx Get_DDB if ax==0202 || ax==7a5fh4 @7 l$ |/ l: j
( O, B* R% \3 E3 B' ^, B: j& C
__________________________________________________________________________
7 U6 b) D* Y8 X$ L3 G( X
4 g; C3 D* o) _) D' L, cMethod 104 ]2 i5 e' Z6 @+ z! e8 L
=========; ~8 e9 V9 a* D
3 m9 E, a# C" _' [# K. u# q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! \) D4 ~- E' s  h) g3 x9 k/ w
  SoftICE while the option is enable!!
4 c9 [4 m* r5 N5 ]( L+ k, J. ^
$ V3 K# @* I; }- OThis trick is very efficient:! V* F* {4 v1 [3 C% c8 O
by checking the Debug Registers, you can detect if SoftICE is loaded) e) r" _! Z9 a
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' }; \7 D- u% q
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( o$ Y1 R; ?! P+ fvalue (in ring0 only). Values can be manipulated and or changed as well/ L% ]9 ^) J2 H" w  f/ o8 G8 Z8 _7 ^
(clearing BPMs for instance)
* j/ n* x+ a1 e+ V9 `
5 \' f2 v9 N8 g2 H; s__________________________________________________________________________0 @' Y. G+ X% J7 v" X

' _1 @5 p# V3 y6 s% B2 u; `3 u) HMethod 11
2 y( E$ \& ^3 U$ ]: \" h5 G=========
, S, h" ^5 H. V/ O  l# v6 s8 N0 S6 i, y( r/ R
This method is most known as 'MeltICE' because it has been freely distributed0 l( t* e8 m: \5 `* T% r. y
via www.winfiles.com. However it was first used by NuMega people to allow7 W8 G! A' A# a4 ~4 h6 \
Symbol Loader to check if SoftICE was active or not (the code is located- j- s& ^5 ]% E1 y1 [7 C+ Y, i
inside nmtrans.dll).
: \4 n$ m' I* i# v1 ?; I8 U& u6 W: z) b7 T  O& |
The way it works is very simple:4 e- I8 y& [, O
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; s8 f" O+ e5 |. U" y; F; s' A/ P& JWinNT) with the CreateFileA API.5 P  K# y: Q- ?

; X9 \9 r! c* R/ i* b( ^' vHere is a sample (checking for 'SICE'):' F$ w: B$ d8 U, v" W

$ \( o1 ^) I$ O! d9 t: n! w( ZBOOL IsSoftIce95Loaded()0 V* d' m3 x: f$ v' {5 h
{
3 K" b$ R2 ]7 w4 ^8 I   HANDLE hFile;  1 N+ A  U* D) [" l
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( o2 I. Z; ]. ?7 G' i7 n( {                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) s! Y! Q  P5 K. ~                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ F* y. \+ `0 v0 W* E
   if( hFile != INVALID_HANDLE_VALUE )" @, |4 ^& q( T0 E4 S8 y$ r0 k
   {
$ O7 ~0 r" ^/ l      CloseHandle(hFile);, Y# x2 l# Z! U& A5 v
      return TRUE;
* @" A  ?9 w- A0 X) Q/ r1 x' v   }2 K% e  C8 \# `& H: X  H/ S
   return FALSE;
( n0 @7 X/ X2 Q}( F1 f* Q9 P& [% C- o' B

8 r  w2 ^" i- o7 e$ C8 cAlthough this trick calls the CreateFileA function, don't even expect to be& ^: t/ n2 C+ L7 W! L0 g4 Q9 Z
able to intercept it by installing a IFS hook: it will not work, no way!1 q, Y- c+ V% Q2 a" x
In fact, after the call to CreateFileA it will get through VWIN32 0x001F# U. F. {. V: M0 M
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
7 o8 }( a- D9 u; ]and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 a- t2 {  v% C& t& B( D) H( S* P
field.: {7 Z* ~* y, v) h  n+ h* {
In fact, its purpose is not to load/unload VxDs but only to send a ) w- f; ]8 f+ s6 {1 s
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE): p6 o2 ]8 k7 f$ `. _: v
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
9 e3 |; m* d% d8 o. jto load/unload a non-dynamically loadable driver such as SoftICE ;-).
# p$ u  o0 E5 Q4 h9 m$ l. AIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 C2 K! }& E$ yits handle to be opened and then, will be detected.
9 i8 h  Y" Y" K$ \' j) BYou can check that simply by hooking Winice.exe control proc entry point
% s' [5 C* f& y9 rwhile running MeltICE.
, m5 [% _8 y% J+ a  W& ?
: p) j+ x2 M9 k1 A2 b0 S; v! r
' G- Q5 I3 ]$ M  00401067:  push      00402025    ; \\.\SICE
: q. J' L  B  a3 u  0040106C:  call      CreateFileA
, T0 {* \7 ]0 E2 j  00401071:  cmp       eax,-001
2 v7 ^2 @5 `3 v- O" ~! t" u  00401074:  je        00401091
! B9 q3 c$ u' p" P
8 S7 f0 v  w& w8 r2 f7 z$ E0 \, ]9 d' f; q7 g( ^: x; }+ H; j
There could be hundreds of BPX you could use to detect this trick.
* g$ `9 N  G: f) ~-The most classical one is:; S% W) z! k1 c& q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 K* x( Y$ r. O& J# L
    *(esp-&gt;4+4)=='NTIC'
' e+ O% {" J& D; ]) e, |- [3 v! E
9 n- W4 |' F/ v-The most exotic ones (could be very slooooow :-(
- v/ S/ `9 v% z+ }3 E   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 X& ]" t$ c% _4 b, V: y     ;will break 3 times :-(8 ?* s+ E3 O, E* H0 ^! d: Z6 S
3 a0 y3 `* ]9 e' f
-or (a bit) faster: 3 P3 q+ V9 ?1 R+ X& E! R
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. t9 s2 G% N7 Q8 [6 _) h! T+ n$ |
% \/ v& J4 {3 l$ b! O& p   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + A8 `" Q6 _4 Q! I- d1 y5 s
     ;will break 3 times :-(
  T4 Q& I5 @( y2 q
* E/ S& }" Q1 f: o( l" q6 G-Much faster:
, s8 u5 v' J# k$ y' ~% i   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
: ]; n0 l4 a4 m. l- {  @1 l/ n, O1 d
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. ^6 ?4 T' i  |6 n9 t5 T/ ifunction to do the same job:( K$ j) [$ Q& X+ U9 Z

* @* G- Q0 i3 x% f. ~% ?* p+ D9 U% F   push    00                        ; OF_READ
# T- }5 a, d) q& U   mov     eax,[00656634]            ; '\\.\SICE',0
& U6 G& O0 e$ @8 ^   push    eax
% @- x$ w' [0 i. U7 x   call    KERNEL32!_lopen
! r, g3 Y0 G3 n! J   inc     eax3 y; g2 Z2 f2 n0 c1 y5 d8 M5 r
   jnz     00650589                  ; detected
+ M2 G" w0 t& y   push    00                        ; OF_READ
/ T! ?; r) R8 Q, c! |7 |   mov     eax,[00656638]            ; '\\.\SICE'
8 z% a# S# E3 ~( e% |   push    eax7 E7 A# p* @& t* W  j2 E
   call    KERNEL32!_lopen
* l/ I9 o$ n" g, h2 G   inc     eax
% [) E% i: q! g, S   jz      006505ae                  ; not detected
, ^, z5 h% Z3 Y7 k/ u) [1 H! h9 A0 E! d( E+ Z5 L  f) L9 S

4 P$ s6 b3 @- H+ d) ~: r4 @1 G8 Y__________________________________________________________________________
2 f) `/ ~6 \& K) h: d2 c! b- a  ~7 a* h( Y6 ?
Method 12
8 f9 e/ d9 v8 n, H& R=========: l1 V8 h9 M$ b  L9 d

+ ?2 Z9 |8 ^3 U6 w/ p8 I9 d# nThis trick is similar to int41h/4fh Debugger installation check (code 054 U0 h2 F3 d& G- S9 i
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* F" |$ a! r% f5 I. ]6 t( sas it uses the VxDCall backdoor. This detection was found in Bleem Demo.- P- v; U  d2 U+ U
# |! e) V! R, n6 |1 Z% X) q
   push  0000004fh         ; function 4fh5 h6 P  d0 h( ?6 m3 G( o% T8 Q
   push  002a002ah         ; high word specifies which VxD (VWIN32)' D# i$ J3 X0 e8 ~$ B+ k) D
                           ; low word specifies which service
  |/ k3 ~5 ?' y6 Y7 F  z                             (VWIN32_Int41Dispatch)
" z/ \- c7 ^4 {+ e   call  Kernel32!ORD_001  ; VxdCall
9 Y5 a/ R+ w6 P! W4 J* Y   cmp   ax, 0f386h        ; magic number returned by system debuggers* f+ a# Z" n* o. d' K9 B* w
   jz    SoftICE_detected! t9 B. O. ?) V4 o# }) \
- C' e, J' G3 U
Here again, several ways to detect it:9 y  Z# d) q8 _: Q* a

7 ~5 G0 ~; C6 r- h; x! G: M; ^    BPINT 41 if ax==4f
& X. t+ Z" ^5 p9 H, H# b4 V( ]# {. @
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! L3 o4 ~4 \! I

) ?5 R6 f& F# e5 M8 ~8 F! `/ e    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 P& a+ p& s5 L1 L- F
  d  l+ {' X) @( ]: v    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. S3 {, S1 `, w% W2 t3 W  A5 \! ~8 G' _' b3 I
__________________________________________________________________________' _# W6 I1 P: O9 g% T$ J' B

% l) T8 U8 [+ \% ?; jMethod 13! K. ^! Z; ^7 n: l& u$ V. n. q
=========
( D. W) O, V7 L7 }0 O) I" c- ?- g" ]2 N" U5 K4 M' _
Not a real method of detection, but a good way to know if SoftICE is
& l" n2 S3 P6 i0 q* t0 Kinstalled on a computer and to locate its installation directory.
) s+ B7 }' E8 Z( ]7 ZIt is used by few softs which access the following registry keys (usually #2) :
( N) l  f) c& }4 }# b6 J# o
. r, Q% D/ r: S/ D4 W-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 U7 F7 e5 a* u( i* T
\Uninstall\SoftICE1 S7 m9 Y( ~! ?6 B/ T* G4 m, r! O
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; `: k8 ^; x5 q) T" \
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; L( E: C  x+ ~  ]# F( M! y
\App Paths\Loader32.Exe
( F* G; C' d( U% g6 P( U* n2 q9 I6 i9 j# o# x- w4 Y
& O( g% A7 c! d( k. Y9 P9 ~
Note that some nasty apps could then erase all files from SoftICE directory& M3 _7 G1 q, S) B! s9 W' G5 b
(I faced that once :-(' u  V, I: S  Z; p. S
- H7 l, R+ z# v$ t1 \. B+ J
Useful breakpoint to detect it:
# a6 b: t9 z) c8 i% w% K  q; k# n4 s. o
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& s; F! E9 L3 S+ t, y
1 U7 h" T0 E  G__________________________________________________________________________
: I5 `- {, T+ w4 @1 }7 r4 z9 g; y% {. J# b' ^* P

7 C, w2 N( K2 f' rMethod 14
+ P/ z3 U+ ?( T" J* E9 w=========0 E' k- g% y2 g3 _

8 P0 d1 }/ U2 K$ o$ q4 `1 PA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
7 k& B' a% y$ {% _6 N2 tis to determines whether a debugger is running on your system (ring0 only).
8 v0 E, o1 G3 {% N+ u; Z9 w
' S3 y1 o, V1 z8 `" N, y   VMMCall Test_Debug_Installed* j. a' S/ f* O) u3 a' L4 R; t; e
   je      not_installed4 Z$ e; v* V; r9 S* k6 \5 k

6 U+ {8 [2 J! ~* f6 N; ?This service just checks a flag.0 V2 @% y: o+ R. s( {( S
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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