About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 h0 V3 a/ F. Y; R( o
<TBODY>
/ v/ ?. f, y; e& k$ T( m# }<TR>: j* l$ g4 H) R; `
<TD><PRE>Method 01   Y2 Z( q6 T% \& @
=========. p8 _' d* K0 w9 y9 ?# x) s
  g; ]% k+ r; ?& d3 h: F
This method of detection of SoftICE (as well as the following one) is( t- C& I& x8 C9 f* k
used by the majority of packers/encryptors found on Internet.; P0 K. V) ?( M$ u5 M) {6 w1 f) `
It seeks the signature of BoundsChecker in SoftICE
7 v3 s8 A: }+ K% J5 ~# m; |- Z$ s% l* t4 r& E6 {
    mov     ebp, 04243484Bh        ; 'BCHK'
- L' ^8 _4 z2 N4 z. @+ E+ n    mov     ax, 04h
0 H! D! x  Q" l" X( @( r    int     3       4 Q) j0 t$ F3 v! n0 @; h
    cmp     al,4
* N1 h1 ?' s0 f; r/ F: T    jnz     SoftICE_Detected
+ B; A! Y- t. x6 @7 w) M  ?9 [" {; s  A: Y' H2 t; r
___________________________________________________________________________
! r# X. ~; w5 @, ?8 Z( n7 R% M) {/ I
. w+ B% h  Z* p& j$ |8 ?Method 022 |% l. F2 v9 z7 I6 k5 @+ H
=========
3 M- d# f" m0 \9 A9 e& i& m$ C& K% Q5 {& r4 V& m
Still a method very much used (perhaps the most frequent one).  It is used
  C! d. Y1 \* T' m& S& S/ bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 O8 M7 c& p$ K! ?2 |0 u+ por execute SoftICE commands...
; b) G( A: r6 P2 b0 d. c. K, GIt is also used to crash SoftICE and to force it to execute any commands
$ N; O/ |8 ~6 d  y$ d(HBOOT...) :-((  
# N  F- E! g0 `9 @  F# M1 A
  l0 p. \0 ^/ H& H. b1 ], l8 F0 bHere is a quick description:; S  v2 d* f0 y' z
-AX = 0910h   (Display string in SIce windows)4 v' K5 x7 b) J3 o3 I
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* k5 e- A2 a! P$ h1 l
-AX = 0912h   (Get breakpoint infos)
2 u+ P& o* O& |: y& i/ d-AX = 0913h   (Set Sice breakpoints): c( W7 i( C. ?% D) E
-AX = 0914h   (Remove SIce breakoints)# l( J: O" Z7 x) l9 G$ c

1 A) W- e: A* N" b+ M# TEach time you'll meet this trick, you'll see:+ u  ^% j8 X, O1 L' d  L
-SI = 4647h
6 P8 w% Y1 R; t4 q-DI = 4A4Dh
, k4 x: W3 `0 X5 XWhich are the 'magic values' used by SoftIce.
5 g3 t3 y% Z# t+ W8 [; `For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# P5 M, [1 M/ U# t$ S% Q

: n) O: ?6 V/ R  nHere is one example from the file "Haspinst.exe" which is the dongle HASP
5 G. I* [6 `0 I0 N* J9 _3 f: h; TEnvelope utility use to protect DOS applications:3 ?4 W; s  c3 L

4 X6 n" Q& A+ U2 g& s( J
9 D7 O2 V7 @: c: Y3 h4C19:0095   MOV    AX,0911  ; execute command.
- I1 D( a# @: U6 x2 \6 @4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ r6 s) C% C* _8 J# C9 c- g9 \  o4C19:009A   MOV    SI,4647  ; 1st magic value.
% K% ?) O$ w0 }; e$ z& s; F, M4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 O2 m8 Y6 f) i8 R
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" n- b9 e! t: d: Z4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ U6 W) j& m# T! P$ F% S4C19:00A4   INC    CX
6 `( J/ O1 Y/ B4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* A5 t  ^% V5 H4C19:00A8   JB     0095     ; 6 different commands.8 S+ Y2 k+ {8 a6 [$ p# t
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 N7 Z) z) h! \: l; J
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 I) p# Q7 P2 W2 V7 C9 }$ D# ~5 @: E: H% I+ C
The program will execute 6 different SIce commands located at ds:dx, which+ ?; c6 K* b: @0 i" f) ~3 b# [
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: n# N( Q/ R6 z8 _3 \

4 s: q! c( A# a* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# A; `( g' ^, |
___________________________________________________________________________4 D( b0 z8 P5 ?; d' g, W
. j  x7 o1 D6 ~; @, V/ X

  u( P* a/ g3 L$ U% y3 Q9 TMethod 03" F/ l) y; S& M2 I" O: G
=========
5 X/ R) ?. u% e* L. S1 [6 R
. n2 T* ?& m$ R8 e2 QLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 m0 n- F7 G  h5 S1 q4 ~
(API Get entry point)! y; u( _+ d' Z) R4 g5 T
        
0 ^+ x: o! a' M# Y- D5 X' G: @. Q$ k) M' P5 B4 \
    xor     di,di
( P, ]4 b4 J+ C+ g0 e! D- h3 L    mov     es,di
3 O# D: }' r$ S. [% ?    mov     ax, 1684h       3 ~& N& h% O. r0 y: Z: v( p  A
    mov     bx, 0202h       ; VxD ID of winice; d# L3 X  M! [$ H- m8 f
    int     2Fh/ o9 M/ ~, x! }9 Q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ u. g0 }- V1 i$ x# R    add     ax, di$ k* i) W' M% i' P
    test    ax,ax
8 N) \+ k9 Y# D    jnz     SoftICE_Detected, _7 Y6 _9 v' x) i$ S
& H$ I2 I) E/ W- X( i
___________________________________________________________________________( U* _" O3 c" y$ D% \' x% Q
; s, l! ^5 _2 q+ S
Method 04. l6 z/ x* o, z
=========1 L0 z1 a. w5 G; o
2 i! x3 s' s5 l, Y. T3 I
Method identical to the preceding one except that it seeks the ID of SoftICE, a/ _8 M. ^% E" B2 z
GFX VxD.
3 {8 u/ Z  W8 `! M- ], H$ P5 {& i5 P1 c% |' U- N
    xor     di,di/ Q: x8 W: Z5 k# ?/ ^3 s' S1 ^
    mov     es,di
; d2 n# A5 [1 @1 d6 L4 A9 I2 ]    mov     ax, 1684h      
; l6 s. l% n1 W& d2 c& T5 K; Y    mov     bx, 7a5Fh       ; VxD ID of SIWVID: C, k- T" ~4 ~  g0 k
    int     2fh( a; r, ]! @5 C6 e$ C) n5 t
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 r  R7 d) h6 U% A  ^- ^7 |/ y! W
    add     ax, di
5 r- G  b' P2 r) @: B( w! k    test    ax,ax, }6 C* _  d2 C" |- y6 [) j/ s4 ?
    jnz     SoftICE_Detected
$ L: C8 r' W9 W/ B5 O$ N% {% }& @9 f. i6 |2 x3 T/ |
__________________________________________________________________________% V. A* N/ B/ \! ]
* V* I0 \8 Y+ E7 m, l
2 _" s8 u: e$ {1 p
Method 05, e3 B' d& L4 B
=========% E3 u$ ^  @+ `3 c: G6 X4 ^
! R5 q* G$ o: p# O: F5 d
Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ Y0 V5 t. g  h; G& u4 G- K" Ydebugger. It calls the int 41h, function 4Fh.
2 v5 n, I5 w  I, X1 R5 SThere are several alternatives.  ) }8 E6 {$ [9 L( E3 v1 @/ ^- J! o3 B

4 e. X' M) k) c# H; oThe following one is the simplest:
2 H+ T0 l, U8 u3 D4 W2 a
" n; O& O: j1 |. ]- r2 f    mov     ax,4fh
6 p( J, |5 N1 d' r% M1 K    int     41h" ]( l2 @, U7 D" i+ t
    cmp     ax, 0F386) Z" O8 x0 v6 J; s) [
    jz      SoftICE_detected
8 B/ g* W1 k0 X# J  A) s! }
/ r/ E& i* _8 k
- K$ j3 \0 K' t6 _Next method as well as the following one are 2 examples from Stone's
$ }5 b$ e9 S3 }9 J6 x"stn-wid.zip" (www.cracking.net):0 n1 r! z" z3 Y" b0 Y: b! `% J1 u
) W; D* C6 z. z2 E
    mov     bx, cs
2 H( V7 G9 U0 |- ~+ N* i    lea     dx, int41handler2
$ K  H+ K: n5 F$ d    xchg    dx, es:[41h*4]2 e2 J# F; |- H* Z
    xchg    bx, es:[41h*4+2]6 ^, {4 ~4 f; w
    mov     ax,4fh& y/ M* ~( [; [6 V) z
    int     41h
) Q$ k- L: K2 w$ f' S* S5 d    xchg    dx, es:[41h*4]- r* u; S2 d/ L; a
    xchg    bx, es:[41h*4+2]0 C* O+ A; F. [$ f% [
    cmp     ax, 0f386h
& t/ ]$ z) l$ Q    jz      SoftICE_detected& _# v: R' x1 E# i" Z3 G
" F9 ~: C* m+ s' z& I4 t
int41handler2 PROC
* N$ }; V  l+ ^$ U, |    iret
" Y. w# B& F, @/ o6 ~int41handler2 ENDP
, i& S  R+ a# Y& r$ P; m+ Q" v: E, P. H1 M( g

) W# V4 m7 F7 s8 {7 n8 J_________________________________________________________________________/ j. u$ g" n. _- l& U6 [4 n) v

/ B, t3 _, a" \# {- {
  ?& ^* y' k" T: K+ gMethod 06
- [6 t& K, x. p* k" g=========
; m) u* m! T! G: x8 |0 n) i7 r' e5 d: K1 h8 ^, T5 t/ _0 Y6 H( Y

7 L8 L3 u$ V5 |" w( O2nd method similar to the preceding one but more difficult to detect:
7 k9 r  `1 z/ K" O# P8 F1 s( M; p0 m; }3 J# m0 _  J: C

) U8 q. A& P5 Z; hint41handler PROC% a6 \) g- ]% ^0 r
    mov     cl,al! v0 L) ^8 ~9 O' ?* m
    iret" W+ w4 @  `2 l+ e: [. e' H
