About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& q) A9 [7 j" C2 Y3 X$ ]7 v3 G<TBODY>
9 z! e1 Q5 E: G' c0 j' ?- u<TR>: Y  P0 O6 S* w
<TD><PRE>Method 01
' L* Y, p, m0 i$ c. `! t=========
" c6 t8 a& L. \5 o
% P/ S! s3 X% {% \+ d( cThis method of detection of SoftICE (as well as the following one) is
  @# ]* i# l  [) W$ \3 O6 S5 x* jused by the majority of packers/encryptors found on Internet.# y! V( Z7 N3 y- Y& J: [) I
It seeks the signature of BoundsChecker in SoftICE
6 @+ }0 ]" ^6 _  y, ^" z: p7 e- _' S  H$ h* B8 F
    mov     ebp, 04243484Bh        ; 'BCHK'
/ f. F, ]; ]2 m1 D2 @2 M0 `    mov     ax, 04h* r- \$ p+ B* N* L+ a4 p
    int     3      
$ x7 }: b' P2 h! Z    cmp     al,4
: l4 Y4 ]3 H) w8 @' }4 z' ?; H    jnz     SoftICE_Detected/ w2 I; p  O+ Q, k$ M" w
: Z! P% s2 ?( g# }) z0 P% |' W
___________________________________________________________________________7 N* ]1 H2 _5 j9 I4 C

% o0 {/ l( q; J- E4 W' [& hMethod 02
$ H; g/ ?8 d; N! L/ t=========; G) A) ^1 c! D
) F; w8 w  ^! D3 s' @# E# i& |
Still a method very much used (perhaps the most frequent one).  It is used# s, k( ~) I' c+ {8 D
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ U% {- o4 m1 ]1 ]4 |! L
or execute SoftICE commands...' A) A6 C7 O; b
It is also used to crash SoftICE and to force it to execute any commands' o9 A( m: e( O/ c7 Z
(HBOOT...) :-((  + b$ D8 P, o8 }: p, n% X0 f
* L" U# Y, n; k) d2 ?3 _
Here is a quick description:) b0 c6 [7 f; N+ O. ]
-AX = 0910h   (Display string in SIce windows)2 Q$ y! t3 [4 U* i+ b2 \5 k4 |
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  L6 A1 {& u8 c/ W
-AX = 0912h   (Get breakpoint infos)
$ ?; i8 A+ A+ i-AX = 0913h   (Set Sice breakpoints)- ^# Q- |. t; ?" s
-AX = 0914h   (Remove SIce breakoints)+ V5 j$ B* |0 j5 g* l% A0 i
+ R( U4 z6 |, ?! u9 f% l, u
Each time you'll meet this trick, you'll see:
; F  O; v& a& J% E9 n1 w) P3 X-SI = 4647h
8 ^7 {: a0 @; R6 D. R( d-DI = 4A4Dh4 i, ~; y1 w( b$ T8 @5 [& l
Which are the 'magic values' used by SoftIce.8 d) F: e8 p- N' L8 |8 V# q0 I
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# h' v/ s1 P- Y- `) B5 q7 |3 Q& Z
Here is one example from the file "Haspinst.exe" which is the dongle HASP
3 N& [" T( b) uEnvelope utility use to protect DOS applications:
3 A, F" k# U3 d' @9 S3 ~4 q: u

& H& N" W& w2 h3 o( M4C19:0095   MOV    AX,0911  ; execute command.
1 G! m) R9 D% Q+ l4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  Q, O5 l4 k. g. d+ P' K* h: ?4C19:009A   MOV    SI,4647  ; 1st magic value.0 E4 [8 e  ~/ C! V: l" }/ {2 J
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 q' _7 P8 v. {# ^' l4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*). u3 j& L* E# \7 x3 L
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* D- d' J  Q5 a3 `4C19:00A4   INC    CX1 [  u. ~5 A2 ]9 Z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' |* Y. M8 H( C5 y
4C19:00A8   JB     0095     ; 6 different commands.8 r" k) g* n9 _' h' \6 t
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- }  a. x+ m+ j+ K& j' o) J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  F$ i. y0 M  x
% @" k% t$ c! e$ W
The program will execute 6 different SIce commands located at ds:dx, which
: t) o3 _6 z% |# g& Zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 a. G, K, O3 x1 S: k0 t1 N

