About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 w! w8 ?9 d+ \8 p5 F$ _1 N<TBODY>
% X' a* r* d; Y$ |0 Y& L# S) I<TR>$ X/ K  n) u3 @+ R+ S
<TD><PRE>Method 01 * S' O/ X3 y$ b' E6 j
=========& L' H& v: p1 H6 O" @

2 ~# a) g+ B5 A  _This method of detection of SoftICE (as well as the following one) is! t0 w" y# S2 P
used by the majority of packers/encryptors found on Internet.
+ h7 L  t" l  b2 i) O8 n. D+ k' F6 \It seeks the signature of BoundsChecker in SoftICE
6 {6 W: e& j% S( V
4 H2 J9 ?4 [- J* D6 M5 h    mov     ebp, 04243484Bh        ; 'BCHK'
, _5 b0 b& `9 T- y2 Y" C+ p# x    mov     ax, 04h# q0 f* Q! }) d  @8 {) T8 }
    int     3       ( E5 b4 h1 B' i
    cmp     al,4
. T1 G1 i3 _5 P& k' u7 v    jnz     SoftICE_Detected
& a" i: M- H, F6 }1 w& l( z) b: c$ K9 i# S
___________________________________________________________________________
6 x* J8 _* w! [( Q! M; {% T- z. i# e2 {+ y
Method 02
& b/ l) g/ w! G& ^  G* e: K6 @=========' Y6 m4 _& t  e% j
; r8 i' [+ @& }# ^" ^3 E
Still a method very much used (perhaps the most frequent one).  It is used6 E. b# `9 T# n$ s) P! q; ?, V
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ \0 J- j  S- |- t! ~
or execute SoftICE commands...
1 X$ J/ F: A) G7 ^- Q1 v" OIt is also used to crash SoftICE and to force it to execute any commands
2 }7 c+ D& p1 X4 E  J/ w! Z7 e(HBOOT...) :-((    j, t2 d+ U: B- d+ u
2 t. b# h* s4 d
Here is a quick description:
4 g9 w0 E# C- ~7 D3 n* ~+ u# B( U-AX = 0910h   (Display string in SIce windows)7 e5 e1 A& P2 x1 K
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
% z' H8 f3 G" h( A/ M-AX = 0912h   (Get breakpoint infos)
, E+ N( j- J- N8 O, N5 j# k+ O9 P-AX = 0913h   (Set Sice breakpoints)) y8 r$ l* v; a6 i/ @
-AX = 0914h   (Remove SIce breakoints)
( `, ?4 h$ ?8 d" r: u7 u+ N1 }0 h  P% @+ m
Each time you'll meet this trick, you'll see:; m+ X3 F- O9 [
-SI = 4647h
/ J  _4 q* F  b# Z0 _- x% u-DI = 4A4Dh
& J4 a, p$ P( |) x6 eWhich are the 'magic values' used by SoftIce.$ a; a0 }- ~; V, T) T: E
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
' Q1 I& l2 T/ @3 I4 ?
4 s  l4 d' a  g& _6 XHere is one example from the file "Haspinst.exe" which is the dongle HASP; Q; O' ?7 N' x
Envelope utility use to protect DOS applications:
: z: z4 [1 v7 B6 a9 e, i% _3 G  f
2 e7 ^) p9 y6 p, x
0 H# p% K+ B" k4C19:0095   MOV    AX,0911  ; execute command.& R# A: Z7 ~" K& p8 K+ a- j
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 E  e' N! t9 z6 w) ?7 u4C19:009A   MOV    SI,4647  ; 1st magic value.* q: ]% Q  Y# m% f
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( [0 T" H. y2 l' F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 H0 N% s& ~7 g: ?. m- {
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 F4 o0 W: X5 c; {5 F, x' d/ n& v  g6 A
4C19:00A4   INC    CX
/ n& J: @$ `3 N6 K4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 V6 p: Z/ I- o$ \: d3 b4C19:00A8   JB     0095     ; 6 different commands.
: ?' O2 T: V2 X& a+ r0 ^4 _4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- w; z9 S( m% Q- @
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 Q" a9 {- Y% x+ ^/ U
& J' m  G( o  r# P7 @The program will execute 6 different SIce commands located at ds:dx, which) e5 J/ \2 H1 j
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 g/ B. B" Q5 H8 |- Q

4 g( L. G6 o9 G. @8 H/ ]+ A, t; f* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.: O% w* f2 l! J1 d! W+ H
___________________________________________________________________________$ [& {8 L( f2 O. V5 |0 L
$ _  B, Z' C+ |5 D: J

% |8 a& M& O$ w. K9 e) ~# b; EMethod 03
; }: y/ `& Y  ?- ?=========3 m' ~. K1 I2 Q8 p
6 {, ]0 \8 S, a3 a0 A/ x- P
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: H6 B2 t8 c0 z/ v- v, u(API Get entry point)
. N6 Z, h: N1 f+ o) F/ p2 X        
/ m% _& |* v+ A: L9 d! ]
  ~- I8 p# C8 p$ N9 b  E    xor     di,di& L, e+ U* Y; z
    mov     es,di
: S; Q1 Z, y7 d7 N  ^# g4 @    mov     ax, 1684h      
$ D) v# R2 M7 w6 \    mov     bx, 0202h       ; VxD ID of winice
: A) @) X4 R% G7 q" E% S    int     2Fh0 p: A) u- V9 _: J% f3 t. U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 S" i( x8 ^  p* [
    add     ax, di% \* [) u8 o9 c1 N
    test    ax,ax
  F6 F1 Z- R( r9 Y: N4 d2 W    jnz     SoftICE_Detected
6 w1 [( m7 W, V2 P" C$ b& j  k2 @( d+ r; D2 ^# `& V$ q
___________________________________________________________________________4 p: {8 G! y9 H* I5 g5 V1 k

" k( T1 G2 p' h/ {Method 04
/ ^5 I! \5 h$ U0 {=========+ ]% g7 h* Q" M+ h3 N  j; B% K

1 d. R# P& O6 k( O+ A( q/ iMethod identical to the preceding one except that it seeks the ID of SoftICE3 |! E2 m% D* D# m1 T  Y3 ^1 i& ]- Y
GFX VxD.6 l* \( U6 P% ]3 s! E
' g% C: n/ r2 S, W" N4 R
    xor     di,di
# L& Y# t7 f# r+ C    mov     es,di
/ H% T! @' A6 t3 Q( y2 z    mov     ax, 1684h      
( y* J& j( k' m    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 a. w" q; j+ a, y& m7 {  K    int     2fh
. N; I/ a4 h1 h, ?! M  w    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. J% v3 m8 I& h! f    add     ax, di
4 Y/ t' @' o( T+ O' C' f    test    ax,ax% V, t  i! j9 F7 i0 d% `" ^
    jnz     SoftICE_Detected+ @, {% a# p% h, s

# c* J8 [$ g* V& F4 k__________________________________________________________________________
  u! }4 ?8 c  g( N$ e; K: |
  C; ?. f% p/ E& ^$ H  \$ t
4 v' m- I5 ]8 v5 hMethod 05$ k7 r( `- v' M3 B+ ~
=========
7 A5 ?9 x9 F3 {2 C" X, g; I5 \1 F: [! m1 v
Method seeking the 'magic number' 0F386h returned (in ax) by all system! e2 k' M" h+ Z2 J% ~: m6 ~
debugger. It calls the int 41h, function 4Fh.
1 x5 x5 Y3 Q; d4 f  I; \' FThere are several alternatives.  
7 `! X( [. f/ [
( h% z/ r/ M/ J/ |The following one is the simplest:
% u& d4 i$ u, D9 g& v
& M- k+ ?( w% ?  E# u' Z  t    mov     ax,4fh
. y9 T. d9 i4 e5 e2 ^    int     41h5 M0 w. b& B: D: Y
    cmp     ax, 0F386
4 u  s  F3 M; ~* |    jz      SoftICE_detected
, U/ m  }/ m$ x/ [5 \4 U$ X. b8 A( _5 ~

( y/ y* a& M$ D2 b3 C6 j8 A1 kNext method as well as the following one are 2 examples from Stone's 7 P  f5 k) d/ y. a
"stn-wid.zip" (www.cracking.net):
! K' L+ {5 C. K& J. G- l8 |7 G) ~
/ H# P* ?- j% b7 n# N8 W    mov     bx, cs0 M$ m& C& F: f$ n2 N# c: F
    lea     dx, int41handler2% `7 \! s, P# J* m7 {
    xchg    dx, es:[41h*4]+ v) ~5 {' u' g
    xchg    bx, es:[41h*4+2]8 ~- g" e5 G* }/ i
    mov     ax,4fh
/ v' U/ Q( w5 b5 J! }6 e( F    int     41h
" m% A* s1 z3 S. s" t4 O3 ?8 L% K2 {    xchg    dx, es:[41h*4]  p% ?* f% f, }! h. Y
    xchg    bx, es:[41h*4+2]  P6 I: h8 t7 |/ f  o3 ?9 r" x
    cmp     ax, 0f386h& g6 f1 s! G, V' p0 R1 d% O; ^
    jz      SoftICE_detected% y) L4 }* F7 M2 w8 T

# y/ w# P( H+ T& Cint41handler2 PROC5 U* S6 M# D5 }3 l5 ]
    iret
& [& U* @# g# t4 v1 @  U5 Sint41handler2 ENDP1 _! e9 d* A. S2 `. R* f

7 U. \9 M0 H( o5 v# w% e4 P5 u- A" t( J8 I" {2 E3 u4 D) E* r4 i
_________________________________________________________________________9 w; W) {. o) E# a% Y( f
6 j& Q; `  r: K% x. B# ~

' e% s+ c! Z  c+ d# b2 C# vMethod 06
& b; D  N  Q) w2 ~=========
( T' q  N5 N" f/ Q2 M) J, ?
0 ^! f+ N3 J0 A3 o" C7 W: H
6 h! Y: s0 s! h8 j) X. w6 m/ R2nd method similar to the preceding one but more difficult to detect:* Y5 Z3 j: V0 p0 c$ X; ?

0 K$ y$ A6 }' \) u3 E& X0 A+ \& E1 i0 h1 k( \+ Q
int41handler PROC
3 Z) C$ g6 C; M: ?: g7 [    mov     cl,al
7 K! e& q6 U& T; _3 h6 z    iret! Q! w6 [. {# _; L: v; A
int41handler ENDP; @3 c# Z% t' H! f% ]  k3 i8 z$ P
3 f4 @7 A: H4 y7 o
! m% m: H$ e6 q$ c. ]8 @
    xor     ax,ax9 r  f4 v$ u" ^
    mov     es,ax! y" U2 |$ |  o& I0 E
    mov     bx, cs) b: W5 K; n& `; P& s
    lea     dx, int41handler. n& q5 t) M& M! H8 a
    xchg    dx, es:[41h*4]; J/ ^+ b3 b6 S. Y3 r  \4 F
    xchg    bx, es:[41h*4+2]
1 y/ F6 S4 a& O0 k& k" C    in      al, 40h; b; U/ G& d$ {; j! s9 M4 k
    xor     cx,cx* ~" M+ g: Z/ _6 {) B. @
    int     41h
6 h: v; C7 U# [; _- \% X/ h' `    xchg    dx, es:[41h*4]
9 u; d2 y. g. s' L  q+ s/ q1 F    xchg    bx, es:[41h*4+2]
3 z7 O# X/ C7 E) a. T, Y6 q    cmp     cl,al. B/ ]% [- U; X3 _6 S# E
    jnz     SoftICE_detected
2 O. X% i: J6 P
1 N) m. x+ z9 J% e. U! w( J_________________________________________________________________________
, X! ]: C$ m: G2 i3 Y! i& Y2 g' x3 t* I$ Q7 B  {
Method 07
( K5 t- ]4 u( n; [* {' d) y=========5 W7 y3 Q! v9 V. C% Z  ?
% C0 G, P# {) G8 n* C6 l& \
Method of detection of the WinICE handler in the int68h (V86)
* D6 D9 S. l, z$ Z8 J1 f
0 a+ j+ d3 G( p! q0 L    mov     ah,43h
. ]  k  \  r: \/ F/ m    int     68h
; h  I" ~! o7 N9 @8 O* p) D    cmp     ax,0F386h7 @$ t! i, O' S8 _0 B; f9 Q
    jz      SoftICE_Detected6 ~" z7 A/ r5 ?2 c2 Y7 [9 A
2 R$ I/ Y7 r3 T9 R& t! X. D5 j

2 M, ]- L4 T- g/ `9 D8 D/ x& `=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. ~( A0 O8 M1 X3 l   app like this:
$ e; M4 G: W6 x% \" k9 V
! ^+ U& X3 t' f3 x  D   BPX exec_int if ax==68
: H6 M2 ^7 u7 m# A" L# ?! L   (function called is located at byte ptr [ebp+1Dh] and client eip is4 k0 A& e/ V$ U
   located at [ebp+48h] for 32Bit apps)
/ ?2 O& S: n. h( F__________________________________________________________________________
0 r  s- g3 m; Q2 k3 n6 O3 {
9 G" p8 n( X+ W- g; g8 r6 Q4 a* K8 B3 n. |' a
Method 08: C1 m: S: S# G2 K' j
=========2 g! u% @! _: f7 }, I9 }; f% h) c1 [
; p! A) V4 K8 U/ W
It is not a method of detection of SoftICE but a possibility to crash the
. O0 p, l4 h" G; b3 y0 tsystem by intercepting int 01h and int 03h and redirecting them to another
0 H$ p  K" C5 J9 i& a) vroutine.
( Y/ {) `- w. e, PIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, e. J9 {, \2 q# q# d
to the new routine to execute (hangs computer...)9 y3 w0 o2 \4 _) }% ^
, ~7 e" I- n" y
    mov     ah, 25h
9 T6 J' u5 }* Q: ^9 U3 a    mov     al, Int_Number (01h or 03h)) S" z4 `$ }/ N6 |3 V  b
    mov     dx, offset New_Int_Routine
2 |2 y4 a/ y  b, R+ N. E    int     21h
2 d/ g& F6 O1 \. K2 K' h: z8 {, F, I) {+ N* A% U
__________________________________________________________________________# f! [/ @  `3 ?! `  m1 }

! o+ V& e" _  K# e- v( t: bMethod 09
7 u. W* `' V( }1 x0 w$ p1 T=========% L, ]( q7 M2 a, A

0 j5 ~( K, B2 U$ ]This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( O7 ?2 q& L' H& F
performed in ring0 (VxD or a ring3 app using the VxdCall).
  \: g( V1 D; l& T5 n; w! {. [The Get_DDB service is used to determine whether or not a VxD is installed
+ l3 }  G2 h2 t4 j4 efor the specified device and returns a Device Description Block (in ecx) for
& c  H0 V" d, F: ^* ]: W% Othat device if it is installed.
, X9 P8 R+ `+ m2 H
9 q( U; }2 ]9 P1 F) q7 p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) j. G9 `) Z5 a% Z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! M9 j) o9 w# d) H7 W   VMMCall Get_DDB
( h( _7 L( T0 J5 p   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- X8 ~. h2 R9 K, }2 f, B2 k. I* ~7 H  g2 d1 z6 P0 y
Note as well that you can easily detect this method with SoftICE:6 k1 l" M! Z" g! q3 M% l6 [: c
   bpx Get_DDB if ax==0202 || ax==7a5fh
* a, a. i  U( {4 q5 p2 U( f- c3 a% \
__________________________________________________________________________7 \# q" c% a9 c! p. g2 S1 e3 o

+ P" R8 v* e% NMethod 10
/ G% @, t& W& u=========) ~) I* O) Q6 `; m6 f! D

& Z& U4 q2 P5 x4 o5 w. w/ ~=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" u9 o' N" C) Q. K8 o# i
  SoftICE while the option is enable!!
) T' L3 H. h  Q9 o% D# J& [* ~
" V: I3 a: ~+ u6 q5 SThis trick is very efficient:
. @! s3 |8 }7 \8 h- i3 L. Rby checking the Debug Registers, you can detect if SoftICE is loaded' M) a& C0 g" a: o' r9 m
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( t7 E& u! `# z" O) l& `there are some memory breakpoints set (dr0 to dr3) simply by reading their
+ u, i" W7 e! n# `0 e; Uvalue (in ring0 only). Values can be manipulated and or changed as well8 H6 K# l  D$ e3 F+ l4 g
(clearing BPMs for instance)$ X- Q* B0 w: H0 L) z
6 l/ `% z- w. `) f$ E
__________________________________________________________________________
3 F& _; q& H3 {2 u2 ^
# U2 j& O: \' I- H; v  d; B  \" OMethod 11& P! a9 S0 G0 Y; [- v( U) k
=========+ r# S0 [2 F( S; f9 r

, J4 y- k3 E8 \9 V$ H  i* e  RThis method is most known as 'MeltICE' because it has been freely distributed) c, C" y% f) i; D2 @9 z% G
via www.winfiles.com. However it was first used by NuMega people to allow
" n( c$ z) h. x+ w  {Symbol Loader to check if SoftICE was active or not (the code is located
" ^( y" K. N3 o! p7 p) zinside nmtrans.dll).
, [6 {5 m7 h9 F
* f. C0 T; Q$ d" U* A. O3 w2 kThe way it works is very simple:
7 B1 L# S! D$ OIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 w9 Q, J' b/ e# ?WinNT) with the CreateFileA API.
5 ^9 {/ K$ w( s  _. Y: {2 T. n% f) e0 H  Z
Here is a sample (checking for 'SICE'):# `; \* g; a2 x7 r. b

3 ~5 m6 J6 s; LBOOL IsSoftIce95Loaded()7 R. k+ w4 t6 e- I) g
{! M" V9 o8 A- k/ I
   HANDLE hFile;  
) p% P) Y4 {: }" T$ C   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,9 ^) G& t" n1 N
                      FILE_SHARE_READ | FILE_SHARE_WRITE,! Z( T- w. G8 i0 v7 [) [' u+ W
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* y  x- K2 d. {5 X8 H- e  A   if( hFile != INVALID_HANDLE_VALUE ): H& a8 A2 I2 Y, S
   {) H2 M5 s# z0 U& X* _: a0 Z
      CloseHandle(hFile);  Z" s5 T# J2 h$ b" y
      return TRUE;- W- D- V" S) x: Q
   }2 @  B. b$ c! \4 v5 s5 U2 ^2 G/ _
   return FALSE;7 a  R& {( q9 [- v" X
}4 o% R$ W+ ^4 N  d5 X! ^$ _

" A8 p1 j2 t$ o, B& mAlthough this trick calls the CreateFileA function, don't even expect to be
8 @4 ^6 d, X3 ~4 C0 kable to intercept it by installing a IFS hook: it will not work, no way!
; l: v+ M5 m( W9 v3 Y$ pIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
/ G4 U) i7 Y9 X5 v" ?) d6 cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 m' n0 F7 g( y3 fand then browse the DDB list until it find the VxD and its DDB_Control_Proc: ~  I; `+ i4 M' R- Z6 Q
field.6 S) u& g' [3 y# a
In fact, its purpose is not to load/unload VxDs but only to send a , x: r' h  k0 e+ O# Z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
# M9 d9 c# D7 Z% O9 X, d6 Q1 ^7 ato the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 ?# z. a2 L6 J  R' hto load/unload a non-dynamically loadable driver such as SoftICE ;-).& ?8 T" ?7 V9 I+ [+ g. N
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 B  j/ a! ]" B9 A; S% J
its handle to be opened and then, will be detected.
/ U0 q' x" `7 y0 `7 D4 b, ?You can check that simply by hooking Winice.exe control proc entry point
- R- C* a; L! l+ Twhile running MeltICE.
+ m) t5 S, n% v" S$ H) Y0 h* s5 q& |3 E- c

  _% g/ _1 g; T8 c) ?$ g- ~  00401067:  push      00402025    ; \\.\SICE
" n) J5 [- L' L" ^  0040106C:  call      CreateFileA
; d6 Z6 E3 v7 U& U4 e9 z2 j* T1 N  00401071:  cmp       eax,-001' O2 Q& x* [+ }# _3 f9 ~
  00401074:  je        00401091
6 u; i$ B2 W. j
, q- e. w# C. p- q  O
0 d/ g. H( k6 I( [There could be hundreds of BPX you could use to detect this trick.
% A* [8 |' d3 j-The most classical one is:
% s4 u/ F3 b- F! r' A3 J& O5 F, q  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
8 {' p; U* S' W$ V    *(esp-&gt;4+4)=='NTIC'3 C& `  a% @  ^7 m# v/ ^

7 D) j) S; Q9 ?9 H-The most exotic ones (could be very slooooow :-(
$ a- H. }7 U1 K2 r6 y# }   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
8 F- H& T# f; e     ;will break 3 times :-(
) U. v$ `  z& q% e4 o* n' ]
8 I. q- l% B8 e! }' ~-or (a bit) faster: 7 W/ _% \6 p4 s& y, g0 _, {3 O
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 x$ {1 t9 \$ g7 v+ G0 {2 T" E. S( s
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 G, z! ?$ i& L- T4 l2 E
     ;will break 3 times :-(
+ A+ y; D, ]: R; i) v! v* r. V! e! l/ O  I
-Much faster:
2 i$ Q+ M! {1 V3 l   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
" [* C' L$ ]+ `* b9 S$ o3 z$ N' A; ~, x( j3 @. q, c/ D. G" }: C) w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 L+ p; k8 M0 j+ X
function to do the same job:
8 [" V8 B6 @7 I7 l2 N0 R- t8 r8 g- W+ H
. f6 ~) Q, ~. I$ N! J2 k   push    00                        ; OF_READ
- B2 z: ^1 G1 o5 Q0 y% V9 k   mov     eax,[00656634]            ; '\\.\SICE',0+ M* Y3 [' g; D. L( Z( _% {) J
   push    eax
2 p+ @" k  m& b  n# l% L   call    KERNEL32!_lopen
6 S5 H" V* R1 D3 |" e   inc     eax# Z+ T% [; _# f5 g( W
   jnz     00650589                  ; detected
7 D7 M6 h% c& g% b6 g   push    00                        ; OF_READ
* x( S  U) a6 H7 G) Z) s   mov     eax,[00656638]            ; '\\.\SICE': Q6 ?) x; d+ @1 Q# _
   push    eax8 Z$ k/ X. r( J! j; {
   call    KERNEL32!_lopen
& a* j0 R6 d, V1 K& B- G   inc     eax
4 K3 a8 p+ S2 T" I' N   jz      006505ae                  ; not detected
! p5 p3 X; w% P' v2 a
! O- T! X; f4 K! L+ N- M  l8 M1 Q2 I# a4 C
__________________________________________________________________________
7 s% i; O  {" d* w, i
1 N8 q, O# Z" t- O1 c! q( ~Method 12
) V, Z& ^5 [) ?=========
5 s7 K/ z7 @) Q5 s4 [% C: {4 U$ w& f+ f- R# [, K5 Z+ L$ h
This trick is similar to int41h/4fh Debugger installation check (code 05
8 v2 e5 K& R, `  @4 f3 T, P" X&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 l0 `, _+ S$ \$ z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ ~& K. V* D/ i$ O- g. o( j7 Q- H7 l6 j& {4 X- |% Q
   push  0000004fh         ; function 4fh
7 Z2 a. Q; u2 v: h   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 e& d, [7 ~5 x, Y6 C% X- m* F( S" Y                           ; low word specifies which service- M+ Q( k9 c5 @3 @
                             (VWIN32_Int41Dispatch)) U7 J( b9 _1 B7 Q
   call  Kernel32!ORD_001  ; VxdCall& H& [" z# }( |
   cmp   ax, 0f386h        ; magic number returned by system debuggers
* b  o0 C& F) e; ]( B   jz    SoftICE_detected
9 ]& |. f# l* y0 \
. u. U  U$ f3 x2 fHere again, several ways to detect it:
" Y: L0 \; c" b  {& K, _( |: J  ?! L' _" u4 ^7 N$ P6 s
    BPINT 41 if ax==4f
3 a) ^" a. ^: Z7 P+ {) z: w& q
  |" O; j* M8 R4 S5 ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 l) @0 z' P, B0 E
3 N$ ~5 w1 t( g' u
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" c! R& i7 c; O
9 t% u6 `* J9 ?3 Q" ]
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; x6 M) T9 G3 P' ]$ }8 r1 U
2 Y8 Y0 o0 D$ h5 }
__________________________________________________________________________! W: U$ T. I8 b/ l- @
$ E/ o7 G5 Y! p7 _
Method 13
. ~$ t: K' u" W/ |' ?=========
1 s) }5 |/ |8 b/ A" H' i  [/ ]+ J$ O2 k* J( a" ^  C* ]
Not a real method of detection, but a good way to know if SoftICE is: k6 f' D, S* t9 L2 L3 |) Z
installed on a computer and to locate its installation directory.
+ j  N0 n' u: A2 W, U! AIt is used by few softs which access the following registry keys (usually #2) :: h5 q' ?5 s  ~* n+ P' W0 G
' l7 Y  ?& _: Z8 `4 t5 M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! G" q1 m* R3 s$ S# N0 j, \8 Y\Uninstall\SoftICE
# }' `) j, f% N8 ]0 g-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
9 \! ]+ X0 {/ e# s: x-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, i1 @" W. Y* V* ~7 B0 s8 `( {1 j
\App Paths\Loader32.Exe$ X7 |$ e0 b; v% V3 [- }) a

5 A0 w" t. z' V0 H
* T/ C; h4 o; S8 C/ A8 S9 dNote that some nasty apps could then erase all files from SoftICE directory6 L$ T9 O( W- Z- _
(I faced that once :-(5 N9 T) ~0 Y% p% I3 a; X# L3 S1 `

1 S0 u9 g/ g/ ?Useful breakpoint to detect it:
) x+ ]* ^, [, T, ]9 h, Q5 K
) m2 k+ n* H0 ?' S) X6 ^& H     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 J# f* H. v3 h1 A

: L* a2 h3 X8 j$ k# M& n, r. E__________________________________________________________________________( V9 B/ H5 ?/ M7 ^* O( J0 v

7 {0 p+ g+ A9 `) w: J; x3 W+ Q$ T, _
Method 14 * P) c9 m8 b3 y$ \: s" a
=========
0 W) {$ W( u* Y7 X7 l# U) D; R
& l5 U8 v, V/ mA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose# ]: c& K; D/ m" V0 W
is to determines whether a debugger is running on your system (ring0 only)./ x; \' E# }& D

$ D5 `: z& r$ V( N. H, S   VMMCall Test_Debug_Installed
$ R  p) m4 K; s3 y/ @   je      not_installed
0 d( i+ o8 d; S: x
: N8 r& r0 d# Y' a' y% tThis service just checks a flag.
( ~$ o9 _4 {- n6 s9 }5 c2 v, A</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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