About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) a! d6 `3 X# M# \) d<TBODY>
# A5 N5 D7 Y: C5 [8 m<TR>
! l' a/ {+ x; d( B% P# r<TD><PRE>Method 01
3 m' {- X) j! U* i5 f=========
& P# j; {1 {' |* H. m) p
+ g  H* P  e4 j: cThis method of detection of SoftICE (as well as the following one) is
0 e  h# d' R) ]used by the majority of packers/encryptors found on Internet.
5 \$ u. a7 ]6 \2 a% N/ FIt seeks the signature of BoundsChecker in SoftICE; L0 o  }% z& Z* P( F8 Y/ b

+ G3 C3 }( @7 T    mov     ebp, 04243484Bh        ; 'BCHK'
5 |) h* S% y5 Z    mov     ax, 04h
7 [5 p# v2 x+ c5 w* `1 S    int     3       - m3 F$ F* o, e: r9 E
    cmp     al,4- y% c- `; z' r' c
    jnz     SoftICE_Detected2 T) T, n/ \5 ^
8 ?1 @( m2 d4 [$ X% H3 {: E
___________________________________________________________________________
# _2 z4 o% x7 E. f- l( q& Q4 a: l8 x7 f: ^
Method 02
4 E- [+ y: N3 |5 v: g; b=========& i6 O6 |, u2 h. e8 |( H

+ ~( b( b7 J) m8 [; T2 \3 v, CStill a method very much used (perhaps the most frequent one).  It is used
2 T* G; R9 w- T) @8 eto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; h$ `7 I2 A4 k( P- Nor execute SoftICE commands...' o$ M- O0 x8 t$ ~( C/ s  k# M
It is also used to crash SoftICE and to force it to execute any commands3 |6 m  I/ S% W. [1 L6 s7 q) b! r
(HBOOT...) :-((  ' @! m* f7 D( l" g/ A7 o/ [: {& z

: b& l/ d! }$ P$ A9 w5 v1 b* ZHere is a quick description:) o" A/ t7 p! n
-AX = 0910h   (Display string in SIce windows)
2 P( i# F  }6 T  h+ P-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% A: t* H; Z2 j9 z8 N
-AX = 0912h   (Get breakpoint infos)% V# N# y/ f+ d
-AX = 0913h   (Set Sice breakpoints)* X- i/ \  O6 W4 i% Q! _
-AX = 0914h   (Remove SIce breakoints)/ a8 e' \5 t/ F- r+ K) |% x# a/ Z+ C
3 u3 M9 ]6 R( y3 N/ f
Each time you'll meet this trick, you'll see:; m9 w5 o1 d0 @1 @" G
-SI = 4647h
+ p( m1 e; z# g2 A. O# b-DI = 4A4Dh
" Y" ~, V+ a. p8 @7 v& e" e" M) s" TWhich are the 'magic values' used by SoftIce.5 U: A* Z2 }( c
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.: H) K" _5 a$ f( P) @
- A  r* |" [+ m8 o& J
Here is one example from the file "Haspinst.exe" which is the dongle HASP
& _: B0 w5 M5 g4 MEnvelope utility use to protect DOS applications:2 @" \& |4 e9 J1 P2 y# N

, K! o: E, U! J! t4 ?* P6 K4 ]/ D. u* z
4C19:0095   MOV    AX,0911  ; execute command.
/ w1 D+ G/ R  J$ P; k8 n% _4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
' J! X8 H5 C+ i( f' c4C19:009A   MOV    SI,4647  ; 1st magic value.
1 X! X/ X; Y- \4 O% C- U. [" P4C19:009D   MOV    DI,4A4D  ; 2nd magic value.( H9 z9 k. L, K) |+ Q& L
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
, E1 ]4 \) E* P7 S- }! L4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* U- J2 P- z5 M  I
4C19:00A4   INC    CX
; j  z. K5 p8 z& b4 A4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ D- k& Z: N& `2 J4C19:00A8   JB     0095     ; 6 different commands.
; ]$ L" x4 h8 ?  h4 A5 s" b4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
1 {) _- A' d, o5 F4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
$ T% t' F$ H7 i& s& c/ [- p9 o1 H3 X* O$ j# j& ]5 m5 {
The program will execute 6 different SIce commands located at ds:dx, which$ O5 G# B* u; m; d8 \7 V. U1 W
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 [! U$ c! K+ _! C, g( r' {" p6 d# R$ y1 x
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( b- d$ Y) M+ m! X  @3 N6 N
___________________________________________________________________________  R0 {% ~  I3 f# l4 e# A# }, v
( d$ O, s0 H) ?) _4 T

2 z3 x$ U  |+ v2 z" L0 Q! c3 yMethod 03; ?; c) W+ p  w; x1 q; M0 Z% J0 I
=========' }- J# T# d7 ]( O0 ^2 \
7 k7 L9 y+ d( r* _( d0 I, ?& ^
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 s9 g9 B2 O. Z) l: G/ ]; H$ e9 e(API Get entry point)" p; r% l' ~* x
        . _$ e4 J* s. E0 T; {4 l

- d9 |" L: M' |% \6 Q( e/ Q0 z5 c    xor     di,di: S& b% i3 @' y& b! o4 E
    mov     es,di& w& ]" {$ E2 t) R* y3 X+ T
    mov     ax, 1684h       & |3 X2 U7 d. m' a( B' [
    mov     bx, 0202h       ; VxD ID of winice+ h+ J: @8 L0 l( C
    int     2Fh
6 e6 K" k( \2 s0 m* R/ a    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ R$ ?* @& `. A& w7 O    add     ax, di+ \! {, ]! M* e( q) ^
    test    ax,ax) l5 V2 Y7 C0 q+ l' l
    jnz     SoftICE_Detected
