About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 w- y# _7 V  R" _$ _: H3 p<TBODY># h; a7 w3 p" e# l8 `! ?+ M
<TR>0 M- [$ m: a. C% m8 l
<TD><PRE>Method 01 ! W( J7 k$ y# y$ H5 l1 z
=========
8 q; r' q9 A% M5 g% E! s8 O. s5 p" q" D& }1 u# M
This method of detection of SoftICE (as well as the following one) is
) n/ M! Y# a) S3 k( nused by the majority of packers/encryptors found on Internet.
0 h2 ~0 L  ^* s9 Z7 W0 |4 gIt seeks the signature of BoundsChecker in SoftICE: \: H+ A* {  P3 c

8 u( b0 ~- O& N  Z# l    mov     ebp, 04243484Bh        ; 'BCHK'
9 `& |1 M9 C3 v$ j' k- ~    mov     ax, 04h- t" \" B" r7 @0 @3 w
    int     3       , d* u* {  y, R) O4 b. Z8 n
    cmp     al,40 x6 v9 X5 S( t1 m1 q* f8 a
    jnz     SoftICE_Detected; w5 g' |. X% ]* C/ Y

4 p" Z5 X% a3 P: s5 U+ `1 q# D___________________________________________________________________________
+ n* A5 L6 s( l* \4 S! E$ B
% R5 p7 V4 _" `0 t! E$ W4 ZMethod 02
1 D3 d* ^  i' E% P  L=========! o% l& A5 m6 }/ R3 Q4 M: R
) h% L' E8 h6 ?9 G! A2 s* l
Still a method very much used (perhaps the most frequent one).  It is used
9 w+ L3 ~' R1 Wto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 R5 s; A: W1 I/ w! w& for execute SoftICE commands...
2 o. z, k# s+ FIt is also used to crash SoftICE and to force it to execute any commands
5 V5 v: r: V" g( B(HBOOT...) :-((  
9 p+ w, S) u; r; D  a* x) y8 y  D) M' f' X
Here is a quick description:1 g. u! t& ~1 j: F4 E( u
-AX = 0910h   (Display string in SIce windows)' ?- _3 r/ r0 l( V0 E
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% C. R7 n* v- N5 Z) Z
-AX = 0912h   (Get breakpoint infos)6 y" @8 R7 c8 f, z+ g1 }) ?, G& I
-AX = 0913h   (Set Sice breakpoints)
; Q" q( D$ c! ^8 E; L-AX = 0914h   (Remove SIce breakoints); Y$ X( z3 ^" a' a; E
$ F. l6 ]$ g. h& ?
Each time you'll meet this trick, you'll see:
( E: j" X. B0 n/ v1 Y+ B& J; P-SI = 4647h$ T2 q' N- z( ?8 N5 Y
-DI = 4A4Dh
5 j0 d% G2 L! g; pWhich are the 'magic values' used by SoftIce.! `# F. \3 X, Z$ B6 R
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& Z" {. N  p  r  W( f1 Q; {& E- [- s2 w2 q* K8 y4 R7 P
Here is one example from the file "Haspinst.exe" which is the dongle HASP8 b/ r% U) d  Y' r9 z1 `2 Q$ ]' A
Envelope utility use to protect DOS applications:
; l4 @# I- j; _& v' m$ ^0 a$ ~+ _- W! R4 z9 h1 m! A6 z

+ B: c9 S3 ^( I  W6 {4C19:0095   MOV    AX,0911  ; execute command.3 _% J7 v" a% F2 s
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 y9 y3 ~5 u3 y: j5 a1 P0 z
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 k2 S7 {  U- j+ {2 K& L) d4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) ^; E0 U3 D6 ?7 \: v' L
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 Y/ ?2 J* E/ R1 d4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
) Z' l6 P; m* i0 \. M' y; R4C19:00A4   INC    CX
9 r% P! \6 u4 j- F( J) N4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute) Y9 H  E! \1 c$ L+ L
4C19:00A8   JB     0095     ; 6 different commands.
: ^' U) T; x; B/ L: i' r( \4 Q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 U" d; c( ~+ W4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( O; [7 U% X5 B' R6 E0 u
" Q0 K( L! t5 N% f, [The program will execute 6 different SIce commands located at ds:dx, which
) g+ c9 y  x$ P5 y# k1 E# ?are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.  X# o8 x  R! ]) b

