About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& H& b1 S1 ?  s7 L+ r% A
<TBODY>
/ F( Y" h, o. X" u7 d<TR>
( G- w/ A& E7 X- \, E1 ]6 j1 k<TD><PRE>Method 01
* L2 S1 s, ?; @) h4 z=========
& g* {, O/ o6 i$ C1 Z) Z1 a
1 h6 f: e" k+ ?1 }* j. _' h6 [This method of detection of SoftICE (as well as the following one) is9 Z4 F. N8 J. C% V3 S' H
used by the majority of packers/encryptors found on Internet.
: F, O3 k5 B' a( q$ [4 p1 _9 pIt seeks the signature of BoundsChecker in SoftICE/ _+ L( ~. r2 _" [/ R. |# b5 Q3 }

( [% x$ n  n* a7 J3 K    mov     ebp, 04243484Bh        ; 'BCHK'
  X/ T' @7 Y. w5 h    mov     ax, 04h
( I+ _8 j8 @+ `2 H# Q+ P9 b    int     3      
/ n: |6 r. C. v0 A  k* `  T- d& C4 i! n5 V    cmp     al,4: x  G4 J( C9 a3 ]! N5 m; j  X
    jnz     SoftICE_Detected
  ~1 V6 i. M4 i( ]
5 |' S+ `) J: ?: l4 f$ d___________________________________________________________________________
. m# [( g% [' w3 C! }3 W6 X$ m4 Z; V  }$ E! U
Method 02
- n7 d0 V. J- N' r=========
% v4 y7 o5 i# Y) {/ l+ p; `2 z$ n3 l# ]' k6 L) X
Still a method very much used (perhaps the most frequent one).  It is used
1 ?* m) X; I  H0 Wto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: Y- U- ~6 ~2 c1 aor execute SoftICE commands...
6 A5 ?1 M- Z: x, v3 @, q8 sIt is also used to crash SoftICE and to force it to execute any commands
  s$ n( B5 L: E; L7 p: b' k. y(HBOOT...) :-((  0 D7 K# Z" A2 V

! }) j1 p5 W2 a8 N- i3 H8 P2 FHere is a quick description:
  Y0 M- v- E4 d5 d4 Y-AX = 0910h   (Display string in SIce windows): W) A8 P! o: U
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 ?0 R* u1 g. n/ {$ ?, B+ R-AX = 0912h   (Get breakpoint infos)
( A) Z4 O$ {4 `# k4 q. N2 ~-AX = 0913h   (Set Sice breakpoints)8 W8 X* G: w0 l
-AX = 0914h   (Remove SIce breakoints)
" {" E3 X  o0 N! ^) X& c+ |4 l3 j4 C0 R; P
Each time you'll meet this trick, you'll see:
2 {9 l! \+ n  M, h-SI = 4647h2 x9 v' ]; D/ b# L& ]
-DI = 4A4Dh
6 |1 q$ ?8 Y$ x; f4 uWhich are the 'magic values' used by SoftIce.8 l& _; A8 ]7 y0 [- c! M0 a2 c
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
. h  c1 l- y# W% ?; H5 J* L( M1 `# x: V5 m3 y* i: }4 z
Here is one example from the file "Haspinst.exe" which is the dongle HASP9 r; ?! K+ F: j* H, ?
Envelope utility use to protect DOS applications:
- u& H* ?) Q9 ]+ S" N7 j- w8 |0 f- v" e. |4 Q( i
8 }/ E/ P! V' S7 J& l9 m% ~
4C19:0095   MOV    AX,0911  ; execute command.9 Q/ A4 U# P! ~
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 B8 ?0 B7 {8 N3 d' g" L4C19:009A   MOV    SI,4647  ; 1st magic value.7 x8 y4 q) b$ {2 @* }0 ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" V' W$ f! r* m/ S+ ~  B& q0 @7 |$ d/ w4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' u& {* P7 _5 o4 B4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ k  {9 y# s3 n# ]$ ?
4C19:00A4   INC    CX
' C2 ^6 O1 y6 y* I$ i) I& l4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ b  k& x8 f  K: u
4C19:00A8   JB     0095     ; 6 different commands.. k) x* f' v9 ]- m# n! y4 H- f
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 Z$ k% {; h3 S" n4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 v7 c5 {" k" H+ g% [
* i) `# J4 F4 S9 O0 |) j
The program will execute 6 different SIce commands located at ds:dx, which
+ i; i& P6 T9 z: k0 Ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& l  M5 z! y, m4 V5 d: m9 Z) J
" b" l3 I$ H* j0 H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% ~3 {- U0 \4 y7 r6 V- ?$ a$ x___________________________________________________________________________; O# B0 q% m- \4 K: a% s$ D% k

; D  I# w) O+ `7 Z: c2 x9 I0 U6 _4 }" J1 `. {4 z* {
Method 03
: N5 m5 }4 T+ R& J=========
  F3 b* H. v4 w/ |( d8 {  |1 Y* r% B6 H/ S8 N8 E3 n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( h) D5 D4 C" I; @. S3 o' m
(API Get entry point)0 {" l+ V/ S* f/ \* S4 W- \
        
, l3 e' ~1 l' K3 C# M2 d& _! ?
1 ^+ T: O0 ?1 ?3 ]2 G% H3 g/ ^0 M    xor     di,di4 a7 m! h: e# N/ d4 k5 S
    mov     es,di
2 a# |+ H$ g6 Z    mov     ax, 1684h       ' ~3 n" f: _8 C' E
    mov     bx, 0202h       ; VxD ID of winice
) u6 r: T/ N* K1 @( F# Y* E    int     2Fh
9 ?3 i; h2 ]0 d    mov     ax, es          ; ES:DI -&gt; VxD API entry point; d8 S, Q' c, h, W! _9 e
    add     ax, di
  f4 `# Q# Y* o4 H+ x) S& E3 r    test    ax,ax* J/ x7 K2 L& r
    jnz     SoftICE_Detected
% h7 N8 n' V4 ?3 L% ^
2 V; u) Z) @& G  F___________________________________________________________________________+ \8 R5 b& d6 J1 k9 l; |7 B# u

) x( s. h" L, i% r3 JMethod 04
- }* w7 O* F- L5 ~$ m% M$ O=========
! Y8 P! r, G  W) z4 Z
- J/ t! M1 i; aMethod identical to the preceding one except that it seeks the ID of SoftICE
6 N, i  k1 K/ i' h! O  nGFX VxD.% t( J7 C- s: ~+ h- h- v' J
# H( ?% ]8 G2 f2 g7 D% p
    xor     di,di
4 q: z0 X4 z/ y' E# r( D    mov     es,di: Y5 Z" r9 I6 I0 t# f( O- I
    mov     ax, 1684h       9 P5 P$ \. N1 i8 b! m7 k- f2 m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
$ E; X% ^! w/ h! \, u! `5 e, l    int     2fh
5 _6 y8 l6 _5 d) C& U0 S" ^; y: d    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 r  s% M% q4 D/ c) f/ G
    add     ax, di
