About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) o5 s% F, y# [  m' A
<TBODY>0 d2 {- o5 ]0 V: ^, x3 H
<TR>
. Q% b2 D, o  {% I, `) L<TD><PRE>Method 01
# f: i1 n" l$ |=========
  [- l" j3 K2 L3 j0 L6 |& N5 a6 ~4 p4 a/ I- v$ Q( b1 _4 F* n
This method of detection of SoftICE (as well as the following one) is
4 v- q* p) E, _: C/ {used by the majority of packers/encryptors found on Internet.
% S1 n# L* l. M+ RIt seeks the signature of BoundsChecker in SoftICE4 j3 m6 m: j, p" h# c( e; ~9 Q, y; o
6 X/ T' V& d& Q( z& @
    mov     ebp, 04243484Bh        ; 'BCHK'9 u9 g) {) _7 C( j( l
    mov     ax, 04h
$ M: @. r; l" y2 B* z    int     3       2 F5 {4 q. h0 [1 F
    cmp     al,4
" E2 D" u; s3 x    jnz     SoftICE_Detected( N& _& T, z, s
, M1 r2 o- o' P6 d& \
___________________________________________________________________________' K9 e) y$ L( P; j
& P/ J( @2 k) [7 e6 L9 Q/ _0 ^$ E- M
Method 022 x* @- |; P3 z; h: H+ A9 J2 N
=========
! O* {9 B' P8 u3 {) J% V& _; G* q1 j
Still a method very much used (perhaps the most frequent one).  It is used. y3 O$ X% F6 J& J4 v
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,, F% i; U6 v, p
or execute SoftICE commands...
: @  t. F, `* `0 l- p3 \It is also used to crash SoftICE and to force it to execute any commands1 x/ Q- v# G! M5 X
(HBOOT...) :-((  . O0 r6 Z, v( j' h1 V
+ r1 c/ }& v5 J' C1 X
Here is a quick description:* L# t0 a$ ~+ n% i$ E
-AX = 0910h   (Display string in SIce windows)) A) z- X7 M+ I: P1 R5 W8 ?
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* Q& B, ?2 K4 U) t3 f
-AX = 0912h   (Get breakpoint infos)
6 {- i( x! w7 J-AX = 0913h   (Set Sice breakpoints)/ h4 P6 Z& Z/ R% d% C
-AX = 0914h   (Remove SIce breakoints), k8 w/ h3 r* U( V6 f

# u% Q2 T) ~9 SEach time you'll meet this trick, you'll see:
1 C* H4 H" g( g0 E3 [-SI = 4647h2 G4 o  A, h( S- \
-DI = 4A4Dh# N: c" U9 |) C) C# O1 Q& s8 a
Which are the 'magic values' used by SoftIce.& D- j4 F9 S! x
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* X  [) T2 H% w* f$ Z7 p/ C
" w  K  M* t3 V! Q/ b: W
Here is one example from the file "Haspinst.exe" which is the dongle HASP2 _$ Z7 g* e3 |8 d- [
Envelope utility use to protect DOS applications:
& k& d( v1 f9 x7 C% S! C9 t
1 _4 {# Z, ]* A2 N$ \0 p: J; Z6 i$ g& v  K
4C19:0095   MOV    AX,0911  ; execute command.4 L2 H4 |3 U. c6 L
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 k* ~1 o! a: H- ^5 I6 c) A
4C19:009A   MOV    SI,4647  ; 1st magic value.
9 ~+ G. U) t6 h, H; @5 i* @3 ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- q0 ~# f/ ~8 j+ S! |- I9 _2 V$ l3 ~
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# L7 f2 t# {: p+ o
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  j0 d- Z5 n/ U
4C19:00A4   INC    CX% R8 P$ N# k5 i8 m7 k- S
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# K. o7 c/ `& Y4C19:00A8   JB     0095     ; 6 different commands.1 |2 P. Q6 N4 m/ z4 f% Z( z# N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
6 {2 p0 A# u7 L0 p  {3 _# o: r4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
! H  n$ Y  t% c" ]$ H6 m* @& R' I# y$ I) x2 B8 M/ j& K
The program will execute 6 different SIce commands located at ds:dx, which$ s: T: L5 h; H3 o1 W( C* F
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ h9 d# y1 g% [% A- \! X# s
% h! I" n) C1 R( d. N$ I$ h  L
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 J% Z  _/ _. a6 Y; ^
___________________________________________________________________________. R4 e9 b% M% l! K: T

. ]9 B$ k3 {" q  c3 \8 @  V
3 ~3 b9 d- j2 o* [% vMethod 03
- l2 G) W$ d- N* H7 r% E) Y; d( _=========
/ z7 L0 N) |: H! ^3 ]
; v8 ?& L$ S, p  H$ eLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: y* l" ]7 H! L; ~7 ~(API Get entry point), j, L( q2 u7 S- T
        
" s9 e+ J: l' K* K8 O% ~! A5 t9 _$ i/ @5 V1 K4 O+ p) z
    xor     di,di
; c- g8 B, `3 r5 w: g" c6 B3 H; o    mov     es,di9 t! Z- B" {6 {+ q
    mov     ax, 1684h       . }  P( r4 c. D
    mov     bx, 0202h       ; VxD ID of winice5 i2 H. ^# j( M  {. w3 V6 C
    int     2Fh
7 |$ F" o5 v  g# \9 ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point" v$ P/ k! g8 ~5 |* f2 k+ y
    add     ax, di
3 {* M8 \. J2 S2 g5 D2 E    test    ax,ax5 @3 K2 a0 C2 V
    jnz     SoftICE_Detected0 h: v' H8 J1 a) `( J
: K$ Y( {' x' o
___________________________________________________________________________
9 j$ V- N% F' D0 S" g
$ h) [8 a* q6 Y; b. z; j' ~Method 04
. e% ?. B' |: T% O" o2 t; L6 |; u=========' ~/ B. E6 d4 w2 t: C
. d5 T+ ?1 n( ~: ]1 D
Method identical to the preceding one except that it seeks the ID of SoftICE
0 z9 d4 b2 {% `3 K$ E- W6 ?GFX VxD.
8 s1 u5 b0 n4 T* N6 e7 G4 o$ N8 H
8 z, f1 V- S) p" j3 q4 ^0 |    xor     di,di
; z9 `8 g8 s; e+ \& y: i1 P$ N& a    mov     es,di9 _$ F, K  ~  Q" w7 T& G- O# C# j
    mov     ax, 1684h      
8 y* o' b8 ~0 L% z9 s. S    mov     bx, 7a5Fh       ; VxD ID of SIWVID; Q9 G9 @6 \+ J3 O* V/ t
    int     2fh
5 {& [6 l/ e# Y$ A) b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: F1 ~, m7 n" c, I. @1 q3 a    add     ax, di" `6 @  B6 w% l! \" T/ b/ F
    test    ax,ax
  ^  a1 o# m7 h4 }2 n    jnz     SoftICE_Detected( U% z! z$ R- K" O8 a8 S0 w0 u
6 ^! y7 m" i. ^; R
__________________________________________________________________________, ^0 e; `+ W7 n/ q8 @9 W

( \, q- ^% S5 o& {
- w6 U! R; O; {- w6 C& ]5 SMethod 05
( N# X9 q( u7 t# ~=========9 d* W0 z1 ]4 c8 P2 l3 _. t+ W
9 x( {: e  N# t; c
Method seeking the 'magic number' 0F386h returned (in ax) by all system
7 H3 l9 N. C5 `debugger. It calls the int 41h, function 4Fh.1 d0 O. {6 z$ d
There are several alternatives.  ) p/ U# [0 s' O. C

2 {: `) c/ H8 iThe following one is the simplest:
. x: Y8 N6 s5 w( J2 V3 R# B# s" Q5 G
    mov     ax,4fh$ [6 W$ l, J( m
    int     41h
+ Z, T% S8 A# G- X1 V    cmp     ax, 0F3860 S& g8 n5 Y/ B) x; g
    jz      SoftICE_detected
1 v% J4 K7 c, G, X9 C; K( ^0 k* h3 f+ [# c

! P8 l8 n4 Y8 D3 f+ [9 U1 x( JNext method as well as the following one are 2 examples from Stone's - S* T+ i, Y( Z, U
"stn-wid.zip" (www.cracking.net):
# c# x7 ?/ U9 B% Q: n$ g2 T- y2 q/ l/ U) J4 w" c' p/ u+ p
    mov     bx, cs" A) |) [/ s5 Z$ r: H- Q0 ]
    lea     dx, int41handler2
8 V4 y5 P3 x2 W9 f6 Z5 I    xchg    dx, es:[41h*4]
% @) T: j/ R+ X    xchg    bx, es:[41h*4+2]
; j! p/ t9 Z7 K/ M    mov     ax,4fh" a! e. s( U8 {: O. w9 ~7 f, v' a: A) k6 ^
    int     41h
. [- s- |# ]. h' u    xchg    dx, es:[41h*4]7 T0 {( H0 q/ l! f. R/ M5 Q
    xchg    bx, es:[41h*4+2]; W: z/ p3 U1 E. w
    cmp     ax, 0f386h
/ G- \0 U! N7 ^1 ]$ c" q    jz      SoftICE_detected
* {( E8 O% M1 [+ F  G& ]# V. y! r  r  ~6 w' J" D9 d- L/ b  {' ^
int41handler2 PROC% e( I1 {$ K1 t1 R0 Y
    iret
, R  ]" W. a* kint41handler2 ENDP: w  p* `  V  f% d/ p

) D* R0 B: i  T5 q$ A9 Z* `: ^: u' e  G' D0 n& o
_________________________________________________________________________
6 x7 u$ Z8 X4 @; V4 A& q5 J
7 i" L5 J% N  Z8 @
* A& _* t* ?& b2 J* O- }Method 06
9 H' x8 R- b4 T# V( I9 I: C# ]: v  P=========
4 O  M1 d; W9 B4 x: |0 S( U9 j# X3 U3 Q5 ^7 r& ]( p

- t  y0 E0 E; q2nd method similar to the preceding one but more difficult to detect:
4 r7 N; @! {9 N
/ k" l0 l' o4 o% u. F
" K' i# m; @" e+ L3 w. dint41handler PROC2 P- {0 ]/ G  J7 V4 v
    mov     cl,al
- R. K. H& Q3 P. D% {) ~, j    iret
$ q7 n1 X1 H# P/ C: ^int41handler ENDP7 I, o  {! g9 v7 i

1 e9 I7 g; D9 w% e. |( j" M  p" R8 T' {
    xor     ax,ax
5 A( ~* U' S4 R( s4 q    mov     es,ax
" f$ ~& S0 Z8 ?. _    mov     bx, cs
7 a3 Q' H0 \; h* W* r2 F    lea     dx, int41handler9 d: g. c- b) `
    xchg    dx, es:[41h*4]
0 q/ m6 ^7 Y# R) X8 K9 u7 `    xchg    bx, es:[41h*4+2]
4 B/ l; E1 x, s2 M& A! r0 I    in      al, 40h& d6 a0 b% J  \8 p. a
    xor     cx,cx3 `' s3 k  U: r8 }- o
    int     41h
0 [; i. O. B) S# n    xchg    dx, es:[41h*4]7 L, m' ?# w( i: L, q$ u& `& T
    xchg    bx, es:[41h*4+2]5 E2 M- ^3 N4 D! h: |# h) D
    cmp     cl,al; [! s7 I- c. z5 Z1 i! Y% q
    jnz     SoftICE_detected& `! G9 Z+ }% O" I

! o/ V. D+ @) f& _3 c# u_________________________________________________________________________
4 e" u8 P! f6 a) t) L
% L7 A# V/ e5 t! m* M7 H% e6 ^$ L  ?Method 07
# w/ i% v) W- A* u# T=========
- ^* \9 x. M: N3 i) b9 n4 A' E4 w  y+ e8 C/ e0 g% X  h  E3 K
Method of detection of the WinICE handler in the int68h (V86)
! y6 q- v  Q5 }: D. M
4 f2 D, V" |' o. Q3 s! t2 n    mov     ah,43h
6 S. `) }8 j& C: f    int     68h
4 d2 n9 Z$ I- p2 u9 \    cmp     ax,0F386h
' U8 y) J9 L" {  {& I' ?9 W    jz      SoftICE_Detected# p+ h2 s  I& ?6 b4 ?

4 C4 g, j7 w( B7 G; C+ k
3 s$ X) Z& Y0 x1 p; m! u=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit0 w9 q. J6 O8 K# F
   app like this:/ i8 F; j( V: Q+ `0 F8 |( @4 u
0 M  h! C0 p/ H2 D6 F
   BPX exec_int if ax==680 y  Q5 w+ V& a" t: V  t/ c
   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 s$ z5 }; ~: m   located at [ebp+48h] for 32Bit apps)
; \. Y: d8 C0 C__________________________________________________________________________1 I& P" Y+ c6 S5 W
9 n; e5 I( A8 n7 h/ ?& a& {

* R7 N+ Q) Q: A* o% U& o$ C; aMethod 089 l$ i; ^; {4 }2 |( ~$ B* S
=========
: D( v" g. t' i8 _' G3 d, k8 s# h
It is not a method of detection of SoftICE but a possibility to crash the
- i0 e) b3 f; }  _# Y1 ~/ o8 esystem by intercepting int 01h and int 03h and redirecting them to another
3 f; q6 g& S$ e( p- J3 nroutine.  b, a1 A& M. b+ U- i' o/ O8 ~
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, f) W1 e/ ?% P: d
to the new routine to execute (hangs computer...)9 j- N' J" A( ?  |- z) P

! E6 I# W/ }5 [! _, x    mov     ah, 25h- }- o& a# ^5 h- s' F$ ~
    mov     al, Int_Number (01h or 03h)$ I' t& L+ S+ u. N1 t' ^3 B# o, |
    mov     dx, offset New_Int_Routine
7 c( \" n' q; N$ P. l, e: k0 y    int     21h+ P! M7 E, v+ N$ Y7 A1 o
- G2 h5 l& J( m& G3 D
__________________________________________________________________________
! D2 K! u. r9 R; f' Q+ Y
* d( C: t( u4 Y# g% ~7 e+ F" }% nMethod 09
! G6 A: s4 p4 y1 O1 g=========& l& F  \4 l9 f5 w1 P& L

  i, m' |2 y$ e8 R& j0 `  [This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ S6 C& {5 w# \  q
performed in ring0 (VxD or a ring3 app using the VxdCall).
+ m- @( C% b1 s! oThe Get_DDB service is used to determine whether or not a VxD is installed
- N) j2 l8 U) L1 h7 D5 Lfor the specified device and returns a Device Description Block (in ecx) for/ I; b$ y7 s% b' E
that device if it is installed.3 z1 {: a9 `; j2 R/ L; T8 {

' `, T4 u  m3 V- F, t; C! H   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 Y2 A' b# Q8 x* [, J/ x0 u& L4 [& U
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), z5 |5 n& a# C, l9 E/ q# a) V$ C
   VMMCall Get_DDB
! E( U  j6 o6 f6 a. g- k1 E1 t0 n   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" i" k1 ?: F6 O  e& D
" B( X4 w) [( `/ `& F
Note as well that you can easily detect this method with SoftICE:7 a$ }' e  @2 ~/ O4 N. j" ?
   bpx Get_DDB if ax==0202 || ax==7a5fh
. E4 H* f4 O4 g6 J2 a- {, A$ |$ ~( e3 ?/ p# \; C
__________________________________________________________________________
: F0 E. q5 _# u; z+ q8 H9 h0 F; [, C6 k2 r
Method 10, [3 Y/ D* t! J6 M
=========  x0 B" K) q) [# I6 W* [2 w

; u' ?$ L0 J* b' t4 k$ @2 I- _=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 h  C: f. `, l# X0 c4 i  SoftICE while the option is enable!!: i5 u4 b' @7 ^% E& r, f6 r) p4 }
1 H; E. L1 d4 Z
This trick is very efficient:
" ]" @* F9 y8 i2 }4 ^% Lby checking the Debug Registers, you can detect if SoftICE is loaded6 }. z! {/ X$ |# h  L& Z. Z: l9 h
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% ^6 S. [; @# q) u0 ^/ Rthere are some memory breakpoints set (dr0 to dr3) simply by reading their# f6 N/ j. w% h# L4 H* e+ E7 s
value (in ring0 only). Values can be manipulated and or changed as well
$ f( N7 k% j# |, L1 {(clearing BPMs for instance)
8 F5 R' r$ Y! I. n, C* [# E- ]0 w9 ^3 }# C- w" k3 P4 u- q$ p
__________________________________________________________________________+ P0 l, ?4 j# p' f
  o! Q. b* B9 a* N" d2 ?( [: v
Method 11
! W/ U! f) N  t0 P, Y+ G4 E3 T=========3 v6 G" Y$ o8 I# N! `. n
* \" {, D( p/ l% U3 n4 l$ ^
This method is most known as 'MeltICE' because it has been freely distributed
: S  K3 X+ b: I; }via www.winfiles.com. However it was first used by NuMega people to allow
& E4 s+ K: A# L- V5 q2 D* GSymbol Loader to check if SoftICE was active or not (the code is located* B2 q; ]3 D. z9 X* ?+ n( @
inside nmtrans.dll).
  G  b6 r$ P- S6 A! b6 c" v8 Q! m  l$ d5 o+ X% S' `/ k7 r  f& b! l
The way it works is very simple:
7 ?5 r. b$ V7 C; h( ~, XIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( j& d2 J9 h; V& Q. _. sWinNT) with the CreateFileA API.
% B& ^  M, b" ~! H( X. }. ^, H$ u7 b) k4 t
Here is a sample (checking for 'SICE'):
6 A  ]- n% |. B; ?( m' c4 H6 c* U( \$ v2 D& G+ F& i
BOOL IsSoftIce95Loaded()3 x& ^) b. y5 a
{
8 C" H+ I/ ?2 J+ u   HANDLE hFile;  
# K, R0 T  d5 d  Z3 K   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
- k. l) f6 p, ]0 ~/ l+ [                      FILE_SHARE_READ | FILE_SHARE_WRITE,' E6 }2 d  Y- z& O
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" i8 V6 L3 V, r# [* N: C8 k. i2 y   if( hFile != INVALID_HANDLE_VALUE )9 Z; A/ k( G) ~6 j: ]
   {$ ~& f7 `' a. _+ e; [+ ~* r
      CloseHandle(hFile);
; ]6 Q; f) I* U9 J. @      return TRUE;
8 s& q8 [$ |$ _$ X9 Z! m" w7 l$ h   }8 x. f' P* T5 B1 M
   return FALSE;6 U* p! D5 E$ B' _" T* t" ^6 ]
}3 u1 a& [+ h. d$ ~0 D1 I* h8 P
6 X! \" ~' r. M( C8 A7 g
Although this trick calls the CreateFileA function, don't even expect to be
5 j0 l) `4 T! ]0 z; T; qable to intercept it by installing a IFS hook: it will not work, no way!, J7 V8 w! l6 z" y1 D
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
) f* Z, h" p1 s7 i4 B2 j- W6 ~service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 r) f4 Z' ^/ O* N; O( r  o  K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc/ E! X, V  H% [5 h( e* }; G5 o
field.
, {. D  W, K; X( Z! Q8 P8 }In fact, its purpose is not to load/unload VxDs but only to send a 8 {+ I. Z1 {% C$ I7 G% `$ z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' u  U4 ]. w3 ]to the VxD Control_Dispatch proc (how the hell a shareware soft could try  d8 c+ }+ M5 V* W) D. x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).3 I: k6 M' x( {* c
If the VxD is loaded, it will always clear eax and the Carry flag to allow
7 u2 h% p) O! |4 O/ Mits handle to be opened and then, will be detected.% R& \: s& d$ N7 e" v0 z" h
You can check that simply by hooking Winice.exe control proc entry point7 o$ z- y8 I& L
while running MeltICE.3 P- z9 _5 R, m8 O# D6 ]
0 x" D3 m0 O& E4 R6 t0 h
* J4 {) T, ?1 d5 U& m7 r
  00401067:  push      00402025    ; \\.\SICE9 I; Z) ~8 u3 R) V0 P/ l/ H6 y
  0040106C:  call      CreateFileA9 T# c; t$ O# ^
  00401071:  cmp       eax,-001
  E" ~; \* S/ B  00401074:  je        00401091
5 N* m4 A$ @* Z% S3 n8 l! k8 i0 j2 Y6 y$ h4 T1 @  K
; i! `0 T. F, O: N; e. ~- u
There could be hundreds of BPX you could use to detect this trick.
  a4 s9 U5 x& c2 L- H# g-The most classical one is:& {/ A! L0 F/ y
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! k5 T& \! v0 C
    *(esp-&gt;4+4)=='NTIC'; f8 l6 p* U) n, C- d

, \7 q/ \7 t5 b" q4 ?: B-The most exotic ones (could be very slooooow :-(- Z- q! k6 Y# ~& n( M
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, Z  t8 T& I1 `* I     ;will break 3 times :-(
4 V6 D( y) u4 m- L" @% r) m
2 h- f; H" d3 }! h' O-or (a bit) faster:
+ V; }2 \- P: g4 V- c5 }   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). q6 a4 _0 h' \/ T% d

) E# C: y4 S4 I. ^( ?% K# W   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
. C; z) m) `' R5 M6 B     ;will break 3 times :-(/ r2 A2 r3 r& B' p4 C7 H. F
/ `. @4 c( [3 F* P
-Much faster:% H' T+ S, @, n  l; h! n
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'/ o- @* S( Y( L3 I! U
# [( c0 A1 y% m8 s- P! v
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 u! J3 z1 I' V. ?# gfunction to do the same job:
& ^+ x. v; P- E! Y9 e' G# i$ V) H3 N+ o
   push    00                        ; OF_READ
) [" j; B# ~1 V  R   mov     eax,[00656634]            ; '\\.\SICE',0
3 A* n6 h7 F# s' v# R6 m3 E$ i1 M   push    eax% K7 A: `, b' H6 a4 k
   call    KERNEL32!_lopen
: A: L' K8 ?" M   inc     eax3 v+ E: l  A9 w2 [& L* i
   jnz     00650589                  ; detected4 A, v. O1 K+ c. x. X+ {1 j  s6 H- K
   push    00                        ; OF_READ
& a2 J; X( x( u( }4 t7 Q' X   mov     eax,[00656638]            ; '\\.\SICE'
: b3 F! X# t5 f" f: L   push    eax) y/ p9 n. Z8 [3 T) L; }, l
   call    KERNEL32!_lopen
* ?6 p. E* B8 o& b   inc     eax$ C0 J, @9 C2 I2 E2 z
   jz      006505ae                  ; not detected7 s0 ?) d! `1 _" s5 R# o' n
) {. G- _% R( S5 }; ?' Z3 I
0 m) y/ s; r8 G$ d8 C
__________________________________________________________________________
* d3 O/ q' V* ]1 C% A
2 F2 F4 ^+ e: u# ], t6 `Method 121 q/ P! W* Z4 x4 @. g
=========6 Q6 X) j0 D. V" ]/ _
: W* V0 s0 V- S- n5 m
This trick is similar to int41h/4fh Debugger installation check (code 05
; K" F' P' {/ w. ^# j. {&amp; 06) but very limited because it's only available for Win95/98 (not NT)* w) x5 r! W, _6 W+ F+ F  G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
+ ]8 V5 f% P4 M1 d4 D. `; ?  t( {7 I& C- U- D) R
   push  0000004fh         ; function 4fh
7 P% S+ w& ]) l( N& E' W0 w   push  002a002ah         ; high word specifies which VxD (VWIN32)0 ]+ w' `( E/ M/ O; t
                           ; low word specifies which service* X  F: {4 m/ l! `0 ?% d5 `- {
                             (VWIN32_Int41Dispatch)  X  D& ]0 B& o9 s6 d. H" S
   call  Kernel32!ORD_001  ; VxdCall
1 N9 X& k: U. }   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 g5 x0 ]* |2 [) f5 q   jz    SoftICE_detected
- j, Z  G6 \+ ~. O. t9 X. N
& q8 X( v6 ~. j* j& ~6 Z% mHere again, several ways to detect it:( }/ U) m4 b) F) K) t) G
1 S( J% B8 t* A: ?
    BPINT 41 if ax==4f/ U+ e* h3 x+ {) O
/ K; B4 D  m7 X7 n$ ?& {% {( v
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! m. `$ @/ B8 t7 J1 }$ x7 _9 `
7 [$ n" X5 @; a9 {0 A
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
# K3 H, D% E# O
+ P/ e3 [& Z& e0 l. m/ Q* O, X    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 t: u* _; ^% T
" w1 L% c0 c! P. |+ P3 ~  Q2 ?__________________________________________________________________________( @+ F- P6 l* e. G1 s  U

% e% ^: S4 g* {4 rMethod 13
/ a: @# s7 g7 E' a=========
. `+ l' r. I2 x6 V8 G: ?. P' R% e/ B9 O- y/ R9 ?. {4 K7 g
Not a real method of detection, but a good way to know if SoftICE is: q/ r# v5 T0 C3 s
installed on a computer and to locate its installation directory.6 ?6 O% k/ x- U) k
It is used by few softs which access the following registry keys (usually #2) :6 Z7 s% w' J3 ~1 b" H6 E, V
; D% B) t4 Y6 A
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, z' S: e' ?+ i5 V, b& a. n1 Y4 X
\Uninstall\SoftICE
' K& ^5 V1 Z8 ?  R9 ?+ }' F-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 h0 E4 O1 O; W+ x- s-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: z8 {+ B  }: q\App Paths\Loader32.Exe
6 W$ u( s) |# J6 y( F2 z: n+ B6 t
' }4 k8 [4 Q3 B* s6 O/ B
! C3 v/ O  i. ~1 {Note that some nasty apps could then erase all files from SoftICE directory
. `4 @) h5 X0 m- E* L(I faced that once :-(
7 u& p8 S8 R9 P7 V  l' q
- s1 d: u  v5 F6 mUseful breakpoint to detect it:
! R! m/ X8 o7 ?
3 W0 B4 w$ Y8 u. S; S, H     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" k# t; k9 u0 c
" I$ g( O" Y' }" d__________________________________________________________________________* k- Y0 U% r# e: A+ Y  j
) p9 [' j9 ?+ p, u$ K

! b/ o, |' g" L) \; e! A8 nMethod 14 7 M9 N, l6 S  [) \5 C/ a4 v
=========5 P; v% e/ A& A9 e" ?

2 \: Z+ \2 V2 ~* z& j/ ~8 V6 HA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! k7 {8 b* A9 Y: r6 I8 @% C! ois to determines whether a debugger is running on your system (ring0 only).
" K! Z7 D0 U+ w& w4 [$ h3 O" b  C0 r
   VMMCall Test_Debug_Installed
2 @" s1 w0 H9 Q* M   je      not_installed: M7 y9 l# U  x4 \% L2 d: N

, h1 a" b+ T7 d- {; M3 M* FThis service just checks a flag.
7 P$ {9 l. h' n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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