About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
6 s6 Z: ]7 A8 o" d  A<TBODY>4 F' S1 G. w2 [3 h) R
<TR>
- D: k# H5 x$ S<TD><PRE>Method 01 ; ?& w$ x* w3 X! ]+ n: ^
=========
& J4 v) C, ^/ l3 K1 T+ W
1 U9 i  p9 `* yThis method of detection of SoftICE (as well as the following one) is5 m* u2 e; S" v' h+ T9 U4 X( e; m
used by the majority of packers/encryptors found on Internet.. k; l  P+ l- y: ]2 N0 g
It seeks the signature of BoundsChecker in SoftICE& c6 }% x' [' o: E) l

5 i% p- W0 E/ ?& v- v" p    mov     ebp, 04243484Bh        ; 'BCHK'
' Z# I6 G  I% r8 m+ U& ]' `5 B" |    mov     ax, 04h+ G* \; {- M0 U* y& v7 e
    int     3      
2 D/ o& ^: n7 _6 J% Y- h1 z+ J8 H) p    cmp     al,4
. B; x0 D+ j4 B- ?    jnz     SoftICE_Detected3 k0 S- m7 w; t! s6 ?
& v  C0 d9 y/ y2 E7 ^
___________________________________________________________________________
$ O# F" s% x2 c! v6 O- S, v  i/ o( \
Method 02$ t' @# G3 G' i. L0 K
=========
' y1 V: n1 C/ Z5 n) ?$ G: e; y; F( n7 [* J
Still a method very much used (perhaps the most frequent one).  It is used
4 c' |, n. h5 Z8 N( mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 X& q- Z; H3 f
or execute SoftICE commands...
! b8 F6 n; X2 dIt is also used to crash SoftICE and to force it to execute any commands9 s, g) g. h+ O' z( P
(HBOOT...) :-((  
' C! U; x3 B, g9 M& U; W5 d( l
5 D4 |+ ^7 r: w! k) L6 F- hHere is a quick description:4 `' q! u) x4 V: i) x+ a
-AX = 0910h   (Display string in SIce windows)
4 h2 ?/ {1 T5 F+ R  c: @-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! k; P. @6 i: u, q+ P" B! e. j-AX = 0912h   (Get breakpoint infos)- x& @* M. s8 o4 N
-AX = 0913h   (Set Sice breakpoints)9 z9 e! l* o3 x4 D2 g" E( {2 N! m
-AX = 0914h   (Remove SIce breakoints)) W; U4 w$ Z! a; n$ S: ~1 M

  d5 {' }, \" _  r% mEach time you'll meet this trick, you'll see:' [3 o- d7 \) x/ a
-SI = 4647h# W5 D; I# D6 j9 q: q1 Y
-DI = 4A4Dh9 l) {$ B! y9 }
Which are the 'magic values' used by SoftIce.5 j( C7 w* i3 M* z# V
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 ^; R. e1 l7 [
  R) H% c9 E- j/ X
Here is one example from the file "Haspinst.exe" which is the dongle HASP9 M5 s5 s6 l& ^6 }9 n/ l* y$ X1 x5 g
Envelope utility use to protect DOS applications:
% _4 d0 J5 e& \( J. {) v. h& i' j% Q- A2 I" y; G5 j4 ^
& u% M3 ^7 m/ o0 v1 r& q
4C19:0095   MOV    AX,0911  ; execute command.' e$ b9 A; H0 p$ @; E" ?- B
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
) Q  ~) T- ~/ m0 o+ R4C19:009A   MOV    SI,4647  ; 1st magic value., f9 H3 `0 U* U+ w" z) U3 `
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. x+ h9 Y3 j5 A8 D8 K( P4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" D! `. \$ v* ], K7 E" e: v
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute3 \4 C; `2 ~- X5 |
4C19:00A4   INC    CX
; R  t% U, h1 Z' b; ?4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. s, t* u( z2 `5 g/ V1 Q
4C19:00A8   JB     0095     ; 6 different commands.
1 W' V4 K  C/ H! [) E+ Q) h4C19:00AA   JMP    0002     ; Bad_Guy jmp back./ q. x: k: a7 h5 _+ x8 c
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)+ Z3 g) d9 u& y$ t* I
% u2 Z1 c) z0 H6 j! r
The program will execute 6 different SIce commands located at ds:dx, which
% W& m: \2 N/ x7 a1 ]! h6 e* Fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 F9 o- g9 O1 Z) Q0 Y6 i# X5 L! u

