About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 E0 Q7 h' X' ^& e<TBODY>
" v0 s- c. t  p7 M) ?<TR># |4 V7 m( O) {- ^  X1 P
<TD><PRE>Method 01 , G% u7 I0 B5 D$ o, ]
=========
  y9 B5 B8 N" B' f8 x9 P2 V# D1 i( \) x3 R( v3 C
This method of detection of SoftICE (as well as the following one) is9 @' R* |; p& O, c8 L# d, u
used by the majority of packers/encryptors found on Internet.
- K0 o& E5 W% F4 C& SIt seeks the signature of BoundsChecker in SoftICE
# C' J; ^" W( J4 c0 Q- b; Y- j* }' l3 G
    mov     ebp, 04243484Bh        ; 'BCHK'
" ~; o9 B% i+ |1 t! ?1 A% w    mov     ax, 04h" w, n& E% M. s
    int     3      
$ ^% a% \1 i0 D7 H    cmp     al,4( }% q' r; w9 `7 ?0 ?
    jnz     SoftICE_Detected
5 Q* |1 n. r; w" u2 [* }/ Y" z! P' {! |7 h
___________________________________________________________________________$ a, M& W/ A/ j5 i
3 \0 L7 N& U$ k+ t. g& p% O: o
Method 02
1 d' L& ^1 o% Z1 v=========
! k6 t) X. q) T2 `7 c1 A: q4 i9 @; }! _, k
Still a method very much used (perhaps the most frequent one).  It is used. V' Z0 ~+ n+ C1 d
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 A5 E5 l$ o" ^+ R( l' `* T2 n
or execute SoftICE commands...& l. U- w% s3 f
It is also used to crash SoftICE and to force it to execute any commands) I6 v) p" w0 J, Z9 [% {
(HBOOT...) :-((  6 D# c  O# \: U& S! ~

7 h6 f- Q, Y5 I3 j: A' eHere is a quick description:
/ m/ L4 l7 `# v3 ~+ P$ n-AX = 0910h   (Display string in SIce windows); `- S# X8 g/ T6 ^+ I- W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( o' T+ G2 P2 z' H8 _9 }-AX = 0912h   (Get breakpoint infos)
- q% f9 R' _8 W3 q-AX = 0913h   (Set Sice breakpoints); I1 t* R2 ^: U5 ]0 i: F
-AX = 0914h   (Remove SIce breakoints)2 G6 `  e1 b3 O8 Z8 G  E- Y- `

/ I2 s  K8 O* w8 E$ }. R( }0 BEach time you'll meet this trick, you'll see:
, o# N" v, `6 m& E6 z-SI = 4647h2 V+ t! W) u1 a8 }: ~. U. S
-DI = 4A4Dh) R8 C/ a0 e+ n& g' i0 c0 c
Which are the 'magic values' used by SoftIce.+ G; i* _  R* k- D3 O- s
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& F. r% |5 z! _0 K0 Z$ G, W

5 x. \. x' l0 [Here is one example from the file "Haspinst.exe" which is the dongle HASP$ v: `9 t( T4 N' k3 v
Envelope utility use to protect DOS applications:
2 e) }0 }3 H) z5 I& O$ f6 Y% a1 a, C# I$ I: P

0 p( E5 k6 v/ h+ N, I6 `1 |# y0 ]4C19:0095   MOV    AX,0911  ; execute command.
# c, _8 g0 \  Z4 q; ]4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 s& m2 G5 K* q4 V  F( V  _4C19:009A   MOV    SI,4647  ; 1st magic value.+ {* r/ `) j+ x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 Q# e( h4 _% h, g: @
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
, n! B) F, S7 Q. D/ W5 o4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute1 @3 Q/ f* Y% y& J* g
4C19:00A4   INC    CX3 {7 [8 r, l0 Q* S
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute  T' Z  R4 K2 K
4C19:00A8   JB     0095     ; 6 different commands.
2 z  M- k! I$ R+ K* G' H- [4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) k. u* Q7 {" `" \, d- O$ D  x' Y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 p! A: h' T/ `: O) `
9 Z) U! f# o: ~6 gThe program will execute 6 different SIce commands located at ds:dx, which
7 O1 a% f. G/ K8 n0 @are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 [; b" d8 u8 X# P& z
$ }: h7 A' i4 `5 k4 H4 r9 V% f; |, K
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* x. f' p1 y3 G$ O5 H, r+ f0 ?- q
___________________________________________________________________________) P% A1 ?9 R2 a" r" e: M% s

