About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>1 e: c, {; e. D! U
<TBODY>
. e- j; g- u# N- K' S! N<TR># K- w) Y: h: M4 M8 r
<TD><PRE>Method 01
3 U0 p7 \7 u* v4 x9 e8 O: q=========
% U6 D; @# b" Y; _! V( }7 q, \1 c* V- a
; l6 T) Y' S( yThis method of detection of SoftICE (as well as the following one) is7 Z3 B( f4 F4 Y, x) {
used by the majority of packers/encryptors found on Internet.
2 o- W* x- X! R, oIt seeks the signature of BoundsChecker in SoftICE
+ _5 N# c7 P9 M: T2 D6 Q2 ?) Y* u* b9 c, `/ _- p( W  w
    mov     ebp, 04243484Bh        ; 'BCHK'3 l7 C3 I7 h  Z/ P* G
    mov     ax, 04h
) C5 n4 D7 m8 g    int     3       . L4 `9 S" }3 A6 u& S0 t
    cmp     al,4  A% ^- F1 D$ W  |% P
    jnz     SoftICE_Detected. n2 P9 V, e2 L; r( ~

8 ~$ j$ A- r  H4 @- q9 @% q, X___________________________________________________________________________" M9 l: w4 c+ F( j) t' `8 @
' h) W0 ?( {$ x7 K1 N+ [3 _
Method 022 A5 X. y; Z) \
=========- h% e. c& Z  E* b' U6 H

! {) s# C1 }7 s, U; uStill a method very much used (perhaps the most frequent one).  It is used5 ~0 a% a+ d, d2 p- u! ]
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 U2 M: K6 q* P7 Q: _! k
or execute SoftICE commands...
' E- K2 q; E/ Q" q1 ^9 XIt is also used to crash SoftICE and to force it to execute any commands
( X* F# V0 Z0 k, t. G0 N, ]' Y(HBOOT...) :-((  6 {3 R0 G8 x  x( a

3 f0 @) l4 H% n4 L! T, iHere is a quick description:
0 b& S9 @& l- U5 ^- T; M8 {9 K-AX = 0910h   (Display string in SIce windows)1 h/ y6 }0 y# O1 L1 P
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 M* O, P, A2 Y+ C) u-AX = 0912h   (Get breakpoint infos)! g6 k2 v: \+ E5 K3 Q" L. U: i
-AX = 0913h   (Set Sice breakpoints)
3 `2 k5 v0 J0 z-AX = 0914h   (Remove SIce breakoints)
/ w! p) j/ p4 P1 t
, S2 M" O) l4 _$ m  kEach time you'll meet this trick, you'll see:! b$ g5 F% \1 s1 w: f
-SI = 4647h
, n& T# _8 w/ a9 @-DI = 4A4Dh; G, q+ s6 Q' A( M- p5 ~
Which are the 'magic values' used by SoftIce.# M& \9 Z6 P; X& W/ H. m
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
  L! q+ ]4 c; t( c  Z
6 ]; Q  m" L3 U4 Y# f8 \Here is one example from the file "Haspinst.exe" which is the dongle HASP6 p7 _4 Q/ j" u- [3 S: ?
Envelope utility use to protect DOS applications:9 K& b7 @" j/ \: e+ V4 M
; u0 L- [5 t/ b
: w- j; I3 y/ V( w
4C19:0095   MOV    AX,0911  ; execute command.
/ \" U2 \+ m+ y3 N4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* A0 {3 Y1 s4 `9 T4 M& Z. W4C19:009A   MOV    SI,4647  ; 1st magic value.0 J! t3 [" Q; G/ j& e
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 v: y6 S5 T; U! @  _9 _
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
( h7 ]  Q/ D9 z  F) l3 S9 b% h4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 E  x1 h( B# N7 g! G
4C19:00A4   INC    CX- x1 n# \- G. P4 _
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# ?! I$ }* A. P4 p
4C19:00A8   JB     0095     ; 6 different commands.) I2 l' {! S' k5 Y6 P/ o; B! X
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' K" X5 q- b% l, K: T% \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 w" m: j6 t5 y( d+ ~9 O: |

