About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( V* _1 ^" L8 r; b: b: A% c<TBODY>
) w; f; X; L) g5 Y" S<TR>
2 C1 y+ A+ r! m5 Q* ^& ^<TD><PRE>Method 01
" z: ]5 ]0 j& N# |. T; V: `=========3 \6 ]9 F& P  ^
  r% F, r: E, y$ B
This method of detection of SoftICE (as well as the following one) is  s# i' ?8 J( J& V% h! F5 a* q( x1 G
used by the majority of packers/encryptors found on Internet.
4 H. w4 f' V0 y, T, P6 b4 [$ v# p4 eIt seeks the signature of BoundsChecker in SoftICE
) M9 s- c; j0 O! ^: t6 h
2 E9 d0 p9 u% l. `( H    mov     ebp, 04243484Bh        ; 'BCHK'
8 \$ }5 J, y" w1 _6 \    mov     ax, 04h
. m9 B' l' b# Y0 g    int     3       ; Z2 u* A0 t- }
    cmp     al,4
+ a' y1 \7 M9 S5 L+ H    jnz     SoftICE_Detected# Z! d6 v0 l. v# h
1 E* {5 @" z7 D$ L2 ^  T
___________________________________________________________________________
2 V' \" \1 W" x, b3 [$ d5 t/ m  p2 U" e0 [" J
Method 02
& l2 A* o) e. D! g* v# |, [=========
. }; R* V4 ]- f# s* |. q# z" `9 S! G: W8 ?4 H
Still a method very much used (perhaps the most frequent one).  It is used
, E0 y. J6 _8 b& f) T: jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 I. ~8 I* `6 x' E) D3 mor execute SoftICE commands...( O, \- ?( t; [6 w2 l
It is also used to crash SoftICE and to force it to execute any commands
' Z6 A' y8 z2 c4 Q# k  T  m6 b(HBOOT...) :-((  & f; N0 a9 U& r+ U& M

9 s- n6 H6 ~1 u; A+ nHere is a quick description:
( Z) R' V8 G* X# V/ `-AX = 0910h   (Display string in SIce windows)
; D8 i7 T" Q% O-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 \1 d" J! K8 N7 B+ M; Y# b-AX = 0912h   (Get breakpoint infos)
8 \2 ^7 @0 _4 R! O-AX = 0913h   (Set Sice breakpoints)6 y1 t1 K% t& n) O: ^' ^( N
-AX = 0914h   (Remove SIce breakoints)' @& R, N0 S0 M9 J
) ~' A# q6 X0 z: n& `' D' ]' H
Each time you'll meet this trick, you'll see:# l/ h8 x# {$ d3 \$ _0 g
-SI = 4647h; G" I; ?. W1 L9 V( Y8 G! }- [
-DI = 4A4Dh
9 U9 u: n% T, o% Z) n& _% D) ~Which are the 'magic values' used by SoftIce.4 O' J1 h3 C. r! \
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! Q# Y& y2 r% l  B* }1 v
+ F: z7 O4 W3 B5 s; N4 }+ WHere is one example from the file "Haspinst.exe" which is the dongle HASP6 _, i: Y7 o! Z9 Z
Envelope utility use to protect DOS applications:6 f: A* L* Q: y) N
8 C- c5 R5 T, T