( q1 z& i" s; u  g% }. x0 k* w8 h/ ]+ o0 S9 J6 r0 y
Method 03
  u8 s, s. Q1 D=========% T$ b- A3 E0 [+ O/ c
, I- j6 ~, m6 @! I* a( t
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
% E. }' N* {3 w( Z& w6 L. A(API Get entry point)9 n4 p: l1 `" w, m! M# C! r6 h
          L) T5 n5 N) e: ?6 c

* Y  M8 z- [; S' e/ F6 H    xor     di,di
1 M1 N; V4 }3 T$ C    mov     es,di
. H  h. [& ~* w3 R- E) d' m    mov     ax, 1684h       + a6 R! N6 J: T: D, r1 t) U% N. i
    mov     bx, 0202h       ; VxD ID of winice  J; u" W7 Y" f1 v8 f
    int     2Fh8 C9 F5 O( ~, P) s2 L6 ^* W/ V- f4 C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) n& a: ?7 D7 n0 J    add     ax, di
+ [) b' F, h; x3 _7 y    test    ax,ax" Z2 n) q0 q9 r' B
    jnz     SoftICE_Detected
4 _5 j% S' e, k+ h8 O' d
  `6 W" t, r0 ~. B0 q9 q" l! _/ e___________________________________________________________________________* u" H$ D. p! g8 i7 i
7 R) H* r/ ?/ D' ?3 ~/ P
Method 04
4 ?2 I. {) |  @5 Z# k& C=========
0 ]% n1 r) s, U# q
! v8 W1 r+ s# i, Q6 KMethod identical to the preceding one except that it seeks the ID of SoftICE
1 I$ O+ {! @7 F! J9 b, `; CGFX VxD.- R" J5 Y/ O7 Y' E' t! w

( H' @. v4 V& B" L4 P! m4 S9 c    xor     di,di
* ]; L4 \6 X- N& }3 G1 w& Z1 T0 t    mov     es,di
0 R3 C+ E, A. E    mov     ax, 1684h       / Y8 B: \5 x5 D; d; m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! ^2 P' q: U: y    int     2fh+ j+ D; k1 ?, q0 j! }
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; W- T" p0 {- B" ?  Z
    add     ax, di3 \" _0 O- a7 l, [( }
    test    ax,ax& L  P6 G8 T1 _' Z
    jnz     SoftICE_Detected
% J# M; F5 i! W2 U
7 I2 V5 ]4 i4 Y__________________________________________________________________________* H1 v" g2 K% b  D
3 o8 ~! [  S( ~8 y

" ?" ~7 j7 Z# X4 z( M2 S' R* mMethod 05
( J! K0 M/ F! I+ B5 Y% {) P=========: ^' J" o# f- A3 y6 G) T' O& a- G3 {

; g+ V5 \  r3 h* e1 PMethod seeking the 'magic number' 0F386h returned (in ax) by all system5 M% x& C/ A9 T4 F0 J3 u5 Y6 ]
debugger. It calls the int 41h, function 4Fh.$ ]; L% Y" y- S- t2 \: F
There are several alternatives.  ) c2 b5 [8 C) e
0 i" e8 h; r# d
The following one is the simplest:
4 J( `, ~/ v& T8 s( y
8 c- y8 t3 A. _$ {0 @* O    mov     ax,4fh
% P7 S5 _0 T. Y1 B- Q; _. v0 ?    int     41h
  T8 \, J1 A- w0 h    cmp     ax, 0F3866 }: r3 V9 [$ p, R/ S$ P5 Z
    jz      SoftICE_detected$ I0 p; l" `) C0 q& t8 ^

# {8 V. D& g+ ^* V/ r& Z
1 d9 \3 ~8 `: S! y( Q3 `Next method as well as the following one are 2 examples from Stone's
  w% Z- y2 T+ ]$ H- a& J"stn-wid.zip" (www.cracking.net):7 V1 M9 H  V) a
) M4 b4 C2 @3 s, ?# G, B
    mov     bx, cs
