About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
* Z/ U2 a  \. G9 G& G  w' z<TBODY>
/ f  N) s4 S3 w: G2 I. N<TR>) F5 Y) p4 _, z4 Y0 j+ a/ u9 D
<TD><PRE>Method 01 7 Z( b  X; T7 c; H1 W
=========9 v5 @/ A: \! O$ |2 g

* v: v( _0 |0 ~9 g3 fThis method of detection of SoftICE (as well as the following one) is% h6 I& _+ J1 e- d
used by the majority of packers/encryptors found on Internet.+ Q# a9 Y, k4 q
It seeks the signature of BoundsChecker in SoftICE' c5 c$ s) c! M/ G

: b3 Z3 D  _. Q3 y# c) j    mov     ebp, 04243484Bh        ; 'BCHK'
3 E  I/ H0 i* v% W) P0 j    mov     ax, 04h" \+ N% g7 p9 f" h( z$ o
    int     3       8 a: ]1 n& Q* F$ r& a, g
    cmp     al,4( p5 b$ `. ]- W6 w4 I
    jnz     SoftICE_Detected
: N  B! @* ]9 j3 K7 H9 I- Q5 Y9 k, z9 {& R4 E: K  b: d
___________________________________________________________________________$ ~$ u' m; t% i
6 g9 |8 A7 S' n$ C3 a* k
Method 023 {0 j4 {* ^; Y! w! P
=========
2 k+ P" N" P& h- ?+ G
$ ^# V7 l; Z$ z  X. v8 Z8 wStill a method very much used (perhaps the most frequent one).  It is used% O4 K! C! u+ l7 I; o
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 U9 h# I. M' }
or execute SoftICE commands...( c9 G- a9 G& Q) s# `& P
It is also used to crash SoftICE and to force it to execute any commands" j$ A/ x: x# F6 h/ ~( g- `
(HBOOT...) :-((  $ ]3 L  m3 @  C

2 d% {# E: L- S, {) X2 j+ D. u: rHere is a quick description:, n+ M4 T7 U! Y. e
-AX = 0910h   (Display string in SIce windows)
; D. }3 Y" a5 W-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
' X: ?4 h. N- p& X-AX = 0912h   (Get breakpoint infos)7 u9 X, `1 r0 w( P9 l. l
-AX = 0913h   (Set Sice breakpoints)
( m- m" z1 t9 p, ~  X% t* a: L-AX = 0914h   (Remove SIce breakoints)' i" J: x8 ~3 \7 ~5 ~+ D, y
& b6 f6 F) E* W9 H: M
Each time you'll meet this trick, you'll see:  I, ~+ y5 Y9 J9 |$ ]4 Y
-SI = 4647h+ E3 v# y) X- |! z* F( T% X0 E' L
-DI = 4A4Dh
7 {! K1 |) D. F: F+ ^: IWhich are the 'magic values' used by SoftIce.2 b- n3 p0 }% g# W/ f- {
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% t: n& f) m+ }- l" a% P6 X; d0 P! i1 i! q" x, L1 O/ Z% T# j
Here is one example from the file "Haspinst.exe" which is the dongle HASP9 |! |* X/ `& a
Envelope utility use to protect DOS applications:
1 }" c$ F4 ~2 z% H1 t$ j; {% E6 z. E& ^5 S
/ Q9 }+ O7 ~* {& O: ?
4C19:0095   MOV    AX,0911  ; execute command." M! o7 C1 T  M/ Q- `0 q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 a: _/ e* Q$ Y% ?% M) ~
4C19:009A   MOV    SI,4647  ; 1st magic value.
7 p2 p2 ]4 A2 b2 |% b! o4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. O9 b0 W5 O2 y" P$ J4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 y$ k! Z; S, q( o+ Z; `& B- m
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
2 |' R3 J3 u. Y5 s- o3 @2 r# f4C19:00A4   INC    CX
* q! ]! o9 L& o0 w& C1 k4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) Y$ r5 C5 u& \, U, T" T4C19:00A8   JB     0095     ; 6 different commands.
: _7 s, G) i* G0 y( R0 n' Z+ `4C19:00AA   JMP    0002     ; Bad_Guy jmp back.; _$ m: w, F0 i, n
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
* x7 t% C9 z( v% V: G3 B# \+ H7 C* A2 t
The program will execute 6 different SIce commands located at ds:dx, which: W% r  O6 r/ R; D7 u. s3 T
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT., C$ G- @% `' M& X% q, `5 V

, Q. ?) k" y7 @* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 R" i1 T9 l( A7 Y) s* F1 n___________________________________________________________________________
: n" x0 a( T$ h5 q/ ]- q% R6 B7 y% ~2 v

6 L, u) ]" `+ I: E" h( p/ yMethod 03
* v0 T8 W3 ~0 Y/ @  H=========. A, i! N* ~9 x* n/ i
* o3 D/ u$ O" g1 f9 N0 Z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ Y$ @2 D) G% A3 s/ s(API Get entry point)0 y# T3 P# T" @& P" U
        
/ L/ _& }. J' @! w+ r2 V# D
! ^! k: c# H5 V. {    xor     di,di# c2 M% X: D& D8 j* W/ ]) i/ S
    mov     es,di
  V, H- x2 v  s! l: A    mov     ax, 1684h       ; M( j+ C  \* a5 A0 [4 R
    mov     bx, 0202h       ; VxD ID of winice+ A; X( c; T8 v# }& L' D6 ?
    int     2Fh  a8 b. A' C' S8 O
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: j1 u. E, p! i
    add     ax, di
" Z5 `0 o' r$ @! u1 `& x# G3 B; C" b    test    ax,ax
0 A+ u2 x: R4 w: \% N6 S    jnz     SoftICE_Detected4 x7 z" l, [& d+ F, K. k! ?4 W3 Z
) Z. f$ b- f1 P3 |3 Y1 h: L
___________________________________________________________________________
6 X- J  {: A7 X) K+ H) z0 G! B* V- X6 q# V
Method 04( M& q4 G3 T5 L) k
=========
; G8 y5 V- s- Z: ?6 H
% v  O) @4 V  W9 ^* sMethod identical to the preceding one except that it seeks the ID of SoftICE
0 U/ I- U( B; R% [$ w4 OGFX VxD.
3 n( j5 U( ]: g5 Z! G
; a% S5 e- i5 N9 Y    xor     di,di
- W* d* k) ]  x: w" t( U3 }    mov     es,di) K; o) ^! ^# V
    mov     ax, 1684h       1 p4 j7 l1 ]  x7 W* L
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 g, w1 L$ f* D    int     2fh; j$ G0 B4 P; `6 d* v- m7 G7 Q. e' m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- @) f( F+ j1 A, i; Q: {: @    add     ax, di! {; u9 e, y+ P  b. N) o5 x0 }8 f
    test    ax,ax
$ B, y* j5 {4 ?) ?9 c* K. g    jnz     SoftICE_Detected
9 B5 @5 D0 s9 C% |6 J3 i  E
9 Q4 Y! K5 Q8 s, ^__________________________________________________________________________
  X1 d6 X, U0 Y
1 _+ A: m  R9 }7 T4 z% B( k- l7 K* G: _7 p- P' r, m! a$ r( j
Method 05+ w4 Z8 ?0 I+ A' t( d" L
=========/ h0 T7 f# s( ~, A$ Y( j7 b) L
8 a% j1 V  j, w0 ?7 U4 k
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 T$ P9 j; s+ r5 r. f/ {5 Z& a
debugger. It calls the int 41h, function 4Fh.
+ \( \. \9 p* Z5 w6 FThere are several alternatives.  
! q: s$ k4 M9 a
& K7 W) A0 i5 q' oThe following one is the simplest:
% J, M1 B& B2 J: k# q- ]9 V5 P# a+ C) }* t" _( K
    mov     ax,4fh9 \- h3 O5 A4 r  G) P* q9 Z$ m
    int     41h
( M# i- o2 r7 s& W+ W; X/ W" M    cmp     ax, 0F3864 c: w( k0 T, V2 R; |' @+ m
    jz      SoftICE_detected: H1 A, k+ b8 z0 Q5 ^* C
" a/ f' C/ ]2 e, N% {  V5 ]7 X

3 K; v- D3 {% }' g! Z9 U3 {Next method as well as the following one are 2 examples from Stone's
! Z( X8 ^* |5 Y6 k. ^8 s2 @2 o( l"stn-wid.zip" (www.cracking.net):
( D  D9 d. F: p
3 w; X% @; Z. X5 a    mov     bx, cs0 [6 i, @4 u4 j" n6 t0 a
    lea     dx, int41handler2
, A) n' l/ j' C    xchg    dx, es:[41h*4]0 P4 c& e  ?5 ~3 {/ S! |( F
    xchg    bx, es:[41h*4+2]8 m1 R4 q  x4 A4 q
    mov     ax,4fh
! {5 n- a1 |$ _5 ~( m1 h5 W    int     41h
7 W% G3 p0 w+ y1 {    xchg    dx, es:[41h*4]. c8 i3 M/ W2 W" R
    xchg    bx, es:[41h*4+2]
) H! X/ r% N8 I9 `8 i    cmp     ax, 0f386h
+ A; e$ m3 ~# n6 p: |. x    jz      SoftICE_detected
' S' {- u& i, H% Z. q
6 L% a0 G/ V. ?/ S, i; D2 Qint41handler2 PROC
, q; u' s: a: A/ Z) k, e; v9 t/ I    iret
) Q* {1 M& y! ~( M3 G1 t* ?2 wint41handler2 ENDP
/ A$ [6 B9 J, P5 r& ~3 R' h7 a  W: A

0 W4 j/ F5 Z  f7 |_________________________________________________________________________) P( R: \2 P  S0 U- ~
0 h; ]* L: M! Y2 ?5 c" J- q3 u

! ]# {# r( y" O  d4 jMethod 06
, Z- m- f. w; h+ _. V0 w' \=========
7 h* V. v& z: a% t0 J* L5 W) Z: z$ u
) [, x. l5 Q5 E, _( @: E1 G) P$ ^
2nd method similar to the preceding one but more difficult to detect:5 E" t6 J; W7 W3 B

$ V2 f8 e- A/ p% b8 y5 r  W
8 l2 b, c) P- D  L  H" tint41handler PROC
) B; ]7 T6 J5 S/ n3 H3 k    mov     cl,al: p+ D: R9 ~' m* A
    iret
