About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# y. {; ?2 Q1 Y: ]. g0 \<TBODY># x1 Y+ \" ?  v/ b7 ?) N
<TR>+ I& k( Z& O: u
<TD><PRE>Method 01 ' y# R" v0 ]( _3 n- }- {
=========. C! Q9 E) I5 Y0 T4 v
# l! u! o( o9 Y
This method of detection of SoftICE (as well as the following one) is
0 r- l6 q% T9 v) Y: P4 yused by the majority of packers/encryptors found on Internet.
' ^1 W# Z/ T& C. f& z. D* F" e  Y$ c: |It seeks the signature of BoundsChecker in SoftICE
+ \0 |7 n3 C4 W* A, n
  X8 h$ ?: n0 {) @1 B. L    mov     ebp, 04243484Bh        ; 'BCHK'
! T& p, u; \" S, l, P$ O    mov     ax, 04h' B  ?3 H3 i/ m& d7 F9 ?
    int     3       4 x# F( P9 Q+ E* |) o  R
    cmp     al,4: r0 x$ S  L3 D( E, H
    jnz     SoftICE_Detected4 @1 C* G+ X$ l7 u5 F6 ~6 Y. @

6 I8 `( @. s8 I' |- P) y___________________________________________________________________________
6 R/ {  x/ W7 a2 D/ a" w1 @
; ^4 i' |0 E) Y6 X' P# z/ P' l- Y% cMethod 02
* h% S/ O5 d  f# V=========% I- Z! w0 {0 W
# s5 f+ N$ a3 p; E
Still a method very much used (perhaps the most frequent one).  It is used
0 Y, Y6 T! g! J  }8 g5 {/ ?to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% b2 z2 ^( b  {/ |1 m  _or execute SoftICE commands...
) E6 N+ M: y; J/ V5 pIt is also used to crash SoftICE and to force it to execute any commands
3 [; x# O$ s- f" o% Y1 C/ Y(HBOOT...) :-((  
) h8 {! I7 w4 @, k2 `
. r! T7 g5 y) @: J5 C) M: Q7 bHere is a quick description:
+ M, M( s. z! @- _: x+ s-AX = 0910h   (Display string in SIce windows)
* k5 F; ]1 G3 V7 h9 [" p- k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 \0 \9 p; b6 e/ ?0 T2 X- p-AX = 0912h   (Get breakpoint infos)! H0 Q/ n/ }( C5 M/ Z- X
-AX = 0913h   (Set Sice breakpoints)
) w- ~6 h7 J! E5 l% s1 o  V-AX = 0914h   (Remove SIce breakoints)
3 c$ s5 H2 W! ~( o' ~4 W$ `; l1 d5 N; [
Each time you'll meet this trick, you'll see:' ]+ r# i$ s9 F
-SI = 4647h4 d7 ]- O( v+ V
-DI = 4A4Dh
5 A* t  l/ T. f1 d8 _Which are the 'magic values' used by SoftIce.0 D3 i6 f9 k* ]' {) y0 S. P  x
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 E0 W9 Z8 j  [$ ~: C" @4 M( o5 L. U4 r7 Y- X8 l7 Q
Here is one example from the file "Haspinst.exe" which is the dongle HASP* c. F& W! d  N. i% N
Envelope utility use to protect DOS applications:% v; [. c# k+ }& y! I3 Z' l0 ^/ I

+ I8 a) b' C% s! W1 P" n1 D9 D7 h; }# p4 W  U. l7 ]
4C19:0095   MOV    AX,0911  ; execute command.6 r; H! e3 r' l; X6 c0 V
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 E& @4 g" T, b! H) e0 E4C19:009A   MOV    SI,4647  ; 1st magic value.3 O* p; h) f/ ~. J: X' L. p' O
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ q9 n& j% Y1 w5 L! w# W" `6 y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- H; Z0 n3 S+ p
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 y6 U- u; o4 p4C19:00A4   INC    CX4 e+ z0 H3 c: G' Q/ h& r9 ]
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 j$ p3 M0 B% w1 Q4C19:00A8   JB     0095     ; 6 different commands.
1 a/ S; y! \! [% v4 r- o4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 g0 g4 [6 N% q% S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 p( v3 {& l* @0 b0 s$ z
) J: ]: V7 |4 W7 y( DThe program will execute 6 different SIce commands located at ds:dx, which' V- w- F* k' q* s" [' W
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' y/ _/ d8 c! ]0 s
, Z( n* X* K" M; T% A/ j* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 H! E$ g& X2 B___________________________________________________________________________( Q& }0 q: N5 \# n
7 ]% k5 g: d. @! h- m' b" o
+ V" [3 E" U2 W# b1 T' Z7 c
Method 03
& ?5 P" A+ L9 }/ |; D* Y=========- I/ m3 N5 }7 g) Q

0 {, j# T( [. G% c9 yLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: X6 y0 t1 j; N
(API Get entry point)
' i2 F, l. c9 w8 B- ^* c, M1 k& A        ; {8 L$ C% H5 }. Q! v

, P# X1 R. V  q' x( n( H: }    xor     di,di
) E, Z7 O) B% _" _  o; y9 @    mov     es,di
9 T8 Y1 E, {9 E7 y) i. w# H0 `* M0 L    mov     ax, 1684h      
7 D! |1 m/ f0 A7 Q) Q( V    mov     bx, 0202h       ; VxD ID of winice3 ?& o- N) R  D; `
    int     2Fh
! K% c& [/ J5 o( L. J. Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point& V  X' ^& \3 E( ?9 U& h1 X, i
    add     ax, di
9 a8 M% q& c: ~% U5 I3 @, P& @' U+ `7 W    test    ax,ax
% C& u9 Y/ m2 x9 p& s! T* {    jnz     SoftICE_Detected
$ w& Q# K% A% \7 E. @9 l1 c% q4 F: B# u4 w
___________________________________________________________________________
$ D" v- P; z8 k- N
, t/ X, E) y! E( DMethod 04; q, T' V3 z5 o6 W
=========: `4 p$ o9 J( T$ z
9 u# a6 O" N3 _3 j4 {
Method identical to the preceding one except that it seeks the ID of SoftICE
$ P. {$ X* K' I) J# W$ M8 J, NGFX VxD.
+ w* y" v! Y6 N7 v1 I
$ E7 w$ v' a4 n& D% t    xor     di,di) E' Z( H( C0 A! [& G2 ~4 n, X
    mov     es,di
: E9 I1 X7 R8 b" j    mov     ax, 1684h      
' w0 K6 M9 H; y# ]  `    mov     bx, 7a5Fh       ; VxD ID of SIWVID# r' d8 }6 j* T  }/ p5 m" l, e
    int     2fh
, i/ ^3 y; L7 g/ V, {    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 q% S; U6 z* B    add     ax, di
) ]! }% U0 n/ K$ z5 K6 O( {5 W, |  S    test    ax,ax
# B0 a1 T9 [" `. u  E1 I# ~    jnz     SoftICE_Detected6 U  t) n4 K. C" P0 f; R8 H' m

) C% I7 R( y$ d6 D! I__________________________________________________________________________2 @7 Y5 Q& X5 g! S9 b! o0 L1 }

: a& |# H- V. h
) X+ N0 x' _' m6 |- }Method 05
# H& N) e& k9 o/ b. ^- L=========
. z1 ?; }+ b- c# A' |% ]3 Z+ r- n9 z
9 [  E" _" f# ~5 c: S' sMethod seeking the 'magic number' 0F386h returned (in ax) by all system, ~  u! H$ F: i3 E( x
debugger. It calls the int 41h, function 4Fh.
" d1 L5 M0 h6 f( R3 jThere are several alternatives.  
8 H  B2 l2 t& C2 j6 [/ h, V+ F& C4 c( O8 x$ e; g
The following one is the simplest:* }2 f4 k8 u. C) L
* f- S+ r& E  g9 a& D
    mov     ax,4fh7 Y  X' z6 v$ J+ l1 O
    int     41h
" C& x: Y7 B1 N0 t% [    cmp     ax, 0F386# L2 z6 M/ {& E/ s" k+ _
    jz      SoftICE_detected
# R% s0 {: Q$ J; p/ a. e( k6 C2 |: {: U
/ @' i7 |) I$ Z
Next method as well as the following one are 2 examples from Stone's
) e% c& ~6 ?3 u. b) c! G# h"stn-wid.zip" (www.cracking.net):& Y" W; D) N! k7 G4 \2 A

