About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) x. e5 {% r5 G% p9 k7 E
<TBODY>" F% j! ~8 u3 \1 N2 g, r2 b. f9 V
<TR>2 H6 b: m9 l7 `  \9 ]  B, E8 J! W0 W
<TD><PRE>Method 01
3 D( e: |0 }" g=========* n/ M, w5 d2 h1 Q, b

: X0 ~' P6 m% G0 NThis method of detection of SoftICE (as well as the following one) is2 t! |% i! A$ }% s) h2 P
used by the majority of packers/encryptors found on Internet., A7 T6 g. |* B* z8 K; m
It seeks the signature of BoundsChecker in SoftICE0 d* ]2 }" I+ a

0 a/ t1 l8 V+ a( x5 D8 c" ~9 D    mov     ebp, 04243484Bh        ; 'BCHK'
  |; _6 [/ `' A0 q% ~4 m6 u    mov     ax, 04h
3 }0 w, W1 Y# w    int     3      
: {- P, f+ b* s% z6 y$ `  [# j. K* n    cmp     al,4. \! A, I  L9 g1 X6 o' o
    jnz     SoftICE_Detected
* ?% [) G" }/ W5 w7 K
% ^4 Q8 s% w; H  t) m! r___________________________________________________________________________
# q% c. B, f. l) ^! y# r
/ c0 e: q' l7 n+ _7 T8 t2 JMethod 02
: C1 \' v9 L  F- s0 `=========# s4 C9 u& |% B; e

/ [( A8 m% T: F1 _$ E: sStill a method very much used (perhaps the most frequent one).  It is used
! S! X8 o% q4 a4 K# fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 I; i8 p; ?& d' F. h/ T5 e4 D6 \or execute SoftICE commands...5 g- F8 {$ L$ M* [2 N
It is also used to crash SoftICE and to force it to execute any commands/ B7 i9 I# z3 X4 I2 y$ n
(HBOOT...) :-((  
0 L" m: w' ^! l; c" n8 F' u. r! C7 K# u* `5 W7 F
Here is a quick description:* [2 `( n- v* C5 u* x8 W
-AX = 0910h   (Display string in SIce windows)
: Y3 k8 M- G" L' N! D- I-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 t* g( s) Z3 A-AX = 0912h   (Get breakpoint infos). e& }) ~7 @5 y1 n% ~* X" j7 a
-AX = 0913h   (Set Sice breakpoints)* H+ j( K- b# u$ a  N
-AX = 0914h   (Remove SIce breakoints), @! c( H; w- O# o# e% \

6 ^1 L9 u) g0 {( TEach time you'll meet this trick, you'll see:( I1 f1 ?& [% w# K
-SI = 4647h* m$ t0 d; m/ U
-DI = 4A4Dh
3 m: E' ?- n# v" \; s; w" fWhich are the 'magic values' used by SoftIce.
  K0 B- {; B- s# X5 V) |For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! ~. i# ~" n2 A  X7 N9 n. ~( I
$ L/ A, R( A# H4 Y+ c) y, SHere is one example from the file "Haspinst.exe" which is the dongle HASP4 j) j/ Y0 n3 b4 ^. y
Envelope utility use to protect DOS applications:
7 `- N' V+ u. S/ N, B, e/ k1 C5 N7 ~  i0 F; U; ]" ^  X
" T2 S8 ]: P) L/ O1 q" X6 U7 y
4C19:0095   MOV    AX,0911  ; execute command.* m+ I& O5 ^. D' d6 l$ W' _/ s
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ p7 ~* i) G; g$ {) h5 O
4C19:009A   MOV    SI,4647  ; 1st magic value.
* C% H# K, U/ l: u4 Q! ^4 H3 t, n3 B4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ c% W' o* L! L5 R3 k8 l
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 w7 v* H1 P5 Y8 v
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ V  B- x' Y* b
4C19:00A4   INC    CX+ O* K9 L6 h$ P) f! p0 }; s
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' J4 m' E" {, U. j; l8 l" \4C19:00A8   JB     0095     ; 6 different commands.1 X) Z1 p8 h: m( L) Y) C/ W1 B) d
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
+ T3 f" t% @8 ~+ G( }4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ y* U# Q1 ^* v( h7 R) x) d
4 `+ |8 g' G( f
The program will execute 6 different SIce commands located at ds:dx, which2 j6 L2 Q2 C+ q( F
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 w( b7 Y3 ]9 ^4 E, A

  K, j' h% X6 K7 @3 g$ H* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 Q, D7 `  v7 _; V& a! ?: v
