About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. Y6 S* ]1 ~" g) y3 D  f) F
<TBODY>3 r  D. V: U' H$ K: }
<TR>& H2 w  _6 O* `4 \0 v
<TD><PRE>Method 01 1 j( f" j) _; ^. t1 c& \
=========! r8 _" w! s$ h" G& _+ l2 N& L6 C
1 M8 T; ~' F* c/ P' f0 Q: E& j9 F: y
This method of detection of SoftICE (as well as the following one) is
: e8 Y+ d4 Z( U" E  wused by the majority of packers/encryptors found on Internet.
1 `  Y0 O; }% @It seeks the signature of BoundsChecker in SoftICE
3 ]; [0 W. _/ k
; I+ b( _8 @* x    mov     ebp, 04243484Bh        ; 'BCHK'
) p# Z; b9 @: H: z" w. l$ _    mov     ax, 04h. L* T1 k: C# z& j
    int     3       ' F: ]# X. y& R7 \7 T# H1 R
    cmp     al,4
/ U4 \& u6 m" b/ [    jnz     SoftICE_Detected
* V$ t* h$ h5 x5 _/ H- o: h$ j
  Q# {) [' L9 [& V- |' R7 a___________________________________________________________________________3 f. e. H# S4 ~% O( S9 N3 n9 S$ x; X
% }7 O) Y7 c1 e  @' y
Method 02
% N9 Q. R+ }1 I; \=========6 y% `- P: J! t0 ~: M+ q$ T
' _  R5 I9 d( x4 p1 _
Still a method very much used (perhaps the most frequent one).  It is used8 {0 ~# B' K" p
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
' i1 B. [  }; G+ Vor execute SoftICE commands...7 }  z( \0 @# d7 L
It is also used to crash SoftICE and to force it to execute any commands$ p, P+ J: l" v1 K# p
(HBOOT...) :-((  
! E" S; j* k  {/ N
9 O% Q. H, h( QHere is a quick description:. Z& c( d; O" A) o2 q& u# g
-AX = 0910h   (Display string in SIce windows): n) X0 g. S& p
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); U  F7 r* c- E+ Z) G; u; F
-AX = 0912h   (Get breakpoint infos)
7 {1 g( k% K% D2 O; a6 t-AX = 0913h   (Set Sice breakpoints)
5 \# P: J* q. V/ S" }' o-AX = 0914h   (Remove SIce breakoints)
0 Z# }5 n2 M, S' w/ R7 Z! V& i; Y7 }. {& j( Q
Each time you'll meet this trick, you'll see:+ e, R6 w/ v! Z9 s& m) ~; L2 V
-SI = 4647h
5 D& ^* g& Q1 `& D- z: C; t3 j-DI = 4A4Dh; y% ], r; N5 j' e3 F+ b
Which are the 'magic values' used by SoftIce.
$ c6 `4 N# J' B4 ^( C0 gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 u; `/ h9 t  g$ J0 D# ?) _% G0 g- R5 I7 n- B/ q5 b: T
Here is one example from the file "Haspinst.exe" which is the dongle HASP$ I1 L' T. J! [3 {
Envelope utility use to protect DOS applications:
1 I, e. V! y( M$ F4 m
3 ~0 x  N* Z9 `% x% R) w% J
) M+ l0 d+ e( H) k, ~4C19:0095   MOV    AX,0911  ; execute command.
$ _' g) h4 v" ~* h, n; r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! c! _$ ?# G/ j9 k; x* G6 w4C19:009A   MOV    SI,4647  ; 1st magic value.& j( z) z1 ]) m% n2 q% N8 [
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.& c8 S/ T* i. G' c
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  l% \- N. Q* Y% j- s' l4 i
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: ]" u( {' V/ N2 ^: v0 R/ x4 z3 @
4C19:00A4   INC    CX
. b) h5 f) m: s, s/ t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' e3 Q- A7 W6 l% X* T% n( o0 m
4C19:00A8   JB     0095     ; 6 different commands.
# O! y8 b. u2 b* Q) X% y5 x8 U4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, a9 ~  p$ q# f6 _4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 B+ c1 a+ _& c/ q( I- n3 N1 B/ v" U: v$ t+ b1 b5 v- O1 p- H  U
The program will execute 6 different SIce commands located at ds:dx, which, v( {' ~  U) S: w% s
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
. z3 w  j* j! j0 [4 F# z+ ^' R" J# x. i% e- k
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* \4 y* B9 {& I& `; f6 p- C
___________________________________________________________________________
! J' \# U, k" G! e+ h1 b4 E
; r, ?+ |& [3 N, |
9 Y3 D: M" A- ^, \Method 03/ }7 s$ n5 ]# O7 B1 ?3 m; u# Q
=========
# N4 F$ |' S, \' l/ t& y0 r; n9 `9 S
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  V, J- v' D# [9 L* `1 n
(API Get entry point)5 C9 G+ ~0 _1 Y* j5 l* G+ Y, b
        
2 [4 ^' R- @$ |5 [* p; E' o9 Q; ]& {2 N8 r! L) R
    xor     di,di
5 R/ Y% d% ]' D3 q8 P/ a    mov     es,di5 i) u0 v* n1 y3 r0 g
    mov     ax, 1684h      
9 h# R& s" e, a% k' |    mov     bx, 0202h       ; VxD ID of winice. @7 D* {4 L" ?4 x$ P
    int     2Fh
, _) V/ j; J% D) v    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ T4 X0 w" @' [5 S: D    add     ax, di- X2 ~" m# v% x! k  c8 U# r# x
    test    ax,ax& m8 L3 U) F$ [0 J7 \
    jnz     SoftICE_Detected
% _* n+ c, _  o
7 O! e0 T- |# j0 o- y! z$ {2 I3 |___________________________________________________________________________$ ^8 }0 j# Y6 `$ e( N! z+ y

- c4 ~7 j% r) K9 J6 Y. d! UMethod 04
1 o9 [! {& [  a: U& z0 P! j=========
& _. J& x1 J! x! U- K, ]. u9 N
% C. Z3 x/ ?2 k6 {% Z( _Method identical to the preceding one except that it seeks the ID of SoftICE
* D6 G& ]# D) X: _GFX VxD.
3 [7 n, X, ?6 s8 k7 ]8 f3 d% r' p
$ @) B5 w9 g3 J- g8 I5 D  h  f    xor     di,di& p  C  p4 s9 R! P- d  B/ B' p- @
    mov     es,di! s% z% E' C' M2 p5 j0 k0 t
    mov     ax, 1684h       6 |& p  _+ \0 Y' V: i, L* e* V" B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ G: m% ~$ I8 n& a  n. O" r
    int     2fh
2 F+ n8 [5 F0 P/ i/ |! m    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 S: h& Y  ^0 V2 K4 z    add     ax, di; v3 A* _+ v; A( I
    test    ax,ax
5 K& X6 N6 c% p. f3 _+ Z    jnz     SoftICE_Detected  A7 a& }8 a! `7 a0 H* n' w1 o* \* X
: |+ G3 l" A/ L6 W) Y" S5 j  b
__________________________________________________________________________
' `: j0 [1 d* b1 ?6 N2 t" F9 i9 A# ^8 U; P' I# d

$ A) U! Z% ~! U! {6 z6 gMethod 05
& H+ z! p2 h( C" ~! Y1 t=========
- O% l' {2 K5 n" N0 S8 p$ e' [& g, @
) W8 a* S2 c% |% {Method seeking the 'magic number' 0F386h returned (in ax) by all system
. _% {5 ?8 N3 L; E7 \# I9 ?  wdebugger. It calls the int 41h, function 4Fh.) |! [% ^' m% g6 _! c" _! w2 [
There are several alternatives.  2 n) C3 Q0 q( Z
0 Y) W8 d# V* ]$ Z; H
The following one is the simplest:
7 k: m: e+ A" {+ f4 D7 _/ M! I, P9 R; p2 s- N5 R
    mov     ax,4fh3 E9 q# s/ u) h6 h) n
    int     41h3 y# T( D; K2 k  ?& y# t
    cmp     ax, 0F386
; b  V* N/ D; J' n" i# c    jz      SoftICE_detected
% v( x" y! x: ?8 E3 L& g0 |- G) P' y

9 [' G8 U% c" s$ E4 G+ zNext method as well as the following one are 2 examples from Stone's ' l0 v0 G' @3 G: J7 r% x% a
"stn-wid.zip" (www.cracking.net):
7 ], T7 z/ }: I* ?; v( n1 g% e/ a: z2 h& \" |3 _
    mov     bx, cs+ B+ n% b( Z! ]1 H$ Z
    lea     dx, int41handler27 M; f% r, K9 s( f  K
    xchg    dx, es:[41h*4]
' u" j0 {- A1 S" g    xchg    bx, es:[41h*4+2]1 \# X8 Y! H+ p( [) g
    mov     ax,4fh
( a0 N  E: t; G/ f4 f+ l7 }" O    int     41h7 I1 S$ X9 G/ o* F8 F' U+ {
    xchg    dx, es:[41h*4]
9 R5 D2 s7 T9 M! ?6 }* ~1 J& B+ z, j    xchg    bx, es:[41h*4+2]5 |1 `! C! l# R- g, q& a1 z
    cmp     ax, 0f386h
6 E  v1 I+ `4 N    jz      SoftICE_detected
8 Z9 r  }# ?$ m
( H2 q# }9 H, @2 T. `int41handler2 PROC" l8 ?! W6 H- j  o7 ?
    iret, }. A8 C9 q' a8 I  ?7 X0 T
int41handler2 ENDP
2 s: @: ]4 D0 F: Q# A7 K# n) u; q2 b! D, p4 d

# t2 `3 j7 s, }& y+ Y: `9 L: `# h0 k  G: q_________________________________________________________________________
0 w' W" y' Y4 w+ i( `% J* {, ]! e7 v
5 p7 M8 v' \% A( i
Method 06
$ @, K/ Z3 B4 W- Z( ?=========  x: a1 F! e9 U( T  l9 U' a
+ J0 s  w4 f" s

: J) ^% N  u: K& e% z. L2nd method similar to the preceding one but more difficult to detect:) @/ u. m% S1 ?& u
% ?0 c, Q1 B7 L# p. E* r! F4 f
) n& c% b1 b  r- V6 }
int41handler PROC
9 a# Z+ Q, ~/ O  ?3 n4 B7 v    mov     cl,al
8 V) g( r6 H2 o0 i( a    iret
1 n  n$ c: `2 h9 ]int41handler ENDP: Q* Q- X) p; n1 L: e* K' u' x
3 `. _/ {; z1 e) ]. b
* u, N: \+ f+ G7 `
    xor     ax,ax
# @- ^1 G" @& Y; Q    mov     es,ax) T% y) c. l# m; a! ~: s0 I2 ?
    mov     bx, cs. n3 a+ ]: @# k) Y" K: T: @; \6 u
    lea     dx, int41handler
7 E, I$ K3 W2 R: o# z8 y' s1 r7 Q    xchg    dx, es:[41h*4]
( g4 r5 `4 S7 M+ a, o; ?' i    xchg    bx, es:[41h*4+2]) O7 J- o: a9 ?5 r" w
    in      al, 40h7 ^' ^% j0 v3 w' k8 |
    xor     cx,cx6 e7 h( W! O. B* M
    int     41h* l4 Z. H4 {2 p6 S3 h
    xchg    dx, es:[41h*4]0 r# q0 ^, Y+ S4 k. p! F! R
    xchg    bx, es:[41h*4+2]' x, i3 \7 H0 i
    cmp     cl,al6 N0 Z% L- h0 Y# C$ Q) ?8 D8 X  o
    jnz     SoftICE_detected
1 V; M# M2 B- A2 R, c+ t  I9 K
" P6 l! G( G! s' h& U% f( H_________________________________________________________________________
+ ^) W8 P9 m; v$ ], `" N/ L! z+ [, x$ B1 p9 _& J
Method 07
3 v% `( \. r0 R. O( B+ ]# p  i=========
0 I8 d: b" a. [4 X. i/ Z
$ l4 _( H" P! NMethod of detection of the WinICE handler in the int68h (V86)
% `$ @/ v6 _2 f8 [
! T9 [/ p4 I. A9 s" X9 o    mov     ah,43h
; K1 B+ v  i  a/ G, Y; J    int     68h
$ ]: s' a% P. Y; [    cmp     ax,0F386h
$ x, c; k5 w3 ^    jz      SoftICE_Detected8 m2 M. A, y$ b1 p0 J

0 u8 K. \1 r+ J) f# d
" L/ C3 m1 m/ Y3 ~=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit7 E! H2 {1 Z% }' f# m. [" j# m
   app like this:
1 e8 F, u" f: }( B. A" U: f- @' g  c+ R
   BPX exec_int if ax==682 h8 P7 J. B  X) g+ F/ _* @
   (function called is located at byte ptr [ebp+1Dh] and client eip is1 ~9 m4 r: I! {0 B" Q1 c" H, ?. ^
   located at [ebp+48h] for 32Bit apps)
; A0 W2 x+ S0 z3 b/ d" M; r: p3 K__________________________________________________________________________
' ?5 d& y' X; d+ u1 K* ]* ~$ D3 {. I4 `6 g# g: d% i/ L2 K

, T8 ~$ `) x  O; C* f$ JMethod 08
3 ?8 K& [% d5 G7 q+ [) A. N=========
1 S- a2 U9 o& G8 A6 G
* {& o4 V6 n$ H, v3 t7 xIt is not a method of detection of SoftICE but a possibility to crash the+ n! q  I8 b! c& K5 u) ]0 W& O
system by intercepting int 01h and int 03h and redirecting them to another+ W4 Z4 C* P4 Y/ s* {
routine.2 F' _9 V# e' T1 a5 ^, B
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, L8 N, n7 p4 P' @" |) b8 ~
to the new routine to execute (hangs computer...)$ D( R' ?* n8 l; z1 ^7 M: i6 s

! Z3 G6 M: [4 a8 `- ?  \. ~4 b    mov     ah, 25h. c& ^, m% ]8 L" P
    mov     al, Int_Number (01h or 03h)
% a# R4 h2 y1 G  f( P! v7 }    mov     dx, offset New_Int_Routine3 m- i" _4 p7 c" ~
    int     21h" \* a' R) t( Z6 H" _; Y+ r/ R9 r

, y% L2 D4 n$ L- E6 f: e__________________________________________________________________________
' ?3 v, N% a$ [' w5 L) E. `
/ U  N: l1 W3 Y+ d* d$ v& _Method 09
, _* p+ E, _" M=========0 Z( E0 Z, n! G6 W' H  w( E6 U' a
1 D  l; w0 u* V) }$ p+ n: I
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
7 ~: v* u# F' f9 Z" [4 ~6 I* {. iperformed in ring0 (VxD or a ring3 app using the VxdCall).
4 x( I- c1 H1 @$ [# `! V$ uThe Get_DDB service is used to determine whether or not a VxD is installed
" v! X! O  d2 a* O  Q/ `for the specified device and returns a Device Description Block (in ecx) for* S$ {2 D' E/ H& E
that device if it is installed.- p3 m# \8 g6 M: C+ X9 d+ g
7 D% @/ J' _. D1 g
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 Q2 s5 h4 ?, F9 E% d3 {   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 @+ o& _' S& v2 G  \
   VMMCall Get_DDB
! E3 r4 Y: [3 h* \* c9 A# @, M5 W0 z. j   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 e; }5 c7 H6 n$ ~( X  E

7 ~- @2 u( b1 ?8 Q& P: y; tNote as well that you can easily detect this method with SoftICE:4 H7 U2 J, u- ?
   bpx Get_DDB if ax==0202 || ax==7a5fh
, W2 o- U2 B' ]. ~# t0 {  x8 @3 d7 y+ i5 p2 ^
__________________________________________________________________________
: m- n6 B: Y2 `" x
/ j0 G9 p% ^1 Y( n/ H3 U, ]Method 10) H1 A, n  }, k) I6 `
=========
* I6 k- W3 y5 O6 J7 F/ U3 l6 G1 w0 F, V" H+ L6 z
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 k5 f1 T; b$ l' m: B
  SoftICE while the option is enable!!
; w- o7 f" l/ i
7 U5 g1 q3 r& n0 f: K* i  W1 q; yThis trick is very efficient:
* N( b8 ^- X7 x6 o2 p, a6 ~/ xby checking the Debug Registers, you can detect if SoftICE is loaded
8 l  s0 F0 D8 [# _(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if  a" D% K# j/ ~/ y: N! d. T0 }3 d9 s
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 P: y/ [: `9 |0 Z2 I1 Z' }
value (in ring0 only). Values can be manipulated and or changed as well" k& M4 L+ _9 B# k0 ]- h
(clearing BPMs for instance)
" x$ m4 T: Y. L8 Q' A; A9 \: Z+ v* e% _1 E! L" [, S7 c
__________________________________________________________________________
9 o2 ~4 Z3 Y- o$ J, o4 Z& o# c: F& P
Method 11
4 s4 ~! d, z# P=========
: _/ W: I7 ^; f0 M: }. m2 M! z% p9 r! p
This method is most known as 'MeltICE' because it has been freely distributed
+ Z2 @- p/ [3 ^& O6 Cvia www.winfiles.com. However it was first used by NuMega people to allow
8 Z" T- p; D& s$ b2 {Symbol Loader to check if SoftICE was active or not (the code is located
: {& u/ |+ O, h1 `8 ^% i' Einside nmtrans.dll).  G/ W4 q* A" }; ?7 A( J- p! a, m
# M- ]+ I% g5 Z- y
The way it works is very simple:
0 C: r- g) l& I9 T: @It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* g. }& Z% Y; |3 w7 ?' SWinNT) with the CreateFileA API.
" ], E  @9 a8 }8 H' d: }( |7 s) |$ f& V% @+ B
Here is a sample (checking for 'SICE'):' `( N3 e4 ]1 m) f* e  t, v

. P) w6 E$ Q: hBOOL IsSoftIce95Loaded()0 @$ C! I, N! Q, k7 m, ^, p
{
5 I, Y" r) g1 W1 H% f! K; R   HANDLE hFile;  
6 R0 u6 _. z- {! p8 `# `   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) G% e% [1 g, x  k! A+ {( @2 n: X
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 @+ x8 |8 B! q5 g1 v  [8 A; S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 D& [$ w) W9 p) O6 {   if( hFile != INVALID_HANDLE_VALUE )3 o. m! l/ F0 |4 }6 [7 c
   {
3 D3 V: W' ~& r: d4 E6 f& H+ b      CloseHandle(hFile);
( ?4 @# Q0 l1 a3 }7 \' A      return TRUE;4 x7 e# Z1 B8 H  J1 m
   }6 |" Y; a% _" ~1 ~5 H$ B4 i
   return FALSE;3 D9 f# k0 M" Y- C
}, u, ?: ^; u3 A. H; A
8 ^: V9 z4 S! [; I: D1 k( c+ v
Although this trick calls the CreateFileA function, don't even expect to be
" E3 o& _9 R. s4 |* @6 jable to intercept it by installing a IFS hook: it will not work, no way!9 i' C3 _) @# M
In fact, after the call to CreateFileA it will get through VWIN32 0x001F* A3 ~% x& w& R" B) M$ M
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( M7 f1 Y; ?' l: J' B" k
and then browse the DDB list until it find the VxD and its DDB_Control_Proc" R' T9 G) N0 Q- i, R3 {2 }' O
field.
- j; H: o! _( G( x) IIn fact, its purpose is not to load/unload VxDs but only to send a
0 p  k" x  I( s# s3 [W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" P" d6 \! y& h$ E2 L8 x
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ a% |5 V1 f+ p3 Mto load/unload a non-dynamically loadable driver such as SoftICE ;-).. Y: I* a0 [: F
If the VxD is loaded, it will always clear eax and the Carry flag to allow" ^  z& f0 ^+ k9 w" c8 P2 N+ v7 a5 _
its handle to be opened and then, will be detected.
( h3 v; N0 b/ w* zYou can check that simply by hooking Winice.exe control proc entry point
7 B3 Y+ Q: {# h2 ?+ v. @while running MeltICE.
: s- c8 G1 v# A0 q& e7 X) H, I. a6 a& Y9 I/ ~! I$ Y' O

4 K: [8 c% j3 J. {6 @" \, Z  00401067:  push      00402025    ; \\.\SICE6 A! G( W+ ^7 Q+ A$ r4 k: g
  0040106C:  call      CreateFileA% J5 ]: }( r" a% ?) R; i
  00401071:  cmp       eax,-001( h& r; _" e4 E! l( Z2 k/ L
  00401074:  je        00401091" _+ [( ^$ Q" `- @

# q6 I3 C8 P2 Q0 }, K: Q4 k4 N
There could be hundreds of BPX you could use to detect this trick.* Y* M  E, b; a
-The most classical one is:: d( q; O0 O7 t* R+ E& v
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% {4 V6 e0 {; G% D- i  _: o
    *(esp-&gt;4+4)=='NTIC'
1 P% o  G3 o6 d) D  i8 C7 f4 E! i6 L
-The most exotic ones (could be very slooooow :-(
5 \' }, l( @1 ~$ H+ P" u& Z! C  L   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; I. u, Y. u) Q, ~     ;will break 3 times :-(
: h* S: r, x' ~: w% h# {0 _  n8 V, T1 E8 v% P  ^
-or (a bit) faster:
  o. {3 A+ ]5 h) L   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ l/ P! c* K" C) P$ k8 J5 @( b" q$ w' `
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& k4 p. v! w# n     ;will break 3 times :-(2 i; q% M7 }3 ]5 b4 H/ R

0 o4 u' ^; Z. j9 n6 p) L6 s6 N-Much faster:
/ Y9 n# F7 C; I  E   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. n0 c5 e' J# P: l  \% ^7 A. p* \; ]% T( w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen7 Q' U5 @- K8 q5 p4 K% O- m) {
function to do the same job:8 |5 ^) H" H  l' u$ F# n

9 A  {& y7 K( O; B' S5 X0 E. b5 I   push    00                        ; OF_READ8 ~5 E& u0 s) {& G- N
   mov     eax,[00656634]            ; '\\.\SICE',00 o& V8 \" P0 L& _8 P4 \
   push    eax
6 ]8 G8 b+ l. q   call    KERNEL32!_lopen/ ~* x' ^, u  W0 S, z; v
   inc     eax0 E  a' x, K+ }2 s- e/ A
   jnz     00650589                  ; detected
' q+ l- t& k8 s   push    00                        ; OF_READ) h% J6 R0 c' }1 ?+ |" J6 [
   mov     eax,[00656638]            ; '\\.\SICE'
% W* ]% T9 v4 r( T. @6 `4 e6 y   push    eax
* s% o3 C) u  [1 ?   call    KERNEL32!_lopen
" A4 I% I2 m. V! b9 V1 ^   inc     eax/ _6 p5 s! M% P6 y; h1 V7 l
   jz      006505ae                  ; not detected8 T! B( B1 m, d0 Q  Y/ ]; M; \

2 B/ C0 z  Z2 v* W* N4 ^% K! ]
0 m/ C5 d* {$ p$ p__________________________________________________________________________
! G- Y% j9 M3 ?/ |( }
* @/ _: r3 @% u8 l& q9 U( S3 @Method 12
! _: |% i$ y+ ~$ h& k# B9 w=========
7 d; Q- ]) s# i9 z$ l9 ~4 ~, f$ z( _; A9 h5 o/ I) I- L
This trick is similar to int41h/4fh Debugger installation check (code 05' k$ M: p0 d+ ^+ i' p: P6 L
&amp; 06) but very limited because it's only available for Win95/98 (not NT)- Y' n& q0 Q6 g5 |# B9 p; H
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.6 T7 z! T; C  f/ C9 V5 u

4 y7 G' Q4 x  a! J- X; y   push  0000004fh         ; function 4fh# O( m. K, S9 F' Y' J; ~& C8 W
   push  002a002ah         ; high word specifies which VxD (VWIN32)$ p, ^) \$ W- f! ]
                           ; low word specifies which service( y, N7 N7 j' [; z0 h
                             (VWIN32_Int41Dispatch)3 c4 d1 H/ W$ {$ i( s6 P+ _* I
   call  Kernel32!ORD_001  ; VxdCall1 P0 I7 |" ^+ n7 o& t4 o
   cmp   ax, 0f386h        ; magic number returned by system debuggers- i6 Y5 z6 Z2 i( c2 N5 ^
   jz    SoftICE_detected0 r; S* ]3 m) ]
: z9 w/ Z5 r2 Z( |( J4 d! V
Here again, several ways to detect it:; a" S; `/ H( j+ m: M

& P/ T  ]1 M0 d2 }5 f2 h    BPINT 41 if ax==4f; y) A$ x5 Y+ f0 U  G5 {9 K% v

! R5 S3 e9 Q& o- T; p2 ~    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& H' b) E% @" l6 y; p4 o$ E+ I+ ^$ a  w( y
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& ^( S% M" k; E0 r7 s! D! E

& [( l, d/ @+ A9 P- k    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 v7 n5 v7 _; H' ?- ]

* Z$ B) H& \2 x__________________________________________________________________________
2 f; b% I/ @6 w* e1 k' d3 ^2 k0 K
Method 13
: v+ e% X: }% D: A1 e=========: m3 p' D8 ^% ^

* x- T! W9 {" w( K, QNot a real method of detection, but a good way to know if SoftICE is2 ~: G- E- L; p3 K& |+ m) i3 b
installed on a computer and to locate its installation directory." Y/ y; C+ i1 P; _7 H
It is used by few softs which access the following registry keys (usually #2) :5 I" M; t" H# t
% \8 [0 M. l! E& k* ]# |! h
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) p: [4 [# G4 V3 G; |\Uninstall\SoftICE. o: V; X! J$ ?0 w+ E
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 a# @$ M  b# O% y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) a8 }0 S5 r( G* w' U1 c
\App Paths\Loader32.Exe, G  m; N9 @# p' W: K& f+ v
: U9 _7 P' S) V) D: Z4 _8 M; R
7 r1 C+ }- U0 r6 l
Note that some nasty apps could then erase all files from SoftICE directory" a: X2 B3 |; [# y% y; Z
(I faced that once :-(
2 ~5 C2 D9 P2 J. F
0 L! S! g7 D2 R# tUseful breakpoint to detect it:
. A1 ?# V7 }/ x* F% @# b8 ^: r3 t+ D7 d/ V0 ?7 Z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ `/ l  T* H" y" t# l: k' S% \5 a/ Q2 M7 }7 H  x+ ?: a
__________________________________________________________________________) c( q% L, I, u3 l' D) X$ C3 a

( d8 q8 d5 j5 L* w- t6 U% n+ P7 f3 T* Q+ n- \+ x3 P! b/ j+ {0 A
Method 14 6 r/ ?! z# E8 P0 m( T, [7 _7 U; C/ g
=========
8 A; U# Y7 }8 J& Q& y- n; [; E4 G
( i2 l- {" k5 W; `1 ~+ v9 AA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 v( n% P) |. [' r5 x; h2 e" t/ iis to determines whether a debugger is running on your system (ring0 only).
6 W5 g6 }; s) ?+ b2 _% q9 S7 u% ?4 ^# V: ~9 X, y- Y& \
   VMMCall Test_Debug_Installed
* Y5 j, u( z3 M- w   je      not_installed$ K! S2 D" m$ q+ |: N! R1 |
3 R/ Z0 i1 ?; B4 x* j* ?
This service just checks a flag.0 s8 @0 a3 z: ]4 E) k
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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