About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 y& y2 n  Y0 K/ W6 R+ `
<TBODY>
6 v" R6 H" x1 s+ k( r8 p<TR>
# H" L) }- ^$ f& a<TD><PRE>Method 01 # R, E: ?; V9 N0 v+ }4 Z
=========
0 r" R, \+ @# N  w0 G& U6 n1 m0 q- {- p. O
This method of detection of SoftICE (as well as the following one) is( t/ O- [: O9 _
used by the majority of packers/encryptors found on Internet.5 O( X1 \2 L3 |; d
It seeks the signature of BoundsChecker in SoftICE. H# m  B1 B2 s; m% x9 t
/ ^9 a0 N; l  E. M
    mov     ebp, 04243484Bh        ; 'BCHK'' i2 D6 a; |( t. e, [# ?
    mov     ax, 04h# @7 a2 V" A$ V- J
    int     3      
2 T. x( P7 k6 @8 R* j6 ^, s4 m) N    cmp     al,46 j3 U6 \! w( ?! N
    jnz     SoftICE_Detected
- [  r3 Q' o8 e+ [5 z9 z) E  T4 j6 D/ C) D
___________________________________________________________________________
1 b. j5 o: m$ p0 }# B$ ]
2 c6 _4 @+ M4 a, eMethod 02
6 e6 i3 U3 ^. q/ I8 N. h4 b=========
7 c4 U7 Y' A' A# C* i! I8 }2 P4 t3 a2 K8 U" ]4 y
Still a method very much used (perhaps the most frequent one).  It is used
7 `- V- K9 L* G+ Q6 J1 dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 V( J4 ?, d) M! F! Gor execute SoftICE commands...
& V+ B& v8 O" E- b; Z8 W  V+ }4 ^It is also used to crash SoftICE and to force it to execute any commands/ n- l: G# x! g$ K/ z6 E
(HBOOT...) :-((  
8 x3 U* W) d1 f% _5 ?! ?  D
/ g" l6 m% v3 @: R4 A$ iHere is a quick description:/ P$ `3 ?' O# x$ N2 g
-AX = 0910h   (Display string in SIce windows). N) b, n9 E) S& b( q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  n1 i4 J; v# k4 g9 w; r
-AX = 0912h   (Get breakpoint infos)$ O. `3 s2 O2 d6 n7 ~. K4 f- b+ ^, v
-AX = 0913h   (Set Sice breakpoints)
. a: P. D& v3 d9 R+ c! t- b-AX = 0914h   (Remove SIce breakoints)
: C+ |2 t2 D" L7 h. X' e, g0 X/ l/ c( c
Each time you'll meet this trick, you'll see:
" A( z, t" J. z-SI = 4647h0 E/ Y# k5 i5 R4 t0 ?3 {  z; H. g
-DI = 4A4Dh6 [. P& U' `; }- \* M) ]# ~
Which are the 'magic values' used by SoftIce.
; a# B0 c* |5 w; y' P% S9 w" pFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 N# z6 ~& h* w6 a* N( ]
- G9 [- t0 t/ S. i6 I" q1 G& l- e3 g
Here is one example from the file "Haspinst.exe" which is the dongle HASP( K% {; K; y( x
Envelope utility use to protect DOS applications:
7 C. {( |3 F* M6 s$ S- Y$ ]" r, ]( k' [& ~- Q% M
! m9 o, k! o/ R& {. O
4C19:0095   MOV    AX,0911  ; execute command.. _  A# k. R' I1 g2 z' d
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 {/ [! X! r. j4 z& J4 b4C19:009A   MOV    SI,4647  ; 1st magic value.
2 Y% S& t( b" q8 E; _4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. G- R% T  a/ Z% F6 l2 z5 ~4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" u/ s( G' J9 u; F
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ N4 S6 e! l/ ?( C! S* {7 o! U
4C19:00A4   INC    CX( t* }  E0 b! H4 p3 f
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! |8 y0 x0 U5 c% K8 y4C19:00A8   JB     0095     ; 6 different commands.8 e  \6 s7 L( z& r: f( m4 ~* _
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* w. z: R# s- e! D4 L, v1 ]4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)+ {* o' K2 q9 p) y+ a

8 b9 A0 d$ b( I: J, Q- d+ }The program will execute 6 different SIce commands located at ds:dx, which
/ `9 I/ i, n8 j2 yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 z  H7 l& A! `' v/ U

! T6 U3 i$ T, G" H! g* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 A0 J0 I/ `  ]/ ?5 k
___________________________________________________________________________& r( d3 @- ~( @& y) L6 D7 q: n
6 f3 [" L1 ~" L2 m% y. {: u" I1 [
- S. S9 c8 V# |4 y4 y
Method 03
. ]& j& Z9 y, f- X" c: F=========
8 ^7 e" V, U8 c* E: [& u: m" j! l2 \2 J8 p( ?
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 }. \  T  o8 O" E6 |: J
(API Get entry point)
: ]3 G& z7 l" b$ t        
; m" i* h; `: ^2 v8 [3 i% l2 E8 Z5 K8 F
    xor     di,di6 Y3 Q& F/ }' m( r
    mov     es,di6 b  ^4 \" l" J: Q! H& `; x# a
    mov     ax, 1684h       : o9 o( v3 I2 N. D
    mov     bx, 0202h       ; VxD ID of winice! I9 D8 e9 Q9 M1 E  h( D
    int     2Fh
/ P" b" ^* h; }5 H    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 {$ u3 r: i/ |! t$ m$ p8 C    add     ax, di
5 [" U2 T& |  C+ T: A; _# i    test    ax,ax; u5 ~- ~2 A7 O( o: p
    jnz     SoftICE_Detected
( [( h" M2 y7 h' I( q- w
3 _$ L+ z% @- ]+ a___________________________________________________________________________
5 N; @! D+ t0 {: u  D5 \. y  D$ G& [
Method 04
( e/ r3 M3 y; I* m=========2 {; \# r  ^! D7 k
9 m' J5 M  ^- u8 ^* N& z- t6 U3 ~
Method identical to the preceding one except that it seeks the ID of SoftICE
3 i( f  ~0 q0 p% HGFX VxD." S0 u5 F* J( Q4 K% Y: \  \, Y+ {
* F) u3 O( K& ]1 X- ]* D7 s0 G1 j
    xor     di,di
& F' l, R; _, u) b" ~3 p    mov     es,di
' W* c1 @( e4 b/ C/ I$ S    mov     ax, 1684h      
# V' M1 \* X$ R0 Q. E    mov     bx, 7a5Fh       ; VxD ID of SIWVID- @: E' E; u1 Z4 b
    int     2fh7 m. M' P/ ~7 E5 x4 A1 Z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% J3 Z7 B: T/ }    add     ax, di
( N8 T0 P- r$ U2 J9 @0 q    test    ax,ax7 l$ s8 u$ H- T
    jnz     SoftICE_Detected: r! S9 Z* X+ K+ u! R7 m3 L" P' X: p
* M. m% S! O, D' j7 \9 {5 V
__________________________________________________________________________
+ O* Y2 Y9 n0 R3 t3 e8 w( ~
5 u) a. F8 E. @/ P% g+ d% k4 N
' X  L2 U& {/ D8 a) g5 D& Z: }! A9 XMethod 05- d* @$ W( ~8 s, {6 ?8 d
=========: W+ v% b& v2 H  ]9 t3 a

, P5 b1 W, Y$ y6 P# J) G3 cMethod seeking the 'magic number' 0F386h returned (in ax) by all system
# c0 ^3 v1 U6 M/ I( a( Kdebugger. It calls the int 41h, function 4Fh.6 ^, Y$ b9 |( {/ J6 Z7 U0 n
There are several alternatives.  
3 O! |4 K( Z5 `$ ]. s- L" Z5 o0 z: ?" ~" ~1 I8 a' B
The following one is the simplest:
3 \! I# H8 _- i- \( |/ b2 Q* k- i: r" h; n* }7 Q" C
    mov     ax,4fh
: j4 J: i; d3 j+ J    int     41h
  b8 s6 l& z3 k; k0 h1 m: d    cmp     ax, 0F386* K/ g+ S" p, C
    jz      SoftICE_detected) l! k: b" e+ m6 I
  s$ X1 v4 s+ a0 W2 |/ }7 V9 g3 z

; c" M: b! }" Y- n4 A: j9 KNext method as well as the following one are 2 examples from Stone's
$ v$ W* ~1 q# b1 u: h"stn-wid.zip" (www.cracking.net):1 s& W2 p) M$ N4 f0 m9 x" S4 L

# @0 {; x1 W8 s. o$ {- B- v    mov     bx, cs9 h5 t# ~1 ~$ v3 E4 d; J& w
    lea     dx, int41handler27 O4 R: H7 Q2 t6 O$ s
    xchg    dx, es:[41h*4]
- B% c+ g# V! u# y7 u& V    xchg    bx, es:[41h*4+2]
" C* O% F( ^! K7 Z    mov     ax,4fh
4 p  t3 t  x  g4 G( s# N; e& R9 i0 R    int     41h7 E+ q2 d  v, p* i0 R
    xchg    dx, es:[41h*4]
$ e# }8 r) o; a. C0 R/ @    xchg    bx, es:[41h*4+2]4 O# ~, R' N  j: T  v; R
    cmp     ax, 0f386h
+ D' E  A5 g8 N+ G. f" @" I    jz      SoftICE_detected  y5 @' D( ?# c
; m2 D5 x+ E7 u0 j8 ?3 Y9 B
int41handler2 PROC
; o8 Y. ^# W* ^# E6 a( e6 S! s    iret4 V9 m1 U/ j1 T& q" F9 v' h
int41handler2 ENDP& c0 {3 N9 r6 v! ~6 _' [

5 M9 z- g5 ^% c; A! u
1 M- C& F! f/ `5 p_________________________________________________________________________% ?5 M' {) V" {0 {

! D: E* z  d, o7 ~2 C5 T
$ {9 Z3 v$ Z" U- W: cMethod 06; [& D8 l, t6 Z/ z( R
=========
+ O% Q! l7 f# d; E+ e- }; G. X# |" U: y: g& ~3 G

% C1 b9 n' |1 ?( D2nd method similar to the preceding one but more difficult to detect:) W% I+ `2 Z) T' L

# _# c! K2 w; ~) L3 Z' d. }* r( O+ l/ _6 _
int41handler PROC
1 J9 L6 q; o' a: r( q8 a    mov     cl,al
% p0 j* S1 q2 Q% Q. o5 p    iret
/ C! X( m2 ]5 Gint41handler ENDP
  R  C: T6 t" V1 U
( r4 ~  }" n: y, k0 z( v) a5 U9 u2 Q2 ]
    xor     ax,ax. i& B1 x1 V+ A
    mov     es,ax- g3 E' P, s7 P2 K1 w
    mov     bx, cs( t2 h# M+ s- C% J& o! f
    lea     dx, int41handler& b- F' ?" |/ Z- H/ J  L% I
    xchg    dx, es:[41h*4]
) ?7 o% h% K+ `) M! J( R    xchg    bx, es:[41h*4+2]) _; _) o& w, H3 n
    in      al, 40h+ x; k( v7 j0 x# E3 f
    xor     cx,cx+ P. l5 n6 G  A; c% O- J6 D
    int     41h- X0 p" V1 s5 o$ y
    xchg    dx, es:[41h*4]
- L9 d9 P+ u" }, A    xchg    bx, es:[41h*4+2]
# {8 j5 F" r5 i" I7 ~    cmp     cl,al: A# e/ A9 A6 Q2 e: d* s
    jnz     SoftICE_detected) ?% O6 V. g3 {$ n# `$ X' r% @$ \

# D/ v2 z/ F0 __________________________________________________________________________+ U9 [2 Z: ~7 G1 Q& R
; Y( W5 J0 I8 d0 Q) Z$ ]7 I
Method 073 R! P( r$ r  S$ z/ `
=========
% F& U# R- D$ L6 `& R5 j+ G
( a2 ~4 c) c2 B) h0 Y- JMethod of detection of the WinICE handler in the int68h (V86): a0 J: ^$ J8 D, e

& p- N/ a. b( q) ?1 z( s    mov     ah,43h
  [  c/ _. m8 h. ?7 w0 u    int     68h
6 s4 t5 m. o: k, o    cmp     ax,0F386h
5 z4 H# G8 J7 I" w    jz      SoftICE_Detected
  Y8 C& T' T2 P; ~  ^# ~1 D# e2 h0 i& }

. J  a& R$ U- A3 l=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; M1 L1 u1 o* m3 q/ @8 ^1 z   app like this:4 h9 E6 ^+ T; L; p* v& ?8 @
1 W: m& [, Z, t2 U
   BPX exec_int if ax==68
: p& y, |3 G4 E9 A   (function called is located at byte ptr [ebp+1Dh] and client eip is. ^. j3 P# O/ s( G( r% Y
   located at [ebp+48h] for 32Bit apps)
# r. B* S3 ^) P% k__________________________________________________________________________
" m) v0 ?- ]/ I$ _! a' @5 b; k3 `: n" B% S2 G# G5 A( X! t7 ?- ?. W4 p

  l% v) p- o7 O/ `1 t1 ^7 VMethod 08* {6 R; c8 Q& z. ~- [; F- J
=========" O8 P! ~7 K0 y: F2 r) t

* U8 L4 k' d! p5 J; T" v% ]It is not a method of detection of SoftICE but a possibility to crash the$ {. f) V# l* S3 f
system by intercepting int 01h and int 03h and redirecting them to another4 i7 t; E* h# T) Z2 a6 A
routine.1 v/ i& @9 S2 l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, m; B9 b9 r/ R% ]9 Uto the new routine to execute (hangs computer...)
7 p+ o! F3 N4 P8 s
5 H, p! R6 c% M2 T, ^& S7 e1 m0 ^, z    mov     ah, 25h
' ^: B4 M! h' U2 W; g1 T2 o    mov     al, Int_Number (01h or 03h)2 r2 o& X' y8 n; e4 j0 H1 D! e
    mov     dx, offset New_Int_Routine
' X+ i: Z" _& Y6 e    int     21h
/ ^/ |( m, R% M' D; e/ y9 V3 ]) a8 f1 {7 M6 T9 O
__________________________________________________________________________' x& y* j: J6 J3 ?" v* J! w
+ r$ v1 P1 d; [, H5 A
Method 09
2 T3 R. p% w# V" x, n) Y2 q( q/ d5 Z=========; k  B9 t4 o. g
' Y" D5 ~7 z  P. N5 [* o
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 G' I$ T+ V0 X4 `( N+ D7 R0 h% B$ tperformed in ring0 (VxD or a ring3 app using the VxdCall).
; U+ b3 x4 \( N  uThe Get_DDB service is used to determine whether or not a VxD is installed
3 x: V. L! `3 F- zfor the specified device and returns a Device Description Block (in ecx) for
& c! {# P# s- [4 \! jthat device if it is installed.
4 J( ?7 V; D; ~) _. O+ [$ O; @4 D' Y( e9 [
2 [; {3 ?1 y8 [, A& Z! g4 ~: ^( N   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. c0 f, f, {1 x. s) u. q! z6 l6 A   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 d/ a  n% }. U; G   VMMCall Get_DDB
: |9 g5 K% K8 I5 {* T) ^   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 J* S  g( x& F* u
( N1 w7 z( ~: I9 y0 W* p, [Note as well that you can easily detect this method with SoftICE:
* k* a+ L+ @5 w4 v   bpx Get_DDB if ax==0202 || ax==7a5fh) b; m7 s/ a- ?" y+ [2 U/ D

: F) n4 Q3 h: d* O1 b" S__________________________________________________________________________
) H% ]3 K$ Z% t6 y
# H/ X- P. |- O! QMethod 10
  x! ?2 ?0 P& O2 x9 `: D- M1 X$ I=========, E! o7 T/ @9 U" j' |% [

* t4 Z) N( t9 f=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 M2 ^, e/ h* F/ Z7 B# }0 O4 Z
  SoftICE while the option is enable!!( q/ E0 y9 G) ~/ _

+ e& ~5 \  f1 C  }1 ~This trick is very efficient:2 R2 B* [4 ?8 y. j+ V3 l3 T1 {
by checking the Debug Registers, you can detect if SoftICE is loaded. g* m+ O- h- t: I$ Y9 }. q; F
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( u" K7 w1 O6 Hthere are some memory breakpoints set (dr0 to dr3) simply by reading their
3 X: y& k5 w% ~3 o/ J+ h/ tvalue (in ring0 only). Values can be manipulated and or changed as well, Q, A% @4 v. ]/ ~' R8 W7 s
(clearing BPMs for instance)
, k2 l1 g/ s' z+ a+ r2 s4 \( o; U" v$ ]2 e+ k
__________________________________________________________________________, M5 t& y( b" A; ^5 {
, p5 B8 d6 `* ]% ?& H# @7 M  {
Method 11/ A$ x$ o( @- _! b
=========
& @$ l7 h7 Y  `9 u) `. Q
/ y. j" e- ?9 K3 |: X: Y9 ZThis method is most known as 'MeltICE' because it has been freely distributed# z7 ?6 h: C7 C, b: e- p% |7 ]
via www.winfiles.com. However it was first used by NuMega people to allow
/ |* e3 d5 E$ s# fSymbol Loader to check if SoftICE was active or not (the code is located
9 ]1 g# o3 y. o! G' Winside nmtrans.dll).
' K7 {$ e$ V$ O; E* |/ q/ d  L. y' b/ Z7 _1 W. X: ~/ D
The way it works is very simple:
3 m9 d% Y8 @1 ]- G- ~5 T  _! VIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 L' X2 h, d8 F. O& J! \! f
WinNT) with the CreateFileA API.
3 j3 j2 }5 W3 M5 B/ }  P4 {) l  m
) y" \6 v: n: O  z  z' {9 x2 v# g# JHere is a sample (checking for 'SICE'):
4 y3 i) Q) ]4 N. L  P& G! D9 e7 [# k7 I- ]& o
BOOL IsSoftIce95Loaded()( Q4 X1 W* g3 |/ p+ P' N, W' S
{' Z" @/ O5 r! h" V8 v
   HANDLE hFile;  6 {: Y5 Y4 R  J% q8 k# P# s) c
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
* b9 O7 W' o8 A2 B: k& w                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# z% U  f4 q/ w# k9 N                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& X' y! C" ~9 v) G3 ?
   if( hFile != INVALID_HANDLE_VALUE )
8 g* M, M- V6 P9 H$ B4 B   {. ?  ^" |' W( j6 \1 T* A+ w5 P
      CloseHandle(hFile);
- n6 j. ?% }3 p: ]& m4 Z4 K      return TRUE;
, s' D/ h# k# Z9 P  O# N   }8 T7 V8 Y. I% S0 Q0 ]# F% a* `
   return FALSE;
( X$ n* Q# l9 V}
- S$ B, [, }) T. B: R" }6 }  K8 e: [. u2 {0 @) K4 T$ i6 F9 @9 q
Although this trick calls the CreateFileA function, don't even expect to be
0 y2 A3 Z" q7 S7 K2 T$ oable to intercept it by installing a IFS hook: it will not work, no way!
: _9 @' E# H: r( f, {3 g) ]/ }- FIn fact, after the call to CreateFileA it will get through VWIN32 0x001F4 o% M1 d; C2 s! N+ E# T
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)6 V  T& d4 G& O$ Y! h) q
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
# s; U2 I: V  P1 G, E1 o% [- ?3 Kfield./ S  o* u& z7 ]& h, O" C& z
In fact, its purpose is not to load/unload VxDs but only to send a 4 s5 W3 w+ @% O+ T: z( m
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: @. d2 Y" `) d' I5 ^7 t. H' lto the VxD Control_Dispatch proc (how the hell a shareware soft could try" L1 z: t9 h( @: _" d6 z# t9 @, w7 W
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
2 A7 z+ L4 U" }! c/ |: T( `If the VxD is loaded, it will always clear eax and the Carry flag to allow
7 l/ u" @1 ~1 T) B" J' Rits handle to be opened and then, will be detected.2 z0 k4 I. ^. E7 _/ O, g8 F& l* e
You can check that simply by hooking Winice.exe control proc entry point* b* x. F2 p. ]. l6 v0 ^
while running MeltICE.% q  C0 F! [' g8 _
; X* `' [% c) U7 l& o1 j
$ u" j! x7 Y* S5 f* s
  00401067:  push      00402025    ; \\.\SICE% E; c- u1 B( [! k/ q; Y2 ]
  0040106C:  call      CreateFileA7 ]( b; B: q( W, e1 v% i
  00401071:  cmp       eax,-001# i$ r( b: u, |; t
  00401074:  je        00401091
+ }; Y1 o. a. o; F0 |/ K' [1 V2 k7 S! f7 v2 L

$ Y6 b$ C! x: x) O% WThere could be hundreds of BPX you could use to detect this trick.
3 V2 O6 w% K; s% ]* M, f. n-The most classical one is:/ D  ~' q1 ]) I* j4 {% |7 N6 @3 L
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 A* V  X4 u2 _# F% ^    *(esp-&gt;4+4)=='NTIC'
# b( r+ {0 l+ |% Y, C* g! m4 x2 x! T  N1 s8 i  E  {! A
-The most exotic ones (could be very slooooow :-() e+ ]$ d% `9 s& X+ Z, i# N
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    X- v& M; i/ V: z8 x
     ;will break 3 times :-(
/ U6 F: U3 N$ t& }# C7 c$ H/ c! m" _) B7 V
-or (a bit) faster: ' G& z" N' {3 x' N- E
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')8 c# \6 r) o* J5 x' x" R
$ _4 z3 z+ K. x4 _9 l( z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
' F9 }# ]; R2 A, q7 O5 ^     ;will break 3 times :-($ m9 [6 G8 q3 h' f8 m5 M
% U3 @; n: B. {3 g* }, m) Y
-Much faster:
0 b, e* R5 s- ~# j+ k. w: a; C   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& q: Q* y& f) g( s7 F) |3 r

/ W  v$ t& v" BNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 r% @9 m( s, j- l& Q) r% Vfunction to do the same job:$ Z, `7 A4 Q$ b
( X, C4 F$ Y9 h) f5 X0 U
   push    00                        ; OF_READ
- x4 C/ x, F3 I) }$ Y   mov     eax,[00656634]            ; '\\.\SICE',0! Y) X* x/ U7 C. c2 m: Z
   push    eax
% O* I2 O- k- x5 ^+ Y4 E   call    KERNEL32!_lopen
- O& ^, |) \3 P- |" m1 z% q& J   inc     eax: {$ X+ j3 R. [/ `8 Y5 P2 W
   jnz     00650589                  ; detected, G; L9 F' f3 w: J
   push    00                        ; OF_READ
2 G8 H* {, c: p   mov     eax,[00656638]            ; '\\.\SICE'
! W2 U# _4 u, \, _   push    eax8 V0 B: o, A: G" b6 b
   call    KERNEL32!_lopen( a6 ?0 Z4 }# [/ T# K8 J" V6 @
   inc     eax. K0 N; N1 O" \+ S. I
   jz      006505ae                  ; not detected( W" h; x0 X2 v$ S5 P% J+ G

) \( N2 q/ V3 S2 e- H: c0 Z# X: C8 }6 U9 y' u" h
__________________________________________________________________________# `0 l; `0 g3 N
; Y/ F9 r+ f" @% o& E8 w/ ?+ ~
Method 12
  p; o- G" i' a1 T=========( D6 C6 i) D% B5 O5 z4 [/ d2 P
  }1 s1 E. S- C- c1 \
This trick is similar to int41h/4fh Debugger installation check (code 05' l: I. v. G/ g  f
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 D& O3 @) h3 K9 B$ ]. N/ I2 Nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.  a1 s/ p! h4 q6 w9 P' S0 {
* t* h7 h5 B/ b* Z+ {- R
   push  0000004fh         ; function 4fh* f, ~/ D8 _3 |: |
   push  002a002ah         ; high word specifies which VxD (VWIN32)
5 G& A/ o8 {0 Y/ a3 @                           ; low word specifies which service
: Y) X. _4 H8 D0 N; N& ?                             (VWIN32_Int41Dispatch)
; ~, F  m/ m9 k$ ^& o9 C; n   call  Kernel32!ORD_001  ; VxdCall; l5 [3 v2 @; B( o8 h; A" D' g: Y8 n
   cmp   ax, 0f386h        ; magic number returned by system debuggers
, R  P* M  u6 z2 t   jz    SoftICE_detected: I& r* M- F6 v" s: S! r  g

" \2 }6 O  l3 ^; AHere again, several ways to detect it:
5 V  u: F- I7 Q2 G) R+ Z4 u8 h# `2 K% A, K+ a
    BPINT 41 if ax==4f
! M. `! p* O% n+ M
( s5 X; s7 t" Q4 g    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one  Y" ]( `' T+ P2 e

$ L0 ^* Z+ t! N" G8 }$ N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 l% N( S& S1 e+ h8 a* l7 L8 b0 h$ c/ A- ^7 R0 D5 @5 T% |, h
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  m2 K. H& c* A/ {

1 C/ y8 ]* h5 f__________________________________________________________________________" D. g4 Y9 O: X7 b2 e. J: a; D
' Y. e8 s: R6 E. W6 b7 x5 a9 A
Method 13
. S; T- g$ N  {4 J/ I=========
  j. ]* f0 x& U* |, z9 F* n+ j( r  ?+ ~, m7 {0 {% C
Not a real method of detection, but a good way to know if SoftICE is
+ ?2 l2 I0 W8 s% y  M5 O' v! hinstalled on a computer and to locate its installation directory./ D! U, M+ U! M+ A( D; E
It is used by few softs which access the following registry keys (usually #2) :
. m; }- ?+ D; U; q+ ^/ }- ^- {1 C, p
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 E( N1 t; m7 x3 w\Uninstall\SoftICE
% O9 H; `9 u3 U4 r) x-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 D# H) K  M0 b5 r9 _8 `( ]9 \3 D-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 g( Y% T: L6 O' t
\App Paths\Loader32.Exe
8 e& c. Z$ q( X& e& v) S1 E. h2 c# s: f

5 {* a/ U" s% {7 z2 ?5 {# V/ u7 N$ `Note that some nasty apps could then erase all files from SoftICE directory
4 j4 V; e2 [( o4 ~0 A& r" M(I faced that once :-() I3 d$ n& T  ^2 q

; i2 {8 J$ \  o6 d6 W- e% MUseful breakpoint to detect it:
1 Z# o/ K$ r5 I* B. G7 p. H9 @5 h+ t+ _& w- z$ H# T
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* C) n; I+ _! X5 Y: [# G4 D& O+ l+ L! M6 N6 U, |
__________________________________________________________________________
9 ]7 V6 M3 |) n' Q& x
: h8 j' ^+ y1 h  ^. P: Z
, R6 p6 S5 C! b+ W& WMethod 14 4 g% h- R9 \, k( S8 n7 d
=========
& R3 N( u9 H2 E2 N  k" s2 c7 h6 ~
/ Q: K" U% r1 r) Q2 dA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 Z) T+ s0 n. c$ Cis to determines whether a debugger is running on your system (ring0 only).
1 w  O' B& B1 q# u: F0 n, \' p5 F6 s( i6 ~7 u1 X; H# y
   VMMCall Test_Debug_Installed5 o  u6 \6 _! x. {
   je      not_installed
, X# U! I" ]+ V3 T& Q) r" `& {: L  u8 R, v; c/ L2 j/ Q
This service just checks a flag.& x, q7 Y& Y# r7 ^: T: g
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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