找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 B+ _3 r# g- y8 R( U5 T8 a2 n<TBODY>, M; z& k* f5 |* I; k3 a9 H
<TR>
$ O1 I' i! v/ h) r; I" E/ P2 t<TD><PRE>Method 01
/ ~7 a. J  f' D$ f: W" t9 I) i=========
& n3 e) }1 y5 k+ E3 P& V/ S; Y, ?+ L4 B' s7 |3 @9 b) {
This method of detection of SoftICE (as well as the following one) is
! a# r: a' A7 F9 mused by the majority of packers/encryptors found on Internet.
; b) U& J& x1 D* {: lIt seeks the signature of BoundsChecker in SoftICE
" k0 j9 V; [( t1 E6 A1 t5 [- g
% K6 e- {* k8 V& I    mov     ebp, 04243484Bh        ; 'BCHK'
, `, G. n( T4 [. @2 [; j. u" e    mov     ax, 04h) [- x4 G1 j, p% S
    int     3       ' [0 L; q8 k% J. @! j# P
    cmp     al,4
1 {1 l6 B1 w7 N/ l    jnz     SoftICE_Detected$ k6 J2 Q8 {1 W  A+ u

7 p6 `# N* C( h& A. N+ K' b___________________________________________________________________________4 M7 a0 G4 [. j4 n: k3 m& Z

" ]% _5 w' r) c  T, PMethod 02
. c: P& x( M3 {- n; L=========
. J/ ]; ^4 `' U$ F4 C, R$ N" W% u- ^) g+ K- a: l& ~7 d1 L' X0 K& w0 Q# s
Still a method very much used (perhaps the most frequent one).  It is used& A; y1 N7 t) C
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! ]# W  G. q- o+ o5 Dor execute SoftICE commands...
9 [# O, o3 B- ZIt is also used to crash SoftICE and to force it to execute any commands7 S' u4 p  b# {2 {  {
(HBOOT...) :-((  
+ D4 r5 y8 t# @" ~% F% A
, ^9 ?& d3 j' sHere is a quick description:( {, l  i. y5 N2 T* |
-AX = 0910h   (Display string in SIce windows)
$ d( N0 a' o- y5 e-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 O& H4 q8 j' Z4 L
-AX = 0912h   (Get breakpoint infos)( ?! E+ v& r, L2 H0 L- e1 |
-AX = 0913h   (Set Sice breakpoints)
' k% t" t: z0 N5 _9 M! j-AX = 0914h   (Remove SIce breakoints)
2 B" M* O. `+ J, B4 h3 m/ a+ d" c2 A$ A' K4 l
Each time you'll meet this trick, you'll see:: x! l# x. Y* J7 U/ s
-SI = 4647h
9 u7 ~- D+ M* G! [-DI = 4A4Dh( C+ }3 E' ?% G4 Q; U1 x4 ]. n
Which are the 'magic values' used by SoftIce.8 `$ o+ M% E- |. K9 O) l
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ H# J# _9 [$ O% M  {2 T
' f) b: }. D) t/ [; V( FHere is one example from the file "Haspinst.exe" which is the dongle HASP
% [6 [. _, W( F% [. y0 ?Envelope utility use to protect DOS applications:' \8 |$ q# I+ ~6 F# p

2 S. p( C0 L% O9 S( g" D
/ U& L( @8 w& N  Z- O; ?4C19:0095   MOV    AX,0911  ; execute command.
, m$ m' @1 ?+ J- U. u2 N4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
8 T7 |& u% |( i+ n- T4C19:009A   MOV    SI,4647  ; 1st magic value.& |% |& [! Q" l- F
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
1 I$ ~8 O; d7 T+ W, O" e8 F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), P: F7 L- ]" a5 b0 h
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- r5 L" ?# M3 G( B# f; Z6 G
4C19:00A4   INC    CX
6 k/ u8 \# ]5 E/ h4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% r6 Z% X: @& T8 c- D# c
4C19:00A8   JB     0095     ; 6 different commands.
/ H8 g( x+ Q, q/ {4 C( _4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
6 R$ N. F' l8 F" F% o8 z8 ?5 |4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 e( J/ [; N* i6 W5 z. I
% H6 i* O. L; G# T4 ^; aThe program will execute 6 different SIce commands located at ds:dx, which1 v: h5 x$ u. M; v
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& a. O$ P, K1 L" k2 U) I. d. B2 R* Z! O) m0 c7 {! k) u
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ J9 o* V+ n+ h
___________________________________________________________________________
( i2 F" q% s  ~$ H: \& c, b4 a3 ^- ?5 t
8 J7 {* b! M0 p
Method 03
. U$ c% G& V2 m0 F. V$ D, P=========( d2 f& q( h( a8 }' Y& I" M
; B; S# J! q# J% K
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h9 A3 j4 _9 j( {, H& S4 {+ O
(API Get entry point)0 M" L9 n3 h4 {) f" q0 T
        8 c" J$ W% r! P7 [# P$ J
3 q+ z* E+ m" R% k
    xor     di,di# f! A4 ?( T9 d8 u
    mov     es,di
' w, m1 |: ~, M1 b  R    mov     ax, 1684h      
" p. x5 S( ?6 H# R6 i; H    mov     bx, 0202h       ; VxD ID of winice
) |- [2 }5 [9 o6 ?1 L6 G8 E2 ~    int     2Fh
# E6 T3 @) h2 {    mov     ax, es          ; ES:DI -&gt; VxD API entry point- m4 Y4 u* D) o9 h, Z. Q2 l" q
    add     ax, di
: _$ U0 W; h: s) K+ e    test    ax,ax
. U. c; F/ U8 o, n8 o9 ?    jnz     SoftICE_Detected
+ G) ~/ n. |5 e4 i5 P! [5 @! e5 x) s  L
1 n/ r- @5 R" c) u9 L3 `  b' x  |# h___________________________________________________________________________8 O) h; Z% d+ u2 z% ]
: o+ i" a" E- \! p
Method 04
( o4 X9 J1 F# g=========
7 R3 d3 y9 A% [
1 o: p, ~+ X& E  x$ e6 eMethod identical to the preceding one except that it seeks the ID of SoftICE
- |# S" r) c( L# _* u$ @3 E* {9 ZGFX VxD.# I: L8 T7 {# w- y$ ~+ i! A- Z* x
; Q7 n  y, |( N! F5 X
    xor     di,di
( s% h( K) F" ^. i    mov     es,di; N: Y, Q* A, t
    mov     ax, 1684h      
( d8 m* l" F0 H0 j+ A1 Y    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 ?( s5 W& ?% r+ }7 W0 }3 A6 ^
    int     2fh
( D; H% M( J0 \" ?; @, [, b4 o/ Z7 i    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 l, Y$ f; `1 W- Q$ H# z) U/ D% J
    add     ax, di; {# ~4 W2 r2 c# e
    test    ax,ax1 F2 @" M6 T. M  g( @5 C  `
    jnz     SoftICE_Detected
0 K6 v/ e8 ?( a& `" X7 a/ q. t, I, m: r, M
__________________________________________________________________________
* J+ C* |+ g$ H+ q1 v0 g, R, c3 `( B, _- e' {. r
; G4 N8 C( @7 F3 J" _
Method 05  ]4 r) j, h" y0 f1 Y
=========% F! T& Y1 w: E( f8 N
7 j# [" f4 u. Y; q& a
Method seeking the 'magic number' 0F386h returned (in ax) by all system' y! ?! Z8 v* P; q
debugger. It calls the int 41h, function 4Fh.$ @4 c- d+ P, b  X$ W
There are several alternatives.  9 r4 s! y7 N: b  t1 ?
7 F. E* k1 v4 Q$ [( ?
The following one is the simplest:
- g6 o7 T' z3 ^9 ]3 T# ?2 m
1 t' `9 `$ `. _" y    mov     ax,4fh) ?" r; u3 K& w/ |; P, n
    int     41h5 ~( [; K; G* i
    cmp     ax, 0F386$ S" M* S& E4 q. T8 r- a' P
    jz      SoftICE_detected# s8 t+ l/ L# n- p" `' J

, J5 R, q  a% Z! P& T. Q6 x* b0 z1 F9 z5 C  ^8 w( g
Next method as well as the following one are 2 examples from Stone's
# T  C9 M8 x- k' O  {7 ?. y"stn-wid.zip" (www.cracking.net):
/ V' T6 ?( J( T0 J* j6 @1 Y4 ~9 G, ^, I" c& z# {
    mov     bx, cs( f! X; S( @2 g* s, m" |
    lea     dx, int41handler2
+ i0 h# h( V: l" v: S" _    xchg    dx, es:[41h*4]9 \5 m% O) B3 r8 k
    xchg    bx, es:[41h*4+2]4 D+ R7 B1 b  V  o+ I8 Q0 W( Y
    mov     ax,4fh" `$ Z7 l8 z( V$ J2 p, t
    int     41h# T2 g8 a9 T0 d
    xchg    dx, es:[41h*4]
! t) h) f' s2 @- |# r2 m1 M4 U  G' U    xchg    bx, es:[41h*4+2]! q4 m# Q  u$ M
    cmp     ax, 0f386h
% ~# F) x" N" E6 A/ X' S    jz      SoftICE_detected
) A9 t9 ~, a$ e- q/ [8 x. Z9 ~% I+ ?$ [; y
int41handler2 PROC, x9 e+ d; n2 X5 G
    iret* i% b/ c. \" b4 H( Q# W% s8 Q
int41handler2 ENDP$ [; ?1 b$ z& |9 q% U; l4 V

" S1 m. z- @& Y3 S* `* P. o7 |" X
: m  `4 \  G. u7 K% f, A_________________________________________________________________________
; v: G/ W8 t2 b1 {
7 w. @4 A" p" L9 f, O7 g; p& c: C; V" W6 a
0 {6 @/ P$ C3 p- mMethod 06
1 o' ?: I" Y; P% M% g  N6 h=========: x' w# K; S" N$ o6 ^  \

8 ~* K: }8 o  [7 M
5 P4 k; b# p; Y! r6 Z: T0 v2nd method similar to the preceding one but more difficult to detect:& q0 u; u, k5 q

. x4 H' }8 s' l; s! `" T
$ A) R$ e6 [( b. B. U* eint41handler PROC  `1 z0 j: @2 V9 P
    mov     cl,al! c' a2 d# f. D
    iret
3 C+ F7 {9 s, H& }- @int41handler ENDP, U: D. E8 P* o" y6 H: o& H

& t7 z7 p  |! }$ k2 L2 j& m# {" ^
    xor     ax,ax7 _9 F  v0 F, m6 a2 Z6 c4 ~
    mov     es,ax
: D! s/ y' y' F  k/ w! A  R    mov     bx, cs
2 g2 @0 M# @7 c- O8 W, ?    lea     dx, int41handler
1 d6 B# O7 w# s$ n3 b. m    xchg    dx, es:[41h*4]
0 t9 I5 s0 H3 `9 e' i    xchg    bx, es:[41h*4+2]
2 A" ]9 [7 G- e8 A- s% L! j    in      al, 40h
- ]* D2 x* r( \) U# R    xor     cx,cx9 e( M& _4 X3 g) v
    int     41h5 o4 I1 F) }/ c: }4 t, ?
    xchg    dx, es:[41h*4]- o+ B, W0 U8 r8 i4 y
    xchg    bx, es:[41h*4+2]
. z; C" w; T% d3 Y8 M3 P( X9 j& H6 k    cmp     cl,al% \4 o! \  B) `) d+ t3 m" t8 y
    jnz     SoftICE_detected- n+ \2 i! U! q  L4 ^- g) N' j

- |- B4 M* h6 K/ `! {( A_________________________________________________________________________' v- j* y2 Z+ ~- Q# c9 \

% G4 y' r/ `0 q: V. jMethod 07, e" w. ^' o! O+ Y3 N0 G5 c: }+ t
=========
1 b; ]6 D" s$ @% y" `. H3 {, ^% i8 p0 l! Q2 V3 F2 w# P
Method of detection of the WinICE handler in the int68h (V86)
2 w/ w& Z# P3 U5 |( k* `$ x+ C% h# E% \# ?( I0 K
    mov     ah,43h
8 z3 A5 H- r4 A) T* M  z  w- h    int     68h
' r# M+ |; U* o- x6 `! G  `# Q    cmp     ax,0F386h/ C9 Y+ Y$ z4 g. s2 l. Z
    jz      SoftICE_Detected: ^# \/ t2 n) p7 p! \
# S5 b" l4 q+ R# D# x

" P* X8 L4 g$ D: C. _7 ~6 J, R9 \# g=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 j# D7 ~$ ?! m  `, V% s# ]' n, I" |' ~
   app like this:
, J6 }% d. E' w+ U; ~. T. s) \4 J7 [* e
   BPX exec_int if ax==68
9 p3 R5 ^6 ~" Y) B) o5 P3 ~+ j1 p   (function called is located at byte ptr [ebp+1Dh] and client eip is
) |# G$ u& ~& s) f* x) x" V# \0 Y   located at [ebp+48h] for 32Bit apps)% @4 M/ S3 S2 b
__________________________________________________________________________
& n, ~, H9 j" o- o3 j9 \# w4 M, T8 c! \5 D, c; \

" ^) ?8 g2 N$ o: v! zMethod 08
9 p$ d2 p; k* {=========) H6 x4 B4 N1 O: p

8 `$ B* j/ R2 e/ \; C( uIt is not a method of detection of SoftICE but a possibility to crash the. C  {2 N$ T2 }% X+ P- j( v
system by intercepting int 01h and int 03h and redirecting them to another
, s" ?- [) R7 j9 sroutine.
# ?& _+ K4 h6 b6 F# V4 kIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 O+ N1 W/ J4 G5 _9 m
to the new routine to execute (hangs computer...)
& o0 k  C; k' E2 I. `7 I- K# w: W- F
    mov     ah, 25h
2 j' |  I( T: f2 E  Z    mov     al, Int_Number (01h or 03h)8 j6 R" b! f8 z) R1 W
    mov     dx, offset New_Int_Routine
8 e' e8 K4 C$ |/ {    int     21h, l6 H, U* r' L8 U2 G3 L2 N% S
6 b3 X- j2 N' d$ l' r4 J3 d: l
__________________________________________________________________________" ?1 Y1 M' z* m( {; |' i6 u" y

; D3 Z: x9 _8 O* g$ D1 U3 hMethod 09. B. G% d9 v( ]: m4 B6 y% l3 r
=========
( @9 w4 M1 r$ l/ ^- ]. o5 `
/ k, o) l/ |" K' S5 r" [This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ O5 Z2 `! m! g0 U* G
performed in ring0 (VxD or a ring3 app using the VxdCall)., t) {* g; i' e$ J, r: V
The Get_DDB service is used to determine whether or not a VxD is installed: \; O2 _( ^) {) t9 V7 h
for the specified device and returns a Device Description Block (in ecx) for: }! W# u/ `8 Y1 f
that device if it is installed.2 p2 x0 T- t- a! H7 @
: \" j9 r/ Q: F6 t
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ F  J! W' {1 V+ Y1 K
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 h) s, Y3 y. ~/ T' R. \; X' Z7 J
   VMMCall Get_DDB
& C4 K: k) s- Y/ c$ f7 W' F   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
4 K# V  Z+ i6 @$ Y2 v' ~2 Y9 K" F
Note as well that you can easily detect this method with SoftICE:+ c  W6 Z' [4 n" m, z
   bpx Get_DDB if ax==0202 || ax==7a5fh+ |$ K" E: i( N$ V# r

* ?1 x# B4 A  ?  }3 y% s& h__________________________________________________________________________
  T  N2 |9 t. l% S4 P" t  E- a8 _0 f' q: S  t+ b
Method 10
% L5 J" `1 {" t- k6 `' q=========$ Q* E% R8 i# v! @& G

( E+ _2 B/ M1 `; l- @8 g3 n=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% j7 p) p* v% ?2 w  SoftICE while the option is enable!!- A4 S8 a3 B2 g4 l

: n! s8 r7 Y- b$ D' Z& W9 UThis trick is very efficient:: P4 J4 l5 \3 [2 d, }/ b
by checking the Debug Registers, you can detect if SoftICE is loaded
* Q* n! L2 ?# \) [0 p- a, c(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
5 A1 F" T! K' k( y, Z: L- athere are some memory breakpoints set (dr0 to dr3) simply by reading their
5 J% I* y6 f: Z4 A5 V" g* `value (in ring0 only). Values can be manipulated and or changed as well
8 |! E/ k8 J7 ~: T/ H1 i(clearing BPMs for instance). P/ c5 L, r# r$ o9 [, D7 v2 f
3 o2 M. v9 X. c( X' Q
__________________________________________________________________________
7 [- Y( s! r2 T* U
# @! {# l  b8 V$ sMethod 112 k& x  n& L1 P1 N" E3 ^, |" Y: y" R" R
=========
# a9 G* l+ h4 J: f+ a, G+ x2 R. x; @! F8 U8 t5 U/ F
This method is most known as 'MeltICE' because it has been freely distributed. E& v6 d, \- U( P& l1 ^
via www.winfiles.com. However it was first used by NuMega people to allow! I$ [8 z4 w; F0 \5 ]/ P7 i
Symbol Loader to check if SoftICE was active or not (the code is located, Q# n- b3 @# n, c  v' n7 d
inside nmtrans.dll).2 Y. y! n# B: V: q* v) g% t2 x
4 C8 z9 I5 N% |6 a2 N. Q
The way it works is very simple:
' p3 C( k. [( d- U/ bIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. k7 l1 |5 N; i9 E- _1 pWinNT) with the CreateFileA API.! e: l3 a- g8 a  c0 n* E& e: U$ O' d9 l

: Z/ X4 I: o5 x* LHere is a sample (checking for 'SICE'):
1 j4 v1 D5 B' F& {( }# O+ |& o0 h& N3 W8 Z7 b% `7 @; n0 T* t4 s8 b' @7 y: X
BOOL IsSoftIce95Loaded()% o; C4 X# @+ o, h6 s8 j
{: f6 R$ G7 M- ~" b' {9 H% D' A
   HANDLE hFile;  
$ X( N1 Q5 u+ }- ~6 o4 r   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) c1 P6 }  ~* h% o  }6 j
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: L9 ~8 ?$ m5 q/ O9 B* o3 [                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# a' H5 X4 q; b/ u# ^, ~
   if( hFile != INVALID_HANDLE_VALUE )
* L# ]& e" j4 z  b1 S   {. y, c5 {, o7 j! d
      CloseHandle(hFile);, M  T8 ]  e% b# B
      return TRUE;
6 U8 i; i' L( z! e* |   }, V1 M6 {4 b9 i2 H
   return FALSE;
8 c  \; P8 P& h+ D' ]}
3 t$ i/ Z) r& @8 i
3 d5 t4 M" C4 L1 R# PAlthough this trick calls the CreateFileA function, don't even expect to be
* b( }6 h" Q6 mable to intercept it by installing a IFS hook: it will not work, no way!2 p5 F6 a) Q) ?5 ]6 Q' H
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; a2 J9 P) I5 ^3 V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" d* @9 [# T/ D3 e$ J
and then browse the DDB list until it find the VxD and its DDB_Control_Proc4 E8 Z, @7 V$ ^: e0 r) E& X! \
field.( k% y* s5 {& \& G
In fact, its purpose is not to load/unload VxDs but only to send a $ b6 m! k  p) e5 ^
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 F9 D- w8 D+ v( _4 {to the VxD Control_Dispatch proc (how the hell a shareware soft could try8 ~9 |5 L2 K1 z7 j& b4 D- W
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& j7 X  @4 o6 @If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 f9 D! A$ s/ x9 o- gits handle to be opened and then, will be detected.% I% w9 I! Z" U- Y
You can check that simply by hooking Winice.exe control proc entry point
  B9 N& {3 z8 o1 ]9 J8 Swhile running MeltICE.8 e" u8 e- d$ R
# |: Q" x1 s* ^% s# z

6 c+ R  N4 V, [2 f4 v$ R8 G3 t  00401067:  push      00402025    ; \\.\SICE
% x) g4 w/ r3 {$ f  0040106C:  call      CreateFileA
) j- I' G6 M) h1 H5 h. f8 ^  00401071:  cmp       eax,-001
3 H# U; m. @  _$ W  00401074:  je        00401091
, ]! [3 r7 X- T1 ]3 m
" s9 d4 h4 g7 ~  M% m) `* ~; k. A4 U/ d  ]3 W- l4 m9 s  _
There could be hundreds of BPX you could use to detect this trick.
9 ]9 O7 i3 G" H( V-The most classical one is:
0 A% W* A! h; v( g, ^$ |$ r  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ i1 {# t' H3 y# f' g    *(esp-&gt;4+4)=='NTIC'
9 ~8 u0 X! R" S5 x- p" x' o; R- k) z8 [% b$ N
-The most exotic ones (could be very slooooow :-(6 T5 E2 G) h6 j9 ]
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% k& S; N6 K& _  T* t: g4 X     ;will break 3 times :-(
; V3 \( R5 I6 [2 ?. l2 |, j! \6 B* C7 x8 R% p# S1 \
-or (a bit) faster: 6 u. P9 y8 b# l# f3 i6 k" P4 Y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# [1 p/ K- j/ M  i

' h# B) ^# }5 z- e4 k, j   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! o  f# e& ^: [5 {. `
     ;will break 3 times :-(
1 j* l" R( W$ ?! X6 W/ R( ~
' l" U7 S+ k. |-Much faster:8 h2 L; {1 e2 @9 o
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 Q( c( E1 q6 i/ P) B7 L" x5 J' b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen: R! V" H, I5 W
function to do the same job:
8 M8 z* W( X/ c7 ], d$ i
/ G; E: L. }2 e9 O9 t   push    00                        ; OF_READ& h! g; f+ z1 _2 A- g: b
   mov     eax,[00656634]            ; '\\.\SICE',08 A% _3 a* g6 R4 @5 Y
   push    eax
1 I% C' g$ e  |4 f* Z$ s   call    KERNEL32!_lopen
: S7 ~1 y; Y6 G; {$ E   inc     eax
' m+ N7 K+ O" F! m   jnz     00650589                  ; detected; ?$ |; O( \0 G+ R
   push    00                        ; OF_READ
3 u) u- P7 N( q4 u6 Y9 I: |   mov     eax,[00656638]            ; '\\.\SICE'- O4 q9 T; _7 u  @8 A. Y. k5 v
   push    eax: a# M2 I) K7 `
   call    KERNEL32!_lopen* i, B4 k2 T' b7 i1 [
   inc     eax
6 w* y1 a: |8 D8 J- W0 b   jz      006505ae                  ; not detected2 ~- I" O# y7 M% v' l$ G4 |2 u
! x* G- b4 t5 l$ q' K

- K2 y( G% w" F" p3 o__________________________________________________________________________' l6 x9 E3 [3 v, _3 S( n
  s; v( Q) h. g1 |2 [: s3 h5 W6 Y
Method 127 v) F3 l4 {& B) l! ]) p
=========
1 |8 n1 h  A: w" E
- U% e4 q) S1 fThis trick is similar to int41h/4fh Debugger installation check (code 05
4 H; @4 C# H( U$ S# M&amp; 06) but very limited because it's only available for Win95/98 (not NT)0 p1 r! A# E0 s
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  l6 ^% I0 E3 Y# D( Y5 S
2 ], B( W* u" {# O( z   push  0000004fh         ; function 4fh
! s  A, Y0 ~5 Q$ h# y" s& V& _   push  002a002ah         ; high word specifies which VxD (VWIN32)
' \7 L) @; C* g                           ; low word specifies which service) `  |' l( z4 K4 l" W$ p
                             (VWIN32_Int41Dispatch): X/ p) |2 i- m7 x% u, N' R7 I
   call  Kernel32!ORD_001  ; VxdCall
8 }: y7 u# ^. R$ b. x" M   cmp   ax, 0f386h        ; magic number returned by system debuggers* @9 s! X; }2 w% e& a: W
   jz    SoftICE_detected
4 ]% g; A: ]( ]7 e( A) G
4 `% R! n! o# rHere again, several ways to detect it:4 M2 P. f: `& R3 b8 j5 y4 c

& S& x" i& W( h% \# E8 W& q% n7 Q    BPINT 41 if ax==4f
2 A! z, g; |) K! D! @2 J- B6 e9 t; }# k2 q- M
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, j1 H' @/ V( G* t. {1 f6 e+ N( V+ D9 Y' H$ z; _
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' |* S( {; c8 U* U8 L7 c0 e4 ?6 U. P1 s) v
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' ?2 m+ ^! L: |# i  j
7 Y  U9 Y# p+ g$ s__________________________________________________________________________
+ t2 f. n' g: o3 h4 U7 p. p  b
* d& @' H1 g" y7 MMethod 13
! h/ O6 F" o$ a=========) Y; ~# l0 [9 n6 ~& C

6 Q' u; s8 K/ y- ?; B; i/ uNot a real method of detection, but a good way to know if SoftICE is
7 X1 ^4 @: M- Z; iinstalled on a computer and to locate its installation directory.3 `! R; s5 C  U' d) t& Y
It is used by few softs which access the following registry keys (usually #2) :
6 @  _4 M: p& a$ r# m2 R4 R5 L2 H" ^0 z4 q2 R& T: \0 X! a
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& m/ {9 p5 b1 g& @' U( O) B\Uninstall\SoftICE' u1 l  r2 |3 S5 o; U
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
7 [6 ~5 E: M; P1 B7 S-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ i0 z) t$ y9 R" c- b) |9 M. k
\App Paths\Loader32.Exe
2 G$ ~& \5 l  m- ]( J, G: [4 i# P) D# z) [
+ d' M: n2 c4 ^- L. \$ p: C8 t
Note that some nasty apps could then erase all files from SoftICE directory
# k7 z8 P4 t! F9 E2 ^) R(I faced that once :-(# r6 D# e( v7 s8 m, [  A! [* y

; w, c: _7 D6 ]; W$ jUseful breakpoint to detect it:" P* Q1 ?8 v% @: S5 \

3 {' ^( d, [1 z0 G+ [9 M, w     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" c$ Z* |% V9 c8 G# l3 Q, f5 k; Q9 n9 m. a- v% Q9 m! ^9 ~
__________________________________________________________________________
7 H% h9 u( ^/ w! L) B1 S5 p4 }1 o4 A7 \

5 p, m6 w7 k5 I, V& I: \$ p+ dMethod 14 ' G0 i5 N8 m6 t
=========
6 Q. v# R; [2 d6 @0 `
- t( q0 S- f( [+ i3 GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 X7 a( p3 {/ z; R" z7 }, g
is to determines whether a debugger is running on your system (ring0 only).
+ k% _2 n  G8 g' r- F6 ~
) V- X( b/ K3 M- L. B   VMMCall Test_Debug_Installed
$ w) H) m0 H0 |$ m# z6 I& w7 g7 Q   je      not_installed
" z3 D, k  E% m# K, M9 J' t% v; F3 E8 O& @$ J$ U% ?- m+ d' h
This service just checks a flag.
9 a2 w% ]6 J" g! g8 p5 q7 h</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-14 09:55

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表