/ V  E2 P) G5 G/ G) p3 d0 s& J, s! _The program will execute 6 different SIce commands located at ds:dx, which
( u- E  L: w) H) c3 b, v+ Hare: LDT, IDT, GDT, TSS, RS, and ...HBOOT." J* j) P. A% h1 ^7 ]# W8 ~4 C3 V6 A

2 x: N4 v' E! }) v% v# k8 _0 ]8 O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 k  o2 f) V9 V7 d; W___________________________________________________________________________, X5 c0 o. {6 M8 K* p' a0 T+ k) ]
( T5 H- l9 |* {( b/ Z

4 ]) g  g) r' x# U0 P+ ~Method 03
$ N& L3 E& ?2 U7 V6 E=========* G# |# P7 s4 ?

. e& m( q4 s7 }* aLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 ^. |& h8 t5 W. b" M2 ~0 ^6 N0 c
(API Get entry point)
* ^9 L% r, k; \, `        
1 [) x& Q$ I& o8 A. R) W
1 N. _1 g0 Q* b8 f1 `, s& f* i    xor     di,di
4 `5 O1 l6 w$ k' N7 f1 A    mov     es,di  b0 `0 y; A8 u% i2 q
    mov     ax, 1684h       9 ]1 }' m0 m4 y" a+ G+ ^( D
    mov     bx, 0202h       ; VxD ID of winice) k( G9 r: G3 S# ]9 w
    int     2Fh
: d5 k& X" g; ?' U; V  |+ j$ r    mov     ax, es          ; ES:DI -&gt; VxD API entry point# P6 y% P- a: L& T
    add     ax, di
8 _' O! z6 n+ M5 I) q    test    ax,ax
8 m) W; \2 g5 g5 A2 m8 O    jnz     SoftICE_Detected& y& }* F* h; n+ i' I, ]5 i, ]
: S& h6 e. Q* x$ O6 s. z/ `3 q
___________________________________________________________________________* Z/ w* k6 `6 s9 ]
- {- J; Z) ]3 V
Method 04
3 v* p' g9 ]1 `2 f. s=========, `4 m3 u2 L; n% D

