About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' J7 B0 I' s6 k1 I6 b4 S5 d5 u<TBODY>
( p2 G: {8 @2 |9 B* k<TR>
8 E: t, U$ N3 L3 ^* B! L<TD><PRE>Method 01
( _- e- a$ r4 K6 A/ I3 T/ N- i. J=========
9 U2 W8 S. x) Q1 X( u) f$ Y
" F) S1 N- m2 T# x1 g8 I- i0 D5 HThis method of detection of SoftICE (as well as the following one) is
8 r# p9 v# C" ^+ fused by the majority of packers/encryptors found on Internet.
" P# ^. G8 Z4 ]It seeks the signature of BoundsChecker in SoftICE5 u/ R8 f- g# v

) Z; T" t8 d3 c& o* G" ^    mov     ebp, 04243484Bh        ; 'BCHK'
, H4 h& r; z, L    mov     ax, 04h; o& G- S( J0 c2 u6 h2 x
    int     3       % c5 s4 k1 }% p9 L) O
    cmp     al,4/ L" ^* K2 \0 i
    jnz     SoftICE_Detected5 Z: x. ^/ Q8 B  K& t

1 J+ a5 g0 n; [  F: J& r: J5 _/ L9 X___________________________________________________________________________$ O8 q2 |  r: q6 J5 @$ J) p
' ?# {: ?! z  @7 ~1 C! D2 B2 I( z( D
Method 02
5 S* B& ]- ?, L& i0 n=========6 O& l. c! Y( C* l2 ]
# }) `# L) v9 S% h* j4 }. i, l; t
Still a method very much used (perhaps the most frequent one).  It is used
( _0 @+ R: M$ C- ]to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 t2 y( E# W; p, nor execute SoftICE commands...
6 R4 F8 `) u+ B) x; QIt is also used to crash SoftICE and to force it to execute any commands
: h8 |9 z5 P& P! e" d$ a(HBOOT...) :-((  
7 t- u* S+ j; K: w$ o3 u4 w& ^( C4 ?2 d
Here is a quick description:% Z0 ^6 B$ e5 F& ?, U$ h% q
-AX = 0910h   (Display string in SIce windows). K* X" B9 q# m/ k6 K
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 g0 }9 Z1 V. W  R, E& s& O
-AX = 0912h   (Get breakpoint infos)1 ]  R( h% [0 u7 J) }" j
-AX = 0913h   (Set Sice breakpoints)& ?  U, r$ u0 S! L( _# F
-AX = 0914h   (Remove SIce breakoints)6 z* R8 J4 ]5 R( S3 T

, v& N5 X8 }7 p+ [1 i: o  REach time you'll meet this trick, you'll see:
1 W4 F  d3 E* l3 Q" w5 T7 R2 U0 `-SI = 4647h
  S9 ^) ~; g1 Z+ U-DI = 4A4Dh