! ?8 t8 P, ~& Q4 b& x$ Z+ y( \3 [% \& B2 I, Q
___________________________________________________________________________
. }9 M  U$ z$ {" \3 }* F, p  Y+ `* M
Method 04
& E* d8 G- g: }; A=========9 e$ u* V" \# ~6 W8 ^
8 M8 ?& o+ P& K
Method identical to the preceding one except that it seeks the ID of SoftICE% U# g6 g7 L7 J( O( m
GFX VxD.
* R  i8 x3 r; K0 i% S! L5 s, _1 L3 @+ M! C
    xor     di,di
4 x" X' r. X. x1 ]# f/ C0 z    mov     es,di  n0 W- z0 J6 O3 u, L9 N
    mov     ax, 1684h       # J8 K9 ?& H1 Q# R' \  V9 [
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
' K; h* G( [: `* d    int     2fh- E" R) W7 v5 M/ {8 G+ n* f- c& E
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ S/ F6 {+ Q; w, C' }5 d1 j    add     ax, di
3 @- X$ N4 u' P9 M' V% P& H7 \    test    ax,ax
. i) o7 i) {/ h; j. M) H: R    jnz     SoftICE_Detected% r  Y. q0 o$ G0 n6 O9 A- J" [
) i; m0 s+ p" L) H; h
__________________________________________________________________________
9 m/ I, r$ S8 y9 Q4 g. O. L9 l4 u8 ]  d# h& h8 T4 d: z% P* G

/ F" \4 [  v) _3 cMethod 05; f3 J" M% o5 s. G8 }
=========) u: Q) h. p! e, |

