About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 Y1 E: X4 X/ f
<TBODY>3 }1 g# x$ U2 m3 b1 p8 j6 Y* O0 H, f
<TR>
8 q; \0 n: z7 U" j<TD><PRE>Method 01
. N. Z  \' E8 e$ e& U3 \3 K=========
+ ~* x: A6 w$ x
) N% B, M; ?, F: B+ I1 Y8 B* @This method of detection of SoftICE (as well as the following one) is
  p) m# o- O/ q6 z' Nused by the majority of packers/encryptors found on Internet., N! p  H4 i+ L5 h
It seeks the signature of BoundsChecker in SoftICE8 V  }) Y6 X+ S2 E# z9 H

* _, p3 B5 N  Z7 V    mov     ebp, 04243484Bh        ; 'BCHK'! U. q: l% d' @; ~
    mov     ax, 04h8 E7 ?% @  u& P: z
    int     3       $ X* T9 l. A( C) a
    cmp     al,4- y) y- S& k. }. d" W
    jnz     SoftICE_Detected
# [& ]) E9 u( u
+ i& p: r) E4 k, n: ^9 \___________________________________________________________________________
$ L" J* n( B2 j$ O# X. b4 X: {5 c8 N% r; E  o8 u1 e  H
Method 02
( O, O4 p. W! n) b% U# K=========
( A+ n$ t- \# H+ v2 G3 j& L8 ]3 n2 m4 I$ \
Still a method very much used (perhaps the most frequent one).  It is used  _& o: ^0 r  z3 w0 w. T1 Q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,( s/ l' V( w& g+ N( r: g4 G
or execute SoftICE commands...
5 n# o" i1 t' C/ eIt is also used to crash SoftICE and to force it to execute any commands# X8 e8 A! r, o, t+ ~$ s
(HBOOT...) :-((  
$ Y+ Z5 l  u- X8 e! Z
! F! Y7 i  p% ^: B8 `Here is a quick description:
2 Q% k+ ]+ o% F# l: N-AX = 0910h   (Display string in SIce windows)
$ g2 U7 v% z+ h-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 h& o' f: `' p-AX = 0912h   (Get breakpoint infos)0 J. Z7 _! k+ e) R5 l/ G1 J! P9 P
-AX = 0913h   (Set Sice breakpoints)
# C. [8 u- b6 D1 M0 }- E  o6 I-AX = 0914h   (Remove SIce breakoints). Z: [- ?) ]4 f) \: P
0 R6 P; a9 Q5 i1 P1 h8 Z, g
Each time you'll meet this trick, you'll see:
" Q' u+ ^; C: W/ T-SI = 4647h
" h3 U& F4 Z9 }& @6 j-DI = 4A4Dh) d" }5 X+ g& G0 t
Which are the 'magic values' used by SoftIce.! V& ~- [7 C/ T+ H- v' I
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& U  q) E1 A. Q! D0 u4 q
0 [# Q  a; ~, V2 R! c, uHere is one example from the file "Haspinst.exe" which is the dongle HASP: J, I& ~+ @6 g( p! a" b
Envelope utility use to protect DOS applications:
2 n( u( c  u' [5 `5 M  A) D
# i/ M: `1 T5 W( B6 M: `$ ^/ {1 ]5 `& d! w& T" P
4C19:0095   MOV    AX,0911  ; execute command.% a6 j7 }% s4 o+ i9 K  g' O
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
$ s: }7 X+ B' S8 _4 @4C19:009A   MOV    SI,4647  ; 1st magic value.
' X; y+ i! ?) H2 n) ^4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 T9 M& Y, ~0 ?2 R2 E- ]8 N+ I
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  O: d5 H' k( U/ c% r$ K
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 O' _2 v# U6 [3 q# N; v3 K5 l9 k
4C19:00A4   INC    CX
/ v) F% H0 S5 T+ D  u5 i, `4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 O9 O4 j- o# [  a4 A4C19:00A8   JB     0095     ; 6 different commands.8 {9 H: ?9 F) \2 z- H
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' O" V) @+ t. i9 F$ s' w
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" p% o3 o& R6 G) M) _
. m& s' Q" D4 `. s! s0 D7 y
The program will execute 6 different SIce commands located at ds:dx, which& I, ?' Q1 ^2 K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT." M8 W0 s& b3 G! |7 x+ d3 \

2 m( @$ _1 G% m) T$ ^1 r' M( r* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* R" @1 j- R+ i0 g7 u# ?" G8 O
___________________________________________________________________________3 K5 C1 p2 m8 i8 F& W
, F, L8 C, ?  C" h
0 ?7 G( u: _# F/ e9 [
Method 03! V+ N& i% P! T4 S, f: }1 A( X
=========
; @" x, _, `9 C9 f
6 V' C: W: {% W. o% ?4 HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# m* Y6 m8 p* [4 z6 t8 ~(API Get entry point)
3 J) |7 E# l6 L. c3 I        ! k0 f& i  z8 s7 S. _8 O  I
1 }: q+ R- s$ H8 Z; M8 l* Z
    xor     di,di) t* E; o" F5 g; E" z8 d
    mov     es,di
# E: Z, m- e4 G2 ?    mov     ax, 1684h      
. |0 f$ S" Y8 ^/ n! ^    mov     bx, 0202h       ; VxD ID of winice
6 z" E/ x8 k* T. I" D    int     2Fh8 x. G! g9 Z0 Z8 }8 x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- I6 |% Y, h4 H) t1 n
    add     ax, di