2 @  F8 K0 `4 Q2 l" N" i    test    ax,ax
, k' o' A6 y3 U0 T    jnz     SoftICE_Detected
% L+ V! D  P$ J. U4 z8 |
' s/ Y& C8 T+ i- u__________________________________________________________________________
, d; `; M) x* z% |/ s6 U. {2 [
( [# X! i3 u4 @& K' @# ^4 d$ r/ k1 m! _' I
Method 05: i5 }0 A* S- F, @2 ]+ s$ R
=========
6 x9 F4 w5 s# k7 }% W1 o* N: z* e: \; |# K# e5 J  O3 [" j# z2 Y' E
Method seeking the 'magic number' 0F386h returned (in ax) by all system
$ \8 ]1 X, ]8 j3 e1 qdebugger. It calls the int 41h, function 4Fh.! w: z0 V$ Z8 L8 f' h1 D
There are several alternatives.  9 S* ^3 i2 [- y) p+ |! H

' k- L5 K$ _; g0 ]% @The following one is the simplest:
0 Z7 u+ A( c' X" }% ]
# a# s" X5 e! P* y: k    mov     ax,4fh
6 s5 Z3 |8 T) y/ ~: x' M: k( ]  f    int     41h0 ~8 u. [& n2 y7 v: M6 I
    cmp     ax, 0F386
