About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' x, [! J! `% u/ C) [) d7 U; ]/ L
<TBODY>+ l8 _$ T0 `1 f5 X1 d& ?
<TR>0 X9 e& U7 W  K3 j( a9 z9 X
<TD><PRE>Method 01 ' ]5 g. ^8 N. c0 ]' A
=========+ W2 X( P5 k% q6 N
% {4 p7 M1 A( [& r: ~
This method of detection of SoftICE (as well as the following one) is' C- P/ D: k+ A2 q  V( y
used by the majority of packers/encryptors found on Internet.- p5 f! p5 |! ~0 q) p
It seeks the signature of BoundsChecker in SoftICE5 ?( |9 a0 `+ B+ Y
8 E$ c3 r) C. d+ d& |8 T
    mov     ebp, 04243484Bh        ; 'BCHK'
/ S9 A6 m0 X% ~: s    mov     ax, 04h6 b1 c% b! |4 V  i- E$ L
    int     3      
. g7 c5 k# E6 w    cmp     al,4
( [; w4 a# J& W) O( b( {% U) |    jnz     SoftICE_Detected
$ [9 ^: \7 c9 p  G
. U& y: B" b/ M3 ~7 B___________________________________________________________________________
+ s. m7 p) w9 T- p5 T; y- I- i2 X4 p' ]- U8 {1 s1 Z
Method 02( m+ R+ u' k$ R9 M2 z
=========0 N' a% \3 L' h
* i/ ?  w* Z) J+ A8 N) _
Still a method very much used (perhaps the most frequent one).  It is used
  g7 W( i, ]2 ]to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
7 ~3 p$ k; ]$ S5 a& S! T+ yor execute SoftICE commands...
" N* N1 u* ^2 NIt is also used to crash SoftICE and to force it to execute any commands
' ?# P$ F* q7 Z! r' T; D" u5 X(HBOOT...) :-((  5 M8 X) f8 I/ R: y

  F0 e$ R2 W! T$ ]7 M; AHere is a quick description:
