About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) j. }8 k& |% B# X% B% x$ z
<TBODY>
+ ~, z* |7 G  H# w<TR>9 p) e9 e9 `7 e
<TD><PRE>Method 01
" X5 y& a5 q* {. k% `; ?8 Y2 U=========0 n7 e( k( ?& ~( w' L' {0 S6 i+ Q. Y& V

; I2 J  k1 Y7 k7 F) E6 _/ cThis method of detection of SoftICE (as well as the following one) is" W5 P/ M/ W: B4 y% q" U" H4 i
used by the majority of packers/encryptors found on Internet.
% Q+ x3 r; D0 n, b5 c* y9 s8 U( eIt seeks the signature of BoundsChecker in SoftICE
7 B- I) W3 a: \' a( H, \2 Q
% Y! {3 n9 p: P! E" ]9 ~  A    mov     ebp, 04243484Bh        ; 'BCHK'
" U: J4 D$ k% ^2 H3 z) w    mov     ax, 04h) T7 A* b" I6 ]' z+ }
    int     3       4 W9 Q5 Q9 Q. S) T* i
    cmp     al,4
% P. ~- r- W# n6 q4 f    jnz     SoftICE_Detected
! w5 [4 t8 s$ v, P0 O* t4 V# R1 r
) h; n  U* X* Q1 |$ O7 C___________________________________________________________________________" z' y( c% X5 {2 y
7 c1 T1 v: e: R) r: }3 t
Method 02
' e& }+ K" u' T& r0 w' J=========1 v5 Q: m; d5 \* T, |4 D  A
( q: z7 W) k6 L- r' c. K+ M' p% g
Still a method very much used (perhaps the most frequent one).  It is used0 g7 c5 a" v3 y3 A) p' c3 L
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! T; }* x7 j, V) O* }- Z2 Jor execute SoftICE commands...
9 b0 P$ c2 _" R2 n) r# w/ mIt is also used to crash SoftICE and to force it to execute any commands/ {3 Q6 ]) z3 x3 g) Y6 z
(HBOOT...) :-((  - u; w) {. }4 {  C
# O# ]: F  @( W' A, |4 i
Here is a quick description:8 s9 _4 I" t! g  p; C
-AX = 0910h   (Display string in SIce windows)
1 w5 G  a; B6 C/ R- k9 M-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)4 V) u4 O7 E/ p3 C6 h/ l& e7 [& e
-AX = 0912h   (Get breakpoint infos): W6 a3 H8 b4 K# m, T
-AX = 0913h   (Set Sice breakpoints)
7 k: u6 ]0 q- h2 H0 x-AX = 0914h   (Remove SIce breakoints)
1 }! D4 \5 P- }  p0 B" }; c# m3 g5 B4 F0 w* N: Q- C% O: B3 w9 w
Each time you'll meet this trick, you'll see:% N: R$ b. a) _$ d# i
-SI = 4647h
/ z) ]& I  @5 F# p9 Y" ]; [-DI = 4A4Dh
. s5 a$ B* @7 Z0 ?Which are the 'magic values' used by SoftIce.
' U2 m$ b5 X! o. e" A1 nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) b6 y; d$ l6 n( F
% j9 u/ s! f3 s9 E2 T+ J- b2 {, ~8 NHere is one example from the file "Haspinst.exe" which is the dongle HASP
' F% B2 u$ ^( d7 P" E* {; vEnvelope utility use to protect DOS applications:- ]; Y, q) X8 v/ |6 z

4 R  }: Z/ O3 v' P$ y8 ^2 v
( p% N+ M, J& Z- Y: G9 I: ~4C19:0095   MOV    AX,0911  ; execute command.
! k; y2 D- E- Q1 _$ t3 i4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ E0 j, t! B8 ]1 T4C19:009A   MOV    SI,4647  ; 1st magic value.; t; ]5 A/ M) l& a% ^) _
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  y! u1 b, c, P" M% O4 ~
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! z1 q* {* ^& O' P! Z0 `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ \# _4 i# s+ T4C19:00A4   INC    CX
$ ~/ K+ \& B8 ~# c2 V' }4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 J. v& `" p& U8 }$ K* C9 _& g3 o4C19:00A8   JB     0095     ; 6 different commands.
2 ]3 U0 O8 r0 P5 x6 b6 ]4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
# o& r" _# Z. y7 X0 i0 `4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 e6 ^+ t1 x. \) D& H
* J2 s5 m2 S* {The program will execute 6 different SIce commands located at ds:dx, which2 ?" s1 ?0 a+ x" V0 L; h
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ U: G; u- P" o- K
1 s+ g2 q1 B' U6 s" a5 P* l
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.) q2 `5 i6 F# ^- e8 I8 M
___________________________________________________________________________" f2 P& u$ u: C! b0 I- u

# p7 @) j, N$ u5 `4 L4 j
/ M  K4 L! P+ b; e$ n) [3 `Method 03$ g" c& W& q0 K) Q" l
=========1 v% N  W3 u* ~( @( w
3 s) E# e* P( Q, a$ r
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h1 u, e6 j' P0 U$ n6 t& a
(API Get entry point)
% B7 `( X( z% u6 E7 D: H9 P$ v9 V$ U        % B. m* K0 f+ E6 \

% L( Y0 h, k% V0 P# T    xor     di,di8 J; Y. _5 q6 X" w* O. z
    mov     es,di( S  g' b! j( P1 m0 f; t7 j8 i
    mov     ax, 1684h       $ \! H4 W) E4 _8 E! Y3 p
    mov     bx, 0202h       ; VxD ID of winice
" B0 `0 Z% \' H: X    int     2Fh! d4 N: H( A* d$ h: N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. k  m& A) g* c2 m
    add     ax, di0 j9 @0 V$ D% [: b2 i) x9 x
    test    ax,ax9 m- t% F% R: u4 D; a1 t( }
    jnz     SoftICE_Detected5 j2 ]3 ?! B( s" M& M
( a0 U( k% _4 U  z
___________________________________________________________________________- J+ t3 V+ q- J% t+ |9 N
+ C4 j+ B! H& M) _
Method 04" V# a( J) p0 F% P5 ]. O4 o
=========
: e. K6 W( v7 D8 u
. P5 X5 |8 Z* ]! S/ F& H' vMethod identical to the preceding one except that it seeks the ID of SoftICE
) ]" F- T9 C! l5 T- PGFX VxD.
' q1 v4 g. U- U! r. ^7 I# g: s, J8 g9 F
    xor     di,di
( x, }  G' V! \! T, F    mov     es,di& C  B5 T9 ?7 T* K& @
    mov     ax, 1684h       2 ^/ b0 k" V) R9 |
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 m/ }- G4 E! ^: @    int     2fh
9 J7 ?5 O- U) j    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 r2 L; [; I- J; h
    add     ax, di
4 i2 @7 p# I% [    test    ax,ax
5 V+ k$ V8 }& E) K, l, }/ P; B    jnz     SoftICE_Detected
, s: F2 p7 n/ q0 N6 N& p6 v( W, j9 w( N1 b
__________________________________________________________________________/ J8 X+ r% i8 P: y3 e/ f# j! \

' w# H, Q0 u' Y& g0 b( h
/ l1 K# G9 e6 d$ jMethod 05
  G( _6 B' v7 O, q3 O4 M=========+ l5 ~0 V: N7 u) w( v! K

: a% J, R. Y) Y: YMethod seeking the 'magic number' 0F386h returned (in ax) by all system! o# @% @: x5 V. s, O( m, W% _
debugger. It calls the int 41h, function 4Fh.  ~% d- {8 I" c6 g
There are several alternatives.  3 F4 k; ^$ R0 `5 f' |2 J

4 p, ~; Q) A) CThe following one is the simplest:) v! E2 u% H3 X! F6 D$ y
6 {% o5 {% M) v4 g+ Y
    mov     ax,4fh/ N: g: R' ^3 f" R2 j+ a
    int     41h
) L) a" B" M% u5 k* A    cmp     ax, 0F386
- J  i' g1 b$ ^# ~4 n8 q    jz      SoftICE_detected, e' x+ g+ [$ e% K
. [5 z  X' K  @  \5 `/ b
; |6 _& @( w) r. s* v) [. t
Next method as well as the following one are 2 examples from Stone's # Z0 u$ O/ r( |. K8 V( u
"stn-wid.zip" (www.cracking.net):$ Q( N+ Z6 @* @  z9 N# L+ B" ]% `. d; r
# E+ s& d/ ^! v, U; j' v. |) e
    mov     bx, cs# Z- B2 t" q' R2 h) o& D  h! B
    lea     dx, int41handler28 r  ^/ _5 z* V
    xchg    dx, es:[41h*4]' G/ e3 Y4 m& v
    xchg    bx, es:[41h*4+2]. P) ^1 P) P4 ^* A. R, m
    mov     ax,4fh
5 @/ a( `, h) o/ \7 j    int     41h
5 K, ?1 ~5 j# j7 n- B    xchg    dx, es:[41h*4]8 g- M/ v! J3 ?3 K" [
    xchg    bx, es:[41h*4+2]
0 l0 M7 r. u5 F# f1 Z1 f) B    cmp     ax, 0f386h
) r5 z4 I/ W/ m    jz      SoftICE_detected& M' k, y/ j, N8 ?; `+ O2 j7 x

! s4 K  i0 Z2 M% F, g# Gint41handler2 PROC; U) `& ?& @: D* _5 G
    iret9 N# d' b. r- n0 g
int41handler2 ENDP
6 Q* P1 j) t" `0 \( r: H( d6 i0 T* c# E  B- G* U6 }

" w$ k8 v) ~$ u, [2 ^) o_________________________________________________________________________
" K2 g9 k' i4 `7 d0 G% o4 Z' K) F) g# G* q

+ |8 ^# x( O" `2 V( C' g! oMethod 06/ P- v4 a! y: y" m# M; ^8 y
=========
0 r: z6 y+ g4 ~" W9 x& D! y; _" e( d) ^! e9 I" X( Q' k

8 A7 \7 ]" Q7 L4 K) o! E* b6 o2nd method similar to the preceding one but more difficult to detect:
; K- p, Y3 j$ }$ K) u( C9 Z" h0 a/ ~7 \$ ]! p* R% q
' s7 I  C* a+ U
int41handler PROC+ n5 L" M! y# o4 ?9 K  P( P# [2 H
    mov     cl,al
7 c7 ?+ j; t/ L! ]    iret
; v& L4 B8 P0 yint41handler ENDP% d0 d- I( }/ P/ E( R0 Z, B/ M
4 t4 ^0 `7 B* o& m' c
- o! g2 m! u4 Y9 `
    xor     ax,ax& Y- f$ X9 H5 I9 V/ T
    mov     es,ax
7 @) D& t8 V1 U9 D: r8 I) f& G7 K    mov     bx, cs
8 a8 T6 o7 ^4 }    lea     dx, int41handler
/ ]- T  i+ r8 H* u* T/ _    xchg    dx, es:[41h*4]' i# i0 d9 Q2 Q
    xchg    bx, es:[41h*4+2]