- i1 f# q6 g1 U9 Z! q# }! S4C19:0095   MOV    AX,0911  ; execute command.* [2 H1 I. k( F2 G
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).+ d4 a% p* z" f
4C19:009A   MOV    SI,4647  ; 1st magic value.
! w4 U2 K6 U6 }# u. G4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 t% P7 V4 h' m, H4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# _1 ~8 }3 V' N9 B' ^/ M
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. R; \$ u# F7 z
4C19:00A4   INC    CX
" F7 S8 w0 f) L4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# _+ {3 w* U5 ~" O' d
4C19:00A8   JB     0095     ; 6 different commands.
: K, P" j1 m7 d' `. L0 B4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 H% z4 _8 k8 K5 f5 l
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 O; o" G8 g$ r3 U/ [- O) ~3 o2 |! w; \) V) G
2 d* N6 E. X, f0 M, p2 |The program will execute 6 different SIce commands located at ds:dx, which% a- `; T1 O% J( L& w/ o- M
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 [( [8 u' \7 c9 z: ]& z2 D" ~' `
; j# o# S) Z$ n- Q/ y% @( h! l+ y# r
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 q- O4 |+ E6 S3 p___________________________________________________________________________
) b3 K5 D$ d4 a& M5 ?. d1 r& q0 ^+ ~$ n2 [( ~8 n
! G2 Y6 r8 U5 f, _
Method 03' R; K- o  G1 p/ h. W# Q
=========- v, P  s/ }7 @8 O( M% \8 M

& J* [: h9 l7 T2 XLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" M, Z1 s5 g: j6 C% Q
(API Get entry point)
; Q" S; _& g, w: d  U. \9 ?        
# i$ y1 E) l# B* r# p& X7 y: A2 L' ^8 o
    xor     di,di$ x8 t0 D" k0 I! ~
    mov     es,di* d$ x; a0 f. q- Q# g
    mov     ax, 1684h       & G5 _5 M& `/ n) w0 k& f
    mov     bx, 0202h       ; VxD ID of winice
! \0 s7 E6 v2 E! Y2 X. e1 M    int     2Fh7 F1 i, p# ]1 G2 p( U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  [* `% k# ~, w% n    add     ax, di
- Q; m; `! {1 a, S) M9 o) j% L/ I" @) K    test    ax,ax
5 ?( S  a' [* d: Q9 @8 D- L    jnz     SoftICE_Detected" e6 m$ K+ |7 ?& C3 u
+ B6 H  a5 o& O* ]
___________________________________________________________________________
8 b- @# s' K- A0 r( f9 s' [( t. V" R# B
Method 04
7 q  u& d3 A* {5 w7 e$ ?. D: F* d+ [- ]=========! K6 h2 [: I) A$ b
9 }! e# C8 x8 d; z" Q! [  K% c
Method identical to the preceding one except that it seeks the ID of SoftICE1 n& b* W. v7 W3 i
GFX VxD.
4 |" ~( W' w; a. e3 y& ^
1 A+ m' E5 X9 C* P. @0 K" [1 _    xor     di,di1 S7 Q2 [% @8 i6 }9 K# ~
    mov     es,di
  m' N$ O2 l& W! w. M    mov     ax, 1684h      
6 Z- @  y6 C5 o3 J! A* q! ]    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 h' s2 h$ g0 }! u( C    int     2fh
+ P$ Y6 P  d+ A% ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point; S( b/ h4 v. S2 y% O' s; s9 f
    add     ax, di
- w. ?5 F+ `) m" o    test    ax,ax& |6 P* {- j( P1 k$ h5 W" T4 D# o
    jnz     SoftICE_Detected. I8 E1 k: @$ S* h; I

$ x' {5 ?& d) j  P4 `1 L5 _1 ~__________________________________________________________________________
5 G$ t1 s  n; x: U, |0 V0 y, v# O6 U4 y* N: R" P
+ `) H; y' d- A
Method 05+ @' d. R" B, G% ?
=========8 n2 n* R0 c1 a
  X7 l& b+ K; U# c: u  P
Method seeking the 'magic number' 0F386h returned (in ax) by all system
7 n( p. ~" X& I! q2 ?- [debugger. It calls the int 41h, function 4Fh.. o6 G, l4 ~. D5 q- \: X/ V
There are several alternatives.  
4 n( e) |% W5 Z) O# }) x# N* D
# C  t& `9 ^5 C  yThe following one is the simplest:6 }% l/ v# C1 k- o& k

$ w; O& R0 b' p8 ^    mov     ax,4fh9 M2 j) W1 o: }: ~( U: Z2 G
    int     41h7 D5 h" R, G0 K  {9 V  o% e! i
    cmp     ax, 0F386+ Q  |) o& b% z' ?6 I: F
    jz      SoftICE_detected" [& c4 B( L1 S9 X/ r; x- J
  D. ~, R% k7 ^) n' y7 y

