About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* @1 L# _& j9 {% @+ X  A
<TBODY>. G8 h  R4 Z3 i
<TR>3 g1 G1 i: f7 |$ Z
<TD><PRE>Method 01 9 J& D% X+ R4 ?5 q
=========
, k) R- W- D, q4 T- u$ t. j) m; X* W* d7 i% i. e
This method of detection of SoftICE (as well as the following one) is0 h( s' f% }3 \) n
used by the majority of packers/encryptors found on Internet.
8 r( W9 n" ?  a. b. Y4 {It seeks the signature of BoundsChecker in SoftICE
: r+ M6 {4 V1 d  M1 ^' _3 [
# n* M  O6 O) P7 G1 X* `( s    mov     ebp, 04243484Bh        ; 'BCHK'' T  O9 L  {& J$ Q3 a7 d
    mov     ax, 04h
4 ^7 T4 `$ q' @" s) j    int     3      
5 s, W* K% n) @: w    cmp     al,4
8 B9 N9 N, A3 ~( Z6 T3 c0 b    jnz     SoftICE_Detected& M; x+ M, @7 J# C

+ K( K9 j/ [8 `1 B. D7 C___________________________________________________________________________
2 _8 Z) u+ v. j
% I- m9 a, X8 L- l7 W5 h7 KMethod 02
" B' g% v1 y% R2 m+ b: {) s+ Z=========
! d' @7 c9 t9 E9 f& g2 Y7 a# e" U. `6 a, k( W8 l8 J3 Z
Still a method very much used (perhaps the most frequent one).  It is used* N( }0 y, C1 ?" I
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 P. k+ P* p; f' Q3 _6 O
or execute SoftICE commands...
9 o8 W4 k) ^3 A8 T- ?  [* I1 \' nIt is also used to crash SoftICE and to force it to execute any commands
7 h7 q, O  q4 s2 w0 \: M" ?/ H, S(HBOOT...) :-((  
. w  A5 D. e2 V3 x$ X( {/ }3 \3 H# ]1 k2 s1 N- K
Here is a quick description:6 \  d7 B9 \) i0 m: g
-AX = 0910h   (Display string in SIce windows)( e; _( Y# N  `, I
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 {3 s+ U* x3 W) t-AX = 0912h   (Get breakpoint infos)
. i& g8 P, q4 v6 |; w5 l-AX = 0913h   (Set Sice breakpoints)
/ J6 m! X7 {! H) L! j-AX = 0914h   (Remove SIce breakoints)- u- W) {" e3 a/ r) }$ U) X

9 p" W- d7 \6 J% z# TEach time you'll meet this trick, you'll see:7 ]* k# B6 B5 H4 h. A" J0 C1 P
-SI = 4647h' I$ W& Z0 S' z' s5 }! v3 d
-DI = 4A4Dh- I3 }; q% M# E( A6 n
Which are the 'magic values' used by SoftIce.
9 o; b- A; A- J; Z( w2 l' E: X( t& hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 }  ^" [/ g9 l
/ m* ?5 A: k  d9 N# G
Here is one example from the file "Haspinst.exe" which is the dongle HASP& _7 `) [1 ^$ y% G# G0 y5 G! S
Envelope utility use to protect DOS applications:& }. W& C$ w! l; v& k' g! \

6 v4 F0 |2 x0 p4 n5 y8 U
  f1 \4 j& I# ^4C19:0095   MOV    AX,0911  ; execute command.
+ _$ S/ [( p$ L. |4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).& R2 O8 W' _( ?1 ^2 Z0 m
4C19:009A   MOV    SI,4647  ; 1st magic value.' R5 [% H7 n2 g0 e. ^
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 f$ d' [2 e, c$ E9 q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*); t7 n* b$ g$ n8 H/ H, B  J
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. j9 R- K0 T4 R( |' s
4C19:00A4   INC    CX) d' e/ k; A% ^( x
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ Q2 N! b/ b7 a* r5 X: j4 G4C19:00A8   JB     0095     ; 6 different commands.
: `- B3 |$ _* d6 R( C+ \4C19:00AA   JMP    0002     ; Bad_Guy jmp back.* ]8 l3 m7 {" l/ v- A  c( v, T3 B
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
$ i% ]" }' K( r+ a" ~( G- d# H+ a- u( U, ]( g4 K
The program will execute 6 different SIce commands located at ds:dx, which
6 J4 J5 B$ V$ j/ n6 o/ _8 Vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 y& N2 H3 ]& u! m' D3 d: w) t8 E& ^
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.6 I& S0 o& Q& R
___________________________________________________________________________
9 `, v6 C" ?3 w$ Z' P0 K. w5 a) `) J, \0 `) S

6 h* s9 W* W$ J* ~) d" a3 GMethod 03
1 R% ~/ q' u5 V5 B' _# I1 f; m3 J7 x=========
( _9 n, _% I  ~$ I& V  U
& w# o3 B1 H4 X+ H8 [Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: b# o5 @3 t6 J6 v
(API Get entry point)
( K' M' j6 V- t1 e* a        
# L: z2 p; D2 }% p. N& m; D( o# a
& N/ v* @3 T0 `) ~    xor     di,di* \0 u" v  N% V, O
    mov     es,di
! B( E, ^/ I6 L    mov     ax, 1684h      
$ o& _/ A; D6 h, [% i/ e    mov     bx, 0202h       ; VxD ID of winice
5 n# F9 x/ n/ i; {7 w7 O    int     2Fh
9 z! h2 ]# n4 Q, v3 U/ l    mov     ax, es          ; ES:DI -&gt; VxD API entry point# w* W4 b4 x5 r; E- D
    add     ax, di5 c: y3 k2 O* u
    test    ax,ax
4 ]& {/ X& B0 }/ B    jnz     SoftICE_Detected! P1 }9 B4 L; [# r5 P# u8 Z
" ?0 |$ ?6 A0 V2 w& w! k3 Q" a
___________________________________________________________________________/ ?( w  L" d( r4 x2 O

  D! d* J; U& pMethod 04
  ~* I  S" e/ r3 \2 f( J=========8 u# `; m% Z/ b2 f

/ ~( l+ w# z( a! \! ]Method identical to the preceding one except that it seeks the ID of SoftICE
6 c8 ]/ D* R: Q+ M# g' ]+ [' O1 CGFX VxD.1 i# v2 m5 |: ~- O# k7 |. E

' E$ A% h' Q) ?: `8 F0 z+ D    xor     di,di" l4 \- M2 y( v1 f% c* f0 |' N# n
    mov     es,di
8 P, v* V2 N, ]    mov     ax, 1684h      
4 ^2 C. Z9 H* S+ t/ Z    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 ?5 }8 W% Q3 u. A, ^7 x
    int     2fh
# B  \5 y) \4 G# R2 }    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 f2 h" ~- Z9 L) S2 A2 _' Z0 e2 C    add     ax, di' d+ x8 @  a3 v$ A  f
    test    ax,ax
+ c% P/ q2 S" ^( `/ f    jnz     SoftICE_Detected
  `# K' n. E7 Q* l2 `( y
2 G! O1 K( z) r+ \; `__________________________________________________________________________3 e: k9 @, b2 O! j1 j# T

4 Q/ t1 y7 t" r9 ~* e
7 \0 n6 I* Q) A  I3 Y  S3 H3 uMethod 05
8 M( U- `- M% b5 }. o, M# v=========: z% U" p$ ]" r

0 a  s6 E/ V5 x6 Y# GMethod seeking the 'magic number' 0F386h returned (in ax) by all system4 L0 E( _4 P. B& J" [6 \  v
debugger. It calls the int 41h, function 4Fh.1 D0 }. I  M: L2 M1 q5 C; Z" h
There are several alternatives.  6 }: Q  G9 d) Z6 m
; M1 m3 G3 L! ]  T7 W
The following one is the simplest:
# h, m  M2 n0 x  F' e# t/ q  |6 z& b! c
    mov     ax,4fh
