About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 `& d2 l# F2 A, V
<TBODY>
1 E+ P1 Q8 r* `8 Q1 m9 l1 C- N<TR>  V, Q% E$ o4 p6 U2 y# F* S) R
<TD><PRE>Method 01 $ \, i0 b! o5 c# u* Z  a
=========% R4 g, L. z9 ]
& v; @+ x9 d( T8 ~
This method of detection of SoftICE (as well as the following one) is, ]$ I8 V% O% c& H
used by the majority of packers/encryptors found on Internet.# q- b' h0 S* J
It seeks the signature of BoundsChecker in SoftICE% r+ Y! y# o* Q/ \

9 G. y0 K8 m2 y) h    mov     ebp, 04243484Bh        ; 'BCHK'! y, f% O2 g# L5 [0 c
    mov     ax, 04h$ l* o5 S8 [/ r" k) f
    int     3       / u& I2 Z9 L* s
    cmp     al,4  Y0 ?0 r  j& g1 o. D9 h
    jnz     SoftICE_Detected% o# L6 x' S4 T: n' l4 i* N
, r! k0 e: _2 p/ y% v1 U# {
___________________________________________________________________________4 E; l# w6 ]: V, M( G

3 C9 @$ p, Y6 B" c9 |Method 02
+ R( j" ]) u( P; ^5 k5 K=========
8 j$ ]- u+ P' R5 b$ C
5 l; [- T* O* B2 ~& xStill a method very much used (perhaps the most frequent one).  It is used
6 |; ^( o* F$ m- v# m( T' sto get SoftICE 'Back Door commands' which gives infos on Breakpoints,  R* U" _' u2 ~; m+ X3 B% }9 I
or execute SoftICE commands...+ T! c1 ^, q6 j+ l: x
It is also used to crash SoftICE and to force it to execute any commands8 y! k2 k5 }: Q
(HBOOT...) :-((  
$ @5 I" s1 y6 v8 E$ b
. f2 s$ o0 A. w3 x- V* q  e- WHere is a quick description:
+ ?4 L9 G( y( {5 `/ d- e-AX = 0910h   (Display string in SIce windows)
4 {! X% v9 x9 U  K/ t2 P-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), ^* a, g" A2 Z3 l
-AX = 0912h   (Get breakpoint infos)
; {* b2 o8 S) Y" e8 I-AX = 0913h   (Set Sice breakpoints)$ p& F8 G! q: y# q
-AX = 0914h   (Remove SIce breakoints)
2 b. q* U# D6 I5 k# w9 r+ C  o; X: A% o  }0 P" U7 `
Each time you'll meet this trick, you'll see:. s  X, ~0 P8 |6 R  I7 j
-SI = 4647h
/ o" X, Z7 Z& _1 t-DI = 4A4Dh
# m, x: n* ?- ]3 vWhich are the 'magic values' used by SoftIce.  t9 |& ?* ~2 A% I( ]/ z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% z/ Z9 g3 \/ v& x/ {* h. [3 ?8 H1 c" ]1 F; c& Z
Here is one example from the file "Haspinst.exe" which is the dongle HASP( E& p3 R% A8 ^- D$ A
Envelope utility use to protect DOS applications:
1 f1 V4 S6 Z5 ]9 ]
; V8 I+ ~4 h* [6 b8 i3 y+ Y. `+ E4 K4 U
4C19:0095   MOV    AX,0911  ; execute command.- K. o: v$ z/ _1 N4 Z
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).& D- B8 a" P0 a6 i
4C19:009A   MOV    SI,4647  ; 1st magic value.
" b: J) d6 ?% Q: ~" a$ K4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 A* s/ s! a8 \! s; P
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)/ g- i4 ^- `+ M  e' l9 L
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, v4 Q4 s3 ^# Y6 k' B4C19:00A4   INC    CX; K) N4 L6 s# g' K
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ h8 Y) l, n; N% \
4C19:00A8   JB     0095     ; 6 different commands.8 s  O: h: k1 s* n( M
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 u" X: q7 c! W/ ]2 `1 w" ]
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 n& m! F3 k, f1 _: @! C/ E$ L+ \" [
4 l) a6 d: l6 d& t" U, `The program will execute 6 different SIce commands located at ds:dx, which
1 T3 ]/ C3 ?2 M7 mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 M' _4 G, X1 c) s% X
) }- ]6 `# j& J' v" t
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& b8 X9 Z; ^' N0 ~
___________________________________________________________________________, _8 n- u, Z1 o$ q7 O9 F2 X4 {6 P

7 v: G* ]* o5 x0 c7 _, V
, _! Q4 q7 |7 bMethod 03' e2 n5 Q5 c9 h# k# X0 w0 o
=========8 {7 ]! t( F. {
2 P6 Q; `( d) F& @# `3 h  K
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 z3 Y" Y$ P# O" p4 C6 L(API Get entry point)
) Q- Q& E# Q2 p& p0 k+ s        ) L, T3 I8 `- a, j