$ L& f1 q/ |( C: {8 A6 w7 \+ R    jz      SoftICE_detected+ z! M( M6 s/ \# o4 x; H6 Y) d0 t: @

/ ]4 K4 v2 ~# N$ a6 h3 }3 K: Z$ g7 V; |/ V* v
Next method as well as the following one are 2 examples from Stone's
" |6 q  g3 l7 R" ]# V& \+ ^"stn-wid.zip" (www.cracking.net):) C- D' Y) N$ q( {. U; f5 f
* J, i4 F  K. x: M8 Z, `; O1 C" \8 N
    mov     bx, cs
5 p* x1 Q7 p+ Z8 W5 B0 B* c% G    lea     dx, int41handler2( }* T8 @) q) }6 ^9 V
    xchg    dx, es:[41h*4]
, [1 V* ]( T- P2 \    xchg    bx, es:[41h*4+2]
9 n- S; }% y' z, g4 S! {1 x    mov     ax,4fh
8 y/ ?" V" F( P' u( q0 h    int     41h
5 b# E" s, p4 \9 \    xchg    dx, es:[41h*4]
5 r4 I, Q: u3 L" M    xchg    bx, es:[41h*4+2]
9 V1 s0 Q: [& T/ J3 k3 w    cmp     ax, 0f386h& E8 i# |5 {0 Z, d
    jz      SoftICE_detected
8 B3 ]3 ?7 R. N, W  T6 H1 e* q! r" t8 E
: n# E8 B) A6 I7 ~" t. f' m/ U2 wint41handler2 PROC2 [! I0 H& g2 n1 Y: s6 b8 ~
    iret! F# C# ^: e  H, t
int41handler2 ENDP3 }4 M/ j- c( y* F, C
" O' s" S! N' i5 u1 p
8 w8 e. u" m9 l7 X, [; y6 d
_________________________________________________________________________
9 _6 j' \+ S: H$ m9 D) E1 Z, B9 k- e7 R7 K9 ^
9 ?- B% V& r" n7 [( I$ H) y0 p
Method 06
* g, e5 _2 ?& ?! O  z! [=========
$ n5 z  t0 ]3 A% f: o* f& i; P0 V0 C9 _8 b
3 x1 [7 X# \& b2 ^3 G
2nd method similar to the preceding one but more difficult to detect:
* L) V: u* n/ A" i  y! Y
' j: p/ T% n9 w- ]( i& M! h% m% g
  ~4 C* O- V- F1 nint41handler PROC
% _: [# f9 l/ w' a% h    mov     cl,al- ~. ?$ F- N/ g; V  h6 l0 R2 ^
    iret4 F- s4 _" k/ S/ I
int41handler ENDP  c5 x: V: `" m7 @* M9 N. _

6 A$ t7 Y" p/ Y. h$ P- N
# }" c6 e2 D' Z2 O5 v/ @    xor     ax,ax. L- L' |8 V/ A) A& u2 o4 |
    mov     es,ax
: d1 {" d3 a" c* j    mov     bx, cs
. r# Q* o- h  O5 S0 T1 Y; C1 f    lea     dx, int41handler+ c/ X  K& [) |$ N$ X' t
    xchg    dx, es:[41h*4]( T  L3 Z' m& w7 }& \8 L
    xchg    bx, es:[41h*4+2]
2 S1 i; R% n9 P    in      al, 40h
9 o& R) }, H( ]. E; S    xor     cx,cx/ w: W% I0 _5 N* r: w
    int     41h
2 j2 S; i+ @, g6 g# V$ v4 n    xchg    dx, es:[41h*4]
- }) k! b4 |' I, O# X+ h    xchg    bx, es:[41h*4+2]
$ T* g0 i  K9 {& m5 C    cmp     cl,al
$ S7 X8 b& Y" A0 B    jnz     SoftICE_detected: I/ @) L& z) X# H0 `

. Q( _$ \* i( Y* }; }* ~, a+ T_________________________________________________________________________
7 L/ k& o; R8 s# ~; X) Z5 q
2 O+ f0 p7 s9 Z- o; o! X1 Z) hMethod 07) i) e2 Q) F4 o; m. k
=========
) }. ~; ]. ^, E4 u1 l2 @
, c% @8 W6 X8 x" O4 s) i; eMethod of detection of the WinICE handler in the int68h (V86)) L% E( y& {; Q" F6 E! k8 m( |, T
! W1 |$ G% m) e1 {
    mov     ah,43h
8 d5 c! T4 j7 v' c3 i& r0 Q+ B; y    int     68h, S0 X* N6 V" p& d3 N9 P1 u
    cmp     ax,0F386h
2 v9 y( ~- p+ [% h7 N; `' X  }    jz      SoftICE_Detected
: |- E# @; h  H2 O0 A7 R7 s7 O9 p1 y0 ?  a4 O: `1 _" c

/ w! F1 b5 A3 P( |* B3 e=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
% u" q# ]6 S- \/ x+ i, S; C7 W   app like this:
4 P$ Z! F+ `5 j3 s# d. X2 h
3 F( m* y. h" L* K   BPX exec_int if ax==68
) z- ~% h( l/ u, L6 q   (function called is located at byte ptr [ebp+1Dh] and client eip is
, t5 M, H4 O8 z   located at [ebp+48h] for 32Bit apps)2 x* x, P  W2 i1 c5 Z/ K. m
__________________________________________________________________________
" l* m) j6 V$ W7 r; ^
6 L/ z3 j# I/ h3 G: T
1 h8 e! A2 c! b" }+ d3 R5 KMethod 08
4 c" \. E/ l7 J/ `=========
( k/ i# J  \/ ?/ b+ y* r# x# E. M+ `+ m/ g
It is not a method of detection of SoftICE but a possibility to crash the
# ]' `: D2 b) V* l! ^system by intercepting int 01h and int 03h and redirecting them to another; W6 C2 ^6 W) o
routine.
& }6 Q/ c8 I9 V' @! |( X6 bIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ z  @/ }% b/ y9 [, t) y; x
to the new routine to execute (hangs computer...). R. G; l2 q  z" _; c
' v) W7 t( v# |1 z
    mov     ah, 25h
% _5 O5 Q1 J2 c3 S/ {    mov     al, Int_Number (01h or 03h)
0 h& G: s9 K$ G2 Z1 Z    mov     dx, offset New_Int_Routine! A# M& f% e' [' V0 [& L
    int     21h4 ^, L: X  X/ M% s/ C
; V3 ~1 e7 ~/ f6 S' d! u9 I: h
__________________________________________________________________________
$ ~1 h$ J9 w9 m% y9 r
9 r0 ^1 @; o, S) WMethod 09
( P& G" b% L) ?: U=========
5 o5 Z8 {7 D' ]( ~9 w
/ K9 o) D: j+ C( w/ t& k3 NThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) G2 N' V3 v! A( p% y. q% F7 u
performed in ring0 (VxD or a ring3 app using the VxdCall).
. g- `( ]7 r, F. d# dThe Get_DDB service is used to determine whether or not a VxD is installed( k# \7 G- [* F* m  r; ?8 I6 |8 o
for the specified device and returns a Device Description Block (in ecx) for
  a. \% _( [- D) f8 _0 Ithat device if it is installed.
3 A2 h2 `3 a  {2 l; D' d6 `/ M" H2 R: [8 U0 q$ n. g+ G
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 p/ y6 Z: l' I) e4 j1 _' K( Y
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* v4 f4 E+ a% W5 F# o% v   VMMCall Get_DDB6 r8 I+ a; u/ ^4 p
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" K" b% I% L" V- Y* h
5 t' @; R0 W+ T8 z3 t! ^, }0 w
Note as well that you can easily detect this method with SoftICE:
0 Y) g+ T2 [* b2 R1 S   bpx Get_DDB if ax==0202 || ax==7a5fh1 r6 D7 t! ^4 G: i
0 H" M1 c2 i; Q4 K
__________________________________________________________________________
% K1 e# g4 N2 I; `$ y+ T/ x8 O8 h6 S, T1 S) ]
Method 10
; U( z# ?6 M5 O8 f/ [! z=========: ~( f( }* c4 L: N5 ^1 |
1 v& W% Y$ a7 r" y2 N: ]! V& p
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ n$ H4 l% c) E% R$ C9 o
  SoftICE while the option is enable!!
1 [0 P# o* C6 |; W1 v/ ?& p* _6 O" ]) E- u
This trick is very efficient:
- |/ R7 {1 E, n7 L+ fby checking the Debug Registers, you can detect if SoftICE is loaded* T) J6 u& j+ a5 \
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if6 }+ z' n* c) X
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( A8 ~3 o' y6 B, R% J3 p- ~value (in ring0 only). Values can be manipulated and or changed as well
  ^% o7 {" X' @! \& S3 A* P# d(clearing BPMs for instance)1 h/ Q% `  V. b- a% D3 Q
8 b1 {$ r  w. F/ H5 b% A
__________________________________________________________________________7 ]/ Z$ V/ A/ @. [! Y3 ~9 j

. h2 ]* j$ F( ~7 l4 BMethod 11$ k6 x  x' [0 \$ S
=========+ }) s* D( Q$ O% |$ r9 e
7 T7 f, D& g( R! M
This method is most known as 'MeltICE' because it has been freely distributed
: o$ _5 a  f3 _2 d: l" Z0 @via www.winfiles.com. However it was first used by NuMega people to allow
' C2 c" H* H0 z6 R, A; LSymbol Loader to check if SoftICE was active or not (the code is located
0 J% n# M2 L+ A, uinside nmtrans.dll).1 V5 A, u1 y7 a- T9 A+ H/ y  k

/ i! ?: W( y9 rThe way it works is very simple:3 E9 s- p# `6 X; }, A  x6 {) y. G
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for& Q1 p; H2 v+ g, r0 n3 S$ K4 O# w
WinNT) with the CreateFileA API.# e; o' w& ?$ R7 w" ]' T8 r

" V2 b# x. Y4 [. `' {) V% n5 YHere is a sample (checking for 'SICE'):! @7 B: T3 L$ }- V' Q3 B
+ g( @3 Y" n# [: X
BOOL IsSoftIce95Loaded()
/ f, ?# ]- ^' p- h% C( z{
- e" k1 U* c0 ?) U& x   HANDLE hFile;  
; R# c) V2 Y( e' Z4 J- I   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# I2 G, C$ Y, P: l; K" u- g
                      FILE_SHARE_READ | FILE_SHARE_WRITE,% y6 Z2 i3 H" H) K
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. Z9 A1 }0 f1 F8 @4 [9 _   if( hFile != INVALID_HANDLE_VALUE )
  ^: J0 l4 Y9 H* Q. m   {
# W/ l9 O, E% S  M  ^: c! U      CloseHandle(hFile);
" m1 U' U, F0 s) _/ U# P% }      return TRUE;
* u3 Y9 a$ t% V; U   }
1 u; q* n$ \0 N. V1 A6 \2 F# p   return FALSE;
" z  ]0 X' S3 ?3 H$ i8 z9 v9 T}3 C/ ~: G/ ^; Y& Z$ s7 F
0 `, I2 E0 t' v" w0 A+ _
Although this trick calls the CreateFileA function, don't even expect to be
4 t; ]0 |+ A# `! N5 a- X: ]able to intercept it by installing a IFS hook: it will not work, no way!$ n) s$ _! ], @- w8 ~- h
In fact, after the call to CreateFileA it will get through VWIN32 0x001F* I1 S, L. L+ N& t5 m: u
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 p( s$ n; ~; L! ^/ jand then browse the DDB list until it find the VxD and its DDB_Control_Proc) v9 K- l2 V; {6 z6 q- W
field.
+ V1 q4 [5 z* ~, P0 H2 X! ~2 hIn fact, its purpose is not to load/unload VxDs but only to send a
8 z9 e5 `6 f0 r: m4 u% ZW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ K1 }+ D7 K' z1 R3 `! M9 X
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
  n* i- c  G$ D: c5 Qto load/unload a non-dynamically loadable driver such as SoftICE ;-).
% w% P  d4 i9 o( h# p% R; _If the VxD is loaded, it will always clear eax and the Carry flag to allow4 w5 W! Y; ?& t( x6 J
its handle to be opened and then, will be detected.. E4 x1 W& O( E8 ]' E
You can check that simply by hooking Winice.exe control proc entry point
8 w4 S& y# }1 @- m- Pwhile running MeltICE.: k: {) y8 E/ [1 A7 H: o: s
7 U2 Q* J1 g  @+ _

+ \9 l4 r. W6 P) O6 n) M$ P  00401067:  push      00402025    ; \\.\SICE2 k  Q+ @7 H& S% Y$ h$ z
  0040106C:  call      CreateFileA
0 s& c/ P, W0 a. W& {  00401071:  cmp       eax,-001
. P/ |* k% w; h( C  00401074:  je        004010917 f- j" u# e) b0 ~- ]8 L9 V
8 u7 _" |* i( O

/ c' ~  d! n" a% [1 w' _( n2 JThere could be hundreds of BPX you could use to detect this trick.
. k* O* _" s6 S! J% n-The most classical one is:  P: D6 W( P: ]9 n' T* D
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' L% P( a. Q4 @( p/ P# d' u) c
    *(esp-&gt;4+4)=='NTIC'
! l+ v. a- @; S7 [: E! u+ p; B# a; _1 v% p! ~  M
-The most exotic ones (could be very slooooow :-(
  V0 b( S% c1 H! G9 D. ~   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& N) T. Q7 @) c& X     ;will break 3 times :-(, `3 J- `& a& Q7 |& |' a% w
- F$ w& s; _; X  V2 Y
-or (a bit) faster:
, d. M0 Q9 ?7 M7 [9 y" O9 Z* l) I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ l+ s$ Z# q. c6 Y. @

6 w% K9 V$ E1 w: y/ r& C, n" i! t- j   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 L6 J6 j0 u2 D! i  G
     ;will break 3 times :-(6 G; o; L' D5 Q

- I  C9 a) g1 d/ _, X! P0 _-Much faster:8 q, X; R9 f' l, Z
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 F3 H7 K% p- E) ~  g- R1 B$ _
5 a$ B8 g) k# a3 h0 X5 a2 eNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
; z3 q7 X) h/ O, Tfunction to do the same job:$ }0 _) d( Z% ~! L* @1 _
" u3 W) ?( Y! m- E, B4 _- |
   push    00                        ; OF_READ
! G; R3 p! i' ^+ G   mov     eax,[00656634]            ; '\\.\SICE',0
# w8 I( I# R$ X   push    eax
" t8 J& v2 c3 G" V   call    KERNEL32!_lopen1 E- }9 b5 n7 e% J4 T6 Z$ j0 p
   inc     eax
* o# E1 {6 j& z7 m+ k8 p   jnz     00650589                  ; detected- R! R! X3 T- f3 ?
   push    00                        ; OF_READ
. |) ~) @6 W( C   mov     eax,[00656638]            ; '\\.\SICE'
/ W6 Q1 y1 {0 z# }% n   push    eax. O2 {/ l1 n4 ~( X
   call    KERNEL32!_lopen
8 p% \/ b" I0 R9 n' ?& z   inc     eax
2 _6 a  z1 |$ D' ^. l) `. M4 C% W   jz      006505ae                  ; not detected: A, u/ ?0 I; x2 A5 a

! |- l2 S6 A8 o+ }5 c1 o, A8 u) }* K1 Z, a5 M
__________________________________________________________________________
' t3 R( X5 T! `2 u8 x- s7 q; j/ s
0 Y) c, \! h) D" ?, MMethod 12) d, R3 C8 X& `" f7 p; H
=========
% F, k5 [  ]0 V$ y" U: ?- a, x2 @" G
This trick is similar to int41h/4fh Debugger installation check (code 05
# \  c% ^: u7 j7 A3 |0 W/ ]&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ e+ O; o# e! W- s* K0 I7 A/ t
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.- _' p4 B3 m8 c/ I2 @8 B& h6 f

7 @, d+ q8 Y2 w! }) T- J# ?% M   push  0000004fh         ; function 4fh4 T+ \  y/ Z# B! c& I9 t* o- U
   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 L4 d" ]: n9 [- ~6 n5 g* P0 |) K                           ; low word specifies which service0 a: h( w, k3 a4 |# u$ ~4 _
                             (VWIN32_Int41Dispatch)9 ^0 E' q4 r* {1 |
   call  Kernel32!ORD_001  ; VxdCall- s% P  V) _& \' t3 J! M1 Y) H
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 p. [/ U" r. G1 V7 U8 U   jz    SoftICE_detected% S2 q* O' h. |9 ~

8 t) t" |7 |. x  F3 H1 w' r& sHere again, several ways to detect it:
* N1 f3 C; q5 K* B
0 n( P. S5 ~. O    BPINT 41 if ax==4f  \2 f4 I7 M% \- T
; f. U! G6 F5 l" P" j& H
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one$ Y, R+ [1 y* F/ k& w) ~
6 {5 E$ ]  f; ]1 @" E6 G5 `
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ d. L2 Z( \( C# w# R1 L

. M% F7 T, W7 k6 T( E2 r    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ C" p6 y# A7 e/ O( \+ V" c% F7 ~
+ R) Z  K8 K: a0 u( Y: }) j2 f0 B0 S
__________________________________________________________________________
. s6 i6 S, K9 ~& g
! o* @" A4 \$ b5 K5 c+ SMethod 13, y7 e3 s  ~, P! l5 t4 m" }
=========: p! [5 F6 y! c( H/ {7 _, u

; t( N8 y+ Q6 S/ l9 {- r4 H4 rNot a real method of detection, but a good way to know if SoftICE is) ]* `- Q$ H4 L& W% s3 O
installed on a computer and to locate its installation directory.
+ A, l4 }0 h6 b  j  I# C4 g. _It is used by few softs which access the following registry keys (usually #2) :
1 x5 L( T+ g; ?9 p0 L; p
% k# v: {* q/ V% q7 l$ \3 ]7 ?-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 R) L- S, u: i! `& `\Uninstall\SoftICE% M" X" \" Q5 A2 G% }$ p
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) n% g, Z2 g" n3 H7 b1 X6 Q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: N8 A1 w( s4 E0 g* m3 t5 O
\App Paths\Loader32.Exe! E5 N# j# y! w3 c7 r0 j

- I8 D1 j5 c( F' M7 v) g1 _- z6 }  \2 T. B8 j# R+ V' W
Note that some nasty apps could then erase all files from SoftICE directory7 ?. r" C4 n, u) @! d2 S7 L
(I faced that once :-(
) Y. x+ w$ v' P: s! n
$ c6 @, ^8 F. ?; C  u. {Useful breakpoint to detect it:7 D2 C+ f  M9 {% N" x7 l7 _! f
: J. F- F5 \) k( A, X- @
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 d. X' y+ C$ p" A: U. S
9 U0 ~4 B. G0 N) J__________________________________________________________________________
( Q" |. [2 ]) o* [
# T7 j+ R) q' \" X- c& T! `/ m# z# R$ b
Method 14
2 ?1 @  n* Y2 K=========8 Q$ U$ _$ F5 n3 V! d8 S

, D8 p9 }' d8 W" t: g0 B7 {! BA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) v) A; B0 Y' `7 iis to determines whether a debugger is running on your system (ring0 only).
1 [5 h. F3 c/ B7 p
2 [# O7 ]5 ?* B5 x   VMMCall Test_Debug_Installed
8 _: n, }: h( c/ C   je      not_installed& O, {! P0 |) e; l: w
5 O% a7 j5 @. R  ~: b
This service just checks a flag.( k7 Y3 u- B3 j% U
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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