About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 z: A* R; ^) z; G) w9 _$ n
<TBODY>
' |7 t9 x$ B: Y, T1 N: m<TR>
7 I! R3 M* |' z2 P3 g<TD><PRE>Method 01
6 u- @# a& b( x( L4 }$ Q$ r=========4 s0 e% a4 ?/ N, `* V5 A/ o- y
3 w' }) V( ~$ x' _. s' V& h3 v
This method of detection of SoftICE (as well as the following one) is
$ @: w" ]7 }; t  `; eused by the majority of packers/encryptors found on Internet.( f+ g) j/ G8 n4 ^( u& ]  E
It seeks the signature of BoundsChecker in SoftICE
9 p8 A( B2 q8 o8 _" k  B3 B* n7 s" R' P6 n- f8 t* P0 R
    mov     ebp, 04243484Bh        ; 'BCHK'' X8 h4 O6 d% X( Z6 g/ q) ]
    mov     ax, 04h2 w! B5 `$ ]6 a& \9 A
    int     3       * S8 f- ^4 I3 Y9 E
    cmp     al,45 {; n! K. j" }+ u
    jnz     SoftICE_Detected
) ?7 x3 p$ [& ^) X7 I
- L; j- ?) m' m+ P___________________________________________________________________________! G" F( j# [# `7 b- S
* [* ^/ h, h) b" ]- A
Method 02
# P/ O# n2 g, s/ T=========
/ A0 G% @7 q0 n4 g& D1 `/ \  n/ O- Z4 a) h) j
Still a method very much used (perhaps the most frequent one).  It is used3 w2 y( o& @9 _+ Q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ Y& f" X# z1 c3 U4 B/ O" Hor execute SoftICE commands...+ @' {! Q0 K/ `5 e* V
It is also used to crash SoftICE and to force it to execute any commands9 S; x9 ^- {6 D& J. O
(HBOOT...) :-((  
1 I) M& ]- l3 h. Y0 J; @6 X+ N3 z  D2 c( }  K2 R& Q
Here is a quick description:
4 L- Z7 k4 d5 T-AX = 0910h   (Display string in SIce windows)1 N# z5 V! a4 S) X/ c: X
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)6 A, t2 N# R; P" y
-AX = 0912h   (Get breakpoint infos); @) Q* D6 F/ ^
-AX = 0913h   (Set Sice breakpoints)
, t! @( ?! _& m& n$ r; W-AX = 0914h   (Remove SIce breakoints)
) K& o$ l( N; h  B$ v# c0 ]) K" U) T: ~5 p$ @5 }* D: y- a8 Q6 S
Each time you'll meet this trick, you'll see:# x. Y: H) g9 t- t" A# D
-SI = 4647h
7 k' s9 o& x% O# u% h% u# V-DI = 4A4Dh0 f( S; s/ `+ {+ P
Which are the 'magic values' used by SoftIce.
8 U! c+ q/ u6 O7 G6 z5 sFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.( O2 @1 Q) M5 }- L2 C! g) j6 O

