找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 K0 N# J6 E7 q
<TBODY>- I8 ~1 y& N4 p" z+ i* f) n
<TR>$ _9 R1 R0 m: ?* k
<TD><PRE>Method 01
; l% \- D5 y* `=========1 t8 M, k3 @2 q9 n( M

& H( \9 B/ S) zThis method of detection of SoftICE (as well as the following one) is
% l4 n8 D4 e* M( B; H# ^used by the majority of packers/encryptors found on Internet.8 U- R4 K/ \9 H' R2 A& q
It seeks the signature of BoundsChecker in SoftICE  [7 L# H/ S' e& z7 L0 J$ H4 l
- Y! c' @/ ^" N6 Q5 Z/ Z% y5 Z: S
    mov     ebp, 04243484Bh        ; 'BCHK'
* u" Y$ C9 U6 f    mov     ax, 04h
/ |; Y- c* I# A( t  D5 W- I    int     3      
/ W! t* Y: r8 s* L* e9 v    cmp     al,4
. P& p% @4 @5 m    jnz     SoftICE_Detected+ s4 b. s% l) v- i+ S# g: ]/ a
9 B7 ], H/ O2 V% W1 S6 v  A1 N
___________________________________________________________________________
- E) H3 `8 a% x+ s: q# q( C
1 j% a- D# k4 k+ o! o0 j. ^/ HMethod 02* A9 L- j! N0 V: j
=========
) @9 @8 n7 U/ X; q3 r& P5 G$ u* v
3 V/ @, B; r1 R9 Q5 v7 e7 dStill a method very much used (perhaps the most frequent one).  It is used% r: P6 I# u5 j+ l* h) W2 N1 J
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 G, H: V# T3 M& U% \6 for execute SoftICE commands...6 f- [% p* _6 s8 v, p
It is also used to crash SoftICE and to force it to execute any commands2 s7 Q0 m4 c( e1 m3 Z; J
(HBOOT...) :-((  
4 G6 D0 a0 h- d" i% f
5 t+ j- \# G2 }Here is a quick description:
/ v9 y) L1 o, K- q' V; b. m-AX = 0910h   (Display string in SIce windows)/ `2 A, V* k" ^& H0 B; {# Z
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" r8 L* \+ C6 M3 @! L
-AX = 0912h   (Get breakpoint infos)8 \# |2 m# l  m$ w# _
-AX = 0913h   (Set Sice breakpoints)
2 t1 g3 _+ d3 \8 I-AX = 0914h   (Remove SIce breakoints)
0 i8 }2 x: K/ M. a) {; {
, V9 ?4 j9 b! B  x% f2 c7 ~Each time you'll meet this trick, you'll see:
3 Z2 r% C2 l& d, y7 I-SI = 4647h
: V' b; W" E6 q9 N-DI = 4A4Dh
/ P  {+ _, Y6 n* p, C; M) p9 H2 `4 {Which are the 'magic values' used by SoftIce.
( c& L. X! {" O: wFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# e7 |8 ^8 J4 O( U& n$ H+ Q' P
, @' o1 {( A+ u2 w/ _Here is one example from the file "Haspinst.exe" which is the dongle HASP" d) p# [; V! M0 N6 j6 B% ?
Envelope utility use to protect DOS applications:$ S7 |6 @4 c% c& c0 W+ [; L
; b% f  o: y9 b' [1 X/ L8 c

3 |. l3 ~  h! q, p! D1 B$ g0 t4C19:0095   MOV    AX,0911  ; execute command.0 c$ B( H! Z! v( @1 [8 c
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 ?, O; z3 K% i8 h) I+ _4C19:009A   MOV    SI,4647  ; 1st magic value.+ E; @7 s- n2 Q/ p- g; c5 n
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.* u6 o2 n9 L$ E# ~& j
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& F! Z, |* j% N
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# P0 X# E  {. k( R# O: ^6 D4C19:00A4   INC    CX
: F% b# @9 z; B4 H$ u4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# ]  L+ H1 H* V' S8 v6 ^4C19:00A8   JB     0095     ; 6 different commands.
( y$ [. w4 u- R) D4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- V7 N% V& B9 f0 J- {" O
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 E' w6 R0 v) @: N; y' X# `1 W9 B7 |; Z: e/ x
The program will execute 6 different SIce commands located at ds:dx, which
$ V' s: f% P/ d+ B8 j# ~0 h  nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% x' }- c5 p9 Z
: h; b/ u$ h% \1 ~9 J
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' j/ G! C+ Y& ]- |, B/ a
___________________________________________________________________________" Q" G( T' f( l6 j8 B4 o

& q3 A* ?/ D- S$ R, H! m3 I( _8 U/ S) D
Method 03
3 V; {/ E" |$ r4 D& w  S, F/ k=========0 D. i: j# R9 a4 }

( G/ t9 a- E6 g3 @, B  hLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h7 x# f1 i! U! v+ ?# e
(API Get entry point)
/ P2 m( P9 j; t, i9 _5 D        
/ ~1 x0 H6 N6 \/ K$ G8 k% ^/ f' q) S* z' i  T; t8 p
    xor     di,di! }$ @- A% Z( X
    mov     es,di
: l1 b6 s* [9 M    mov     ax, 1684h       5 x- v" ~; ?4 |- Y1 U6 S% g1 k
    mov     bx, 0202h       ; VxD ID of winice
5 o' Q+ G  p7 H! L- P' g    int     2Fh' i) T, _7 K& E1 V' B& t
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 C1 m7 X8 g  V9 s( v$ t) c    add     ax, di& s; f+ \% U2 f6 h5 N
    test    ax,ax) B1 _; @, ^. x
    jnz     SoftICE_Detected: C4 ^- m8 M4 s- O

3 W* s! ]3 H3 x& I! V___________________________________________________________________________5 E/ C& b0 C" {! y/ ]
% U- T3 T; G6 z+ {: @
Method 04
, I6 i+ f+ l6 K: w3 r, ?=========: q* g4 U: D* ~6 W) M# e
9 \8 q% o9 p9 B2 K* X0 o) o" b
Method identical to the preceding one except that it seeks the ID of SoftICE+ ~8 i, N3 V% q, t7 ]
GFX VxD.
. T% O$ F4 N3 s
" }$ |& _" P% d3 F( h' {    xor     di,di7 H" w- H0 i& Y0 n
    mov     es,di
- w0 j: N7 }* u& w) a    mov     ax, 1684h      
# A9 a7 J* e1 S8 F: f    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 A2 L" r7 I/ H5 r; x( B& B    int     2fh7 ?6 ^. ?6 b( V0 \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" k6 n+ I- C/ b4 [5 H4 v* \
    add     ax, di, I" I4 l2 I8 P. K7 \3 S0 L
    test    ax,ax
; I7 {# _% @( I$ g    jnz     SoftICE_Detected
! y; H9 p; [( ~* z
* U, [, F7 q( m. E0 \+ W2 N__________________________________________________________________________
0 \% h" C) P& N# f& Z" r" z5 |( b, l7 I4 u0 x( n/ m+ c# |) g

7 t; F: O2 k+ `+ o6 HMethod 050 l" e5 G% q  {& ?  c$ [
=========4 s* b# L" ?' \7 `
/ r4 F9 \! t% [7 A4 R& j* I
Method seeking the 'magic number' 0F386h returned (in ax) by all system
# V# k# m9 o8 w6 R' {& ndebugger. It calls the int 41h, function 4Fh.: V5 w9 C" `) E4 ?" E: _
There are several alternatives.  9 K" y% j; B. s  i4 _2 I  O$ }

7 w7 q/ o7 A2 r  g" v& UThe following one is the simplest:  P: }3 I  W  N6 x  G0 ^/ l3 I
' v1 x! ]  |. P& z& s
    mov     ax,4fh$ N( a: {0 G( Z+ {; [- c3 C
    int     41h
! x0 Y2 ^7 C- Z/ [% M    cmp     ax, 0F386
% H( B5 |7 N2 G) ]: i( B8 f    jz      SoftICE_detected
( I, G$ w8 }) e, H0 M" w/ q$ |6 N

2 n2 I- W% s, C  WNext method as well as the following one are 2 examples from Stone's
: [8 n! F+ Y& E5 R/ W  C"stn-wid.zip" (www.cracking.net):+ u0 y$ D* y3 C$ W

+ E0 X6 p6 a3 K2 v! ~+ }: ~    mov     bx, cs3 j& z  ~+ k' n
    lea     dx, int41handler2+ u9 l3 g, W! _$ }% l! x
    xchg    dx, es:[41h*4]$ Q$ n. A/ P% ]0 \
    xchg    bx, es:[41h*4+2]7 h; `3 \: K( u" E2 x* I
    mov     ax,4fh! K& i/ X2 l; b+ u# [6 s  Z" G7 |
    int     41h
# ^' w$ t- M5 `    xchg    dx, es:[41h*4]
( x; _  ?: T& p: z    xchg    bx, es:[41h*4+2]' I/ d; h- Q' S3 U" `
    cmp     ax, 0f386h9 o' ~2 M: O$ J
    jz      SoftICE_detected  A9 p+ g9 |$ t7 |6 R+ Z4 n' q

9 j$ `% M7 m9 J$ h5 Kint41handler2 PROC7 }/ i3 P0 V/ R  v6 C
    iret
3 Z  o9 g  X$ N- [% ^* nint41handler2 ENDP0 v) b0 k$ E9 X2 v0 v
: h' r! A# H; \% y4 B
: h7 q8 t, G& ~+ c" y
_________________________________________________________________________! W6 G/ ^. N& W4 D6 Y

& u  F, G$ B4 D7 q+ t: I) ^! J
Method 06
" I0 `; ^8 x9 d3 e1 J+ _/ y+ `=========
% F' V4 _' Z% H4 j
# e& y  b4 n0 u; C2 b+ t1 y4 f) V% \: [6 a# E9 r0 e% h# y$ q: t
2nd method similar to the preceding one but more difficult to detect:
( Y8 @2 D# I" }, q" [% j+ \) g  r3 g- e1 h- K! [0 Y

% o% [# h/ i8 I. U2 iint41handler PROC2 s. i& X) ?2 r2 Y4 |9 _. `
    mov     cl,al
% U% Z1 h3 z+ L    iret
9 }: g/ O7 K0 s. d( S5 Mint41handler ENDP
/ O% l7 i$ Q2 C' Q& ]; m# U' X! b/ a5 n* M

! f+ L! {$ a2 V4 R    xor     ax,ax
' X2 ^9 f& V# R3 f1 H    mov     es,ax
/ I+ e" ^# D; J& I9 r    mov     bx, cs
" X! G0 }+ M! _6 H5 n    lea     dx, int41handler
/ r+ L7 V* \& M/ |    xchg    dx, es:[41h*4]# F( o- C- r- M' R& \
    xchg    bx, es:[41h*4+2]2 I3 b, i, ^. P& X7 F1 h, }
    in      al, 40h- c! i: c" |$ F
    xor     cx,cx+ V9 b! N; u& s0 n0 o# M
    int     41h
9 o" k/ M) n- i2 O& ~9 a    xchg    dx, es:[41h*4]
' e2 p+ g9 R, @" p0 k% _    xchg    bx, es:[41h*4+2]  [, R6 f6 Y9 t. l
    cmp     cl,al3 j) z' T' z% I
    jnz     SoftICE_detected
; M5 {7 G, l* o# U2 F0 p7 F* q9 {+ M. G
_________________________________________________________________________3 |4 C$ f1 B4 l

) j6 m+ E4 M; m/ h; p5 ?5 @Method 07
  q, K# v4 p5 {7 r  d' z- Y" {* C=========
( ^4 e* k8 X; ^
! ~  |) i' n5 c- tMethod of detection of the WinICE handler in the int68h (V86)5 c* s6 C( z* @7 T2 y& q1 u
- t% q) Y, p0 M; ~4 m4 @
    mov     ah,43h
+ L6 l+ o* V0 M    int     68h3 _# Z) W- ~8 w" L" p/ E) t- K/ `" Z0 ~
    cmp     ax,0F386h
6 v) f8 P  n+ Z9 H    jz      SoftICE_Detected
: }3 h- N# \4 G) L8 I6 k
: y3 n8 d* ]+ B$ K. ^! F' g! U/ k% Y( B: `- |$ [4 O" G' U1 u
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
6 _/ Y1 t2 X9 v2 g% G' w   app like this:; \# R  O, |" M; l- `# [! J8 o
5 O5 ^  l  S8 M0 L" r
   BPX exec_int if ax==68) I0 N' k+ O% c0 U
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 R+ `& n7 ]& k- x+ z% R1 u   located at [ebp+48h] for 32Bit apps)
- a$ @, L+ p* q. }6 P% U9 r9 N__________________________________________________________________________
8 N1 r* x0 Z- H5 O% I! C" @3 `4 v5 t
1 z3 r& p6 U8 v- R' d
Method 08
5 g3 \. _3 K3 B  T; \; B=========
: |8 t- P, H7 g- e) x9 D, b, t; Z+ j/ g0 H6 I1 X: V& A. M
It is not a method of detection of SoftICE but a possibility to crash the( j. S# m$ O4 x5 R, O! E
system by intercepting int 01h and int 03h and redirecting them to another, e9 q0 g) a6 |1 h
routine.
- e6 ^9 Q1 ^$ Q3 W* PIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& i8 O. n- J  M$ A( V7 i
to the new routine to execute (hangs computer...)
! ]% N* d* ?8 y  K8 A$ {. m( v( Y: G4 }& n9 G
    mov     ah, 25h
9 d8 |* U1 n8 z    mov     al, Int_Number (01h or 03h)7 c6 e7 D% {; U  ^" E5 D4 N
    mov     dx, offset New_Int_Routine7 W, V9 G! T# u: ]7 N4 [: t% `
    int     21h
: u$ y- N6 c9 }8 X% b3 h; S: {# W7 h, d: p) q. b7 h
__________________________________________________________________________
( u. g$ V8 W) Y  R4 \+ h& X" T/ M) M3 g6 F* H8 q  Y5 C1 e
Method 09
4 Y9 n2 x8 m1 Z8 v% \+ j5 e* p=========( w  W- a- s2 r2 `( r* K) ]. t; e
4 V8 k4 q  l: K" J% f& m1 i+ ?$ L
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 O8 n+ f% o( U; Jperformed in ring0 (VxD or a ring3 app using the VxdCall).
: v( h  f! g. s1 Y3 ZThe Get_DDB service is used to determine whether or not a VxD is installed( a# @' {; a& k$ \' R
for the specified device and returns a Device Description Block (in ecx) for
1 m! ^+ c! U" {, `  i4 bthat device if it is installed.
, P4 U% h# m! |: f( M: G
$ c2 q4 |- @; J4 ]- k  k# ?   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: C# y" R) p. H+ b
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
$ x5 H% M% i3 z1 {& [   VMMCall Get_DDB
& ~2 D% `6 K2 i: d' g6 E   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 b: V0 B8 J6 r9 k% I
) |! R4 V) U! j6 Q+ X
Note as well that you can easily detect this method with SoftICE:
  V( U4 ?) j( A3 ]3 a6 K, `% u0 T   bpx Get_DDB if ax==0202 || ax==7a5fh
: h* }) j/ H5 y  Z0 V7 I: N2 J" ^5 }* H' S! t( K7 k- E4 t5 _! L
__________________________________________________________________________) u. s8 s; H9 |7 I9 s5 l  a
% v  H4 Z( m( u& Z$ S' I! o. l
Method 108 q8 S# @% _" D, D4 T. U
=========1 _" o/ @- m0 Z4 m) ?

6 N: h+ U4 v9 b; r, I0 }. e=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: n) H7 @1 W$ l' n% f" H
  SoftICE while the option is enable!!
* I6 K0 F$ _8 Q) l3 c0 k: t/ `, [# j: `  V- b
This trick is very efficient:' a5 _3 m# ~4 X1 j3 r
by checking the Debug Registers, you can detect if SoftICE is loaded& q" ?  S0 h5 X) B- D
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! O' g0 ^3 E- |/ G9 @  @' h+ q6 _
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 j: Y; @! n; W$ qvalue (in ring0 only). Values can be manipulated and or changed as well
. ^% _% |7 K- K, U! Q1 C(clearing BPMs for instance)2 t1 f* M7 h$ x

* ]5 `3 ~, B$ x( H$ a2 J5 u__________________________________________________________________________
5 \+ K4 `( q' C7 N5 b2 N: i# J  s% c! v- J% t* N0 k7 D5 v1 w
Method 11- F) j& G% v* _5 a8 }6 D8 K, m% a
=========/ X6 Y' ^6 u' b; @2 Y/ t4 q/ I1 V
5 p; U' ]. `! E. o4 K& U4 s
This method is most known as 'MeltICE' because it has been freely distributed; n: i* O0 _) q; ]
via www.winfiles.com. However it was first used by NuMega people to allow5 Y* k4 g( G& ?' |) @% @( c6 G4 J7 Q
Symbol Loader to check if SoftICE was active or not (the code is located' ]; p% m1 i0 o
inside nmtrans.dll).7 Y; Y  @" X; G  v0 |+ `

# G& Y! n" w- c; `$ f' W4 b/ a7 aThe way it works is very simple:/ v  d1 _( f4 }* T( i6 S
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; ?& U# ^- w4 c) p3 r) J. G. v
WinNT) with the CreateFileA API.
. q& H3 u' d7 c7 [4 _, B  z0 m! F' Q+ l% `) T; x
Here is a sample (checking for 'SICE'):
9 O& z) H  R: l1 o9 _* C. ]& f/ l" I  v" t8 T
BOOL IsSoftIce95Loaded()! K$ e0 y9 Y0 C
{
# O) h. L( K* N! r$ [2 q1 E   HANDLE hFile;  
& W- P$ M/ V0 d% n   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: A) s  v3 V+ k/ t) X+ y0 m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' Y0 [) h  j, {3 C- H/ l                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 L2 Y0 `$ b$ ?0 }% p3 ]   if( hFile != INVALID_HANDLE_VALUE )
$ h% R: Q1 ]; k4 Z/ I% k   {
$ B9 A' |/ T/ i) M0 L      CloseHandle(hFile);+ s3 y3 f/ P$ ]" T2 X: w
      return TRUE;. i% {/ F: U2 Z1 ]6 r2 h
   }: ?1 Y5 O7 A' ~$ u- i
   return FALSE;
  A+ j( i9 U7 f4 L/ O8 f}