* d' a3 E9 H8 i: n    int     41h- I1 P, C) L8 t' F+ }+ ]+ z
    cmp     ax, 0F386
, C/ A" o8 M) ]0 L" z, B, K    jz      SoftICE_detected$ p; m) a4 {& q

8 M, D+ v2 O1 t0 b, A9 ?% n
  n3 U+ w6 Z, F" F+ a- BNext method as well as the following one are 2 examples from Stone's
4 @' i: ^5 t8 p" u5 z3 ~) g"stn-wid.zip" (www.cracking.net):
3 E# G, \, u; n  z6 c8 B' K  U- [# _5 S8 Z" F" A3 _. h- F4 V
    mov     bx, cs6 Q1 W/ m. _% o  j' v
    lea     dx, int41handler2; t3 I0 D& R+ o: o' w
    xchg    dx, es:[41h*4]
) H5 X% `* j8 g2 x5 n    xchg    bx, es:[41h*4+2]+ ^1 _9 Z5 y4 p
    mov     ax,4fh2 E# f" u$ |0 v# X( W$ R7 ], T9 n
    int     41h) l2 I9 A: e! c' ?, y+ }
    xchg    dx, es:[41h*4]6 K% Z, ^* S7 z# c& P0 M, O
    xchg    bx, es:[41h*4+2]
: k' G" K5 y0 {' c% Z9 p    cmp     ax, 0f386h5 M1 I6 W. X$ L* K7 Q
    jz      SoftICE_detected- J* z) ?/ }% x+ ~4 A
; m/ o) Z# M) Z3 d4 r+ n; Z
int41handler2 PROC# l% @- T- @1 B1 X5 H6 J: H4 r
    iret7 ]+ M8 u. g1 u0 I5 ~1 p
int41handler2 ENDP
( a" Z7 S9 L  O$ \  I& l0 e
* R; n. r; \+ ^1 {+ _5 w5 g. N: B% F4 Z$ ~' \, b
_________________________________________________________________________- ^' g8 M; p1 D! L# |. R* V

/ \# i/ b6 [: ]4 s) M* T. a6 _1 R: x) T5 C
Method 06
/ }8 c6 y6 q# W% S4 y6 ?=========0 B) K: {, G& U: ?, B9 i* I" u

; o/ x( F; l- E. J5 h; z
+ }/ l% A+ P& A2 W2nd method similar to the preceding one but more difficult to detect:' J* a4 k  F6 Z3 V' r5 `
. M5 B! h( e2 h% `
) p4 R/ K' p5 _# @% |: y: R' K
int41handler PROC
6 \3 h' o7 g3 t    mov     cl,al6 W: [; l4 ]- `2 D& S4 h
    iret
) }; i& x6 d2 j* sint41handler ENDP
* G2 P! {/ z2 G
! L! a8 g7 ?+ C' k* K/ o' x- W
4 K* ^' e3 }* [    xor     ax,ax" o; q# m! I5 a' V+ \( u1 z3 p  L
    mov     es,ax
2 W5 f7 m" ]4 s8 H    mov     bx, cs
  Y7 i& Z2 Y* A" C; T% a    lea     dx, int41handler
, s( Q: x! `6 n0 ]9 @9 `    xchg    dx, es:[41h*4]
9 Z6 E3 J1 J0 I8 w! n) P    xchg    bx, es:[41h*4+2]
  V0 \" b" G8 Q0 z    in      al, 40h9 C1 \# g- Y" G$ [
    xor     cx,cx
/ b5 S6 _- y+ o  }/ V    int     41h% f4 W8 s$ Q& J5 t0 X. B7 ~
    xchg    dx, es:[41h*4]) `4 G5 H' H# ?" ~* }0 P! J
    xchg    bx, es:[41h*4+2]
' @' m" ]2 X$ w, |    cmp     cl,al% ~  `6 P- G  O" j  I- W: ^  I# O
    jnz     SoftICE_detected
