About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>  Y& U: Q& Q# F9 H! z
<TBODY>
. P  E7 N! W3 {5 o3 R! t<TR>
+ F. q) C5 g, q<TD><PRE>Method 01
3 A% K: L7 I; Y, Z=========
  y* d5 D" s# T' x; h" z
  j; x, m1 R( IThis method of detection of SoftICE (as well as the following one) is
2 Q9 }8 V1 J3 ~2 Y0 C' gused by the majority of packers/encryptors found on Internet.
; R  Z' Y: a. m( R# qIt seeks the signature of BoundsChecker in SoftICE
  L" F# ^" ]2 p/ U2 n  _2 ^
  [/ v6 R5 u+ k6 C    mov     ebp, 04243484Bh        ; 'BCHK'
0 U. [3 b4 Y4 U$ q* l4 n; ~    mov     ax, 04h
7 n5 O2 N0 K- v5 l# ~! Q    int     3       " G* h) x. C2 E3 `+ \: G1 i  w
    cmp     al,43 t; _2 f# ?5 H
    jnz     SoftICE_Detected
, l: p7 u  L' M8 b9 H! \8 z# d3 ^3 `/ j1 ~6 U- Q
___________________________________________________________________________
/ ]8 e/ {4 J' ?" E) t6 h7 U$ q* t0 [/ |9 c5 z3 |8 K
Method 02
) q9 z* _4 w& }1 j2 z6 M- m( |=========
8 n* h9 Z+ h4 k  Y/ [2 e0 a0 S. Z+ @
4 v" ?3 e2 D% R4 ~' D, DStill a method very much used (perhaps the most frequent one).  It is used% P) R3 q4 _5 d# @
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 C& K  X* C8 r. q& Cor execute SoftICE commands...; z. q* O& B' u& s
It is also used to crash SoftICE and to force it to execute any commands
9 I; b2 ?8 I: q/ Q# u5 p(HBOOT...) :-((  
9 U& q' B+ Q) q  T$ y2 p. k% E( i' U- G; F
Here is a quick description:0 U4 W5 x0 Q( y9 ?& ^+ c3 Y
-AX = 0910h   (Display string in SIce windows)9 k- h  n% j. J
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) z2 u8 a6 i, R/ U/ [
-AX = 0912h   (Get breakpoint infos)" Y8 I4 X& j8 @, E
-AX = 0913h   (Set Sice breakpoints). f' O2 e" `; ~; ^) w9 j
-AX = 0914h   (Remove SIce breakoints)
$ y( J9 K+ w# h) }+ D. e
  F- n! w# [) h3 wEach time you'll meet this trick, you'll see:
7 p# L$ l6 c2 Z0 Q/ l* a-SI = 4647h
0 w4 e, x8 I& ~+ e-DI = 4A4Dh
# |6 s2 t1 m- rWhich are the 'magic values' used by SoftIce.
- I8 l4 b' R% XFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 s% w4 t1 P$ ^" E

  C: F4 d$ T1 L4 T2 JHere is one example from the file "Haspinst.exe" which is the dongle HASP) u. m* E% c) _; Z* H4 P8 d
Envelope utility use to protect DOS applications:) [- |3 ?# z5 O! G

/ P9 ]4 g2 B+ S' E4 j
% ~6 G0 i. l: |4C19:0095   MOV    AX,0911  ; execute command.
  G; Y& V( R/ u+ w3 ]4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 q) F" E9 H9 P4C19:009A   MOV    SI,4647  ; 1st magic value.1 p/ r2 W& ~* p& f! ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value., J! v; D, S4 g. |' v0 I
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
) N6 a4 c/ ~6 p* U( l4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute; O6 F! {2 H( w4 r# }
4C19:00A4   INC    CX" y  w, Q. K3 {
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; E1 k8 y" r5 A4C19:00A8   JB     0095     ; 6 different commands.
8 A: H6 B3 V0 x3 Y0 ^/ o, @4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  S" k9 Z2 P4 R- I5 K; Y# X6 n/ ?4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: }4 J( j2 a1 h( K. q+ s; i5 L& m: i* L$ M' Q
The program will execute 6 different SIce commands located at ds:dx, which2 A7 z/ b. o# B4 B9 n) _
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! v. I. G( Q7 T' W; d0 F0 f5 G' H
! N2 d) i1 @+ D2 R: i
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.) Q- |: ]5 q; x9 n$ X  {8 r8 f) n: j
___________________________________________________________________________& r1 b6 k4 Y3 Y8 i) d
# O( E+ h) z9 Z) Q0 d/ H! n
, m$ Q2 c( G9 G4 o2 R
Method 03  {+ X6 d: d& V5 D
=========
' w" N# d+ R% q" W
8 k* S6 q* ?, i2 w0 eLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 }% a1 ^7 P6 Y( U' X- x
(API Get entry point)2 q1 C: \3 c' v3 J; C* g
        . T% k! F- T1 j* o% a
8 w( }/ t# f: g. o
    xor     di,di
+ ]# b! J; K+ ~7 b6 J: q! ^9 R$ l    mov     es,di
3 s! s) U; o' _0 A5 w    mov     ax, 1684h       9 L  ?5 U1 p8 g
    mov     bx, 0202h       ; VxD ID of winice2 d7 R5 G7 h# N2 e0 d
    int     2Fh