+ F9 w7 f5 N/ t6 @7 G6 f9 H! A0 q) ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
0 z2 i0 x3 F$ x+ c___________________________________________________________________________4 n0 {# e# @& x9 e/ y
( Z, M! }9 I1 w- ~" U! B

7 |8 y5 n: k! f3 N* g- RMethod 03$ v5 y. L) b: f0 I4 G' H
=========+ V! R* Y. ]) p0 t  I& o) }& r& |

! U# H6 @6 ^9 _7 @+ I: a; p7 vLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& B9 S$ O% I) l2 a(API Get entry point)  d' Q3 p1 T% B+ B
        3 e5 l" A* @' A8 T- L7 {5 N
; R- [- M( I6 T
    xor     di,di* H  U& y$ H# m* p/ P
    mov     es,di
1 e1 U2 l5 E9 d: h    mov     ax, 1684h      
# y# b" i+ m& L& b3 f6 O: R/ ]( k* B6 m& d    mov     bx, 0202h       ; VxD ID of winice
$ e6 P& h% X' U( \) P% J# t3 }    int     2Fh; ?! N  G/ F& E
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 J4 `: ~, j/ M# v  b
    add     ax, di
2 B) G. p3 Z1 `5 Q& n5 Z+ C    test    ax,ax7 S3 Z0 b+ I1 B0 O
    jnz     SoftICE_Detected" I  |; k4 v$ O# k& \" n+ e* r! P

5 q6 U9 d9 `2 A$ G___________________________________________________________________________3 R! i2 p: ]  d5 @% p, m: r! U! u) V
; Z- X8 ]# O4 F* w
Method 04
' E# Q6 v' m* z* |8 C=========
3 y. p3 G4 L; {" R
. r9 e5 ]$ ^2 `+ T" ~Method identical to the preceding one except that it seeks the ID of SoftICE
$ Y3 s3 h6 ^$ J8 d" B$ QGFX VxD.& h$ l/ }. \  G; M! N
  c; p/ T7 l1 J& j% |2 _
    xor     di,di
! [; ^8 ?- J0 c9 k% c    mov     es,di
* @; g$ P1 B+ m: b    mov     ax, 1684h      
7 }: u5 D3 M8 Q  s0 x$ D" w: V    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# n: h4 p. p( v& I    int     2fh
# @' i3 a  i- P2 U! [+ s    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, Q: |+ D1 V( [" c3 z    add     ax, di
. L6 q1 J# K; Z  x8 A    test    ax,ax
; }0 s* x( `1 E* H; |) n, l8 u    jnz     SoftICE_Detected) A2 r$ H" M) ^9 v, ~

+ W7 n. m$ V1 o3 d* Z__________________________________________________________________________7 ^* D0 F# }$ ]5 s( ]: r% C

& ^6 {" ~  q* ]8 [% i; y* z+ B
, d1 _  r; G% l/ I. u+ FMethod 05
. I  d4 @) }% y' u" ]4 @' ?# D0 a/ g& i# O=========
& i0 m% p1 Z. F3 Z6 a. w
* }( i4 v9 a+ A; E$ [5 EMethod seeking the 'magic number' 0F386h returned (in ax) by all system
" P1 ^+ a2 ?- odebugger. It calls the int 41h, function 4Fh.  |/ \* Y6 V6 v4 f# W. C+ D
There are several alternatives.  
& R2 D: f3 `0 r! T  G; v" b0 P% b& _8 j: g! c7 M+ g+ U  h) S0 _
The following one is the simplest:
1 f7 B/ c$ A* _* e2 w6 t! |/ }, f$ u: w! h- p
    mov     ax,4fh8 R1 {% @5 ^  h6 e  _2 o$ e
    int     41h
5 a* g6 r4 G9 F4 u1 Z% b    cmp     ax, 0F386$ `+ s/ g, z$ L9 s- o+ Q
    jz      SoftICE_detected3 i" {2 ^4 E5 x/ E6 ]
4 `. p# t& ?7 `/ \* Y

$ f0 }+ A. C, l* \4 _3 j+ N* F: XNext method as well as the following one are 2 examples from Stone's
4 _3 S  n+ o1 ^4 ["stn-wid.zip" (www.cracking.net):
6 X8 Q0 L$ M' A) f  R, D& z1 `
7 F" l; `$ r" n. [' d4 g! w0 j( J    mov     bx, cs1 U- l! h) N  h
    lea     dx, int41handler2
+ m9 x/ g* c1 m8 e  a' T    xchg    dx, es:[41h*4]( V+ l; j9 V6 w0 g, L, G) V% ?
    xchg    bx, es:[41h*4+2]8 S$ N7 N; H; ^7 r& U1 D! \( j
    mov     ax,4fh
/ @7 E7 o8 W3 t6 Y/ ?+ ~- A2 h, v6 F    int     41h9 k' D7 r$ }# J- X
    xchg    dx, es:[41h*4]
3 V  b1 k5 F# V/ s    xchg    bx, es:[41h*4+2]. k$ S0 C4 [4 F
    cmp     ax, 0f386h
. @# U4 b1 P/ {, h    jz      SoftICE_detected9 ]4 E& Z2 Y& z1 Y/ |

, [9 l' A/ B, T& B3 R$ Eint41handler2 PROC
- K! n0 c0 }# ~8 a0 g7 P8 X% m2 S( i    iret
+ z: g  X2 h: P( d6 Jint41handler2 ENDP1 M  g) s! c8 V- f$ y  r
8 }# L1 U- N4 {, t
2 c/ q4 r; _" i1 R% [7 I
_________________________________________________________________________
! M+ @1 ]. s$ _! P6 }. V/ w4 C0 `1 l8 B% s* y# K% o2 j
3 u# Q7 @; |; C4 A; s
Method 06& w. e. ?: i6 O' a" C
=========
: b4 H( q) p) D1 u4 f
) G  ~6 [! P$ v6 i$ R
0 F/ N6 Y* b5 S2nd method similar to the preceding one but more difficult to detect:
$ e; J$ U# U% e. T# o! C; P' o9 G6 d# m7 O
0 T6 V: J6 D/ [$ E
int41handler PROC
- v, k# _0 q+ n3 A; u& z9 n9 S9 O    mov     cl,al
- _" Q/ l( @  a( W    iret+ u9 _" V, B3 s5 G- c) P4 H1 c" q
int41handler ENDP
9 f: V! O* e* `4 L' R7 v# v  }5 [& F# y. b7 M7 P( c8 p

, H! d" e$ H7 b# y    xor     ax,ax' D' s" J$ p* d( `1 S5 r; q5 {/ z; }
    mov     es,ax+ K( }- P' M5 s3 j1 i' ?) S8 ~
    mov     bx, cs$ z, d+ D' g6 ^' A, B8 h1 [6 k; |
    lea     dx, int41handler+ n% r  \. C7 j5 H0 d
    xchg    dx, es:[41h*4]) U9 W# F1 F3 A9 r0 p5 Z
    xchg    bx, es:[41h*4+2]$ t/ Z1 B' g) K4 R( V& w4 S+ x& D' s
    in      al, 40h
2 p/ ^5 W4 `8 U! ?7 X; f! t! M+ L8 W    xor     cx,cx$ d. `$ }6 c2 I% j  Z9 M
    int     41h; J1 Y1 B. w& R
    xchg    dx, es:[41h*4]
: }  o% t1 u$ F( a7 f: T# v, a  B    xchg    bx, es:[41h*4+2]
  U, J9 B# n# h6 g/ G$ A8 ?( d    cmp     cl,al! o( R/ @4 b& t5 J7 O
    jnz     SoftICE_detected# w, C; N5 m7 y+ [. [

3 _) F- u+ l( a8 K+ y' p_________________________________________________________________________
" \' P1 W4 }6 J" J, Z: g, s$ f
/ Q' \3 F% m! q2 N: b4 w4 Q# eMethod 07" U( T2 @9 E+ A- C( L9 t1 g* m
=========6 b) I& e0 f' i" v/ X
6 F. q% }* [! @( u& t. ~. M0 b1 X! Z
Method of detection of the WinICE handler in the int68h (V86)) s0 K# X0 w& n
' d9 b" w8 d$ ~
    mov     ah,43h8 g* K) [. L( |- f
    int     68h) o% W& W' x# U; Q
    cmp     ax,0F386h7 M+ y* F/ O# d9 M* A1 l2 t! g
    jz      SoftICE_Detected
# g7 I$ _$ l' D- f8 n2 _8 L6 R; u# J) C3 Z9 D8 a
9 A. p0 o1 r3 E" d) X: d- l
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
+ Q2 P8 A1 s- {, Q5 X- d   app like this:+ g: n0 x( N8 A$ J0 c9 D* H$ F0 G

; @( h6 [* o$ J+ L8 d. v   BPX exec_int if ax==68
: Q/ O1 f+ X3 w   (function called is located at byte ptr [ebp+1Dh] and client eip is5 E5 S7 I6 R3 B2 c4 P* N# w4 S4 X
   located at [ebp+48h] for 32Bit apps)$ B( B% C) ~  f$ ]* G/ O
__________________________________________________________________________
. \( u1 j- P: [8 _
$ S5 T5 w/ X& F- z/ Q3 ]) x" H* B4 q6 m" u- C
Method 08
% [& i$ O/ |) F, R- h; e$ M4 s=========
1 B' s& P0 c1 x) P& Y, v: c% T7 l# J. y$ ~+ O8 v
It is not a method of detection of SoftICE but a possibility to crash the1 V, V' |* \( I" x
system by intercepting int 01h and int 03h and redirecting them to another
  z& ?. F  A, J- B7 m4 u. O* Qroutine.- O/ ]8 p" T# m6 Q8 a6 I4 d
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 D1 m2 l! S, m) Y
to the new routine to execute (hangs computer...)/ ~1 G* H4 h( f  j
6 H# i+ x, L, |/ t
    mov     ah, 25h
) h1 o+ t* \( G; o, M, w% o    mov     al, Int_Number (01h or 03h)
8 O! e3 S' u7 h; F3 {    mov     dx, offset New_Int_Routine! j$ @0 z4 g" @5 d( G/ D
    int     21h
& v" i' Z. J6 g2 g6 m
& I  T% j$ }8 F4 r3 ]__________________________________________________________________________( t& O2 F. ?% j- E4 U# V  y+ R

: S! ~5 L1 D7 R. A" W. ~, NMethod 099 q5 W1 h7 _. Y# x$ [: @  T( o$ |+ O" ?* v
=========
  L8 I* e" j8 W) [+ W+ a, J  h$ z  G2 T  Z9 z
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 o: ?2 M6 ]- h: s6 H  ]2 jperformed in ring0 (VxD or a ring3 app using the VxdCall).
# m7 k% e% c! b1 ^/ C" U( |The Get_DDB service is used to determine whether or not a VxD is installed
. J$ U: }3 a/ s( ^' ofor the specified device and returns a Device Description Block (in ecx) for
& p0 k' s, E3 ?# A. Xthat device if it is installed.5 p* R* O3 l! g/ L( ~9 n: l! w% z7 s
5 X( l% B. d7 Q1 v
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& {& E8 ]& L( Q$ u' `  d- g   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)# y* y4 Q: w4 p
   VMMCall Get_DDB+ }2 h' o, u' v% y3 \7 m- ?
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 W3 e, F% z+ Q) ]/ E7 h
! K2 g) l: z; ~) e3 ]
Note as well that you can easily detect this method with SoftICE:" D1 c( o, f3 B6 m4 x
   bpx Get_DDB if ax==0202 || ax==7a5fh
