About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 d3 H# M- M0 I1 q" m3 z7 [<TBODY>
0 G, V7 ~5 d+ S# |1 _# Q<TR>
* V, f3 ?- M; |<TD><PRE>Method 01
1 o; S  W) D/ x8 f9 y* u5 K0 ?=========
7 B6 U$ N6 v2 o$ _7 u' c+ V, {
- \" O% Z) G# [0 ]0 uThis method of detection of SoftICE (as well as the following one) is
6 O& B$ I! o0 l: o3 H" Oused by the majority of packers/encryptors found on Internet.
  m$ A3 w) y8 h% k/ T- RIt seeks the signature of BoundsChecker in SoftICE  U& ~0 q+ c0 d3 {' ~1 d0 i9 k5 Y0 Q

0 {8 t" L. E1 R! e- j9 e    mov     ebp, 04243484Bh        ; 'BCHK'$ K! B: |. C, f% G
    mov     ax, 04h
, P& K, r1 x' {    int     3         U3 L; [" X8 q5 H0 J$ w% {
    cmp     al,4
; F( A) b# U6 K6 I  Y" l2 {+ s    jnz     SoftICE_Detected
2 T; O! d4 N3 D! j: j5 n9 W0 C0 A: |% P
___________________________________________________________________________- l7 {, ?) U: x: O& e
  ~0 W7 o5 s  I* O" X
Method 02
8 o# U2 M- G2 {, V. q=========
9 m0 k0 x+ _% \
) _) F6 n0 O1 j% N$ cStill a method very much used (perhaps the most frequent one).  It is used+ M' O. I/ h5 V  A5 O) z1 h- F
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,) t) r" g* B( K7 ?: U
or execute SoftICE commands...$ ]7 d; Q. V' m( F+ l' p4 Z
It is also used to crash SoftICE and to force it to execute any commands
: g) l1 G" I9 W+ G* [& F2 \(HBOOT...) :-((  7 B7 s' z$ |4 h2 E/ m( N) R