9 b' I3 v( |7 w7 N  ^Which are the 'magic values' used by SoftIce.; x* t" W. B1 i1 W7 I
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) b" V" n! m# y( p' ^( t5 A* `: j8 r* n* u( f* {9 m0 t, J* O
Here is one example from the file "Haspinst.exe" which is the dongle HASP* v3 M# `# Z0 X) P
Envelope utility use to protect DOS applications:4 U! V( c) \9 l9 U1 a0 y

) F: Q9 n8 U! k3 }+ c3 [& R$ I, @% l, W8 h1 A
4C19:0095   MOV    AX,0911  ; execute command.
/ C: P* M1 b' G6 K6 d( X& G4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
( L8 `" ^5 V+ H- g4C19:009A   MOV    SI,4647  ; 1st magic value.4 l* H( d1 a3 z
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.% U& D. L" c. [/ J1 W, }  r
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- K8 r; m9 F0 R
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( H  h% _: d, A% E' e) x
4C19:00A4   INC    CX0 j: q  }" R& E* R/ U" k! ?9 ~
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute4 G& l$ O7 D* b6 T' \, ^
4C19:00A8   JB     0095     ; 6 different commands.$ |& c3 ~* w  z& a
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) L: m3 [' N- s: d2 C2 ^4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( R3 ^" ?3 Z% I! O% ^. M( r: [) x8 f( p) Q7 W
The program will execute 6 different SIce commands located at ds:dx, which
) l  ~9 v$ F1 c2 e9 K1 Lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' ]$ ~7 V4 P# ]* b: R* t) ]/ t6 m# L  \7 ]5 d
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.) C# K" |9 @& }+ P( N
___________________________________________________________________________
" Y' I) h# r% P# x! u) |3 C0 @6 j! u$ r9 w

0 e. S5 s* T! e, I5 x: l( ^Method 03) K1 r& E' V* v0 J& S
=========5 w- i; i% O/ c# p) L

$ t0 {+ P; n' p2 W3 O( hLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 G/ N3 C) A5 f& W' l  @! K' q(API Get entry point)2 w; q/ o4 O$ @
        
* A0 E0 _" u: p  z5 W. z3 v: U* O" N, K0 t1 h2 k
    xor     di,di' S+ j4 J, @+ n$ O# U9 R
    mov     es,di4 C) a- z( q$ Y( [# @4 a0 Q
    mov     ax, 1684h      
$ ~5 d0 q- B: M    mov     bx, 0202h       ; VxD ID of winice
  t; Y, ~5 ^: ~" A    int     2Fh
) E/ T  G0 o: J0 C$ C0 T    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% }; n( S/ ?- Q) e    add     ax, di
) S/ K) d9 I6 z" H    test    ax,ax
8 ?" K5 }3 k& m! Q0 A+ L    jnz     SoftICE_Detected4 z/ `. f( h5 ~1 a. J  o* A

9 N8 w( J4 U% a5 K' r7 S0 X6 J___________________________________________________________________________9 N+ ]- x" c$ i
4 F$ }4 Y8 t  o2 Z8 I5 E! X
Method 047 A: U% ^4 X9 o
=========
7 ~7 d# K7 r9 u
- J+ t1 \* Q( t# Y3 tMethod identical to the preceding one except that it seeks the ID of SoftICE# y5 M9 I2 R& p" }  `' T$ g1 Q7 d
GFX VxD.
# O5 o* Q- J3 M! V: i  O  z: N! v
4 S4 K- }3 i% I) t' `    xor     di,di' d+ ]5 m  }2 q8 v. C5 V3 ]
    mov     es,di
