About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' m* j7 [" W- _, ~& J0 }) r<TBODY>
8 u0 w3 `  U8 g5 z<TR>
, [# Q; P$ y* `  d& E8 b+ h<TD><PRE>Method 01 , I9 \4 }. w6 `
=========
  _% w3 h" d1 G6 o" {- l
, X  b% D6 |# [This method of detection of SoftICE (as well as the following one) is2 U( n1 E% v9 S: |
used by the majority of packers/encryptors found on Internet.
; r) V4 ~6 w/ c% T2 ^It seeks the signature of BoundsChecker in SoftICE
3 V, w0 T- V4 O( G- x, {: o0 W' O
- [3 N1 F, ]2 [- H* f    mov     ebp, 04243484Bh        ; 'BCHK'
: f0 V! x( Y* s! }    mov     ax, 04h1 w4 y! v  O1 C& h8 U! o; d1 v. l: ?
    int     3       / p; f2 W. K0 ^8 I% k8 g
    cmp     al,4: A- O! r7 h' T' g1 O
    jnz     SoftICE_Detected/ D2 q& g. H4 c) C% ~" O1 n
7 n+ ]; b; f( S: e$ `! E2 i0 q
___________________________________________________________________________
9 c# x" I0 X- o& {
; H: `$ }: F7 f/ z) B, aMethod 02' T8 P. d. p) w* |
=========% T% u! j5 a) e
4 p; {5 A; y; z4 L4 @  {
Still a method very much used (perhaps the most frequent one).  It is used* D. P. Z# W) {1 y/ A2 R# G
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) b, l9 Q* t8 f" Qor execute SoftICE commands...- r' ~. E9 b+ W  p
It is also used to crash SoftICE and to force it to execute any commands
& o' x, m: @1 P; \(HBOOT...) :-((  
+ a1 l% d( T$ |/ y3 P9 }
( o" L0 W' A0 w, [Here is a quick description:
, a2 A. R' K" {* x$ W-AX = 0910h   (Display string in SIce windows)6 c& L' V8 [; I* A! q7 w
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" F5 s, P# i" p8 q-AX = 0912h   (Get breakpoint infos)$ m  d+ k/ z. s; I; r! Z; W
-AX = 0913h   (Set Sice breakpoints)
7 `+ @4 L& I2 q' K, `- j  |-AX = 0914h   (Remove SIce breakoints)
! x, `' \, J/ l( x) l/ A' W9 ?# e3 d' O& B! K. K
Each time you'll meet this trick, you'll see:
5 @) _0 t3 r1 M9 Q9 k$ `/ m, h-SI = 4647h& e2 y- L) C5 L7 W4 {' \1 w' A1 Y
-DI = 4A4Dh
  S9 y  R3 s3 E+ aWhich are the 'magic values' used by SoftIce.
( o* l$ p3 D+ a$ N* ^( W. c* qFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.  Z3 o# T' X  A. w

$ M4 y2 q& f# z# z4 H* OHere is one example from the file "Haspinst.exe" which is the dongle HASP
7 Y2 Q! `$ d. ~  i6 LEnvelope utility use to protect DOS applications:( e/ H5 v9 p5 Q$ L( Y  f
  L; k: T/ \" Z- e9 B' ]- A8 ]

, A( {; Y% V( C+ @: B4C19:0095   MOV    AX,0911  ; execute command.
1 I, n$ ~, A$ l4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 |6 b; n5 K/ R, ^5 k4C19:009A   MOV    SI,4647  ; 1st magic value.. G) H1 M. ]" w; W  d8 P" ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- J$ a9 Z) O; [1 H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" }! V: d. [" i$ I7 Z
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, w5 T7 F2 R/ E( K! G7 [) u4C19:00A4   INC    CX
0 e( k6 d! u1 d3 ~' D4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' d/ k+ K) J- V5 |5 w( W3 X4 y
4C19:00A8   JB     0095     ; 6 different commands.& U( s( O: B* u, b; J8 c
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." m+ J$ T& V$ E% D8 M% A1 H/ |* y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)1 @: B# X. z4 Z! Z- t( M* v% H- W
, w7 [- B6 K; L
The program will execute 6 different SIce commands located at ds:dx, which
+ K( T; y+ @1 |$ @( @+ Rare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& V& ?6 g. n" O% b* g$ |
, z0 W4 Y1 {. M' V! ]9 [5 ~1 H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
. B& y/ h# M, ____________________________________________________________________________, ]3 N8 |0 d; p3 }
$ Y) Q# z' n* R- M- Y$ \5 I

# y5 A, t+ [, T; ^% _6 wMethod 03  u2 p! ^: F5 {* l* k
=========
" ?2 m2 D4 p+ I: m+ U& a  _- K7 m- W- S  c
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
. t: B# r0 `0 ^6 w7 P$ M(API Get entry point)
# @* ]& ^5 L4 ^- k# K        
" }5 Z6 ?9 M; S
' B/ R+ p4 W6 p    xor     di,di
1 H# r& V/ q5 I8 s. a/ a    mov     es,di
: A) e0 e! t* U5 \$ _( j" C    mov     ax, 1684h      
8 I7 z+ {% p, S- p2 T6 d+ o    mov     bx, 0202h       ; VxD ID of winice  B) L3 j& B: [, t4 f
    int     2Fh
2 j& R+ F4 s* ~; K, M( T8 T7 {3 V' _    mov     ax, es          ; ES:DI -&gt; VxD API entry point! u6 V: N- n5 I% h0 v4 ~& a0 ?
    add     ax, di
1 _) {: O/ Z! M    test    ax,ax
% U  p( A( w- S    jnz     SoftICE_Detected
) c5 O3 V1 p+ S4 h, q
3 d( A+ a4 r" M/ Q3 i% }2 T1 C___________________________________________________________________________
  U$ ^+ s' F7 N2 G; p& ]5 d# S$ s0 A* [& `+ E
Method 04: `: K* b1 n& T) b  b
=========
# m8 T8 X6 \' R- W& |) P
1 D& E, u& H# q  _3 E0 fMethod identical to the preceding one except that it seeks the ID of SoftICE$ C8 T( d9 j) A, i% d
GFX VxD.2 P" w( g7 P& L4 Q/ ?& y7 k4 `2 {0 K6 Q; Z
  D$ R# W0 V$ D
    xor     di,di
/ b4 y& _7 \* u    mov     es,di  O6 n2 K* m, y- n
    mov     ax, 1684h       0 r3 a' L4 g! i, h: B' o1 r
    mov     bx, 7a5Fh       ; VxD ID of SIWVID5 I; J  _$ s  u5 J: r- ~
    int     2fh. Y2 d  g+ _4 j2 X1 \9 m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 {' F0 l9 i- y4 t4 S  O4 J
    add     ax, di' C; n# Y# u  }
    test    ax,ax
5 W* Y9 b1 P4 Y    jnz     SoftICE_Detected
. q* ]# n6 S. z3 ]2 r8 c) s! J( T; A% W; G9 a; ?! _( F
__________________________________________________________________________
) A6 }  }1 V9 E1 D
  n6 ?8 Y! b) e
  \1 M& |# e" X0 J: tMethod 05. Y2 B$ K) m3 }2 i1 ~* S9 w) R$ i2 I
=========- P; [2 Y2 B2 d) K0 c; b, J
2 h/ c2 T: ]* k9 p. H/ i
Method seeking the 'magic number' 0F386h returned (in ax) by all system. y: Q4 ^' ]  O( I3 q
debugger. It calls the int 41h, function 4Fh.
1 K$ y: E, \4 v" YThere are several alternatives.  
! W' ]0 ]* J8 K& v" z6 v/ `
8 K9 n9 n) r  E; g2 e+ a# CThe following one is the simplest:$ R+ h3 i' G; [% i: }9 T: v

7 D4 f6 m. `7 L: P    mov     ax,4fh
5 N1 K. z8 |. F4 n* }    int     41h$ C) q; V1 w" W; W* i: Y. }+ j( V
    cmp     ax, 0F386: V+ K5 L: Z. @- Y& S
    jz      SoftICE_detected
3 l) ]2 F* R; p0 k
% m, I* C: K3 l: e2 c4 w1 ?# {* D% x7 i0 I# d* t
Next method as well as the following one are 2 examples from Stone's 6 t; w) \/ w: ?& P* @# D
"stn-wid.zip" (www.cracking.net):6 I2 [$ y6 }& x3 W) k

$ R3 t# }0 |' q7 h5 h) C    mov     bx, cs
$ `; A& s% v! a1 L) }+ ~7 f& X0 W8 v    lea     dx, int41handler2  ?6 A2 t* C/ s6 Q, [4 J4 Z. @
    xchg    dx, es:[41h*4]
: Z  A* u% T5 W. b+ Q' ?6 D8 _9 b    xchg    bx, es:[41h*4+2]# v5 T2 H6 I/ o5 l: n
    mov     ax,4fh/ p1 P) x+ E  v/ k; ?
    int     41h
" b% H+ Z* S& u& X2 q    xchg    dx, es:[41h*4]3 V/ [* d3 ?% Y% F
    xchg    bx, es:[41h*4+2]
2 P  d* P1 q5 A6 A: ?    cmp     ax, 0f386h" K0 H( `1 D7 i- y! j
    jz      SoftICE_detected" u/ _" L: m8 \2 Q  ]