1 w2 Z" p  g% f' z: iNext method as well as the following one are 2 examples from Stone's
$ z8 v# M' \1 d' s0 V- E! Q"stn-wid.zip" (www.cracking.net):# y. n: A& ]" c4 o$ S7 C

0 M2 c0 T" j7 @. _& t" v9 N    mov     bx, cs
1 f$ `5 V+ n0 S/ f: o5 t9 S    lea     dx, int41handler2
6 }3 v9 S" U0 |$ s  {5 P/ g1 }1 M    xchg    dx, es:[41h*4]9 b4 T% p# G9 f9 G: W
    xchg    bx, es:[41h*4+2]8 D3 R- d/ z9 R/ X1 h
    mov     ax,4fh
# d( v0 P, _" D) E    int     41h9 p" N" [9 U4 o2 D. }
    xchg    dx, es:[41h*4]
9 J& y; w1 L# P+ B    xchg    bx, es:[41h*4+2]
1 Z4 Q; B( n' m% t% o& {6 p8 L    cmp     ax, 0f386h- {# m" U; m  r, |" _
    jz      SoftICE_detected# g8 O3 q6 y+ |, E4 W3 l
! k3 c/ c# T+ X) g
int41handler2 PROC1 S5 q- @+ W; o$ o5 y* k  \2 ]" h
    iret/ k8 f2 f# I. b5 b% H
int41handler2 ENDP' O( n9 P* {; \) i$ U3 k
0 B7 K& t, K  p- q2 m& ~
6 F  z; I, ^" p/ {0 ?
_________________________________________________________________________. F1 r1 a  W5 o1 A" B
, K, E3 }5 `0 q3 r1 J! f+ P1 n

& e  a: u% c" S" N4 mMethod 06
' e" k! ]5 p' k' X8 p) B) `6 y4 {=========
6 C" A% a7 V8 j, A* L7 B) l1 B0 U$ _2 c6 U

