About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
: m6 O* t7 T* P<TBODY>$ j; B9 v# I$ b) p9 b/ V& k1 {
<TR>
0 a9 Z7 v  E: c<TD><PRE>Method 01 # a2 w- u! v- }! M% G: |
=========
$ G- s. q7 A; D; l! ?
& S, }: Y" P$ ~6 S6 lThis method of detection of SoftICE (as well as the following one) is: R5 T2 p7 z. r: ^  G
used by the majority of packers/encryptors found on Internet.2 a/ x% X8 h: u
It seeks the signature of BoundsChecker in SoftICE) E7 f6 B; U& G  B3 q4 Q

# s: O' }0 R  l4 T0 _- j    mov     ebp, 04243484Bh        ; 'BCHK'
; z8 w! q! f$ {    mov     ax, 04h
, R2 w* Q$ S/ V3 x& X4 a! }    int     3       2 L* [  R& W7 J2 u
    cmp     al,4
6 E7 Q4 _+ R/ G) @4 Z- Y0 r. g    jnz     SoftICE_Detected+ A- \  i7 y; X9 o" o( q' x

% ^% F  @# C% g$ B0 M( ~___________________________________________________________________________- E8 W9 {: R+ X8 ~6 d4 _& V' \( n- H) b

) w$ D2 m2 I3 N- s2 E' H. e( F. KMethod 02
6 [& _+ J9 ]$ b$ m0 j$ T=========
7 D9 ?1 Y, i7 k+ A$ R4 v
3 J6 F3 o' }9 J' c" u- L7 cStill a method very much used (perhaps the most frequent one).  It is used
* u3 w- Q: M% ?: A5 t" w, jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ H# \3 q. F9 [: {
or execute SoftICE commands...1 Q) f1 m8 k" E3 E8 O
It is also used to crash SoftICE and to force it to execute any commands
6 K* g/ |% V* Q3 y6 w1 C0 I! o(HBOOT...) :-((  
/ S% i! `' ?  O( d: W+ G) V1 j( ]# t2 x; B3 M
Here is a quick description:
4 v9 T3 X) n  T-AX = 0910h   (Display string in SIce windows)
" o' u! T" k# A& B$ X-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* V* G) N* h& W2 ?/ N-AX = 0912h   (Get breakpoint infos)
* @: z' T. v- u4 t2 ?$ C1 l-AX = 0913h   (Set Sice breakpoints)
# {" C  e) U7 P3 f: E: G-AX = 0914h   (Remove SIce breakoints)
! y1 _: u1 a$ Q" h% A% z! I- ~; a- R% q
Each time you'll meet this trick, you'll see:
- g9 u/ f" H! y; m' `! `-SI = 4647h9 a4 D3 G0 |& m2 y7 e$ i4 ~
-DI = 4A4Dh* C1 ]" Z2 D$ w& R, J% d9 Y
Which are the 'magic values' used by SoftIce.( Z6 ^0 N) [- c+ k# ?" X( Z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 i- x* y& [* J- w: s( j' x. m% L
2 L- q; V, d& {( o9 _
Here is one example from the file "Haspinst.exe" which is the dongle HASP0 F7 ~& ]9 t9 e5 Q/ U" r" F( v7 N
Envelope utility use to protect DOS applications:/ t$ X1 p/ p+ H5 Y6 \
' i( a% h( G4 x  d
7 z( I" Z7 `) w) @5 @
4C19:0095   MOV    AX,0911  ; execute command.
; a, g% P+ O9 A! J: @( o4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 ^8 t% K0 |5 |' a2 q! z4 h8 H0 k9 K4C19:009A   MOV    SI,4647  ; 1st magic value.% Q" n0 t% a4 H: C2 Y5 ?/ T. o
4C19:009D   MOV    DI,4A4D  ; 2nd magic value., q8 ]# t* H! S! L$ M6 \
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& e' N: T0 {  {; r4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute3 b' L+ P5 ^5 c1 ?6 G: u+ N; X/ \8 i
4C19:00A4   INC    CX
2 J1 M" }. Z( w& ~% E4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; B* P6 K& a. {) b: ?4C19:00A8   JB     0095     ; 6 different commands.
/ @8 c* L% c; v/ s8 D4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) f/ W7 V$ [6 r+ [4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, A5 s6 h5 f+ I, C2 E* |" C, g5 Y7 M3 N6 y6 ^
The program will execute 6 different SIce commands located at ds:dx, which
/ z2 x# c# n$ M! \& ^are: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ N' h2 Y: L3 ~

  i5 @% N5 d: |, [- |* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ Q. m* ^, j, Z' ]# p, N___________________________________________________________________________2 L7 S. G4 N. P+ j8 x' t" U

. p+ g; s5 N) [( Q5 Y4 I# Z" D6 ?
8 `3 u% C/ E- i( A4 n% U3 i4 fMethod 03  g" }6 d4 L0 F- [5 T! ^
=========# b, V! T9 f8 ~& Z
; f0 [) m3 M& _, k# w" }0 S
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, e; u: i  K& ]4 ^! h4 d
(API Get entry point)) z- t( t9 i* d' K1 m
          b% k6 n9 n, Z+ Q7 R5 _; G
8 D  R% F7 Y1 F8 a+ a
    xor     di,di
1 o. k% N+ h! g5 k: {* C4 t9 M    mov     es,di
. U0 P6 m; T) B! `    mov     ax, 1684h      
& X0 ^* U9 j0 _/ w    mov     bx, 0202h       ; VxD ID of winice
4 ]: M! {9 p/ ^    int     2Fh; r* B0 |; L3 v. a* n* ^( K
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  J  d* V( K$ C# i
    add     ax, di
# i4 C: r/ k9 l1 M) i! z    test    ax,ax" [. j3 u! p: w2 r3 g, ?; z8 }
    jnz     SoftICE_Detected
6 _# u3 L/ Z. Z3 t9 H$ A. g  D
4 x7 A) m$ q5 Y4 J___________________________________________________________________________- {+ Y# b' z8 S$ R5 K/ ]$ e: y

. C& Y/ `# P3 m. Y# u5 rMethod 04( I  c  `/ m, X+ M
=========
, [2 x* x- S( ?; j. @
; \0 }1 g, s) @! Q2 I- _Method identical to the preceding one except that it seeks the ID of SoftICE. F+ d, a  U. M* u( |2 F
GFX VxD./ |1 ?! l) @9 \& g7 s
! H; J1 V& _! n  f
    xor     di,di* K8 p/ A( L) {% ^* b. ]1 K
    mov     es,di3 h# u, d2 x* j
    mov     ax, 1684h      
8 V7 Q; ^7 ]- b/ |9 a' @    mov     bx, 7a5Fh       ; VxD ID of SIWVID) p0 I8 z0 K/ E
    int     2fh
2 D+ c0 D  m& h8 n# |7 ?3 W1 i    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. x- g- I8 v- i2 q  H    add     ax, di
( Y2 b1 h- L( R4 ]! g" a! Y4 f    test    ax,ax
' `1 T  z# N# b6 F    jnz     SoftICE_Detected
+ A/ U9 q& C  s) n- j0 k1 [& M& W: B! X# S/ a6 b
__________________________________________________________________________, p) }6 s7 u8 q  X; s

4 b/ C8 j& y& G6 H% v$ Q
: N: x7 d" g3 Z1 I  J5 cMethod 05- |5 W) ~+ s' R% f1 b; t
=========) Z" t+ y! _% w; J
7 `" X0 u  s8 Y( N
Method seeking the 'magic number' 0F386h returned (in ax) by all system
  ^! k- F9 H. O- l9 J, i6 vdebugger. It calls the int 41h, function 4Fh.2 g  a, m& R$ k7 ~1 M2 ~
There are several alternatives.  
  ~' R! B8 J1 t) Z6 r* S" c& E; x3 U, g, v4 z8 d
The following one is the simplest:; D8 Y: v8 ~0 G* r+ ^1 h

, c3 p. X. K. r% P: E' e    mov     ax,4fh
( n. Z/ U, _, J. W0 u2 Z    int     41h
8 s% m$ x5 n' r4 P/ _& t( e    cmp     ax, 0F3867 a7 F; J, i7 n; H- r5 y
    jz      SoftICE_detected" E5 \% g/ \, Q8 y/ ]9 V

5 D% g) w5 v- ^! t
2 \" a* a9 ~+ v0 o" P6 zNext method as well as the following one are 2 examples from Stone's ; b* s' n0 r; [8 H
"stn-wid.zip" (www.cracking.net):
9 W4 l- m  t: K5 |8 e: z( x! O0 m; j+ I+ O( l7 E; M. q
    mov     bx, cs
+ N' U- p" [* B    lea     dx, int41handler2! x3 K7 y# A: Q2 h
    xchg    dx, es:[41h*4]
+ j: i$ N& z+ x  S- s" N4 f7 d5 d. |, i    xchg    bx, es:[41h*4+2]$ n# x! |' g& ?# r2 T9 N1 Y) }" ~
    mov     ax,4fh
6 L6 a7 G! u0 e- s    int     41h
7 B; v4 \, f7 M* @3 B    xchg    dx, es:[41h*4]
  b2 _3 A  y  e# w, B    xchg    bx, es:[41h*4+2]7 X9 Q, E7 Z# x( {
    cmp     ax, 0f386h' Y) F: w- u  l2 z: w0 e- C5 A
    jz      SoftICE_detected
0 I2 H; r7 C5 W3 {5 A" \4 s
+ c1 }+ X0 k) y- K& }int41handler2 PROC& O# Z) p4 ?& z- U+ o
    iret0 J0 S) S* S1 D5 C- |
int41handler2 ENDP
6 j0 }" K/ [9 M. W  R
1 N7 O) X* v4 Z& V$ |) q
2 U# n- I2 O6 a0 ?' m" J_________________________________________________________________________  F' A% K6 @; X# q
' K$ e2 a  Y/ p: V

, ~  A! N& d! o. Q' x# z  S1 h1 ~5 L# TMethod 065 e0 _( L* k9 U" J' |( D5 a5 \( J
=========0 j/ j% n4 Q; Y( l

! A' h" O0 ]5 j, W: _- f) z( D) H9 c" V- s) x, H! ]& ]* ?9 \+ e3 S: c' N
2nd method similar to the preceding one but more difficult to detect:; N6 [( p' b6 o5 i, G

# o+ i  z+ E5 n: H! L6 ~% q% `! Z3 q8 d  g% l! M4 M& \# K
int41handler PROC
+ }% Z) d- `4 C' W5 c' g* U    mov     cl,al
3 P9 @! ?% t( e6 N% Y$ |+ Q    iret$ F1 G/ F; L7 L
int41handler ENDP
. G0 E- M  m4 S& B4 K0 t
! g  Z' b7 J4 o- a4 _
. R; j! C& N, x3 {7 |9 W    xor     ax,ax9 m  y& e- i" m5 S9 }: o
    mov     es,ax5 Z5 j- D1 a9 ~
    mov     bx, cs
' a* o3 f; l& x6 [    lea     dx, int41handler
( `, U* D3 {  g! s9 V3 A9 R    xchg    dx, es:[41h*4]3 A" g: ^$ z  v' v$ a, t+ B
    xchg    bx, es:[41h*4+2]3 W' A) f  w! O/ @2 |3 Q& X7 a. u# B
    in      al, 40h2 Q: v8 k* s+ I1 b9 o
    xor     cx,cx( E; `% H: T8 X: D. K1 q! ~! s
    int     41h
# g% l9 X7 b( P. f( I    xchg    dx, es:[41h*4]$ P3 s% a4 y8 ]2 ~. i1 N
    xchg    bx, es:[41h*4+2]
8 \) r* _& z, c! Z8 s    cmp     cl,al
* L+ O5 G1 ?" ~    jnz     SoftICE_detected6 J+ o9 ^+ {! E
6 i1 s- \. T% |. [2 L% ?2 ]
_________________________________________________________________________
( q4 `% w) S" R! y) Z, f/ g' N, B' [! Q5 {, n
Method 07
$ p& P: @6 I. Q3 n) Y4 K- r6 V=========
! {3 G  ^- T' m1 A" J0 c4 l  _) p; X- t* L1 ?# l
Method of detection of the WinICE handler in the int68h (V86)1 L* f* K) U# b  ?, f

5 X, X/ r+ F1 ]' c! j- V    mov     ah,43h) c. ]6 g: T1 P: I& A/ l
    int     68h2 ~+ j; k& I1 Y: E" ^
    cmp     ax,0F386h