* K4 z' W0 ]# c" F+ P+ n; R0 x& s( _4 G/ m/ @9 V% \
Although this trick calls the CreateFileA function, don't even expect to be! w& q, p( j, _( ^0 M1 h( i# s
able to intercept it by installing a IFS hook: it will not work, no way!
; T, n! b% Z5 i: ?2 `In fact, after the call to CreateFileA it will get through VWIN32 0x001F2 n+ s. w; Y, R& r2 H; m. E/ a
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- V: V, d7 ^! `* f* {
and then browse the DDB list until it find the VxD and its DDB_Control_Proc! s) T8 y7 r1 _
field.  s9 I& b$ ^, I, D
In fact, its purpose is not to load/unload VxDs but only to send a 1 i+ K1 X8 j& Z/ v) V
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 L5 D* z4 e& R# ^4 m
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" O+ V: D! |) [& Uto load/unload a non-dynamically loadable driver such as SoftICE ;-).9 c; I2 o- O  c/ B, Q, M. Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
' q1 C3 l4 p' _its handle to be opened and then, will be detected.
4 ?) t& ?. m  tYou can check that simply by hooking Winice.exe control proc entry point+ t0 |5 A0 {! |3 o2 |- m5 n7 r5 _) F
while running MeltICE.8 E, _, W: @0 J* e% j/ z

$ d. D' I% x' @7 C6 f$ F4 O5 r1 A, |+ |. J5 `
  00401067:  push      00402025    ; \\.\SICE" p4 |6 @" k5 e$ t
  0040106C:  call      CreateFileA! |3 ]! j  B. Y
  00401071:  cmp       eax,-001
" ?/ A& u8 W1 U: U  00401074:  je        00401091
; H1 e4 u! }/ p) a0 O1 i2 B
$ E# p* d  n' m$ l3 Y4 t! s* ?7 N/ I, p$ G4 h  X- a$ Y! L
There could be hundreds of BPX you could use to detect this trick.
  s, s5 F$ w) Y/ ?' m' e7 @$ v% d( G-The most classical one is:6 D' m+ p2 w9 o* l/ y
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
! C; G/ Z% q7 c' s1 {- b3 K" c    *(esp-&gt;4+4)=='NTIC'
, Z5 |7 u( K8 \6 x. Y1 X1 s
( Z+ G1 o2 _3 r' I. w0 @$ j$ f-The most exotic ones (could be very slooooow :-(3 g8 J( P, O  c1 m2 Z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ U( N% v4 s; h9 o" _* ~  G7 s
     ;will break 3 times :-(; z. }6 f3 k) r# q" m6 ^

3 ^$ \) v% B$ i1 N) _/ ]-or (a bit) faster: # a$ E8 n1 k7 N4 ^4 [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ l8 n1 p0 z4 X" X% }; {( Y8 Y% `
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + k( ]! s! b5 E1 M! _
     ;will break 3 times :-(" c* o( O1 P* ~& Y) V

, P: z, u6 \, f: ^$ _% r-Much faster:
- B2 e8 m1 W8 x2 r1 f/ r/ u   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! T- W+ w5 T. D/ i) p8 T  d% f
  I2 |4 W9 d- q. Z0 PNote also that some programs (like AZPR3.00) use de old 16-bit _lopen1 O* a+ R* G& ~: A5 A3 n, }
