About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
! d* Y; |  X1 I+ U6 C' Q' y<TBODY>
0 u- R. H" }) F8 p+ }% @$ j9 z<TR>
( a! s. S+ I& ?( H  K* b<TD><PRE>Method 01
3 }- q6 A. c4 y6 N3 a' B& u=========
* K  N6 p, z. d5 }) D- Y
1 |# U2 g* R- |8 R' A3 w$ v" jThis method of detection of SoftICE (as well as the following one) is
% d0 F8 C* h) ~. bused by the majority of packers/encryptors found on Internet.
: [; J' W3 N6 t" `It seeks the signature of BoundsChecker in SoftICE
3 m" o& Y) g3 t& L0 ]: j
! h6 {& u1 D) R+ `4 U9 u    mov     ebp, 04243484Bh        ; 'BCHK'2 U: j$ {0 \. h' z
    mov     ax, 04h  E( V# e- U, Y# w. c. D# Z" O4 x, Q
    int     3       ( Z1 N9 A) M% O8 ^; ~9 j3 c4 A
    cmp     al,4+ e) X" I- V, y$ j
    jnz     SoftICE_Detected
( w  f. U& A5 ~# X+ }8 A( [. S0 L$ z) Z
___________________________________________________________________________2 @, D- u9 p/ e  e
& E$ T% _4 [+ O0 o9 V2 K
Method 02
' v, W0 s7 p( H5 s) ~. h=========" q  L' K& O- A! s5 o8 f. O

" D7 b# O% z: `+ UStill a method very much used (perhaps the most frequent one).  It is used7 J! D) b1 h1 _* F2 P; p$ P" ?! n, r/ ~
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ T: L( J( g; a3 [0 w+ e, t
or execute SoftICE commands...3 ?  s! s! M, D. B$ C% V6 u3 S
It is also used to crash SoftICE and to force it to execute any commands% W+ ]9 K. Q; k" M5 k0 {
(HBOOT...) :-((  
6 e- b; P- v# \6 n" o# T) C9 y+ f3 o9 O$ N' k- M
Here is a quick description:
) B1 q. U: p$ I& B1 z6 Q-AX = 0910h   (Display string in SIce windows)
% b, {/ F8 n- \8 R. Q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 b# b( ^% K* L; N! y. @-AX = 0912h   (Get breakpoint infos)
" T: j" J7 ], Y5 ?-AX = 0913h   (Set Sice breakpoints)
9 w, }4 S, h( \1 n+ a  I. y, s/ p5 m-AX = 0914h   (Remove SIce breakoints)
; ?  H/ u# U- E) m! m( V! x5 C6 q6 _) ~& P6 q7 g) Z1 r
Each time you'll meet this trick, you'll see:
6 q2 O. Y9 c2 Q& J; d- H5 N-SI = 4647h
3 l  n4 ^: A; ~  W9 s) E-DI = 4A4Dh! B: h+ ?5 y( j. ^* m8 t1 t6 o$ ]$ c
Which are the 'magic values' used by SoftIce.
7 h+ n# X3 M; V) kFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
' m6 r% a3 ^% Z, V/ w+ j/ |4 G* ]( d5 y8 y" o9 k: e+ T
Here is one example from the file "Haspinst.exe" which is the dongle HASP; A5 D1 ?5 i, r0 ~
Envelope utility use to protect DOS applications:+ S) S5 j: T. O6 B: l  C2 w" X2 ~
. s, v5 T. \- b0 [" ^) w" z

+ E3 F' P- B1 |4C19:0095   MOV    AX,0911  ; execute command.
" m& e9 f1 w( I- W4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, V: b% [0 l) _( x  k: u4C19:009A   MOV    SI,4647  ; 1st magic value." z( S- H3 F' h. t' Q& [0 O- n7 k+ d
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.# n0 l. T) F/ X. H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- r  a$ L$ Q; e
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, z1 a3 j6 D6 _2 F* b4C19:00A4   INC    CX9 |7 K& w* E- E1 s5 h7 e2 ]8 V
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* L$ Y% Q/ f$ ?0 c/ @4 ]4C19:00A8   JB     0095     ; 6 different commands.* W* K7 R$ [9 r# n
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' g8 u% f: D8 P& M% R
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 e6 U# _' |5 l/ Y, p
; J# B7 O0 M+ l
The program will execute 6 different SIce commands located at ds:dx, which
6 d8 u+ J( P  Z+ B& F9 _8 o3 qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: m2 x4 ]2 U2 e7 a. Q
* Y# j. F( c" a# K
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
. D. I& r% U, A___________________________________________________________________________% s3 v& D/ S. X- m( r
2 P( k! e$ x! G& j; ?, K
0 [  v/ s6 T3 ], J0 D
Method 03" h6 [0 B  G4 f0 n
=========
8 G, _! w' f9 v0 C) m: u2 y8 i5 M0 E$ Z1 ]2 C
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 N/ x6 ^8 ]1 Y1 s5 L; d
(API Get entry point). q% \8 Z( j5 D7 f( x" B
        
" h9 b: @% s6 q9 n. l" ^, O" r
. G1 z6 m* ^; W# z    xor     di,di6 ~5 o1 Q) `1 p0 [5 I
    mov     es,di1 u3 D+ C6 Z! G" V) F$ l
    mov     ax, 1684h       ) A, D) g# a( q" d, ~
    mov     bx, 0202h       ; VxD ID of winice2 Q/ Q- L8 u4 Y* I4 o6 w
    int     2Fh7 G9 F$ V6 K7 N7 ^
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! ]0 H2 n+ D6 f8 T$ h    add     ax, di7 W' g; P2 U! r5 X  S
    test    ax,ax& w1 |6 l' _5 W$ A$ D
    jnz     SoftICE_Detected
9 \! K) N  W( ^& I1 {% R5 H* d
3 U8 N' Q) H# e___________________________________________________________________________2 @" E: v# [4 y% ?# u1 t

" z% v& [5 m; W% _, v% |* U3 `Method 04
' i+ A/ y. g6 U2 w=========5 D* p# ~9 x* }% F6 q

7 B/ a4 E6 H; t  {+ O4 `' d0 n2 ^Method identical to the preceding one except that it seeks the ID of SoftICE. r! r+ `1 f5 y0 F
GFX VxD.: E  Z( Q8 Z/ `" `+ j: {
5 f; R) ?  [2 R
    xor     di,di% Y2 V! n. L/ j/ Z0 Y
    mov     es,di2 o2 C0 W) k. o# S- {! n/ m8 o1 X1 {
    mov     ax, 1684h       8 B$ ?: A- Z9 L6 M. @; \4 f( c5 q
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 E; ?. }% v5 ^8 ^: ~( D- h    int     2fh% x  |7 t5 S$ X* o. C, \7 Q( T) \: i5 z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( Q7 H* O& Z' L0 H5 j+ A2 d    add     ax, di# `. ~$ o  x0 @; s% A( }
    test    ax,ax; a2 W- t) A# {2 i1 k( a
    jnz     SoftICE_Detected1 Q$ |% C9 U, |7 y, i1 D2 n+ M/ c

. h5 _" V, u3 s6 E9 h__________________________________________________________________________  y9 Z3 s2 e; d4 _. C6 D
+ s2 u0 x3 N& v! e+ a4 ?

/ @8 }5 h6 T, K0 A' p' i! E! |Method 05
) z1 n, m* W9 a- t" F=========
9 W# Y0 e- G+ h* _$ o; V! m! U
( o" ?& z1 X$ c3 i/ ZMethod seeking the 'magic number' 0F386h returned (in ax) by all system8 J9 p, a/ m/ e0 n
debugger. It calls the int 41h, function 4Fh.: g1 S' b5 ]9 X# O! U% ^
There are several alternatives.  $ j8 L( B$ [( [' P8 M! K5 h
& y7 S  {, w( _, j3 U
The following one is the simplest:* q8 B. f& [7 e: P1 z8 n

) Q3 G* g5 ^2 K8 Y, D, w# \) t4 `" M& \3 q    mov     ax,4fh& B" E4 N0 r: U; J
    int     41h
3 ~) D. x$ k$ n9 g) r. Z& o    cmp     ax, 0F386
, e- d' m. h+ d) j* x- {    jz      SoftICE_detected
# [9 L0 R9 p1 O2 P4 |' t5 f/ {4 P; X; \8 u
2 p9 w: _- x+ `/ U7 O
Next method as well as the following one are 2 examples from Stone's 7 m7 N, K; ?% y$ F. A
"stn-wid.zip" (www.cracking.net):  |1 h: e5 q! N6 x5 E  X" ^0 ~

% _3 e1 p- T* Q$ c, I  A    mov     bx, cs5 b- [/ L' R) a* {  x: L/ N
    lea     dx, int41handler2) c7 X5 A: c1 S2 Y0 i# Q7 y2 _
    xchg    dx, es:[41h*4]! v$ k! {4 [: g8 c3 ]5 s) X$ {- k: M; d
    xchg    bx, es:[41h*4+2]4 L! B0 _5 i! i$ _
    mov     ax,4fh
& _1 |% A2 x3 p3 a6 C& r8 e# x    int     41h
7 U& X8 p& V6 S" @* E    xchg    dx, es:[41h*4]
+ d3 u, f- z" @2 _    xchg    bx, es:[41h*4+2]0 T/ x4 a( g; L$ l, X
    cmp     ax, 0f386h( f+ J: \1 j4 _5 s3 h
    jz      SoftICE_detected
" T6 |2 a7 [& ^% I6 ]; C! U
! d" p' Q$ K# Z( ^2 |5 I& f9 ~, pint41handler2 PROC3 d* z# r& H- |4 V) ]
    iret
: c& u2 F6 ]" c  Xint41handler2 ENDP
( Y5 b2 W; @0 B$ ~7 X
3 a- e/ x$ h; g: B& _( T" B6 f* s9 {
_________________________________________________________________________
# z# ?% H( d/ t) J
4 j# x! e9 ]5 e/ S5 w% W' B% `/ ]" u4 U6 h# n( B
Method 06
  s& E0 D, y: n  T3 h+ b=========2 |3 I  r1 A8 X* B" w. T5 l$ {

- r, S, W+ I3 n% }6 s0 x/ C" B4 M# F9 V& O# a
2nd method similar to the preceding one but more difficult to detect:+ g5 Q4 I+ Q( @! x( R9 F

2 _1 f, H* U0 n! e: c
$ K/ c* \1 r% N! Q; M/ H+ \& Hint41handler PROC6 ~3 o1 Y3 U- v9 F7 g5 K
    mov     cl,al
( t1 B& Q3 X7 v+ e    iret
7 l+ }/ \( I1 C5 Xint41handler ENDP, p; o, ^% r0 ]5 \, i# \$ J
5 t8 _9 f) v- n
; n$ ]% p. l9 F
    xor     ax,ax
( x! s* d% k! }5 R) @( L0 s    mov     es,ax
4 H+ P8 p2 J5 v/ h* E. Z+ s    mov     bx, cs
. \  e2 A; ^) C9 A3 W    lea     dx, int41handler
; ]) N3 }6 ?! H, b% N6 F    xchg    dx, es:[41h*4]  L( a" [5 B' D- K9 q$ K* l
    xchg    bx, es:[41h*4+2]6 S9 X" U9 Y- k+ b7 N7 l" P
    in      al, 40h' C+ v; i7 o% [' r% z4 \) F
    xor     cx,cx
3 q/ y* ]* F# o4 z3 h, Q    int     41h
+ y" I0 t& n# V! ^& m4 X    xchg    dx, es:[41h*4]1 }3 V1 `: G: l8 \1 m5 _
    xchg    bx, es:[41h*4+2]0 F3 @' d, y' T7 W# v, t
    cmp     cl,al% w# X9 L' S' _
    jnz     SoftICE_detected
4 q* m* L4 N* B1 y4 n3 K
+ M# H) ~% \% C, p% c_________________________________________________________________________
, A/ ]# S2 {, L9 y7 R* F8 B, x1 |2 n+ n7 u" i' j6 O5 u
Method 07
% s  A) W/ B: x1 ^=========/ ?$ W) [% \  ~) L
7 h& {+ T- e' Q, I
Method of detection of the WinICE handler in the int68h (V86); n2 s" H1 p, w, M0 ~8 j* R) E

& g  n4 ?: I/ S3 d    mov     ah,43h& Y+ u  B. c. c2 y2 J, `2 S
    int     68h6 i- a! M1 \; [1 h3 y! D( k
    cmp     ax,0F386h# M& j) }, |0 j, ]- R; x- n
    jz      SoftICE_Detected- }5 d6 }! F6 r0 d$ r
+ `7 b; z" b3 M( w& l
* ]7 h& t) {' J0 f
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 T# D) ?& l5 A, ]   app like this:$ T7 T0 L# Q1 L! X+ s
; N2 d1 G7 b3 F# O( W7 C
   BPX exec_int if ax==68. H6 W! i) w) f& k
   (function called is located at byte ptr [ebp+1Dh] and client eip is
$ U) ]% }8 |2 S3 F4 q+ U   located at [ebp+48h] for 32Bit apps)
- h6 y. H" z- M8 P) u5 P1 K__________________________________________________________________________) V3 d# J& n4 r8 t/ s! T