int41handler ENDP
8 j2 J8 f6 a: h( @& g# t/ [& I  m- U8 `) A" G( C1 k

- ?5 g* Q; N6 U& G) t% G    xor     ax,ax- \; `- N. Q- C, u( Y( }$ S$ `
    mov     es,ax
; b( \# s- {) K0 @; N8 x6 A    mov     bx, cs
" C/ m6 i$ Y5 a  J- L/ u    lea     dx, int41handler( K" I  i' [, t5 Z8 O7 k( o
    xchg    dx, es:[41h*4]+ `5 e" q. _4 v# }- m  i
    xchg    bx, es:[41h*4+2]
8 E( x0 d- P- V$ C/ \; t    in      al, 40h
* {8 x0 B/ R: F# o& }7 B5 O    xor     cx,cx* W8 i4 ?3 Q" y
    int     41h# K' l9 c0 H; P$ m# r1 G
    xchg    dx, es:[41h*4]* w4 `: F9 T1 K' }3 [1 p3 v
    xchg    bx, es:[41h*4+2], U0 w6 q* K' T7 u  g3 T+ f; A& A9 A
    cmp     cl,al) k! [1 N/ Q3 I, @8 Z
    jnz     SoftICE_detected! i# T; I% f( G: ?5 d

) \; J% T/ f/ c6 P_________________________________________________________________________" A" U' g( y' c) O' V
: k! y3 ?" D, S7 Q( z
Method 07
( O/ s8 e5 M0 x9 M$ u/ ]=========$ Q. H; n% w1 o: M$ p& h
* C$ O9 Q/ R# J, X- a  `
Method of detection of the WinICE handler in the int68h (V86)1 j1 r+ x# [$ E