1 |2 s* [$ o4 z+ R# hHere is a quick description:" b' A/ u- z5 H* z  r7 L
-AX = 0910h   (Display string in SIce windows)3 V. Q, M% i: r2 e/ {
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" W9 b+ j% B: T
-AX = 0912h   (Get breakpoint infos)
, j$ n& V- V/ i/ R! M& p# Z-AX = 0913h   (Set Sice breakpoints)
  s! W) F& w5 i8 |& `! k-AX = 0914h   (Remove SIce breakoints)/ [) F5 g& P# n5 I/ G. L1 E1 D
! D0 }7 o) b1 S3 k/ x5 v( U
Each time you'll meet this trick, you'll see:
' n, a6 l5 z" R+ K* {3 K-SI = 4647h
6 `# i, T& ^' l-DI = 4A4Dh
" H  R2 x1 i; kWhich are the 'magic values' used by SoftIce.8 d3 H; ~9 D% q, e, d
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& T) V' N, j3 J2 L  Z5 S3 \; y. V) ?/ Y) m
Here is one example from the file "Haspinst.exe" which is the dongle HASP
4 d  h# l, H! dEnvelope utility use to protect DOS applications:
! a1 A& Z2 z6 ~" V& _8 b& G7 X( x" j9 f* U+ k- X$ h. @- ]% S* E0 [
2 M. Y  u. _2 H0 G
4C19:0095   MOV    AX,0911  ; execute command.8 M# l' G4 a. |5 D0 w9 t  A
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." l7 g0 d* S& k# x
4C19:009A   MOV    SI,4647  ; 1st magic value.  K; l. s! f! A* @( s: X
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! w+ h2 R: \, M  c0 X4 t
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 f* }$ r" i6 f. M( c4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
6 {1 M. \( _; M0 I; I0 S2 K+ B& A4C19:00A4   INC    CX
. Z* ^4 W- W1 Z, G7 S2 h% ]4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" \  j+ |8 D$ y- c4C19:00A8   JB     0095     ; 6 different commands.
0 l5 C! h4 v. o% ~/ D0 e8 M" }* N4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ _, i0 w7 d8 P$ n5 s8 U- v" N4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 v4 E1 [( e; ]4 L# P: U2 l& b0 ]1 R" ]9 ~( x0 J: Y
The program will execute 6 different SIce commands located at ds:dx, which
$ |- |; A+ w5 `0 M  t5 Sare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ G3 h/ d* W3 O' @, W. G
4 ]& O3 h. h# @8 e# E* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ d  f4 c* |# m___________________________________________________________________________' m" I; G$ w2 n# I( |1 ~" C

6 o) d0 U$ Q; i! }9 B, }9 ^2 _( d0 e: j: k2 J! I& n
Method 03
& T4 K/ `& F( d1 L=========  Y+ S# n$ p! n) U; L( |# k7 F
6 _3 I! [0 w. S  T6 R, `: ?
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
% n& X# @6 }4 E0 R(API Get entry point)
7 b/ H) B7 I$ L( i5 u6 i6 u        
" l. Y+ Z9 e# A1 q: ~6 T' A
) G- P3 @1 d: R( g4 k1 A    xor     di,di
: K( [- B1 Z1 k8 ]/ X    mov     es,di! A" ]# S) c% K4 p
    mov     ax, 1684h       % o  h7 y4 d4 m0 M
    mov     bx, 0202h       ; VxD ID of winice
+ o7 |9 O4 J* t8 p7 u2 Z0 a    int     2Fh' F! o/ _# f6 U0 j" c8 V1 Q4 d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' x& d' _& F7 g9 q. g; P6 r! y    add     ax, di* u* g( g1 L! Z% L# b+ B: @
    test    ax,ax
! d1 l" K( I5 V' g+ g    jnz     SoftICE_Detected) H5 F& M6 U( |/ T' \: @: O: }
7 U( f8 I, F2 U- ^8 k; b. u
___________________________________________________________________________& B( e& X+ Z4 d; t7 _

5 f3 y, a( ~4 f4 {* kMethod 042 q9 U: d) y5 M/ l
=========
' P7 D6 j2 e# B; S3 z0 ?: T9 F3 K8 D8 J! e3 I7 q, R
Method identical to the preceding one except that it seeks the ID of SoftICE
) A* r- x2 A" \2 `2 |GFX VxD.
2 ?5 U9 H4 i: g# ^% h( B
7 R1 Z; {0 v8 r3 a4 {$ M. T8 o    xor     di,di1 W  T2 G, j% j! z1 L: a
    mov     es,di  |" w3 ~' {$ N4 X% O9 T% ]
    mov     ax, 1684h       : U# I( g: S$ \1 m5 q
    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ n- Q, I* k- s8 K; C1 d% }/ O
    int     2fh
& X4 O5 z8 S* l7 Q1 N# n  L: Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: v" S7 o; M* F% q# `    add     ax, di- f* f, m2 c9 s8 A2 Z  D+ t7 B+ q" ^# K
    test    ax,ax' ]5 f& e" J6 g" ?( f5 ?
    jnz     SoftICE_Detected/ h. _$ Z! I3 g  t0 m) d. ]* g6 Z. g7 A
& p1 G2 h; u( K) C6 F4 ?; X
__________________________________________________________________________
- ^0 M8 [0 I; n  A; ]6 z
5 D* q6 c; O  Q- c* r  a1 M! [5 O7 I! p( f
Method 059 s" ?  }7 [: A2 H' O
=========
( q; j. U. I2 e6 L
/ [6 e! M5 O1 |0 G( Q- X( ~. {Method seeking the 'magic number' 0F386h returned (in ax) by all system
# J6 I2 p1 z7 hdebugger. It calls the int 41h, function 4Fh.1 T! }# j* L: b* `, e
There are several alternatives.  - Q7 O! Z( {/ w( u& D, |# U! Q7 s

# b3 I+ ]9 o4 _6 G% S7 pThe following one is the simplest:" r# I+ l2 u5 }9 {( }+ _& @
9 v! U/ A  L: [. z" I0 n. J
    mov     ax,4fh2 g% g' R+ ^9 g% F8 x
    int     41h1 X1 [5 [" v% e. D
    cmp     ax, 0F386. w# s$ x, j7 `" S
    jz      SoftICE_detected
1 M' j: u/ o/ b- P! y8 V9 w  Z4 \! ~1 G% J# f! k4 J1 b4 E9 M0 r* F
' _" Z, ~7 j( a: @4 g
Next method as well as the following one are 2 examples from Stone's
2 l! y* R2 b2 ?# `"stn-wid.zip" (www.cracking.net):# ^" x. v" x1 ^

3 ?( C2 [) `! k& K2 D    mov     bx, cs/ b9 o$ V( T( n4 C' o
    lea     dx, int41handler2
) r& k& p0 u& p: N' K' v* f& Q    xchg    dx, es:[41h*4]
% }# K  \1 i0 H. \0 M$ Q    xchg    bx, es:[41h*4+2]
: L: x$ c2 V* P! W! h    mov     ax,4fh
' v. B, u! E- U    int     41h
3 E$ G) Z! m5 s; j* ~    xchg    dx, es:[41h*4]
1 C$ O5 \0 z2 Y# F9 L7 ]8 n' p    xchg    bx, es:[41h*4+2]
7 u. o5 R1 Y& a; `! j% p/ R' j    cmp     ax, 0f386h( X% R  y3 o7 f4 ^0 `
    jz      SoftICE_detected; T1 x) j* }4 ^; z5 s6 |; b
% h, }" D' o2 }0 O% v" z
int41handler2 PROC
7 s! D3 Y% Q0 G* c( a' x1 o    iret
, \2 N; P2 c7 X5 D  H6 Zint41handler2 ENDP% V: L: s; s, C- E/ H- Z$ b
/ Q5 c( R" Z  f9 m# _

/ }" p! ?6 q2 ]) Q_________________________________________________________________________
# R/ g/ |8 j; k& \
4 U2 N# R1 U3 Y& ^- E+ C5 U/ V; ^* M" E+ p
Method 06
1 L, m- z; h9 `( X7 i2 _' g' e, _=========2 |5 t: }& [$ {! I4 w1 Y$ B
' [7 `! Q: E- M+ m0 c7 e
$ m' }4 b5 ~' H; g+ f4 g  G
2nd method similar to the preceding one but more difficult to detect:
6 X, N: A) y. T' H# h( H1 ?( }  S/ @5 E1 H  S* @
  b8 j/ e+ Z) G2 d
int41handler PROC7 B( Z- ]' X' F" L5 g1 C
    mov     cl,al; `4 c' x6 v( s2 X% a+ }+ \
    iret
7 g0 y2 l5 m2 P) e+ o" I" J+ Zint41handler ENDP
) w! ]8 p7 K2 g6 J
# P  \9 c% t: x6 k1 u8 S5 `' ?4 X1 J2 ~; F
    xor     ax,ax$ h4 j' P3 l  M
    mov     es,ax1 k+ l# B/ z& s, B' M! w
    mov     bx, cs
$ y: A4 {$ l! l1 y9 A    lea     dx, int41handler* [5 |* J  j4 F
    xchg    dx, es:[41h*4]. S! k$ k3 s4 i  J1 |8 }7 h
    xchg    bx, es:[41h*4+2]7 Y% p+ n, E) a5 Z" h
    in      al, 40h5 t' h0 |, \" Q. V, i5 C
    xor     cx,cx3 M2 l# L  z6 e0 C* W: w
    int     41h/ G  l$ X; C+ A4 _& n6 R
    xchg    dx, es:[41h*4]0 B0 f  o/ _& F" \
    xchg    bx, es:[41h*4+2]
* H* L8 }/ c" t+ g. H6 \$ c    cmp     cl,al
9 X  v( V( w# b3 e) p0 U$ R    jnz     SoftICE_detected
4 z- v% ?' l3 W4 r7 M( x' U
8 @' E! u2 F8 R3 t# g2 g5 s8 l_________________________________________________________________________
5 A6 r8 L* W, m# {# ^3 j
2 x4 V1 s: L: l4 \Method 07- f. f( t% ]4 o. j% i
=========3 a* H2 n9 r5 D5 G
% ~: Z5 b, P# [) p6 N
Method of detection of the WinICE handler in the int68h (V86)% _7 r. ?/ D( k$ I

- n% p; }1 @; i7 a; }    mov     ah,43h
# h  O. O" s+ A  }( f1 ~    int     68h9 d$ m8 n4 R6 F, ?$ ?$ B! |4 h
    cmp     ax,0F386h$ |$ f0 u5 r7 p$ ~: I0 |% l
    jz      SoftICE_Detected
0 c) {! y7 n+ j8 o% W" }6 }
6 k( z' y5 C, b2 j% N
. P/ U4 @3 a3 {( @: O=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% E8 t! o2 o3 }- x8 J( Z
   app like this:. G- S; R  l0 I

4 q4 w, Q9 d- g9 h8 u: H: k   BPX exec_int if ax==68
. V( j- }+ [; ]4 [   (function called is located at byte ptr [ebp+1Dh] and client eip is6 }+ @- S* T; X! B1 q
   located at [ebp+48h] for 32Bit apps)
5 y  ~9 N7 L# K) K0 P$ h' B__________________________________________________________________________8 C6 M% k  Z' q! R
4 Z" W7 L+ @3 ]- T. Y
3 a& n. a. e+ v2 i7 O& m
Method 08
) O' |  v. b' C8 S) f9 `8 i=========
, `; p: M+ Q& X6 y/ r& A/ R9 X% g
( S1 O  a1 M0 ZIt is not a method of detection of SoftICE but a possibility to crash the
4 d1 o) ^% i% t8 }4 C8 C+ L1 ~: j& osystem by intercepting int 01h and int 03h and redirecting them to another
$ ]) W. k5 o( i6 ^! Troutine.4 i6 n5 f  [2 ~6 C4 C
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; X- B2 ~6 o: n) g/ h. J! @to the new routine to execute (hangs computer...)
; j8 w1 _2 W/ c2 h* ^- P) ?2 x7 C7 M4 t! E2 E
    mov     ah, 25h
6 V) V9 e* P! }* E7 b) K    mov     al, Int_Number (01h or 03h)
0 d9 _7 R- z7 U; c+ e/ [$ U( e" r    mov     dx, offset New_Int_Routine
5 z3 ?) Z5 Q3 L( J, K5 j    int     21h
( n7 q3 Z5 ?6 M# X5 |
* c! O- ^8 m6 ~6 E3 Q__________________________________________________________________________+ U* K/ _) H. W  z8 e2 ~6 H

$ d4 B, c. v2 L' RMethod 09
' N& F9 B, Z* S' x5 R0 ?) v" ~=========1 n' r: I2 ?. a2 f6 b6 Q
2 K7 c$ d, t( n( O# R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% [6 r5 I2 k! ]" V: wperformed in ring0 (VxD or a ring3 app using the VxdCall).
1 y2 X' v7 T. r% U4 _1 |The Get_DDB service is used to determine whether or not a VxD is installed( _  `  n: K; i. C& U3 t  D
for the specified device and returns a Device Description Block (in ecx) for
6 \) u* }" V, G7 }4 vthat device if it is installed.
. i, l# p) B3 \  Q
" T- o5 q! N8 O) @& Z" J   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# H- I$ [/ J) A6 a. F2 I- l& X8 r   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). S4 `4 k1 [& _
   VMMCall Get_DDB
* L+ s3 c0 V( s- g8 `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 o8 a7 l* F) \( f$ j* y0 V' }, N6 Q
Note as well that you can easily detect this method with SoftICE:
. y- ?, w; [  _/ \  x' h   bpx Get_DDB if ax==0202 || ax==7a5fh
, v' Y, n8 n$ I8 z; r+ }# i0 \0 ]5 }; k' t
__________________________________________________________________________
% A' Q2 ?) `' c* k* F) E( L! Q4 |
4 A' N1 Q  L( |4 R% e  @) v4 ZMethod 10- N% S  M2 }6 M& _$ }) i
=========/ H0 V) P$ O! i0 \2 ]' O& Z" e

% \1 l" l, u. p+ h. _2 L- U=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# _, C) c$ u, v3 w9 z
  SoftICE while the option is enable!!# ~0 [0 @$ _; B
1 x& n/ @: `$ \# ^  n: W. L* b
This trick is very efficient:% `. [/ r: _+ d4 f3 B: g" q4 h# Z- U
by checking the Debug Registers, you can detect if SoftICE is loaded
! ~4 r' R0 s1 Q( ?(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; ~0 @% ]! J/ Q
there are some memory breakpoints set (dr0 to dr3) simply by reading their
  ?3 h# w: Q: F; l% E6 @* lvalue (in ring0 only). Values can be manipulated and or changed as well  B/ l8 e' Z# _! {  ^% b
(clearing BPMs for instance)" N/ ?' D1 E6 i4 H# u5 p4 f
" |1 S, C9 S. A
__________________________________________________________________________
9 E- m7 i. h8 Q; n6 y
6 @% _/ D- `. |' P3 OMethod 11: |5 u5 ?" x, G9 C1 s% j2 A
=========
, ~9 h9 L/ i! [/ X+ @# p5 Y- x  n" j+ p2 |3 s; w0 {4 g
This method is most known as 'MeltICE' because it has been freely distributed
/ H. q  \5 x8 X; n8 ?3 g8 mvia www.winfiles.com. However it was first used by NuMega people to allow$ {# q3 I7 {1 d
Symbol Loader to check if SoftICE was active or not (the code is located
& y! Z$ z% f# ~/ v( hinside nmtrans.dll).
9 \7 z7 g0 p  {: Q& t  u' d6 L$ ~1 r$ I+ S$ b" o$ b
The way it works is very simple:0 r5 a' f9 g. X2 U# O( l7 x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ V! O' x- [8 g! R' l+ y0 F1 ]0 J
WinNT) with the CreateFileA API.$ K9 g" {6 Q5 I7 z
8 @8 ]4 S2 J9 y& Y
Here is a sample (checking for 'SICE'):+ b, d) i3 P. Z, o- V
, E1 p6 l' S. \9 [
BOOL IsSoftIce95Loaded()) ~, N- S2 Y9 Q! r% B. Z- o
{
: u7 A5 E& K, ?$ t/ @1 g6 m' E   HANDLE hFile;  
* b  a9 t) _# J! J   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,/ Y4 f) `0 N( s0 S' ?5 V( G
                      FILE_SHARE_READ | FILE_SHARE_WRITE,( ]: J, g$ c  g/ H. C4 p5 U
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  H3 R) c/ \  q8 W3 o9 b) G- l
   if( hFile != INVALID_HANDLE_VALUE )4 b8 |, J. _8 t3 k% y
   {! ~6 \! I6 s3 Y; B3 ^6 U$ {% J
      CloseHandle(hFile);1 ^9 K+ ~3 ^( O! I  A
      return TRUE;. E( G$ c# ~% a( _$ l) E
   }
  ?0 ?$ d( t) v- m) n% x5 P   return FALSE;
; l/ d, w8 V5 w8 E2 T, }}1 f- `4 F. g* k4 d! A4 A
; J5 J; C4 e9 Q5 x
Although this trick calls the CreateFileA function, don't even expect to be
3 L0 V( W7 M, S. F, table to intercept it by installing a IFS hook: it will not work, no way!8 D. c% {( b+ m
In fact, after the call to CreateFileA it will get through VWIN32 0x001F* S3 [1 v! g5 v: m
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)6 s$ G4 O' N1 `! [" H# v: u! y9 m
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
) s9 _4 a1 `" q4 |3 v# ~/ Ofield.8 {6 ?, k/ |8 i  D8 D
In fact, its purpose is not to load/unload VxDs but only to send a
( P0 S8 U( c  b6 f! g6 C) {8 @W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 u  S8 h) ?( A: y" B. T
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ ^7 f8 A; k8 k: w$ g4 _: g& m  ito load/unload a non-dynamically loadable driver such as SoftICE ;-).5 a; {  U: D! S* S* }- P4 v
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 S7 X$ T6 d: C) y4 [( ]
its handle to be opened and then, will be detected.
: J* o1 z/ w) u& r. ^3 NYou can check that simply by hooking Winice.exe control proc entry point: w/ l: e: \+ Y+ h- X/ S+ m
while running MeltICE.
4 R) P& M0 U; F- B- h7 \1 T$ t2 J+ n: o  o

* h( d1 M% g/ N# G* J- m  00401067:  push      00402025    ; \\.\SICE
! P7 C& D: K) M. u, R! P: h8 l' o  0040106C:  call      CreateFileA1 a: w! v! c7 {/ q  s# x. N
  00401071:  cmp       eax,-001
9 j- x5 l+ c! k# U8 e/ _! H" \& P3 u  00401074:  je        004010910 k/ @: ~2 |* u8 u' `! R
* ], S( b- p; b1 z% E! h
3 v) k. r$ o2 m: t
There could be hundreds of BPX you could use to detect this trick.
  c; _8 d5 u  g" e-The most classical one is:
4 E3 G: u! ]  T+ h/ ]! v  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ G, R2 _- m6 V5 a
    *(esp-&gt;4+4)=='NTIC'% `1 A9 y8 v, g2 ]  _/ `
4 F. t2 E3 K( F( K8 W9 H
-The most exotic ones (could be very slooooow :-(& G3 T8 r6 h' m$ r. s8 Y% [
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . C  {; W# ~( F$ ~& \
     ;will break 3 times :-(
/ V. ~. P8 k5 d: T9 k' f. A9 B9 Y% G; J" E+ H6 c1 n
-or (a bit) faster:
) U5 W% D9 m1 U% M4 W. U" e   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' L( j' E$ ?1 ?% B
1 e! f# q4 L8 n8 b: c
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, z5 @6 j( s8 o4 m     ;will break 3 times :-(" y: H7 \- d& n) C; E& M* t; E
1 F8 H* B4 e" K+ k1 W5 K' a3 H
-Much faster:) P8 `  X- N' X& V
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
- `9 C) x4 S4 W8 ~! X4 }* b/ G
3 C2 Z: i: Z: `, {7 GNote also that some programs (like AZPR3.00) use de old 16-bit _lopen5 R3 B# Y- ^: y
function to do the same job:, X& L0 Y- \3 U' F2 P3 ?
- W4 E' k0 N5 U* M$ O% Z' o! ~. C
   push    00                        ; OF_READ; K! b2 j8 [5 C: W7 Z
   mov     eax,[00656634]            ; '\\.\SICE',0# K+ O7 [( I# @' t. G7 H
   push    eax
" d+ {" d2 E5 `" e# j0 R4 B   call    KERNEL32!_lopen. L; ^2 J( i% Y; e0 \0 E( c" B
   inc     eax. L  }/ d, m: ^$ N* U
   jnz     00650589                  ; detected
, y7 r, X/ Q7 s7 b; J& S   push    00                        ; OF_READ  ~( }, O; Y; a1 r4 M, z! j
   mov     eax,[00656638]            ; '\\.\SICE'
) c+ J  f2 ?, o2 K   push    eax' Y9 c& Z- j1 z
   call    KERNEL32!_lopen) v. _6 d( N- A2 A0 m
   inc     eax3 w5 F# c5 k3 s5 z: V: z1 Z% t
   jz      006505ae                  ; not detected5 B+ i: T5 W+ G2 L- r& [4 \
' W1 @" U; l) W, D4 t  O5 m$ {
# W1 v. T, r& K$ q, @0 g% I8 F! l" r
__________________________________________________________________________* z/ K0 z# u% s! c1 w1 [2 L

+ a1 X4 @3 O" V9 j0 eMethod 12* M6 ^7 E) u: n
=========( C: J, W' P& J4 B  `' d8 @
; g8 s% _" b- G6 }; q" J, V1 @
This trick is similar to int41h/4fh Debugger installation check (code 05
- f2 e' ]! }1 B&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ A: V9 K5 O' f6 f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 M2 G5 B) O; T
& P$ X4 i& j) z; U   push  0000004fh         ; function 4fh
% d6 E4 Q" `1 {1 y% A9 r" i, K   push  002a002ah         ; high word specifies which VxD (VWIN32)0 e& y8 a5 G: i) m/ J' s) h" D
                           ; low word specifies which service- d* w; a) M: r% X
                             (VWIN32_Int41Dispatch), d; ~% K' c( ^3 M4 Y# @3 d
   call  Kernel32!ORD_001  ; VxdCall  W) c8 K! \# `5 ^
   cmp   ax, 0f386h        ; magic number returned by system debuggers! a7 q& S  `, w1 |4 w
   jz    SoftICE_detected9 p% g* `+ k* j; N) O+ ]) j$ @
$ R* _7 U. s, J/ p1 Z
Here again, several ways to detect it:
2 A# `2 n# S% u, B) Q; u$ O0 r1 ~, r$ }; h: |
    BPINT 41 if ax==4f
" p) s& L4 U% R( [" H5 x
* y% h. b2 f. G7 u) q  b    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 |: C$ ^# k& h6 a* L( j
: r2 }/ k/ ?5 S2 X1 V4 K8 r: b7 S
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! Q) e+ _2 G  w- C' z& O6 N: `) L8 ?/ V5 M# B& R
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, O4 d9 V8 T7 O/ H1 P. n/ O4 n