( }& {7 s2 T  ^' ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 i" h8 [  L, D
    add     ax, di
: P* Z" S' d: O. F    test    ax,ax* ~( ~3 G- i% E# c6 o
    jnz     SoftICE_Detected
/ ?1 l1 o$ [% H* C$ ]/ [6 [' O4 e0 G; h* c$ t) Z' G2 }
___________________________________________________________________________
! @- H3 Q5 C( T" f# f: U" w8 U9 s3 Z+ R6 j. f
Method 04
$ n6 z0 ]: {! E& }  L( }7 t6 e=========6 F' R2 C0 h; O0 U2 r
4 Y3 W5 \5 o' n( h# h
Method identical to the preceding one except that it seeks the ID of SoftICE
! ~5 I2 |/ {$ C0 S: fGFX VxD.# Y4 }) D+ \( v( ~2 R' g+ K

( s4 }* `. \4 q. ]1 x8 |    xor     di,di
; C5 h0 Y! i5 ~3 k5 Z/ y! K    mov     es,di% s! A1 l  E6 v' {7 W  Z: y/ z
    mov     ax, 1684h      
8 c2 c/ D$ V: q5 r    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 u7 v  }6 f4 k2 M9 Q3 J& V    int     2fh4 [! f' i2 M% `2 f9 U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 C1 m" f* v8 X; t4 g* f. D' `    add     ax, di
3 w( Q  w) o  ]; x4 o    test    ax,ax
) O. T+ l" q& h! j    jnz     SoftICE_Detected/ n6 [! i5 m2 D% |

- a/ _9 k$ K5 R__________________________________________________________________________  T* K2 ?& {$ J7 o& C: `" `1 N. W

- x$ V- w& d8 N
& T0 m9 u8 F- b# GMethod 05
9 {, ?- ~9 e& |! b7 |6 q) ]! h=========
5 [( Y+ t, Z+ t' H% U
) K5 m  ^) _' ]$ S; RMethod seeking the 'magic number' 0F386h returned (in ax) by all system
5 ^3 X' z3 d0 H$ a9 kdebugger. It calls the int 41h, function 4Fh.3 J! L9 V5 b% i2 g# i( r' I# N* A
There are several alternatives.  * _6 x$ k7 V$ k8 e
, d6 @  j& b4 d8 a% p. D
The following one is the simplest:, d* x5 g/ `1 \+ Q  f

% c$ e! h2 V" B2 {" i( N& W    mov     ax,4fh
, b+ d$ P+ g' ?# a    int     41h9 H$ t7 X; ?& ?! ^8 E7 i* V' s
    cmp     ax, 0F386
# P: Z4 k# ~' d9 V    jz      SoftICE_detected
5 v3 p; D: B" o% |- w: b( j: l2 o; }8 G8 j3 U/ ~( q, v7 O

, O! o- g* G8 z2 C- uNext method as well as the following one are 2 examples from Stone's
1 _6 v# o* i7 }. \! U"stn-wid.zip" (www.cracking.net):
. ]% G, N6 B) q9 Y* }" Z( W7 g8 R2 A! `6 Z0 K1 V% w4 z9 W
    mov     bx, cs
6 r; c' K1 L; M7 {    lea     dx, int41handler23 J1 `) `- @; \0 |6 W8 K6 m
    xchg    dx, es:[41h*4]! a8 m1 R' H& W/ \' [) w
    xchg    bx, es:[41h*4+2], ^4 B8 e5 D$ r. w6 a8 m/ m
    mov     ax,4fh9 B. A, y7 G! N* Q
    int     41h
; F9 g2 U- r$ r    xchg    dx, es:[41h*4]
5 @. F; Y# `" x+ c: @8 s    xchg    bx, es:[41h*4+2]
1 L1 s- @/ T& ^1 d    cmp     ax, 0f386h
, ^4 r0 S* X3 U3 ]  w( g/ Q; B" B+ e    jz      SoftICE_detected/ q3 O( ?2 O/ {! ^3 e: D3 l

) v; o$ f+ l- m" O0 nint41handler2 PROC
, R+ @4 K, w6 e( ^    iret
; U; o5 c* J' H( p" Eint41handler2 ENDP" H* y* P/ J+ u4 o2 y

1 a/ X# F  A9 M+ e$ M& K, O0 f( Y  b* h+ ^' o: x9 z
_________________________________________________________________________( Z! o. ^! E8 s) J6 C3 q

) }' L/ y8 N' s) Y
: K6 @$ p3 X) {: @  @+ T& CMethod 068 C/ x" ~& M6 T+ y- ^# p
=========
* U% H# U) h1 ^9 \
" X4 D& U$ w( W, H! c6 L) M& ?
' R( T$ r7 A: y9 r  m- ~( a2nd method similar to the preceding one but more difficult to detect:5 Q: o$ [9 y! C4 c! i: z

8 o3 B' E; d! b( d5 V. I% p
  n1 {* `- P+ a+ i6 o/ C7 Wint41handler PROC2 f1 ^( |6 w  t% a3 j" R- e
    mov     cl,al8 e) k4 @4 T$ \5 H& q/ c
    iret
+ h$ _$ Z, h( ~; d- s+ Qint41handler ENDP  h. \# b- s- ~

' T# x9 s! X6 S( F$ M3 I. S* n8 f. h( \
    xor     ax,ax
% e( R. o! K, l5 \    mov     es,ax+ M4 c" I  _. L
    mov     bx, cs
4 k! H5 s- K! L  s+ {- D- _1 \# ^    lea     dx, int41handler
- O3 ?9 q8 [3 H; c% w& B: i    xchg    dx, es:[41h*4]
* A" H' Z$ Q1 u8 I5 u- h    xchg    bx, es:[41h*4+2]$ Y3 N$ X6 G% O! |3 b
    in      al, 40h6 K/ m3 ^7 @0 G8 m% T* z) B- [
    xor     cx,cx
$ @5 ?0 p' [3 r, n3 J, v5 M    int     41h
9 g+ `3 C2 y  S1 _    xchg    dx, es:[41h*4]
  A9 a& I  Q% V/ p    xchg    bx, es:[41h*4+2]
1 ?/ |; i# z3 {# T    cmp     cl,al
! \4 g' H6 G( F. |  B5 s    jnz     SoftICE_detected, l4 K. O9 N4 x% g  c" F* ]
/ G" q8 B& a( c' _/ R; u5 N1 A
_________________________________________________________________________) b, u$ K, W4 e5 r& ?, i# \

7 }3 a6 k2 d. e$ P6 LMethod 07
8 E/ Q9 X" k  U' m9 Y$ ~=========3 X, B; G' ~" c  G& p. F
4 t: H* m; x$ I6 m2 h& q$ ]6 i: _
Method of detection of the WinICE handler in the int68h (V86)* o, V5 H  \6 [- D, A' k; r" O+ ~
8 }5 F7 I/ ~5 F+ m* @
    mov     ah,43h& L  Z. |" \7 \( d6 A
    int     68h1 v3 a0 g; }3 C
    cmp     ax,0F386h5 x* C# `. k9 |
    jz      SoftICE_Detected