/ S. M, j5 d9 p# f4 L' l    mov     bx, cs
8 Z; J' a, c: a6 I# n( b, `; H5 O    lea     dx, int41handler2; w# w% f7 {5 c. m& T- H1 `
    xchg    dx, es:[41h*4]2 W$ {1 L# q) t- s; l
    xchg    bx, es:[41h*4+2]$ J$ a/ H. ?) ?  [" R6 ~
    mov     ax,4fh- o5 S( }# y1 Y9 T
    int     41h
; }0 i2 O& p4 F9 h  [/ }( S    xchg    dx, es:[41h*4]2 J- A: v' \/ v/ \& q7 ]3 Y
    xchg    bx, es:[41h*4+2]7 w3 g5 ]6 I4 F
    cmp     ax, 0f386h% _6 M' A& g" i4 U5 W
    jz      SoftICE_detected# I6 }/ h9 K& u( m. K1 _4 q
! ?) q/ u* R3 Q$ b1 [8 ^6 f, l7 y
int41handler2 PROC8 O9 j% W8 `. D1 l) y- ^3 _
    iret
7 q  g" g; ^# w3 m5 i8 sint41handler2 ENDP
: ~; Y3 d* S6 I( K1 I6 w; `+ O4 \' _/ t7 @

# K) R; T/ n; c# G6 E5 Y/ U_________________________________________________________________________
3 r* i4 [, j9 m/ t/ u  E* ~* n" B1 P; Y- X6 c) g* r
$ Q8 G7 i( r) o; U7 p0 k+ Z
Method 064 h5 f9 E0 I, h& T1 M/ n& u' p, T$ K$ c
=========
, y- k5 F0 _! r/ ~1 I
0 e( W+ R; r' N% F! ]2 c' H+ o9 o' o# x' s. a  c
2nd method similar to the preceding one but more difficult to detect:& ~/ _% ?6 w& Y# |
/ R# a: O; L4 o1 B1 ?$ K
" A, I% s0 r3 F
int41handler PROC8 {) ~5 f0 E! p; w; O
    mov     cl,al
: Q% J* g# i4 Z    iret9 o% t6 F3 x! ?7 p; y
int41handler ENDP, u) @; k4 o' P4 I5 t' b
9 e9 \6 u4 N5 f

2 |# G8 Q: G, f* T0 c. R" E    xor     ax,ax
9 J  c% m  r, X& K' M7 a1 `    mov     es,ax
8 i: Y" i$ S& \! S- ?    mov     bx, cs
" [7 w( t8 X) i* }# v$ x. M( E( P    lea     dx, int41handler7 c- h: C, P# Y) I, P' X
    xchg    dx, es:[41h*4]
; l( W$ s! t3 K# }1 r9 \    xchg    bx, es:[41h*4+2]: }; R# t8 x% N, g- B
    in      al, 40h) I' i3 c* M8 h0 c
    xor     cx,cx+ x0 N& g6 c7 z9 V+ G5 ]& p
    int     41h6 k. r% ?: d# a
    xchg    dx, es:[41h*4]5 L8 `% G9 |* I; d: N
    xchg    bx, es:[41h*4+2]
  F0 @' D4 `7 i, @    cmp     cl,al) M2 W0 C3 f# W
    jnz     SoftICE_detected& s- \# v: R9 e! [' T/ U$ l& B

