About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& M4 B  H3 s. x4 o/ Z# F
<TBODY>2 l- @" e  F  o
<TR>* x/ k7 Z6 p  K$ }
<TD><PRE>Method 01 0 E$ y( a5 E4 F& D5 W9 U# v
=========& K- U8 L. ]: y
' h+ J' ^3 |0 @  @. m1 i: y7 ]
This method of detection of SoftICE (as well as the following one) is
( Z% o1 z- P# [" n0 P+ {used by the majority of packers/encryptors found on Internet.
% Q% U" p3 w" K  N6 eIt seeks the signature of BoundsChecker in SoftICE/ K& w5 j" f  ^! d
  ?: A/ h0 q% u$ X: x7 j* V/ f
    mov     ebp, 04243484Bh        ; 'BCHK'9 \% D: p+ ?8 P' f# ?% P
    mov     ax, 04h) `/ H5 ~* l" Y0 ^
    int     3       4 j; s0 o* q, D6 R4 H
    cmp     al,4
' h6 N3 x' @9 Z+ c5 x. R    jnz     SoftICE_Detected
2 i0 q1 \! d' `9 A7 o6 E& r- T; u! q6 W) ^' w# A$ D
___________________________________________________________________________
. j5 H' n3 `3 V. H
2 w/ h8 b. Y5 ~# P1 r% N2 o5 s, s3 E" xMethod 02
: n' R$ j8 s8 A2 R) h8 X# m=========$ y) S7 w# H8 a! j
. L* t0 y+ N( J* S9 y, X
Still a method very much used (perhaps the most frequent one).  It is used
+ w5 w; c( P) l% y) v# z4 ito get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ K' E- O* I# L1 B
or execute SoftICE commands..., q3 \2 Z6 S1 }5 _
It is also used to crash SoftICE and to force it to execute any commands$ A( E2 v% i: I- L2 ?
(HBOOT...) :-((  
) T4 T( ^, a: W# c4 o2 M0 @% z
+ j8 i& k0 M" e9 g5 Q+ O7 y5 QHere is a quick description:5 Z' z0 |  ^) @: C/ N
-AX = 0910h   (Display string in SIce windows)' b; D1 J  C  V: _: q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  }' K$ t3 q; y1 h  {
-AX = 0912h   (Get breakpoint infos)
! U, x: E1 d5 B" a" u3 q; ?-AX = 0913h   (Set Sice breakpoints)2 J) x# X' E5 ]' D: l2 L" F
-AX = 0914h   (Remove SIce breakoints)
& o2 E: [! h" {( C1 q8 F+ i5 _. u- ]: y1 S* V3 p7 g8 r& U
Each time you'll meet this trick, you'll see:
/ N% A6 O6 M! E+ x& J/ z-SI = 4647h
8 j* D- X; K( h, K- O-DI = 4A4Dh$ C& C" C4 x4 j$ g
Which are the 'magic values' used by SoftIce.7 \6 w$ J4 X+ x2 {' e
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.$ {. d9 _* V0 ^' S' M' T
% b) H" k5 a! k7 |! y
Here is one example from the file "Haspinst.exe" which is the dongle HASP
1 s! d. {+ D7 n$ b$ w3 BEnvelope utility use to protect DOS applications:
: S9 Y# {6 f1 q7 z4 _9 g  R
/ g  i3 ]4 T$ u9 }1 m$ ^7 ]  I9 G  w) _5 q3 h3 b
4C19:0095   MOV    AX,0911  ; execute command.
% w) e: U+ T4 A4 s! M  K1 j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 b6 j0 u, e4 L5 L8 ^
4C19:009A   MOV    SI,4647  ; 1st magic value.) j3 _0 f( n( ^. s9 H5 k
4C19:009D   MOV    DI,4A4D  ; 2nd magic value., V- [$ u, f' |7 O% p1 Z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! F. N* m5 n/ @0 v0 h* T
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
' _2 C, M+ R0 h6 q! O4C19:00A4   INC    CX
; B7 V; l6 s8 W' Q0 ?& O. f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, L$ X+ ?$ e! L- q" r
4C19:00A8   JB     0095     ; 6 different commands.3 g7 m8 V" i$ X5 R# ~
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 O  u; r/ ~' O1 T. y+ D
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ q! P- A" S2 [7 j  m
3 v  b  A) e9 M2 I- fThe program will execute 6 different SIce commands located at ds:dx, which, g4 M( _6 D+ f! u
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ m) |! U) L, w; I" ^# Z3 m4 T7 F& _
# z' k* J1 ]2 w" q( [
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ }. {  T1 g; i- P: u
___________________________________________________________________________' a# Y: p$ R; F: O/ ]; W' f

" Z8 N, d  \1 X/ q8 M
& z* |# b4 C. E( nMethod 03
+ D2 n. K. v4 u1 X! H! z=========
) G. l# T( E* J! A6 B% i" D4 S: o6 r  h/ L. w1 x
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' j9 `; D9 [6 y
(API Get entry point)8 c' w$ q1 d- g
        " u$ M% s1 a% m2 `% x- [! X( R

+ j4 B( s: y3 D  b    xor     di,di1 H0 Z! ?! z$ b+ s: V6 u# Q- ?6 a3 j, c
    mov     es,di
  k7 h8 ]) |; c    mov     ax, 1684h       $ a9 y: ]7 M, G. I; p
    mov     bx, 0202h       ; VxD ID of winice