4 D& y: s  h6 ~. G; E    jz      SoftICE_Detected
3 @8 r+ y6 N5 L2 a) G+ G# U; O& I2 u0 n" G

7 w$ H) }4 l: |$ d3 W/ K8 }=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit4 S  y" T& f2 M' a
   app like this:
+ w$ n" }" ?- S. p# m4 W" N" X* u" K4 b2 K& i" m' g+ h9 j
   BPX exec_int if ax==68
' P. x5 X: I8 _- m  J   (function called is located at byte ptr [ebp+1Dh] and client eip is
" A  X- R7 Q$ r. `4 n5 Q  g   located at [ebp+48h] for 32Bit apps)- }* |. a; Y5 x9 B  m% a. U' z5 m/ f
__________________________________________________________________________
4 J5 ~- s: E" T6 j3 x+ ~! u8 y8 s1 Y

; d0 h+ e5 Y1 I% n, {8 RMethod 08
: t5 D, z" S+ o% p" |=========
7 {- p/ K1 U9 u( z: x+ ^: C4 B
, \6 Z) A4 }: g  dIt is not a method of detection of SoftICE but a possibility to crash the
# X& W0 ?4 r$ }% M; \. lsystem by intercepting int 01h and int 03h and redirecting them to another
, u1 B+ t8 A6 h0 |routine./ S0 w8 H& E' T0 `$ @
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# J7 T. E. q# u7 s
to the new routine to execute (hangs computer...)+ }7 S% X% A- B7 V7 H" U) Q# N
. j! Q* M/ f4 V+ p/ r' p* b1 q: B
    mov     ah, 25h& V" D7 f  P! W0 X" g8 n
    mov     al, Int_Number (01h or 03h)
