About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ b+ }! j4 S% S# p+ y<TBODY>/ i) t  B: H  ~
<TR>
) V8 }' h5 g& n<TD><PRE>Method 01 $ u- _6 P! u, S" V0 s+ O
=========* f/ T  i+ o  h- b1 u* q+ A0 t
& P" O9 a' b% u* o* z
This method of detection of SoftICE (as well as the following one) is1 m" R0 P/ E7 `* E
used by the majority of packers/encryptors found on Internet.
, A$ v! B! }+ U1 nIt seeks the signature of BoundsChecker in SoftICE/ M  {1 J7 D) w: {: s2 a

1 ]$ ~3 c2 _& y7 Q$ R    mov     ebp, 04243484Bh        ; 'BCHK', V4 i) _9 d8 f" @" _" c$ N5 @- D
    mov     ax, 04h2 `0 b- f, M: R8 L$ z  z" {
    int     3      
; Z# n' m  Y4 E/ P, m$ i    cmp     al,45 a2 W% @$ K+ ~$ V2 }9 W/ d
    jnz     SoftICE_Detected
) }$ J7 m. C' W# @5 n, B8 ]( P' h: _$ }7 V. Q
___________________________________________________________________________9 k- }& t8 `& i
3 Y9 u% l$ r9 D' M* k
Method 02# V7 ]# q- a& o0 i" p; C9 V
=========8 ?/ r% y" q5 C6 r4 ?" m

, a3 j  @8 T  |* pStill a method very much used (perhaps the most frequent one).  It is used
4 o/ O0 B0 S6 A) xto get SoftICE 'Back Door commands' which gives infos on Breakpoints,. ]6 _4 M- n* B; U  k2 u3 ^
or execute SoftICE commands...
6 E$ t8 q- x  }* R3 iIt is also used to crash SoftICE and to force it to execute any commands3 o/ Z0 J! Y& ]/ s, H! @
(HBOOT...) :-((  0 w7 Q1 @+ G: W9 ?
1 |5 `; r! z" y3 \
Here is a quick description:6 S9 y/ V5 y, A+ l# H
-AX = 0910h   (Display string in SIce windows)
  ^, ~' d2 [% u" k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), w5 U* f: b2 E1 x; @% Z- u
-AX = 0912h   (Get breakpoint infos)
0 N0 S6 u' ?" C-AX = 0913h   (Set Sice breakpoints)
& E# b& j) J. |" w-AX = 0914h   (Remove SIce breakoints)
4 D# Z- c* F/ N! ^) R
8 L( S" x+ E+ I& JEach time you'll meet this trick, you'll see:0 S( I0 R6 m2 ]; ?6 P' d8 `
-SI = 4647h' N" q% V5 ^& [7 H9 c( C
-DI = 4A4Dh# T! @1 g# s3 M* W) Z4 D# ^
Which are the 'magic values' used by SoftIce.. p* ]+ l# `: R5 I2 v4 q: {7 z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h." l1 c+ j9 H  s& \+ x: P: x$ y6 q

( c. ?  R+ X" |9 eHere is one example from the file "Haspinst.exe" which is the dongle HASP
% ~( {# ?( k0 d1 X+ U# jEnvelope utility use to protect DOS applications:6 M( Q$ ?& r% i+ q6 N
8 ^6 R3 K6 C& F4 |% k) m. S) R5 B( l

, A7 ^5 S! n* g; }4C19:0095   MOV    AX,0911  ; execute command.
+ ^1 t* {) W: L, A) D) X4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 o) X) K) G; G- R
4C19:009A   MOV    SI,4647  ; 1st magic value.# l2 d) g# V9 K9 Y4 F5 k( x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ ~. N9 C( F8 D$ r$ j: Z2 D4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 [3 F8 m8 q6 ~3 a$ |8 |3 F! i' R
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
8 A* H& J5 |4 h8 e: B- d! {4C19:00A4   INC    CX
  f6 \) Y7 o' ^% n& ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