$ o& M3 {# W0 a1 x8 o9 @    lea     dx, int41handler2
0 i0 q3 |; l+ y    xchg    dx, es:[41h*4]! W. E5 d' T, m, K; z' ]
    xchg    bx, es:[41h*4+2]
, ]' Q# I1 x) K- z& S2 Q& c    mov     ax,4fh# D  E) O0 a* z# v+ t4 ~, \$ N
    int     41h9 ?# K- _, e  w3 _! b  c
    xchg    dx, es:[41h*4]1 t. O7 J) k" ]6 x/ W: J: r
    xchg    bx, es:[41h*4+2]
0 B+ A1 @: u  z    cmp     ax, 0f386h
" ?$ q* r" b. M1 x: Q% l    jz      SoftICE_detected8 X4 d* |! b4 b) P2 v5 i: z  v

9 V! A5 A. Z7 }/ Q! _* `) fint41handler2 PROC
$ e$ k. Q( m+ e    iret
0 d" Y; \. I6 a  [0 o! |- R7 s8 n* aint41handler2 ENDP
! T6 `! _% R, t/ v, Q3 j) m0 U. Z7 b  S. u( p
- J' l7 Q+ }; J% ]$ ~% u# N
_________________________________________________________________________8 T) ^9 Z* h2 q8 K
0 s6 t; |  g3 V# @6 S6 y
: R* H( ~8 S( T, E8 {& N7 e
Method 06$ [( Q' L# ^+ N: ~" W
=========1 D/ q6 y1 h0 ^5 ?
# R" F, N5 F+ m. n# u

8 F+ }, U- {: E2nd method similar to the preceding one but more difficult to detect:1 k- I) e# j: g: ]1 H+ M) O
  i- t- j4 d. L6 I
2 V1 c, W, p; y* R
int41handler PROC
% ]3 k3 W5 L) F" q$ y) _4 ]    mov     cl,al
7 T) o5 w( `: h  o* X7 w% f    iret
2 N% j' j, `. g9 Zint41handler ENDP! z$ R" ~/ q: `: B) }; T
- t& P) u) b5 A6 h# c