2 m$ D2 A. f% Z: a3 D# Z    int     2Fh' U7 ^! F  u6 D$ U( a
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: ]+ ?- c) ?6 W6 ^
    add     ax, di, [( a+ B' T0 p/ i. P
    test    ax,ax
8 |8 v* F* ~% v& G7 R2 Z  q    jnz     SoftICE_Detected) ]2 w8 {, W: i8 V8 T
  q: \' V. r6 o, J
___________________________________________________________________________
9 T6 k% `4 S$ x  T: B+ B  x/ ]( `; Y* X2 X! T# F  V
Method 04
! w/ l' l) c# C. H! G=========+ R; ~% h  Y' p3 t! S, E% S. V

9 j) L/ t+ h& H7 f# ZMethod identical to the preceding one except that it seeks the ID of SoftICE
8 K3 q& y6 E0 j5 p$ G! v! ?GFX VxD.  x9 S1 N% z1 f' Q1 u) C" `

' M! V% M7 P% I: ]- R9 N    xor     di,di
) O- j" f1 h- G    mov     es,di3 Y  V7 G8 R0 z2 x  O
    mov     ax, 1684h       ' G! _4 {7 Y$ V- M
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, ^8 d& A% d: O9 p/ E    int     2fh  }: {! C: H8 E5 u; y( m6 s) x# j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 n& j9 h# o" T  e0 d$ |* I% S& k    add     ax, di) N) D+ z1 {2 e+ l+ i9 ^
    test    ax,ax  _7 U. D1 k' m& R" o
    jnz     SoftICE_Detected0 v+ S' R6 X" M+ m! _9 N
( A) O; i5 h8 d& d" u* `* X) L
__________________________________________________________________________
8 m: A% A* v- i% e+ M% y# u" v( Y& Z* Q  ]; c- ]$ N; \
! d3 ?1 _8 c: L1 [
Method 05
/ P& h' P: F/ ]$ Y. }5 R! X) w=========# e' U) c5 `. b
) v9 {+ k" T) t- p# H! ~5 n: ^
Method seeking the 'magic number' 0F386h returned (in ax) by all system; d( R: p4 U& T% `6 E3 W
debugger. It calls the int 41h, function 4Fh.  ~* z7 B- T" @1 I0 ]
There are several alternatives.  
6 C. U4 J, `- f
* }3 u7 ~3 F' V3 h' V- m9 f2 rThe following one is the simplest:
& A7 j5 \) X9 a! m2 R3 s
( h0 }/ r2 K+ T* V- V  F    mov     ax,4fh! E8 Z1 a0 E/ F8 P
    int     41h
; K6 ?% w8 M2 p9 U' j1 ?  a6 u    cmp     ax, 0F3869 n7 m% j* t" Z6 D
    jz      SoftICE_detected
% @  [' F- c: Y9 P# D, A7 k: b3 ^( \& i3 n' [% f
& ^8 X3 s+ M( I9 r3 z3 K9 s- O
Next method as well as the following one are 2 examples from Stone's
5 T7 d. P& T2 E: K0 D"stn-wid.zip" (www.cracking.net):3 A' u9 s8 C% B$ l4 i

$ s3 N  q$ l$ _* H    mov     bx, cs0 T' _, ^; _+ P
    lea     dx, int41handler27 L$ d- D* {8 C: C6 l
    xchg    dx, es:[41h*4]
& _  A1 I, W, F" T. U5 l  P    xchg    bx, es:[41h*4+2]7 t/ L' ]! _5 Y! C+ |
    mov     ax,4fh( T8 l2 ^. G& P( |4 c6 ?" y8 d
    int     41h& ?- c% i+ q8 D+ [# t
    xchg    dx, es:[41h*4]
% V8 n" c. K# M+ `    xchg    bx, es:[41h*4+2]" x2 |* ?: ?; m3 e5 V2 k# W
    cmp     ax, 0f386h
) I2 @- P, W1 J9 _; m    jz      SoftICE_detected
# y1 Q8 E* \9 S5 ~! n0 V# {& ^8 H1 e+ E  l8 C6 U
int41handler2 PROC
" \% y: f0 @% P# p; s6 _    iret0 Y* z: x  i4 V' Z, w# e
int41handler2 ENDP. j6 n" M3 S" ^
2 i2 d3 a* L5 p8 }
) B9 T2 d% L; h, ?0 p: Y# ^9 `$ d
_________________________________________________________________________
1 O# l9 j1 r# T$ L4 S1 A" L& i. i+ ]) h) a

