About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 S$ d! _, d" X" l. l& @% ?2 a7 T<TBODY>& R8 N7 H0 @6 z, K$ x+ P! c: p
<TR>; u) H6 s" u, ?4 D3 t! F
<TD><PRE>Method 01
5 e( M. N' @1 n! h2 A* i; \=========
; J2 E. b0 q4 z
+ o  C# J; D& G# AThis method of detection of SoftICE (as well as the following one) is- \* b, w- ]0 c" k6 \+ q
used by the majority of packers/encryptors found on Internet.
2 s* z. t1 I7 S6 D% }It seeks the signature of BoundsChecker in SoftICE
% G1 \8 }- G4 W+ c3 n
- V! q" q3 x6 E1 ~    mov     ebp, 04243484Bh        ; 'BCHK'
7 d$ {. O" ~% y    mov     ax, 04h
$ O8 q/ P/ V  O" h    int     3       # E7 Q- z2 _# s6 V0 h# E; V, R
    cmp     al,4  s; g4 t: t& H! z
    jnz     SoftICE_Detected
/ t2 w, u+ W1 M* u/ U( O0 A! T: G1 ]% o1 i
___________________________________________________________________________" a. W2 R: a8 Q  ]* r4 S
' O3 a4 k3 X: B( W% I4 m" p
Method 02
9 V5 P& C$ q2 _0 j9 c) n4 ~=========
. s! N7 q$ i! t) I7 J' Z1 l# U4 r2 Y* @! }
Still a method very much used (perhaps the most frequent one).  It is used
' G( [( e  a$ i9 f: Dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,* q1 N1 \; R. V
or execute SoftICE commands...
$ x$ k* u: V% u7 W9 ^2 NIt is also used to crash SoftICE and to force it to execute any commands
+ a( B9 v3 N* x; \+ }% k( T9 `(HBOOT...) :-((  4 d$ D. t* N9 C. g7 t3 X
0 [4 J) l7 N& }" t4 D( l$ X3 j7 C
Here is a quick description:0 C) b% ?* j. o! a
-AX = 0910h   (Display string in SIce windows)
1 C' ?+ t3 Q! a" ~-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 h+ d) O& A" V" S; b% ^6 {% w, J-AX = 0912h   (Get breakpoint infos)
0 B1 ~0 ~- |9 L9 w-AX = 0913h   (Set Sice breakpoints)+ T9 T% Z  ^  O0 U" y
-AX = 0914h   (Remove SIce breakoints)7 b% @2 L# ]* O  m" W% r
9 S" s2 s% k) G- S
Each time you'll meet this trick, you'll see:
  \9 a1 d1 Q. Y+ i# y-SI = 4647h7 X$ I% M. a$ z8 s0 c) {7 l
-DI = 4A4Dh7 V/ v1 y6 V$ Q6 J% \5 R, e  c
Which are the 'magic values' used by SoftIce.% Y. I; |0 @. a  Q% h
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ B7 e5 L$ ?5 T* s
: N4 v' H( [" Y7 K/ |7 l( |Here is one example from the file "Haspinst.exe" which is the dongle HASP# |* S, ?9 m( {" C* ^; c
Envelope utility use to protect DOS applications:
! ^4 T3 ?2 ]8 s/ _$ u  f  m
' o, X3 ^; J6 O5 E9 E0 F: \
, Y, E+ b4 N) x, C4C19:0095   MOV    AX,0911  ; execute command.
) l2 Y5 k0 J% K. p8 ^) F: o+ L0 h4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 b% j8 o. M; D( c4C19:009A   MOV    SI,4647  ; 1st magic value.
- F" j0 X9 I: s& X) E4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 n. l. F2 G( I- `8 g" o) K) H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- I3 p: q- z5 I- ^4 y5 p8 f4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
) q9 h2 [4 H8 ?( Z8 e/ ~4C19:00A4   INC    CX
- z; C6 [( P, }) f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. p0 D: o) F3 }/ T4 i8 a" ~
4C19:00A8   JB     0095     ; 6 different commands.
7 S' Z# s* D' Y8 J& Y- O- W( [8 z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 l% V7 v2 a9 V$ G4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 u% |( e1 B8 g* N

2 H( J) s) P+ Q7 z- ?0 E- wThe program will execute 6 different SIce commands located at ds:dx, which
1 q& }& G- i" m: ~  ?$ [are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
; q0 ^, s/ R- @" C' ^# y4 B: K0 b; P
" K$ G$ d4 r5 c# F  ~" O) i9 s* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." ^) x4 ]+ e# a6 X" p
___________________________________________________________________________
1 f: R9 w2 V6 M& J' j* W7 |% N! H2 {8 l
5 y' t8 K" G" q
Method 03
: m/ u9 z: i- Y/ X. E* k6 q% Y: K=========- |" ~! q' s9 ?
* b- H( t: \: }# F
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 a+ R5 s0 d* \6 }2 e0 p% p(API Get entry point)- B: v2 W- Y# k' c3 H: v
        % R3 `# C; w- }# `/ ~
