About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& i" x# _, o5 j
<TBODY># y+ J$ C1 {6 s) M8 J
<TR>: u! |' j1 |# c1 q+ W0 X: X2 E
<TD><PRE>Method 01 . C; g3 M- y, M; a: |( m3 K; X. R2 p' ]
=========
" w% j9 g, y9 e( w3 i% r/ L% T0 C6 I0 W9 U( j: z8 _
This method of detection of SoftICE (as well as the following one) is
3 K/ {; K  X$ |. m" f- |& kused by the majority of packers/encryptors found on Internet.
7 ?+ G6 r0 Y4 r1 Y1 j( m1 AIt seeks the signature of BoundsChecker in SoftICE6 `5 y$ p4 K' t0 m) w: X0 o

& Y* n6 I7 J( P- ?    mov     ebp, 04243484Bh        ; 'BCHK'
. Y5 e6 ?1 Q0 h    mov     ax, 04h3 p+ R- v# ^) g4 N2 u: T; g
    int     3       ' L8 `! \8 n; E9 Y. ]- b/ N( T
    cmp     al,4
) V$ P  f* u' P* Q- S  j    jnz     SoftICE_Detected, T1 I- r  e4 \' L( j2 W
0 g6 m" J- W* O" j
___________________________________________________________________________
! O. c$ I% Y; `5 B* b, B
) D& N5 f- ?" m0 Y3 PMethod 02
+ H' O2 v3 n1 U% \" s& w. ]; l3 W=========/ ?0 K( a9 g- i- D: p

5 t6 X, w6 L/ u) U7 S7 }7 _0 oStill a method very much used (perhaps the most frequent one).  It is used+ K1 N( p6 j, p, A3 Q- s- i& @
to get SoftICE 'Back Door commands' which gives infos on Breakpoints," p0 a# Q8 r! ^0 y/ F# Z) o+ x
or execute SoftICE commands...5 s* K! X- z- L  p
It is also used to crash SoftICE and to force it to execute any commands
' `* Y! b" W1 N(HBOOT...) :-((  
. c: [( T9 p% M3 Y' d$ a+ x. W5 s
Here is a quick description:
' p3 _. g9 N5 f: g6 Q* v-AX = 0910h   (Display string in SIce windows)
7 Z4 t' i2 R8 o+ Q4 p) U& W-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) C& g3 O+ G; G5 @8 i# {( _
-AX = 0912h   (Get breakpoint infos)
& x% K+ {6 e( }1 @-AX = 0913h   (Set Sice breakpoints)
' r" C% G  j9 o8 }' N" x7 y- L+ |-AX = 0914h   (Remove SIce breakoints)( e& p" `8 u  {0 U

# P" P3 T/ e) a2 {6 J1 VEach time you'll meet this trick, you'll see:
+ {9 @" Z2 l+ b# v* Z% G-SI = 4647h
! `$ s5 `7 v& h. p) i-DI = 4A4Dh
# @& H5 e; L  y. FWhich are the 'magic values' used by SoftIce.3 E6 R$ @5 t% m4 D! Y( Z0 T
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) m% `% C9 b2 i# h2 w! k5 P; W* {. I8 i# F
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" B# o* ^6 P$ y) O  W- PEnvelope utility use to protect DOS applications:
$ P5 u1 }; J& C( j$ n7 M. D0 p; O6 j6 ?# L
+ p# B* g2 {1 O6 l, |* S
4C19:0095   MOV    AX,0911  ; execute command.
) _' F/ o- Q3 K: I- x6 x0 q4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 o+ {2 }8 f+ t3 q3 W7 V: f4C19:009A   MOV    SI,4647  ; 1st magic value.' Z# ]# j' a: K! K( P& y, m' }
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 u: s2 o4 f/ B+ ~/ l* N! Z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*); s/ J, w9 M; w& r. k/ ~
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- Y' M& g- c$ n8 I2 |& s; H# O5 \% ~4C19:00A4   INC    CX, o; U" u, U1 g$ ~; G, w
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" H5 C9 B/ e% o- }( V5 c
4C19:00A8   JB     0095     ; 6 different commands.) y7 J; _* t) |
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
1 g( L# n# w9 k" |% N4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 [3 f$ H; S' {) n% u" y$ r; c& R
$ Q( w1 b# I2 g& u
The program will execute 6 different SIce commands located at ds:dx, which  Q# n* R. m' n- t
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 T2 M) U, ?5 P" m

" q$ i6 ]$ i* s+ P4 L* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- Y* n, Y  A/ s5 G4 h2 i* ]
___________________________________________________________________________8 J) {& {: ?3 X

1 T, E& |4 G5 n9 W2 V; [: ^+ l& ^7 \& v& q5 h
Method 03
2 U! e9 w2 V3 H7 m+ q=========
" Q4 u' X) Q2 h. y
7 |- F3 m) s" L  F/ q& z: {: _! f. iLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" T: m7 j2 Y! s( z- I3 c
(API Get entry point)/ w! F! L, b9 |/ M1 P
        
" c7 h" y2 }8 |* v* n" C; x8 o( T, F: |5 C% E  b: Z
    xor     di,di
) A% p. `' Z1 D' y& [    mov     es,di' s! g% o& t' y0 Y4 |1 I% X1 s& V
    mov     ax, 1684h       # H7 g7 [& L- u2 w2 k9 ]
    mov     bx, 0202h       ; VxD ID of winice
- p: u8 S3 y- Y& A8 s* i    int     2Fh
* y; ^" H* j, }' p1 l: T    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% F9 }  X! a8 C6 D' z    add     ax, di8 a! n# c' Y* Z1 g
    test    ax,ax! s7 d# ?1 u5 j' \/ E7 X
    jnz     SoftICE_Detected3 V( l, s0 W4 n/ |* r
  [8 X) }, c8 ?% e+ o
___________________________________________________________________________4 k3 D/ Y5 f' H+ y# \, r! Z
( K, u0 V0 _5 z9 \& I( x9 N
Method 04
+ ?( U0 A. C: J& w=========. i6 F: L/ G; T( Y4 O5 w  j7 {
+ ?- u' a& @- Y( {0 f8 s
Method identical to the preceding one except that it seeks the ID of SoftICE. p0 r, g8 k% o
GFX VxD.. l, C& b7 c  @4 Y) q' {: i% M
% A% P$ L3 E% L1 u5 W3 T
    xor     di,di9 w1 \3 R. w2 O* O
    mov     es,di5 j* B! i* d; F0 `! ]- o
    mov     ax, 1684h      
" A2 B: ?* a+ s    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 Q/ ]' N3 d/ g$ d% `    int     2fh) [1 t6 h7 Y! [9 A3 U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) @; D. R. W  d/ D, Q/ @% j    add     ax, di
- s  Q8 d; g  J/ A9 w7 O    test    ax,ax
; X: e( P* y$ ^& L    jnz     SoftICE_Detected
7 w; ^5 _0 {$ d6 M6 e# u4 K- I/ [; e% V# A9 O2 e* p6 t/ u) q( L
__________________________________________________________________________
, Y6 a3 t6 \0 V( V( f# l7 f
2 @! v7 R& H8 a7 r: s; K- B8 k# F: ?  [# x! C
; _* V: J; x; ]4 i' DMethod 059 e0 G$ p; x) R1 D3 \% n
=========/ m; Q/ H' y" H4 w7 [0 M

% F; S$ B+ N4 F, {1 ?Method seeking the 'magic number' 0F386h returned (in ax) by all system. M( U( w) G( s$ u$ i2 w8 L
debugger. It calls the int 41h, function 4Fh.9 [% U, N6 G6 i5 q: i0 m6 t
There are several alternatives.  : A- D& M& i7 z3 }8 R0 {
7 z; @' u  J$ R* z/ A5 {0 m
The following one is the simplest:
( Q# H& c) i& R! a) c& K7 a8 h* A) H8 @
    mov     ax,4fh
7 I% \- R7 V+ |& {- @    int     41h" G) G5 g- D& `! x0 j9 n( e- {: G
    cmp     ax, 0F3863 K( |! G, z( W$ q5 c. U) C
    jz      SoftICE_detected
: a) i' j. K3 X% G$ G, k6 O; ~3 J& I6 K1 Z. x( p( {
8 W; [. D, f& r3 ?3 r
Next method as well as the following one are 2 examples from Stone's ) x- J% r7 ]. a0 P2 y7 K% v% w
"stn-wid.zip" (www.cracking.net):
; G: |, q/ k0 h# _. }$ r) g( Y7 ~7 I2 w' C- A% y) b7 R. Z
    mov     bx, cs
: X; z" m1 V- z- L7 Q1 }    lea     dx, int41handler24 K9 ^6 U5 y$ e- c. g% G# X# J
    xchg    dx, es:[41h*4]
& X* F9 W$ A3 S* o0 D* D2 ?; n    xchg    bx, es:[41h*4+2]! M) k0 |* n6 T2 w7 o1 q  G
    mov     ax,4fh
) F; o1 E* F9 \7 O! X0 q    int     41h5 b7 i* V/ Y6 }4 u" A% O4 E
    xchg    dx, es:[41h*4]
, _& f, R: W' B2 `' {    xchg    bx, es:[41h*4+2]
1 N2 Q% h: J5 {; t- |& a1 V9 f3 ^( p    cmp     ax, 0f386h
+ d; I& S+ W7 e9 i    jz      SoftICE_detected
8 Q5 e! h; ^6 Y$ K% ]2 a3 R% x1 W6 T  G+ g8 K& ~3 D
int41handler2 PROC+ P& K. a9 I* `- k/ @1 Q9 T
    iret
* m$ [5 e& b* I* U9 I. i* Nint41handler2 ENDP4 ~: c+ m! b- |4 D& L$ E

- A* X( L  c5 g5 H  D
) {2 U; V) R, y& r! r_________________________________________________________________________6 r! p+ R5 u! d. L# C
$ v1 p3 Q+ T( u0 j! p  B& Y# K& ^7 h
4 d$ F9 u" X5 Y
Method 06
6 ?0 L" Y  |# f7 d" c2 E=========% J5 z& T0 Q# F1 U7 p
# ^9 A0 Y$ N1 X: l9 c: Z# N/ ]: [
% i) k, ]% [4 L9 ]' O/ G8 q
2nd method similar to the preceding one but more difficult to detect:8 q, O) X9 S! Z! O; ^7 w0 W. Y1 G( c
$ S$ S1 M) s6 @9 u1 y/ _; t! m
  }  K, S! @# |7 b6 T1 w
int41handler PROC
9 q3 b, N% C" s5 T1 C2 x. F* T" r8 A    mov     cl,al
- x  Y4 u6 s& W7 v    iret1 B/ `/ W5 ~0 b& D, b! g1 o
int41handler ENDP
/ f# L1 ^% b0 c8 s  ~( z6 |% h3 m+ @0 Y0 ~0 ]. u
7 i- I6 b1 o; N% ^( P
    xor     ax,ax* A; r3 O9 r5 ^: ^3 D& F" @; z
    mov     es,ax
! q2 `2 @8 L' y0 M) I6 B- u    mov     bx, cs5 t1 ~9 B1 t8 w! ?# R6 _
    lea     dx, int41handler
& a, C" \' d  l+ v    xchg    dx, es:[41h*4]3 F& o/ g0 m2 T, B
    xchg    bx, es:[41h*4+2]
5 X- m- U8 }$ o" ^    in      al, 40h( m3 M: i+ `/ f; x' b4 @
    xor     cx,cx
5 ]" A( r# ~. v6 g1 X% S    int     41h5 ?" {( M  H- w; K8 n
    xchg    dx, es:[41h*4]
7 _0 q' q6 g3 U* a# D$ h2 [1 m: D( W    xchg    bx, es:[41h*4+2]* @4 b$ U2 X  k3 @
    cmp     cl,al& ?7 @4 m: `: ]
    jnz     SoftICE_detected1 I7 S$ m' r9 W7 u1 j# b+ L% I# H5 w
+ U* V4 l8 M& y! v/ D, _9 D
_________________________________________________________________________
- V9 p* Z1 O/ Q- Y
  |* P. ?6 Q9 X# E2 X% A' eMethod 07
2 U! C! p! W4 @=========
$ N* ]: L& K# m/ C: l- i( X8 j( ^& w/ n  K: ]# ~$ w
Method of detection of the WinICE handler in the int68h (V86)# C( V  j" s$ h/ q( h% b# R

4 P# h$ u7 Q5 ?% X+ \3 n# I    mov     ah,43h8 Y+ R: ~: m8 f# t2 ?( v9 W
    int     68h
! p5 @; E8 T0 H9 T" @) A    cmp     ax,0F386h
* z( a% Y- K5 A( \% ]3 b' F    jz      SoftICE_Detected
* ^1 \5 \, }* e9 f7 q8 d2 @  n: [5 `% N
+ [, c) k5 [5 s, h2 ~1 }& Y% K& p5 C' T% k1 Q6 j8 k" Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  n# M/ n# {7 f   app like this:
7 X" {+ o. N& b' k' O
) i. Q( D3 f/ G' z' u   BPX exec_int if ax==681 z4 I4 B" |$ Q9 E
   (function called is located at byte ptr [ebp+1Dh] and client eip is
, `, B2 ]  T4 k3 `8 I3 c6 E   located at [ebp+48h] for 32Bit apps)7 V* s9 s+ f, k, _" b# y6 m
__________________________________________________________________________( N' M3 D" |* n6 q

  d- d" h9 I& A- i$ I0 C
7 p9 A5 X4 G1 o& pMethod 08
* }# Y! T7 j0 N$ \7 w& R6 c=========
; M& `3 E$ n0 y- ?, [0 r6 `$ P/ h7 T, a2 W1 @7 E# G
It is not a method of detection of SoftICE but a possibility to crash the( {! ?% E& n: X' V: \9 u
system by intercepting int 01h and int 03h and redirecting them to another
: i& i) p2 d  x" A% y$ d4 ~- E4 {routine." |% H0 @0 k; |% o# g) g6 s9 f3 R
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 D+ ^' R# I, U6 ^1 d
to the new routine to execute (hangs computer...)
2 b) r5 _; X7 j1 b5 b$ }$ B) y# z  q9 g2 Z2 x: d/ G  K
    mov     ah, 25h
! j, F/ [5 @) }) k" c9 T* @# Z    mov     al, Int_Number (01h or 03h)5 [2 R2 y- l" ?: J9 T. e
    mov     dx, offset New_Int_Routine
0 @" Z  o7 y$ A    int     21h
" K3 H9 c2 H2 w+ ]5 [
' [& B1 I0 S; {: O__________________________________________________________________________
) C/ \" B7 P& w8 _/ L' s$ b$ N9 c* H& y4 M2 B
Method 09
% J/ L; b7 W' h. Y+ T8 l=========
5 c0 L$ ]" _0 t; {/ [5 W+ l/ C8 i. k' }3 r& ^, l. d9 b# ]# H
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only$ `. `4 j$ `- t2 a6 q
performed in ring0 (VxD or a ring3 app using the VxdCall).) |- F- L* [- v' y' P5 H
The Get_DDB service is used to determine whether or not a VxD is installed) ]: f1 }+ X5 k* s* _7 i
for the specified device and returns a Device Description Block (in ecx) for
+ u8 q: z) g  i) othat device if it is installed.
- H% F5 e/ Q- P0 \$ F( _; x/ p6 ?& W
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
, m+ ^; C7 s$ [0 G6 M8 u. i9 S   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 Q# ~- O5 i" e  x8 X   VMMCall Get_DDB
6 m  A; H( }- B* J& [. i   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" Y" q! V6 H: d5 e7 u
1 q! T) t* Q  J
Note as well that you can easily detect this method with SoftICE:' t8 c7 M+ C8 G: W: _  H5 t: o
   bpx Get_DDB if ax==0202 || ax==7a5fh
  O, {( C1 ?( V" I- c0 b/ P2 F5 b2 u# M
__________________________________________________________________________: Q7 m+ O; p# q: _  Y" ^! h2 N
, B( x7 `  D  Q- c1 S$ C
Method 10
5 p$ [/ d. [/ v9 h/ Q% F: I=========
5 n/ H( I# J1 o4 j* d; k6 o+ ^/ l/ I
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ ~& z8 g8 P# o' L- Z  SoftICE while the option is enable!!' {) x" W: a- ?$ I# b  ]
: i/ M; d* w' V: D+ B: ^
This trick is very efficient:6 N+ U. y: D9 l$ k4 k
by checking the Debug Registers, you can detect if SoftICE is loaded7 c0 N0 U/ V# H7 M. j0 n/ L
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% u; |7 R) ?  C  Tthere are some memory breakpoints set (dr0 to dr3) simply by reading their3 v6 j) q1 S1 N3 C
value (in ring0 only). Values can be manipulated and or changed as well
5 I, c8 T# o% v(clearing BPMs for instance)9 G8 C- L- x& T, Q9 c2 O+ G: M
$ i/ \' W! T2 B' K9 X9 g+ g
__________________________________________________________________________
9 m( c; T  E, K9 Y: I0 X0 l
9 B4 S4 E/ L$ v) C) n# ?Method 11/ E( `5 d& R7 X# e. d$ S  ^
=========
( L; \3 a3 @2 z3 p0 k  e2 R' E: y, o+ `* \- F8 p
This method is most known as 'MeltICE' because it has been freely distributed: B. e) D% J* f
via www.winfiles.com. However it was first used by NuMega people to allow: v6 i4 T1 I/ l7 M: W* E
Symbol Loader to check if SoftICE was active or not (the code is located: j& K$ ]. D3 [6 x: j8 ?" w' i- u- \
inside nmtrans.dll).
- u9 D, r& h2 E, C4 u. I$ P  k) `4 X  r7 l9 s6 F# m
The way it works is very simple:: B( A9 `: U, ~- {3 d
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) D: Z& L. S; G- a1 M( z3 P' r1 z
WinNT) with the CreateFileA API.
2 \: Q# h/ e/ u4 l* v2 S( B+ Y' O( X- F8 S( l( ^
Here is a sample (checking for 'SICE'):
' t- m+ |* |* J7 x' X1 Y% e" l$ G& h1 C, r
BOOL IsSoftIce95Loaded()
$ i2 q% x/ B9 H0 e3 d{# N6 x. C7 I/ ]. r9 `
   HANDLE hFile;  # e; J" O2 U+ r- y) ^4 m2 q, C
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,, y' W$ r1 j( t0 P. Y
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. J/ D" i, z9 o0 O) r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& R: z3 }' N$ [! D6 Y   if( hFile != INVALID_HANDLE_VALUE )* r% g3 P8 x- l  Z: |, C' a
   {, W* c, y4 A3 [$ G
      CloseHandle(hFile);
- U' S1 d+ z. I  g) j* N( w      return TRUE;
- s* m, d  C3 {- H  Z4 N, b   }
9 l% T2 ?+ l- `4 I2 E# }   return FALSE;+ E" r& J' q5 G5 ^6 g$ W3 ]; [0 Z
}
! h* {% }2 C, |8 S" {7 Q
$ _' }: L0 F& e. i7 m6 aAlthough this trick calls the CreateFileA function, don't even expect to be
& l8 f! I( ^# F" t& \7 R1 Nable to intercept it by installing a IFS hook: it will not work, no way!- F' ^3 ^/ X* G
In fact, after the call to CreateFileA it will get through VWIN32 0x001F$ ~  K2 F* t1 E
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). v6 `( c1 T4 m' `8 _4 {9 T
and then browse the DDB list until it find the VxD and its DDB_Control_Proc  p# s3 w( Z$ l' h3 X5 d9 ?
field.
, f" x% h  y5 z, C; BIn fact, its purpose is not to load/unload VxDs but only to send a
- N4 c% u$ b) T! W" ~2 _W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* Y  H# T+ H0 y: [4 V
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
5 r# [% R* Q& G  ~+ Z/ |to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& v/ J& v$ O% G* ]. Q2 VIf the VxD is loaded, it will always clear eax and the Carry flag to allow: Y% H& t" ]  R8 h8 |0 m7 P
its handle to be opened and then, will be detected./ H( g& N) X5 T1 C- A. H" R1 z
You can check that simply by hooking Winice.exe control proc entry point
) ^$ |1 l4 n$ A4 j' x* L1 C  Zwhile running MeltICE.
/ Q1 C$ Z. _# \+ N1 a; N+ u4 Z
& t9 P+ _& j' X& ]/ s! n) V$ S' I' r9 ~' c
  00401067:  push      00402025    ; \\.\SICE0 E, h$ K$ T' s) i; j4 J
  0040106C:  call      CreateFileA
( z- ?4 j' Q8 z9 v" X2 j  00401071:  cmp       eax,-001- x8 S2 S' Y' C$ ~. v# Q4 o9 o; Y8 D
  00401074:  je        00401091
3 A8 g* Y% V+ b! g; X- j) [4 \# s1 J$ L
' C. u* X% r* C1 Y$ \9 Q7 w9 o
There could be hundreds of BPX you could use to detect this trick.: z1 S! P' A1 K3 X
-The most classical one is:
7 X4 b* |% \  s0 j  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ Q# V/ k2 b* J* G4 i8 k% g; |
    *(esp-&gt;4+4)=='NTIC'+ {( h. w8 i; q* C# r

! w9 J" i6 o4 @% K5 v/ J-The most exotic ones (could be very slooooow :-(
+ f0 B! Z1 y) H, I9 E& T, U' j   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 @  j7 s3 S4 d  _, ^, l4 W! a( K; U+ |
     ;will break 3 times :-(
* u" s5 P2 Z6 q8 D8 `
7 J- m4 y, V9 X, d-or (a bit) faster:
* q$ ?4 m/ Q7 t; m3 j/ n0 Q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')* e; Y' n2 f8 j% C/ g
4 a4 l' \& u0 S8 V' W
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , r3 Q: U8 L+ [1 J
     ;will break 3 times :-(
  j9 }% T8 v; G3 L9 C4 f% m/ n4 f/ m0 T; @1 y6 C
-Much faster:1 B5 \2 [& K$ d$ K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 F0 k, ~1 @0 u  [) m3 [% U! G
" h& S; J% B- Y% X! e, \
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen  w2 x/ A' V1 T8 I( U
function to do the same job:. `$ K' B$ t0 l0 U
2 O& _/ v4 O' b3 ?, U# s
   push    00                        ; OF_READ& W3 p& W+ B. E1 @! [- W
   mov     eax,[00656634]            ; '\\.\SICE',0
8 ?( P' B* q" ~   push    eax* A  E! V' `: W  X; _
   call    KERNEL32!_lopen
2 E& R  H; }* G. a   inc     eax7 W+ u* ^, v3 h5 _3 l8 t
   jnz     00650589                  ; detected
* r* W) `8 P: L( \" L2 C   push    00                        ; OF_READ) l" {6 d8 M' y% W' B. ]- i* s0 s
   mov     eax,[00656638]            ; '\\.\SICE'
5 W- @% k, D6 r) h& F+ U   push    eax
) J* P! J  r7 y4 b3 r% H  ~$ H   call    KERNEL32!_lopen
# F& q2 M# r7 s' d   inc     eax
7 l$ b; _8 i9 K' W8 M5 U! j4 A! f   jz      006505ae                  ; not detected
+ @! F! @' i) \# }6 |! W$ i6 C7 z3 j/ f, d

# y/ j- E' g+ U7 z__________________________________________________________________________6 `: i2 q! D+ @- N1 k5 y/ V
; b. X& |9 m/ P! V4 q6 G( s
Method 12& c, G6 f' _- F' [  b2 v" A, y1 x
=========
% v& b3 e8 h: l7 x6 w" Q: p
  Y* s5 X3 ]# |* y/ P2 f, F2 S! F! Q) B" nThis trick is similar to int41h/4fh Debugger installation check (code 054 s0 V5 j2 }$ q3 s2 K- D/ p# W
&amp; 06) but very limited because it's only available for Win95/98 (not NT)# H! l! j8 _) l2 O/ j' [  X& Q$ b4 ?
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 ?- u. M. k0 C9 X! ?( O4 p: B' d0 X, b/ ~8 V
   push  0000004fh         ; function 4fh
1 \% `5 w! k7 V4 b6 \   push  002a002ah         ; high word specifies which VxD (VWIN32)7 @4 w$ {" @" l! E
                           ; low word specifies which service
2 k" s% W* ^3 E4 b7 T; o2 M                             (VWIN32_Int41Dispatch)
2 p8 k9 K4 V% r& q   call  Kernel32!ORD_001  ; VxdCall
' |4 y, Z1 q- s. c; n   cmp   ax, 0f386h        ; magic number returned by system debuggers2 R7 Q3 {7 K- f: w/ f
   jz    SoftICE_detected7 l% Y0 x( D  P: G2 H
% D0 B+ F, h  `, N( O
Here again, several ways to detect it:
  t8 Z" W- O2 b6 {7 v/ J$ d) ]! B; p. {7 s" @
    BPINT 41 if ax==4f
! j! s1 V$ S" R1 ~0 p# y* U  Y. d# B- P+ J+ {3 S
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* C( H8 b4 V2 J5 H
4 N$ p4 `' |# i2 l4 S) D
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  D2 W" z! N# T' b& b! L+ m

8 M) G3 m7 I% o" I9 w. V' ~3 o& N    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 i. e* b: W% B1 s7 s6 K2 [
% c" S, Q/ C9 B* }
__________________________________________________________________________
2 d" T5 _* h$ l3 E% z  ^6 ^  X- L$ z8 m$ n! R9 f7 e6 i: h0 x
Method 13( l$ y* T, J5 \, n8 w  O
=========+ g+ f! ~. h, D: D6 l% t

$ }8 x% x  |& S% hNot a real method of detection, but a good way to know if SoftICE is- i6 d% E! T/ \
installed on a computer and to locate its installation directory.
9 J* Z$ ]- m8 X% C' [It is used by few softs which access the following registry keys (usually #2) :6 V2 i6 I/ X8 [: m3 W& Y

7 d" s* h( @  F% q* `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ Q" F7 ]2 K& }0 o$ s
\Uninstall\SoftICE" ]+ T/ f+ ?4 T+ O
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
0 P8 P4 q: w2 D1 [# X-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' J! S8 R+ E& c3 j5 p) h
\App Paths\Loader32.Exe
# S9 P& ^1 T: G* {! O" j" n
+ b$ {% q  e( A  P/ e, [0 z+ l+ O5 k* k! K3 N% `
Note that some nasty apps could then erase all files from SoftICE directory
4 ?6 t4 A- w; K0 u8 `2 }' ]$ M(I faced that once :-(
. h) }2 o4 r( l
( g. {3 O9 `  E5 LUseful breakpoint to detect it:4 N: E, y& u) p# J
1 n. H5 a2 Q9 ?8 M* [" j, j5 y( g
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
7 b1 Y. z+ {" o4 Z3 ]: g/ u7 q' R) j$ w& v7 t: n, a& K
__________________________________________________________________________$ E$ B# t& `8 W' H

4 k5 T; k! Y6 `: t4 S( \, l8 j% h) T4 ]1 |; s5 T
Method 14 ) \! _0 i" C  p5 Q
=========
( Z4 R9 P/ p. I) z* _! n3 ?  I  l& T6 x6 G  K/ Q, K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 G2 @$ T) q% r9 Vis to determines whether a debugger is running on your system (ring0 only).& e$ R* h: ~: J  H! |7 K) l* V

/ ?6 ^' W  Q, s! a5 {/ b   VMMCall Test_Debug_Installed
1 T' n  |4 q: H' d   je      not_installed+ B# @* s1 z' _3 k9 j. |7 J
( o4 z/ _2 h5 H' M
This service just checks a flag.
' \% J! }! X, a# W) F</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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