5 L( F5 b4 Y$ S5 pMethod 06
" c1 @. j: ^- h' k8 r5 Y( ~=========" V( O; l% O% Z6 m

6 H- U1 J9 o' {* y
+ d( l9 ?) L) e" d+ {; W% }. L2 X2nd method similar to the preceding one but more difficult to detect:7 |" [* E$ u) W0 m, S( ]% i
) Z$ c& `8 ^& N

/ T. i6 B$ h# a' r( A. T4 u& H  Zint41handler PROC6 g0 M" g3 m: V+ G# F- c
    mov     cl,al  \1 R9 v. y; N0 k8 o- V% h; |0 o
    iret; o, E& c' j# R; v7 s1 z3 U2 j
int41handler ENDP
! a& @+ t$ _% v2 h# D2 F- @& b
. i+ j7 t) a' B$ ~$ W
( Q9 c$ E6 Q. }1 H* o' ~' \    xor     ax,ax' k' c% r0 X! w) j% l; q5 ?
    mov     es,ax& @% ~2 k; R' L5 l
    mov     bx, cs/ O% F  Q! i( z: k; A
    lea     dx, int41handler1 Y* J) ?2 |1 W3 Y8 Z4 x
    xchg    dx, es:[41h*4]
, h* X2 \. P4 P+ K/ l8 R( p$ _( j    xchg    bx, es:[41h*4+2]
) S& O% @, X) t    in      al, 40h8 O; l  K) I( T* o; D
    xor     cx,cx
% w4 C  H; ?6 C  Z    int     41h
8 W6 Q0 ^8 W% H    xchg    dx, es:[41h*4]! Y3 V3 Q& f7 O$ C2 ~+ \* G2 m
    xchg    bx, es:[41h*4+2]
# ]- z6 ~- V# ~    cmp     cl,al
& x; D5 u/ u! }# q    jnz     SoftICE_detected
# [8 t4 k6 {6 N1 J$ G
9 X# |6 z' y5 m: ~7 b* D  y7 Q_________________________________________________________________________
% Z: a7 F, L# `+ g  b" g9 j
$ w0 O6 X: |( d3 Y% ~Method 07( `& W, ~; ?/ g
=========
2 X! l/ c; f8 t6 ?) p
- q( P; `: A- ]Method of detection of the WinICE handler in the int68h (V86)( u1 f. [' q8 G" X7 t

. a! N$ s7 q. C4 c: H: U    mov     ah,43h
5 R. h9 o* H1 s    int     68h
- y# x; h2 n4 f7 |  |    cmp     ax,0F386h( U: l$ G; A1 G# A
    jz      SoftICE_Detected+ l0 U" O* ~3 O4 H
- Q" a, p7 U' m/ I% c
" A7 ~4 N6 d, {% e. f" C
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
% ?+ r5 D3 i9 t7 [   app like this:
8 d( u6 h. c. A' _6 u4 [0 j
; t$ ?6 [0 l) {) |2 T; L  R   BPX exec_int if ax==68
' C3 Q' Q5 A2 d) d   (function called is located at byte ptr [ebp+1Dh] and client eip is
, C; ]% o. X( A   located at [ebp+48h] for 32Bit apps)
2 ~: M7 w( t% n! l8 y8 S/ S$ h__________________________________________________________________________
8 V0 \1 J  O# m2 I/ `. x# C  {$ B, \4 k6 N) G, u8 f  M- m

4 I& m) I% o2 c; G; |  p+ zMethod 08
  K, }  r+ D8 _' d5 G" _% P, G=========
% f2 W  k4 b  ?, f) k6 n2 f  V7 F' V/ }$ v9 A, J
It is not a method of detection of SoftICE but a possibility to crash the( H/ \- i( ~. z+ D* w4 D
system by intercepting int 01h and int 03h and redirecting them to another
) d- D. L9 G# x3 D$ M3 m. t7 eroutine.; D5 _' F8 V2 Z3 [  \( Z. [  K
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 l/ N: ^6 u% @, T
to the new routine to execute (hangs computer...)
# O, Q) m4 e& Y# T, n8 E* w6 H4 c( s1 {! E" I
    mov     ah, 25h* _' F* n* d+ s$ u
    mov     al, Int_Number (01h or 03h), P* `6 a4 X  A6 k" ?6 q- \
    mov     dx, offset New_Int_Routine, F! O( X' A( B# {2 \( l2 @! e! m
    int     21h+ j5 |1 k! q3 _$ z9 ]8 {
0 L) }1 G6 `. l# @# C
__________________________________________________________________________
3 t' q8 \/ }5 e  i$ Y* w; q
8 T0 G/ R- H5 M  a1 f2 c( FMethod 09
% u8 S6 t9 |/ N, G8 S; y: H9 p=========9 n. L/ R, z, h
9 r% I1 C7 }, u5 G" ~
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) e- n) [' @9 Operformed in ring0 (VxD or a ring3 app using the VxdCall).
% N1 r/ x& H* a0 X0 G! lThe Get_DDB service is used to determine whether or not a VxD is installed# I+ B- s1 B1 N  |' }
for the specified device and returns a Device Description Block (in ecx) for7 p' f& c0 e; K+ V& z) X4 n
that device if it is installed.
9 R8 v- _3 K6 l/ v7 T: m1 b, P6 b$ `; d% [
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID, @% s) g* t. }7 |5 U! D9 [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 J2 ^7 H/ q  H* E$ @7 k0 s   VMMCall Get_DDB
# z, Q' v6 l, M* Z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 Q6 i( K. m3 h. D  b4 J7 p# g7 O3 f+ F- _9 |
Note as well that you can easily detect this method with SoftICE:5 m8 g, H, Y- V) a! u$ ]
   bpx Get_DDB if ax==0202 || ax==7a5fh
0 ~$ B. {' C' h, O% S/ J, i' ~. G+ q" [' j7 `; Y/ S) V. \8 Y
__________________________________________________________________________
4 T( `- g  G* @% i- S! ~0 b( @; I6 J) x. K- d0 r+ Y) \# m
Method 100 C  h$ D& X' i, t) d3 J& G
=========  @; }1 T0 V2 w6 X$ K
( O4 W* I4 \8 {- G4 i
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) \2 f# b# V8 a  f  SoftICE while the option is enable!!  O& u; p: S% o+ D" h9 k+ @) ]# ]
) |; e8 J2 n, j; y6 d( p0 f9 N: m
This trick is very efficient:8 ]2 D4 V& y6 j
by checking the Debug Registers, you can detect if SoftICE is loaded! J: [0 t4 E' P$ y
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if1 L6 t' d# Q1 [: X* G) d& {7 O/ s3 n
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 M+ C8 k5 s6 k" O1 J- R  ]! Wvalue (in ring0 only). Values can be manipulated and or changed as well5 @' z3 D  M9 A$ L" g
(clearing BPMs for instance)
. L; t- \6 w( B/ }5 F) s4 U! z1 O: |8 |3 V, z5 }+ Y& _; S/ r8 [
__________________________________________________________________________
8 W4 F8 H' ]/ n1 s$ u7 U& I1 q* a& e# E0 l* P, `' E7 D$ N
Method 11
* K+ a; E, V0 ?9 y! D=========
4 i/ x3 g4 s9 U" |  ]+ ]
  a" {& c& w; ~2 ?! V$ PThis method is most known as 'MeltICE' because it has been freely distributed
8 p4 Z* E) R; P# D+ ~* [via www.winfiles.com. However it was first used by NuMega people to allow
% C  t; c; Q) f; c: N/ lSymbol Loader to check if SoftICE was active or not (the code is located
# R# `1 A9 g7 k% ~9 {inside nmtrans.dll).# {) @% p4 q# e) k& I

1 A) b1 r; E0 \2 xThe way it works is very simple:
- c; w* i. a7 R" EIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
" R! _& ]1 S& GWinNT) with the CreateFileA API.
# u$ F: r( H7 e: J
6 N7 ]; i% o! V/ sHere is a sample (checking for 'SICE'):
; U; q/ s( M8 h4 X+ h# G  @& R  z# t2 @2 y5 z! k
BOOL IsSoftIce95Loaded()
3 j% O8 ^# n1 }/ O' W) C2 @0 n/ g{
* w! N! r) L+ p   HANDLE hFile;  
+ f  ]. a4 a! {7 B5 U6 S: e# @$ }  M   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ e! u% C: n1 w7 P7 k; \                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ [( e* K+ u$ y- {                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' l2 j+ ^1 T2 ?, }
   if( hFile != INVALID_HANDLE_VALUE )
8 }. S% ?" C) J# ]; a; h4 M   {  o3 f8 L; X3 w& `) t* ?& {
      CloseHandle(hFile);