function to do the same job:
$ u; H# _0 P; g* S8 Z
: b4 h, T" [8 |+ T' m   push    00                        ; OF_READ
" b, B8 G+ d5 o, x  Q& D   mov     eax,[00656634]            ; '\\.\SICE',0- a; ?/ o+ T  e: Z0 _: }' X
   push    eax& W/ J9 }: n( w
   call    KERNEL32!_lopen
) h+ H; ?, \# s: i5 Q. Y  v- ~   inc     eax* @$ m& S4 t3 y. U* O  n
   jnz     00650589                  ; detected
% q# P5 @1 a$ W3 }   push    00                        ; OF_READ/ f  ?+ Y% E1 b0 i8 E
   mov     eax,[00656638]            ; '\\.\SICE'
+ ~' x9 e0 R: @% q0 G$ v   push    eax
! r, ]8 I: F% i0 M! o: M5 C   call    KERNEL32!_lopen
9 f, ]6 ~8 l! S+ J   inc     eax' F7 o( a) e% f. K, k
   jz      006505ae                  ; not detected! E  \- D7 K3 p2 j& a* c$ z
( K' f+ ~) `: l$ [' N" r
9 @7 A  i3 w3 j3 i' ^
__________________________________________________________________________9 F( ]! P- }; v! Q9 S& }- ]
& [- `2 }* P+ R$ N. h9 W4 _2 l
Method 12
. u/ ?* M1 x) O- s4 s* I3 `=========$ t( P, n: M2 h, _4 a0 C! \
4 h: n- V+ m7 O8 L
This trick is similar to int41h/4fh Debugger installation check (code 05# P/ f, q3 Y$ q+ ~- j. m' H  ?
&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 u+ f: d' W/ m5 C1 b8 U
as it uses the VxDCall backdoor. This detection was found in Bleem Demo., q& m1 H8 D5 ^$ I2 J  k
( n7 S7 T3 P+ w7 ]( d! j
   push  0000004fh         ; function 4fh
/ M8 N! }+ N' ]% M, T- c9 P! R: q* ~   push  002a002ah         ; high word specifies which VxD (VWIN32)3 i5 N2 F" m( @; F: \
                           ; low word specifies which service
+ s# b+ r# U1 D8 `  h                             (VWIN32_Int41Dispatch)
" v: n1 Q+ Z. Q* o   call  Kernel32!ORD_001  ; VxdCall. ?0 ^' D/ s4 |
   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 z5 Y8 h/ Z+ M! N' W7 t* F: O   jz    SoftICE_detected
0 d1 k2 M+ \  W
4 a, U* Q* M! D# PHere again, several ways to detect it:
. n$ Q2 o: s0 A, N
- U; a  r& f4 Y& `5 F3 h8 l! B# B    BPINT 41 if ax==4f( g/ }8 w0 h5 N$ {1 b4 g1 j
2 Y$ ~! J. b' ]& \7 z0 [+ J4 x
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 g2 R; h* l9 P  g1 n
( @' t" {3 v& \; @- P5 O
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. y( {- z) v. x% W5 @- F2 Q3 [) A

" j* Q7 t$ k3 ^$ }$ u    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! q  d7 H5 _% u3 ^" G, q
, S; A' M9 S: N2 m. _6 L2 N
__________________________________________________________________________8 Y6 P7 \; }5 m3 y* x4 O  q. Y- }
: `  F; |, ?# P" X% u. l
Method 13
+ Q. p$ g- o$ j4 H) f=========
% ^  @% q/ n7 K- M4 n/ f
5 T, L* a* h( o; x1 KNot a real method of detection, but a good way to know if SoftICE is- L8 P  b- _' E, O; k
installed on a computer and to locate its installation directory.6 Q" N# |4 u8 \- [) S
It is used by few softs which access the following registry keys (usually #2) :
8 L& ]. _% h6 Z# L4 E
; \+ D- W0 G( U: ?; s" G/ l1 x7 e" M1 O-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; `+ E3 g5 l; g, y4 a0 k+ k\Uninstall\SoftICE
. {- e5 ^/ }+ Y! Z, ]" C; Y$ I-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# p, [" O; o+ H! h& I-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 j8 v+ P) h: t5 f, n! n
\App Paths\Loader32.Exe
0 B* [: p4 v7 s& A3 R: X' o1 k0 B& T$ Z6 u8 Y5 S* L& C
& u$ V: `8 J& s; |- v( u! t
Note that some nasty apps could then erase all files from SoftICE directory
. y7 K  W5 y$ z6 Q# I! Q* m(I faced that once :-(
9 P0 @% O, ~/ K' W3 D
; [) L$ `8 ?6 yUseful breakpoint to detect it:
* C2 O* B. V4 z% V1 C. J" f! Q' E4 @
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
% f! r/ k* N, N) c* z  ?( _, b: m6 H/ F! m; A3 z
__________________________________________________________________________' Q8 }5 G! N# H! S  T" p
) j& B: B# ]8 o- g, W2 m
7 ~3 M  D+ W. i9 I/ L8 Z
Method 14 $ R% y% {, y9 m. g' S0 H
=========
) D, Y2 r* t! E" j5 F/ d& z7 c& p! s$ z( I" Y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" B6 j# O" i. @; q+ D
is to determines whether a debugger is running on your system (ring0 only).
) N8 R; h9 w9 q- a0 h" k- f$ |1 n5 j. L1 q) p' J/ S
   VMMCall Test_Debug_Installed
1 @& J1 D& \, C$ n. [  G   je      not_installed
  z& [' t! _2 Q/ Z! l5 S# ?
, d$ w5 E; W5 d+ OThis service just checks a flag.
0 M7 n+ t/ S6 }</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-2-1 23:54

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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