+ p: @4 G5 K$ p0 Y- L* Y9 O. I2nd method similar to the preceding one but more difficult to detect:
. D( d; W. ?- f- B" |; ^7 T; E! l) z8 V! g, K( S3 c

9 {; r5 c8 J& s3 xint41handler PROC
, f! A5 g/ \' }+ b" {+ j6 E: O    mov     cl,al
( |5 L( B8 t# d" {' O( y& U0 V" n( D    iret
) i% u$ Z. B$ }6 `0 W; ~4 D& K) Jint41handler ENDP* y0 k# @8 e. X  N* y8 c( z- A

; S! n* A0 w7 ~# @0 i
+ h% w- r, o( d+ b2 b    xor     ax,ax
, _4 \2 J6 {. s  W  v: D    mov     es,ax1 |. V- J% |6 w+ t
    mov     bx, cs9 B8 T( _& u% n3 X( r1 N2 |8 u
    lea     dx, int41handler/ r* }, M' |2 N- A4 q' f
    xchg    dx, es:[41h*4]6 u) H* f) @1 r8 I% {+ H3 H; |
    xchg    bx, es:[41h*4+2]
, C: g) X  E; _' V' k( G    in      al, 40h3 R! m, z/ r- y/ b, [4 R% q
    xor     cx,cx5 U! I8 K, l2 n7 ~9 ~0 F3 F( F
    int     41h7 R9 M/ m" [" s/ ]3 g
    xchg    dx, es:[41h*4]
5 B5 j- V0 c6 M    xchg    bx, es:[41h*4+2]
8 {& K/ e5 Y( x- b2 F/ S$ a6 d    cmp     cl,al. t5 d1 Y; i/ ^/ n3 C) V
    jnz     SoftICE_detected1 ]# [2 I$ O0 g+ o: N/ I. g6 R

  p- U! F5 K  C: f7 `6 A_________________________________________________________________________
0 e* W' W& W: V6 T4 p8 i$ {7 |5 {4 ]: d  }. |
Method 07% h. B' p- _4 M' I* _: ?4 O
=========1 ~. V" {& I7 Y$ ]( d' ~# n% W
& m5 A7 w. c. O. P( _5 m9 \. k" Q. Q
Method of detection of the WinICE handler in the int68h (V86)
1 [$ g" Q: p; Z7 \; ^, _# k- c2 Z) m' V$ s. q$ k$ Z
    mov     ah,43h' [. d& x6 z" q/ P$ h  P% A9 I5 e
    int     68h3 i+ d2 Q3 W  N* X0 I
    cmp     ax,0F386h
  @1 a7 t+ s4 m8 Z4 A' t    jz      SoftICE_Detected
( `4 b! c0 y8 W& M, u1 a. `( z) w. j$ q* V/ q

# q* Y+ q7 X& O=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit7 D/ _  j5 l' i# Y  U& v
   app like this:
2 _5 }' @  |$ w9 V2 R# T, [( @2 f4 Q; a  }5 T3 a
   BPX exec_int if ax==68* G8 @. {2 H, ]  Z1 c
   (function called is located at byte ptr [ebp+1Dh] and client eip is  y- d' J) F7 e
   located at [ebp+48h] for 32Bit apps)
' B3 a' U% x: |" W! q7 C__________________________________________________________________________
; B4 ^  q; F. H: K* \; E" L- }1 [# U
, C2 p; g0 x" ~
Method 08
7 f  p( H" V3 [* a0 X=========
4 h2 ^# F& o) }$ g0 P) j- m# W
1 R' p* `+ ]1 G- jIt is not a method of detection of SoftICE but a possibility to crash the8 U( N0 b% x1 X" |" r
system by intercepting int 01h and int 03h and redirecting them to another
6 X+ k: A3 D# f9 m) I- Proutine." o8 |2 C- ^5 i0 R
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
1 r8 x* ^  Y( m* _% |4 Vto the new routine to execute (hangs computer...): c; Y8 K. L. M6 d( S. t' F+ n# M0 r8 y
" v# o8 m1 i" ^/ y- r/ A
    mov     ah, 25h# E7 T+ p) {  }
    mov     al, Int_Number (01h or 03h)/ c! s, d+ x2 R; }" F- A) l* R
    mov     dx, offset New_Int_Routine( J/ n# g( ~( V/ O2 D
    int     21h
* h  ]! R9 K! r. N6 [( B& V: w0 O3 u0 P+ B3 s/ \  @, U, H+ S
__________________________________________________________________________
2 s: G. F. T% p; q# Q5 M2 f: Y$ m
" h* s* e7 c# O- H: H  m  qMethod 09
$ n$ V* \( R7 j1 ]=========9 U# X5 X8 H7 O( n7 l: Z$ \; }3 d5 n% p

5 T7 t4 `/ o1 C7 O/ L" zThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" ^: s, \2 A- n  |: A: t  u9 ~
performed in ring0 (VxD or a ring3 app using the VxdCall)." u. H: _7 X% N' o( o+ b
The Get_DDB service is used to determine whether or not a VxD is installed
% x& l+ w0 h' @for the specified device and returns a Device Description Block (in ecx) for6 E! O% p/ J: n; s! b
that device if it is installed.. A! x6 }6 \; N

" u2 N/ N6 v$ y5 k" U! h   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: |, [8 E( z3 _   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 B; h* s5 H& C. S- j   VMMCall Get_DDB: s7 r) _+ q& U" J$ Q7 l: e0 g
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# O" H6 B5 ]+ N& s6 n7 I

: q# ?6 N- I) b% o8 KNote as well that you can easily detect this method with SoftICE:( ?* D: j2 u) f+ e, _9 a# H0 i" c
   bpx Get_DDB if ax==0202 || ax==7a5fh4 q8 b; R4 ?0 \, Y3 }. x2 t% Z

1 I2 p2 |6 |0 H' {% h__________________________________________________________________________
! a7 \$ r& l( d- S4 a) O9 w/ N4 e
- w  t  D& z. o2 J5 ?8 CMethod 10
" ^. r4 i- `/ }# S# ]=========
/ Z! ?/ E, D3 F$ k+ ^
8 ?' h' q: {( i0 j& c; l* L+ B5 l=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
1 Y# g0 l2 {5 g" a( E  SoftICE while the option is enable!!. Q. Y" k  r# H

+ B$ Z8 h! r4 o* m/ _' _+ vThis trick is very efficient:
$ U, B5 }' j4 }/ Rby checking the Debug Registers, you can detect if SoftICE is loaded
0 {# J9 ^( G( {9 W) ?8 B(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) W9 J2 h' Q5 ]1 N; C9 ~# _
there are some memory breakpoints set (dr0 to dr3) simply by reading their. w0 f* o* }1 [, s4 b! F3 @8 I
value (in ring0 only). Values can be manipulated and or changed as well4 ]1 G( I  w9 E/ |6 X
(clearing BPMs for instance)& V: O6 N' `' \8 l6 V8 p, i/ T! `! K: Z
2 G8 B7 q+ s1 `4 B  [0 N1 n* l. t
__________________________________________________________________________
* y0 [) G' ?, ]/ K+ N$ g8 E6 g# n( h0 }
Method 11$ U" }1 o8 p/ x/ Z  ?0 y  w# s
=========
$ Z5 m$ X+ C: ^
3 L' a9 x8 [, h# ~5 KThis method is most known as 'MeltICE' because it has been freely distributed. y& x7 `( V" n$ P  q) O
via www.winfiles.com. However it was first used by NuMega people to allow
" Z% @1 e7 i+ T! d" lSymbol Loader to check if SoftICE was active or not (the code is located
( W$ J& z9 T5 Z" o/ E; F* ginside nmtrans.dll).% e3 K. M, k; C: _
8 |. N0 k4 w- _+ s' d3 R; C
The way it works is very simple:
. G  q, a, E. _' e& VIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* P; c4 q  F( x6 p5 P0 O4 o. fWinNT) with the CreateFileA API.5 C8 |; h9 y. y3 n8 Y/ j

6 j8 b2 F: i, `Here is a sample (checking for 'SICE'):$ l" f% V  f7 ]/ q7 f8 b
5 c2 ]4 |' L; D. h( H& A9 H2 A
BOOL IsSoftIce95Loaded()
. }4 V6 q/ F4 K/ A{
: x; M# c6 @$ i& I5 A5 x   HANDLE hFile;  7 }2 n& ^( g( _. s
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: g; u* U7 l) N& Z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% v3 u/ \1 T" L  V, l3 v' t1 d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 H/ I1 y3 v5 v6 w: n   if( hFile != INVALID_HANDLE_VALUE )
& R6 f  m  J4 o7 Q2 C1 w, U   {" Y6 O% A" |; \" P6 F+ i- k3 z
      CloseHandle(hFile);1 ^' p# `& T. d. f; q
      return TRUE;
7 |% p$ P. v% G& b   }
: `1 K/ m7 X# B) A) A4 x   return FALSE;
  {; }% z! B5 s- x% z* m}; K! V2 V5 h7 U
7 S: Z: ~; E6 \1 e. {; b1 j/ L
Although this trick calls the CreateFileA function, don't even expect to be
5 m$ h8 o9 A9 ~! c7 W4 }  lable to intercept it by installing a IFS hook: it will not work, no way!
1 h) K) J4 Z3 v  \, JIn fact, after the call to CreateFileA it will get through VWIN32 0x001F* J% ?! t" r# M" w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ L! `5 o, z5 w+ q1 ]and then browse the DDB list until it find the VxD and its DDB_Control_Proc
: q$ r6 c+ k" z5 ?8 L3 ^7 mfield.2 T! i7 u$ ~1 Q! U; {  v. ~
In fact, its purpose is not to load/unload VxDs but only to send a ' G4 H8 n; V/ M" f2 U5 K/ p
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 @$ k/ S% C/ Z% b9 |" s- [6 w4 C# kto the VxD Control_Dispatch proc (how the hell a shareware soft could try
& d4 T' i4 j  z( q1 N  K4 _to load/unload a non-dynamically loadable driver such as SoftICE ;-).6 Y9 [. H, m; z) }  [( k: P' k
If the VxD is loaded, it will always clear eax and the Carry flag to allow. a$ x; s' s) S: \
its handle to be opened and then, will be detected.
: O2 Z! W9 G  B7 q* W0 r8 ?You can check that simply by hooking Winice.exe control proc entry point3 S/ x5 ?, n  y$ y/ m6 [1 r
while running MeltICE.
/ _2 m& o- `% P4 _
% J) t# }5 |* i: k9 i! J' x3 q' J* V  Z) k# c" Z! O* }
  00401067:  push      00402025    ; \\.\SICE
( x! i  G& h* z. p, o  0040106C:  call      CreateFileA
% Y& `, n/ y" z# L  00401071:  cmp       eax,-001$ a" n8 N$ d& L
  00401074:  je        00401091
" x* ^+ `  m1 X2 D. k
  L" x( i: }% ]$ h4 M" r! U  b* ], f0 Y7 \4 K0 l
There could be hundreds of BPX you could use to detect this trick.
* l1 U" P# V- b% ^$ Q-The most classical one is:
0 `& F: @# `$ B" w7 n1 u0 h; G' x  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; _  m7 G) N, ^6 {  }6 s    *(esp-&gt;4+4)=='NTIC'
+ q' ]' \! |. O2 u( @9 ?2 {: p' m# M) ?! X0 v
-The most exotic ones (could be very slooooow :-(/ j( K' d; E! G& ^
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  1 ]3 f$ U. S$ @( V* ^; r, g  m
     ;will break 3 times :-(. n# {' a' H- y3 k" I& `

3 g5 ?2 a/ W/ ?! A5 l-or (a bit) faster:
  a& t4 b6 ^; m9 H   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; K6 }$ I- k) J' d
3 m2 m7 a. ?+ X) a   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
+ ~$ Y7 ]# Z* t2 t8 f     ;will break 3 times :-(0 t& g  R1 p" ]% p
$ T# T' e8 F( N# d
-Much faster:  E1 B7 p5 w7 |- A
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 m0 O3 A, o7 m6 d

6 d3 n* \- b1 Z: c9 Y. a3 BNote also that some programs (like AZPR3.00) use de old 16-bit _lopen" i5 Y, ]# o$ s
function to do the same job:/ N: i6 G# T" U7 Z& y. m3 j
2 q: v1 s1 e; ^, w; k
   push    00                        ; OF_READ
0 d' T( S# u+ I* [& k( A+ M8 e% ?) }   mov     eax,[00656634]            ; '\\.\SICE',01 H9 z/ p; q  {) ?* k. X
   push    eax
  F9 Y1 w: z2 e  {4 w: x% h9 @   call    KERNEL32!_lopen' B; H: t6 ]% v* Z3 G$ i- W5 A  V3 l
   inc     eax
( Y* k: ~+ ?9 x   jnz     00650589                  ; detected
. f* n  z* Q. ^% N$ d8 y  H+ o   push    00                        ; OF_READ
1 W3 |, f, ?$ |1 s' |* c# }9 e( Z   mov     eax,[00656638]            ; '\\.\SICE'
: ?# P& Z7 Q, j) O   push    eax
1 V$ O; ?. Q* I6 E   call    KERNEL32!_lopen
+ m0 ?) G  d1 ~: F6 j* N1 c   inc     eax5 D; A/ `( ]* U, l* i
   jz      006505ae                  ; not detected9 y7 S. Z! w( Y4 K7 K, p  W" J! [
+ Y, V) f% X8 [; a2 |

" F( H' [0 b/ j. V__________________________________________________________________________
% u- L: H# {/ P: m9 L, |+ Y- G
. O: N! O8 j& }+ C( [Method 12
) w9 m9 J, a, p=========& @- m. Z+ ^2 M9 p6 ], b# x0 U
; W% k- a, s$ C$ h, w& P
This trick is similar to int41h/4fh Debugger installation check (code 05; x8 F" Y$ P: I5 C* Y9 ?; B( V9 C
&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ G3 c/ K+ d0 V
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; p7 t% X) k0 T# b
, t% Q. Q5 }$ t
   push  0000004fh         ; function 4fh
! Y) `3 u/ H0 \+ b8 J  b8 p; M( T   push  002a002ah         ; high word specifies which VxD (VWIN32)
& e! U! K; O8 p                           ; low word specifies which service
" y4 c- n% N* a4 w3 |                             (VWIN32_Int41Dispatch); q. n. c; P$ ?/ V* y
   call  Kernel32!ORD_001  ; VxdCall
7 ^0 m" q$ ^6 H2 J/ E* i# h   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 ]8 i# X( M8 D7 U3 ^" b' |& c   jz    SoftICE_detected
9 z' x( S# P0 k* }) u3 ?- O5 @5 s( p
) d$ {1 j: @1 e/ ~Here again, several ways to detect it:
3 z1 p2 S/ @0 Q8 _5 g8 M6 J4 a4 W+ A0 ]
    BPINT 41 if ax==4f7 S3 b, B  g% K, c
: |& L/ V* x4 v7 `
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 ^) r- H+ u7 T( L. r) T
: P$ h. @3 L7 d# f
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 R$ C4 L4 k7 h

4 \6 z6 B, I# D8 ?1 l# Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- E! ^" W% \% N
5 j3 R9 X$ k* {0 {
__________________________________________________________________________
) \0 \8 i6 |8 {3 M8 Y' }
8 Q4 `* b# S' t" B* I( ~* x+ E: UMethod 13
7 B0 g: i+ o3 j=========
6 o0 L7 L% ^2 m
7 d* y4 j& }. gNot a real method of detection, but a good way to know if SoftICE is
) n8 D+ Y% i/ D; r7 j; P, cinstalled on a computer and to locate its installation directory.
) t8 o7 S* `. {3 _3 UIt is used by few softs which access the following registry keys (usually #2) :
( g4 f% W6 m% U! v2 ~
' h6 C# @6 q$ k-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 ]( d( p- q6 n; a\Uninstall\SoftICE
3 S1 s5 V3 ^* F# I8 g-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
5 q9 ^: \* }# U! o-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 Y) ?, b- G( ?4 F" c
\App Paths\Loader32.Exe
; N0 T7 C; K( |' W' T+ N; R+ ?9 ^0 U' ?; T# N0 a
0 T3 z& r( j$ M( M) l3 j8 Q
Note that some nasty apps could then erase all files from SoftICE directory# R- p- F/ d, g* L  q' ~) }* G
(I faced that once :-(
$ F7 m0 h/ P/ z) O7 f
3 j% j! _& s/ R# A6 j- c4 WUseful breakpoint to detect it:$ e! d& F3 f  _# ^! Y
9 C8 [* {; w1 R) `
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ U4 G* H( I! _* K
" j" D# \& D0 D6 e__________________________________________________________________________. h* g! f) M0 |- g; [

% H9 E" q. b; \4 u9 e1 A4 s/ w5 a
2 V$ }% ?3 A7 O, ?- J6 U/ EMethod 14
6 W$ u7 a2 I- Q6 \7 S) v. o=========
# b/ a4 `5 c5 m. i, }7 p
  R5 R5 a# ]  s" N, W3 E: S. H; dA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 _4 P# Q% {% }( \$ s
is to determines whether a debugger is running on your system (ring0 only).: a6 l7 N0 W. i

+ d8 b: C) T4 J. |2 T7 k$ z   VMMCall Test_Debug_Installed
. z8 s  o) {1 u5 b, V9 a: N/ \   je      not_installed
. h7 w- l6 Z: e# c3 ]: R( h/ B. c  K* ]. d# P
This service just checks a flag.
. h" Z5 c$ h! B$ z( S& |( a</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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