9 u' t: E' L# X" R-AX = 0910h   (Display string in SIce windows)/ K0 g; N' D: b& F/ F! s
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& G, N1 h6 k7 w0 O1 r6 z4 W" _# s-AX = 0912h   (Get breakpoint infos)
$ k/ I1 x. H' W. c" c3 ?: g-AX = 0913h   (Set Sice breakpoints)) s, E$ y; F' L- x
-AX = 0914h   (Remove SIce breakoints)
) U5 j5 `7 C$ w: j
/ E7 D8 \! _7 \8 |Each time you'll meet this trick, you'll see:! O2 U. T' B- S7 u, u
-SI = 4647h
  R; e" _# I. P4 a-DI = 4A4Dh7 g& B7 t9 m9 _8 p" r5 i1 I
Which are the 'magic values' used by SoftIce.
8 m4 C9 Z, ?: S& R6 CFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! o" l$ ?" g3 y* \
1 Y7 I' M/ i/ hHere is one example from the file "Haspinst.exe" which is the dongle HASP
9 |+ n/ p( Q5 c; g; }7 fEnvelope utility use to protect DOS applications:$ u1 U# Q4 b. V) r+ G$ ?

' W% f! R0 }! h4 O+ K! b+ C/ g( a  U, @  _+ A6 n
4C19:0095   MOV    AX,0911  ; execute command.3 y/ U, A3 `; J6 ?2 V2 u8 Y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 x$ m' ~7 B) s' b) }* L$ k4C19:009A   MOV    SI,4647  ; 1st magic value.& \6 H* \; w; X& C) h# Q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.2 H. w: B; X5 q: ?; c+ I4 H# P: E- f
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# r2 Z4 O! b" C4 O0 m
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) d8 P8 L# o+ i# y! Y
4C19:00A4   INC    CX
9 z3 L9 b% J# v+ Q) H5 s4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute1 |+ Q  H2 ]" N5 n; h
4C19:00A8   JB     0095     ; 6 different commands.
% }* a2 Q; k/ g" f1 y+ K# y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.( y4 g: }- O0 u9 |
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: `7 J6 I0 m: o
: E4 a1 D) ^5 r9 v1 n9 M  BThe program will execute 6 different SIce commands located at ds:dx, which
9 S7 _! d7 C9 q% Qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.' j  o) C% I  l* S
2 ~2 d8 Q1 G$ T2 C' V3 w
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 X4 y' _' I( F! n, I  |# a___________________________________________________________________________
. y3 D1 L4 C% h. M' ?) z" P
, v- {; |& S  O9 Z7 ]6 L% b4 o1 ~& j
Method 03
) q" i! V1 ]9 n# ~/ J8 f$ n=========+ A! v9 x$ G+ ?" b" r) j( f8 K8 ?$ j

& K; e0 H* Q4 p) U- P; DLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  w/ p" c# W5 }: R% R" [* r. y4 f(API Get entry point)
9 P% g( q: J) \! T        
- B: k  g' S, \8 K* q+ G1 ]3 D0 c, J. J
    xor     di,di
( e* l( I( X+ O: N    mov     es,di7 y# p5 L: N2 g! n
    mov     ax, 1684h      
( g- ?, j$ o( y+ U+ T0 |    mov     bx, 0202h       ; VxD ID of winice" q2 E" y+ H1 u; ]3 X
    int     2Fh
* s; j8 T( p; z' G. X    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% H4 V- }* [& {    add     ax, di
& E! b% a8 O- v4 N8 S/ U    test    ax,ax
& Q1 T/ i3 Z' J" T0 p' v    jnz     SoftICE_Detected
6 q( U! n( S  f- ^( l4 b- @
2 v! G% a& H$ u5 |4 f- \___________________________________________________________________________) C: U) M- x- I. U

+ t; I" h9 @& Z" }' yMethod 042 C1 b" B: L+ @! E4 \3 A
=========7 l7 s/ D, @# b) J( ~- ]
5 L1 i9 R( l) L- Q# F. j/ ]: R
Method identical to the preceding one except that it seeks the ID of SoftICE4 E: b- T. Z" O* F
GFX VxD.
+ @+ C4 v# R" Z4 h% G* n1 I- y% X/ A1 S& f) l
    xor     di,di! ^# W6 N0 x0 }$ K2 @, w' b: Y9 j' S
    mov     es,di5 w2 {" D3 G% ]& |; u
    mov     ax, 1684h       - _' Y1 e, q* C8 a
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 d, D0 o: A! I8 f% g. m! I    int     2fh5 G$ s) i, }- O" Z$ m0 _% d: H. u
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" I  ?7 `$ ?4 u3 x    add     ax, di+ W1 }3 v5 \1 l( w% ]8 f
    test    ax,ax- a' Y# n! a; o* X1 q) F
    jnz     SoftICE_Detected3 l8 x& R' a$ N" u- l

& c" F* P2 u- W! q__________________________________________________________________________
; X- u" i% j& g' D5 l, i$ O, t( @* N! U: x+ w