___________________________________________________________________________# e" e0 `+ f+ X! H6 @7 M* c5 U, R) L

7 i! |$ C. F1 S' I1 C$ P2 ]9 i
0 ?* I8 V- u: B/ g" w  IMethod 03! l! [7 J0 r) i: D) N; f7 j
=========5 b" a& ]7 m" P5 p1 l6 K

3 \. J- M  Z0 tLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  y! z; _# `9 T8 _2 `
(API Get entry point)
  R5 A; T, I0 M; L) ?' c        
) ]+ t9 k: A! Z; h, A
( Y5 ^# F, c' x    xor     di,di
- x7 Y3 s/ a2 c  z3 K! I8 Q    mov     es,di# k# z8 a! @1 g
    mov     ax, 1684h      
8 R- o: f9 d$ e, y& Y    mov     bx, 0202h       ; VxD ID of winice
7 T; ]3 z0 _. c% s    int     2Fh+ j1 y4 ^3 a# T& D4 Y$ B/ N  a; |6 X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ Z, n# h5 }& Y
    add     ax, di
) `$ e3 O) |- C* e. t( |' c5 E    test    ax,ax
, x( T! p' a3 T6 u: o    jnz     SoftICE_Detected0 t6 x5 @% I* f3 Z# @

. |# O' y& h) B) V$ k! j' F, O___________________________________________________________________________$ q  W4 r+ U' F; @. l8 d: U2 W% X& [
% p; M: v. w; ]8 a
Method 04
# V& Y& [+ s7 i7 d5 T7 V=========
: p3 ]  m: Q$ ?1 ^  D
- G# h! @& v+ S9 A) K& |3 `5 P$ a" ?Method identical to the preceding one except that it seeks the ID of SoftICE
6 Z" `+ A7 G- J' l/ gGFX VxD.6 @, ]6 l9 `/ C6 \

' V9 M% j$ n9 T7 F$ _1 c    xor     di,di
3 R! [2 R/ ?3 ~% b    mov     es,di9 a& u5 A/ M2 M8 ~. o5 Z! K
    mov     ax, 1684h      
# U& Z7 [6 t5 h/ O5 _7 B1 j% K    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 Z4 F+ Q" l6 V+ ~" K1 p' V    int     2fh. O: v/ t: j  j- m) i1 \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ C# E* d/ @: _' [
    add     ax, di
$ [3 i) M- U4 j0 o    test    ax,ax6 s3 e" U* \+ l) s! ]& j2 P7 t* y
    jnz     SoftICE_Detected
, G4 K* h9 V! u- Y, [" R, v7 M0 i, \
__________________________________________________________________________$ M  v/ J" }) M. G! p
$ J! E. U1 f3 v