$ ^. X: E, O7 M; `Method seeking the 'magic number' 0F386h returned (in ax) by all system
* F2 I5 n. Q) K$ \( n2 Fdebugger. It calls the int 41h, function 4Fh.
) }  S- g; @& ]6 t3 {) _There are several alternatives.  
: l& o6 N" Z) P, |3 s' c; _( n
. d% d' k9 @4 f" `- I7 }7 |- YThe following one is the simplest:
' z9 e# {1 _' j0 f
; _0 j6 Z6 I, j0 ?6 f: U4 z- ~6 R, E    mov     ax,4fh
+ a1 s3 v+ g. w+ ^    int     41h
4 L: z+ `: P2 I7 ~8 D    cmp     ax, 0F386
. N  [, R3 r* X# |, Y+ w/ ~    jz      SoftICE_detected
3 {2 _% P" X  L" e$ u1 X' s6 P2 x; n3 n
/ R9 e) H: F4 t; g0 `
Next method as well as the following one are 2 examples from Stone's + q3 P2 }. R: {& E" H
"stn-wid.zip" (www.cracking.net):
4 `9 |% Z1 d: l
& k, g5 X! H: X9 x7 U    mov     bx, cs- G" P! A$ g$ ^! }8 h9 A9 v3 z( l
    lea     dx, int41handler2
% _3 _2 f  H3 e7 r; h" X    xchg    dx, es:[41h*4]
/ p4 n& @- y0 b  Q; P    xchg    bx, es:[41h*4+2]
/ }7 P0 {- z9 l- k) ?6 f    mov     ax,4fh
  c$ p" G$ Y% z6 G/ L    int     41h
4 |* f; V' K" i3 C4 p- b5 e    xchg    dx, es:[41h*4]
* L  J7 L8 y1 I, y) s) }, \( D    xchg    bx, es:[41h*4+2]- D" l& l; Y/ v" k. q
    cmp     ax, 0f386h6 h( E3 T/ I; U0 P+ ]
    jz      SoftICE_detected( H- J% J$ i0 g" O( v
* h( [1 }0 f/ t* I  n5 p1 @% f
int41handler2 PROC
  k/ o$ Y; q! A; L4 D+ ~( H/ k    iret" i2 b* m! _4 d: ~  p1 V' H8 g
int41handler2 ENDP+ ]" G0 t/ e) X

* w! R* \) V+ g7 f* [) V
9 _! M1 a8 @2 ]_________________________________________________________________________
5 ?& d, G& v0 Q2 J
% T. ?8 f, ^+ K0 o3 n5 c2 {* o4 j1 B" G. k8 a9 C
Method 06( u9 D) [9 d, O4 q9 M
=========
+ x# o- {% P0 Q+ z* ^
' X( v% }  R& m5 [: A" _3 i" W0 Z* m8 J* m& `
2nd method similar to the preceding one but more difficult to detect:) @/ u+ x$ {+ ]! e( `& h

2 F4 g1 Y4 x* @; Z1 X: s3 K) T- t% I
  b. X* x0 {- a+ \0 |' Mint41handler PROC' g, D+ l- ^5 b# E0 Z, O( K. k! a
    mov     cl,al( ^# J. ?8 m2 w% Q9 s
    iret" ]2 Q* X& F# M2 r/ L5 E0 X
int41handler ENDP$ s+ S/ M8 y+ k, e# k& L( j( p$ ?

# y# L8 o2 j% m# b2 a( ?. c2 L) a+ ]/ d" p) k7 O' V
    xor     ax,ax
9 s2 y6 V* ~& D* h    mov     es,ax
$ x( h* _* L$ `% U2 x3 A$ ?; [    mov     bx, cs6 G4 Q& h7 f! D% l8 ^9 \( ?
    lea     dx, int41handler
( g! a. J, ?$ O/ a; {2 o# J. z    xchg    dx, es:[41h*4]
2 A9 p8 X9 G5 G2 @: E    xchg    bx, es:[41h*4+2]
( L8 c% O) _( W0 H' _( A# ^2 M    in      al, 40h$ b5 J7 W9 G+ M: H
    xor     cx,cx1 Q/ d$ a7 w; j: r- J2 G+ E3 [$ y2 F
    int     41h
% P- `# E2 L; ~0 l' Q    xchg    dx, es:[41h*4]) U( A# B: \0 {, d; T4 L
    xchg    bx, es:[41h*4+2]% `& w$ P3 k; R1 U8 K# E. u- ~
    cmp     cl,al
3 t6 n  e7 i4 a, M- g# M/ u( P    jnz     SoftICE_detected0 Z) d& h  g9 E9 u$ L

! G: ~/ I  F) ~  p# _, J2 _; D_________________________________________________________________________
# e" E- y+ @3 Q( M$ J- }! o# s* H
Method 07
1 l* P% q- u9 _) a# s# u9 T=========
4 P! K) Y0 d. ]0 }5 O
) ^. F, x5 U* W- r3 `/ N' W' tMethod of detection of the WinICE handler in the int68h (V86)) c1 W+ R7 K  y& T' q% Z; t
2 A  P* V9 t# r# b
    mov     ah,43h, u9 b5 w2 g: g
    int     68h
+ Z3 I% R1 R/ R2 O    cmp     ax,0F386h
) Q5 R7 A, X2 d0 D! ]. E    jz      SoftICE_Detected+ ^2 n( W5 R7 b1 U7 i- H0 w

- D  b- t& ~, T& |
3 r& b+ V( B' T2 A- k' L2 u=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 l7 J) O, f; N( Q
   app like this:
0 c4 L3 i- _% ~! W' j" i) m) }; }6 ~% Q6 d5 s" \( }
   BPX exec_int if ax==68. j( |+ x+ {5 X, v
   (function called is located at byte ptr [ebp+1Dh] and client eip is; Z; R, Z% o1 R
   located at [ebp+48h] for 32Bit apps)
  H4 N, M9 N  ^% s__________________________________________________________________________# K; S  i4 V' k1 C# n* X: s/ F7 P0 x

- k, I/ S" l( `6 `2 M
; D* }4 l: e) a" P) C$ _Method 08, J3 G' ~* v$ S" l+ r. v$ T- a
=========
3 r( X/ a# r% H$ {( W: I
' o, X6 f! `* ?2 B: v- K' q, YIt is not a method of detection of SoftICE but a possibility to crash the+ @) _5 T4 O& I+ m6 E
system by intercepting int 01h and int 03h and redirecting them to another. z( @( }) e3 A! j0 X9 N
routine.0 ^, c1 W* {4 Q
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& T4 L- N2 h; t8 r) W: B
to the new routine to execute (hangs computer...)* m$ D% v  q& h: e4 t  |" g4 p

; h# X- [; x% W4 q+ T    mov     ah, 25h3 }- K6 r" i2 O: N
    mov     al, Int_Number (01h or 03h)
0 U. z, e) c1 O5 o- z  P. ^+ a    mov     dx, offset New_Int_Routine5 B0 a- _0 `9 E) l
    int     21h( D' d2 ?6 a1 L" [

. l6 q2 I" o5 ]; i  m: K__________________________________________________________________________
; ]1 k! U! P: v& B; w1 ~" H( L, x$ O/ F8 E) C; a8 j7 l
Method 09
. a  @8 p% c& U* p=========
& Q7 _& K. m7 p" F' G2 J6 H1 q/ W! D) p5 M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 h$ E8 R6 z; n- _& i1 {& V( Bperformed in ring0 (VxD or a ring3 app using the VxdCall).
* g" h& X( o. G, @) T: dThe Get_DDB service is used to determine whether or not a VxD is installed
/ x5 G: f; f* t% }for the specified device and returns a Device Description Block (in ecx) for
5 Y/ g4 k  S; rthat device if it is installed.
) s, |( B1 y% m6 n0 b% N! \+ z, O
. K) s% A# v, o   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 I& {* t1 c+ |. }   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ \/ U* W% G, j2 |9 S+ e' E3 A+ j
   VMMCall Get_DDB6 p9 T, f2 k, `6 [& ?
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ h) T: [0 G0 u2 f: P* u: n) ^. a: z. l3 H. f$ t
Note as well that you can easily detect this method with SoftICE:, c; Q3 K- d/ }9 f4 v' c
   bpx Get_DDB if ax==0202 || ax==7a5fh