8 `9 N& `3 ^/ e$ @; H
    xor     di,di1 w' W" x9 h6 r# q* i2 {7 n
    mov     es,di
2 j8 x, F2 q% q    mov     ax, 1684h      
. Y: M/ L2 L  Y! {    mov     bx, 0202h       ; VxD ID of winice( q# v4 n7 ?. W1 }. Y4 {
    int     2Fh
2 K4 C) J9 t4 |3 _: ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ k! {) T0 i2 V    add     ax, di
7 A+ S, z3 d& K& W% p6 i+ t' b5 ~& W* u    test    ax,ax% C6 S; i/ v2 ?3 g
    jnz     SoftICE_Detected
# O  i- Q) C- `7 C( v7 V+ c2 D9 Q7 s7 c% `9 T* x
___________________________________________________________________________+ {8 R- {  H( t) z0 Q
: h3 c: s& n! w( q. ?2 c  p
Method 04& G4 G! W& y' ?9 h5 n! [+ l) V) N
=========4 o# [5 `% [& X5 q

" N7 l1 _5 ~5 n/ o0 NMethod identical to the preceding one except that it seeks the ID of SoftICE
2 ]5 ], N/ o; M( r1 vGFX VxD.7 X# y6 f- c: H7 W. @
9 b! c3 @) V1 x, {- K: @
    xor     di,di
9 W! L/ y! s, R6 o; F% o    mov     es,di
& S/ K+ ~8 t' R! D/ G    mov     ax, 1684h       ( d/ d8 x/ o/ m0 ^* p
    mov     bx, 7a5Fh       ; VxD ID of SIWVID- L. k: g# i% A# k9 ]
    int     2fh" y4 Z0 k) [& Y, Z: |
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  n% @8 [  G  h% l( X' I    add     ax, di
' e7 y) S$ m, N    test    ax,ax
# G$ h0 H/ g! ^' o    jnz     SoftICE_Detected
: [5 F' Y2 o7 {) `; V
0 z+ Z: b! ?! O6 ~7 t2 }__________________________________________________________________________& h, b  r$ `* P" j; w5 H
6 \; @3 D; x& @* ~, o1 {

! R+ I+ H8 x( T* L- AMethod 05
$ |  r: D4 c  J4 i, M8 n=========' I3 P; A; l- L4 G

: N  d0 A' Y% x& [& R1 n8 hMethod seeking the 'magic number' 0F386h returned (in ax) by all system
. Z8 R! X, R9 ~; ?debugger. It calls the int 41h, function 4Fh.
6 d- y& c5 U( yThere are several alternatives.  9 d9 ^3 L9 C7 J' B: `
4 x% \7 n2 K8 X2 e$ ?, B% B
The following one is the simplest:
7 F+ H! r! ~; J- C- u2 V8 G; O+ M$ y4 K8 K, j' `) N
    mov     ax,4fh
! [; x' z! S/ r& o; Z' Q    int     41h
4 A) \4 N* y/ q$ k* p8 f  e3 N5 v1 B/ w1 s    cmp     ax, 0F386
! i0 j' F/ e) o    jz      SoftICE_detected
% z) i" ?% p  q  }; e& y; N3 m8 ~/ [! g6 J  B" ?) }
& k0 J5 W, F" g+ O
Next method as well as the following one are 2 examples from Stone's
2 X+ R5 n5 s$ a6 D1 B1 _) {"stn-wid.zip" (www.cracking.net):! n' [8 j0 w5 ~2 i/ t' Q
; k1 ^$ O, u! R) ^: s
    mov     bx, cs2 O( J7 c# Y: H/ d' T
    lea     dx, int41handler2: W$ b( ]5 u5 P7 p9 x, }
    xchg    dx, es:[41h*4]9 b4 N: R' a/ c0 g+ [! ^7 Z. K
    xchg    bx, es:[41h*4+2]
; j* N  A8 w! l% f    mov     ax,4fh
) Z' u; y1 e7 c% M2 H* B  c    int     41h
( r: t! f1 A% `- B- T    xchg    dx, es:[41h*4]
0 }# M# U* ]% u( i    xchg    bx, es:[41h*4+2]
  \: y4 L$ ~. B, y' o& X    cmp     ax, 0f386h
4 ?0 ]! G) b9 n' U' X    jz      SoftICE_detected
) k6 @4 ?; y9 I; {6 ]3 B. B/ e$ \/ m- l; N) P
int41handler2 PROC# I, z3 D  A( {; E! [9 O
    iret
8 s  t8 n  P- Fint41handler2 ENDP4 d+ j% y$ ~- \# p: `* G
  F& K- Y7 _' o% G4 z

. H, C0 B6 J( O3 o_________________________________________________________________________- u2 H! m, L# a' [$ Q  c

1 z- s/ m, W; ^0 |8 T6 i3 h2 P0 t" p! g% L+ e9 x
Method 06
0 b, G9 O: a: y0 k/ d( M/ v=========
0 L" X$ H3 D! s/ A! ^- [8 Q  l6 i! e, `; {6 P

6 k; b  A( t( v2nd method similar to the preceding one but more difficult to detect:
; p; O2 B: L2 W+ y0 y; Q+ d  o  s1 g6 V  w' f1 a- t* T. ?

" v4 {) `4 ^0 c: v' yint41handler PROC
* ~/ h. G' e/ S5 u- ?    mov     cl,al$ [7 N) w5 K& T
    iret, H) y1 A' L2 b) h% U  j' e3 d
int41handler ENDP
8 H6 _5 [/ n+ v, W' I7 Q
# Q/ i5 z& o1 F6 V! e/ h* E! Z+ X: J9 J- S  O# A' T" w
    xor     ax,ax
1 X- }' }) M- {) k2 S4 [' O; n    mov     es,ax
) p. S; a0 b4 q" L* u    mov     bx, cs7 F) C- T1 B0 s7 ~& T, c
    lea     dx, int41handler% \) |( V. b7 c# V. N
    xchg    dx, es:[41h*4]
8 n+ U- ^) b$ {+ A6 D    xchg    bx, es:[41h*4+2]
' f9 p" a0 D  Q; R    in      al, 40h
/ S; R+ Z7 p1 B" J9 m- s* R4 g+ q    xor     cx,cx
1 }- j" H3 a3 t9 M    int     41h
! B  s. l# ?( d: y! y( E    xchg    dx, es:[41h*4]
% @( e4 n5 i5 H  ]7 o( S) O    xchg    bx, es:[41h*4+2]$ s7 _7 W" t' N7 Q0 v- R8 a
    cmp     cl,al
6 u# |# T/ ^& ?  `    jnz     SoftICE_detected6 j4 L5 W3 Q2 E) S$ U/ w7 q

3 e. L  w) I3 x: v9 W: R" `9 __________________________________________________________________________
/ b. u- {* Y5 G& b
- j9 V9 N  k0 C4 RMethod 07, I' d9 g8 _6 C* z3 q
=========
! I  G& b7 P- C+ m4 ?
! y. s8 m  [) w" H% |Method of detection of the WinICE handler in the int68h (V86)2 i! z# m) l# l
+ t1 V% ]* T$ D/ {8 H7 c
    mov     ah,43h' W/ ^# n+ v( _+ Q0 U& e
    int     68h
# g7 D! i5 L" Y4 I    cmp     ax,0F386h  [6 b9 c4 J1 `* P# W
    jz      SoftICE_Detected
/ X: X" c( Z3 }1 S# B
7 M8 y3 }  j/ c3 H( P
% M' x: Z/ X% x8 u2 ^' w* Y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit1 `+ m0 Z; `1 ^2 k1 R( @
   app like this:+ s& l, l" Z8 w. c( z' j; r0 P

6 m: S; e+ j1 W   BPX exec_int if ax==68
  o: y) ~) b( p4 {4 K7 d0 n( d/ V   (function called is located at byte ptr [ebp+1Dh] and client eip is
. l. h) ~: E' l) ]2 \% |6 P   located at [ebp+48h] for 32Bit apps)
1 @; p% Z- N7 r& x2 U- l3 }$ A: y" Q__________________________________________________________________________
0 L; d$ `+ Z/ J, c4 e* U* t! k  p
- n$ K: \  q0 Z/ J1 X' t' r0 F
Method 08
$ w% j2 G- n: v2 b5 c4 ]% l$ A=========) t) g* f, L' ]8 T

2 H& f4 i4 Y& ^3 u' G1 z8 wIt is not a method of detection of SoftICE but a possibility to crash the
/ C. }: S" V4 b  H  c- r# Ksystem by intercepting int 01h and int 03h and redirecting them to another
( M' x# q! F  P/ k& ~; A9 Nroutine.# f+ H4 y. u) u. N+ g
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) @+ p$ h& a' v1 p
to the new routine to execute (hangs computer...)* X( h3 L) R. ]1 X: M

  x/ P6 d/ w: p    mov     ah, 25h" M# h" o  m( m4 u
    mov     al, Int_Number (01h or 03h)* ]# [. p( L0 c' l* E
    mov     dx, offset New_Int_Routine
+ x9 G+ B$ I9 ~/ X: e  _    int     21h
  _  `9 T+ r/ n$ W( s+ s+ ^: G: a1 b, c; ~
__________________________________________________________________________9 O* S0 u( v' [0 p& `3 j
6 R; [6 x* z5 W
Method 09* C+ S. V. t- W* U7 M  A
=========
) i4 E8 Z4 k1 W/ G1 L+ j4 o. L
& ^0 P& W  d' Y- C( vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 F2 M- n% E" _& X8 U4 ^
performed in ring0 (VxD or a ring3 app using the VxdCall).& H: d4 K0 U: ~! `2 D* m# u8 a. A. E
The Get_DDB service is used to determine whether or not a VxD is installed+ [) r& k3 v% t* ?
for the specified device and returns a Device Description Block (in ecx) for+ U8 m( `( i) S, b( H, u% k: x$ m
that device if it is installed.( \) g# O$ m8 L$ I

& ?' F1 K5 m% d+ @3 Q: t2 x   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 O4 J1 {  d2 J  E; W   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) Z- `& [: N5 g" i% j% c& l2 E   VMMCall Get_DDB' b) b# B/ Y" X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 v) C9 g& j# D" @

% ~' p7 e1 ]: I( T$ ?Note as well that you can easily detect this method with SoftICE:  B4 A% Q# b3 y* Y; f: |9 {7 ]
   bpx Get_DDB if ax==0202 || ax==7a5fh8 t; U1 n8 q* F# p$ Y

9 ^0 l: z5 o1 D1 Y__________________________________________________________________________* P% k6 |+ @* _% p) o' c1 W
  t. t) ?5 t' {! ]  w) a, k
Method 10
# L7 W" u$ v4 U5 u  l  T( H=========
) s7 p( m' h% d& j, m- [0 ^3 ^; y% h7 i+ N- }- }! }! G$ b
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ z' F8 L, d/ y: H  SoftICE while the option is enable!!
( p; x7 }4 c( i/ F, o
6 y; t/ e# h$ ?# }) u3 ]This trick is very efficient:/ l0 l% o3 Y* O$ P: x( ~
by checking the Debug Registers, you can detect if SoftICE is loaded6 g' S4 T) b$ E# Q
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if" I7 m# f1 ]% N) t
there are some memory breakpoints set (dr0 to dr3) simply by reading their9 f/ s8 ?0 H, [0 f$ [
value (in ring0 only). Values can be manipulated and or changed as well
  I) a$ a3 w' ]2 W0 l% ^" G(clearing BPMs for instance)* y7 Q6 Y% P7 ^! C7 g
/ I& P4 V4 k3 m0 F2 _
__________________________________________________________________________
% t- I5 W: H5 H3 @. \: g/ L8 u+ S8 @' p9 K  ]& `
Method 11
6 J" ^+ v' M9 a  d# v! G3 R  n2 p6 J5 J=========
+ m3 X* k3 R1 _+ L2 {, K3 F* E
This method is most known as 'MeltICE' because it has been freely distributed4 b& \6 l& k! o' x4 }8 k' |
via www.winfiles.com. However it was first used by NuMega people to allow
* _: S* ?# E0 \* X/ F0 PSymbol Loader to check if SoftICE was active or not (the code is located
+ e3 ]9 I3 `; g7 t# ^, Oinside nmtrans.dll)." l3 B1 k+ q) o. `$ H& _. ~" {
/ q: h. b. J# Z' f" n9 z% b5 n: R
The way it works is very simple:3 v5 J. g$ J4 n4 w% G8 ]
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ k: S. E. }& s0 r
WinNT) with the CreateFileA API.
4 q) {% I+ G1 h$ o1 r; D+ r" ]2 C9 L- ^* F
Here is a sample (checking for 'SICE'):$ R3 a" W, s4 t- P( y1 N! F+ f! s
9 t8 W! k" z- d. K8 }5 {4 m6 C( L
BOOL IsSoftIce95Loaded()
/ _' [2 F+ _7 s0 g) _! f# {{
% p# @1 o! {6 s- E9 M   HANDLE hFile;  
- t) R8 W0 g- H5 Y; r; c   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE," w! R% w: j+ r  G% G7 [# X% c
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) m( v9 J" w+ L
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- V3 L6 C- U! ]+ I# i0 g   if( hFile != INVALID_HANDLE_VALUE )
( i5 `+ h; q* t6 E5 o& k3 E   {
; E' A  j- i- g. f3 d  V      CloseHandle(hFile);
1 h) Z" a0 j$ s      return TRUE;) c0 K: ?4 j' U/ J! n. w! H
   }
# P# Y8 s5 X, C' ~   return FALSE;
( L3 l# i( `! y1 d( s9 I}
: q" g* C* w, W( B4 F- L
- \& p: `4 o7 c6 a8 V9 gAlthough this trick calls the CreateFileA function, don't even expect to be3 O4 U# i, v2 U& r
able to intercept it by installing a IFS hook: it will not work, no way!; {  n) J- h4 o% s# x+ N
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, s8 _$ ?  ?" Y- ~/ G0 Z/ ~
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 X5 [% }# k5 A, \$ S% [
and then browse the DDB list until it find the VxD and its DDB_Control_Proc% E& y/ o' W$ Q' L1 y1 j
field.
9 ?4 {3 x# [6 z6 ~7 F" g# ZIn fact, its purpose is not to load/unload VxDs but only to send a
8 Y3 O& C  x7 \& p. iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' Z  T* Y! |( X* {2 o+ h- H. uto the VxD Control_Dispatch proc (how the hell a shareware soft could try% w6 ]' b$ p7 }  x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
% Z/ i9 ?, ]& yIf the VxD is loaded, it will always clear eax and the Carry flag to allow7 r; e9 R% V9 a/ p
its handle to be opened and then, will be detected.. c$ ]' Z! e( ]
You can check that simply by hooking Winice.exe control proc entry point
  M6 ?' P7 b- s) Q4 R# j7 R7 S6 j: G, Zwhile running MeltICE.- V7 W0 ?4 G3 T

+ j% A3 X! H7 N) q% N  I  g! l# u" X: t: ]4 v
  00401067:  push      00402025    ; \\.\SICE; f/ t9 n/ @% g3 l& Z
  0040106C:  call      CreateFileA
! [; d: n7 P4 t- R! f# i  00401071:  cmp       eax,-001: D- M2 w7 e5 d$ Y$ O0 C" [" M9 u
  00401074:  je        00401091
  ?$ |, ~6 \$ a0 D! ~# L$ t
( ]* P7 [4 Q1 C2 o8 O# N$ o
- J  ?. w$ T3 a+ g# LThere could be hundreds of BPX you could use to detect this trick.8 q8 K) L5 u% m/ M% _
-The most classical one is:' E7 M" y( T4 v- d  C; k
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 j) c8 |- o. l9 H9 P+ h
    *(esp-&gt;4+4)=='NTIC'
7 G/ J7 T$ B4 |3 v  ^
' {8 g- `6 j8 j# _7 m# V; q-The most exotic ones (could be very slooooow :-(
$ `' n7 u2 h, F5 ]4 i6 |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * p( b' k" J- e1 a0 @1 U
     ;will break 3 times :-(
, X  |0 c3 g* e9 v3 T# J# r, m
% }3 O0 m% L/ h4 H8 p-or (a bit) faster:
0 E& E  o1 ?- ^; _; |   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( Z# C" l  B3 D; ^2 z! O, |
! j. M% b5 }! A- J2 K
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
2 i# U% n$ `  d% }  ]5 a7 _     ;will break 3 times :-(9 a9 u# M/ X3 Y9 E% W; e
. s( V% f" i% j5 a% S6 E7 i
-Much faster:# O" m+ l7 w$ f& E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* N7 }, B1 R2 }4 N# m& L* `1 T: _3 _, r
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 [4 L! y! s6 z: e, Q7 Dfunction to do the same job:4 ^4 v' F' c1 j; T% c

$ v. j4 r" N' @6 W: [# e4 E   push    00                        ; OF_READ. F9 q7 ?* I0 I
   mov     eax,[00656634]            ; '\\.\SICE',0
, V9 k2 }5 {1 a6 }. J   push    eax
2 y4 k" ^" l1 n9 I6 B   call    KERNEL32!_lopen( ^, z! B' T: s! h4 Q+ \& h
   inc     eax
$ B9 m" e, M2 g( p   jnz     00650589                  ; detected
! l# g% {: s) s+ d& g1 N1 g   push    00                        ; OF_READ
+ q2 x, R  v; G8 o   mov     eax,[00656638]            ; '\\.\SICE'
& N4 @. `- u; x- [, b9 p   push    eax$ w6 P' y* O% a8 l  I
   call    KERNEL32!_lopen
/ F" P8 ?( m4 D' f8 D' R* r9 C* w$ ]1 D3 Q   inc     eax5 ^; V! O6 B! N
   jz      006505ae                  ; not detected
7 r1 }( M! e! W* y" C
% N# b8 \# N- y/ P  j# L+ T* Y$ s! k0 \- n0 M
__________________________________________________________________________1 ]5 z$ f+ f& y( _

" V+ X1 d( v9 q. TMethod 127 v0 n. T2 e/ ]7 {% d$ a. a
=========5 y0 u8 U: k2 i9 r& D

5 v$ d% M( K& PThis trick is similar to int41h/4fh Debugger installation check (code 05
. x* R' ]2 o! c& q5 d&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! a) m+ n+ I3 z2 Ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.% z# m" z+ b8 G& h# j7 k1 y

, I) ?  a* Z5 p# T, _) P  B   push  0000004fh         ; function 4fh# R2 K% r5 c$ q0 R; t9 N3 m+ {& d6 H
   push  002a002ah         ; high word specifies which VxD (VWIN32), S- R; K7 O7 p/ s3 E& n
                           ; low word specifies which service; ]- U6 U" q( q/ B' [" C
                             (VWIN32_Int41Dispatch)( i0 q% U  s. V& g1 q" e3 I6 s& ~6 X2 ~
   call  Kernel32!ORD_001  ; VxdCall7 ~( H! S: q' }0 ^9 i, K& A
   cmp   ax, 0f386h        ; magic number returned by system debuggers; [) v; t  R9 p( g0 E& ?: P
   jz    SoftICE_detected' z9 S. k. h/ z4 A5 ~
( A8 t, n) d/ b4 V5 C
Here again, several ways to detect it:& s" }0 |6 t/ B9 V  l( d  f  m. O
7 ^% n: Q  v3 {. s7 h9 m
    BPINT 41 if ax==4f( t# n) S2 b1 y3 j
. }/ G2 V1 M; M- L& ~
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
9 {1 s+ X" t! l; T9 a, ?% J2 V$ g. H1 G% d2 K# h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& z( j0 d  {6 w/ V
' e+ U0 N$ |' \5 U+ f7 h9 _. O% `    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 Y: X# W& e. x  `/ |3 ?2 b  Z
9 z4 E8 l1 B! o4 h5 C8 M1 r5 j0 m__________________________________________________________________________- y7 z8 O7 u8 H; B1 S- h2 Z

- V! ?. t+ k" R' Z* L, @) a3 ^Method 138 i, c/ @- l& `
=========0 n) B6 E) }' W. `4 {4 z
/ @% H+ m' F- M. F2 I# _# a, l
Not a real method of detection, but a good way to know if SoftICE is- }, o3 T, E8 T' ~8 O1 k/ {" u, W7 z
installed on a computer and to locate its installation directory.
6 ^, |6 t' x* k& ]% d! sIt is used by few softs which access the following registry keys (usually #2) :
: ]( o( W% p; R0 ~$ `) l. O8 X! a  x; c! {
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 Z& ]3 t4 j& k4 N- I" e' m( ?\Uninstall\SoftICE; n: ]6 p7 i* ], W
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% j7 @% S6 l: }1 {-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" Q) M1 F: M# F) U
\App Paths\Loader32.Exe3 n% s) I/ |7 A& n
# B5 i/ Q- L) I4 f3 \: l5 [

) j, w* A0 ]  INote that some nasty apps could then erase all files from SoftICE directory6 m" U; X$ N& K+ L# D
(I faced that once :-(- ]! @5 U+ q3 U5 s" Y
# x1 I( }! L5 ~& _! d) e0 O0 ~
Useful breakpoint to detect it:
! G- k1 d( ]$ ~; s
/ M) h; R: U: Z" |) Z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ e, F! B# H+ M" ?0 z$ r/ P9 N, {% ]7 H  K1 r1 X' Z
__________________________________________________________________________
$ D3 u* Z, k; h( F7 B, J2 X. C# C) i* ]: Y
2 `0 p( |0 S6 h6 N+ I! b% Q' D& y
Method 14 . T/ W5 p- }1 u0 j  Y4 E. ~9 d
=========
- |3 n9 Q8 ^  W! X" A0 H+ n/ u( `. F# H  ~2 s
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! v# U% ^, `. v- g
is to determines whether a debugger is running on your system (ring0 only).* O, C/ L9 M; r+ J- K* m; R
% M) ]" C3 Z- y6 y
   VMMCall Test_Debug_Installed
* {1 m" {* X! i- [8 n+ H8 q   je      not_installed; d, b$ ~. q3 @5 }

# ~) Z/ Z3 }$ Q7 A- mThis service just checks a flag.
+ Y, ?* q- T$ k: K9 L* G8 l1 Q* t7 t) a</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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