, O4 e5 d# d% }- m. N5 t2 U! fMethod 054 _  a4 G3 r0 L# d9 j5 p
=========9 d9 u& k; i& a& V
8 p5 v. s1 C8 a( U# g
Method seeking the 'magic number' 0F386h returned (in ax) by all system$ @+ B  D, e# x' l7 F0 w
debugger. It calls the int 41h, function 4Fh.  u. `3 N' z# J' b/ X
There are several alternatives.  
9 ?8 d. J% M5 M% x5 b' D/ y: {+ [  a( V" q5 j: e5 \+ m
The following one is the simplest:. ~$ u' B: m: u6 a3 n

# v5 i) l8 @# c/ x9 p" ^    mov     ax,4fh* j. G# M! P0 B6 H
    int     41h! l) g. d( ?  F" [
    cmp     ax, 0F386
3 d9 e( {- P  s1 ^    jz      SoftICE_detected
1 g) C7 I6 w( p/ f; y7 L3 H9 m4 E
& {' }3 k  `/ _6 x; S  g+ `: N/ U9 d( t& T* V
Next method as well as the following one are 2 examples from Stone's
( \2 t; ^9 h# _7 z2 V2 H"stn-wid.zip" (www.cracking.net):
0 d  {, c% J/ T6 W5 O7 {' q; h/ v+ N5 Y/ o# t) }% g
    mov     bx, cs
, u8 p3 K: a0 e. d# K    lea     dx, int41handler2! E7 s2 j. C$ _( K& `9 |$ V
    xchg    dx, es:[41h*4]
% M" s: i/ v( @    xchg    bx, es:[41h*4+2]# N4 e& I2 T! H
    mov     ax,4fh
8 v3 M* m* d  v* G( b    int     41h' u( p, ?* r5 e" T6 Y, f/ `
    xchg    dx, es:[41h*4]
" I- ]- s7 D, j$ K: b    xchg    bx, es:[41h*4+2]' {9 S% _4 a" i; k; H8 ?/ V
    cmp     ax, 0f386h
$ r) _4 f0 H: w    jz      SoftICE_detected. l/ |' Q( U  z0 L0 j6 A# y! o4 c
4 ~; U8 x" p, L5 U
int41handler2 PROC
; o0 q0 ?+ v4 H    iret
; k, |4 i9 A) X9 v$ D" }6 Dint41handler2 ENDP
: y5 }' y: S% G4 q! T4 b; }5 d5 ~/ ^( O5 _5 ]+ `
6 n2 `: n4 `" A$ B- k: E. h
_________________________________________________________________________
* P- s' W/ k6 e) K5 Z' A! l* T& A  o
1 q$ I; K1 ~9 ~& T/ C( N# R( V/ ?4 |
Method 06
9 ~+ Z8 B( n' ]" x4 Q=========4 ?6 b6 K7 h+ l3 ?7 I8 n  L# I+ T+ Z3 |

3 G5 ^! i' ]/ X
8 u2 R8 B* {: {* B: C' K2nd method similar to the preceding one but more difficult to detect:
$ j) l) g6 M' \' b; [9 Q3 X
1 f/ R/ V9 a; C4 v+ c2 C( w7 n0 I7 Q) R3 O& a) J1 X, N/ Y) f) {" D
int41handler PROC
: N3 a* ]% |4 z% p; f    mov     cl,al9 m+ L) ?2 H$ x
    iret