* m* X) ?1 Z2 }: {int41handler ENDP
' [5 C+ m" @4 \' O, S" W5 }; S
8 @6 S; i9 r. J7 v) R5 `
3 C4 L2 n' a; w9 S    xor     ax,ax7 I: i& \5 e2 [4 i! C9 N4 J
    mov     es,ax
, S/ A2 t% q+ I: y/ E& E' ]    mov     bx, cs
9 {3 B; k3 I$ {2 ]    lea     dx, int41handler
7 U% \" U( a+ g  y3 O# P& }    xchg    dx, es:[41h*4]# l' Q- W  e( I* T3 z- s
    xchg    bx, es:[41h*4+2]6 m8 |$ ^! ], U  }' b
    in      al, 40h
6 V# d2 O4 b7 a5 H2 m2 b: _" |    xor     cx,cx/ o( W  Z5 N/ _9 M6 G# ]
    int     41h
' p" l+ G7 B" R+ f5 a    xchg    dx, es:[41h*4]" `7 C& d- p8 w% _' p
    xchg    bx, es:[41h*4+2]* T8 g6 A. {. J/ W4 g6 z
    cmp     cl,al9 r; S/ K0 [. ?1 h+ y
    jnz     SoftICE_detected+ z" N: Q: n. \4 u+ w
: s" M6 @' Z7 P1 b3 q$ H7 r
_________________________________________________________________________7 M7 g6 l/ D: V; ?$ s7 ^

" s# A% i3 Q/ ~  ]8 \! y# ?Method 07
7 w& m) u$ V5 |5 s7 x=========
& O, l5 P/ j) j3 F  t4 j( R# a, u  I+ K3 \6 J) i
Method of detection of the WinICE handler in the int68h (V86)
- \: S0 `# T) c$ D7 a9 `* H- G& M; O3 R. h3 T2 p
    mov     ah,43h
2 S5 ?7 _) e! |4 ]: e* j    int     68h
* u% P% }* l8 k  i  u8 j0 Q    cmp     ax,0F386h
. e. l3 R9 \: @    jz      SoftICE_Detected
3 e: I% Z; ]6 f# M
* W$ N# \, V% l, Y$ |& I9 K+ D; y9 x" B( J4 [/ h. q$ v7 o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
6 H2 X7 v# k: d7 E8 d+ h0 j   app like this:5 b/ A7 N2 u6 P+ Y# S; [) }6 |& ]
8 N7 Q! j6 M  E2 b
   BPX exec_int if ax==68$ x6 [1 C3 c  M
   (function called is located at byte ptr [ebp+1Dh] and client eip is
, q+ H6 B. ]2 C& C6 |, L8 O   located at [ebp+48h] for 32Bit apps); c" q9 @% O9 _
__________________________________________________________________________: V, K4 s; F8 W

