About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># T# A$ I/ ^4 Q+ H# m
<TBODY>
3 ]* A9 y+ p2 o, _. W6 P<TR>5 Y( H5 D6 d% |2 Q( z
<TD><PRE>Method 01 ' R4 T5 [3 {$ S: o7 L0 J$ E
=========6 ^% X. Y! q  c! B2 _: h$ {
4 J& m- }5 O. Q, Z( x! c
This method of detection of SoftICE (as well as the following one) is" g. i& r0 ^9 i' B: J5 P
used by the majority of packers/encryptors found on Internet.* Y: f2 B8 Y/ ^. }% m# Z
It seeks the signature of BoundsChecker in SoftICE
) U' A* |9 v7 m& y6 k" `5 O* {% _+ \! R, x7 a  ~2 d3 I( K: A
    mov     ebp, 04243484Bh        ; 'BCHK'7 n' L: z9 v, B
    mov     ax, 04h' J, s( b; `; o- {! K* A
    int     3      
# l; r# Q& N2 j, i    cmp     al,47 D0 f* g% H& [9 O/ ^4 u
    jnz     SoftICE_Detected! K: v  [6 V$ Z
5 J$ a; s4 \& V8 m8 i
___________________________________________________________________________
' t  [1 R+ X5 b! Z( r# E# g1 B5 }8 N' A9 r8 J0 E5 I
Method 02* k  `3 d/ E1 M3 l1 ?' {7 ]8 P
=========4 b4 W# \- i9 K
6 Z3 |1 N5 f& ^- z3 ?
Still a method very much used (perhaps the most frequent one).  It is used
7 y1 x2 R  I- ?3 hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 t" u- ]! ?3 g; O5 wor execute SoftICE commands...
' @) p+ T: {/ e/ x  P% `It is also used to crash SoftICE and to force it to execute any commands1 C5 @" t; f4 G/ {4 ?' S. U  v
(HBOOT...) :-((  & ~  Y9 S1 K6 d+ q) G: w9 Y% o

, h3 y, S& D2 r! o6 J& [  SHere is a quick description:3 A- C! H7 K$ Z# Q/ v, `! z
-AX = 0910h   (Display string in SIce windows)
0 N$ w6 F$ `% b3 o/ D& E! `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% h- N7 T7 [# \5 i
-AX = 0912h   (Get breakpoint infos); |* ~2 S$ J8 Z* A
-AX = 0913h   (Set Sice breakpoints)3 f  w. D  l, h0 N
-AX = 0914h   (Remove SIce breakoints)
$ ~3 F8 b: W" m) Z: j3 L
: p1 _. o' ]: mEach time you'll meet this trick, you'll see:3 ?, M7 ]" d* [
-SI = 4647h
0 P, Z3 L) {3 I, y- J3 i$ b-DI = 4A4Dh, D6 g" C, \% `' s
Which are the 'magic values' used by SoftIce.
: q7 |6 j9 K5 D+ H9 X  n0 @, lFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 s# v1 U) r& N- R. c
$ u5 R5 M1 |/ m# \; g
Here is one example from the file "Haspinst.exe" which is the dongle HASP1 g2 f. \$ c4 c5 N
Envelope utility use to protect DOS applications:
7 t0 [2 }4 H! r' K8 a) x, l9 Y. ~& R7 H4 J

* v0 I: q# X- X' ~$ S" ^4C19:0095   MOV    AX,0911  ; execute command.
1 j: C( P! P; o, G% M6 X8 }0 r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: _! j: Z/ |) ]. J0 |7 }4C19:009A   MOV    SI,4647  ; 1st magic value.
- ]: V$ J1 }3 b) e) C. M+ u4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 W  ]8 c1 B3 f; G4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 |/ ?. ]1 A( T( O/ Y5 E
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! k# b6 J6 J( B
4C19:00A4   INC    CX
" M& M6 V- X0 {9 Q4 f9 D# S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 u- i0 E  C% P' S4C19:00A8   JB     0095     ; 6 different commands.
- s* J1 `% N" q& c4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& j9 D7 l5 l9 `8 y1 S! |( K
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 S# q* C0 Z. a4 h$ V: r7 V
3 V1 @" u+ u1 r* g5 K4 WThe program will execute 6 different SIce commands located at ds:dx, which2 q- w1 W, J4 @. e. i6 ?
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 l: }6 Z' c( k% b( g' l  D/ X, e& {1 I2 Z) F
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.7 b) A0 p+ {7 O9 O8 |
___________________________________________________________________________
. [: f$ i: g5 V& ^1 k4 U1 B( P# W6 N4 P0 ]9 i4 Z, k
: t. N4 U4 I& f; \, o& a: g
Method 03
) ^6 b& c0 ?9 U: M, I=========
1 m. C) C! _) i: m! Q  `- K: @/ Y2 n" _$ S/ }6 W7 t$ `
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' f5 v9 Q& q* m
(API Get entry point)0 g1 A9 C8 E; Y/ [6 ]9 z- s8 o6 a
        
! K/ B7 n) b( c3 ~7 ~4 D
- U% m; j7 g; H4 o$ }# g5 i  @2 {& l    xor     di,di
$ _. X& m' n  q$ O% A/ L( F# h3 V    mov     es,di
4 e. }8 I- f8 U. f9 [/ s$ K    mov     ax, 1684h       ( Y  v+ q; m" Y: Y
    mov     bx, 0202h       ; VxD ID of winice2 m9 L; |9 {/ q2 I/ X' \" ]' F/ Q$ \
    int     2Fh
# L  v- L( `* l# y9 i) K. d+ X# A    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 [* ^+ w8 X) E5 S% \2 G5 B% t5 F( V    add     ax, di% T4 }  y& {; B3 `, M
    test    ax,ax+ G! D% H5 u2 @
    jnz     SoftICE_Detected
- Y6 C3 A# I% ^& b
, u1 t$ A$ ^% \1 M, i/ v$ ~___________________________________________________________________________
, V# M- {9 Z7 B& V( L- j, u# O; p5 l6 w/ i  |6 I
Method 04: G6 _! ~+ R( y- {* P9 o  ]
=========
' v8 L4 |' ~) p+ k! Z! @$ q
8 o% r, ]$ v2 M% ?/ b0 VMethod identical to the preceding one except that it seeks the ID of SoftICE
9 n7 j9 `2 ]' UGFX VxD.
4 |) C2 d9 M5 S2 h: A
3 @# `( w' }8 {% h) c% Q. O    xor     di,di
0 C% [$ w/ a8 j8 Y: D" z    mov     es,di$ d2 w/ B- Z' m! W1 u- K" @
    mov     ax, 1684h      
4 Q7 l( s6 l  t" M% X. j( E    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ e7 c- l! t/ ~$ Q4 l# B
    int     2fh
" L6 S& l: L% \9 b& [+ O3 h% W    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 _! `0 L9 Z2 [0 ?4 a
    add     ax, di
, \& L6 H% R6 Y1 B& G0 \; U    test    ax,ax9 R* m7 O8 @" F3 ^0 Y
    jnz     SoftICE_Detected
5 n. I% B. [) q0 F+ v6 D8 D0 L* B% L# {
2 F2 B, ~+ c" i__________________________________________________________________________
+ R/ p. W" ]. ^1 b3 t* r, I7 l- P3 k% ~5 _& P7 {/ H

' l5 m3 S* M! h% h# |# p3 I) ]Method 05
6 y9 M) X" S/ c/ y! p+ W: l=========1 {4 z1 B/ r* y8 a- J- H
7 _5 l' D! ^* v! p  D) Y$ m& H
Method seeking the 'magic number' 0F386h returned (in ax) by all system
& |! l, L8 s2 m. v1 C! o9 P3 W' pdebugger. It calls the int 41h, function 4Fh.$ p4 ^. |6 `$ u# E/ u
There are several alternatives.  
$ l3 O% _/ c6 Q6 t
% A5 S# S- J, M. DThe following one is the simplest:
/ o2 X& L) o) f$ f+ S9 ^
) t; N9 f' d" Z* D* A& Y    mov     ax,4fh- i2 w; T) I+ R* M4 o
    int     41h
& f7 t, S0 J" j2 X    cmp     ax, 0F386
: B# @+ g8 `# m! u    jz      SoftICE_detected
* F; z+ j6 x, I$ Z$ K& \/ C8 b. ~& j- _) j7 S

) Y2 N7 ?# l% fNext method as well as the following one are 2 examples from Stone's
5 K6 l) o" U+ V# x"stn-wid.zip" (www.cracking.net):+ v" n; F+ \% o7 D* W& t: s
3 s5 j2 [# r3 ?+ m9 P
    mov     bx, cs/ q4 E5 r. H4 W/ g. G' l2 o+ B
    lea     dx, int41handler2+ S2 v) b1 A7 Q! W  b2 h: @! H
    xchg    dx, es:[41h*4]
