About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
- ?( |& }" E5 q! _/ O, ^0 X1 g<TBODY>
! R( e% q* G8 {1 {- t/ M3 k2 P8 N<TR>6 M# N* o3 n* b& U! i3 G* q& b. C7 e
<TD><PRE>Method 01 - S" t" v7 R3 M1 b' \
=========( A9 Z# s# v' s$ K+ A3 V
8 Y, l2 L" X$ p# B; l5 ?7 ?
This method of detection of SoftICE (as well as the following one) is
) a( K- o3 ~, q. R& ]used by the majority of packers/encryptors found on Internet.
3 l3 Q9 P6 R7 g) Q# G! eIt seeks the signature of BoundsChecker in SoftICE
8 t3 `5 r" v5 o+ @* F( @! t
  b+ B# w9 F- M5 D$ _( L    mov     ebp, 04243484Bh        ; 'BCHK'0 y6 y8 s+ L! E" I: t; J2 l% {" e
    mov     ax, 04h
1 {+ p+ q( Y4 d( ?+ r* G    int     3       : j% f( E  a+ t
    cmp     al,4, t* d; p5 q) ~+ E
    jnz     SoftICE_Detected1 i1 }5 V% X2 t  D; W# u

6 x0 H0 \2 H# A$ g  M9 H$ Z9 Y9 i: ?___________________________________________________________________________
# `2 T* I& u. ^. s+ \. I: A- Q( w
) l! q- S4 V: o0 O: f* n3 kMethod 023 F) A5 X$ `, {" p8 b+ K, C0 F
=========
' I- T6 J4 h: {2 `4 j( X/ s: ^1 u( Y# v  ]! p2 K1 z' _5 Z8 l
Still a method very much used (perhaps the most frequent one).  It is used
8 E! z5 @  o7 q6 d) ^9 Mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,' j5 T5 G. Y& J- t" f
or execute SoftICE commands...; t) M9 g2 m* K/ _* v# l
It is also used to crash SoftICE and to force it to execute any commands4 @* Z2 D* i& _/ S+ A
(HBOOT...) :-((  
/ h5 v3 _4 y4 p3 x. h4 F0 p% `0 ?" k2 Q* X
Here is a quick description:
5 ]$ R5 K# q+ D& r  Z-AX = 0910h   (Display string in SIce windows)' Q* U/ g5 m" g% s) o6 o" G7 ^
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" E: {( ^* z9 B' d/ B* a- c-AX = 0912h   (Get breakpoint infos)/ L  E0 @) I0 Z8 F
-AX = 0913h   (Set Sice breakpoints)) s! t" k9 i; b0 k% e
-AX = 0914h   (Remove SIce breakoints), {, s- {3 E$ U
0 V3 ?  |7 M+ d$ L* g% a
Each time you'll meet this trick, you'll see:$ \2 o2 a# [" f5 X8 T
-SI = 4647h) c% g' G0 m7 [8 h+ [% }# i! P
-DI = 4A4Dh3 B4 D/ o% R2 D& y! I2 o
Which are the 'magic values' used by SoftIce./ W" b; @* d9 _- d8 R% S
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
7 }4 y8 j2 v% Y/ N& Z2 w2 n5 x) R% M* b
Here is one example from the file "Haspinst.exe" which is the dongle HASP
6 Q( a0 u4 R4 J2 u3 `/ Q1 M  |* wEnvelope utility use to protect DOS applications:
- A% _' t) E( a' r# y
. c/ H' V2 v5 _# e7 Y. f/ u7 m5 M: G2 h1 v3 b7 U& ~) b
4C19:0095   MOV    AX,0911  ; execute command.7 z# m! K$ V) A
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* E% O6 T, q$ V4C19:009A   MOV    SI,4647  ; 1st magic value.1 V3 Y% w4 x, \+ n3 T( V
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  ^4 O- q- T  r' g4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: H3 l3 x" X/ H7 O/ r# s4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 r4 r0 G  u* |% Z! ~4C19:00A4   INC    CX! U" v8 [( N2 r8 t* S
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) u- m5 K$ t2 V) d# b+ o0 l4C19:00A8   JB     0095     ; 6 different commands.
0 @6 Q% P& T, i1 X$ d' h+ R# t4C19:00AA   JMP    0002     ; Bad_Guy jmp back.. @9 W; j( C( T# b
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 W3 r$ J+ C) ^  t* d) R/ d- L4 w$ W) @% k2 c9 B9 X9 A
The program will execute 6 different SIce commands located at ds:dx, which. ?& [0 _% _  H8 x3 R
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.) c6 N" W2 }, }9 l' T