+ v* q! @' B7 S$ P
9 H7 I, C/ X( FMethod 08
6 W" _- X' n' `* i% J=========9 s& s+ U( f! R0 E: c$ ~4 t& L  ]

4 s9 C1 O# ^2 eIt is not a method of detection of SoftICE but a possibility to crash the" ?3 g' D' s6 [/ C! ^
system by intercepting int 01h and int 03h and redirecting them to another: C% c' J$ I# U3 b" b! p. ^$ S% J
routine.- z+ ^6 b* W  k/ h' o2 Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 |3 q; b5 o; v0 nto the new routine to execute (hangs computer...)
0 K5 `8 H3 O, C, l' D
( B, K. L0 }! d: O7 \    mov     ah, 25h2 f* p, t& ?) L' \' q' p
    mov     al, Int_Number (01h or 03h)3 L% b' S0 w& p9 }" t
    mov     dx, offset New_Int_Routine
1 I, M3 D1 @& x. |9 u+ q    int     21h! n$ ~# Y# H* a9 X6 s6 ^
, L5 {5 w, ~- c3 R6 `
__________________________________________________________________________) Z) C* T5 D0 L1 U1 F3 t5 T/ ?
4 s$ T8 O; T5 d4 n- C* S, y1 f
Method 09
) U6 J& t4 H+ ]6 j=========
3 i- ^$ V# Y* ^5 H( |1 M/ @
! a0 X4 }  w6 H( ?! j, F1 WThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 B' Z; C0 ^2 O+ q
performed in ring0 (VxD or a ring3 app using the VxdCall).7 m" w6 ~( g& m0 Y" {4 |
The Get_DDB service is used to determine whether or not a VxD is installed# [& Z3 U7 d" s
for the specified device and returns a Device Description Block (in ecx) for( @& Z0 k. m; W6 O% M' ^
that device if it is installed.2 p. s9 o! X# a

( B! J2 r( J, M   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ f" n2 ]3 @9 P; o. e9 G8 Q4 T3 @; P   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  r& k+ ^- f) B1 L3 \* m: [5 F# W7 s
   VMMCall Get_DDB
  N7 m$ L5 r+ L+ w7 P! X+ T   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; c( x' o! L! E% v; h& ]3 ]( A; H# o/ A+ Z- b* O1 z, F
Note as well that you can easily detect this method with SoftICE:
% z7 M5 R8 ]+ G   bpx Get_DDB if ax==0202 || ax==7a5fh
" P1 t! ~+ p6 {- @, h1 {' E! G3 F, c% i
__________________________________________________________________________, {  R" k" Z1 F8 Q9 y
6 Y! p5 T5 U, @% p) P
Method 10
7 g) X. }% O8 V8 F$ ^% a( u' F5 L- G=========
" L4 o( d% D6 n. }5 u9 i
* _: J! @4 E; e. a; F9 N8 L( D=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
  ^5 y2 k. k+ f* ~  SoftICE while the option is enable!!# s# A, C; \' v' V+ Z

3 P: U( U! \5 S9 \  W( q' w' E8 R3 TThis trick is very efficient:
$ k) k' W2 S$ `( g4 aby checking the Debug Registers, you can detect if SoftICE is loaded
5 o3 h- u, h9 M- j- J(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ w. X) ^9 I6 \- E9 _5 u% a7 rthere are some memory breakpoints set (dr0 to dr3) simply by reading their
: \8 K2 j2 b4 i$ a8 H% Svalue (in ring0 only). Values can be manipulated and or changed as well- B1 R* R+ H2 e7 k" D- y' G
(clearing BPMs for instance)
" Z$ {& Q, ]; t; E5 w
- D9 P0 Q! A/ u__________________________________________________________________________- n3 Y, S/ M" [2 R

& m4 d$ E# U! ?. H/ bMethod 11! ~" y6 Z6 m7 e3 }3 P9 s
=========
+ y1 H, `  i" E4 t' S% B6 F! M/ f6 x0 F4 k# M
This method is most known as 'MeltICE' because it has been freely distributed+ M, W  V, w  H* q/ q
via www.winfiles.com. However it was first used by NuMega people to allow
& @! l6 Y, j5 o4 U: Y' @Symbol Loader to check if SoftICE was active or not (the code is located/ U# N1 V; \3 M3 }
inside nmtrans.dll).
8 X- N8 u0 T, R3 N0 o" O
! p" i) m; n( ^6 _The way it works is very simple:2 m0 c+ W4 {. e0 E& j. j# |4 O- E
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# v& ]' y  S5 `1 I& BWinNT) with the CreateFileA API.
+ q. ]) |* L" j7 c7 a! v9 z9 o" w( O+ z
Here is a sample (checking for 'SICE'):
4 W1 |! m+ N1 B1 y3 n# C* @: P) Y; U+ _7 ~- V
BOOL IsSoftIce95Loaded(); @) r" l% s- I" ]
{' U$ E" S1 @) c
   HANDLE hFile;  4 s# N1 W$ ^6 M/ D; l% ^% W
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: O3 Y9 G( G% e% ~5 y' a                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 q: e/ k% M! K                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' p  }" C) ~3 J2 z: X0 f" C7 V6 ^   if( hFile != INVALID_HANDLE_VALUE )3 R. ?4 G: h# K( }5 K. u7 p3 O
   {
' h/ M3 C4 Q3 [7 A" K( X% c      CloseHandle(hFile);. C# G* e  J# |
      return TRUE;
: J+ q( m1 h( [: b$ P4 U' z; D: J   }4 g; b" E2 v! Y/ O4 j% \: a$ T; p
   return FALSE;
6 g% p2 S0 P8 p}9 g7 V+ |- T1 l% c% Z0 ^# @
: {/ K6 y! i/ y5 R, q
Although this trick calls the CreateFileA function, don't even expect to be
8 U; [$ W% C7 N6 n8 Z0 G6 gable to intercept it by installing a IFS hook: it will not work, no way!( j* x, D) m: u1 p: |" E8 [# v7 F+ u1 ~
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 o2 v% {+ _& a- v) c5 @, P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( Y8 M. G( B$ j! y
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 j; P, F, z9 J" g# {field.
# @3 U6 I( b: WIn fact, its purpose is not to load/unload VxDs but only to send a , ~! u6 Q7 L3 s/ T0 _, E4 {
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)$ E4 G+ h) [+ m$ R5 e
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
& B* S$ S4 m3 e' o$ Sto load/unload a non-dynamically loadable driver such as SoftICE ;-).
, N' d" l% z5 q! A6 e. }% U6 n4 iIf the VxD is loaded, it will always clear eax and the Carry flag to allow+ P2 @$ M* ]$ i! q: D6 Y+ {
its handle to be opened and then, will be detected.5 R3 t9 X( @% I. v
You can check that simply by hooking Winice.exe control proc entry point
$ b& F. x8 I* u$ W" e, N) L. twhile running MeltICE.: m7 ~& D" d5 q9 l) o) \

) w9 W% W& o2 e$ l7 w
5 B5 q6 `: @5 r3 E1 f. n: M/ x  00401067:  push      00402025    ; \\.\SICE
8 W0 u0 G/ K" f  r1 r8 P3 O  0040106C:  call      CreateFileA' ?, n$ C% s1 J6 f: j: X* c
  00401071:  cmp       eax,-0017 n9 Y* k3 E. [9 p& I! k# a5 p/ `
  00401074:  je        00401091: a. K. y* b9 b4 f! U! X7 F

3 j; G4 s6 V# D$ X% R; Y$ c! e
* y9 q7 o/ B6 NThere could be hundreds of BPX you could use to detect this trick.' a" m( i; s4 Z, T9 _4 N" h) ^0 e
-The most classical one is:$ w6 X, P# o+ _* B. q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% f) S/ y' |& ?) Q4 ]+ N    *(esp-&gt;4+4)=='NTIC'& q: a4 L0 i- T8 t" b# L6 u

% |( e1 t9 X$ U-The most exotic ones (could be very slooooow :-($ A; P6 |' s4 T1 b. O
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 q6 ~- i- ~. l& u
     ;will break 3 times :-(
) I. W* y+ K4 R2 f4 H$ n; L
1 A7 C9 f1 C5 R, T0 @- H! p/ S-or (a bit) faster:
" [' S$ P6 y$ m   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" q; e1 `, Q6 H: I7 _
$ b$ d, _( U: a* @! C. Q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / f7 k( S. Q# m8 s2 L
     ;will break 3 times :-(
% Z6 X( z5 K2 ~/ ?, I/ j: Q# `6 l! _0 i- {  u1 l
-Much faster:
  {4 R  ^4 X: q  M6 w, p4 D. M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'- c  ?+ B! w  E6 P& c" T

5 a: w6 `$ L/ ~2 q1 c! \Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* l$ R0 o1 k) z5 W) yfunction to do the same job:; Y" E, E2 ~5 w2 C/ `2 H, z4 \0 B, I
2 `1 d) t; `, K! ?! b5 b
   push    00                        ; OF_READ* Q4 ^" [' M7 I7 ~9 G. {( f  V
   mov     eax,[00656634]            ; '\\.\SICE',0* z8 |+ T; Z+ ?
   push    eax
) F/ b% c* n5 }   call    KERNEL32!_lopen# {# u+ n5 Z( N% o6 ~) D
   inc     eax
2 x& M; c# p, J( ?, E2 U% Q7 s   jnz     00650589                  ; detected
/ ]0 ]: L6 X" H3 E* n. L0 v( K4 @) V   push    00                        ; OF_READ5 a  p$ V) U7 h1 h- W2 u
   mov     eax,[00656638]            ; '\\.\SICE'
/ u. b5 x+ v( B; \   push    eax
3 ?* {6 B. v+ d; {/ d   call    KERNEL32!_lopen
7 }/ R3 I5 R5 Y" e- K" q3 R& F   inc     eax
4 J) I- W  F5 V   jz      006505ae                  ; not detected" s: z7 q- _9 `9 k) O

  z. E5 _, ]1 \; L' @
& d4 [9 e" T8 D__________________________________________________________________________
2 f& ]; A/ h$ M" b* h  m! t! N. ^- m
Method 12
( `+ W" G8 q" L* i* |9 m=========
; F' C/ h6 r" T- T. v/ C& t4 A% \' k3 w! X( g
This trick is similar to int41h/4fh Debugger installation check (code 050 [2 q7 E5 ^2 D3 j( A
&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 O& |& W( ?1 z- t" t0 H
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.8 M# c: ~4 Y* M) d. i

2 E2 d" r/ ~5 E% X! U: p   push  0000004fh         ; function 4fh. G0 `/ \2 Q8 Y* N& i5 p, a
   push  002a002ah         ; high word specifies which VxD (VWIN32)! R# |: F# i7 Y) F5 O" q
                           ; low word specifies which service, k( V8 Q7 O+ D
                             (VWIN32_Int41Dispatch)6 H, [2 d( x7 Z6 u: R7 ^9 G! e
   call  Kernel32!ORD_001  ; VxdCall/ f9 M+ f: f- C+ e+ ], l; G9 S
   cmp   ax, 0f386h        ; magic number returned by system debuggers" r  I0 K, M3 H- p' q* l3 Q
   jz    SoftICE_detected+ d0 d$ J- |1 \6 c0 A$ M! p
+ y3 k0 c8 ]4 {! m! l
Here again, several ways to detect it:; y, T" w$ v" y

/ ^+ L8 ~, H$ g; i( b4 D. y    BPINT 41 if ax==4f
1 @5 V$ q) S& V) |# d1 v, g, ?: r6 u7 t0 m
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 F. m; y+ I" z$ b3 N% w2 r7 w
! M) F. y8 T0 G" ]: y. w! b3 E    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 O6 i7 c$ P1 x' I! W0 G: X
, Y2 I2 \/ B& A1 q: g
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
9 N5 B2 l; F6 P3 X2 y( Q' s. [0 J
__________________________________________________________________________
) Q* P1 L+ N9 Z4 ~# S* A- |% u: b
& ]' U% o3 Z! I: \Method 13, F, C# z3 R5 V& c
=========' G" ^" F, q! U$ m& {: Y
+ z/ o$ D; X, J4 C2 {4 E
Not a real method of detection, but a good way to know if SoftICE is4 T+ |8 R0 Z3 o+ D, V
installed on a computer and to locate its installation directory.  B% W" m" s3 X: f" |0 y( P" m4 N! p
It is used by few softs which access the following registry keys (usually #2) :- |" o& v% e; o% i
8 v: ~8 N' y0 _: v; B
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# a) {7 @$ Y) D  M, w- Q, p\Uninstall\SoftICE
6 M) B) n6 M0 S1 b; ^: B* ?-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ [& Z5 V. e5 w8 _' }& G% M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% s- e/ J% ~9 ]$ W% H- T) c\App Paths\Loader32.Exe5 W1 d: }+ F+ h  j2 [

( o# U# m3 Y4 r" q/ Z4 ?  t
3 X4 Z: O7 ?& a/ F8 W& CNote that some nasty apps could then erase all files from SoftICE directory% n/ ~; w4 |% M5 i
(I faced that once :-(5 v0 q/ B* {1 b) s5 w
! |6 a* w* m9 _" ?3 S, R7 W
Useful breakpoint to detect it:8 E, \) v: w' ]2 ~0 E7 I9 G

% V2 A; t. V' G7 c3 R7 r' K$ u     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 _* _1 y6 U: q9 @& u
  v' Z# S) w7 K, G6 ?__________________________________________________________________________) H0 z% }) N" y0 I, |  V( p

) O' t2 R9 J  O7 w" @
$ \' x: T0 Q" C8 U% TMethod 14
8 b  Y2 b& `( @4 k0 L& r# J=========9 a/ `+ Q2 g% I( H: o  L& ]

' Z- \0 D' w2 ?% F/ L. B4 XA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* I0 ?2 w: l6 a/ p2 k/ Tis to determines whether a debugger is running on your system (ring0 only).
" N- e% g7 l' a7 i( {- c3 h4 d3 l# o
   VMMCall Test_Debug_Installed3 g8 j5 q4 m1 _8 k* Q; [- g* `
   je      not_installed9 e4 i7 o' v7 B* o  }" O* G2 g

# Y7 R5 t6 ~& N5 z/ mThis service just checks a flag.
% N& ^7 Q8 I9 ?  w, R1 a</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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