! E/ }( H% T1 V6 E
& M: J: d7 {& b6 U__________________________________________________________________________
# F6 M, Y: w( ?! d; |
% D2 a9 G% A2 B- m2 D! HMethod 10
  V" x! x* g+ E& R5 l=========& B% D3 d, J' ~( ~7 _

% A: n0 r9 J) q1 Q9 v% u=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
, w6 C5 D; _; D  SoftICE while the option is enable!!7 J9 A# B: x# X& {9 N2 ^8 p6 t' I3 ^

+ p1 B! ~3 L; P! oThis trick is very efficient:
" o6 O0 f2 Q& l+ H. v8 h9 h9 H. fby checking the Debug Registers, you can detect if SoftICE is loaded5 J: U0 z: A+ w4 |. v
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if$ t6 f6 a: J  o9 b* \0 Z5 L# B
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 _2 O8 B! _& x, A7 A; m
value (in ring0 only). Values can be manipulated and or changed as well
/ y& r) U2 n4 U- i9 c(clearing BPMs for instance), Q" O7 S! X  C- Z

3 p  i+ e7 }4 c& T__________________________________________________________________________5 _" R. m, ]. U' t5 F: n" p

7 N4 ^3 o& ^6 h1 [$ L6 K- gMethod 11
1 s4 ^" m- U: k; r8 r=========% E6 h# f, N" k$ r; u
1 S6 }$ \& @& q/ t' Q
This method is most known as 'MeltICE' because it has been freely distributed
- c9 x  L% q# C, A9 Bvia www.winfiles.com. However it was first used by NuMega people to allow2 H4 O# p* K+ `  p6 n
Symbol Loader to check if SoftICE was active or not (the code is located9 B9 j$ N7 W. U, m' y! ^$ U
inside nmtrans.dll).
" I- B& x/ ~# U+ S
) e6 g7 {4 W/ T. A3 W6 a. \The way it works is very simple:& V6 [$ G# U% y- D3 e; L
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# S" |0 k( w, h& o
WinNT) with the CreateFileA API.
: L; \! w4 w/ _8 b, s6 c4 X) y5 x8 `0 J$ D' N! g
Here is a sample (checking for 'SICE'):
( W/ v* ~4 Q& P! i5 t# g/ I
. u1 ]: m2 D. ]% u( qBOOL IsSoftIce95Loaded()/ P" l/ q$ v0 q' S; j
{( \9 {+ V/ T7 {$ C2 _0 R
   HANDLE hFile;  
  r7 o, @* ^. T( i5 `; ?   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
