找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& J' @! @4 ]- W<TBODY>- k$ E" S& v9 H' p
<TR># M0 F! g9 H3 D+ j) s( }' [
<TD><PRE>Method 01   a1 s& S2 R. ^1 T) C
=========
8 p% Z( Z8 a/ S- b0 U$ c! ^$ U5 s% [0 {" ~# n' d. f
This method of detection of SoftICE (as well as the following one) is
# m" \' a( A" h$ Sused by the majority of packers/encryptors found on Internet." U, b$ j/ f* Q' E1 t
It seeks the signature of BoundsChecker in SoftICE
. r+ N3 k4 b! F6 G: h& D; o1 i7 N; P- r% T: Z/ s- J
    mov     ebp, 04243484Bh        ; 'BCHK'7 \* k( v' D9 F
    mov     ax, 04h
8 g  x0 v0 @: \    int     3       * L, U) C- Z, l4 `  M  w
    cmp     al,4
! a$ ]# `+ Z' M+ Y$ a% j    jnz     SoftICE_Detected* t9 }  Q% z  c2 F- H8 v
4 o- A, O- ^, a6 X
___________________________________________________________________________
: t( \% L* ?9 T/ K) r* g) t- `" L4 X$ e( J6 L! q+ b+ K$ h
Method 02
; I  |( Q3 `. t0 a=========
0 |1 t; z( I4 g. s) D. M2 Q" M. S* B. o3 }% L0 ~' k6 B" _! `
Still a method very much used (perhaps the most frequent one).  It is used, k  Y7 D/ T7 s* |
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 ?9 f9 m; F$ Dor execute SoftICE commands...+ R, ]1 F, }& a3 y$ v( V& L: r; S
It is also used to crash SoftICE and to force it to execute any commands' B, T" D, `# [* T" z# B
(HBOOT...) :-((  # s$ A, K% @0 p8 @1 b7 x8 }

2 M+ s* P0 i, p( v4 xHere is a quick description:
) z$ A9 n4 b0 R# {7 @-AX = 0910h   (Display string in SIce windows)
( q+ q, j# I0 _. n' m) J3 o& l" ^-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 i* e, [3 P; L. P-AX = 0912h   (Get breakpoint infos)! G& }  t& ?/ H4 l  d
-AX = 0913h   (Set Sice breakpoints)
' d* Z" ]* ^- Q& Y: _; c/ T' h-AX = 0914h   (Remove SIce breakoints)
2 G$ I# F- ]( w
% A3 l# U: {/ |Each time you'll meet this trick, you'll see:
6 b# c0 E$ u6 A  ~-SI = 4647h# L1 _5 l4 R: j$ H
-DI = 4A4Dh+ a8 m+ W# c7 O, F
Which are the 'magic values' used by SoftIce.
- l& l, {: N5 y+ {5 @& j, XFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
8 t8 b, W& b& c& G' k) [1 P; I" ~8 x- S, x
Here is one example from the file "Haspinst.exe" which is the dongle HASP
3 j% \& m: l" [1 rEnvelope utility use to protect DOS applications:. x1 W0 }0 Q3 }0 O( G" \5 L
' T' _! q" X; v
  D! ^" P6 ]9 i
4C19:0095   MOV    AX,0911  ; execute command.
) }+ t0 p. z( A4 G9 K* J9 g, F1 F4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: P) K! x$ M: O, [* k( L* [
4C19:009A   MOV    SI,4647  ; 1st magic value.
! A* \" ^  e( N% a# S: @+ `4C19:009D   MOV    DI,4A4D  ; 2nd magic value.+ V5 @1 o+ o; J5 K
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)$ M- h4 v3 F; N, }
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 @. L* y/ s2 E/ y
4C19:00A4   INC    CX; L, e8 i! a! |* C! ^
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! L) A$ v: }1 s/ W! ^( e' [# m4C19:00A8   JB     0095     ; 6 different commands.# H( m1 L/ h5 h5 l5 _
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 C! S3 X. G! n7 a+ R" z& l
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 q' K0 b4 n1 R/ i' u: P2 I: K3 ?7 r/ a" s% Z3 i
The program will execute 6 different SIce commands located at ds:dx, which
; Z6 s' j1 v, p. ?6 zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ C, ~% _  x& d* c

% y& e: E" A' Z* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
# V% e/ E$ |1 L; I3 }- a___________________________________________________________________________; K$ x# f) z& x- l/ }
& H% B+ E! Y  T+ Y$ g# J
+ i+ k! C0 E- F* z1 q# V
Method 03  N/ R$ c5 \. e1 s9 T
=========
  ^' U; ?; E$ M3 U: W* ~; v7 `3 o, _: `: C3 W' t( B7 G0 ?) P
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 I7 |* q( O4 A, P* [2 ~) J1 ]2 ](API Get entry point)# r# \) q" x. s0 }$ f4 O
        
- B6 J* c' `+ i2 j
4 N: j* {4 ?$ j6 S    xor     di,di
; F0 _. N7 E3 f4 x) U    mov     es,di2 i) D; P! g9 G+ ^
    mov     ax, 1684h       % U+ p- }" u5 i, o' Q
    mov     bx, 0202h       ; VxD ID of winice
' j7 i9 D1 s$ @% n    int     2Fh$ E7 N4 O- {; P: u$ C0 a4 g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. p6 b6 R, [* f* A1 X& S
    add     ax, di
" `/ c! W$ V: \2 C% N7 K2 C% b    test    ax,ax; A! x* T0 M% j! g$ ?- F+ j" p& o
    jnz     SoftICE_Detected
* B  }! N. T, T8 L$ q
9 C3 [7 Z: M. L1 k: K___________________________________________________________________________
% X! Z; H$ c' c  H$ P& u. j, n5 h/ \8 p$ F
Method 04
. H+ c6 p9 k# P  l/ w: M=========/ A& s! t, x( S& g3 a' H; \
- m. ?- W4 Y9 m9 t+ I9 ~% T+ P
Method identical to the preceding one except that it seeks the ID of SoftICE& \2 C1 C0 Q7 M+ C
GFX VxD." v9 y1 k- U) G8 f+ N' y2 e! f- J; a
+ B* O: }2 c9 [& K" y$ Y
    xor     di,di8 L# z5 L/ E( h  f) I& L# @3 J& L1 @
    mov     es,di6 ~. Q/ C& r# r2 a  z3 d. b4 Z  f
    mov     ax, 1684h      
, R) y: \" k7 m) i    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ E' `2 k2 b; A
    int     2fh
! i3 I; r1 M8 k  e5 E9 C$ ]. l! ?. k    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ ?7 R5 F. ]# T/ E* h    add     ax, di5 R9 e/ J8 w# n0 Z7 x$ m1 }( ]
    test    ax,ax