( z& r/ G+ u( i- r% ?  u5 w: ]8 U
int41handler2 PROC
2 p: B2 f( y$ P$ b    iret
* z' U3 s' F# S" s9 `- j5 [int41handler2 ENDP
. Z1 g/ R; M1 r0 l) ]' f
# W" t8 n- o* W' Q* V5 w; R  N
6 C. b7 Z! X% t; K( J_________________________________________________________________________* l5 v9 y0 W; u4 {2 R9 `
& ^: O, h. |; @
- N6 @$ w% r4 l. {; I
Method 068 R! Z% F1 r$ k. D: m# c7 n
=========
; I. u# s' E7 e( i; \4 i. V$ K& T4 C  A7 Y9 o8 A' J: H6 s
; O: w* j2 J4 [  [' p: T
2nd method similar to the preceding one but more difficult to detect:' t4 c; e# v- p1 @8 ?+ g& N/ E$ `
( D8 j7 m8 W: Y% a4 l
5 w) X4 A  _/ ?, R
int41handler PROC) p$ y4 }% j4 s( [* U& u& u) t
    mov     cl,al
8 |# O) n4 H6 M# ^. m: M: \    iret
0 V1 O+ L/ n: @; y5 D8 pint41handler ENDP  [+ s7 A& C9 F5 ?

) \* y+ I3 o8 c% p4 L9 i( F( e, `
' U, a* Z  l. j% J: w1 w5 @* `    xor     ax,ax! i% h5 z5 _- v5 G* Y" K
    mov     es,ax5 E$ l, p  X8 R% G5 W8 C
    mov     bx, cs
9 ]  ~7 u$ D& n3 u  I1 G3 }    lea     dx, int41handler9 U- U- _; C- c/ Y
    xchg    dx, es:[41h*4]
# A9 A% P; k5 ?& Z$ `$ h  s* P    xchg    bx, es:[41h*4+2]0 }+ O* r0 A$ K
    in      al, 40h  J* n+ m8 `% |  Z
    xor     cx,cx
  T. e/ W* Z1 ?8 p    int     41h9 D+ G3 G, u) [& S: ]
    xchg    dx, es:[41h*4]5 I6 }8 t& i- f6 t! h3 \
    xchg    bx, es:[41h*4+2]
. O& h6 o# G+ \  G    cmp     cl,al0 f9 n7 q, T0 b
    jnz     SoftICE_detected
  _8 y9 _: g0 b6 c) k; p6 D0 h* e, |0 f5 `% k% G
_________________________________________________________________________: k7 M0 C# N! c' A2 ]

$ J. v3 Z& \3 L- m5 h" _- ZMethod 07( a* e+ |" `5 u; ]" Q1 j
=========& n6 G# Q+ x/ A$ P" }- W5 z" M
, U5 W1 d$ l5 A$ _4 z% g
Method of detection of the WinICE handler in the int68h (V86)
( D; Z9 r& h# X
, S. r" Q1 l. w6 k0 H    mov     ah,43h
! J* L5 n9 m  |$ X% Y) K8 _    int     68h
$ V( h7 Q+ l' W    cmp     ax,0F386h
2 c8 }8 {; o# {9 O/ v( _% i3 A2 V, h    jz      SoftICE_Detected6 `# d5 J. u  y+ z" r& ?; H
, V9 H2 k. j3 d' I: J- p6 e
, ]% }4 ^5 ]5 i9 U
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ X% n. g: q; r$ y$ S7 A9 J   app like this:* a" T9 o" M1 i
$ A" a# \: B# o
   BPX exec_int if ax==68