7 T5 C+ g  ?' X0 I' q5 ^' n; \
& J/ ~1 H% U9 j9 P4 w
+ c9 }  C8 Y" R) |=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: W; Q: k/ x! D: S9 F+ ^
   app like this:2 G( X4 b5 h9 L

: }: Z8 ?5 F1 `) T& k6 c4 Y   BPX exec_int if ax==681 Z  P) Q8 X  w1 b8 E( w9 _
   (function called is located at byte ptr [ebp+1Dh] and client eip is" x5 S' F1 a. m. X, |2 p3 {
   located at [ebp+48h] for 32Bit apps)
% O' c) n6 L7 r5 H. t# @__________________________________________________________________________9 N: z. h. ^0 l# z8 d# l" V6 c

; V: V, X) u8 y! s( s" W
6 p! K+ [9 d, H4 W3 MMethod 08" c6 D8 M# C+ v) h7 F% B; X& B: Y
=========0 f( ?; z- N  D2 O' t

  `5 l3 L  Z  {$ v) t% q. a$ ZIt is not a method of detection of SoftICE but a possibility to crash the
9 o6 C1 Y) T) W& Zsystem by intercepting int 01h and int 03h and redirecting them to another
5 M; D- K$ f, h" q- D0 T" M2 Kroutine.
* o8 d% A# H/ `7 R0 |+ fIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
8 v5 F9 T/ _1 W1 L' i- ato the new routine to execute (hangs computer...)! G9 c- f2 V' U) _
4 [# o" b+ \" B  w
    mov     ah, 25h
( }3 x7 D, f2 w& i+ C0 q    mov     al, Int_Number (01h or 03h)' M/ F4 x6 ?/ k, t2 f. ?
    mov     dx, offset New_Int_Routine0 s8 A2 m7 ?/ ?! z
    int     21h$ i( F; E, }& i' }+ a, Y8 |4 S
% q7 T6 M( T9 _, D9 F* U
__________________________________________________________________________
8 s2 A5 Q: S' r4 J3 B, @
% {  h4 O' a% n% C/ p9 wMethod 09! c6 K. _: K8 \: M
=========
/ d& Y+ }* V" b* U$ W6 X5 I$ |
& |$ y& P5 z0 C) C2 VThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ F! Y% g3 J4 A" y. Xperformed in ring0 (VxD or a ring3 app using the VxdCall).6 R1 B& H! I) [' u0 p+ l/ B
The Get_DDB service is used to determine whether or not a VxD is installed7 O' K7 L! ~' z% @0 `5 q  K
for the specified device and returns a Device Description Block (in ecx) for
9 |6 x+ j. E) Cthat device if it is installed.# v0 F& G) R2 {& v. T
% e4 K% I7 u6 c
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 q* C  `, [; ], U3 n! ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)9 L9 L( v% ^2 s' G0 l
   VMMCall Get_DDB# C. `1 R0 ?1 I. r) l( v; p2 ?! [
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& [& D% y* y2 U" j
" _0 Y/ U- B. N' m- X7 i* V& rNote as well that you can easily detect this method with SoftICE:+ C1 E, Z6 E& G$ t
   bpx Get_DDB if ax==0202 || ax==7a5fh% g) |! k, x, D5 I

+ D: o, L5 G+ d4 X1 T/ W. o' c0 f__________________________________________________________________________
: V) T9 O  t! z
& n3 i: ]1 }! z' H4 d2 }; ~% aMethod 10
2 i" d& B, `5 L* W" }; F+ t4 M=========5 d; ?( h' Y4 }/ O; @
  I7 l: Z! n' z1 \- S# p3 s- O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
# }) I/ @; n% D  i2 c; R5 ^' t  SoftICE while the option is enable!!
) ~/ j2 c" _* E+ O" A" f- x# k
; `# h5 w( [) I6 t4 L0 U* NThis trick is very efficient:9 M- e3 E/ \; K5 k% ^5 Q( p( z% r& z
by checking the Debug Registers, you can detect if SoftICE is loaded
! A4 o9 M* Y# n. e6 p2 v0 w0 O* A(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 I0 K9 V0 o2 i; u5 Z1 j" m7 k
there are some memory breakpoints set (dr0 to dr3) simply by reading their, R' n: }+ e6 b) B/ z  ]' \
value (in ring0 only). Values can be manipulated and or changed as well
* B7 [2 j4 |; q(clearing BPMs for instance)
( C+ J+ w& G$ I# I6 y# ?/ m" B/ M8 r2 E8 X4 N$ x2 Z5 ^
__________________________________________________________________________; N! ^. M! p- y3 w# Z& r
! B0 B) @) f& e& |3 @& K; M
Method 11( d" {2 R* d  s/ d# y3 o
=========6 `, y( R( K/ ?' ^
0 n2 H/ s& m* n
This method is most known as 'MeltICE' because it has been freely distributed
6 f. R6 Z- ?5 l) X, V0 ^/ L# v" d1 lvia www.winfiles.com. However it was first used by NuMega people to allow
) D8 x  `& R5 G0 r2 ^% CSymbol Loader to check if SoftICE was active or not (the code is located2 l: t) i, }1 i% X
inside nmtrans.dll).
- c5 c8 l* Z1 x4 n9 l4 J8 n
2 K- b5 O6 h; I  J' V$ [8 JThe way it works is very simple:
6 a$ `: r4 n1 K: f8 v% f8 {It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 H  b, z0 ~4 a0 s! u
WinNT) with the CreateFileA API.
: F2 g$ q/ ?1 A$ j  |
1 p" m- K: A6 K( h, MHere is a sample (checking for 'SICE'):2 f& V: O5 A& |- z& F