5 J3 a8 }* r6 q4 n( i$ `* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
- a. ~3 r, y3 |5 z2 Q% o5 r___________________________________________________________________________
# l, n1 [% W5 p3 m6 {! L0 ~. Z( N/ X3 A& F# Q5 r9 v' P

3 `5 L5 W& Z6 b/ c4 SMethod 03+ H5 u' g; L. H% J' b  t1 S
=========" Z! g6 v. E& [' E
/ a) \, Q- Y3 X2 L
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' t$ W6 M/ e! ^& T(API Get entry point)! W- ]* y% |6 T; l& H
        " Y+ r+ }" m& p) S9 W4 ~7 h2 w
6 ^$ @8 v; [$ J' T! M; t) m6 r
    xor     di,di
! U) U! {  g+ ~6 j" \& I    mov     es,di
1 q% P5 D' |% T$ l    mov     ax, 1684h      
# `- M4 H3 t5 |# T    mov     bx, 0202h       ; VxD ID of winice3 m6 Y$ J  m: l0 s, e) F
    int     2Fh+ H0 C& b* m0 q9 x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( R$ a2 G# Z) U2 C. b% t5 U7 G    add     ax, di$ k% H  Q: o7 D1 ^! t
    test    ax,ax
4 b, g2 _0 }) \    jnz     SoftICE_Detected
/ u  J" [/ ?' }' [9 i
! A2 o7 h% f/ q/ Q___________________________________________________________________________
+ f- @1 G  O( U# R* p5 b4 h4 r+ _9 w/ P' n
Method 04" M6 B4 [" x: U
=========. X" s% ~* i  q7 n

: O" F, n3 b& y$ h* LMethod identical to the preceding one except that it seeks the ID of SoftICE
- Y7 e4 S! Q7 U" Z; _5 ]GFX VxD." u0 i/ k+ T: a" d: E; o$ e
& J9 R* C0 G! _+ E9 G
    xor     di,di7 s& d) I, f# p
    mov     es,di
" L. _% ?% U0 r3 e    mov     ax, 1684h       ' z( D& u* _' y
    mov     bx, 7a5Fh       ; VxD ID of SIWVID. ~8 G+ s6 }$ ^) q8 I: I* z
    int     2fh+ b; _: Y5 z* @: }: g* ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point! C+ e; l; C& T5 P" G
    add     ax, di
& }$ n5 _5 e, a! h2 r    test    ax,ax
6 U) w" j2 X( c    jnz     SoftICE_Detected/ }; P& Y# P& k4 u+ Q6 S

! k0 x! U; Z0 t" J* V1 h2 }. H__________________________________________________________________________) s, R: k" }: P, C1 W3 ~. q! Y8 Y