" V4 ?" S5 H' k_________________________________________________________________________
& V& y4 ?& K3 U- h& m/ U$ e
2 p6 s- ?6 r) X+ ~1 i; W) XMethod 07
( k6 c. U7 [6 ?2 d7 B% H=========
$ r; [& ?2 F3 U
0 t. _: I! \7 n$ W% {2 w. iMethod of detection of the WinICE handler in the int68h (V86)
8 k, T4 F# {! c7 u1 R5 c$ F; j  V2 h/ V$ a0 e0 ^! O
    mov     ah,43h, q+ f. o3 [3 l2 c7 h
    int     68h
7 S$ J9 c8 d9 Q2 t; i4 Q    cmp     ax,0F386h0 x$ y# q4 N! K# t% w9 d; q% @$ y
    jz      SoftICE_Detected- c' D! P0 P" C, F
+ E& P# c: `2 h; R* y
- ~8 [, d5 H9 z7 F0 U: x" Q0 Q$ O
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit6 ^* m+ G; i. P+ E7 v
   app like this:
  |. E8 \( N- d# o- I+ Z( e9 A+ N
   BPX exec_int if ax==68
0 P8 Q' y' \6 w+ ]2 W; ]6 ?) O   (function called is located at byte ptr [ebp+1Dh] and client eip is4 h: H, @, j; @+ h! F
   located at [ebp+48h] for 32Bit apps)6 [7 K0 ]  F/ [  z+ f3 ~! n
__________________________________________________________________________+ h5 B. ^* K0 d- }

9 ?( p5 w1 g+ G; [6 }
$ d9 E2 h8 s% F& PMethod 08
0 p0 Y) o* y, o- u  ]=========4 L6 l0 T2 ?% u+ z# {6 [5 s; w

( Y7 S" ?- I& N( M, wIt is not a method of detection of SoftICE but a possibility to crash the
# u' s+ {% q3 v2 T; B$ N0 Asystem by intercepting int 01h and int 03h and redirecting them to another
0 s/ C9 N. e; H$ ?6 J6 ^routine.
) g8 `# y8 ~, j6 D. @It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points2 H' H+ o0 h$ N. H0 ^
to the new routine to execute (hangs computer...)1 H* y0 K5 ^  K4 o% u! }1 q
% ]4 I$ N; g# }1 o" F( k4 t" }
    mov     ah, 25h9 K9 `3 {  Y- E1 Z7 R: Q" @+ a
    mov     al, Int_Number (01h or 03h)5 x% c8 z4 @6 T, O
    mov     dx, offset New_Int_Routine# q, ?; t* w1 V" d% Y
    int     21h
5 V0 Q/ U+ t8 D9 a& W: o3 b7 |5 s5 M! Q' i# u# j7 [: J0 F( x
__________________________________________________________________________
2 `4 m. a/ x' W; }- Z
+ ^5 w* ]" ?' w% N6 i# dMethod 093 D2 R& j3 p4 S
=========
2 W8 w. k# C: L% S6 i" _+ i7 i/ X3 G1 N$ v" D. m/ y  B+ y
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ C; S- r; S' t9 N7 X
performed in ring0 (VxD or a ring3 app using the VxdCall).
; _. X# U7 Z: L0 v: E. |The Get_DDB service is used to determine whether or not a VxD is installed3 Y* w' w% V5 P: H- L! H& V0 R( g
for the specified device and returns a Device Description Block (in ecx) for
* U7 H4 W% n3 \# P9 o' M) sthat device if it is installed.( R* [) H7 P0 Z3 }6 K+ \
& S6 E6 W3 Z* O8 n  X' v
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- R6 b4 G2 {5 Y) y% Z2 L   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* n6 i- W; q2 `' c   VMMCall Get_DDB8 x/ W1 U# I2 b1 v
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" j$ y! y: w8 z) z5 b5 K) I

3 m5 k( I! c( q8 x, J4 ^/ o% y9 kNote as well that you can easily detect this method with SoftICE:( ^! R4 g, W, D4 W+ Y
   bpx Get_DDB if ax==0202 || ax==7a5fh4 x4 B( b  B7 u7 c4 D& Q% l; f! J% a

$ B  n+ i& m& C' j__________________________________________________________________________
7 x' H8 k* U4 {; \9 C1 w8 w" ]/ l. f$ F* E. C2 n+ i) r
Method 108 b2 e( u2 \% G
=========
& d0 u& i+ |& @$ K  W1 }4 \8 s; i, s  E+ q7 k
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- a: j8 p- D  Z" y0 Y0 z
  SoftICE while the option is enable!!& x, i. C7 _4 S3 j5 c6 F+ X8 n; \

( G% G- I+ |1 _8 T; DThis trick is very efficient:, }) E. Y5 z7 M" Z& c% f
by checking the Debug Registers, you can detect if SoftICE is loaded* u# S* ?' E2 y% ^+ E8 I. z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, [% X  f# S1 u$ @% [there are some memory breakpoints set (dr0 to dr3) simply by reading their
7 a8 P+ w' j8 h: N$ _value (in ring0 only). Values can be manipulated and or changed as well
" b8 r1 F4 d( [(clearing BPMs for instance)" U3 l* W% H1 ^  d) k4 C9 x5 u
* l* o6 L. o) _9 [
__________________________________________________________________________
; l, q6 ]- v+ `; d. Q
/ `: c% _6 O7 g" @Method 11
; x/ _8 G% q2 ^7 Q  b=========
5 X& T1 J" _. ~4 e. O5 o6 X# J  {
This method is most known as 'MeltICE' because it has been freely distributed
: a( ^" L8 k) A0 r% }via www.winfiles.com. However it was first used by NuMega people to allow* Q+ b9 _& p. R' y/ w0 M
Symbol Loader to check if SoftICE was active or not (the code is located
" y* q, j* n" |inside nmtrans.dll).
1 A: M" _6 `; u/ }3 N3 j3 ^; n6 X9 R/ B5 ^
The way it works is very simple:
) a0 i/ D) x5 mIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 W3 }, P2 z7 F8 hWinNT) with the CreateFileA API.
" V2 q% h7 q4 [. }% s- A% A4 s- q0 R2 c" u: F1 }
Here is a sample (checking for 'SICE'):
5 {" T' O% s( z% z) K1 s6 J0 G& K# D" b& ], Y1 C1 \9 b
BOOL IsSoftIce95Loaded()
+ |' l; u) z& b9 a# Y' R{
# G. E: c4 G0 {8 t$ T; V& ^   HANDLE hFile;  
9 p) D' Y& m$ C& c   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' \4 }0 U8 o7 f2 U1 }% y
                      FILE_SHARE_READ | FILE_SHARE_WRITE,# i. x$ m* N4 X2 T* F
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. X' p( v/ y: G+ P
   if( hFile != INVALID_HANDLE_VALUE )( u* |/ a2 p1 a2 n
   {
& S( L# M7 V7 i( H. T$ b5 E% N      CloseHandle(hFile);5 L. V+ R1 r, l) d
      return TRUE;* \2 l1 y0 I* F/ o( W$ s. j
   }& g7 a, |: b" Y, X, a. J
   return FALSE;
4 F8 Y8 b& }+ G* L- j}# @$ J% b# N+ v3 F, D& ]: E. }

: O" ]3 ]# \: o  `! KAlthough this trick calls the CreateFileA function, don't even expect to be2 d' K0 Q. k" i: {& \6 j
able to intercept it by installing a IFS hook: it will not work, no way!( B* F/ ~$ o& h
In fact, after the call to CreateFileA it will get through VWIN32 0x001F% i1 P5 w- `- y9 ]& X6 T, t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
' r) ~8 H+ c0 Aand then browse the DDB list until it find the VxD and its DDB_Control_Proc  \7 p6 F# T4 o# V; K0 W
field.
4 m2 e* O7 l5 f) Q8 LIn fact, its purpose is not to load/unload VxDs but only to send a " S1 ~: P$ {# `8 V# V1 B
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)$ Q! k- [. d+ N6 v
to the VxD Control_Dispatch proc (how the hell a shareware soft could try8 E1 x; e7 A& R$ Z7 d1 r
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 E1 i4 ^) v/ m: {* u/ X' ]If the VxD is loaded, it will always clear eax and the Carry flag to allow
* J& Q& ]7 C$ c( f% k, ^  F& d( fits handle to be opened and then, will be detected.
! n- R% k3 T6 E% KYou can check that simply by hooking Winice.exe control proc entry point
! ~4 f: q; V) g* \- l( I; r0 xwhile running MeltICE.
( F+ \) ^. T9 m: p8 k- p" i' F
& ^9 b, _. {0 e9 x9 m) q5 U0 E" Y: |( K- m2 C* C9 }& p7 X
  00401067:  push      00402025    ; \\.\SICE
' @- n! ^) T. f1 o7 ^  0040106C:  call      CreateFileA& q/ H* C/ T- O3 z, x# G7 F6 x
  00401071:  cmp       eax,-001; y; q! F& c! C+ j, I: D3 L
  00401074:  je        004010914 }; a5 i: c3 K7 l6 ~% N7 f7 D
  }6 F6 g3 ?2 \6 B) T

- s6 H: O) J) vThere could be hundreds of BPX you could use to detect this trick.* {/ u! d5 v+ g. @' ^! t
-The most classical one is:: ]# [& S% A$ d( I: e1 G; w. V
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* E. T: ^& i. O% h    *(esp-&gt;4+4)=='NTIC'* ~3 c2 M9 ~" @$ M" A& t3 a

