About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' `, G6 w* u' M2 }3 T7 S
<TBODY>1 D/ q, j" b" _6 L6 B  ^- Y
<TR>
; H0 T8 {3 j! N  t6 c! a. o<TD><PRE>Method 01 - d3 ~& Y4 B# E! q) ?8 J1 M
=========8 w" y9 K; i+ p6 o# ~. t+ G  G
8 ^3 j6 _$ S' a3 r
This method of detection of SoftICE (as well as the following one) is% n! A7 I3 h* q/ B* Y  T
used by the majority of packers/encryptors found on Internet.# x( X( v; V. \
It seeks the signature of BoundsChecker in SoftICE
  z/ x4 X! _% `2 c
5 K6 a) D) b1 g2 F- [3 y    mov     ebp, 04243484Bh        ; 'BCHK'5 S7 z7 O5 }* P$ {. l# H
    mov     ax, 04h) ^9 L- R7 G: c0 Q/ H+ b3 V4 v6 ?0 W
    int     3      
* q. k. r: }0 O1 m2 x# P    cmp     al,4/ h- ^% ?/ e# p- j+ F$ i7 M
    jnz     SoftICE_Detected
( A8 H5 G0 O0 n6 J/ P. B0 u% N+ |: Q# T. F+ J, A
___________________________________________________________________________+ Q: d: R0 n  y* F0 D

4 i) K1 C5 u) `* ^Method 02
! [% d9 [! p% U3 z3 f=========2 _4 b3 A) ^# w. j) [; J

5 L- i4 r0 z* \5 \, vStill a method very much used (perhaps the most frequent one).  It is used
/ R  n* B* C9 P6 A! O. bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ N( Y( V; Y' _( Z- l' Yor execute SoftICE commands...4 B8 j1 ]. C( ?& [
It is also used to crash SoftICE and to force it to execute any commands
' U8 O; ^# e8 f, K4 T8 y( G(HBOOT...) :-((  
7 d, g: h$ V/ @! [. I; a* j
. ^8 t; T6 s* Z8 ]8 n4 hHere is a quick description:
9 d7 H) H2 e, Z* X-AX = 0910h   (Display string in SIce windows)
8 @# u6 Y( r( K. U. W-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& N% D7 |4 x5 N3 G2 D. R
-AX = 0912h   (Get breakpoint infos)
4 I: t. s0 O- y' [7 N. ]# G# p-AX = 0913h   (Set Sice breakpoints)/ `) A, B8 H1 r8 O, A/ G/ m
-AX = 0914h   (Remove SIce breakoints)% u! S/ ^$ c( w; u$ q

: l1 s! F1 V2 Q" ?* c5 U+ \Each time you'll meet this trick, you'll see:
& L& @4 `. r% y% }" h1 G( X  y* E-SI = 4647h* }  G) `4 a8 x* V0 ]
-DI = 4A4Dh/ V/ q& q' `4 U) \
Which are the 'magic values' used by SoftIce.
# z' x! ]" c& D5 m6 sFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, J) h( c1 ?4 T* K7 V7 C& E8 l, p" L' Q
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" i3 D8 f; G% j7 f' Y# d$ }Envelope utility use to protect DOS applications:
" }! V7 h/ C; T/ N9 U! b6 j! ]2 P2 w! w, i$ ?9 C- }% Z
! w5 z; W# z+ i
4C19:0095   MOV    AX,0911  ; execute command.$ D+ j" Q: U/ c8 g4 b1 P
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
% b4 w% q& B0 X& n, Q. F$ I$ F4C19:009A   MOV    SI,4647  ; 1st magic value.
% I( L% b7 \6 e1 S4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  c* D9 \! M. }+ y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
2 L/ O4 z0 `3 `4 F1 X4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  c+ V$ I; W9 s( ?
4C19:00A4   INC    CX
4 W& x- O) m6 h7 c& U7 ^/ l4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# D: M5 i; a2 L" s0 U
4C19:00A8   JB     0095     ; 6 different commands.* x; e5 I! u0 u% S. J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% m- y* M8 H# p5 _1 }6 f! l& H) ~1 U
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); F# B4 D( c) w( E- q7 N

; T8 I( Y' g# O- n! C( tThe program will execute 6 different SIce commands located at ds:dx, which* a. F/ B1 _- o6 |. W
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
" n% R+ _/ p, G
' H/ |! V3 D  w, R! }* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ ~( ?, l( [1 X7 d0 B6 s
___________________________________________________________________________
0 z4 X" u6 t! w$ p( _1 z) P" u
5 \% ^9 L3 t- I2 f8 P* i3 a
5 d* c- z/ K- A+ ?Method 030 q, Y+ _, ^  l8 K; l
=========
/ d7 @$ n5 |" ^  D, Q+ t3 H; k' j
7 X$ M+ Q8 [$ r4 [* M! O- ^& MLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ J/ z6 }& V+ x6 V5 I(API Get entry point)/ P" I( p8 x$ K/ D* ]
        , q3 M: f- S" ^7 \' Y0 i' F
2 |1 k+ V: D9 X0 ~& j4 |
    xor     di,di! B+ b# _: G: ~3 J" L0 i7 M
    mov     es,di
+ M# c) |! ^6 P( [/ L/ e  H    mov     ax, 1684h       + ]4 ^7 H) ~- {- u' z, T" _& F3 O
    mov     bx, 0202h       ; VxD ID of winice
0 M# r# r( j, `2 i) t1 f    int     2Fh5 S2 l/ ^3 M" W; W, u! @+ D8 W; z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; i# a1 E' S- q( K- r9 w    add     ax, di
& l3 S5 z1 G# ~    test    ax,ax
/ w' E9 ^6 V" K6 a$ }# M( C    jnz     SoftICE_Detected
3 e3 Y' Z) H) E' B% N9 j. N3 K+ q2 t  P7 [7 W; U, ^! m
___________________________________________________________________________
% U* Q) h2 g0 l! e* \8 y% M
! E& c* m6 y) {Method 04
# p8 i+ B" f" y) ~/ P% N9 ^=========1 U# J/ l9 A% f1 P. g3 u

) {- I  U2 H# V1 p; oMethod identical to the preceding one except that it seeks the ID of SoftICE+ b+ W) P: Q8 z, b$ S  p
GFX VxD.
; ]6 [' i- x5 W/ I+ @2 p3 m, f" a$ n+ j1 ]
- s: z+ G; D; @- B+ Z    xor     di,di! a- Z, m& B. [# Z3 y
    mov     es,di( Z0 p" s4 s3 X
    mov     ax, 1684h       % [& i6 W) x8 a' v$ P1 o9 w3 L
    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 L' t8 o4 s% e3 s( u; C4 p0 a
    int     2fh
( O+ i1 F7 N4 t; u& {3 H# @    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 a) A# z. f, i* h9 a7 O1 d
    add     ax, di
- E& C4 b* d: f5 i1 U$ p6 h    test    ax,ax
- [- i3 W' A4 v, @    jnz     SoftICE_Detected( Y" x0 F) y9 |# o. o8 r
, r  h' Y% s. H7 ?  J
__________________________________________________________________________
* ~9 T& q5 G' ^# }7 q+ _! R3 b) a; j2 N2 H3 I: N
8 P' Z# h: k6 E$ k
Method 050 s3 _1 v4 K3 G+ G6 ^5 U5 K$ w
=========
4 S* t9 C, O, O" Y% A$ @+ d$ L+ P* e2 M' K6 V% `  S% h+ Z
Method seeking the 'magic number' 0F386h returned (in ax) by all system' @# G: R( ?7 T6 v
debugger. It calls the int 41h, function 4Fh.8 S8 u2 p8 G; A) n; W, G1 ?
There are several alternatives.  
2 i+ |4 Q# Q' z  q  s! ~  H. u. W1 M
The following one is the simplest:. [4 J$ U$ S0 u
7 C, Y( B, I' M7 Q5 T- K4 s$ ^
    mov     ax,4fh0 I) N9 N2 j, g2 K
    int     41h; F2 q/ R9 Q! K% a( C
    cmp     ax, 0F386
9 r$ n! F5 w3 @    jz      SoftICE_detected
6 T  Y+ |' g: r: P; s4 k" D6 {8 X+ o0 T7 k& K

' I1 x! x9 e: o9 ]" p* }Next method as well as the following one are 2 examples from Stone's - T/ s8 o- s% C; [
"stn-wid.zip" (www.cracking.net):
& |- E4 d, k2 T8 z
$ \. u* X- w+ G1 X" R2 b  e3 C! S    mov     bx, cs! @0 a8 G7 E( G6 Q& g
    lea     dx, int41handler2
0 U" ]5 m: E$ U1 U# N& N    xchg    dx, es:[41h*4]- ~+ [0 O" J% Z+ x  H2 }! \
    xchg    bx, es:[41h*4+2]3 C  D# }5 L) e5 }1 _3 j
    mov     ax,4fh3 d' [) S2 h* {
    int     41h  X* N4 x5 m, ^5 a* ?
    xchg    dx, es:[41h*4]$ ?  P/ c4 e8 l5 X3 S; G, \
    xchg    bx, es:[41h*4+2]
# u& W  w5 G& a9 T! G* Q    cmp     ax, 0f386h& X1 ?* |) O6 y7 ]/ J: o/ X
    jz      SoftICE_detected
7 A  \) v8 c9 `! T: l* D+ z" C. g; u. p) J/ I
int41handler2 PROC* c% Y  _4 r, }$ t* j$ X
    iret
! U5 @) z4 k2 U+ ^. |  G: Kint41handler2 ENDP
1 @$ i; _/ x3 \& j1 y8 a( O* ~6 ~
7 `# ~' W$ @3 r& _5 J" d- L. }0 r1 _
_________________________________________________________________________
6 y" b5 Y6 }' n, J* g
1 U4 N1 K/ A& [% q: q9 m4 |1 B2 |, u5 }7 D$ o
Method 06
- [( \, A/ `1 d6 ]/ O6 \=========
+ x- z# w; Y) u% q* n) k; {4 t$ z" M! W' j5 r4 o# I+ I6 C

  I7 A8 k( A! g' ?8 ]2nd method similar to the preceding one but more difficult to detect:
( e3 u( o1 m0 i, r% Q
& c2 @3 ^1 s  Z* Y  m. y+ |% d" Q: J2 b* S( ?( \7 t9 K
int41handler PROC9 j; ^- ?" x* l2 K% b5 E  F3 J
    mov     cl,al
& e0 x* r- b5 B# v    iret" O! @( u% I8 {- `) D2 ?8 S
int41handler ENDP+ f) e7 C" l6 z) p/ f( |
: b5 v- }" o, B% V. o- f

' o3 e* R% i5 p    xor     ax,ax7 s/ `! o' t6 O
    mov     es,ax
7 a( A  y, D7 ]6 }% r8 E2 ~+ ]+ O$ Y    mov     bx, cs# j$ ^  |: p% A. g
    lea     dx, int41handler# M  Z- ]' l; S2 \, `, ?4 n' ~
    xchg    dx, es:[41h*4]7 ~: B' @$ v& O: R* p# y% i* D
    xchg    bx, es:[41h*4+2]2 N+ z) O) e0 l! ?. o
    in      al, 40h, u" ~% e- E6 j. [1 q1 U
    xor     cx,cx
' ?5 V. _- s& e! k    int     41h. d# u  a3 ^  }3 d
    xchg    dx, es:[41h*4]3 I: n& O  ^' f4 U
    xchg    bx, es:[41h*4+2]% `4 `9 v4 Q3 s5 h1 E' C3 h1 c
    cmp     cl,al6 Y! v4 T6 V. R7 \
    jnz     SoftICE_detected
  x/ P, V8 b5 F2 A: M
! U: ^1 j0 r5 F6 b' A_________________________________________________________________________% O( `! I' n0 V
: E# z* P2 q4 }. l4 d5 i: q! t
Method 07: \, S- M, A' w* L+ L
=========: a' c: E4 r; L/ ~  q

% R, J# Y5 K3 j/ qMethod of detection of the WinICE handler in the int68h (V86)9 ]; s/ _" c) t) G' W
- i% n3 u  ?9 b
    mov     ah,43h+ r, ]3 G* F, _0 R  Z' \, b& R% l! F
    int     68h; a7 m% }5 n+ b: Z# n. b
    cmp     ax,0F386h8 A" a- B  G% N7 k6 i: A4 P
    jz      SoftICE_Detected) k0 C: \" c6 H  Y$ A
: P% u" y  L. h, y) ^  \
- u8 d6 W5 T8 Z* P
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit* M. n* [5 r: s1 e8 g
   app like this:% B$ q$ |8 }/ `: \) V
- o* S4 K1 w3 B8 t. g+ G: B
   BPX exec_int if ax==68
& y% H( v) T" w  `  W# T" `  C   (function called is located at byte ptr [ebp+1Dh] and client eip is
1 ~' {& R% \1 C. k! h, ?   located at [ebp+48h] for 32Bit apps)
; K# q  _) Y1 I7 J, W5 y! A/ R__________________________________________________________________________  c! W) S/ U" I# v% b/ w- }5 J+ r5 h
. n2 r2 ~2 q" k1 H2 f2 `
% H4 Q! O) F/ F1 I# ^, W& _
Method 08! g0 N( {, h5 c  n
=========; k# w1 K# B  @; s: H1 k( ]

' s8 Q- ?6 F/ i* y+ g; x  t6 T2 jIt is not a method of detection of SoftICE but a possibility to crash the+ X/ n8 g% k0 h' B, K
system by intercepting int 01h and int 03h and redirecting them to another7 e9 G0 M. m$ o2 ]
routine.
4 N2 J5 J: F  C+ cIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 k* d1 ?3 u" w3 E6 t$ k- Y
to the new routine to execute (hangs computer...)4 m% n& [% y& d4 B& ]
; i2 X( o* A: A$ A$ y7 g
    mov     ah, 25h
/ l  W1 Y) `- J- v. i, H- P    mov     al, Int_Number (01h or 03h)0 u0 v$ g+ t6 q, A" l
    mov     dx, offset New_Int_Routine4 M; b8 g. {" p! W0 S* S
    int     21h# X; X& x# j/ p3 M# |

" c, S% @8 g: y6 ]. P7 _+ W__________________________________________________________________________4 y, y  R5 N+ D+ M8 V. ^, R

# x2 \1 c! V& W$ Z. RMethod 09
& X" f0 N1 V. `2 r$ R( [=========
0 m* L7 W' R0 z
+ g( m- ^  T# l! [$ P3 {; `! kThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only' F: k$ K6 X( v: R  X$ g
performed in ring0 (VxD or a ring3 app using the VxdCall).# t* C5 u% K5 X5 _* W  H) j; ?
The Get_DDB service is used to determine whether or not a VxD is installed
+ B4 O9 V8 k2 U0 r& g( Z4 Q0 Xfor the specified device and returns a Device Description Block (in ecx) for/ c- S' W8 Q! ^( S( D5 F$ ^2 ]
that device if it is installed.
# K3 \( a2 }7 a0 e% d( r3 V$ x9 u6 z% p# H/ b+ K
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
0 D+ h% m- @. C( Z: U; _   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 u% i* Z# M. [" d
   VMMCall Get_DDB; q! P, [8 Q* S$ ?  ?; J7 {
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: y+ X/ `/ C4 _- h6 W
8 M" S+ q7 U9 s
Note as well that you can easily detect this method with SoftICE:2 t6 {; G/ x, I' M
   bpx Get_DDB if ax==0202 || ax==7a5fh3 O2 c: C/ [& h" v' G
, k% _" I8 _1 o2 }9 \  w' v& I. @
__________________________________________________________________________
5 B; ?) d+ \' x7 X: c
3 X6 Y5 w  b. ~( {# r/ }Method 10
) k: {5 _  B( z6 r+ M=========
7 [$ S4 z; D3 V7 b7 Q7 C3 s1 T
) W9 ^% [3 b! J+ K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with' T" O; o2 A1 R/ f6 e2 y& C
  SoftICE while the option is enable!!, l9 r! m# w5 C  c% I- q& T

* q9 W: u+ T- x' \+ D$ v, gThis trick is very efficient:0 H5 K  a( Q/ _6 p# w6 t
by checking the Debug Registers, you can detect if SoftICE is loaded
" u. e- n  q+ r(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& f& v' _7 T& q' _  i8 O2 c. I, Athere are some memory breakpoints set (dr0 to dr3) simply by reading their
/ C' M6 Q1 p. @% |3 y' x4 x6 vvalue (in ring0 only). Values can be manipulated and or changed as well& {7 c& x% }* c( ~
(clearing BPMs for instance)
6 U) D% T4 J% m% @$ @
8 m* z7 W8 L! a) l__________________________________________________________________________% r/ a' M( y( o/ Q, D4 P+ ?) \* v
0 ^7 z! Q8 S, ^
Method 11
: p1 p% I+ I6 m# b=========+ A: q$ w% I/ I' j# F( F) R# ]
3 i& h: g, \5 c
This method is most known as 'MeltICE' because it has been freely distributed
2 R( x$ ?+ D0 B. i' ~# y; kvia www.winfiles.com. However it was first used by NuMega people to allow- o0 q. u3 |, Z' J5 u* P
Symbol Loader to check if SoftICE was active or not (the code is located( a+ e% z% g7 q' I/ [
inside nmtrans.dll).
! g# S/ q, H* D3 E5 |: I0 l' h4 Y5 [$ S7 b
The way it works is very simple:& M" z& E& d( J! O3 O% ~
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% a' q! y( i! D0 o7 K1 R
WinNT) with the CreateFileA API.1 k9 b* t# A- S& T) o# ^

9 Z! s+ m; D4 HHere is a sample (checking for 'SICE'):
$ k4 X1 r( ]* q- B9 H  d4 y- O' @
# u' N8 ]: c- L; W6 J0 l" O9 I5 X: A( jBOOL IsSoftIce95Loaded()8 H- F. ~. J3 z4 M
{$ [+ E, }5 k1 B1 {4 E5 e2 G7 W
   HANDLE hFile;  ( W& e; s8 B3 N3 |9 B
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  R% ]! {3 n6 i6 q                      FILE_SHARE_READ | FILE_SHARE_WRITE,+ v; ]% M" P+ T
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; a9 s( _' ^4 n2 l   if( hFile != INVALID_HANDLE_VALUE )
1 O  P! @3 s$ v7 G   {
, G6 r) B& g$ ]3 d& u4 ~5 z      CloseHandle(hFile);
) Z: |3 Y$ Y; g% }* u4 W$ o      return TRUE;' i, a8 B. o' c  u7 h) s
   }2 i6 s# Z# Q0 q
   return FALSE;) {( z$ S0 P. `
}
0 p* d$ ~: D2 \; c
" h% ?* m2 [& G. k, {) Y+ aAlthough this trick calls the CreateFileA function, don't even expect to be
( y- a+ W8 z- a, x% Q; a3 G0 Vable to intercept it by installing a IFS hook: it will not work, no way!: h7 K: F' u) I( q1 a/ o6 |! M
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 W; o8 f. u8 X& Y1 L" z
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 H. F& k2 R: Q9 i3 E( I6 T
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
& A& `6 M% ?: v& g; [" tfield.7 _- m) g0 R* |# N
In fact, its purpose is not to load/unload VxDs but only to send a
7 _% a# U2 K4 P5 {2 e' ZW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' f$ O2 |7 R% U4 N* a1 W% f% sto the VxD Control_Dispatch proc (how the hell a shareware soft could try
( I" |# h* n; Zto load/unload a non-dynamically loadable driver such as SoftICE ;-).0 I" [2 f$ }, H: N) \
If the VxD is loaded, it will always clear eax and the Carry flag to allow: `# b- `9 H6 c3 @
its handle to be opened and then, will be detected.
: t% j) S% Z/ h+ d2 aYou can check that simply by hooking Winice.exe control proc entry point
- l% G) x4 r% d9 e- r2 cwhile running MeltICE.
7 q; t/ {- v$ ~) ]$ v% h5 z# w3 P$ a/ C$ j1 [: T& S% J( Y" H
; A0 s; o; i8 b# f- o; i
  00401067:  push      00402025    ; \\.\SICE' _7 U4 [/ A0 w+ b6 x! [
  0040106C:  call      CreateFileA) ^" o; P: U9 m: G, J3 \% {
  00401071:  cmp       eax,-001
7 ^" @  B* j! x4 w8 S8 J: S" {  00401074:  je        00401091
; l' {/ Y. R0 f9 T+ M
3 L) C& H0 `4 ?0 h& j! S, k0 f1 |" E* C8 H
There could be hundreds of BPX you could use to detect this trick.- Z) ^! g2 h$ X* h! b8 e
-The most classical one is:
5 Y' K. f* k4 d6 U  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  g: [* r, H6 H6 [0 q2 f
    *(esp-&gt;4+4)=='NTIC'4 N; n+ q& m  E% Q4 r9 f
& H6 D. J$ }" c9 B' r; U4 N
-The most exotic ones (could be very slooooow :-(1 E! [5 P0 X& Z1 F( {- c$ h6 u0 i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 v, i  b( P0 Q# X( u: q5 q
     ;will break 3 times :-(  n% S5 B. y! u/ x- K& C
4 z, ~4 I$ _8 s) Y
-or (a bit) faster:
% N0 N& P, ^& a5 N- s+ e9 c' A5 g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
0 o( Q: ?6 k/ v$ J# Q: d* a7 b, p, Q- G& {
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 }( b& A) O; H; ?4 ^. h
     ;will break 3 times :-(& L8 E' j. N$ \; I* {

& A0 m  U( m/ @9 u) o% i-Much faster:+ b! x; D8 Y5 L1 {3 [0 _
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', p' F5 ]3 H( _1 @
7 G& y5 \, m: e3 E
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen7 l' [: {( a4 }; A7 U7 Q: Z
function to do the same job:
5 l" G. ]) X5 ~$ b; c6 @$ U6 }% h2 Z* K, ^
   push    00                        ; OF_READ2 v0 @6 L; K1 ?: d7 W- J, H3 y& m
   mov     eax,[00656634]            ; '\\.\SICE',0
* @, Z) H  P1 G% X/ c" U( l1 ^: I% c0 E   push    eax$ r; Q5 G8 E& L
   call    KERNEL32!_lopen
' W: ]; i1 u: X4 J( s+ G9 s   inc     eax1 m7 h$ t, n2 a& Y" z
   jnz     00650589                  ; detected
# e' n- T5 e1 C6 b/ s( {; O- ^  [% r   push    00                        ; OF_READ9 T: G& D. M, G- p; |( D- G9 Y
   mov     eax,[00656638]            ; '\\.\SICE'9 h+ }% I7 k4 A( q# K
   push    eax$ v7 k" |! V) Z8 Q, R
   call    KERNEL32!_lopen; L# l: d" P5 X1 C, i5 j% @
   inc     eax1 c( P) h$ j. ]
   jz      006505ae                  ; not detected
9 J# X# n, j+ n. R8 [, b$ h1 `5 @* ~% H' c4 E  Y

1 B5 |: \4 [" C; i4 ~__________________________________________________________________________# s" p! k- _7 a8 V3 l2 W# L* N# N& o

+ `- Z: d; t: w% tMethod 12
, b! U3 i0 J. p4 H( B7 B) ]. L=========3 m" X1 \* h* q* j2 Q( u
! Z' P! s0 A0 _& [6 Q/ C7 R# M6 d
This trick is similar to int41h/4fh Debugger installation check (code 05
' \. H; T2 ~, I8 Q. [  {&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 `) ]4 f. X  o* G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.- }8 ]: n4 M/ j8 ]1 z, h2 }4 u, P, K

: U( b. q; ~9 W6 y6 b  |   push  0000004fh         ; function 4fh+ V; R4 K, t7 E1 ]% i- [
   push  002a002ah         ; high word specifies which VxD (VWIN32)/ }7 t/ C8 F* r: ]3 J) }
                           ; low word specifies which service: {' d( V, B% T( y3 k, V
                             (VWIN32_Int41Dispatch)# X+ h: K4 [3 _# ~: X4 X1 h
   call  Kernel32!ORD_001  ; VxdCall: t% ~+ s" |* p+ B$ `  w
   cmp   ax, 0f386h        ; magic number returned by system debuggers
- D  C& o' f7 \; Y8 y2 g# U   jz    SoftICE_detected
& i1 ^6 |+ v1 S
3 f: ?/ V2 U/ P' _5 D; eHere again, several ways to detect it:# D; H) q2 h3 b* M; n

+ Y! y; E3 ?' D% x5 z# z    BPINT 41 if ax==4f
& ^% S/ O; |  b" f5 ]. o) F# L0 h' t( u
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 n% c" X' @0 m" [4 j
5 W/ A8 h% J: X: x3 t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
+ U/ g, {4 A0 x
; i$ o* b" x* r2 l/ F( c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 Y8 q& R* X1 u, ~  j/ d. L4 [

8 Q8 A+ d* N, \% p3 X9 h__________________________________________________________________________0 S  F7 W" y  U7 R' n9 {

& ~8 c) s+ @4 dMethod 13. s: h  T3 [! E" \8 I4 |
=========: c+ B4 H/ Y- K( j/ W
  d% m9 Z* T* a* ?* z
Not a real method of detection, but a good way to know if SoftICE is1 w! A. |3 s8 Q4 \1 c! I1 {
installed on a computer and to locate its installation directory.
; T& f+ N3 f8 NIt is used by few softs which access the following registry keys (usually #2) :" Z) A% u6 v. \7 T( ?

1 T" A# l$ u; K+ p. Z-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. E0 l9 P9 l8 _7 a2 ?) a\Uninstall\SoftICE
/ ]* b3 O, U1 q* Z$ F. g4 ~-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ g0 C% j" k: c- @4 t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 P& [: S" t5 n8 N1 c. |\App Paths\Loader32.Exe
* a. j% Q% L: w6 z
( c2 s+ I' R, ^& b% L2 x- H# L( d) q2 z0 ?4 e1 V+ |
Note that some nasty apps could then erase all files from SoftICE directory( Y5 W$ O# l- I% F4 A
(I faced that once :-(
1 Q+ \% x- o6 @
( h- w2 S$ o  P& n3 y/ O8 bUseful breakpoint to detect it:
9 F( _4 f) Y. L( j5 p3 S! s
% y* r1 q8 X$ q$ }" m( @( C     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ d# B9 z% S* }! |& R+ A# Y5 P! J. V) M

! F9 w8 V0 S, c__________________________________________________________________________5 p: ^  |3 L# m- T: t- d  K  N. E- h

* [" K. C1 j/ D# I; ]
% A& s4 s: h- c! t; A( m' VMethod 14 / H. K# K" a/ e0 z/ T; u; U& @% f+ G
=========
* m) @- ]5 {  ?) ~4 o9 a, z& e7 f1 q6 N4 V; J/ d
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# }2 I" P( @. j* f5 V3 W9 b. Ois to determines whether a debugger is running on your system (ring0 only).5 S0 K* J( R! d  K" A5 ?* V
4 k, [. k7 w' p
   VMMCall Test_Debug_Installed
3 {$ u, M: R" n1 ?) C- V5 q3 B1 w1 |   je      not_installed
7 f! K: D# ]# c& F7 H) l# \4 E$ C- W
This service just checks a flag.
6 n, ~4 F  U5 ?5 E  j</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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