: @" d) x: P& r: Z    jnz     SoftICE_Detected* Z/ e( r3 G" _

$ _, [1 @+ O- w2 m__________________________________________________________________________
; g3 [2 R5 Q) l. I5 X% u8 n) }
9 y6 q$ F# w/ _- t2 y9 i
+ [3 r' c- a+ o$ u( _3 i& `% j2 gMethod 05
' m9 r, V- x7 r2 q  E* |=========( P8 E) p  V. ]& @; Y; ~$ f# v9 [

: c; s& X2 A1 q- cMethod seeking the 'magic number' 0F386h returned (in ax) by all system$ L3 a0 X) Q" `0 X1 X, a! x
debugger. It calls the int 41h, function 4Fh.
/ a+ ^6 E. O: B+ oThere are several alternatives.  
- F: ~2 l* E- Q2 `7 p% ^
) _+ G6 M, o& I( C( H, z4 B2 W6 KThe following one is the simplest:
: }+ r! Q$ e4 ^; r+ X
% x* W) i% D1 c$ t6 P+ r6 o& r* q    mov     ax,4fh
: _7 x' M- z: K5 G8 V. y" ]    int     41h9 C7 G; j( @+ P2 v
    cmp     ax, 0F386
* f. s9 U2 P: k    jz      SoftICE_detected) l4 |* x) r: S+ {/ s9 I

# ]$ K- I& B( H; W/ e* d* S6 O2 ?% Z1 r  x2 [
Next method as well as the following one are 2 examples from Stone's
' o4 X6 U! k7 U$ r# |" X) e"stn-wid.zip" (www.cracking.net):! {$ d: x, d% t+ r4 h- i0 s( E
7 ^3 G2 t" C1 z1 c& p' {. e
    mov     bx, cs
; E% x4 N' i$ @- g# _$ b4 V    lea     dx, int41handler2
6 F# I8 J( C* m    xchg    dx, es:[41h*4]
* x- J' d4 \& ?2 n  B' R    xchg    bx, es:[41h*4+2]/ W5 g* z6 q; B' Z
    mov     ax,4fh
0 R1 o2 x! A. ]3 i    int     41h. p1 m; a8 q( r6 a
    xchg    dx, es:[41h*4]7 Z! o2 I/ r( n! n7 {6 Y5 K8 J
    xchg    bx, es:[41h*4+2]
4 ]# l3 l+ B# L: ^0 X* ~    cmp     ax, 0f386h& g& n, _- i. }/ m
    jz      SoftICE_detected1 M/ u' B0 }! U

7 A% |. t( z. p8 l* I: gint41handler2 PROC& X/ Q5 Q8 w$ x, L: O9 v0 A5 z
    iret
6 U  f( }% {& D4 }/ k: U9 Jint41handler2 ENDP
9 ]) h/ ~% i0 ]" ^9 s
8 Z5 p: D8 ]  }
: l8 _8 z, r6 F5 ~8 J( J2 @4 n_________________________________________________________________________- n: h/ r& V) L9 j+ G0 N7 h
& Z: p" \, e  ^9 p* [8 }5 {
( l& ?2 \  X9 c( v# ^" n
Method 064 }& {* p" n/ l1 `- @9 t
=========
7 I5 C7 Q/ ~4 y* e1 p
; D6 h- A7 D2 a' H# v
/ l, t$ G3 Z, t2 u1 [/ Y0 X2nd method similar to the preceding one but more difficult to detect:: k$ [, h  F9 s/ J# |
# M, n1 J) h, T4 M% N* g. f

  d! M4 z7 ^- Fint41handler PROC0 R% d5 V, S. W7 V8 N) ?
    mov     cl,al4 q6 V- [, g' N1 v- K
    iret/ J7 `) |" [: j9 x' g" v: }* q
int41handler ENDP; M4 @9 s+ C$ o3 w  o7 [4 }( A
6 k3 ~& h& M, a3 b! i% e+ L2 u4 n

: k/ t/ D% L% @* N' K    xor     ax,ax- k7 K3 d& ^% `4 y- }
    mov     es,ax. G; t7 d9 u4 l9 i0 V. Z( j$ [0 j, W
    mov     bx, cs  s8 [& F- U2 t' u& \5 r; c
    lea     dx, int41handler
" x2 ~0 U& x& ^6 I; o3 X: x. m    xchg    dx, es:[41h*4]3 |( S) y3 B$ |! h) _+ v
    xchg    bx, es:[41h*4+2]
. Q8 N3 ?+ z- n    in      al, 40h
: I% B. |2 k' i9 ?5 i    xor     cx,cx
; a! l' f: ~6 E# Q: n    int     41h
; R) O7 S0 \) c9 l$ U9 K    xchg    dx, es:[41h*4]
6 I& X- N" ~& k  i) k& n% P' n2 L    xchg    bx, es:[41h*4+2]
) _5 }. s9 c- G, ~& t  ^* N    cmp     cl,al3 M# D+ N: s2 u" L% L$ }
    jnz     SoftICE_detected; Q  _. O" ]  V) ^