! r, Y  _- J% D$ |; y. a4 w* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 ~3 P0 T. K) [9 y2 c3 s
___________________________________________________________________________( B1 A  T8 t1 p
+ p/ K4 x% O! D, e- u" U' Z
  D* B( f* U; @& B' Z
Method 03
+ Y" e' D0 v3 o=========8 T4 r% L, S9 }9 ?! v

0 @0 v/ w) x1 O8 A, WLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ }& q) S. Z! c6 r! J- b; d
(API Get entry point)) S: J4 w% O, x" _  |1 R9 x' U+ X
        
9 I; }* S! R: {$ ~
: w* v! G9 U* v7 z    xor     di,di7 H; k. u: ?" T  _" S
    mov     es,di" n3 Q" A$ B6 k! h- D& g4 ^
    mov     ax, 1684h      
" L5 P0 G# A! L9 p# f    mov     bx, 0202h       ; VxD ID of winice! B- u1 [/ Q7 q" ?3 ^+ e$ U
    int     2Fh
0 Q9 [' s: S$ F/ k- H0 y; N    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 Q: }6 T9 j, B- c* c' h    add     ax, di! ]+ \+ l' K+ T7 p( w8 I% M
    test    ax,ax
6 r% w$ O) E( u+ r1 {    jnz     SoftICE_Detected% {  a/ x' \6 r7 m
+ w& [0 [4 J' M. y0 a- k
___________________________________________________________________________
: ^. l& C, T- ~% C$ x! C/ a
' \& K3 G" W' j, z. H5 ]6 e. bMethod 044 O0 N; J, z3 G# i
=========; _6 X1 [' z) z$ @! W

2 g) E3 J' |2 G- eMethod identical to the preceding one except that it seeks the ID of SoftICE
+ f, Z, a# t( w- HGFX VxD." A5 p5 ?% l' b$ v& _( B, s0 u
# Z4 Q* R% _5 |( S3 o
    xor     di,di5 i# H, M; F- w1 J
    mov     es,di
: H, r1 P6 n( G* x, n    mov     ax, 1684h       2 P' G9 X8 a! K3 w5 X
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
& J& W) \& d! H6 y( @    int     2fh
7 x- Y) r8 I% D& [    mov     ax, es          ; ES:DI -&gt; VxD API entry point" y4 E  _+ r* Q( D$ m; x3 K
    add     ax, di
( j. [% s$ `- x; h1 f2 [9 s    test    ax,ax
' n" g/ {  f' Z, J" v/ D, c    jnz     SoftICE_Detected
5 F5 A1 `. @9 l! V
8 t% g# Z5 O3 U4 U; j+ C__________________________________________________________________________  X3 s1 g) u7 _# I) o: R3 i
- G  Z0 g, Y4 I6 y' U, M! @6 ^

) \1 ^0 \8 r. f4 q1 F: uMethod 05
4 R* I% r7 f. b: H4 z=========4 {" b2 F( z, Z0 Q0 {1 j+ E
3 @* R+ @- C3 n
Method seeking the 'magic number' 0F386h returned (in ax) by all system: I* t/ H. x' f( f/ ]8 P! U' n
debugger. It calls the int 41h, function 4Fh.4 A* M4 C, T# m- Z. j2 }
There are several alternatives.  0 a8 N1 z/ [3 l) D9 |/ V% d1 |8 O1 c

4 a4 V/ e4 a+ W! H/ p( kThe following one is the simplest:) @, x9 o# X& t3 r
2 J6 @4 }; z0 A0 u, x0 l3 e
    mov     ax,4fh. |- B6 R! E9 r' s: |( D
    int     41h
1 V: W) L6 r* c0 O# m    cmp     ax, 0F386
5 o7 @  e4 l7 |" D    jz      SoftICE_detected" P  `1 D& y; ]5 K" j! S8 y

5 @( i% }- ^) b+ {: d
& K5 D) s! v8 @+ e9 N" \Next method as well as the following one are 2 examples from Stone's 4 j% V5 Y% ?2 r! h& ]5 P
"stn-wid.zip" (www.cracking.net):5 O; |4 x* w9 ]; Z( y1 E$ b

/ Y5 V2 O  P# O4 a8 p: S* _    mov     bx, cs6 K6 p6 V* l  e1 x. Q, K
    lea     dx, int41handler2
- y3 b' q/ I& x    xchg    dx, es:[41h*4]. i* P' n1 Y1 x
    xchg    bx, es:[41h*4+2]* [: x4 {1 v+ u8 @
    mov     ax,4fh
5 b7 M' K9 I+ _& n    int     41h# T) {3 a+ U& R  k& k
    xchg    dx, es:[41h*4]' B% M6 }4 p& I3 [  r
    xchg    bx, es:[41h*4+2]
0 ?& ?# `/ H8 N- ~! B    cmp     ax, 0f386h
* M" Y' Y0 x7 s0 {  N    jz      SoftICE_detected
) m7 Q  B$ I& a& k5 ^  q1 a# p
; |" [3 o6 |, N; `, r. B0 E: a& wint41handler2 PROC( r- }2 A( D: ^9 x+ P5 H+ w1 x
    iret
$ h1 s* _( Y# W, E8 o& ?. X! Kint41handler2 ENDP
7 \( P. t- W$ }
  |& P3 F( L7 v5 K) L6 U% N6 ~: h6 d. M& o
_________________________________________________________________________
& \) ]; E9 u5 f7 ^2 @
1 A: ]  O  c& C4 H
, x0 {! G4 q9 o9 J& x" ZMethod 062 S& e* P- u- `. S; r  ]9 L
=========
: R, e1 R/ ]4 A4 D) X: O+ v# y/ d' T# I3 q* R

( j: b3 S0 K8 E3 F2 s/ N; O- g: b2nd method similar to the preceding one but more difficult to detect:
4 D" t( {. P8 F# H& k# z( }7 ~" F3 x" D5 P! Y8 o4 Q

" g6 f% ~6 Q+ Z" _8 rint41handler PROC
7 Q' q6 g& P/ z+ M    mov     cl,al
0 b# t$ v4 B5 t; |% M    iret( \/ L1 |6 _# {3 E* Y# W
int41handler ENDP( d/ ~$ E  m3 H- X
" T/ a& U6 M, F
( h: B9 }- [! P+ T8 e9 {0 p- D
    xor     ax,ax- I* M4 D" p# a, `6 R+ r
    mov     es,ax9 V: p% B: {& ?# o% Q
    mov     bx, cs
- V# ~- p) G: ~    lea     dx, int41handler9 y6 U( e# m1 }1 ^- m" i0 G
    xchg    dx, es:[41h*4]
2 ?* M/ {4 x. d# c3 I    xchg    bx, es:[41h*4+2]  \6 {* @9 D4 @) x3 l
    in      al, 40h3 V% ?" K& w. e4 ^
    xor     cx,cx
8 l- u$ D& X( y9 a! v) G* u: R    int     41h
' |( s- A, F3 V# D% S$ B    xchg    dx, es:[41h*4], R' i% h8 [& c; u
    xchg    bx, es:[41h*4+2]
2 q( {6 y$ b0 v9 f% {( Z    cmp     cl,al$ f# s4 d5 s, \7 y9 B
    jnz     SoftICE_detected
( s3 S" P: K3 l+ O7 }% g) S; l/ k8 O# [1 m$ I# O3 B' n4 Y
_________________________________________________________________________/ S* ^( k- _  ]! {  n8 p

: o* I0 [- j8 m1 cMethod 07) D" m6 O( C# W/ r
=========, ?* o3 G! ?+ k2 E9 H6 F! b/ k
& F7 r' h: {5 a' s9 x9 R  Q  r9 O
Method of detection of the WinICE handler in the int68h (V86)
: n' S/ v% R& @7 v+ F9 I" y4 B' H; a; o0 x
    mov     ah,43h
8 J# Q4 z% ]# |( i' f  u    int     68h
& q( K2 l+ O' Y$ R% h    cmp     ax,0F386h$ P7 K9 O7 C$ q" t9 K) m8 H
    jz      SoftICE_Detected
8 K% S6 U/ X2 e3 V0 F! O% Y4 }7 z* l8 }- }$ |" R
! d) }1 r- ]. h
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' ^* V) P3 e, l: a  v, n
   app like this:
( I0 e; n9 c2 |; L* L) G' y/ P& Y: p0 e8 e! `/ \# S
   BPX exec_int if ax==68
! i7 {5 r% i/ G: w6 q5 M  _+ [7 W( ~   (function called is located at byte ptr [ebp+1Dh] and client eip is
$ @' K' J9 D; J8 P- O   located at [ebp+48h] for 32Bit apps)
3 q( J& Z2 i. Z__________________________________________________________________________
/ g3 C$ [6 q2 w0 g( f1 W, t  @
+ H. \& }8 p. p3 m5 R# Q' D* I
, H; C" t+ W4 \: H; ]( UMethod 089 @2 |# J' }" P
=========
; I5 a  o2 b( h7 x
" G2 v$ A0 k4 v5 h' NIt is not a method of detection of SoftICE but a possibility to crash the( W% l& j, l# |! Y6 K
system by intercepting int 01h and int 03h and redirecting them to another' C* ^( i6 b2 \7 Q& \( t
routine.; m6 d+ e; K% p( g' l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 f- K8 }( y4 ]& v/ t! F2 P) hto the new routine to execute (hangs computer...)
( M" G1 D  e4 q) f0 C$ k0 P. Z" z7 K$ l
    mov     ah, 25h
0 T. h5 d$ H2 u$ r. J0 _    mov     al, Int_Number (01h or 03h)/ }) M4 r; Q; E( t2 ]& O
    mov     dx, offset New_Int_Routine0 T" S5 Y& H2 q5 W% J
    int     21h
* Q- ~) `/ a4 M) u* I8 H1 a% Z, N( Q( {% Q! h
__________________________________________________________________________
7 y: I+ M' q  {9 {6 s5 T7 G' [: B( g2 e
Method 09
' Z9 T/ ^  f: u2 O# X5 F$ S=========! ~) W# T9 q' F

& O0 O- b; E/ c' S- y" CThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
7 g1 b& H' z% Y7 s5 uperformed in ring0 (VxD or a ring3 app using the VxdCall).
& h" `: k$ v' a' XThe Get_DDB service is used to determine whether or not a VxD is installed
8 S/ C, G$ E& u7 k3 n/ Y" s( W# `for the specified device and returns a Device Description Block (in ecx) for
9 ]' l' {4 q, Jthat device if it is installed./ M' b; D# Z* s% m8 U
, A% Q, Z; G' J3 ?* A$ \8 ^
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: P$ L) K) D- g; p
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  f4 D- B& q, y% p
   VMMCall Get_DDB7 ^  W# r* d0 W, O1 _' {4 [
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. c1 Q5 K' P2 g  L1 a7 X+ {# j( p( u
1 k+ d8 |) j( W
Note as well that you can easily detect this method with SoftICE:
& B2 P/ `+ y& K: F7 y   bpx Get_DDB if ax==0202 || ax==7a5fh% }+ Y/ C0 V2 q: d
- @) X' R" A! S3 O
__________________________________________________________________________
( `# ]. r. ~, M' d/ F; C
# p" f" b) v3 ?: M( f5 yMethod 10
1 u- f; v+ l: r- Z9 ]8 Z( r=========" A  \. V1 I7 J2 O

" [' [8 L. ~8 @% F8 E* M1 m=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with* |3 w9 ?& P' ?& _2 Q$ \
  SoftICE while the option is enable!!4 K; }5 W5 m# z) n

- G! ?% x! W# `" v7 t, Z8 F6 QThis trick is very efficient:
0 X- q  f9 d- I# A9 L8 ]$ I% ~& sby checking the Debug Registers, you can detect if SoftICE is loaded+ {/ O5 Z% T! B7 Y2 @! X! T$ \
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 v& _. a1 d' G. }there are some memory breakpoints set (dr0 to dr3) simply by reading their; K  l+ R5 Z8 _. x
value (in ring0 only). Values can be manipulated and or changed as well' ~- S# ?* D; n7 I& c* j' O
(clearing BPMs for instance)- U3 T! u" r- B# P2 l1 m) ?
3 g: M8 G! [% I: o3 n& R  i
__________________________________________________________________________
7 M2 l# ?/ d$ G3 e* a' g  ]) u6 `+ I3 V9 J( H- W0 R& a
Method 11
; m; V8 P4 ?! m7 f" N( w$ R: B=========! Q) x( q$ f" K/ q5 D

+ ^: U/ W& |3 S% \This method is most known as 'MeltICE' because it has been freely distributed. K! k2 X, p1 O( z. v
via www.winfiles.com. However it was first used by NuMega people to allow
. O; T; E/ n# f# ~Symbol Loader to check if SoftICE was active or not (the code is located, h8 j- d( w8 p2 [7 O
inside nmtrans.dll).
: N( b1 f+ Z4 ~+ }! W
0 l. C6 T5 j$ @' w( n6 l+ B4 T' dThe way it works is very simple:
8 i* Y+ j' d$ c: I' {+ YIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% J# z  x0 S' e) w- v
WinNT) with the CreateFileA API.
( e6 I0 A+ t/ A1 F1 y
3 ^. L5 ~6 [  h) W& i: fHere is a sample (checking for 'SICE'):
! g0 y% T, G% A, m# Q
% s+ Q/ \, Y2 h3 ~; T) H; \6 cBOOL IsSoftIce95Loaded()5 {( s4 c& G4 {+ g& R
{
6 Z' L' B0 _* Y% n5 a( a! c   HANDLE hFile;  
* }, d5 V/ M0 `, _/ n   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
8 a+ j: F* K3 u. O( ]                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 M* S7 T/ j! g  n7 K$ }
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 T. ?6 d) X7 E3 m
   if( hFile != INVALID_HANDLE_VALUE )) f3 v4 l' w0 I7 {2 j8 V; t$ H( s9 o
   {1 t" M4 W% s1 W9 r5 p4 V; l' u6 \
      CloseHandle(hFile);
) \$ F" A6 a  I( k7 ^      return TRUE;
" J+ o' H2 h1 o0 v5 q   }
& J% v! {  h" q" k   return FALSE;( F, \; ~5 i5 o! }/ o% g% g; h$ E
}% a  L  t& V8 U" f

' t! s# y9 ?- l6 ?% pAlthough this trick calls the CreateFileA function, don't even expect to be/ r# S# C0 N; x8 V3 e$ I
able to intercept it by installing a IFS hook: it will not work, no way!
+ b5 Z6 P2 _  A& y+ hIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
) D1 Q4 }5 j% ^$ c$ k# l1 Y0 i4 s) J7 `service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 C/ j1 m1 f0 cand then browse the DDB list until it find the VxD and its DDB_Control_Proc' P$ \6 }2 r. n' `3 _) p
field.
$ v/ B: ~9 e2 `! n, i/ \) dIn fact, its purpose is not to load/unload VxDs but only to send a
4 i2 P! v' P- ?. ^& CW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! }. j: ?3 P8 n* Mto the VxD Control_Dispatch proc (how the hell a shareware soft could try1 k: A  W7 t5 ~) S
to load/unload a non-dynamically loadable driver such as SoftICE ;-).6 w. C* n! A; [1 F
If the VxD is loaded, it will always clear eax and the Carry flag to allow- S2 I% R  x0 P% a
its handle to be opened and then, will be detected.
- I7 Q0 P0 d% tYou can check that simply by hooking Winice.exe control proc entry point1 F4 l* X  A% O' u
while running MeltICE." |9 U+ j) E9 q: t  A; i8 s7 a0 J

$ S* E( |) \# e3 F; n8 E' @2 M  G! Q& u4 i0 E5 J+ V
  00401067:  push      00402025    ; \\.\SICE
. o! ?: W( b/ ~  0040106C:  call      CreateFileA9 K! o0 `" m6 u& k( H
  00401071:  cmp       eax,-001
- C1 O. L% Y6 Y' {# D  00401074:  je        00401091
4 N# l2 U% o2 L
8 Z8 w2 |! H' e. k: b; @8 w1 w6 [  _2 h! \
There could be hundreds of BPX you could use to detect this trick.
3 `/ Z- @: s4 `-The most classical one is:1 {0 E4 D5 G& S
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' g8 [; m3 D/ z0 U; w) y8 P. n- L5 Q    *(esp-&gt;4+4)=='NTIC'
5 w: k- Z$ l9 ^: f9 }/ r0 D6 w4 G& e/ n9 A7 C. R9 I% s
-The most exotic ones (could be very slooooow :-(
; ~% y9 R' u) U( C   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 N+ ^! m; e+ U( k( p+ t
     ;will break 3 times :-() c! q& E1 S6 D5 s
! L- |& {+ c8 x& i% D% q
-or (a bit) faster:
* l3 v$ v( |3 ]  B* B   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
: j0 T/ B1 i2 h: O( a- G- l, |3 q( [/ a% a
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! S  X& L+ K% T) X
     ;will break 3 times :-(
# o- J7 M* N5 s' z. X8 a2 S( e/ i' ~( b7 `% x  B
-Much faster:' g( q) t7 t0 B7 {! v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# d% p' x: q2 c2 C
) P$ A4 F$ p# f7 G5 E+ BNote also that some programs (like AZPR3.00) use de old 16-bit _lopen4 \, s. t2 T, j% m- q( {
function to do the same job:- P4 T7 g6 U  X' h; z' R
  j& y% T4 ?6 @* @- o; L
   push    00                        ; OF_READ
# V" L0 m) v7 F6 D   mov     eax,[00656634]            ; '\\.\SICE',0
$ D# O! B- L% ^3 @9 v   push    eax6 U1 L/ r+ ~2 Y- c
   call    KERNEL32!_lopen- ?" D& H. K8 n( X* u+ K
   inc     eax
2 p/ [+ B1 L; Q" l. s8 ]# c* ^  `   jnz     00650589                  ; detected
) I1 ^/ D% `( @# n3 l  ?- L9 Y   push    00                        ; OF_READ0 N3 |+ D. s0 G& M
   mov     eax,[00656638]            ; '\\.\SICE') h( M9 _, }) ^, w  l* n
   push    eax. R! u9 X/ l, E1 c3 c
   call    KERNEL32!_lopen) \& _; H3 U& D+ F. Y/ ^
   inc     eax
+ P0 i7 z. {* x' b  M- e   jz      006505ae                  ; not detected
" Y; N+ g! R, }9 G9 J, y* @! B) \' M& M7 ^1 H+ u( P

1 }- C  X" G# J/ [0 z; t__________________________________________________________________________8 s8 o6 A' B& L0 \% G  u
" Z$ W+ {* `# U1 @  `
Method 12; s3 R7 r7 ^9 T% T  m
=========
% |  B8 I. a2 ~8 \. R* r9 v& Y) s( V/ \, m* e; L
This trick is similar to int41h/4fh Debugger installation check (code 054 I4 l& V# o% P; X
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
3 q  T/ N1 c$ q: g( L1 Ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 I; }. e/ G4 H, @9 w8 ~  S
  `; A" z, m2 P) I8 z' u   push  0000004fh         ; function 4fh) d& H8 i, G, {1 r) D. Y+ H$ I& @
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 T% _0 h. y; I3 Q" u
                           ; low word specifies which service
. S3 t7 R( ~' x* j3 G6 @& ]9 i                             (VWIN32_Int41Dispatch)6 D. ?& d* j" W/ V
   call  Kernel32!ORD_001  ; VxdCall5 V/ Z! \9 P+ y% w8 Y
   cmp   ax, 0f386h        ; magic number returned by system debuggers. \& v3 B7 R* ?
   jz    SoftICE_detected
/ O+ X/ F, Y. Z- F- P( m, x" y" g% K# `/ F% v
Here again, several ways to detect it:
: P7 C2 r! @0 f" {% T& J
  ~4 Z3 o, \  h$ q+ ]( D. T    BPINT 41 if ax==4f
. Q* s" ]: _* ], X/ f. R/ {8 ], A1 _
! X. N# J$ M; y    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
# |8 p+ f. v7 ]$ G3 Y
8 t+ F& N: J! G) X) u2 H    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 l& h3 @3 m+ |( X  K* b( T8 h! x  L+ f# a6 O2 N% L# `  x
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 b3 D! @6 D2 @" M

* F' M7 `$ \( ?+ H( S__________________________________________________________________________1 |* x" l& h3 m( K+ M# ^

1 j% b; Z7 _4 [. \* tMethod 13; E  [$ l3 c' w7 i: n6 t
=========' d8 a9 g3 X/ n2 u* H- d
, G$ g- d1 _. W2 X" }
Not a real method of detection, but a good way to know if SoftICE is
" l7 s' l. E' f+ _6 Binstalled on a computer and to locate its installation directory.
3 V: n1 Q: E( V2 O" U. mIt is used by few softs which access the following registry keys (usually #2) :
) D1 G6 G1 g! ~6 B+ M
! s& k6 L/ k3 V4 Z# r-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( m4 \" O3 n8 R' H: C
\Uninstall\SoftICE
2 b- M3 r) ^+ V" O' o3 g3 C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% S& Q2 {; T) a8 X-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) m: j! j% \. O6 l0 t
\App Paths\Loader32.Exe* W! q$ v4 x2 p: x: l+ B

0 ?* U  U7 s/ ]
$ M1 R" S3 [& VNote that some nasty apps could then erase all files from SoftICE directory* ~" a  h8 r! V0 R
(I faced that once :-(" o/ f* `2 Q3 e* k

% T8 Z% M0 e5 R' L1 K, R# wUseful breakpoint to detect it:0 D' g# E* f0 T& i' F3 b/ v' P& e5 ?

- B* L4 _9 f: M     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'0 N* W# ], R% Z4 h

9 E" Y7 }, B# X2 F" {+ q) T__________________________________________________________________________
  G4 ~# O0 ]  h5 O; K3 l
4 }% z  D! B; o4 s$ l
% v& W1 i9 {$ X+ H" m% nMethod 14
7 @' c( H& l. m! h5 X; s8 ^=========
) k* Z+ r& G- u! j8 [9 p* {5 `# ?0 O/ Z5 l% z0 d& e
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
" g1 U( h+ [* _1 yis to determines whether a debugger is running on your system (ring0 only).
, g) l& Q- u7 S5 u% A! v( ]5 w  M* e+ j+ d3 Z
   VMMCall Test_Debug_Installed
! A- x3 z1 `# S   je      not_installed5 n. y% c% j2 ]$ |

& ~/ r4 B. d+ i2 GThis service just checks a flag.
& g( K% u8 W  A' s</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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