0 c1 f) u. q* W) z! h1 ^* O- W, q4 w0 o3 N7 z& ~
Method 05
9 |+ z+ w* l; t3 @6 i8 }9 r. X1 a2 F=========) f5 R* J9 D- X7 z. h
, Q+ g( X7 ~" f6 @  a' Z
Method seeking the 'magic number' 0F386h returned (in ax) by all system  k% K( w$ E6 L& s, p
debugger. It calls the int 41h, function 4Fh.
  @- K" F* v3 E  E! PThere are several alternatives.  2 w( N8 N, t. @, ~3 }
  S1 ?. L; N+ ~3 ^" b
The following one is the simplest:
$ s/ ]  X4 B. M, ?
0 o2 ?  {2 P9 G' ?3 P3 N2 Z! b' M    mov     ax,4fh
; g2 n0 K( n  u- {" i    int     41h
; q6 a. r6 i$ J- i1 O  y; v8 C    cmp     ax, 0F386, g9 w  [% d1 g& {$ ~
    jz      SoftICE_detected
% u2 b: y6 @# s( K& ?4 n- C
' m/ @$ ?; d1 o/ s: d
+ x/ H( |' O* o5 fNext method as well as the following one are 2 examples from Stone's
! a8 p0 I$ O, R8 n  j"stn-wid.zip" (www.cracking.net):
5 g2 ?- [4 Q9 Z; w5 b8 {& @4 M' ?. {% q% S* v0 i
    mov     bx, cs) f# T0 z: _' o2 x% n0 Y+ ^/ }
    lea     dx, int41handler2: }) x6 ~; ], f
    xchg    dx, es:[41h*4]: U" A2 B9 S7 r$ m9 ?( z; o
    xchg    bx, es:[41h*4+2]: S5 h* u% S% v* G
    mov     ax,4fh
- j' Z9 Z9 x- u* c: |, x" V& z" [/ [    int     41h# y$ M, U% ]# C# d( o0 G$ J
    xchg    dx, es:[41h*4]8 A8 a/ d4 l. R+ Y- T; b& E" E3 [
    xchg    bx, es:[41h*4+2]
$ f* B$ V1 ^1 w- k. S    cmp     ax, 0f386h
- y1 q4 t, g+ ~7 _1 p$ h# O    jz      SoftICE_detected
+ k8 u6 F8 u% Z: n% ~; N* O
8 j) J$ u! V; y- Nint41handler2 PROC
3 u! ]- t# j) `+ |5 m    iret
- B. G# C7 P3 O* H4 S9 t! Yint41handler2 ENDP
/ [- u6 V( {& @; K- @* f- ^9 M8 x3 U, M  c

, o6 ~1 X* W  s1 Q5 O3 U_________________________________________________________________________% C: ?) q1 f! z5 w8 o$ f" H

8 A5 o+ Q: p+ r- w, d  v- c4 J4 r0 I
Method 06
' S) J& Y/ w+ o7 z=========
4 G2 I" v" V. Y1 I# Z1 p9 m* L, g) h$ f. L) @

, ~& [9 ?! k) m+ V) Y0 b2nd method similar to the preceding one but more difficult to detect:
! l+ ?0 r# F+ H, [; G* u" n* x* {! V2 N5 f1 C/ d% n
- @, s8 C( Y) Y& U  [. r) B7 q9 n1 v
int41handler PROC
4 s4 R# q! D/ j# i    mov     cl,al0 _+ s0 g9 I1 L% g
    iret1 k: j: z8 Z: r% H
int41handler ENDP
; i! M! a0 ^3 u3 z5 K# B
5 h* Y7 m* M! ]1 S- M& q) |, o* M. n0 b. F9 Z3 E
    xor     ax,ax
6 p; W# e( o: T    mov     es,ax
+ `! X* I/ P3 D" n* S/ m7 x    mov     bx, cs* z+ O! O! l7 x% F1 ^& B
    lea     dx, int41handler
0 X3 Y6 L7 u- _+ [    xchg    dx, es:[41h*4]
" h# `; u6 {3 Z% w    xchg    bx, es:[41h*4+2]3 a% z- E* ~# g2 i4 |* A; I# N
    in      al, 40h7 g0 J3 s: |3 S% s8 R. ]
    xor     cx,cx) H2 f$ k+ j% Z, T- M
    int     41h3 o/ ^4 X0 U; r5 N; J6 m
    xchg    dx, es:[41h*4], j3 i! D+ o& U% W9 F
    xchg    bx, es:[41h*4+2]
; @9 x9 N0 E# R8 O7 j: T    cmp     cl,al" {. G1 J& g/ a8 J8 }* K
    jnz     SoftICE_detected& a8 c7 ~- T" S2 C

% X/ Z1 Q& V: c8 a, I_________________________________________________________________________
; t. ]# t+ _) f9 X- D2 B7 o# W% P# {3 {! S/ U8 @  k5 G$ d$ B7 q
Method 07
# E, g* J8 B( U% X=========* Y3 g) o- `% `+ x7 ?/ `1 M

) ?. C/ \& j* WMethod of detection of the WinICE handler in the int68h (V86)! R# ^' u, F# s2 v; v: J
% C- L, k; A& U, M7 d, ^
    mov     ah,43h* R7 ?2 ?5 b+ F. E
    int     68h
