About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
* U7 S! F) Z. q1 a* o<TBODY>
- g  \* n4 R% N. u& t; c& L<TR>
4 J' k; F( J  E, n<TD><PRE>Method 01 9 C- E6 z+ m) N. n. ?4 l1 w
=========
$ o3 f* \) R7 \4 t0 o/ B& r
, O# e; \. @  y1 T( PThis method of detection of SoftICE (as well as the following one) is7 _! h& m! M( K
used by the majority of packers/encryptors found on Internet.
2 p3 B- r( X) v/ a7 }* g1 TIt seeks the signature of BoundsChecker in SoftICE( n* i4 X/ p( |1 d/ q

  G8 m1 L1 }) l# O6 R; q( Z  w    mov     ebp, 04243484Bh        ; 'BCHK'+ t3 N* V. n; C& |
    mov     ax, 04h* @% V; ~- U- ]7 K0 J
    int     3       # S; b' |3 r) m' y! ?# m, y
    cmp     al,4/ ~+ Q4 d5 C& `3 }
    jnz     SoftICE_Detected
4 h7 C6 c, z' \2 \9 Z7 T
$ i' v* b, N: I" Z3 d___________________________________________________________________________
: R2 C8 s0 G9 `8 a5 l; I9 S% X) Q( c: F& g/ D; v
Method 02
8 Z& p0 t) }8 g- a9 K* ^1 h# R# u# {=========( c, |3 f0 N2 n7 S6 }/ V

) W6 x4 R! w! v5 ]6 }8 w: p' MStill a method very much used (perhaps the most frequent one).  It is used
/ x/ U7 s( j& C4 \4 ]2 bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, r, ]+ w& _. c1 e6 hor execute SoftICE commands...
% u- q. m9 y1 a6 {0 P3 [It is also used to crash SoftICE and to force it to execute any commands5 m% @$ l4 Q. y- I7 Z- R2 l, B
(HBOOT...) :-((  
0 ?) I* V$ R9 j! Y4 W/ H6 t# c+ t$ j- _* E
Here is a quick description:
# d) `# t% X* ^1 v" V-AX = 0910h   (Display string in SIce windows)
) y* t/ F2 F  i+ y1 \4 [-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)# w/ u0 p0 x. b7 s" ~; \
-AX = 0912h   (Get breakpoint infos)
+ k" T% \+ n9 e! n& G$ W& s-AX = 0913h   (Set Sice breakpoints)
8 v/ B2 N4 H- E) ~, u/ Q-AX = 0914h   (Remove SIce breakoints)6 s7 V/ ?4 [+ p& s6 S. v$ a* e3 S
% V0 Z+ N0 Y% D' Q) z" [
Each time you'll meet this trick, you'll see:
; T; ]1 I+ Y0 b2 J-SI = 4647h, M1 V5 K0 b# S% j
-DI = 4A4Dh7 \2 {* d4 ?9 f7 u! [+ ]  g2 Q
Which are the 'magic values' used by SoftIce.
. `! x! v1 H' ^' G( s$ gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% F( t. _. [2 f! |
9 `/ }9 Y, }8 f2 V+ F2 P! w0 }( f8 u, xHere is one example from the file "Haspinst.exe" which is the dongle HASP; n  }2 u, J2 S- z
Envelope utility use to protect DOS applications:- K0 [" b: h0 O
4 j! C+ H# b9 L' Z8 C/ j2 ~6 U
3 i3 ~7 C3 }$ C; g& V6 w
4C19:0095   MOV    AX,0911  ; execute command.% x, h! L  G5 d" k7 x$ `
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  z( A: k$ X" v! r+ b
4C19:009A   MOV    SI,4647  ; 1st magic value.
% V0 l7 S1 f2 _7 [8 `4 L4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: t: X' f$ U# c3 n4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- Q! D# S& g0 z0 Z# Z6 @5 ?4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  l: V/ h* d) t( H; Q, i. U2 \4C19:00A4   INC    CX! f8 N3 _$ ?* K1 R7 b/ T6 C. o# ]
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 e$ h5 P9 H5 G+ v+ n% [1 \. z4C19:00A8   JB     0095     ; 6 different commands.8 z2 x9 |. X1 d/ b
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 t2 ]5 V; v5 O4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' S: U( {1 W- R7 j
. B" y( \% ~7 f# l* ~3 `% H. Z
The program will execute 6 different SIce commands located at ds:dx, which0 {3 p( F9 Z# G# Z
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT." P: u5 B- C' J" q" E% s6 D

- d* [+ X6 Q/ }* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  c& `  B* c! [3 H: n2 f' A( N___________________________________________________________________________: U. f- ]* W7 r8 Q: U1 I: O
3 A5 V0 T7 w' z9 N( G' a) n
' r! J  J# o- ~
Method 03
* Q8 F. a3 N' M* J/ N: Z=========
  E+ A4 _* l: q7 d) t1 q0 I! ]0 e2 G* K# g6 s9 u0 C
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* m4 j  K8 @/ Q; r; Z(API Get entry point)
7 B% L4 i. e: o$ ~$ c: {        3 V- O2 e# h' U" J2 T% i. o

0 a- H+ x8 t  o    xor     di,di+ [9 S) `2 w* m
    mov     es,di; E! K4 f) r& q" Q& `0 n6 W
    mov     ax, 1684h       9 ]. ?6 [3 {0 _  M- S
    mov     bx, 0202h       ; VxD ID of winice
5 E; A. \. `. [) ?    int     2Fh$ l; w5 E* l3 _, [! `& B
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( S4 g2 b- E$ g3 Q9 V
    add     ax, di
& Q& [, q+ x* c+ b: ?    test    ax,ax
! Y' |8 Q" e$ W8 o9 r    jnz     SoftICE_Detected
& z# o0 U. ~, y1 M: |- A
7 n" O* N+ g& }$ k) O; N___________________________________________________________________________  O- d9 B6 X" D1 @0 C

: _5 F, b( B1 L1 uMethod 04
4 h3 I3 C  W0 P7 O. B! s) W=========, k# v& E9 P7 X. K

, A; D& h$ r9 D" r" X9 H/ uMethod identical to the preceding one except that it seeks the ID of SoftICE5 C5 S4 g3 p" y
GFX VxD.
8 P# s+ M1 {  _
" s  i' S3 a0 l9 x    xor     di,di
2 L  v) Y9 E- |    mov     es,di
) W5 \. t, t% ^    mov     ax, 1684h      
  c3 \( l$ v5 q( _' _    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 z9 C; ~( j& ^3 F) o" L4 Q) v    int     2fh
0 @  s* y/ D+ @& h; O    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" s, r3 J2 X# C9 N    add     ax, di4 x( Y6 T% M6 h
    test    ax,ax
0 K* Q1 F% p, a0 f9 p8 P; M    jnz     SoftICE_Detected
9 ^* P$ ?/ l; U6 H  _
( Q3 m; s; g+ v1 N* c! L__________________________________________________________________________
- ?8 U) R1 u' j3 n+ N  _* z) @" j) |1 k, A. G

: s4 S, ~, u3 AMethod 05. O1 M1 u/ \0 K5 K9 }( p9 c- B! M+ z
=========0 p1 }1 @4 W# }; k+ i0 K' y/ u- t
, H( S$ _' X. M0 @+ n1 s: c7 M
Method seeking the 'magic number' 0F386h returned (in ax) by all system
" }. F" D4 n" r: r  Gdebugger. It calls the int 41h, function 4Fh.7 f: L& m$ x' M0 T* d
There are several alternatives.  
; {. ?% \6 t' P6 C- q5 U; n; ^' x- W& B; y
The following one is the simplest:4 O: \3 s( Q- a6 `/ V* L6 n

' O+ G. V: i" _, V* `! D4 _+ B4 q    mov     ax,4fh0 a  c6 u5 g: y7 E: G
    int     41h
3 _# @1 v: e3 r, k1 m    cmp     ax, 0F386
: K7 W$ W5 h7 s5 S. C    jz      SoftICE_detected
  c. j  X# x5 X2 V/ H
- B" D0 @/ R& i4 k/ y7 s2 \0 s
# ~1 k% o2 s7 a* R+ C, `Next method as well as the following one are 2 examples from Stone's
$ C- [' X* J- }"stn-wid.zip" (www.cracking.net):. I9 Y* s* R1 l5 y3 N* U! I
& `, e* ~7 M! o  c$ [( C1 k: A* ]
    mov     bx, cs
2 z) v% `+ E' H: ^- `    lea     dx, int41handler2
! L5 w% j2 X1 {/ m    xchg    dx, es:[41h*4]8 r! R  g4 q+ Q
    xchg    bx, es:[41h*4+2]
- F* y' D/ v9 |' T2 |2 k    mov     ax,4fh' T4 h6 ~4 z# T1 j( k0 ]
    int     41h
) x% b; J1 Z9 v/ F/ |    xchg    dx, es:[41h*4]
- Y- {6 C3 @% H: }2 ]2 s    xchg    bx, es:[41h*4+2]: N& C6 Y( K' j5 X+ t
    cmp     ax, 0f386h
6 K7 c% J* W" z' f" _    jz      SoftICE_detected
/ r2 E5 k$ D2 l, i( X6 R  ?8 a# L+ f8 x
int41handler2 PROC
! G, {+ l9 f6 E, C+ ]( S5 t    iret/ U8 o. @. S" ]" s6 q, b5 Y3 [) B8 `
int41handler2 ENDP( k& ]' x( w# [- u

; u& q7 ~' s3 t# u
, `3 q9 s9 W" V1 m' {3 b0 w6 g# f_________________________________________________________________________, v6 P  p" O# b' z+ ^8 S. D

& B( s; ?$ q: R- `0 G* G# [& M& ]+ B& s' Q$ a( C
Method 06: U  M9 ?0 B* l
=========' m' t  ^2 y( n; K' [0 c

( l% A! t" Y. E8 p; h$ d" e& L  T
2nd method similar to the preceding one but more difficult to detect:( Y- I& y- I# E1 y
- `% R% ~) `! T& @9 n, l

  j9 x- K5 R5 }* _$ Dint41handler PROC, o/ u* y6 E; d/ A: \: q
    mov     cl,al
6 p9 L  {0 X$ T0 j    iret
0 O0 p$ g( Q- p0 P$ X/ H: sint41handler ENDP( D( c3 r/ _/ x: H# J2 T1 g$ ?( C

' b  s$ d9 v  v) c( d0 U! n8 L- r( C. l6 X9 e# r0 ~" y  q
    xor     ax,ax
  u# \/ V6 M( @2 o" a* V% d    mov     es,ax# i* }: F5 x/ R, `; c, K
    mov     bx, cs  I  e! G5 Q* _+ I$ y5 x$ D+ Z
    lea     dx, int41handler2 u1 C0 p! S* S* J) F3 C
    xchg    dx, es:[41h*4]9 @: n0 F' s% H( J4 i( i3 S4 S8 N
    xchg    bx, es:[41h*4+2]  R6 k1 j/ d5 \
    in      al, 40h# w  A' a8 ~# r5 [$ t* i: ], L
    xor     cx,cx
' J: l1 i) |! d* o; T    int     41h
: m- k0 m& [+ X+ A8 O4 l    xchg    dx, es:[41h*4]
( t- }6 q+ B" Q9 b  S    xchg    bx, es:[41h*4+2]
4 }' E+ ]9 o# X& v& k8 G    cmp     cl,al
+ t' w- ^/ ^) h6 [/ F7 j6 x    jnz     SoftICE_detected
4 B% D  e4 H  ^4 k9 C/ z4 N9 }( _% m: }; s/ ?
_________________________________________________________________________0 z+ R, t4 U0 ~4 e' u4 s
  B0 E4 K* v" _3 o. S2 g
Method 07; P# c2 C0 w8 Y6 a9 y) ^, Q& n
=========
6 M( }! y- L  \0 r; v8 c7 @8 @* L
Method of detection of the WinICE handler in the int68h (V86)
4 l  i7 @! K- k4 ^, O4 q
8 G" H# k$ _' @7 A( z  Y/ s    mov     ah,43h
6 q; X, U1 z7 f+ }! F& i$ W    int     68h
5 c  ?! D) j; r1 ?; _9 ]5 l    cmp     ax,0F386h3 u$ E- k4 G5 {5 H# z9 t6 z% a
    jz      SoftICE_Detected1 i. p: H2 _7 [. t& {
5 |# f( N8 K1 j! F

7 O0 Y4 v3 |: ]- x* J2 M- n- m  _=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
- k% p0 H8 ~$ e+ J* d: j; J   app like this:: j6 s6 F9 L; k4 P

: M- M' N. f8 z/ e( w' m   BPX exec_int if ax==68
4 k( h% E; S. `5 ?6 O5 ?   (function called is located at byte ptr [ebp+1Dh] and client eip is2 {( J4 c* ]; D+ M
   located at [ebp+48h] for 32Bit apps)
$ _# ]+ s2 k, x) {6 J% P__________________________________________________________________________
8 ?7 U8 _; R8 f4 Y
) I9 q4 y* D1 W9 ]9 z& {2 p2 \# ^
Method 08
0 b& J3 @* H3 v% r* q=========- N( [& ^' q" e' j1 x
1 E6 P! u/ D: i1 _) m8 ?% W
It is not a method of detection of SoftICE but a possibility to crash the: T9 N) O8 p6 |" v: s
system by intercepting int 01h and int 03h and redirecting them to another
" _* m3 d1 z  r+ M+ j- ~1 ]+ zroutine.
& @* ?+ a" M+ p9 s, F) L- qIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 y7 M# Y* ^) i
to the new routine to execute (hangs computer...)
# a) k5 K' L0 M( r& ?) s
) s: `' e  J( Z) Y7 S; \& Y    mov     ah, 25h
6 I' h. \$ R$ i/ h. C# L    mov     al, Int_Number (01h or 03h)
" h, T( ^6 a$ U# A" c8 l    mov     dx, offset New_Int_Routine
/ ^+ K7 Z/ O& e6 A3 G    int     21h
, ^$ C3 W+ E7 ^5 Z2 ~; Y0 Z$ |1 ?, B) l3 F: [
__________________________________________________________________________
( I1 C1 u0 S3 n
6 X4 S9 t* K4 Z4 O2 P! L4 lMethod 092 d: g* C! _5 D5 b7 P
=========
+ C+ J( p5 c. X* N
: O5 E. V, g9 T& V1 J4 U; ?6 ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 A) b0 H- W1 y+ `  O2 b  y" E* \4 D
performed in ring0 (VxD or a ring3 app using the VxdCall).# I- n- U5 n3 ]1 J' G
The Get_DDB service is used to determine whether or not a VxD is installed
7 D$ C% U  e: ?' t  L) w7 @/ s! i- Zfor the specified device and returns a Device Description Block (in ecx) for
4 v- v# w" e1 w. B+ Gthat device if it is installed.
  X, ?6 F, Y! i- Y; `) M* H( ~& U+ M+ k& X, k
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 U5 A) Z' C- Z6 t0 J) n, r
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" b& l' n3 @) `! t% o4 }   VMMCall Get_DDB
" A$ S1 Y+ U& p8 c   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. U) f( z& V4 p* e4 @* z0 a% }- T
: n; s! e9 F6 k% C  {: L9 d
Note as well that you can easily detect this method with SoftICE:9 Y: d: B4 m, D
   bpx Get_DDB if ax==0202 || ax==7a5fh6 k- n9 k: A1 H8 g7 d( L( g+ {! z
. ~1 e5 p  p+ R% D# N/ F
__________________________________________________________________________
& B1 \; ~( D$ z( @8 H( q' T  A$ w8 O2 D
Method 100 G* w. B/ }  U3 T3 X0 ^7 [0 {3 {
=========: F' ?) a) G1 y3 B( l
  C$ ^8 n0 _' z2 l
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* @* q2 j* G' ]  SoftICE while the option is enable!!
+ p+ p8 e+ B+ @; S7 G* H
; S/ l  m5 b6 d$ H, }This trick is very efficient:
$ q% G5 I5 P5 R- lby checking the Debug Registers, you can detect if SoftICE is loaded
9 M3 k. n9 R, L6 A% G. N& X(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# O* d) d6 }2 ^there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 W$ u, ]% }1 [( K8 C" i8 _# Bvalue (in ring0 only). Values can be manipulated and or changed as well
: P/ n( z' f- E7 p(clearing BPMs for instance)/ E. F- J! L; K5 b' B
) A$ X0 C- d5 y4 T
__________________________________________________________________________
5 h. N8 U( v* A; T3 o  I: k" S2 g- g; Q
Method 11
# R8 y1 S) B, I; U- w  }+ W=========
: p. V, \& y2 t- x6 O8 ~( J2 s$ b! [0 O3 |! Q
This method is most known as 'MeltICE' because it has been freely distributed
( I6 d3 h3 _: n% ]$ y7 A; |via www.winfiles.com. However it was first used by NuMega people to allow; u$ w9 D5 U; O' A" Y1 B' k
Symbol Loader to check if SoftICE was active or not (the code is located/ Q  ^& d4 z! h5 E7 W! M  G4 o  o
inside nmtrans.dll).
3 f8 m( x) a7 W5 U- ?7 j( T2 d8 e& V; a* h2 U7 e" W  j0 u
The way it works is very simple:& ?' r1 D+ T2 M; Y2 |9 G
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ \6 R3 L, A+ [  I
WinNT) with the CreateFileA API.& O6 ?' r8 Y* u, H" D6 w
# j  X1 S2 m* n+ |
Here is a sample (checking for 'SICE'):0 G5 A' c) t+ Q9 Z( y
, j# ?1 T7 f5 z( d! j
BOOL IsSoftIce95Loaded()
8 }( A4 [  S8 @: W{
2 \% Z9 {9 I$ v0 Z   HANDLE hFile;  
; x4 a4 ^9 N6 X0 a, x% g8 z- {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 w$ z, G* \# |                      FILE_SHARE_READ | FILE_SHARE_WRITE,! M0 j# K- O" s2 y! }' o: Y5 Z
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);5 r( U/ I. b+ F% y1 f6 K+ O7 _) y
   if( hFile != INVALID_HANDLE_VALUE )
8 U2 N7 a+ g# l2 \! C+ N9 _, ]   {: q( s7 i! C2 N' x
      CloseHandle(hFile);
1 H# }, F( J. @$ Z      return TRUE;
+ S% i, K  |& p: W9 T   }
$ c+ u5 G# f8 X% J2 J   return FALSE;
8 h# W/ p4 o, O}2 \5 @8 x2 T1 M  W* Y/ L

! R6 s9 g0 i' v& KAlthough this trick calls the CreateFileA function, don't even expect to be
# K3 J0 ~0 t) R2 _/ aable to intercept it by installing a IFS hook: it will not work, no way!
0 r2 ^2 Q% U: b8 F- y# V& h# yIn fact, after the call to CreateFileA it will get through VWIN32 0x001F: x$ F/ [4 }6 R! [+ e/ T
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 Z1 a# S2 k% N0 {* J
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 _9 N  ^+ H: K4 C* B: F# O0 r9 A' ?
field.5 m; X6 ~8 S. v- {* P6 x" [! H! A
In fact, its purpose is not to load/unload VxDs but only to send a
7 }- |6 z5 j  Q, n: C  {4 j6 v2 OW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). @+ e. T6 q  w- k( a* _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
: V) a; b" r% p- K) j% ?* O4 [  Oto load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 D- J6 y/ e- G8 QIf the VxD is loaded, it will always clear eax and the Carry flag to allow" X7 {3 ]; i% l7 q' }
its handle to be opened and then, will be detected.0 M0 A) N) U9 n0 X2 E8 F% b
You can check that simply by hooking Winice.exe control proc entry point$ {% ]. Q  x: @) [5 C7 P! u6 H
while running MeltICE.
0 c% L5 h# P8 Q# |  B8 F. E& a2 _- V4 S! N; o: T/ V
8 B5 Z  h( P6 \' H  A0 `6 Y* a8 ^
  00401067:  push      00402025    ; \\.\SICE; R4 b' x* O9 }7 H% N: x
  0040106C:  call      CreateFileA
7 O! c7 z% Z$ U  00401071:  cmp       eax,-0016 p- g0 p+ T0 H9 h* [0 }8 {
  00401074:  je        00401091) k# D- I6 y, ^1 a
$ k8 @- L8 _8 y, j' l' N
' L* z. x, t0 G7 h5 Q
There could be hundreds of BPX you could use to detect this trick.
& _+ P& b+ s, a-The most classical one is:$ }8 _4 e& I2 l
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) ~2 L3 f+ L! k& ~) r$ y
    *(esp-&gt;4+4)=='NTIC', ]8 m+ ?1 d' C7 A& U% T

$ v" d7 n1 p6 U* X0 @-The most exotic ones (could be very slooooow :-(
* ?& M' R" f8 o6 |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 Z$ ?4 L4 Q- L- Y; P
     ;will break 3 times :-(
2 d1 T' N: w8 N* b
* _% j$ Y: T. O0 E! R-or (a bit) faster: 0 y+ h4 T- E8 A  ]8 M# k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" F# ~9 j1 E  V( O$ O
, W+ k; K, p; q6 l, H- W. v0 j
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 X% p: V" k9 y. S
     ;will break 3 times :-(( k8 X- T" K, L" [% ^

6 X; R# R# e+ N4 L' [-Much faster:, v' t* j: f. P/ J
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 G, }0 s* Z0 Q& }' m3 ^* |9 P5 J5 a0 g' `5 Y7 W* {
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
  }- Z! R/ S" s$ Z9 Efunction to do the same job:/ O% p$ A1 \" O9 p" k

+ J# h8 `$ \' E( T   push    00                        ; OF_READ
' r  z8 {6 W) V; J. e   mov     eax,[00656634]            ; '\\.\SICE',0
' R4 Z9 J# T% O$ k2 d   push    eax
: f5 R1 w2 x" N* J0 V, _   call    KERNEL32!_lopen
* B% D+ b3 _) ^/ ?# f) r7 n, P   inc     eax; r! e3 g4 T) ^. @
   jnz     00650589                  ; detected
1 T$ Z; R. a2 o  |& T2 a   push    00                        ; OF_READ
$ ]9 a7 G/ A. |  P/ F$ N   mov     eax,[00656638]            ; '\\.\SICE'
3 V3 p$ h6 Z) X. r4 s1 j5 }6 f0 b# u   push    eax
; ]5 ~  a/ Y# b% A0 `   call    KERNEL32!_lopen
6 ~4 I0 d0 Z0 f* o* l   inc     eax% X) v- _4 D4 ]- d
   jz      006505ae                  ; not detected
4 t4 p4 _9 m# E( _* @9 o( ]% W) a; U& B& ]  p. q' o& q

4 E% t2 q  K" x# T__________________________________________________________________________: D" J+ H+ r( R0 {

, C! M# K# R5 }3 r4 k/ g: QMethod 12  t0 R1 ^- W$ c! z* ?
=========
& B" E  R- |5 ]: \7 k& ]* Q( h* q2 j+ Z4 o# p1 z( A5 I, B
This trick is similar to int41h/4fh Debugger installation check (code 05
  |8 Q3 w' c# p: H0 s. |&amp; 06) but very limited because it's only available for Win95/98 (not NT)- P/ x/ ^/ P' V& T+ z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, l% `; _, M) n0 I
( T2 x( T; Z$ n! {   push  0000004fh         ; function 4fh" P. _" M4 M6 f! N
   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 l8 p/ Q+ N6 B! S; }- K) w                           ; low word specifies which service
$ @8 ]) X# i0 ]' h. \0 w* Q2 h- L! Z                             (VWIN32_Int41Dispatch)4 f0 S3 _0 Z* [2 W9 n' A- J  }# ^, T4 X. z
   call  Kernel32!ORD_001  ; VxdCall" h9 [4 D$ s. M, Z
   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 W0 n2 v1 z1 i  I$ s( I; H# a1 z7 s. U   jz    SoftICE_detected
3 V, U/ {8 s- G  c8 Z% Y  c, o
. p, Q+ r8 b4 v; [! o2 wHere again, several ways to detect it:: c& c+ T2 X" q9 w2 F$ J2 b$ P+ k
* {" a  u4 ]4 W" t
    BPINT 41 if ax==4f
3 A9 _: o$ S( e# u% J; I9 w& `/ H0 u8 `8 h# ?; m8 s, l0 o: `
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) `$ Y' S7 f- [" D" x# A. S

* r/ B1 Z3 ]2 x2 }+ T    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; j" g: Y) [# E
! T) s' u( C8 S4 `
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( m: C8 @4 j+ ^5 ]+ {5 h+ K
* v4 P( _) o8 X0 K
__________________________________________________________________________
( p+ `8 k2 f5 D( p  Z+ f6 u3 g2 g. z; N' _  k6 q: S) V/ ~7 {; E
Method 13
7 P2 {) g, ~* C7 v# F  _# X=========7 d( n- w: k2 B. ]# S6 a8 ~; @
  }1 {3 a2 N2 \
Not a real method of detection, but a good way to know if SoftICE is
9 G6 o# j0 |) P" o  ]! @0 ninstalled on a computer and to locate its installation directory.3 v' K, R6 M; Z$ }- G
It is used by few softs which access the following registry keys (usually #2) :
$ w( C7 M8 V) W( w  B* m1 B3 f- x, h) x
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* {* E. S* I5 Y$ r. m% a- _% O) Z! d
\Uninstall\SoftICE4 }: a; ~0 U8 q$ n1 e
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 g. \# p1 ~( O/ D-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 `5 `! ]# f) J9 N' l/ a\App Paths\Loader32.Exe- @0 D3 B# k; \9 C( S8 T

# _: s: e7 g' R3 x- @) I
! [; i7 I$ R+ [* V; o7 RNote that some nasty apps could then erase all files from SoftICE directory
/ I! V& w& f- k3 b. l6 T(I faced that once :-(
" b! F  S% U. [) K$ O+ N1 B3 ~9 m. t) l
Useful breakpoint to detect it:
0 l: `/ N# S% y/ f* L+ z  M. j  S% u
! d5 r) S* Z2 o! B     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'9 m( l) O1 x1 d( \6 h
5 b+ a4 W9 f) F' M% i. y( ?
__________________________________________________________________________& U! o- `: A/ O7 N6 ~7 ^  ~
% G( d, [# J/ m& O: D" n8 K/ _! X

( ^) t# ^4 J2 g( v% m& d4 }Method 14
& F% p! B4 d; K$ q" E=========
* v5 I' [/ v' C2 Q' I6 i. m+ v, R0 b  ^5 s! K8 a1 x
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, n! @6 E/ B% ^9 j
is to determines whether a debugger is running on your system (ring0 only).
/ Q. e/ k. f& E' n$ b+ v. z
# O3 F/ K/ k" w1 k, W1 o   VMMCall Test_Debug_Installed
$ }( w. g9 V; [   je      not_installed8 u5 v3 D- B, O, S) ?% @: i; h+ i
. n/ E2 X6 n) n+ h" c; s
This service just checks a flag.
# i9 }/ m, n6 J2 M% b  u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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