About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) Z; l6 N' K) n<TBODY>
6 b; y' g! s5 p5 u9 h8 D" C+ c+ s<TR>
8 x9 u# y$ \" ?<TD><PRE>Method 01 , \. w* t1 N! l4 ~. {) m2 ^# C
=========
+ w% A! \$ N! w2 }
9 U. |  k! w8 OThis method of detection of SoftICE (as well as the following one) is( W/ K& O4 j, X! d7 V! g: x! a
used by the majority of packers/encryptors found on Internet.1 q# S1 Q- l) ?8 |
It seeks the signature of BoundsChecker in SoftICE
" {/ K1 i5 }7 {/ q, O, g  C
6 k, N  i0 M( ^9 ^2 [    mov     ebp, 04243484Bh        ; 'BCHK'
& m/ D) q2 V: c) C0 @# }" |/ c    mov     ax, 04h
4 E1 S0 V1 ?1 |/ @, I. L; x  n    int     3       / \+ W9 L4 y1 v; ~7 x( _. {3 j
    cmp     al,4
: F6 _: ~  I- P6 `. B; f    jnz     SoftICE_Detected
# L2 }) T1 t& j* M% c$ _( O; x* l2 u1 j6 }- O
___________________________________________________________________________" e/ V8 x, c6 F. r7 Z! I
7 z' T: y3 K5 R# X
Method 02
7 K& B  w$ ^: Q8 H6 u3 \=========5 N4 \4 j1 j  q9 R2 A" V, s
3 h2 \1 [1 v8 ^1 I5 E8 C% a
Still a method very much used (perhaps the most frequent one).  It is used5 Y2 a  y/ Y6 x) G
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% z& F4 u, K2 {/ por execute SoftICE commands...
% h! L! [3 A! J$ c( }! R. w+ Y1 B* y, RIt is also used to crash SoftICE and to force it to execute any commands, s: E* I" Q# ~6 r
(HBOOT...) :-((  
0 x& s" f6 e8 z2 G$ K- y
  B/ U5 E& v) G1 MHere is a quick description:, W4 X( Z; O: b4 ?) m
-AX = 0910h   (Display string in SIce windows)
8 O' e) X1 J( U( E) J-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- [/ R8 h2 s# h- U9 @, E-AX = 0912h   (Get breakpoint infos), ?" U5 F1 Q+ h/ r4 h
-AX = 0913h   (Set Sice breakpoints): N! O' y6 }3 z7 C& w# S8 u* a
-AX = 0914h   (Remove SIce breakoints)
: x- Q: X* ~) I) Z' Y# Y
( y. @9 l# o: U# gEach time you'll meet this trick, you'll see:1 T3 x% [' l. {
-SI = 4647h
& A9 H: K! Q2 S* [! a9 u9 j-DI = 4A4Dh
- h& s7 \, g4 t! X9 F8 H+ zWhich are the 'magic values' used by SoftIce.- g4 ?9 c# d  L- ]+ z3 H/ e/ E+ B
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
6 q# O% n0 e* N* v
% k$ _- ~. I; G+ |. CHere is one example from the file "Haspinst.exe" which is the dongle HASP
/ a5 W, `( ^5 V; q3 R) c% b% s, JEnvelope utility use to protect DOS applications:  J( P& o+ \; `2 m. M

( V  t1 z1 j2 h  W; H. A# L* G0 F7 i4 j/ W  o. u6 n
4C19:0095   MOV    AX,0911  ; execute command.1 P- s% {, s. g& |9 X2 W0 A
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  _$ l# a9 v9 @8 T: d" G4C19:009A   MOV    SI,4647  ; 1st magic value.4 u+ ^. q) x7 `+ ~$ l! n: r
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 d' l. U; o2 N( [! U1 z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# H  e' t+ V3 M: i$ y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# ?7 y0 K+ V8 t! L
4C19:00A4   INC    CX
& n& ]4 ?$ O6 _3 b, D! h4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: Z* {' P$ b1 O4 A2 k
4C19:00A8   JB     0095     ; 6 different commands.  f/ N# p( f8 _# ]+ q' E: T
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 e8 q8 S% y! w7 u
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% Z/ H8 |# V8 g$ i$ Y5 n1 _8 y' O" z6 A) U1 S
The program will execute 6 different SIce commands located at ds:dx, which  D7 H# q! Q( A% m# }4 R
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
. I) U  }7 F$ t  B) V
0 J4 m  U( k% D9 z* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' u1 r# K' a' n5 ?& @___________________________________________________________________________
  ?7 O0 G  j! i- X! D) E3 R  r" G; i: W1 p7 {: H0 a) a0 A" X

0 o/ k# ^" g$ a# s- \8 mMethod 03* R  J) e% J5 j2 `4 |
=========; X4 n$ U6 \0 z2 a* |: s. _
& Z  l; o$ g: M1 _0 L
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  `& D+ a+ W1 Z: s(API Get entry point)+ Y0 @1 h3 D* e; |
        
" v6 [0 W4 Q$ r2 u4 R, o! S" i2 _
% [" v: A& E+ ?& P    xor     di,di
& R5 Z5 r* t9 T1 u- v9 e2 n. i    mov     es,di# W5 P# ^, s% A4 I0 F1 \
    mov     ax, 1684h       6 F% ^2 ^- n5 ~6 j0 K  |: y) |$ S
    mov     bx, 0202h       ; VxD ID of winice
8 @+ c; \" x0 x9 u8 c    int     2Fh
! l2 X3 y5 g0 e( R. D: Y6 Z7 x    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 `/ u8 a$ E5 w
    add     ax, di
) W  r) E5 b- S  b2 ^    test    ax,ax
! @* S' y; P# L    jnz     SoftICE_Detected
* Z8 k" v- F  \% `8 Z# T& N1 n' s- G8 T7 _' b. n' a7 [1 W# C
___________________________________________________________________________: s$ M; v% ?- T5 w3 [  R! @
( i5 w% m6 Q$ n
Method 04
7 h3 W# }; q& N5 l3 I/ T8 r% w=========' S4 X8 j* f$ }4 E# k8 \) S
3 z2 F8 N  G4 S  X/ R8 W
Method identical to the preceding one except that it seeks the ID of SoftICE
: g" O6 e3 [9 }( q9 SGFX VxD.' L! L+ S" N) H( {; l
/ a$ q. O* m; M2 D4 M# S( R
    xor     di,di" h7 R9 O" q" |
    mov     es,di
( M" g! e. z: b9 `" x! A    mov     ax, 1684h      
: R+ X7 u0 G, p( Z! f    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: _; N; J. Z) P: C8 P    int     2fh- P% r9 w3 v  F& L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* u5 M4 n6 \: u8 y, ^
    add     ax, di4 o9 c5 k8 ~! Q5 \! F
    test    ax,ax
1 v( V" ^" {5 V, L+ \$ l    jnz     SoftICE_Detected' H: z. M  Y" V# N) u1 U, J; {

- W' d% Z+ K' q  M* X, j8 a1 P__________________________________________________________________________
7 A3 o, k& Y2 C- i( |5 c, c3 `. u' M( a6 c2 F
" S+ U, ^% H  Y# V: n, o
Method 05
9 c! O9 A. a% f: k- ~1 B=========# ~) |2 Q9 E* y

/ W4 j' U0 H! o' g% t2 |, e' r+ PMethod seeking the 'magic number' 0F386h returned (in ax) by all system
9 w* G8 o! ?4 I) f& |9 rdebugger. It calls the int 41h, function 4Fh.
5 N- b! V# r3 P; z) a) z! ZThere are several alternatives.  
8 Q& K$ e$ ?& L2 @5 A0 |6 }
  Q6 G8 _! @1 H1 ?The following one is the simplest:4 E9 W6 x# P: y0 Y2 E

; G2 p) w+ W6 ?! I! |' `    mov     ax,4fh3 F; t. b( }, }# G8 g
    int     41h$ g$ ]: k, c5 Y  @$ R" M
    cmp     ax, 0F386" o7 \, E5 a; h- D+ _' o8 \$ P
    jz      SoftICE_detected
1 G9 h- s1 ?1 [0 j8 o1 }! [
, D% o) a0 P1 S: p
2 u& v/ ]8 B1 YNext method as well as the following one are 2 examples from Stone's
" b4 j9 y4 H" [1 Y. K9 r"stn-wid.zip" (www.cracking.net):, v( a6 z: f7 H* O4 a3 t* Y/ i& ^( X

  O3 A0 u9 |; [# l    mov     bx, cs
1 J/ x& D: ?4 M; O% K' k6 a" j    lea     dx, int41handler2# v* r2 Y9 n. v/ y8 Y' [
    xchg    dx, es:[41h*4]/ ]4 Q* X0 ^, s; ]3 Q, m
    xchg    bx, es:[41h*4+2]  i* o0 Q- \# K
    mov     ax,4fh
  I5 o5 @' V4 m$ S  i# r% l+ v/ o    int     41h+ a4 D/ I% B0 N
    xchg    dx, es:[41h*4]
# [7 z  I. b- W+ J8 E    xchg    bx, es:[41h*4+2]) ~; S% f7 L! f1 F1 r* P2 O1 `
    cmp     ax, 0f386h
$ a& S7 u. @% e" }    jz      SoftICE_detected
/ p' Y, g! L" m0 O% e8 F: b
: y. m, Z! M3 O# _  u0 sint41handler2 PROC) t5 d: S+ f$ r3 M
    iret! ^' J: d% w- T$ _5 \
int41handler2 ENDP7 c7 A9 b! q& t' t  s+ R6 I

8 X, W2 S8 h0 i+ @
2 [% s7 s# a% h9 ^8 z7 b_________________________________________________________________________
) z' R5 Y' Q$ I; A
7 C& q5 Z$ N, L4 z" ?" s. {6 S8 S  B- B. F: o5 j  |0 P; {, X/ X
Method 06
2 |. A9 H$ G7 ~=========
( N% l% ]9 u% D; f
  h4 X* U  r: p+ z5 H& E
* w. V) U( O4 \2 ~2nd method similar to the preceding one but more difficult to detect:; N3 F  W  B5 u8 j5 I: o- v( E

0 s  S4 z& p0 l' U* q% i. M% l! l0 i+ J* Z* ]7 O0 \) R
int41handler PROC
( z  q6 Z8 J' E/ }    mov     cl,al7 L2 t& T6 U3 b- t: K
    iret% e4 f" y4 u1 |1 x  r
int41handler ENDP
( K, p% C7 W! i/ h* K
, g- G2 c$ Q; a1 k- T4 o
; ]7 `, \- }' c( k& M    xor     ax,ax
* H* I5 ^! }) L6 o2 D5 Q- l. B7 D    mov     es,ax
* F  J+ F) G6 e1 @    mov     bx, cs
+ [1 X% [; h# l2 G    lea     dx, int41handler1 V0 C. e4 t9 h: p* M  j. c
    xchg    dx, es:[41h*4]6 a$ K# l1 l7 y/ A* I8 Z$ |
    xchg    bx, es:[41h*4+2]: c" o+ }$ _/ z
    in      al, 40h3 k7 {! c1 G- T
    xor     cx,cx1 w/ O' ]- j# U6 R; B
    int     41h
/ Z( u( h/ w4 r7 z* ?' t2 S    xchg    dx, es:[41h*4]
- K: J( k+ {, A. [' v8 g$ r    xchg    bx, es:[41h*4+2]
& D0 j- s- Z! ?! {$ S6 {$ p) E    cmp     cl,al
3 C8 t: A4 y: ?0 k; O    jnz     SoftICE_detected2 p' E/ T2 I  m; J! L
( s6 z' L# n7 e9 w" r2 k
_________________________________________________________________________' l+ \- X. C# j4 j+ e) V
: q6 Q- k. D2 s' F9 F  n
Method 07& d5 U1 h' R$ q$ B* p4 ?5 j3 d
=========2 d5 g+ {7 d# C) l1 M) J. g% ^* K
8 K1 Q  m. C0 ]* q, e& ?3 d' A1 G
Method of detection of the WinICE handler in the int68h (V86)
$ v9 B( R. g1 I- M5 I/ ]  u
! q3 y& ]9 M7 a9 C! q    mov     ah,43h# K. `9 b3 o- q% S# D! I+ s" R  x) ^
    int     68h+ i* s/ W8 U. z" [( S% O- a  F
    cmp     ax,0F386h+ [  C* ]- D- j) M
    jz      SoftICE_Detected- ?' U) J1 R0 j- ^/ r% ?( F

3 Z+ s2 J2 P1 p! T' y# c, ~5 c8 p+ d' }2 [. `6 m6 E3 L
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 z- ~4 t8 @9 ^   app like this:
) t" Q* ~. D- X  M  {( G; l5 G( P1 Y% Z% J% X7 H
   BPX exec_int if ax==68+ X. h" N0 Z5 n# Z; f( M1 h5 Q
   (function called is located at byte ptr [ebp+1Dh] and client eip is
( A( j( Z$ h" k( o   located at [ebp+48h] for 32Bit apps)
5 {+ |1 j7 m# J7 |__________________________________________________________________________' ?6 @& D, S3 ~7 t9 B( }

  k" H& J; c: Q) r( G( M& T! C) k: \
Method 085 S) H" M9 i# e! `# x. w! a9 L
=========
2 u, N/ m$ n0 E, X5 P7 k9 s# x' ^# p& _
It is not a method of detection of SoftICE but a possibility to crash the
4 {8 [1 S% f( n) ]system by intercepting int 01h and int 03h and redirecting them to another
7 o4 l+ C; X; K7 _+ uroutine.
# D+ T0 @# n2 \* N- e. s2 RIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
1 b8 [3 U- B4 ^8 J  Cto the new routine to execute (hangs computer...)6 ?( X1 ]& b; \: h; E

$ X( }: g2 ~; O: q    mov     ah, 25h
. A8 K3 U8 z5 Z/ Z( h2 u. E1 A* W    mov     al, Int_Number (01h or 03h)
; `* w# Q0 ~( H: i; ~. z    mov     dx, offset New_Int_Routine
2 e+ T8 L/ u# ^  V    int     21h* Y7 d  X: B( |* c. f

+ r  y- D& O) W5 s  N" L9 v__________________________________________________________________________
8 `6 G9 s, b& D1 y) M: h; y8 f; m" L! f& d7 @8 X
Method 09, F* M  u+ N2 }$ }$ `
=========
# E7 i" W* l. X* k/ h' p8 @0 \: t: ]( Q5 u' \
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) A) p5 Z9 N7 M8 W
performed in ring0 (VxD or a ring3 app using the VxdCall).
% \/ k/ Z% q/ Y! C7 I- uThe Get_DDB service is used to determine whether or not a VxD is installed9 q: Y$ f9 D: s/ O! Q! ~
for the specified device and returns a Device Description Block (in ecx) for9 \8 K  a9 p: p( D' K% v4 p# I
that device if it is installed.
) Y. ?- R! S+ v2 E
: L, U  v# Q$ e4 y- n  H   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: H" |+ {9 l/ v# k3 ^
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 a, P7 m! J' o) ~
   VMMCall Get_DDB
" x- Y3 z, k$ a8 F4 y  I   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: U! I- z: R5 e, g; a

0 y3 K, ^: c6 JNote as well that you can easily detect this method with SoftICE:" P$ E* q6 X4 `9 ]2 D; N+ o
   bpx Get_DDB if ax==0202 || ax==7a5fh
; B" X% L2 _/ H  e  b  X) R
% }/ C. X: W( K7 E( M__________________________________________________________________________
9 f: K9 d; ^6 P0 p6 t# i) d5 y9 k9 ?6 Y! A/ G  m0 ~
Method 102 ^4 x) {; h, ?$ Q1 B% }% V
=========
: e6 m" m0 R, p, ~7 D  r1 F) ^, k4 E# q7 A) s0 p# Y
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* w0 \; R: b! Y/ ~4 ~- S: c  SoftICE while the option is enable!!
% Q+ X  N7 f2 E
4 Y, }0 O3 N3 r! J1 qThis trick is very efficient:
9 A; A& _- \' ~4 `, N6 \1 Y: y# Pby checking the Debug Registers, you can detect if SoftICE is loaded
/ x1 N) l& `" a7 N' q9 {. F# C(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ h& W. d7 D% e
there are some memory breakpoints set (dr0 to dr3) simply by reading their; g! o! d# N5 R9 M# ?" d
value (in ring0 only). Values can be manipulated and or changed as well
1 y7 E- }- L) Z( u* @+ D: Y(clearing BPMs for instance)
8 w4 _+ @2 @9 n0 `, E' L0 z$ w# r+ u  |7 j1 c
__________________________________________________________________________
6 \+ c7 `" s$ D2 I' u
% r: k/ q( j- O- V+ zMethod 11" u" B8 L8 V) U$ N/ P( W7 S  p
=========, w* G$ Y) k! D# d0 D& \
# n; r+ Q( b3 L- `: x
This method is most known as 'MeltICE' because it has been freely distributed) f) f" D7 [  A/ a- p; u. k- P- [
via www.winfiles.com. However it was first used by NuMega people to allow( ~: w3 d8 @5 t% ]* O
Symbol Loader to check if SoftICE was active or not (the code is located1 G) ~$ I0 p4 G, A$ }, M8 Q# a
inside nmtrans.dll).! W, \: `( u1 E# b5 g

( y' d5 |# [  o' P. a- t* A: MThe way it works is very simple:- O" h' R6 J; t* m6 h( T
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# N1 V' Y& u; e9 W( M! y
WinNT) with the CreateFileA API.
8 Z; y9 J$ W/ I! W" t7 C* O; A: G0 s
Here is a sample (checking for 'SICE'):3 j' d* T6 v5 H1 N9 o% e
* R% [, O6 k: o6 r/ \. i' G' I
BOOL IsSoftIce95Loaded()
' n. a2 T  }& B0 v9 Y" ^9 E! V{) C( U) w; g0 v' W
   HANDLE hFile;  
" T0 ~5 w. C! r( h5 J' V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
- Q) ^+ q/ N1 m! A2 Q4 i                      FILE_SHARE_READ | FILE_SHARE_WRITE,& v* R' ]: [; k7 R& F7 z, A6 F1 ^
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 A# h) s/ n0 m* _7 I, l   if( hFile != INVALID_HANDLE_VALUE )* t8 H2 @# E1 X' A; a
   {
5 a- \# a' j) l, W% v      CloseHandle(hFile);
: {1 X) L$ ]6 |( J- w# c      return TRUE;
; _& u& Y+ a1 h& k/ ~4 a   }, M( }9 v. C' {, K4 }8 W
   return FALSE;
( r/ T4 _) V& Q7 t}
; e5 S4 D( d( J+ L% g: q) U- [* P' q
Although this trick calls the CreateFileA function, don't even expect to be
- a# `2 {& x# j% e5 K& cable to intercept it by installing a IFS hook: it will not work, no way!
! u; {: a" U, a, E' a- m7 CIn fact, after the call to CreateFileA it will get through VWIN32 0x001F% u! Q; h! a+ _7 H/ Z- l, E
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, s% P8 \0 \; W9 Vand then browse the DDB list until it find the VxD and its DDB_Control_Proc4 p$ [4 B2 k, D& J
field.
& V- f6 Q1 C* K: ?In fact, its purpose is not to load/unload VxDs but only to send a
7 F' w1 E9 j" _5 u( B- S  Y  QW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
$ \! m3 \* J5 @* r3 I! S; v5 ^  Bto the VxD Control_Dispatch proc (how the hell a shareware soft could try, P4 I4 \7 v. ]8 T7 Z8 x7 d
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 T- D1 N1 d8 q! pIf the VxD is loaded, it will always clear eax and the Carry flag to allow( q) K% M0 c& ~2 r% x- u! k. y! B
its handle to be opened and then, will be detected.! ?- C& `3 ?' |! }# _( p- a
You can check that simply by hooking Winice.exe control proc entry point
! m0 k& j; O/ R0 k" v* Bwhile running MeltICE.- f& ?- R& a3 L, B1 V% R

$ w& t8 j2 w" B8 a0 P' e% j# w
# X! q6 D7 c! m. |, Y+ ]2 F# K  00401067:  push      00402025    ; \\.\SICE3 u# V1 f! N9 H2 Y6 B
  0040106C:  call      CreateFileA6 p3 T  Q  X* j. i1 S0 K4 W
  00401071:  cmp       eax,-001$ B1 p% S. g& B+ I" h- N; }3 L
  00401074:  je        00401091) o8 l6 W' u6 d- m

+ p/ J: u+ s. q  \, [  ^1 G3 D& U: A  a& I
There could be hundreds of BPX you could use to detect this trick.
. m/ H2 _( b6 @-The most classical one is:* H8 Q4 s' n2 Y$ ?  |% V
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ [3 n) U/ n4 i: o& f- Z, e
    *(esp-&gt;4+4)=='NTIC'
) R6 v- @$ o" y+ d: P/ g' `8 Y; P0 Z/ Y2 ~% Y. w1 I
-The most exotic ones (could be very slooooow :-(
1 R/ N7 L+ d. u+ w   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 s/ }4 u7 Q- @. l( `% _     ;will break 3 times :-(
9 ?# i" S( x1 _+ D. r* }
* y! j' L; p1 }! h1 X-or (a bit) faster:
" m7 g7 `% U* b# @- ^) E   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. W7 W9 q; e! x6 E4 C# I
# Z- e5 O; _; o! ^; f) R   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 C  ^; W% {5 Q/ q+ W
     ;will break 3 times :-(
9 ~- B# L0 Z1 o- J6 b1 r; |$ n8 T: D1 g4 v, ^( I8 K
-Much faster:
' I7 I; e9 p! }* x( a% v   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 C* p5 u4 P  f5 E* E: c
$ F1 n- P2 \- |% U+ Y3 xNote also that some programs (like AZPR3.00) use de old 16-bit _lopen. l9 m4 p1 P; Q! T' l# C3 G
function to do the same job:
5 s7 O0 F# v& o) e- P* ]* @7 _- Y; n/ d- I/ L% m/ {
   push    00                        ; OF_READ
# ]$ g# J9 L4 L- D3 N) p: J   mov     eax,[00656634]            ; '\\.\SICE',0
2 _6 \8 O5 ?3 l  V: m: W$ _: T+ |   push    eax
' F8 l  K4 h/ {) b   call    KERNEL32!_lopen
6 P: y8 ^- a: ]   inc     eax7 t3 j- ^) z' h+ P0 w) }& u/ n, g7 X
   jnz     00650589                  ; detected
* b  R( M% ~) ~9 c8 z% r   push    00                        ; OF_READ
% R  V2 P3 s, l9 U7 _   mov     eax,[00656638]            ; '\\.\SICE'
1 L+ c5 k& ]- o: b- z8 \7 [  R   push    eax
% X+ b4 v( t$ e+ r6 r   call    KERNEL32!_lopen% ~  T4 T7 X) r* }0 R# Q8 {
   inc     eax
% d0 \! U1 t8 u7 `, C7 e8 Q   jz      006505ae                  ; not detected
, J% k# O7 y( t8 t0 H4 f* {8 n/ n! \, A/ u+ b% b' Z7 y2 |

6 Q! n1 W3 I& s: e, z__________________________________________________________________________
) G: k" e( |) D4 p! r9 s
, s7 m5 I* U7 c1 K% U: OMethod 12( F, h' Y) J, r; c6 J1 n" r, {
=========/ D' p4 `! m8 }5 j1 t

* |4 x1 }/ p+ V6 R& }' @This trick is similar to int41h/4fh Debugger installation check (code 05
! Z1 ?8 d. n$ q& i0 |, T' k7 ]% I&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; R3 M: n* M! r( ?  o$ das it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, r, Q/ T2 y0 P; g. ^5 O# R  R, s, h% W  o! D0 `  M( m
   push  0000004fh         ; function 4fh, [2 t+ u  c# _0 ^% z1 |
   push  002a002ah         ; high word specifies which VxD (VWIN32)! ]- [, f5 B6 S  b
                           ; low word specifies which service
( \% k- w* b$ _) ?; ?6 W0 t( Q                             (VWIN32_Int41Dispatch)
$ U; t! ~& @& l: m   call  Kernel32!ORD_001  ; VxdCall6 G3 B, _" q: Y' v' m+ X& N1 ?) F
   cmp   ax, 0f386h        ; magic number returned by system debuggers
% W  H: x2 {- ^) F   jz    SoftICE_detected
* L) V: i5 F! q3 u- @$ c  b: f! r2 z8 X9 k4 s
Here again, several ways to detect it:. @6 j! A3 I4 p

6 \4 v* @$ ^; k5 y    BPINT 41 if ax==4f
9 [  X  g2 b, g7 k6 x; \1 C0 l3 Q4 l
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' T% Y: f0 M1 t8 g. t+ i

0 p9 {- _  P  E    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. S7 Z6 c2 A9 m

' ^  J5 B+ B  r" G+ p; q$ t1 K$ _    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
7 U; Y+ m+ X2 X* ~: `
! X) z6 P9 J  {4 \__________________________________________________________________________
' c7 t' B' H/ Z+ c7 J' f3 f+ R
6 n+ o: ~6 x1 M. S# I) M: G( fMethod 13
' j  J* X- U6 r1 r4 n=========( t2 _. @+ W% C: t5 `
6 ]% ~! P: m# B2 u: h0 n7 @  a# K
Not a real method of detection, but a good way to know if SoftICE is: @8 e2 g% j/ n4 c
installed on a computer and to locate its installation directory.
; g1 _9 l- k2 h' F* SIt is used by few softs which access the following registry keys (usually #2) :* u* K& R* G; f& h: A  s

9 K, d# y- N* H1 B9 G' t6 ?-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- W" {  C6 R. E3 m: M) q( p. k\Uninstall\SoftICE
. G6 i' y) y1 a( Y: q5 q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( j! j7 c5 H  ^! R2 F-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# W, E' n4 Y: l' {# ]: \
\App Paths\Loader32.Exe
: `+ v) B2 ~' ^5 W6 Q5 o- }+ o5 R, b* b0 `& B

3 d. ?+ e2 `" [) [: S" g. h: f1 A# jNote that some nasty apps could then erase all files from SoftICE directory
& [$ w$ A+ p) c: ]0 F5 M) w4 F(I faced that once :-(
. V- J# Z: S& F5 }2 r0 U
- P/ [) h6 f* @1 P- zUseful breakpoint to detect it:
- w2 c! n1 }& {5 F4 a8 c( z4 d, K' q: K* ?& T; S2 B0 F1 b/ E
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& L' o5 F: R5 p
2 |9 i3 w" q/ G; V7 r1 Y; |& {__________________________________________________________________________  ]1 S/ b; M! C4 C4 U
# l1 J5 p. P& s9 C. |( s
" ?4 j+ X" H$ Z( g! q
Method 14
) u0 h" l4 G% ~! y. ^+ B=========  X# I: ]* F3 n+ x; w& H% ]6 c

: n6 M  X6 m; d5 {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 n4 ?( }% O  Q
is to determines whether a debugger is running on your system (ring0 only).5 F- W4 v+ J3 m+ d: I6 b9 A

; M3 ]6 d" A+ Q& `4 P   VMMCall Test_Debug_Installed$ ~- s9 s: e" p
   je      not_installed
+ J! O0 ~3 t+ k. Y9 F$ r& ^% b; U5 X; G% R0 E" ]+ p/ P+ ]
This service just checks a flag.8 J1 [5 m6 R. I( m4 k4 ?7 B' l
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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