About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 |4 v! ~1 O8 |6 i4 X5 O% k
<TBODY>
1 N8 d2 }$ K+ ^, s9 c<TR>* B5 Y' k# S4 @8 O  a5 h$ v% z
<TD><PRE>Method 01 4 L) Z- R6 B0 [& e; w# x
=========
3 m' M2 V* D5 \/ [" y! f! x
0 V# S2 O( d! |9 e  zThis method of detection of SoftICE (as well as the following one) is2 M9 A: c  M& U% G6 m
used by the majority of packers/encryptors found on Internet.) N- M1 O- ~8 I0 t9 @
It seeks the signature of BoundsChecker in SoftICE
% y  P# ~1 [* _7 t& V# e! g6 U8 h2 [: u# k
    mov     ebp, 04243484Bh        ; 'BCHK'0 K* Z4 H5 h3 P
    mov     ax, 04h
1 }2 G) u( \# n  r5 d2 e    int     3      
* N2 L) H2 I7 V7 P5 C  b    cmp     al,4$ _! c& Q; Y8 z
    jnz     SoftICE_Detected( A+ J- E# Z1 d# q7 i0 Q3 v

' ]$ u4 |7 f2 v! |___________________________________________________________________________- ?7 D4 c# X. t

+ b8 `2 [- L9 X" PMethod 02
# ^! C& @, X" q) N4 `) d9 a=========
4 }3 \# x& h" G4 Y& h4 P
7 b6 M8 G$ g$ \, k& E. ^Still a method very much used (perhaps the most frequent one).  It is used
/ w+ r+ g" t/ c; l! bto get SoftICE 'Back Door commands' which gives infos on Breakpoints," c0 `% P! i2 @( q: N. T
or execute SoftICE commands...
" u$ a* f; m: B0 I4 n1 b8 w$ sIt is also used to crash SoftICE and to force it to execute any commands
' C/ C3 a0 t3 i- q( e(HBOOT...) :-((  % ^8 L! @, o* n1 _8 `
* |3 i2 q# d1 E
Here is a quick description:
9 Y; E) t8 G# B0 I-AX = 0910h   (Display string in SIce windows)2 V- f8 C/ ^# Z$ x# F3 k: A
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" _9 i8 @7 T" f1 E3 y  l$ Q& @-AX = 0912h   (Get breakpoint infos)
2 y2 |+ _9 G: m1 _8 a-AX = 0913h   (Set Sice breakpoints)! m: X9 T6 L% [0 F
-AX = 0914h   (Remove SIce breakoints)
  Q* @- r: q. Q3 e9 ~
' V4 c# I- A3 Z0 |& f  q8 z" {3 eEach time you'll meet this trick, you'll see:
( z6 ?: S' K7 k+ n-SI = 4647h1 d. N/ C, }" n9 M9 b! i" ?3 z
-DI = 4A4Dh' c6 ?8 K5 q! \
Which are the 'magic values' used by SoftIce.
) L/ i! i' F4 w0 W  f  Y( EFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% _' L  Q5 H0 t7 U+ A6 T

2 b! z3 a$ S. h8 |1 T9 cHere is one example from the file "Haspinst.exe" which is the dongle HASP, E5 C$ G5 R- d8 t  _( [
Envelope utility use to protect DOS applications:7 h. X3 r+ h! M$ U% Z5 W
, L& P* W  k) ^
% ^- H$ A! E1 y  ^
4C19:0095   MOV    AX,0911  ; execute command.  k( L; H- v; N
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 r' O$ a# ?2 D* u) S4C19:009A   MOV    SI,4647  ; 1st magic value.
) o8 \# t0 U) m* ~4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; o1 C8 m4 P. w- m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 l- F" [) L" D: [  {. y4 I
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: i& ]" n- c& @* C5 v) T7 W0 L
4C19:00A4   INC    CX4 d% J* q: J6 \$ p% y/ q& K, d0 v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute6 D  s+ U- g7 o: E
4C19:00A8   JB     0095     ; 6 different commands.
" l1 w; a& D$ v: U9 N4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* k" Z( D8 [0 p+ f+ r9 y6 q. X: P6 t" I4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% M  e9 c4 h( o0 P
6 ?7 `- b$ q* l9 F
The program will execute 6 different SIce commands located at ds:dx, which" v9 ]  L  c* e
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT., X+ c, S4 b9 C* D, G* [; U

* h: H! `( m6 v0 q8 O( I* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 L7 X, K/ y$ n: ^8 \/ z% n% p
___________________________________________________________________________
, ]" v4 c1 A; h6 @: s  s( w, A& w7 V; X" `7 ^  o

+ `" I$ P/ s4 N+ x3 TMethod 03) ]6 \: B) k9 _( y, R/ T5 v$ q
=========0 a( S( `/ p' m' |1 }, H, p
! C1 H- t: R% G5 K* \0 y, W, D4 D1 h
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 Q1 a  {4 N9 N. _2 R% K
(API Get entry point)
* e. I0 ^  P1 {" G" A9 a$ U        4 _0 {4 ?( @7 R8 X5 i; g

' m! x" c* _4 I# U. g% N    xor     di,di1 V1 s% K0 J# s! k$ t7 S
    mov     es,di
- D: }; e, }7 k) q, @( f3 U    mov     ax, 1684h       2 x$ Y" J( e2 H8 j# h8 h
    mov     bx, 0202h       ; VxD ID of winice
) Y: l: Z6 v$ s: }! n( ], v' }    int     2Fh9 B1 s" m) g6 v% u4 ^% G/ i6 V2 [6 G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 I5 z: u  \, ]- j4 ]4 ~1 x' Q
    add     ax, di
0 n# c4 Z' r4 Z1 U4 X2 F* f    test    ax,ax
  }+ @+ F1 P$ Z; ]8 H5 _3 Q    jnz     SoftICE_Detected
8 C- J# F# r+ j8 M" W) Y# h3 v9 f7 F. _4 P* w+ j
___________________________________________________________________________
9 E1 @% H# h, S) _
1 ]5 [" ]3 v; F8 O/ {8 x3 @Method 048 W( [3 F6 t% q$ P& W% l- ]0 ?$ t
=========
/ e* u8 I  f2 W6 w3 q$ w: `, o9 s$ Q9 E/ ]5 s3 e# T( L
Method identical to the preceding one except that it seeks the ID of SoftICE1 v: ?, N. T3 _; g$ _; @% n
GFX VxD.
3 j3 Y* I' E, l7 T  r
2 A; c1 P; U) A% S    xor     di,di
# P) u: ?1 R+ Z! S$ n: x3 y    mov     es,di
7 ^: G' k; X% U1 T    mov     ax, 1684h       ! X" T% [/ T; C1 K4 P! H" F5 w  P0 F
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% V, @1 ~0 g! ]" q# @+ {    int     2fh1 D0 c. O8 {6 B
    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 w. g1 [) a) l9 E4 e# I
    add     ax, di
$ \) X1 u0 |8 h' w% r, l) e    test    ax,ax3 D  Q  ]7 [4 ^  z2 c+ |
    jnz     SoftICE_Detected4 u' Q/ }7 t: {" F0 O* c' F6 T

1 o$ c* I  c+ n6 ~__________________________________________________________________________% ]  T: E6 Q" ?2 R# [
' t. O( [4 f, |2 t5 Q  j) I. ]
# y$ v/ [3 a+ I3 L  \7 t6 x
Method 05
2 z* e8 k: ^& s% t9 B) h: T" ]=========( b/ {' ^; o8 q, e; k& i( L8 M1 W