$ {/ ]5 z6 f1 v4 a    xor     di,di1 r0 \) x' D# r' }) b
    mov     es,di" H2 U1 q+ x1 z2 i4 Y3 h4 \4 w
    mov     ax, 1684h      
! s* [+ A5 L- H* K. `    mov     bx, 0202h       ; VxD ID of winice
* L6 T# `0 [9 b2 r    int     2Fh3 M7 B' t, e' D# }9 Q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 Q2 R) l. f0 q6 I! [! _    add     ax, di( L+ ~$ r, k# [. G9 {8 ~) b! k
    test    ax,ax
( w' S& @& S5 p1 }4 j    jnz     SoftICE_Detected3 f3 K. s' _8 `1 d  A6 v6 ?; \
& ~. i2 y& R) k, W
___________________________________________________________________________
' P7 [! r. {7 u! z  o- i# Z# A3 `, f% ^6 O# C0 f+ g
Method 04+ ~  c8 q0 p& u6 ~/ F& G
=========% v& K, k/ U4 T
* v% L1 _" v& v" Z# O
Method identical to the preceding one except that it seeks the ID of SoftICE) m$ H; B! q# m' w, M
GFX VxD.
0 A4 n7 M' [5 y/ k2 l
. m4 D9 Q) f5 G! N( w! S    xor     di,di
) O% ]2 n! }: O9 i; w! J    mov     es,di
; ]" q  C1 g7 O3 V    mov     ax, 1684h      
# b, E2 u8 V3 L0 _# Q    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 I  a% ?7 R4 v, V$ \) B$ J    int     2fh
8 h5 e2 p6 v( o: B5 q$ v    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 x, ~: r( F4 e" T" v1 I
    add     ax, di
- N/ H1 t0 `8 ^; l  I    test    ax,ax
& \" G- a/ u) _; R    jnz     SoftICE_Detected5 Y  V1 t8 S: C  C% o
+ M! w; K$ \5 I  g' s6 n/ r
__________________________________________________________________________
3 `; ^# O+ u% U! c3 r2 z7 T# H
; M% k' u0 r  t& m9 y/ C: p0 n& S  G4 v- ?) v9 `- u  O1 L( I
Method 05
7 \0 \. _4 g" U( y; o* S7 i! u6 m$ l; |=========
9 g( ?8 t& \' m' U: ]7 `; D5 h+ W, s* T5 u! V8 r4 L% e
Method seeking the 'magic number' 0F386h returned (in ax) by all system( s8 p: ~8 a3 S, Y2 Z* y
debugger. It calls the int 41h, function 4Fh.
1 p1 I- b+ X/ s( FThere are several alternatives.  
# Q5 Z; ^" V2 {$ [. t5 E
7 _$ h( H# v: [/ s8 p+ lThe following one is the simplest:3 s) C+ C4 v( Y# p2 M7 G( P
' A$ E+ U& X1 T; h7 S8 ^
    mov     ax,4fh& i# r) v' X% L' B+ y3 W
    int     41h
, b0 l0 W+ N) V3 R6 n    cmp     ax, 0F386
, u1 |! Q* Q( R1 _    jz      SoftICE_detected! a) ^0 K% S7 F8 D: J

. \0 Q2 A/ k  E/ k0 B7 V! ?. m! H. j
, Z$ [  v: P6 W* INext method as well as the following one are 2 examples from Stone's   |* M4 d# [, x' M: o) {
"stn-wid.zip" (www.cracking.net):
9 z5 |7 n) I, B7 V, r
) g0 x- ^3 y( K/ l    mov     bx, cs
2 P$ i3 `4 }+ S% g) q    lea     dx, int41handler2  G  p1 M9 T; G7 \! p5 X3 \3 j
    xchg    dx, es:[41h*4]3 @- K3 Y6 h( S9 v
    xchg    bx, es:[41h*4+2]9 L, I2 ]/ a; p0 Y& Y1 Z
    mov     ax,4fh