- ~- i) G1 K( X9 X. d) w( [: B+ l1 r5 e. L, I. R, n
Method 08( h8 t3 @8 n6 T0 {
=========4 }0 H" J: b1 `; s% }

- M' s: S6 }0 w, w  i1 @) EIt is not a method of detection of SoftICE but a possibility to crash the4 N. U' C" c* l/ n& R" `/ m$ m7 n
system by intercepting int 01h and int 03h and redirecting them to another
- g, q5 K& j) o. Croutine.
% W6 K! o8 s9 W# E( M, LIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, ~  F  |$ [. P4 \3 m
to the new routine to execute (hangs computer...)7 W/ s0 o$ r2 o3 j7 {
+ ^' R( M  L5 Q$ W0 D2 C+ g
    mov     ah, 25h
. E8 c9 d0 {' ?3 }7 _    mov     al, Int_Number (01h or 03h)1 t/ y$ r( Q) F9 D
    mov     dx, offset New_Int_Routine
% v( k2 X. B" m+ a5 H    int     21h
: k9 k+ n+ A1 C3 d7 d, @, x, e; ]- W( E. o  d1 ~- p/ V
__________________________________________________________________________4 y/ k9 R0 q1 _: k

& B9 z' z6 ^/ V$ c) g6 \Method 09
- }/ e6 t) C! z, r2 _6 f=========
& O% Z( m: y! T% e  w% U, _* V
3 l) H* `/ ]. T2 A" w! V1 g  @This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) [* f9 K8 Y& U; Q! x# W
performed in ring0 (VxD or a ring3 app using the VxdCall).
: }& [5 E+ u8 s: B9 FThe Get_DDB service is used to determine whether or not a VxD is installed; d$ N" T2 z: {" y& J2 K4 t
for the specified device and returns a Device Description Block (in ecx) for
5 c/ H* C- A$ ]that device if it is installed.
* x! ~; U, }1 o& S, m) T& T% v
3 T1 @0 P* O$ O, t" J( C   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. f2 X$ d' @* x   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ Q% v* E( U. n5 Y2 K$ |0 y
   VMMCall Get_DDB