9 K, ?7 ~$ ~" H) I; e( C' O3 Y+ E6 UMethod identical to the preceding one except that it seeks the ID of SoftICE
7 k5 F& r0 S1 B# O3 v# z7 {GFX VxD.
" K4 l3 J1 x8 M1 ^/ M0 L' Q% W# C$ f- e( o) T0 l$ A, ?
    xor     di,di4 l+ o& `# T4 V4 e+ r- A  T$ r
    mov     es,di2 U: a4 x' T1 Q- v& _$ |' \& J% u
    mov     ax, 1684h      
" J* u4 b& d7 o0 H+ M5 ]    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 @  [5 N& ^% [+ j    int     2fh
, v: E" u  {  {9 b! s    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) T8 X1 V& A9 }/ ~    add     ax, di
: S# g% Z/ {% i; _7 z  @    test    ax,ax) A( {/ H" E+ x
    jnz     SoftICE_Detected
4 N8 f; [9 Q/ _8 k8 E* v: j' Z5 Z9 p- j) S+ o4 `+ C
__________________________________________________________________________
- t) ~5 U- `9 [( B+ n) G8 H6 w' ]/ A; `' m% o
! Q: G  c7 G1 f
Method 05
( {: P, u8 {( d$ n+ R# H2 [=========1 d% `, e( @* u
6 }' k4 @# d& b4 ~. _# X
Method seeking the 'magic number' 0F386h returned (in ax) by all system* W0 S6 K: K  G1 @7 c
debugger. It calls the int 41h, function 4Fh.
2 R+ p" y+ Y( K% W8 ]; FThere are several alternatives.  ! C: z4 P; I" G

/ ?8 Q* x* u; n2 `+ Z! f# s7 bThe following one is the simplest:
# M1 z. d1 k& o% p) J$ Q: K7 R7 x& w
    mov     ax,4fh! Z/ u9 l* p/ P& O3 ^
    int     41h
4 P5 u+ @- s1 e6 _3 x8 L1 S. }    cmp     ax, 0F386
5 ~+ _7 v8 }' D/ w  ?+ B    jz      SoftICE_detected% F+ p8 n- ^# r( U
8 d# k1 O8 C8 R7 n
8 H1 _& J( n6 d  f2 w, g
Next method as well as the following one are 2 examples from Stone's
% ]" o8 x5 K8 u5 m% [3 V"stn-wid.zip" (www.cracking.net):
8 i4 e2 U! c8 B; i8 B. [: Q: W) @; e* ^5 _
    mov     bx, cs
) i6 t' v( {1 r' }0 c5 I  j    lea     dx, int41handler2
9 L8 I' w9 a9 G: L) Q  g" I    xchg    dx, es:[41h*4]* S$ z; ?! Q$ I
    xchg    bx, es:[41h*4+2]
1 U7 ?# g& t, p9 b3 |; G5 S    mov     ax,4fh
( [# k7 l3 A3 t0 }. n! C0 y( [' {    int     41h& k2 [4 K! l! y
    xchg    dx, es:[41h*4]
! \9 w4 U& {% b3 N- Z# `    xchg    bx, es:[41h*4+2]; n' A; _( Z5 j& @9 Q+ j
    cmp     ax, 0f386h
9 Z4 Q- T9 d) M5 i$ E8 z    jz      SoftICE_detected6 Y- p* V6 o3 c+ L; g, Z
- v% ?, ?$ r* z2 ^$ y( s) _* Q# T
int41handler2 PROC) o/ ^% n5 @- _( [+ f9 ~2 ^) O
    iret
# V' S7 u" {+ K8 z( B6 jint41handler2 ENDP# R4 `- n  _2 W: |1 {
' S+ Y6 t! k3 S* l1 ~, I: S9 o

' ]3 b4 F0 T! W9 j8 E& e% ~_________________________________________________________________________$ S- u) J1 \  g0 a3 z. ?3 {
/ U! T* b/ f1 M  Z/ a

9 I$ ~6 a' Q' V& t' ^2 QMethod 06% z, }0 v' L' W3 b& ^& l/ U: V
=========+ O* \1 ?. e4 E7 Z; g

8 M+ c% ?7 I" H
1 ?+ S+ P* o! H# f7 R' m2nd method similar to the preceding one but more difficult to detect:
' I- y( B- k# O# K- [8 i( n' K- O7 I) p' G+ Y, G3 Q4 S

/ ]& c) X- y9 e9 g! O" ~5 {int41handler PROC2 h$ U7 g# g* X; A, r/ }
    mov     cl,al
- ?% w3 i! K3 y5 N) U8 U* d    iret
" q& ?+ _6 ~; F% V% Y% V# Iint41handler ENDP
* H' w9 P: }/ s$ Z6 }/ L! a3 |  a/ u! ~