% ~& U/ L! m( |    in      al, 40h  W, _3 I5 k" C- _" J
    xor     cx,cx$ t$ x' j( M4 Q. s1 s
    int     41h% j+ ^9 D% [6 y+ Y. h7 o  ~6 S  C1 U
    xchg    dx, es:[41h*4]/ M  ~5 n2 _4 }1 ?* q" E1 r1 q
    xchg    bx, es:[41h*4+2]- J5 Y8 ?* ^8 \! ]+ m& t( v# p
    cmp     cl,al
; |# R8 n" g, K- W! b, c    jnz     SoftICE_detected8 L9 T# p$ y6 n) E& k9 l

' Q% E/ h, e9 B. q0 d_________________________________________________________________________
+ i( ~8 r- \5 z$ x9 w
0 ~) }% c+ B' U( d& \/ EMethod 07
/ R* }+ ^: O6 v/ y9 h4 V/ \=========
7 P4 B# I/ E; _
) E. N+ X0 H, D- G  |6 n) s; }. ZMethod of detection of the WinICE handler in the int68h (V86)! W+ [$ c' d3 q5 r% |5 a

) j3 r# R2 w: s: C5 Q$ J2 J    mov     ah,43h
9 R/ L+ ^9 j% L3 ]! ]! ^5 }    int     68h6 `. T, N0 v$ O& c& Y# s2 K! J
    cmp     ax,0F386h
" \1 @; G! J# H" ?    jz      SoftICE_Detected
5 w8 p4 K$ J# S* h4 S1 B9 F1 T2 G2 B( k6 p4 T' t  e( r; S
) q3 |/ X9 d$ M! B. `
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% ]) T3 o& E& {
   app like this:/ m4 T  |+ |2 D9 [2 w

6 x  I, `% W/ L6 A. l  ]   BPX exec_int if ax==68
& }9 d1 U& U* n3 L( m. R/ Q   (function called is located at byte ptr [ebp+1Dh] and client eip is
7 O1 q% P. ]6 P; Q/ H2 [0 d0 r   located at [ebp+48h] for 32Bit apps)
4 Q2 t; X" f9 n% @2 s1 I' I__________________________________________________________________________" O# k" u3 I; ]1 s

: `* e+ p5 |! }# z6 m6 w4 H6 I. }6 F& N4 G6 [# H
Method 08
- x/ y; Q* F% q( E  ?=========
7 H! n+ C  M# x# m
6 N  {5 y" o6 m1 jIt is not a method of detection of SoftICE but a possibility to crash the# |: ?0 S2 P; Q: u& l- m2 |
system by intercepting int 01h and int 03h and redirecting them to another
2 Z* ]8 T8 s9 z3 proutine.+ z% `* c6 E" ~& `: c
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ p8 K" w$ x! W: |& ^
to the new routine to execute (hangs computer...)
8 y  S0 B% j# V, [8 v# _: O3 ]5 C# {" ^: ^( J
    mov     ah, 25h
$ K+ h- t3 u. U: q9 z: y    mov     al, Int_Number (01h or 03h)) Z- ~- E, N( h5 ~  p0 n. @$ a
    mov     dx, offset New_Int_Routine' \9 {) j$ m2 B# N. {/ @0 ]
    int     21h/ P% i7 ?2 F4 {1 A

/ @5 w8 U9 G. ___________________________________________________________________________
" p9 Y( z5 f1 l! ]0 r- q2 P0 @6 b8 ?
Method 09( r& H" w" K' D9 w* ~2 F
=========
+ a& a* r; y: F9 `1 ~  M' y8 O% C
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! ]0 k5 P6 Q& _6 l8 Q0 m
performed in ring0 (VxD or a ring3 app using the VxdCall).
- t, M! G' E; b3 \1 qThe Get_DDB service is used to determine whether or not a VxD is installed
) _7 J2 S) M  y3 z! c$ zfor the specified device and returns a Device Description Block (in ecx) for
* ]' P7 p. ?7 B4 n* ^5 Qthat device if it is installed.
6 w; c" v' I" R$ {
$ I, ~9 Q; Y7 Z7 Q& E   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# O; X! F1 b' |' E! B
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ n. A3 x: s/ o
   VMMCall Get_DDB
2 d6 }; l/ r' @- S   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
" o9 E9 u9 ]7 ^
* m5 r( S) z7 C! b: e+ P( O, _; QNote as well that you can easily detect this method with SoftICE:
. _8 }8 t( {! ~4 d   bpx Get_DDB if ax==0202 || ax==7a5fh
* ^3 Q9 i, P) w; j9 s. }( Z2 y8 Y! ^6 j! V  K
__________________________________________________________________________
9 R/ y( `$ [( d$ N0 h/ |7 Y; ~( K0 h7 {  A( n: l4 f4 N8 K
Method 109 B/ d7 o) \0 J2 [! I4 L1 P6 }& ~
=========9 ]# n: [* h3 l7 k, i

2 Y& H! R0 b+ R% I: @=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with( u: \! S- u. |0 z
  SoftICE while the option is enable!!: g9 B& f2 d8 K# G
: k9 |1 p! }% t# L
This trick is very efficient:
, G& G/ Y3 f' _* j$ Rby checking the Debug Registers, you can detect if SoftICE is loaded
- u9 m6 j# R' Y9 B) P, M! n3 f. Z7 d3 ]" g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ l; d1 L: b, X8 m. x# t& _
there are some memory breakpoints set (dr0 to dr3) simply by reading their
, ~" E4 @) `4 g% e# \) |& wvalue (in ring0 only). Values can be manipulated and or changed as well
6 z1 }, @5 |- P7 q5 T+ |1 P(clearing BPMs for instance)3 [  c/ S4 O4 r( S, i- j9 X

- N. e$ {: Z: W, O4 d. V, y- y__________________________________________________________________________( o: s* Z( H: {& I* E
! J* o! N. F  A8 j& {: H! N
Method 116 I; U2 Y7 q: H* r
=========
: h' ]& ?' t( e. k  N
' u6 w* d$ Q' e: i, nThis method is most known as 'MeltICE' because it has been freely distributed4 O0 \  j0 V0 W# U8 B3 V
via www.winfiles.com. However it was first used by NuMega people to allow
( }' G4 U! b# n4 \- n# t1 @Symbol Loader to check if SoftICE was active or not (the code is located: t" f/ j/ J3 ?' \! P( {$ m
inside nmtrans.dll).
& Y9 L$ c% D$ k6 U( a% o
& N7 h& W6 ~. I5 F8 U) RThe way it works is very simple:9 B% }6 Q& K; M! C9 z* }4 p
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  u  x; M  `0 A8 H7 R
WinNT) with the CreateFileA API.8 c8 B# v, |+ b* U
5 G/ E/ J- t0 Z5 {+ O9 N  S; ~
Here is a sample (checking for 'SICE'):
9 W' ?, H9 Y, s- z
7 d8 X+ b$ ?5 h2 o* P. ~6 f+ a& QBOOL IsSoftIce95Loaded()
% f# m" Q: I4 b  }" a$ x1 S7 x: D" ?1 G{& F: z1 {' J8 o& }3 N3 w
   HANDLE hFile;  $ ]1 P; _; K0 \: ]" F3 @7 s# Y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,2 Y0 |6 c. G0 _- y( M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
, Y' w3 o) ^7 J! ?                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 Z$ W3 w1 W. ?   if( hFile != INVALID_HANDLE_VALUE ); Q3 ~( ~( L+ x4 W
   {
, c- w5 F, ?' d& Z* _/ {1 _      CloseHandle(hFile);6 h8 s6 ?! z9 S. p* Y
      return TRUE;
7 `: G/ f% `0 ^# g% F7 h, w  |   }
% T0 K( u3 h! u; U( J! i6 S7 Y   return FALSE;, K4 P! y" I/ i0 Y% [3 L
}/ R3 E0 g' U& L2 X! }# V9 e* E' l  g

5 Z! Q- }7 @# L3 oAlthough this trick calls the CreateFileA function, don't even expect to be1 V- `% `0 L2 Z9 |7 I6 a
able to intercept it by installing a IFS hook: it will not work, no way!& u9 D' B2 V) r/ q; N. m
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
) ^, L. x% n; Tservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 o- }8 e- r+ G+ ?: C1 u- {' k6 W# fand then browse the DDB list until it find the VxD and its DDB_Control_Proc* u% W/ E0 v0 ^
field.
* Q0 {" `' T  ~0 d. E5 qIn fact, its purpose is not to load/unload VxDs but only to send a % C& v/ P6 y7 u
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( x  i/ j( a! @! j2 x. B! Zto the VxD Control_Dispatch proc (how the hell a shareware soft could try* m4 S8 C$ z( g( n$ X4 V) P
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ v- t5 l4 W' S8 J: p5 MIf the VxD is loaded, it will always clear eax and the Carry flag to allow/ j( j$ [( u1 ]& ^
its handle to be opened and then, will be detected.( c$ _& s. u- C' u/ |; s, _
You can check that simply by hooking Winice.exe control proc entry point
: f0 {2 s" n9 Awhile running MeltICE.
+ S% W; i1 M3 V! W- T5 J6 B( P9 ~5 m9 H8 q
( i" ~4 I" Q5 f3 x( }) P
  00401067:  push      00402025    ; \\.\SICE: W; a8 J4 s. u0 A0 M  U  W6 q, d1 q
  0040106C:  call      CreateFileA
' e2 v& O: b& C) ?- h+ l9 f( {. x  00401071:  cmp       eax,-001# q* _  c' X2 t+ w5 w
  00401074:  je        00401091
5 r* o7 n$ b* ]0 y, j
0 Y3 b5 b6 {1 H* k8 C0 y
; v- w% V( q* v4 g7 a' |There could be hundreds of BPX you could use to detect this trick.& b( X1 o8 l+ F% U+ V
-The most classical one is:
. d0 x1 R  Y  k( h/ G  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
: q/ M( F& o! I, ]; c    *(esp-&gt;4+4)=='NTIC', Y* Z7 C8 d# m# P9 o/ O3 e

: @; O- Q, Y! G; e# z-The most exotic ones (could be very slooooow :-(
  i0 U8 ?5 f/ P8 ?4 [7 p   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 r' l( R' M  w     ;will break 3 times :-(
2 `, Y  V- s: J" M7 S* c) r& X' l4 ^1 Z7 I5 L' p$ K
-or (a bit) faster:
6 h8 q- I6 G4 j! h% ~3 I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 o6 _" U' F2 G9 f# A4 \7 U3 M8 [0 H* }  @
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 n( l* z8 C7 ^4 Y- Y     ;will break 3 times :-(
# _& I) o$ J  p
0 l$ S2 |( s0 @-Much faster:
, t, _& n- t: e1 @   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 |% {$ l7 o' p3 t+ c6 w: ?% ^* Q) t1 @, `6 M$ [% W8 J$ N
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* {( Z% ?; Q/ C. e1 @function to do the same job:
* }4 Z1 A' B; R0 \" t+ U. K7 o. ~6 ^; v4 A! |" l* I' H
   push    00                        ; OF_READ5 ^; B' V$ c5 P2 O/ Q: G
   mov     eax,[00656634]            ; '\\.\SICE',0
! k. Y' O* S; z$ _: a) @   push    eax1 U' g# N& V3 B, E# {6 s8 G
   call    KERNEL32!_lopen
7 d' l2 o9 c; O% c% O4 }- X7 K% }   inc     eax
  s1 X" |/ @5 W; u( ?- m. {! M   jnz     00650589                  ; detected
  E8 Z) r' D( E   push    00                        ; OF_READ* l+ l- @8 M9 ~! P. L1 k0 _$ Z! L
   mov     eax,[00656638]            ; '\\.\SICE'+ `6 H5 |! H9 t7 T! Z
   push    eax
" B' F! L0 G, H. y, m; v2 K, |   call    KERNEL32!_lopen2 F( A8 g& y% u, Z6 p  M
   inc     eax+ Q: ~1 L  V3 ~
   jz      006505ae                  ; not detected7 \" b/ M! ^6 Y; s) {- A
* Z4 T* v0 S! P2 s

3 }; z; y# d. w2 Y__________________________________________________________________________; `3 |; p- d: W* y6 F9 U4 C
% e) z1 R6 w  {$ N) A
Method 12
! W: A4 c: k* w9 C9 i$ j=========, j$ n( u4 u& e4 U" \4 k: Q

& q6 d+ j& _+ t8 Y- Z+ D: o4 o$ o* }4 ^This trick is similar to int41h/4fh Debugger installation check (code 05
3 a7 i% p% G' J4 \1 {- u* K5 ]$ u&amp; 06) but very limited because it's only available for Win95/98 (not NT)! g! s# e  ~* h1 T( x; x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo., H; d% j7 r% R

/ ^7 ?3 c- n& x& _   push  0000004fh         ; function 4fh
1 }. L" l% A' G! ?& _& E" D1 i9 h* X   push  002a002ah         ; high word specifies which VxD (VWIN32)! t) m& o& W5 D' V( e( t; v+ B
                           ; low word specifies which service' |; q  x4 o( D/ J  t; G
                             (VWIN32_Int41Dispatch)
* X$ F. J: y) u* l) O   call  Kernel32!ORD_001  ; VxdCall
7 F  ]$ o' q7 b5 I" a: C4 V2 G   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 q: B  O0 t2 o   jz    SoftICE_detected
% w" F0 F' }7 @) G: w: S7 \) B) T; p. O; ~
Here again, several ways to detect it:9 O5 `( ~$ z' N; ]2 z/ C5 u) B

; p$ b: n. r) L2 n9 D7 A    BPINT 41 if ax==4f' ?) q& h0 y7 @( F9 x, J8 s9 V

6 Q3 P  s/ Y; L% Z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: Q- }5 |# o/ l0 W
9 `3 N5 D$ U# D    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 e9 J2 p8 i$ @$ z; p3 y" K! C  m% x
' u( H3 j0 t  H) N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 g# w8 t1 a3 J
5 v( r% i3 K: Y* R! S
__________________________________________________________________________( {- z0 s3 |- q3 Y
8 l  z, ]# T& z9 N1 I* `
Method 13
5 s3 f  l# H$ N7 d; a* n/ p=========4 L: c$ q8 E5 ^1 Q8 z

# r- z$ A9 U% w' `; uNot a real method of detection, but a good way to know if SoftICE is
: m' m  t% E7 [6 A) S; r6 Uinstalled on a computer and to locate its installation directory.
0 Q4 b) n" ~9 q8 U* h: PIt is used by few softs which access the following registry keys (usually #2) :9 b" Q( Z" a9 f, Y) m

2 }# O4 Q' E) ^' U* S5 F( X. I2 ]-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; w6 }. @3 `7 _7 F* d7 c
\Uninstall\SoftICE0 Y: U+ D' J! Q( B8 M
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE/ s) p$ t4 `" K8 v# R: _+ @
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! ~. V! E( l! g/ I: L& {/ O1 [! m\App Paths\Loader32.Exe; D2 i% W, M& h

/ s/ _: W( ?4 `  r, d0 g" b% P0 I0 G3 ]" h. m, _+ s
Note that some nasty apps could then erase all files from SoftICE directory3 T3 r& \2 y7 }" y, C9 i( v9 E
(I faced that once :-(
$ l% n; I9 ^' o3 \" ~1 I. y: s5 E+ w; \9 c5 L2 U  n0 X6 ~* y
Useful breakpoint to detect it:
9 v, x$ W: j! S" r7 y5 o6 K4 ~' e# _, S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! X6 h% N6 {" w% q
% V: E5 ]+ T% a__________________________________________________________________________
4 A5 M8 m! |: e, d% y) |7 R8 y
" v5 C# {! D4 O9 ]
4 }& S4 I0 C: lMethod 14 2 F+ M& g/ O2 h) [
=========9 M8 f. w* Q8 A+ p; S. ~" W' P
+ K5 o- b' |4 M5 b) H2 _; \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% o: h( c1 a! z4 g/ V/ d3 his to determines whether a debugger is running on your system (ring0 only).
. O4 \; C% y/ h+ N/ }1 i$ \4 R3 @' t4 b$ y( z8 t' i( |& ]
   VMMCall Test_Debug_Installed3 l9 c1 h/ l* X' o1 i
   je      not_installed
% w4 g( `5 u: V
2 u; |# T9 w( J. t1 _( ~. EThis service just checks a flag.
9 K" e% c( X1 X" f" T$ K) y5 ?$ L</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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