; V8 j5 G1 q& y  D3 l, u, L) R3 _  N8 g* ?& i# o4 p5 y
_________________________________________________________________________
- u6 X- V+ d5 M1 M4 d: n. e; x9 O: _8 F% i) V
Method 07
! W7 l4 ^4 E0 N=========
+ K4 q: M( w3 _" [, b
2 E6 v: h5 @0 S& _7 o  }Method of detection of the WinICE handler in the int68h (V86)5 e! Y! h: ~4 l. o9 F, g) ], v
, C: }/ F0 @* A: y  {, e
    mov     ah,43h* ~7 _6 [0 L3 |) ~; H
    int     68h+ o* N5 F- Y, D6 A5 g4 G
    cmp     ax,0F386h; E7 ]( t1 Q2 T: s; O
    jz      SoftICE_Detected+ ]0 X& Q% L9 j- k% C$ v  k
; {0 @$ R+ n* _% e) f0 J* |
4 L+ s9 h# M6 j  H0 k9 k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 C0 x* j- n. I   app like this:
# ^% M  U+ M$ y7 M# O4 |1 E3 L
$ e3 r& I. x9 b# s; P  E; G   BPX exec_int if ax==689 G  n, p( _% {- d+ [/ u- F- r0 C
   (function called is located at byte ptr [ebp+1Dh] and client eip is
" M: ?8 y1 a. `5 ^2 ?/ ?   located at [ebp+48h] for 32Bit apps)
! `/ B! H; s5 `& E' t__________________________________________________________________________: Q7 a% {" {: O( a+ `
- r" [: n) c) c$ w5 J7 j

7 c  [/ G( N4 n8 F5 l  M" T; RMethod 08
0 V) i0 `9 o0 A- d=========1 |, h! \( H0 Z

- r' B5 V7 \& u9 I% z* GIt is not a method of detection of SoftICE but a possibility to crash the9 ?/ b) N9 e9 H, r
system by intercepting int 01h and int 03h and redirecting them to another
0 |* s) o; Y4 Q/ zroutine.) t7 ~  L, K  Q$ b, w% n# l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' ?& N$ t$ y$ ?1 K1 f
to the new routine to execute (hangs computer...)* u( G. b/ f  s7 T
- P7 W- D& b: D9 X( F
    mov     ah, 25h
, M. v! a  g7 t2 b1 _0 F8 S# Q0 o    mov     al, Int_Number (01h or 03h)
% q9 {8 u/ b* Q8 A' `' G- h' H    mov     dx, offset New_Int_Routine
8 k" s" r9 Q, t1 p* s    int     21h
$ k: ?( f1 J0 Q2 A! d) u9 q
4 s- u$ o; J8 ?: ~__________________________________________________________________________1 D& Z1 u+ {* H8 L
$ j# d/ E/ @7 d% M/ G
Method 09
; K" w* D. _2 D. \2 E4 w=========8 H. L& i+ M' Q& |% W0 h3 _

% F. }5 `  j" Q% b9 [+ d3 PThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only, \7 a* d! {% Z7 C
performed in ring0 (VxD or a ring3 app using the VxdCall).& X$ G6 m) s% j- x
The Get_DDB service is used to determine whether or not a VxD is installed! I9 E+ U) G9 _
for the specified device and returns a Device Description Block (in ecx) for
, l! M' q# _! U2 N5 k, x4 j6 Sthat device if it is installed.
) O3 f9 m$ q4 X: {- Z2 c2 L% e0 o" ^6 m+ p4 Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- h  ^5 x  L8 o# X* N! X   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ G9 P( C' _  J/ S6 |
   VMMCall Get_DDB
! ]% `$ ^* I" j( y* \8 a2 x' N   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 m# q8 U6 X! H* v' m! B3 u" Y, P
$ B/ F5 N, u; u$ jNote as well that you can easily detect this method with SoftICE:0 K4 f9 Z/ q& i4 [: `  e
   bpx Get_DDB if ax==0202 || ax==7a5fh& W5 n) Y8 B( `3 x" x

- f& ?7 p: o1 V% @) k6 ]2 ]% i6 \__________________________________________________________________________9 i8 H% V+ Y! Y