7 p4 _! o# r' Q9 R8 J
_________________________________________________________________________! ]7 l% O# i& F: z. v, i

6 z! `$ E2 X3 g1 mMethod 07
( G! n9 E4 N8 w' ?) }* _4 y=========2 b. ~% c+ V2 z, O4 H# n
$ n( x6 h2 H8 t/ F$ J- q
Method of detection of the WinICE handler in the int68h (V86)' r9 |7 H/ W2 X5 M" E7 Z! h1 e

5 f) d7 E& @' z1 R, s    mov     ah,43h
% h& O8 G1 c3 {& R    int     68h# s- v; E7 N  z: C" j& F) {
    cmp     ax,0F386h
7 W9 C. N. k; V" e, {9 n. @9 Y    jz      SoftICE_Detected
" ^- \  V6 ^8 }% N0 u/ r5 o8 s' S( h4 s5 _4 r
1 l- ?1 Z+ ~5 O8 h5 J  |7 }! _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 Q) H: d" b# I- b3 q5 W
   app like this:
3 \( R2 F5 ^/ u" y/ a, S6 j3 v% W) ?: ]2 C; w6 X
   BPX exec_int if ax==68
1 `: A7 k7 _5 z% N2 s5 S  j   (function called is located at byte ptr [ebp+1Dh] and client eip is; ~% c! }2 c1 l5 @7 P- t
   located at [ebp+48h] for 32Bit apps)