* a% p4 D" |/ {1 \    xor     ax,ax
. c( b$ Q. L7 g0 z% O    mov     es,ax
5 m6 m  u1 x' t- l& T, s5 e    mov     bx, cs2 n0 l2 E) p/ _: q* k! n
    lea     dx, int41handler* [) z+ R5 S$ S5 z$ M& C/ j
    xchg    dx, es:[41h*4]
6 O8 I0 v# W' ~+ _1 I    xchg    bx, es:[41h*4+2]/ a: w1 @$ t! R. }* L
    in      al, 40h
4 z! @  E& E8 f* {" d/ X2 E    xor     cx,cx+ j& E$ U/ m; A
    int     41h
; Q- F. B0 k+ V2 X- q. Q    xchg    dx, es:[41h*4]
  X! c: J% G6 R  Q* Z    xchg    bx, es:[41h*4+2]
2 b% y9 M% c% A2 ~+ T0 ~    cmp     cl,al
2 `2 y' P  ^$ K& g: ]    jnz     SoftICE_detected
1 ~4 W& n, S0 C: c0 j! m, y. S  v+ Y
) U% B+ w! v$ U% r/ x  E3 Y9 V_________________________________________________________________________- ?0 [9 ~) \* S" i  J( {! z
, v, h0 ^0 J6 U2 g/ @5 c
Method 07
* w9 q0 U) ]/ J: T% [=========0 q: a/ ~9 s6 u+ a' X! L# N- K, h

& C; G3 f" c5 OMethod of detection of the WinICE handler in the int68h (V86)
, q1 O6 D: q, a+ G: x1 w
" C) y6 V% ?$ e9 [, H) t8 ^    mov     ah,43h7 s7 U# N* m6 ]0 |% r& f6 j) ?
    int     68h& K* r! j* k) _
    cmp     ax,0F386h
; d; C& `# d  O5 K    jz      SoftICE_Detected% s5 e4 v' A: z1 T8 f
) L  A+ j  ~0 V# T; n$ n
( G: b, L7 g) j) C0 v! r0 J
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; d/ _, P) c8 R1 u% W+ }   app like this:
5 L2 n3 R+ h: Z. \1 Q+ J; q
7 e  x* f2 `) ^6 J2 _8 w2 O; Y   BPX exec_int if ax==68, Y; a+ p! x0 U) ]2 b
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ J  f: }0 Z- ?   located at [ebp+48h] for 32Bit apps)
& _, c: z: D6 L+ k__________________________________________________________________________
1 L4 f' f9 L& I& n* s
# C- A* {$ f( X
! Q$ E! J. F% N: N% V  KMethod 080 T  X: \5 [- K! r: y) t" h
=========
7 {/ @- c: z3 `/ i- `- j2 d$ z% T3 \2 O2 t( [0 A0 q
It is not a method of detection of SoftICE but a possibility to crash the, x: t1 ?6 h$ |1 Y8 z
system by intercepting int 01h and int 03h and redirecting them to another1 U% Y2 ?3 N2 l3 ?+ b# n
routine.
( A$ c" C- |0 T/ jIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 `- F7 ]: m2 ?- t4 s: Y
to the new routine to execute (hangs computer...)
* M) g" f9 D5 L* M) k: n8 x7 a( v1 N6 _& ?8 L
    mov     ah, 25h
: a+ o0 l+ K* U! ]    mov     al, Int_Number (01h or 03h)& @; i0 C  l# W+ u1 z
    mov     dx, offset New_Int_Routine( N: ?: W/ }# `- e8 o% ~
    int     21h
4 P2 U  o, G/ n$ ~% o" v/ C- x6 O1 V' ~9 K
__________________________________________________________________________- n( {7 c& f* ^# L2 m3 b: w
; N# O" \( `" K3 W  Y7 I
Method 09
9 i' o- @" N+ O$ Z0 s=========' |' H1 P: ~, y9 t+ j, _

+ P3 x0 ~9 ^! SThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only3 Q9 V: l, Q9 }: a7 E! i4 u
performed in ring0 (VxD or a ring3 app using the VxdCall)./ W/ ^; s4 \8 _
The Get_DDB service is used to determine whether or not a VxD is installed  P+ g. s! P" G3 D# I' b' K
for the specified device and returns a Device Description Block (in ecx) for
3 ^  s; b1 f. p4 d2 Q. V2 e0 lthat device if it is installed.3 C7 J0 ]7 q4 o5 v

5 q0 Y* F' Z6 F   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ r* m& x- I" o   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
+ I0 M9 E% m2 n& ?9 l9 C   VMMCall Get_DDB2 h2 t7 @% a' X/ L, `
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ N+ J1 Z+ Q. Z5 L

  p6 i; u3 c0 |Note as well that you can easily detect this method with SoftICE:, ~/ X' L$ g! ?- j
   bpx Get_DDB if ax==0202 || ax==7a5fh& O. [8 g  ?3 h  w) y$ K4 q- P* p

