About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) O- t9 q% w, t9 T1 d<TBODY>( T# j9 g/ p0 G' d: t1 H5 U0 ]" J
<TR>  _# @# \$ U- v$ F0 Y
<TD><PRE>Method 01
1 Y- l2 i1 {7 y- e=========
/ p9 G, P- N& Z& q' \2 G1 d( \
2 A1 [: {3 `" H' }# d& |This method of detection of SoftICE (as well as the following one) is
+ Y$ W7 S! O* R. `% O) ]: [( _used by the majority of packers/encryptors found on Internet.
& n- H, h( T" n+ b& [; o6 r3 e1 {It seeks the signature of BoundsChecker in SoftICE/ Q( N7 L' ^) [& V0 N
+ G/ r5 }) G! N- _9 y1 i
    mov     ebp, 04243484Bh        ; 'BCHK'& L4 O: s* s! F) W
    mov     ax, 04h
& m: K, s; o7 E! u7 k+ ^8 ^( [$ [    int     3      
' ~% J& B0 r+ ~7 L: C1 R; d    cmp     al,4
) \: a: E. p: y* x1 ^/ O/ y    jnz     SoftICE_Detected
5 r2 J) `, O, a! L) f8 P  T
( [$ N! t) ]+ Z/ ~  i8 c6 w___________________________________________________________________________+ x+ H' v: r8 t- h0 }

