About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>$ H9 ~7 {; L( U2 m# }% U
<TBODY>& b' j, o3 d# }! d0 j6 j  w% K- W9 K$ U
<TR>
$ N1 H1 j7 p2 X<TD><PRE>Method 01 $ b9 {# f! X0 B  v- Y/ t+ Y6 t
=========
8 [0 r  ~" K; L# z2 @( R7 S4 K
2 K/ K0 k7 M! z+ sThis method of detection of SoftICE (as well as the following one) is2 O- @6 x* p# j; [" Y- n1 K$ ^
used by the majority of packers/encryptors found on Internet.0 ]- @2 d2 _2 z4 f0 `2 P
It seeks the signature of BoundsChecker in SoftICE( F2 O- j) J9 K) H- E' x/ G, z
8 \% J$ |+ x+ N6 J
    mov     ebp, 04243484Bh        ; 'BCHK'
6 }8 o0 E7 t% s( h3 A    mov     ax, 04h  M6 e: {* ]: i3 v
    int     3       0 m; O: ~) X- J- w
    cmp     al,4
/ P/ e8 I) l* r: Z5 M    jnz     SoftICE_Detected
2 V# c! Y+ ^" N+ D) a0 \
2 C3 a7 V' H% s! o' p9 H/ ^___________________________________________________________________________+ Y  H& R- l5 q! a

% z6 x% n& s' H( ^& @2 q9 w- _Method 02
8 n/ J; U; m1 Y9 |: U0 ~/ v=========
+ ^3 [" a4 t: ^4 z/ h1 ?5 s
, w7 h+ m' p: Y8 f0 O$ J  IStill a method very much used (perhaps the most frequent one).  It is used6 u" X4 v+ }7 ~9 z7 S9 ]
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
& x7 L' I, @1 s9 a0 [or execute SoftICE commands...0 k7 M* h6 w# `
It is also used to crash SoftICE and to force it to execute any commands
  _) D6 n0 z- j! e* V: v2 l) v! B: W(HBOOT...) :-((  
+ h; w. ?2 A9 X7 F( F' v/ W0 S; E
& X; ?9 Y3 N& Y' O- {Here is a quick description:
$ h  E/ U/ I  k1 ?. |9 ?* o/ r" O/ Q-AX = 0910h   (Display string in SIce windows)6 j# ~0 i4 ^, Q- L2 B) a
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 C- F- l/ i. M-AX = 0912h   (Get breakpoint infos)
8 w% F# m6 |/ J4 H) C8 L/ u-AX = 0913h   (Set Sice breakpoints)
# n0 J: V  R# K- P9 @" o# ?-AX = 0914h   (Remove SIce breakoints)
% d- _- n1 w9 I! @# ~. k& z
' a/ z# [7 [' B# t* i9 \6 uEach time you'll meet this trick, you'll see:
2 J% G9 X5 K1 S/ x. z# p2 Y, X-SI = 4647h
6 R2 h2 z5 k9 U  F3 x-DI = 4A4Dh8 @, ]. U  v# ~5 V. D
Which are the 'magic values' used by SoftIce.5 p% t4 u$ U; e8 [+ y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: C) a) `' j: ^* E  T2 C! i5 K4 ^) e
2 k& d; g* A( h# l9 DHere is one example from the file "Haspinst.exe" which is the dongle HASP
2 U- F- ^1 n+ ?: B- wEnvelope utility use to protect DOS applications:
" c' ^( ^) J0 L; k1 P$ z4 {
0 B6 t3 i/ f3 `, O% z: M; _9 _6 l7 X1 U+ H$ q  n4 f) {
4C19:0095   MOV    AX,0911  ; execute command.
% O" z; d/ F( @+ R# N% s4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 l$ [. u3 c" e  u3 J6 Z1 {, p3 m
4C19:009A   MOV    SI,4647  ; 1st magic value.( q9 i# M5 i% F9 W' b  l1 }4 V
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" O- h& C1 n+ c2 Z( `  [4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ j  [1 ?4 I( X9 Y3 a/ ^( K4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; L7 B3 k. Y' [4C19:00A4   INC    CX+ L3 `; y  m$ e. b( \$ O" d
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) `$ u2 i! I6 I* g4C19:00A8   JB     0095     ; 6 different commands.) P5 I% b7 p* y7 T) k
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  E" b% `5 ~6 u' m# T$ t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; ?- l  r$ L; Q5 \' K8 d: k& p6 W1 I) f' y" m6 f, \
The program will execute 6 different SIce commands located at ds:dx, which3 j- G: G0 K8 u: `8 m
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT." D/ c9 ^9 F! I+ e8 `4 C8 a
$ R* p" b5 {3 `9 Y- [7 Y
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
- H5 {0 c: o# |" Q7 v* A. ?/ l___________________________________________________________________________
# ~' K/ z% l! I" r. o0 m% J% V, C$ Y# d& O- G% n! o1 f7 P2 V4 p- U

' h9 _6 F$ U- b6 u0 Z  H4 SMethod 03) m/ a  I) Q+ @/ i
=========
  M. y' c. G% K  g( g+ `* @& U7 B
, t9 |7 X0 q7 y+ E, s' q* DLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, {  X7 Z% r$ }& Z  K0 i$ t(API Get entry point)) \. P& H$ Z! m4 V0 Y
        
5 Y& z2 |9 T% B: N& ^9 H
  D, q& M$ C# ^4 I2 |    xor     di,di
, H5 d; f. g8 @( i    mov     es,di% X$ B$ M- @. |3 a
    mov     ax, 1684h      
8 ^( i$ z9 e4 ?7 ]5 L) V- f& U    mov     bx, 0202h       ; VxD ID of winice
! L' S! K) |+ O: [$ s9 b2 D    int     2Fh9 E0 L2 x. V8 h  G4 z0 \4 [9 K4 O
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. ~  a& c+ U3 C9 A9 B* `* R    add     ax, di
5 P4 u+ M) `9 Q- _/ Q+ O0 b+ O    test    ax,ax- S, U% |" q" \( ^5 X& q" u
    jnz     SoftICE_Detected
3 s2 d1 N/ ~5 h% |( x+ Q
# K6 N7 s/ b: T# g7 w: {3 M6 ^___________________________________________________________________________
/ n! Q: M1 t, ~3 {% V9 c0 P( d8 x8 ]6 P" b
Method 04
# K- e! Q1 T9 H=========
1 \9 s: ]& g4 U6 m$ r. N
# l. u2 k1 P$ [2 j: J" }$ e! QMethod identical to the preceding one except that it seeks the ID of SoftICE
* s4 `7 l8 V$ }GFX VxD.
; u- \0 E" S( `! [# V, @% d- W/ U, N: B# \, |7 R
    xor     di,di4 @( u. i! B3 x; ?8 {! s1 K5 U6 k
    mov     es,di, Y# M# ~9 D+ r# X
    mov     ax, 1684h       % I- ?( L* L  n4 G9 _. ?# q4 r6 W
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 ]& q/ {. t0 y+ [0 i) F    int     2fh
% `# C! t6 x( p, L+ D    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ U# E! {% y8 g+ c9 f
    add     ax, di
- X/ T+ \/ Y3 {9 F1 c' c    test    ax,ax- X7 {: `$ n5 z: o5 c
    jnz     SoftICE_Detected5 ]# {/ }  h0 L# g& t

  ?4 [' j% O( l7 e+ c3 t1 N9 P; r__________________________________________________________________________4 h% p  }7 E0 M+ ^' f

4 b3 [( Y6 Q( y- m0 x; Z  W
* @! l* [+ i  r0 K. k3 k0 `Method 05
4 i7 d  [1 ]0 a& E7 V=========" `: \2 e' c* \- ?8 R( _% ^* F
3 N: q3 k- Q+ p% C  m5 K0 b
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- q  D, X; H, s! D, X$ `$ U6 O( ndebugger. It calls the int 41h, function 4Fh." P+ w3 c& Q2 R% ~
There are several alternatives.  1 P9 z. [. R, W  T( V

+ {; e0 q; |( O8 |. h" DThe following one is the simplest:9 j! x. |& T3 l7 d

: v$ p; f8 e+ J6 T, }1 p    mov     ax,4fh% h7 Q; \0 p; g. x
    int     41h
: e- y- E5 l: }- h    cmp     ax, 0F386
* v# r- M4 z, ~2 @+ V    jz      SoftICE_detected
" X+ N' |1 d: d& o! p: \
/ j/ z" i2 B  G  {: M: \6 m+ f* q; y7 L
Next method as well as the following one are 2 examples from Stone's
" k2 _7 I! `; ]* @! B6 h"stn-wid.zip" (www.cracking.net):/ |) _' k& }+ W2 f0 F* n* d

4 z. Q% W: I$ X9 x    mov     bx, cs
8 O8 ?& [. e) I    lea     dx, int41handler2
6 E* A) ?! C# z9 e* s    xchg    dx, es:[41h*4]
' [+ J( [4 p9 E) m' m+ Y& J    xchg    bx, es:[41h*4+2]
9 s2 S5 e( ]1 T( Q- w9 Y: Q    mov     ax,4fh
* z1 Q. K6 T. T0 P    int     41h  `% P/ B' h( Y( A% Q
    xchg    dx, es:[41h*4]
4 `0 p- z9 s7 i" c+ c* @; }    xchg    bx, es:[41h*4+2]2 z! v% d  ]/ c, Q1 p  M
    cmp     ax, 0f386h
; ~1 ^; E0 \. H    jz      SoftICE_detected
4 B0 K$ _: W& o4 l: [+ v/ F$ N
1 S, t& c* m, D8 x" Iint41handler2 PROC
+ q4 G3 V7 _! @2 i5 w    iret
3 e" l: A, r$ J1 h! r. Vint41handler2 ENDP
9 c8 Z! {& l% R2 N7 P
8 ~* C9 d9 w1 j% U6 x( _/ O9 M+ V4 M0 H: m: P* l
_________________________________________________________________________, G& B, c2 R& v3 J& U

* D* _$ |. H$ {* g
" l  a, V2 B! \7 A  |Method 06
/ j0 d, D) c4 i7 a( K9 S=========
* [$ N6 s- K+ j/ H, O4 I: Z4 F' j" ?8 T, Y+ P
2 e4 G% i5 i0 H# l  M2 e
2nd method similar to the preceding one but more difficult to detect:1 L; d- c1 t# H' V
: R+ t% h8 N9 L  j% u) @5 ~& V
0 B# M' k( K+ p" N( R3 {
int41handler PROC2 N( p1 M! M6 f
    mov     cl,al/ L% p! o9 P# V, [  ~, r
    iret9 A5 r! s1 \) Z9 X
int41handler ENDP
" I$ N0 ^5 G: C; S% y' I
; x. m2 Y0 m+ n7 ~& x8 ^) p
; Y. |% O. a+ y  L# V/ L    xor     ax,ax
. D# B$ g' d! `, s    mov     es,ax
! a7 t+ ^, k+ R( a( Q1 E" M% z  F1 o    mov     bx, cs
+ O3 w0 {( X. {$ D    lea     dx, int41handler
( v, e! C  v  R8 ~5 c8 y" }! Z    xchg    dx, es:[41h*4]
: N5 ~7 g, H7 o# }- ]+ Y    xchg    bx, es:[41h*4+2]
8 _# [& ^" v" N& w' R* t% ~    in      al, 40h: C- l3 q( [0 v  J
    xor     cx,cx1 M4 v" C% j) ~) M" V' a& W) ?* ?
    int     41h; m! a7 H9 [3 f) P$ ~. P/ i
    xchg    dx, es:[41h*4]
# T% [! Z% V* b, E* l( O& x0 J    xchg    bx, es:[41h*4+2]
# a1 s2 U- T, W% U7 ^: r    cmp     cl,al! Y' j5 h: L9 l. F
    jnz     SoftICE_detected
+ \% h$ Y0 {3 X" R
) w3 t! R/ A, F" ?7 r# h_________________________________________________________________________
! \/ W- }& H* O! X/ U. B
5 b" P" r. ~% L0 S" W- @' h- ^Method 076 P" o/ Q' x6 O! C: o  G& o0 v. W4 r
=========! _* j' {$ k! T7 L! V; n4 V2 j
( r# I* k/ i+ e* ^* R9 G+ T" k& w6 r
Method of detection of the WinICE handler in the int68h (V86)4 Q0 N* S: H* k+ J' R1 @
3 u% K: b$ W* x
    mov     ah,43h, C. o. O1 U: V# u, A% \8 ~7 l9 s
    int     68h
& q% ?# d/ Q) \- j    cmp     ax,0F386h
% w6 m% s+ l2 l% l4 f    jz      SoftICE_Detected* C* A, s  N% X+ H' W: f

: g2 H: f; ^$ E8 @: j6 E. j0 |
" _. w9 W- ]; Z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; J. @; |* V) E1 r$ _) _
   app like this:
) u# `. u5 {% w$ A4 `) n. O6 I- L
   BPX exec_int if ax==688 ~6 r' `$ k9 Y5 b$ ^
   (function called is located at byte ptr [ebp+1Dh] and client eip is, b0 P) P( q4 B- @
   located at [ebp+48h] for 32Bit apps)  c  E, ~) T. d/ o8 Q
__________________________________________________________________________
# p# u2 c' ~# H. ^  ~
# k. W  `& h2 m; R( i$ [: ~
) W7 O6 c$ G: a0 x  \# tMethod 08* l' n2 Q7 x9 g
=========4 w1 V" r% J  K; U$ Y+ l8 b  u  q

! L0 F6 `9 N" {) f+ b8 XIt is not a method of detection of SoftICE but a possibility to crash the( x/ [. C4 e0 n/ x8 c
system by intercepting int 01h and int 03h and redirecting them to another
! |# l9 Y3 H( [routine.
0 W- ^9 ^7 U6 C3 N: l$ q+ LIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 s& M6 Q2 ?/ u- l) Eto the new routine to execute (hangs computer...)
( C$ t' h3 i# m' f, h) l3 d6 ~  }, Z* P1 ~. B# `
    mov     ah, 25h
- \# Q" C4 m6 c* u" z    mov     al, Int_Number (01h or 03h)8 a( m# }% m( z5 K. w6 E% \
    mov     dx, offset New_Int_Routine; x5 |2 z3 s: m; h
    int     21h
+ |% F+ @8 Q' a% G( \# c4 y" c5 e6 i* q2 z* H
__________________________________________________________________________9 u) C6 m. O" m/ I5 Z1 M, B

2 ?2 O7 x0 u. U3 g1 xMethod 09) z  {4 v: W" [, d
=========% c4 H/ A2 |' I3 U1 M. o2 M- A+ S
# E& b9 f0 x* M( \8 q& r
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 b) T( b( G  U8 k( ]( M) J8 y0 iperformed in ring0 (VxD or a ring3 app using the VxdCall).* [6 R3 v6 U. h# R+ f' M6 {& s6 X
The Get_DDB service is used to determine whether or not a VxD is installed$ @; A, b3 k3 ?, Z* \' S2 l3 u
for the specified device and returns a Device Description Block (in ecx) for
: k4 z! ]8 W. P& @; ~that device if it is installed.
8 g5 P  h2 _! ?3 H
5 ?) ?- m& z1 h4 x$ |" o% q3 G& _7 G   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 c, R1 l; J5 k' a& a   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 g) y' e+ F# O5 S! v# j
   VMMCall Get_DDB
7 A/ z  j2 W5 e- W   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ E5 |5 g! v8 a( J4 z: T$ s) u- S4 g
2 A: s6 L4 h, Q( X  \Note as well that you can easily detect this method with SoftICE:
( x) e8 Y/ b+ D! r) v4 P  V   bpx Get_DDB if ax==0202 || ax==7a5fh
2 t4 o; K# S2 q  n5 ^3 Q
" \  Y+ G& R0 T6 C4 n__________________________________________________________________________
# z9 w2 l$ t% h
  ]: e) D' t( f4 k; f, }. `* ]Method 10" [' g7 `4 B# c2 c" U  |
=========0 L; Z+ p7 w, m% A

( X$ r% R2 K+ q3 k, _=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 _# [9 F# F3 o5 o1 E) z$ p  SoftICE while the option is enable!!* U$ \6 m1 ?2 F# E+ O8 v

3 B% c8 o* M: M4 ^$ j7 R/ TThis trick is very efficient:4 p! X6 C( r. _' D
by checking the Debug Registers, you can detect if SoftICE is loaded
& w3 \7 E' Z; S& k( N(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. s* v: ^; ^' [there are some memory breakpoints set (dr0 to dr3) simply by reading their+ n% }4 M5 e+ _
value (in ring0 only). Values can be manipulated and or changed as well
6 N7 S2 b* D) C9 t' E1 c. e/ b(clearing BPMs for instance)
/ ~. q' ^+ `; N: F0 C2 R' u
7 M8 u" `  X6 {5 n% h__________________________________________________________________________5 U( @3 `' `2 U5 z) I- d' {. }6 D
$ F& u2 w% r4 }, u3 l" H  N5 e
Method 112 r( p4 K$ \* J& z
=========: `: ?8 [4 f/ V! s

: p7 c7 p4 l3 a& ?This method is most known as 'MeltICE' because it has been freely distributed
, _9 G4 }+ X6 E7 N3 Mvia www.winfiles.com. However it was first used by NuMega people to allow
; W4 F3 y7 \# f8 P3 ^8 hSymbol Loader to check if SoftICE was active or not (the code is located$ b& K; L' X' Z/ f# U
inside nmtrans.dll).) K5 C) B- A0 C, M; J

+ _& Q/ E" u+ ?: q$ d8 Y8 K$ l0 o) pThe way it works is very simple:5 B5 J; H- V' k: i+ i
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 T2 _% [1 @5 X* f2 i1 h/ Q9 M, L
WinNT) with the CreateFileA API.
0 P* w! \4 U2 }0 T! Y/ o4 u! B5 n" S1 X% Y
Here is a sample (checking for 'SICE'):
, D2 U, g* ~7 j; [1 R/ k" h' x/ i0 O- V( u3 M2 R1 Q* V6 p  W+ L# q
BOOL IsSoftIce95Loaded()! k! [$ w5 i& y4 p  X
{
0 A( {6 }' Y6 J& u   HANDLE hFile;  
, E7 e: J9 a: `- {; ~+ A  L4 a8 g* G   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ }9 O# N8 R2 Z) T                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 X' \5 J& V! C- P6 {
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" z' O6 u) c; I# I% S9 n1 w   if( hFile != INVALID_HANDLE_VALUE )
3 n: X; i0 T7 c5 `$ ~   {7 a/ Y$ m$ c( Q% q1 C; g+ q
      CloseHandle(hFile);
& }3 G: s1 J$ r* u) U      return TRUE;* I) e6 S- [9 l% d( C0 g
   }
. ^6 A6 ^0 j  \" g   return FALSE;
' y' |, i( n; `- _" y& `}$ u& }& ^* u; n/ C# P' [
4 |. d- F$ L3 i. j
Although this trick calls the CreateFileA function, don't even expect to be
) f+ r" h! Z% T  O: d5 N& f* s# ]- ~able to intercept it by installing a IFS hook: it will not work, no way!
1 d/ C: Z2 O, WIn fact, after the call to CreateFileA it will get through VWIN32 0x001F, d  u6 G( D% @! \3 r9 e" F
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* N/ T( C: {, J" q' s, n2 B
and then browse the DDB list until it find the VxD and its DDB_Control_Proc/ N/ {$ [/ q0 [/ Q. E7 m! Q5 s
field.
7 A9 b) _( x, RIn fact, its purpose is not to load/unload VxDs but only to send a + S: D6 b9 S# t9 Y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 e5 `* ]! d6 o8 {5 E* J9 {to the VxD Control_Dispatch proc (how the hell a shareware soft could try) f% Q( p9 f6 I% r& r
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
8 ^" ?) M5 i, y" `7 hIf the VxD is loaded, it will always clear eax and the Carry flag to allow
& B/ ^& A; Y) U" T! C4 r& W+ t7 bits handle to be opened and then, will be detected.% ^2 H, N/ \, @* X7 J' H
You can check that simply by hooking Winice.exe control proc entry point: u! e6 v1 K2 b
while running MeltICE.
3 n$ I. n# q% K! Q
, v9 Z! j) D9 S$ C! ]/ y! h2 `" {9 ?- C
  00401067:  push      00402025    ; \\.\SICE
! b3 T  P4 o$ s  u; }! N  0040106C:  call      CreateFileA5 _* u- z( \, E# R. g
  00401071:  cmp       eax,-001& Z* i- r! o+ q) c" K6 A
  00401074:  je        00401091" ~4 R" ~  }7 i8 k/ e. K: a, n
. m1 ?2 v+ [0 F

7 U2 l( ^. V- D4 A! C' J$ {/ y- QThere could be hundreds of BPX you could use to detect this trick.
1 S7 O1 i  k; p+ K3 w) i6 {# p$ w9 K-The most classical one is:! [7 N9 j9 v0 c( G. T) l5 k3 H; F
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; g+ ~$ W6 K4 Z/ O) R6 C4 b6 i    *(esp-&gt;4+4)=='NTIC'5 x5 }, H) ?" Z# x5 u5 M

: T6 ]  q4 S: C" a  U" W, x! M-The most exotic ones (could be very slooooow :-(
  e( ^  x" [8 h" k& U% I   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( _3 w& I1 b# P     ;will break 3 times :-(
6 z( t" U" }0 d" u. r; N" l8 J
-or (a bit) faster: 7 K1 r* |# |, I" p$ o
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 t' h. f8 n; l1 m: t. Z4 r
" _# g; z0 S5 W
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, {' k. F2 l. T) A' y     ;will break 3 times :-(
: S$ O0 x, r' L! I7 E
( x6 R* m3 ?6 m, D: H- l-Much faster:" }4 q8 E' N' U/ e- s4 M
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'  r; |$ b. |2 ^3 |' y& Z
* q. }9 e/ l. L( F7 r
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen& P9 \1 k2 ^( x3 y; r6 q
function to do the same job:
% J  v# C7 B  m" ^2 O1 @% O( S, \( g: W" B
   push    00                        ; OF_READ
" q3 W% S* C( O2 l   mov     eax,[00656634]            ; '\\.\SICE',0$ B; R  i' }. j6 ]0 W: m& f
   push    eax, `& Q5 Y) ?; _5 {
   call    KERNEL32!_lopen
. l2 h5 p9 ~& p( D8 A8 L/ ?! _% z   inc     eax
/ Q, l9 }5 z1 j8 O   jnz     00650589                  ; detected7 ?' |- B" u* ^
   push    00                        ; OF_READ, ]7 i- ?- Y2 p1 ^0 n# G
   mov     eax,[00656638]            ; '\\.\SICE'
9 Q; Q* g7 h0 \   push    eax
  B- j1 J7 ]; v$ S0 E   call    KERNEL32!_lopen
: E  o: ^% X( A% L9 [! J   inc     eax8 r7 ]' h! U" f2 \! ~
   jz      006505ae                  ; not detected% D: q% I0 D' e4 Z

1 T" O9 B' a3 [7 }- F* l1 h3 S
2 [& k) U6 Q7 w7 Y. `4 [__________________________________________________________________________
% R- u( s* M% L9 r( o2 A. B! m/ P; g: |6 R& \
Method 12# |2 z1 _6 l5 j8 h
=========
& D( Q0 V: ?0 k: |/ S& T$ F  B9 K, }/ W; `9 a$ A8 V
This trick is similar to int41h/4fh Debugger installation check (code 05
" v- J7 N7 D. T- D&amp; 06) but very limited because it's only available for Win95/98 (not NT)0 T( v+ I6 C8 ]1 }' N& m( K
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 {) M6 U; }! \6 E' \

& ?' B+ ?4 d; a, O2 W8 x   push  0000004fh         ; function 4fh
5 R) F# a+ C' p) p   push  002a002ah         ; high word specifies which VxD (VWIN32)8 I  t) f0 h7 }$ G3 Y7 N' e& V# @, L
                           ; low word specifies which service. B0 t& P! r6 P0 p
                             (VWIN32_Int41Dispatch)! E! P2 \6 _% M4 c
   call  Kernel32!ORD_001  ; VxdCall! r* Q! O6 G# b4 _* s
   cmp   ax, 0f386h        ; magic number returned by system debuggers
* k$ R) v5 X( k$ @5 Z3 U, ^5 X/ N, j   jz    SoftICE_detected
% F( T* |: J, _& F8 U# q' I
% T/ ~2 v: r# l3 THere again, several ways to detect it:
0 s9 K$ e9 D8 w1 c1 L
# N$ E+ y* O5 v; @4 l    BPINT 41 if ax==4f6 H# |; Q) J  {- O6 u  b6 a
: e+ c$ C" t% I/ W9 N
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 L! N2 J6 ?+ M5 \5 }1 D% Y* O& z* E1 X: e4 v4 x% w/ j
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ \' F5 D4 p1 T, ~* J( ~% C

4 a* I7 B4 i/ h, s    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* e4 u: {  I- L7 i0 H8 c. r
! ?. p( j  O% N  I__________________________________________________________________________" I( d2 d- Y1 q( g; A
" b6 I' s4 |! u1 w
Method 13
* `, [" [" B$ Y; D/ Z=========
& |. A, w6 E  T( _3 c+ Z9 x- n. V; {& `" t1 W
Not a real method of detection, but a good way to know if SoftICE is
4 N) Q0 g6 H: s/ }+ Ginstalled on a computer and to locate its installation directory.
8 I) K( V5 S; ?, O4 O* EIt is used by few softs which access the following registry keys (usually #2) :" g' |. |; K1 g( Y+ U& U

3 z( v3 f4 @* t! z& b+ j-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 }+ H; e5 [" Q+ J7 ^2 D\Uninstall\SoftICE
: i$ I( t) v  o7 `/ }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
1 ]! k$ X! y) ]3 F-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; o  ~, B* I5 r0 g9 m\App Paths\Loader32.Exe
1 b& W! s6 F% U6 o* w6 I8 ]+ u: X( ~1 m) E- a: B( L  T2 ~( c; z* H

. j1 E& z( y" w- w& l9 U( F- O- INote that some nasty apps could then erase all files from SoftICE directory' r4 C$ E# g1 c  H
(I faced that once :-(
6 R/ z0 i/ w% M' t2 E" W7 @! W
# e$ F+ L  u, L, D, tUseful breakpoint to detect it:
* U7 R% l  b& e: Q# E5 B8 |9 D0 J6 ?3 k( a- k/ t) V
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. {) F( b; x3 a3 ~
3 o9 q: t6 ]" g7 D9 D
__________________________________________________________________________
7 w# l5 @1 Y$ o- _9 ~& ?/ A3 a, }3 ?

# k# P7 }% o" a6 I( c# ^5 {; K5 sMethod 14
" t9 l6 s0 k+ v  g3 J' I=========
# h( r/ K5 B7 D4 _2 f/ v( q% W1 U7 X9 V, p
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 [- X6 }: I! A8 xis to determines whether a debugger is running on your system (ring0 only).
8 N/ V& S% O, Z6 }& r, }* b: J. U/ P- R
   VMMCall Test_Debug_Installed8 t' ^. S% ~$ m3 s" S$ J5 e
   je      not_installed0 e) ?+ f5 a4 G# s

- y2 p7 L( H; z% y7 k1 QThis service just checks a flag.2 P3 t: l, ~" M" m$ q* G) s
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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