3 z2 o0 v, q4 E( v' s1 H    int     41h
$ L8 u. R- v0 }* U" u# q/ P    xchg    dx, es:[41h*4]
' |1 R# Y5 g& F- d3 V: k    xchg    bx, es:[41h*4+2]8 r  W8 o0 Y: Q- E: J
    cmp     ax, 0f386h
6 I! n* n' r* t6 H    jz      SoftICE_detected
( n1 h9 J& a! w8 o" x
5 R0 @2 S  E4 p# e6 w, ^, rint41handler2 PROC
6 U8 U% K& j% V* e    iret
8 y! i% B, i3 @3 m1 jint41handler2 ENDP& Z, x7 V  t6 O# J
* j: g- q6 f8 R- ^' }+ n$ W' q

! @( L! ^9 T$ w4 T_________________________________________________________________________6 }$ d( s* o  Q9 q) s2 ]
! }2 u( w) _& R5 Y& x) @- |  p
- l; [8 Y# u$ [+ }; _* R2 @
Method 066 t8 z3 h9 W9 H1 f, G! o/ Q
=========
% p7 m. _5 F' r/ q- a7 {6 Q
" L3 j) Q: C$ ~
" ?. W+ o; P8 j  S4 @2nd method similar to the preceding one but more difficult to detect:7 C! D2 U8 W; \3 |1 p7 ?$ Y, }9 z
1 d! _  @6 w) C- A

+ b8 P7 O% e- |% h" ^# E' Uint41handler PROC# W( a# W1 Q& x* j  Y
    mov     cl,al
9 ]8 V8 E+ i! c' M+ ?0 Z    iret
  E. i; R+ |2 K' zint41handler ENDP" D8 ~: E1 B7 l' q+ {

! s) X1 H; Z" w. e! V8 e- M3 q5 n+ R) A, a
    xor     ax,ax