2 N- f1 f2 n2 f; ^' V% D& F    mov     ax, 1684h      
2 P) \2 g* R3 f; n) Z    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 i' x: G& E# C5 N; m+ b- f) ^    int     2fh
( |  k% z! o$ m& N& N, C" K, [    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 \# D" {. ?1 h8 @: ^; P! }
    add     ax, di( ?! {, [' x; m
    test    ax,ax
2 K( K  D. q0 P/ b, ~    jnz     SoftICE_Detected
0 J( h4 O/ i3 b6 A) |5 k7 k. L7 x+ z  v
__________________________________________________________________________
' p4 t6 C8 W8 O; h8 m: I% m- d$ v% Q& R$ j8 \
) w) K" Z- C# K6 d; _
Method 057 G/ E1 Y) q7 J- r0 @$ p
=========9 M6 a: n8 J: h! [+ c
/ R* N' a5 D/ L5 V# V& u7 H
Method seeking the 'magic number' 0F386h returned (in ax) by all system3 T* F- b5 O4 x) c( t" ~
debugger. It calls the int 41h, function 4Fh.) c& C1 A3 E7 l
There are several alternatives.  
. n9 ?& R/ Q5 Z4 x( q7 v* g: X) {2 i! G8 `& t/ V
The following one is the simplest:
8 S; t1 e4 d' I7 O  n1 i  Z
# [2 U; b1 k# N- m+ {    mov     ax,4fh& p5 u7 y. O- d8 X- I
    int     41h7 r" N* o7 b( m/ f
    cmp     ax, 0F386" o5 Y2 |( k% `7 r5 H2 i
    jz      SoftICE_detected, G0 R4 E, l$ x/ U
1 Z, k7 T" b" |- r
8 j' R4 N- H/ W* ?1 V
Next method as well as the following one are 2 examples from Stone's ' k. E' h' r/ l9 S8 X. F2 B
"stn-wid.zip" (www.cracking.net):
4 ~( x& r5 D3 Y9 I; d; d% |
1 [$ Y7 ?+ m9 Q' B: [) q    mov     bx, cs3 I) }2 W# O5 A( i- B
    lea     dx, int41handler2
9 W: R! S% Z  Y9 Z/ v2 _    xchg    dx, es:[41h*4]- R) q) H" n& R2 C; @
    xchg    bx, es:[41h*4+2]( L/ Y% H; @% H: \, c8 z4 K& v
    mov     ax,4fh$ a& A# o* }; P
    int     41h) P' C1 ~* x; L. I5 I0 M1 k$ |
    xchg    dx, es:[41h*4]
9 K. d: O' I# A; o    xchg    bx, es:[41h*4+2]* g7 U7 u$ [/ q! y8 D
    cmp     ax, 0f386h) m) o0 m% G. z
    jz      SoftICE_detected
9 I4 l( t, J; ^9 d2 Y* J" Q' M* J" T  S: {$ `
int41handler2 PROC
/ i+ W6 N$ h7 u0 O% H) p9 p    iret
. G: H& D  B* m  b1 Rint41handler2 ENDP
# N% a$ j# x9 x/ [7 E& z% A; c* J* S3 G

( N" c3 @+ D0 q_________________________________________________________________________7 E  d$ j; r0 n

" ?) \: U( L+ ^# j# h2 s( R6 S( j+ e( ]: ^% H. }# p9 l6 `' V+ f
Method 06
& z8 j# I% I" i$ i8 h7 b=========4 W5 c( \4 `+ K1 X

9 Y9 I# R5 M. s) R3 e1 d# {9 B! O
2nd method similar to the preceding one but more difficult to detect:9 x: J+ F0 ~1 y3 r' j+ r
' p, S5 v+ L# s" |9 l! [
+ l, P* e$ B) _, Z* b
int41handler PROC! q3 F( r% v  L! _6 U
    mov     cl,al0 `  z* N6 x% d5 S* u) i3 O. U5 M
    iret8 v( x- D7 d" W4 U  `  s
int41handler ENDP
6 s7 ?6 E& B- i" M" o
: q! o- P2 f& Q/ g* }* ^
6 M: p- ?$ J) @    xor     ax,ax
, a- {# `6 y3 g- o* A3 y    mov     es,ax+ W, Q1 v# I$ @4 p4 V2 {
    mov     bx, cs
# [; ^- I" H  T    lea     dx, int41handler2 z, A8 g% X) N# L" O
    xchg    dx, es:[41h*4]7 t) Y& I- g/ U9 t: |
    xchg    bx, es:[41h*4+2]/ q( _$ k4 }1 _- p. g. B
    in      al, 40h' W1 e1 m" R) r+ \+ b
    xor     cx,cx3 D: {. A8 h7 z. W
    int     41h5 C  a4 |4 p1 U" P6 C/ P
    xchg    dx, es:[41h*4]
1 m) Q( u- t$ b    xchg    bx, es:[41h*4+2]6 g3 J- k) {5 T7 {# x: @
    cmp     cl,al
. |0 K+ W7 o4 l! Z& v& l    jnz     SoftICE_detected
3 M* S" \4 L' t9 v7 Z( A( ^2 ?! Q, r  t. a- E/ V: m
_________________________________________________________________________0 ^' i" Q: h# ^/ W- ~

4 R( m7 K. N4 k* Y/ VMethod 07$ f+ i: o6 @4 F$ b
=========
0 C% O1 C7 |% o5 H
3 W: Z- k" R) \/ VMethod of detection of the WinICE handler in the int68h (V86), B: g% f3 u- D" L

# G* F& p4 x! z9 j9 c) d5 Z    mov     ah,43h
; J/ v, ]2 c1 }) ]    int     68h
: g5 n8 A" b8 S6 T' C% k: d+ {    cmp     ax,0F386h/ n+ ^) i, N  U: w4 `
    jz      SoftICE_Detected* d" P) z1 o6 r% d' @9 T$ X9 T

& E2 s9 O" y* [  Q7 Q& f( X( C6 W% T
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit  R; F) R* Z* W& B1 w
   app like this:
! ?0 u& Z. {0 p6 Z" r" R( @' f
. D/ n% G- d% e7 V# V. G   BPX exec_int if ax==68
' {/ q- z. A  z: n   (function called is located at byte ptr [ebp+1Dh] and client eip is
& y) U, x$ l& G% v! K* T9 Z# F, o) t+ Z   located at [ebp+48h] for 32Bit apps)" M/ d) w) P8 X
__________________________________________________________________________
% i$ F) ?# N; u2 U5 V; V
0 y0 I9 r- h/ v8 A9 N4 N* R* o' ]: \+ P5 m9 `; ?
Method 083 \- Q! ?. V( D5 g( F* S8 Y9 f3 l
=========7 i) `, Z7 m5 [5 M

% l. G4 A1 Z6 x2 ?4 h9 wIt is not a method of detection of SoftICE but a possibility to crash the% f+ n( s+ {2 O7 ?; w
system by intercepting int 01h and int 03h and redirecting them to another
9 Q4 v4 X% D" k' eroutine., R9 r" l. l- o( m: i
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 [4 t. p9 b' R5 T+ _to the new routine to execute (hangs computer...)3 `( w5 \4 Q% E' G! Z# x( p

6 h2 c0 M$ y3 R7 H+ O    mov     ah, 25h
( Y; n, \" m3 m1 d9 _0 Y    mov     al, Int_Number (01h or 03h)
* R' b( m: Q9 z' a  V    mov     dx, offset New_Int_Routine
# |+ G6 Q; p/ y" l    int     21h. f: z' E" n1 m* N% p8 W
. y+ K1 S# x- _: G5 U
__________________________________________________________________________
5 T% I' I& E3 q3 v- b# P
3 v$ k4 C/ d0 x, O  K0 KMethod 095 P8 \/ A7 t0 B1 _2 A6 _
=========4 }3 m1 a( R& L. g2 p0 I) L* z

: y( M+ d1 ?2 ~" ~4 ^6 O+ G$ t3 XThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ N+ D; f( Z% s% q3 d# {6 dperformed in ring0 (VxD or a ring3 app using the VxdCall)., x3 z  a% ?: M8 x2 }
The Get_DDB service is used to determine whether or not a VxD is installed+ M, v5 m8 E/ [- O- V1 B! f
for the specified device and returns a Device Description Block (in ecx) for
9 B2 S- f+ t( d3 lthat device if it is installed.
3 F5 x% Y# `, \+ x% |1 p
  E& P( r+ W* i) O6 n   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) O" y+ T4 ?' h, c" I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)' E7 F( s0 M- e- J4 R# ?8 l
   VMMCall Get_DDB
& b' |- d+ E+ {1 [8 l   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 O; d) G4 p& Z5 m  b0 O/ v4 ~

" o4 q0 _4 k- ^Note as well that you can easily detect this method with SoftICE:
; v2 G. P% c; {" |8 w) R' n7 v# p   bpx Get_DDB if ax==0202 || ax==7a5fh
) |9 F! V5 R; p, V
: k  G. A: f% t+ S+ @5 F5 t2 v3 M__________________________________________________________________________+ S+ F& e; m; w; R

8 F& L8 U. j) U0 a: K) YMethod 107 n2 k7 O/ ?- m; P1 A: T- X( k; S
=========. C( K4 g/ K. Q" ~0 f0 A

* }  b4 a7 K1 ?! K7 g* }=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 F% x6 r! \! g" S& G  SoftICE while the option is enable!!1 L- A# {9 x+ o/ a) ?0 w% V+ M
4 ^9 [: b/ B9 n+ _, k( K* ^/ ]6 k$ g
This trick is very efficient:
, P5 n- L4 }' i& cby checking the Debug Registers, you can detect if SoftICE is loaded
8 \+ H# O4 y2 A  {6 g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. D. D6 r/ Z" C" t0 p7 r  h
there are some memory breakpoints set (dr0 to dr3) simply by reading their
& `; U% w# }& m* e! e. j* svalue (in ring0 only). Values can be manipulated and or changed as well
6 d7 d5 U6 ]7 H( E) \7 u(clearing BPMs for instance)
8 W! _) v8 C- i  E0 v: B; q: n0 s3 }
. V& i% C0 |+ O$ i__________________________________________________________________________
" n" f. j  Z0 ?3 l# |3 _
' w; J' {+ n3 C5 E; YMethod 110 l" E' z9 U: A* u# J! ?" f' D
=========
# b/ X2 w$ h/ ^" x6 X
1 k" R9 e& j6 k+ ?This method is most known as 'MeltICE' because it has been freely distributed
: d8 Z: D4 K% s0 t% G6 J: d! xvia www.winfiles.com. However it was first used by NuMega people to allow
1 [2 E: k1 k5 b% d" sSymbol Loader to check if SoftICE was active or not (the code is located1 X+ l! G9 Y! k
inside nmtrans.dll).
3 F; H! D6 f/ @. d! ?+ ~' Q- F+ ]9 }( y/ [7 U
The way it works is very simple:
# \3 w" f# e8 G' aIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: h1 l8 f8 ~( tWinNT) with the CreateFileA API.
0 V. n2 l' I: J: Y& G* r5 e6 X% }3 ~0 D2 f: `3 q# I' J) i; C1 B' [
Here is a sample (checking for 'SICE'):
# |: S& M0 F4 s$ i6 j. c3 @$ }7 M
BOOL IsSoftIce95Loaded()
7 D) V% g" `+ o{* ?2 v# R% ~7 v, R
   HANDLE hFile;  8 F4 |& W$ ]& B3 O9 N
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ E8 A- X: y# z( I
                      FILE_SHARE_READ | FILE_SHARE_WRITE,& m8 T1 z" O# W3 T  m' Q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 N8 J4 F% K4 i, ?, Q; v   if( hFile != INVALID_HANDLE_VALUE )1 t/ _' J1 {% J% w  @. Y; q
   {
* I5 q7 E( w) \% R" X      CloseHandle(hFile);
. C( P' q' @8 r7 r7 C      return TRUE;
6 J9 P: j; ?8 t/ W4 V- V# O9 {5 ~. e   }: B4 h8 E$ `8 @. U2 L
   return FALSE;4 L0 G% I7 z# T1 \6 g5 ~. a. R
}- B7 C. L1 \2 I1 S% X& E- P
) Y" }* P  R7 a# g6 O5 ~: N
Although this trick calls the CreateFileA function, don't even expect to be( n& r) i3 k0 d* k1 }( f/ }
able to intercept it by installing a IFS hook: it will not work, no way!% Q# X  _6 z! }4 m' b! {
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
# _9 I! ^9 q; c9 Uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! U/ {# c  J9 r0 x1 Qand then browse the DDB list until it find the VxD and its DDB_Control_Proc
# P! v/ R3 J+ j+ U* O8 Vfield.3 b$ \/ V# p) ?% a" E& R; b
In fact, its purpose is not to load/unload VxDs but only to send a
1 S- M. G0 a* N! C6 L% VW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 H9 E7 ^& ~/ i  I6 Y/ v. Qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 r& T( }$ z3 o0 z9 Ito load/unload a non-dynamically loadable driver such as SoftICE ;-)." ~. z9 w* ?) J' I6 o/ @
If the VxD is loaded, it will always clear eax and the Carry flag to allow
/ B7 l3 D1 I9 {3 pits handle to be opened and then, will be detected.
' U- t" ]* ?4 b6 R% @4 _You can check that simply by hooking Winice.exe control proc entry point: @/ U' J& E' X6 H% I
while running MeltICE.
/ c* j( M) f/ T7 W: y; P- h5 y  s- {9 x, P' o
* h/ S: E8 Q9 Y8 [+ W
  00401067:  push      00402025    ; \\.\SICE
7 _& W3 J" [$ H* B  k* H  w$ X  0040106C:  call      CreateFileA
' P# t" \! a, j/ P  00401071:  cmp       eax,-001  u$ j1 X9 Y9 T$ W# x
  00401074:  je        004010917 P/ z# V2 Z/ c2 ^+ W6 g
$ T- s# N7 O: C/ n! P  W

8 U! I5 y$ J( c+ o7 ?+ CThere could be hundreds of BPX you could use to detect this trick.6 }, M7 j! O  F5 R4 |2 e9 L
-The most classical one is:
8 z8 |: N. Q% q; [' ?4 n* m+ Y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 [/ g0 V2 v' o# l) W/ b
    *(esp-&gt;4+4)=='NTIC'
; y; d9 Z* u' K6 |( p$ {' Z) L0 z# p1 e
-The most exotic ones (could be very slooooow :-(" n, I" M! b3 }4 w% }5 g; w6 J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 v  e" U! M+ E) i  t% \/ X4 ~3 h" j     ;will break 3 times :-(! H3 V( [5 f0 Y1 _, @) i2 }# F7 D

; p6 f, c, P( l) i) x3 d-or (a bit) faster:
! q) k# E' t: c0 y7 r5 L   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! A1 }% F! ?2 J' {! ?

9 A7 f, ]6 K" i- r" ?   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ' m2 C3 ^6 O7 X; J: Y
     ;will break 3 times :-(
& x5 T3 G; Q; g9 k. Z) O
0 a7 c. R, \0 m-Much faster:1 ?: F3 U- h0 u2 V- M
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 D3 o1 G3 r! ~! v2 I. ]