4 R( n6 ~, V$ h+ R$ Q# NMethod 10
6 o+ z! v9 ~9 w5 W4 W=========* R1 i& R. N3 z9 q" _3 o5 G  E

& j# F' E" \7 J; |=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 b7 Q" C9 {( D" v- h! y  SoftICE while the option is enable!!  z$ [$ z, i( l( M% u

; ]/ d. ^3 t1 E0 f/ XThis trick is very efficient:
1 u  e* U0 N1 x6 Z+ i, tby checking the Debug Registers, you can detect if SoftICE is loaded4 v5 u/ a# x" z4 f
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 T5 `  s/ r  B3 b) E
there are some memory breakpoints set (dr0 to dr3) simply by reading their
  K" E% p  C* J. _0 Zvalue (in ring0 only). Values can be manipulated and or changed as well; y3 j$ P7 |% ^3 D8 Q0 \! o
(clearing BPMs for instance)
) f6 Y5 o& W8 n( {6 ]: V( x3 n/ Y4 }
__________________________________________________________________________- s, h# r% Q& s: g3 W6 O9 b

4 H# p* c& p; o3 c% Q6 c/ GMethod 11
' {7 E- x1 S) z- z9 O=========. Q# u0 G+ Q1 U3 }; x

# Z) n0 v  u, H2 \2 IThis method is most known as 'MeltICE' because it has been freely distributed% L% v! B2 V8 ^5 K. o2 S
via www.winfiles.com. However it was first used by NuMega people to allow9 V* p- Y" c5 g. G
Symbol Loader to check if SoftICE was active or not (the code is located
4 N, Q9 K2 A' F% Cinside nmtrans.dll).; {# \2 ]6 `( c  R8 o- ~

+ |5 _( m6 m- K- ]( {4 p) wThe way it works is very simple:
; G5 W% ~% H9 N# B+ ZIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for, b  b. {0 H8 W0 n
WinNT) with the CreateFileA API.
- c8 l3 t7 J( ]( m  ~& \; Q. B3 C; _7 U% N, K
Here is a sample (checking for 'SICE'):
- I, G0 s1 \3 c/ a+ R& C8 O+ {# ?, E  I6 C- K+ Z
BOOL IsSoftIce95Loaded()
8 {% Z6 k7 p9 q2 ?, j{
* J# ~) j" H- a+ _+ Z7 _2 b   HANDLE hFile;  4 `" q, F  h. m; F
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# Z! z' Y: w7 b$ V' ^% M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) @0 L7 t( Y. A0 F( \1 b
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. m7 c& ~- z6 @7 D& O
   if( hFile != INVALID_HANDLE_VALUE )
, M7 L- w: l0 G   {0 J% b3 {8 B0 U) o) [0 z
      CloseHandle(hFile);( x0 q) G+ ^) _3 O
      return TRUE;$ L1 W2 l: X& w% @9 V3 S( M# S0 l
   }  e/ L  Q1 S  I+ |
   return FALSE;8 l# c) u5 _& U9 m
}* I# x% H! {4 _, O- c
0 ~4 R; w8 G  i$ y
Although this trick calls the CreateFileA function, don't even expect to be
/ I1 G' }" ^# ^; n* Z; Nable to intercept it by installing a IFS hook: it will not work, no way!
9 ]1 m% h5 W$ C. g8 ?4 J5 y' [In fact, after the call to CreateFileA it will get through VWIN32 0x001F
/ ]1 M5 [) O$ }service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" _4 ~) h" P/ f' \, Qand then browse the DDB list until it find the VxD and its DDB_Control_Proc7 {$ u: h( M7 i6 x
field.
+ M- ^8 B+ ^5 H( c4 }5 C" zIn fact, its purpose is not to load/unload VxDs but only to send a 1 t+ ~1 ^  \5 b3 m0 l
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ Q# d" {5 T( N" X0 ]
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
' r8 B+ f0 @  U4 Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).( m8 A) m+ V! M8 w# T
If the VxD is loaded, it will always clear eax and the Carry flag to allow% x, b) J2 ]0 |& f4 a7 D1 ]3 a# a
its handle to be opened and then, will be detected.) _1 g. ~3 v3 f4 _; n
You can check that simply by hooking Winice.exe control proc entry point
. m2 C/ p+ L5 |1 v  Y8 v1 N! v& cwhile running MeltICE.
" M  D/ m8 I. x9 y
2 z( F1 @, C6 ]) s/ l) e: `- H5 d  z0 a! U4 @' y: p* N
  00401067:  push      00402025    ; \\.\SICE* X7 h+ L* }, |4 c" h
  0040106C:  call      CreateFileA+ m0 C9 f1 w! h5 j6 h! n
  00401071:  cmp       eax,-001/ g* W9 X2 C' x
  00401074:  je        00401091$ a' p: Z1 C: S$ j; D% M; M8 j

# M$ E$ o  U" W. H3 u( U+ R% x" W" k1 v
There could be hundreds of BPX you could use to detect this trick.4 w, t1 R4 v( e/ `/ L4 g
-The most classical one is:  O# K2 j& U+ M$ u# j
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! W( I( @) |/ ?8 R) E
    *(esp-&gt;4+4)=='NTIC'( {* ~4 N7 G( l; A" T6 c8 B
% j8 `6 X: r6 \# I3 ]
-The most exotic ones (could be very slooooow :-(
- Y4 m6 }; w# c9 |# _   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% f. y. B& r  d/ c1 Y* X) M- e6 r     ;will break 3 times :-(/ {$ S. U9 n' z" H+ p% {. C5 M
: s0 q7 f0 ~4 n6 L2 R& S
-or (a bit) faster:
/ a+ K7 e$ d0 D* R7 W; M   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')5 c4 ]* v$ J) m' `3 g% z0 r- U

/ Y% }' s/ ~8 Q- W$ M% f; n( R   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 |, h3 L7 i* q5 i     ;will break 3 times :-(
' {$ M( T' m2 @" E$ }1 T& y" ~9 K. Z
-Much faster:
/ n' X1 t4 @2 U   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 A1 P$ u! O# q3 [& n/ e
# u* I" o) b: a, ^9 O. r7 I! eNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ ]3 g% x1 G/ J% z- u' ~function to do the same job:) r& A1 f; t. t4 h/ F, J

! b# d4 j& s, E. a8 p   push    00                        ; OF_READ. \. t9 ~* M/ @* }: R) D
   mov     eax,[00656634]            ; '\\.\SICE',0
9 I8 x; A$ E) Z. R% q9 @1 n+ @   push    eax6 }. j' U9 Q; `; w4 N% K
   call    KERNEL32!_lopen