/ D5 [. X" S0 m6 eHere is one example from the file "Haspinst.exe" which is the dongle HASP
* n! d2 ~* X* \$ H; u) yEnvelope utility use to protect DOS applications:
" ~* J) W1 V  f2 @9 D
$ T4 L' G6 E5 _5 ]+ E: f; X  |* U' z  U& _1 Y/ n
4C19:0095   MOV    AX,0911  ; execute command.
. S/ i; D7 R0 h! G" j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 I3 O0 E% C- O% U; ~7 }1 J4C19:009A   MOV    SI,4647  ; 1st magic value.
2 L$ _  J4 J4 P# w4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ ]4 H8 }' v5 X& \: z" p4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" b6 c+ U% N+ f
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 f4 H* Q% z6 a1 {. G4 S7 \9 n( |2 e4C19:00A4   INC    CX- i# p+ r! M: e5 X  O
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 i% i2 U* D0 a) a8 v: k8 ]
4C19:00A8   JB     0095     ; 6 different commands.
6 D) G5 h' F1 a. b/ C: f* ]4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' M4 A  S# E2 V+ {- u4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
* R& t6 X$ m: X) J( H* q1 ^# D$ v
The program will execute 6 different SIce commands located at ds:dx, which) ]2 N' ]) s7 k$ G- b: B' ^
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 O' i' l' u) d9 A. v, c0 P8 M0 A, j, L0 {9 c, J1 f. b( r
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
0 l; j1 \+ J, X  @___________________________________________________________________________4 J4 Y5 X$ z- H( G8 y. O5 g
. Z! c- `5 V8 N  p/ A0 w8 ?
  d/ _, n: I  c( z% M
Method 035 w6 V2 F7 k  q: X$ c. c
=========
. z# t6 t1 ]7 l3 e' J% e, \6 f7 ~. h' V
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 s( f1 L& z0 e6 ~2 `! |* k( M' p(API Get entry point)2 `4 q! }( t! Q0 Z" x3 ~
        ' E) @2 @0 Y+ h0 Y& [, n0 D

' n7 g6 J2 t4 e: u$ o$ W$ B    xor     di,di) s7 E, b2 {/ l! L0 H1 M, w
    mov     es,di0 k: n; m5 f# @9 c9 f( H8 n9 j
    mov     ax, 1684h      
$ T* G' X" ^& l4 x6 z6 E# ]' h$ L/ L    mov     bx, 0202h       ; VxD ID of winice
. ]# J9 I- \+ u4 E3 J8 U5 A    int     2Fh
) B* [% e9 Z8 V5 T9 P! n( \    mov     ax, es          ; ES:DI -&gt; VxD API entry point# F3 l% \1 i% ?4 P! u
    add     ax, di9 T! q! w7 a- \2 E5 j. f, f" t' z7 f
    test    ax,ax2 U( [4 c8 f% J/ ^+ }, h
    jnz     SoftICE_Detected
' W* r/ P% W$ v2 R& q6 D
  J) I. F" W1 T' o8 P& U+ ]9 A: ____________________________________________________________________________
9 k- J* b9 T1 u1 x& D& H. D; V( f  M4 k9 D
Method 04
3 z8 d' F4 u, j' i6 ?=========
- R5 @+ X- E1 a; k3 G$ v- C- d
8 I7 t/ o' O9 K8 c; J9 z- U1 TMethod identical to the preceding one except that it seeks the ID of SoftICE
, Y  ^  |, q6 q5 ]4 _GFX VxD.
; W, U% p" C; v8 R$ W# `  _. W& P7 s6 v3 ?; q0 }
    xor     di,di7 u0 y3 K) L% f  J1 e& G
    mov     es,di
4 D. E" P- h. r+ o4 O/ W5 c9 V* ^5 o! k    mov     ax, 1684h      
0 L9 X$ }. {2 S    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) n- T2 ?6 M8 T; F& T" o7 I    int     2fh1 O+ K, B. x$ r& |, k8 H, R
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ |# u+ `; e3 W7 m
    add     ax, di
7 S3 M$ P5 }, E$ v! V    test    ax,ax
0 b! Y5 y% D) C2 n$ Q0 O9 N6 n    jnz     SoftICE_Detected
6 n: `2 \) z, F6 J1 g. V# H8 Y. S) W0 k: ~
__________________________________________________________________________: \8 ~. ?1 D+ Y* o( F; B

7 G7 T0 w& Y; T% }# N
1 X. B' m# b2 ^* zMethod 056 |! d+ Z9 p2 S; g7 Y1 ^0 R
=========
* Q& H+ B, M5 ]1 A7 s9 j! {; z
2 G9 ?; {2 J- s+ ~, B/ P# K. IMethod seeking the 'magic number' 0F386h returned (in ax) by all system
. i, n" g7 D+ x; v; j% y8 X7 jdebugger. It calls the int 41h, function 4Fh.  w; `/ n( w  ?  W# |# w3 V
There are several alternatives.  $ S) ?. h4 c9 c9 y4 V  o
# w6 Q* v5 h) T/ _
The following one is the simplest:
/ s4 ?3 W, V: ]% Z, \6 b9 w# N# @: ?* h5 S; x; {
    mov     ax,4fh