9 C: f5 b3 O& e4C19:00A8   JB     0095     ; 6 different commands.
: [: G. s, c$ B$ v5 U& z; _3 I4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
1 x$ g) F$ F7 u! g  U+ S; M/ f4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 i, ~: w+ u: ^- E- N" Z# i
$ p& e8 ?" u% |/ R
The program will execute 6 different SIce commands located at ds:dx, which
6 w; H& y5 y* D( Uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 A! m& I$ m2 w) b0 ], a: @
' ^% {1 c# c  e6 |. M* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 T- w' _2 @: w6 u8 O# f$ E___________________________________________________________________________
& ^( e) ^9 Y4 n( X) f4 ?7 D4 M2 j
/ n5 ?3 C8 ?& i* Y
4 l5 ]( X; r6 E) v6 }" pMethod 03! x8 T8 s% g& S+ m. C7 ~- T" _
=========. B' z. |# ?  L& r2 @
& d! V4 q4 F+ v9 \. l6 U+ X; s8 M& K
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ R$ H1 x! f9 l0 e
(API Get entry point). M* }2 t) i/ F# t: v, G
        
# K" \2 C- S8 T+ \' @1 i( e) N' K$ \( d
    xor     di,di# ~0 n2 P/ {: x/ T
    mov     es,di
1 y3 ]4 T3 x- h3 g    mov     ax, 1684h      
, y. R) J& [2 h+ L& ?! P    mov     bx, 0202h       ; VxD ID of winice& u; x, C7 {; E4 z
    int     2Fh
+ ?- R3 c2 s4 Z' J8 ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point) {/ G8 H7 N9 w4 f; \
    add     ax, di
, p4 N8 O" W, J' J- n2 h% \    test    ax,ax
" P6 h2 R0 M' o    jnz     SoftICE_Detected6 b' p+ I# F$ \
% u, X: @/ E& w3 P- `4 \
___________________________________________________________________________$ m; S/ ^: a2 U

* o" I+ {9 Z$ e; i2 DMethod 04
' A0 C4 @' \2 h9 O; W7 u8 [=========. U& k: q5 g. ]
, L1 L2 U" m+ U: `4 Q9 B
Method identical to the preceding one except that it seeks the ID of SoftICE& j3 G# I8 E' ~; y
GFX VxD.. T3 h+ e8 S: m3 {
! u. s# _4 @6 w) J* N
    xor     di,di
1 m) F) s1 i2 Y& d2 B0 P; T3 N    mov     es,di
. G. C; v) \( F2 a' W7 N2 V% u    mov     ax, 1684h      
* v: X; J9 L" J    mov     bx, 7a5Fh       ; VxD ID of SIWVID' J( D5 K* p+ T/ o0 f9 [- b
    int     2fh
) u9 Q! T4 L# e% h" j    mov     ax, es          ; ES:DI -&gt; VxD API entry point: P) v& m- Q/ w5 _/ u  R; `! H
    add     ax, di, x& W+ o' D* L. M
    test    ax,ax
$ \$ f  n/ E2 v) q# J    jnz     SoftICE_Detected
( t$ m6 T5 t- v4 Q" L
% X. q3 U$ n1 e7 A/ c* s) U# T% R) l__________________________________________________________________________+ Y/ H+ j6 _' G

! ]( ~2 y9 d' `+ \0 b# r. f9 e
# W& J2 U# ^' N" C& KMethod 05
) k3 m3 _& n' Z4 M! S=========1 l/ P# K1 a% S6 Q  u! ~7 Y

6 M# b4 G' k4 ^2 Z' I( c5 `! k) IMethod seeking the 'magic number' 0F386h returned (in ax) by all system' S8 w. ?% k  J$ e$ I
debugger. It calls the int 41h, function 4Fh.
/ M) w# T7 k* o, u& d5 I- JThere are several alternatives.  
( U6 V( b# ?; p) T9 p  s' w; }% g; U/ n2 k! Q
The following one is the simplest:- l1 K- ]* q: Z  ^; ^$ O8 G3 k  Z

# b; q1 v2 u! O' z" j    mov     ax,4fh! d, d  G6 f$ K/ O, O1 \5 i; @
    int     41h# E% ]$ V3 H5 R0 w
    cmp     ax, 0F3869 Q) ^, C6 p* e# G: {
    jz      SoftICE_detected
