找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% n+ f! L7 y- |' y4 v<TBODY>
  Q* O2 y) S9 H/ r: {7 ?( V0 V: b<TR>/ p0 Z6 r3 a' ?" z0 \* x: p( v
<TD><PRE>Method 01
; `* M- t: }. P% c# Y7 O+ ~=========  F$ h5 a' s3 x3 X& i& t- m( K; R

) d" l$ u( ^7 ^& V6 LThis method of detection of SoftICE (as well as the following one) is) M5 r; @& `: Z5 e% e
used by the majority of packers/encryptors found on Internet.: a# U. J3 S2 E8 I, L6 F
It seeks the signature of BoundsChecker in SoftICE
  a9 E6 L$ Q4 v, \0 I
6 j. }9 O; r+ l7 v    mov     ebp, 04243484Bh        ; 'BCHK'
" V: @7 I- y8 B9 q' d    mov     ax, 04h
" `7 A) p/ j8 l* Q; _! P& g0 i    int     3       8 g3 _: U* }5 [# ^1 s
    cmp     al,4' H* p& g; @+ D0 ~3 K+ R2 q' `, ~
    jnz     SoftICE_Detected
: J" s) z+ o5 i4 Z! N( w% z( ~9 J
3 c' e* ?2 }4 g* A/ Y___________________________________________________________________________3 x- m4 x* s) I
' ?, P4 L9 n) Q: X! c5 g: O
Method 02. a% M$ e) i3 E) q! Y
=========
- N4 z8 y4 ^& {1 }& o# F8 \( _7 U1 `. \
Still a method very much used (perhaps the most frequent one).  It is used  Q" b. B* F1 x) a- T
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 D& h1 f- A& L7 @5 J9 R
or execute SoftICE commands...
' Z* g3 d9 X! B" k5 M& R( [It is also used to crash SoftICE and to force it to execute any commands
% K( X" z( M+ A& g(HBOOT...) :-((  ' m7 P2 \# J8 `- G/ Q6 N$ i+ q! u& s
  Y5 t6 Z6 h8 f- N3 o% q
Here is a quick description:. ]. d3 g( }5 q, O& h" j. k; I. `+ C
-AX = 0910h   (Display string in SIce windows)
  {* i7 @/ W; g. N-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' p7 `8 R3 l5 ]+ N
-AX = 0912h   (Get breakpoint infos)
' N; L6 n0 Q0 w4 L7 I+ E: q8 @-AX = 0913h   (Set Sice breakpoints)
! W5 U# X+ E/ P3 W; J! M( H( {-AX = 0914h   (Remove SIce breakoints)0 u3 i( o/ H" C# V
5 N) b. J9 @$ Q
Each time you'll meet this trick, you'll see:0 X9 i/ F5 s* q) Y7 ]0 N
-SI = 4647h
1 y! F8 G& @0 w* `: S; c! F3 V+ f-DI = 4A4Dh0 s+ L- m0 R, R0 u! Z+ R, a. L
Which are the 'magic values' used by SoftIce.
5 J9 i6 R( ^( u6 l8 {For more informations, see "Ralf Brown Interrupt list" chapter int 03h.  |0 v: m! H; u* U4 N
0 S9 ^$ U- T) v2 @" Q" A5 l
Here is one example from the file "Haspinst.exe" which is the dongle HASP2 A! m; H) ^  y
Envelope utility use to protect DOS applications:
$ U* k# ]7 r6 \; R3 @5 ^
/ J. l( z+ W4 s& z4 M' f' n, A' c0 \- I  w8 f# X
4C19:0095   MOV    AX,0911  ; execute command., e$ o7 ?3 E5 Q8 W. f& O/ {1 t
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 r1 R' c+ X  u) M
4C19:009A   MOV    SI,4647  ; 1st magic value.
* b: j% z  X: k/ w* w4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. \/ G( P% `; \+ m, E- c- A8 `7 X
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 U1 l/ E. B% c  M7 Y# {" i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! J+ g% |- v7 R* ]1 ]4C19:00A4   INC    CX2 Y- \, s' F$ |3 ?9 v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: P/ P, u$ ^& t# ~, N
4C19:00A8   JB     0095     ; 6 different commands.
, E7 U/ c+ F6 f% ]9 M3 K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 i  j. `1 _$ N; t: ?) [6 A. @4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# W) c$ X; n( c6 J" f! J
& k; K1 }1 H) d- lThe program will execute 6 different SIce commands located at ds:dx, which& J" A& O, J. \1 @* x
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 S# Y: ^0 u+ R3 ]* E9 m. M" Z( H/ Y
7 r- A! q' l' m1 Y7 T- j
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 |4 M8 X* n( P+ b: N: B9 R___________________________________________________________________________+ R0 x& N5 T- F- y) s, Y+ U  _
5 q" R3 E, \+ d* r' L