$ ]1 z; S! ?6 J3 B# I+ H* B   (function called is located at byte ptr [ebp+1Dh] and client eip is4 P& L8 B( y, @9 T* i: i5 L
   located at [ebp+48h] for 32Bit apps)
5 Y. `9 K( a- y4 W__________________________________________________________________________
3 g9 K7 n# K& Q& U* L
4 c: }' |7 D7 t, f) e5 n* ?6 X9 x  ^: {5 R/ X* E2 G
Method 08
8 |: M% ?3 P; c  X7 [( o2 @=========9 u' A. s( m& p5 ^+ O* O; G0 {9 w
' @/ I. i1 N: B$ W$ w/ r
It is not a method of detection of SoftICE but a possibility to crash the
& P) T* ^* r: Z# G- Ksystem by intercepting int 01h and int 03h and redirecting them to another. W- E7 W3 W- X9 E+ B9 }
routine.. u- J) y' d, y: z8 A
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
9 j2 C' d4 @  b. eto the new routine to execute (hangs computer...)1 N$ Q& Z- S1 w8 \
% d1 m+ F/ w4 e5 ~6 s
    mov     ah, 25h
; [1 p2 w5 z: ^) j* b* w+ e    mov     al, Int_Number (01h or 03h)
' g0 Q* s& D/ s, P! M# e. g- g    mov     dx, offset New_Int_Routine0 |) H* w2 ?+ y$ D0 p
    int     21h, `% t, ]5 ]: a