( ^: t$ L, p' R4 e    cmp     ax,0F386h9 h3 R5 Y. p0 `  v& z
    jz      SoftICE_Detected
  h' o3 ^- ~' M1 l7 Z; ], z6 L: T. Y3 @+ p: s& h: }1 s* t
5 U& P4 V5 V' c" J5 B. y1 N9 o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 C6 k- Q$ G$ S" X) y; t6 z6 D; n   app like this:
3 s: v& Y' F' \6 H9 @* L( `  p- X& V6 X6 h
   BPX exec_int if ax==68
) G" m& D  C' ^9 z" S, G+ |5 E3 O   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ u% [2 p: m9 ?9 Q& {1 {* @   located at [ebp+48h] for 32Bit apps), x% t6 C1 x$ C3 S0 }
__________________________________________________________________________- F: H( f. V2 B
- l2 R$ s- e4 x, Z+ T$ N9 J- [
+ O: F, f  a$ I% ~' c
Method 08
! Y% Z: P8 Z# r6 C=========
5 Q: F$ f( U8 Y$ D$ m' j
$ S+ S. L; y3 D6 zIt is not a method of detection of SoftICE but a possibility to crash the! {+ A) P# Q' Z" [. M7 K& U( d
system by intercepting int 01h and int 03h and redirecting them to another
* I! @( f, k+ a! X0 [routine.
! a" P9 l' @' P2 c, RIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ d3 {1 {* e, X+ L, m
to the new routine to execute (hangs computer...)+ u2 w; a& h1 p
$ E8 d# [# [' |  F2 Z
    mov     ah, 25h
- ~, r, _1 @9 n: m7 y6 y" f    mov     al, Int_Number (01h or 03h)
) U2 d! R5 z4 @" W( G    mov     dx, offset New_Int_Routine+ ?6 l* O& j# G3 s+ ~9 B2 |# x
    int     21h+ `/ j& J0 O- H# F
. q& _( ]; q( q8 K7 v, p
__________________________________________________________________________
3 g. s/ C' C, Q8 F* r
' y, R0 B1 f0 [Method 09; s% L9 Q' ~# I( K
=========
* |- P( S6 E, q1 |& L) R
6 O" K+ Z) c$ O* ^This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
7 m3 e1 {/ U3 e! w) j) Tperformed in ring0 (VxD or a ring3 app using the VxdCall).
/ g& D/ P7 L; ?! u7 S' ^" SThe Get_DDB service is used to determine whether or not a VxD is installed/ [5 Q$ [* g' K, n
for the specified device and returns a Device Description Block (in ecx) for
4 c9 _- @0 ^0 ~/ ?6 ?/ }! Gthat device if it is installed.: c% ?$ @9 a. ]) s+ Q' v( q" ?
4 Z& q" \) F+ z& E2 G+ l! [; G
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 y: u% d% i$ p' q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
: [5 ~+ n5 G* i3 \1 O9 N( n* J! ~   VMMCall Get_DDB
/ l/ x, [- F0 G6 u: D* o   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed& V# t2 B" r! O: j7 E
- G4 A& z: v$ R5 r2 Q
Note as well that you can easily detect this method with SoftICE:" [7 G. s4 T8 U5 {* P& X
   bpx Get_DDB if ax==0202 || ax==7a5fh& V" H5 s- b+ C% P( |

# N0 p1 `3 e/ G; d2 T5 G6 i__________________________________________________________________________
2 B' w" ^: L' _, o5 B' X, ~# Y* H; D! Q5 R+ O
Method 101 E& R5 L( Y2 l" ]6 _0 K1 m
=========* ~6 K: q. v" `

8 {0 L0 k6 q! ]9 U$ H* r=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 J8 [* x$ y+ V6 m; H
  SoftICE while the option is enable!!# t; ^* N8 a- p8 q7 u

/ O. }  r( \' I  W; g. @This trick is very efficient:) s  p1 v9 t0 }; [6 d, z  m' h
by checking the Debug Registers, you can detect if SoftICE is loaded4 t, L+ [2 |  C% [4 W) v& s
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ B6 m! a  \1 i/ q  {+ tthere are some memory breakpoints set (dr0 to dr3) simply by reading their# w, S- @7 ?6 Y
value (in ring0 only). Values can be manipulated and or changed as well
9 Y! X' U, b; z$ u* E; m: F1 Z* r(clearing BPMs for instance)* j  f, T2 E  q2 n) ?0 {
, P' |) Z# N: U9 t
__________________________________________________________________________
8 T5 `* K/ n3 _, q0 V) Z# k# m( E4 q  Q8 f6 B6 M. R
Method 11% J8 U; z+ O! `' @+ m; b
=========/ {; K! {8 Y( t9 }; m
1 v4 f0 N4 F9 \
This method is most known as 'MeltICE' because it has been freely distributed
& _& B# `3 k2 ~4 o1 K9 k2 I% o1 Pvia www.winfiles.com. However it was first used by NuMega people to allow
. W1 P9 V; A( G% U* t. q7 \Symbol Loader to check if SoftICE was active or not (the code is located/ Y" F$ w, w+ _; t' B, l/ k% U7 h
inside nmtrans.dll).4 Z) Y! Z) v. e' |- `
0 c, _' }+ ?/ _2 d0 V
The way it works is very simple:: e; a  i4 Z' G8 G3 M
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( ~4 c" j3 t8 \4 b9 z: X. j; d4 G9 OWinNT) with the CreateFileA API.
% z" F+ l' N1 y* B% u7 `  g  h* f* B+ F: T5 `+ O7 |8 s
Here is a sample (checking for 'SICE'):
  z' d( j5 y2 k2 c8 m& L/ F$ `% c
BOOL IsSoftIce95Loaded()1 B; U+ A' a; `: K. c
{5 m5 t4 L0 z8 e6 u
   HANDLE hFile;  8 ^$ w& J1 v( d6 T$ @' j
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 i2 D$ d+ D4 K  D% p! g! K  ^                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) [3 k) j/ L( W* P  S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 t( F1 `9 r$ [0 r) e2 {+ Z! @
   if( hFile != INVALID_HANDLE_VALUE ). {. d& _3 _3 J( G1 x
   {- Z; W; H6 C/ q) G7 V' {! r
      CloseHandle(hFile);
! A. \  J# Y# G1 R: G      return TRUE;
9 l* `6 s$ V' \, }5 V   }' C+ i( Q# U# ]; j  s" `% c0 B3 c
   return FALSE;6 `! c; q% c6 i3 e- S9 X, f; P
}0 |  b9 C7 w% e. l, {! U

& Q2 v* W: {+ K2 w  lAlthough this trick calls the CreateFileA function, don't even expect to be. ^# x& q7 h" [* f& |) F8 f
able to intercept it by installing a IFS hook: it will not work, no way!
2 s: T9 P* v" T/ \. SIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
" N0 G5 o$ F6 h/ J2 cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)  {; P: E. W1 E: Z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc! M9 `# I; K  V4 i+ G6 T8 ?% i
field., A; v5 u3 \* u) E
In fact, its purpose is not to load/unload VxDs but only to send a 2 y0 e- i3 ?4 X+ G
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 G+ I& d; M0 s) Q# b% R
to the VxD Control_Dispatch proc (how the hell a shareware soft could try* L: [% Q* \% s/ U
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 a) D8 C* h' W) c; nIf the VxD is loaded, it will always clear eax and the Carry flag to allow
+ \0 B2 t# Q+ e/ E- l  J& @, K- Oits handle to be opened and then, will be detected.7 c, r7 ~- g$ c" H
You can check that simply by hooking Winice.exe control proc entry point; ~& }. z" P* {/ i  S5 [4 r# I
while running MeltICE.
+ }3 b4 m6 @% H) ]2 L/ E- Y
/ o8 Z; `& M0 _* q: M! b8 R
( E: H$ y/ j0 U! M- \3 o2 F0 w  00401067:  push      00402025    ; \\.\SICE
9 H4 ?0 u* `2 r' u  0040106C:  call      CreateFileA5 N; C$ _1 Q6 \7 b0 h/ V; u
  00401071:  cmp       eax,-0016 W* D5 t* M: O3 P" C
  00401074:  je        00401091- |2 |  \: R' o7 `% `- A

$ ~& S$ P; n; t  ?6 w9 R8 d
. G: Q, F0 g) \+ g3 YThere could be hundreds of BPX you could use to detect this trick.
0 |! W& C3 F* ~% Q$ j2 y* t2 S: s9 Z-The most classical one is:
- e$ _+ @4 r) K& w; D% S) X  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
. M, Y3 g* k* n  G    *(esp-&gt;4+4)=='NTIC'
% X( L. Y6 W6 t! |: _* h
4 N% o& U5 t9 q- G5 b-The most exotic ones (could be very slooooow :-(8 D1 J; `* c7 J5 {% ~7 w, V
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
7 v, j, ?) S8 }$ o3 D4 @     ;will break 3 times :-() ]$ w/ V+ ^* P5 P7 j! y
0 Y5 V0 [7 P; a# n" `# n  k
-or (a bit) faster:
( V$ J' R$ U, c) I- \. @; o7 l6 ~   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 T' h! h5 I8 @: P) n
6 @$ C  p; E, P& C3 \% J
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 [4 v3 x7 O, P     ;will break 3 times :-(
, [% ^* o5 }5 c0 y8 t
7 m0 J# m( M- C6 {  D1 M0 f- U, a-Much faster:
- l, j1 }. i+ j' P" s3 H/ s1 \+ Z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
4 L5 n. h3 f" i7 x5 b( l" n8 M6 z8 ^
9 f9 H; d' G  }2 u+ t6 h' @4 O$ fNote also that some programs (like AZPR3.00) use de old 16-bit _lopen/ {5 d1 Z, o- `1 C
function to do the same job:
! ^7 f% K' p: k4 i
* N6 {9 q1 \# L& O; \# m) U   push    00                        ; OF_READ
% r/ j0 t7 b- p, K7 ~   mov     eax,[00656634]            ; '\\.\SICE',0" |' V5 M$ O: q# U$ r2 Q  g
   push    eax
9 x& c" b; z6 I# ^# y% i   call    KERNEL32!_lopen
5 f% U9 R0 I+ p, e  \   inc     eax3 N( Y, r  x) q4 }, W: u: O" J( l
   jnz     00650589                  ; detected
! X1 `4 M3 ]$ [& s; w- u   push    00                        ; OF_READ, b, \6 v# {% K+ }
   mov     eax,[00656638]            ; '\\.\SICE'% F& k# b& D# w: b5 k3 E* b
   push    eax3 }# X3 B  |4 t, O$ k; `# B. _, X
   call    KERNEL32!_lopen
9 z8 I6 Q+ h4 H& D9 r  V   inc     eax% x+ f. h# [5 U, b+ O3 m  }
   jz      006505ae                  ; not detected+ f7 g* O- y1 W( y6 |0 d2 D7 `

6 K' d4 d! h% B8 M6 Q0 u4 \( M4 X& Y. C6 {' n1 ]8 ^/ Q
__________________________________________________________________________
6 ^2 d$ r5 e, ~0 ~  z6 h( U4 o+ X) Z5 M1 j" H
Method 120 e2 _9 C0 b! e: ~; O5 G) r3 P
=========
4 ?: Y; v; z( q, B  A. h& a
  i7 X4 B' V1 I( V1 hThis trick is similar to int41h/4fh Debugger installation check (code 05
4 j- q5 J+ w6 M% n( r; ~&amp; 06) but very limited because it's only available for Win95/98 (not NT)  D) I% Z" k' y: j9 V9 \1 z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; k+ w' |+ P/ e' E6 v! t6 |& ~) u; U" z8 w3 j" |7 ]; p/ c
   push  0000004fh         ; function 4fh$ _6 ^8 x/ }) v% w1 W8 H& l1 C
   push  002a002ah         ; high word specifies which VxD (VWIN32)0 R4 X! H' h; d5 U: S$ Z
                           ; low word specifies which service
1 R1 r1 n. [9 U8 I2 U                             (VWIN32_Int41Dispatch)
- J& H  `0 ?% t# l! v# C0 o  [0 u   call  Kernel32!ORD_001  ; VxdCall
, j7 ?2 K& g1 r" E1 u$ s; D& P   cmp   ax, 0f386h        ; magic number returned by system debuggers' S, m% B. c4 R. q5 a: P* ?+ X. ^
   jz    SoftICE_detected1 g8 Y: `" Z. |: h1 j

6 ]- J) x7 Q3 x0 Z% R6 S9 _Here again, several ways to detect it:* Y+ O" R- c9 s) {! }8 ?
6 ]6 J  @5 i+ f
    BPINT 41 if ax==4f+ z4 a' H9 r& r- K1 }5 P& E+ `

: r5 q- z+ g& j* o& n5 y    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 x  j: V% e0 ?+ Z( d/ a. e! P8 Z6 p" ]6 c( w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 Q, s/ a8 Q" `6 Z, a5 w: Q$ D, u
9 ]# K, n! J  ?9 Y7 r- b    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
3 |4 y" T& @/ _. T4 Q7 j8 n% Y2 ?$ V" G( q" a
__________________________________________________________________________6 y# d, X  x. R: f3 t
7 Y9 ]' w$ Q& R( M2 z6 u: z
Method 13+ h2 J  z) m$ o1 w. W
=========' I9 A# a; y* f3 A% K! C
& {3 {0 j/ Z' t2 `! J
Not a real method of detection, but a good way to know if SoftICE is
- K! n' p% \* F& ]6 Z# ginstalled on a computer and to locate its installation directory.7 A- M) g8 T4 ?" a7 o9 A# j
It is used by few softs which access the following registry keys (usually #2) :
/ w4 Y) V) a( ?$ Q9 P
8 ?' }" U4 N4 c6 U+ R-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* ~0 N0 x- q* r* B
\Uninstall\SoftICE9 D2 f" P: _; T( L
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE2 o; O/ ^- }# s
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* z5 U7 S# A6 o' {4 U\App Paths\Loader32.Exe
& I8 @) X$ O7 ^1 z7 k2 w
" W& W0 d% u" R7 p$ {5 s7 i# B$ ?( e8 m  l: g( f; o) D
Note that some nasty apps could then erase all files from SoftICE directory
2 f  t  Z# M6 }' j3 o(I faced that once :-(3 e( R: d7 D3 i6 j; O
7 d% v. J4 f! x6 e5 H5 d. ]
Useful breakpoint to detect it:0 k- S2 M8 \2 M& r4 p7 g( d  h3 H

+ V  Q# a6 p3 i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* h* B$ C  \, O  S- g: l, o/ `, G* q& D, H
__________________________________________________________________________
) `/ ?, x0 i" E" b
  y$ E' k* w" ^9 U/ X& f) i* u% `
Method 14 0 G; p! g( _" Q8 {* `
=========/ i9 X  l* x2 j7 f
" P; O6 P' Z  e- ]: Y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 R) {# s5 _" l2 z% S9 D$ k
is to determines whether a debugger is running on your system (ring0 only).4 k" K" Q3 f) o9 E6 V/ e5 ^8 o
5 j% K" b9 a, m* w9 `7 L
   VMMCall Test_Debug_Installed4 C9 L: R( E9 ^3 z* D& h
   je      not_installed
& e" [" a& Y; n! ^- Y, ^; n" }( z( f& w4 z/ f
This service just checks a flag.
+ \! [8 ]. x" S7 i$ u. s</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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