' m% O; ^" d& i0 f% M7 \Method 034 p2 {7 `$ f, w( N- k7 D& K3 W% R
=========; X6 C9 V- F* R2 a* R+ A  k
! ]/ P' _/ o8 |# ?8 l( Y
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, C0 @$ Q+ F0 [1 F4 n' r) \* ?
(API Get entry point)) W& ~" z# \1 J+ m/ _
        
6 D. \) g1 `  {5 [  n$ O7 \6 i3 I' x
    xor     di,di' b' T! b2 t! n( x- m$ _: X
    mov     es,di
+ I1 T6 i  ?1 `$ C0 n& P    mov     ax, 1684h       3 X3 ?( R) Q6 w2 J
    mov     bx, 0202h       ; VxD ID of winice
7 O: j) ^! c8 y' y' H6 v/ t0 W    int     2Fh5 q6 Q* \, e5 g2 `5 `) y1 P5 a
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  N$ m, q8 z: I6 l6 ]& f1 C    add     ax, di
+ F1 B5 }( `/ Q) l' }    test    ax,ax# s3 k( Q+ H1 Z
    jnz     SoftICE_Detected" T3 e) B( ~5 n9 G

2 u. c$ n2 d: W7 K; r___________________________________________________________________________* D* J. v; \. L
/ K, @3 N* P& H& q" l) X( N+ `, G
Method 040 ?: v0 _* ]% [, l2 V5 O
=========
* A2 F  f/ c6 D2 I" {5 z: P( q% ~; I8 ^5 U
Method identical to the preceding one except that it seeks the ID of SoftICE% U8 H0 `$ c& ^0 A9 @3 O
GFX VxD.
! n/ N/ R5 T% |! H2 D! M* g5 m1 N! V, f$ X
    xor     di,di
5 ~2 F4 b9 N, W' E2 i6 M, p- m    mov     es,di3 M" ?' k  o, [% f- Q
    mov     ax, 1684h       " h' p$ B. G9 J: N
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 Y: g) g$ E  a# J8 h    int     2fh9 u5 y, N- y! x  U( y8 |" i2 w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: ~% I+ i/ S, {7 I$ W  ]
    add     ax, di
1 `' a: ?/ d7 c( n) I9 c    test    ax,ax( J5 q+ ~! U9 K9 x
    jnz     SoftICE_Detected- V) e2 z( w2 ?6 }

  j  U) L, w5 e6 F) s. z+ z__________________________________________________________________________$ j/ v; W) h$ H5 R6 v$ ~% `
* H7 @1 W' J1 L

3 f# J! o% c0 r  K5 UMethod 055 \* {6 b5 x6 g+ s
=========
; h8 w# k) e: L6 G
: ^) \9 _/ v* f- C8 p/ F* U. AMethod seeking the 'magic number' 0F386h returned (in ax) by all system& ^( _- ^8 e9 @. k  g7 u
debugger. It calls the int 41h, function 4Fh.
5 o; @& j8 u- n0 H: M& o, fThere are several alternatives.  . f, q( G% t9 e! D- L
  f; K5 `, |5 E9 h- r  W% H( e
The following one is the simplest:! `* ?: r, m7 a% R$ `( ?) U* }

