About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& m& e' @5 x1 C' s. }) A6 p<TBODY>/ S5 ~) T5 ^) N
<TR>3 Y; O, J0 g$ Q+ d
<TD><PRE>Method 01
; W% Q! J) v7 X8 {& e=========- x+ o2 {9 ^- O. B" U- o

" _% {; l6 R! DThis method of detection of SoftICE (as well as the following one) is3 p, A2 x3 i" `2 ^3 u2 [
used by the majority of packers/encryptors found on Internet.
% }: v3 W9 ^, PIt seeks the signature of BoundsChecker in SoftICE
# ~) L* P; y0 s& P3 i7 C" P2 ], i1 k! n6 c' E: W% b
    mov     ebp, 04243484Bh        ; 'BCHK'8 y& j! Q7 ]) ~1 @4 ^- h7 |
    mov     ax, 04h
+ E0 m# i# P& r- \3 s" _    int     3      
- ]3 l( Q) A) E5 H  C    cmp     al,4
' Z" g. Z$ Q) `+ Y' O6 J    jnz     SoftICE_Detected
) `# U% q! H6 ~3 L) H  ~( f, {, y0 |3 P1 ?  R2 V
___________________________________________________________________________
: F; P) _7 V) o- f. ]0 I' r$ J! S
* H, m2 o8 }& B* R  YMethod 02
* Z2 d1 T8 W/ y; d2 l( [. R=========0 E7 w1 H/ F9 @* ~2 y# q' H4 b

% |( \0 ]: Z$ |' f$ c$ jStill a method very much used (perhaps the most frequent one).  It is used$ h3 K4 F$ h: W4 ]8 l
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; t  y) M% i  P. R8 {
or execute SoftICE commands...6 x- X0 C/ \2 d& n
It is also used to crash SoftICE and to force it to execute any commands
& W. b  h5 x' ?+ d0 N! ^(HBOOT...) :-((  
" t3 i. ^, e) _) _6 {( M5 Z3 \
6 l3 |$ S, b# [" wHere is a quick description:9 N$ o8 c5 R" s1 \% D: Y1 |4 K; I$ k. L
-AX = 0910h   (Display string in SIce windows)
8 E1 e- Z0 c6 m2 h-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- B7 o2 ^+ D" k! O7 ]+ `" q0 z
-AX = 0912h   (Get breakpoint infos)
5 d8 e0 ~% U# \& T5 R0 D  A-AX = 0913h   (Set Sice breakpoints)
! O0 y8 [6 t- R" ^8 W8 _4 w: j4 P-AX = 0914h   (Remove SIce breakoints)
7 W' {  U9 u, X$ P) m' {0 m, Y# ^
Each time you'll meet this trick, you'll see:! ~) ^) [! ?* h: B3 B
-SI = 4647h* X. U5 P6 n$ m5 }0 x4 A* B
-DI = 4A4Dh
; U9 {4 n2 v/ C1 RWhich are the 'magic values' used by SoftIce.; K6 ?2 t7 Q; a$ l
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! s! U0 i3 [6 B& o" o
0 d0 E) l+ ?- t0 d& MHere is one example from the file "Haspinst.exe" which is the dongle HASP! E( a, e' F: X: p7 j2 p6 Y
Envelope utility use to protect DOS applications:
: f/ J6 O  F9 a8 @- |/ K  f
  g" K4 U- C6 E# ~1 D% ^) y$ ~% W, V$ h# k
4C19:0095   MOV    AX,0911  ; execute command.
6 R, W' D# g. \+ R$ G8 Z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: M) w  l. J  @8 @: ^* ]
4C19:009A   MOV    SI,4647  ; 1st magic value.8 ~( I+ D# S  ?, J; T. n
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ n* Y/ j5 P( P( v5 |4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- M; J& M2 R' S3 n+ c
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* V* P* P3 t: _) \  u& Y1 b. N# Q
4C19:00A4   INC    CX  w* n# q& `+ Z$ a
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  f  W1 R/ c$ f) n/ x7 s) k3 g4C19:00A8   JB     0095     ; 6 different commands.
- _+ f0 }" H2 E4C19:00AA   JMP    0002     ; Bad_Guy jmp back.; G6 ^% Z% @& q$ b$ Z; L
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' Y$ G9 D. S  P+ m5 l
* ]) H  G, a* c3 s* F: f$ n3 d
The program will execute 6 different SIce commands located at ds:dx, which
" T6 I" E6 ]& |9 c2 v, n+ Pare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 K! U' _( ~6 u4 a
, g, t7 {  g. M5 r. u
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, i* B* W) N- _) I0 `: {% ~6 Y___________________________________________________________________________
; z& @8 \6 o- U% M/ E2 x" I7 o: Y! p2 n

2 U0 a/ e9 ?8 F( k2 r5 GMethod 03. Y1 ~9 J. Y7 [1 T
=========* U" L0 f% ?! T: K  A. ^

) C: y3 ]2 _& H8 q( Q3 DLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 Z  N7 x3 o: b- Q(API Get entry point); Y, f5 r$ q. E- Z2 Z0 B
        
4 I$ V( q* y, \$ F/ K5 A5 S0 D: r9 w$ Y( l* F' i
    xor     di,di, T- `9 C! [9 Y
    mov     es,di
6 o: H) m5 u- D  e( m    mov     ax, 1684h      
4 z* G, l) B9 B* n  }    mov     bx, 0202h       ; VxD ID of winice
" d5 t. w5 ?: N7 E8 m    int     2Fh: J# S( r* {1 S  S( M: _; `* E
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ ~6 \6 i- w' I$ a    add     ax, di  A4 H7 s3 r$ j1 q
    test    ax,ax/ R& x2 }* B( a7 a
    jnz     SoftICE_Detected3 F3 B8 e& D, q( a! M
/ Y* l" g4 F: q% l  v
___________________________________________________________________________2 M; y1 Y0 F+ C) ]7 o3 \% K( T

( S- U* [3 r' d- i* [Method 04
% [$ A. m, s* W% s6 ?% K=========
4 v  R' k& z( }8 K+ {$ x: n: ~/ M1 l
Method identical to the preceding one except that it seeks the ID of SoftICE& e8 h% x9 I- Q! q: {4 b
GFX VxD.1 `% ~' Z+ i5 W% I# m/ D6 c

" b6 W3 D3 k' L" ~    xor     di,di* j' o0 ~$ s  w- }
    mov     es,di
8 s; }  P8 G; d  C5 |; O& b    mov     ax, 1684h      
+ @' y6 G' f+ _7 T    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 Z+ s5 m9 p$ w* r
    int     2fh+ @6 ^: _* `' u! R  @% N. I
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ V* ]( q2 Z6 B3 }% P) l+ u    add     ax, di
" u0 S. k$ r$ A2 ]0 v5 Q9 [5 @6 B+ G    test    ax,ax$ l$ F9 W. G9 N( b: A# Y, M( e9 G
    jnz     SoftICE_Detected
4 d# x1 i+ B5 m: P0 j2 u: A( n' L- Z- O# E/ `
__________________________________________________________________________
% I% r4 D; G( V9 q# u* @2 w
/ }6 A5 i7 G' L; s5 ^- I# O) Y' `' M. ^. C& T" @6 g
Method 05
$ _& U+ D% e7 d' I, D% G=========
- g, q* q& o- H4 t9 A+ P
/ p' |' J- H! @$ f/ @" XMethod seeking the 'magic number' 0F386h returned (in ax) by all system* r2 Y" ?4 ~1 Q# [  d
debugger. It calls the int 41h, function 4Fh." t% B' t% m) e, c" L9 p9 ^: g
There are several alternatives.  7 ^$ t+ c* T% g  o4 w9 V' m4 ?/ C2 r
" t7 j) s; f4 Z
The following one is the simplest:
% o& \+ z; ^5 i% ]7 E3 B
0 E/ U6 j( }" n, L  u    mov     ax,4fh
. s! A7 R& q. Z; @0 ~" [* \    int     41h, |# ^0 l$ [$ L6 @; E( t9 m' o
    cmp     ax, 0F386
# C+ L: w; T3 F6 r6 v: }+ t& M    jz      SoftICE_detected  u" T6 O) E, y, F, m* Z

9 z' `( ^0 t0 y0 x! R. k
, ~6 e5 P5 O* nNext method as well as the following one are 2 examples from Stone's " _8 e8 M) r  H* \4 @: V
"stn-wid.zip" (www.cracking.net):
0 B2 e2 p. _9 ~  B! i0 z+ M$ P6 N3 x1 p8 C* C& v* _3 m
    mov     bx, cs; k9 M' a! |" J0 Y" b1 ?
    lea     dx, int41handler2: G( u; X5 o  \+ f4 E, \' t! B
    xchg    dx, es:[41h*4]
1 P+ l( B: b* V8 J    xchg    bx, es:[41h*4+2]
7 ]/ f- Y5 h& F! m, J8 @. {! y    mov     ax,4fh
* ^( u; f8 f3 I5 z    int     41h0 o) L! w8 H! w
    xchg    dx, es:[41h*4]
( W; V1 T! i2 Z9 p' N    xchg    bx, es:[41h*4+2]! l$ D4 k/ V! I
    cmp     ax, 0f386h- {3 q& A8 X4 }+ i, y4 V1 G
    jz      SoftICE_detected- G3 p, B) r: T8 l

2 U; ^" g9 K7 O$ M' `int41handler2 PROC1 ^& s" J7 E6 I, ^; ]
    iret+ A  k* F, u- Z2 J" u+ @3 B
int41handler2 ENDP( \6 v- [+ p0 r

& i) L9 ]0 Z* B$ ]0 a6 A. A5 L# A9 H% u5 Z: v& }6 C; U
_________________________________________________________________________" R( \  }2 G" ~0 s! |/ ^& t
8 [! ~; {  `$ y3 y
* V+ P0 _" ?2 r) @! T' A9 r
Method 066 R' O9 v+ T- D- K$ T
=========
  {' W- j3 t) d! G, \, i" l9 |; k* x# t. o9 k# r: W

7 Q* x8 _! D, d9 u& s1 L- n2nd method similar to the preceding one but more difficult to detect:
  x- }1 J, O( |  w3 S  g0 X
& f3 N6 W% ^* ]4 i+ m/ D' B3 L; F0 m& F: F, n; X
int41handler PROC
# d: V, M$ P5 d  m# I$ v; g5 a    mov     cl,al$ _% Y* z: T9 y
    iret
8 M3 s9 v4 R0 v( r; N' V, x6 v/ K. wint41handler ENDP
% l- W& y5 d1 L$ N( \: W
- Y: R) `" T, k* ?9 e  e4 J
6 b, i. J3 L2 H) w' o% @    xor     ax,ax% A- C& j+ h' r
    mov     es,ax
! H) a! U7 r! N& ^    mov     bx, cs
9 c1 {9 u: d* ]) j6 s    lea     dx, int41handler
0 D; o9 b4 \0 {1 T8 a9 E3 C    xchg    dx, es:[41h*4]% N8 x0 G' a! P# \0 K( W# J
    xchg    bx, es:[41h*4+2]) ?. x, c% R5 z' q% u
    in      al, 40h* Y- j+ T) X. ?
    xor     cx,cx
# c& ?& |* u( d3 i+ x" U9 F    int     41h
  s6 W( \8 f5 S$ N    xchg    dx, es:[41h*4]- f( M$ T4 O' W4 ^
    xchg    bx, es:[41h*4+2]/ |/ }" C2 K* a' Y2 `
    cmp     cl,al
+ f% q# A5 i3 r# B, c* d* p    jnz     SoftICE_detected
( p% M! ?. J7 q4 p3 ]
. S% E  t& u) q: x+ s$ __________________________________________________________________________
* B+ [- O; o# o4 A3 s7 D/ L7 Q: n- Y9 M; @  g3 W
Method 07: ?; m/ \: [- D1 G$ q
=========
$ }7 {" |0 V4 w5 P2 {# r* i. p; l- p0 u
Method of detection of the WinICE handler in the int68h (V86)& r5 [' `0 l% o6 ?3 I. S) r1 _

6 Y8 \3 O1 \; i% i' x    mov     ah,43h
# ^0 ?2 k: |1 d    int     68h  g) j1 A. L/ o- c
    cmp     ax,0F386h
/ V' }# T5 z) \7 `) ]- u* A; T    jz      SoftICE_Detected+ V; `1 N! z3 B3 L. U
1 K* Z) T' B' C$ I& u

! B- O5 @* {# h+ i5 G0 _4 n5 b=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
! R5 u+ i0 U& Q0 j" G" z   app like this:
) f- ?& y; D6 H# N+ U- H4 w6 b& w) J
   BPX exec_int if ax==68% z  m4 V" }! }/ Z2 F
   (function called is located at byte ptr [ebp+1Dh] and client eip is( \( y3 z0 s0 P. U% l
   located at [ebp+48h] for 32Bit apps)7 ~2 \) _4 ]( ]- P( s! |+ o+ |
__________________________________________________________________________
9 p: d2 ~. f' O7 H, q* j1 O, Z1 E' a
; b+ S4 P* s0 s* t# r' a. c* J6 \
Method 08* M- k! a, o, Q6 t
=========
  g) X4 Z% B) @' Y6 ^
5 q6 P' O/ h1 g" z! {7 P( pIt is not a method of detection of SoftICE but a possibility to crash the5 [& q8 k  R# m/ [) p' w
system by intercepting int 01h and int 03h and redirecting them to another
4 T) D* F2 Z7 k1 Y3 iroutine.
. j6 I" t; P, N' ^- v, G) WIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points" V! S* S1 f) f. n
to the new routine to execute (hangs computer...)  t5 |5 o+ T% e$ S
( n# x- U" x7 R/ C" \  _. ~
    mov     ah, 25h
5 D& X+ U# O) d8 T    mov     al, Int_Number (01h or 03h)
9 O6 M$ u; H. V3 k- m    mov     dx, offset New_Int_Routine
( }! |# {$ ~; M8 q9 p, K: e. T    int     21h
9 I) q: Z" f" c  C$ ~. Q4 b0 V4 O3 }" c( w
__________________________________________________________________________( r" [2 E- i. j8 n1 E) `7 u; ]
' |; L# Q+ x- h* N
Method 09
( m: ^5 d2 O& ?# N/ ]/ t7 ?( l% G/ ?=========
" H. f* T4 M) y% a' v
$ [1 |; t  Z2 F5 IThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ t/ Q% [3 z, _) c8 j! f* A
performed in ring0 (VxD or a ring3 app using the VxdCall).8 X" Z5 C+ Y7 I- f5 f  V% _: t
The Get_DDB service is used to determine whether or not a VxD is installed& K, b* k1 H, B& z3 J
for the specified device and returns a Device Description Block (in ecx) for) @! g: V8 v3 s$ d
that device if it is installed.
: e. k- U' \" c) o4 x# B: l9 S/ {  M* c
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 d' o* t9 [& A$ y
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% l7 o4 W$ x* ^% I   VMMCall Get_DDB
6 i2 e( T' C4 f6 b3 n   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: d1 K- L; f2 k) y* w; _" a9 k* T+ X/ J# j
Note as well that you can easily detect this method with SoftICE:2 W. V# r0 _' m1 d6 `0 K
   bpx Get_DDB if ax==0202 || ax==7a5fh
! G( C- H1 N9 J% s( j: t
* X; ?( E' l1 b3 F9 Z0 C: x- n+ m__________________________________________________________________________
; l" \" z  E- l$ d6 R( w0 o( p
& a/ D+ B4 r( H8 oMethod 10! {$ ]2 Q0 X. v# \5 U7 ?3 @
=========
# H1 h. y; o. T+ @2 }( Y( |' I/ t9 n* e' p5 Y- I
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with' [% M5 S/ }7 y- g
  SoftICE while the option is enable!!0 P! L  s9 L; k+ Y: r9 ^; y
- ~7 n6 Z  C6 B) {$ K
This trick is very efficient:
3 |# L( u5 [) Z8 B% ^! Vby checking the Debug Registers, you can detect if SoftICE is loaded
* L! D1 e# z! f(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 H% K, F- i' v4 g* d0 a+ r
there are some memory breakpoints set (dr0 to dr3) simply by reading their
) c4 i- p" U: T/ x% X4 _value (in ring0 only). Values can be manipulated and or changed as well
/ X) b0 a  A. a7 N(clearing BPMs for instance)% M& L  F* Y% M( [# u4 r

+ D2 B' _3 n; @__________________________________________________________________________
# d/ c9 d. t: r, g$ n
- A8 T' s2 ^8 b; O2 v5 d3 u3 O/ PMethod 11
9 O; \' F9 e2 {* w2 Q=========
6 J1 E% K( Q' S3 K
/ P, x1 Y, g; r& x, m- O- |+ C- jThis method is most known as 'MeltICE' because it has been freely distributed
; k) ?; [; ^- Ivia www.winfiles.com. However it was first used by NuMega people to allow
9 A/ T+ l& E0 h. b7 y. KSymbol Loader to check if SoftICE was active or not (the code is located# N- N9 B& T* V; N* C7 j" ?3 d
inside nmtrans.dll).+ [" x# \6 \! l6 p

* T" C3 S$ }1 v) uThe way it works is very simple:0 _5 G! i8 U9 {0 d* N( w& Y# K  J( f6 y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 g5 J& y: b5 P' T$ GWinNT) with the CreateFileA API.
) N+ t! W4 `5 z: s( p" A$ T0 k0 x8 t# K, o( `( ?1 m
Here is a sample (checking for 'SICE'):
6 i( d+ a) L% m4 S, o
% y" x+ d9 v5 C* K+ l4 U" U, P8 x! KBOOL IsSoftIce95Loaded()
5 L9 I0 E) Y3 A# u% `3 T3 I% p{# \* S2 ~- O% d
   HANDLE hFile;  
/ h( \* ?4 u; a7 M" l   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,! E  G3 B% c# S* b) G: |; |' s; I
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  E; K* O  M) [, l2 x                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 q* C# M, z! y: O   if( hFile != INVALID_HANDLE_VALUE ). E* m( ]1 P; M$ I9 l6 z7 U1 Z
   {
# f2 y0 f, M* \! m0 z1 ?: Q      CloseHandle(hFile);1 o0 W* E" N4 t
      return TRUE;
5 m! p( e# Q& Y$ O1 n   }
( G, J- ?4 R9 h; a4 Z& I$ o9 z' }  T   return FALSE;" P. M$ @% O1 k+ y
}
) b1 z5 I4 |  L* r* a: ]; `# c
Although this trick calls the CreateFileA function, don't even expect to be
9 D7 R+ H" L1 ?, Cable to intercept it by installing a IFS hook: it will not work, no way!
/ }* j; o! ~. u. D( vIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 a% ~$ `/ H& g# }6 R# Gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- y* }! ]+ o, s( S6 K2 {* K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ u$ F' P4 J$ X- d/ q/ Ofield., a8 z  R7 |# m! `4 r
In fact, its purpose is not to load/unload VxDs but only to send a 5 P* B( N0 Q( ]% c8 f- L
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ d" l9 X) m5 w9 S! b
to the VxD Control_Dispatch proc (how the hell a shareware soft could try- o* ~7 H( f8 c
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ J1 v3 ?, U5 F, ]* E, x% l* G6 Y) KIf the VxD is loaded, it will always clear eax and the Carry flag to allow$ L. i8 S! D4 I0 @- n' [4 o/ Q
its handle to be opened and then, will be detected.' O/ }. ^3 ?/ ]& A3 G
You can check that simply by hooking Winice.exe control proc entry point- S( a) e& i0 o. P
while running MeltICE.# h% t: L+ b8 r: a- t( W0 i% {( f

- P4 c3 u: T& s; h4 }: x. g/ u( k4 o7 Z9 ?3 {2 v
  00401067:  push      00402025    ; \\.\SICE
: q4 x' u# a& `2 d0 _$ G6 b5 O3 z  0040106C:  call      CreateFileA
$ l; ]# M2 D2 ?$ I, p  00401071:  cmp       eax,-001! H  ^4 _+ k. v9 U: _
  00401074:  je        00401091" o! Q5 A& _9 v9 z4 [  |9 ^

' Z7 ?7 G3 P' |/ f3 I+ b- _; _
, L5 u. b3 r+ n3 hThere could be hundreds of BPX you could use to detect this trick.
' I1 I+ o1 m3 k1 U# s7 C/ `9 t-The most classical one is:
1 _# ^: s3 O& F& _) e  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' m0 Y3 a3 F- ?$ c    *(esp-&gt;4+4)=='NTIC'
8 E/ m4 G7 A: @3 Z
( A$ x. O' n5 W8 u" P5 p-The most exotic ones (could be very slooooow :-(
: V9 L7 R9 U! d, H" E   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  1 ?- M' @& E4 L7 G, B2 _/ e
     ;will break 3 times :-(
" x+ I8 Q" }0 q. I9 D( D, m0 o1 {4 t/ W$ M3 w6 H  _
-or (a bit) faster: % S$ D% R3 `3 N! j, [% ]' z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" f: B( ?& C8 }8 p9 \! |. m# Q# [) O7 {: m- P; d6 E
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # H  m, ]0 H7 K4 Y
     ;will break 3 times :-(
5 |1 ]; u# E6 H2 Q" W& x( v
6 w& T( G/ ^' B6 [2 i; M4 q-Much faster:
! ^4 r/ V4 J  d7 x   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. g0 V6 j+ K6 N- H( ?0 R2 W4 }  H- O8 o& |
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
# i8 s2 Q3 n4 jfunction to do the same job:% ~  O7 |' H8 H6 c( P

5 t0 R4 E8 E9 [  N   push    00                        ; OF_READ
" [" Q# C& h& ]# W; K2 b& B! R   mov     eax,[00656634]            ; '\\.\SICE',0
( d2 c3 K3 g" G5 L   push    eax" Z( h0 L8 |4 R3 d
   call    KERNEL32!_lopen
5 X6 [3 C7 U- o1 a! }% H   inc     eax: @3 N4 |8 O/ F1 u7 \
   jnz     00650589                  ; detected
/ p% |3 O- F  D4 p) [# N0 x: o   push    00                        ; OF_READ
, W5 F+ q5 p6 Y6 Z, V- h   mov     eax,[00656638]            ; '\\.\SICE'" d9 F6 S! p. B  n8 b+ f& F
   push    eax
0 g' U, G; `$ A8 T2 u   call    KERNEL32!_lopen
% G8 k$ g" g$ \# ~   inc     eax! g( p1 p  ~1 }8 U
   jz      006505ae                  ; not detected
  Z3 y5 v# p8 ^
# c) j9 |* C6 R$ C- ~
+ c8 k1 z$ |* D4 @. d+ ?# d__________________________________________________________________________* g/ u8 b" h9 x6 {$ j. i* \/ J
/ ~% c, X" A% d! r7 C" A6 z
Method 128 }7 U, G* F* d* l
=========# `: s) y3 R( e7 ]

2 ?5 N; |8 J3 I% i% U& gThis trick is similar to int41h/4fh Debugger installation check (code 05
/ i& c0 D  u1 W6 [' A/ A8 }&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. A# K. N8 V+ u% w& gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ k! z! Q- L& M; o4 q6 s' d( v/ W6 G/ A0 z* N% Q) M& u" r
   push  0000004fh         ; function 4fh- S& A3 b+ O* i% b& O  Z2 X! y6 Y
   push  002a002ah         ; high word specifies which VxD (VWIN32)& R+ {* C5 \: y
                           ; low word specifies which service
. A/ K4 r" Y; M8 q9 T' s" d                             (VWIN32_Int41Dispatch)
% J2 ^2 x; D. U3 O   call  Kernel32!ORD_001  ; VxdCall
( w4 O! z  Z& D6 C6 B   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 ^1 ~# O% k& _1 C/ u5 b* h   jz    SoftICE_detected
2 S0 X7 f0 h4 _2 _. |. z, ~5 P5 r, _( t$ B2 X
Here again, several ways to detect it:1 H( w: Y- {0 v7 v9 x/ ^
/ e9 n- f& V" i* z
    BPINT 41 if ax==4f
1 P1 Q  I6 _4 B+ P1 |8 X: I, L. a, Z: E- U4 c$ A4 r' k% R
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- _5 y& E( P0 B6 t0 R
. v! b" @& W# ?: d8 B; K# j  _. j    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 f  Y. J/ \+ E3 U1 j& u! w: L' {3 r9 S
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 _4 m9 U1 k) C1 D- @! p; ^4 ]/ c/ i) E9 _9 j# }; a, F
__________________________________________________________________________/ l% }+ m: p/ t, N9 \

* g3 n6 r7 q' v' o$ rMethod 13; X& i9 v7 t6 z/ X
=========
$ O2 c: I6 I# D0 r  [' Y, Z  B/ Q  h* T5 o# s, ]
Not a real method of detection, but a good way to know if SoftICE is
# M% i: ?9 r, }4 p/ K9 v7 X0 Pinstalled on a computer and to locate its installation directory.2 J7 g8 ~2 [  `" \; F, }. D- B
It is used by few softs which access the following registry keys (usually #2) :
- p( Q  x" J/ F6 D
. m4 V$ f) I1 j$ n6 ]( q* l-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ n! }4 `  |  k! X\Uninstall\SoftICE5 Z- r& n) }3 z* M1 W# e
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 B% i) _; M  }! b
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 @$ N4 I* k) E
\App Paths\Loader32.Exe3 r" K9 u: ]  Y; ^& I0 k* y

8 H/ W7 C. i4 M+ I5 E9 p6 z4 Q4 C- Y4 J5 ?' O% v
Note that some nasty apps could then erase all files from SoftICE directory
7 y( {8 T* i# r2 Q8 c9 A; v(I faced that once :-(
0 P5 e1 F. T: e
1 v  s2 U; K. }& ?) b% C1 ]2 Y# ]Useful breakpoint to detect it:6 C' C; j* ?$ [4 U4 ]# }2 w* E

1 ~2 r' n# t  s     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% t: Y9 B9 {, q. p% d
) t) t+ L/ `: g
__________________________________________________________________________
& d/ |# q( x% l2 w# \1 V6 c/ I4 P1 _; o& G
  I- H: }) i: R0 V% a
Method 14
: m9 `& Y' }" j9 w=========
, n2 T& s% W7 m1 q, P! f8 u
- T3 |( ^& V) v0 k7 d8 Q5 M. uA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 {7 o4 N0 _5 B( Lis to determines whether a debugger is running on your system (ring0 only).
# F" X8 p( O+ o# A* H" `5 Z) e6 l0 I: B/ T, \4 l
   VMMCall Test_Debug_Installed- G" r/ `& f4 J/ ~" g. H! l
   je      not_installed4 M/ t" J2 f  h/ }

* i$ y, g+ m; @This service just checks a flag.$ \8 T/ W0 s# j, @/ q8 F, V% ]
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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