About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 V4 \$ G" M- A<TBODY>, e9 x# N8 L1 v* v4 e. B
<TR>
7 b/ }+ s5 {2 V: |' }8 w<TD><PRE>Method 01
/ X& _( s8 u# o4 @=========
5 h) G; x1 d6 C5 _1 r! Z+ T& ?( `) t
This method of detection of SoftICE (as well as the following one) is+ {3 ^% c$ \" F+ B% h. `
used by the majority of packers/encryptors found on Internet.2 M7 V& T6 R' n& H( @. C* [. N: H1 R
It seeks the signature of BoundsChecker in SoftICE  k9 n9 n  p8 z4 ~! k2 o+ \" M

0 v4 N' y6 C$ q: ]0 w. m" t; Z7 b    mov     ebp, 04243484Bh        ; 'BCHK'
5 f( Y* e1 \0 R0 }& M- q+ ^    mov     ax, 04h
: s. J! D8 l. |2 p$ I    int     3      
" W$ ^  j8 s" t! y/ l    cmp     al,4
( x, b. \5 L6 j0 q  l' R& b7 H    jnz     SoftICE_Detected# `, q& v8 c* z

5 e# k0 y  i6 t$ {2 _/ {2 U* `___________________________________________________________________________
. I  g! g) G3 |4 {  e: d+ r: k) S
Method 02- A# o$ J2 n5 b( h& M9 T& R
=========  t" z0 s6 S! t. c

1 l& B  y1 j( R/ x; G" TStill a method very much used (perhaps the most frequent one).  It is used
0 t! I. j  B/ i# g, K+ Bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,  \" l- _) G2 l- V0 k) i; m, Z; S
or execute SoftICE commands...2 p  k- \6 [) p) d& n  v$ [8 t
It is also used to crash SoftICE and to force it to execute any commands/ A1 H% l5 D. y' w
(HBOOT...) :-((  
5 m0 r9 x5 S/ W2 d8 P/ z" H  I
9 o8 O+ x/ q, g3 gHere is a quick description:' y3 x4 s$ b( P( E" ~
-AX = 0910h   (Display string in SIce windows). u8 |/ B3 ?( J
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% L! P6 q& m( V, j% {. N* ^& E& o# V
-AX = 0912h   (Get breakpoint infos)/ V9 `) R5 f4 T
-AX = 0913h   (Set Sice breakpoints)& h6 m2 b6 n! V
-AX = 0914h   (Remove SIce breakoints)
, |5 S4 @1 I5 _/ }, s- d2 a0 \5 M5 v* \% N* b2 c* m. e
Each time you'll meet this trick, you'll see:6 l# N: D/ a- ?1 H0 W
-SI = 4647h
, @  {  `. ]7 n1 \! A-DI = 4A4Dh+ W! I6 K: G6 A3 v7 S) G/ t& l% [
Which are the 'magic values' used by SoftIce.1 h9 s4 L  X. G2 G! |+ _0 B; E
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# ^: C9 r2 P2 W% K( y
; b! ~, ?/ P2 y* y& Z$ g* b
Here is one example from the file "Haspinst.exe" which is the dongle HASP1 i7 B: g; |, P6 r% B
Envelope utility use to protect DOS applications:# z: m: R6 L- U
5 h  R2 Z! U! L2 g+ J; t4 Q
) q) l( b; M3 \) b0 Y9 p" E
4C19:0095   MOV    AX,0911  ; execute command.
. A2 z- B% R" ~) X- G4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. @6 q& U' S& }
4C19:009A   MOV    SI,4647  ; 1st magic value.
4 _) R; J/ S+ J4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ N5 a3 I9 W; ]/ x* X
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ L7 J& c6 l# Z0 u" ~% t4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! N" Q( Q, H" T6 p4C19:00A4   INC    CX) p( m+ m1 y8 |( \- V/ o! F
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
. f. \& B$ Y, [" H( Y4C19:00A8   JB     0095     ; 6 different commands.0 \# u7 u; R; P! Y$ r
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  x/ z6 Y; f* }( Q8 j& e/ s
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: J6 T0 I6 W9 N9 E2 u% x* y2 A/ y1 H4 Q
The program will execute 6 different SIce commands located at ds:dx, which
. ?2 h9 N3 w* w8 w6 p# Vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' x7 `, M( O& U5 p) l$ q9 _$ _3 C$ |7 H: i7 x4 J0 d9 @8 `4 B0 L
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 h0 `" }0 [7 p9 h# L___________________________________________________________________________
2 A' E! j$ f( l3 T( c$ [) s% ~7 ?8 z/ Q7 I/ G
/ N7 m* {  N# I& J# k6 h8 G
Method 03
7 @. z) o9 P% L. r+ K=========
6 J2 Y% o4 K+ _- l6 u5 T7 s: q. J0 J  `& X& x$ J
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. w' n( I9 o1 j
(API Get entry point)3 j4 F2 g, B" A  E3 R& `2 B% @
        
3 x* R1 t/ T7 ?9 z$ @! |6 T! ^+ d
    xor     di,di
' D, J" l6 n( d    mov     es,di: D: L  p3 L3 n1 C9 Z3 E: h
    mov     ax, 1684h       5 L- L+ [, l, ?! S/ ?0 K
    mov     bx, 0202h       ; VxD ID of winice
( z6 V" s, |' h/ C    int     2Fh
. _8 O1 E+ K) N4 Q9 Z, b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% B! a6 }  G# i5 b    add     ax, di! Q, X3 e$ }: ~! T6 O6 p: r
    test    ax,ax# o# x8 M. q, h! b$ w0 ^
    jnz     SoftICE_Detected4 ~; F+ X! w; N4 }$ c) L

* f3 p& c' A2 A9 n* L& D9 O___________________________________________________________________________
" K- S4 T8 _' r8 p7 x1 h! _3 M) u' {, z7 D0 S; y
Method 04
9 T  F, b  R% f$ O$ _5 ^=========- s5 y* C3 R6 t2 \
- v. s7 F! B  x( [$ b  P
Method identical to the preceding one except that it seeks the ID of SoftICE
0 E! O, e) Y" e+ b4 eGFX VxD.
7 _. S+ y7 S# k$ u/ ]5 q3 T1 T7 `3 J* @( J* W; t
    xor     di,di
& [6 H- b0 Z6 }8 q/ {# _    mov     es,di
; y  Q8 e6 n" P$ h$ \0 o7 s, X; e    mov     ax, 1684h      
7 t  l" U$ e4 s8 C: ~    mov     bx, 7a5Fh       ; VxD ID of SIWVID" n  Y9 |' j5 a( t3 t- i4 @
    int     2fh
, U% C7 c) O: G( i    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ ^& z  D, @7 f1 _% d% ^0 y: y" _
    add     ax, di2 z6 Y- N" E3 z; o5 C0 C
    test    ax,ax; g  N* o( V1 s& E1 }& c% T
    jnz     SoftICE_Detected
! v% g) t- f5 Q. a/ ]- E. q
! i7 z* Z1 u/ Y) R# ^. B2 g, R6 }__________________________________________________________________________3 l- D' I: i! @! h
/ `" ]% _7 m4 t; E  k# B

6 b) l0 _; d( AMethod 05
/ E  [/ U5 a1 @. Z& L" B# j=========5 E* Z3 \2 S* y4 l3 H
  b& |1 P, e' A- _* P- X5 Q4 {
Method seeking the 'magic number' 0F386h returned (in ax) by all system
( u4 l) H" X: ~0 Pdebugger. It calls the int 41h, function 4Fh.6 O# {+ B2 f. h! P) B
There are several alternatives.  # k( G0 A, `( K& W3 {( _6 k
( i5 w  X) _1 N) H" J2 M
The following one is the simplest:
$ B4 d: u, C$ {
" `7 k2 |  Y4 Z$ u2 }    mov     ax,4fh: s0 o% m/ u1 U" W6 j% G: e
    int     41h
5 K1 G2 T7 C: [0 G+ @    cmp     ax, 0F386
- `* I# A' d7 z& m    jz      SoftICE_detected$ z3 i+ F7 d% |; _
- Q& \) a8 s, h
. z$ I5 j: c7 L& w* A
Next method as well as the following one are 2 examples from Stone's
5 u( y) ]1 v* n' `9 l0 _"stn-wid.zip" (www.cracking.net):! p  _# \; v, c
, A4 `0 f8 _1 R  O6 \5 M- O0 g8 R
    mov     bx, cs, t+ W7 A0 w5 l
    lea     dx, int41handler2
+ Y4 {0 s: D: b# }    xchg    dx, es:[41h*4]
! S, K  {' L; v( T, i+ k    xchg    bx, es:[41h*4+2]
6 [( P- O, \2 d) S    mov     ax,4fh8 ?. \2 Z+ w- I: |. j) k/ o9 \; D
    int     41h; t  E! ~! k! V9 ]
    xchg    dx, es:[41h*4]5 J: u8 R* k; y. [2 ]+ b. i% M4 T
    xchg    bx, es:[41h*4+2]
! k" p, }& E" X$ y    cmp     ax, 0f386h
& x8 |. t0 s5 X% C5 M    jz      SoftICE_detected8 m3 o) g% |; {
5 Y  A; r# R  l% \3 s. ^0 h$ W
int41handler2 PROC! z' [. ~  N3 `, O
    iret
( x7 e* @2 D+ X% {' bint41handler2 ENDP
  l/ p" v# W) O
. J( }! ]1 e  u8 R
5 W# v9 v2 [" e_________________________________________________________________________( I5 `# r- l$ t: _# N

" A, J- y; V* z3 E
( u2 }& n4 y: V1 v# E1 CMethod 06
- L1 m* `$ M' v' r8 o=========" |) H% S/ a& _9 ]1 Y' V

% K3 D- ~0 _. |/ |1 h- W* s$ _) {: A
2nd method similar to the preceding one but more difficult to detect:
1 G* ]8 H7 z% L1 A) {5 ~8 _! v0 I0 o
+ K5 [" U8 g  ?6 A& B
int41handler PROC- l  V/ k% F. d" H
    mov     cl,al
' t& m: R% s- i8 H. C! s+ H, @    iret
$ g4 n, u$ V9 X! cint41handler ENDP
$ H; A6 A) ^/ @7 l8 W
; ^1 f, R! d/ B1 d( u. Y  z4 u& \
" s$ `1 q8 F. s7 L% e    xor     ax,ax
: s! O* O9 Q0 F! T7 a    mov     es,ax
+ Q9 m' X' F0 q7 f    mov     bx, cs
; d: g% I+ l3 o6 J    lea     dx, int41handler8 Y( {6 S, |2 A" t0 N
    xchg    dx, es:[41h*4]
% ]# P$ L: Q* |& t    xchg    bx, es:[41h*4+2]
# C0 L# k7 @1 n; \) h    in      al, 40h
. _; t( M- b- H" P8 [    xor     cx,cx
' L4 i9 }' ^( x1 e( t9 z% I" d  A    int     41h, U3 ~$ [3 Z3 |$ ^$ U' s
    xchg    dx, es:[41h*4]
9 c1 o4 L3 l( a$ t- l. _    xchg    bx, es:[41h*4+2]
" H$ d9 o1 p2 i# f* ~8 f6 i9 r    cmp     cl,al' h2 I$ |' g  u5 s! S) q7 N* Y
    jnz     SoftICE_detected5 t+ N: m8 }% _; a; u

5 @" L/ D, M$ \! B% g# h7 Y_________________________________________________________________________4 ~2 P; f7 `; b" v! t& V4 M
: ]* s9 Z/ Q  H4 c6 L3 G
Method 07
5 ]3 ~5 F$ r/ M" H=========
, u8 {( Q: t5 X! W1 `
) j1 g7 I7 Z4 N" y* K# q$ Q, {Method of detection of the WinICE handler in the int68h (V86)- c0 [6 n( W8 \: ^$ y% ~
$ u3 i5 j! h! R; \7 @
    mov     ah,43h
& n6 R, E$ i0 \    int     68h
3 \- Z4 v# G/ X9 z. w    cmp     ax,0F386h
' f* i; j3 T3 i+ _; Z    jz      SoftICE_Detected4 N" H' i8 e% e. x- k" j' _1 P( R* G: r
3 ]% V; `& M- o- h/ l1 N

& r+ G0 w1 P# _) _: d=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit. f/ _4 L( D% u, Q# [
   app like this:0 r, q+ S2 s( H& K/ h& k+ c
9 J* L1 O: R" O4 B% i8 F$ i1 G8 S
   BPX exec_int if ax==68
( Z, \$ B! P/ E. _0 E) c! q+ S   (function called is located at byte ptr [ebp+1Dh] and client eip is1 P* z; R: A) V1 S1 V6 o1 L
   located at [ebp+48h] for 32Bit apps)
$ R6 ]2 ]4 p, X3 a: H2 J9 a, o__________________________________________________________________________
: n0 l7 c6 z3 N3 f
' W, Y* b4 R1 A2 h# o
" J) p- z. m2 ^$ @5 a4 f2 l, k: OMethod 08
1 |: N8 J5 @& D4 G6 c/ A=========) C7 ?* ^  ]! d: j

. O" t) n( S% l0 bIt is not a method of detection of SoftICE but a possibility to crash the: \# \8 ?9 s. s
system by intercepting int 01h and int 03h and redirecting them to another
# ~$ h6 I0 M( D% q6 Vroutine.) Z* @6 w1 e* h, [4 H8 |
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 t, C5 \: v8 a! u( N$ f- m) b
to the new routine to execute (hangs computer...)- W6 q  k/ r- W/ x" k

" x- R0 U/ Q) u    mov     ah, 25h4 g1 S! ^6 a8 Y5 |" j
    mov     al, Int_Number (01h or 03h)5 a" ?3 O# c3 y/ G
    mov     dx, offset New_Int_Routine
- D5 m; d0 X1 g$ }" F4 e    int     21h
- e3 o% t% P0 E. U, Q( z
+ f- W8 d3 X9 A( y__________________________________________________________________________; d1 s; [" u5 o4 v# u0 j- s/ {: m
2 W+ w1 v" E% o" w  f
Method 09
3 S5 U9 I9 O( Q( v7 Q* d; s=========3 [$ p, k6 K# B

$ P1 k3 o- h3 D! U: M  w- tThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
5 N/ y# [% j# O9 Q4 g6 @3 E* M* O0 mperformed in ring0 (VxD or a ring3 app using the VxdCall)., F1 w/ w, N. R
The Get_DDB service is used to determine whether or not a VxD is installed9 z$ v5 i! l& I5 U* L  H1 S
for the specified device and returns a Device Description Block (in ecx) for
, O% Z% M# g* h; j1 Qthat device if it is installed.
& D' Z9 C2 [. e  H* V5 f. S
; p0 t! V* [# P7 M   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 d" D) y4 k, H7 ^" `
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)! }1 U) B% T8 F) Y
   VMMCall Get_DDB
, J0 B) ~% f% q   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 @0 H( Z- N( m1 [4 \6 y

$ h% O* l& E9 A4 r, j* O" j: INote as well that you can easily detect this method with SoftICE:
/ H- _+ R  `7 h' n2 z   bpx Get_DDB if ax==0202 || ax==7a5fh
& S, G1 i, f1 {! k, {' e( o# c
7 _% |% y4 n7 E, M__________________________________________________________________________% q+ [  K2 q& @. h5 `
5 _7 W9 _: p  @+ v$ t
Method 10" K9 H; {# I/ U! z( |8 @' J0 k
=========
/ E- A( ]: z" ~. ^& e- Z/ r: D% b
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ Z* W% C+ M7 v  L1 m, t  SoftICE while the option is enable!!
8 H' Q6 h+ \3 L. ~& f9 k: A, N/ X- L
This trick is very efficient:
: j/ p* s$ {3 k/ h0 g3 Tby checking the Debug Registers, you can detect if SoftICE is loaded+ i& `2 G/ `2 w" |& c
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
6 v2 y  D8 S3 c& P2 Q" H  Sthere are some memory breakpoints set (dr0 to dr3) simply by reading their
$ v  r+ y* @5 w+ |value (in ring0 only). Values can be manipulated and or changed as well- m4 ~  h$ a3 Z
(clearing BPMs for instance)
3 }+ E) H. C! N, a0 V$ f. n( w' M8 A! c5 J6 a* s2 E9 ~
__________________________________________________________________________8 }3 |8 h7 X$ B# n* r% r7 I4 i

- K& A+ A# M; \+ C5 m: m" H* i  aMethod 117 u1 G  }. |% U7 {: U
=========. y. f: s8 Q( N2 z. C6 `7 G# H" _

- \8 f6 @: x! ~% c& [8 cThis method is most known as 'MeltICE' because it has been freely distributed* f# b0 w) e  C
via www.winfiles.com. However it was first used by NuMega people to allow5 K9 a$ D/ K9 H& _
Symbol Loader to check if SoftICE was active or not (the code is located" h, A9 H7 w9 N( E% B& o
inside nmtrans.dll).( g) O, [, m- \
8 l8 e9 ]$ h  Z1 p5 @
The way it works is very simple:3 _! c1 r0 j' i, i8 \* r6 Y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 q4 D2 C  g9 VWinNT) with the CreateFileA API.5 k: o: h. d2 B) H: Q0 w
/ l( R, B4 j* {( A9 X1 G3 G
Here is a sample (checking for 'SICE'):! M* Q( ~- p! A9 i
& z1 f  ~. r4 E' s; D0 @& A
BOOL IsSoftIce95Loaded()# ^( \4 q% e% V1 r6 a& G2 _
{
- N5 @* B- F& p6 t# Y   HANDLE hFile;  
& Z/ b4 C9 a2 F. t# U   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* \) F+ V6 d8 S# r' v
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 @$ v( C7 [0 w4 z                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; X4 @6 f8 R+ E% Q% V   if( hFile != INVALID_HANDLE_VALUE )
/ f* R* [& J, D* u. O& \   {
# t) i% {1 S" {: `( _      CloseHandle(hFile);7 o, ]! |7 [2 x5 q$ [* {/ ?8 M2 J
      return TRUE;
5 R7 ~$ o  B8 T   }+ E3 l3 c$ `7 }% K1 m
   return FALSE;: t, O: M1 d, P/ D9 e( I0 r( h) c( j
}& T; z7 h# V: _' }: t! s
+ L) ?! ]! J, O: S% B2 X0 x; h; I
Although this trick calls the CreateFileA function, don't even expect to be7 i: O1 R9 r3 P- \0 C2 k$ p! S
able to intercept it by installing a IFS hook: it will not work, no way!/ w5 B+ z; v1 V+ W% \
In fact, after the call to CreateFileA it will get through VWIN32 0x001F% \# ]: X4 {' ?$ `; L% s# a
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
% a! _' \9 Y8 f" Q' F9 ?8 J' h4 y0 wand then browse the DDB list until it find the VxD and its DDB_Control_Proc! i% O( z% r4 G0 v! g; d
field.- W: R& j4 [1 h# e
In fact, its purpose is not to load/unload VxDs but only to send a 9 x2 C* O% n1 z& S! O. t1 ~
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' u% P6 p0 f$ U" }; z6 `to the VxD Control_Dispatch proc (how the hell a shareware soft could try! M$ ~- g, X4 `; Z9 ~( i
to load/unload a non-dynamically loadable driver such as SoftICE ;-).- e  K/ O; r3 L
If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 l$ V! w# P! j; l( @0 z; ?its handle to be opened and then, will be detected.
  y: J3 B2 u2 f: eYou can check that simply by hooking Winice.exe control proc entry point
5 k6 e- h  }' ~4 n6 Swhile running MeltICE.
' ~. }2 w/ d! ^2 V* H$ h2 l* z4 h! Q+ U6 j( U

0 C. E6 O3 S; g! ]* F! J  00401067:  push      00402025    ; \\.\SICE
. y: i+ ]( O7 b5 A7 P$ b9 W- d' _  0040106C:  call      CreateFileA
4 T/ ~9 [; y" x# q- |  00401071:  cmp       eax,-001" E# s, F# |& t5 ?3 }
  00401074:  je        00401091# n; R: G6 }9 M% E. x. |  k$ G

+ s  B, L; L3 E2 m& z/ d
% c$ \# a( D1 B7 q4 f6 BThere could be hundreds of BPX you could use to detect this trick.
( L" D  i1 h. F& F2 d; l- {-The most classical one is:" c9 S+ q! K5 j% D& a' ^
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ c% K' W% L' ?  ]    *(esp-&gt;4+4)=='NTIC', n6 j, r/ z  X! @, U! k$ k; B+ n9 E2 N

! i0 _+ u" a4 F8 Y* F-The most exotic ones (could be very slooooow :-(* ?# q+ D/ h+ J4 I' B- j4 \
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 N* I' p% r2 A! p4 H, {     ;will break 3 times :-(5 Q0 l# W" N9 P( s8 `) s& o0 \2 m6 h

0 J: i6 b* N; p& Y0 |-or (a bit) faster: 6 n2 t2 \- i6 z- j$ u: S4 w
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). Q4 \- F! `* M: W& s% l2 {
' n# v' C4 f4 G+ P" @: D' o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 v% ^9 Q, d2 s: n, K8 t
     ;will break 3 times :-(3 h. s2 s3 R0 s
1 C! Y6 a' d4 S, \
-Much faster:
! r* X# p1 n5 s. x* {8 d* D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ w" i* g( W% L" [9 e
' g- ^' _, o: b1 xNote also that some programs (like AZPR3.00) use de old 16-bit _lopen; O" b; z4 b& s# k; M
function to do the same job:
1 C( J( R0 D2 W2 i  x% o6 J8 x9 _1 T- e; E* s0 @
   push    00                        ; OF_READ9 \5 o4 L2 p+ C! R9 _! [
   mov     eax,[00656634]            ; '\\.\SICE',0) @( p" q% w1 Q3 Q( T
   push    eax/ ^" r% D: U. k3 a
   call    KERNEL32!_lopen& j; k# I4 |# R& z
   inc     eax
& }/ \% @1 a6 b7 V  ^   jnz     00650589                  ; detected
% O0 ^0 e' V( ?$ M! q% U! Z: q. `   push    00                        ; OF_READ8 Y7 u# o4 {* f  F1 W6 O
   mov     eax,[00656638]            ; '\\.\SICE'
# h4 ]5 Z. x* |+ P   push    eax
/ E+ {' L* x% a" f# M+ G   call    KERNEL32!_lopen
. B, _: {, i7 L* h   inc     eax
0 \) w5 U8 q6 g+ q0 ^- ?   jz      006505ae                  ; not detected
( c# J& T0 O. M4 O: ~8 P% Q9 H" [5 `
$ B! G- j1 ^0 @# d, B5 M- d
__________________________________________________________________________7 \4 }9 E' o0 h$ i

1 L) e1 o0 m; A2 t) ZMethod 12
+ @0 N8 @$ X/ ?8 D4 a=========
6 W5 b' z4 L" l5 H' v; I0 d* W% {+ B4 ?3 q  y
This trick is similar to int41h/4fh Debugger installation check (code 05/ s4 D+ T/ I, N0 F+ j  }! A
&amp; 06) but very limited because it's only available for Win95/98 (not NT); J1 T. m. \! v$ j! n6 v, Q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 l% b9 j1 _, A) ]
. V2 h  i$ e7 Z% w
   push  0000004fh         ; function 4fh
# Q( ^& r1 G) Z1 S   push  002a002ah         ; high word specifies which VxD (VWIN32)& v5 l, w& z5 s- ?/ s3 N5 L
                           ; low word specifies which service
4 D, w9 @. P; b8 P+ r4 d/ y                             (VWIN32_Int41Dispatch); e! W. K1 u8 r0 F! F8 O
   call  Kernel32!ORD_001  ; VxdCall8 e0 ^& q9 l" n
   cmp   ax, 0f386h        ; magic number returned by system debuggers  n9 o& n+ p$ p
   jz    SoftICE_detected
4 [4 E# R. ?$ f$ e8 ~2 Z: a3 x$ R* c- D
Here again, several ways to detect it:0 y. V2 \. P) E- Y$ i" }/ ]
4 S' Z+ y) L, \( F% `9 `8 T2 j" z
    BPINT 41 if ax==4f
3 @, y+ J8 [7 u3 ~3 R6 e
7 T* M- \+ ], R7 h/ q; F8 l0 n( b    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! `2 M+ S' P6 V5 t) ~
) U. ^1 W8 g" Z; P' K$ [    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 ~, k: P& R7 Q  ]2 m) w2 f

# k& r' Q, I& ~+ ?    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ g% G4 n- A- \4 d
& U) y6 e% N( L  \
__________________________________________________________________________0 D/ b- k! I# u8 v- @; n3 k

6 Q6 R6 ~4 i9 e" H  v) ~Method 138 C: p" m9 d/ G
=========2 S5 T  X! R. M" s9 Y
, H8 f" o6 _" Z$ ]
Not a real method of detection, but a good way to know if SoftICE is# L6 {  B+ B- Z
installed on a computer and to locate its installation directory.1 A5 n, q: q; e" b+ a1 J; s0 |
It is used by few softs which access the following registry keys (usually #2) :: B3 @" w4 H/ `3 {- h% a$ _5 `+ j
9 T" S$ F) a  r2 p
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 O2 D5 Q% c7 J; \* D2 ]
\Uninstall\SoftICE3 a! O4 I- P: P' Q5 Y5 y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* t' B/ ^1 C! E  Z1 ^3 ]
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' P+ Y- V# y9 P$ R# ^\App Paths\Loader32.Exe/ S' B" u2 K+ r' }2 a+ k/ b
7 P/ G; D8 c; P2 ^1 v- `0 c
( H  a/ B7 V, u  W& _
Note that some nasty apps could then erase all files from SoftICE directory" e+ h* s' H) l8 F' @
(I faced that once :-(* z. u1 b; t6 _2 t+ L
2 C) k" J  L2 S  b
Useful breakpoint to detect it:. x0 o8 S; w9 r- w; _$ L

- [& I  D# Z0 H! Q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
( c7 g" [  N* y2 x% R: k& Y& k- i4 h. f# Z
__________________________________________________________________________+ X# L* q4 |" n4 s

' w/ {. F  t  S) V6 G
: X( A$ }; F1 A3 D' @8 q. GMethod 14 6 h' B# N: Q9 Y3 R
=========
; O+ m# }3 Z& n- ^' I
) K8 z" F+ H! gA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
- i; d2 H" W  q" E' T; bis to determines whether a debugger is running on your system (ring0 only).* [4 a# h- n9 S4 q  ^$ @
/ i( x2 x- a: ^% Y
   VMMCall Test_Debug_Installed
/ g, T9 S! L& s+ K. F* L   je      not_installed/ e) _8 l) W$ e5 i

' x1 S3 Y  s0 g, b3 DThis service just checks a flag.& M' A! ^* p$ T6 U
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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