. m, P9 O" Q% i: n4 [" [2 |      return TRUE;
/ l, R. j6 o# {; _   }
. l% u# C" v* l# `/ ~; I) }. J   return FALSE;* u( H; L+ r" m0 D) ~
}% d. r3 g' f/ Z( Q

3 V3 C- P2 G) \- M' y% oAlthough this trick calls the CreateFileA function, don't even expect to be) C$ g' s, C% N1 Y! ?. m' o* y
able to intercept it by installing a IFS hook: it will not work, no way!2 b$ \0 M4 m2 J; P- S  c# T
In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 `7 b! B- w. U  z# n4 B$ @8 ~' D
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, W; r( e  k9 J3 tand then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 Q. Y; U. K  _2 Zfield.- L$ w' ~1 c* {) i% _2 o% |; ?: C
In fact, its purpose is not to load/unload VxDs but only to send a
- L4 t+ ]5 O. _8 nW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% I* r) y& Y% a4 _1 gto the VxD Control_Dispatch proc (how the hell a shareware soft could try
- v4 |6 ^5 h" [to load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 y8 P, V7 m1 z5 u5 w9 kIf the VxD is loaded, it will always clear eax and the Carry flag to allow, A' ^, m3 s9 e# k- l: ^, n  X
its handle to be opened and then, will be detected.
' `, p1 n! P8 r. J8 tYou can check that simply by hooking Winice.exe control proc entry point) w0 m- Z6 I1 ~# ~
while running MeltICE./ |/ f! a1 r% u  f# T
6 F5 Y/ L3 L9 X$ b5 H) ~! V; Y- A