5 k& d1 j' G$ z6 A/ q    xchg    bx, es:[41h*4+2]
6 P1 Q9 P0 n1 B) X: C/ I    mov     ax,4fh# n' Q3 Q8 e- U5 n, ~' s  C' n
    int     41h
) X; \0 }$ `) i" I! W& i    xchg    dx, es:[41h*4]
! H) J! W* A& Z' s    xchg    bx, es:[41h*4+2]
3 A+ D0 d: D. N7 V0 a) |% x    cmp     ax, 0f386h
1 n& \& H* k! ]6 d0 S" K    jz      SoftICE_detected% W& x! s: ?3 x

' O" t) x) T# _7 {int41handler2 PROC
/ h% W. c! \# \7 N- G% k  v2 V    iret6 U3 X: @# ^$ f" m1 `+ }. N# c
int41handler2 ENDP0 f5 G4 v$ N7 `0 A/ s. y

) }+ f! A  u" S2 l  R" {, F. `5 q" H2 f$ Z
_________________________________________________________________________
3 T  ]1 S, p- b. p3 t
3 ^9 h+ S7 d& j. i/ ?7 b% @! J2 C) G  _( ?; m* y7 p
Method 06
# X+ A6 g7 l5 [! _=========9 i3 D/ J+ z# p  n! L
; J5 J6 h! q+ }' P6 p
4 [) s/ x9 q) t5 b5 i) _
2nd method similar to the preceding one but more difficult to detect:: F# z9 z: W3 S8 w# E$ B