7 K. g  n- {' q- n    mov     ax,4fh/ W- M! h4 j  Z7 j# J8 z9 D
    int     41h3 M2 b% `' @, i' Q
    cmp     ax, 0F386$ \6 u5 Y; L! w' P
    jz      SoftICE_detected/ `& `. D1 D) j2 `/ v

% `' U+ X8 q/ t4 u: L% G( d, [7 G! f+ E3 n
Next method as well as the following one are 2 examples from Stone's
* d" t4 w+ B6 q7 R  L- q"stn-wid.zip" (www.cracking.net):
& E7 j  C2 E8 ]8 K" y4 `* ~/ U  ?$ p* s, a1 C3 s: c9 t% P( h2 S2 S
    mov     bx, cs
  e8 ^# J- X8 l# e0 f    lea     dx, int41handler29 P4 u2 U! o+ n  ?& T
    xchg    dx, es:[41h*4]
+ H9 Z1 Y4 f; J, ~/ N# J4 J- i    xchg    bx, es:[41h*4+2]( J  ~; B" x* a3 N  Y/ J: b
    mov     ax,4fh+ y, H: y* w& H1 V. V5 }" [+ P
    int     41h$ }0 r  Q& _" t+ p
    xchg    dx, es:[41h*4]
4 _0 y6 s: o  O% }% q; k& k8 y: E    xchg    bx, es:[41h*4+2]
% a# L7 `1 {( f4 V: \$ i    cmp     ax, 0f386h( O' J( \( \9 N1 Z
    jz      SoftICE_detected
0 ~( H4 G1 G; I( d* V- W2 N% P2 X
int41handler2 PROC% H! `# m6 ]# }4 n8 y' y
    iret
7 ~  m! Q% h, `+ ~int41handler2 ENDP! E1 S$ K/ V$ r
! x( ?$ U/ l: i

5 @* A! D5 c2 ?) N- X_________________________________________________________________________, R8 t1 J. m7 o& G; h4 N
3 b' S# Q( v4 P/ z: i& D" G$ d

/ K4 k5 k; f8 F, m$ WMethod 06
+ E9 f% I3 f" s, L: T=========* N/ }" S, [0 `# m
  T* @8 l2 u( b! H& V. |" G' \
: N: n+ F: H8 X! v: @
2nd method similar to the preceding one but more difficult to detect:) @! Q$ M: z" J# N! u+ I0 H
' m* w$ K5 D# N5 Q: ~: R

6 j0 [- @' W' [8 n. d1 Vint41handler PROC
! X$ j0 r( _7 I+ y4 ]    mov     cl,al! x1 r1 b# r0 _! N, j- ^
    iret, _1 D# ]% C( o$ g+ N6 w
int41handler ENDP6 z0 f5 G4 b6 ]- E# r
) ^( d& P# E1 ?- |" [4 ?8 R
$ x4 U- V+ J. I, o
    xor     ax,ax' D/ [* {( O2 B, |) S( \: ?3 V
    mov     es,ax$ K2 u1 f& q! ?/ P9 V" s1 l8 U# O
    mov     bx, cs
/ z; l& B. b6 i( X. ]% V" E2 j$ |8 n    lea     dx, int41handler7 W4 H1 H. t/ R
    xchg    dx, es:[41h*4]
1 u1 v& ~' J; u( o1 \+ u/ z    xchg    bx, es:[41h*4+2]
* x* `0 R% s; c! B, ~1 {    in      al, 40h% V% o! ~0 r+ c2 j1 ^8 T8 j
    xor     cx,cx
6 p; j6 E/ p1 F# L8 X& i    int     41h8 N! t+ t8 e$ R) P: `
    xchg    dx, es:[41h*4]& D1 i7 [. ~0 }: ]+ ^& P
    xchg    bx, es:[41h*4+2]' |; [1 B- [5 U( A: G/ s1 s0 H  W
    cmp     cl,al
# G3 J( C; }2 j4 ]+ b    jnz     SoftICE_detected# J! K5 W. K5 L
, d6 d) U; q3 `& K' D. |
_________________________________________________________________________* `1 ^, O+ E$ C/ R
. M4 P; }0 J! `3 K) b
Method 07' q( q6 E( f/ Z. f; E/ H/ l
=========4 F2 G. Y! P4 V( m4 e& d

( [8 k. y8 v0 |Method of detection of the WinICE handler in the int68h (V86)5 C0 P( a. }6 o0 H; r6 J1 Y8 ~) m

! O5 `8 t0 K, `! w' _9 x    mov     ah,43h
2 C2 Y' d1 m5 S$ R9 q" c3 ?" Y9 l- E    int     68h# J- h+ ]8 C  _1 H- U
    cmp     ax,0F386h
8 J2 l% B4 a" m! }    jz      SoftICE_Detected1 n8 U$ A3 M% [- O* }! p
3 L& }0 p+ W  Q2 M) H: I; `3 O; L
, U" U. U# O# r/ Y" Y$ f5 B/ M( n& Y
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: A; o2 J& v6 \* n) H! n0 p2 F$ S& x, _   app like this:$ h0 ~* y. k" T* k) G% _- K

/ N6 Y) \. w, r" p   BPX exec_int if ax==68
4 N) ~2 h8 h; i8 X9 s$ t   (function called is located at byte ptr [ebp+1Dh] and client eip is, M% T3 Q8 g. r- ?2 w$ W$ ^
   located at [ebp+48h] for 32Bit apps)" Z! p* h4 \/ r( }7 I/ X! A( S