1 K  z5 q" S- l1 N; L6 n: }) G    int     41h
' T5 ~8 r0 }! O    cmp     ax, 0F386
& |% V* p) s. T1 @$ }    jz      SoftICE_detected
; P( S, b7 p! d5 N6 t9 ?) s4 E: g. V. u: E5 r9 ?( V9 y

7 e0 }+ s1 W9 qNext method as well as the following one are 2 examples from Stone's
% M4 {6 @5 A5 n"stn-wid.zip" (www.cracking.net):
0 N. J  g' Z1 a/ G9 d" I; E5 A) D% ]
    mov     bx, cs
! F; S9 j- h7 A' U3 p% b; g    lea     dx, int41handler2) D( k1 o. i3 d% d; e
    xchg    dx, es:[41h*4]
3 u, |0 L( g' c# f5 `* Q    xchg    bx, es:[41h*4+2]2 M1 Z7 @+ L% @* }" `
    mov     ax,4fh
* K4 \8 b9 Q- x    int     41h
  q; J  n6 X  V2 t- }9 ~4 j& U4 u    xchg    dx, es:[41h*4]4 U) o0 ^2 a  I% v$ N" D
    xchg    bx, es:[41h*4+2], X+ |% z' M( Q% n2 U# r4 z2 ~. M
    cmp     ax, 0f386h
8 p' ^& A' D& L    jz      SoftICE_detected. p+ t, v4 E- \4 M; l2 I( K
$ y# \- A) p. Z& E
int41handler2 PROC
- x9 F% h8 ~3 H    iret. c7 U% W7 K% z$ U( C6 L
int41handler2 ENDP" w3 }+ i6 B; S, A- A  T

  H) G) ?' O, p  d' w9 T
" g9 C9 z2 S0 y' \9 o1 B. P_________________________________________________________________________
! d3 A2 K! a  S& V( d( K
) q9 x1 T/ M& u2 R1 v
' y) a& Y+ A9 B6 m2 G$ a$ zMethod 06
7 @9 }0 C, b+ d8 j2 ^9 O! {( a=========
* s, o" s) x4 @4 m$ q
" ~; o8 d) R" Y) x. F! E2 m0 Z' H; N( A4 \2 e! [3 U
2nd method similar to the preceding one but more difficult to detect:
% k9 M) u, r0 K( k# }9 _. O# z( w' b$ ?4 y* ~: G# x- P
; K" X7 B- U8 k, a- W: ^1 {. ?, Y9 O
int41handler PROC) h  }; P( u) }2 }. r8 d! z
    mov     cl,al
' s3 |) P: c5 J' }! `$ B) X    iret* p* B. l$ a  @& }# Q
int41handler ENDP
2 Q0 l4 Q# [. u5 v9 X4 K
+ z4 D% n: w" e! A: @
: n; S7 i/ w6 U$ c4 S! @- _    xor     ax,ax2 F$ B" F2 X; N1 I  y
    mov     es,ax
' Z3 {7 n/ H% T1 |. P    mov     bx, cs
; j  S& h1 {/ U2 ^7 A8 R    lea     dx, int41handler7 a3 q0 }* I; z1 S
    xchg    dx, es:[41h*4]
8 Z: R% P, c  h  t/ ^. g% q    xchg    bx, es:[41h*4+2]
) ~: v% Q4 `" X9 W    in      al, 40h* d" J; ]8 e9 I$ c
    xor     cx,cx9 H0 i( N5 l/ m) \6 i. E% z& q1 \
    int     41h
