About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>0 i& \/ g0 i  y) M" m/ l% q  \" G
<TBODY>
& G6 K: d7 p- N5 Q& R. s<TR>5 f- J) q- R$ a3 H* U" u
<TD><PRE>Method 01 0 y* E8 e" W; x9 a" X2 T6 F
=========
$ M3 X3 w: O( u5 t8 q" \
; P/ d- ]+ W: I( K. \; QThis method of detection of SoftICE (as well as the following one) is
* w9 }" N) G* `- tused by the majority of packers/encryptors found on Internet.  o# [$ K/ d( x9 F2 p, C8 |
It seeks the signature of BoundsChecker in SoftICE
) U. y7 I0 P# T$ M* q6 ~) }; v( R
3 R; A) k" ^& k/ Y    mov     ebp, 04243484Bh        ; 'BCHK'
, J! S8 s# \& U% ]5 C" E' K7 a    mov     ax, 04h" R+ @+ H! [8 X9 C9 h& S
    int     3       . `+ x& R7 W7 d2 U% s  I
    cmp     al,4- h& z3 O: J3 K3 Q% s' A9 Z
    jnz     SoftICE_Detected2 d1 s* J  Z6 o, U' N) s& F2 P5 y5 i
: _8 w0 H+ i8 b; q' |
___________________________________________________________________________, g2 Y9 I4 o/ ~( f2 W

4 ^) L- B) x7 aMethod 02
3 `1 v. m% m) Q=========, U% o- m1 k+ u4 E& y