; w  Z3 O1 F2 O2 [$ A8 P2 QBOOL IsSoftIce95Loaded()
: ?8 I# H+ Q3 O) p; n! t{
5 z( X7 b4 C6 \0 U& n% O6 o' T7 c   HANDLE hFile;  
" U. W: v8 H/ d" O, D" L; D; x4 x   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% L) y+ x( t6 w7 g3 h
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! d% G1 Y( d8 n                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" X" V4 r, V+ d- e7 o7 `   if( hFile != INVALID_HANDLE_VALUE )5 t$ o2 r" m8 H( U1 _7 c
   {
. e* p" {+ |4 [8 c& i$ u: R      CloseHandle(hFile);
1 j3 A/ O9 ?4 M# H      return TRUE;. i8 {/ S* U) B5 \5 {4 Y
   }- Z; S& A: N7 }
   return FALSE;% M: F" t2 Z% M/ F
}( b( Y( |& X' v5 e; |( v2 }

1 d9 \1 X+ \6 ~  H8 wAlthough this trick calls the CreateFileA function, don't even expect to be2 x+ p0 c" m  n2 w1 g( O
able to intercept it by installing a IFS hook: it will not work, no way!; M* S, E" E( \& I
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
: |6 y( t  \" b) _service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 n+ A9 D6 s. R7 c$ j
and then browse the DDB list until it find the VxD and its DDB_Control_Proc- n. e( v4 O3 x' Z" l) h
field.
8 K1 j. d! }8 {. B0 P' iIn fact, its purpose is not to load/unload VxDs but only to send a
) y1 U: p% d5 \. t7 O" `, z5 hW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). u: t- h+ ~  R- Y+ z  k4 U
to the VxD Control_Dispatch proc (how the hell a shareware soft could try! D( k! b2 B; `5 F+ x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" w3 x7 @0 Z1 z* M/ uIf the VxD is loaded, it will always clear eax and the Carry flag to allow- }$ w" p; n* Y# d  U2 h* i5 Z+ y
its handle to be opened and then, will be detected.
( ]$ R! o- \- S9 ?You can check that simply by hooking Winice.exe control proc entry point) V: D' I9 F; ]* S, t" \! S3 K5 d
while running MeltICE.$ J" e2 S$ D- P+ X8 O

1 G6 c7 u" ?+ k& r# |6 m- k9 H) }8 \5 y& x, g0 E
  00401067:  push      00402025    ; \\.\SICE, j" q' v( E: L0 i
  0040106C:  call      CreateFileA1 R, r; F' A) B8 q1 b$ S. p
  00401071:  cmp       eax,-0015 E$ R" {: o; Y) _! U
  00401074:  je        004010915 w4 l+ r. t6 i
4 N/ {$ a  o+ q& y

5 Q) }* v! t/ c3 P7 V$ `: v$ a  kThere could be hundreds of BPX you could use to detect this trick.
/ f8 K7 A: K7 Q1 l+ M  b& X-The most classical one is:
8 w2 s. j$ E' [  X/ r  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
3 D  L/ [# s: W! ^3 d, E7 {    *(esp-&gt;4+4)=='NTIC'
4 Z1 M- M" U  \  I9 P
: a) C7 [2 v- C+ J1 q' R" r-The most exotic ones (could be very slooooow :-(
7 r" X, y0 J+ g& a7 d   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + e5 p4 c4 R+ @  c& D
     ;will break 3 times :-(* F% K' W2 [: X* p, G& I. \

$ u; @7 d4 i+ L! @! B: V' h" {: @3 K-or (a bit) faster: + ~* n6 E- z# ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')4 U; s. V8 d4 C! V+ V

; f) v" a; c( O% {6 U) ?9 ^   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
. p, K8 f( V! }+ w3 K) P6 I/ ?     ;will break 3 times :-(/ q. _: U7 D9 B4 C
$ Y! S4 \, R3 X
-Much faster:
# M$ h8 D8 ?; [+ |1 u* }   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( T- p2 o. Z) T2 X! @4 A5 z
) H4 R; z  N$ z+ C- F" \- [/ S
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ a+ f  L5 x; f: k8 r4 C! h5 |/ lfunction to do the same job:+ i9 r: z" V$ F" A5 l, D5 Q
% F& j, h3 \! j, _* O
   push    00                        ; OF_READ, @1 y7 V3 m9 c6 d. M
   mov     eax,[00656634]            ; '\\.\SICE',0# {0 R) x* g! U1 O0 |% ^6 K9 E
   push    eax- d8 N8 T' y7 Z% k4 j
   call    KERNEL32!_lopen
0 d) X" p, x& y( i: o. O   inc     eax
2 n$ r! [/ a9 e  y   jnz     00650589                  ; detected8 O: u  [7 K) H$ O  i/ ^5 i
   push    00                        ; OF_READ( k5 x# j8 O, M* `: b* N
   mov     eax,[00656638]            ; '\\.\SICE'1 a$ a0 {9 v8 h' R6 [+ u
   push    eax) L* p4 a7 w& r& w
   call    KERNEL32!_lopen
, J1 U/ L' @- y3 G   inc     eax
) O: l1 \& X) `  P( j0 M   jz      006505ae                  ; not detected
  _6 W! |; Z7 p# ?
' ?) ^' M' E: j/ ^5 W# d- |9 C2 `% u, J% N+ c
__________________________________________________________________________
$ e7 ?+ m; t: t/ ~% D
8 P( H- Y' o/ d, gMethod 12' _2 V* t% R9 ]
=========
, S2 [' p" `+ T( I! l' x9 Z( k! `; i, M9 [5 p
This trick is similar to int41h/4fh Debugger installation check (code 058 k; B% A1 i. m. o$ a  g
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& j# X( L  u: H8 yas it uses the VxDCall backdoor. This detection was found in Bleem Demo.# ]* R& e1 H2 L" x" \

5 T; p4 W8 ~* c5 y- V' T3 Y   push  0000004fh         ; function 4fh6 O$ O' s. B) D% `; ?
   push  002a002ah         ; high word specifies which VxD (VWIN32)
7 Z- d9 L. j/ y9 C0 U* F                           ; low word specifies which service! Y' G7 V- H$ {+ v
                             (VWIN32_Int41Dispatch)
! v- q( Y& A+ w( c   call  Kernel32!ORD_001  ; VxdCall# \* v0 `4 }- ~; A7 b& w
   cmp   ax, 0f386h        ; magic number returned by system debuggers
& @7 I; i3 i7 w  q/ |   jz    SoftICE_detected& l9 e5 o' e$ y
. t' u  {. B" l& g5 j" E! a  b
Here again, several ways to detect it:
2 ^8 [8 k2 a& f* `# U$ W! e& m9 ]  I2 H% P, m3 o; ^
    BPINT 41 if ax==4f7 ]/ q' F3 c8 J
5 A# U8 H: w4 g4 C4 O
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  f: u" O; ^- g/ c1 I2 B) z
, u& m, \  r& `2 n3 p    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 x1 }, p+ f2 x9 t0 P: p% R* b9 p- i2 H
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 L" @8 g: {6 H5 J& f& P9 Q

+ @/ e2 c5 G' }* ?) S+ h__________________________________________________________________________7 X! p* S. I: E+ `6 p

% Y* y+ k, c. [) k: f% H  QMethod 13
4 T2 k5 ^8 V8 y4 a, A5 u=========# f" b+ B/ d) ?- O

% B0 F5 s, G- K: [8 s7 v: [5 lNot a real method of detection, but a good way to know if SoftICE is. J9 V6 v+ g: R* Q5 t
installed on a computer and to locate its installation directory.8 e: t3 i5 L6 ?$ k4 @' }
It is used by few softs which access the following registry keys (usually #2) :8 W& E7 ~- ?# V

" B- K: D' \# t  `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ l, U7 |. T4 z4 s1 `3 a9 x\Uninstall\SoftICE
  {6 t4 j' u. b-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 t/ F* Y' F! X) O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. f# b5 c- X2 k
\App Paths\Loader32.Exe
  ~, o! a8 |# {8 j% C
  T% Z: Z- Y0 N+ d9 l% K) d
, p- Q( p, Y/ pNote that some nasty apps could then erase all files from SoftICE directory
# [8 k7 A3 E/ q3 p' `(I faced that once :-(1 u: ^4 d  n. y' T( @" x

9 |: D5 Y. [1 w8 u5 E7 RUseful breakpoint to detect it:# ^( P! a2 t) ^. x3 r  a
0 f! G$ K" F0 v( Q& N; h& Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 a' D) {" p/ M- N9 L! o, t
) y9 K  l% }* r- W& d) Z; o
__________________________________________________________________________) q( m; {3 h9 _+ {9 T
$ U1 Y) H. k  T: }' m- Z2 p/ O

0 I% ]" ?# D2 t9 B) u* OMethod 14
& x6 @# V+ P7 v% B7 t9 ~8 `=========
) f# i- s& v! [2 f2 i
7 d0 V8 y7 T; K& _& J/ SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% T; \1 i& v1 f5 H$ kis to determines whether a debugger is running on your system (ring0 only).
% L. T/ h+ e; C5 |3 O$ H. a. R) R/ I  Q6 a- p! D, S* J
   VMMCall Test_Debug_Installed
% d5 K4 x; h$ C3 y+ V. ]   je      not_installed1 b) E8 ]6 K; X$ I
+ z' x% |2 W  G" r% M6 r7 q
This service just checks a flag.) j; _# s# m* \& {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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