About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% K4 J- B+ I" D6 X0 r<TBODY>. \3 v4 t- h. Y, {  m5 h
<TR>9 t& d' [% Z4 X/ [6 T$ J. p
<TD><PRE>Method 01
( [5 X- [- `* V/ w7 i1 s=========/ T4 t7 h5 O; E$ D

" z! A# d5 x$ r0 [( jThis method of detection of SoftICE (as well as the following one) is
3 r0 w! j1 T) X5 x1 Wused by the majority of packers/encryptors found on Internet.
$ _& H# E$ J( L1 k8 Z5 R& R: g0 vIt seeks the signature of BoundsChecker in SoftICE0 s5 \" {# D7 X0 G9 Q7 w

2 [2 X* z9 B. h0 G    mov     ebp, 04243484Bh        ; 'BCHK'* O8 J% a! j) x0 e, Z
    mov     ax, 04h. L. W3 {- x( {2 y
    int     3      
. f, S( U- \! q( e5 o0 \7 ]    cmp     al,4
( o/ ~; N- U+ H  |8 S    jnz     SoftICE_Detected
5 C+ t2 Q' ~7 V: b: P) V6 z
- L0 \  ]% k" E1 R___________________________________________________________________________6 F/ I3 |! E1 g: Q5 L
6 W& b' g' C& c- h
Method 025 ?6 h  o: L  x" a
=========' N  N7 k; g) c7 k5 C
9 m1 p9 S5 A2 `- U8 }$ {
Still a method very much used (perhaps the most frequent one).  It is used
9 u0 R3 T8 C9 }# Ito get SoftICE 'Back Door commands' which gives infos on Breakpoints,
  H' a  |/ k' \7 e. G* l+ uor execute SoftICE commands...7 B9 R. {+ h  O" p: o- `6 v3 v
It is also used to crash SoftICE and to force it to execute any commands
0 \% ?4 q: ]5 b(HBOOT...) :-((  % p' u4 u% h9 E* b( q
5 l: k  [  F3 F
Here is a quick description:
' r1 H" i* M. u, ~4 W" R% g% Y- K-AX = 0910h   (Display string in SIce windows)7 q& Z* Z; i/ ~/ i& T( t
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
/ I: o+ X( S% i-AX = 0912h   (Get breakpoint infos)
! K* J: H, u6 O1 c. P+ p9 G-AX = 0913h   (Set Sice breakpoints)
' [! j. }7 u, V5 ~( u, c( P-AX = 0914h   (Remove SIce breakoints)
+ z2 f, j! f' D, D9 Y2 S, V: p* y+ Z6 @& A* l( Q
Each time you'll meet this trick, you'll see:3 A4 G6 @8 ~( Z' K5 |
-SI = 4647h+ V; t: x* o$ H! C$ w
-DI = 4A4Dh4 z3 A: X2 {( _; Z& f* z
Which are the 'magic values' used by SoftIce.# f  ~/ G9 M# B5 x0 K
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& O0 Q- g7 ^+ z! f3 L

( ^8 P0 n: T/ N+ r9 \8 jHere is one example from the file "Haspinst.exe" which is the dongle HASP: |, w0 g9 Q$ i; k- Q( e
Envelope utility use to protect DOS applications:
) S: S+ H" `  t  Q4 V' \# k
" D2 }0 v: R& o  J4 \  V* O/ s" e3 y# E
4C19:0095   MOV    AX,0911  ; execute command.
1 h, S" {8 Q: J9 g, u1 p4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: H, y8 ^& u" i5 P1 ~( m3 s2 ~: }
4C19:009A   MOV    SI,4647  ; 1st magic value.- R2 W- d5 ~, p3 J% i
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: q& r8 M' \. f" C( L4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* D9 V" I8 {$ {2 K
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 m3 R/ t! a9 b$ E" ?% N4C19:00A4   INC    CX# A2 l/ _! Q/ v% |5 o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute4 x% E' e+ R# L
4C19:00A8   JB     0095     ; 6 different commands.8 @. `5 ^1 C5 X( v
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." q1 C2 t& {7 C7 `4 J! r4 L+ C
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); Q, J+ ~* a- {  b' T
) h0 L$ a* s0 t1 [
The program will execute 6 different SIce commands located at ds:dx, which! A: o0 }* x% [! e7 y- |+ @
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.8 d! K9 }& R. l

, \' C9 S4 c( v* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; @' I2 H& n: C9 o4 a9 D6 R2 |___________________________________________________________________________. V/ M2 k8 d( y

8 q  d: F2 c( c, z7 Z7 ^1 b! J- L* M1 D  J
Method 03
1 R; H- w* F5 o0 d) l+ i5 D=========, |, k4 {& D; b+ P
9 ^5 o, ?. W2 u. u+ R1 p7 v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h% Q! |# N+ W! R% R1 R) b7 r4 j
(API Get entry point)8 Z* B  v6 u. h2 P- Y* e
        5 N1 M8 C0 `) D& x

$ I' |8 p+ E4 T  o0 h* S: O" I  s% ]    xor     di,di3 o. b* B: A$ A" V7 }- X: G* B
    mov     es,di
2 |# b! N" m3 W, r7 l    mov     ax, 1684h       & y' K  I* V  c# t: X7 [; a
    mov     bx, 0202h       ; VxD ID of winice6 {5 `( Q: v& X5 S
    int     2Fh0 Y& {7 n, Q# A, H) Z, g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ k3 p5 \7 K$ z$ p+ b4 z
    add     ax, di5 r) W, D" @! D' ^( `  l( o! j
    test    ax,ax) h1 O: m8 U& k9 B
    jnz     SoftICE_Detected: x7 a% l% b, M9 A8 N: k
1 L$ ~1 t: n& ^5 D$ \3 P( t) ~; j  m
___________________________________________________________________________
2 r& I$ @. h3 |9 X
( x5 C% d$ u& u9 g! O. uMethod 04
# D- x( L) n8 J  m5 S, X* S; q=========
, j% F% a' [# K: T
4 \9 j; h; ~& h' U  |7 lMethod identical to the preceding one except that it seeks the ID of SoftICE
) ~# v( m5 Q& O7 ?) ]; m/ |4 k& M- OGFX VxD.$ r7 }1 D6 Z9 h' G8 ^

9 q" E  a5 q% y$ S0 u4 Y! ~    xor     di,di% u$ P- j: U9 v2 S8 B
    mov     es,di0 Y$ \' h5 Z6 |6 H8 a2 Z
    mov     ax, 1684h       ; E% ~7 i/ k$ w3 b0 l
    mov     bx, 7a5Fh       ; VxD ID of SIWVID! d# l- R  I# R* u% L
    int     2fh
% o$ I! b/ @( c; Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, |" j" W7 H! ^    add     ax, di; X8 u2 c* ~- [- p
    test    ax,ax
( d1 Z8 S4 r5 t% e0 {& Q# f    jnz     SoftICE_Detected* U9 t; d+ }7 Y
8 m) O8 ], G7 b+ m, p  r
__________________________________________________________________________) `, F+ A) T; \/ \$ P- U% [! z
8 G5 w' }. v3 T$ n* Q1 g( n
* y  a# D0 H( J7 L9 Z
Method 05
# f2 e9 Y" I$ w  `, s: B=========( p: x3 x8 w4 g3 C3 j6 x( t

5 A& ~: ~+ x* I- M& i6 {Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 o7 S/ w2 T: m' t2 ?, B* }debugger. It calls the int 41h, function 4Fh.$ s) K  W8 u! t/ i8 D( J
There are several alternatives.  
: @) Q& A* N$ }$ R5 K8 a( A7 l& I+ ]( c: W# X: i
The following one is the simplest:
8 E$ ?9 B: i( }1 \5 I1 I2 f! l* f( n
    mov     ax,4fh
5 [9 j2 w( [: O1 f: T. s: c+ M1 W    int     41h5 q, R* L/ U4 p5 X3 p
    cmp     ax, 0F386
4 I$ o- f' h& O/ T! w5 Z    jz      SoftICE_detected
. j) O  F" q; }5 Z' o$ F3 B4 `! H! [4 |

, t( C' W- J& \& L, Q0 [. k& r5 SNext method as well as the following one are 2 examples from Stone's
& ^* U, w1 v8 P2 X4 |0 E8 h"stn-wid.zip" (www.cracking.net):
  M& ~8 k/ i/ y3 r6 @) y. T3 E9 J* B: O. s
    mov     bx, cs
  C' C% K9 P) V    lea     dx, int41handler2
! @3 E, j1 Q2 G- S    xchg    dx, es:[41h*4]
' I6 B1 X! F( \* s, D    xchg    bx, es:[41h*4+2]
6 c7 I9 k3 c- a) A: i    mov     ax,4fh* g1 @& G/ ]; I5 U( b- b
    int     41h
/ }/ @% ^0 j/ z( d    xchg    dx, es:[41h*4]" t& B- J, k, q8 ?
    xchg    bx, es:[41h*4+2]
3 Z; X- p9 G: E. O% C    cmp     ax, 0f386h
( G% p& E( \4 N  r3 m: P    jz      SoftICE_detected, j5 D8 H% L, j

7 h6 p3 F0 g0 {" gint41handler2 PROC
1 p2 l/ D1 ^5 r- G1 z    iret
% J3 R* c+ ?9 yint41handler2 ENDP
/ k0 ~/ Q5 \" ]$ M* t+ U
/ s4 @( C: L& Z  S. X' X8 x! {, `  t* V& b2 W, M* u5 J5 c
_________________________________________________________________________
# M" T' A6 a! p* _1 I* |% p2 p
; {! q  o! t2 |4 A7 L, q. [* D* X; {' {1 |7 H* Z5 C1 w$ L
Method 067 e9 R, S. d2 G4 O/ N
=========- r4 H$ d  q; \. U9 `8 P
, V/ v5 ?2 u) h2 ], ~* e% X! p
2 @" V) c% T2 O$ M! A) v
2nd method similar to the preceding one but more difficult to detect:
1 N% I& F$ {% B$ F; C4 s1 N- \7 t( q; \( X
. p. |; e9 {0 N2 b% B5 L2 g0 c
int41handler PROC+ h% Z  L' v/ |& @) g! Q
    mov     cl,al* U6 g$ P0 w& I1 s. F
    iret
+ x: _6 h- }# u* xint41handler ENDP
; V* S1 \8 L1 R9 G. Z5 |% a; w( ]0 W# W' z; F$ ?

( A' z8 |5 W% S1 T9 _0 j- s    xor     ax,ax
  K. |: [' M+ d; H+ j    mov     es,ax
5 P/ `5 z& J: U( ?% |0 R    mov     bx, cs5 H/ e; |1 y9 B) W. e( ^0 r% _
    lea     dx, int41handler2 t7 M+ y! b4 M+ R/ c. J9 Z( ?
    xchg    dx, es:[41h*4]
. w% x/ F+ b0 Z, ^6 x5 g) A    xchg    bx, es:[41h*4+2]1 f0 v$ e2 i. {- q
    in      al, 40h
* R- I$ b3 P3 d$ f( m& G    xor     cx,cx% @' V+ [' v! Z8 {0 Z
    int     41h" O* q$ o) ^5 a8 _, d
    xchg    dx, es:[41h*4]  t' \8 n6 ]  r  J# Y: f2 X! x
    xchg    bx, es:[41h*4+2]+ q, J5 L! F1 A6 u) G  n
    cmp     cl,al
! T7 \, v" @! p! q" j  m    jnz     SoftICE_detected
! J/ `" ~8 s! _
! n6 D8 _0 Y9 \9 v$ t+ N% s5 z_________________________________________________________________________; Q1 S# D+ d- w( ^, I3 [+ Y7 k
9 C) H! i: Z% G) P; X; Q  B) W1 F
Method 07
# ]7 z- E, i0 j) G! l% `# r=========
/ @" V) l5 n$ ?3 e( u. g
$ `# b) \2 w! G# _Method of detection of the WinICE handler in the int68h (V86)4 b4 G" T" T9 _1 D: x' t

' D4 X! z( G8 r$ I) Z, o, K    mov     ah,43h* m! E% i( G! Z; Y4 A4 \. f" Z, o* I
    int     68h
/ ~& A2 X/ h# o+ m    cmp     ax,0F386h
' H" L; |, B& ]3 @    jz      SoftICE_Detected' v5 l% w) G1 c  o2 w
2 B( x4 c2 V9 @! T9 j. M3 [

: y; B. C8 ]# ^=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
, V& M( Y$ a! }& V* e+ {) U& _   app like this:, C1 `7 f: |5 O" l8 h( p; M; K

& s# T. c% i2 }. q, d# u  s   BPX exec_int if ax==689 ~) X9 X# Q5 E8 T* {9 `
   (function called is located at byte ptr [ebp+1Dh] and client eip is1 d$ `5 |" h* K; N5 [5 K8 b2 C
   located at [ebp+48h] for 32Bit apps)
$ C; r) T3 Z! @' F6 Q__________________________________________________________________________
. T: x8 q& S5 I9 z( G; o' e3 E* u0 }- S0 S3 U

" I; ?( l7 M) X8 G  M/ n, CMethod 08' e5 p: h/ `' {5 R
=========6 X3 ?7 ]+ R. q' y9 [: D
$ G$ R& E9 Z* g: P2 [; v$ k# P# b
It is not a method of detection of SoftICE but a possibility to crash the
% o7 Z. I1 [8 U( Y# ?! e2 o0 ^system by intercepting int 01h and int 03h and redirecting them to another: T* Q$ Q! J5 W% E# R% Z3 ]
routine.
+ [! x9 {! B# q+ X0 [7 R# ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points1 Z( f9 K* w$ J+ ~
to the new routine to execute (hangs computer...)2 M/ z" v6 `4 q) h' Y' q

2 n" S& N# b$ {0 T5 Y$ l2 N    mov     ah, 25h& m& f0 `1 @; o/ f) h0 n9 _) g
    mov     al, Int_Number (01h or 03h)
7 S' E$ S, O# y- S: D7 A% o$ ~/ g  y7 j    mov     dx, offset New_Int_Routine
; _) h7 X# }# c( K& _    int     21h, v3 x3 W% M; J5 a% Q
) k" B: W  z$ i" D' @
__________________________________________________________________________
  t3 o8 S: s  n! y" ]; J9 f
, e( W7 j9 O3 D$ s, k' O/ o& [Method 09+ i0 L5 n9 b( @9 j; X
=========
' G9 v1 a$ D  Y! E7 g6 p+ P! R& z$ w- f/ B5 U
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 u& H0 ^$ |4 o2 ]* G3 j0 B
performed in ring0 (VxD or a ring3 app using the VxdCall).
4 [0 X' n) p# q' w% s: S( S  V+ PThe Get_DDB service is used to determine whether or not a VxD is installed
, {, K5 a0 \; `1 u( A7 Bfor the specified device and returns a Device Description Block (in ecx) for" s* }8 s, ~6 h2 Y
that device if it is installed.
8 @3 a8 y) z$ Y3 r9 E# h5 o) C% T' c6 K8 E3 X5 \
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& N5 G. S. F' k( Y
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ O$ r7 }. q; F
   VMMCall Get_DDB
# n# j, Q6 A+ p6 i   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 ?* K5 |$ ?: [7 p! A' L( J

; E2 m4 J8 K' V+ Y' vNote as well that you can easily detect this method with SoftICE:
8 d: P9 Q% F; u, ~! B; F: x   bpx Get_DDB if ax==0202 || ax==7a5fh$ [1 a( c) A8 A: _& o1 \9 w9 c3 ]

$ z& @- j1 m- ]( H__________________________________________________________________________
  i6 u7 l; E% g7 d! N7 A9 x7 j! u$ l0 e0 i
Method 10
% ?+ `7 k* d, d, O=========4 f2 w7 A+ z2 g7 h* q
% v2 `) c+ Q1 ^# E) l
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. |( J, o; l) g& ~7 Y! p  ?) }  SoftICE while the option is enable!!
% T& }. a* Q$ d. p8 p+ B2 t/ |9 h: B: N$ a0 m# v
This trick is very efficient:: F! M1 _6 H5 f
by checking the Debug Registers, you can detect if SoftICE is loaded" \9 U4 n% c: }9 u6 f
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 f+ m6 b% }& m! Y; j+ w
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" o. X; a3 D: E: O( Jvalue (in ring0 only). Values can be manipulated and or changed as well
; Y1 m1 H( v/ t* v/ ^$ c(clearing BPMs for instance)
4 a, x0 ~* U# w, b% F( X' z$ r) Q& p6 \5 u7 q! e! v2 F4 r$ g
__________________________________________________________________________
" v# z% H8 }4 V
3 t! s$ T5 D! W7 O/ S/ q" WMethod 115 E4 J! ?8 @( ]. G
=========4 T8 Z6 U/ M7 {; n8 @
" j& l' j8 y3 Z- H9 u$ g+ O: W
This method is most known as 'MeltICE' because it has been freely distributed
/ Z( c& u6 U5 r2 [; Bvia www.winfiles.com. However it was first used by NuMega people to allow
5 |4 ~* ]1 v. N0 r6 j+ h0 {Symbol Loader to check if SoftICE was active or not (the code is located
/ z. L5 b; h% U9 hinside nmtrans.dll).8 c- i  k. L4 w

( s( n) _9 }$ lThe way it works is very simple:
+ k# n9 Q# N( p0 q8 [1 W5 U1 JIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 i* g  G" v' m) ^, }
WinNT) with the CreateFileA API.# b1 t; P# a" ]* A/ T2 S+ E

' e: c$ ]3 S: F" iHere is a sample (checking for 'SICE'):
' ?, `4 b/ B' m# `( Y: {
6 I( O+ Y+ S: A5 h, s% fBOOL IsSoftIce95Loaded()8 b( t8 }' c) d8 T. e6 a
{* w. q+ r$ [' V* Z/ r
   HANDLE hFile;  , b5 h4 R+ x2 ^$ j7 P
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 ?$ s6 d1 x5 h, n+ i: Y                      FILE_SHARE_READ | FILE_SHARE_WRITE,, h8 w! @7 W$ I7 O, O8 ^
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
% a1 s' O0 W: ]7 G6 N   if( hFile != INVALID_HANDLE_VALUE )
8 s- z2 H% Q9 i6 a   {* s  I/ Z5 l; |
      CloseHandle(hFile);+ M0 i6 g9 D1 i+ x' e
      return TRUE;
( h3 \! I4 ~# \, Z7 C# T( n   }: C! g* q8 D2 }8 u) B& N
   return FALSE;, \/ d$ v3 z. f- x$ \; f: I
}
/ Z6 H# G3 n1 l( l6 {, a8 G( i, M2 P% y5 O
Although this trick calls the CreateFileA function, don't even expect to be
+ _$ D# R" q6 L: J8 R% F/ `8 Z) w: Oable to intercept it by installing a IFS hook: it will not work, no way!+ ~  ]8 W( l; }1 e8 y6 q% f' c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F& `- n9 x, E" D+ e- y# I
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 Q' |! |& o$ V2 Sand then browse the DDB list until it find the VxD and its DDB_Control_Proc2 O9 a% _% o' s2 {9 h4 f" b
field.+ }- s  M' J! t( ^5 _; g" H# S
In fact, its purpose is not to load/unload VxDs but only to send a
" c$ R9 T4 Y5 b) ~2 B: AW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 p2 n5 c6 [. J) O  J; g
to the VxD Control_Dispatch proc (how the hell a shareware soft could try0 K  h* N. S  I! \) p) {
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" ?* r8 ?8 E6 `If the VxD is loaded, it will always clear eax and the Carry flag to allow
  o" o" o! _# Z0 q  f' Mits handle to be opened and then, will be detected.+ D; o/ ^5 o, p, }/ ~3 ]- h
You can check that simply by hooking Winice.exe control proc entry point
8 ]2 L  ]7 z9 Z8 j0 ?' }while running MeltICE.
6 x. l4 A, f2 D, v. w$ S' k* G' y+ z+ ~8 W, s0 M

. p# ?% P- y1 y' r3 ^, _$ W8 }6 O  d  00401067:  push      00402025    ; \\.\SICE
# `0 L) p" [7 i9 W+ s  0040106C:  call      CreateFileA7 k2 ?8 E- K* N; B7 p+ G
  00401071:  cmp       eax,-001
* p9 D2 [9 F* r2 j: e  @) f0 z  00401074:  je        00401091
7 X: n) i, i/ y" R) n6 W2 d3 ]8 y1 _7 V5 R  w
& }* H2 ^1 {0 o, H5 C3 D
There could be hundreds of BPX you could use to detect this trick.3 I. D- k6 \1 h% `( R* E  g
-The most classical one is:
) U- I& b8 N% A1 ^4 C  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" K& E  Z+ P" f  V
    *(esp-&gt;4+4)=='NTIC'- v% c6 e' J* f7 Z- h, |

' S. `3 Q/ K$ l2 Y. J7 E-The most exotic ones (could be very slooooow :-(
, d2 |% M- R; R   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  j5 O( ]6 K8 n# S/ ]  ]! g     ;will break 3 times :-(0 p. k8 f- ], K& |
# N; e# F; M+ u& f/ ~! e/ o5 t
-or (a bit) faster:
+ i: e+ [% f+ s( i/ r" k% O% m! u   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 q, S$ k  ^8 _- J# E0 {/ j, P& ^: M& ~, E! E/ J& B3 c
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  2 ~- A' z' o; Y7 A1 {  X# g
     ;will break 3 times :-(2 m" G" D* }* M% |& d, v* G( F

! T4 ]1 q4 Q' q-Much faster:
6 K7 x9 v) v4 z. Z/ B& D7 v   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 J7 G2 @5 B2 \" ~7 y& }& U

$ @, A- X: G7 p9 eNote also that some programs (like AZPR3.00) use de old 16-bit _lopen9 z, g9 B! G- N  ?% T
function to do the same job:+ c7 U" y5 ~6 L1 p/ G7 p3 n  @
* _) ^: y' B" `* |# J4 y: k
   push    00                        ; OF_READ
7 [$ t% C2 e% {$ E* ?* u7 Z   mov     eax,[00656634]            ; '\\.\SICE',06 q# t' U+ o, I8 s7 ?3 n' j0 H# s
   push    eax1 K$ l) [# n1 \% c2 J# j; @/ c. J
   call    KERNEL32!_lopen
, a/ w8 _. C% D# e   inc     eax, t, c, S& h1 A
   jnz     00650589                  ; detected* x: ~; I9 L& l. R0 i% A. _
   push    00                        ; OF_READ  K- ^! |& {! d  d" G# x; t( y
   mov     eax,[00656638]            ; '\\.\SICE'
& k- {, l  C8 N& V! ?1 y7 f   push    eax, a7 V. K3 c% |) j2 h% y  k
   call    KERNEL32!_lopen
6 Q9 L% g' k. F1 f5 _: s" J   inc     eax2 y( K+ k6 Q, i# j
   jz      006505ae                  ; not detected
5 y3 w7 d" J, i2 `0 j: Y
: r8 H* o) L5 z
, u( x5 a8 T5 M. g3 C__________________________________________________________________________
0 o. L3 r' R  r" g2 t- p$ B/ ^2 M  f+ w
Method 12
, e2 D3 l% y$ i- p=========
# y# K2 [9 i8 J8 i3 C* ~  n
# w; \7 [7 v# Z2 f8 UThis trick is similar to int41h/4fh Debugger installation check (code 051 |/ B4 N4 ?+ Y' l
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% Z) k# M* B) v, g( w  J: \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.8 W' h3 l9 q" |- c; o/ p

" M( u2 K; T- e4 r, L) `) C5 q# {   push  0000004fh         ; function 4fh' f6 q9 }6 r$ p# c
   push  002a002ah         ; high word specifies which VxD (VWIN32)# J( |" u) N+ F7 D/ J6 G/ Y2 x
                           ; low word specifies which service
% T- B5 ]. u- z6 N3 c: I                             (VWIN32_Int41Dispatch)  G  J& e; r! m  I( v6 a
   call  Kernel32!ORD_001  ; VxdCall5 Q6 P2 v6 A. Q8 q8 K
   cmp   ax, 0f386h        ; magic number returned by system debuggers
. }: E& c) ?: j; D* R  b! y1 x8 v/ ?& k2 x   jz    SoftICE_detected
+ @! w8 Y2 A) i( h3 E) w5 L- Q3 s4 _0 L& V
Here again, several ways to detect it:
. G* D' q9 }7 L* t( P" T& Y* M# a. V/ Q
    BPINT 41 if ax==4f
& z; c5 K' L- e+ H1 [/ g% Q% |& @& \8 |% B" X
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 C( b- B. L# Q  S5 _  S1 {, ?: M! P1 l* h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 t. q4 m  w  B$ [2 m4 a/ F: B( f) }4 t2 K; Y
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) n+ v: F0 K3 |4 N1 T7 f
" Z3 B  S8 o9 P- J+ U
__________________________________________________________________________
8 B. b+ _- Z/ ]) t3 c3 K
% s. Y' b. T/ y5 L" j) G5 i  NMethod 13! D. T- f9 s# |; I# Y
=========  p, f4 N" u( T1 X0 g

4 A7 b' L  D; [3 v: K7 N6 aNot a real method of detection, but a good way to know if SoftICE is
# ^3 w1 @* Q0 l3 i/ @' H2 ninstalled on a computer and to locate its installation directory." B+ q" Y( I. T0 \* Z* c" W
It is used by few softs which access the following registry keys (usually #2) :
" W2 v: I7 Q3 O2 @7 y, c
" d: J% B: o9 u7 x( k, n, A-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ N3 @& v2 t+ |" X: I( d\Uninstall\SoftICE
  }: k/ k9 T8 o) l( y7 [! ~# _-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE0 K' Q4 J& i1 l: V3 a
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 P7 {: E' f6 N; Y* t\App Paths\Loader32.Exe: C! v( @; G! t& _$ R
/ [5 s4 _5 u* n* ?
! {" c( U. k% v
Note that some nasty apps could then erase all files from SoftICE directory& m. _' d- l. i+ ~6 m3 B0 m* e
(I faced that once :-(
6 R8 p0 q6 s' G8 `2 V( s
, _6 b. J9 N" g: `8 n! k! t$ {Useful breakpoint to detect it:7 Q. j  y% i5 |: |' \2 G% y
4 t) `- K2 f0 r. I
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& V: K6 R1 L1 s+ }: ^: S" H9 @% t$ t( k
__________________________________________________________________________
5 n" V$ k4 K% m, y+ F/ `
  A/ h0 A5 l% ]# m" L
5 P+ {+ @# F% q. U: x* p& J3 TMethod 14 . [0 V6 j' d  b9 x! v% W8 }3 v
=========( h$ R9 k. C- |6 y" K

. e0 {7 R& f& |! H' wA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose- D+ H( k% ^7 j( Z& `# n4 O
is to determines whether a debugger is running on your system (ring0 only).2 i4 D- ~% N! U4 i

3 y6 Q8 {0 h- R2 R4 w5 X  s  H$ u1 u   VMMCall Test_Debug_Installed6 l5 E5 V: M/ B' H
   je      not_installed
# M4 w) ?4 J: k4 J5 y+ j( J& e: W0 U2 E* p1 U
This service just checks a flag.- j  A0 \' x+ H. L' t5 x+ ^+ a
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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