: d8 w' b) m2 z1 l0 `' j! }6 R/ U/ r: B, h  y& P
int41handler PROC3 t, H, L6 q2 g, \. n( c
    mov     cl,al
/ I; Z6 j$ b; ?& n! n9 Y# F    iret
  }6 o% a5 Q" n* Jint41handler ENDP
1 R5 l5 V# M  d# |( L6 j( A) H; ?# e& v0 d* z: N0 y: z1 R3 T
2 U8 V! B9 O. H& Y
    xor     ax,ax6 R  F  P5 x0 Z$ H5 s/ t+ ?: N
    mov     es,ax
8 Q5 }# H, s( Y$ {4 g) \: N6 P; d( S/ k3 H    mov     bx, cs
- Q4 v! ?* j" ^( u: x7 d. ~- M" H8 Q    lea     dx, int41handler
) m# n3 X! v" p    xchg    dx, es:[41h*4]
9 T6 B" W! f/ |0 m  k$ w" ]    xchg    bx, es:[41h*4+2]
; I* f8 @* p# H. Y3 x  S! h/ R" Z* i    in      al, 40h, {" n4 U% T) e8 v+ g" n
    xor     cx,cx
: ^" ~. u& ]* C    int     41h
1 k8 X2 i' ^. N* ], i; E' e" ~    xchg    dx, es:[41h*4]4 V, u) |0 \& x+ m) K
    xchg    bx, es:[41h*4+2]
+ G- R7 T% t4 |) f) P  M    cmp     cl,al# `# Z' ], N8 n* U. s
    jnz     SoftICE_detected