, K0 L# c' ^: c; c   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed5 v2 ]0 p" ]8 m) @  [, |
3 {2 v4 c( c+ H2 R" }" M/ T- }
Note as well that you can easily detect this method with SoftICE:% F; V5 g# r! _
   bpx Get_DDB if ax==0202 || ax==7a5fh# J. o9 B& q8 O$ S+ x

3 |' O; K" S+ I8 a& M__________________________________________________________________________
9 ~) n; E. X2 S; _0 {, J/ F; b2 N( P: c+ h- D8 S( `7 q
Method 10
3 |8 B3 P7 c! ~5 E0 ?=========
& G6 u/ l  t7 N6 s/ n( L. u
8 K/ I& ~8 w" K( f: F- V=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 e* D4 ^; ]6 i  h2 v  SoftICE while the option is enable!!
- {, A% w; N; U" D3 k( J0 H; O
$ h9 ~$ V2 H6 hThis trick is very efficient:
2 p% S' ?8 L8 H0 d9 Pby checking the Debug Registers, you can detect if SoftICE is loaded
3 e% T3 S6 s. r# r# b" v0 L2 m0 O(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( i0 ~# j* }0 l, e
there are some memory breakpoints set (dr0 to dr3) simply by reading their
4 R$ N: N9 C* h/ vvalue (in ring0 only). Values can be manipulated and or changed as well
" h  W# S3 K: ]2 h(clearing BPMs for instance)& d5 _+ q9 U- ?9 M2 X9 j
% g! |% O9 ?) Z
__________________________________________________________________________" \! W8 i! w6 n  A% ^# T. e

! H& V. k; y0 {4 c* NMethod 118 R8 P8 u8 v8 ~  z" ]
=========
- K. m. D9 f$ A$ z
+ e. E" K" I8 o( @- w! X$ jThis method is most known as 'MeltICE' because it has been freely distributed
: I# y4 m3 e) c3 Svia www.winfiles.com. However it was first used by NuMega people to allow; @( K/ n: ^' t) u2 h/ d& x$ P% h) F0 J
Symbol Loader to check if SoftICE was active or not (the code is located7 Q& _6 d* n" Q, E
inside nmtrans.dll).: z4 o" i1 s9 x5 Q0 z
% `% `3 `" I  Y/ M4 N  @! i8 M+ Q; N
The way it works is very simple:+ I) J# j: m* j$ c4 w
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 H4 _1 @0 L9 E3 ]! M# d- q$ m
WinNT) with the CreateFileA API.$ ?& ~# [$ F9 G/ a

) c. ]/ @' T2 }8 m  rHere is a sample (checking for 'SICE'):& a; Y* V4 G9 r* l" {( ?
) m( k, c# f! K6 l
BOOL IsSoftIce95Loaded()
$ R3 p0 h, i/ W5 J' a{) D& ]* _2 y! r: J4 i0 O# i
   HANDLE hFile;  
" f/ S2 P6 E7 {5 ?% g! ?   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( T% E. T) l) N2 I: x* R                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 b0 k* H7 H) e9 P% z. E0 M
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) o9 {5 T, g9 Q  O: a   if( hFile != INVALID_HANDLE_VALUE )7 ]' Z% j8 f2 f9 U' P+ b
   {
$ _/ Y" d/ O/ t5 d9 K, G      CloseHandle(hFile);
+ z& k1 [* I: V+ `' O) v      return TRUE;
2 H2 U4 t2 S4 U( J5 z  N( a  b   }
" U5 ]- K3 n3 e6 Z" k2 Q8 U   return FALSE;
; q: i& T, q: E7 u/ U, z}8 V1 o8 j( i2 O' R' R* X

0 `. b* V: c0 ~" Z5 dAlthough this trick calls the CreateFileA function, don't even expect to be) ]  O/ q% u9 v
able to intercept it by installing a IFS hook: it will not work, no way!
0 t: L* K& h3 U& N1 B( ^In fact, after the call to CreateFileA it will get through VWIN32 0x001F
* K0 d0 x1 ]9 qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 i0 y2 q. d8 h# T1 |" X6 Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 g$ `7 y0 I9 N) k  J: vfield.
% E/ N% G% B0 S5 e6 ^In fact, its purpose is not to load/unload VxDs but only to send a
; H; Q0 [1 G% w  K' o: tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* `2 r& k( X% G0 N) @2 Z; ~' W: |
to the VxD Control_Dispatch proc (how the hell a shareware soft could try8 M+ u' k+ A( b! O' z! K: k' q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
* N$ ~- \, D! l8 k0 HIf the VxD is loaded, it will always clear eax and the Carry flag to allow
7 _0 ~) ]. F' ]! gits handle to be opened and then, will be detected.. O5 e3 ?! p; N. ~  q
You can check that simply by hooking Winice.exe control proc entry point
0 q7 l2 @6 K- |( kwhile running MeltICE./ V$ R5 t  Y7 _1 ~
3 z8 {  {( K/ ~' ~* f6 h

  N3 o- b- S( k  00401067:  push      00402025    ; \\.\SICE& G6 g% |. i9 e0 T0 g
  0040106C:  call      CreateFileA
1 b3 A  k0 c2 ^, ?0 d  J  00401071:  cmp       eax,-001
4 o7 X& X6 o7 t  00401074:  je        00401091$ _5 v2 W( Q# `. I
: }. v+ R( D" _9 M" G7 S

7 |' ]5 E' O2 |3 D1 pThere could be hundreds of BPX you could use to detect this trick.! w" F- f7 j0 N, u3 j
-The most classical one is:! k0 k& ]* }' }2 m0 B; ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& O+ c* M6 o9 z9 M6 k1 r  Z: C3 p    *(esp-&gt;4+4)=='NTIC'
7 D, i2 t. Q. k
' p: _; R6 d, a& Q# }-The most exotic ones (could be very slooooow :-(& M+ _: U4 E5 R
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" B& K" ^( Q& \8 W! R( l0 C     ;will break 3 times :-(
+ l# R  T* r  m/ Q% T! q
$ e$ h' d1 x0 v* a; C- I4 m-or (a bit) faster: 0 }+ ?6 G5 N: v( G
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
0 f0 P0 \2 Y  b0 M8 g) _. x. ~- i) ^, X' p
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, ]8 m; A2 y' b2 N  e( J     ;will break 3 times :-(# i5 g! o; V7 a: s9 M

  M! z0 E. _8 m# m* P7 M-Much faster:
% O4 x$ I" f& p: v# Z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ D' |) r; r: e% i
" \( \+ j/ \) k6 A, y; E" _- s
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
4 @0 z4 t8 k- ]! o* }; u$ Efunction to do the same job:
8 \2 m; l% R5 }/ o, P" g" H# l: ^: ?% J# ~* @0 B! W$ P
   push    00                        ; OF_READ
* ^' T( {- M  B) g) b   mov     eax,[00656634]            ; '\\.\SICE',0( L7 l" p9 Y) F# C( x$ X
   push    eax7 u: w, U" [# u- _
   call    KERNEL32!_lopen
" m* d+ Q, \4 s4 Z7 I; l' `  @+ m  ~! E   inc     eax
. g+ c0 x1 d  q$ \$ ^% q9 j   jnz     00650589                  ; detected
3 I7 n5 |8 S$ O; ?! x, [   push    00                        ; OF_READ
3 k9 q1 K( D. `0 P, f   mov     eax,[00656638]            ; '\\.\SICE'% i. L% U# E, v# _& n5 H1 Q
   push    eax
0 J4 v- \2 r4 Q   call    KERNEL32!_lopen( E$ V/ [: ~" Z& J
   inc     eax
- L. c# P" H6 q$ I   jz      006505ae                  ; not detected
' G2 `1 `1 e' a, D3 H8 m
6 B; f5 V2 W3 `8 |5 H; E% B: Y  A
__________________________________________________________________________* H5 X9 V; Q- L; F

* w4 X9 G8 e2 H) U1 ~% ]& {; l# J6 LMethod 12  Z# O6 f, E' |; V: E' r
=========
, U0 g; E" g  R9 Z
- {+ Z/ U# h: [$ E) ^This trick is similar to int41h/4fh Debugger installation check (code 05
- e; B2 N) \: q5 m5 @&amp; 06) but very limited because it's only available for Win95/98 (not NT)- J4 B$ Y0 n/ {, ^& Y( Z* v6 z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
4 `$ F: v9 b9 l2 L2 E/ \" Z1 G1 M
   push  0000004fh         ; function 4fh  _: a, s$ N/ a# e0 j
   push  002a002ah         ; high word specifies which VxD (VWIN32)* X% M# ?# _! a
                           ; low word specifies which service
8 ~! B# d; v3 W+ O  u  e  U                             (VWIN32_Int41Dispatch)6 `8 P7 A0 W; N, T
   call  Kernel32!ORD_001  ; VxdCall
) o6 }$ |& Y9 b7 }! w   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ s; h; j% ^' H, e6 k  r0 r% `& x   jz    SoftICE_detected
7 U) Z; R. R- A' s/ v- O+ O
7 ?! f* y0 X1 ^* \6 [+ HHere again, several ways to detect it:, s1 x8 x) R: ^0 v