' ?0 W# k. \7 h: r- L; K' X$ BMethod 022 r( A; b  F- h' Z
=========0 i/ ?0 n+ |/ {, z0 F
; L8 h3 v7 N/ A. M# K1 R! _. K" K
Still a method very much used (perhaps the most frequent one).  It is used8 p/ Q2 V* A/ i+ f9 A
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,& i/ _8 Y; H5 Z" r8 m9 r) w
or execute SoftICE commands...2 Z; w/ s8 f/ w
It is also used to crash SoftICE and to force it to execute any commands. S( C. J% l, e* g: n/ e# F9 q
(HBOOT...) :-((  
' ]9 l$ @5 G7 F: ]
% ^: N* v" N7 i; ]/ tHere is a quick description:
* H1 j( t: Z  y, b4 r! i-AX = 0910h   (Display string in SIce windows)
+ {6 `' P; ~$ ?& E, t6 v- c) Q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)0 `& U- M) Q8 x
-AX = 0912h   (Get breakpoint infos)
* P/ a& H9 e3 ^! b( d1 q, X-AX = 0913h   (Set Sice breakpoints)- V+ }2 Y& b5 h& T' P
-AX = 0914h   (Remove SIce breakoints). Z( _- `4 T7 O+ S# m' A! F
; L8 {6 T0 ~+ Q: E/ g
Each time you'll meet this trick, you'll see:
4 [' w" q7 |! b4 a. |# [-SI = 4647h
, D" ]% V1 g& t+ Y9 E-DI = 4A4Dh
  b- p9 V, Z) M3 g- Z7 n2 EWhich are the 'magic values' used by SoftIce.
5 b6 N$ V" _3 Z$ g) j0 FFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" v; l6 W/ S4 {$ d: r3 R% Z6 X9 Z, b1 w! e6 j$ @1 S, _
Here is one example from the file "Haspinst.exe" which is the dongle HASP
6 R% t6 }- i6 Z; {Envelope utility use to protect DOS applications:
7 @* f; M. I* Y2 ~; L2 n8 u/ m5 q! H( o8 i; M

# J, U6 H4 k( @$ D6 L" g4C19:0095   MOV    AX,0911  ; execute command.
" y2 G& _. `0 |/ K4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
+ `5 N7 i! {8 Y) M4C19:009A   MOV    SI,4647  ; 1st magic value.
' h2 k) t- i. T& Z" c! @4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 B) G8 {6 |, G% ~3 [  U5 \/ [4 o4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! h3 S. Z0 }/ U* |3 L
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
9 E. |$ `7 L5 D; T3 n) q4C19:00A4   INC    CX! @8 H2 X/ \3 o# Y* w- T1 J& c. S
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' Q. l4 J  r! H
4C19:00A8   JB     0095     ; 6 different commands." ]- ^/ f0 s. p, A8 C0 z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 Y4 v5 C7 H2 X; }3 P: {
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 k# E% V" v! e- S6 c) H
6 S" x$ b  p: a0 E- l( w3 A: NThe program will execute 6 different SIce commands located at ds:dx, which1 T. W/ s+ w  J) r, J
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
; E( l7 s  j; `- _% S  k2 M2 y4 Z# d8 E7 |
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
1 f1 L; Y0 S$ x0 G6 Z* ]" n$ }___________________________________________________________________________
$ E% A  F* F8 y) A; w& z8 o2 S" f5 [+ L
9 a( [8 F4 r, @: z6 E, i( G
Method 03
. R# a" S$ N! d1 V6 Z, X% K5 }  m=========" z3 p. \! R0 q% h! \: W: k  m! S
* L% m' }/ D9 s. ?! l! ?% n4 c
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* h) K7 G# ?! W- A6 X8 z
(API Get entry point)
$ u3 J% G6 M5 p7 H( k/ A" w: o        ) K8 g0 t' c+ _) w% I4 E
* r1 ^7 l- ?* V4 u, e2 M& s+ D; W
    xor     di,di
+ Y* p- B2 }& S0 @, H    mov     es,di# i" {4 t: z1 C, s4 @6 O; u. @8 x
    mov     ax, 1684h       ! _+ L; K6 ]5 a
    mov     bx, 0202h       ; VxD ID of winice: k7 Y# F: F) c! [
    int     2Fh7 p* N7 l9 C5 d! ?8 T$ [/ }& q/ h
    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 E: S) V) l) s0 f7 w# V& E
    add     ax, di
' T% P& }$ P: b3 S2 F  x    test    ax,ax
1 ~$ h$ h5 B5 r7 M; D* q* M    jnz     SoftICE_Detected
  q4 y7 m) U$ W# S% z
1 c# \! c* D" v___________________________________________________________________________
, N1 e: U3 r4 G1 [/ B
* P* [+ P' D2 k( n6 `, z  z4 gMethod 04; e" t, ~) I4 ~8 E; x. _
=========& l- [% o% ~% S2 z& q' t" q

5 ]& L& {  A' r. ~+ BMethod identical to the preceding one except that it seeks the ID of SoftICE8 E9 s! V+ L& i5 V+ p4 }" B( ?
GFX VxD.6 a% p- w. j8 J( _6 `3 l9 ]
: c3 \0 E1 U6 V& f" F+ I/ B! Z
    xor     di,di: m. x3 g5 Q* ^% s
    mov     es,di. d* f. M' E8 H$ S- Y
    mov     ax, 1684h      
* |. g3 G  {9 j# S% \    mov     bx, 7a5Fh       ; VxD ID of SIWVID
$ N' f! Q* ~6 M! i  Q( ~( t    int     2fh% X( O# [6 C+ O, \1 q9 L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 s+ e; d/ v6 H1 O% {: r    add     ax, di- e$ G. w& I9 y
    test    ax,ax2 c& Q$ Y( n8 Y: H! d% `
    jnz     SoftICE_Detected4 f- g. s; `. k% y: `
2 q# j" E, C( w* m4 x% Z% l$ a
__________________________________________________________________________
3 I; z, k/ b' l9 c# k6 `: E8 ?9 P. ~; E- M# g/ p$ J' G% s; A/ _! M

) j& C8 h8 v+ H9 @: xMethod 05
4 ~% E  {% \) u# L. ?5 S6 o3 N=========" K8 T, v2 N4 r9 R7 o: h8 k$ G

7 y6 U  G! D! Y' v' ]9 s/ h7 eMethod seeking the 'magic number' 0F386h returned (in ax) by all system
4 o2 W/ _/ q; O4 _/ a) O! ?: pdebugger. It calls the int 41h, function 4Fh.
7 C" W  m* K2 ]# NThere are several alternatives.  
: q9 J, m: b! H8 g0 [
8 v9 }; j& g1 M+ r: w" `. l* GThe following one is the simplest:
# X9 A& x% @; K6 }
: N# |% n0 N+ r- W/ A    mov     ax,4fh: L6 b0 y% o2 ?: C- Y
    int     41h
2 @  l3 m% [* [    cmp     ax, 0F386* N+ t+ X( y. |( v
    jz      SoftICE_detected, G4 b) G7 L' i, G8 U

9 ~- _& d) e/ Y, ~! i5 p3 c! ^8 c% M# q
Next method as well as the following one are 2 examples from Stone's
) z0 u( Q# O" s"stn-wid.zip" (www.cracking.net):, x% ~4 _8 k7 ~: _3 B! |

+ Y. L4 t8 h% W' p8 V    mov     bx, cs
0 A: u' w0 n) h: t' K    lea     dx, int41handler2& S% ~7 w7 N. d+ ^' |
    xchg    dx, es:[41h*4], H8 r, U4 x' b) P1 n! y7 C' @+ S
    xchg    bx, es:[41h*4+2]
; Z' ~$ {9 h) a    mov     ax,4fh  z' Q9 h! y2 ]
    int     41h8 g0 S7 i6 B0 m6 ?3 `
    xchg    dx, es:[41h*4]
  t$ y! N" G  W9 x/ X$ Y    xchg    bx, es:[41h*4+2]
6 Z3 a) D; `# |3 V" c    cmp     ax, 0f386h
4 T$ M% u% [) z) B) u. Q/ d    jz      SoftICE_detected
' I3 z! v; O* {$ X( T( y
$ F. W7 f4 m5 w# j$ P8 w! Nint41handler2 PROC
6 z/ w, E& P/ I% l" `2 A6 K    iret
" l% o0 j1 T* @7 |; ?1 }3 g; H- Zint41handler2 ENDP
0 y) k% C& _7 R, [7 l, @  N8 g( a' W1 h- @; }
  G9 J4 `* k7 K1 _9 F
_________________________________________________________________________
9 X2 _$ D6 J* Q6 l) w3 S( D5 e% o: k, m3 E+ G0 A6 s* a  _
6 X0 |1 [$ Z  b+ u1 S+ ?2 |& E
Method 06
- f6 Z2 e" z0 C9 ^' q0 C* d% |=========
6 v5 [) L+ S0 `& P
( S% k8 i$ }5 D/ Z2 H+ M) g- G* N; F9 u$ x$ G
2nd method similar to the preceding one but more difficult to detect:" j$ U) s6 c2 Z( A: C5 D" U1 x

: E. {! j6 \5 o7 N# a( u; K9 x9 v! n3 ^% m3 F& g% K
int41handler PROC' b0 L: Q2 K3 g! y# }, r
    mov     cl,al
$ N6 H6 F1 m; {! f: I    iret, t, C1 s) F$ W9 S- x
int41handler ENDP
  Q8 E3 l7 w- T$ h/ i  e0 S4 M* {
& _$ s6 X( `# x3 c) y1 P
; Y& K& {, S, R' p: y3 b    xor     ax,ax
! P" `, x- m' _    mov     es,ax
7 M0 A5 P" u6 {! u4 I0 C    mov     bx, cs
5 j8 L* Y3 |6 I    lea     dx, int41handler
) M! Y) U* p( I2 U% \# w& v8 e* x    xchg    dx, es:[41h*4]
6 \! c% X! t) \    xchg    bx, es:[41h*4+2]( o% t0 S! K4 X6 C, n
    in      al, 40h9 e. _0 v: v8 }5 }; l+ Q
    xor     cx,cx9 T4 |: @7 Q; a& L% ~7 c; Q4 K
    int     41h. c" @; x4 D5 w6 U6 A! S7 m$ Q3 j
    xchg    dx, es:[41h*4]
$ q1 p* @+ W  g6 ]- D  y9 b    xchg    bx, es:[41h*4+2]
& ]4 F3 o6 H$ K1 t& T% O0 n    cmp     cl,al6 b+ q/ h  B# x( o( K
    jnz     SoftICE_detected+ I6 P/ \9 S( Z0 l
; i( J! [4 C, \2 C9 m7 H
_________________________________________________________________________1 [- d& R. j* M- b  K( ^

- m& H: J4 w6 u+ Z, W. FMethod 07
9 W: ?$ M1 A4 ~8 Y: D; N  B=========
, y7 }$ R) x- d# L- E" Y
6 N8 B+ _3 h- o/ K, w( V: TMethod of detection of the WinICE handler in the int68h (V86). T9 U+ `6 E- ^# v- l

5 Q6 S1 |. X% K4 E9 `9 M    mov     ah,43h
0 }) I! \. c% @4 }    int     68h; p! @" H- p# d, T" a
    cmp     ax,0F386h
) X3 b4 |" B) j: l    jz      SoftICE_Detected& P# }3 P; q0 ?- c8 ^) ~& s1 M7 X

) w- c' Q; V0 S2 h' {# E. u/ u
1 N1 a+ a* U7 D- j' t, R" @9 f1 [& t  z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
, X* p; P& o  y9 t   app like this:
& k8 p9 x; _1 i. P# M: X- C1 e0 w. x, |8 W0 t
   BPX exec_int if ax==68
% B  M4 L) R5 k! B' M( W   (function called is located at byte ptr [ebp+1Dh] and client eip is# @8 V$ w& N$ Q8 G- K9 X
   located at [ebp+48h] for 32Bit apps)
' o/ k  r7 F( \) w' j__________________________________________________________________________
0 j4 f4 n% \& S1 W; g# T5 s; S0 z" `2 e! V+ P+ G  u
" O% n. k: n* g' Q4 k
Method 08
: I- g: r2 `- U/ j! W2 E2 @=========" C1 v# G$ X" u; z
% t: y$ g' p; u3 I% ~& i" e" {
It is not a method of detection of SoftICE but a possibility to crash the) G# T5 b0 \; d( S, o/ d  t
system by intercepting int 01h and int 03h and redirecting them to another  z% x5 S. x$ y1 M3 m+ v& A
routine.8 K/ p; w& y9 Q4 k6 T
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points1 |: ~+ G: J3 s
to the new routine to execute (hangs computer...)& n8 f) i6 q6 ^2 N- j3 m, x6 U4 c  k
- k8 O( q) v4 _! s' T3 a& t2 i
    mov     ah, 25h. ~& a; \; [: B. S8 K
    mov     al, Int_Number (01h or 03h)5 O* ^2 r2 w, V# X. }+ U
    mov     dx, offset New_Int_Routine# l5 }8 T! Z, a1 P
    int     21h
4 t! ^6 @8 O! d; U, \' Y
1 D8 u' x- a5 o  f6 U__________________________________________________________________________9 j& Y% g6 l( a* {; y
' U* c! a( i' ^* G+ m8 t
Method 09& N- ^5 z0 x) V: A  {4 a& l* ?- t
=========
# G- Z8 e6 y$ F, I" a
; g! h$ V$ z5 h8 J8 u4 KThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 o3 N. g+ m8 s( r  w+ O' h# @6 f0 ^9 w
performed in ring0 (VxD or a ring3 app using the VxdCall).
4 _2 y  R" M4 Y+ Z- `# L: wThe Get_DDB service is used to determine whether or not a VxD is installed
6 y" H% r. E. m; Tfor the specified device and returns a Device Description Block (in ecx) for! Q- o% M% P1 L/ K
that device if it is installed./ r, |1 h7 x; Z: E" Q9 }5 R

# b/ _' r7 ^5 m2 I   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID, F5 T/ L7 H4 F# q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). ~. J6 [1 ~9 G7 {/ Y( `9 F" T
   VMMCall Get_DDB
4 ?( H; m  j9 Y" }# U1 {4 F   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed$ p+ {, J7 A( z$ }0 J& X# y6 D

; K9 o& f. ^/ ^, t5 i( lNote as well that you can easily detect this method with SoftICE:
, A; S) x6 f0 |& e# F   bpx Get_DDB if ax==0202 || ax==7a5fh  |. V$ M5 O4 q3 ]' x

+ f: _1 a& E- _+ _) V__________________________________________________________________________
( h2 E6 h- \9 Z$ _) |0 {; k
- i' O2 m, a2 E7 _* S* lMethod 10
7 V+ _1 W# Z# ~# z: J) j7 e=========
" P5 J! Y( E6 W/ o: d
% ^- k. M2 H) T. ?2 _! G, M5 G=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
: {! \0 X  V0 l+ g, \* w3 P  SoftICE while the option is enable!!8 i  e4 x. m/ ^0 l. R+ |  \

1 w3 j) b; F& D1 {  gThis trick is very efficient:/ d* m7 M$ {. j( V2 i! t' _) j
by checking the Debug Registers, you can detect if SoftICE is loaded5 @1 u* V. X: \3 T  T
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 w0 h- X, x+ L) A+ ^2 Y& w. x
there are some memory breakpoints set (dr0 to dr3) simply by reading their
0 p6 d+ H* e, ?. [1 ?4 Hvalue (in ring0 only). Values can be manipulated and or changed as well
- e0 u5 @0 I8 d6 N  ~' b. l(clearing BPMs for instance)8 L: U7 T0 k$ U! w
3 L, ]" s, H1 x
__________________________________________________________________________, N) o/ f5 t9 J+ Q  x4 q9 @1 @: O$ u
% S7 V! |! z+ r, M4 u5 G, k9 X
Method 11$ i6 T* j6 Y  e  u, D! I
=========
! K/ s: X" G/ n9 Y  h" ]$ q5 l* v' n9 M, ?8 k( d
This method is most known as 'MeltICE' because it has been freely distributed
  L9 {4 s7 X. j5 N. V" C8 cvia www.winfiles.com. However it was first used by NuMega people to allow% m! J5 ]: s3 q: z& q
Symbol Loader to check if SoftICE was active or not (the code is located/ X. `# l9 y. i) ]. Q# k: E
inside nmtrans.dll)./ K6 k7 w! R5 d" {

) Z: t& q) z; CThe way it works is very simple:
3 i- _8 `* F* u* f+ H% K/ d+ y6 f1 MIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 t0 _5 p  @0 V8 o7 tWinNT) with the CreateFileA API.* `" c: H( L" S

2 f9 k' J9 H7 f4 M! I, xHere is a sample (checking for 'SICE'):
( J  R0 ^" i, J! y1 r( x* Z& G9 d% A( Z9 D* R6 ?  P8 M
BOOL IsSoftIce95Loaded()
5 A0 w$ u4 T- T* a+ v) P{
; t3 d" R. b) Y   HANDLE hFile;  
- H/ N% r4 d. W; y' Q4 ]/ I& q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  t. G+ w& Z) k/ J8 ~; ~( u
                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 W" P4 H) p, c/ @) B
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ m7 t" z( l2 L8 M. @! G  E. t/ `6 p: `
   if( hFile != INVALID_HANDLE_VALUE )
, |" G& u7 s' W3 L' @   {
6 ^; P- e! E; d0 O2 U  R      CloseHandle(hFile);
3 v" [, ]- R/ V7 G      return TRUE;; O8 n7 L# K- F6 C! ~9 J6 J
   }
/ [" ^5 i: `4 G4 D   return FALSE;6 @( A8 A" ]7 x# o% C* T
}
; t" r! ]1 u' n2 `$ `" l
3 j( l& E4 c8 E  q% d) y8 jAlthough this trick calls the CreateFileA function, don't even expect to be! {0 ~3 [6 l% g" Z' A. O; [" A
able to intercept it by installing a IFS hook: it will not work, no way!
$ r0 c5 i- K+ \In fact, after the call to CreateFileA it will get through VWIN32 0x001F  t+ l2 N$ a1 ^6 m% l
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
2 f: b. H, X2 P6 L* I5 R* Iand then browse the DDB list until it find the VxD and its DDB_Control_Proc6 s& A6 U: U. J' H
field.
! p& k8 E! F+ n0 b" x2 BIn fact, its purpose is not to load/unload VxDs but only to send a ; v& @9 R& p8 B. R; Z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
$ ?6 @4 w- @; W/ q( l) o, Z% eto the VxD Control_Dispatch proc (how the hell a shareware soft could try7 y3 I9 }+ \# h# x4 ]* w
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 m- ~: A2 Y# z: A0 XIf the VxD is loaded, it will always clear eax and the Carry flag to allow
8 M3 t; B. o$ X% n9 Hits handle to be opened and then, will be detected.
" L) j( z6 R% k! u/ N! q& iYou can check that simply by hooking Winice.exe control proc entry point
2 X6 t- s/ O$ b9 V% N" ]. I3 j3 cwhile running MeltICE.; T0 P4 s/ f% G

0 x6 H) v  t( ~, K
5 D0 `; I# O% N* G' ~( c7 @  00401067:  push      00402025    ; \\.\SICE& {7 n; N7 j7 T5 Z& x
  0040106C:  call      CreateFileA0 N" {0 {/ c- w; t+ ]+ s7 h
  00401071:  cmp       eax,-001
5 F4 R. ?' V' L. F2 A( @: }  00401074:  je        00401091
  Z+ [0 S* V# I! z/ G  ?$ ?
7 Z' k9 t8 F$ T' h% a) Q; Y! l# j* `/ n' a% y
There could be hundreds of BPX you could use to detect this trick.
3 h9 B2 F! H1 C- p, o  W9 e7 j-The most classical one is:! R1 o: c' S# M/ o: k4 A
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; S4 W4 v  |1 F    *(esp-&gt;4+4)=='NTIC'& D, R4 d( M" Z( W

* I0 E' s9 r$ i3 d6 V2 T2 v-The most exotic ones (could be very slooooow :-(
# [5 W/ k: `/ y) z$ a: u; ^   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % G9 C4 W& f- ~: J+ K: ^, Y
     ;will break 3 times :-(
5 p. o& U4 l; D+ ~( c+ o4 w, e4 n3 k+ J* \4 h6 \0 t4 s
-or (a bit) faster: ) Z& L9 z- g0 S" }$ D
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')* @$ w( B% n1 {: T! P: i( l: G
& |1 K' }$ Q8 V* c' r4 |4 `
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & b2 M8 {, A, W/ R$ ^
     ;will break 3 times :-(! w4 ]6 P; C6 F% O6 ?- T" V: x4 O

3 L2 [0 C5 _) G; H+ W# h, L% f-Much faster:
; d% T: f2 i7 H( g; {" x/ w% d% d2 o   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& z$ q( M/ @2 }+ q) ?3 v2 @

' O% r  }3 x/ }* `/ t' Y  O, qNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
4 ~& D9 y6 P: j" D2 Kfunction to do the same job:
# y1 ]/ c; D5 G& R1 P) H" n: z; J# B  r$ Y1 M6 ?# P$ S6 E9 H
   push    00                        ; OF_READ
1 |- t: W# S# u. d2 L1 P! K8 j   mov     eax,[00656634]            ; '\\.\SICE',0
! z8 a' {8 c. k   push    eax$ N9 B5 \( Y" u' [
   call    KERNEL32!_lopen- j+ d) ?) L" C( l- d
   inc     eax
8 `2 V# ^, \; ~1 G2 V$ @   jnz     00650589                  ; detected/ v8 E# }6 `) n5 ?
   push    00                        ; OF_READ# t6 ~9 z: e1 n/ r* K2 R
   mov     eax,[00656638]            ; '\\.\SICE'
" D# }+ _/ A' l& {( b   push    eax
- ]! S* ~( l* t   call    KERNEL32!_lopen8 v4 V: A4 {) G9 O$ f. d1 j
   inc     eax
  I0 u( s% o9 K- {0 Y  ^$ C& K) s   jz      006505ae                  ; not detected
5 \& b8 Y7 b2 \" N7 g5 V% r
7 `3 ~2 \- u- X" N2 e9 e6 _
9 m% P3 [4 [7 R0 h& d: Y__________________________________________________________________________
0 P2 Q, l- I) E* `8 s7 ^6 w$ m& ]0 H3 J3 ]+ [, X7 Z( d: O) M
Method 12
8 @# J- _: J3 ~, j* o9 J) g2 P=========
( R. P; q& P0 `/ ]7 Y
, z! V3 a0 ?& x+ o/ F, O' O9 {This trick is similar to int41h/4fh Debugger installation check (code 05' J, Y! a( |# B1 a
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
3 a5 m2 k! q+ j( z1 Aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 X; h$ L* h. Z; l' J8 W0 i  z) G9 x
   push  0000004fh         ; function 4fh- M: M; _. j6 i% Z% g
   push  002a002ah         ; high word specifies which VxD (VWIN32)# |& v6 x" Y1 R, e9 R# r* G1 t4 N; [
                           ; low word specifies which service: Z: J% Y+ r8 b4 t5 r& {7 D) I
                             (VWIN32_Int41Dispatch)
! \. |4 J0 ]$ C; r9 t& F- @7 h   call  Kernel32!ORD_001  ; VxdCall4 `- u' y! H, H- e* G. u
   cmp   ax, 0f386h        ; magic number returned by system debuggers1 M- b$ b' A! ?7 V
   jz    SoftICE_detected# @5 F8 M# I9 j/ G  i

% C5 X4 y/ w; `0 p3 XHere again, several ways to detect it:" P, z: k- x; y1 C) {/ N5 R
, T, v6 [  W, N! U* W/ [9 p: D
    BPINT 41 if ax==4f& U3 r: h# K1 g! t% J# E7 Y! U

# y7 z( F( N7 V. c, I) w2 D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 j5 ], S; Y, q( s: G* B% K( ]( t" B
% p$ X4 O+ `' g3 t' D/ S    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& J: v, P0 `% L! h! S0 q. j
% W( G: L1 K7 B4 L0 Z" J    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ B0 e% L& s) r; z9 a

- y) a; U# Q4 W' i: \) o6 r__________________________________________________________________________
% K/ u3 O' r3 Y8 D  \) u: S4 J) Q6 m
Method 13
; z) n; k6 d) b7 }6 J1 ?=========
9 @, ~& A& U$ ]5 D* G# @7 F# u5 `2 W& p2 H
Not a real method of detection, but a good way to know if SoftICE is: W4 }, `( @) x( q& T, ~
installed on a computer and to locate its installation directory.7 W, d9 ?9 x' {% A5 h5 W
It is used by few softs which access the following registry keys (usually #2) :, w! a' t* e8 J( N9 h
4 Z8 L0 F* o  S6 ?- ?
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 S* X3 Q" \/ w5 W- s1 h8 N. U- V\Uninstall\SoftICE  n! \) Y4 t2 E9 ~6 m( N
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  S3 P! L6 G0 T
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* d# e$ S' z, D* @9 H+ V! g
\App Paths\Loader32.Exe0 R: h4 U' c5 u: o! v/ R+ V
8 q# w9 X/ [8 U2 b; C3 i! Y

' Q4 ~3 R9 E" N. k; ^5 \* ?9 ~) i; vNote that some nasty apps could then erase all files from SoftICE directory
/ g: Z! F! n; o! f(I faced that once :-(" c. r* R' w# E$ @$ L

: t. o( i4 }% N; HUseful breakpoint to detect it:( c1 W8 {! Z! M# o! i. \
) q# g4 h# W8 O/ ?4 b3 S8 Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 J# }6 S5 e, k) y$ ?7 j6 u  o- N2 j' w
__________________________________________________________________________
$ y6 |& [2 a* h4 _8 s0 ?
) H6 N% W3 J4 V* k  ~/ G
6 z: t% B) T( a1 y) G$ LMethod 14 & E1 i4 N- W% }4 z3 k2 E& [
=========6 }9 I9 Q' S* U/ F: v$ y

$ z2 Q3 z. Q: v+ GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ s) v2 |. f# w& ^3 y* J9 j2 g
is to determines whether a debugger is running on your system (ring0 only).; h) h% E( H- a- g& R7 g- f- a
1 n* R) M4 c5 O9 h) v/ I) d
   VMMCall Test_Debug_Installed0 ^( n! [. ^1 i. P$ Z) F9 V; `! Q
   je      not_installed9 v  H0 w) t& M2 W
7 d% G* m1 @$ Q5 O$ B+ e
This service just checks a flag.
$ x4 ]/ W; p" K</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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