- J% X' y" [7 }4 K* M__________________________________________________________________________4 N1 f  D6 A: V& L5 y" K
2 `/ q0 }  x0 O9 w7 |3 ]8 q
Method 10
" E, i1 @0 ^- M+ c' }3 z* M" e$ I=========
  |: B, k2 U/ Z
* Q- `- |" R2 W4 L8 w+ ?=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
# K- B/ Q7 X2 H* n/ Z$ U  SoftICE while the option is enable!!& p( h6 F  O8 o% Q8 C9 ^
. B2 G4 U" y" _6 M
This trick is very efficient:
7 l1 y6 _" F0 d: I: q9 U" qby checking the Debug Registers, you can detect if SoftICE is loaded) `5 R2 m7 J5 v
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if# x$ c, @7 C: X1 R' R! R& w+ j
there are some memory breakpoints set (dr0 to dr3) simply by reading their
. u3 Q3 ~5 o6 v; @7 n! s) cvalue (in ring0 only). Values can be manipulated and or changed as well
4 L/ }3 M7 T+ y& x5 i/ @# n6 x6 R(clearing BPMs for instance)9 E) @) f7 @3 o- A# V: J9 _

! V- s/ W( G* M+ W; c__________________________________________________________________________% m0 F0 t% Q6 i7 ^6 z+ w

# c4 {, J8 H0 T4 T! p1 zMethod 11
  `: N; G" ~& b, n$ x8 `' L=========( p. d) Y9 {( O' _8 V3 `8 r