. b+ f8 W3 T. f9 [9 i% b, O
, p7 u& w2 ]: h5 O/ y* J- Y( ^_________________________________________________________________________
7 i; `2 J/ ]% \9 }
. j3 Y; G! m; s$ v6 xMethod 07+ z* u( E7 N2 g/ a/ r# _3 V8 Z
=========" b/ E* U3 ]5 K' _) z

8 u3 R! I1 X7 IMethod of detection of the WinICE handler in the int68h (V86)
3 y3 C4 c" e0 I  |5 R5 L$ ~9 f5 k( ^: s! b/ l4 f+ C
    mov     ah,43h8 Y) j9 ^" T+ N; K6 R  Y/ |0 Q: x
    int     68h" k1 A0 t. J: f5 M6 i3 j! H
    cmp     ax,0F386h5 D$ G3 W* K9 l; {
    jz      SoftICE_Detected2 O4 q5 `  B( i" }; _" n5 P( C
) a) `4 z$ f: d! C4 _; I. ~* F  i2 }2 x" D
" h7 k# P/ Q8 P( n
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. Q" G' A6 l4 T  X! b0 n   app like this:- f8 ?( R" Q4 A+ Y' m1 y* C/ L
2 O( B1 g5 l# |  O' J+ D9 b# l
   BPX exec_int if ax==68
5 G5 J  Z( a3 G   (function called is located at byte ptr [ebp+1Dh] and client eip is' x& b; i3 T- A# w) h5 B$ o
   located at [ebp+48h] for 32Bit apps)+ S& e6 B! L" Y- S- ^' Y
__________________________________________________________________________
. H0 J& {0 z2 S7 }) q3 B6 r( Z+ I& s# T# |5 z0 M" ~* d

' p" E1 P! L! B4 j: @2 sMethod 08
- f2 |: c7 M* R# b" {) }& `$ C' v; o=========
7 ^# W- [8 R  @/ x- }, @- j
6 d9 d3 k! E* Q( A" h* WIt is not a method of detection of SoftICE but a possibility to crash the' M# d  T& `# m1 N7 T& J) K
system by intercepting int 01h and int 03h and redirecting them to another" |/ T( O2 F- i' H8 z/ [
routine.
2 V2 h. Y# N. j2 ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 ~' m, \5 w% X* I3 D) [+ x0 hto the new routine to execute (hangs computer...)
$ {. \; `# _$ ~* T# J9 Z; b. q0 K5 }: M: v
    mov     ah, 25h+ J! B5 a+ ~. q7 T, h# e
    mov     al, Int_Number (01h or 03h)2 n( `+ h* l6 m) J0 H8 j
    mov     dx, offset New_Int_Routine& @0 x9 k7 d& ?* v. V
    int     21h
8 E) b, o& x% K* |' e" Z# ~2 a* \' i2 R& |- u
__________________________________________________________________________
; S  `8 ^% O: D1 G) b" W3 l) c7 ^' q! W% p$ n+ D' \
Method 09
3 \$ d% x1 g* }. @=========% E  {( ?; C3 {# K

$ V% L: w5 n7 C. Q& xThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ @# o' [  q: X- A" ^
performed in ring0 (VxD or a ring3 app using the VxdCall).2 m6 @6 \! z# f. W( {
The Get_DDB service is used to determine whether or not a VxD is installed' H% v" _; V) q; \( d8 k0 \5 }/ o
for the specified device and returns a Device Description Block (in ecx) for
+ v3 V0 B2 G0 Y, q1 D9 b; `& F9 E5 uthat device if it is installed.
# G$ V* p5 N. W, _0 |7 m
. |' H# v$ w/ k" P) V2 a' g   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: G8 ^% t- j3 ], }! R
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- Q4 p' R# M) {; e! g8 m) c
   VMMCall Get_DDB" [( ~# }2 w$ ?1 r+ k# {
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: i; z, S; s1 r$ [4 c

+ ^9 q! p3 [! E& PNote as well that you can easily detect this method with SoftICE:  f9 C2 f2 J, x4 V
   bpx Get_DDB if ax==0202 || ax==7a5fh
$ o, ]; Q; P: {/ P* b* n+ {( ]3 F5 U# R% x6 n. q; i
__________________________________________________________________________( S* p8 |7 t; x2 Y, v) w

9 i0 ?7 w0 V! P1 m* w+ L, W, qMethod 103 R4 f* l8 B6 ~
=========
5 E! G2 ^, U' o. F" [
/ P" u6 \% Z2 W  a=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with  k0 B& F! }( _) y
  SoftICE while the option is enable!!# z4 K4 T( A  L/ x7 T9 `  r
7 y1 a- A8 }- c: U" D, M
This trick is very efficient:
8 r+ p, Z5 o/ t' M+ I; bby checking the Debug Registers, you can detect if SoftICE is loaded
6 I- ~! C! Q4 O: ?0 y$ l9 p6 Y(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, v4 L: U- |# z+ E7 ]4 X5 @there are some memory breakpoints set (dr0 to dr3) simply by reading their
! Z1 L' S7 `0 Lvalue (in ring0 only). Values can be manipulated and or changed as well
# y& X6 b  u% v0 `: p9 w0 M3 h7 o(clearing BPMs for instance)
% W# W" {4 i* g4 v' a
$ ^( Z6 w4 m! m/ Q( Y4 N__________________________________________________________________________: h. f7 a* b3 V8 E5 e5 p
/ E" P2 v, W7 G/ E
Method 11
6 Y2 ~8 M* r7 j, a, r3 Z! P, v=========: V( ]5 y: y) u) q3 y
8 n6 Q1 U: `) n' o/ W& j
This method is most known as 'MeltICE' because it has been freely distributed  _. M+ V9 x  a# y5 d1 q
via www.winfiles.com. However it was first used by NuMega people to allow6 X' c; O9 `9 i5 O1 O+ C
Symbol Loader to check if SoftICE was active or not (the code is located  |' v* j& I1 F1 k% }
inside nmtrans.dll).4 g* X" R6 `9 }! q2 o
  ?6 Y) B6 |8 V( F: A1 \: v
The way it works is very simple:! ]9 U( b# z' Q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; ~8 Y, l! i  h% P; F
WinNT) with the CreateFileA API.
- Z/ s, `: r2 h1 p  F* B: f7 Y' p3 P( B! d9 M7 f3 x
Here is a sample (checking for 'SICE'):$ r. ~/ N7 {; M2 P/ P& }$ v2 S7 P+ ^! I
: b$ S% W& N. V8 `. b
BOOL IsSoftIce95Loaded()' _/ J0 K( l+ |+ U' c
{" O, f/ [2 Y! l7 U& K& i" m+ \* I
   HANDLE hFile;  
! x1 @, g! |* B, Y/ |, Y9 w   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 Z5 D. T$ M2 ?' P$ u) ^                      FILE_SHARE_READ | FILE_SHARE_WRITE,
7 a3 M% h6 X2 I6 b3 Z  b/ {( i                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ ^7 f9 V( W# U% L2 {% W+ U   if( hFile != INVALID_HANDLE_VALUE )
% i6 ?: o7 [5 O% @! r   {
$ ^+ U" u7 g: o. f      CloseHandle(hFile);
2 |0 y  ^8 l: l; i( X' j      return TRUE;) n6 X/ N# g( t% ?  {% Z
   }
5 `( j3 L: i5 k- g   return FALSE;
' `) b0 y$ i7 p% w( C5 w- |0 p2 Z}
; I# R2 z# _% G7 n3 ]- S( `# L& I+ S- C7 }& M/ g- o
Although this trick calls the CreateFileA function, don't even expect to be8 A& C( K1 U+ h$ Q8 }  `$ P
able to intercept it by installing a IFS hook: it will not work, no way!6 o% g: ^1 ~' ~. w/ u! z' Q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
; a% d% C. k5 @" _$ ?2 A% nservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ w, r9 w2 E. T+ Tand then browse the DDB list until it find the VxD and its DDB_Control_Proc
& S( e3 Z' Y6 ofield.* @9 O4 g2 P1 r
In fact, its purpose is not to load/unload VxDs but only to send a : l6 e% w* h) _5 @6 u: q' G6 Q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 h0 f2 ?4 y/ S' {7 R$ G5 F5 P9 [0 Z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' E8 p7 H, C4 `; i$ R4 _
to load/unload a non-dynamically loadable driver such as SoftICE ;-).! I% t3 H- g. T& @3 i
If the VxD is loaded, it will always clear eax and the Carry flag to allow, Q0 i( i/ r, e6 G
its handle to be opened and then, will be detected.3 }0 Z/ o  y/ B! B; e
You can check that simply by hooking Winice.exe control proc entry point
1 t# H  E8 p6 \- D! f, Uwhile running MeltICE.
( w& h$ j" }! \  k. E
) D+ g, B/ S/ z) J$ d
( h3 b7 G$ A& s9 j  00401067:  push      00402025    ; \\.\SICE9 [$ j! W8 e9 L( d: I
  0040106C:  call      CreateFileA
% |) {* D' V5 L9 ^0 `  ]# V  00401071:  cmp       eax,-001) e! R# w9 z8 Q3 ^: c! c3 z
  00401074:  je        00401091. O7 D! M+ G3 m( x1 b4 O% F

5 ~8 ?- ]. J' `
1 d0 T. H' y9 Z% ?9 h; [, NThere could be hundreds of BPX you could use to detect this trick./ D- @0 h0 k+ b& n$ \8 U! B
-The most classical one is:
) u6 s+ ^  N; Y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) a( g4 A$ q- B7 U, f! Q7 [, q
    *(esp-&gt;4+4)=='NTIC'' {( E& ~2 i3 [, A3 x5 O3 C" }
/ f0 Z, z) T3 I' Z% V$ F* r
-The most exotic ones (could be very slooooow :-(
# g- e! `( [1 C0 F   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
2 {+ t6 ^( F9 `/ G8 \* Z     ;will break 3 times :-(
5 c1 j& I4 j* ^: y4 M4 X7 L' h) w. y
-or (a bit) faster:
. ?. p" n7 v! y1 Z& _7 V# L4 {4 d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# q; _4 W5 K# ~2 l8 n5 l

: Z2 f2 v; |; ]5 [! X1 A0 ~( O; Y: O9 V   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" [& E) f' x$ v3 A$ a     ;will break 3 times :-(
# [$ {  U7 _7 R' h: j: L' z) w' l% o7 q; o0 D) P2 X* N
-Much faster:# I) j8 G1 p+ O+ H1 y: F( J* @: X
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': j. u* `0 y5 h( z( q% |

1 \. @  }' C' f. G- bNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
! T9 `0 |7 S0 r- qfunction to do the same job:
, ?0 e! a; S4 x7 A  L
8 y* B0 E. f& x" F. q   push    00                        ; OF_READ
# \& ~2 J9 c- o# k! |  l3 x   mov     eax,[00656634]            ; '\\.\SICE',0+ K) W# L" @5 Y0 ~7 t$ g4 ]+ |, @
   push    eax) K9 |- }7 t0 v6 @' j4 q7 D( C' C- ]9 a
   call    KERNEL32!_lopen+ k" G' [0 y; q# n# o3 G
   inc     eax& c( u2 Z& v$ l( _2 p: a5 G
   jnz     00650589                  ; detected
3 z! P2 ^/ `: S1 J   push    00                        ; OF_READ( m. S# q$ B3 T& P0 s6 u
   mov     eax,[00656638]            ; '\\.\SICE') r# B) ?  t: }
   push    eax! @( F! L) `" k, \- f
   call    KERNEL32!_lopen
1 W4 Q+ V& I: U( @: u5 x7 B& ]   inc     eax8 F# \  r9 `+ W! I7 a1 k  K( P7 k
   jz      006505ae                  ; not detected6 V- R* l. W0 p

1 h7 i  ~; z; E
$ M3 A2 O1 b% f  g__________________________________________________________________________
; L$ p) e9 [6 k, ]- e8 ~0 b
+ B4 P, {( Z  W* pMethod 129 l2 H& m# g1 M8 f" I, Q9 v
=========- j  m, |9 b7 j) `# l) Y

& v+ H3 ?2 P, W0 v2 K- ~6 E3 I; @( FThis trick is similar to int41h/4fh Debugger installation check (code 05
, M) ]+ _6 v$ |, q&amp; 06) but very limited because it's only available for Win95/98 (not NT): C* d' [* {& j- U1 o  v; ~! N8 b: O+ d
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ o# x" O( F* C+ n0 D# x
- M! w2 D7 o, M3 k
   push  0000004fh         ; function 4fh
1 Y- `) L4 Y- N# o- Y8 ^, n   push  002a002ah         ; high word specifies which VxD (VWIN32)
( i# K# o0 F( p' X2 U( ]4 o                           ; low word specifies which service+ E, X0 k. p/ I% Z+ P' Q# P! u
                             (VWIN32_Int41Dispatch)
' v$ W, I( R, M' k4 ]% g   call  Kernel32!ORD_001  ; VxdCall& C$ Y( ]' p$ p; G2 Z
   cmp   ax, 0f386h        ; magic number returned by system debuggers% e2 z& O- v$ T; I; x) C
   jz    SoftICE_detected* P. Z. Q1 L  E; ^8 h& K  @; E
* Q- _, C* L2 c; u, O
Here again, several ways to detect it:8 a6 ~5 [9 d! F4 w' h" i

5 k8 f7 a* b3 [9 R. }4 [/ d2 J    BPINT 41 if ax==4f
  A1 c1 k  }% \+ ^$ G( J; M% Q9 K3 D9 O
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) C& T  Q$ K# q' U4 U) C7 c, L; H
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) @& a8 z' |! ?8 P" Y

0 ~% T; s: O( Q& v' b    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 Q  @" k6 t+ v( Q+ n9 m; H% b$ [: @3 [! \+ M4 [4 z
__________________________________________________________________________
0 V" ]- @# ?- J* ^) P& H/ m/ |$ m& n, [9 T) s
Method 13$ W2 a6 O5 |2 P/ C, q3 W" A% N
=========
8 `! K. [  |$ g; k4 @, o* }7 h  A1 _/ v
Not a real method of detection, but a good way to know if SoftICE is
1 ^: _3 x8 v4 _, K: f# R% winstalled on a computer and to locate its installation directory.* i4 U1 d0 _1 x0 \4 e- d! V% [
It is used by few softs which access the following registry keys (usually #2) :& x* ?* i3 z3 V- K0 k4 ^, n) c3 C

; S: J3 E* T; q" s- I: [6 K7 r5 }  c8 C-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) k% ?7 m7 |- P" ^
\Uninstall\SoftICE" j; _& h6 J  z' y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' a6 `6 q2 [: U/ {" t( ]-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. }' ?" u( C4 @! m
\App Paths\Loader32.Exe# Y2 x; S8 A3 D- B& b( o6 h# v8 Y
% g1 B& E8 x2 |/ B9 t' C

' }. h7 ?2 d# ~. LNote that some nasty apps could then erase all files from SoftICE directory  ~3 z+ ^, Z$ ^0 K! s- S: d( n7 @
(I faced that once :-(
/ D' P" ], ?0 W# |1 o6 H5 C
- x$ ^1 l* p' |7 vUseful breakpoint to detect it:
- c7 {' K! A' W) ?+ B* j1 `( ]! l* D6 C# X( U7 O% L& Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- b5 K' _3 }# C' a
) y3 W5 Y" y9 _/ E! F( e
__________________________________________________________________________8 j6 h% m/ t2 _/ I# e! i

$ ]2 M4 P; v$ c# t$ g, h9 T& Z5 A
Method 14
1 Q1 C, b1 t8 Q! r9 ?! K8 E. N- Q7 A=========
4 X: Y6 m" o/ l! y7 H# @% A7 V
8 W3 ~3 w8 S/ S, L2 WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* p; e$ U: S& c* W" e& W$ r
is to determines whether a debugger is running on your system (ring0 only).
4 ~; O! y) _' y, w# i4 ^. `* y! E8 k1 k1 P. m! p; f$ u
   VMMCall Test_Debug_Installed7 ]/ F2 [" \5 K; I4 p8 }* E
   je      not_installed
) s! G4 v9 l1 B1 Y, u
  s$ R# W; ?1 N, [- e4 t& kThis service just checks a flag.0 U9 k, H( k; ]" O* Y/ S- h
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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