About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 _1 P# c& z# U
<TBODY>
! h/ i5 Z$ R- `/ `; t+ m1 O/ S<TR># r# d  R4 }5 R3 j
<TD><PRE>Method 01 + u4 x% q% _, @. H
=========
! [! w/ |6 f( u1 k4 T/ t! P/ w9 I3 n, ]  M0 j
This method of detection of SoftICE (as well as the following one) is# C! E+ q3 v  ]. W9 k
used by the majority of packers/encryptors found on Internet.* f0 A' S% `% N) _2 o4 I
It seeks the signature of BoundsChecker in SoftICE2 e" G& z0 H( x! T' O. @1 F. @0 A

7 \7 d7 `2 j: M    mov     ebp, 04243484Bh        ; 'BCHK'+ z8 ~) E' j: a9 i& c( l* S
    mov     ax, 04h
8 r8 D& V& \4 @    int     3      
; F% q5 u) z* c% l    cmp     al,4) m2 c) S; V: a1 u2 O
    jnz     SoftICE_Detected
/ s2 e- l, c. ~$ {  U0 L7 j2 w! x0 Z0 ?
___________________________________________________________________________
1 W* R6 x- n; u( L) X4 M) u8 W5 g# C8 k
Method 02% p* J/ j: x' w: o$ b4 f% `" I
=========4 W  J4 ]9 e" H' |) \( S+ Z

