About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>- \: |8 A. s! u  k) `
<TBODY>  [& F7 P: o  M7 [8 L
<TR>
7 U; s7 r0 G/ U8 a* F. D  l3 }  B<TD><PRE>Method 01
9 t% A( I' T2 ^0 x=========
7 u# B0 ^" h4 l( F$ W/ c
7 D7 A2 @+ x3 q# [This method of detection of SoftICE (as well as the following one) is
+ y" l- ~6 k2 c0 S: Y. cused by the majority of packers/encryptors found on Internet." C3 R5 n6 s' ^* A" d
It seeks the signature of BoundsChecker in SoftICE
2 b; O- A& ~- p4 K) t2 J4 \
1 H+ M3 U! N2 h- K* O+ X0 M    mov     ebp, 04243484Bh        ; 'BCHK'3 H% g% w7 h% {# p+ g$ w8 l
    mov     ax, 04h* E7 Q3 H% M+ J; N  {
    int     3      
0 ]* e1 g$ w9 K4 v- {+ c  I/ n    cmp     al,4
4 l! r, F1 B2 T, @3 H  p! f    jnz     SoftICE_Detected0 n  [! d: M# e3 u% Q/ Y  n1 [
2 V" v9 M8 Y8 u. ^: A* _
___________________________________________________________________________
; s7 ~9 }! e: M* S. f( O
0 h* D3 e, T2 x  sMethod 02
, s# p- x9 {4 Y=========$ q2 O- }2 }  F# D
6 K& {2 U! q) V' k
Still a method very much used (perhaps the most frequent one).  It is used9 Q# S3 p5 `+ O2 N( U0 N) l9 P( t6 [7 r
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 t) n( N/ e6 @. X7 q9 Y* M
or execute SoftICE commands...7 O) O7 V- ?; A4 P0 a
It is also used to crash SoftICE and to force it to execute any commands, I, y  d4 F+ h/ O3 N; T
(HBOOT...) :-((  
1 a7 \0 X! x$ m5 f$ e
* l- u3 @$ j9 dHere is a quick description:' ]# E7 a$ Q! `/ P. V% j# e& l
-AX = 0910h   (Display string in SIce windows)
' N; r. c. r  n0 T( z9 @-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); t, E% ]; ?1 z. a
-AX = 0912h   (Get breakpoint infos)
7 p* m1 d+ \7 H, F/ U# K-AX = 0913h   (Set Sice breakpoints)3 I1 ~, u) O2 [$ o* a) n" X. L
-AX = 0914h   (Remove SIce breakoints)- ~- B! `6 Z0 X4 Q$ q) M

& v/ {6 V- I/ g* sEach time you'll meet this trick, you'll see:
$ Q( u+ z! e% r, G7 C/ v; X; [& `-SI = 4647h2 Z2 ?+ L  d* P) ?2 P
-DI = 4A4Dh: w# O/ ?; e& ]8 l1 j
Which are the 'magic values' used by SoftIce.
+ m+ x# |' C) K' o; ?$ g: ~' mFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& [& e+ M, s0 D5 {: i- S$ Z1 ]; v" I* O2 W8 @6 F7 C
Here is one example from the file "Haspinst.exe" which is the dongle HASP6 J0 d; O# G7 g
Envelope utility use to protect DOS applications:
6 b8 a. y+ i: @+ k: F% ]4 [: }
% R& f( W% y, e! B0 ^  w, b/ L; X" U  K0 D% f) g* U7 C0 X
4C19:0095   MOV    AX,0911  ; execute command.
0 f) y6 S4 H8 ~9 z# [6 }4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).7 U, _9 D. ~8 h8 d# `  Y4 F
4C19:009A   MOV    SI,4647  ; 1st magic value.
! o2 F$ v, q5 Q6 ^: O4 g' Y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, f4 z6 G0 |, w4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" c" E8 Q5 e( B9 T2 `* G4 z1 v1 I) }' Z' |
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ D# k# w8 Z: r1 ^+ E: e4C19:00A4   INC    CX
8 p9 O/ W; K7 `: \* D4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ _0 L7 y$ _0 o
4C19:00A8   JB     0095     ; 6 different commands.: r+ C3 Q% t# q* B  \
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 l7 M( E. e1 ^3 @0 H( y# Q' Y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' ]6 g, G- y. B" x  Z+ X% z9 u# L+ g) i! `% S+ v- o( C+ U
The program will execute 6 different SIce commands located at ds:dx, which2 h( c! A5 u! y0 i
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ o3 H3 Q: N8 R8 J$ v4 A2 U# E( s/ [, w: n' I
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( q- Q" G# @( W% n3 b6 Q8 B
___________________________________________________________________________$ j$ v: F( g  u% t' B: d
0 a9 g8 b) ~( ?" D3 c" \; h& `0 U
$ a, A0 N! _/ L+ A6 w
Method 03( P4 f! R) F& ?  p- c# s; w- i- E/ b+ B
=========
5 _6 K9 @/ C& m5 h8 L  W2 a
7 y& r: O  ]$ ?$ z& n) C! yLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ b6 w- P8 u1 D, w4 \& T
(API Get entry point)
0 S" y& D+ J( ^/ i. D. p        
/ q" e) [4 d+ D) G3 S0 v- N' b  \+ x4 m; M- L
    xor     di,di
+ b* I. K) |! c, w! M    mov     es,di
7 e! N) w: G6 ~6 i8 m* D    mov     ax, 1684h       ) m- C: t# r- L) j7 J
    mov     bx, 0202h       ; VxD ID of winice
! }9 J) n6 V3 ^: Z  T0 \3 p    int     2Fh( C, Z, y" Q6 ]4 _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( w1 O/ w5 e: J! U$ e
    add     ax, di+ t+ G5 h2 n; V9 r- r6 @* C
    test    ax,ax8 s4 W* \, F$ N2 h" o
    jnz     SoftICE_Detected, u. a* Z8 |2 l+ _1 _1 W( @% _
+ S+ A3 \/ e4 K; A; e+ ]5 u
___________________________________________________________________________
# q+ Q% o6 H, a2 E9 k  T
9 N" F* b  I. L! J, DMethod 04
3 L/ Z7 [! v* S=========
" k' ?2 C; P# D' W7 e
* i" y6 Z* |$ ]& T2 O$ j6 hMethod identical to the preceding one except that it seeks the ID of SoftICE
4 j7 q# a( }: \" s! G& A' OGFX VxD.
& Z* x  L' m% w2 m8 F; @5 b7 z9 j0 j. ^/ E5 B) m
    xor     di,di) Y  {+ y9 L; \$ w! x( S0 V
    mov     es,di
' w7 \( ]8 H6 x' s7 B2 ]/ l    mov     ax, 1684h      
1 Q0 `$ j" p' F0 d    mov     bx, 7a5Fh       ; VxD ID of SIWVID
; ?! F7 \3 |" P& B8 Y) `% v! R% J    int     2fh3 P6 H# A- N% t  P4 _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ ?' @6 a1 K# |
    add     ax, di9 N" N" P7 v$ f. o4 [
    test    ax,ax
. l0 e4 |: b: ?7 |$ _    jnz     SoftICE_Detected3 s) E" ?3 _7 m

, S$ T/ n' @; s7 x' [. N9 a) g__________________________________________________________________________) V2 H+ ~+ Y+ o( M

- }* [, h' T' L. Q
2 g+ A8 S* M/ u8 r' ZMethod 05& ~; M, @5 [6 g0 B7 k
=========! q) @$ K/ L+ `* w
. ]2 ~+ Q7 f7 ^8 Z. S  Z
Method seeking the 'magic number' 0F386h returned (in ax) by all system2 L# T: e4 F: A- ?( P
debugger. It calls the int 41h, function 4Fh.0 u# w2 q9 g  z" O
There are several alternatives.  
# w2 ^$ M  T: b0 s) h$ z! s' |, O: d( P( E" P
The following one is the simplest:0 [; p9 z/ _9 p2 L+ [

( \: ^/ t+ _8 \* R$ A    mov     ax,4fh( Z5 O( f4 F1 y7 F
    int     41h
. C6 ^, L$ F, {, x    cmp     ax, 0F386# ]; Q4 V/ j! X
    jz      SoftICE_detected0 V  [7 _0 q% ?; o" T; b% y9 j
. @& F6 n" E; X' G' T, t
3 X+ y/ K) S4 Y
Next method as well as the following one are 2 examples from Stone's
* t2 q; H3 S0 b  [; G  i"stn-wid.zip" (www.cracking.net):
. }) O4 y' j1 p; k+ l- ~* \9 ^# Z2 [# [5 t. p6 U
    mov     bx, cs# w% F. g# E6 e6 T# ]& m
    lea     dx, int41handler2, X( W, v) q5 N
    xchg    dx, es:[41h*4]* U: r9 O$ ^4 G  ~% o4 i/ M
    xchg    bx, es:[41h*4+2]
0 Z) D, d" t' j) i) J! N    mov     ax,4fh+ X/ M! c5 `+ ?
    int     41h
( r7 }) l. a& R' G8 U) I    xchg    dx, es:[41h*4]3 ~' H# `  c+ ^  C
    xchg    bx, es:[41h*4+2]
0 l$ ~" |2 `& p% D  ]    cmp     ax, 0f386h
& I' C! s; G1 H    jz      SoftICE_detected
, L0 p# h& `) i. S% r# [! R5 \8 k$ v$ S, H2 w0 b7 F/ l
int41handler2 PROC
8 Z& r' V  W7 D, N# Z1 D; u5 {8 i    iret
. [6 P! p4 L' X7 t! u* a8 Zint41handler2 ENDP* Z, [5 b& I0 ?9 l
3 _6 p4 b$ P4 Y4 f* N7 r9 Q

4 a/ M8 ?" T) ?3 ?6 __________________________________________________________________________
3 u$ S- C* g: X- C  |" K
5 d3 J; k3 h, j7 l/ V( i
0 f/ Z9 u: y: x6 r  w: bMethod 06/ l" J8 V! u9 Q/ v2 E
=========  Y" i, j6 b3 V2 W/ t

% [. P9 T0 E) }2 \+ x6 V* |+ \6 w; E& a8 {: q2 i+ K7 Y. k
2nd method similar to the preceding one but more difficult to detect:3 D: l2 P5 T. E9 ?. g

4 p- u5 l) }4 a6 k) w7 m0 c6 d, @5 ^% n; W* t; r' J3 }# I1 v5 U
int41handler PROC
8 n. F$ e& o4 B+ P1 u+ Y    mov     cl,al
3 z  z7 B2 S& K) }    iret: G" N2 X7 x/ c
int41handler ENDP
# h1 q! V6 `- A$ \$ [6 K% \+ ^
- R0 F+ K# l7 M  ?# o2 k; z+ B+ t+ ?! G2 |- H( ^$ K' G# `
    xor     ax,ax