6 T3 R% l% ^. H6 I& W+ W( u    xor     ax,ax0 C: Z; h% c$ Y: f- N
    mov     es,ax  I1 ^5 \  @& D* F( G, I+ t
    mov     bx, cs5 }3 Q. L) ?7 |4 h# j( h
    lea     dx, int41handler3 n, A8 }! ~) _! W# F/ L- s
    xchg    dx, es:[41h*4]; l9 W% h0 j9 A' d! E
    xchg    bx, es:[41h*4+2]. A( b5 A4 L3 N1 Y- [
    in      al, 40h  P# C  ^1 p) N7 {1 L! ?* |
    xor     cx,cx8 Y2 c/ U' [- X' z( A1 S
    int     41h
' F7 ^4 y. {2 r, U/ {# v' v1 r    xchg    dx, es:[41h*4]
3 g( u2 {% D5 X' }    xchg    bx, es:[41h*4+2]
4 ]3 D/ [# G0 }, ?8 K; R    cmp     cl,al
6 _  P+ \6 I2 A$ l- \    jnz     SoftICE_detected1 `5 Q% u' z, I- e

2 p3 O6 [+ y! l1 y_________________________________________________________________________; ]9 j2 Q: @0 A  Y
% A; @, ~) C5 H: n, W3 a
Method 07* M9 a) {( Y- A
=========
5 g0 j  i/ F  o) C  c' @8 P
- ^" t% g8 l* k3 R7 N. a% z/ ]* wMethod of detection of the WinICE handler in the int68h (V86)
, n) E& E/ J0 z" F( j2 ?' v
- S6 |9 C8 D1 `5 U( u$ b    mov     ah,43h
$ U4 C5 z& U7 a    int     68h
  Y6 _. D! T" k    cmp     ax,0F386h
( a& J' b; B0 z7 G6 g* ?/ J    jz      SoftICE_Detected
1 n9 l$ f. a- W' v$ f  C; ~0 N( |- W  q8 M; S! p2 c( g

; N$ H. ]  M1 l) u=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) Y" ?6 \3 n/ e* [" T4 }   app like this:3 N% ]/ x$ h8 l2 s# h, _

: c- n8 [* E. h' O% C  N   BPX exec_int if ax==683 S/ f9 J2 e; T( j
   (function called is located at byte ptr [ebp+1Dh] and client eip is2 G: |; n/ ~% l; D( t
   located at [ebp+48h] for 32Bit apps)
0 @' Q/ R5 w) T6 |__________________________________________________________________________
! X* f4 u# n( v* @2 w( B5 A5 {  O9 H. s$ d( u$ J/ ^' U
5 ?0 a! x% Y1 A  C, W
Method 08
9 j& _: K9 Y1 A% A=========
) L4 U, ^/ O8 @1 ]9 M" Z/ Z3 v
# }: Y9 Q  O, M! [5 TIt is not a method of detection of SoftICE but a possibility to crash the, \1 {0 Z0 ?$ L9 x6 Y! H
system by intercepting int 01h and int 03h and redirecting them to another
, R; }" H; d) ~( x( `routine.
# i4 x- O" U% N" R' c7 zIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 O" O5 B8 ]- `) r# mto the new routine to execute (hangs computer...)5 S/ J% d8 \. T8 P3 C- u' ]

- N9 n# h) l: ~# W% R7 l  z    mov     ah, 25h
& A/ Y, I$ \" i$ a5 X* n: N    mov     al, Int_Number (01h or 03h)
1 _2 i2 O( d& P: M7 n: P* F: f7 y    mov     dx, offset New_Int_Routine$ W$ E. |  K5 M: D5 d3 N
    int     21h' U, X% Q# N8 ?) k
3 j) k+ A+ e6 [! I
__________________________________________________________________________
' z4 r6 P; X( @, {
& B1 {, ^* z/ C% q+ N+ [' q) fMethod 09
' x7 Q1 H% K" U) ^! k; C=========' X$ }- a, v$ @# p  R( T9 n  y
7 m. H! B. Q! w* m: w
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 ]  n8 X' W' A( o8 U* m- P' `
performed in ring0 (VxD or a ring3 app using the VxdCall).4 E# u# x, u2 [+ T1 K8 k+ j
The Get_DDB service is used to determine whether or not a VxD is installed
9 u; O- C/ J/ j2 O( Dfor the specified device and returns a Device Description Block (in ecx) for
* V# a1 r# d! b- G7 ^+ ~5 Lthat device if it is installed.6 v' b+ g, m4 ^' L" Q# o
, ~& G- H# u  o. c! }3 v
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& n, r* x$ J% x- b3 a+ H- i$ G
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
3 T7 I+ d8 |0 E  D+ h$ C# L- ?   VMMCall Get_DDB4 h2 t# U3 \, j- N1 E' `
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed5 _. s* l9 @! p# d0 u
- ]0 V+ d, A# q) d
Note as well that you can easily detect this method with SoftICE:: k8 v# Y2 D. z7 s" }0 `, s& e
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 P# A2 o+ @, G# F7 E
9 a( m5 V7 V) z2 @. V3 z) k+ M__________________________________________________________________________' o6 {+ L/ b' C% W
! V, m' o  R. A/ f; `+ ~
Method 10& L+ C% b9 h; W4 u. w& g+ {9 F! @
=========
/ B# ~# Y4 Y4 s& w9 B0 ]: X8 g7 z1 f! W# ^( L% I
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
  y( j8 c9 H* ~1 _7 i5 |  `  SoftICE while the option is enable!!
/ I1 f( S, S, N3 f# K4 p8 |* Q+ Y" L: k9 [( Z% y7 f
This trick is very efficient:3 i& w: U9 t" X. B( r, O  K
by checking the Debug Registers, you can detect if SoftICE is loaded
% e2 b' h! t+ Y6 O) O4 L; L( j(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 j( t5 z& {" \" x: nthere are some memory breakpoints set (dr0 to dr3) simply by reading their
$ k8 d4 J# n5 A  q+ ?1 Qvalue (in ring0 only). Values can be manipulated and or changed as well
6 }7 |" V9 X% O(clearing BPMs for instance)' }, Y, i% T$ q* n) R3 L
  t4 ~( p1 e2 Q
__________________________________________________________________________
4 }- {  j: n  o8 m" l0 w, B  E1 B1 C; B) e! p5 |: D. w% c$ [1 \1 L& \
Method 112 g( a7 v# I. {9 o, K' q9 ^6 b7 I- ^
=========* g2 `& S. F8 P6 |
0 f) [1 A3 q% w; m: x$ Y
This method is most known as 'MeltICE' because it has been freely distributed* h; ^" s' }  I  A6 G/ ^
via www.winfiles.com. However it was first used by NuMega people to allow" R& p3 ?) v% ~% w( u  w) [
Symbol Loader to check if SoftICE was active or not (the code is located) W, ^3 z0 I. Y5 |3 s
inside nmtrans.dll).
+ n, h4 Y! r& W, ~. u. ^* \9 i7 s
& v' C* _, Y1 h2 gThe way it works is very simple:* M7 |6 N7 b( b1 D  @
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
8 S) L$ ]. D; _WinNT) with the CreateFileA API.
+ v; N2 o% g/ e4 F8 o8 N/ ?% y5 q0 g! ^9 k+ o+ b& s- e, n
Here is a sample (checking for 'SICE'):
/ y) x( j  N: v  n. s# Z
; v& j6 D- k7 \/ l7 o4 m2 o# J" pBOOL IsSoftIce95Loaded()
: L/ b4 ^, W) f1 z+ w( e{! R" e  T! c* P2 c3 V
   HANDLE hFile;  # q# z( R$ U+ Q: n) I
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ J3 T( Y# Y! w+ t7 A& F
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ k$ Y0 q) a: `. M4 Y( D                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* @2 p, s9 x4 T/ H/ M
   if( hFile != INVALID_HANDLE_VALUE )8 F8 j9 N- X, e2 e& W- e
   {
" y8 j' `( I, n      CloseHandle(hFile);
, e# R8 D- r  d* x      return TRUE;/ R: \  N2 d7 w, b: m8 ^& P. K
   }
6 K: z+ p; ?% P  k3 \2 K   return FALSE;
# h' T3 W. d7 ?! w( x}% {, W. p* Z! {3 C6 ?8 i6 c$ t# S7 j
2 U7 Z1 M1 j7 @) h7 [& `, i
Although this trick calls the CreateFileA function, don't even expect to be
! J2 w& v+ b$ F) n/ aable to intercept it by installing a IFS hook: it will not work, no way!& W9 u* P( R0 k6 {* C* R& f
In fact, after the call to CreateFileA it will get through VWIN32 0x001F6 ?! F1 Q, I% Z. W  L, F
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% q) w0 M3 D3 i& e* @4 F: e/ p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc" a# s! H+ u- b3 p
field.: S6 A8 [# H. c( F, E$ F6 X1 {
In fact, its purpose is not to load/unload VxDs but only to send a
5 U3 L# P3 F5 |% E) |0 c# ?W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 u, W' F2 d$ Q% z, Z& H5 P# M+ k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try9 G5 P! N2 e$ T9 y0 e* r
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ N: p3 V% O2 W+ ?5 A" O  QIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 ~9 S6 W& ]6 E9 cits handle to be opened and then, will be detected.3 ~- }# Y/ x2 d% i0 ^4 [8 s$ ^
You can check that simply by hooking Winice.exe control proc entry point' L. v  _3 G' @4 U8 b2 T
while running MeltICE.& x1 a" q) m5 g& v$ G
/ R+ ~% b8 P6 ^
' ?: l# X. `, x, s) D/ k
  00401067:  push      00402025    ; \\.\SICE
  e3 C; F" S0 k  0040106C:  call      CreateFileA6 E. D7 W" B9 W& t0 a" i( }& H( `
  00401071:  cmp       eax,-0015 ^4 U4 S5 W' M' _9 ?# Q3 V' t
  00401074:  je        00401091' a1 |5 q. f) N
. [. g5 U8 A- a* j2 O0 z
3 W, z0 g) ?2 K
There could be hundreds of BPX you could use to detect this trick.
3 m3 M# H0 _& z, @% M1 x-The most classical one is:) D  i; \5 f4 s" A5 V/ i
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; O& I" U& ?, z1 g% C5 M  K: q
    *(esp-&gt;4+4)=='NTIC'* {2 j" ?+ q$ v

% V  k/ i( W( c. e; v, `" x-The most exotic ones (could be very slooooow :-(
. B1 y  s" ^) j- m5 l( }   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  _, y" S- e$ x& H; H0 Z     ;will break 3 times :-(9 @# V' p8 w( |2 [! n* x! f- O9 r" `

, w' U% l* x" O6 E-or (a bit) faster:
+ G& k$ `2 {. h' J- d) T" R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- W, J5 @) R! c, P6 z

$ B6 T4 a4 k2 l% M, g+ g   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  * p6 `  D3 i, Y
     ;will break 3 times :-(
4 a* o4 E$ K, E" R% J6 |
1 I8 x6 f9 W5 `  E- Q. D-Much faster:
% b0 \5 P: ]: g' \' g: U. v   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV') x5 D7 A; F$ W3 s7 O

4 g5 p/ E. x) ~1 zNote also that some programs (like AZPR3.00) use de old 16-bit _lopen9 I# l( r, @5 f7 D( _
function to do the same job:
8 y+ E& g2 O! y( P* b7 Y0 V0 z9 h
7 r( k$ W" @  _3 N2 R# ]5 S5 g0 O6 r   push    00                        ; OF_READ
) G* v- x9 {' J5 z8 E   mov     eax,[00656634]            ; '\\.\SICE',0
9 @4 V0 X( u7 O8 {' l   push    eax' O1 K- t: m: ~1 I4 d
   call    KERNEL32!_lopen' u) I  }" R6 T9 ~
   inc     eax
/ b3 S4 N+ B' b9 M& U   jnz     00650589                  ; detected. ^* X6 ~3 @. ]
   push    00                        ; OF_READ$ o, d' r% x: M3 i5 |3 `& |
   mov     eax,[00656638]            ; '\\.\SICE'
6 K1 n5 Q' r, {/ u0 D* l2 J   push    eax4 N* _7 y* V$ r: L
   call    KERNEL32!_lopen  R2 k: m3 u5 O4 s+ \+ P% A# F3 z
   inc     eax0 U, e2 U1 u5 m9 k
   jz      006505ae                  ; not detected, x5 G' N  Q5 k. B

7 H. p  n* j0 T$ {& `) n4 j
1 b$ u. Q0 K/ p/ E! W__________________________________________________________________________
0 o1 _: p" G( d' }6 \1 v$ `) ^- z# x1 O( p
Method 12
. r4 i; j3 `5 N; N0 Q=========$ m+ c3 ]* x/ l# _
( j0 Q1 J3 W* w9 b# T6 u; H. [
This trick is similar to int41h/4fh Debugger installation check (code 05
+ S8 ?) u* l0 @+ A) B2 J+ m  V&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 m2 x) A  b, Kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.& B/ b- z" m" q, J' `% g
# u( L5 \4 e/ Z& `
   push  0000004fh         ; function 4fh
+ [* W; K# P( Z1 X3 j# C. H! O   push  002a002ah         ; high word specifies which VxD (VWIN32)
* z1 y0 t- S1 t) i& Q% s                           ; low word specifies which service7 G* E' S* |# x
                             (VWIN32_Int41Dispatch)7 {+ {! z1 R3 b0 K
   call  Kernel32!ORD_001  ; VxdCall$ r6 H% @, [; `7 ?
   cmp   ax, 0f386h        ; magic number returned by system debuggers9 V6 T2 |* C5 n1 c
   jz    SoftICE_detected
/ J2 D9 P3 O; a- x, {+ l# C, _6 X1 |( ?% O. j
Here again, several ways to detect it:, M1 D! ^0 D0 j' p0 t7 U( F2 k+ s

6 g6 Q, l) o( Z4 V5 u6 I' |' X( E* E    BPINT 41 if ax==4f! k: g  q) V3 f3 J/ X% a

9 Q( {# }/ m& g+ T. _1 v    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 L. `$ `% F; S+ H0 W% A
; a- O" o$ U4 V% f. ~; f" I! x
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* m2 }! {2 l' c' ]- J. M

* `* z" [$ {. _0 m# V    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! G' E- |/ U! F% m  _6 {

* w8 ?9 o4 d) |, ^- r) q, T__________________________________________________________________________1 R9 U/ e. m9 [7 y6 @, W
# x, C6 x" m- h, Y: h" G+ S2 a
Method 13
+ [5 N  A6 y: J0 T=========
$ Z, ~* R/ D8 I5 x9 s0 k( h4 C6 ]1 W- d
Not a real method of detection, but a good way to know if SoftICE is! E0 k' @% E" f) J7 O4 W
installed on a computer and to locate its installation directory.& z) U/ v. B: y& U9 O6 e; v
It is used by few softs which access the following registry keys (usually #2) :
/ g* E4 }* O9 V3 ~. v
0 A/ Q# \7 d$ S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; H# d9 b9 R2 R3 X\Uninstall\SoftICE
2 N( h2 Z9 T0 \8 @% \-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) i- X: K' p7 c7 u
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' }5 W8 {4 E2 L* z( q  k! n
\App Paths\Loader32.Exe  k9 y/ e0 M- r* K: e6 ~

/ J% ]9 T' U2 m3 U3 n; \8 I2 }& U5 K7 _$ p6 S
Note that some nasty apps could then erase all files from SoftICE directory4 o! y2 V  e8 _& t: T# x& A( K; x
(I faced that once :-(
. H9 G9 B$ E1 J$ _) y2 _
4 @5 p# }6 k& e- t9 S2 ZUseful breakpoint to detect it:
" c+ \6 X: b' g/ a  `% @, R8 E; r  P3 \2 {0 D/ w" F
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ L) T5 Y2 t; W
$ b+ A" X% Q% D* C1 J
__________________________________________________________________________
% x, Y* \% I  [* h6 u# U
6 A  C4 Q) s) ?: I/ E7 K+ n
5 ~& {" [; n; t1 SMethod 14
2 R. I1 W* T- ~=========
! D+ P: x! s: Q: h& V) h
8 b  h: i1 a; t0 a" SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 X4 D% `; R: ^+ uis to determines whether a debugger is running on your system (ring0 only).
! Q9 ?! n4 m% B, i( b" J* [$ B
  _* x! {; c* y0 N- Y2 q   VMMCall Test_Debug_Installed. l9 [2 A! v! G5 _/ Q+ h
   je      not_installed
- a: l% S& z, [7 i& B- f# B1 y+ X: V- p8 n8 `, Y8 x
This service just checks a flag.
3 a" y8 U; R# a0 A" B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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