' a7 g% O; s. A1 R/ d6 i! s# SNote also that some programs (like AZPR3.00) use de old 16-bit _lopen- a6 @4 ]: b) N5 V4 F" y4 E
function to do the same job:
6 u( O' }+ h1 G3 c6 t2 {$ U8 l, R- {/ C5 E; W
   push    00                        ; OF_READ
6 o1 z9 J9 l" M3 z1 _   mov     eax,[00656634]            ; '\\.\SICE',0! V! B$ _( t: X, e) G! p* L
   push    eax6 Q- R; C5 x- `4 X% @/ ^
   call    KERNEL32!_lopen
6 w+ ~  d- Q: A( @" j1 Q; w   inc     eax! `! F6 V6 M: N! R+ b
   jnz     00650589                  ; detected8 N1 A- K. s1 F9 a/ ^
   push    00                        ; OF_READ% c. \3 L+ [, m
   mov     eax,[00656638]            ; '\\.\SICE'9 L9 P/ D4 f* ?" n% V
   push    eax0 P+ s2 T# |. K, E' ]1 j
   call    KERNEL32!_lopen9 @3 }  W0 N* V+ k: t& L
   inc     eax6 {7 w4 l! i& M, X
   jz      006505ae                  ; not detected  r7 f# f. z9 S% X! p$ u# S
- C1 h  _( U+ R! U  ?3 V0 F; H

$ J% `# w: `7 C+ M__________________________________________________________________________
* U& Y9 i  ?0 [8 K) Z3 }
+ C% G/ p# r1 @" WMethod 12
) v7 M1 L' c7 ]% o! r8 X=========( n- D4 \6 d0 ~; w
/ o/ ~1 D5 ~6 f/ j, |
This trick is similar to int41h/4fh Debugger installation check (code 053 {5 ~, y* O" ]+ n9 ]% c
&amp; 06) but very limited because it's only available for Win95/98 (not NT). @  X: J( C: z6 U7 R; f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.) H4 Y0 l& S/ b9 B6 Z% c

8 Z' n2 m# x" `/ N) O% u+ N   push  0000004fh         ; function 4fh
8 m% m" i1 G7 Y/ J5 n3 f, o   push  002a002ah         ; high word specifies which VxD (VWIN32)
" q# a, @4 L3 x, B2 s8 c- |                           ; low word specifies which service. w, Z7 u# `+ W. O* V$ h
                             (VWIN32_Int41Dispatch). A/ v3 o6 h9 G
   call  Kernel32!ORD_001  ; VxdCall
7 C: n. J* W; a/ c% D   cmp   ax, 0f386h        ; magic number returned by system debuggers- @" Y% |# r8 ~' O" Z' t
   jz    SoftICE_detected) ?4 Z  c3 B/ b7 s. `
3 F9 m% l1 q; v3 |& F
Here again, several ways to detect it:7 W; z$ j6 M. E$ o- y

) k9 W% a. F- @; z0 B- ?    BPINT 41 if ax==4f
  }7 }' T) z3 I
- l9 `, O5 c0 W& f    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one$ X1 H3 A2 T* S
$ h/ C- r% C3 j2 K
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( z3 s# S- }- M2 Q! J
9 l. q2 U) U; N# c3 d1 s7 X6 ^
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; h! o. |/ R! O
" x) N2 p) e; [+ W. ?
__________________________________________________________________________
% C9 H0 L0 L& J' i4 C9 d
, {, T: |/ ]' yMethod 13  S2 U7 @2 ?, Y% g6 y
=========6 a$ R3 T( U  m. C* F+ ?& [- @
# a7 K( E4 S' }9 t0 h2 z
Not a real method of detection, but a good way to know if SoftICE is
" R5 f8 R. v, ~  S7 j: Oinstalled on a computer and to locate its installation directory.; q: n. S% J0 E5 \
It is used by few softs which access the following registry keys (usually #2) :
. H; O2 M' J# ]: Y* M- ~9 X$ Z7 v
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' D5 m& y9 N) L+ i
\Uninstall\SoftICE
7 a: J* t6 O/ g" N% g" p* Q* c-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 x( M' l0 k# ]% W. U-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 x5 l9 S1 {# U  L\App Paths\Loader32.Exe, M7 U% @! s6 I  Z+ f
3 l2 `9 j1 w1 z/ F+ o* f. I, [

2 \3 [# j' O; I8 xNote that some nasty apps could then erase all files from SoftICE directory- {, i+ u! J( V
(I faced that once :-(
8 i; `7 \" T1 c4 Q  x6 z# a" d
2 A# p: C! [- O5 jUseful breakpoint to detect it:
0 s4 C  h6 n' H1 ^9 A2 V" L
9 Z1 Q9 g! l6 M1 e% y  C1 t     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! [" V- p9 D' H9 \# H9 _8 t( k2 T3 k6 {* `
__________________________________________________________________________3 ~8 L- s/ m- o  b6 U. Y
, Q7 v3 N" d( d5 o1 T- i3 `1 P& x
' P  U9 q% o2 l4 E
Method 14
( ]1 W. r" x" R( d% p. i=========
) n0 e1 c) j7 z1 m' T. c- r# E
: Y) F9 \) L' r8 ?A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  q. C& Y  ?/ J$ e3 J$ m+ Vis to determines whether a debugger is running on your system (ring0 only).
" \( U+ q# O" e2 A( F8 R' l( T- P' l
   VMMCall Test_Debug_Installed
/ z0 i) J! E4 A& w   je      not_installed
/ A6 b7 F$ p) S; @% H
( Y4 G. W) v" {) u/ CThis service just checks a flag.2 t& W' |4 j1 K1 J% y% I" {2 Q5 s
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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