4 f7 F7 ^+ b+ `: g5 C6 B+ e0 l: q: a$ q/ r! `1 t2 H
__________________________________________________________________________
, j4 ]4 k& }- U7 R* d; x9 }) @1 \* W: M5 m0 C
Method 10
& f* z0 \3 k2 {; h1 C7 N=========2 ]7 D/ q2 O$ s* X! c

9 C) Y: A) m. [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 u1 p/ C2 t8 j2 s  p1 |) ~% I3 p/ [
  SoftICE while the option is enable!!
6 ?* E5 ~) n* Y; N, Y
0 I7 m/ {% b0 w# U- y* I+ _4 {  rThis trick is very efficient:
8 c' E9 s0 `# L0 k% z2 P& @by checking the Debug Registers, you can detect if SoftICE is loaded
7 N  S2 e# S! R/ {7 O(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if  k  Q/ Z% |- I) R! @! e7 w
there are some memory breakpoints set (dr0 to dr3) simply by reading their4 j# H5 H% j5 L0 i( [& D. [
value (in ring0 only). Values can be manipulated and or changed as well% Y2 u/ D! p7 V/ J/ Q4 ~3 c
(clearing BPMs for instance)
. |* g- m6 i# g9 R- p3 f
1 M( f- |) `  r4 \__________________________________________________________________________7 a1 u* N0 p. ]! [+ z! [' M
0 o" d: o& L: H% z* k2 u, ^
Method 11& @( A4 \, V6 C, L* k
=========
" p5 D' f1 X- B' |; Y8 V
. H1 H9 Q, `3 BThis method is most known as 'MeltICE' because it has been freely distributed
7 V8 B8 k1 V! g9 A, k$ s" h. T) Cvia www.winfiles.com. However it was first used by NuMega people to allow
$ P( @6 l  ?6 z6 aSymbol Loader to check if SoftICE was active or not (the code is located
/ k# d0 B; C, Z  Z2 ~inside nmtrans.dll).- G; j# s$ F6 W  u' X  H

# y8 {& |$ ?% X: HThe way it works is very simple:
- m  \2 f+ o) @- I/ J$ U; {" J/ oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! m3 y) [6 m; BWinNT) with the CreateFileA API.0 V6 w4 d2 e2 y& j* Q9 ^
1 {2 N8 S9 G2 B8 n% U" O1 L7 T& X
Here is a sample (checking for 'SICE'):
; m/ K- p; y4 a7 p6 q' s* X$ r# {: r! n
BOOL IsSoftIce95Loaded()
7 ?+ @& W& N" ^  o( k+ G) f{
7 o) s# v8 o7 ~4 {% e   HANDLE hFile;  
. q! H$ `, w: T3 H   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,5 D5 A% r% p. d; x9 ~! w
                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 Y4 @. j6 P" d* H, h
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 X6 l. P0 t1 n   if( hFile != INVALID_HANDLE_VALUE )
9 d; h+ [# o. g   {
' Y7 [' d& E- K' Q# H' j, n      CloseHandle(hFile);7 j- [3 t2 {0 H0 }
      return TRUE;. e3 v' W* `% A% S, q! q1 g
   }+ }9 s/ u4 {+ t; G/ I
   return FALSE;0 Y4 }  V* m, L6 M
}
+ m3 ]1 |; F% E7 @
5 R0 _4 {# ^% i( OAlthough this trick calls the CreateFileA function, don't even expect to be
! _( E$ c1 A9 G+ S2 ~! K6 Bable to intercept it by installing a IFS hook: it will not work, no way!
6 Q# X/ ^& v3 V; r7 ?" NIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ Y1 y4 }3 F4 t$ F, _% @+ T, f/ Oservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 R. w1 x+ U* h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc% P* o2 D. Q4 G; H5 |4 h
field.
( H% Z' ~# P3 N2 c: V  P, YIn fact, its purpose is not to load/unload VxDs but only to send a $ O& U5 B' z4 v# B( [
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
& F8 m) K5 P. g# w* H0 A9 q  S; mto the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 c  ?$ `1 O( i# R# F) [to load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 {/ v5 F) K/ }, e& x9 _9 X' u' OIf the VxD is loaded, it will always clear eax and the Carry flag to allow
: e6 o; Z5 [2 X, S- Xits handle to be opened and then, will be detected.
7 a, k' B* S$ Q" z: j$ nYou can check that simply by hooking Winice.exe control proc entry point
9 D+ o) t1 \+ m* G' a1 |while running MeltICE.
: q& s6 b. {- U4 H& {, u, d9 V9 V0 w) I2 }$ K: s2 Q: k3 `; s# m

8 t$ g2 {8 k' l: i  00401067:  push      00402025    ; \\.\SICE
1 g, o# p' B% R& h  0040106C:  call      CreateFileA; c' {$ Y" G9 Z4 ]
  00401071:  cmp       eax,-001, v& v5 ~, E- d) h: e2 W  a3 _: A
  00401074:  je        00401091
) Z5 E6 o* n# L6 z& ]
( |' A# X/ ?& n- V; z( B
& g4 R6 Y) a6 J, b: ]6 @! pThere could be hundreds of BPX you could use to detect this trick.0 e4 A7 @4 Y/ s2 q
-The most classical one is:
( E' E& B* s. B  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 b/ V4 K: z4 _) O    *(esp-&gt;4+4)=='NTIC'! \- T" f. f: d2 k5 L  ]# \; ]

/ m/ K7 l3 z8 u3 v% v. e6 L3 S-The most exotic ones (could be very slooooow :-(* c) |' i( r: Y3 Q; c. H; V
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % i1 S3 `/ \8 F3 z: \6 a
     ;will break 3 times :-(0 B/ \0 \1 T( i

+ _/ l5 U8 u6 y-or (a bit) faster:
7 c5 ]) q- e4 O9 L* W, K  ~   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')1 M% M9 {6 e0 _

1 P! I2 q6 C+ \5 _   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ D7 y4 H; }5 {! G6 F9 ^! l
     ;will break 3 times :-(
4 c# z; a' O  x8 G! B/ ?& \  n9 u1 t
-Much faster:$ t# a! @3 k+ I0 Y5 y6 ~
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 Z) A" U; A/ z0 j, }4 Y  x+ b

0 ?! f! o$ w9 x- I2 b% ]Note also that some programs (like AZPR3.00) use de old 16-bit _lopen- `0 ?& f; s; ~/ k- F5 }( u$ C
function to do the same job:$ J# q/ P' i# p: h' J

5 D: J6 [1 _! P   push    00                        ; OF_READ
1 _3 a  a# f$ l. W7 w   mov     eax,[00656634]            ; '\\.\SICE',0
9 _. f; ^1 C4 f9 @9 Z) \   push    eax5 B. Y& z& g$ J( l
   call    KERNEL32!_lopen' s5 w# D* b) l" A3 u% S7 l
   inc     eax
% G0 i% g% @' ~. c$ T   jnz     00650589                  ; detected5 P% O: J" E$ _
   push    00                        ; OF_READ
& [% Y+ ?5 M$ F% J   mov     eax,[00656638]            ; '\\.\SICE'7 I( ]& Q- r9 k0 v: S8 O
   push    eax
  ]/ Q; x4 h7 X' v, R   call    KERNEL32!_lopen1 q( d5 |! l& g* z0 z* B
   inc     eax
' M& i! _" d3 _' h4 Y   jz      006505ae                  ; not detected
) B0 a' ^/ s( z4 q$ n
5 G8 W  y8 T+ i  E  d" w, h
; M8 D$ P# z" s' R' c& x& e9 @# G__________________________________________________________________________
/ {4 v3 o- P. z% ?+ f+ Z7 Q0 F: C3 k" B+ q( z9 b, H
Method 12
" t* ]5 y' t, _5 N: `8 Q' k8 z: x6 e=========
; E$ A. q+ |& M: \
, a6 s4 D: I# Q1 g6 J0 hThis trick is similar to int41h/4fh Debugger installation check (code 05
+ j9 Q' `) y, E. F1 H+ ]" }&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 U, o1 A, N& u6 b6 Yas it uses the VxDCall backdoor. This detection was found in Bleem Demo.; C( @) B0 @( o
" g; l: N+ B  U) ^; R
   push  0000004fh         ; function 4fh8 G" h% c: m9 \6 H2 }
   push  002a002ah         ; high word specifies which VxD (VWIN32)
6 u& B! o9 R* w                           ; low word specifies which service
5 Q7 N1 u# i- J9 q. ~                             (VWIN32_Int41Dispatch)# N3 Y+ ]6 N( U$ ^& W  _) m+ B7 S% L
   call  Kernel32!ORD_001  ; VxdCall7 {& e9 G9 D5 o% H- o
   cmp   ax, 0f386h        ; magic number returned by system debuggers& A" {7 l% M7 r
   jz    SoftICE_detected/ A0 L* k8 g3 s' r9 e
$ M) P& @+ i( R4 x' p
Here again, several ways to detect it:- y4 L; p. _. ~+ b0 h3 U( w
! L  E3 ~2 D6 K. g, V
    BPINT 41 if ax==4f: B* p) R' ]- Y" c9 g% b+ P
+ C3 y8 q- K+ X
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 g, V7 E) s4 R6 o0 y/ o2 X- Z. K9 D; v* F
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! R- |! h( I% G" v) f& c4 j
. E1 f' Y( ~0 H. y' e+ F    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
& ^6 ]4 j" V5 l5 C3 A9 V0 {& K  z! f9 ]: Z- t; {2 H
__________________________________________________________________________2 z! r5 \! j. m$ {( @& j
$ S% I4 c" s3 @& V# ~
Method 13
% g- `/ V/ v+ o/ S% G0 e+ m8 F& q=========
: I. L* {. M" G! ]" A+ B  z8 ?8 N: l; }: k% I- J
Not a real method of detection, but a good way to know if SoftICE is2 v; z6 k" O( \
installed on a computer and to locate its installation directory.; o; K" D8 N6 c% j- f/ V! s
It is used by few softs which access the following registry keys (usually #2) :
& ]: l+ X: f5 B
1 T6 A$ q) `) ]3 y% ^9 W-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! [- E  @! u5 H( |9 v: `/ \7 J
\Uninstall\SoftICE
; E7 f5 T0 \7 |# _8 ~5 o-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. P6 H- O( H/ A$ C
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 S8 h" E3 k3 s% R8 Y  ]\App Paths\Loader32.Exe
8 f" U+ {0 M3 G( d! c9 q1 a, }9 P3 A2 N$ H
9 H& `3 A6 {1 w  s7 L/ x
Note that some nasty apps could then erase all files from SoftICE directory
$ v% ^7 \! M1 V$ _(I faced that once :-(
; G* }' z  f* u* v9 x' V
) _9 p, K, T, nUseful breakpoint to detect it:) \* n2 f- F  w- S$ ]
& h% |6 v1 h4 f6 ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. p6 x+ m! a  }+ n; ?
; M7 J, m' C9 s* ~- ]+ F! ~: p__________________________________________________________________________7 G3 w1 E$ m" a2 N9 U
3 ^6 S. i" ?, C4 [. g+ y" I

) l, O' ?2 T  |* `  U0 ~Method 14
5 ^) w3 q" \  ^* F5 R=========
( W7 f* ?* a1 h2 ]% N
& d% X3 ]- `* T! N! c2 oA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose# y' i9 q! ]0 j% J
is to determines whether a debugger is running on your system (ring0 only).) _) K- D- _( D0 p3 P( N

, w1 S( E9 n" E   VMMCall Test_Debug_Installed( Y- l4 x, y) f' b2 S
   je      not_installed
5 _9 c  ]! @: j0 `3 V" `+ v1 c  _+ n3 ^* H) x
This service just checks a flag.; R* s, D0 J9 \  t- }
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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