$ K: a2 i8 v; y! A; d, Z) Z    test    ax,ax  _. P! ]& R# r6 p" M! J; e
    jnz     SoftICE_Detected, p# ^& w8 ]% e8 i! c8 k
& A  g/ `" S8 ^. k. Q8 A" e4 S
___________________________________________________________________________
" X! P5 {) y) r6 A5 V& ?
* B( x' h, U, qMethod 04
& [7 T1 j: x" s" |* p# H=========
0 Q' t( {5 V3 ]# d. i& L. A6 a& Z" ~$ r" J* [; d+ e" J& U
Method identical to the preceding one except that it seeks the ID of SoftICE7 T+ y: F# a* e7 c2 ?
GFX VxD.
5 _- z6 `3 P6 C0 Y/ n+ V2 {; @. ^% p/ |+ P1 m* ^% R
    xor     di,di. p9 R" U, e( z$ f8 t2 @# F
    mov     es,di: H" H5 A, {/ Z1 [7 |# F+ \
    mov     ax, 1684h      
4 X, v& I" }3 }    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) t% W$ J3 Z3 Z. c0 g( K- R- G    int     2fh
( z/ @2 E, H4 S' Z: }, n    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 }" m6 \) o8 c5 s, a$ L" }    add     ax, di
  j/ l# Z! M  l, r$ M! p) E    test    ax,ax  w" e2 ^$ T. Q: z- Y5 F/ b3 n6 K
    jnz     SoftICE_Detected( M5 P: c% S2 T+ D. w

2 D& K5 w8 I6 H__________________________________________________________________________. F  F, D9 R8 v$ S4 A

6 [* `. E$ r1 K: U3 i8 ?& e8 I% B% d1 B
Method 05
$ l1 S0 k3 g+ ~=========
  c0 P7 {; v/ I- a' p* E2 k
0 |$ N6 |  K" I5 L2 w# F8 bMethod seeking the 'magic number' 0F386h returned (in ax) by all system
8 B; D  x' H! Sdebugger. It calls the int 41h, function 4Fh.& z$ C  j& N# r& G
There are several alternatives.  ; [/ Z) i$ \: \( q& j  B! ~: Y

7 R, `8 _$ e( J* d: K& hThe following one is the simplest:8 o* i2 H) o6 j4 I
! }- m4 t, R4 D' |/ V4 N0 h
    mov     ax,4fh6 J/ O2 t- {( M3 ]4 T6 c: l5 \
    int     41h9 k9 d) F' E; d9 x/ j
    cmp     ax, 0F3865 D! u; \# h. r  t" ]
    jz      SoftICE_detected" a- S/ Y9 E, C
- g6 V3 A: V2 }: N) q7 l: L
! b, ^" ?# d2 s, [% I! v
Next method as well as the following one are 2 examples from Stone's - ~8 ^3 N  o7 [2 Z' H
"stn-wid.zip" (www.cracking.net):
6 I( s0 P( D9 a) Q% h& w2 E5 h3 c& u0 u
    mov     bx, cs1 i2 X- h' p& r5 C( B  B
    lea     dx, int41handler2" b# A3 U/ g, {( A
    xchg    dx, es:[41h*4]
+ @7 p9 s/ |* O. W6 _8 r    xchg    bx, es:[41h*4+2]
5 e* m: G( D/ R  A/ m    mov     ax,4fh
8 A6 ^. e- k& T9 X    int     41h2 j1 _0 a2 q  \3 {
    xchg    dx, es:[41h*4]2 ?: H) e4 p9 p9 F2 I& T
    xchg    bx, es:[41h*4+2]
) n  v  j8 ]6 `5 k  d0 f# U    cmp     ax, 0f386h8 L0 ^- F# J5 T1 [
    jz      SoftICE_detected1 D0 t9 S) y# `

5 Q6 f% n' Z* \0 r4 b: B% p0 A, Oint41handler2 PROC
4 V) |1 i. M7 m/ N  b    iret
7 Z$ C2 _: C9 P2 oint41handler2 ENDP1 ?+ N- T3 v6 s4 j" N( w
& f  c$ G  w+ w, U3 \
& U6 j( \/ a( L% Z
_________________________________________________________________________6 c( L8 n3 j3 q
3 I+ Y' {* Q+ j2 ~$ h$ E5 P3 `
( J* [; V6 U9 e' i2 g3 T( e
Method 065 l. _6 E0 d# L7 T& N$ v5 A& q
=========. `1 O6 L, s9 s  x) b/ x
; k3 s% y( L: ]3 Y7 x7 G7 q
% V% c9 P: N3 D
2nd method similar to the preceding one but more difficult to detect:" C- K% v3 v  ]# v

, r, |$ J2 O* N" g% S& j: ]5 S% S
int41handler PROC
. I) Q7 d; n  B( {% z! U7 c) l    mov     cl,al
3 U. X" u& P0 X" r2 @4 o- \    iret
. U( V% l! `1 r; k& E# Mint41handler ENDP- T  F( q+ L1 ^* j0 F. j9 ~
/ t7 h6 [; {9 A1 M. O9 D& _9 X
' y4 U5 g! Y% t
    xor     ax,ax; y9 R% S+ ]% h: m+ r  ~# }
    mov     es,ax0 a8 G3 j, y& u  p
    mov     bx, cs! X" U8 v. \+ i+ ]
    lea     dx, int41handler
) B4 M& ^; H" G$ u, `    xchg    dx, es:[41h*4]
/ F2 q, l/ G% t0 i8 L    xchg    bx, es:[41h*4+2]  f/ m" q) }8 h4 g- W* E/ R
    in      al, 40h
* V/ H& V- R6 }+ k4 g, _, e1 O9 ~9 t    xor     cx,cx
! h& p) B  O5 z# c2 k    int     41h7 t0 }. e/ P* S$ C1 n
    xchg    dx, es:[41h*4]/ P6 n+ D6 y0 u& q8 X" L$ C& y
    xchg    bx, es:[41h*4+2]1 l3 Z4 R2 A% K! u- u5 L3 k  Z
    cmp     cl,al8 A: }: {4 o/ c
    jnz     SoftICE_detected) S3 u8 S  n) T, d9 d

. M8 A4 f+ Y: g/ t% ^9 {& g_________________________________________________________________________& \- V( @' q: _3 v  V( e$ b

' S( d4 ^1 _2 V9 k8 S1 V3 I8 DMethod 07
5 U% m+ I" k# u& ~( P" ^, ]=========- R) L/ N; m! E( g- J
& A4 v2 q) n3 f! w$ I
Method of detection of the WinICE handler in the int68h (V86)4 }0 `# i, m( C# s, ?! ]

3 Z6 F% ~) x% k+ ?( h    mov     ah,43h
+ p0 j0 K3 ?1 n    int     68h
, I8 H9 i& u' h: F) q" h* Q    cmp     ax,0F386h" L) b( }* p9 V' Q  j; g/ H1 Z
    jz      SoftICE_Detected! x% V" Q, o( W& j
4 [7 Q, W' p6 n3 y  k

* t* K1 ?5 N5 ~* o' x+ Q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 k0 u' K5 I  _/ O5 }- B3 x9 _3 P   app like this:5 P! x3 M" z$ \) q' \
) i6 d- o; x" f$ a5 r
   BPX exec_int if ax==68
; Q- }: b+ ^/ o+ b9 v6 H   (function called is located at byte ptr [ebp+1Dh] and client eip is& ?; k0 m7 ~) G% V2 X4 F$ D9 c
   located at [ebp+48h] for 32Bit apps)
; l9 v: V6 s! M7 ~7 q9 C2 j" O__________________________________________________________________________
; c% a$ L+ R/ T3 q. ?: k+ E$ ?! P# A5 A7 Y2 f6 i+ p
# a  X# l4 ?# l
Method 08( p! \# Q( Q3 K2 l% Q( X* S+ i
=========" w! q* p2 F  x. Z

) D! c" `; Z. ^# ?5 ?0 X5 ]/ e8 B- |It is not a method of detection of SoftICE but a possibility to crash the
- a2 W6 B% I% @; i/ f2 w" Fsystem by intercepting int 01h and int 03h and redirecting them to another
9 n2 m& f2 j; B+ u4 _( Uroutine.
" x7 b& N7 W# Y- ^$ i8 h( DIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 A( _0 O" \8 n: X
to the new routine to execute (hangs computer...), W) H- \$ x* {2 y1 `: o9 O7 k# C% N; v
) B: h7 W# m* F7 L4 o4 y. L
    mov     ah, 25h
" m9 m% i' i- z+ S8 a4 W    mov     al, Int_Number (01h or 03h)5 T) P, \5 ~/ |* @( _
    mov     dx, offset New_Int_Routine  t$ [8 c; b( g& W) q$ {, y- X
    int     21h7 {5 q2 P+ y+ u! |
! j+ x3 I2 e4 U
__________________________________________________________________________. g7 }) w8 X& j7 r1 U

$ A# W# ~" V+ z* A7 dMethod 09* s/ q0 J5 V; D6 C) z/ y
=========: `8 q" q" d9 i$ R  ~3 U
! Q- _% w5 i  h
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 v: c2 D* n& z6 G
performed in ring0 (VxD or a ring3 app using the VxdCall).
+ r* i( S% _% p4 iThe Get_DDB service is used to determine whether or not a VxD is installed# L2 M4 l( i3 Q
for the specified device and returns a Device Description Block (in ecx) for- j& y$ M- j9 F1 F; g) _: |: L
that device if it is installed.
: D. k; I5 R. I# @6 L2 f9 q5 @
& _# B5 b' ?! s3 ]4 @0 H" e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 r. F. V( ?* S9 G0 F+ c
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) M+ `1 l% }, x   VMMCall Get_DDB
3 }: o5 a5 H' i- i   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! W% t# G5 A$ C" p6 o$ i' I
2 ?; x  A8 R! l3 {
Note as well that you can easily detect this method with SoftICE:
; M$ P1 s" h& O5 r4 L) g7 U& u. D   bpx Get_DDB if ax==0202 || ax==7a5fh
% g, k. r: O% k# s' X7 a, N9 `& P9 W8 z* B
__________________________________________________________________________
- q$ H' a1 G) {1 Q
+ r, _+ x* s4 H  D9 V* gMethod 10
" `# j2 b, m: G; h7 [' b=========, A9 v1 B$ ]2 F$ X6 \
' J& N# U8 |! q& M/ [
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* g; H0 z  E, Q+ L( f  SoftICE while the option is enable!!
( N% G' R( g' j, |9 M% i( Z( g9 z# t
- V7 ~4 h# J) K; Z( n% F( U3 z! nThis trick is very efficient:3 X4 z# P* q- D# v+ k0 C# y* @) O
by checking the Debug Registers, you can detect if SoftICE is loaded
- J& G9 b9 Y) B2 H" i(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if  r+ l$ u' f! K4 X  a- t
there are some memory breakpoints set (dr0 to dr3) simply by reading their' X- z5 n& Q- M) V7 K; j1 X
value (in ring0 only). Values can be manipulated and or changed as well& ]: M2 b5 G, d/ {1 {
(clearing BPMs for instance)9 y' ~  O+ U: z
( r! H* |* X" |- \( O; F0 M$ G
__________________________________________________________________________$ s5 i3 C8 i0 J4 `
# J' p: Q& d  B! z
Method 11$ b0 @) ]6 `' i) f0 M
=========
" X8 A, v5 q% G6 N
" W9 G% D, E8 V6 jThis method is most known as 'MeltICE' because it has been freely distributed' d7 r$ x. p6 P
via www.winfiles.com. However it was first used by NuMega people to allow
5 a: ?1 M! u: E' v/ d# X# n4 nSymbol Loader to check if SoftICE was active or not (the code is located4 y$ W* P% Q3 O" j0 i; x! [
inside nmtrans.dll).$ e* k$ S$ X7 {0 ]: d

1 ^$ n+ ]3 C; Z' ^The way it works is very simple:3 C4 u" z: E6 N2 U" i* f5 U; ?5 \
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 X- V+ b: r' [4 i! H5 i
WinNT) with the CreateFileA API.
/ C1 c7 A) S* O- i* f4 O6 d# t/ j! [0 F, ?+ E
Here is a sample (checking for 'SICE'):
, U: F7 q" h+ j+ S5 T8 m( b' w' F+ {+ y1 M* |. R  X# D
BOOL IsSoftIce95Loaded()
9 f  q6 u0 x/ r{
1 x- M& E. i9 F9 f# T7 J: K5 U) p   HANDLE hFile;  
: m1 I- B8 I7 o# b# {+ A3 g   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& q7 W/ C8 Z+ G. K0 y                      FILE_SHARE_READ | FILE_SHARE_WRITE,- K) t- h4 s2 W5 w1 x: x
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);8 [/ y+ `+ J( t. z6 p1 c
   if( hFile != INVALID_HANDLE_VALUE )
+ ]- k" ], g7 _2 ?   {; I5 n3 Z8 p* _. s% R! r
      CloseHandle(hFile);7 o6 e4 h  R, F3 M6 T/ N
      return TRUE;
0 {2 E& l; D1 x) O! i0 _. ~   }
# [, A3 E( S# p& D- c1 ]0 c& i   return FALSE;
1 B, m( `4 e! v. Q}; n" Z/ s' R* }# j4 E
2 ]  s5 f3 Z# B0 z5 R& i* ]1 N3 {
Although this trick calls the CreateFileA function, don't even expect to be: q5 ~5 g; C) D
able to intercept it by installing a IFS hook: it will not work, no way!3 C* N9 l; }" V; P/ v
In fact, after the call to CreateFileA it will get through VWIN32 0x001F! i! I. v) @; U* ~# B) ^
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! S- c4 R# X% e) n1 O4 M- land then browse the DDB list until it find the VxD and its DDB_Control_Proc: |* h9 q: Y# D* ^# |8 d: O
field.6 |1 r$ K3 R) S8 C
In fact, its purpose is not to load/unload VxDs but only to send a
! z% R7 g. _1 s2 l6 e, eW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  _& T% o9 n" ?7 w
to the VxD Control_Dispatch proc (how the hell a shareware soft could try7 _* r) V2 E" V# o1 {
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 R. u0 T0 t; r# v/ I9 JIf the VxD is loaded, it will always clear eax and the Carry flag to allow
" t; n, f0 E1 W) uits handle to be opened and then, will be detected.
, |( ?9 v* U" q2 h3 Z$ n4 ZYou can check that simply by hooking Winice.exe control proc entry point1 a- g3 Y) u9 n8 A
while running MeltICE.
7 c% ?) ~: y% i0 L
% _6 p" z' Z6 B. v/ i4 G1 U. z% C: h' }
3 \2 c4 L* b- `3 Q) i  00401067:  push      00402025    ; \\.\SICE& N! k! G3 H+ H" l8 p9 C
  0040106C:  call      CreateFileA& r  u  k/ \" \( l7 Z+ f: E! c# y
  00401071:  cmp       eax,-0019 a+ B! F$ t$ r# k8 S* [* o. |
  00401074:  je        00401091
  }( U' S5 W/ n5 \3 Y! g  X8 o, d8 T1 E+ a1 N9 z7 [' d

* l/ K& C; Y# YThere could be hundreds of BPX you could use to detect this trick.
! l1 l# b/ Y- q5 [( O8 p) Y  @! Z/ ^-The most classical one is:1 v& B9 z/ Z( ]0 x1 K8 [5 X2 E
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 ~- ]& j0 Y1 @, H* b    *(esp-&gt;4+4)=='NTIC'6 ?3 @- a% y- I) U9 {- L" Y; U

! B! E* v' [) @4 f  _$ w-The most exotic ones (could be very slooooow :-(
8 v, e" y5 e' X" ?   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 Y3 @. K7 M1 z( J
     ;will break 3 times :-(
' M) ?- ~( G4 z$ M+ W+ D
7 `$ k6 u+ ^1 C8 u/ n-or (a bit) faster: & g% l# A) U. l( B$ q7 U
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  G4 ^2 A& h- {7 o) N+ ?
# D* y1 p. J( i; p) G
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # \; G- m% K/ z0 H
     ;will break 3 times :-(6 G( X$ A/ \" s. M) p
1 a7 D& t& V6 n" n, c% d0 q
-Much faster:
6 l5 O3 ?* H, M+ F   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 U& v/ e) X3 ]4 _! w
; x! T. u$ F7 J+ @, n" H" D
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
( M/ Y- @* P  Efunction to do the same job:
4 l0 v4 R/ t& k2 `5 c, l' d: F. e' T3 i2 N
   push    00                        ; OF_READ
3 k9 V; W, u8 l0 C! L. f   mov     eax,[00656634]            ; '\\.\SICE',0: U5 H" D8 M4 k( T9 b
   push    eax
  [$ B* A+ J* @) ?- k: Q# J; C   call    KERNEL32!_lopen
4 u2 W: W$ ?/ x6 n9 x) f5 N   inc     eax
9 W# L5 t) U& b1 r# V& F& p   jnz     00650589                  ; detected) @5 h6 E7 ?9 U$ K! r- X! J
   push    00                        ; OF_READ% Y& j( r0 ^5 V* k% I$ l( ~
   mov     eax,[00656638]            ; '\\.\SICE', u1 R% y* }0 E
   push    eax
" A5 T$ b: a# V0 F9 s1 n$ ?+ d   call    KERNEL32!_lopen; d9 l2 V/ ]% `. d/ E8 ~6 w& D
   inc     eax6 @; O9 R: h' d! f: w! n/ N$ k- R
   jz      006505ae                  ; not detected
  E- n# t+ ?9 ]+ U! h( {: q" o. J7 |2 G% i

; f. M9 p+ J' h1 ^' r4 T7 |__________________________________________________________________________
+ a! R: m9 ]( A9 R4 s) O; q
4 c7 x9 P5 k# ^  n8 S9 ?Method 127 [/ ?: \9 X! R, O9 n! m1 }
=========
( c. l6 U: p+ p, e
* B" A$ u5 b7 c& y1 iThis trick is similar to int41h/4fh Debugger installation check (code 05- X! i2 D7 o- l! g" @: s: _
&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ }' e) T# k) r8 }$ {1 p9 }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
' z) Y/ g( F$ V2 F# A+ w/ O8 |3 i% P) i& o& _
   push  0000004fh         ; function 4fh" {- u; A( X# E! G6 q
   push  002a002ah         ; high word specifies which VxD (VWIN32)% A, d! i# c0 W. C* Y  r
                           ; low word specifies which service3 @  M, l* B( n, |( ^
                             (VWIN32_Int41Dispatch)
: x/ @# C" A! C' T7 b   call  Kernel32!ORD_001  ; VxdCall" a& E$ `6 d' C: m- Q/ H: `' W
   cmp   ax, 0f386h        ; magic number returned by system debuggers
; ?8 S' w" E7 `- s+ L8 X9 N   jz    SoftICE_detected+ v! n9 S  f4 P0 ]5 ^5 L
$ v+ H: _2 @$ D, t2 C# h, ]
Here again, several ways to detect it:
6 ^- M! }2 b5 v! |
' T8 g0 S' J5 O. ^; n% E' ^    BPINT 41 if ax==4f
' u3 u  ^3 S  K5 d
! {( R7 `+ q* Q6 M5 k    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 m+ `  R6 `4 D( S' x

. F$ a5 X& z) X/ v/ p* g    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- V" y1 z! v; C& C3 f- [% W/ \! x* [* F7 j! x$ Q8 l# f" O$ `5 C: f- c
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 Z; d1 i5 z  o

0 z+ v" ~; G9 W0 L5 P! U__________________________________________________________________________$ t+ b3 M$ `  k
. W# P5 Y' t' x
Method 13- ^# S/ {+ o# ?* r# M1 K9 N7 ~
=========
1 j& r3 B! i( M0 s# R+ O
# t3 Z' t: h$ v: @6 \Not a real method of detection, but a good way to know if SoftICE is6 o/ c( Q/ m5 ^1 S
installed on a computer and to locate its installation directory.; V  j9 `" o2 l/ p0 p
It is used by few softs which access the following registry keys (usually #2) :) v6 I, F# g% n

$ ^' I+ w# b" \- a; z, U4 X: D: Y  L-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! M  F* E6 Z) V8 f- E5 O
\Uninstall\SoftICE. e+ T+ ^+ T- ?9 n$ K9 [
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE3 ?. o8 Y! j( X$ |4 @& T$ N
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% P; ~) j, p$ u0 ]1 B\App Paths\Loader32.Exe4 j+ i, ?2 C1 ~- ?& F  @9 X7 W

5 O: q& x6 l$ O7 W/ D( l
- i1 W5 |# `9 r3 v" [! f4 U- M  e+ J8 KNote that some nasty apps could then erase all files from SoftICE directory
7 H2 j5 \; ~$ o1 S9 _: p, Z(I faced that once :-(
/ M' O) f3 G( h0 P. [
5 {* h3 f$ n0 P9 b4 H. \: iUseful breakpoint to detect it:! z' b) p9 }: @8 W) w
/ y# |4 ]/ ^8 R9 E
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" U' T; i; g; }
: m8 C0 r. ?9 T/ y: {( n2 s__________________________________________________________________________: ]% ?4 o- i- \- y7 O1 c

! h1 f# |: e) O4 i# J- |# q& s2 o7 P5 S5 P) |* U
Method 14
/ T: }$ E4 c  S0 F$ R/ _8 M$ o$ S=========+ f$ S- `+ _" x+ m0 W
4 x$ b" J7 q% ^4 e$ z4 v9 q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ p0 c6 `8 m2 v1 K$ {% w$ l  p
is to determines whether a debugger is running on your system (ring0 only)./ a2 r" z2 f, D+ L# M
  s# o% f9 Y9 C  ?& X" C
   VMMCall Test_Debug_Installed* z6 Y0 p7 Y# Z) `- Q9 ?+ k$ c3 D
   je      not_installed
8 z$ E4 F" G( L3 m: P1 t: r# \( ~! B
, k4 G! i6 E; b; i, f" g# P# a4 NThis service just checks a flag.
' b% L$ I9 b3 B  _2 {- o0 n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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