- P1 B; q2 D! p. z( A2 F
This method is most known as 'MeltICE' because it has been freely distributed, h" I1 T! j: Y4 \
via www.winfiles.com. However it was first used by NuMega people to allow) `# B- o4 d3 x
Symbol Loader to check if SoftICE was active or not (the code is located
" ^6 u) d( B, }: J+ Dinside nmtrans.dll).! f6 T/ x2 S" K8 n# j) @# J1 p

: S$ B- ^# d4 B5 U! W5 AThe way it works is very simple:$ L: q* \+ d0 c/ |
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% \5 Y' Y; j* s# d
WinNT) with the CreateFileA API.. ~" ~1 L6 U7 G  z  p$ T
( T' ^: X5 r9 w. }* U
Here is a sample (checking for 'SICE'):; E7 j5 w% |$ V% ?& K9 o# q. b

" C0 n% E2 B4 L6 ?' f: ~BOOL IsSoftIce95Loaded()$ U& ]1 c' M7 `! E( @' f. c: e6 z
{  }' O: R" b" i  z% I/ Y
   HANDLE hFile;  : {1 l) [3 x( e$ p1 N* _" p
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 o" P9 b; K, Y" n% ?! Z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 B" F5 D' K6 I                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, [9 k  r+ E- b' P5 n) {
   if( hFile != INVALID_HANDLE_VALUE )
7 c+ L5 U  O& G1 [" I- b   {# v$ t) R6 ~) \2 C/ c
      CloseHandle(hFile);" \% H4 D; o+ _& x
      return TRUE;  |3 m/ L6 Y$ r0 m; J
   }0 H+ N1 ?" |! N) F/ T
   return FALSE;
  D2 K* g6 Y8 U0 u}
  u5 v/ Y0 O% I& e2 V
: m+ s9 D% M1 q2 y) VAlthough this trick calls the CreateFileA function, don't even expect to be
3 s: i# {( H% M2 [able to intercept it by installing a IFS hook: it will not work, no way!& `) A7 y# u) {2 h! b+ h$ U$ |
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
! X; W* g& o& o% t$ Hservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( [, }. j, Y9 `" t* ^, n
and then browse the DDB list until it find the VxD and its DDB_Control_Proc  e* g6 K( ]* P7 e" P/ F+ D
field.
+ J( K2 h: b2 KIn fact, its purpose is not to load/unload VxDs but only to send a
2 }! `5 L- |" O. P6 ~4 ^W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) d1 n( e' k8 |1 D0 i1 uto the VxD Control_Dispatch proc (how the hell a shareware soft could try* H$ Q$ G3 c0 ^+ p7 C0 J
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
  s4 ?2 D8 t( ^* o& zIf the VxD is loaded, it will always clear eax and the Carry flag to allow6 E. v& O# g, \3 v/ z  D
its handle to be opened and then, will be detected.& ?2 m5 W* o9 P; d% d5 b2 M
You can check that simply by hooking Winice.exe control proc entry point9 G4 S0 \" z! B! L* A
while running MeltICE.9 a* m. ~  F: k" ~' {3 e

- j: R; ~+ h; c5 P  i( _  k; H/ J5 i# n  ?
  00401067:  push      00402025    ; \\.\SICE
& V9 a5 K7 `  b# X$ c/ ?) U  0040106C:  call      CreateFileA
# I. R& X0 x4 U( J5 |+ X; B% i3 |! O  00401071:  cmp       eax,-001
1 a; K( {4 i; y* v  00401074:  je        004010919 M+ w$ C0 i/ N) E) o$ F

# ~) J- }1 X8 f5 m" l9 \
: b! R" \' _9 ZThere could be hundreds of BPX you could use to detect this trick.- v( r3 O+ p4 ~: x
-The most classical one is:
8 a5 N+ U5 V! i1 [" u; m) h" c  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 d" O8 p/ n& U5 [8 R) }    *(esp-&gt;4+4)=='NTIC'
0 m- t9 ^+ c' @/ H5 e* y( y0 r4 E2 f8 t1 `4 F: k
-The most exotic ones (could be very slooooow :-(( Q; x% F& \5 O+ }
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  2 @" J/ X2 C/ _' g$ `+ o% R0 N
     ;will break 3 times :-(
4 v' Y+ \$ _8 F) c5 T7 R: w' A( p8 P& Z) u- g4 E% E
-or (a bit) faster:
9 S+ z. G4 J4 u9 L3 R0 w   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 I: x' [; |0 a- K
6 M4 ~9 P! C# M
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 y2 Q, I$ m% K. U& S4 Y1 o: T     ;will break 3 times :-(2 f+ Q- C: e6 c

6 l& _/ Y7 o- X0 {; G' v( ^9 t  Y-Much faster:$ G3 I% |* X3 Z" {$ o7 y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! Z$ P, O- V: l2 n/ D5 S
! E4 ^2 ~. ?0 J: M$ `- A
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 n* g$ y7 Z, Yfunction to do the same job:4 W) _5 A/ M- |: X

2 _" d" M) k+ D1 k' m   push    00                        ; OF_READ
; r7 Y# q# T7 w* b5 K   mov     eax,[00656634]            ; '\\.\SICE',0
  b: ~/ H: f; m+ L   push    eax. r+ Y% ^* B8 v  ?" z3 t0 N
   call    KERNEL32!_lopen
8 U" z+ W$ Y: E/ b+ p3 `6 X   inc     eax
* Y3 Z' c" G9 \7 Z/ }8 v   jnz     00650589                  ; detected
% F* Z  |% n, C   push    00                        ; OF_READ: x8 V% z; g( p" ~
   mov     eax,[00656638]            ; '\\.\SICE'9 D: {2 Z/ l* i
   push    eax
* }& W+ C4 l7 |- M$ T   call    KERNEL32!_lopen
) S) [( T# y$ R' t! @+ |! e   inc     eax' \) c0 V- N% B6 O7 d. @
   jz      006505ae                  ; not detected
6 F: o% Q  C) N2 K* }/ X2 D6 a; N8 {1 ~/ }

' S8 Q% q8 Y! B- T$ I0 \4 `( d8 t__________________________________________________________________________
& R8 W7 C# }+ O0 i2 W  q" U/ Q( U8 w1 Q% E
Method 12
9 `+ w/ C& |$ I+ R=========
5 k5 I" w& g+ |8 U& Q- i( {1 t1 a, i: }2 A5 \' V' C& V6 ~. T
This trick is similar to int41h/4fh Debugger installation check (code 05
: t' K! Q& m+ v9 C% h&amp; 06) but very limited because it's only available for Win95/98 (not NT)" R. {9 Z5 t5 N, K5 k& x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 {- Y, [& x, [) F2 c7 [% B. J4 W) N0 t/ }
   push  0000004fh         ; function 4fh) u2 V7 K& j/ _3 R2 R! N% k
   push  002a002ah         ; high word specifies which VxD (VWIN32)+ C$ B/ H! u( J- A+ B, E
                           ; low word specifies which service# W7 V  k+ K) r9 {# U8 l, O
                             (VWIN32_Int41Dispatch)
+ a, m# }' U: h6 D# w. k   call  Kernel32!ORD_001  ; VxdCall
; p. ~( A+ T' V8 v+ c8 i+ v$ O) k   cmp   ax, 0f386h        ; magic number returned by system debuggers# H& r% U3 u  c% [1 O1 x3 n6 i
   jz    SoftICE_detected
& w* i2 W7 z: F, F4 `: p$ ]0 F1 ]7 d: o6 K) Y
Here again, several ways to detect it:8 t% ^( f* o, P* N! @1 \; u5 P' G4 v
& M6 S/ ^. z1 C# Y6 _
    BPINT 41 if ax==4f' @1 b5 u' j4 M  I7 z. |8 T, c

. j9 I- d1 k& d3 G' K" F3 v2 P    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! S+ {* P; `3 v0 r+ B

* a$ a; j$ h1 R2 P  J    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- Z1 M+ E3 ~7 r9 k
" I6 r, X6 L( L    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!" g* x0 d  Z0 ~

2 H4 r! ?( J+ L& t9 M__________________________________________________________________________
2 V, b) r; z9 k9 Z9 b
* h% t  ^2 O3 h/ S* Q7 }8 i3 UMethod 13
& l& \7 ?; F) L! B, }=========  Z2 @2 \- C7 g+ Q0 h" P3 T
% ]5 d: W1 }0 v! m, I5 t
Not a real method of detection, but a good way to know if SoftICE is
0 f& l7 r* E  Z# Y/ e4 D/ ~installed on a computer and to locate its installation directory.0 Q9 J! H5 T- g
It is used by few softs which access the following registry keys (usually #2) :9 j; Y, ^' k) I7 E% A

8 g4 K6 l- h5 C5 ]-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* h* {5 w) H6 F2 w
\Uninstall\SoftICE, |( y9 U8 \+ D$ d! I1 L+ [: _# ]
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, p: z( ~5 h9 b" `3 B- ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# H% C2 \3 V& }" p) I: b
\App Paths\Loader32.Exe" I1 s: ]1 J. [6 @$ D
  N; a, I7 h2 r- Y. j9 A0 ]4 {8 R9 D7 y
# M5 K/ Q* Y1 F% a$ `) e7 n
Note that some nasty apps could then erase all files from SoftICE directory' \2 z+ v$ t. m6 y
(I faced that once :-() \  P' W, G1 J% l0 q

3 n' Q+ O% y$ o9 HUseful breakpoint to detect it:" g. k5 M1 [- r, u8 x
6 C8 d: v2 {- C7 U% l& P1 N, d! P. |4 g
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- x- g9 x% r. p2 |* w- i9 v

! r: E2 w# q, A" W4 f+ ]__________________________________________________________________________
5 d; R. G" k4 O' R+ k: Q0 _
$ a0 u5 q6 B9 [
$ k4 _( u# p3 Z: ^( nMethod 14
- U. O+ ~* }) W0 \7 z=========  P; P0 S* [) M2 n( F2 ], g. J
# M, `$ f  |  N1 q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
1 ]- z' }" o6 Y$ H  kis to determines whether a debugger is running on your system (ring0 only).
/ u# u% h5 a' `9 P7 Q5 U0 j6 a! k9 v
   VMMCall Test_Debug_Installed7 f( I/ c0 M" C. ?% o5 N4 [2 m- Q
   je      not_installed
$ h" u0 G8 Q/ }2 ~( q# o- O' l5 Z; ^) A3 o9 {  \
This service just checks a flag.
% N. N5 f/ c- `! B( g8 X' ^</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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