; V. S7 S! i1 P  00401067:  push      00402025    ; \\.\SICE
+ e" O8 B9 R& [2 E5 Q: w+ _) c0 h$ r  0040106C:  call      CreateFileA3 k/ K$ c) X. s# f7 p+ h# X
  00401071:  cmp       eax,-001
( t' H  Z( E; Z2 |% }0 K& w- O  00401074:  je        00401091
9 p0 i' M% W& d6 V3 c
. v( f/ t$ m+ i  `5 W" N# X7 u5 ]$ T1 a# \  R
There could be hundreds of BPX you could use to detect this trick.! s& K7 F# e& v+ M
-The most classical one is:
. x) ^$ W* v4 r0 ?, }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 {, o) K4 l* d" B    *(esp-&gt;4+4)=='NTIC'
3 H4 G# I# r' v; {1 W, y! S9 V7 f" Z, v* [- J" o
-The most exotic ones (could be very slooooow :-(6 P+ {6 t$ F- c0 i( y2 S
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 E5 a" g, A" U5 `% f; o
     ;will break 3 times :-(3 z: H7 G8 s+ a3 Z6 T. m8 T, G

  g* q, l) l. ^* T$ D7 U& q# ?-or (a bit) faster: # {4 L( H( Q: b2 ?5 N, x+ E
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 C& m4 S' G: m) r
) D7 w7 b% y% L5 Q, O0 g: z& I
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 R" x' i" [: w/ i+ q5 k  o0 L     ;will break 3 times :-(
2 Q5 V4 j5 J7 V1 n/ Q# C- X2 n2 h. U% n8 `" A, ]8 [
-Much faster:; k" _/ Q5 J! L) S$ {0 L9 h
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 g# j* s8 H4 M: d
/ d( A: L4 U- b$ `3 E( [
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# g) D5 n/ \% f4 @
function to do the same job:
: ^1 g/ E5 @  o$ s) k  h0 c( j$ R" b; ?0 Y# a# M
   push    00                        ; OF_READ# W5 A* {; e$ M+ P" H
   mov     eax,[00656634]            ; '\\.\SICE',0
! V) p2 Z) W) G7 F2 h' f   push    eax
3 }, k: s5 w5 o- C2 y   call    KERNEL32!_lopen" g' `/ I2 l+ Q' S- E% Q$ C) r6 k
   inc     eax
, m$ G5 e4 p; m7 ]8 u% m6 {4 v' }   jnz     00650589                  ; detected$ f4 D4 R0 b& V+ v
   push    00                        ; OF_READ- e6 Q2 |! P6 Z  A" b$ U
   mov     eax,[00656638]            ; '\\.\SICE'
" I5 H: ]6 G5 c/ z6 X( g* @5 y   push    eax9 R: k/ D2 F/ n" \# x
   call    KERNEL32!_lopen  N/ P; J! m# Y/ X& }
   inc     eax; s% p. l# y9 N; K# S0 k
   jz      006505ae                  ; not detected3 @, a+ }% y0 G2 I4 K
( _/ s/ t4 Z$ o* a8 M  O# j

! z' B: Q+ `% S5 o6 h__________________________________________________________________________
% p/ k; q6 }9 ^. H. E6 m/ q7 N9 S9 Q8 H: Z) d
Method 12) m( B1 [. a' a1 _* O
=========
! u- M0 P9 l7 k/ g" f2 L! [; S% s' U2 K, R# F# W7 l
This trick is similar to int41h/4fh Debugger installation check (code 05
1 M) i. ]$ U, U5 q4 l&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" z1 I8 o2 w* P! Oas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- d5 U9 F" X7 T& `  v3 |* N( \- _* }2 j& S1 K9 Q
   push  0000004fh         ; function 4fh
$ p" q+ j, x* I. ^   push  002a002ah         ; high word specifies which VxD (VWIN32)
: x3 P3 W1 @* N: X% u1 q  R  ^; P8 [                           ; low word specifies which service
' R' d& p, D6 L* V; D6 t# w                             (VWIN32_Int41Dispatch)& _7 ?( i: l' D1 y: W' ]1 s
   call  Kernel32!ORD_001  ; VxdCall, v% S+ |: a! E3 J
   cmp   ax, 0f386h        ; magic number returned by system debuggers- g( L3 h8 f1 ]1 n* I5 }
   jz    SoftICE_detected
* `/ P3 ~2 `9 U" K, P
* l: ~- m- W0 u5 v( ~% bHere again, several ways to detect it:
7 d! ^- D' B& \" D- t3 s; P$ N2 J% {5 M1 ]6 L$ q" Z% ^) A
    BPINT 41 if ax==4f3 Y' ?$ |5 [' H8 l. }+ m7 p

3 A+ C  @+ \7 z/ P- @    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( z" w( a2 Y% W( m% x; @
6 x" |) z# |& ^  o3 Q! u
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! r& a# V6 J* R/ u$ ?% F% v
$ P7 A- i; P3 |1 J7 x( V, K
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" @. o# p+ v- y
! u5 N: N/ b3 k7 ~__________________________________________________________________________! S; P1 }2 O6 B% b
7 J$ R. _, s" o( W3 V* A, o
Method 131 x; h8 P' y1 @+ `1 l/ k
=========
9 L9 i6 v0 Z5 B
% p0 C; V& E- ?Not a real method of detection, but a good way to know if SoftICE is9 r- ~0 c# g6 {0 n
installed on a computer and to locate its installation directory.
% u5 P" d% ~' Q5 R  x* @It is used by few softs which access the following registry keys (usually #2) :
, z# }8 B% Q5 G/ K9 v; q6 [6 u6 L
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 f- T/ i; ^5 c6 i3 b- W
\Uninstall\SoftICE2 W7 K- B7 e) J. ?  o, s: X
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, k1 E% B- c0 ]) |5 j$ E# z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) R( M) z0 }* N& g9 e/ J\App Paths\Loader32.Exe
! d$ p" T5 U% O- S, S- ~% k5 b  V+ b- S+ c8 r