, o; _; r  n% W; S6 D+ e+ u    BPINT 41 if ax==4f
' ?: O  C: C8 r
- Y5 I7 I# {7 K9 Q; @5 ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, `4 N: i) e% a% p* c, i6 V
. m. I$ }! W8 z# e) s4 ~9 ]) G2 ~$ w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 E7 V  m- l9 u) V1 U! y3 v$ }1 {: z5 C+ K" p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!* L; g: `# V; v# T3 Y
3 f. N$ p, h/ q0 M5 ]5 r' ~5 x  M
__________________________________________________________________________/ K; j  S, _, i! w
9 K/ A5 f. N* w2 R2 D
Method 13
9 |" ~7 U) z# \3 W, ^/ G=========% O+ S) ^- P; V+ o1 r8 d9 z- _
' y2 X  h3 b; ~: _: r* L
Not a real method of detection, but a good way to know if SoftICE is
/ h# w) r! S/ H3 p3 finstalled on a computer and to locate its installation directory.
& X+ A: C% u+ Y4 s3 }2 @8 bIt is used by few softs which access the following registry keys (usually #2) :
7 |& [, a* U9 s# H7 v2 N+ V( P$ w7 x) c, A7 h4 P) Y# X* V, }! |3 c
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ Y: k! Z. t5 h% F9 e
\Uninstall\SoftICE
" M+ C" Y+ `  H/ l-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
: Y1 N# ^" k4 r* r+ ~( U0 L2 ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 U, v) s6 V' a# U1 a6 l- p* U
\App Paths\Loader32.Exe
9 h) ~% B, \# N3 G! R8 L8 k6 c& \' `4 }6 t" B; B& \
/ B, K' |: e; M& G
Note that some nasty apps could then erase all files from SoftICE directory
7 m) P9 }: `. F7 x: j  R0 y8 b, e(I faced that once :-(  g3 B$ L: Q' G3 X7 H0 ^5 o3 [4 B

$ m. Q% _; A1 V2 u6 E  d6 gUseful breakpoint to detect it:7 C3 M4 c, p; f
8 r- S; o, I, \
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ H* K5 Q4 {+ r' C7 a! E9 c2 n0 ]  E

9 U; m  c( t( F/ h) @# m__________________________________________________________________________
4 H" j* W1 T! Y6 l/ ~! y0 z6 b# y1 N0 `

" k% k  r4 n# y. {# rMethod 14 4 J' X( R: A$ G4 L% O
=========
( ?8 S2 x# v3 z5 i( U& t$ y$ B" i0 r3 _3 I& W2 ~9 i) [' M: k
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: E, d; e. d5 L: W& K5 g6 gis to determines whether a debugger is running on your system (ring0 only).
! |! Q* @, {. D/ }3 i. f4 F
. D6 `+ Y1 a- V* c; S   VMMCall Test_Debug_Installed
, `7 n8 C4 q* y- E   je      not_installed
; u& J2 c$ o: r" R2 [4 Z5 s$ C# c' _" y9 J
This service just checks a flag.8 g/ A3 z! y& @  @" }
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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