About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 I& E0 H& \& D1 b. L<TBODY>+ K/ d* t* s5 G6 ^4 g" L8 L" B
<TR>9 k' s* [3 _. }: C
<TD><PRE>Method 01 * L. J: w+ @2 [  E
=========
3 A9 M% [/ r5 G$ x2 z. V2 T! \3 K* Y$ h
This method of detection of SoftICE (as well as the following one) is9 s  U* X8 B% I6 Z' V
used by the majority of packers/encryptors found on Internet.
: D- r! t/ s1 I8 aIt seeks the signature of BoundsChecker in SoftICE
8 E# Q. j; c: ]2 J/ `" ], m  U2 ?% f9 o
    mov     ebp, 04243484Bh        ; 'BCHK'
" ^1 H8 D6 e4 a2 S3 U2 ^    mov     ax, 04h, Y+ v; j  P  a0 d+ H
    int     3      
  A5 i( e: a! k9 A8 x    cmp     al,4! [! z6 Y2 y# c4 r  c3 t
    jnz     SoftICE_Detected
8 c& o( p1 i% W0 ^
8 Y) ~. \7 }0 S- O% T" e& N9 {___________________________________________________________________________
2 n- Y% K6 K) c2 H; F- Z
; e" c  q% ]% q1 h: s* I" uMethod 02. m3 Z2 B- d+ }/ x
=========
4 D  H* h- f' n
( \- S2 R9 u, Y' Z$ v6 JStill a method very much used (perhaps the most frequent one).  It is used8 t3 m/ O) \: X9 w9 M
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
. [# ]- Q2 c, v1 m; _: N) x; Zor execute SoftICE commands...! {3 ]' m( h8 v) j3 x; e- U' y
It is also used to crash SoftICE and to force it to execute any commands
' _0 ^1 e5 n* f; Q(HBOOT...) :-((  ; q8 l! v! \# N3 Y0 @' b1 f
6 H; ~% z# J: B! L' O
Here is a quick description:
2 W6 U& @2 b( U6 N1 `( ^-AX = 0910h   (Display string in SIce windows)
2 A3 \0 v: Z3 u8 S) z0 u: ]8 a-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  q1 v6 L; g2 ^: f/ k7 O-AX = 0912h   (Get breakpoint infos)
8 U2 ?7 I2 j$ K( c9 v4 N-AX = 0913h   (Set Sice breakpoints)
6 M4 P4 W* k1 R* B! z1 T-AX = 0914h   (Remove SIce breakoints)' b) q+ i- m; O1 y2 N
2 n  W" R( I! p- j  i/ {8 n
Each time you'll meet this trick, you'll see:
0 V+ y7 C; e3 s& e( G-SI = 4647h3 {- b4 ]( U4 _! J$ [
-DI = 4A4Dh$ o% M" O9 p) B8 J( O9 Z2 l- B" I$ _7 G
Which are the 'magic values' used by SoftIce.
( b: n3 Q$ ?- u( hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 d, w6 P0 z! s6 J8 ^/ c. [) a' @7 _9 E- e6 ~6 V! ]
Here is one example from the file "Haspinst.exe" which is the dongle HASP) ?: O! T. W) k: p; f
Envelope utility use to protect DOS applications:5 d+ E% a0 c# \, R, n
. M3 A! `( o4 t( Y' l7 A5 z
9 v* c7 h! j6 T% F4 Y8 S. K
4C19:0095   MOV    AX,0911  ; execute command.$ _) a, }* C. ~* ~) N# n2 }
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) |" D8 }0 Q3 z7 N, |* J# N
4C19:009A   MOV    SI,4647  ; 1st magic value." I7 X" L7 R5 L( T% ^
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ d, s; b& }! f4 e& z! G9 E4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
2 W* j6 c) _7 Q) W! ?7 u4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" Q- m# V3 g% r% D( d( J4C19:00A4   INC    CX
" N6 {( J& e4 F, V5 B4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# Y2 V0 d( c4 _, y$ u, I4C19:00A8   JB     0095     ; 6 different commands.
; u8 o7 T0 H( g3 n% y7 I4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 m6 |; d3 {- ]9 v, D. \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 a) P0 @! f% z$ g8 d+ G8 ?3 t4 G, O
1 T9 E7 E4 l. c- G5 S0 T
The program will execute 6 different SIce commands located at ds:dx, which
, E3 V, e9 o+ B. K! Z- e- @0 zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 |+ k% R! R% a. ~% i! N& ]" @8 ~1 a% d& t2 a7 a, W/ E
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." d+ e1 N, ^& c
___________________________________________________________________________
. q2 D5 n" |/ U0 E% ~7 E4 ]& Z+ F8 t% X5 {8 O$ h  ~3 D
9 N8 G2 ], r7 T8 j4 Q6 }
Method 03( u$ A0 o( Q$ {" e. }3 G$ U7 Y
=========& z9 D8 z# f8 J7 D6 N8 ?: g4 h) M

2 P1 {; V, z0 b; E8 `% ?Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
" T9 h2 ~& {& E- V% B( a+ N(API Get entry point)( X" \; T6 X+ |+ D% o; `
        
/ f2 U% @+ O4 F8 B" T" S! E/ @' |& \
    xor     di,di
# ~& D( O3 Y- ~    mov     es,di, e2 j/ i- p8 p4 ~1 D! b
    mov     ax, 1684h       5 l! I! v2 j" K- m
    mov     bx, 0202h       ; VxD ID of winice
% h8 p9 ^' V/ t/ {    int     2Fh6 U2 O" Y$ z# B, ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 [2 Z; r8 l; g1 R( j  |    add     ax, di
4 e( x# q! b2 y* J9 I( [0 @    test    ax,ax  f: w% E3 ^4 ^% ^0 z( L
    jnz     SoftICE_Detected5 |6 a/ h" ^$ L. M" O0 r
# x0 y/ t9 j$ E' Z" c. C: p! [
___________________________________________________________________________+ q1 {' M# V0 C
* b! H' O! U' v5 y0 b7 e  G
Method 04' h6 ~% q' {% z
=========" [2 T- K% r: z9 u0 b  L

  n- s/ q- A% d& V: c( g8 A$ ]Method identical to the preceding one except that it seeks the ID of SoftICE3 m7 ]$ @3 [- U  M
GFX VxD.) e' e' d' u/ g$ P0 K$ E$ k" a

, g+ u2 b; q0 X2 Q    xor     di,di. @0 L, d; Z0 |. K  K2 T, H
    mov     es,di, d) `9 _' G/ X
    mov     ax, 1684h       3 Z- B% t( U2 E
    mov     bx, 7a5Fh       ; VxD ID of SIWVID. V/ w: p3 i7 o- l9 o, p1 n9 a
    int     2fh
* u& p, A& c: j% K1 q, ]    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 f1 _/ d' ~: w/ d$ O" f
    add     ax, di
& s4 {; O3 S. V! }7 u+ Z: _3 a0 J' A    test    ax,ax* r6 N9 c. |7 h2 O; U
    jnz     SoftICE_Detected0 C& L& |5 }3 g# ^9 l6 d  v
5 Y. R" g  b0 V$ n. j: t; h( \
__________________________________________________________________________
, R+ H# T" T2 Y9 C9 a# J" R7 H$ d  \0 L
* ^% W' t4 w" N' p2 l" t1 l3 t
Method 05
8 K: F" q  O* N8 g=========- g% t7 V8 d2 m+ R3 Q" e  t

# y% h* Y) n: YMethod seeking the 'magic number' 0F386h returned (in ax) by all system
% |" F# [% \! H4 \, c/ ]7 L& ldebugger. It calls the int 41h, function 4Fh.
, k3 ?; {$ m. hThere are several alternatives.  
9 W! J8 ]5 M) c! S  \8 u3 m/ a* W" [+ `
The following one is the simplest:
0 u6 d1 R- I5 i# o5 n
, {- E9 m7 V2 G' l/ l! x0 v: P    mov     ax,4fh
* U; g/ O7 M& a- [6 C& h9 ^    int     41h1 `" k# l& l4 _- T( D& s; S" M  N+ T
    cmp     ax, 0F3861 F. _+ J6 e9 l2 O
    jz      SoftICE_detected
  [! d4 ?  V- `4 M6 I3 p
( Q, n+ k* b! y9 \4 V8 z! ]! B+ \2 ^  d, Z9 N# T$ Q# |' x
Next method as well as the following one are 2 examples from Stone's
1 r0 C6 l! i  q; w! C  P"stn-wid.zip" (www.cracking.net):7 H; t7 V4 h0 M

# M& o: a8 s1 D2 g) w+ U9 x9 }) @    mov     bx, cs
1 Q# B8 t) s  \; H9 c    lea     dx, int41handler2
1 J  h3 h* Y6 O5 T7 G    xchg    dx, es:[41h*4]: B1 i& Q/ h. N8 L. z; d
    xchg    bx, es:[41h*4+2]  g) A' p& p- x* x
    mov     ax,4fh
3 ]/ S- P5 l+ ~    int     41h
3 }. L( I, t; O. o* F0 S    xchg    dx, es:[41h*4]
' c' y& r( b4 i    xchg    bx, es:[41h*4+2]
1 j1 t. \  W9 i/ D0 P. B1 t9 \+ v    cmp     ax, 0f386h+ r% k7 W9 s9 p3 O, ^6 ?0 c
    jz      SoftICE_detected/ A* K$ x* L$ P* w- D
: q2 p) s, l( F3 e
int41handler2 PROC
$ G* J* `$ q; P! p    iret( `9 E' d" l  j+ K7 l
int41handler2 ENDP
# P9 h. E9 U2 M
7 Z( M$ T  o" Q# E) u& \; \0 J- l; |& e; u" h7 `
_________________________________________________________________________& a0 C, ^) e- c0 d% @1 b
4 ^) j6 p8 M0 a( w2 R
9 ^  ?1 i+ _4 T. }
Method 06
2 f; V( M6 G/ J; A5 k  t. s, D* v' |=========
. n1 Y7 K$ O* y- h2 E% Y8 r
2 C1 S7 [: ~0 N! `+ [6 x5 N
  n" r9 x. c" n% |6 J, y* y. X/ d, z0 w2nd method similar to the preceding one but more difficult to detect:
. v2 n4 q2 Z/ S% D+ z, e* S5 t; x! T' ?, O, T
* Z. e# O1 C2 T" j! O
int41handler PROC6 x( k5 a# I, t
    mov     cl,al
0 S/ @, H0 L7 j% {: F    iret
1 h9 F  Z( r& D- q1 Dint41handler ENDP- p% W' _5 D) K7 a  x

9 _( H2 s. L) b4 a* K, `
( b; |7 j1 z- J7 L* ]0 V    xor     ax,ax3 L2 c0 g8 \# q' y  c
    mov     es,ax$ k. O# u3 h( t( @3 X% O( g
    mov     bx, cs' X6 \; k/ Y, C) g
    lea     dx, int41handler/ c4 Q; b3 p# t7 w* P& \2 o" T+ j5 Y
    xchg    dx, es:[41h*4]
, N3 y8 e2 ~! U$ R! k    xchg    bx, es:[41h*4+2]
" B, ^9 `0 o* l/ ~: B    in      al, 40h$ Q0 z  _9 U* @- [7 F+ e0 {- d4 p
    xor     cx,cx
1 R/ D# r- i# h3 d+ w/ Q# S- f1 b6 H( Z    int     41h
  P! m6 q) T, w+ `5 W    xchg    dx, es:[41h*4]
3 N6 q9 s& J( J4 e$ {" u    xchg    bx, es:[41h*4+2], E3 X; W) e" U: [- C( Q
    cmp     cl,al
  ]/ {2 L& v' [: [5 S    jnz     SoftICE_detected
9 m5 J1 M& s0 |7 P' A% b$ F" y5 \0 W) q8 O- e& \* E, d
_________________________________________________________________________
5 L6 P% n' ^! Z
  F- r0 ?. V; p! Y% lMethod 07
' Z+ B$ c) D% L! f8 F" Y" a) o=========
3 X1 c+ w& u) Q- m4 ^& A2 M  ^0 f0 h; d5 I1 d9 Y8 Y  ^+ J
Method of detection of the WinICE handler in the int68h (V86)
7 R4 t9 T3 t' a1 k1 U% C; I5 _1 V! R3 y  X
    mov     ah,43h
) z0 `/ ]9 p) N' m5 q    int     68h, K/ x! p( j" e5 ^& W+ S7 w
    cmp     ax,0F386h
0 }3 @: x; e9 a3 U$ g5 ?$ {% x    jz      SoftICE_Detected
( B# q- V: w5 x. s$ h1 x5 e; l) G0 h# C% d/ s; J1 y

# @2 b7 c. l1 N4 _. K. ?=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 L) |( H( Y# Z
   app like this:' i$ h& _; `  s+ X0 G

9 |0 t7 T# Z7 q/ P; J   BPX exec_int if ax==68
5 d5 ?4 \  w; e7 {   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 W5 T$ F# k  v+ x" Y; I   located at [ebp+48h] for 32Bit apps)* C2 }; ~7 Q; v, w
__________________________________________________________________________$ z0 d6 N$ E. }% M& ?, e$ C
: q( D8 S! M# ?# F. U' b
. w, C  D* C1 |- Z. Y
Method 08
9 U. {( u% o1 W5 f' V5 }) U& W( t, V=========
% Y1 K* J8 x1 W8 u7 Z4 s% {2 e0 d% ~. j2 f0 ^6 V$ L; Y: q
It is not a method of detection of SoftICE but a possibility to crash the6 l% Z, a* Q' l7 a
system by intercepting int 01h and int 03h and redirecting them to another
/ h0 ?, c: u( ^* R" Mroutine.% b7 e- V2 y& o! {, ?
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ l. ^! i0 r; G  A: m
to the new routine to execute (hangs computer...)
2 R! e" I, v& a1 {* V( x% k% t* {  Z* _3 Z: [/ K
    mov     ah, 25h  ~2 e$ [/ ?! ~: p. \3 ~; B; T* L8 P
    mov     al, Int_Number (01h or 03h)- K8 x5 a- r! W: b% {1 C3 A. z
    mov     dx, offset New_Int_Routine* c; r+ c. d. p* W3 G7 A( ^' I
    int     21h* X* j& d- o3 ]! c% }. j. c

& @2 z1 }* @. O) F__________________________________________________________________________4 ^: g: M2 `$ |
/ u6 V4 W% G* R* \' p
Method 09' Z% l2 M6 T% g. |! _9 ]
=========
2 O# R+ Z: k. @1 e$ _2 ?) G( [' ?4 C4 S: _$ w, F2 L: W) P& A2 m% Z  q3 w4 ?* `
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 t: U) j+ ]* w
performed in ring0 (VxD or a ring3 app using the VxdCall).
' f3 J  q% J' H1 X+ d' F, qThe Get_DDB service is used to determine whether or not a VxD is installed
) q( t! m0 r# j4 z4 Q6 P7 b1 Rfor the specified device and returns a Device Description Block (in ecx) for; J4 H* m. R0 g2 d8 p7 J
that device if it is installed.
5 f8 J" }+ ^; h& G- [
0 A+ b4 T7 O& P7 J   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# L+ N% x1 d& f( T   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 {% h1 l. X2 i3 y! h
   VMMCall Get_DDB$ E  q" }( ]9 }# \( f
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. P) f* E/ o2 W$ }8 }  J( F
& n' T3 t0 @7 I9 T+ n  c; D
Note as well that you can easily detect this method with SoftICE:
  l4 b; U9 [2 X9 k5 h   bpx Get_DDB if ax==0202 || ax==7a5fh, S0 q! C4 f+ M/ w& H+ B3 [& s
4 }- J+ o  b/ _- L/ l  B
__________________________________________________________________________* S" c* i  Z5 K) y$ ?: G

' c) w# l) v* zMethod 10
. N7 i2 b( u! H1 C5 v=========4 L' `( {; V7 N, H

& }  p' @3 V. I! ]7 s; i=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 s+ ^: Z. d! x: Y/ f# C
  SoftICE while the option is enable!!
% J5 E; K0 H8 ]3 G4 k* w4 o& p
; J9 O, T( z( _& `( ]$ a9 d3 pThis trick is very efficient:
* i4 s* g& m# {# B" \  Xby checking the Debug Registers, you can detect if SoftICE is loaded4 W2 B" d. i2 b7 C
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. b9 e' r  z8 c8 N6 ^# C  {% \there are some memory breakpoints set (dr0 to dr3) simply by reading their+ H6 q7 v3 B0 V/ X+ g2 M3 }
value (in ring0 only). Values can be manipulated and or changed as well6 p6 `! r6 w5 h4 m! n# U/ k5 H
(clearing BPMs for instance)) u1 g9 ~2 c9 o$ k4 ~4 [/ E, Y
5 L7 o" K  f$ L" o" b
__________________________________________________________________________
6 o6 X) i3 Z& R8 d9 \4 p, d
. P0 O: y9 U+ i8 ~Method 114 k/ B" F& r1 Z; F% B
=========7 @+ i" ^7 O: t: V' G

5 t! l) R4 \' qThis method is most known as 'MeltICE' because it has been freely distributed' ?  \% T! W( l
via www.winfiles.com. However it was first used by NuMega people to allow% A0 U$ n* n  r+ f5 |- u7 n
Symbol Loader to check if SoftICE was active or not (the code is located/ q/ s4 |+ q. Y7 _1 c* p3 {' m% y
inside nmtrans.dll).
' S) u* |' ^" S  y* u- W
6 ^; x2 d/ [* f* q( f7 [8 lThe way it works is very simple:
2 c$ a' g( L8 N  o3 MIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 X+ R1 O: X1 C+ I; Z0 Y
WinNT) with the CreateFileA API.
5 m  `( J" D5 _- [$ t1 x7 f
7 r+ s/ Q% T3 X# O$ HHere is a sample (checking for 'SICE'):
# q# G* X+ u8 K' X, _, z/ d) K" m1 h4 Y
BOOL IsSoftIce95Loaded()# _* p# C# B! p, Z- K& N9 `, V
{4 Z9 L: O8 M$ \; h* P9 Q" l
   HANDLE hFile;  
/ u& o" l1 ~+ n; _/ W* T   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,2 _0 ?& k- @& e- o! t3 N
                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 [: Y9 O& |" X+ P
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( F" g4 e. Y- T" y( B
   if( hFile != INVALID_HANDLE_VALUE )# |4 G1 t9 B/ t; R' N
   {
, G$ `; _; x3 T& `1 d2 o* a% u4 [      CloseHandle(hFile);4 P/ {, E* k: S% c& |# q; E9 c8 z; ^
      return TRUE;
) q2 V; y7 _1 L2 {& Q2 E; a   }
$ j; u# D& z! x$ x: B   return FALSE;0 }$ S* }# b7 ]4 c, n/ d1 f
}" d" z) n* d0 ~+ \/ B) R) h. U; J
. z* S3 o. Y! T0 o% l; J( D
Although this trick calls the CreateFileA function, don't even expect to be
) }6 E  @6 l" f) \- H* g8 `able to intercept it by installing a IFS hook: it will not work, no way!6 G1 X7 Y* e% s7 m$ @; B
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
) |; A7 o5 `$ i9 v) w% c0 S. ?* Nservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 }$ C7 O% F3 U$ B5 h9 X  f+ Sand then browse the DDB list until it find the VxD and its DDB_Control_Proc0 X& }! i+ Y4 ?0 u# @' G
field.
5 G$ ~# w! T0 _In fact, its purpose is not to load/unload VxDs but only to send a
* F+ M- |7 B& X: b! {3 Q! H8 H! |W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 h8 n2 c' t1 K
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
9 x3 X2 |( O$ T; sto load/unload a non-dynamically loadable driver such as SoftICE ;-).3 }, l- p6 q+ v7 v! W9 ?8 m7 E  ]4 p  |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
, Q# C1 k0 y' S1 i) _its handle to be opened and then, will be detected.
' r0 ?" o% m: l; W: jYou can check that simply by hooking Winice.exe control proc entry point7 _5 m" ^) ]+ j* j/ Z
while running MeltICE.7 ?% B1 e1 I" J) h7 j0 q9 w
9 a- z; u; c- [1 ?
# F  k9 _7 K2 }& I0 G
  00401067:  push      00402025    ; \\.\SICE; Q( O: L* D, _" J! ?3 I
  0040106C:  call      CreateFileA; R+ l1 Z3 n  B  N3 o
  00401071:  cmp       eax,-001  U  U. i9 f4 D5 {: ?
  00401074:  je        00401091
' }! _0 Y7 {$ f5 ~% B2 n/ s; X+ W% @( h, V
! Z0 z5 v, x, F: @
There could be hundreds of BPX you could use to detect this trick.0 K, F9 d/ T* P( U
-The most classical one is:
/ w8 ]0 ?5 ~) ~$ X1 Y1 x  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 M. [7 s3 d& @$ r8 Y
    *(esp-&gt;4+4)=='NTIC'
1 A* p; r4 k0 l
3 |! i! ^+ W2 J% M! I+ f7 T' F-The most exotic ones (could be very slooooow :-(
5 p& J2 V* \# ]   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; R0 [6 w5 k; d' A& h
     ;will break 3 times :-(4 z8 s$ t! A6 b% k9 ~, T
( |& q% x7 v- `
-or (a bit) faster:
/ ~  y1 Y8 ~8 V2 ?6 p1 F, U! y   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- q$ K6 N! z) ?8 E, a* W+ A: N2 l
' s  R" q. H9 h2 b" M   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% {1 u2 c- @! o4 v) y! {     ;will break 3 times :-(
' _6 C7 O6 O- I* Z* U1 e% r) w" q
/ a8 Q* K5 q5 n/ m. ^+ v-Much faster:+ l( x- b0 _1 z  K) C9 y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 _, P+ B5 y# ^  r/ X* K
% l' @7 L' B  L3 U% [
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 C  V3 e. g0 C) w9 |# Vfunction to do the same job:6 C. V9 X! \/ E8 W+ }
' S: {2 }  X. P: G5 k& x
   push    00                        ; OF_READ9 x2 `, h( D! }
   mov     eax,[00656634]            ; '\\.\SICE',0$ S' q% d7 O! g/ p
   push    eax
6 m& r7 Y6 j, v3 O1 f+ Z   call    KERNEL32!_lopen7 y/ h2 ?! \" m0 _0 N
   inc     eax
. n0 O9 E! U5 M  f2 k   jnz     00650589                  ; detected0 o: M( W* I+ N& C2 c0 \- `
   push    00                        ; OF_READ# ^7 t8 Q* S' D1 `2 Y7 E3 K
   mov     eax,[00656638]            ; '\\.\SICE'1 p% W, c! D1 ]- {' o
   push    eax6 L- d- l; S8 W. S
   call    KERNEL32!_lopen
* S# f$ h+ ]% a5 [5 G6 H   inc     eax# g: W2 d" X# F; V6 z
   jz      006505ae                  ; not detected# T1 Y, |+ M9 x* X8 g
8 I! F3 ~2 }$ e& w/ A+ N  o

. h8 _- \5 ], _! \! J__________________________________________________________________________
, ^4 ]5 y' j2 C( p2 j% b6 n; m# {! i0 }8 Z
Method 122 \  V% D. k" q. o6 |  v) D
=========+ E' R5 C. G; i
" k, J+ x) i$ O6 i
This trick is similar to int41h/4fh Debugger installation check (code 05
. N; @) k1 [% b7 E3 X&amp; 06) but very limited because it's only available for Win95/98 (not NT), E' c9 V. p# D5 {# |6 L
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
% B  R2 {6 E1 k" S- N% b( _
- P4 R, e( S" m. x. _   push  0000004fh         ; function 4fh
) v. ^2 V! @7 p2 i   push  002a002ah         ; high word specifies which VxD (VWIN32)5 q7 f4 l$ |' M) T0 o" |1 ?
                           ; low word specifies which service
5 j7 a" l, z8 J" O9 {; o- C7 t( z                             (VWIN32_Int41Dispatch): A& c/ \, v0 q$ m
   call  Kernel32!ORD_001  ; VxdCall: m. t4 e7 w' F+ r4 ~6 A+ G6 g0 S
   cmp   ax, 0f386h        ; magic number returned by system debuggers
: R! {7 w( n+ r# G. d   jz    SoftICE_detected/ ?9 c0 ~/ f$ t& Z8 c
0 G* p: A% n9 K% ^: V7 w0 V! e4 _
Here again, several ways to detect it:, b9 a# U6 |4 Q- c* q
/ H- i4 \% L& g) Z
    BPINT 41 if ax==4f# ]0 j8 W( y0 y

4 G2 S) k3 I( u3 U+ C3 N    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 ]( K1 U- @5 C+ Y# {0 n% M0 g7 \4 H* _: |  M5 ?
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 G  i1 D' O9 z  D  M- a2 ?. ^+ [4 q- {3 u) _  d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  u7 U/ L0 y1 L$ }- O& y) l
  B' Q, ?$ S! J$ F1 m
__________________________________________________________________________
7 q3 ?( [- y7 u% m
* O1 m- c4 _0 {Method 13, `% Z' F0 h! ]7 o- X; T
=========9 [( o9 r# S9 E" Y) w. A6 S

" A4 R; k2 Y) Z6 m9 x9 UNot a real method of detection, but a good way to know if SoftICE is
% E* R( h6 ?; a" ~* Xinstalled on a computer and to locate its installation directory.' A6 q- }3 u; M! H9 C% z0 P
It is used by few softs which access the following registry keys (usually #2) :, b/ r' l* D7 r4 e% c  s- o# @, g

; x) \* v: T" K! `; I8 s% l-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& l' ]9 @) @3 z8 N& D* ~3 W3 C) |0 {\Uninstall\SoftICE: }4 d% l# E1 h4 H9 K, |1 K
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% E# \+ _% p2 e2 m5 H
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  C# y* M3 ^) Q\App Paths\Loader32.Exe
$ L' _: ]9 q$ \7 T. B9 E
6 A* e5 h& c1 k( n4 w- L
6 z6 g6 u! w- T0 [  _" ONote that some nasty apps could then erase all files from SoftICE directory; ]; l4 a8 y8 R/ T% }
(I faced that once :-(1 w9 F) Z" ^5 A, s4 }  W/ B

5 D2 K+ W/ E) l6 d5 FUseful breakpoint to detect it:  g  G' r! O5 [2 b: i: q; U& i

/ I) Y7 K2 J! j4 N$ L0 s" Z: O     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. P2 B5 I4 D% g+ V6 x' k. }9 {$ M3 n

. A! m. `9 k  c9 v- v7 j3 a, T__________________________________________________________________________$ `) }# z6 T; e4 R7 j2 h2 f

! a3 ~/ z1 d8 [, N; ~4 O- h7 P# O
" D- W; S* o' X7 l" j) r) `Method 14
/ O9 o' X- f" x+ a; s=========$ q) l4 h, `6 d: d
* n8 o* W% Q# W. g3 V9 [
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose# }; w0 _" n/ u; J+ y) S- H
is to determines whether a debugger is running on your system (ring0 only).
+ [. x9 }0 w: o: t( M7 O4 S+ _) U6 h7 F' r7 k! M3 t% X
   VMMCall Test_Debug_Installed- ?1 R# a0 i, z9 {+ T
   je      not_installed
( [( [0 v, n8 u, l9 ], V5 ?
. @( Z8 }- \% H  t, WThis service just checks a flag.
3 {4 F: @% [' p; h( N</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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