8 Y* q# X* V, Z7 v' w- N& a
+ z7 |- v1 q/ i# @4 ~' ~, y) q  h  W) o2 f+ ?' y, Y  X8 M
Next method as well as the following one are 2 examples from Stone's
2 c9 h; A% d5 }6 ^"stn-wid.zip" (www.cracking.net):
7 m# W9 t: X5 S% ?, _; O/ G  U7 _, k, k/ U
    mov     bx, cs8 ?- x7 b' n6 y
    lea     dx, int41handler29 q5 s5 m' b" L& ~! B9 t
    xchg    dx, es:[41h*4]
, m4 q: Z6 ]0 `) [* Y    xchg    bx, es:[41h*4+2]# H- Q0 ?% F' u( N
    mov     ax,4fh; X, y+ I2 {( \
    int     41h+ R- p: U! _/ T1 E
    xchg    dx, es:[41h*4]
) m# B% I: n4 z) o    xchg    bx, es:[41h*4+2]8 I' c* I. ]7 \. }7 c6 M7 X# U
    cmp     ax, 0f386h. g6 l4 S& L  m  w. C3 G2 k  T9 U
    jz      SoftICE_detected
$ P1 I! {& {* b% m' u
. z* v7 k4 r; uint41handler2 PROC) q7 ?$ q. X( P$ A! R6 L& b
    iret: X& _( k$ B% H
int41handler2 ENDP8 ^* W4 E4 w* b- @' c: g

' M% M- U" |, i" @- I+ |" M+ D7 b# \6 G8 P% W: q1 d" _6 n
_________________________________________________________________________8 c) C  t$ u/ l& x0 {

0 }. b; |) z- A) w( j0 ^# n. x$ J9 N# g
Method 06
* [1 f- e% Z! e+ Y" \) J- ^=========, y$ C6 X& Y* h( N7 D, c

) t" C1 c9 U, G& u; Q  S' @/ |/ l* ~' I$ v
2nd method similar to the preceding one but more difficult to detect:, Z3 A3 \3 |* s0 q# ?
4 X$ J& ]6 M% A& O. b
3 I9 z; Y! F' T. ^4 V& ]
int41handler PROC
$ A9 A' |6 A# g4 K    mov     cl,al' |7 S" D( }* c+ S
    iret% K0 K" I6 t7 |0 d7 I9 u
int41handler ENDP* Z) Z) B7 n' Z: Q1 H2 p
  Z- W* ~2 A/ U, F3 s% |& k8 ]
0 L5 O1 Y3 N$ H6 K& R% F; M% C
    xor     ax,ax+ E$ j5 Y; D5 G. Q) Q
    mov     es,ax
# f! `) [" W  @; ]) M" h( P6 b    mov     bx, cs5 u, ]! W- r: u0 m  R' k- t6 Q' v
    lea     dx, int41handler' l2 \! Y' v  {
    xchg    dx, es:[41h*4]
. P, _0 u( Y8 m1 f" h$ [( a; K/ Q    xchg    bx, es:[41h*4+2]* S6 G" H- a! t
    in      al, 40h
5 h5 D5 i6 A' T' Y5 V    xor     cx,cx3 `4 r6 h* z) {9 Z
    int     41h
% M$ O2 N$ |/ R3 g; A' @) p    xchg    dx, es:[41h*4]) Y5 W7 a( P# h" q( I8 w  I3 [, U/ ]
    xchg    bx, es:[41h*4+2]% [1 n1 t( v. U# @; O" r7 N
    cmp     cl,al
* ^+ M* x1 `) Y8 _    jnz     SoftICE_detected
5 M; a7 D" d' S6 ^7 `9 Y: z
. [/ F& n6 P- C+ B9 |_________________________________________________________________________% ?) c; F. W  c3 E
8 M; X. \2 A/ O$ N  s
Method 071 O8 ~5 d4 R# C9 T% y' g" d$ R
=========, _; u0 W* S( _  E; f- G

& W* V$ u+ H5 l1 mMethod of detection of the WinICE handler in the int68h (V86)3 G/ E1 |$ a. e4 D8 q

) _6 X* C1 d. a. s' k" A3 r    mov     ah,43h- _6 j8 I5 o6 {6 g) H0 [+ S
    int     68h& ]7 K) @. _; g+ c
    cmp     ax,0F386h