; V4 ^& _' U3 D4 Z* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% M% n+ Z' X& R0 ~1 a  `9 \
___________________________________________________________________________
% s  B4 E7 j- L) k7 m0 S, P. `' x" j
+ T; ]  R+ K" \" Z% U- k+ B1 A& R
Method 03$ O( b1 [7 c( g2 E0 l
=========' A3 }, _6 b# V

' o4 L( C8 {; HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' Q, l- [) s+ I8 Y% p(API Get entry point)1 ^0 W* u0 x  ~; \4 Q4 ?
        
( W9 O; a7 y/ w4 [8 n9 s  p2 v* L# ^8 a* h2 R" p  T, n
    xor     di,di
9 ^- g5 J8 E) i    mov     es,di/ z  X. `, t+ y. z% U- ]: x
    mov     ax, 1684h      
, J" b# `0 n2 d8 v% J) g! Y    mov     bx, 0202h       ; VxD ID of winice
3 o6 l+ ^  R; d: w$ L! v% Z2 T    int     2Fh( E; T) V8 @9 t+ ?$ e$ g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point! V7 R% A/ i- i& S3 P! F5 v
    add     ax, di3 w3 p- V3 k" H9 f- v6 ^1 d
    test    ax,ax
1 f- O) r( d" w    jnz     SoftICE_Detected
5 k" ^6 z+ c* E+ R  C
* o* e( V; Q+ q. d___________________________________________________________________________
9 N4 i, b! J6 P9 w( y3 w8 X
8 e/ f/ A) i1 m. x" z1 K: \/ IMethod 04
9 Q3 B" Y, y, R0 @+ u=========+ M6 [, ^* H5 U0 v; Y
2 R9 w: B" j! n* ~, e1 d
Method identical to the preceding one except that it seeks the ID of SoftICE
, M" y' r6 [: MGFX VxD.
" W3 @, W% u! Q' h% P' |
: S6 C  E  @% L    xor     di,di$ N" F/ }- q8 y! d" [1 F
    mov     es,di( e& n" S! i5 Y
    mov     ax, 1684h      
0 K$ W( E# t! U2 U( p2 o    mov     bx, 7a5Fh       ; VxD ID of SIWVID3 c! L/ n7 _; k' }; [3 [% n' H
    int     2fh7 L- |, _4 g2 w1 P5 G7 i: X6 V
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ y0 p2 c! j  A/ U8 W6 U( _
    add     ax, di/ I/ C0 b! r. J  o# Y
    test    ax,ax
3 \1 ?0 c1 F8 e. o0 R    jnz     SoftICE_Detected
% n  I  s0 G2 `1 M( v0 b7 c0 T0 T' @) `, `* T. s
__________________________________________________________________________
" t& B  W, [+ z, w  X' P& N6 J0 S4 T/ I  r* C$ `. O
' ^5 f0 T/ I: K8 {4 e; v
Method 050 O( ^: p/ r. B! @* W$ x: x, }
=========9 o1 j; x6 E5 N

5 x- ~2 ?2 R3 z5 j5 t# h! sMethod seeking the 'magic number' 0F386h returned (in ax) by all system7 y1 {& t+ M9 _$ _) S
debugger. It calls the int 41h, function 4Fh.. ~! t) h5 I1 u7 J& c  o9 k: p
There are several alternatives.  
/ @, s! L) I& d7 x( w5 \, p; O7 \5 ]' }' L
The following one is the simplest:
  z* @7 |" H* l+ f, `9 @: a" j9 K  @
    mov     ax,4fh
9 e! {4 V  {8 R' ~& o% N- m) d    int     41h
# p# z, P# x2 @  b7 G    cmp     ax, 0F386' b# Z% h5 ]# [5 e
    jz      SoftICE_detected
" D. ?3 V. Y" q& y  y' g
; e5 W* t0 b6 a' v3 x
6 O& x7 M  x: g* R3 f) P" n# `1 sNext method as well as the following one are 2 examples from Stone's 2 Z) r! E8 A' @9 [. J, G( e
"stn-wid.zip" (www.cracking.net):6 E# k5 s) a# A

6 x% d4 U4 R" h! u5 e" |' [  F$ W    mov     bx, cs
5 F1 q+ W3 [* h    lea     dx, int41handler2
" j* x. d5 J* c" G* a9 S    xchg    dx, es:[41h*4]
) o5 [( W3 z& t1 B! W- o    xchg    bx, es:[41h*4+2]
8 ]0 a% [: Q' ~8 U# @/ w7 V( @    mov     ax,4fh* R0 q# v* b) t; [2 j
    int     41h6 D1 M0 V5 U3 h0 |& ^  Q
    xchg    dx, es:[41h*4]9 y2 u0 ^/ O+ W0 a# S) ~
    xchg    bx, es:[41h*4+2]
+ d1 }) E- l8 n$ p$ F    cmp     ax, 0f386h
2 r& Q9 u7 L4 v7 d# b( O    jz      SoftICE_detected8 T2 g! N: B8 |# ]- C* a  `
2 d! i- p! _( @0 [0 l- p  R) u
int41handler2 PROC- u3 g, K! ]; ^# w3 k% w
    iret
/ R) h+ m) c/ [2 T3 ?int41handler2 ENDP8 h9 A3 R: A: b- c) D" e7 S$ ~. i" `

( [( Z, ^7 R* _; B
! A, u6 A& q8 U1 I1 ]4 o: @6 L( X_________________________________________________________________________
5 L3 ]- H# r2 Q3 S2 R  z4 o
2 d4 i! D# H3 ?# U9 l" H3 P- C; A, o* n
Method 06/ ~; Y) ~% ]9 N+ P0 Y* R
=========
& l: R( m$ C- _4 e( Q1 @4 q, _$ k' ?/ E, A. Q. T6 u) R
9 W1 ?7 _; }! u7 E) V( M
2nd method similar to the preceding one but more difficult to detect:
" P0 _- _/ j& P$ Z  X; u# P+ {
- W; u/ z0 a: ]) I! C2 u/ ^% x- e7 z3 u- D6 l' k
int41handler PROC
5 I2 r/ Y* u/ t6 {# q' z    mov     cl,al1 [9 ~  Q. i+ V; s+ f: H6 n( t& E/ `
    iret7 f! ?- E& _* K3 g3 o' t. G; A4 M
int41handler ENDP
2 e$ I% d; G- r5 Z
7 L/ g# V$ [+ b: y! l2 m- R
1 X3 d6 z* `, |: W+ g3 L9 C    xor     ax,ax
5 z% c4 `" R4 Y0 Z6 y$ |- e! ]1 \    mov     es,ax
' q+ {& b5 v4 t& H: g9 r% Z- o    mov     bx, cs) \/ X: I9 O* E
    lea     dx, int41handler' c+ I' _$ B2 E) V5 l0 q
    xchg    dx, es:[41h*4]* n9 X8 |- o$ ^6 c# u+ S* w
    xchg    bx, es:[41h*4+2]
4 s& ?5 O2 N- m3 Y5 f    in      al, 40h- T( L  S, N0 c; d
    xor     cx,cx
1 m1 z( I8 ~% a0 n, M8 `: E8 t# Y' n    int     41h
/ y  Y1 Y. D8 J) L) y    xchg    dx, es:[41h*4]: s' c; c$ g" w
    xchg    bx, es:[41h*4+2]' ^7 A# ]9 ?" i) y/ L7 a2 \
    cmp     cl,al6 N* z/ t7 J6 R/ F- M/ Q
    jnz     SoftICE_detected- _8 k2 K+ G) H% b( B9 H9 _
& }( W1 _0 b; P7 A" A8 F2 i
_________________________________________________________________________
* j' Z* \  m8 e6 x5 v( f# x' b" Y! l! {0 k. y2 Y* F; m3 Q2 s
Method 07- O7 X: Q4 W5 z  B( n: h3 M
=========
6 ?1 C0 Q0 u; l) q# V. @$ S
( B2 O* X1 q2 YMethod of detection of the WinICE handler in the int68h (V86)$ p2 c: d& w0 W) L7 o" C

3 h/ X" }+ r/ g6 C, H    mov     ah,43h
* k- t) f6 E7 v    int     68h
; s! [; h" s# Z/ |    cmp     ax,0F386h8 E- E, B! H  h$ I# v, w/ B
    jz      SoftICE_Detected5 M1 T5 k7 L  v# \: `6 A" O
6 M9 b3 o1 I. O/ g7 e4 ]

7 D9 {/ ~/ c& n=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 E) t9 z* z9 _# [7 c
   app like this:
, @. w/ @/ V3 q6 t# T: T& y7 i5 @+ J( b* ]
   BPX exec_int if ax==68
  G# w1 b) X+ h3 ^: c   (function called is located at byte ptr [ebp+1Dh] and client eip is# d: Q% z' j% K. ~; t
   located at [ebp+48h] for 32Bit apps)" V; t' Z+ }# H* L7 B
__________________________________________________________________________
+ R: W) b$ N0 x9 Y9 q3 y( z5 k) S3 M) ~1 N" }+ ]8 |! |& ?

' H1 L! h- Z+ d. t$ Y; {' h# VMethod 08
1 A) T4 o- \9 x- ]. ^$ W=========
6 Q: a2 l5 r% A( M+ M% j8 @" j: F3 o/ l: m3 x
It is not a method of detection of SoftICE but a possibility to crash the
' r" s# w' p2 k/ U. Ssystem by intercepting int 01h and int 03h and redirecting them to another
5 I' n" n3 ~2 V8 D, broutine.! ^8 O. k1 ^7 a; D# a
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* h/ S' Y" x4 O. A, N' E
to the new routine to execute (hangs computer...)* ]; C2 j' h2 ?9 ]# R