% f- K- `8 ?0 K-The most exotic ones (could be very slooooow :-(
; R- `7 @) L7 N9 h" d   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 }6 ~0 U8 \: o' L+ c. y  c     ;will break 3 times :-(
3 Q) ^1 W" O4 Z; i& B1 H% B* E& T8 [( w' q0 A3 X
-or (a bit) faster:
  y- n9 n6 T" z0 \: l3 v" f( b3 S   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ a' K  s+ J2 a; R2 R& Z! E% J! j, D7 ?% O
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 ^; i* e7 ^& H0 a+ n! Z+ E
     ;will break 3 times :-(
6 I  t5 X5 @2 ~8 ?4 C" [7 l; {- l# w$ p# F9 m
-Much faster:
% S6 u: i( ]" K   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 E+ B) \# a3 ~* H/ u2 h- A; C# r3 D2 n1 K. y7 X* v* W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen" C* e; j& P9 k' Z7 f  U
function to do the same job:5 [4 K0 ~8 e# r/ p7 m2 U7 ~
% C' _2 O7 {  V  w
   push    00                        ; OF_READ
' R1 S0 a+ e$ U0 h/ g   mov     eax,[00656634]            ; '\\.\SICE',0
& g0 Q, f! v: m2 }5 c9 {  F   push    eax8 H+ c: [% u0 S! v# s* Z2 R0 s
   call    KERNEL32!_lopen. s0 ^# A; m2 w" Y2 S6 J# ~
   inc     eax4 r5 L1 J- m/ ~: e3 [7 ]
   jnz     00650589                  ; detected  r6 B6 R: g' I5 c
   push    00                        ; OF_READ( `/ u/ g8 N6 j) z0 {6 L$ S
   mov     eax,[00656638]            ; '\\.\SICE'
2 ~6 M" g3 f  S+ K, {8 h# j' Q   push    eax
7 [) q* u5 q5 [" |' J" K: b   call    KERNEL32!_lopen! |* T/ h+ \3 N& W6 a
   inc     eax
1 P5 W/ x9 ~' _0 p1 t, p# d* D   jz      006505ae                  ; not detected9 D- k  m& f; C) K

6 m, S4 x4 h0 d4 c" D
7 c: Y: l; B0 R& M" V* v- y__________________________________________________________________________
& D9 T8 y- A0 `5 j/ M; Z
) g6 Q) n3 ]- |& R' t0 QMethod 12
1 j# N3 `- L, V1 Z, Z% A=========
+ e! @( r  D/ z, o! }7 Q& I7 Y- O  M3 K
/ o1 k1 j, W$ R8 _2 H( T% VThis trick is similar to int41h/4fh Debugger installation check (code 05
7 k( d  Z8 x4 S( q&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' |$ s+ t4 [" ]% e8 Pas it uses the VxDCall backdoor. This detection was found in Bleem Demo." F4 H" ]  S0 k/ E3 t7 v

% M7 S, B* N+ I. z# G   push  0000004fh         ; function 4fh( Y8 \/ q( g( X- v  Z
   push  002a002ah         ; high word specifies which VxD (VWIN32)' g( `1 r+ Z) H1 G0 F0 ]4 z/ \
                           ; low word specifies which service7 ~2 q) b8 f3 ?0 ]" j* L, a
                             (VWIN32_Int41Dispatch)
  C5 T2 y' \$ _7 T2 G1 v- q+ q   call  Kernel32!ORD_001  ; VxdCall! ]$ _0 T1 B6 {- g/ \
   cmp   ax, 0f386h        ; magic number returned by system debuggers0 M" Y; F' F) k1 v
   jz    SoftICE_detected8 E: T, l) |: d0 _

. s( F. R6 m( L. `* u6 @5 ~$ r3 yHere again, several ways to detect it:8 ?. a. Y3 ?2 u* l2 q+ o

% w: j' _, e6 s- m; L    BPINT 41 if ax==4f
# j& X2 f( R1 H/ l1 }) c$ S
# c, Y, W5 t; r8 p# R$ z8 D) V! `    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
. W* a& E4 ]5 Y+ w
9 _2 V( Q/ ~8 @! W    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ ~2 H( d- \5 T; E

5 _# l' }/ Q  t# F2 t6 ]* ~    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ H& p6 f$ z" Z3 S4 k
8 ]7 Z! f+ \; Q, J4 B* m0 y__________________________________________________________________________
# H3 Z2 u9 u6 d6 L. r6 F. w# n3 b+ S# B: H. k3 c( [3 Q! C$ o
Method 137 s: Y3 F9 s3 x6 C& L3 F
=========
( Z, k7 T( q2 ^& s5 \* |% T) E
# |1 y$ p2 P3 G& v) u/ [Not a real method of detection, but a good way to know if SoftICE is' N. B$ z/ T; H' H5 F; k  g$ c5 x. F
installed on a computer and to locate its installation directory.. t  R6 A6 m+ A( K
It is used by few softs which access the following registry keys (usually #2) :
# K3 Y2 x9 [" c, }
2 l, ^/ F5 e1 u3 H1 P8 |- ?: I-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 u" i5 p* M. {0 c6 E$ G* G! t\Uninstall\SoftICE
( I# c4 j. P% w+ @: W-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ R  z- [' f1 b-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ e" k0 z& _5 W7 B9 w. L" Y" `
\App Paths\Loader32.Exe! G0 A6 D" o- d* l) {8 j
5 J" H! ^! n5 D" U4 q! U8 k2 q, ?
0 B+ G' n" F: S6 R
Note that some nasty apps could then erase all files from SoftICE directory
; O: q2 A  F% l$ Q1 L(I faced that once :-(
# @# |9 {7 m4 q. O
1 L* n7 m7 a6 f! fUseful breakpoint to detect it:  U9 Z* {! p" ~' I2 Y! K( O
$ V- M3 L$ I0 o, k+ F" E3 g6 X
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 [* |) z7 ]6 t0 r- o% P
6 d7 n& ~* t! _' W. _( M& U
__________________________________________________________________________
  s" w+ b$ o' r; }. K) [$ b$ M. H4 j7 V+ K$ L# T! n5 W  Y# G5 }
1 D& b7 h/ o4 M3 T! ]
Method 14 % h# _6 l% O; `! b5 `7 }3 O# o
=========
# B- j- v' Y% i* s
) w. X' `& Q2 W9 @. p) fA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 r3 }1 o0 r0 I; Ais to determines whether a debugger is running on your system (ring0 only).8 ^, c0 i) {+ V+ `2 L* v
6 l* S3 g, S; n5 K4 R/ U5 o
   VMMCall Test_Debug_Installed
# z# ?" D$ }6 _; P  o   je      not_installed
6 G3 X" |( f. G% a* ~7 B3 ]0 j) t; N
  I2 M  B. g9 r. {This service just checks a flag.
1 p7 G9 ~2 W. l& Y+ g</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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