! X# T$ I# h6 n- r    mov     es,ax
  V5 k. |$ |, g& j5 m7 T% Z/ y5 b    mov     bx, cs% F" h4 D3 U" C4 G  m$ W
    lea     dx, int41handler7 `/ k" i- M: }- d9 {; U& g
    xchg    dx, es:[41h*4]
- a- [* h0 S/ U    xchg    bx, es:[41h*4+2]6 i5 s2 X1 b2 L* n- @1 H
    in      al, 40h
+ }# X! x5 k! z) O3 E    xor     cx,cx
* F1 X7 e$ O" Y: }' s! S6 q2 p/ w) a1 I    int     41h
5 R9 b& B8 R# N3 M! ]    xchg    dx, es:[41h*4]) N' N; X0 s: S* y& I+ n
    xchg    bx, es:[41h*4+2]
5 d, p! z% U, C2 J" _5 H    cmp     cl,al! m3 v( D# O1 z$ z( j  h0 i7 N4 C
    jnz     SoftICE_detected$ R8 L' `" I# r; I( z! Y9 C5 {

4 E" r6 `, z0 e+ h6 w_________________________________________________________________________
3 q' e2 W& i/ Q! _$ X1 b
4 t: `7 N6 Z4 Z  c% ^% bMethod 07) Q& H, \  {8 w/ z' o/ k
=========' `, a7 O  ?! f) J+ W

) ]! \0 r+ F7 q6 ]' Y2 BMethod of detection of the WinICE handler in the int68h (V86)" W4 n* p6 N% O; ^