" b( Y, d* f: T    mov     es,ax1 r! G' u% a* `  e
    mov     bx, cs# o% W5 ^* l# ^: a" V) z
    lea     dx, int41handler( [$ z0 _. t: f
    xchg    dx, es:[41h*4]
" C$ r6 {( h$ j+ w    xchg    bx, es:[41h*4+2]
' u+ h3 y1 e; G- v( W/ y8 Q7 a* p4 U    in      al, 40h1 l' S7 |5 \; y* d7 o2 O5 V
    xor     cx,cx
. H/ ~% G& u1 k% v3 A% ?/ K    int     41h
& V/ n( }/ ~9 g& ^6 K& S: p    xchg    dx, es:[41h*4]  d. m5 b# K( P; V( {0 _8 M
    xchg    bx, es:[41h*4+2]. j( e. N  l3 h8 Y- p7 l1 C2 s
    cmp     cl,al
' s) A. g8 F. ^% z    jnz     SoftICE_detected! }7 S% F7 |3 v: n: k: {
/ {3 o1 g( |9 ?# {6 j+ _9 F5 W
_________________________________________________________________________
# b+ r) I; o: b/ n& \$ \. W
- n" X  s9 K; N; U% t# q0 T. QMethod 07! j! \( t9 Q; f" v$ M' b% T
=========$ ?9 z; f; }& ~! L7 ]# E5 H
9 W. S5 L" l( C# S1 |" G
Method of detection of the WinICE handler in the int68h (V86); x" k* T8 A( e7 `

2 G5 _, P7 A* Y    mov     ah,43h
1 f+ w/ ]/ _- D) s& U# T    int     68h
) P) H0 p7 [. w8 [7 P. b/ T    cmp     ax,0F386h6 ]3 A- p  _9 V: r
    jz      SoftICE_Detected# ?$ S* `0 ~& p
5 `# {- z$ a3 Q; Q! v- y

8 p$ Y6 e- |, l# Q6 D& u=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) J. J5 e" V' o  U) v8 J   app like this:7 @9 I1 Y8 C, E9 R! B
) ?" k8 s6 m1 F! P" A5 R* }
   BPX exec_int if ax==68* o! r8 Q& o' K. [0 n5 G8 N6 Z" H
   (function called is located at byte ptr [ebp+1Dh] and client eip is( W1 k/ N4 p' B: Y- H
   located at [ebp+48h] for 32Bit apps)" ?) g3 g% ~/ H1 g
__________________________________________________________________________
8 |+ M. M9 k+ M' G) @
) H. S6 H; A" C( s/ y. y
7 E$ ?- c0 P/ P- c9 IMethod 08
. C7 \/ q+ [/ r+ P=========
( g1 K5 ^+ {& |$ H, n" Z3 N. Y0 _# j) D6 U4 ~
It is not a method of detection of SoftICE but a possibility to crash the
) z- B2 n9 U- x/ ~system by intercepting int 01h and int 03h and redirecting them to another- q& R$ P7 {9 }4 n0 ~' W
routine.
* F/ y& v/ V; jIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 J6 n0 x9 f' c8 C* oto the new routine to execute (hangs computer...)
- |4 G, r- Z; `9 _5 l, Z, Y; j0 s4 L& w* s
    mov     ah, 25h  j! a4 \" [" ]. W, V  R0 b' f+ Z
    mov     al, Int_Number (01h or 03h)' F! q' v2 C7 n; }  \
    mov     dx, offset New_Int_Routine2 l2 Q# G) v6 P3 _( Q
    int     21h
9 ?# `) Z: w- [! h9 D. O) C  ~3 o  a6 K2 G2 r
__________________________________________________________________________. A' i7 V& K/ g+ g/ s; q( ?+ D) B& Y