% M, p* ~* e) c5 g% }' R* hMethod seeking the 'magic number' 0F386h returned (in ax) by all system# l. s/ T8 m( t1 U& b
debugger. It calls the int 41h, function 4Fh.* ^( V, n% {- n
There are several alternatives.  7 e. f7 z, }5 ?  c; R
5 a4 p# s  T8 X9 o6 `0 A7 l
The following one is the simplest:
& x/ s, o: A8 [  C. H: G1 q+ Y( s0 D6 n; ~9 \1 h! P
    mov     ax,4fh0 h$ h% T' f0 e, b0 N" W
    int     41h+ _, Q/ P5 m, {( u3 x7 H: ?! O
    cmp     ax, 0F386
, {2 q2 n" T1 M& U/ V% D# f8 i    jz      SoftICE_detected- H" G8 x! j6 {4 F

. _3 G$ B+ F, B5 Z, e* @% w8 t6 L, E7 z
Next method as well as the following one are 2 examples from Stone's
. P5 T+ n0 l6 Y' \9 Y"stn-wid.zip" (www.cracking.net):6 l# i: d2 H7 V% F
# x' P) V4 P* a& a) U) z
    mov     bx, cs
& X% Y# C9 x* v( p7 V$ y' \    lea     dx, int41handler2
4 c* W9 C6 F, Z# R  _1 O; T    xchg    dx, es:[41h*4]
; V- K7 H$ o; \% m% n    xchg    bx, es:[41h*4+2]2 j% D( @3 M$ |9 S' T0 M
    mov     ax,4fh' v$ t2 P' F# q
    int     41h, S% o& i0 T0 j$ M' t" Q8 V
    xchg    dx, es:[41h*4]6 t- k. ^, }- S$ K, D# i6 }
    xchg    bx, es:[41h*4+2]
; e. ]+ f; r. ?4 U    cmp     ax, 0f386h+ ~+ ~. y7 v2 v. s. r; l8 @
    jz      SoftICE_detected
, U& T  G# }7 Z' I. T  B$ ]: s3 G& w$ ~, l1 i
int41handler2 PROC
$ b5 p6 {! ^+ O+ G# _( q, j; I, U    iret- I  Q4 B9 @: `% Q9 z
int41handler2 ENDP0 p- a, I: w# k; m) C" @! e
6 X# H1 |3 G6 \6 Y

7 X  V; V6 p! Y4 I_________________________________________________________________________. V  q# u- ~3 b+ z0 K" R5 L! z
# |& f8 f2 l" D

4 L$ ^* C0 a! G# UMethod 06
# Y! Q6 s! \* ?$ W( u2 |=========0 x9 z% L3 G* c5 B6 [1 U
: S' Q* l# e0 M  y# N
" L$ }! A+ f" P$ T* i7 z
2nd method similar to the preceding one but more difficult to detect:; B5 s8 E; F5 \
; g1 ?1 {- J3 w) i9 T

! S+ p; R( S/ q- @int41handler PROC6 [  M/ L6 c; H- R
    mov     cl,al
2 M3 P% Y1 \1 E2 W( k' n1 O! S    iret
) b1 v9 L/ k" S+ c- T- Pint41handler ENDP% q" D- u: R: G$ k' F& M1 A( W1 s
+ m& T! _1 c8 q
. _; E( M$ L6 p; u' [! U/ B* n" }
    xor     ax,ax
- i# E, n; q+ P5 F- n( B    mov     es,ax, r/ i1 n# G, [
    mov     bx, cs
: \. R4 ^$ z5 N+ ]+ s- s) K    lea     dx, int41handler
5 ~; n4 m) u6 P" U% M    xchg    dx, es:[41h*4]- ^( t8 K1 }' L
    xchg    bx, es:[41h*4+2]
( q8 g/ f) D* z0 @; k- J    in      al, 40h
! V8 i, `" W. G    xor     cx,cx) A5 c# ^5 K1 C+ j
    int     41h. I" m! w5 H" e$ h3 }8 {. P/ a2 j
    xchg    dx, es:[41h*4]
+ I5 L  T- Z8 {  X8 A0 H( N" O    xchg    bx, es:[41h*4+2]6 i  H9 Y! e5 Q# V
    cmp     cl,al4 |  v& c1 t' d3 O# J
    jnz     SoftICE_detected" [9 V+ h. S) p4 g
$ m# n/ }2 n. d7 h9 C6 K0 }9 N( G$ p
_________________________________________________________________________. S8 k& s3 H* v  k# \4 ]

0 ]) O0 B% [1 ?) wMethod 07
' a/ \: a; w: I+ [=========
1 u1 w1 \$ F0 O2 c, ^4 J$ m
  t" u$ i; D5 P+ E2 \0 j( ?Method of detection of the WinICE handler in the int68h (V86)
0 f% d, D- t/ \$ V
+ y7 B/ \5 L8 U    mov     ah,43h$ `% }4 @& ?! W! ^0 D) M: X
    int     68h& T1 v7 X% L; a; Z1 l$ m  L. x
    cmp     ax,0F386h% R  g0 z4 T7 O, |  E+ {
    jz      SoftICE_Detected% R4 A0 [5 b% F3 \* z! ^* R: ?) E

% {' ^: F* C1 ~, ^- P1 ~1 s! P( J  {1 ^$ w0 Y/ _% _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
$ Z: ]  g- k' T7 _   app like this:
/ n) H+ p8 D7 E+ @9 J
1 B8 p; n0 w1 _   BPX exec_int if ax==68
4 j. A" h- B7 w$ h5 b- m; a; m$ |   (function called is located at byte ptr [ebp+1Dh] and client eip is
) C% U5 G2 [/ c' A* [9 ^: }   located at [ebp+48h] for 32Bit apps)
! F( M$ G3 A5 Q- k8 h. F__________________________________________________________________________
% p$ W5 Q8 C* R! a) u- X9 C. s8 r0 E; ~1 I; L! {* F' A9 P

$ w! }- g5 k9 J( m$ a" xMethod 08
5 _; ?4 N. ~1 F9 V+ Z2 D4 n: m+ S=========! R% |/ Z3 O( F! N
2 H( x/ a; c) ~7 U% _" m7 V
It is not a method of detection of SoftICE but a possibility to crash the$ c, y8 F0 w! X# E" a, q6 @
system by intercepting int 01h and int 03h and redirecting them to another( f; ]: `) t& H( s0 a
routine.# w" E" O% N: r: }" x! n4 J
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ u5 D" q  q- V/ J( p5 s+ j, q4 g5 Mto the new routine to execute (hangs computer...)+ Y+ y# K! |- A+ r: w; A; S
2 K' r8 u& g5 M3 `! ~9 Z0 ~8 m
    mov     ah, 25h$ c& K0 y7 U( r! ?
    mov     al, Int_Number (01h or 03h)
& B" R* f- k3 E; K$ k/ `- V/ e8 L+ R( A7 v    mov     dx, offset New_Int_Routine% a* E8 ]4 V7 j
    int     21h6 @6 [9 `$ w) W9 R9 z1 v+ T
! n0 k2 U/ [6 f0 i0 k% `
__________________________________________________________________________
0 F' @9 M! x. B+ F8 y4 H5 b' c- V9 G: S7 |4 g( u3 D6 }  y  ]; Y! y
Method 09
* w- r& P/ c# L+ w, b=========
) J, M! l! d. R$ I
/ ]0 [+ `- f( [$ S& k! {) \This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 j! i# u6 \' h9 ^4 A9 ?performed in ring0 (VxD or a ring3 app using the VxdCall).
% p( o) H% }+ y+ F' ~) tThe Get_DDB service is used to determine whether or not a VxD is installed3 ^4 k6 P0 O$ A, N! n7 }
for the specified device and returns a Device Description Block (in ecx) for
/ Z& _* ?# r4 i- Nthat device if it is installed.# ]# O! N, n1 G# u6 a* T. q
5 q& S# L  ~7 B3 c1 R: i- F, z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 z2 X2 m& k( y3 q5 `1 L2 ~# M& c   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
: F; f8 h# d; r9 l$ O+ k* S. u+ z   VMMCall Get_DDB
0 s4 m3 [, O4 D   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 j. n5 F; F% m0 Y8 V

6 ?( ], b& t" g1 R: ]. {! mNote as well that you can easily detect this method with SoftICE:3 H5 }+ G- F7 c7 Z8 r
   bpx Get_DDB if ax==0202 || ax==7a5fh* e" \' K# i; g5 x) L2 ^

$ Q8 Z6 k' ?" G5 V: o: c* D1 @__________________________________________________________________________6 f: b$ s9 R, ?- b: J

- a* a8 }4 z% ]0 ?( GMethod 10
$ g( v3 ]6 A( W2 h/ ~' u=========# _! u1 T6 O+ {2 R, a5 {
9 q0 X' b4 q" k. x
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# m5 x+ @# Q, P- _5 ]  M7 t; A
  SoftICE while the option is enable!!6 T* b- l+ }6 M. c4 ]5 R- v6 L( @

8 }6 R9 t& }* d& T* \. dThis trick is very efficient:
) j5 ^1 R3 ?! ^, qby checking the Debug Registers, you can detect if SoftICE is loaded4 K- B8 E& L) y( x1 `) X9 ]
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if# U6 y/ e2 R$ B$ T" b  O
there are some memory breakpoints set (dr0 to dr3) simply by reading their  x2 O9 k' h( s# h+ @( j
value (in ring0 only). Values can be manipulated and or changed as well
$ i' N- D( s) T2 g& o; S  ~  p(clearing BPMs for instance)
5 b* ]- W. m. q6 H+ i) b' X+ H4 B& J/ m; `9 j! {* h/ Z' l+ b2 G
__________________________________________________________________________
& R* B  M& X; b. V# J5 R
) t& G% g1 h! y9 w8 mMethod 11
4 j$ _' z% D) ?4 V) ?! B=========
$ K- b2 w8 U/ @1 Z" i
: d* n7 i/ Y* x3 U, J( ]This method is most known as 'MeltICE' because it has been freely distributed) N; K# v0 D! u  M2 l9 Q( }' |
via www.winfiles.com. However it was first used by NuMega people to allow; i# O: W2 Z6 B* K$ U* m- s8 \1 j
Symbol Loader to check if SoftICE was active or not (the code is located& S) [$ S/ u; g% j
inside nmtrans.dll).+ k) n& U1 j1 _
3 f1 k' A% {& ]% W& x
The way it works is very simple:6 W: M( _( O! K4 y# e2 s2 X
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
' A/ k/ T/ M0 j8 \6 I6 U6 AWinNT) with the CreateFileA API.
: a* k- U  U1 m3 z3 g" y9 A. Q+ v+ i, I- _! }3 |4 d1 M
Here is a sample (checking for 'SICE'):
: F  x) M7 c: R8 U% N1 |8 U8 i
; j: e! r, Q/ {! y# X' z) X5 oBOOL IsSoftIce95Loaded(). A& W9 [. o$ i3 j; i4 E8 T
{+ K# a" P8 F8 K$ R" A$ H& i' }
   HANDLE hFile;  
' u: o4 d: |- L; P$ W1 J   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 {3 \* A5 Z/ O' }$ X$ s                      FILE_SHARE_READ | FILE_SHARE_WRITE,  |4 j1 w0 C, F- j7 C3 T1 g0 v/ R
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);! y3 r) `: n" I$ z' b
   if( hFile != INVALID_HANDLE_VALUE )
7 [: M' ?6 H3 h8 O% t4 R   {
5 o2 t) i, E+ C- I- T      CloseHandle(hFile);/ b7 m& D0 C" Q8 R7 u8 p6 P$ X4 a
      return TRUE;# r8 |: |. d% s& ]" B0 @
   }) M4 r  M* z5 q7 H9 ]  B
   return FALSE;
) C4 i# d' }8 @; N* x}
: ]8 v" ~/ U4 H6 q
+ u3 |% l! i% c* ~, S. IAlthough this trick calls the CreateFileA function, don't even expect to be7 y; V7 z$ S. Z" R. a* H6 y5 D& U
able to intercept it by installing a IFS hook: it will not work, no way!
; H$ K" o* P' f7 q6 KIn fact, after the call to CreateFileA it will get through VWIN32 0x001F1 K1 s9 H/ \+ o0 C/ J8 T
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; V4 J# n6 \; x+ nand then browse the DDB list until it find the VxD and its DDB_Control_Proc! ]% X/ S3 [8 T- k6 \1 j3 r
field.
7 W8 J6 v$ y2 |* K6 B. XIn fact, its purpose is not to load/unload VxDs but only to send a
% H" y$ ]0 s# n7 [3 P2 F  f, \W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 r% n' D) ^* U# p/ Tto the VxD Control_Dispatch proc (how the hell a shareware soft could try* v7 P4 p2 I: P( ]* i: m) X
to load/unload a non-dynamically loadable driver such as SoftICE ;-).2 D  \+ A- L0 y* a% d- K
If the VxD is loaded, it will always clear eax and the Carry flag to allow4 `1 x! q1 I) l7 a$ W
its handle to be opened and then, will be detected.
/ e' r- m( \( B0 a! _  P7 F! d4 p! lYou can check that simply by hooking Winice.exe control proc entry point: _2 l, s4 l0 ~. O" k
while running MeltICE.
! M) J) g8 g8 F1 I
1 |9 k; h2 r& x. h4 G5 _" G8 V! ]7 r* X+ W
  00401067:  push      00402025    ; \\.\SICE! r+ q1 _6 K3 N5 X( T/ Q* d1 C7 g/ X
  0040106C:  call      CreateFileA
9 m' v4 W- C- K! o, f6 a  f7 {  00401071:  cmp       eax,-001
0 `$ }) P1 V4 j" O  w. K  00401074:  je        00401091
; O/ j2 m7 A: M, V1 ?8 W# ^' a0 v8 a  m% |

6 `( J0 x, d; |1 g+ g! g7 PThere could be hundreds of BPX you could use to detect this trick.
3 _" ]9 Y( c( _/ Z-The most classical one is:
8 q7 A# ?- S6 [  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ ~" W) }* \, A, [! r
    *(esp-&gt;4+4)=='NTIC'
- e) l: c. {& ?/ S" y" K. l$ s: e/ S5 |
-The most exotic ones (could be very slooooow :-(
1 y; f4 [1 {, D8 v$ G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & n/ B  L  [4 X. R7 g
     ;will break 3 times :-() V* N- n' N9 ?8 ]3 v# F2 f; j
0 U( P- h+ b& s: E8 o( q& L% b/ r" S
-or (a bit) faster:
; @+ a) ~4 r$ y4 Z, ]- N   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- X( j3 c: w# f/ P# k, @$ j% Y' m
, [' P) H7 H, p7 g# e2 g3 a1 J9 @   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% z0 O+ Z& e3 Q# r9 J( @# C     ;will break 3 times :-(9 e7 W4 e% l! \4 z- Y  w8 d

( b2 V! X* ?) U( C$ A+ C-Much faster:4 s: o% \' G( U+ U+ d% H# k  ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 W5 h' P3 W2 X9 M5 Y/ W5 z: [7 F# v
; `/ g. U6 L( [9 E6 k! nNote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 h9 d9 J' p4 ]9 E, E- {3 V
function to do the same job:
* U6 Q  y4 U2 S+ }( Y, w- ?( {1 Q. p! M4 G5 T. V$ V0 Y, n
   push    00                        ; OF_READ
) q4 E7 }, t) F. S9 k' j; M   mov     eax,[00656634]            ; '\\.\SICE',0. \' I; d8 R* A8 {% o) W1 R: x. Z: f
   push    eax
5 p8 `) M4 U& \2 a  t# t' Q   call    KERNEL32!_lopen
* P& S) j  }9 z6 d: C   inc     eax5 h! U) @* j, A/ x! {/ }4 l
   jnz     00650589                  ; detected+ W: Z! j( N0 K# O6 f
   push    00                        ; OF_READ6 E5 S! N) l; D+ \3 h
   mov     eax,[00656638]            ; '\\.\SICE'; L5 n8 G, V  Q- h) D
   push    eax
/ G8 E% m3 h# N1 @9 t6 C! t: ^% O   call    KERNEL32!_lopen1 {; j0 M. h2 o5 I( A
   inc     eax& K; j- t# c2 w8 Q8 h, G4 G2 d. V
   jz      006505ae                  ; not detected
  J# Z# y8 w; o4 C& y: x' m/ _+ u+ ]4 `4 E; `0 g4 \" q" e
" l  a. X7 ]$ W1 H2 U1 a
__________________________________________________________________________
" b( L  n' W# R
8 i  P' C. W* l" {" [Method 12
& L3 [9 d0 G/ z" Y=========! S) U. I2 f: f( s# Q
, Q/ W6 N' p: _5 a5 J/ \: D  a3 y6 E
This trick is similar to int41h/4fh Debugger installation check (code 05: J( p5 k! _; T. z! ^
&amp; 06) but very limited because it's only available for Win95/98 (not NT)# e4 R# a) [: L+ C9 C
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: t; I/ W  j; Z/ A( B& ^/ N* w8 y5 x5 \/ f% @3 M" R% m7 C- P* K
   push  0000004fh         ; function 4fh
: Z! r! p, {1 e4 w2 t# h9 F' i   push  002a002ah         ; high word specifies which VxD (VWIN32)6 ]! i( u6 B# n
                           ; low word specifies which service' j8 r& J5 M# v0 @& l
                             (VWIN32_Int41Dispatch)& r9 o* X8 f, G
   call  Kernel32!ORD_001  ; VxdCall
" w5 S' m3 o" Q. }8 d) w; A   cmp   ax, 0f386h        ; magic number returned by system debuggers
8 ^' f' _2 ~2 k6 S0 ?   jz    SoftICE_detected
: w& |/ ?5 D9 Y1 ^* O  q, a5 Q/ t
( |; J5 X$ v+ e1 G2 p" k( V( Y$ WHere again, several ways to detect it:! _$ {7 P$ g! @5 U5 R7 C1 `

- e7 ?" C: ^; N    BPINT 41 if ax==4f9 S( H- A+ U4 t, V+ c6 G$ r9 K
6 o  A1 q" d/ J2 M2 W
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one# q( o, R8 ~2 }1 I4 W- ?

- g2 w+ O+ b9 G+ ?: e    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' i. s4 t" A3 T. t4 J/ ~

7 W5 M2 B) L' w6 m6 W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( {1 G3 b% y( g& L
% n6 L* h6 F/ `
__________________________________________________________________________. v/ m5 P7 E; i0 {

) X* L, G  T0 c8 H6 n- p) F. LMethod 13( ?" D: z' x0 f; M. ?
=========
9 n" U: ~; [) F3 Z9 U# _
6 I& E) n/ t8 l( L, ^Not a real method of detection, but a good way to know if SoftICE is% H9 U; w% T1 c1 h
installed on a computer and to locate its installation directory.
- q7 X) F% B6 o7 OIt is used by few softs which access the following registry keys (usually #2) :$ s$ m: O. L. K6 n3 _) ]4 k
8 _: C' q" F. e+ [3 D: |* H
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 l2 B8 {. ?% C: b" H
\Uninstall\SoftICE' q1 A* C; d9 c7 s4 z' B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
) b4 p2 a8 U( E" ]-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( y# p; X, E. P3 A
\App Paths\Loader32.Exe
' ]( Q: N9 w" |5 B$ x4 P. @3 E( Z
! Z8 M, c4 j8 e, v0 W' Q9 S8 x  m8 ?* i2 g2 s* K
Note that some nasty apps could then erase all files from SoftICE directory5 _$ q6 r% {- t; p
(I faced that once :-(
. `5 J; k) L9 D! L% Y$ x' x
3 W4 l0 @7 j% M2 iUseful breakpoint to detect it:
* H; x- g8 o) f4 [, j3 N1 o+ v2 C$ K: Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& Z# V9 f& z3 x! O
4 B9 i5 @, s8 E  C% P
__________________________________________________________________________
7 @+ x% t- L+ {* V6 j
2 u7 L/ w* S& X# k
! Y7 @  l* y- Q( f, t5 ~Method 14 . A& g, M+ s. |
=========9 ^2 t+ F) g. ?) A& d) l

* }* A! P" L4 Z# a+ f4 T' YA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% H/ W+ c3 ^% M  x$ l
is to determines whether a debugger is running on your system (ring0 only).
3 i- t7 m1 t% S7 {1 p& [% u1 t: z; y6 a. X6 g% U
   VMMCall Test_Debug_Installed
' a  r% u, {- f9 j! M, [/ h4 x   je      not_installed9 O5 T; u/ u! G
6 r+ T9 h# ~% s
This service just checks a flag.7 ~1 \3 X! r* @+ \
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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