, T7 j- ^; z+ b. j/ C    jz      SoftICE_Detected$ Y/ j6 V% T% g( ~
4 o; X9 @2 r9 B1 X. \# B8 y: a
; W: w8 e# D0 t4 p! F$ f, O  T
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 U  A" }) d* W# q
   app like this:/ p. z% D9 i+ Z+ @  T1 U

- h3 T. Y* V5 \* ]   BPX exec_int if ax==687 [, ~! B: _$ h  ~' m! i
   (function called is located at byte ptr [ebp+1Dh] and client eip is, y  F# g" _( ~/ T2 k4 j; I
   located at [ebp+48h] for 32Bit apps)0 W: l5 N/ s) c' g  u; @
__________________________________________________________________________! T5 f! A( G% c) w' w
) R! l, y# e) w  G2 u
  p' h/ ^/ ?* j  V
Method 08
7 Q; \" E2 u, Z0 I# |=========
* j- ~3 S+ j1 T
5 X3 i# q! n" [. pIt is not a method of detection of SoftICE but a possibility to crash the5 O. ]9 Q3 V) I6 [
system by intercepting int 01h and int 03h and redirecting them to another
. f* T$ P; j& j" u7 sroutine.
* V' b8 I! D; q3 l2 E! XIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( z6 H. T" P9 Q# G/ }) V
to the new routine to execute (hangs computer...), d$ S8 I" V; U; ]. w) I