6 y: D4 Y2 L$ P' [' N2 B! r2 h    mov     ah,43h
  U* @' T+ A2 J    int     68h
5 }7 V" M5 T  {2 F& o    cmp     ax,0F386h
3 Y2 _/ r3 b1 ]$ z9 G    jz      SoftICE_Detected4 G& \9 k# c4 m0 o

: K$ v: P; G( _" _
. I8 _6 {0 {3 A- ^=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
, W6 G9 c2 Q5 N4 P  r5 L   app like this:1 v3 Z0 z/ r/ e+ C6 t

1 P0 N- W, h1 ~0 G   BPX exec_int if ax==686 s; O0 u( X+ L/ |2 x& N% Y
   (function called is located at byte ptr [ebp+1Dh] and client eip is
: b* b- A1 D" t   located at [ebp+48h] for 32Bit apps)
1 _) `# E( ^/ ?5 u__________________________________________________________________________3 i9 {. T" S' P1 v
, y. \; Y  S6 d7 _8 R2 K9 c
. d# f$ a  L) V. y
Method 088 h; R7 r, m1 ]& \* }* o
=========. o6 q& A) N5 j6 ?- k
' E9 h) W% K2 d) G) ?* M
It is not a method of detection of SoftICE but a possibility to crash the& [0 R* J% s/ s- p3 b6 l9 O! J
system by intercepting int 01h and int 03h and redirecting them to another
9 ^5 F8 F' n# ^$ troutine.
2 j3 H; M* Y) \% `& W8 z3 D/ ~It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. Y7 N8 K2 w" z) `
to the new routine to execute (hangs computer...)" y3 h  h. u: z) ]! }

- T& e6 T5 g; x+ x2 s    mov     ah, 25h2 }3 {/ `9 `- J
    mov     al, Int_Number (01h or 03h)
- `! X8 ?2 d4 C6 H3 `- c    mov     dx, offset New_Int_Routine
5 r9 v/ Z9 W& n: ?# O( a    int     21h+ b! v' W2 i# d+ `- R7 d
/ R8 w! U" Z9 o; H+ f& ~7 [
__________________________________________________________________________6 u) U/ i+ c# P$ s' u

2 x( R7 m  J2 lMethod 09
+ f: a. F( S6 L) i=========6 x" t7 g4 P8 D- \5 [
( j* y& e* J5 e' l7 F
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; O2 p- _) [& x! k
performed in ring0 (VxD or a ring3 app using the VxdCall)., ?9 n1 X  j; }- P# o+ [: G
The Get_DDB service is used to determine whether or not a VxD is installed
) |0 n* s+ W- Wfor the specified device and returns a Device Description Block (in ecx) for
3 Z5 g" M, I. M4 ]* z" Z4 g4 pthat device if it is installed.; Q& I3 D9 b% [
( S5 p, u/ s# e3 h
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 X; H+ L' c- m* R, j- a( ^- X   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# ?! e( [$ _# u   VMMCall Get_DDB6 Y5 q1 \$ @3 p1 w! Y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed0 l' P/ m4 G5 R: J* y  J/ ~

8 E: ]) t. a: D" r2 G6 s7 YNote as well that you can easily detect this method with SoftICE:
" M/ m" |; w3 n   bpx Get_DDB if ax==0202 || ax==7a5fh
: s5 c/ _; g; q8 z: F5 s# ~7 i/ u7 L7 q1 p( c
__________________________________________________________________________
% S  i+ {& t/ t4 _8 p6 N' `6 S( x8 `9 o7 Q" T+ s2 y  x0 _
Method 10. e2 t  S, _4 }1 O! A7 n
=========4 `( k: M6 J* t+ c, D
. U4 [5 X% t: I* E+ Y% Z" c9 W3 }
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* G( `  ^  t) V) y  SoftICE while the option is enable!!
0 t/ d& H2 v/ W& t/ \6 H+ h3 @* [9 A& v2 A& q/ o6 j
This trick is very efficient:* W( i5 k- z5 B6 a
by checking the Debug Registers, you can detect if SoftICE is loaded
! q6 j9 Z( j1 Q( K9 v* F; c(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 p! L" v: j/ I, W+ L. Zthere are some memory breakpoints set (dr0 to dr3) simply by reading their/ n$ Z) H; z+ L3 }& \& I
value (in ring0 only). Values can be manipulated and or changed as well) B* y2 T* N, m
(clearing BPMs for instance)1 n8 U: i! X/ c# q% u  b! _; B

: e& A" R8 d! U# M  ^, |4 K' H: X( W__________________________________________________________________________
; J# F& ]* o. B' q" h  d- v( w3 V" j: r" x. `
Method 117 C% D4 R" e- A  S7 k3 i- W
=========. i/ D5 t+ M: t+ R. f: `: e4 Q

3 ~# b+ ?" a( \# y  Q4 vThis method is most known as 'MeltICE' because it has been freely distributed8 h2 f2 I' `; ?; v% g6 B. B' s
via www.winfiles.com. However it was first used by NuMega people to allow
( R3 ?( P: p9 @# S2 A6 w$ l& WSymbol Loader to check if SoftICE was active or not (the code is located
2 c6 p. ?9 i8 l& }, S+ kinside nmtrans.dll).
5 J0 t& P) L# Y2 ?7 v: o  k  c; C7 Y- ?" a; J
The way it works is very simple:
$ I, a' x9 ~, p/ V; |$ J3 c& l- xIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) X9 T1 Q* c" D3 ^WinNT) with the CreateFileA API.+ w& B2 u# `& F6 A
' }: S% e# S9 z$ U) T8 x$ ?
Here is a sample (checking for 'SICE'):
& `: G$ `0 O4 y2 V
' [/ z* v" w3 c1 ]BOOL IsSoftIce95Loaded()6 t; b5 u' }7 e
{( g' C5 ~! C  C% y  {& \3 ~4 }
   HANDLE hFile;  
% A7 s4 C1 }: j5 O1 b* q8 X   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 x4 c. w5 ]4 W8 N                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 K5 ^/ h& Q  e1 ?8 Y
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" [5 ^" {0 E& T; e* g) j   if( hFile != INVALID_HANDLE_VALUE )
0 `9 W( T1 j8 P6 C   {
! q7 k# \$ j; Q+ o$ P+ u. L+ }      CloseHandle(hFile);' @2 i4 s0 I4 t, j* m/ j/ ?
      return TRUE;
. }' u6 X/ V* m6 Y( e+ B( u1 w) O   }
: R$ w0 v. G9 d0 N8 B  c   return FALSE;
* Y; s) C0 U, \2 V5 K6 K}
4 h3 J; o* Q# M. s6 }; \  l
9 v; ^+ T( P8 Y& d( \4 V1 HAlthough this trick calls the CreateFileA function, don't even expect to be
( f/ E) P3 }1 |2 W8 D; f$ Oable to intercept it by installing a IFS hook: it will not work, no way!5 _' h2 @& r, I( f2 I
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, H6 Y3 Y6 `* ]) Q+ D6 a# lservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) W0 e: a0 J: S  H$ U) w# ^8 Y7 m
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
  h) N" M, Y. \4 Z4 [field.