- o% J, S, s8 ]7 [1 [' |$ H( Z    xchg    dx, es:[41h*4]
; O8 ]& E$ i0 X# o0 }    xchg    bx, es:[41h*4+2]
' {# w1 _. t' v! _3 N    cmp     cl,al3 p/ X1 P; v9 y# Y8 e5 W, l- ~$ W/ \/ j
    jnz     SoftICE_detected
( T4 t5 _; {; P# ^* ?) P; ~' [5 Y5 j/ X. _9 J' [
_________________________________________________________________________' V, U6 ~4 k3 `3 ^; a: t5 j

+ d* f! @- Q6 \+ a7 B# ZMethod 07  C. d- l$ }( v9 ~) L8 C% M4 [% x
=========4 L, u" A& r3 \7 V6 N

& X: A3 T+ [: a  z. F3 l/ }Method of detection of the WinICE handler in the int68h (V86)0 x- c/ r* A# s& \6 \2 O; y' L' F& |
3 @2 i6 ?+ }; H
    mov     ah,43h
# f4 n5 O8 w- v    int     68h
1 f) s# M' E0 X  m3 A    cmp     ax,0F386h
3 y% E9 r& A& ?- F& W; V    jz      SoftICE_Detected( k+ l0 i% k; _8 t) N, V

' ]& ]; M, t4 ?
2 a* v: [+ i' i=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 \: `/ n* P  m9 @: r* X% o
   app like this:
( F  Q6 D; h# u1 ~+ l! t) m( x+ {/ b/ Z, i4 t/ v# M5 F) N' K" n
   BPX exec_int if ax==68
# }* j6 i7 a% e   (function called is located at byte ptr [ebp+1Dh] and client eip is
! N0 T  H, ~2 z( z0 h, k# ~% v. g   located at [ebp+48h] for 32Bit apps)( {- C/ \6 N/ @. D
__________________________________________________________________________
0 q2 ^4 R* R- H+ g; W: m& o, B& T5 T
9 F! |  p2 ~4 M3 b( {$ |$ j
2 h3 i( R6 W, b( OMethod 08- G; j% J0 m. D3 n) s/ s5 P  Q
=========: L- S+ K1 r  q: r& B

& ^( e9 s0 Q$ u8 u+ WIt is not a method of detection of SoftICE but a possibility to crash the5 b0 F3 w) y5 u* E- i: _
system by intercepting int 01h and int 03h and redirecting them to another
) U& r  G* J9 X- J  l; Proutine.
0 s# a3 M1 j. t. l( VIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. p7 g  J+ g+ a4 x' |$ B) {
to the new routine to execute (hangs computer...)
9 _+ j# ]- _' ~- P; {$ l$ }" u: N/ \% {6 l  H) W3 Z; v! [
    mov     ah, 25h) G* {9 X3 j: P1 g
    mov     al, Int_Number (01h or 03h)" {) @0 m7 l3 I* D! H  A/ n
    mov     dx, offset New_Int_Routine
* B3 @: t; S9 M; Y    int     21h
  Z- s5 d8 a, P7 `3 V  {. R9 Q
__________________________________________________________________________
" q$ q9 l7 f1 R: _) ^3 C: m& W+ c7 F; |% T. G% D: {. M: Y" F
Method 095 m8 ~9 R; i' U6 K
=========
% A/ ~# [# l$ P; Y6 t4 Q1 B- x! v6 l/ m4 e: k
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only' A& n1 A& {% x8 z
performed in ring0 (VxD or a ring3 app using the VxdCall).
2 ?1 p! ]/ Y" I$ Y% H& Z& Q* E) ]The Get_DDB service is used to determine whether or not a VxD is installed5 y7 n# r- e- [0 W: i
for the specified device and returns a Device Description Block (in ecx) for8 T5 E& [8 h2 F* m
that device if it is installed.2 J# U1 J' s. ?; u/ ?4 `
: T! u  t4 c( M
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ d2 o; w& ]9 r1 m+ f5 h6 Y# s7 ~   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 q2 F" |" d9 t! h8 _% ], \
   VMMCall Get_DDB" w% N7 U1 B  ?+ v, V- s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed+ w1 e" O8 V" s; d5 L5 o/ v
( [) |+ J* K" e( b; u4 p1 f
Note as well that you can easily detect this method with SoftICE:
; @) w1 j8 G. \   bpx Get_DDB if ax==0202 || ax==7a5fh8 N' h% B6 d. v$ i& k3 G& J

8 c4 r3 L* W  M5 \3 Z  s/ b; z0 d4 c__________________________________________________________________________
$ b! `, _& |+ e
& Z+ A! q: M( `$ O' QMethod 10
: z& `+ O/ o( L8 Y) g/ l) n7 d=========$ e0 n) M+ S7 Y
; w: L2 Q* k  E, g+ H' w6 z) h9 i
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& k  W: P% O2 X5 U$ K" l+ `1 R  SoftICE while the option is enable!!) N* n5 P* O  X. b& D5 l  Y
% e, j5 k/ U" f1 H
This trick is very efficient:
" w' I- C" B7 vby checking the Debug Registers, you can detect if SoftICE is loaded" ?- Q7 m/ ^4 ?1 M( l5 ]. Z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. u  o9 M0 v+ gthere are some memory breakpoints set (dr0 to dr3) simply by reading their* H' h5 E" p7 b
value (in ring0 only). Values can be manipulated and or changed as well
4 }2 ~4 c' D1 V. o" B(clearing BPMs for instance)2 L- c0 m# Y+ Q' f) g, s/ M

/ v- x0 ]# Q& i3 P* y$ P__________________________________________________________________________3 l) t" d' n( S/ Q8 T/ x, a
4 h" h* \( Y8 f
Method 11
4 Y' E9 I2 I1 p7 h  u6 l- h' N9 M=========5 e( ~- o8 G% X/ U" ?# p4 J
/ E: }0 r/ R6 H3 P$ X" Q) j6 f
This method is most known as 'MeltICE' because it has been freely distributed
6 a! K0 n4 z- Qvia www.winfiles.com. However it was first used by NuMega people to allow
  o0 p; p1 C) a+ b' l  Y" iSymbol Loader to check if SoftICE was active or not (the code is located3 o% T% p6 |2 ^2 M
inside nmtrans.dll).
0 \! ?! u# ?4 d5 h# Y' k3 K+ ~8 Q& r( K
The way it works is very simple:
% i) g6 f. U' b! g  jIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* k' }& i5 Y$ Z; C9 h' y$ I" jWinNT) with the CreateFileA API.
! q3 v5 `1 n5 h( g5 P
' T! x) z. c& ~7 @Here is a sample (checking for 'SICE'):
" H3 m1 r) W$ {
' c7 _& M+ I& Y' `BOOL IsSoftIce95Loaded()
- S0 z) n/ F: k' N) F6 g4 O{$ }: z( P# p% n' B5 M: P6 j" v
   HANDLE hFile;  
