找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>$ y9 O: ^5 Y: U* j% _1 A3 c- r
<TBODY>$ Y5 _  F5 L2 J5 u( ?
<TR>
5 N" g! H/ @) @8 w3 e<TD><PRE>Method 01
. T& f( ~' g% J7 k=========
; T3 p3 l( Q' B' w. F4 f8 W6 q7 p2 T0 U" _
This method of detection of SoftICE (as well as the following one) is
0 s7 d# ]) h1 [* ?used by the majority of packers/encryptors found on Internet.: Q1 \! d7 @- k. v
It seeks the signature of BoundsChecker in SoftICE
3 _9 ]4 k0 L5 W3 t" K5 q( E2 z2 K: o0 v" B, K0 m# B5 C
    mov     ebp, 04243484Bh        ; 'BCHK', R/ C" B7 k; `! t9 d5 g
    mov     ax, 04h" }% J& Q/ ^1 V0 f+ ?
    int     3       5 ^; i8 f( G3 D. s( P/ L
    cmp     al,4$ ^' r: U; j: ^$ j  m' C+ ]
    jnz     SoftICE_Detected
6 i7 p* d0 L. e3 E9 E
2 P9 C8 q+ C: w# i7 I8 g___________________________________________________________________________
* n9 }1 D( d& z+ q6 ]# K8 H& P' ^$ D- Y7 W
Method 02: i; }1 D" X$ \2 c& p2 C/ C# k
=========
, c6 X, I8 h$ V( F: c- t
, F* W; Q, o1 f" |" EStill a method very much used (perhaps the most frequent one).  It is used; q; y# s/ j7 q" L) q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 X1 E! _- m+ J2 o: I2 {! U
or execute SoftICE commands...# {$ {' s3 p% z9 b, [; n
It is also used to crash SoftICE and to force it to execute any commands
" ?. x4 [8 t- W(HBOOT...) :-((  
( D, n: M. Z4 W/ U! S+ G7 |1 S
% r; Y9 ]6 e1 J1 |1 S" c. v# {Here is a quick description:
5 j( o; p2 W, }% b/ ?- B7 |-AX = 0910h   (Display string in SIce windows)0 S! {# O' i6 G! _8 X# k
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% E& o) `: H' E4 u! \
-AX = 0912h   (Get breakpoint infos)8 V4 h3 ]7 `- {- ^9 p
-AX = 0913h   (Set Sice breakpoints)# @. u  b; L  l' i0 F
-AX = 0914h   (Remove SIce breakoints)
) z' ~: }3 G% \* V, k
; r" a* M9 z4 k* S& r2 |) O4 ]/ yEach time you'll meet this trick, you'll see:
- l, N/ n6 ^  v( L$ a# p9 Z6 t-SI = 4647h
$ l; U8 \% K+ ?' p-DI = 4A4Dh
3 l1 `) r3 V+ \7 R' U5 A- x0 v3 |Which are the 'magic values' used by SoftIce.
( W0 V7 O! z- VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
5 B7 J$ U6 E$ O7 R0 C+ \" v4 E
9 K* o# R8 h+ G( j8 c3 N8 k3 MHere is one example from the file "Haspinst.exe" which is the dongle HASP
( ?% M0 F0 J. u4 b6 vEnvelope utility use to protect DOS applications:
" M) A3 v2 j. r! a2 ]% Y+ D( F. M* m9 x6 s' ?6 t

1 u2 M4 M# g8 h8 q# ?) Y3 N0 }4C19:0095   MOV    AX,0911  ; execute command.  [! W6 ^* G% P, M7 E( O
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: `) `0 A8 U3 G0 L4C19:009A   MOV    SI,4647  ; 1st magic value.& ^! K/ @1 j/ ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! N) D9 z) v8 _1 I, M* @2 A/ J3 K( L
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! |& ?3 h! `" h4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. {- h$ \* Q7 O
4C19:00A4   INC    CX
' }6 g! _8 n; n, h, w4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
5 N& f7 b$ q  r0 S8 T4C19:00A8   JB     0095     ; 6 different commands.
: I$ c8 P% B! w4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
2 t) H: I) c* {3 z0 ], @4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! [* I5 s3 J* K  e

, v7 r1 e* ~: i" l4 c: G1 EThe program will execute 6 different SIce commands located at ds:dx, which
, x% q( ^6 n' Iare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 ]- V" m# K  q+ x1 c& [# W
1 h/ B; O* K. g( p6 D. D
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., {6 P) W! |( Z+ B! H4 Z: x4 v
___________________________________________________________________________; e$ L0 ]- e' D" ?7 ]0 u
, b9 O3 f- W( H: P0 F) o% q0 U, a
& ~- m+ R* v) G4 ~* O' J
Method 03  ~% C, d$ T. b- z7 w% Q
=========
. E1 j+ {1 O3 w( U- ^! Q# A1 H
6 [2 ]" Y) o$ S, P( t! `, ?; cLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ A1 i1 @  T/ y- R" L$ L( Q1 C4 ~(API Get entry point)7 y/ J' F1 ^1 [5 b* _. |1 T5 p4 ~
        9 p) V" X3 \1 o1 C# g) k8 X- k

7 ^( w0 c, [% f1 a& j/ \1 D0 Y    xor     di,di5 Q  n* R8 a8 A2 V, E
    mov     es,di
& }/ C  B, W8 f" P6 V! T! x* Z    mov     ax, 1684h       ! O+ r0 g: G/ X; H* n# b; @& S
    mov     bx, 0202h       ; VxD ID of winice
1 ^( L1 |7 ]( R8 y    int     2Fh. [8 K5 ~3 J* n9 \; b. V9 z7 q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) K# M* Z4 F, o6 `    add     ax, di
) W/ T! ]( [  O3 N    test    ax,ax' v! m" A# \# G' X9 I5 c
    jnz     SoftICE_Detected
# o8 L5 C3 L6 @) V" ~' K  T% e/ @6 M" {! Q. F; L& Y* ~' A7 g, g
___________________________________________________________________________9 p4 \2 p( R4 x3 C; k
# E1 p$ g+ i0 Q4 a5 T3 @
Method 044 q4 Z; h  K$ z% h
=========
3 {( c) h% m8 ^- L9 m6 q9 m3 f/ j( t( u- Q* ^8 n
Method identical to the preceding one except that it seeks the ID of SoftICE
9 |; g# ]" Z% b# [8 uGFX VxD.
; U5 p) G. W9 v
& s1 [$ E+ I: ]7 }    xor     di,di
$ e! `0 j4 s6 W    mov     es,di
2 F: u! u6 O# M, U, ]    mov     ax, 1684h      
) ~# ~9 @2 n% q! r! `! A# M; i    mov     bx, 7a5Fh       ; VxD ID of SIWVID, t- [0 r, h. {4 t" j6 {$ q& ?+ J7 z
    int     2fh
) \# m% h3 i" t; e    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" S5 ^" S, i! v% q/ K4 s* G    add     ax, di
: h& T5 G0 D, G0 p    test    ax,ax7 F% o$ O6 F6 \4 u. @7 e( i) B: F+ c
    jnz     SoftICE_Detected
& k& z) o3 K- j, ^) p4 E; D0 K
+ e7 S0 ?, Z; {* J__________________________________________________________________________
0 y: g. [0 k8 t& L2 k( `7 s+ V
; n3 m+ m+ C) D; D7 V4 B4 Q6 F) B( t  A& u( ]" G  }5 n1 ~0 r
Method 05
( h& L, |; ^# m2 p=========' T, T. i+ O8 D1 `; R. R0 t
% w' o6 w9 R6 f  C$ _0 a8 o
Method seeking the 'magic number' 0F386h returned (in ax) by all system
& @$ p7 c( g0 Q* k# D. [/ K6 {debugger. It calls the int 41h, function 4Fh.( D8 g  A4 r) z8 V  Y
There are several alternatives.  
5 D' U0 b2 P& ?8 W* J2 s6 ?4 p3 Q/ ^  K) q+ _4 N& G
The following one is the simplest:5 ^4 ^& k# L  s2 A5 x- s+ U% p
9 s! D0 Z5 j7 f6 U. C# L- ^
    mov     ax,4fh
' }+ s1 i6 W) S    int     41h
5 m" H" Z1 M5 J2 U  Q    cmp     ax, 0F3861 d' e. q! v0 C8 v
    jz      SoftICE_detected3 K/ u+ n. K& W
8 e0 l: \) P# F  S
7 [4 Q9 y; X2 ?: N7 j
Next method as well as the following one are 2 examples from Stone's 0 Y# U; [6 c! m9 R& I2 A2 m
"stn-wid.zip" (www.cracking.net):5 |$ k+ H( v# u
5 J" `8 V3 V* G( P
    mov     bx, cs
3 I  x( {) }8 h3 H    lea     dx, int41handler2. x# _) I( C7 z# O
    xchg    dx, es:[41h*4]2 l( p( t6 o; @% m, r, z
    xchg    bx, es:[41h*4+2]/ y( Q( B8 }/ r5 A% S9 ]! U3 c
    mov     ax,4fh
% y3 U6 ^3 y! K8 H9 o    int     41h( T, _# w2 K, y+ S) B$ ]/ ^
    xchg    dx, es:[41h*4]. }  g% ]8 d. u3 a! B: H
    xchg    bx, es:[41h*4+2]
; a8 y- \. `8 W2 R! j. I    cmp     ax, 0f386h
0 g- F2 e6 V. V5 b    jz      SoftICE_detected& s* \& n: {# O3 q7 Q

; o) W6 c5 ?) D3 Fint41handler2 PROC$ j+ B1 g, |# b1 b
    iret+ g- [' U0 P3 e' v
int41handler2 ENDP6 f8 C  Q& k+ R, d) a
- z; I7 c7 R, m1 g6 r

, j: }( F. z/ Q) b_________________________________________________________________________
- O9 }5 V, v" K: E6 F' V& s$ A: _
& f- `& q4 w3 d% T1 ]1 v4 t
Method 06% K  r. V0 j1 L- `) z0 z! A
=========
, B7 L8 i5 E% l# j! D( B; o! Y8 w3 V! }3 A* E8 h8 S

+ |6 f( E% W. z) P9 @" q/ H2nd method similar to the preceding one but more difficult to detect:  C, x1 P/ Q" `# D% }% ?
5 e% p) R$ p: S
! k. f* N) K8 O) c& L' x0 V8 C
int41handler PROC5 P6 N' a% l4 S. z8 ^  `: a
    mov     cl,al
8 C& m# b/ _* Z! {    iret! K/ c, `3 ^) U' k
int41handler ENDP: i6 G. c3 v8 P  f2 {: p
; G3 s# d, B/ G" r1 }
* {# v* R7 G! C# m0 J, h7 ~& r  y
    xor     ax,ax
& v7 ^& l( `. {: S( ^    mov     es,ax! {0 Q) c  G; v3 Y( ?7 N& q
    mov     bx, cs  H. k- ^0 {" L( q8 p- A3 T
    lea     dx, int41handler% ^" a" x% I  X$ a5 Y
    xchg    dx, es:[41h*4]; P* x, q8 |( V5 U1 j
    xchg    bx, es:[41h*4+2]3 b' y6 @. k0 E# v
    in      al, 40h" _* z% b& H/ o
    xor     cx,cx
# c8 F! Z, z9 J# u    int     41h
" F$ ?7 k6 j$ t- }- Y: ^    xchg    dx, es:[41h*4]& t1 a! E+ z; g! [# s! k! K
    xchg    bx, es:[41h*4+2]: q/ Q0 |! t( W# ~+ f
    cmp     cl,al( m- ]9 k) i% u
    jnz     SoftICE_detected: j4 A+ {; ]8 b

; _8 Q& w; {3 f( C7 v7 D_________________________________________________________________________/ q0 `# J8 j/ w1 {) D2 [1 u
* q- i0 E8 L: `
Method 07
, d1 ^% ?0 X6 A+ B3 \, u/ ]1 Q=========
+ G$ x9 c( C" i7 P! J" T4 L: _' x3 a5 P7 D1 [& m0 d; [
Method of detection of the WinICE handler in the int68h (V86)+ e. |% K8 ~6 C5 p4 I* H6 m" t

, u: N& O) d; x9 l+ A% j( G    mov     ah,43h
! B# g, E8 ~6 N8 C: e+ b! h    int     68h
9 w% \2 R0 s; G: j0 W    cmp     ax,0F386h+ F2 ?" g9 K0 [: w& Q% T
    jz      SoftICE_Detected
; q0 t# `& j' \
# q* |. R. T# h7 X( R4 [  @" a5 n
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  A+ s1 x  ]& [* p& C   app like this:7 i+ p0 Q; p7 O2 d6 T
% p1 M% v1 _3 I/ ]" p
   BPX exec_int if ax==686 p/ X9 q" N7 b6 u
   (function called is located at byte ptr [ebp+1Dh] and client eip is9 G0 [, K7 R0 N- f) e0 d* u
   located at [ebp+48h] for 32Bit apps)1 A, r+ A0 {3 s: p% L; R
__________________________________________________________________________0 x( V* s" b4 ~, Z" m

7 l; ?5 k- j( X  J9 ]* ~% r
8 ^& j, r. I8 e4 bMethod 08
, H) h* p/ n' k: u/ c& w8 b! q2 @, V=========0 Z1 z% N6 U0 o
' F7 v! @7 `( L# ]
It is not a method of detection of SoftICE but a possibility to crash the* X5 \% [6 \/ W4 t" ?' c7 e
system by intercepting int 01h and int 03h and redirecting them to another7 U# F" ~( @8 }5 F" x
routine.7 L  g! Y+ ?1 V* P0 l* k
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ U* p* S1 c$ k. y  hto the new routine to execute (hangs computer...)8 q4 c/ ]) A9 U9 s( u

2 Q/ I! ?' K) z! A    mov     ah, 25h
* e( E: Q; {  m" \1 g/ Z( Y    mov     al, Int_Number (01h or 03h)3 w$ o' S" R/ m0 N' V
    mov     dx, offset New_Int_Routine
# P4 U0 z2 m& ^% h7 t$ [    int     21h3 @6 d1 y6 f1 l
7 X  L0 _" P7 ?7 P; ?% }- m
__________________________________________________________________________
* C. b" r" ]" i5 K$ i) g3 S
; C& l+ e2 O3 P. i6 _- Y+ }! @Method 091 W, K# s9 n& e8 r5 e7 k/ v
=========
% [( R2 x% T# o7 ~0 S9 ~4 a, u! Q3 F2 X) N8 Q% e
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" B: Q3 a/ z9 t8 cperformed in ring0 (VxD or a ring3 app using the VxdCall).1 u7 B* N* e2 V
The Get_DDB service is used to determine whether or not a VxD is installed5 `7 q7 V4 R. a. w, {* S
for the specified device and returns a Device Description Block (in ecx) for' |. b1 J( D8 P4 V) H. k+ }
that device if it is installed.
: U  r0 b1 C+ I+ ?$ C6 f* v8 k
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ Y% j  ~! X% H% h8 N5 f   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  w5 v+ d5 z! d- M/ l" P- I3 ?' u) y
   VMMCall Get_DDB* I4 O; v# F  J
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. P7 g6 D+ M/ c5 U9 z1 x% R7 R" r- k! n+ V. h6 Q5 k! |4 g2 `
Note as well that you can easily detect this method with SoftICE:2 M; \- n4 D4 k& n! o- T
   bpx Get_DDB if ax==0202 || ax==7a5fh
! c$ o8 Z% a' G: Z
" b. C! W0 R+ w' h* W1 ___________________________________________________________________________
6 V% W6 ^  h2 g
7 i( W; |- i, f3 bMethod 10' {/ U; w- g/ C$ s, [- r& `
=========
$ X: F& f* ]" U) l4 {! R( j+ a$ }' ~0 z$ W; A3 F
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 @$ A0 B; W0 e1 d* G  SoftICE while the option is enable!!2 D8 R+ z$ R7 L

4 m/ s% A5 D5 P$ T" dThis trick is very efficient:: }4 a0 t- V9 |* ~: X0 B
by checking the Debug Registers, you can detect if SoftICE is loaded
  H& {# T! y6 w; I. j( W(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! L1 {: q7 m/ |1 Q
there are some memory breakpoints set (dr0 to dr3) simply by reading their5 ^0 }" i, E8 e3 v
value (in ring0 only). Values can be manipulated and or changed as well
) n9 k6 R: U4 w, _& q2 S) }(clearing BPMs for instance)
" W/ T( p- _& R- E5 U+ l. t/ W" d3 t' n, [1 }* u
__________________________________________________________________________
8 |4 v) @, E5 ?8 K6 U) N; e- E' ]; @; n' ~* ]
Method 11' `5 b3 S% o7 k' \& m" z
=========
) F- C. ?2 q8 A* ?5 a' S9 J8 P4 J; _( ?; C) k9 S+ N, K
This method is most known as 'MeltICE' because it has been freely distributed7 j  T1 L) ?1 I; W
via www.winfiles.com. However it was first used by NuMega people to allow
. ~6 @& f" x2 ^5 R; T7 O  RSymbol Loader to check if SoftICE was active or not (the code is located" i& i% J+ L/ j" \7 c! G
inside nmtrans.dll).( F0 X& m3 M, W9 l  ~, {

  g3 f8 q( @7 t$ c* c! TThe way it works is very simple:
7 B0 C4 |+ ^! l- V; K2 eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
3 z* e& |3 V" u7 kWinNT) with the CreateFileA API.0 L  c' K/ W' ?- i6 }  l- |9 Z

2 w  u+ t2 K. _) a$ THere is a sample (checking for 'SICE'):
/ ~7 P; m# b( `8 g' _3 D& e* s# |: o2 j1 X
BOOL IsSoftIce95Loaded()
7 u9 J+ L3 ^. H& Z! j{
& n; A3 f; E9 i- I0 a3 w6 C, V( p7 ^   HANDLE hFile;  
% T. O7 L9 ^$ C+ l   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 m: a6 F" t+ J
                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 [% e- i' d8 ]! ?
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& v/ @9 [' {9 B- Z; K+ l   if( hFile != INVALID_HANDLE_VALUE )' K$ d8 d2 e% G. A
   {
+ J/ d2 |2 C& e$ ^1 U      CloseHandle(hFile);; j$ W7 M! v$ T; [8 Z+ A- N: Q3 h
      return TRUE;4 n9 v5 A! m2 o$ `8 ~" k
   }
5 E7 e1 N5 \, ^$ A; c: I   return FALSE;4 @* O# {% a1 v% q  o
}( L2 z$ P1 S, p! C' t( ^% w
' S  |6 f9 f6 K2 ~
Although this trick calls the CreateFileA function, don't even expect to be
# x$ }; y' H7 V2 Y# Z) w4 _able to intercept it by installing a IFS hook: it will not work, no way!$ ^$ _( ^7 F/ p
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 G! s% f8 l! d! F* qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 Y& H5 Q8 Z/ y4 x3 `
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
  |. ?7 |4 M5 u) efield.
- v5 I0 b* [# }9 r/ p) ?5 JIn fact, its purpose is not to load/unload VxDs but only to send a * l0 H0 e9 \  f) R' E3 H! O
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% |- Q: z5 Z" o) \+ J
to the VxD Control_Dispatch proc (how the hell a shareware soft could try# d& t  B, y6 ~0 n; O1 B& \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).0 `# R0 Q+ ]. g- q( t
If the VxD is loaded, it will always clear eax and the Carry flag to allow
2 B  t6 z, G0 m/ d: ?its handle to be opened and then, will be detected.
$ t0 a$ I8 P! b# mYou can check that simply by hooking Winice.exe control proc entry point5 A9 |# u! e7 D# a* i
while running MeltICE.2 b3 p6 G6 {8 U5 |  x" P1 b! n

& q* \0 q- b9 g: ^& a/ I  Z: e. `
1 j3 I3 s$ U! Q% f- L  00401067:  push      00402025    ; \\.\SICE
- f) ^. \7 G) h" ?5 F  0040106C:  call      CreateFileA2 `" t2 R& c5 e8 f9 h
  00401071:  cmp       eax,-001( t. G6 e( N# v3 L. M
  00401074:  je        00401091' A5 L; C7 {9 D0 m$ c: G9 V; a0 _
0 z9 O7 r6 N  c6 H' k9 @* \% z
' e- Q8 M& h: N6 X& o
There could be hundreds of BPX you could use to detect this trick.
# E* Q6 r, |; S$ ^-The most classical one is:
+ y/ S3 {* e0 [5 g! }/ D! r' M  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( R6 q* v! o4 W8 `4 @
    *(esp-&gt;4+4)=='NTIC'0 s( q4 S, m3 D
: Z% Y; z- R5 q+ F. ~& B3 _* y( i
-The most exotic ones (could be very slooooow :-(
: O8 u' z0 M1 i" l; q7 G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
) y, U, Q  P0 ~     ;will break 3 times :-(
& F" b8 p3 R" m9 h
* E* s+ S4 M8 u6 z2 k-or (a bit) faster:
! Z& b/ e3 k* l   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 @2 G+ {( [* R; b
0 ?- W* D3 F- _8 X* S   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& |" A( s9 _" h% h: O2 P     ;will break 3 times :-(
% f- G8 E; z7 l/ H" z
) F  Z2 \' \* Y4 T9 y4 f  P-Much faster:
/ C) K/ [9 v" G. ^! `   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 R0 m# s5 c( G' \) l7 L8 ?4 C% c! `

2 e  |8 A! O$ C- {0 b4 B2 LNote also that some programs (like AZPR3.00) use de old 16-bit _lopen, {' r. s! E! q2 Y
function to do the same job:1 T3 Y" W* I$ x2 v6 A
0 _6 }' r; @! ^* V  ^9 J
   push    00                        ; OF_READ7 l" [' U% G, _) T, t
   mov     eax,[00656634]            ; '\\.\SICE',0
5 C7 d- g, K9 g  j- R- K% y   push    eax6 h% z: H. ]4 Q5 L& }
   call    KERNEL32!_lopen6 P) q! r- C5 X3 U. ?% d7 g9 B) p
   inc     eax
8 y4 h8 \7 q  O' n: x% [7 u3 R: J   jnz     00650589                  ; detected. d' |; a+ }2 k+ Q1 W+ ~7 [
   push    00                        ; OF_READ
& I7 ~$ H' e" P" ]+ R: p5 A# T2 W   mov     eax,[00656638]            ; '\\.\SICE'
0 a* D! Z8 I; \   push    eax
( H, a8 s2 R# q( m% \& u. q6 E   call    KERNEL32!_lopen
4 H3 V) a/ b" A/ U   inc     eax2 |+ J3 m* F. ]3 l. l: X' |
   jz      006505ae                  ; not detected' }$ E- {2 O$ V& o9 }
! r8 l$ z8 j% G' V1 G; i- D7 M

5 P. @" d" W6 j! R__________________________________________________________________________5 J0 n) W* K  ~" e2 o- X" ~

+ {9 ^" T. x" f* {2 eMethod 12
6 T* E0 p- h- Q=========
6 K: x: R# i% k  P9 }1 m0 J. Y2 \. I: j0 O% r$ |9 J) e" W0 J
This trick is similar to int41h/4fh Debugger installation check (code 059 [+ L6 E8 H9 W3 k& s+ `* s
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 K) y  j& E7 k0 P9 Cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.! s5 U) Y" x8 p% b
  P! y5 X$ V# J8 x- a1 H8 v8 a
   push  0000004fh         ; function 4fh( p& _4 m  F0 R0 r. f' z
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 }, ~6 _1 n4 Y9 _8 j8 i
                           ; low word specifies which service5 u, ]* h$ l8 r& i
                             (VWIN32_Int41Dispatch)
! x9 x1 ?' C( K4 [0 n   call  Kernel32!ORD_001  ; VxdCall' `3 v/ Z2 Z, V& {
   cmp   ax, 0f386h        ; magic number returned by system debuggers, z! I& X. |) h+ q9 X
   jz    SoftICE_detected# B. A, K0 t1 Z+ v3 S
; E# n& H9 c9 M: r) x1 y6 {' |
Here again, several ways to detect it:
( D3 L* y- p: B) j# M0 X* C) s0 Q3 ^2 \( K, x/ J
    BPINT 41 if ax==4f& \/ e% @' q6 f  R- m
/ C% D6 v+ u$ D7 c
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one# d* M7 k# e# ^- t  b: D

- D3 {8 P3 W/ T2 a& H0 S+ S- @    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
# t8 H9 S3 u1 V7 \
/ M+ ?! v% H0 ^( z- L6 v: f    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" a- B  w+ J: k( i$ N% q6 z
" b1 `2 K; b. z/ J* M__________________________________________________________________________
; `1 F+ H1 B2 w: D
. f8 K1 u0 o* D9 W+ L( k) xMethod 13
/ w5 ~! i+ l& ]( C, }/ N' e=========
1 u, x, I8 r. \$ R) t9 L. k( n
. k5 A, u. o, Q' p- qNot a real method of detection, but a good way to know if SoftICE is" x2 h( x# n9 u3 l0 b3 a! f
installed on a computer and to locate its installation directory.; O& ?- E' t7 g4 t6 Y
It is used by few softs which access the following registry keys (usually #2) :' ?$ Y. s; E5 h1 u6 R& \& t3 M
0 u+ s# Z$ U5 _
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 n5 ?0 D2 y5 l( D2 D' ]
\Uninstall\SoftICE
& Q8 n/ v( ]9 \1 l4 R" a-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
5 i. p- t* x2 y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  D9 n$ z% D. F1 y5 o  c( ~  {
\App Paths\Loader32.Exe0 e( h* A1 J0 B7 |7 e# p* v3 l

4 n: E8 [; B6 \5 u9 }! d8 g/ d# J1 Y
Note that some nasty apps could then erase all files from SoftICE directory# o: }# T; p5 ?% B
(I faced that once :-(6 H; E' ~6 u# h4 w9 p/ n

' d! {9 Z( \, @/ q3 G4 i3 gUseful breakpoint to detect it:9 m  h1 `2 N: V5 _$ u/ H& f6 S- T
% P- B8 U, @( S  w& x
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': r9 }# R7 p# f
$ }% f, q( f) x0 x
__________________________________________________________________________- ?+ l5 w& |+ w$ r, F0 I7 @

0 j. k2 Y- H' j. y6 G" ~$ c! \" }
1 j% @& W/ {  K9 FMethod 14 5 D& R9 Q2 E2 d- F9 V9 i2 y$ C8 \" d
=========2 t" M" i2 E2 w4 X( s9 U

8 ?8 o" _3 v9 g9 c0 RA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) @7 [% M7 I- R5 u' D  h. W' T1 H
is to determines whether a debugger is running on your system (ring0 only).
% F1 }5 B0 l5 I: J/ m4 q
7 [! c) g' J9 s6 _+ g   VMMCall Test_Debug_Installed
+ i/ l* K) q, d$ i   je      not_installed2 X) [  d2 U% ^3 H
+ I1 C4 X  C5 }& V5 {
This service just checks a flag.% B2 o, r; u; k8 `
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-14 19:54

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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