" y# {% H. e! Y) c- B6 y    mov     dx, offset New_Int_Routine
% E6 a0 S( @4 M9 W9 r    int     21h
# P  f8 ~' q( v7 D- [  V
# G* Y. I; B, }. Y% w; S% H: j( U__________________________________________________________________________
4 t7 p& l; a+ W+ c$ L9 m4 f2 |
& [6 w( Q: x* l* y. }Method 096 a4 R5 T3 T2 ?8 G& C
=========
5 F- M, V& g& u# |8 v# u* ~- K5 P' B' S  d5 v
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) ?& S" D6 V' |. sperformed in ring0 (VxD or a ring3 app using the VxdCall).( @) ?& t- @% Y1 x$ p! ^
The Get_DDB service is used to determine whether or not a VxD is installed  [& b0 |0 \" C
for the specified device and returns a Device Description Block (in ecx) for
3 ~$ F1 a* Y7 e5 o1 ?1 Z0 L$ s, U) gthat device if it is installed.
* a0 w5 W1 X& {' [
* n1 n, x# K" l. ]   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 R( Z' X6 J0 B4 Z6 c! f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
: H+ i) G# i! u* E9 F   VMMCall Get_DDB# Z& G/ W+ }# E2 C" s/ T) W8 s* g
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( E6 {/ y: O% T; _! L

1 w8 a; T, J9 w6 x: i+ iNote as well that you can easily detect this method with SoftICE:
+ a: W3 m- Y; O+ A, \6 b   bpx Get_DDB if ax==0202 || ax==7a5fh
6 A1 D& l+ _- k1 v, [/ G& h: i
6 X0 c7 G" H" c# f! M__________________________________________________________________________; L! _8 N, w1 _' @8 J+ Q* I1 @
6 Y( p" e$ t2 `5 w" y
Method 109 Z6 S3 p' N& u, Y6 C
=========
( D! u# b& n- h! @) z# g' R) t+ S2 ]1 J0 U8 o' d, T
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) m: ^3 H  W( f; x: h
  SoftICE while the option is enable!!
, K' I0 u1 G2 c6 P. X- b$ U0 H1 T7 Y0 d# L
This trick is very efficient:
; B+ P7 S" }6 V6 }! R) xby checking the Debug Registers, you can detect if SoftICE is loaded
2 X' d% H% w/ K(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* Q3 F/ R  e& Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their( [9 ?6 x( s1 V3 O# J$ a- G9 T
value (in ring0 only). Values can be manipulated and or changed as well
0 i( H8 z( r0 C" t(clearing BPMs for instance)
5 L4 ?! P$ x7 y* w2 L( T8 w9 A0 X" v8 ?+ }  ~
__________________________________________________________________________0 [. ^, O4 d, z( g/ L
% }. X5 ^4 K$ m) T4 k) S+ U7 z* y
Method 115 l2 |) X0 D# z; e$ \8 C$ o
=========7 K# S  r( h9 x

% `& Y; K* b' i% F. ?This method is most known as 'MeltICE' because it has been freely distributed
+ R: Z5 Z5 f# {: v. \via www.winfiles.com. However it was first used by NuMega people to allow9 \2 `+ H* r$ ~* U4 e5 F$ V0 W% S' K/ J
Symbol Loader to check if SoftICE was active or not (the code is located' Z# F+ C  `& S' G' Q3 P$ P
inside nmtrans.dll).
7 ~( o3 r  ~& R& [7 N4 Z
  c) A9 I/ `  U0 G( y6 NThe way it works is very simple:" \  n6 S9 P; B7 D. K  F) R: V
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! Q- f8 |' i$ i: R8 d" B
WinNT) with the CreateFileA API.
: l: E2 C) G! _1 Z7 T3 Q- Y' Z6 r
, }5 f! s9 ]8 e# y3 X  hHere is a sample (checking for 'SICE'):
( B, \* y- `! q. z5 c$ r. c1 n! P$ b9 B. F' v
BOOL IsSoftIce95Loaded()8 {7 B' m  C2 P( I' `- i
{5 p* x- Z' ]% b  a' b( ^
   HANDLE hFile;  / G( i1 s% D+ Q9 m
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) ~' o/ q7 N0 `( u                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 d/ f* H* \( |" O
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# }6 ~7 R: M! t
   if( hFile != INVALID_HANDLE_VALUE )5 o9 \, @( y! z4 }
   {
; |* l. q/ j) l- v8 {, w! r5 V9 X8 p      CloseHandle(hFile);; T3 a8 J! m2 @% E' c, r
      return TRUE;. H( O) m( u# G  D
   }
6 C5 L: k: G% o2 E   return FALSE;$ i! d6 B2 ?8 q
}
$ ?% M, s7 {& Y' U- a7 o8 F* ?1 C8 ~% b1 M$ P8 t" F8 v
Although this trick calls the CreateFileA function, don't even expect to be
* c" k8 {1 x8 L6 aable to intercept it by installing a IFS hook: it will not work, no way!$ h* ?9 j% H+ n- c7 I% e
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
' i- O1 Q9 h  g; Eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( m/ d5 f3 b0 K7 V# wand then browse the DDB list until it find the VxD and its DDB_Control_Proc  A8 g6 u( T" u4 N9 q. {* X
field.( P& a4 M% L  X
In fact, its purpose is not to load/unload VxDs but only to send a
  ?( p6 X6 J" C& m/ l" `( e7 WW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 V/ J+ z& X" e- rto the VxD Control_Dispatch proc (how the hell a shareware soft could try( g: Q5 B/ }& b5 e) n9 Y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).. G( h& W1 o5 x" A/ R# @
If the VxD is loaded, it will always clear eax and the Carry flag to allow; ^0 Y: w% Q! J, F9 @
its handle to be opened and then, will be detected.7 u5 ?) s* ~' R
You can check that simply by hooking Winice.exe control proc entry point0 |: R+ d  o2 t" V/ t
while running MeltICE.
7 X: i" d; W/ E2 `: }0 U* u- |6 c; J" r
1 U1 Y) C- u4 n) X" f( d  |" f, s
  00401067:  push      00402025    ; \\.\SICE
! Z% q' Y& d! G/ f  0040106C:  call      CreateFileA
% A1 u) N) c, f  A6 M8 F  00401071:  cmp       eax,-0017 M4 S4 [  F! }/ w: p
  00401074:  je        00401091# l* \# A1 d5 T5 w  \  H
8 L& H. z/ p+ V& W( F( C7 {

  R6 ?# e0 t; D4 H  mThere could be hundreds of BPX you could use to detect this trick.5 B4 O1 Y4 b1 Y. d* j  n' }
-The most classical one is:! d3 d: }0 E2 z$ D! X
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
: G5 I# w" s  q. N    *(esp-&gt;4+4)=='NTIC'
: q+ N) K# Q$ G9 n* |( `) i. X6 c9 Q8 i* B
-The most exotic ones (could be very slooooow :-($ X5 o: G# m, i. z5 n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 L$ T* Q) `, ]( O4 K& v
     ;will break 3 times :-(
& t  ]: T7 b" u. |! u  n, f/ I  q2 S+ S- v5 a# D
-or (a bit) faster:
0 n# S5 {5 M3 T; q% ~   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) _  g8 r" I- C8 d4 I# K# X  ]

2 x) P  h# D' J   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  % F$ v, H* {% S
     ;will break 3 times :-(
* ^. D7 B' A# P# q3 J% {  ?' b
$ N- _) n- ^$ Y5 u1 C-Much faster:
3 g% l5 C8 q# N( e1 @   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
: R/ z3 U9 _) C; E2 m& x+ ?5 s( [8 B8 L
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# {7 y4 R- Y; E  b  g
function to do the same job:
9 o7 d1 n4 [, }- t$ }. k" \0 k/ a  ]+ `# i' _$ C$ T* V' F) U' W
   push    00                        ; OF_READ
( M2 M! R+ \* y) p7 R% e$ j   mov     eax,[00656634]            ; '\\.\SICE',0
1 ]: X2 M. s$ n! B   push    eax
3 Z+ m8 v' Q# E$ r+ e! K& S/ i, C   call    KERNEL32!_lopen6 W! N' V( u7 F4 l, @" `3 t
   inc     eax7 ?" B6 j& u* ]
   jnz     00650589                  ; detected
$ l8 `- _& K2 Y. g7 L( _6 ]   push    00                        ; OF_READ# u! {8 J6 p" H' n; R$ N$ c
   mov     eax,[00656638]            ; '\\.\SICE'
7 a* S( w: |9 K* Q: O   push    eax
% l( v- W' }0 m4 d; Q" @1 h9 l) Z; W) J   call    KERNEL32!_lopen
: y  N% c9 A) K* f$ c' j. `3 p   inc     eax, z) y2 I1 k( I5 H- z
   jz      006505ae                  ; not detected
+ y0 d) X- U+ L( b4 M. F3 `4 W5 z2 m. g
2 g" O5 A4 |  u' _8 p. I
__________________________________________________________________________
, {5 S! b$ Z, \% B: I: f8 \
+ ^8 w' V2 Q# e4 I: C$ v3 F) U6 WMethod 12
; s$ _! `+ w2 i& O=========
& u: Q, l5 X6 F' g, f
5 e4 q" k- Z" b$ T3 vThis trick is similar to int41h/4fh Debugger installation check (code 05
( j! H6 O" R! W* b& p+ P8 T/ w&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  J$ V: O+ R6 L; ^# O" jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.# S8 r+ n* ]6 [. t, Y) i( r5 U
! c8 Z3 q4 H+ o) z1 |+ G
   push  0000004fh         ; function 4fh
5 e% r% j2 R. J( V+ o   push  002a002ah         ; high word specifies which VxD (VWIN32)
9 f- Z: s0 k# }* {! C' `/ G7 ?8 Y: k                           ; low word specifies which service
7 M+ s! Y. B6 h: k8 Q8 f                             (VWIN32_Int41Dispatch)
, s7 \2 M3 S& y6 V* o   call  Kernel32!ORD_001  ; VxdCall; U+ }" Y( f9 I* F
   cmp   ax, 0f386h        ; magic number returned by system debuggers6 e( k8 `3 b8 J1 \+ D' {0 X% W
   jz    SoftICE_detected
; ^/ J) A8 S  N5 q: W* t
# Q- s! D% T( ~Here again, several ways to detect it:
  L% Q: \+ }4 e4 {  }
4 N; q5 d2 ]2 d; e$ O    BPINT 41 if ax==4f
4 {( Q8 K5 U; ^' p! |! a
) k2 M' ~3 ~6 B: r% M) K* v3 {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) ?3 i# g" B7 G0 l6 T7 ?* y  l' c/ m' \5 n9 |8 \8 Q  n
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A% @( `0 ^' h1 ]1 |+ C9 y4 d7 k

* u  s  i7 r3 ^8 ?    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) S7 V+ H4 o; n0 f
0 M/ Q' e$ ~$ Q; s9 K; i& J0 N
__________________________________________________________________________/ d, M0 K. ~, ]  _% q
( C- P+ G2 r( E! k/ Z3 a
Method 13
& p% F& G3 e* t/ s5 I# c  O( C7 _=========5 [( n( w& A' I; J- S( e- i% {' q

/ O8 A1 n; M7 \' R5 J  ONot a real method of detection, but a good way to know if SoftICE is
2 S4 r, f, ^0 o' q# Finstalled on a computer and to locate its installation directory.
) H# Q: N- ^& A( F- OIt is used by few softs which access the following registry keys (usually #2) :. @$ j9 X+ n* u  q

$ X, |$ n" |. _8 Y# A$ @9 Q; w-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& ~6 s# R0 n! @% F
\Uninstall\SoftICE$ R; C0 ~$ Y/ B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ [0 @- S" p$ r7 A
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" u! m. T3 G/ d% P3 g3 l) \/ f\App Paths\Loader32.Exe
* o! ^2 s, y' j* W# R8 q+ ]  ]% k- G
) P2 T9 m, g/ Z" I3 q7 `2 R- C' K) F6 M
Note that some nasty apps could then erase all files from SoftICE directory
/ N5 F( k2 l( M8 j(I faced that once :-(
' Y  \' [5 k% h. n9 I+ F0 h$ e2 @$ q1 U/ E. m3 g
Useful breakpoint to detect it:' }" F9 F9 L5 [; Q+ e5 S0 H# l
8 O: ~9 l9 d4 ?8 _$ `
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
7 s) k! y* _1 z& E; D; ~0 w* k
4 ^& u  i% i4 D__________________________________________________________________________5 @' d! q9 I3 J- H
4 f* Z' j: C* A  N$ X5 h* A3 c5 P

0 C  s( [, V5 [1 ^1 F1 [Method 14
% U2 K5 e1 i$ m- K0 O5 Z( j4 |- i! J1 u=========9 _, Q; b, Y  n" K
6 k$ V1 P! }. ~! o. K4 g) m
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ P8 G4 k& z; @, o8 N& d  lis to determines whether a debugger is running on your system (ring0 only).
% N: P2 ]1 `* p5 ?
9 X! l% O/ v& u0 |   VMMCall Test_Debug_Installed1 W& W6 ?, W8 b$ @* {8 L% Z
   je      not_installed  ?+ r* z; F+ D  C4 \' R

2 Q* z9 s& ^* b' S2 RThis service just checks a flag.
! M9 y( x0 c8 D, V. e</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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