__________________________________________________________________________, K/ y: y8 M) c; w

' z# F( P5 b% T0 m5 B1 s% k6 y7 {. O1 r
Method 08" o' Y1 x2 H  T
=========
# T$ R: @# W& o3 B$ C3 e9 A+ {
# Z) e/ M% V8 T4 _# v: d, _It is not a method of detection of SoftICE but a possibility to crash the, v! G5 S, s( C9 `& C: k1 i2 X( A; U
system by intercepting int 01h and int 03h and redirecting them to another- b0 @% W- R( r( E2 I" u
routine.
& v' u5 }& A9 [; }& |. n3 O& E0 s2 f8 VIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# w% C+ @) h( e. e: z2 w# D
to the new routine to execute (hangs computer...)+ i" z/ Y3 b" z% n- H0 s

4 D1 K% i) a6 X) ~" j! n$ j    mov     ah, 25h
2 v/ x; n1 X& ~8 |9 v* P    mov     al, Int_Number (01h or 03h)0 @/ z8 }( Z- Q! D6 {! B* w- P( @: d
    mov     dx, offset New_Int_Routine7 S. M4 I% |' Q' G7 C
    int     21h" w, l; L4 G7 E

; W4 W# v1 m0 O, q7 w% t9 Z$ o0 @__________________________________________________________________________
  S; L7 q% w" C( T- J
5 v2 x. W3 D1 ]: ^Method 09
- i7 E# H" t8 v& \0 Q' ?! T: i+ }=========
% l1 R! u. u9 o: ~- w  n# y6 y8 s0 |3 ]# _4 h" h
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; U" E9 ?" I, W+ Q( Fperformed in ring0 (VxD or a ring3 app using the VxdCall).) b! h7 Y3 R) g4 u
The Get_DDB service is used to determine whether or not a VxD is installed/ J) M6 }6 D9 |# d9 B9 p
for the specified device and returns a Device Description Block (in ecx) for: H$ t& {2 F0 g( \  {: L
that device if it is installed.
3 }2 H$ V& v2 z, q" Q9 {; W
6 w1 A3 e, x/ l/ g   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 n# C3 P# d4 L6 a( B# I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)( W, K, G$ \8 H  `% U
   VMMCall Get_DDB) u' Y' p# O# p; r9 h5 c5 V
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  b/ Q4 q5 m! n3 L) w
* k2 P4 H, `: P' L( _$ E/ K8 }Note as well that you can easily detect this method with SoftICE:+ n# \0 K4 J* [0 u# ]" U" k
   bpx Get_DDB if ax==0202 || ax==7a5fh
# B0 ^' c7 r' R% N2 Z
  c5 q+ f6 N  V__________________________________________________________________________
3 k1 k2 |6 r* w! Y2 t
7 p  f1 @4 {" y# ^Method 100 K% O8 G! p. r: W  `' }. k/ o( M& ^
=========, X- E& e2 x) D7 w  I+ X) [+ J

1 h7 l2 P% Q8 D1 H7 x=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ t1 Z0 j* M! X3 W  SoftICE while the option is enable!!
# S. C7 b( o3 C/ W! |6 i" x! |. i. t& @) c- [
This trick is very efficient:/ O: U1 r. D( p" m; r, Q2 [1 I
by checking the Debug Registers, you can detect if SoftICE is loaded1 R' ^" S1 l( Q9 i: U
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% M: P; e0 N% X  o; x# {0 A# I
there are some memory breakpoints set (dr0 to dr3) simply by reading their
4 {. H" ?, _9 }+ K1 dvalue (in ring0 only). Values can be manipulated and or changed as well
& [5 d  B1 h2 J, }(clearing BPMs for instance)" m: D& u8 |3 J  R4 R& Y
  g7 u! J3 L0 x
__________________________________________________________________________
' q+ @" ~- n$ l
6 b+ e9 E9 W2 m: hMethod 11. @2 X  ?1 M. m! l$ {. v& s
=========
/ C/ i- G$ R+ U" Q: s1 `, s
/ \  j8 \6 Q& OThis method is most known as 'MeltICE' because it has been freely distributed
- ?/ E3 B6 I; \" Nvia www.winfiles.com. However it was first used by NuMega people to allow  k- w" y2 C  b4 r3 U) J
Symbol Loader to check if SoftICE was active or not (the code is located
9 z* T5 `& N, y, Q" Z8 Vinside nmtrans.dll).- D3 k$ W6 @/ d4 S

  z# e7 y7 }1 M1 qThe way it works is very simple:3 L1 J$ {9 z, }. B; N4 O/ o- X) |
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% b9 z/ t7 ~! F$ L, w8 ^. V8 G
WinNT) with the CreateFileA API.
$ c/ c* b0 |1 s  g/ |4 I8 e5 X9 x$ ?; O. b: ?. r
Here is a sample (checking for 'SICE'):' y, x, K% n' K9 T3 ]

5 r; t& b1 ~5 ?& j$ P8 rBOOL IsSoftIce95Loaded()
, W- h: M( b7 Y{
9 V3 l& p; ~6 ^* a( ]* e, M8 g   HANDLE hFile;  $ E/ v0 c1 g1 A# Y2 {
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 ^/ f7 P  l% R* @5 g/ b                      FILE_SHARE_READ | FILE_SHARE_WRITE,4 x6 e: d7 q% H
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 {6 T( \  Z- f# Z- W
   if( hFile != INVALID_HANDLE_VALUE )5 l1 w4 ?# T; y) L* ~8 S+ L. \
   {
4 J( \) J/ {" S/ ]5 T. R  B      CloseHandle(hFile);
6 l3 [+ Z; O# y& q      return TRUE;
0 X9 k& i) Z. C* V   }3 n9 X. u( `, i* |) j# a( j
   return FALSE;
! P9 \. W8 r) Y( c}7 ]; H* l- e; |  {/ z

. g) G8 }1 `, X6 [Although this trick calls the CreateFileA function, don't even expect to be
' ~$ |0 ?  G+ O3 s+ u" ^able to intercept it by installing a IFS hook: it will not work, no way!  n* a- b3 P) g4 ]/ K6 v( F
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: i6 w3 U5 g3 ]6 D. p) ~
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 g- a+ [+ o0 g6 A* U. G. t
and then browse the DDB list until it find the VxD and its DDB_Control_Proc# s' z* {) L$ V  x6 M. ^# f
field.
% x" x+ D7 m/ K% k# T* ?; yIn fact, its purpose is not to load/unload VxDs but only to send a
% i/ [6 t5 p# `9 s8 @% Z! SW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
# f9 x+ x6 N& X9 ?& j3 V+ V) Sto the VxD Control_Dispatch proc (how the hell a shareware soft could try
" s: I. C, a; S: l$ m: G9 `0 Bto load/unload a non-dynamically loadable driver such as SoftICE ;-).3 P8 p; g9 k% Y; K/ e" c
If the VxD is loaded, it will always clear eax and the Carry flag to allow, A- C3 r! d; O' y0 [
its handle to be opened and then, will be detected./ R' n+ }4 h4 H! N) H8 ^! w* {2 K
You can check that simply by hooking Winice.exe control proc entry point
1 \/ S" R3 z6 w, i+ K! Q( _" wwhile running MeltICE.8 M: D3 U5 Q7 |; D6 Y, @/ h1 ?
& n1 c: a5 B. f2 v' n) ]3 C5 @