: R1 ~% J7 i$ V' @2 ~4 T" ?Still a method very much used (perhaps the most frequent one).  It is used
) o( G- B- y( y% m: s$ [: `  _to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 ^, d* j: h9 P* D& V% cor execute SoftICE commands...8 B8 q! ^$ r9 N9 F3 {" `, M6 W
It is also used to crash SoftICE and to force it to execute any commands3 w  P, y* M6 t5 N
(HBOOT...) :-((  3 J" C/ N* [% Y8 e, T7 j" S- h( ~
1 ?+ s& M+ x% M
Here is a quick description:- m7 x6 H+ o1 e+ N) V& F- ^
-AX = 0910h   (Display string in SIce windows)- x1 Z2 f4 J( Z  D& a: y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 n" Q0 [/ I# b" t: @4 T& H+ H-AX = 0912h   (Get breakpoint infos)
2 W4 M, E* S, g-AX = 0913h   (Set Sice breakpoints)+ `9 a) W* V; E; ~) S+ p) x
-AX = 0914h   (Remove SIce breakoints)
, y  i( }- G' g# r9 R
& C" l0 H9 L: [3 b' q/ i8 DEach time you'll meet this trick, you'll see:
5 B) |) ~( W2 H% ^$ D-SI = 4647h
& ^0 L+ y) ^. P3 |5 ^-DI = 4A4Dh
% v% l) J2 r5 x: s5 ^6 CWhich are the 'magic values' used by SoftIce.
" F/ K( c/ ]. O8 {8 a2 gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
; C) p  _( c" C& e8 G3 B% B) F$ I' I, C; I
Here is one example from the file "Haspinst.exe" which is the dongle HASP8 ^. h& g+ p) N0 p
Envelope utility use to protect DOS applications:
$ g% n, v8 p$ f& \' b, Z% ]7 }/ ~6 D' S

- W: E* w  D  C3 M' O8 J- c4C19:0095   MOV    AX,0911  ; execute command.3 t$ v/ D2 Y% l! I6 S: W8 M
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% K+ k, q) ?9 {
4C19:009A   MOV    SI,4647  ; 1st magic value.5 _+ t! x! v8 S! P
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! L5 D7 C' b2 G4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& a9 I7 o' j4 y& ^/ }! K/ G
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% L6 q# x" \2 z5 S  M$ |
4C19:00A4   INC    CX
3 N+ h6 O& M  [1 Y8 L) W# s; O4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ e/ l& R. p" R  b
4C19:00A8   JB     0095     ; 6 different commands.+ B$ t3 m. C) n6 Z2 B/ x
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) ^5 x& M( l4 M, [3 L/ ?4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
1 j; S8 ]/ E5 i5 D, p& @1 E% |
+ i; V2 l- c. [& I1 m: I3 SThe program will execute 6 different SIce commands located at ds:dx, which- Y0 }0 M/ l9 {( C
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
5 r; a% Z$ Q  F; l5 z: a
; p, l1 ^- {$ u2 H5 {9 O3 t5 ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 O1 n* W9 |2 P6 h
___________________________________________________________________________# d1 m5 ]$ r1 ]) R6 }

& u) `/ Y# G) |
% e; C5 T4 q: W! y' cMethod 03
) t, i8 H* ^( t$ P* @  o=========
, M' I: y; S4 v$ E# ?( l# d% l: o& I, G) u6 c; E
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* K. o3 |: m0 i+ _. Y(API Get entry point)( H2 C5 [6 X, [7 q3 H- _
        
! S$ b) u  \9 G( {- V+ C
+ d3 f" W. {0 y    xor     di,di
+ I6 H0 z8 O2 C7 P    mov     es,di
& m! H7 {, x4 m0 y" \, j  d; K    mov     ax, 1684h       + P' M" R: {  \1 V. c3 U$ U( v
    mov     bx, 0202h       ; VxD ID of winice# [' M7 Y$ h4 _3 _+ A
    int     2Fh9 h  d: \6 J. @, `
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, G  x4 C) |6 a8 |' \  a0 E    add     ax, di3 y* @2 e0 B# I
    test    ax,ax
$ J# l% m. F1 g1 V; L- E    jnz     SoftICE_Detected
" x' L$ A; n% {5 V, y1 j: M& R. \( l; k5 G6 t3 d! G
___________________________________________________________________________
- x: k0 ?# n- K3 I1 M' K
0 u1 _- s7 |& T2 l1 g1 A$ sMethod 04
# U' \: i8 ~5 O- t2 n0 K# n3 M=========% Q2 ?' v. m+ Y) E8 e' h7 \2 n

1 _! Z2 ~* ^: x5 H+ R2 z: x( Y+ FMethod identical to the preceding one except that it seeks the ID of SoftICE
8 K( M0 L' [- z6 GGFX VxD.4 Q  c, c' k2 j

8 {- r9 y( m# ?& O( _8 V    xor     di,di
5 Z1 l: X6 l9 f0 Q, R9 [    mov     es,di; I- x( w5 I$ x
    mov     ax, 1684h         e& r' x# s5 R4 N* S3 I2 G
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, u# O3 y8 l& {! X    int     2fh
' l1 ~. r' i6 q& L" n! }2 O  r    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 z0 o' v8 s5 x, T    add     ax, di
: N! w- a7 z( P7 g0 e+ q. R3 l    test    ax,ax, [5 |- s' Q7 b# ?  L3 Y7 q  B. d
    jnz     SoftICE_Detected! [& D( b1 V) g/ X: i. C+ J) z

4 f$ U. A) P2 ]; M7 L8 E__________________________________________________________________________
6 l: U( Q( K. Z0 K0 M7 i
8 O! g) m6 p; `" Y
) p. W" Q( s# f6 ]3 r1 SMethod 05
9 Z2 d9 h, x' ^( A# x) |0 {9 i4 ], j=========5 c4 S. ?# y- h3 {( X

, u3 C$ D  y7 n6 m" F8 g, ?  SMethod seeking the 'magic number' 0F386h returned (in ax) by all system0 [% ]# v" J( W. n4 W
debugger. It calls the int 41h, function 4Fh.
# J+ ^' \5 o' n1 A4 T9 C, t& C; uThere are several alternatives.  / j- \" O) e$ ]+ [+ s) G

4 H8 T+ W% a7 p$ U8 l1 k% OThe following one is the simplest:5 E  B2 {( \9 B7 \8 i; g

4 z( \0 ?" D) K; {    mov     ax,4fh9 I3 J/ a& |: P! y
    int     41h
3 [% l7 ~/ t* ^$ p    cmp     ax, 0F386
0 p' Z% q% O. t2 L8 l    jz      SoftICE_detected  j3 z) F6 E; C4 \! _. |6 z& U+ e
9 H3 c7 F0 A  R8 K- J5 g' P3 L

& q( u; y& d9 a; u+ oNext method as well as the following one are 2 examples from Stone's   `: o2 B+ `5 Y  s, _; d3 V
"stn-wid.zip" (www.cracking.net):- m' x4 f" K. n, i
$ ]! c# [6 ^* f* s0 E& C9 E$ e6 I
    mov     bx, cs+ i/ k' e/ a$ B
    lea     dx, int41handler28 j) Q8 u- c( [4 @1 J
    xchg    dx, es:[41h*4]8 D! {# I$ t% A% Y5 B
    xchg    bx, es:[41h*4+2]7 c# f5 I* x/ |/ i
    mov     ax,4fh
2 r$ N. ?. s/ H/ x! m    int     41h
% u: w8 b+ Z' o% R7 ?    xchg    dx, es:[41h*4]
4 }7 G4 m6 i' N( n% z( i    xchg    bx, es:[41h*4+2]
$ l; A1 d3 f/ y. m* e    cmp     ax, 0f386h
" ^- ^) ]4 ~% ]6 t- W$ ?    jz      SoftICE_detected8 ~, a6 |& r1 s8 U

9 o( h0 x, S9 Q' `! o+ cint41handler2 PROC+ v# P  f+ Y" R/ ]) d" C# B
    iret
& S' Y- t1 ^% F; @% |int41handler2 ENDP
4 a* ?6 v0 F/ D& _
+ K: }  C* T! p
4 V; H. V/ ]. Q0 W' A9 k_________________________________________________________________________8 P# _+ P. x9 b6 \

3 r7 n: A4 `, I" \0 Q$ ?+ @# ~8 P) i+ l% ?+ C0 u5 z
Method 06
2 R! P* X5 u0 j7 g" n  U% ?2 f& l=========
) M9 B' ?, k2 {+ z9 n# [  M/ G
( c; V% m8 D) F5 I1 i* g, s0 i; W  z& _9 r: Z' Q. U/ |7 d
2nd method similar to the preceding one but more difficult to detect:* ^7 i" b/ ?% ~; a. A

7 K$ c+ L: S% [( P! O/ i! T2 |2 X* z" E( G% O$ e/ [
int41handler PROC
' ~2 j' @, U8 f2 M, L( u0 R    mov     cl,al, j# T  c, s! S; f, B# F% v. h
    iret3 i( g$ T+ a6 d! N( n
int41handler ENDP: i# a* |, K  x) ]9 {0 z
1 f' ^) G6 v" A- R; r

+ E9 t$ m# p0 w9 G$ k% S9 |, `    xor     ax,ax
; T3 N+ z7 W: k    mov     es,ax
; n- d" o+ Y0 w7 J4 s    mov     bx, cs2 F% S  ?7 Y" b( `' ^# n) ?# ]
    lea     dx, int41handler
1 c2 \1 E6 b3 H; X' G    xchg    dx, es:[41h*4]
& V3 r/ n+ O2 D5 X1 s! s    xchg    bx, es:[41h*4+2]
4 L) b3 b/ Z5 I- Q( M  ^' E0 Z$ f    in      al, 40h  |1 n% T2 p0 ^3 o
    xor     cx,cx" U7 I8 r, y6 m; e! z0 _) g! h
    int     41h& g/ i* }# U- e. W+ `
    xchg    dx, es:[41h*4]
. i8 c; b, D& i1 r% q% S    xchg    bx, es:[41h*4+2]
# |0 }( z0 a5 k6 m$ s* K; w    cmp     cl,al
/ O6 p: m. t' I  E# H    jnz     SoftICE_detected
1 b& E& v. n5 K- S5 G2 ]' ~3 X! l# o- j. N
_________________________________________________________________________( X. T: O7 |/ m- {* S  l

' F; y, `/ K1 qMethod 07' J) W* B# A2 [* o0 n' Z
=========
$ ^3 a8 c- j+ N7 f3 q$ R; a4 ?0 A7 h* a
Method of detection of the WinICE handler in the int68h (V86)2 W4 a% c, u2 ~
) f% t" ]7 p' d* [- d5 W$ Q
    mov     ah,43h
0 |' Z* z* x6 t, Z1 a5 p    int     68h* i% ~# y) ~6 h) \1 C
    cmp     ax,0F386h
/ p) `1 `& `* w* o    jz      SoftICE_Detected
$ X3 C3 L& r" g7 {
* P; X6 d' U/ V# s( @% O7 y* M
: J# y* b/ W" _1 w/ g=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
8 ~1 Q8 C3 W; s7 P) B+ K   app like this:) \% E' p* S$ K

8 L/ t, |3 B3 z, J, x( U/ ?   BPX exec_int if ax==682 o' J, Y. X& ~6 t# P) K- w
   (function called is located at byte ptr [ebp+1Dh] and client eip is3 Y* ?. @' o7 `6 R! X
   located at [ebp+48h] for 32Bit apps), Z7 ^7 V7 d3 x( f
__________________________________________________________________________, h% b! Y0 ^6 m4 M3 P
8 l. E9 j" y2 v+ I6 x0 o/ B5 E( h

/ I, v" D% _1 y9 CMethod 08
7 }5 Y8 p) U' j9 c# V2 N/ J5 ?) x5 M( s=========+ Z: H* {: n2 t! \
& z$ V- |& q' [3 A+ j
It is not a method of detection of SoftICE but a possibility to crash the( @: E) `$ i& g& i, I9 d! n+ x
system by intercepting int 01h and int 03h and redirecting them to another
- X4 v8 R1 l% p7 V  Zroutine.
5 i7 h$ c# ?& a  bIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( o3 d! _8 |1 s, p  ?
to the new routine to execute (hangs computer...)+ R1 n( F! C) k6 X) q% p

: n1 ]6 \' h3 ?' X1 @6 a- |    mov     ah, 25h& o* _" a$ q, _/ g
    mov     al, Int_Number (01h or 03h)7 W% U, g( i/ B7 |/ |
    mov     dx, offset New_Int_Routine* X6 ?7 o/ S: Q+ S& z; E% ]
    int     21h
. H7 q) }+ @9 s' @3 v- O2 a/ t8 H
9 R# ]" v6 M0 {& ~! V6 s__________________________________________________________________________
8 K" M7 T3 f# n; }) n$ m5 ?
- j( q- }6 x' _8 }7 V" G8 rMethod 09( j8 I! U3 `; C8 s; n1 E- U
=========. u" k' V% W* l! \" K2 L

- U* p7 }8 c" R% i9 SThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# y/ [) Q. G, b! R. c3 x1 [  ~performed in ring0 (VxD or a ring3 app using the VxdCall)./ ^9 Q8 e1 M8 q1 C% U$ _
The Get_DDB service is used to determine whether or not a VxD is installed
% g( `# X3 |3 T9 B6 h  a# _' a+ _for the specified device and returns a Device Description Block (in ecx) for
. W4 b* f0 K$ {- c$ Lthat device if it is installed.8 c3 d) m1 E: d3 y5 f% u
8 T3 m. c( n) b( \% N" G) i% f
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% q; P# K- ]+ V( r+ S   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
0 {* w* A, n3 E+ @! m+ X   VMMCall Get_DDB% Q# X6 ?' B3 z+ q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- g# r6 f# G1 E4 [3 J) r3 U, ]1 `# _  b% q2 W2 ^/ Y* i
Note as well that you can easily detect this method with SoftICE:& R$ n# B* p- }9 F/ s6 ~5 `! I
   bpx Get_DDB if ax==0202 || ax==7a5fh, k* t9 t, f) w/ \: O/ @3 E
- V- r0 U1 A# F) M
__________________________________________________________________________
8 V$ |  I) J( m$ f3 }+ }1 X- M) e2 E2 R7 a
Method 104 {5 j6 i* z  j. x, I
=========
7 O- s% S1 \) u4 E. g3 t/ F/ s2 F* S2 V- W) T
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
# N, E) Y4 T$ ^3 T: u$ H, p  SoftICE while the option is enable!!; e3 d. T( I& g4 a8 {3 [

4 A! G% Q4 T  r, z( ^This trick is very efficient:  ]* c2 @8 R8 w, b8 W
by checking the Debug Registers, you can detect if SoftICE is loaded
- N% N/ t" }0 r- I6 p  `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 l8 `5 v- A* u  z# ]there are some memory breakpoints set (dr0 to dr3) simply by reading their
/ M! f: p  P# S6 \9 E% evalue (in ring0 only). Values can be manipulated and or changed as well' [! H# z3 M4 \5 B& _2 T
(clearing BPMs for instance)
2 O6 Q1 x* z2 @+ r( p2 f/ s
5 t; D- c3 e! t" ^' z__________________________________________________________________________
( g; T$ s+ o% ?3 M! Y' E; ^' H! o! L- B/ Z% K0 Q+ g0 l
Method 11
! R9 ]; y' a7 u$ S" u, ?=========  M8 g4 ]% M* P8 N: g# f) Z

7 l" c) K/ P. \/ [$ X" U1 Y; UThis method is most known as 'MeltICE' because it has been freely distributed6 ~: ?8 t$ N- g4 W' Q5 a
via www.winfiles.com. However it was first used by NuMega people to allow
7 O5 g  B, Q; K0 h6 G' cSymbol Loader to check if SoftICE was active or not (the code is located4 j5 c4 _7 a  T- o  J
inside nmtrans.dll).
7 l" D3 w/ G3 M- q2 g6 I" U5 i* T1 A) T  ^! q
The way it works is very simple:
. x2 L% ]2 s6 g! d/ ]: @7 qIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 M- X2 Z6 c6 W* L- k
WinNT) with the CreateFileA API.
4 `+ n' y5 f: u6 ~$ y% d- Z( R7 Y  _, M  E: p
Here is a sample (checking for 'SICE'):
; ~9 C1 t; I+ j0 E7 g' [9 [7 J
, R$ }' @! v4 t$ C( y7 NBOOL IsSoftIce95Loaded(). f1 |/ b7 f& n3 k! n( I5 F( Z# \
{2 Q8 j' ~6 Z  g2 e  s
   HANDLE hFile;  
+ T  z9 D0 o1 I) S   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. M! X. b5 H! R  W$ ]/ z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ J/ E4 Z3 t$ h8 K5 B+ w6 z                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 _( `+ Y; O' ~9 J8 g; B
   if( hFile != INVALID_HANDLE_VALUE ): O; |) p( r! e! O, H7 o! b, A0 J
   {
$ K3 p/ H) H& d1 {  ~# k' C      CloseHandle(hFile);: q5 i* T' ^2 @6 ]
      return TRUE;" h# ^7 N  x# ]
   }: G! L% m+ C. M0 s' {
   return FALSE;
' B& d: I0 c' Y! \  E" o' y}# P$ u7 V. v# Y( K2 c4 e
9 e* _$ J' r+ E! g. f2 w
Although this trick calls the CreateFileA function, don't even expect to be
. s% L& A0 u! Rable to intercept it by installing a IFS hook: it will not work, no way!
9 @. ^% G. t# I$ nIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
  H& s1 }) J2 z5 n  Mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& }% D2 O& c) H1 r; mand then browse the DDB list until it find the VxD and its DDB_Control_Proc5 w5 O9 P4 ^+ H; ]0 i
field.
1 {( A( J) i" yIn fact, its purpose is not to load/unload VxDs but only to send a 6 U2 }! M0 I3 I( f
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). k+ U: n2 @/ P8 \
to the VxD Control_Dispatch proc (how the hell a shareware soft could try) _1 c7 _& s$ G* f/ X
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 Y6 z& {* ?0 ~$ i3 a& YIf the VxD is loaded, it will always clear eax and the Carry flag to allow* K7 e0 e+ Z' w# F
its handle to be opened and then, will be detected.
+ ~- x. @1 p, ]" kYou can check that simply by hooking Winice.exe control proc entry point2 M9 F1 g' A6 ?' ^6 _
while running MeltICE.* @/ E6 ]; @. K
$ D% e% L# E  ~) b' L% {

; N* N3 j; B# E+ ]! j$ m  00401067:  push      00402025    ; \\.\SICE
$ x( P/ u, l6 Z' P. Z  0040106C:  call      CreateFileA! p$ u- W# f/ }* b& i5 T
  00401071:  cmp       eax,-001
& f; M/ A. Z. [& f6 P2 b  u  00401074:  je        00401091! w! A6 U: b/ L1 H4 ~% Y
; c+ d" h' m9 T1 I
) U6 ], P* r( Q- y% k' d* l! J
There could be hundreds of BPX you could use to detect this trick.
# |; G0 }3 G/ N$ s-The most classical one is:
" |9 I( [- ]/ c: ]: f  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
. r! {: L7 `5 _# z    *(esp-&gt;4+4)=='NTIC'
- d; a# X" \% a; O& Y+ E
3 F4 R- N4 k! K- x" p6 u-The most exotic ones (could be very slooooow :-(8 B+ B4 S  ]+ o: g. s# s/ l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; `3 b8 x! v. y  l( G4 h" V4 ^2 Y     ;will break 3 times :-(
- J' Z4 b2 ?6 y* _, R% o
  X; C/ B# m5 ]# v5 Z-or (a bit) faster:
: h, }" v7 o' P. V$ A% g; Y   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# a) C! q- @: L9 s2 g
5 S9 ~: B- M1 s& k1 u6 ]4 P4 c0 T
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 `& J6 h" c% D* E) T! M     ;will break 3 times :-(
' D1 E; g) N6 s; x
: `9 z7 [. T% i5 p6 \, H-Much faster:
* |7 w$ ^/ q! E   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ ]: ?) w5 o9 s# }
$ Z# o- ~5 Z2 i0 @) s4 GNote also that some programs (like AZPR3.00) use de old 16-bit _lopen  W0 n# N' A+ g0 q7 M# M" ~, z
function to do the same job:
, K( _* Y  j5 R% X, C
8 Q5 q- f0 m3 [* V) U& A. r1 x   push    00                        ; OF_READ
/ S$ _1 h% \1 Z, w4 h. U: |   mov     eax,[00656634]            ; '\\.\SICE',0
$ c( K, \8 G0 O5 S" p3 q! c: S   push    eax3 B# R# J7 H; e  x3 c
   call    KERNEL32!_lopen6 D8 t5 o+ x+ I5 r  [
   inc     eax
  m, V7 I5 o7 O1 V1 A   jnz     00650589                  ; detected% x- q# A: k9 U9 B% J* r. M
   push    00                        ; OF_READ4 k) H& S  Y* Y* |
   mov     eax,[00656638]            ; '\\.\SICE'' @: d( M/ j. g; C% L+ u7 Z
   push    eax2 {' t) `$ L( D5 y6 B& d
   call    KERNEL32!_lopen
* }8 h/ ~+ n- p( j   inc     eax% s# u9 V2 U; D5 B$ o
   jz      006505ae                  ; not detected
: d7 G6 u# T% O$ |  T/ s' a5 M/ Q8 ?0 j5 R9 g+ V4 d1 {$ M
: J6 Q8 V  I+ i6 m
__________________________________________________________________________
: l6 ^- f7 O' q( y) t3 k$ u5 ^2 N, n& R3 C+ _: a) J$ e0 n
Method 120 t* P( j; e3 k4 L
=========
8 |7 T9 P" E' ^, Q4 w- F0 X7 Y5 X5 O' f( O6 N) F
This trick is similar to int41h/4fh Debugger installation check (code 05
0 }7 D/ C+ l3 ?; w2 o: m! W3 ?&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  |5 J+ }9 w/ m: Was it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 W5 V, Q7 ]. N* d
7 ]% E2 @9 l9 Y* ^
   push  0000004fh         ; function 4fh! g8 ?' v9 u1 \& \& ?1 k4 Z
   push  002a002ah         ; high word specifies which VxD (VWIN32), [% O' l: s% p
                           ; low word specifies which service
' P* {% C1 v& G% q( h# l0 i                             (VWIN32_Int41Dispatch)( L5 ?0 T! u9 `) E3 M1 u: C  O! T
   call  Kernel32!ORD_001  ; VxdCall
/ G' j/ M( A& D( k- [: @( T   cmp   ax, 0f386h        ; magic number returned by system debuggers
! d& q0 F* p9 \) l# ]; |! ?   jz    SoftICE_detected" E3 ^& K# ^1 F6 X7 q

4 W; r9 ^1 ~6 E$ yHere again, several ways to detect it:
7 O1 B2 s+ G# i0 ]" c! B( B% |+ D# A6 i8 w
    BPINT 41 if ax==4f
- N! L3 X( x% y
) j' {" e; }6 U% ~& q( }0 d: q- {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& G1 a- _" n3 ^2 S, i
* L& F9 K/ X! H; S' A+ a: i9 x
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A1 f/ c6 l% M1 Q1 b' G4 N% U* u) W

, f" S" {# A& s6 U$ R: |: f    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 j/ x- I. ^2 n7 ~7 [
3 G7 @" |& y9 V! A# {7 F
__________________________________________________________________________
0 q9 m, v; a5 K* X: ]1 Y: m0 L
8 W4 b  D. U5 w, A# NMethod 13# N- f! ?5 T% U$ g* |
=========
' N2 L# a# U$ t$ m# h& p) ~2 c
Not a real method of detection, but a good way to know if SoftICE is
1 s! o. R. {+ n* D, {$ kinstalled on a computer and to locate its installation directory.8 ^+ A9 b/ o6 ^0 A+ x' a3 F
It is used by few softs which access the following registry keys (usually #2) :
& L& f1 A0 l1 X
, u: J" h' `- c- Y$ S$ m7 t-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- }( u& s! k8 _# i8 y' }- W
\Uninstall\SoftICE
: f8 c7 Z- A6 s2 v-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, d  z4 G7 F* Q1 S' l/ g' f
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% r9 V2 N* o7 y7 ?/ u* N
\App Paths\Loader32.Exe
9 }3 q( K6 A$ s. I2 K% j- l9 W0 G

  z* D. z; y& t* f9 J2 iNote that some nasty apps could then erase all files from SoftICE directory
0 `5 V5 q3 q1 L* [# d(I faced that once :-(% \; r7 t' x& B* C. E
6 b3 J& J9 x% |: Y( c, Q3 C
Useful breakpoint to detect it:6 E  ^, t4 e' B2 B- D6 a7 l
. Z# w6 c5 c* s/ F
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; i; S% d, e6 `5 u
: \! S* X- ^, M3 ^4 R  e; a% N__________________________________________________________________________
" S: \* {, r, G" c( r
  W, K! a# J7 m& `8 O5 b( ~! G+ B8 z' m
Method 14
# X3 ]' Z/ Q: x+ @2 U) T=========
: n! o/ C. P- q
! m" Y& A) r. v$ K1 B; `3 P. n2 }A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% s. B  F+ Q5 ~, s5 {
is to determines whether a debugger is running on your system (ring0 only).
, c( q# c: |* A* \0 x9 Z- |2 r* O7 ~  z& \9 {9 ^6 h* D+ F
   VMMCall Test_Debug_Installed
6 B9 F5 N* y. E7 g   je      not_installed# T' w2 _$ f8 o& s

7 H( ]  r  R% J9 |$ C, MThis service just checks a flag.
0 g: O- O/ q" Q' Y7 v9 B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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