" a7 t0 A6 o% s7 w) O/ v__________________________________________________________________________+ Z6 g* {2 k' g+ X

  S" P, [: J# w% ?Method 13
8 z. B4 R! g. }5 c, ^+ W5 ]7 V=========
; n6 S, I- V$ N" Q6 f( V; d( h1 c% s  a5 O  x9 K
Not a real method of detection, but a good way to know if SoftICE is" U4 T7 D! ^/ e- G
installed on a computer and to locate its installation directory.
  @( P1 H) x% ?It is used by few softs which access the following registry keys (usually #2) :
, A6 G' @, v9 t! }. L  M+ a# U4 A) A% `/ L9 q5 B% N7 ^1 @
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 `2 q3 Z3 w5 X4 I3 v" O8 [
\Uninstall\SoftICE
0 b2 f; {  y2 Y: ~5 j; k3 U-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 N% Q' Y% s# d5 I
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 G/ C; Q/ D  R/ q- D\App Paths\Loader32.Exe8 n, n  ^1 U+ J6 j& F

+ @: l) }) i0 B  I5 `+ J- Q# V% t1 F0 D! V6 M7 u  A9 @* ?4 b
Note that some nasty apps could then erase all files from SoftICE directory9 `" c" L* R+ c, g
(I faced that once :-(
- ?$ i: v8 p& n: U, j5 j# J* Q- K1 e; b+ ?
Useful breakpoint to detect it:
6 e5 E0 z: z7 J& e
" p" U; s6 J2 ?4 S! L; ~     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', s6 D- X: i- n4 p) Q& g9 C7 L; l& J
  j0 P& s% w! N* N
__________________________________________________________________________
1 t' |) c/ a& D  o
% G" e% ]) [& o3 K1 t) p' q8 ~( K4 f# |1 @2 u8 I
Method 14
7 z! B% u8 N# G! Z9 n+ I( O+ f$ `=========
& @% P3 u% q6 M6 D7 I0 K
+ |8 a. R0 R2 R1 D. wA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 Q; h9 l4 U0 y* \) {% R
is to determines whether a debugger is running on your system (ring0 only).4 {/ w5 d) u5 b" K' @& g8 Z
7 q# _3 o" X1 g) l' n' w
   VMMCall Test_Debug_Installed$ e0 g% y) A! Y8 H
   je      not_installed7 q' r' `4 N, ?1 C
- ~# h3 x+ s- Y+ F6 c
This service just checks a flag.) K; ~. a+ Y6 F: W- \& O9 Y: F% B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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