About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% j/ ?+ s; {0 |% q6 X# O
<TBODY>- `0 }9 W' l# k
<TR>
" i4 R0 ?5 @' Q% ]( ~0 ?<TD><PRE>Method 01
5 Y6 s; u0 E1 O; ^' @=========" C5 q) T. Z; G3 g$ r5 K( |

  @8 b/ S1 ^5 zThis method of detection of SoftICE (as well as the following one) is
- T! N) u8 O, K6 C! H8 o. O: pused by the majority of packers/encryptors found on Internet.
; |' G, y3 P. `+ v. YIt seeks the signature of BoundsChecker in SoftICE! y( k! h2 p1 {

! q' f5 L  P2 p( I    mov     ebp, 04243484Bh        ; 'BCHK'
' _2 I3 ?! O9 y7 a7 \1 k    mov     ax, 04h
; ^" n$ ], Y/ w% m6 b7 h2 c* r    int     3      
4 [9 v8 I1 a/ K8 F* m    cmp     al,4
5 w5 t* m( Y4 |  A# `    jnz     SoftICE_Detected
( i% m9 @5 R. v% M8 J6 h2 _/ k, ]4 t% Z: i1 N$ ~2 @6 R
___________________________________________________________________________4 J/ K; X! [4 C$ d1 a, D& f
9 y- Z5 ?" d. n& R5 ~1 G
Method 02
* H* g  C9 R/ _=========
0 F! S: x: G# b) M8 c7 k. R. K" F" B# X* ]2 {$ c0 Z' g
Still a method very much used (perhaps the most frequent one).  It is used5 f! Y! `. Y- v
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,' ~0 h( Z2 O& m- Q
or execute SoftICE commands...
6 X3 T: V9 P  q, M7 }8 C9 [It is also used to crash SoftICE and to force it to execute any commands( q1 i  @6 v+ P+ T) C9 S1 |. Q
(HBOOT...) :-((  
1 ~3 f! ]6 H1 s) u  ^" j) \6 I& S4 e
9 f$ `3 V0 t2 [' S, mHere is a quick description:' ?) n! t9 s3 L7 y  ~
-AX = 0910h   (Display string in SIce windows)
$ g1 y9 `- m7 ~4 m( {-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% T. g( \1 g0 X" c7 i
-AX = 0912h   (Get breakpoint infos)
5 O: l" F' w0 e6 h6 Z; }-AX = 0913h   (Set Sice breakpoints)1 m3 c/ V0 w3 V
-AX = 0914h   (Remove SIce breakoints)
" l& f2 d/ e% _) t# h$ ?- ?1 _; w6 [) B* g
Each time you'll meet this trick, you'll see:3 W9 u% `0 S0 d7 l$ [  A
-SI = 4647h
' `1 o/ T! Z; U$ @, Y' T-DI = 4A4Dh
2 G8 Z/ i7 e% a9 o9 xWhich are the 'magic values' used by SoftIce.' e+ l0 h8 H  \$ I2 |
For more informations, see "Ralf Brown Interrupt list" chapter int 03h./ a$ L/ t! g3 y0 Q! w

; W# o6 {! q2 x: qHere is one example from the file "Haspinst.exe" which is the dongle HASP
  w, H' g* x& W+ c" N/ zEnvelope utility use to protect DOS applications:
& X; ^; q1 {% m, \; R! `( W- w* o6 `3 i: Y+ c* M! y$ |

) m0 u( _+ u$ x: I/ J4C19:0095   MOV    AX,0911  ; execute command.
4 P# g  k$ w. t& r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).& T) T5 g1 _4 y) v! Z* N
4C19:009A   MOV    SI,4647  ; 1st magic value.
, N5 ~9 s( F- I$ l7 O. }4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- z4 a% Q! a, ?7 P8 p. p
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- _& z2 ^# z& s' I0 S7 ]4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
6 i  c& |) c$ B9 e3 S( D# r' b, e4C19:00A4   INC    CX
/ @' W: B  V6 \2 c( d, F4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ I0 c* s* T% s( g0 W% C8 d, Y
4C19:00A8   JB     0095     ; 6 different commands.
5 b2 |+ d8 u5 l- N; @! J4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 m4 @- d  q' Z
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" l8 |! o3 [. Y  G
( f2 Q% g6 n. n% Y$ U
The program will execute 6 different SIce commands located at ds:dx, which
* r" O2 j$ `( \/ x3 Hare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
/ N! ]! b+ D0 ~: l( Y
* L" F4 y: p6 g/ t* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.7 A6 K+ ]0 U& x. f8 [
___________________________________________________________________________
( |; c0 r. X8 I1 i
; t" z; g9 E$ i1 p% f
! `; `) x1 _) b0 x4 B' \+ d4 a( R4 BMethod 03
; |5 c" U# J5 o1 H# ^# m=========- Y/ E) T4 a+ m

2 A* o- n( p$ |9 b. `Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ }0 M5 V! w- @- M(API Get entry point)6 A# x0 C' N6 B* w  O! p
        / U. F# [* K) O

6 g5 ~1 W- l7 n3 ], n  R* `    xor     di,di
3 e7 a# _' \6 `4 S- G" P( d" k  L% J# y    mov     es,di6 k: t$ q! V8 W# a( f% [9 ^
    mov     ax, 1684h       0 m% o/ ~6 @- }) X1 \: c, {
    mov     bx, 0202h       ; VxD ID of winice
0 ]( D& ~, n: p1 ~( Z9 T3 c    int     2Fh
, H  R2 s+ U: b; z7 U- q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 i% Q2 P' F/ n+ U' x    add     ax, di
3 ^9 s" E% g/ ?9 }! e/ l3 x: i8 B5 E" L    test    ax,ax5 c1 n% [- z* m  {# n  B
    jnz     SoftICE_Detected" ]; g- \9 i  o% L# {/ J( F: W* A

; |& g  f2 ?. x1 ^9 z1 `___________________________________________________________________________8 |1 H8 ^6 D: A, i

4 n" Q8 f- t$ T7 T' ~* p) cMethod 049 S  ]6 J: w  k9 U; [: r
=========4 X! Z  q) w) d: E% G

  G0 ]. D( n- V, O* x; x9 LMethod identical to the preceding one except that it seeks the ID of SoftICE
% V2 W1 _" P# |8 r2 I/ ^0 HGFX VxD.
9 C$ z9 z* X+ x0 a0 k! |; ?* `
7 F% r  Z5 @% T, n9 H! c( B9 L    xor     di,di
9 ~% ~' e# [% J. X( Q  E! O    mov     es,di
7 `" k: f+ K* S- X  [    mov     ax, 1684h       5 m2 G5 k& \5 T
    mov     bx, 7a5Fh       ; VxD ID of SIWVID" t# r6 o; C4 `9 a! J6 D, l
    int     2fh5 P! V* j$ `$ s8 \3 ?9 a" M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) L! h' c. \/ ], V# b" W$ T
    add     ax, di
" A. E+ X+ F/ L; N    test    ax,ax9 a, D, q3 ?! k0 C: b
    jnz     SoftICE_Detected
, g) z) h& f7 v6 C. }
! `, Z. U0 B1 u__________________________________________________________________________
& H) |- J( d1 r6 ]9 z9 j1 w% p+ q: |- O7 s/ Q7 x+ x" i( a

" V* j' D1 C7 _8 Q; P# |! bMethod 05. k6 _- n2 A4 N/ Q
=========
2 |7 c& i% B& K# }' @
. m8 D( V7 Z9 ZMethod seeking the 'magic number' 0F386h returned (in ax) by all system
  x2 {- `' D6 P. d8 x8 M3 Q% ?debugger. It calls the int 41h, function 4Fh.4 \3 [* x! Q! S/ \
There are several alternatives.  + e2 k1 s: `$ a8 P3 f8 H+ s

6 n$ E+ u5 P! _; p) \The following one is the simplest:9 h  @- z6 S- D% M: E& i

- f. |8 j; C) Y) X6 w    mov     ax,4fh$ R( i6 z- I# t$ k1 I
    int     41h
, p! J+ x5 \, r. t    cmp     ax, 0F386
& ~% _3 V' u; d9 }: m. H' l    jz      SoftICE_detected
- r9 G3 r; `  T" z6 ^  ?3 p
" }3 J/ e" L: @/ w7 i+ V9 ]' h" l9 L: R5 }" e" c6 S
Next method as well as the following one are 2 examples from Stone's
+ p; d+ Z0 ?  v"stn-wid.zip" (www.cracking.net):
8 Z& M$ b7 Z0 R- H* I. U
" p! R5 x& J* p9 g2 R    mov     bx, cs
7 v" Q+ k+ X' p/ s1 {+ B2 m* y; D. G    lea     dx, int41handler2
/ F+ \! p4 F7 P8 `; R2 y    xchg    dx, es:[41h*4]) ]( W% [" `' l
    xchg    bx, es:[41h*4+2]5 l. i- H7 A9 g' {
    mov     ax,4fh, a( u+ k- [9 @: ~
    int     41h
* m  Y: _( ]' }3 N! O2 j7 H    xchg    dx, es:[41h*4]3 F7 e& O+ G1 h1 w1 f
    xchg    bx, es:[41h*4+2]& @8 q9 u+ l, D. p
    cmp     ax, 0f386h
8 k5 w6 M$ T( f' C4 [4 ~    jz      SoftICE_detected
! L1 |  j; }7 u9 s# T" W( U( M# n, _* p9 u
int41handler2 PROC
, d  o( f; N0 Q. o- H! Q2 s0 P    iret
) J+ u; G, Y) N5 I+ H; A+ o8 Kint41handler2 ENDP6 m  T" B# k2 a

5 T; b3 N" k2 S
+ N( S, G2 b* j3 T$ M$ @/ B. a_________________________________________________________________________& G2 p6 t- p+ a! Z

! E3 T1 z5 k' N
% A2 s+ f0 k- _+ K! HMethod 06
" E, O7 d% S% \- y( i8 j* A=========" r4 B8 J" T; u2 M
7 n) e6 e5 h7 E5 A5 F
+ l& z8 s6 G: B* l. r8 z, S
2nd method similar to the preceding one but more difficult to detect:
# G/ x; t: Q% D2 U. b: X# f9 a/ g+ W' r- g' r" ^7 s; J

- _7 E9 m; ^0 U7 U& K: ^int41handler PROC
: ~  [9 l$ j2 k) S+ J& S9 k  M    mov     cl,al
" ^; ]0 e+ M) D- q% {    iret; o7 L: `, A3 ^; \
int41handler ENDP
0 g6 ]* x4 C, j' Q6 {7 P7 X1 D! ^
% u% z; ?, P+ n0 y9 ^$ |8 d. d' Q' I- X2 F4 h7 u' O
    xor     ax,ax  b' o) }* s% k( w. L
    mov     es,ax  g2 m5 w/ f( M% Q* ?# }
    mov     bx, cs
7 k3 s  x1 W2 L, ?4 l4 ^: j    lea     dx, int41handler0 k# D2 \8 @! D" p
    xchg    dx, es:[41h*4]; V  a$ O( i: V
    xchg    bx, es:[41h*4+2]
( K3 r. r% R( ^, \, c; u$ E    in      al, 40h
, X4 l4 O7 w( X7 _2 V    xor     cx,cx* u' o7 ?3 R0 i( K
    int     41h
( s$ F/ q; T% w" @. d    xchg    dx, es:[41h*4]
: n" Q" c' X( s# E- {. A, C. O  V    xchg    bx, es:[41h*4+2]
- X, ]8 D2 Y5 {$ L* ^    cmp     cl,al
) K# k& I$ f/ @5 x/ U; P    jnz     SoftICE_detected# b8 e0 v& o3 ]+ V! d- E
9 t  Z' k& {9 f
_________________________________________________________________________- q1 U4 V! ^+ K' z7 I$ x5 Y- `4 p

8 t+ k( [$ |6 N- h5 ^* i! ]Method 07
& O1 W, q, t0 {; e0 G2 K( m' g=========3 [" @. p7 h9 ]2 }# W
3 E& _3 I5 B* O, z; L- U/ c
Method of detection of the WinICE handler in the int68h (V86)/ v7 q2 p: u% F/ N/ M2 {
; A. F% O. e1 J; @% e* Z: P
    mov     ah,43h" ]8 [/ K; j8 P
    int     68h
" A+ q4 ~  O4 H- [, [6 `    cmp     ax,0F386h9 u+ m3 B" U8 B0 J( U
    jz      SoftICE_Detected% U, B6 h$ `$ i* V8 m
/ ?5 u& v* }) F! Q5 \# M
" S& J/ ^1 _6 U( z& b
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 ?8 f, d% d2 ?" z4 J   app like this:5 \" \* x, f0 u# r

7 q' d5 i9 @6 F& B' g   BPX exec_int if ax==68
, x0 A9 Z% l5 z3 R5 z; c& k/ F. V   (function called is located at byte ptr [ebp+1Dh] and client eip is6 i$ t4 b' o: `: E+ x
   located at [ebp+48h] for 32Bit apps)8 s4 ~6 n3 C3 A1 k* n
__________________________________________________________________________" D) L# [4 B6 y0 a' d
9 \. Z$ m$ ~5 K& G: w1 d, T; k  X
4 N# {6 o6 i0 z
Method 08, [  x% b" R. `1 Q8 q+ }+ J; h9 P
=========5 i) V6 q" m. f, h% x7 P4 k: S
# J1 P2 l$ R- b4 g7 I. p. f! W; L
It is not a method of detection of SoftICE but a possibility to crash the+ c( g$ \  ]( {8 J
system by intercepting int 01h and int 03h and redirecting them to another  [( z3 g' f7 J, E( M% w
routine.) Z; P) S" [2 m8 M9 E) v
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ R* M: O& y" }9 g2 u" sto the new routine to execute (hangs computer...)
5 Q7 U8 ~& y) Y9 ^9 R! R
( a. E' P3 g2 I- N    mov     ah, 25h
! z8 ?. c! H& ^. ^$ e    mov     al, Int_Number (01h or 03h)
* f. Z# f# s9 n- D  Z2 V0 h    mov     dx, offset New_Int_Routine/ v7 j3 ]* _) w8 \: l
    int     21h
& w5 B' V1 m; G' Z  |" k: R( G. y( z. Z
__________________________________________________________________________& V- L' C; H) }1 i, ^, @

* }( D- }0 @* R1 jMethod 090 s; Q7 j2 s& w/ Z8 o* g  M& j
=========
/ R0 p* A% p" x7 l* u) F" g% y
; J9 `. g  f' ~$ wThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" z2 k) Y# l+ c' ^3 C" t& Bperformed in ring0 (VxD or a ring3 app using the VxdCall).# k) @. _. P! G* Q
The Get_DDB service is used to determine whether or not a VxD is installed
  i2 W8 l3 C5 \8 A$ hfor the specified device and returns a Device Description Block (in ecx) for
! F; p0 N  T% E& C% d+ Q: f, [that device if it is installed.
( v: i1 e6 ?9 I# d* R9 v' M% O. D! A) W: _- @- U( F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: [) V* B; {; b; J" Q0 C9 t: ^; L0 Z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 q& N: @* r8 |0 N. T   VMMCall Get_DDB
8 i% S9 K" u3 q  E6 p+ G   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 C' q, X, y8 i" a+ a4 \0 J: C
4 u7 U) A2 c6 ^* O, |
Note as well that you can easily detect this method with SoftICE:) E8 O  B3 r1 R
   bpx Get_DDB if ax==0202 || ax==7a5fh! M9 B# f* w- Q# L& y+ l4 X
9 h: F  L. W+ R% }- l
__________________________________________________________________________) a, @9 k' z. J7 {6 ~

5 [0 w3 P" V: K/ O& B2 NMethod 10! P" `& s2 w* x" F6 ^2 o6 U
=========
" _' u" @9 @. J2 y' h6 M$ g+ E9 [
' a6 S1 X# k! P* X. V! ?; D1 [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% k  Z( Z& i" j$ {% O9 i  SoftICE while the option is enable!!
, I* z! I+ _: @9 q+ ]7 v& [' |6 [8 X9 a
This trick is very efficient:
3 d: t  @+ C+ ^8 g; Q1 h4 Sby checking the Debug Registers, you can detect if SoftICE is loaded' h  V% v$ l; w( m7 e; R$ u
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
- Y& M$ L& c; T, ^- U5 ?there are some memory breakpoints set (dr0 to dr3) simply by reading their7 J. s8 M/ G# ^8 z$ \; F
value (in ring0 only). Values can be manipulated and or changed as well
/ ]- B4 p9 l# c(clearing BPMs for instance)
0 \+ H, i: O# |- N% Q
8 ~- u/ p5 c) J, t$ y1 ]( D__________________________________________________________________________
* v5 |4 c" u) {3 J( Y3 N- h% \  u! N6 T' E5 B/ A
Method 114 X" _7 d) `; l1 l& y- n
=========
/ C" ?5 X2 E3 m1 o! J
( R+ N+ ]- H" M1 H  d! \This method is most known as 'MeltICE' because it has been freely distributed
6 {9 @! w. m6 `) _" bvia www.winfiles.com. However it was first used by NuMega people to allow
' p) X! Q  Y5 u$ |8 ASymbol Loader to check if SoftICE was active or not (the code is located
8 z5 o5 ~# a. ^# t+ G- binside nmtrans.dll).
" o; l2 Z( u, Z' P3 N8 X
, O9 D* i0 U  ]: c. `, }* T" |3 q+ NThe way it works is very simple:
$ i$ \8 x; B5 T% `2 R1 TIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ Q3 }4 @6 J$ T) N" o& y
WinNT) with the CreateFileA API.
. x! I* \3 `- K0 m0 ?+ N, _; K) p0 o7 Q
Here is a sample (checking for 'SICE'):2 Z' [+ R: [& j0 U( J( J8 _6 D) w

5 H. e; q- E/ w! ~BOOL IsSoftIce95Loaded()
6 T0 u5 N% n5 M3 u9 ~$ a* e, r$ K{# ?( w5 g+ H. [( T5 R; D
   HANDLE hFile;  
) D( Y2 }4 I! d* ~  ?( Q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,/ J* G4 c0 R4 u8 j9 s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,! T/ I! `% |3 l: L! B0 d- m# c3 ?
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);! T3 p- G+ `4 x! Y3 a
   if( hFile != INVALID_HANDLE_VALUE )) ^8 }7 N6 @6 z, p( V2 W( p
   {
# f$ a8 q" M+ \: C: C* x; M9 a& K      CloseHandle(hFile);4 _% ^/ l. a& X7 f7 |/ F& Z
      return TRUE;
  V' A7 t# K* ]1 o( T   }
9 @0 n" l4 @- W5 q3 N- [   return FALSE;% t& W. E; h" N7 R- M
}
' _8 k" ?3 P: q& v# d9 e7 q  G) Z$ `& a2 N3 x
Although this trick calls the CreateFileA function, don't even expect to be6 I2 Y. B; A) {& K) P$ E; N. t
able to intercept it by installing a IFS hook: it will not work, no way!
5 x! Y/ Y. r0 BIn fact, after the call to CreateFileA it will get through VWIN32 0x001F' S  J5 M/ S% o3 J+ k& Z! _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 X- C6 c8 @$ v( e) Uand then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 W4 ?5 v1 h' W+ g- Gfield.$ w! t& P; ~% f' X8 d9 m( Y; d( b
In fact, its purpose is not to load/unload VxDs but only to send a
+ X. P& S2 ~- I5 d0 HW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 V( c" H# b; vto the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 A/ C: {% f" J, ?to load/unload a non-dynamically loadable driver such as SoftICE ;-).
- f6 o9 _9 {( ?/ u0 i; wIf the VxD is loaded, it will always clear eax and the Carry flag to allow
# ^3 E3 ]/ a; x# c$ W5 kits handle to be opened and then, will be detected.! `3 @" d" r9 |9 h; B9 W% g
You can check that simply by hooking Winice.exe control proc entry point
! {9 P  l% n; ~# U" ~& Rwhile running MeltICE./ C3 N  `; [; T: ]& ~/ W6 q
8 D; ^; X: ~# d' W+ S! E

" D. _1 R/ p/ v- `) Z( `  00401067:  push      00402025    ; \\.\SICE
$ y5 v- j2 k; O6 _! s5 F2 h  0040106C:  call      CreateFileA5 h0 h9 b8 Y  n
  00401071:  cmp       eax,-001
4 s! G5 M7 b! `' v" g! ^  00401074:  je        00401091
. a& m! j- S, G8 }
, O* i' v% p# H$ Z: K
6 J4 g2 r& h- T# ], ZThere could be hundreds of BPX you could use to detect this trick.7 H7 W) i& E% V. O8 w* P
-The most classical one is:; h( A6 C5 K- z& V$ h
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 N0 O0 n  j) s
    *(esp-&gt;4+4)=='NTIC'+ F' E# ^$ ?' T+ v- n* a3 r
/ s2 n0 T' R# V( N- T, _( @3 L
-The most exotic ones (could be very slooooow :-(
8 q9 G8 t" w8 G  M8 ?   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, C3 z  l  I) R$ R  V0 k     ;will break 3 times :-(
7 I6 d: c' l* F+ w6 \5 S  {+ I6 s+ J! m3 J
-or (a bit) faster: " s) J4 ]* K8 v* [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 s1 j0 V+ \: a+ s

2 b4 x6 I# f( W3 d, u; `8 v   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
' g, N( F( u6 T5 I! b) j     ;will break 3 times :-(
( w- }4 z: x% l4 u, {" o: J! {' r5 ?2 P7 p5 Q6 B% W
-Much faster:3 ?. q: D$ i4 g* a! y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ H9 f( v: Z: S- H0 S8 D& _) G1 b& N8 {: b( S
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ Z; G) \# G" d2 Vfunction to do the same job:
6 `' z6 Q# I8 C% Q( P# W0 ]
$ ~2 t7 Q# l2 _& }0 r% a) z   push    00                        ; OF_READ
  L5 E1 V: ?  j   mov     eax,[00656634]            ; '\\.\SICE',0
, M* m' Y; h6 M; i* A( }9 Z9 ~9 z   push    eax
, ^* B3 c! H$ c. U0 E   call    KERNEL32!_lopen1 k7 Q& T4 f2 K) M
   inc     eax7 w" K6 q: u8 Q+ s: k0 L& r
   jnz     00650589                  ; detected
4 M! R3 x, f& n" [5 O6 u   push    00                        ; OF_READ
$ f/ R" Z0 K/ g   mov     eax,[00656638]            ; '\\.\SICE'
5 Y( t% ~2 U8 t( l  p& R   push    eax6 J7 k! S, b2 W/ U" c! Q1 I1 G
   call    KERNEL32!_lopen$ D, o8 C7 I! O
   inc     eax' }7 Z$ U, h8 K6 }, t$ c
   jz      006505ae                  ; not detected: @) S6 \' g8 ?  F
, w$ b; ~* v; N# I, u; C5 n3 o$ t. x
5 v/ x- `% Z; Z5 w; W
__________________________________________________________________________
0 t( h% x" N/ g% @9 [* b+ C5 G0 Q. m, F6 o8 [2 y& \8 L; }! y
Method 12
/ P5 o; E- Z4 o( R) b=========
  ]0 H7 B2 Q& k, `) o1 C; g1 M8 q; ~0 Z0 L4 \# `( f% S, b( V; n: \
This trick is similar to int41h/4fh Debugger installation check (code 054 l* f" `+ ?  Z/ r8 G9 A5 q; k- S
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
9 Y2 m$ E: E9 aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.8 B$ t' T* O" c

5 S% L$ c3 ?% s0 g  s7 h- y: w   push  0000004fh         ; function 4fh
; }) \6 y; D8 N2 n6 h7 D   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 z+ J- o0 q1 v5 m0 Z0 a                           ; low word specifies which service; g8 V: F3 t  D  {* @( z# w
                             (VWIN32_Int41Dispatch)
1 S) t& o' y* G) K   call  Kernel32!ORD_001  ; VxdCall
% }' z3 M! u; t( p- \; B   cmp   ax, 0f386h        ; magic number returned by system debuggers
5 E, u) n! R1 F' f! B# p   jz    SoftICE_detected" Q8 v  U+ r9 Q0 H

* \4 ~2 F2 t/ g5 W( A7 I  aHere again, several ways to detect it:
3 m0 J7 ^% K$ T4 ^, q1 ?0 N9 |8 _' H4 t
    BPINT 41 if ax==4f
9 B5 U0 A( h% h0 E. x8 Y5 b4 {! B6 D/ ]
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 H- {7 F5 [3 o( w; U
5 [/ P; l; |; d0 B8 D6 @: h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# Y3 Z9 B/ D( E3 F! ]6 s

) P( l# G  S5 E$ I, P    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- L+ T; b9 m$ j) V! y7 S, j1 C% O/ w& M
__________________________________________________________________________
) X( J, n; y- L; Z" `. ~/ \2 C
$ g7 M( f$ }, D- hMethod 135 a: @  |9 M; m; E
=========, g5 `* \' Q1 ~1 r

* Q4 B. Y/ S9 a9 `. F3 l8 G: rNot a real method of detection, but a good way to know if SoftICE is
" x5 a1 o& }+ Oinstalled on a computer and to locate its installation directory." W1 @+ T/ n$ Q4 x4 P) }% e8 ^
It is used by few softs which access the following registry keys (usually #2) :
% p, R- l/ }- M8 X9 Y/ n: a5 m+ q4 R
+ a7 `; S9 C9 ~4 }" b2 S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; j. B0 k# D* r/ V: j3 }8 u\Uninstall\SoftICE
' H" K) M: r4 q/ C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) ~& y. [/ }5 `
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ p' Z' v6 X$ K. ~: M\App Paths\Loader32.Exe+ O- Y; _' H' r4 w0 Q

% x4 b  @! _6 @9 }( s) O5 A3 w# R! W; x
Note that some nasty apps could then erase all files from SoftICE directory
+ ]: G: Q2 M( g. m9 r/ Z; l(I faced that once :-(
  z+ r8 _7 ~. Q: m4 ]! h& ~- Q) R; d1 V4 y5 D, e' U" N2 `6 t! @
Useful breakpoint to detect it:- i$ \) u, @' h7 _
3 m- `$ |$ h, ?" u% _; ?
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* D3 r& \: B. G. s
1 N% N0 c  |2 ]" y
__________________________________________________________________________9 K4 p% ]# [+ b9 [
- m4 t3 g4 s$ m) e  P
6 p, \; _. l; I. E/ f1 o2 _
Method 14
6 M6 z( t/ I+ }8 ^) ^% f4 A! X=========( a, _$ J7 P' @$ n8 t+ a

$ e8 [. i- U1 u7 L: UA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) a/ e  i% P- P( Y/ x
is to determines whether a debugger is running on your system (ring0 only).
( U, X1 n, z. \, k6 q( @. a3 \  g! f2 F
   VMMCall Test_Debug_Installed
) ^  ~% W% ], c4 L4 g   je      not_installed8 d7 n- Y0 T% k) @$ R7 B  {

* N) j, k- K  |4 O' {; _# qThis service just checks a flag.
% d& k8 {4 ]7 g' P7 U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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