$ w+ P4 ?3 `! K4 l# C7 m, k    mov     ah, 25h4 A* D/ h) N% [0 t1 ?" p% r
    mov     al, Int_Number (01h or 03h)
2 n/ l- j. V' n; Q    mov     dx, offset New_Int_Routine$ p0 j/ p  w6 O: F: j& g. t! q$ V
    int     21h
& {! ?3 h1 V& X8 z5 C3 j# e1 j- d2 V8 Q# j  P
__________________________________________________________________________
0 d/ \3 N7 {6 d- f$ U- z+ `- x5 Q* ^  y! f  l, |- p7 m+ g
Method 09
! d. Y1 E) B5 h* v8 k# E=========6 I$ W& @6 ]; U. X+ s; t0 c' n

' M- f" A) O9 V; h  fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% l4 b, o' x+ F* k5 g% w, [performed in ring0 (VxD or a ring3 app using the VxdCall).. g: o. f( n: j- Y$ S
The Get_DDB service is used to determine whether or not a VxD is installed! b! z5 {( Y& [  C( I( \' o! R
for the specified device and returns a Device Description Block (in ecx) for) Z6 k2 |$ Y3 j- Q
that device if it is installed.1 @! I. p( A" ?& `4 z

5 O" Q  {% i2 D) S1 N   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% J1 ]! L. f+ ~7 D, N+ u# M
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) N( m8 B8 ?- Q0 Z   VMMCall Get_DDB! p& O! t& m" U, ?* P/ Q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 F$ \# l& x% [$ e; B
+ C& N- E; o$ n
Note as well that you can easily detect this method with SoftICE:7 G1 q0 s$ S: y6 n
   bpx Get_DDB if ax==0202 || ax==7a5fh
' |% c' \3 Z) f2 P, [0 L4 d2 |( p) x( _% L
__________________________________________________________________________
3 C" o* ^7 y; ]* z! f" I/ P4 ~! J4 z: U$ u- ^4 d3 H5 p
Method 100 ]: _" m0 I" j7 q# [  t
=========
. L3 f: S( k$ P, R$ {6 k; V7 d8 n; Y
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% _0 r4 J) p3 s8 u& D
  SoftICE while the option is enable!!( D; t6 Y: r' T, i; l
* E9 f1 j% I. i1 |& O2 ]+ Y: i
This trick is very efficient:" ?3 B% z0 c2 x5 O$ L0 P
by checking the Debug Registers, you can detect if SoftICE is loaded
" `, O, k+ Q7 ^9 w(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
3 z" {' E" }$ d" a3 Uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
8 x4 e. ], B; J4 m- g9 Wvalue (in ring0 only). Values can be manipulated and or changed as well
5 @- e) Y( ?( N; ]9 W, G' p) d(clearing BPMs for instance)
: r. E% q% r) B( Z" P
0 Q, ?6 d8 L& R$ o% t% o8 ~__________________________________________________________________________
+ e$ Q) }# z: W9 T4 Q6 }/ \# A8 n6 ~9 a8 T  u7 y$ x5 r
Method 11( {6 {( f4 _# P& l2 O9 t6 m: H  V
=========
+ n0 n2 x6 J! x
+ H, I) K( |6 j& Z3 G+ KThis method is most known as 'MeltICE' because it has been freely distributed6 J2 U# W5 K& P* |+ g1 D
via www.winfiles.com. However it was first used by NuMega people to allow( O0 l/ ?. W( q+ v0 b1 e7 J
Symbol Loader to check if SoftICE was active or not (the code is located* t, z& ~  Y" q- q: q
inside nmtrans.dll).
  J9 T  X6 E! v# K) b7 C& h; x0 O* e. V' g& H* ~& Q8 I
The way it works is very simple:
: W) X9 F+ g- k8 d8 e" ~It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for$ K. W7 c# N2 O8 R7 Z
WinNT) with the CreateFileA API.1 I) s/ ]- m  a" e8 ?5 |5 f' {
/ N: B% Q5 i. q) z3 h4 H( W
Here is a sample (checking for 'SICE'):
5 F' v; H6 E" R- g7 B/ T' J$ U- U9 x2 e: r$ d" D+ O
BOOL IsSoftIce95Loaded()/ E- J; t! R" a$ F0 G! S+ J
{% j+ @% j, J$ r4 z8 \% c1 p
   HANDLE hFile;  
4 R' e4 m! p* ]' T  O6 P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' L$ d, P$ Z" L! Z% X9 X                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) _3 A3 c8 q/ z7 F* T  q2 X                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. g/ k# L/ `% ^5 m1 s   if( hFile != INVALID_HANDLE_VALUE )
3 L9 k% ~! z# d$ N: E# t1 U. @& ^   {; Q% N) R* d9 L# I. M
      CloseHandle(hFile);
4 H! \2 q4 F7 b, v' u5 u      return TRUE;
1 d6 l" W4 J: \; v0 \) U, T   }
3 @' V! \; j- K   return FALSE;. |, f5 v1 H0 V" Q' ^- h. b
}
2 E5 n9 y8 v& K$ ?# r! S
& z8 |6 }* z& C$ r& d7 O1 G' ]- b# EAlthough this trick calls the CreateFileA function, don't even expect to be5 i; h9 D3 y: k" M
able to intercept it by installing a IFS hook: it will not work, no way!- Z$ n1 O! l: R1 L) g- n
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 q5 _4 H" H' ?& R5 o5 R  Lservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 k8 {6 [& }8 a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 L: }3 N7 ~  s6 n1 ]& x5 W5 z/ ofield.
  r! I9 P4 u. N; K* L, R7 bIn fact, its purpose is not to load/unload VxDs but only to send a
2 m$ i9 I0 T; h! u/ EW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' [" j# e& m& j: g* G) h9 E6 h
to the VxD Control_Dispatch proc (how the hell a shareware soft could try. V: m1 ~6 R. [; R' A
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ M$ A" ?5 C! d5 Q% tIf the VxD is loaded, it will always clear eax and the Carry flag to allow0 n; T  }% K) m7 f" P3 Q
its handle to be opened and then, will be detected.
5 m! S# a" Q+ ^3 Q6 u8 YYou can check that simply by hooking Winice.exe control proc entry point) D% y2 d" O8 d* S5 `# @
while running MeltICE.6 K/ A" P; ~/ f8 x
3 }# y3 E) |8 }/ }
2 n$ e. y9 D( M* T7 e
  00401067:  push      00402025    ; \\.\SICE
) p/ g% z& h6 ?  0040106C:  call      CreateFileA* y4 h  u6 I4 y( u) m  o, |/ ~- `
  00401071:  cmp       eax,-001
  C7 U$ x6 e5 }7 K* q2 }  |3 R  00401074:  je        00401091
, j1 X  I# q$ u4 G6 d8 ^6 F! H8 t
, i% e5 o9 U5 {/ A$ p7 `, A# J! D
" U) H; m$ E+ v7 H0 {There could be hundreds of BPX you could use to detect this trick.
) M6 e" o3 a  Y+ D-The most classical one is:
4 t" \# \' U" v9 _5 p9 }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||7 M* t3 t5 R  a4 q: s
    *(esp-&gt;4+4)=='NTIC'
; X+ w, M* @5 Q& T- P1 N9 }5 r2 Y+ u" G5 i7 z+ G2 v6 m2 Z
-The most exotic ones (could be very slooooow :-(
" e2 w& o: [& l' N& g   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 C. s. ?& J5 _) j% X% r0 t
     ;will break 3 times :-(- Z. a* i" F/ E* N/ p0 P9 Z

7 J3 ?/ `* m( F8 z$ `  ^- f8 f-or (a bit) faster: * T3 O) }$ i" q& b
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) O2 A6 }/ ~* o" Z
+ z( m3 L  X3 T8 `; @8 J   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
; _: V1 S9 K. I* z     ;will break 3 times :-(  N+ C: [+ u% R- U

) f! C$ J+ |" e1 ~$ S-Much faster:
4 K* s; [# ?7 B% n) q7 E   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* S, ]: T, b) }+ l, |' e9 v  Q# f0 E, @7 W& E& {0 H. k+ R+ m  K" C' i
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen, G) r% p' @" s+ t0 g0 g' F
function to do the same job:
5 V% D% o# b8 j$ i  Y0 C* z; ?
4 F5 _. N/ S5 v/ D  u  l   push    00                        ; OF_READ& ?+ x' A: G0 K0 l4 F4 ?" J1 L# s& r
   mov     eax,[00656634]            ; '\\.\SICE',0
, v1 u: \/ G9 o* P/ S   push    eax
. L& |3 p$ h2 ], k* c) `   call    KERNEL32!_lopen
# K5 O+ q/ Q* w: Z   inc     eax
- v3 e+ d- _% d2 J2 \3 A0 h6 i) d   jnz     00650589                  ; detected
7 Y+ C3 r9 X" @1 X) n9 n   push    00                        ; OF_READ
& Z* k% p8 J  [7 w7 l   mov     eax,[00656638]            ; '\\.\SICE'! J- g: n# }# B
   push    eax! ^3 G7 D0 i% N8 M8 q( X3 p" m
   call    KERNEL32!_lopen+ ?4 s. |' Q& @" b
   inc     eax* E: F: r  o) u: l
   jz      006505ae                  ; not detected* `: d4 C/ E0 O- n1 k% I+ v
/ \2 i, d# _' U9 n

$ S6 M& |3 a% Z* m, y  U__________________________________________________________________________  f9 N  `( n, V, a3 _/ Z( a* n

+ c# C% T6 }3 ]. RMethod 12
6 G1 {% R; c) H) c$ Z=========
6 t% p/ h: U1 f( E
& o7 `% d' I/ OThis trick is similar to int41h/4fh Debugger installation check (code 05
! n- r; b' N' u+ _&amp; 06) but very limited because it's only available for Win95/98 (not NT)
7 t- A/ z" S. p& f+ V4 p( H5 E2 |6 aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.# M. m5 h" x5 l7 u& @

7 g9 k7 h5 z+ [2 s: {   push  0000004fh         ; function 4fh
" h5 j( P6 z+ I4 A/ S; z   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 l# x4 ?2 O2 s                           ; low word specifies which service4 g/ Q1 j5 `3 V4 u9 \
                             (VWIN32_Int41Dispatch)- m) f0 D$ }9 ]" t# \, `: h" {
   call  Kernel32!ORD_001  ; VxdCall4 d4 ^; \, V+ p2 d" P2 H& D) g% ]1 E1 h
   cmp   ax, 0f386h        ; magic number returned by system debuggers, b' {# z; l- @, A3 u% L: t
   jz    SoftICE_detected& |3 a, R  B( O- v5 I9 P
8 W6 J% C$ D" w* l0 I' L
Here again, several ways to detect it:
0 C- O+ S. i& D/ n$ h4 U, P: Z7 x  |  a
    BPINT 41 if ax==4f& k/ a/ p2 Q) e& m" L

/ K# E  Q8 Y# u0 X+ r& K2 Y    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! [0 S+ E) K! E# {/ k3 B) ]% B* \8 M
) N3 K+ e/ X7 r' D    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ l/ x. `$ k) w* ?6 F. @
! E# q9 \( G% `: r4 k& a9 P( V' S
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: r7 f  _$ T$ g, Y2 ?
' }: H* u5 I  Z__________________________________________________________________________
) B6 t3 w3 t) T6 G% B- n- F0 @) L2 q/ |: j/ N( q; p
Method 13! d% N7 }! B7 \, d5 d8 _; S
=========
, f. b" a1 Z: j5 O
: x+ U9 F. f! x2 l  GNot a real method of detection, but a good way to know if SoftICE is: J9 N4 ]9 ]* a* B: b
installed on a computer and to locate its installation directory.
/ R: z- C& |1 ]" f6 }It is used by few softs which access the following registry keys (usually #2) :6 ]: R# T% j. G, l- o7 T
. j9 v9 U! m! f/ }5 ^
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 }* C& Y0 |0 n& W% d" ]\Uninstall\SoftICE. h0 i8 L# V, T2 E4 v
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE2 V  r, u+ u  M5 O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 l/ f0 s. Q8 I; {7 c/ X\App Paths\Loader32.Exe
- n+ n$ {% [! t; N- x, N1 w- B" e/ w% Z( K- {
9 E6 N: Z3 o4 N7 z  V' [
Note that some nasty apps could then erase all files from SoftICE directory# Y- Q/ t' t/ |3 I* v
(I faced that once :-(( `0 u- C* \4 U- H) D+ \
1 {+ o, R, M# L! [/ Q0 D2 d; J
Useful breakpoint to detect it:
" S8 x2 V4 `% U/ R
' E/ _$ t7 S9 B- G! F     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 s; \1 c/ S2 ?% q3 h8 `
/ A  i8 H. v# K1 a4 Q9 ___________________________________________________________________________
( {( x8 P9 R% _; s7 W$ B
6 q' i  X0 _: f( }' d' i: ?) l+ F6 z2 x
Method 14 ! m) {4 w3 X, I4 l" P) o0 p3 s
=========
) E% B. l' S6 T- ], o7 R
' ?" Z. }: A1 z3 sA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose- r  y2 B* F% ^; C$ @
is to determines whether a debugger is running on your system (ring0 only).& ~1 |4 q( a* g) ?" X

& ~$ n% S+ V$ r; ^/ N+ N9 I   VMMCall Test_Debug_Installed8 b9 u7 p$ q" l. i
   je      not_installed
: I3 _. m8 [* X, O
, S# p/ P: u3 B0 }: ~1 nThis service just checks a flag.) r5 m, ]' i  l( ~/ _( }' a
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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