, _2 O8 t+ @1 l; b$ i  00401067:  push      00402025    ; \\.\SICE
: J' \, i$ Q8 |9 [) q2 O+ D$ Q  0040106C:  call      CreateFileA
0 c7 J3 }5 L- A! q% s8 b3 f  00401071:  cmp       eax,-001
$ y( z8 U; `* S  00401074:  je        00401091
+ K$ k2 i) g* j1 T5 P& k$ T( x' X- k* S" V( K6 J8 U

) Q% |( u9 l  F6 Z; m: T7 O0 lThere could be hundreds of BPX you could use to detect this trick.0 L/ X4 q! |1 d1 `  x* Q
-The most classical one is:
1 H% ^3 J( H- |! V3 M  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  G/ T% z8 h' a! X- H, L
    *(esp-&gt;4+4)=='NTIC'
+ I# P9 ~: Q* v6 O8 w$ p; h/ j
& q/ f% s3 O* y1 c: g; ^' E-The most exotic ones (could be very slooooow :-(
4 H+ ^, J! v9 F+ N0 a7 X   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , T/ \6 R# ~4 g6 ?( O
     ;will break 3 times :-(
2 M6 ^# {/ a/ [+ w: ~2 o! t2 ~# R5 p2 c5 ^& l
-or (a bit) faster:
  ~3 K! ?$ I" M; X4 @   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), V6 b, _6 d) W) l1 t/ h2 i& c) q

' s& b0 W9 b5 \) M; i   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , S; B% a3 C6 i" D& P
     ;will break 3 times :-(# Y; s# n3 C5 a3 W
) T$ W$ A- i* s# w2 W* Z" p
-Much faster:& p3 e3 A4 s' y/ \4 A5 w- ]! V
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 z' R! Q4 Y1 Q7 c+ U2 Z

, j6 r( G6 t! K" A* I1 w4 vNote also that some programs (like AZPR3.00) use de old 16-bit _lopen- C5 j0 v% [$ A
function to do the same job:3 n# {3 ~* D- j! ?

: {  q& V+ l6 d# ?& c& K/ l# _   push    00                        ; OF_READ# n) K, a3 G1 ?
   mov     eax,[00656634]            ; '\\.\SICE',07 V, d& ^- ?4 J4 b9 F
   push    eax
0 G# B$ ^+ h# C6 E   call    KERNEL32!_lopen
3 P0 ^- e! f' l: i" N   inc     eax
1 ?4 Z/ `/ T" n; O. p: c0 ~! `   jnz     00650589                  ; detected
' K$ R1 f: N$ ^   push    00                        ; OF_READ, {+ ]) Z# b& z5 Q# b- u! K
   mov     eax,[00656638]            ; '\\.\SICE'
3 ~7 I8 o, a. k* |: b/ j8 {   push    eax3 V! O0 \! Q# O: I0 U0 w' S/ W
   call    KERNEL32!_lopen
  g  [  {; R% K; i' i; C- D   inc     eax
$ L5 O9 |- ]5 G+ V7 ^3 M/ D- o" J   jz      006505ae                  ; not detected
' g4 v- v3 y  _0 P7 C  b
$ t2 x# I! m" @# k8 `3 f' S
. N: p5 f, x; K5 D5 r/ d__________________________________________________________________________- m& \9 o: t0 w& f
6 [& d! v7 b1 c- @! X4 L
Method 12# c" M: R7 c8 I, A+ q% z7 G* }
=========( f* v( E6 p( M- u# t% B
8 w7 B+ Q3 F4 m9 ]
This trick is similar to int41h/4fh Debugger installation check (code 058 o9 B1 b1 B: Z$ x" w
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
) O0 x$ E7 {, Aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# Y8 E  ~' T, _( D( m3 c, ^& v% l, P8 H& U
   push  0000004fh         ; function 4fh6 O2 G1 x" h, m, J: q
   push  002a002ah         ; high word specifies which VxD (VWIN32). m; A- h4 {2 {
                           ; low word specifies which service
# v3 Z) |, p: q. l7 s                             (VWIN32_Int41Dispatch)# `, \2 c+ e4 Y, L5 A- {
   call  Kernel32!ORD_001  ; VxdCall+ u' n9 \" d8 p
   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 a7 i! d0 ^' X   jz    SoftICE_detected
- C4 e- n8 m# ^5 ?0 l9 p9 E
# y  \" s$ h* K8 w  `Here again, several ways to detect it:
/ q) r( u, x3 D4 O
* Y: O- D2 A' l3 n4 h: h; g    BPINT 41 if ax==4f( z: |8 N. j5 H& c$ T

9 I$ @5 j6 }* I& V3 d  k; b3 Z) U' E    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 ]/ `+ i3 U" H) [4 W7 m

* h7 H8 }, e7 p* M    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ a8 {) G/ l2 G* ^
2 w" W, ~  l7 m+ M8 j6 f4 i
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 T& P  g9 p5 o' E% Y) w

) e. x/ E* r  A$ K6 N+ x2 ^__________________________________________________________________________
1 B: @8 v7 Y( c6 z7 T4 E8 ]7 M, c) S0 n. ^" w3 d0 |! Z
Method 13% J, v) J# _, y3 ]5 Z& {8 ?
=========- f8 }# \4 u3 w7 f

& u1 w3 p+ N% l1 Q) dNot a real method of detection, but a good way to know if SoftICE is1 `' E' [8 C6 h& j" q: l
installed on a computer and to locate its installation directory.( j" q9 F/ t4 N, M
It is used by few softs which access the following registry keys (usually #2) :
1 H% f7 n$ J9 e1 R& G* V1 P2 n8 d3 [" i9 e6 A
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ T! T+ K' M8 u- `7 ~- @\Uninstall\SoftICE
0 A5 x% `# D0 D# P+ G8 r, W-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
0 Z* y" e6 K- k& C% S3 E& s-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, L% p* X& U6 H9 t. L: q! ]\App Paths\Loader32.Exe
2 D, q( L9 D: L9 b: ?' C; `& f" s: d* P6 a( S
  M; m) M, R" Y, C* }8 j
Note that some nasty apps could then erase all files from SoftICE directory
" s9 O0 [) S+ d- f" J; N% z(I faced that once :-(
9 I5 b( M! ~( G5 J! Z7 `
7 [+ d. t' _) Y: ^$ L3 jUseful breakpoint to detect it:
) I/ ^! ]* v$ o: F- f) ]9 J/ c! ]5 E2 Y  @$ F# A4 @, ~
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 U: K8 d6 e: L
: y3 w5 P0 O" w: x0 s% |9 T
__________________________________________________________________________
3 n# u' C5 L% S. v/ \0 S- d: e3 b& @2 c; P" E+ [6 W. `

9 n7 [$ N. a7 U: ]4 m' M: aMethod 14 ; a1 Q$ [3 y6 u1 X* R( Q7 m
=========
) x, e. H3 ^) s8 R+ B  [6 J9 g+ H8 L5 g3 C
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 X- R' `; Y4 w/ I+ O
is to determines whether a debugger is running on your system (ring0 only).' i8 }3 a8 v4 U( y6 P2 V
+ m9 d, c- O6 I7 ?# y
   VMMCall Test_Debug_Installed7 K0 ?% @3 p' _' U
   je      not_installed& S; O" i; w. }! C" t. z3 o

/ n3 ]5 I$ b' x$ qThis service just checks a flag.
% L8 e& C5 S' A9 N  {$ @$ I# h$ Y</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-5-30 04:33

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表