" ~6 p5 w2 F: ?. d9 `- u   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 I3 I; G/ k% M$ q; h5 b                      FILE_SHARE_READ | FILE_SHARE_WRITE,; ^- ?" k6 o$ _, H9 j9 Y
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 c3 W5 Y5 S8 v* r& e  O& W   if( hFile != INVALID_HANDLE_VALUE )3 f+ F2 X  T# I( S
   {; r7 b) S6 S# i) e% b
      CloseHandle(hFile);
1 ~. \0 j% b4 R. B5 T7 h8 o      return TRUE;1 P8 G5 Y/ i, y9 U
   }
8 k/ j% k( @! u- X+ }( [   return FALSE;
1 d+ \+ B  v+ b2 t( S! N( r; s}
; Q2 }  p9 u+ `; s# w0 L  Z" A1 w' V3 L$ t
Although this trick calls the CreateFileA function, don't even expect to be
1 G" @  y, X- @& W$ v, {able to intercept it by installing a IFS hook: it will not work, no way!
- W5 O/ ^" ]( q  Y& e$ iIn fact, after the call to CreateFileA it will get through VWIN32 0x001F& t: P( x* ^5 L8 l* |1 \
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& L2 b: q, x0 U9 y% {, w- s8 Jand then browse the DDB list until it find the VxD and its DDB_Control_Proc
. n4 |+ l# U% z, G8 I3 H. }9 cfield.) t) C" N* `, t: Q/ O" C
In fact, its purpose is not to load/unload VxDs but only to send a 1 a* y1 \7 c5 X! p# Y1 ~# Y* [
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) V; x& e) T! n# R, a: p' s8 [to the VxD Control_Dispatch proc (how the hell a shareware soft could try
, e3 p2 b1 \' B* O1 _to load/unload a non-dynamically loadable driver such as SoftICE ;-).
% T( W* k$ [% o# mIf the VxD is loaded, it will always clear eax and the Carry flag to allow3 l5 n0 g" j( o, g
its handle to be opened and then, will be detected.( P+ m7 h* G/ y% w" n
You can check that simply by hooking Winice.exe control proc entry point8 K& d1 X5 N& z- X, i; A* A! C! w
while running MeltICE.$ ^0 A: k/ I- r) a1 k
2 Y  r1 n; Z1 Y0 m: a3 Q, S- ^

( A3 O+ I" y, g# ?( r: q  00401067:  push      00402025    ; \\.\SICE
5 V$ ?% p* M! `' O$ e/ {  0040106C:  call      CreateFileA, U$ D5 W3 i" G! x9 h
  00401071:  cmp       eax,-001
. b" P. P7 k7 I! u% g  00401074:  je        00401091
1 L6 N$ @# K1 Q6 `! v0 N# z- g& H, C5 L& I" t' u

$ l$ S; v$ r! U& C% y7 {3 oThere could be hundreds of BPX you could use to detect this trick.
& D6 I5 ^2 n# v( v" r-The most classical one is:
' W5 X9 q- Y: a0 E4 Q, M$ J5 ]8 e$ z8 D  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
( ]3 V4 Q, L; V    *(esp-&gt;4+4)=='NTIC'
4 Q+ Y5 Q/ _6 \  F% d& t: R8 P
2 y/ I9 c( D" a! U% Q( Z2 u-The most exotic ones (could be very slooooow :-(
+ O6 J+ F; A' R6 s1 d7 O' P   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % y6 m& r; H$ q& T/ Y* v8 i: p
     ;will break 3 times :-(
  q) B" o6 t% w3 p- ], _) \) f' y4 _
-or (a bit) faster: 3 O9 K' K1 P+ b; D
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
% \' r9 `- g; {) d$ r+ U, d
' b% I6 y( E. b. s! t9 h2 I: P   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  6 R* I: G9 ]. Q$ X' n
     ;will break 3 times :-(  \2 R. Z7 ^) I$ d/ N

4 Q3 z% O# h$ b5 }, ]- A; B- v/ f-Much faster:- v" `$ |& a! d1 e0 Q9 h3 m  u7 j
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ [; [! N5 ^) ]4 C' W
9 L# W2 Y, T% h( I: R. q# Z0 xNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
0 d& H7 J5 p  _+ d4 _function to do the same job:% o& T$ l- G& t4 R5 t0 U: t, h
- n% {3 U, N# x! g9 I( E* ]
   push    00                        ; OF_READ$ ]; e# J; I; d/ g6 T
   mov     eax,[00656634]            ; '\\.\SICE',0
6 m" @- q1 g& V. b) N+ I& |+ q   push    eax/ k- R' v9 v" d! A
   call    KERNEL32!_lopen
3 ~: q2 A/ E+ e: M5 g8 p& N' [   inc     eax5 c; \/ p, a: Q9 N! b
   jnz     00650589                  ; detected
; t3 {! r! v2 z" v   push    00                        ; OF_READ9 B3 F1 ^5 z  d
   mov     eax,[00656638]            ; '\\.\SICE'
- n+ ?" k8 K4 y! r+ C$ L6 Z6 u   push    eax
4 T1 K& |5 f* c3 W0 s" \: v: Z   call    KERNEL32!_lopen* g0 Q0 l/ F4 z5 p" u
   inc     eax
  Y$ l; f# A- I" K2 R   jz      006505ae                  ; not detected2 z  a, T+ A9 N, y* ~

: }& A4 K, w3 K! w, F/ n: s7 T- D
__________________________________________________________________________
( c  V; e. i5 a( j: I/ U$ @. w0 U7 R" h6 Q/ k1 c8 w6 H) R& K
Method 12- L+ J# Y# {5 P2 j0 D8 G
=========
: v; |3 W! d$ i/ n6 C  s% s
5 e: G- f  g! V% y" MThis trick is similar to int41h/4fh Debugger installation check (code 05
2 C$ [0 X9 _' H2 F&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ A2 T' W, Q# |9 }! Q5 ]6 g! C
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.( u- u9 k3 ~4 F. _0 J1 s* d

1 l$ G8 Z) v; K+ O7 @* M   push  0000004fh         ; function 4fh
4 o7 N; L/ n, J9 Y   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 g7 d) |2 w: @1 V                           ; low word specifies which service% J5 Y3 n% H( S8 t
                             (VWIN32_Int41Dispatch)/ K) `% U% m2 n$ Q4 ]% d; M
   call  Kernel32!ORD_001  ; VxdCall
  \' n( R6 j1 x( E3 P- x2 P# n   cmp   ax, 0f386h        ; magic number returned by system debuggers
3 n9 H! C3 _: H3 d! ]   jz    SoftICE_detected
1 N; c- f+ l0 t5 }3 D7 a% e& I# s/ d
Here again, several ways to detect it:( w2 r* k. Q# K, s4 O, \

" D8 K* O8 K( {0 U7 p% |) V    BPINT 41 if ax==4f# k/ m8 j% |& u8 p- Z
/ I: y* c9 |/ T- G& x
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* D& b! x/ l5 d5 r
/ D, ~) }5 }+ \' \0 Y& K- a
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 \9 c1 R: `1 y% {) a
. F8 j3 H- k. A+ z0 B
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 J2 |! a% V  ], ?7 z+ a
0 z: h  U' p1 j1 s2 @+ Y
__________________________________________________________________________3 g5 T9 ]# N' W# O$ p* o0 A
, _0 ]/ [  m& i% |6 \4 n  t, L+ [, D
Method 13
* K' i( P- t5 v0 R; Y=========
. b/ W4 W" s% D' E4 A2 L8 p) _# [* D  _
Not a real method of detection, but a good way to know if SoftICE is
) L7 E$ F4 x6 k8 |! A# Y/ F' x  sinstalled on a computer and to locate its installation directory.
* J6 }5 p2 C: {! |$ }2 c* G% NIt is used by few softs which access the following registry keys (usually #2) :4 X; F1 H- T8 b+ r

; f: L* d/ N# z0 M/ `3 r-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( ^* j0 C+ |2 C7 S0 {
\Uninstall\SoftICE# o4 G/ r% O* }3 s
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 {7 H4 }0 d" y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; |6 {$ j, b5 y& _, |- v/ w\App Paths\Loader32.Exe) G9 }. g. k: J( b2 P* v4 |( A4 n& {

- B. l4 x" V/ w, s3 \9 o1 F
( W$ S  [- B1 [! e/ u# @Note that some nasty apps could then erase all files from SoftICE directory
, e, C# }  ~- T7 O4 W: e3 z9 w(I faced that once :-(- z) J7 W3 }2 r7 i; n: ^, Q
# I1 m( [7 g7 u3 |2 M- \
Useful breakpoint to detect it:* o: S7 U6 m  f; u
; J1 Q+ q- }. j
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. Q! ~  F4 X6 [5 i) V+ M6 X# x$ j! u- L" [5 O$ i: ~9 _
__________________________________________________________________________  ^& O7 y4 j. v
. x1 s+ J5 d: {5 J4 K6 b( T

' D1 t  N3 `# g! RMethod 14 0 x' s  q1 u2 v8 H. G
=========' Y7 _+ U: ^! F: i7 ^1 C# k

( Z& e& @) J( \7 v( R. k7 \A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 z: s0 e  `) ], P3 D; Fis to determines whether a debugger is running on your system (ring0 only).$ z9 U$ H  [+ l; P' f5 ~: p
4 h; |  b) s: V1 T2 q
   VMMCall Test_Debug_Installed4 E0 t2 J+ r; O. `
   je      not_installed
4 j# ~% k5 |4 D" _7 v& y8 Z! L
This service just checks a flag./ V2 V8 C, X3 E
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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