: [& Z- J1 Y4 W+ I+ G5 t  dint41handler ENDP/ f. j( i9 v' e+ \1 V# e. z! [

. u. k3 c2 c2 v/ {$ E/ _; V
8 }4 j8 u% `, P, B: d8 H% w5 E    xor     ax,ax6 Y4 a& W, ]7 }2 F+ z0 z
    mov     es,ax# ^( l, ^8 h' D; P
    mov     bx, cs
1 I$ H; M9 k9 ?4 @    lea     dx, int41handler7 ~0 a8 l& R5 A. {
    xchg    dx, es:[41h*4]# F/ x8 H7 i; Z
    xchg    bx, es:[41h*4+2]
8 ^5 U7 l1 P, y; F1 d" h' \2 H$ f  M    in      al, 40h
$ K/ u7 J  E. x" c- K& h+ O    xor     cx,cx& m& A* O# z7 V# g: q
    int     41h
% N" @9 I" T* H2 e6 b5 M9 W/ p. o2 |    xchg    dx, es:[41h*4]
6 d8 r: `& P$ _) P* z" h. Q    xchg    bx, es:[41h*4+2]
2 C. ~$ U( b: N7 }: T6 r    cmp     cl,al2 ^* H6 S& F. l+ Y) F8 `
    jnz     SoftICE_detected
+ }# z" B# P/ D. Z
, O& w& j7 H( Z_________________________________________________________________________1 P) L- `( g7 C( b; H' M" h. _

& E1 x, [3 ~% N+ xMethod 07' _* _1 G/ E8 N3 E0 g: s, o/ R
=========- k) {6 z- o$ q1 O6 S* _: Z
- M7 e2 G* ^% Q
Method of detection of the WinICE handler in the int68h (V86)/ F* _& j1 [/ ^" R( O
! a+ v. Z4 ]/ O4 j& w+ R2 |8 [% v7 `) y
    mov     ah,43h7 [# J' @- F& W
    int     68h
3 J8 ^, g" z- l4 f6 @    cmp     ax,0F386h$ V: H' n" S" W0 p: b4 V' N3 `
    jz      SoftICE_Detected
) W+ T- y6 z( T% b9 P4 p7 W! w, k" V0 q# s: P

& u3 d( H, g- N" {=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 X7 n+ n) S% u0 R' c' w6 R6 u: ?   app like this:
$ x. y( K( Q4 @. G0 ~" f+ M
# x6 U5 J9 ]# k& z( w: b! P/ M0 n* t   BPX exec_int if ax==68' O0 G; ?8 O9 v6 G1 s! c
   (function called is located at byte ptr [ebp+1Dh] and client eip is
$ G( l" L8 c4 [   located at [ebp+48h] for 32Bit apps)
; F! f/ R) O) Y3 c5 R__________________________________________________________________________- |/ D! z7 Y/ |. m8 r9 @

& V) p: g$ i* e8 }# k5 V" N; f1 ]2 Y/ c, f0 D0 @0 H
Method 082 a( v+ Y7 F$ V3 D
=========' I0 L1 P# L: Z' D$ F* ~5 k2 z
  x) K3 w1 o) S7 g5 Z* E
It is not a method of detection of SoftICE but a possibility to crash the! }2 Z/ ^/ b6 d5 J1 m- ]
system by intercepting int 01h and int 03h and redirecting them to another
- X+ W3 m2 P) B' P! ^routine.
( F: \2 [- C0 D. B6 x  I4 q% U8 a5 GIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points  H/ b, t+ N0 o( p1 A
to the new routine to execute (hangs computer...)
8 f) w* K- P3 g. [  x1 R7 i6 K8 Z) f$ [$ o" T
    mov     ah, 25h  @$ z5 v+ t% [! p/ ~" ^2 j
    mov     al, Int_Number (01h or 03h). u" R+ H9 X; X. X$ j
    mov     dx, offset New_Int_Routine
4 q" @6 n/ Q* J5 @% a9 |    int     21h# w; x$ P+ q+ C5 D8 ~

1 K: Z1 Y  i  a5 l__________________________________________________________________________) m9 l, F. j, Z
. Y3 J6 z& h9 V( N3 i' q
Method 09
! W9 J  H2 k: v, f) `( D% W5 c- u=========; \; L4 ], m" n
" O) O, Q& t& O/ ^+ x9 P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# x: B5 ?$ {' \5 V: D! Bperformed in ring0 (VxD or a ring3 app using the VxdCall).' E& R$ N. O0 S, S3 I7 V! h/ q
The Get_DDB service is used to determine whether or not a VxD is installed
8 f2 R  ?1 G+ M( i4 Afor the specified device and returns a Device Description Block (in ecx) for
) g  y7 M) d( E# ?1 y5 sthat device if it is installed.
" D: k: z; L& T) T4 W1 r# k) X; W% r* @$ _: L! q4 S7 Z6 z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; ]7 O2 Q0 L' \7 ~: c* i
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% @$ q! |6 a: c
   VMMCall Get_DDB3 C/ K) @  M( C1 M' n  k
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' X( i" F6 E$ s! Y) w6 I
& n8 }' h/ o* aNote as well that you can easily detect this method with SoftICE:/ a  T: l# Q9 ]7 ?& H4 ~% b
   bpx Get_DDB if ax==0202 || ax==7a5fh' s6 u  q4 }1 M4 p8 X+ r/ y2 v! ?
* u5 V% n( L% c- }
__________________________________________________________________________1 n1 m5 B3 m0 p4 w' {- L
+ E" }5 {( ~& _4 l5 B/ o
Method 10
! g5 d8 d' J, G& z/ z=========  i8 }. z- k/ n7 i0 @

4 C; l/ M- n) X6 K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ y+ Z+ C, d6 f) ]' _  SoftICE while the option is enable!!
: t7 N7 N; E- T+ m8 Y# c- y) f, q( n6 n8 ~/ L* g" P2 W
This trick is very efficient:
+ i0 Q/ g5 z5 nby checking the Debug Registers, you can detect if SoftICE is loaded. U" P  g$ J$ L
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& F5 o+ U+ g! j* @. Kthere are some memory breakpoints set (dr0 to dr3) simply by reading their
' q& p; H: B+ I3 ?3 ~1 Mvalue (in ring0 only). Values can be manipulated and or changed as well/ A9 Y6 x! n- i" G. V2 k6 t
(clearing BPMs for instance)
3 i1 @: R8 a+ y# g9 w/ b
& s! D4 \8 v- ^. _$ \/ a' c__________________________________________________________________________* r4 b) d; p! Q% y$ U, [  k

' W0 e: s) L% m# H3 BMethod 11
1 M1 ]: g0 G  {* F" C; \=========$ G, u  V( x6 C1 n' l' \- f) Z3 c  T
. G! S  ^; ^' @7 b
This method is most known as 'MeltICE' because it has been freely distributed+ A0 L  R4 a; U9 n5 J
via www.winfiles.com. However it was first used by NuMega people to allow
/ [0 O& {/ W4 u1 y& n! {9 @, aSymbol Loader to check if SoftICE was active or not (the code is located1 J% m2 ^: k0 q" k& O
inside nmtrans.dll).1 |: j9 _' E6 _- l; Y8 z+ ~
$ w8 f/ R1 N8 e" i- `' y' Q1 ^
The way it works is very simple:; ]# e% N2 r( v* O; L8 T. a
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 S( v4 h/ ?- M! T2 y' r; c& M
WinNT) with the CreateFileA API.( ?( H2 T, K4 K. M' z# p3 _1 U

. X9 |, [. K  a8 WHere is a sample (checking for 'SICE'):8 R9 ^8 b/ |5 C9 Z- C( D) n1 s
; \: l; [' E0 O& @7 l
BOOL IsSoftIce95Loaded()6 ]% X/ s/ m- U& L* \- e
{
, m' g. p% n- o8 w   HANDLE hFile;  # J$ M  t6 w# K! ^* R$ I1 x  Z
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 ?/ y: o/ J. W8 Q1 z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% `. q' x, j" H# B. W                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# C; o/ \+ p* u* R0 T   if( hFile != INVALID_HANDLE_VALUE )
) A1 C+ `4 Y; T+ C: w& f  S   {1 _! y# t( ~! B! I  C7 ^& X; W/ e8 d
      CloseHandle(hFile);5 {; a  W8 M& ]9 H
      return TRUE;
7 b; ?" j/ l- m8 A* d( O   }
! D8 D9 T, [& b' \# e+ f   return FALSE;
% q6 E) L' Z* x9 q+ e}
6 D8 i8 C, i# _- j& [
) ^/ r# O3 Z$ \( y" X8 {Although this trick calls the CreateFileA function, don't even expect to be0 N4 v% N2 }/ b4 q$ e7 Q# }
able to intercept it by installing a IFS hook: it will not work, no way!
( n# V5 q  X" l, q& \2 V. E* |: `In fact, after the call to CreateFileA it will get through VWIN32 0x001F2 J+ ]' ]+ \8 A
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 J  f3 A! Y  S) t& j* a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 P8 u0 B0 W9 g  s/ ?4 X$ Ifield.
( h& U/ [8 k5 z; J9 i( W2 dIn fact, its purpose is not to load/unload VxDs but only to send a
9 `9 l$ F( C& S- \W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) H& R& w% Y! }& `' p: T* a( u8 qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
% q% e1 w8 q' }, M0 e) W; ]to load/unload a non-dynamically loadable driver such as SoftICE ;-)./ a0 \( p: s: _; o( e
If the VxD is loaded, it will always clear eax and the Carry flag to allow2 u0 _6 e% s6 X
its handle to be opened and then, will be detected.
4 F9 i8 `, Z; _8 p% W! C! D- f8 dYou can check that simply by hooking Winice.exe control proc entry point- {8 z6 D2 K7 k; A6 }
while running MeltICE.
0 j7 g1 S+ A( d5 p3 n1 a
* v. Q/ m+ f% b! H7 q' U& E
7 D7 }1 k, y, t1 T+ f  00401067:  push      00402025    ; \\.\SICE  Z3 X/ }" z3 c) }5 X
  0040106C:  call      CreateFileA
' _* w) k+ v9 `/ H+ c; T) }4 Z$ ]  00401071:  cmp       eax,-001- Q6 @7 |9 A6 `
  00401074:  je        004010910 i. R) j: q4 i2 j
# ~" A( Y# l) q2 W( |7 @; S2 U
1 x! ~5 v+ D: f5 \, N3 v" n
There could be hundreds of BPX you could use to detect this trick.
5 V, E' d0 t4 u; R7 B; Q-The most classical one is:
2 B9 y: J( l6 W( w  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ M' t8 M' n: D0 l
    *(esp-&gt;4+4)=='NTIC'
2 {! p# b) G8 c) w9 c9 B7 h/ l8 l8 T" w: l; r7 q7 U. K
-The most exotic ones (could be very slooooow :-(+ X6 {* k5 \. ^, k1 x/ h
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, y6 `. S. |5 ~! j+ |     ;will break 3 times :-() [% x( Y( k$ c, N' @, J7 @( c
; ?, G4 r) n- J% U+ ^0 Y7 v! ^
-or (a bit) faster:
7 N+ ~' P9 f' g) C7 i! e   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ X& z6 q0 U1 L4 S1 u6 Z" {$ f1 H4 R9 t* z9 g: s3 P
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- P# J  |; l  Y! k4 O     ;will break 3 times :-(( [1 `  J( I9 g7 n5 c0 c4 Z3 d) j" n
, Z5 h: X$ D$ u% a) ]
-Much faster:# ~: l! W# L/ C3 }2 A) }2 E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', n, W0 b9 q) {

2 C" U. E; l8 F  ?1 J$ E  ]Note also that some programs (like AZPR3.00) use de old 16-bit _lopen3 `' q* Z2 E1 b! f
function to do the same job:
8 J4 @  n, @. x/ [7 W! I# X1 I' A  n" K4 {; i6 g1 i" V$ n
   push    00                        ; OF_READ
1 Q7 P1 w+ Y4 T+ M/ y4 w2 H   mov     eax,[00656634]            ; '\\.\SICE',0
: I% s" i6 k# S& K+ M& r   push    eax$ p8 V/ v4 q6 F9 h0 b! d
   call    KERNEL32!_lopen
) `' [! Q& M9 o$ [2 u   inc     eax) X  d6 z0 D- ~( Q
   jnz     00650589                  ; detected7 z8 R' V6 C: Y8 }% I
   push    00                        ; OF_READ
: j! [+ z4 V  f! f   mov     eax,[00656638]            ; '\\.\SICE'" u% B, l+ P4 z. |" J
   push    eax6 n- @; J9 w4 q
   call    KERNEL32!_lopen
2 F2 j( \3 Y" L   inc     eax* S9 n1 }" L6 W% Q
   jz      006505ae                  ; not detected
# H/ @& W8 `, ?& f% ?$ k' V1 C/ }# A7 a* t5 C% }2 l/ ^: q
; ~6 K9 L& i: V/ c- h2 @
__________________________________________________________________________9 y- w4 Y: `) r" j
" d" s  [0 T. ^6 j0 ~: F8 |
Method 127 w7 x( r. y: m( s# M& b
=========. o! A- q- U' B) K" b; S0 B
7 V8 j( E7 y2 v
This trick is similar to int41h/4fh Debugger installation check (code 05
1 x# u% S$ R2 ^1 O" r% u&amp; 06) but very limited because it's only available for Win95/98 (not NT)% A# _3 {5 Z* q- D% z/ B4 W# S$ v
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, G/ N/ h6 w+ G$ g
* Q; v2 \5 A- p   push  0000004fh         ; function 4fh
6 N- W/ W7 v( g( z4 Z0 J- r( l   push  002a002ah         ; high word specifies which VxD (VWIN32)
# F! C% T$ ~2 R. O% ~% }. p- K                           ; low word specifies which service
, F+ ^5 i# Z& H% Z                             (VWIN32_Int41Dispatch)
' ], ^* P5 _! J- |3 }   call  Kernel32!ORD_001  ; VxdCall
1 J7 ?: P# |: t% A   cmp   ax, 0f386h        ; magic number returned by system debuggers; ~/ c4 `$ [4 }. i" V+ X/ g
   jz    SoftICE_detected
& g- u/ w. X' _* N: u9 o
# |/ n5 S' e/ J' @9 j# FHere again, several ways to detect it:9 h3 g/ R8 d( k' M# j
  n% S) _0 A- y1 p) l3 w8 ?3 t5 d
    BPINT 41 if ax==4f
% I5 [* f, d8 y/ H* O0 B( q' e2 k) l9 j
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one5 U) Y# q+ [+ X( A% v5 M% @
! v) l0 [  J9 h* E0 r2 A
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. h# i( D/ n) O" {# X
4 e" P7 {; L4 j8 C) w; h
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!* ]6 c% k6 T+ J# P6 j4 ~1 @: q2 W

; Y$ Y9 l8 w* Y! R__________________________________________________________________________
! E& ^' a2 ?/ h, \$ {5 I/ I5 ~5 L8 Z" b% K. ~4 g' C7 h9 i
Method 138 f: r4 n* `" X, B, A
=========
) m7 X4 J' g& U! x' V- o* G: f  m& z/ y
Not a real method of detection, but a good way to know if SoftICE is& e9 Y4 q$ a( ]! e  P" c- f" a. G; J
installed on a computer and to locate its installation directory.& ^( ?8 J$ i& m* }1 |4 z( {2 b
It is used by few softs which access the following registry keys (usually #2) :
4 h$ N3 t% Q3 |! W6 t- z; m0 {- X; [5 I+ Q4 g* l2 O' y
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 ~9 [% c/ V8 u2 u\Uninstall\SoftICE3 B. L5 I. l& U; [  @4 O1 _
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- [3 W7 A: s% }/ O& y  c) _5 h
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% q5 ?8 u" \' y8 B( Z9 `1 ?\App Paths\Loader32.Exe
; a9 g  W5 A0 J& h2 N1 i  \- K' {* ]4 X- d2 R) Q$ [; v
. F7 V1 G0 H! T. u0 W8 I
Note that some nasty apps could then erase all files from SoftICE directory6 v. f! y. ~! z) O$ g) T  g
(I faced that once :-(9 Y0 e! k7 G5 q5 N0 H6 R* ^1 u

3 S' _9 M, l; b( A" ^0 ]Useful breakpoint to detect it:! d  p( E, U7 s# g. t, ~

4 k0 F! l2 ?. L- }     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! d+ `$ `+ w/ Z( \5 g* h2 @( F
3 K# x0 K. N- C$ X6 ~% h6 r9 P) o
__________________________________________________________________________, ^( Q& r! ~( ]

) X; _. j) G0 u8 ^* @5 V. c
& t4 c3 e+ k! v$ OMethod 14 , k+ q1 f$ m9 O! Z
=========- Z9 I4 M; o8 B; u8 L9 E' O9 s
& ~8 I; w* {* A' P- ]  v; K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! h1 |/ O3 o4 i7 Y" o7 u
is to determines whether a debugger is running on your system (ring0 only).( O; j  W1 Z, E% ?" U1 j) r/ G

1 r6 C1 ~, R+ B. e   VMMCall Test_Debug_Installed
. P( d+ `- }+ E; z' x% B6 _   je      not_installed
8 q% N7 Y- O5 E) p- I
2 s  ~5 T4 V  I5 JThis service just checks a flag.- S$ k1 Z" J+ B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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