2 `# u, M% a. e+ U8 E1 M. U    mov     ah,43h" |* z, A2 }2 P, O  c: i
    int     68h+ t/ [6 [& ^4 I, v( i" ?
    cmp     ax,0F386h0 }# B# _$ ~; G0 E7 Q( Y
    jz      SoftICE_Detected6 |2 O+ j' M7 s4 S7 L' c

+ B/ L7 q$ q1 t8 O! v$ I
, a+ G- t6 `8 E: i8 G- v5 m  C/ x1 M=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
- n# Q4 `/ z2 }3 {; |   app like this:) N0 M2 y8 E" U+ o8 _  O9 t' {

  R. X9 H8 x  b. Y- [: Y$ C8 S- |1 O   BPX exec_int if ax==68
, @$ E; e1 }, s9 z( u; ]) p; u& p   (function called is located at byte ptr [ebp+1Dh] and client eip is2 \" J* k! I- I0 H9 b
   located at [ebp+48h] for 32Bit apps): D' l; Y9 Z4 ?( l% h3 B
__________________________________________________________________________
1 v' R; ?: C* B) c' i3 Y1 m- [- z- P$ ]! x4 I0 X( I. w

/ e3 @! E& f1 YMethod 08' V' J; ^0 c+ {+ p  Z
=========
3 w% r) L/ y; g9 K* f! Q( I) M' z6 c( q
It is not a method of detection of SoftICE but a possibility to crash the
9 r; V* U- F& _. Ssystem by intercepting int 01h and int 03h and redirecting them to another
& [4 t' [! [( C8 Droutine.5 r; d2 E$ w7 X( [/ E1 _
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 A( x+ l; e5 s/ A8 Uto the new routine to execute (hangs computer...). W" ]0 i* b  ~) F  S! b$ X
( a# Q: j- p  d4 B2 M
    mov     ah, 25h  _; c! U" E8 x1 z
    mov     al, Int_Number (01h or 03h)
) B/ \: T* r# \; A, o! ~; n    mov     dx, offset New_Int_Routine
( Y) J; ?; @- H4 w& w    int     21h  F! ^2 a4 J9 X) o

6 {- P+ _0 Q' i$ y! y6 y__________________________________________________________________________
7 ]! d; q- W& u5 k- z$ Q' K: \; d3 |. n( t" ~( Y4 o
Method 09
2 r5 b% F% l# M3 n" E=========
# b  S  s- E1 w+ m3 K+ M" q
, n4 L# V5 X2 _5 k+ M9 BThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 D. d0 f7 T% K7 _+ R) ~performed in ring0 (VxD or a ring3 app using the VxdCall).# E* \- S. B& Q" x$ h
The Get_DDB service is used to determine whether or not a VxD is installed
" Q, u8 W7 t0 `& dfor the specified device and returns a Device Description Block (in ecx) for
8 t2 q$ [! O7 r8 b5 M# S! bthat device if it is installed.8 ^- Y1 Y$ m3 f2 A3 H
* T; C, V) q5 m& e
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' y7 [+ g3 v, l5 r4 r   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ k, N; Z$ O+ |9 @7 N6 `: p
   VMMCall Get_DDB' z. \  P, f$ K9 t
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
3 p# ~" P$ i* U8 Y; J0 `# s* n0 V* s) \( g9 ]4 b# |. m1 x1 e- W# k
Note as well that you can easily detect this method with SoftICE:
- }! i* S5 O3 T3 a* W4 B   bpx Get_DDB if ax==0202 || ax==7a5fh. O* K0 p# A: r$ X. ~1 W+ ~
* U4 B) O; Q" h* `) I( ], Q
__________________________________________________________________________# W- p1 P6 g+ M. }