+ q& f" O8 Q, K7 n; ], F: J) PStill a method very much used (perhaps the most frequent one).  It is used
/ I! V; _0 _! _5 _to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% D; x. O' |3 ^0 u; ?6 Aor execute SoftICE commands...4 A  D. }8 f3 ]' k  i" c
It is also used to crash SoftICE and to force it to execute any commands
! s1 Y) ^) o3 w- C- b(HBOOT...) :-((  " H" t- L7 P/ j* H9 j. V

' X+ a0 v' w3 z& e+ CHere is a quick description:
7 ?5 K7 ~( @. `) `8 R-AX = 0910h   (Display string in SIce windows)2 C$ ]: R' B  z$ N: D( G* [
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)# o& O' L) L( D# K5 L8 E
-AX = 0912h   (Get breakpoint infos)
" q2 V+ j1 V1 |-AX = 0913h   (Set Sice breakpoints)! a" w. {! D1 a. A) B+ s4 F. A
-AX = 0914h   (Remove SIce breakoints)
# f# i3 }3 L/ Z1 r* Q% ]- I3 S& k9 ]# {4 a% O: r9 T
Each time you'll meet this trick, you'll see:
$ G" U; u, c% W0 @9 O-SI = 4647h8 W  a; ^' x4 g1 ~1 x) u
-DI = 4A4Dh
- O& V/ Z" p" d5 r) K& D, [# i) fWhich are the 'magic values' used by SoftIce.
& [2 A: D9 D1 {1 K; g) G! ~For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 o# q4 F; r* Z" k+ _
. c3 E" G/ n0 T! d; \Here is one example from the file "Haspinst.exe" which is the dongle HASP
6 d- P( H( E7 a% REnvelope utility use to protect DOS applications:
; k8 _1 j/ |% C: y5 X
4 H- E1 t- a+ D) O# G4 m
7 L! U9 Z' O1 G4C19:0095   MOV    AX,0911  ; execute command.
5 a7 |  y2 U% D4 V' M9 Z! H+ ~3 z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 W6 |0 G$ S/ d# i
4C19:009A   MOV    SI,4647  ; 1st magic value.  O3 B' ]; `9 @4 ^/ J' E( j
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 I7 q; ~/ w2 o# L4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' B% a8 k* c3 b2 B" F# f) {4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# i0 Q/ W. h( c& I9 g6 P4C19:00A4   INC    CX; c2 C5 p7 {" d: L: {' }4 e
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( }. {! v1 |" S# ?, c
4C19:00A8   JB     0095     ; 6 different commands.
/ a& u: N0 U8 t. T. H4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 j  ^9 k4 y. _" C0 g8 V1 y8 B4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)* k* l' u# n1 h$ T: q! Y
! E/ P" g( A: d: W1 E
The program will execute 6 different SIce commands located at ds:dx, which# {5 u( @5 C; }: ~3 z3 ]( g
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) k2 x, ^( z. L7 q  W" t
* h8 ]  Z: C% O' X4 R* K$ N% n& c- Z* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.; y0 N9 C5 T' J6 N: c6 y
___________________________________________________________________________
, R+ `+ c% y5 e& E" {$ _
& C. M3 }) N5 X2 g( k. Q2 }7 f+ K( @/ D9 ?# c0 B
Method 03: S. ^6 Q4 g) x3 c
=========
7 `0 X7 Y% p5 T& S3 J
8 I3 X# P# D5 e% s- Q% oLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h1 ~1 z/ o3 n) n1 k+ M0 b/ x! G
(API Get entry point)9 I" N. W& }$ k! J7 d7 e9 N, H8 [- B1 z
        , c& a* y) |  P  q* z- `" l, ^0 W4 U
: u" n2 V5 i7 C* Z  _% e
    xor     di,di
; ^# n; ~* O0 q6 y    mov     es,di
0 h3 ~# l' ]3 e# w) N    mov     ax, 1684h       ' E  V6 l# k  j5 l4 h
    mov     bx, 0202h       ; VxD ID of winice% b% U. ~3 f" t
    int     2Fh3 K  g' @. A2 b4 v) U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- w" u* R" L8 a1 |8 Z+ q5 P
    add     ax, di
) x) O/ X0 P- w% Z5 E    test    ax,ax. u- f0 [4 ~; ^2 Z( z2 F. j6 @
    jnz     SoftICE_Detected
- t4 d/ S' z0 H0 @# f  ]3 V3 r' R  c+ D
___________________________________________________________________________
3 x: G9 {/ {  P2 \) Q5 S, o9 W; O, o6 ~4 J$ i) ~
Method 04
& Y& ^4 N. J# W# G  ]/ L=========8 V9 y6 w/ m' S# E- H
# p3 g7 R% [: A: j7 u
Method identical to the preceding one except that it seeks the ID of SoftICE+ [8 R8 X. A4 ]! l$ N; ^" X
GFX VxD.$ `- [1 Z+ K5 {$ _8 D! u4 j
9 F7 I1 M8 x% A* D, Y5 n- Z
    xor     di,di8 r3 t, Z8 [! C: p- _* X
    mov     es,di
0 [! U1 w0 u5 s4 j! O, W$ w( Q    mov     ax, 1684h      
  n3 s7 e: m3 z# z' |6 f    mov     bx, 7a5Fh       ; VxD ID of SIWVID, U7 N% d! [$ B, y# Y
    int     2fh
6 i0 {# k7 }) P. E  ]& i, c# `4 J. X    mov     ax, es          ; ES:DI -&gt; VxD API entry point* C1 O: I; Y$ Y/ T( \3 E
    add     ax, di( @9 e5 h3 u" @: G  D# I- }
    test    ax,ax$ a7 @- b5 }5 O- c% {4 \$ \) ?
    jnz     SoftICE_Detected3 Z5 n5 S0 p8 ~  `; \
- }9 b+ Q8 I4 W
__________________________________________________________________________
& D+ r" F2 X5 R, L$ h( d7 i- E1 \5 F! X
( u, O4 J* a) c2 m) U! w
Method 05
3 Y3 {% g0 o2 m$ {3 q=========* v$ p  E( a3 N" O8 Q5 q

: O, B' Z( R5 V* [5 `1 CMethod seeking the 'magic number' 0F386h returned (in ax) by all system
+ E" ~$ G& `4 ^# adebugger. It calls the int 41h, function 4Fh.
* e2 Z' p; |9 V5 l9 uThere are several alternatives.  
) F6 T/ C. {3 Y' E2 V
2 K, f$ A- }/ ^1 ]6 nThe following one is the simplest:  }. P8 @' o% x4 J

; `! B2 f+ I" O4 O* g( b6 Y9 t    mov     ax,4fh8 J1 M/ T4 d' H5 Q& x- d
    int     41h
8 }. t( e* p$ V    cmp     ax, 0F386
0 h% {; P4 [' a8 t4 c% U5 \0 ^    jz      SoftICE_detected& i  f; `/ u8 q9 t

3 p2 ?' Q% d; Z. c3 [: N% P% L8 T6 @/ w* {+ x' S& d
Next method as well as the following one are 2 examples from Stone's
0 B5 O7 U, ~2 Q# M0 v"stn-wid.zip" (www.cracking.net):: U! O7 [- s, S  {
1 ~1 C* t7 {4 J; A4 ~  V# m% Y( k5 S
    mov     bx, cs
. k0 }; l2 o/ J' p* k( @9 f    lea     dx, int41handler23 y* S# f! a; R% G8 t2 U/ C
    xchg    dx, es:[41h*4]5 y; e1 Y) x+ T/ }. y
    xchg    bx, es:[41h*4+2]' A) U6 R# ~9 I, Z6 U  b
    mov     ax,4fh
2 A* M1 F6 D/ m/ B    int     41h
" z# D8 ?0 A9 T9 S! f    xchg    dx, es:[41h*4]
. C! D* _3 y5 E7 W& w9 Q    xchg    bx, es:[41h*4+2]: a0 H1 d6 I9 A- I& B) m
    cmp     ax, 0f386h- K6 n/ \5 a0 F% v& U
    jz      SoftICE_detected* W9 J/ q2 A9 Q- w  X7 w
9 n: B: J/ C4 n9 n) m5 a. e5 [
int41handler2 PROC
% p* w9 N" D" N6 ^# _4 G1 u    iret2 f- u' t; Q# I7 i9 n# l! K: U
int41handler2 ENDP, z, Y1 K7 L* g" w! r9 u. Q+ P

5 Y* `5 S: `. [3 q# h$ L
0 m" I  A" o* M6 _$ \1 v% g_________________________________________________________________________  f+ q: h/ U- M3 f5 U! J. N/ e: n

" O4 C( x$ K! q
1 L& b. a: i: W+ ?2 b3 WMethod 06
3 w- l" B% [4 N5 y; I=========
5 n* X1 j/ i! Y1 e% D/ S0 e0 O: J% D) i

' C1 V! [; C5 Q8 U2nd method similar to the preceding one but more difficult to detect:
1 ]2 p; g* `0 v, p: y( _3 i( N; W: W4 p& j
- f: g! {6 U  s9 n  E3 N
int41handler PROC9 w9 u  u5 c5 E! _, p$ ?
    mov     cl,al
* ^0 _0 z/ K  C& ^/ f    iret
3 Y3 J  T. w! r4 [int41handler ENDP- J. h2 Z0 Z$ P+ E
; j8 T- x9 A8 g$ s. m" i6 l
0 b* k( ~& X4 L* w8 T% u8 ~# m
    xor     ax,ax
2 e1 r$ b7 P! z6 {/ i    mov     es,ax- c9 N: r- L4 v
    mov     bx, cs& N( O5 }6 c+ a% ~: K2 x, e
    lea     dx, int41handler
, D1 [- u. N( {3 J+ I: z    xchg    dx, es:[41h*4]2 q) w8 {# t9 n, X; N5 A
    xchg    bx, es:[41h*4+2]. a7 w# V/ O" O4 E
    in      al, 40h0 {$ C( |3 y* }& ]$ S" b5 X% d& o
    xor     cx,cx, x, C9 ]+ k0 A, S
    int     41h; F4 I# \7 ^3 H- g" p( e0 ~
    xchg    dx, es:[41h*4]  W* D% {1 J, r, q8 l
    xchg    bx, es:[41h*4+2]1 I9 [: r, k$ G% o3 @
    cmp     cl,al# Z3 u. g" [7 j$ u* K4 a2 r$ M+ f
    jnz     SoftICE_detected# S; |2 j, z" v! P1 c; L
& A2 r* Q4 |# A& f! y
_________________________________________________________________________
8 T# R" P/ |: g" ]1 r$ S1 @
6 x+ P9 R" o: ]$ Y; B. tMethod 073 m3 O+ p( w" [# a
=========# S6 N+ E. @2 ^/ v! l
8 u5 u5 L3 k* ^' E9 q& p* {
Method of detection of the WinICE handler in the int68h (V86)  `! s+ a4 Y- P. R

0 P1 T$ l* D% g8 N: Q: j    mov     ah,43h! Z1 _& M+ g2 {
    int     68h
8 o- Y0 I' }! f8 P5 j$ A    cmp     ax,0F386h# q9 y% L6 s, ?8 _( z! E6 p
    jz      SoftICE_Detected" H6 z9 K- f3 O5 n! D1 E
: F' |9 r) I% q  ?; ~
' ]  N' J! U! I6 f9 m
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 l6 v) A( B6 e; n" V( e0 u& ?4 X  z
   app like this:
7 p# p9 f- r5 C1 k) Y; B* }' o" _; Q8 B: @; C
   BPX exec_int if ax==68
6 g7 \' h% r: T# T& u! C   (function called is located at byte ptr [ebp+1Dh] and client eip is
* V" k! Z' |* S# ~+ N, k   located at [ebp+48h] for 32Bit apps)
: m( m6 Y; ^  B9 z__________________________________________________________________________
- d9 ]1 X0 {1 ~/ o: @# D
" X; J) n' z/ y: U3 ]( O1 }4 J) Z7 ^- j( p0 e1 `
Method 08+ `& a; X. P2 n: W- \
=========
9 q& w% x4 O& \0 G, C( [% c
. N+ Q! G4 D& y3 HIt is not a method of detection of SoftICE but a possibility to crash the
8 Z3 D1 S' \, X. [system by intercepting int 01h and int 03h and redirecting them to another
$ D) k! e3 R/ l! ^7 }5 r, E7 F5 h9 L- Vroutine., I7 ^# ^9 \# n+ S- y% P) o
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, x8 Z  _$ M: wto the new routine to execute (hangs computer...)
! P9 `/ d- A( W1 s* q" w$ P7 L  v7 i
    mov     ah, 25h4 h0 R) {/ r" `1 Q
    mov     al, Int_Number (01h or 03h)
  w5 p; A" d( v; U) L    mov     dx, offset New_Int_Routine1 I; g" q! R4 c+ F/ q' l/ Z
    int     21h
. @6 b& m- R2 D
7 E7 c: e2 t0 b__________________________________________________________________________
2 O2 y( |5 ]7 `! m/ ]( o# I% x$ h1 s3 \3 K
Method 090 m7 F0 D0 \3 }
=========6 Z( |/ M/ v' O& S

' N. V! D0 @2 q: LThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! r4 ]' Q# X1 q4 D) a# ]8 d( eperformed in ring0 (VxD or a ring3 app using the VxdCall).
; ^+ H! H4 h0 w0 P# u: YThe Get_DDB service is used to determine whether or not a VxD is installed; _2 u& `# U/ {
for the specified device and returns a Device Description Block (in ecx) for( w& E; `4 ^. l' ]* H* F) i
that device if it is installed.' C+ u" N# d/ M) e9 C

* q' h8 t& U& {5 W: R, i( ?   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 z. F) ?  l4 \) d. i: ^( `
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ b# x, M7 H: C1 M1 D/ p: z: x
   VMMCall Get_DDB
0 g- U3 Z9 E3 _9 Z$ p* [! r' d   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ x8 w" c" I3 j2 ?' d, z
. H4 ]  }; |$ r8 m0 E4 FNote as well that you can easily detect this method with SoftICE:
2 q2 \3 A1 j: l   bpx Get_DDB if ax==0202 || ax==7a5fh2 ]& l0 X: q+ T) x5 L: V
( G% u2 P+ P4 U; N' x
__________________________________________________________________________
/ q0 B) H" H4 S5 k
( f5 B" \$ U" a% C# xMethod 10
" Z8 |8 `( E- \/ O: z: I, s* J=========- M' o3 a% X# C+ |1 g* P: P
# D- l# R8 i  T  `1 Z( U
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with8 Y' Y+ v4 R: O+ n% E) a' k. M" u0 J+ {
  SoftICE while the option is enable!!
7 ~& `8 ~! S1 m# R  [" b# r, e# K
This trick is very efficient:
" I! e& R' r; Cby checking the Debug Registers, you can detect if SoftICE is loaded
! s+ k3 ?  {% F' J. {& E" {(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if6 f  V2 a2 K) s( R7 p# J
there are some memory breakpoints set (dr0 to dr3) simply by reading their
+ {* Z. _% g+ r  j' \! {; Y! [value (in ring0 only). Values can be manipulated and or changed as well% \7 A& V/ V5 x; m/ Y8 b# T
(clearing BPMs for instance)/ p' G1 w, a: }* }2 y: ^" L' r

3 a0 ]: @$ X6 o- G__________________________________________________________________________
$ Q. p4 [$ u% n: S3 V2 `/ u  R7 o0 n7 X0 `1 I  k/ j. g4 u
Method 118 U- Y) }% v; H0 m- _# Z6 f4 R
=========$ D4 s; S/ x1 T. T
) o5 _' r2 ?3 U0 H
This method is most known as 'MeltICE' because it has been freely distributed
6 q, u) ?4 p* Q$ Cvia www.winfiles.com. However it was first used by NuMega people to allow
" J# M$ v5 d5 `4 nSymbol Loader to check if SoftICE was active or not (the code is located
* B! }* j- _) i) _! t0 N: X$ uinside nmtrans.dll).
& }. F: e' I% w2 M, p+ w- x( F
7 u! J! C0 d9 ~+ \6 W& DThe way it works is very simple:
" p4 s- l% _; Q0 @7 |8 P$ l3 YIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 o3 x5 G( k/ C4 v
WinNT) with the CreateFileA API.
7 M8 m! C5 M% K( e
* n6 j5 |9 u- y  I  l+ BHere is a sample (checking for 'SICE'):
% e) Q: m2 m+ N; S! x3 l. f/ o+ L, \$ k& i( k1 d
BOOL IsSoftIce95Loaded()
9 W( Y; T4 I# m2 I{8 I2 r9 W5 ?2 ?0 n2 B. ~4 k
   HANDLE hFile;  ! R: l4 Z0 X6 s6 E
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 }8 {% s# Z/ r
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# C2 y# g1 X& V: y% \! c# W                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' g2 ^# F) Z1 h; T/ I, o
   if( hFile != INVALID_HANDLE_VALUE )
5 r# E" i5 R2 t5 T1 p   {4 w& j# J, a3 p2 N2 B7 n6 X
      CloseHandle(hFile);% T/ h- R- P( D1 E1 M
      return TRUE;5 a, |8 T1 ?0 |, n
   }% W' ?8 D$ x+ I
   return FALSE;+ S/ ~1 ]* q6 w8 t, _, W
}  R0 j7 f) {4 R/ u
9 |6 b8 O# X8 Y9 Z9 A
Although this trick calls the CreateFileA function, don't even expect to be7 a4 B1 I2 G8 [0 x/ M4 b  J
able to intercept it by installing a IFS hook: it will not work, no way!
& B$ Y* m  I$ mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F0 b3 o9 v: b6 E' u- Y
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ T2 l8 O' K0 f/ Q2 D. o
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
, @8 ~: J# `2 X/ G* K3 Cfield.% s* B$ R2 S& _7 R* _! W. u
In fact, its purpose is not to load/unload VxDs but only to send a # g: i, f8 K% V( e4 a) E% q5 |
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 J, b/ @" `0 W  \* k/ j  Jto the VxD Control_Dispatch proc (how the hell a shareware soft could try# n' B+ Q% n- o: {) k0 m% \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).& R& e$ w& t& J: v
If the VxD is loaded, it will always clear eax and the Carry flag to allow! i; Z1 n' J2 Z0 Z6 a
its handle to be opened and then, will be detected.$ V* M) ^/ M9 {: h, b& F
You can check that simply by hooking Winice.exe control proc entry point2 j0 ~* d2 c2 C2 G) K, M
while running MeltICE.# q1 ]8 I. t5 j0 p# k% b, c+ I
# y. |0 L; G2 m! Q/ `' y
! i% A) ?9 V% O- ?3 K
  00401067:  push      00402025    ; \\.\SICE