9 Y. Z+ R4 R7 R9 T                      FILE_SHARE_READ | FILE_SHARE_WRITE,# v4 b5 d- o3 ~6 h
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ o/ R+ s3 i( L/ U# ]
   if( hFile != INVALID_HANDLE_VALUE )
8 ?# k2 u8 S2 X+ b0 Z- s  a' g# e   {$ g$ B  P) a( ^) l  y1 c  r
      CloseHandle(hFile);5 ^4 B2 z. m5 o6 J/ j/ @( C& L1 K
      return TRUE;$ ^$ R0 v0 U5 z& v- S' f) B+ Z
   }, j% N1 q' a9 Y$ n- d8 s
   return FALSE;
1 y4 `' K6 t) K}& M3 T0 ^4 @1 b6 Z4 o+ T. _

# A" o0 e( F; {2 J5 O* |Although this trick calls the CreateFileA function, don't even expect to be! H8 k+ @: x$ r4 j$ o, [
able to intercept it by installing a IFS hook: it will not work, no way!
1 U$ ~$ k7 n2 i& UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F3 m. K& h" M9 C" j& v, Q5 k& o
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ _  M. g  F1 tand then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 B$ _/ J( ]/ @: Z& k  B+ Mfield., Y. O6 d5 f% K% _7 E6 ~
In fact, its purpose is not to load/unload VxDs but only to send a
( \9 r$ |3 Z% m6 h5 mW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
/ H: k' C. N" ^( _( M$ d4 A* s6 rto the VxD Control_Dispatch proc (how the hell a shareware soft could try& d  Q, A$ r: p) N3 N% [; f( U
to load/unload a non-dynamically loadable driver such as SoftICE ;-)." A/ X! U' y/ s1 B' f$ q( e& H
If the VxD is loaded, it will always clear eax and the Carry flag to allow
  ~8 v: S2 |; J, T1 n- oits handle to be opened and then, will be detected.- x) m: u- x1 {8 q# F9 Z2 D
You can check that simply by hooking Winice.exe control proc entry point5 V) a2 l% Y$ W* Z) c0 c5 N
while running MeltICE.
( k# K+ g# K# B; x( e
) a5 t) H& s. @- t9 d; \. L( v$ W9 F8 o, F- [; E' W4 H: ?
  00401067:  push      00402025    ; \\.\SICE: M5 f. Z0 p) H; V# w& U" D8 L
  0040106C:  call      CreateFileA
- e" G, ^; n& @  |  00401071:  cmp       eax,-001
7 ~& @3 l- V/ G9 N0 b0 N5 l/ V, E# w  00401074:  je        00401091
8 c8 ?; @& ~) p- T
' `! J) q1 v2 x* U& M4 r0 y0 g  r2 Q4 M/ Q' A
There could be hundreds of BPX you could use to detect this trick.
# ~& f" m' x7 Q! \5 x# x-The most classical one is:
- G  Z9 R( X  o  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  Z9 U& \- ?' j. M
    *(esp-&gt;4+4)=='NTIC'2 R3 p) ]2 `2 u
8 I# i0 P9 i: [( ?# i
-The most exotic ones (could be very slooooow :-(! |! j: o. e1 g
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , [& L9 u  o3 ^& d+ C) _
     ;will break 3 times :-(. Q% S* B# q( _# {4 r0 \
5 ]) Y- C" w3 Z, w' `
-or (a bit) faster:
3 |0 z% c- W6 M4 E   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ a! K8 E1 E% Q7 x/ a' d