( \4 n7 X( J0 k) }& @Method 09
' `2 O% D7 T6 }% {. z* Z=========
$ c/ f8 e1 j/ n  J) m" W- }4 s/ o5 g5 [" }% O6 Y
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
( H- J' g0 B9 [performed in ring0 (VxD or a ring3 app using the VxdCall).) p5 r; K: ]# x
The Get_DDB service is used to determine whether or not a VxD is installed
6 A3 P6 }' ?8 }% Y! }' Xfor the specified device and returns a Device Description Block (in ecx) for
& W; r7 F% T1 D: W/ e) Wthat device if it is installed.
8 U  G0 A  N  m; B8 S$ {2 _0 i" i9 d2 I. ?  K! Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID5 A9 E! B9 |1 d  `5 T$ g! w
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" O$ P* |7 T/ s8 q; v1 p
   VMMCall Get_DDB
3 {- v# t: v% ]' G% Y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% T8 }9 K. P9 W7 c" F/ f6 S' f

* |$ n& v' u- I3 ?2 B; fNote as well that you can easily detect this method with SoftICE:3 m$ l- I+ @' n, W0 k
   bpx Get_DDB if ax==0202 || ax==7a5fh! P* Y' Y8 S* w1 [3 H
' s/ \! p4 r8 H- Z; h! F! j
__________________________________________________________________________
" t+ F) f9 r8 o; \+ P* R2 a7 b7 `' ^% e5 P2 R
Method 103 |# q8 g5 S3 D9 x! a
=========
3 I. v. X8 k+ _# T
, c, a5 ~: T5 X; ]  O. Q: H=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with* Q* T- O+ P6 h: b
  SoftICE while the option is enable!!! z/ {$ R9 y. R, v% Y, i' p4 d$ U

  ^; x2 o2 t2 @* v& n! UThis trick is very efficient:& Q! }" d- [5 G6 \  O
by checking the Debug Registers, you can detect if SoftICE is loaded9 x: f" y+ \: \5 O) d; `
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# d) x: R1 V' }" v! n4 t4 j  uthere are some memory breakpoints set (dr0 to dr3) simply by reading their, Q6 f1 n# X* F) |' P$ A
value (in ring0 only). Values can be manipulated and or changed as well5 m& a# y9 u8 c9 K, t* k2 y; d
(clearing BPMs for instance)3 W& H$ b- o8 @2 r/ F& O

4 D9 u+ a$ M* @7 Z2 Y__________________________________________________________________________( h5 w9 g6 p7 W% N; x1 H

6 s  _  d3 g  R- @; i, W3 gMethod 11
4 ~7 c2 |2 f2 ~' V' M9 g" D=========
( e/ X, E! L4 K; o4 t0 c3 T
, m; p( Z6 }5 z# UThis method is most known as 'MeltICE' because it has been freely distributed
; T5 y1 ?4 y  c( G7 q$ R! kvia www.winfiles.com. However it was first used by NuMega people to allow
" \0 j/ c4 d  bSymbol Loader to check if SoftICE was active or not (the code is located5 p. ^3 V# p/ N$ D" y4 o4 r
inside nmtrans.dll).2 {/ z; F2 c8 G; O, \. P
3 L; d$ J$ z" C- C' D6 b
The way it works is very simple:4 [9 c& Z1 B: k3 [3 c
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for3 Y& ?5 ^0 |. ]% v  Q; L
WinNT) with the CreateFileA API., M. w8 N  c9 A; D7 s0 b

5 Y8 ?# w0 ~' G) H9 D6 BHere is a sample (checking for 'SICE'):- v1 T# f2 M9 n; a4 |
* m6 O( J/ x7 N; t' n8 Y
BOOL IsSoftIce95Loaded()
% R4 c& z/ V; y2 l% {. F+ I{* x3 g; C0 s2 f5 A
   HANDLE hFile;  . H. ]. N; |2 a% [1 X& v
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ @  A  j! W3 d8 ^. ^: |                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! w0 F: g* d& c+ u. o                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* k% `  I, j* w( R6 u, N( D, X
   if( hFile != INVALID_HANDLE_VALUE )1 T0 B# j5 M2 f4 K
   {! N+ K& }4 C7 h# L6 [* Z. a6 K. t" U
      CloseHandle(hFile);) ~" S3 ~: R9 H/ P5 q, f3 P
      return TRUE;) f( [$ R8 Z* h! x9 [* e' V/ \$ V
   }
+ n* p9 h. U8 B; ]9 X* G   return FALSE;
" c0 f; u  W7 @: d: x. i- U1 ?}0 m/ }/ p3 M1 L7 p* f
8 E7 @" H/ W9 j$ ]
Although this trick calls the CreateFileA function, don't even expect to be/ Z+ Y+ Z& h7 w- a; L
able to intercept it by installing a IFS hook: it will not work, no way!
  c5 M% E* F3 ZIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
; I5 s2 }$ g  x' `' [0 R% {, T( R; yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ v; r8 ?! V2 N6 P7 {and then browse the DDB list until it find the VxD and its DDB_Control_Proc: W* t& X) T2 ?3 ^/ A% l6 P5 _! `
field.6 M! O" n- |8 g
In fact, its purpose is not to load/unload VxDs but only to send a ) ^* R; J6 s+ G% ?, ?. x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( e5 m6 X2 B! l: ~to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 a% b# E# _7 [9 S& D4 p& n# P! ]
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
8 q9 u0 R9 g/ c: |9 G1 C4 u! qIf the VxD is loaded, it will always clear eax and the Carry flag to allow: d! G8 R1 r& Y7 Z5 ?
its handle to be opened and then, will be detected.
$ N! X% f9 d  `$ ?8 o. N% X2 z- gYou can check that simply by hooking Winice.exe control proc entry point; u+ ^2 b( _, ^3 L) c3 h8 Y
while running MeltICE.$ s) f2 ?5 N; W' k! J5 M
' h" O$ g( G$ R% B

5 s: h, }' C; `  00401067:  push      00402025    ; \\.\SICE- H# {% ]) Z8 @4 O
  0040106C:  call      CreateFileA
6 w4 ^0 x( P( T, h3 q  00401071:  cmp       eax,-001& E2 {4 x2 [% j* v
  00401074:  je        00401091
) X& K3 ?1 D  A. |7 c1 q9 ?5 f- J' F- t2 Y& J8 u9 G$ W" A
! ~5 }0 C. }+ F  |. Y# t% X5 ?6 Y
There could be hundreds of BPX you could use to detect this trick.
* G5 b9 G" d, N% g+ \-The most classical one is:
+ e% r0 S& l# k* u% d' U  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||# f9 r6 W$ r' V8 |
    *(esp-&gt;4+4)=='NTIC'
9 b$ u. x4 K: n+ D! R5 V1 s: X1 U8 e0 P( B. ^  z3 x
-The most exotic ones (could be very slooooow :-(
+ ~" z: I2 }2 M0 ?/ c+ {   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
' j, d, D. @3 q: p8 x% H     ;will break 3 times :-(
. K& x# m1 H% \  w  V
* _( d! q  Y# x9 P; f8 U-or (a bit) faster:
( n# V+ \! N5 e: {1 K, v   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" B0 e* q0 `& o9 M" b; h

) I- P9 v! g9 H3 F1 h- s6 i) L/ I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & X2 C0 r! J5 @4 c# R. ]
     ;will break 3 times :-(
2 t0 U4 A& N2 K
& S0 ^1 P% E0 b9 P-Much faster:5 z! \; t* t/ O0 e/ R
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 g" h, @$ [+ Z4 o+ J, Q4 A9 X, x5 f' x- d4 Q' q; J
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen" x9 p/ A% o( r  N  B% G5 h- ]& `
function to do the same job:
  _! z* j! @. V1 Z' }% k: S3 l3 {7 a* v7 f  E
   push    00                        ; OF_READ
- D; F+ p4 Q/ h/ l2 ^   mov     eax,[00656634]            ; '\\.\SICE',0
" d6 |9 A% P3 k$ h# [4 P: o1 n, m   push    eax7 `5 o8 C9 t- R6 K& d, Z1 R
   call    KERNEL32!_lopen
& j; n  _8 V' j/ P9 H   inc     eax
' s7 C+ n8 W. T4 V* U4 m   jnz     00650589                  ; detected
( g& t5 C' e" y; p. ]   push    00                        ; OF_READ+ d1 w- j6 g4 ~  V* e9 s* _  E# |
   mov     eax,[00656638]            ; '\\.\SICE'
* v2 d  A9 F- K4 z. f5 J   push    eax
. z- Z$ A3 e! q, `   call    KERNEL32!_lopen: v2 r+ c* @! @
   inc     eax; L- R# j3 L  C5 d
   jz      006505ae                  ; not detected
- A0 y9 y( a! l4 [4 V' H, f9 v8 ?- E9 h! G0 D6 q
$ l5 H8 F3 q& M$ Q8 I; M1 J
__________________________________________________________________________
' X9 K9 Y5 g) j$ d( U1 r3 }0 I2 ]! @6 C2 K! f
Method 12
% T; N0 p  [% M' P5 G3 n0 a: h=========% i; r$ |) Y& S
- ^' h5 r+ W7 H6 P. W# C& p
This trick is similar to int41h/4fh Debugger installation check (code 050 N" A' q! U0 c3 |/ m! g7 u
&amp; 06) but very limited because it's only available for Win95/98 (not NT)- O& A1 @2 F5 T& R/ |* R5 M
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. J& z. C$ F, K  g5 g+ G

' Z- V# Y% r5 ?4 l# }1 ^   push  0000004fh         ; function 4fh
8 {' i! j, E2 ?5 ?' b6 H! V& N) v   push  002a002ah         ; high word specifies which VxD (VWIN32)
/ g& b% A9 w4 o. ]6 M                           ; low word specifies which service& r$ Y5 Y9 p) a9 j& R; [4 D1 F
                             (VWIN32_Int41Dispatch)
, J  t9 E5 c) E0 Z- Y( u# y/ Q5 l   call  Kernel32!ORD_001  ; VxdCall
! O# g( o, q# E) U% O3 j   cmp   ax, 0f386h        ; magic number returned by system debuggers) m6 X: n# ~) P; Q% b7 {! Q7 c, N
   jz    SoftICE_detected
* {6 E$ m  ?% C7 S1 W( ~/ N! d+ P' Y4 V8 `; @$ I" ]9 _# o
Here again, several ways to detect it:
; |- R  e" ?8 h( q1 H4 P1 ~! R
) Q# p& Q  g' v. O7 h    BPINT 41 if ax==4f
! k) M) t( ]1 E, O
/ g) C  t, C' u    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one: W+ ]3 J3 c$ V" x

* y0 O( B# B9 W- ~    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 f* u9 F1 L& ]0 j7 R6 @$ C, ]0 ^5 }  C8 A7 @0 ]% |
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% o9 F3 h5 _) c9 O# o" ]# Q) b  z& n2 x
__________________________________________________________________________
+ @4 g1 f( ~% A
6 j# \/ X2 f6 F" v% Z5 j) B9 OMethod 13/ J' u- B7 x- R0 \
=========
6 v" x, s5 G  y) c8 n
  O6 E5 a' M9 L) Z# [/ |7 _; }Not a real method of detection, but a good way to know if SoftICE is
9 H. `# I* N% c/ P" }. Tinstalled on a computer and to locate its installation directory.' D3 D0 v1 J% A6 T$ o& `" K- y' @
It is used by few softs which access the following registry keys (usually #2) :
, Z, {3 B# y. I, e4 B6 V9 k4 o9 I: ?1 c4 k$ i9 B  T+ `
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 R* n% i- |# ^3 S& s
\Uninstall\SoftICE
. Q, i. ~0 W1 j' {' J-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* ~  l* k) N9 r0 A
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ O, y3 F2 D: {9 a' D7 i\App Paths\Loader32.Exe5 _" S% c. h0 `4 x* j5 E% \
: I! U# ^0 y3 M% y) v
! W5 ^! t" M, \8 N6 m, ?
Note that some nasty apps could then erase all files from SoftICE directory
0 M: j' G+ Q& Z: Y1 ?! D+ G. l* ]4 y(I faced that once :-(7 B" r, {( }' @5 o, w

: B2 M/ B% r7 `, OUseful breakpoint to detect it:
7 f$ n( R" }" Z) o# {9 ~" w' C5 t' d# W0 }$ q. Q5 V
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ a0 H1 v. S- o( R! N& f3 t% N1 E8 L" N. W4 \$ Q- O/ ?- m! H9 r& V
__________________________________________________________________________
& R6 K4 P8 H; \" E" y( T* _  B+ }9 i0 x& _3 D
( H8 J- b5 E4 n7 T2 d9 K, {
Method 14 1 O5 O5 z+ y3 i
=========
( _' ], c' t9 y: i; h# B7 A6 }" T* S  \( o3 ?2 @7 e7 K; g. _0 T# z: ^
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
- j5 |% t; G- f0 j( h, Yis to determines whether a debugger is running on your system (ring0 only).
. V+ [$ C* F& ]- m8 t
. T8 Q0 E# C, c0 Q   VMMCall Test_Debug_Installed9 k1 N4 m. @( f& m4 ?
   je      not_installed
1 [6 F. K" @* U5 l  i7 B2 x/ f  w) k2 I0 ~
This service just checks a flag.
0 Y: f; l; ?1 c! z3 |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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