; ]+ X7 n7 s$ v+ y% w8 q- u    mov     ah, 25h
9 _. E. K% i# M( B" [) W( L    mov     al, Int_Number (01h or 03h)+ M* r5 b- t2 p- I" |
    mov     dx, offset New_Int_Routine. c; `. m$ _" l0 [; b# n2 X4 Z' ^1 \5 d
    int     21h
( ^+ ^  a3 F3 @9 e8 d
) k' Z; u6 a9 B8 o0 ?4 t2 d__________________________________________________________________________
' S. W. S& Q# P& l& j# c% g# k1 O( O4 @. }+ \0 h  E  F( ?6 Q/ ?
Method 09
( D5 O, N# h- W. T  l=========
+ W/ y+ `" W( t$ \1 \
9 b6 B+ ?  }+ v: PThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 {0 b/ _. X, b8 H9 X% m1 Q5 r
performed in ring0 (VxD or a ring3 app using the VxdCall).
4 N, h, I7 ?8 [( j% tThe Get_DDB service is used to determine whether or not a VxD is installed# [4 u3 O! s" Z7 S' N/ W
for the specified device and returns a Device Description Block (in ecx) for
/ K* Q# K5 I5 r; e9 D2 vthat device if it is installed.
2 X7 X3 H- A8 n6 R% T5 Q. p  ]  ~; O
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) t. `% f+ @- `$ u   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 z  y& H7 T8 T- H+ {- q
   VMMCall Get_DDB' @# F8 U0 E' u" d( d
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 a$ s+ v$ u& S
2 V6 }8 z- B  a# f  [& N' z
Note as well that you can easily detect this method with SoftICE:- j. m$ `+ m& f, f0 I5 L
   bpx Get_DDB if ax==0202 || ax==7a5fh
3 k5 W$ Y6 P7 o+ b- q! F8 U
# ^2 Z( i0 ]7 F+ V2 T, H/ g3 e__________________________________________________________________________
/ O/ n$ q& \% b8 d. L! G$ s, G8 c. i
Method 10' E1 z- W9 l" t9 ^" S# f. ~
=========
! R7 |% n2 g( V$ D$ M
8 g1 I- T* _" y6 H# e2 [" F9 T=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
! j6 b" c" _7 N$ D  SoftICE while the option is enable!!
% l: c4 l# m8 e! L- ]& C1 t% o8 x; o7 W8 P
This trick is very efficient:
2 Z/ ]6 b# K: `7 P3 Cby checking the Debug Registers, you can detect if SoftICE is loaded
" _4 S; P3 @# r% ?& _* F(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" i) P8 x- `0 W0 w# d* Lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
1 v) W* T: _+ K, |4 r8 W6 Cvalue (in ring0 only). Values can be manipulated and or changed as well
8 ~9 e8 ^" i: f7 A+ u' Y(clearing BPMs for instance)
! H, n0 ?) e5 A& }/ @6 r( x* N$ b- l5 @; X$ X- O
__________________________________________________________________________
$ Z: n% K5 u1 ^4 p: F) N4 L8 k# ~# R2 u  s1 E
Method 11( Z* W2 Z* x, V7 G; C
=========" }! I* F2 S6 ?' ^$ P
  W& R: j1 G% B9 Q, G- F7 N2 }
This method is most known as 'MeltICE' because it has been freely distributed/ J6 {. v; H: T
via www.winfiles.com. However it was first used by NuMega people to allow4 @0 k8 o, p4 X! l# p* V3 c) l2 ^
Symbol Loader to check if SoftICE was active or not (the code is located
: J8 M" v5 v9 B4 I6 vinside nmtrans.dll).
8 {6 P) E% {( c6 f7 C7 y
: _- J; b) |. c# z2 E& kThe way it works is very simple:1 Q% n- R! }9 s" E" o5 g
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- I1 K' @8 A& b2 L( _4 l
WinNT) with the CreateFileA API.
+ e1 n. j* v) C; Y: `- d' ~. P
9 c* q. W- S/ \  Z* ^8 x* CHere is a sample (checking for 'SICE'):
, x! @  S9 B5 V2 |: O+ k* D* W1 u* w
BOOL IsSoftIce95Loaded()
$ m/ |7 f* O4 M) _4 m2 ~2 i1 E. n{
+ A! i* G! ^0 B2 C3 l( u; _   HANDLE hFile;  ( r; _# [0 M# @! f$ q3 O9 y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 j+ S9 H* ]7 T$ c% }) _. H" W& l+ ^                      FILE_SHARE_READ | FILE_SHARE_WRITE,- Q3 I  K' g. @& k- F
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);! o7 ?" G1 w" l' j- s* G
   if( hFile != INVALID_HANDLE_VALUE )
7 y) y% C6 U& g3 Y3 H! G   {
7 M& |( q. t" `* ]( I9 l      CloseHandle(hFile);
4 E% u: w0 C! y$ o      return TRUE;
7 [6 n- ~# o4 k  a8 ]   }
( z% }; k1 Z( u, E   return FALSE;4 h0 [5 t( Q8 _) j0 ]2 y" a
}! i6 m( ?* C4 p% |- ~; E3 v% R: A
, y. `! m  ?& v
Although this trick calls the CreateFileA function, don't even expect to be" F: q. {, S# g1 T4 r' E) J
able to intercept it by installing a IFS hook: it will not work, no way!
( Q& l, U5 s' ?' [: z6 o9 L+ iIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 z7 f, H* C; i5 p8 ?7 zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 B, Y+ |8 T  H5 Z0 e- d! qand then browse the DDB list until it find the VxD and its DDB_Control_Proc
  B3 ?$ b5 W+ L* E! x/ v: j' |field.
0 X' t2 b1 A6 L! E: `! I& X6 p1 s5 OIn fact, its purpose is not to load/unload VxDs but only to send a " d% c8 x* C/ s  G
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- n6 U% E) k0 ?, w( [+ Vto the VxD Control_Dispatch proc (how the hell a shareware soft could try
; y0 ~1 [* z! f4 vto load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 A' Z7 H7 j7 Y9 f5 k' bIf the VxD is loaded, it will always clear eax and the Carry flag to allow
2 e0 X3 M! U* {+ |  j, c7 T4 y$ Fits handle to be opened and then, will be detected.
8 V' i  H) J  K1 ZYou can check that simply by hooking Winice.exe control proc entry point# S$ n0 V, s9 _
while running MeltICE.
( O2 D- l* S/ p9 r5 }* b" l2 Z9 ?( [( a" _6 C

1 w% A7 m; W6 G5 M  00401067:  push      00402025    ; \\.\SICE
5 i  _* \- F: l; G' S  0040106C:  call      CreateFileA
4 }3 Z' y, W# X4 f7 C7 L9 V  00401071:  cmp       eax,-001
. ]) E! ~- y6 E  j: N  00401074:  je        00401091# w* s- ?" C, r* \
5 T( v; q( B; c. t

4 s9 O! [6 h  s. L% fThere could be hundreds of BPX you could use to detect this trick.
4 U" L  a! @: @3 E3 S-The most classical one is:/ ^- [* {" W: y$ q+ ~
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 V; @5 U* O' M% B4 k6 l
    *(esp-&gt;4+4)=='NTIC', V  A8 u" N9 }
* [- t# G8 x  o. h+ H, o  b
-The most exotic ones (could be very slooooow :-(* j3 t. A+ i9 f1 M, Z. T
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( l! p) i0 W8 ]& L1 x
     ;will break 3 times :-(" S% b* V  m7 J/ }! t

, Q' g% N/ _, ~' S2 A-or (a bit) faster: , F" N/ x( O" E  u, k" L! Q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 X8 Z% m5 k1 i5 w  W. X
! {: R4 _, s$ p* B( M0 o5 L
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # o: a$ F& p4 d* }6 F
     ;will break 3 times :-(" h0 o' h' i8 \

5 |/ j* u+ _( c) K/ \6 g+ w4 t-Much faster:
. G( ]7 m3 n- k  r0 X' ]   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 u9 A3 u, T- f* b

7 W# a' y. q* Q2 P7 `5 j6 d0 w- d1 LNote also that some programs (like AZPR3.00) use de old 16-bit _lopen  L- q, U4 @+ G2 d( w
function to do the same job:
7 P! t+ X) d: C0 a; F( a
, O5 Z9 Z- V: m+ N; L. R, {   push    00                        ; OF_READ
0 N3 ^1 t" r; `) k; r$ m   mov     eax,[00656634]            ; '\\.\SICE',0) `7 L1 ]; y8 U# b  o, e
   push    eax
; n# L/ X1 \  k! P4 X4 I8 C+ }  Z" D" J   call    KERNEL32!_lopen3 B+ `" O( w9 M; o& [  m8 O3 X8 n  A
   inc     eax
# |0 O2 N: l7 Z   jnz     00650589                  ; detected
8 [) }+ c! \* o  v/ G% M   push    00                        ; OF_READ' f. l  n% |" L
   mov     eax,[00656638]            ; '\\.\SICE'
. Q' @9 Y0 S5 ~   push    eax
' X0 i1 m$ O% f+ w   call    KERNEL32!_lopen" ?4 ^1 H8 h# D& }9 C/ B
   inc     eax
) K0 X, W# \+ d% @; _   jz      006505ae                  ; not detected
8 \. {. y( a; |$ {
6 P3 z9 \! R7 {" s& x9 R: f- U8 x
/ d  Q; U: U, ], ?  N__________________________________________________________________________
3 q1 ]. b: ~; f+ L
4 ^8 Y; d' \$ U, o' m) ZMethod 12
9 s  k' [! I9 V8 T, T% u- p5 l7 x=========
# E& w( c/ c8 h) C" e# K% j& S2 A( e% A  @
This trick is similar to int41h/4fh Debugger installation check (code 05
$ G7 U9 H5 B- [6 o# e* F( ^&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, k) v4 \% |4 N6 F8 M  v7 Cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 F; C9 e) K9 a* }5 m
0 A8 y0 o% x6 n+ o   push  0000004fh         ; function 4fh. K, q5 E7 }, w7 k3 K* H6 S6 P
   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 T( a# r; `3 @% [                           ; low word specifies which service
# R# p5 K3 t$ k4 A' n( f' v" Z                             (VWIN32_Int41Dispatch)
4 t% M. c: j/ Z# c; Z   call  Kernel32!ORD_001  ; VxdCall
8 X1 b* L) ?- i   cmp   ax, 0f386h        ; magic number returned by system debuggers: f% W3 Y- g% j, ~0 M: e  I$ ~
   jz    SoftICE_detected  k# m4 [6 y+ r- A3 J5 e1 z
6 H5 s+ {  `/ y8 u; w8 V4 m
Here again, several ways to detect it:
: e! g8 a" F; D7 @- v& d
" j$ `8 q- x1 h; E; o1 C1 a    BPINT 41 if ax==4f- p4 S6 U1 d& R8 v" l6 H
" g7 u1 Z* Y+ Z2 P) B$ N( d* ]
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one: W4 w$ d+ O. ?% r. ~# s  }$ q, L

2 ]7 e+ h: y3 z- `6 {1 X( b8 M0 p    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* a! k1 x0 B, m: }# y, q  Q2 b( c4 S' R0 i# X. v$ u1 _( [
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
, ?9 t, S7 Q; X' m9 a+ z) u
& F; B! s% Q% u0 I4 z__________________________________________________________________________
5 w7 r* O7 l2 }" D" o+ P9 ?( J0 M1 W- v
Method 13% B" r  x1 P+ ^
=========
4 \6 @6 T3 l1 @# _0 D
& S" L; b/ F% E. @/ pNot a real method of detection, but a good way to know if SoftICE is
, [- Y+ w0 z9 h# Z- o# x3 X' yinstalled on a computer and to locate its installation directory.
- l& f' U5 w$ ?- D% `4 |It is used by few softs which access the following registry keys (usually #2) :
0 k7 _. ~+ e/ j  J0 A
1 w) J3 K9 p* `+ m-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" t, m# H1 v  n" n3 j4 T# \; \3 A' }\Uninstall\SoftICE
5 E" @3 U# Y: s3 I! X-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 s5 d+ m4 s3 ]$ ?0 ]' D3 f-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ T% c3 p! r- X- u& q
\App Paths\Loader32.Exe
+ W" Y% p/ Q2 K- o$ y( N+ n* \! m, F: s' }! Q8 ^3 R! U
' o  B% M9 Y* S5 I& @
Note that some nasty apps could then erase all files from SoftICE directory
: U- [8 b7 ~- o(I faced that once :-(' r& ^3 d9 @* J
( @2 L- F+ }( o+ M
Useful breakpoint to detect it:
0 a$ K+ O' a& q& e7 V2 D
7 c5 f2 j% m/ A     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" w- @. Z$ m, S/ p
  [# x% L2 r7 H& K9 Q8 ~__________________________________________________________________________
( f$ L- c3 N! U0 _. q/ s3 b& R0 ^" F2 {

4 u# g" A1 v1 [Method 14 ; d5 M7 Y* Q$ ^4 N7 n9 b$ @
=========
) j" J" ?6 B$ {; ?, ^5 U
) t, m' u  l, |7 k  o* V1 M- qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) I  G! D$ ?- C( ^is to determines whether a debugger is running on your system (ring0 only).6 }2 w" A3 x% S' c! `
7 ?0 R5 {3 A7 R
   VMMCall Test_Debug_Installed
' u' R- U) i8 d8 `/ S   je      not_installed
3 _3 S) G2 w4 ^& X6 \. R. \6 i' P: [* g) T* S
This service just checks a flag./ C9 c8 b6 @6 k& {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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