* A  w3 `, @9 G; ?- H" U- yMethod 10
& I: u% e' K3 V- Q& s=========7 y9 J. |1 f* F9 w# ?1 R! T1 T

6 Q# i. |) \8 K( ?; {2 S; s=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
# U* A' Y; o; m& D6 |, z  SoftICE while the option is enable!!
/ ^2 V* s3 }' w
. ~  W' d2 S' ~8 u% rThis trick is very efficient:
( w- V  ]# W7 F  `) ?( m9 N6 sby checking the Debug Registers, you can detect if SoftICE is loaded; s0 Z7 |: U, K8 o3 |; K
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 Z- @3 [( q3 b. }7 G  V
there are some memory breakpoints set (dr0 to dr3) simply by reading their
& k. G/ Q5 k5 Z5 T' _value (in ring0 only). Values can be manipulated and or changed as well
- \& r  A% X) L(clearing BPMs for instance)
9 |$ v; F1 c  w$ \- U# B& V9 H$ [1 W) m! Z
__________________________________________________________________________1 @/ w% J- \- }: o& t  u
% [: V% r9 s& c" d( O0 {* \
Method 11
' ^; l7 I5 n4 M8 T/ v% ~=========! Z2 h8 R, v& X+ v/ V$ [, L

& i) n' `1 x8 ?, m1 ]" eThis method is most known as 'MeltICE' because it has been freely distributed
1 _7 P' X2 U" S5 w  [via www.winfiles.com. However it was first used by NuMega people to allow9 U7 n- o& w8 P' ^* x( j
Symbol Loader to check if SoftICE was active or not (the code is located1 z- M9 G$ B8 J
inside nmtrans.dll).
! k% L' |/ s% F, v" D$ V9 K: K3 J1 _% L' s7 {' l5 c/ C0 {
The way it works is very simple:
4 N" i; F6 E+ U+ @7 ^* J$ jIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# ]. C1 l7 I5 [# xWinNT) with the CreateFileA API.
3 {- a" z3 }) \& h5 k6 E5 f. w$ I# T9 b9 S$ f
Here is a sample (checking for 'SICE'):
& y" m$ ~$ z, p0 h( S( D2 f: @- L9 C. M4 p8 E! p
BOOL IsSoftIce95Loaded()
8 x( f* y  J0 \1 ~& b+ q0 J{% y5 o0 q9 p2 v+ m5 ~2 Q/ ?% b6 g3 {
   HANDLE hFile;  
0 q8 |; P) a. }1 V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE," j, A5 F) }; K, S1 Y$ X4 ?
                      FILE_SHARE_READ | FILE_SHARE_WRITE,( H* [) E. \  d1 p- R! k( ]
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& R6 J5 \1 P2 G
   if( hFile != INVALID_HANDLE_VALUE )
$ e5 o# T" v) [) E" K) P   {9 ~2 ]2 q% p/ {+ A" M# G
      CloseHandle(hFile);* r9 v/ G, N3 c$ L( S6 Q
      return TRUE;" W3 g$ v" n+ m) ~. O1 N2 w) j
   }, Z& r. X3 k* A; j
   return FALSE;' }% W( Z2 q5 I# `) R
}6 L" J* u. p; S

" O  @7 ]8 J& R' @/ X3 y8 y3 EAlthough this trick calls the CreateFileA function, don't even expect to be. G! |* |) v' S- j4 j+ l. w
able to intercept it by installing a IFS hook: it will not work, no way!
' l$ d1 S( I, c7 lIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
/ F7 p  f7 e- D( b( P1 Aservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ S6 R+ L2 o2 ?, Y" K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc5 _3 \( z" i( j/ ^. |$ E- J
field.4 v6 ?  L% @( H
In fact, its purpose is not to load/unload VxDs but only to send a
& d% V+ |4 F: I. d) a3 x' oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
2 q, n7 d* ^" G8 Eto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ L0 O; J/ c/ x- U9 l0 a+ `
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 M' _" x- l# {+ W3 f7 d' LIf the VxD is loaded, it will always clear eax and the Carry flag to allow
  Y0 z# p1 h- e9 yits handle to be opened and then, will be detected.
8 Q; S& t+ k4 K/ ]/ F0 `1 w$ T4 GYou can check that simply by hooking Winice.exe control proc entry point4 L) n$ V- s1 [  v" P
while running MeltICE.
+ I: {( q, M! j6 r) j, `' ^+ V' f9 |5 c5 e- M$ D1 k) U

* \1 F! p0 W$ o1 {+ o6 v8 v! r  00401067:  push      00402025    ; \\.\SICE
8 `5 \  c; J) o3 S( u8 Y  h  0040106C:  call      CreateFileA
4 K* X# Q2 n1 M; Z$ U6 b) v2 G  00401071:  cmp       eax,-001- {( y1 l  O6 ?% E
  00401074:  je        00401091/ [; x+ s0 {7 Q' ]

/ o. a& F9 E# t% l  }/ k9 M7 g2 Y# P/ p0 D1 s! o) y
There could be hundreds of BPX you could use to detect this trick.
5 r( m) |8 b( f! H4 I6 z6 `" o" ~-The most classical one is:4 q: I5 ?, h/ G* W% A# M/ h
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" C- m, S/ @7 {" v! [' _    *(esp-&gt;4+4)=='NTIC'5 Q* x3 g* J% F" l" }4 D

* G& ~) H0 S' y" c/ y5 r6 c-The most exotic ones (could be very slooooow :-(0 x! W3 D( c2 `/ s5 i) x
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" ?5 z+ z$ N+ g( C' c; `     ;will break 3 times :-(* ~, H- j% \1 W$ E( m

' [9 z; ?" p" r; A: q- x-or (a bit) faster:
" _' B/ M7 z. R! C5 t2 Y   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 X$ v2 i# G; T$ z0 ]! K* X
; q4 q7 k( J% g6 L- t   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 m1 E5 y& V& h7 Z& W     ;will break 3 times :-(' p2 a9 t( x  `. T
! X* B8 W2 t8 r0 N, f4 T1 Y
-Much faster:! ~3 e. b6 k0 |5 V6 N  S
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 w8 N2 q6 F2 R- r; y

( S( ?# f: i9 T2 kNote also that some programs (like AZPR3.00) use de old 16-bit _lopen4 c& b  Z- J' b, n4 R8 x' X
function to do the same job:
9 E! C. T' b+ y; W5 c
6 _2 [* `/ B% J# N: m, {   push    00                        ; OF_READ" @9 p  B. i/ n4 w' q
   mov     eax,[00656634]            ; '\\.\SICE',00 f' Y+ N, ~5 o- ]+ J
   push    eax
) k5 U4 I- E- ^. s1 \3 l5 @8 `   call    KERNEL32!_lopen
9 [; u& B" A; P( I1 B! n& x# [   inc     eax
1 T7 j+ c9 x* O( @) Y   jnz     00650589                  ; detected
$ R. u: e  c" R* C   push    00                        ; OF_READ
; e# {( e6 H# M/ `) B$ z9 O   mov     eax,[00656638]            ; '\\.\SICE'8 n# L: _; V; g+ r, |
   push    eax
+ D0 l, ~& }2 P$ J, [   call    KERNEL32!_lopen
) O' x# Y; J: o   inc     eax& `9 l) E2 t0 R/ w8 n
   jz      006505ae                  ; not detected& r9 b  k# L2 q% V* _" i  g2 d* e

. n$ s: g& \- o. S
1 V( |0 I7 h; y  A: ?0 U/ d! r__________________________________________________________________________
0 U: h5 Z2 _  ]6 {/ [
& y7 w& b1 N6 R$ }. ?2 @9 XMethod 12
: j4 b, ~% D0 _  J# D5 ]1 F* u=========
  ^( F7 Z- Z+ a+ b; f' G7 g
  b# p3 `0 G* M1 K) {This trick is similar to int41h/4fh Debugger installation check (code 058 ?5 n4 P9 b0 y2 b! S3 X3 e5 i
&amp; 06) but very limited because it's only available for Win95/98 (not NT); a/ M* r/ s; m
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.: D1 Z% r* D0 }! ?& j# z

2 ?6 _' _& X; X+ p9 ~9 [6 B   push  0000004fh         ; function 4fh
2 C% f# i9 H3 P" a   push  002a002ah         ; high word specifies which VxD (VWIN32)( N. i- b. X6 {& d  k# Y
                           ; low word specifies which service1 D$ l& V$ A9 n/ B' s6 z, Y1 h8 S# F
                             (VWIN32_Int41Dispatch)
  j& z3 v! y) J* d   call  Kernel32!ORD_001  ; VxdCall
7 O# `* j; T9 E7 W; M9 b" Q   cmp   ax, 0f386h        ; magic number returned by system debuggers% w! c" B0 @2 w
   jz    SoftICE_detected
' Q; e' f1 e! H7 v3 ~
% ^3 U, A/ W0 S4 `4 o* xHere again, several ways to detect it:% w  N: j* _. Z1 Q3 s

7 e& \0 t9 o8 W$ L& A: U* [    BPINT 41 if ax==4f
0 ]3 s$ @* J+ T3 y7 B: Z& C
$ N( o) _  M9 w    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, c; o8 b4 a& y* i) A4 B" r
% ^3 |* I2 H6 }7 R    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A- T0 F. f+ T: p' k  K; r' D
( W9 m( I7 n& x
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' X3 Q5 M2 A; |: r# A
; u- L$ n; Y* i. M
__________________________________________________________________________% e( d, U1 S9 r
+ P4 ^5 G+ T7 {+ q3 S) \
Method 13
; q3 q; M& I/ V6 P, B' c2 A=========' ?# ]$ I5 d; |1 n) r
2 \- {& S3 O. E: f0 x8 K
Not a real method of detection, but a good way to know if SoftICE is& j/ j; D/ e& {" h* F
installed on a computer and to locate its installation directory.
7 l* r* _( j) vIt is used by few softs which access the following registry keys (usually #2) :
& [) N2 c: h4 ^) M7 A$ e
$ T% |$ ^) O( f9 E-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% m, q" R- N0 o) z
\Uninstall\SoftICE4 z# q$ k! U+ L. E0 i2 d) \
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
8 w/ g- C2 h/ V: l+ I1 `2 e. q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 M- k8 ~$ W  l5 F5 G! l% i4 g\App Paths\Loader32.Exe
" _; |) G% c: v9 E( W" R
6 m8 ?: r% ?' N( E: M( T; Q
, F1 x' P. y& c: ^3 W0 HNote that some nasty apps could then erase all files from SoftICE directory
3 \5 C/ B/ y( _  T(I faced that once :-(% ~: ]5 M3 T( s: e5 B8 t6 A. G7 j' O

" C4 y) h4 B/ P8 t' f3 C% |Useful breakpoint to detect it:
4 j; ^0 V% k5 q; l6 G) a
# w  d+ q+ z  o% G" f     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
1 C$ q! A! @, U4 Y$ k9 F
9 t/ @* u/ g4 l6 T__________________________________________________________________________3 L! a& J! k+ @  ?, ~
1 D: Y9 O) S. |7 g8 r5 n* N$ z0 ?
/ e1 U- S3 A" y) W1 M( K
Method 14 - c% F$ ^) S9 e  N, W1 A9 z7 x) f5 k
=========
7 p# z6 N/ C( t* \, H  [: `2 d% ^
7 P; G4 T! t% |$ G7 NA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 I0 t' I$ `6 l* p5 C* O
is to determines whether a debugger is running on your system (ring0 only).) U# F/ t9 Z$ l
5 V2 R! i1 w8 w
   VMMCall Test_Debug_Installed
  y! e: ^0 F* P# f" k   je      not_installed
8 ~) H# T$ C6 c  ~, Q/ h4 k/ S$ R6 a* ?) [& J
This service just checks a flag.
- q9 K& x. ~( E" o2 ]3 A</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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