: {/ W$ N5 Y: l8 z+ b; d) P' s   inc     eax
, Q1 h0 v2 Z0 d   jnz     00650589                  ; detected( _! L2 |4 h; k, R
   push    00                        ; OF_READ
9 C- x  i7 R, M% _9 S' [: H/ w   mov     eax,[00656638]            ; '\\.\SICE'$ r' h+ D3 ]  u4 O
   push    eax
2 d6 Q) V( T  f$ z   call    KERNEL32!_lopen
; |; X9 ~# P' R- o5 T   inc     eax: ]4 [; H6 Z& E5 M8 r) w
   jz      006505ae                  ; not detected7 g/ O" F) X% m6 A5 A- V0 h

# u! v0 G8 ]* K8 V/ z$ z8 j- T/ ~
( ^* [" J0 Y+ u9 W( h- }0 o__________________________________________________________________________
( ]& Z/ a/ n" h7 a0 g. W
2 ~! s4 h  N: [Method 122 T  c$ c0 ~( Z* B
=========7 p# Z2 Q6 d9 |% w+ L& `2 D4 m

. H2 n, X# V/ kThis trick is similar to int41h/4fh Debugger installation check (code 05% g5 ?  r2 r4 V% l0 m" x& G- H
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% x1 U* {% t5 C( f- J& r
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 e0 e/ r, F3 b  t9 |
; c$ I: P& R( v  g- f2 p9 U8 Z   push  0000004fh         ; function 4fh+ D1 n: f; b  T& z6 v
   push  002a002ah         ; high word specifies which VxD (VWIN32)
' T4 h7 Q" X6 ?# i) Q                           ; low word specifies which service
: D/ J2 z) \$ F! c) C! \# g& Z7 d, I                             (VWIN32_Int41Dispatch)
& ^& ~0 d# o6 u( ~- z0 k0 p   call  Kernel32!ORD_001  ; VxdCall
8 I- h8 [' m2 ?   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 {/ g+ w! R# ~$ h0 P# P5 J   jz    SoftICE_detected6 r# j+ S: r4 Q: n/ L  ^

# E& D3 e7 g- d; E" a- z5 EHere again, several ways to detect it:
) H; }; @. z# J7 r- E
! i8 q8 Q! a( p! A" L3 ~( o% u    BPINT 41 if ax==4f* J" _7 Q9 |: T0 z
- L1 c" V: g7 l" \' C
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: Q' W& T) t: g, r& ^
9 ?; i; J. F3 K/ [    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- ^! I& I2 c1 O
6 _/ r, B0 C, E% B% g; F7 l0 b    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% `5 M$ o7 E% r  R  f6 R
6 G. F! D' @/ Q' |% j, c
__________________________________________________________________________( I( \* F6 N/ h
7 b! J8 r* @' O: z# Y/ K" e5 W
Method 13* x! A  A3 ~: _; ?. l
=========, r' W, R+ B; j! O9 q) A
* X+ O5 O* a- r5 ?
Not a real method of detection, but a good way to know if SoftICE is
8 s) J3 L$ Q6 N3 rinstalled on a computer and to locate its installation directory.4 }) _/ i7 Y; z; k) n
It is used by few softs which access the following registry keys (usually #2) :
) V5 V; N3 E: Q, ]1 K! b8 A3 q0 t- s3 j' y+ o$ W6 L
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ w: P, O7 W$ n1 @
\Uninstall\SoftICE( l1 x) o; R- }* C# D/ Q
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
7 N5 B7 i; e0 E- }# a5 x8 q/ p/ Y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" G. B6 H. q7 ?1 K4 _! y\App Paths\Loader32.Exe; s9 C. x' v* {

: H3 y9 E8 G- x; a- ~4 D+ @
( Y- k# Y$ T7 @/ nNote that some nasty apps could then erase all files from SoftICE directory
. v' b' A+ ~# V0 T& {(I faced that once :-(
" Y, r. F8 p. s) F% J8 z2 x, h  T8 D( o: d' E
Useful breakpoint to detect it:
4 Q: U- S  Y  X3 L! n+ E3 Z% d: L, K. x  C9 o- l
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& {! ]/ r" k5 a3 B
( w( n  M$ z  r  e. y- G+ ~7 ?  T, g2 \
__________________________________________________________________________$ R: R( V4 j& p' i, |4 @
) E' s: i7 @, ^" m. R$ Y* ^

8 Q) p2 Z+ }" c& qMethod 14   v7 l6 k2 x7 k
=========
. B( @/ E# ], ?8 b8 s9 |( U- c- H7 [, r% w5 Y, ]6 K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ N; m, B) Z  B/ C  j1 Sis to determines whether a debugger is running on your system (ring0 only).# B7 L$ }7 `% S
* x* A' _9 Q* b
   VMMCall Test_Debug_Installed0 C2 ^" t/ i2 f
   je      not_installed
. x- u" J8 [. ^; c
' X* T' D( A$ i7 {" W0 q' m: |4 nThis service just checks a flag.# ]$ f" ?6 j$ s1 f/ L3 ~
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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