1 T* t* m1 P! L8 H( ~__________________________________________________________________________# r$ n, k* y/ H
4 c8 W) y, }0 p

; [& }; i, q; ]1 nMethod 08) i7 r! M) u* S1 \3 R0 O
=========
# Y5 c$ M" I8 F3 D  T1 r, v) a6 Q: y6 _/ @6 @
It is not a method of detection of SoftICE but a possibility to crash the- y% o5 w1 s* E. |/ F. X
system by intercepting int 01h and int 03h and redirecting them to another
% O6 t" i: n+ G! D0 L1 k, R2 w" Xroutine.' @: M" ^0 _5 d, `6 o9 v
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
3 D2 h( t1 a6 J& n; Q, Bto the new routine to execute (hangs computer...)8 ]& s- W$ y( A5 r; W$ D. S
" I" T6 m) C* `; b; [5 }: k
    mov     ah, 25h3 s0 ?9 x% g, a  q" d9 y3 r! S
    mov     al, Int_Number (01h or 03h)+ T2 R9 B$ K- k4 L% z
    mov     dx, offset New_Int_Routine* ?$ ]" v) `/ }7 i" v! g. Z
    int     21h  t% \1 A; h( D. W

+ m1 G2 |1 |# C' j' \__________________________________________________________________________
8 x) G5 e& ^% ^% U4 V8 M; _1 d' N# c* i0 w! p2 B
Method 09
- ?8 l3 q; j5 V- a0 Z/ [=========
8 j+ v9 [4 V) f( _+ H
4 I& B$ ^) [' K2 RThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) z9 ?; r6 D- R& J; X7 R
performed in ring0 (VxD or a ring3 app using the VxdCall).
9 `0 `  ^1 V! w$ ~8 r0 A& y  z0 |) jThe Get_DDB service is used to determine whether or not a VxD is installed- g7 M3 X4 }0 e' ?1 ^6 p, Z3 j
for the specified device and returns a Device Description Block (in ecx) for
, s/ R; e1 p* }4 H) `that device if it is installed.' S, x" z' e0 Q! v* Y, |* J
; v7 o. _3 \/ Q# |
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 ~+ x1 Z4 }7 [: ]6 U   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
$ E5 N4 |' r, }   VMMCall Get_DDB
/ m/ @& }5 G$ T( K- H9 W7 @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ p$ @! ?/ L# H/ Y9 F8 ?* o
- S+ Z: w8 Y+ z4 eNote as well that you can easily detect this method with SoftICE:) J8 q) w$ I6 A  G* Q; k- v
   bpx Get_DDB if ax==0202 || ax==7a5fh- ?3 d4 F/ o; i, x5 Q7 w

$ L2 p0 l  S, z/ B2 ~__________________________________________________________________________
& g9 [" w: E8 i1 ^  S4 Q2 g! h1 L
3 a; ^( m8 Q( \+ @3 e$ pMethod 10
, ?% ^" i+ d- o0 @# j" s9 ]=========
( O% b$ y" B: _0 e7 |' T2 A/ C6 U0 `1 Q& [' Z
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. L+ j) A+ W# I  SoftICE while the option is enable!!5 R' v( E  V  {& C
1 _5 R' m- k, z+ `& a( P/ m
This trick is very efficient:
  p9 b0 c3 F4 `& m/ ]7 [  u7 lby checking the Debug Registers, you can detect if SoftICE is loaded
7 q6 i- }$ _% R, I7 c/ t) D3 ~' g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 O  D& W1 ]/ a5 I0 h
there are some memory breakpoints set (dr0 to dr3) simply by reading their- d% d0 N/ f0 d6 Y( [. n
value (in ring0 only). Values can be manipulated and or changed as well1 [6 b# p0 l1 E& @% C* h0 B
(clearing BPMs for instance)* n- F% X& S: l
0 ?& z- l2 O) m3 J
__________________________________________________________________________, ~/ @1 y7 s4 t9 Y1 B: d6 r
6 |3 J! w. n1 r4 s- R  P( u
Method 118 c! }: k/ C" A/ v
=========
+ V8 l6 t9 Q( O5 u2 {5 m
5 ^  K2 Y: J7 H5 F, ZThis method is most known as 'MeltICE' because it has been freely distributed
- h: h% ~  w+ O6 mvia www.winfiles.com. However it was first used by NuMega people to allow
" j. V$ }" r" t0 \) S6 uSymbol Loader to check if SoftICE was active or not (the code is located4 U- G9 l& N  l: u& C
inside nmtrans.dll).
$ L' e+ E5 }8 D3 t& T% n
9 S. j7 [: y8 z: \' h9 pThe way it works is very simple:0 ^1 f7 {% U7 Z! V/ ^( x' p
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" C6 M. I+ {8 x( y( f9 S5 z" v
WinNT) with the CreateFileA API.1 g. s6 S% \* c" Y& x

6 k% e* o/ Y4 _; T0 z( yHere is a sample (checking for 'SICE'):" b. @6 f# W3 q0 V7 G/ D
& p& ]4 m9 P* _$ Y* g% O% m/ R) T
BOOL IsSoftIce95Loaded()3 c9 e! a" ?: i4 d; H
{
1 Z2 Z0 m: d( J( G% c2 H   HANDLE hFile;  
( Q4 h$ A3 L: T   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ B6 s7 Q- C7 Q/ P! J                      FILE_SHARE_READ | FILE_SHARE_WRITE,
7 N2 P7 x( ~- X0 h( d9 s                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; b+ F" e) P( g2 _   if( hFile != INVALID_HANDLE_VALUE )+ R) t/ g$ o5 U; ]: W" c
   {
+ D6 g1 O3 o& Z# k      CloseHandle(hFile);5 t! N. b, Y" s0 {$ `
      return TRUE;8 q+ ^( x. n8 U7 ^" l
   }. Y) h# y- ~! [8 F2 O
   return FALSE;6 x5 h" N- S' j
}
4 g5 q! C) x9 g/ I& B- i5 f1 X, W4 {' T" w7 A. x5 e; o8 ?3 }
Although this trick calls the CreateFileA function, don't even expect to be
% |2 o( |$ i: |7 J$ Vable to intercept it by installing a IFS hook: it will not work, no way!. G; T. m* s) G; R
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 o/ l% A! C' u' G' d, `* c4 _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 b4 K" x8 _! \/ F& E7 K' F
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" N% B/ w. N9 e+ p8 _2 r1 E9 m8 ~field.) F0 {9 @: c0 n1 S
In fact, its purpose is not to load/unload VxDs but only to send a
! x! n; B* B* b# R8 FW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 b" b/ {0 `: X7 Z8 Y4 Wto the VxD Control_Dispatch proc (how the hell a shareware soft could try$ x% t! D* x. k9 g& M
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 r, t- M0 o0 K% FIf the VxD is loaded, it will always clear eax and the Carry flag to allow3 j7 e% O7 W' x+ T/ Y* r8 f! ?) a
its handle to be opened and then, will be detected.2 k" D2 r. N" [/ R
You can check that simply by hooking Winice.exe control proc entry point
. H& K. o& l4 \* Kwhile running MeltICE.: ~6 X6 U8 u' N  J

0 d, u' M# ?$ p2 a) g: M) d6 l( c& i* D* x, \7 ^
  00401067:  push      00402025    ; \\.\SICE& u4 e6 {4 B& J) t8 Z# i  ?
  0040106C:  call      CreateFileA
0 Z3 ^* o! A( E3 ^; z3 x2 N' M  00401071:  cmp       eax,-001* e0 v) v, ?+ w! i5 Y5 @
  00401074:  je        00401091
+ n  U( w/ c* T3 g
3 O5 N2 O# s/ K
' h7 R* ~- |. \- T: Z6 X! RThere could be hundreds of BPX you could use to detect this trick.& J$ L  N- u7 ~0 Z
-The most classical one is:, O/ }* M" t# Y2 R. P/ I/ c
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 [. o6 ?' w$ ]7 _; _
    *(esp-&gt;4+4)=='NTIC'
$ z' E& p+ S' S, I, @# v( `
4 |6 ~" f: H) F  f8 v8 ^-The most exotic ones (could be very slooooow :-(
, v9 Q$ Y1 ?8 s  s   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - z' E3 |! j( C: c. }. x
     ;will break 3 times :-($ c7 S7 y5 W% }6 i) X# m

2 d: r3 z. C# `; q3 ~-or (a bit) faster:
% H& b1 I) R8 s3 d- N  T+ V( ]   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" f, L+ K, u  L. X4 ~  g% U% \
2 |2 k( W6 R- r# ?8 A' h
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 W; R" ?% T1 b+ s9 X/ \0 w, s
     ;will break 3 times :-(* r" Z+ ~' B# f/ V
8 P, c: D) `! Q! T( t
-Much faster:" |0 {# m. s5 a
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 n! b2 j2 b8 }! ^

: x9 H* F7 Z& @' @Note also that some programs (like AZPR3.00) use de old 16-bit _lopen, M  b8 O2 H! H  V2 \( v, y
function to do the same job:
3 s( A' n- v. f' @3 v. Y7 S4 A! d$ N
   push    00                        ; OF_READ  n5 X( J+ w6 F# `4 [0 e5 L4 \1 l7 P
   mov     eax,[00656634]            ; '\\.\SICE',0
' s' T; K7 m' l$ h7 D; E+ ?/ r: R   push    eax3 I! ]" T9 U, c$ A
   call    KERNEL32!_lopen
1 d% R6 |- b9 L# c" }) i& x: o   inc     eax
. U& e3 Z; }1 G9 g) D7 v   jnz     00650589                  ; detected' Q/ t, a% s' g( c( e  y) j
   push    00                        ; OF_READ1 X0 K# f% W$ m9 I8 I: t. w) w& R
   mov     eax,[00656638]            ; '\\.\SICE'3 ?5 Y3 s+ W3 A  s3 [% G% p
   push    eax6 K# b, a, l' {* U5 L5 ]5 S
   call    KERNEL32!_lopen
4 k* @* K# e' t5 A& @* w% \   inc     eax, N  r2 D( c# {4 x3 `* v2 M
   jz      006505ae                  ; not detected
* W1 M; u: d0 e1 P1 O$ F; x4 O7 r1 n" D2 X$ S4 F
3 a( D% x4 R# B8 g  U# _9 ~
__________________________________________________________________________
/ _+ d6 U7 [, ~
: W! _" L  Z. \4 z! [Method 12
; D& i" P8 X/ t3 l=========7 s- G# k% h6 z  L  z0 |; [$ b# w
. O/ M! \: p3 K8 c
This trick is similar to int41h/4fh Debugger installation check (code 050 M& m6 `: [, \' d, U. u/ z" }6 @
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- ^1 w2 u2 g0 Xas it uses the VxDCall backdoor. This detection was found in Bleem Demo.) f, p6 H  G2 J3 i8 H
3 g7 d* E  M) h5 W. U
   push  0000004fh         ; function 4fh
& f- p8 w! ^) c* {# v: @   push  002a002ah         ; high word specifies which VxD (VWIN32)
: U) |# q5 K1 E  h                           ; low word specifies which service# E& }1 K  A6 f; @8 d
                             (VWIN32_Int41Dispatch)
$ e( n( D: Q" m   call  Kernel32!ORD_001  ; VxdCall
" y) U: Z- e, k6 Z0 M   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 l  u- o+ i, p$ r/ ~0 k3 V0 z   jz    SoftICE_detected
4 a3 m. h/ _' i: [
% Z: x- V+ T+ m. WHere again, several ways to detect it:
2 H9 g. d3 J, @  Q6 S
7 A! U* G% j, }% _0 {    BPINT 41 if ax==4f8 E( e% w& ^7 T2 y
/ u: E3 h- J/ g7 Z! x5 k
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) _7 l8 _* Y" i7 C8 c' t
- b0 X' C* E9 d' c    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 J) e8 Y6 `. x8 n
& C6 u+ [2 l2 }( Y( A7 X
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 m6 D6 k5 D/ e* @* _$ d

2 S( e5 M6 D, T& p( M__________________________________________________________________________
; I& N# n% E3 {' r+ Z: U. `% h" f1 y0 q. U6 ]. v. W2 Y4 l
Method 137 \0 K/ z# I0 S# K) t
=========) n2 j  n( C8 L+ p& O& _0 o$ V

" \6 o/ ^7 y. `2 XNot a real method of detection, but a good way to know if SoftICE is
$ f# R+ s9 ^  e4 W) K( }) ]installed on a computer and to locate its installation directory.) o& ?, S* X9 V1 y2 u- ]
It is used by few softs which access the following registry keys (usually #2) :
6 B( c3 ]! S( d7 |( f5 |7 z) N) V2 h- \5 O$ U6 |0 D0 h
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' o4 G8 t: w0 E' D$ ^/ c
\Uninstall\SoftICE# `: [; N; g; G
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% H) ?, c# a7 U: K1 s
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 Z" ]) s  S& x  @. m$ f/ m
\App Paths\Loader32.Exe. K1 b/ j" B# H" I
5 W  o8 D+ v' e, n- u& T+ |
4 d5 q9 O1 _; I7 l/ V. C
Note that some nasty apps could then erase all files from SoftICE directory
: w1 h) z! i% J9 s, p(I faced that once :-(8 U7 r: n9 M$ k4 Q& ]) z8 Y9 l. d

; U& _3 z1 e( m" M- U4 oUseful breakpoint to detect it:
4 R# |6 p( x8 [# K/ }) L) E- J+ x; ?% F6 R
0 _" B! |* l0 D# C4 q  d1 A/ o     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 o9 f$ T; g! Z6 X6 c$ C3 ]5 [3 f. m1 b# y6 Z0 x
__________________________________________________________________________
/ T" }5 m% |" v6 _# @) [
- r( h' G: W6 o9 Y- \
; E! D5 P, y: `* ]+ e7 FMethod 14
( M5 H+ s- L. w0 {=========2 a% W' U; s3 V- }" V+ B& M  H8 r

; C7 |8 K! j& ~* U: YA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ x  k, D  R! D. P$ U3 F) P' Mis to determines whether a debugger is running on your system (ring0 only).6 W0 _! d& t/ ~3 w8 K9 g% x, s5 R

- K' _/ W2 y8 Y7 F; s% }9 a, K   VMMCall Test_Debug_Installed7 f& Z, F! ]+ c# }( g) }; ^6 ]
   je      not_installed, q/ S$ z' s; ~

# f- E/ v) Q, K0 y' mThis service just checks a flag.# U- t: b1 c# i# M
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-16 05:28

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表