' L  i; l$ _5 b/ m9 r( lIn fact, its purpose is not to load/unload VxDs but only to send a
4 [# B' N: d1 UW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* G; U5 [" s2 c5 W- s; dto the VxD Control_Dispatch proc (how the hell a shareware soft could try
5 f; M" G1 _5 S8 Cto load/unload a non-dynamically loadable driver such as SoftICE ;-).2 V. q4 }7 ?6 z& P3 g8 m" P8 |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 a, N5 k& w% k" i. }; v, A+ r6 K" uits handle to be opened and then, will be detected.
5 g- |* h) S" `: i+ r$ cYou can check that simply by hooking Winice.exe control proc entry point, Q1 f0 b4 A6 b
while running MeltICE.
3 w& d: H) u" ]6 a' ?% d* A3 \& ^
  y# ?* R" h, U* o9 P( m- E# J5 P- D: r! n
  00401067:  push      00402025    ; \\.\SICE( w! u  K0 O: v
  0040106C:  call      CreateFileA& E: u& ?# N0 k7 R# l
  00401071:  cmp       eax,-001
( I% ?. S2 K" l2 |+ ?  00401074:  je        00401091" {) ~- f* n# Q: n0 N0 P
# z0 E  z. x: Z/ q

- _+ m( {; O- F8 vThere could be hundreds of BPX you could use to detect this trick., l& C- N5 _; ~0 a& _& g6 t
-The most classical one is:% N% L5 _8 F& M9 Q# u
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; G! D" l/ O% f+ n
    *(esp-&gt;4+4)=='NTIC'
+ V( M2 Q  g5 [: u1 W3 j$ D) i( ^; s& R7 \0 {" X3 H
-The most exotic ones (could be very slooooow :-(
! u% P, K3 H0 D8 [   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& O2 l; c$ y3 c/ v- n3 c     ;will break 3 times :-(
$ W' ]5 G+ B+ w! z- S' `
$ d9 U) p& y$ V: Q  C2 M) K4 i! W-or (a bit) faster: 6 h6 `1 H4 J6 U; V: C6 p( r
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 d7 c- C( v- ?; K! ^' d. f/ W. o

3 e/ @6 ]) n! e) k+ u: ?   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 T" r' E. [7 q  _     ;will break 3 times :-(
9 `& Y# [$ G; p" A/ l" s  l
) W# @/ J: w5 U  A% V# G) |-Much faster:" x1 g( S- C. F% @) v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ j, q( p( j& \. W2 Z- k1 q
. y* f6 I" |8 f" p
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 M( I! v9 U  p! M+ F8 [: q( x) xfunction to do the same job:. }% I. G( N, ^7 x0 K

8 g1 j; z7 h5 }% ~" \/ k; O7 T   push    00                        ; OF_READ
% K; O! V3 m4 T$ d/ j6 G7 l7 j2 t4 J   mov     eax,[00656634]            ; '\\.\SICE',0
+ t7 n& B6 h- q8 T$ ^   push    eax) o3 ?+ r) l; q% ^+ _
   call    KERNEL32!_lopen
$ ~) M; W- g  q0 Z% G   inc     eax
7 I& S1 P# m5 J   jnz     00650589                  ; detected- Z' u, Q* U0 O) v, I& W% ~# x
   push    00                        ; OF_READ
. U+ f- T: l7 j8 p# w   mov     eax,[00656638]            ; '\\.\SICE'* }6 k- J) e/ S% k0 j
   push    eax  g$ u: U8 r3 H7 X
   call    KERNEL32!_lopen
$ k4 b9 W/ Y, J' m; A   inc     eax/ P* B! k7 ^, H5 `2 c( R
   jz      006505ae                  ; not detected7 q: ]/ d4 X, {) J7 y6 d
7 U- m! r. T/ W

) `5 X& i( h( p; k: z__________________________________________________________________________
" y- }. n! d8 H. E7 |; {- l5 o3 @8 h- C( V8 T3 j$ {2 N0 |
Method 12" ]2 q: [! F' P
=========
+ r  h+ z1 f0 ?3 _
0 v+ P5 D% Y! G( i) S% K, |# eThis trick is similar to int41h/4fh Debugger installation check (code 05
" r0 H  S2 H1 V1 G! M&amp; 06) but very limited because it's only available for Win95/98 (not NT)& Y% v6 x$ {6 f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 g/ d2 U% n- g. y
  O+ l) D. E) r" g; S* ]+ C
   push  0000004fh         ; function 4fh
$ C) N. @5 @* t. F   push  002a002ah         ; high word specifies which VxD (VWIN32)
  r( T  u5 i8 Z                           ; low word specifies which service4 c8 g- @+ k$ U7 H' L$ g
                             (VWIN32_Int41Dispatch)
: s' P) H4 @4 ~: @$ M7 \   call  Kernel32!ORD_001  ; VxdCall
6 O" t' i2 {7 g   cmp   ax, 0f386h        ; magic number returned by system debuggers
& L$ ^" A( `  Q   jz    SoftICE_detected0 R* r  z8 n0 b: H; _
% M" y: n! |" @: x) A3 c
Here again, several ways to detect it:4 W: B. n( o4 u0 }7 z
  P2 Y8 J* k4 L  ^- W9 _
    BPINT 41 if ax==4f
; X6 x6 Z5 L& c1 Y5 i" {+ ?7 @( Q9 u" r- v6 u* L) D
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 F& G. f) i9 T4 E
1 L. e; {- J5 {' }& v4 K7 x    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& O$ S( S% S: M, P0 m+ u* T8 V- N& @7 |$ C! x) c% W2 F
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( S+ h5 g# b( E
9 c* v6 {- b; j+ w8 t__________________________________________________________________________
! {6 I" Z7 ?- F
2 p+ a8 e3 P* [' A/ Y9 }7 |Method 13
9 [6 I, y& C5 S' m6 n/ k2 i=========/ ^) d7 Z5 Z" w, m

+ X7 D# ^# G/ MNot a real method of detection, but a good way to know if SoftICE is+ u- D" @$ m# O2 t* N8 X
installed on a computer and to locate its installation directory.
8 s, u8 F- C! {# c' S' cIt is used by few softs which access the following registry keys (usually #2) :1 i- N5 k3 i5 u# [+ y+ Z8 V! q; f

8 r; [3 E4 b& M( M) Y: {-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 o! G4 T, ~1 P. E" U) O5 |\Uninstall\SoftICE" E' g. b$ H: K) U% R  N. w
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# N0 L+ [: u7 {2 Q4 x1 ?/ L
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- Q8 A( E8 ]1 _; G% o; A: X
\App Paths\Loader32.Exe
2 }6 }( Y/ @1 v# q8 P' H& v- r3 `0 z% {: i

5 I* E0 g+ D: SNote that some nasty apps could then erase all files from SoftICE directory# \# j5 e" v( k- O' g
(I faced that once :-(& M/ G7 z! B6 y0 w! e" K6 ~, M6 Z
- _8 q& g8 K. G6 {. R; w! r
Useful breakpoint to detect it:
' o& x& f1 J) X
2 c; h. {' F1 O1 v1 T     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& M5 X- Z8 }0 s* s' c+ A3 e7 T

9 e- ~+ J2 r2 t( r* b7 E__________________________________________________________________________+ G- {6 ~1 w4 P  o
, Y/ {- }7 j. d* V8 y% `4 w- j

7 t# k+ a, _0 \Method 14 ) x! l$ J- c9 x+ g7 G
=========5 ~; t, I: Z) ], M/ }& @
( v4 F, I- @* m3 `# C8 B& R& v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
& ^% U6 M3 }' Jis to determines whether a debugger is running on your system (ring0 only).' n7 M6 @/ X, r+ i

5 o3 _8 K% E# g: K   VMMCall Test_Debug_Installed
# s0 ?- y1 X3 ~& O" U$ X% ]0 D5 V+ B   je      not_installed
( p/ s% a  F: F4 w
! U" U. K2 e# s- r; v1 }2 sThis service just checks a flag.: O: v# G; u3 |! g
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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