# A% u( G  |/ |2 L- Q  0040106C:  call      CreateFileA$ R/ p0 i& Q, H- l
  00401071:  cmp       eax,-001) T& n6 {7 f) i2 X$ E" M0 Z7 H
  00401074:  je        00401091
% u. [0 P3 m- W0 r& d
# O1 O8 J- t3 K: o- m; ?' J' u9 X( p7 f6 C
There could be hundreds of BPX you could use to detect this trick.
" _. s# \4 `" B: c-The most classical one is:
' W. `) N- H% Q0 D' l: p  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 d9 |6 }8 D2 ~/ _* h- y' V
    *(esp-&gt;4+4)=='NTIC'
$ ^) T- S) x1 R7 i9 I# @& w! Q; |1 g6 F8 o+ P2 A$ e
-The most exotic ones (could be very slooooow :-(
5 a2 |! i+ z6 a# M   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
' z. Z* L, b1 o* h/ j     ;will break 3 times :-(! g1 w& \* b$ l

: p  F1 M& W7 I& X* d& B-or (a bit) faster: 7 b, F( l8 P6 }& n7 g+ i
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& A, `! _9 t/ g, i  W& L/ w8 \8 N) x: @& F3 L! [. n& U
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : ~8 w! W2 j/ r; P, G, F
     ;will break 3 times :-(
, ^4 G# K( {, L5 W2 B/ Y2 s+ Q; |# @4 P
, G4 @$ Q  o5 |: L6 @& r: f: k) \5 d-Much faster:
, ^/ H9 @- ~. O) ]! M) D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! k* N( B7 b6 y4 Z6 B% N; B( y( W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen5 r9 X8 U& X! C' b; A
function to do the same job:: |" B+ K% G& s1 S" ?9 M) {

- h( F# s% t& p7 m6 e) U- ?0 s   push    00                        ; OF_READ
' @0 i+ r9 d6 k$ `" Y1 P   mov     eax,[00656634]            ; '\\.\SICE',0
0 s8 Y8 Z0 P! x+ Z: r0 C4 t7 `   push    eax
9 }$ I( v% b0 [% V# p) B   call    KERNEL32!_lopen
3 `  e. v, x) B( n2 P  C   inc     eax: P8 S% ~$ m# K
   jnz     00650589                  ; detected5 b$ Y0 |7 ?; I  B2 V. H$ |
   push    00                        ; OF_READ* q1 m6 C3 Q  P9 y( i% J4 ^+ [
   mov     eax,[00656638]            ; '\\.\SICE'* `% T' K( p9 V; m
   push    eax' y5 ?2 |; [$ g* g( x
   call    KERNEL32!_lopen& r- [2 R$ a% @0 Q9 ]
   inc     eax
2 V* m) Y/ R! ^1 p6 J* C   jz      006505ae                  ; not detected
6 d* D. {2 ?* g8 u+ Q' y0 V& a$ I3 ]( D9 b! k, p  X

; M7 _4 }' H6 o! A__________________________________________________________________________
- G( u/ d5 D/ b3 q! c4 i9 M! p6 C- @9 o; ]7 A) c+ S" @& w2 s
Method 129 b" f" s! a1 V( M+ S& u. O
=========
* X' P/ p; W. }- ]3 l6 ~: y5 u0 h: i: _8 j* N
This trick is similar to int41h/4fh Debugger installation check (code 05" `( ~9 N1 M, z( j8 p' F
&amp; 06) but very limited because it's only available for Win95/98 (not NT)# [' r+ K& [5 Z3 }% d9 f, n$ F
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( G& u2 e1 y7 H! X6 c- H, M- k# o" R) c
   push  0000004fh         ; function 4fh
6 a" O' W3 h* ?, l  ?) o/ |( ?9 e   push  002a002ah         ; high word specifies which VxD (VWIN32)
  H- g' X: K3 q% n                           ; low word specifies which service
1 n  o+ X+ `" o3 G4 V- h4 L+ e                             (VWIN32_Int41Dispatch)
0 Y2 G+ H3 G; C* l- z. F   call  Kernel32!ORD_001  ; VxdCall
; ^+ h' c- v% _& b8 u1 I) g+ e   cmp   ax, 0f386h        ; magic number returned by system debuggers
( A! m0 s; K; r5 N   jz    SoftICE_detected& o+ U; f1 \' w! ]" x7 ]
$ R( i% W8 R1 R3 K; w: K
Here again, several ways to detect it:( D: _# R) Z- P4 \, K1 f8 E% q
3 _$ [0 \6 \3 t- F
    BPINT 41 if ax==4f
& j4 |7 x& r" X1 m! Z( v6 {. _9 P, ]- D! \7 l( t
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 L: T) ^* E1 J% t. E& n
" N4 W. w. m* O' l4 T) _, v6 X
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 D) S8 K2 u: O" ?  U6 k; o
9 R. h/ E5 R8 v* F- X$ P
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ s4 q" ?" T+ X2 X- p
% }* o+ ~) S/ f0 s; g
__________________________________________________________________________$ _" o# G* x+ Q

2 u: c1 b5 I  J7 v' W  F' ]Method 13) }4 p$ c$ `% {
=========' A5 }$ \1 M3 t4 j! n5 [

: Q0 t/ O+ m# S  b& h: F2 v' }Not a real method of detection, but a good way to know if SoftICE is
; c. D) J9 R, p1 |0 [4 linstalled on a computer and to locate its installation directory./ E9 y$ T: b& c* O! b# v) O4 R
It is used by few softs which access the following registry keys (usually #2) :
5 b8 ?" r8 A* ~/ a  w' o4 D
# O. F- v) L( g0 `8 P  O+ K' G-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* b3 X& j  E: t+ i3 W& R# e: R\Uninstall\SoftICE
  ~4 N# P% b2 D; A( G4 N: R-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# N' c) g! \0 d3 Y! V
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! [5 p9 @* Y# i; i% K' P\App Paths\Loader32.Exe7 D9 J0 n* Y' ]  \8 z

6 `& W3 B  x2 p6 f2 U; ]8 z1 q$ h( Q' |! p0 M4 Y1 ~% g
Note that some nasty apps could then erase all files from SoftICE directory6 r+ t8 `0 y( n1 {( x
(I faced that once :-(
+ `" ^# U5 J4 f, s9 B! s
8 M6 @: R+ [& |$ J( L; E0 K( {Useful breakpoint to detect it:
4 |. j) @/ \( n5 T/ q
2 ]" @6 A  d. q/ O0 x     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. Z) l- V1 I, |( I/ x% k) `) d
! @3 V2 Q( H# Z+ a$ H
__________________________________________________________________________
) r9 p/ l7 b, m$ c. P4 h, I2 w9 y) a/ W9 }4 e, W
" ?1 `( y! @% ~" M9 h0 }2 L
Method 14
' Q9 x4 R, }5 c; p! f+ k9 O=========
* n( K6 i+ Q, c# s! ~2 n( v! G
. U/ a1 S8 Y& Q+ ?% LA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% M% \& H1 c  u$ K) mis to determines whether a debugger is running on your system (ring0 only).( E! Q. g$ ?9 Y" g) s

7 c/ q+ e0 x& \* h   VMMCall Test_Debug_Installed+ O) `4 o" [7 }; p! f: Z) ?
   je      not_installed* o7 A! v6 ?4 f2 S
" a( @2 A8 d7 O9 l
This service just checks a flag.
+ ^* \$ s5 O! B; D4 f4 R4 r! d</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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