7 }0 w2 Y: M2 Z9 W% g9 I$ iMethod 05: K: q7 O2 I. X# ?' K
=========
, z; Q% {5 I* P1 [) b# N' ~  y. v2 U( F) D, O* O6 c% d* {
Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ @" T6 X5 A6 M  ?6 k. vdebugger. It calls the int 41h, function 4Fh.
% a& Y7 |# z2 \There are several alternatives.  
9 w" n, C' V3 Q
3 S9 T1 ?. e) K5 ^  k8 f8 A+ r' W* `The following one is the simplest:
/ U2 U. \0 @( n( A! k) v7 \, g8 |8 n. y- G- z9 s
    mov     ax,4fh: S8 v6 ?6 Y! \! S$ F7 a
    int     41h
: k8 o, e/ v# i! N1 q: j4 s    cmp     ax, 0F386" U% t% m% B8 W
    jz      SoftICE_detected
/ r# k2 D4 X2 D3 D
4 t1 v  K1 {9 i* H; t2 n4 ?# {
) Y- D3 m9 q. ?& N; iNext method as well as the following one are 2 examples from Stone's : D) }/ v  E4 c; r2 {! C
"stn-wid.zip" (www.cracking.net):% e# Y7 B3 g5 l2 }- r" l

3 R' B4 [& x' v/ U3 a    mov     bx, cs
$ V+ x* M) U: j; i1 `0 {    lea     dx, int41handler2( F) x4 m! J6 Y, i
    xchg    dx, es:[41h*4]
% ^( \) }. \/ b    xchg    bx, es:[41h*4+2]
% |2 R0 T. E/ q0 a    mov     ax,4fh& d/ D% N2 @8 Q; P( c
    int     41h# a, |. b. o- ?4 B7 V
    xchg    dx, es:[41h*4]
  U; M5 V  L2 y7 s4 w2 w- |    xchg    bx, es:[41h*4+2]
3 g5 D# a& f- W) S' D. T. @    cmp     ax, 0f386h6 ~, w' b$ {6 r
    jz      SoftICE_detected
' c# }; n0 ~  D& Q/ d
3 S7 Y& [, u3 s* t' yint41handler2 PROC
4 o/ m2 @/ p$ S    iret( A  {+ G( g7 Y
int41handler2 ENDP
3 b5 z4 \+ H- p0 w' q$ Z: P' ?- w! }0 x

: X+ L7 {+ P- E+ p# i! r6 n8 i3 L9 C7 K" |_________________________________________________________________________9 k' \% C3 r- x$ _0 @
7 c5 t: O) ]9 }, b8 E# S* C
) ^6 o7 |' l  ~  ?+ V& ~% s5 H
Method 06- X) w9 l" t, o  m  c8 e; N
=========
6 }6 k% a( a* l6 ?, X/ N
, ?/ O. n7 B) e& o2 ~4 A/ Q+ z3 W* g; x! d2 \7 g3 ?" T
2nd method similar to the preceding one but more difficult to detect:( v8 a- s: {$ F) L3 \+ s) F( Q

2 ~. i9 m( @9 C' w( `: J# Z2 [1 b2 W/ z* l" ^7 e, g! D
int41handler PROC. w! y/ `; x( O
    mov     cl,al8 r% e, v' W( V0 d2 o
    iret* c' a; v- I2 ~2 {  ?
int41handler ENDP: Q8 s; _# o: X

* u9 R, D4 l  ~# }+ o- C# R0 B! t4 y. n2 X9 a" o  Y" @* V2 J
    xor     ax,ax
7 M: M8 o& D" h6 U2 [% H) t$ \    mov     es,ax
! Y- W  l- b0 |' t3 H    mov     bx, cs, e2 Y0 }$ U$ u/ O% G7 {5 c
    lea     dx, int41handler9 {  b& i$ l5 Y
    xchg    dx, es:[41h*4]
$ R/ x4 V( w3 W7 I$ p( W    xchg    bx, es:[41h*4+2]5 M, a( P" E. r6 ]3 a& C
    in      al, 40h
7 j4 g" l0 M9 A) a& A  d" ~0 Z: w    xor     cx,cx
- C$ s0 Z: n; R/ F( f) U    int     41h( v' e0 N3 F+ C- R
    xchg    dx, es:[41h*4]. h1 L4 P  f4 x# ~6 H
    xchg    bx, es:[41h*4+2]
# w2 Z- n. u  S' F1 L    cmp     cl,al
3 H5 u& W& p% [. p1 [) k/ x7 q9 K4 q7 W    jnz     SoftICE_detected5 I$ g" s% U- m  I7 A

8 N) d+ y! Y0 T- i1 a$ M- a$ N_________________________________________________________________________6 r) Y# A% D3 Z9 }

7 S; h! ]% Y( |, w- [4 W# _Method 07' p# H$ @# ?9 M/ S* |: p
=========6 [4 e" B, n& m. ]
, q) ]+ h9 p& B8 R2 v+ Z8 W" {+ ]
Method of detection of the WinICE handler in the int68h (V86)
+ k( m4 y7 _* t# Y) _. {; a
8 Q) n" y5 L. T. j  j! x    mov     ah,43h% k, V1 }6 @- q* Y# [  W  e
    int     68h
# x/ w! ?0 N* G( D% c9 u, c; H7 h+ x    cmp     ax,0F386h
9 B' t. b% n$ D# r    jz      SoftICE_Detected
. d' K: G* |0 I" k  J
" h% e  k  w4 O, R; j- o9 ]# x
$ g, p5 \9 ?( p/ I9 |; l3 y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 M) r- A# U- x/ ?, B1 L8 p/ l
   app like this:
( p0 |. q6 ]$ c( K
0 s+ O, L& \* c( @0 n. [4 t, L, |   BPX exec_int if ax==68' c( E% r% A; C8 J8 V! V  m6 V
   (function called is located at byte ptr [ebp+1Dh] and client eip is1 y& {  q( O* J( Q
   located at [ebp+48h] for 32Bit apps)+ V, S5 Z8 \$ u$ |
__________________________________________________________________________+ Z8 v/ |% {4 @
% o) b3 Y5 F! Y. a
" N  M4 r0 g4 y
Method 08
: n6 `8 _; V' A* I$ F=========, A" L( [  @$ L- g$ P* v/ |
0 V5 L) X0 O3 S
It is not a method of detection of SoftICE but a possibility to crash the2 N1 U' e, x+ F4 S% `( Y
system by intercepting int 01h and int 03h and redirecting them to another
! y$ k8 n; B) V6 |5 nroutine.- Q+ Q, Q, _1 h# y+ h
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( x' g- [& I2 X3 W, B1 R$ F% G/ kto the new routine to execute (hangs computer...)
  r3 E, a4 o$ ?; g/ l  h' f( m# \" O$ X6 Q; F1 n7 q4 ~
    mov     ah, 25h
6 p; ~& z* S, z; ?    mov     al, Int_Number (01h or 03h)' b/ j9 q' C' ?- J5 Y- M  l9 ?+ v
    mov     dx, offset New_Int_Routine
# E, t: ^( N' y! w8 N6 b    int     21h
" K' L" m6 j; K
* b/ n3 x1 I# P1 q+ W; ~__________________________________________________________________________$ K' h" A0 C4 P0 b; ]  \6 s/ h) d/ [

6 }+ ^' _) o* \4 Y: u8 g9 LMethod 09- E5 s( W% n0 l% D8 `3 a
=========
2 }* C& y7 d# V# ^) a& L& r" y* ?+ g, D
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! F5 Q& Y" m, ?0 ~- f) p3 j
performed in ring0 (VxD or a ring3 app using the VxdCall).: i& R4 ^% G) N" }( d* v- W8 d
The Get_DDB service is used to determine whether or not a VxD is installed
2 v3 ~1 K8 _7 R3 Kfor the specified device and returns a Device Description Block (in ecx) for1 e/ h- e  P3 ]/ d6 }
that device if it is installed.
! {0 u& h; i/ j$ G5 o$ s/ g% e. p6 u% q# j: h9 a5 v
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 P1 b; y! L2 J' D! q) k4 [. K- W
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 R/ ^! Q( j& [/ @& p
   VMMCall Get_DDB  L& S" S2 X# I) ^# _
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* i' J8 @+ p/ W( Z6 w' N* c- V* d( Y9 x# I! j! A2 Y5 X5 c! P
Note as well that you can easily detect this method with SoftICE:1 b# s' P0 p  q7 S0 G
   bpx Get_DDB if ax==0202 || ax==7a5fh" x% H+ i6 S* H( \* j

0 H% K# z' u0 g; L__________________________________________________________________________
2 v- v. i6 D# a6 c
* _, Z* S2 \% p& ]1 Q2 {Method 10/ P- ^4 R' u$ I/ U6 A
=========. j8 e8 |) I  Y! B

' I# h1 j$ p% Z8 O) Y1 _=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) N8 y. Z0 ?5 L, d
  SoftICE while the option is enable!!. J# B+ l$ e8 [- e2 s
8 l# X* H9 K0 D5 I7 Y! S, I& k2 V; p
This trick is very efficient:; Y( h/ Q3 E) E6 L9 c8 w
by checking the Debug Registers, you can detect if SoftICE is loaded
$ h9 j  Q& g- i5 q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 W  s/ ]0 C2 V( p3 z# e7 p/ kthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 H, y' h6 A& q0 i6 p
value (in ring0 only). Values can be manipulated and or changed as well
* O( ~. M' T' a( ?. B1 `/ J(clearing BPMs for instance)
+ g& b; l* m& K: }
( [+ Q' T5 Q5 I__________________________________________________________________________
+ e! _' K7 ~3 }: z
8 \" `. Y, G) S4 w1 ^) KMethod 11
/ c4 @/ M  R( t# u/ l1 C=========
6 u# e. k4 X2 R9 G' A, K- A% e$ E5 ?9 Y: ^6 K6 E! g; w& u
This method is most known as 'MeltICE' because it has been freely distributed2 D4 F$ v7 p: B: T* i1 E+ a
via www.winfiles.com. However it was first used by NuMega people to allow
; S, V0 P7 ~  _Symbol Loader to check if SoftICE was active or not (the code is located
1 I# I$ B0 @# {* F9 M1 Zinside nmtrans.dll).7 {: L/ r. T  A) O  l
4 l, {" S! t+ @  o) I+ m5 E
The way it works is very simple:
% I# M; O+ k* ~4 Q! BIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 {4 @( u& ]; Z
WinNT) with the CreateFileA API.
8 n4 p# ?+ ?8 t4 U6 z- p+ `9 t
% S/ ~4 |6 {. L9 v* O# Q: uHere is a sample (checking for 'SICE'):
2 n0 Q  O9 F7 {
0 ~: k6 {7 ?: wBOOL IsSoftIce95Loaded()! E( r# B9 \/ d: }# ?" o
{
  ]+ W# S6 D( W& e8 p   HANDLE hFile;  6 ^! T( q) X# Q2 `. A# f
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# v. n* t# g# m! ~, b: _                      FILE_SHARE_READ | FILE_SHARE_WRITE,& S! X# ?+ [: E. L1 c
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( r6 N5 X- N# t4 W9 y* N6 x5 ~
   if( hFile != INVALID_HANDLE_VALUE )5 [2 V" T* g  m# M% w
   {4 `4 G6 T/ D2 C; I% D
      CloseHandle(hFile);
' ]4 S) h0 i! O- S. |0 e, x      return TRUE;& _, V( j' d. R5 H5 o
   }/ }$ @; A3 J+ W! R" g  I
   return FALSE;! @$ F  @$ O3 e
}
- l: z! P# f& p1 s, |; l! C
$ M4 v4 y. Z1 a1 P! h7 iAlthough this trick calls the CreateFileA function, don't even expect to be
0 i6 Q- K. s# i) G% X* n4 Lable to intercept it by installing a IFS hook: it will not work, no way!
! V- M' I0 W! N9 P$ j8 ZIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
& O, H3 |! t9 s% r5 @+ `# ]service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( W+ Z# d6 |+ y8 |
and then browse the DDB list until it find the VxD and its DDB_Control_Proc' i. C8 }+ ]# {, E
field.
. N# c2 y' S9 F" _In fact, its purpose is not to load/unload VxDs but only to send a   ~* B9 q& k4 c1 q' i. L
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 d& }3 b5 A( l. B
to the VxD Control_Dispatch proc (how the hell a shareware soft could try4 n4 Y# g7 U/ f+ ?$ g# u# |& ^" a
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) R5 j4 J6 x6 K1 q( X3 RIf the VxD is loaded, it will always clear eax and the Carry flag to allow
' n5 A. P6 s0 M* E. h7 p1 F* [its handle to be opened and then, will be detected.* \- d2 ~: P* u. E, [
You can check that simply by hooking Winice.exe control proc entry point) ?# K* c; V) G. f
while running MeltICE.6 a6 b1 N: O0 D5 k

5 L' F8 ?$ W- U! X3 m% j  E  s( d% Z+ ~" f4 d
  00401067:  push      00402025    ; \\.\SICE! I2 x0 K9 H- i  q/ V
  0040106C:  call      CreateFileA
6 q9 E( v! n- Y! v! F2 A/ d  00401071:  cmp       eax,-001
% c4 d4 m" m# n- Q( W/ E$ V( @$ ^  00401074:  je        00401091
( n$ L) q+ y- O; g
8 l7 @/ L8 S. x- H# k0 Q; V* L& i* m5 x( h: J& a
There could be hundreds of BPX you could use to detect this trick.  E( H$ j# m5 s! n% \8 S5 q
-The most classical one is:. \" }" H: u! v& g% k  S3 V
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" H0 |2 [. U3 M5 B$ R* x9 K$ R0 z- g3 J
    *(esp-&gt;4+4)=='NTIC'
- E/ ^. E7 \- |8 @3 V: e
2 S0 h; K* `+ y1 W0 r" `0 N-The most exotic ones (could be very slooooow :-(
+ x+ E) ~) t( m# _, Z# j4 B   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& u) u! N1 i, ~" x     ;will break 3 times :-(5 k# W$ Z& S3 Z. a7 f; Z
: F8 y! f0 m2 ~
-or (a bit) faster: 0 x( N7 r8 s) I% ]- `( ~* t4 \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 p: `2 H1 G* J) q* _. G* e& z' [& l% w& I" E1 E
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( X4 J* D6 C" T6 W: L; `
     ;will break 3 times :-(8 A* m+ `4 B1 {: f4 X+ V
4 S: m3 r  t/ H+ k1 U9 O
-Much faster:
$ G" H0 Y* L# o* I: G   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' n& w' p# j: W. E) Q; X9 Y1 W2 v' l$ ]2 s8 }7 M# e$ p% [* l% x5 j2 b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen5 U1 T9 h/ O% L, a$ a+ |
function to do the same job:
& U% S: ~. ?6 U' f; l( p% X- N7 j# ~" E$ c
   push    00                        ; OF_READ% u6 }: t# g4 y9 `# Y1 @
   mov     eax,[00656634]            ; '\\.\SICE',06 Q8 E8 P8 k! a$ M; G# v
   push    eax
4 b: d2 U. A0 V% ?3 _5 X   call    KERNEL32!_lopen* {2 p; R# S+ A
   inc     eax( h( V& x3 w8 ^# t6 C2 N
   jnz     00650589                  ; detected4 _: U) s0 ^" y! l
   push    00                        ; OF_READ
8 n: i0 Z* t6 O, z0 K   mov     eax,[00656638]            ; '\\.\SICE'
4 R6 L- o! d5 y5 c# H   push    eax
5 h9 F2 Z3 l' W  j4 p0 e3 d   call    KERNEL32!_lopen
! n1 c4 |$ a% p( a3 R+ ~# N2 ^   inc     eax! q9 `( @& k" q" u2 p+ \
   jz      006505ae                  ; not detected, }$ W8 `! E1 _0 F! e" X& C* g* }, N
" V, y  a. `/ M& P6 y; W1 u

; ?" l& b# i* f" N- E8 R9 p__________________________________________________________________________8 u7 |( E# h- @3 i1 s
) u9 R. _9 ?; y
Method 12
5 K7 }% U% G( n" x=========4 P7 ~9 ]8 O- K% P$ i7 F1 w8 Z
; ?+ Q) I$ j/ c4 W. v; o
This trick is similar to int41h/4fh Debugger installation check (code 05% W+ w! e( t$ V) F
&amp; 06) but very limited because it's only available for Win95/98 (not NT)# B& x. S3 n9 ^
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
. B  y+ b- v/ P- {5 l7 ~  J" S( u2 A1 J; P  u; B# C' X
   push  0000004fh         ; function 4fh
% M# G, E4 J1 o+ b) ]4 V* I/ j/ G   push  002a002ah         ; high word specifies which VxD (VWIN32)
( o+ t0 g' i$ u# U/ i$ x                           ; low word specifies which service, Q. L0 Y7 v/ N5 b1 G" H
                             (VWIN32_Int41Dispatch)
4 a) r0 d: {4 m1 R! \: B4 S   call  Kernel32!ORD_001  ; VxdCall; K4 j4 n# L9 h
   cmp   ax, 0f386h        ; magic number returned by system debuggers1 u6 ~- D  e! z( P7 e( S
   jz    SoftICE_detected* s* Y3 Y1 ]/ T! z& c* X: K
3 s( F: i, V! Y$ K, Q
Here again, several ways to detect it:
+ R$ i  `% T. ]% B, j9 ?; g- G& ^+ @( S% }! @- j) X3 a* h
    BPINT 41 if ax==4f4 p3 x( x) V6 y$ @: e: S
+ X1 T, I: ]0 @4 g, ?
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, V- @, Z0 J5 N/ i& k* W6 C. ^- f6 W5 y$ R& _- W9 T
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A$ `- y+ _: a3 B4 l' ^6 W
' X( |$ O: @# V4 q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ K# Z$ o; H% }% Q% T, s/ T
! z( Z, z% m! U
__________________________________________________________________________" v; G4 C$ C4 v" y% x& b# _6 g

- L" O0 V2 g) R9 }) `2 b6 r6 VMethod 13
9 W4 a, V: G& C# T& @1 h2 u: A: I, V=========
# W/ G& w5 T  B9 L3 n; {
2 f) s) f; u* f- j* _$ vNot a real method of detection, but a good way to know if SoftICE is* q: ~) l! Q0 V( a" I2 w! s
installed on a computer and to locate its installation directory.
+ q, _' v; @+ a" v* J. f% yIt is used by few softs which access the following registry keys (usually #2) :
5 X- H; i+ l, q# a9 P" Z" u- f: D4 F( S% I# i
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( `/ P/ K& s$ H7 w8 y% G\Uninstall\SoftICE
2 p- s$ h) |* k% f- R; I- J) I-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. A! Z! \/ ^5 I& h; O( P0 s
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) V, m# k/ {" ]5 ~$ x- |
\App Paths\Loader32.Exe, p  f4 }8 S' @$ A, o# K

4 I! K2 D: Q* A7 K" w2 Y" d6 Q
* M* I) b7 z" ]4 X; N2 n# y% NNote that some nasty apps could then erase all files from SoftICE directory* D+ a- F; h6 N: c  q- D+ y" e5 |
(I faced that once :-(7 z/ F  _3 y: \9 D% _1 T! r* S

6 X  r& M# j8 C5 t$ A% JUseful breakpoint to detect it:) a. v" W( D& z2 _
4 {7 J0 x& b( q1 H; z: P
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% p5 i9 [: ]" z) d

: U" ]; C) c: u- D$ A' R7 \! K__________________________________________________________________________
( x2 M/ B- ^! z; {/ Z5 f+ |  G# }+ L3 h
. e# j( D+ w- k) L1 S  X; W
Method 14
( J. ?* K; @' r' {: `: y4 D=========
( D+ r# w9 a0 Y$ V; N/ c& q: E0 F! j/ c9 T0 P# f. M
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 A& k8 }5 g! E2 f0 l& T% F. Nis to determines whether a debugger is running on your system (ring0 only).6 a3 T7 X; {, t; F3 n2 N8 f+ ~; C* o

& d8 \& z6 e/ O7 l2 J% @   VMMCall Test_Debug_Installed  D+ I0 v2 L. b: S/ r
   je      not_installed9 t6 v2 ~0 c% L% P! b9 Q9 {

* g% S- H: M; h0 k, q5 y  i/ WThis service just checks a flag.& G* h9 V6 X# B$ `  x4 A7 I* d7 u/ r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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