2 m- R0 ]4 u, ~5 i1 U, _
__________________________________________________________________________/ E% \0 Z, u7 q0 a* F0 b* N) U, H1 J# }
4 M3 m1 S2 |( f" V7 n) a6 x
Method 09
4 y, |/ X" e, q. t5 L0 u0 N8 I=========- u1 a0 D# @9 N" m& ^

  ~* n% i% w% [3 \: O: ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 V! ]6 O( N0 J3 x% {9 [performed in ring0 (VxD or a ring3 app using the VxdCall).6 Z$ Q5 t$ }- }: y7 H* R+ ]
The Get_DDB service is used to determine whether or not a VxD is installed
/ K1 ?3 M! m; [$ ]2 `  l9 a' Afor the specified device and returns a Device Description Block (in ecx) for
3 ?7 m# y/ f) j  U: zthat device if it is installed.1 y3 u8 L- d1 k. Z; C. c
/ c/ I& k3 w0 W& \
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 a7 `: |0 k1 s& P4 f: F0 |   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; u1 q9 E. b9 r& l/ f& d5 z   VMMCall Get_DDB
$ O# H4 b" E4 y- n4 u   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
" L: v* i$ X. Q2 r/ X0 ^
. ~& ~) y9 @- D+ R. N& D/ X1 ?Note as well that you can easily detect this method with SoftICE:
% q. |2 P- P% H" @   bpx Get_DDB if ax==0202 || ax==7a5fh
( X" N. ~/ \$ Y2 F$ {1 o* Q
* Q, b% u! w$ ]9 T9 A& `__________________________________________________________________________
8 \6 ~* L, P" O+ ]
8 I2 Q; _, ^8 @Method 10' ?; `, W! i5 r& K$ D6 P
=========
% z0 U9 H  X" W* L$ d. f2 ]
' K' g; p/ q7 l# F=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- _2 K; B% c$ s* }! }: ?  SoftICE while the option is enable!!0 m0 c& T( v* ^. [: ~- ~# j0 x
7 C( M3 I+ z0 m, }: L
This trick is very efficient:
# D. E8 H) |* W) s/ H7 Fby checking the Debug Registers, you can detect if SoftICE is loaded
) Q; k& y3 `3 D, U(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. k5 V8 B0 ^/ f7 Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 a: R* u4 w6 f1 N4 [. M
value (in ring0 only). Values can be manipulated and or changed as well
+ B" r4 s# d% e( _! |& ^, @4 I(clearing BPMs for instance)
2 N5 \1 O. e% ^5 N
3 C) j; b- M2 q% d4 l- l__________________________________________________________________________
) ^! p' g+ l$ B
* i' B" |5 _' @Method 11
, R  y' x5 _8 X, _4 D=========
1 I; G  d# C2 m5 s; x8 \" X& o. s0 `; q$ L" }" l
This method is most known as 'MeltICE' because it has been freely distributed
0 c. v5 K# Q- M+ \7 F- d6 |- j1 Dvia www.winfiles.com. However it was first used by NuMega people to allow
4 Y$ r  h4 |: r4 L: Y$ hSymbol Loader to check if SoftICE was active or not (the code is located6 ^/ @, V3 ^# z, r$ O) T
inside nmtrans.dll).
  `" p/ W& u+ w- Z+ I+ D3 V
" G* y6 v0 Y+ \; T" `4 v' wThe way it works is very simple:
" i5 {  A0 K3 r# j, f  J# hIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; i( T( f. K  y! WWinNT) with the CreateFileA API.
( o' M9 x4 m. G* f4 t. F; ?. d0 ?: Z
Here is a sample (checking for 'SICE'):
" [6 E* ~) ?1 p' m: O7 Y" P$ }1 |8 k- H8 N# u, \( ^% H, w
BOOL IsSoftIce95Loaded()4 B: V! s9 w4 k
{
) ~( o, g2 Y- N   HANDLE hFile;  
% ]$ _  ?4 X! M& y   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* i8 D; `+ {; N' P
                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 i. y/ v9 l3 ?- @8 j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 W' Q4 E+ R1 H- H
   if( hFile != INVALID_HANDLE_VALUE )
6 G, j3 N& m. k5 [  T   {
+ y9 O: d5 G# d+ m7 @      CloseHandle(hFile);
3 ~1 c& q1 w, Y# q9 w! G  ]# j3 c      return TRUE;( O7 A, E# o, x3 Q
   }! A- r4 K2 g" M0 h$ s3 C
   return FALSE;
" ^% }  p" v  B$ a  |$ I& n}6 C8 j1 ]9 s) ~& o

6 X" P% p; l$ M7 `; ~; n6 I, \Although this trick calls the CreateFileA function, don't even expect to be
" x; U8 A( y) k( Y# F' ?: G' _able to intercept it by installing a IFS hook: it will not work, no way!
6 c5 U3 K2 I; j5 W! eIn fact, after the call to CreateFileA it will get through VWIN32 0x001F, K8 y7 P8 I7 Q# m9 v1 D
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) r7 o" H% j$ J1 W% e
and then browse the DDB list until it find the VxD and its DDB_Control_Proc& [- P# \; S4 v: }, ~1 g& g1 ?" H
field.
* @- c$ K* t5 i) WIn fact, its purpose is not to load/unload VxDs but only to send a * O3 E. j! N  n7 {4 v9 x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, ^( v' F5 p; L) c- }5 ?7 Fto the VxD Control_Dispatch proc (how the hell a shareware soft could try0 i$ B0 v6 t+ }) y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).$ g( q1 u0 H* D* V
If the VxD is loaded, it will always clear eax and the Carry flag to allow
( Z  {2 A7 t" E$ _+ Tits handle to be opened and then, will be detected.
# B0 M& v2 I) Q# SYou can check that simply by hooking Winice.exe control proc entry point
/ r- j; n9 t3 I% f4 B: Kwhile running MeltICE.0 q+ i  m8 }$ \

9 f6 F+ v' G! V7 e
1 i/ Q( V$ Y) b" w% d  00401067:  push      00402025    ; \\.\SICE; k+ Q0 S/ f: Z' |
  0040106C:  call      CreateFileA' z  a7 r3 {; _5 O
  00401071:  cmp       eax,-001' M" x( b6 b" {& w5 v5 Q: D4 r6 b
  00401074:  je        004010915 U" ~0 W1 ?$ U2 C/ ~- g8 v2 n' J$ [
& O" D# H0 H2 X  ]) }% q9 [4 i

7 c3 D' R+ g1 o: D7 kThere could be hundreds of BPX you could use to detect this trick.0 d* ?* G+ }4 M: ^6 F6 `/ q% n
-The most classical one is:& O+ s0 \$ K/ c8 y4 d' t. }
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  _+ P) P2 A: M. j
    *(esp-&gt;4+4)=='NTIC'
6 v# k& R) q8 m: k3 p: {, M% J. Y4 e4 W3 J; A) [* z; ?" u) c
-The most exotic ones (could be very slooooow :-($ s4 U5 x+ _7 t% V' L, a, d% _2 Q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    ?/ w. b5 v+ x4 g' B  y, ^
     ;will break 3 times :-(
3 Z$ Z$ x% i  _; F+ h( ^5 r/ z4 k
: p% W' ]; X! K-or (a bit) faster: * _" f; ]6 E9 m7 a, q, z: X7 b
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& y4 H9 [5 K1 b9 e
% `( W6 a* \, j3 A# m
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 W: }7 q- Y/ t1 I% |$ }$ d% @     ;will break 3 times :-(9 e) V1 X! W3 X+ Q1 t
. [3 {- \  ]6 ?" F# P. o4 c
-Much faster:4 U% K0 ~4 m1 }; N& j' H* [
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' h# l, q' W9 d* T9 [; y1 E
: z5 d. A" ~$ j# n9 N% vNote also that some programs (like AZPR3.00) use de old 16-bit _lopen4 j' i5 c8 C& E. O  F: C! C
function to do the same job:0 T4 [/ R% |6 T  Y, `: {6 e& b

) E" O/ W) K; q) X( t$ C1 E9 ^* s   push    00                        ; OF_READ
8 e. V7 Q# O+ G8 T% s   mov     eax,[00656634]            ; '\\.\SICE',0
4 s, P7 A  l3 z; P. ]' q. Y/ Q4 j. V( P   push    eax/ O0 v. m' O6 h, Y6 ]' L1 b
   call    KERNEL32!_lopen
6 ], E; k; c! q2 u3 S* t   inc     eax
+ l1 ^" E: z% [. w/ S0 P   jnz     00650589                  ; detected
% e0 d0 o$ C: y0 H$ i   push    00                        ; OF_READ
+ F: K- ~8 @6 s' `. g/ L& ?   mov     eax,[00656638]            ; '\\.\SICE'
' K8 }5 }7 c7 n/ `1 W$ Z  g   push    eax
" [1 K% I$ A1 c   call    KERNEL32!_lopen: I+ F. X; w' g& ?# m! {
   inc     eax
7 d, b8 v# w) u) [9 ^0 p   jz      006505ae                  ; not detected8 @% W% i0 _& t3 j/ s
9 T/ v  y1 }8 I% [3 L4 W! l2 K
0 T" f9 h9 ?+ b7 u
__________________________________________________________________________; ?* }, a2 x4 z0 E+ v

( N( G' U# b$ m- @* E5 U, OMethod 12# b) s# |6 O+ k
=========( X, ^' `7 P2 O( g: K1 B& x. l7 t

! w1 I; X2 H9 N3 N: UThis trick is similar to int41h/4fh Debugger installation check (code 05' |. ?7 a, {+ Z0 i0 W  e. f
&amp; 06) but very limited because it's only available for Win95/98 (not NT)* s) v/ J5 M! X% @# R7 C  F9 Y8 X
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ A) G" \- U3 R' i9 l; A
& K- Y( H7 R' U' n2 V6 P+ }
   push  0000004fh         ; function 4fh/ i6 X" M+ i. s* @3 V( U
   push  002a002ah         ; high word specifies which VxD (VWIN32)
" Z3 p7 A/ _& b                           ; low word specifies which service
. G: H6 s! C+ ?4 O- T/ d                             (VWIN32_Int41Dispatch)
7 U& w) N$ K* x) P- ?* f, F   call  Kernel32!ORD_001  ; VxdCall
/ H$ j4 j( y, x7 D6 v  Z. Y, a   cmp   ax, 0f386h        ; magic number returned by system debuggers# t1 a4 V0 I* G5 M+ D6 E  `
   jz    SoftICE_detected' Z, L7 h4 V" \+ p% K8 o

% R7 [$ H7 K' z# Y. ]9 _; LHere again, several ways to detect it:
3 J+ z. y6 R' i0 r& C- E7 l
6 j) i# U2 `7 l0 I, X  e    BPINT 41 if ax==4f! Y9 i6 z3 x2 p% t+ r9 X
+ z* w& {, ?" v6 ]
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ d1 x8 |8 D$ V0 K7 y
: @1 g, W6 W8 R$ q1 f/ h! i5 o
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; A5 q6 K* }/ Q3 C8 _
, x4 P$ {' U$ g" y6 x- h    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" W3 w, k: b- I8 d. V% K1 N2 e7 G) f
" r0 R7 w$ [: s3 q__________________________________________________________________________3 H# S( }7 [9 a4 j- @  R
0 R. q0 n- a5 P: R, M7 k
Method 132 J" T* J: ?" A$ n" M1 l1 i# U
=========5 S& w" t& F) w) u: D

9 f+ Z0 `4 t" {* x' vNot a real method of detection, but a good way to know if SoftICE is4 S6 A" O# f: Z- a
installed on a computer and to locate its installation directory.
! G( S) ]! u, r. I, x8 RIt is used by few softs which access the following registry keys (usually #2) :# C5 X0 ~  B8 o3 w$ Z& `
* m3 _+ j7 F) O4 R
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 b" |3 ]- a+ o; F( @' l* G
\Uninstall\SoftICE
9 G: r4 p! h: O0 Z/ G' ~-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ H+ R* H6 W" Z, v1 P4 {# {-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 Y! D: ]/ @1 \3 n0 m
\App Paths\Loader32.Exe2 u7 X1 \! D, U
7 M0 Z" U' U. X, @9 f/ ^2 R- n7 t& v

0 X4 m6 J7 d* f! v# ^8 {; x( I6 @Note that some nasty apps could then erase all files from SoftICE directory9 r8 Q) [8 S# |% I
(I faced that once :-(' O+ m4 q; @, T' A* ]5 C1 O
! V; S9 \5 J, M# ]' [$ D
Useful breakpoint to detect it:6 L" T- r. N9 O" P6 S1 \- ?  O2 b  T

/ @( f( l0 X* t: l) \     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ z- {4 r9 Y* F: J" I4 d
8 W( E2 X" u6 J4 g, C5 D! T( V__________________________________________________________________________" a) R  a; _$ `
: d& S5 i6 l4 u- N) g

, R  l/ Z5 a$ W0 F( ~& XMethod 14
. y# }& A* X5 l* a% g3 T( k=========
! Q9 M) M  r, X6 V4 f! s6 K
; r# ~# T# ^/ [2 r1 DA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: V+ j+ z; E# \1 @! iis to determines whether a debugger is running on your system (ring0 only)., T8 Q. w- ?7 J, `7 k! |
% q, s5 @' Q) b  k
   VMMCall Test_Debug_Installed" E5 Y! c5 u3 ]
   je      not_installed3 }1 |. f# v9 c" p/ I

+ C. _& {: p, a3 EThis service just checks a flag." w  d8 ?, {7 r3 O: R
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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