: y$ q) l( x/ K2 U, C# h   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 Y! M. [2 E9 k
     ;will break 3 times :-(7 M& k8 z  u! M6 X  A/ R6 I
! k9 X5 T$ b) |
-Much faster:
+ K  B% C, y% k; H   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& ^& ?0 p! @- U
6 t- o2 g( Z3 l! }
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
( e* I, m! G6 y2 Dfunction to do the same job:  Z1 ~& N4 C% W( R% s" n
$ H2 m1 V/ t/ w9 Y* D; g8 ~0 |9 m
   push    00                        ; OF_READ
, l# j- g2 h  k/ _   mov     eax,[00656634]            ; '\\.\SICE',0# ~9 G+ d/ i, s) }. j' m. ?% ?: a* a
   push    eax4 W4 g" }# ]3 \
   call    KERNEL32!_lopen
" Z. r: n5 r8 K# z   inc     eax
' |+ U# K1 ?1 |: Q4 J; S9 T   jnz     00650589                  ; detected- I$ i5 d( n# E0 J6 [# D2 b
   push    00                        ; OF_READ5 e$ _# T2 D2 c5 b
   mov     eax,[00656638]            ; '\\.\SICE'
) y) J! @# y3 {; |   push    eax
0 l" L& {5 V. B   call    KERNEL32!_lopen
3 b! N1 d% p9 D% p& s9 e   inc     eax  _$ c7 W" E" Y+ M2 |
   jz      006505ae                  ; not detected% \$ G& f! m! {6 I/ ?+ U6 i- B
$ w/ g  ]0 r$ l5 f% @, u" m
2 L2 ~: Z$ d5 u+ |* E( x
__________________________________________________________________________- z, ?* c/ p+ V3 u7 n: x2 H
- F; d0 h5 d/ `2 x1 ?/ w* e
Method 12
7 R& e, |7 z6 O" y' O: d5 p$ k=========
, H7 v% ]! ?. }( c6 H
9 \' |2 P* ?$ b$ m; n& rThis trick is similar to int41h/4fh Debugger installation check (code 05
% c7 e  f0 i% w: n7 y: _  U4 _&amp; 06) but very limited because it's only available for Win95/98 (not NT)) P+ W5 S* c4 w/ r) @% ^8 J, s
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 A7 a, V7 h- W$ Q9 a# `- i% f0 @+ }
   push  0000004fh         ; function 4fh
7 \8 W" ~% o; ?   push  002a002ah         ; high word specifies which VxD (VWIN32)5 I( e' S) r0 P' U0 f
                           ; low word specifies which service! R2 ?5 Z  \6 _/ X8 B; y$ j
                             (VWIN32_Int41Dispatch)
0 }7 ^% q4 f! L' s; }   call  Kernel32!ORD_001  ; VxdCall) T' u/ I9 s: _2 s5 Z3 C& g3 _
   cmp   ax, 0f386h        ; magic number returned by system debuggers3 X( M& B5 h1 O/ e; {# W
   jz    SoftICE_detected. W- j5 F7 z% M4 h
$ W+ L1 b. e: g5 t( _" Z6 c
Here again, several ways to detect it:% a+ e6 _  Q) G2 v, U$ u/ p9 O

7 h7 |. a; I' E) ]    BPINT 41 if ax==4f
6 z# t1 C3 k0 X/ `! e5 U7 E0 T5 l& A* h/ x& p& w
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" L; g9 ?9 i% q, _

& x$ d% f$ i( L3 s    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 e) d* @( o* y" I% i
3 R$ K2 z( u( v, p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: y0 p5 g/ B% ~2 `, ]( E6 o- ]: ?, \, q0 P
__________________________________________________________________________
5 t# D% e3 ?/ H' j  r
# g1 `: \' A, \1 i6 j" FMethod 13
, `) i; t/ |' ~8 V& Y=========
8 x& x, r: I" z& B, O8 ]6 Z7 q" D( h( \. w7 R
Not a real method of detection, but a good way to know if SoftICE is
& Y/ r& E3 l- q5 P  Rinstalled on a computer and to locate its installation directory.
" S* u) N7 U5 _It is used by few softs which access the following registry keys (usually #2) :
3 Y* m7 y+ ?0 M% {" h( w
0 z2 H: D+ a" o2 p-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* |8 z7 J. X7 C% i\Uninstall\SoftICE, r$ N8 E. `- c8 z" S$ E
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE" T0 a4 X' x: k
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 w; Y$ L+ K9 `; O- ]' Z' {! x
\App Paths\Loader32.Exe: ~: ~9 _8 F- l4 c- z8 X, |5 z! d

4 l5 o9 x5 ]/ f) H: A# q
& j7 Z0 Q5 P) M  N' Z& y" @) ANote that some nasty apps could then erase all files from SoftICE directory
7 u- I4 ^- L4 D+ o7 n  N(I faced that once :-(& r. D" e5 F" `; o
7 v2 s5 w1 A+ V' K7 J$ Q
Useful breakpoint to detect it:
' o% }) ]* h4 w/ P# V# y; q3 P. G* W1 t" r& T2 U0 X; {/ a, t
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ p) v+ C/ c( l% X
' J0 R) v8 m% m8 ^0 g6 d5 G& D% [0 T__________________________________________________________________________6 x/ q! U+ e  Z0 u2 m
( e* ?% U/ p; Z: f
% O6 `% }# R4 I" G% q
Method 14
  l  |: r* _  e' m: S# v9 V* F1 C=========
% V% k6 i! q, L/ m6 q% f& L' u
* l- T4 I1 p/ ^8 g& l% DA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ X6 F: H5 D' zis to determines whether a debugger is running on your system (ring0 only).- J" a: D, K6 T/ \' ~

- p  ?' _/ x7 h& x4 H1 _   VMMCall Test_Debug_Installed, s; |  f8 }  Z
   je      not_installed$ _6 \5 [: l, _1 v0 ~! U
9 G  L! V& S, @
This service just checks a flag.# a/ L' A6 _  @! ^
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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