# r5 e1 {5 d' u$ F4 a! ]Note that some nasty apps could then erase all files from SoftICE directory
: D/ g& B* i$ T6 Y& k$ Q  i2 F(I faced that once :-(0 s+ M9 U. y- e7 J  B& ]
3 `9 d9 C4 O$ ]/ U2 A
Useful breakpoint to detect it:& C7 [# O: B/ d7 T

' ~# d- z( b+ L     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 H8 v$ |  d% S8 y. x2 H

- z3 W6 l! B* k* b+ x; ]7 b__________________________________________________________________________
/ J1 s1 I1 g6 X
7 F& N" L% J( n* B' Z* e2 X
" b  `% H2 z* P9 ?Method 14 ! C8 S  p2 C1 C/ x4 O+ l
=========1 F% R) O1 M) b" A

2 ?% r; [- v  g; S# a# P) hA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) @- m) K$ P9 \8 m% pis to determines whether a debugger is running on your system (ring0 only).5 B) A5 J7 p, a7 ]

7 t# i' O! @% Z3 O( l   VMMCall Test_Debug_Installed$ g  _- V3 z5 j" c! |8 w, c+ y
   je      not_installed$ q6 D1 v6 w. k' ]4 d  c
% e; ]+ e% g$ N8 i$ j) k
This service just checks a flag.0 m8 i: C% d0 B, T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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