About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: u3 H1 A7 s9 f+ _" l2 L
<TBODY># f! E( s; Z  X. j" g9 W
<TR>; W8 T. y/ N+ ~# A  L3 s
<TD><PRE>Method 01
& D0 k- l* x3 Z+ p=========
$ t/ J5 b; Z* c6 l" m; q3 `+ z' A/ N0 {- z$ G
This method of detection of SoftICE (as well as the following one) is
2 A! v3 y" T  A* Iused by the majority of packers/encryptors found on Internet.
  t0 X) j9 H4 I0 v" C6 C' eIt seeks the signature of BoundsChecker in SoftICE0 X5 v; b' V( f* J' [

7 M/ R/ i- m" p2 L    mov     ebp, 04243484Bh        ; 'BCHK'/ w. G7 `1 a% T" Y
    mov     ax, 04h
+ x2 s/ U) h5 V, X6 t: W    int     3       7 L# l- m9 H2 z6 d" _% X
    cmp     al,4
" [% q6 }6 j) @' j- Z% ]9 Q    jnz     SoftICE_Detected
/ T, h& X& ?6 O8 P$ z+ A' [( v9 V7 Y" ^4 q5 o8 `
___________________________________________________________________________9 O- }' e5 o) E& L* f. H' A

8 N  R# l: I) _4 `4 ZMethod 02
/ c0 i5 x$ l! O=========
, c0 M+ `' ^, v! J# G9 ^& Y
/ f* K# j4 \5 V% j% @2 qStill a method very much used (perhaps the most frequent one).  It is used  D8 i+ J0 ]% C% U* ]- f% ~
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ e( j* Y0 V3 T2 a3 ior execute SoftICE commands...3 {& A$ U3 @. P8 g) ]) l
It is also used to crash SoftICE and to force it to execute any commands- [& ]7 x7 n0 `
(HBOOT...) :-((  
0 B4 S, ^: _2 g2 l! p' t1 J* v7 H$ v: D9 Q$ z# E# j
Here is a quick description:- p# ?0 l! G& M
-AX = 0910h   (Display string in SIce windows)
8 ~# j4 Z) T5 p: z! u. I-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)2 f# K; x6 {. Q& I" n
-AX = 0912h   (Get breakpoint infos). C" X3 \7 `3 I
-AX = 0913h   (Set Sice breakpoints): K' F. o1 i7 v; {3 Z" Y; Y
-AX = 0914h   (Remove SIce breakoints)
$ j) {  V; F9 d3 R
! f5 U7 |! Q! f1 N9 K% `! r! xEach time you'll meet this trick, you'll see:
2 X! s9 q) C" |-SI = 4647h! n/ ^  |2 w1 `' |
-DI = 4A4Dh( @* ]4 m, n6 {4 N
Which are the 'magic values' used by SoftIce.
9 _* h( S, y! z# P) ?0 x( t: DFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.: P! r4 @6 p* T6 c. d( \8 T$ I

5 t6 X  \/ k5 n# @, ]; JHere is one example from the file "Haspinst.exe" which is the dongle HASP; u. M. Q  A- q& k6 J
Envelope utility use to protect DOS applications:# f" Y3 N; f# |' k0 y

2 w4 A$ k& B* b$ u* D. d2 J; ^' Q2 {" _! }/ ?' ?; ]( r
4C19:0095   MOV    AX,0911  ; execute command.5 x, ^* Z8 X+ x, Q# [! j+ h
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, W4 a& ^2 Z' h" [1 Q4C19:009A   MOV    SI,4647  ; 1st magic value.
: S. X" u6 G7 o4C19:009D   MOV    DI,4A4D  ; 2nd magic value.$ j/ j# j% x) u6 M
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 i/ G* w& Z/ K  @' N6 [0 G
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
$ S' G0 H2 J2 y1 h4C19:00A4   INC    CX. B2 ]+ _8 ^9 g
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% ~) W9 `# X& T1 e% m
4C19:00A8   JB     0095     ; 6 different commands.+ s2 C$ U! t& r
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.( B/ p" B; K, e% b) ]0 [* ]
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)( a/ i, w# C- D& z& @0 A
7 E' p, q4 D* i/ I+ i1 g
The program will execute 6 different SIce commands located at ds:dx, which% k* L- o' l2 s' J3 p* G6 ^3 x
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! `! G9 N3 {5 j5 `) y) R9 N
) T, c0 E( e6 N% u3 Z. h
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& b9 E( j2 z5 t6 Z2 ~6 X- m6 h___________________________________________________________________________
: M6 F$ H" a2 i, ~7 A. u! D3 s* I4 g& q/ J$ d( J

' Q; V; Z* Q- R+ ~* u4 L1 z2 x+ qMethod 03
6 c5 I# R4 A" Z2 ^3 y=========( j- x: B5 m$ L' w

( a2 M$ d7 n& h; r; K1 hLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  [) k) t) u$ i: f0 y. x
(API Get entry point)7 ?& N/ A! h  u5 k
        
  Z  @1 C' v! A3 Q6 K- o: _- @) x! G3 m/ b# X6 c
    xor     di,di  R% {4 j( F% }% [+ ]4 o8 L5 K0 {
    mov     es,di3 o+ D' i/ P5 v1 z5 i
    mov     ax, 1684h      
* ]+ ^" W+ T3 E5 F4 t% g* O$ M! `) _% }    mov     bx, 0202h       ; VxD ID of winice
* R9 i, ?) O  }2 U. Y: c    int     2Fh: V  y% v3 @+ o+ K9 K& K. X4 j" c/ C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 U+ P3 c0 d3 c# U9 Z    add     ax, di# |+ D' i3 {$ ]- o# q
    test    ax,ax
" F, s/ x3 }# S- p    jnz     SoftICE_Detected
6 v; _$ g. w1 q! L& F
0 w6 ]- H% Q) y( T' |7 y: J___________________________________________________________________________
; N2 K0 e2 u# Y" c) n/ f' u4 }7 J' X' ?- L  ~3 _* y
Method 048 [: K& u0 ~( q" m
=========) [+ F" O! c, A- j- ]5 M

* B9 D! t" {& S  ^/ nMethod identical to the preceding one except that it seeks the ID of SoftICE
* ]1 \4 q( b: C2 \9 E2 oGFX VxD.
9 M0 G6 G4 O) p& f9 y
3 x* |* a) g/ H% M    xor     di,di
2 ]. J: Z! ?/ d# n: d3 i    mov     es,di: B+ E! N. \; y: X8 l
    mov     ax, 1684h      
# \' @& z2 w5 ]    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 [( ]8 F0 J" M4 B3 h6 T; T; k    int     2fh) N: r) V$ P! E; v% b. u) s2 R
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 Z+ E+ d9 V9 d0 d) d    add     ax, di
6 ]$ Q+ J0 ?$ v3 b" A$ C% a( N    test    ax,ax
8 g: g7 I5 |; p" D2 u; Z    jnz     SoftICE_Detected3 _/ c/ I, V3 q

0 O* x) O' r2 z  Q% b, d4 ]$ }8 r__________________________________________________________________________
* A% @9 V( j- H" ~8 i3 K: v* h
8 z( h- M& s+ {$ C# C7 R! ]* D3 j$ P  ?7 H
Method 05
& E' d5 ~6 _4 z& M=========
5 a* }' a' m( N/ \/ D) f9 z. L$ M( T
Method seeking the 'magic number' 0F386h returned (in ax) by all system* g( |3 V; S8 W; f2 u: T4 J  Z
debugger. It calls the int 41h, function 4Fh.
, y6 X' F& E# D  F8 P/ E, ~' ~# yThere are several alternatives.  $ D5 K6 D5 X9 p6 O) e2 C
0 d" L9 F* V* q5 A: K, b
The following one is the simplest:
- _; d+ j4 e' o+ ~5 Y! S  X$ t  q% p( l) I. r1 {% Z
    mov     ax,4fh% h4 G* A# F- [2 [! `
    int     41h6 K: h& F* \% `; A5 O
    cmp     ax, 0F3866 U3 @! ^7 {) d( }. I
    jz      SoftICE_detected
6 o7 r2 @  h3 D/ ]- Q' t
) L' B" o* X6 n& _0 I
3 P6 g2 R& {/ ~" M9 E" a) iNext method as well as the following one are 2 examples from Stone's - X/ h  O9 P5 E* }; r8 A
"stn-wid.zip" (www.cracking.net):9 r# {, H7 A* Y

: u# m' ~4 J" j! i: H4 X    mov     bx, cs
) c/ G# V; a' R% K    lea     dx, int41handler2
9 Y2 {/ Y& x% @( D! E$ q3 ?    xchg    dx, es:[41h*4]1 V! f- m5 [' t) V
    xchg    bx, es:[41h*4+2]: \4 H, L8 Z1 B2 [
    mov     ax,4fh
8 D% H% t$ u0 y& W; p: s! W: y    int     41h
8 L& Z0 d# x- b: q8 O% J1 [# t% \    xchg    dx, es:[41h*4]- e" H9 w. ?/ h1 i, ?& V
    xchg    bx, es:[41h*4+2]1 A1 J8 a( @3 e) x
    cmp     ax, 0f386h2 n* M4 A7 S* D! E
    jz      SoftICE_detected/ ]( z/ U, C4 W  l% p

' B! ^0 ?3 n6 V. @, |0 v+ l0 q. G+ Lint41handler2 PROC( a" H; r& K& w: a: s/ ~  c+ e
    iret
( {- [# v4 ]  \: C& `6 n  v; @int41handler2 ENDP2 \( x/ X# i2 R" Z, w& }
2 q" k$ E& M# _7 ^1 u6 `

7 h2 d$ ]5 g) }- [& g_________________________________________________________________________" X6 x3 @1 c' }8 Q% i4 ~0 e% q! z

4 k9 f( j3 \6 V- |6 n
! Y% H7 Z5 P  J# i* g1 V* Y8 g0 k$ M: lMethod 06
# p2 E- w( U% n- p! x! a0 G* P=========
4 H+ X( Y' S) a/ U
: f/ e- x1 y% j3 `% s  [# R, I' }
# U& o  |. n1 ~; q. A* j8 J. f2nd method similar to the preceding one but more difficult to detect:
* m7 E6 A/ u' g" f5 B. l: S% G) R$ [0 g: o4 _* Z
; X: P% o$ }2 V" \6 Z$ e3 }* E
int41handler PROC
8 r4 k( _3 L% p0 c* D    mov     cl,al
9 r# H; G6 ^! Z/ @: v; h8 c    iret
- M1 ~- v2 s$ Z" o9 mint41handler ENDP
' l2 e" f: R$ ^3 G4 p$ w7 ~
# v* H+ ^4 c# C/ N- Q, }( l# H  A4 |, w2 @
    xor     ax,ax3 l& O1 m: Y3 t5 S: w) C- ?8 f
    mov     es,ax5 F5 l  Q2 Q* E. i# d# n4 J+ {
    mov     bx, cs
) f& V* k$ ?# y: l7 u    lea     dx, int41handler, ?' U; q# C$ ?) R: u- I# t) e: ], p
    xchg    dx, es:[41h*4]
: o! w0 a, f. W    xchg    bx, es:[41h*4+2]
  ?+ Q: ?' i# w7 T! l    in      al, 40h; Q6 t- @5 \) n
    xor     cx,cx
# k; D" U. U* ?/ B; M2 ^# d( K1 Z- y    int     41h
5 G  }: ~% \2 q: q    xchg    dx, es:[41h*4]# \) f; t* M: y2 W
    xchg    bx, es:[41h*4+2]
, z8 P: S- |4 x1 l0 G    cmp     cl,al! v- D- R! ?, \; e, Y6 z
    jnz     SoftICE_detected
2 W9 U: g, m5 [' F7 b. C$ ^4 I$ H; N' y  p2 x) E7 v9 w, U! P% |1 g' T
_________________________________________________________________________
; B/ [. l2 u  d
4 M+ B) t* b" U  U5 P5 ]9 iMethod 077 p  x7 L( ~( P$ y# L' z" _
=========3 g1 Y$ I, P0 {+ b* h  U

% z. Y; l& Q0 K  F, q: RMethod of detection of the WinICE handler in the int68h (V86); h, A2 O# Z6 u2 F0 m4 l

8 d% Z8 h0 G  ?! V    mov     ah,43h  r! P9 J1 M; R. q
    int     68h7 k8 k2 X# z( [* S/ {% J
    cmp     ax,0F386h
/ X+ F4 o  F6 D    jz      SoftICE_Detected; F7 t3 w& |, Y4 K- {
% q, u8 U  W/ c8 O

2 f* t/ a  O$ i8 @3 ~=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' e' I2 c- V$ B' b
   app like this:0 T. M/ L) Y0 Q: A" Q. O$ o
1 Q; X+ e) t  w
   BPX exec_int if ax==68
% L5 Y4 S$ A  c( k" M1 I   (function called is located at byte ptr [ebp+1Dh] and client eip is2 Z5 v- `2 s% `* f$ b
   located at [ebp+48h] for 32Bit apps)
* r$ p+ w1 N5 X! {5 ^' i$ Q__________________________________________________________________________, O% D& P* X! k% }  P

" g0 I  a" J2 M8 y5 }1 j& S  g( e  k4 c! X5 d1 k+ K/ R7 |: I8 H
Method 08
  k  ?7 Y: Z/ M3 g. D1 K=========! I2 J- l- I; o& L- i9 y

3 d# [4 q) q2 y2 F7 F6 d9 J: PIt is not a method of detection of SoftICE but a possibility to crash the/ B9 ~- F* E* V8 j, E7 V2 a; M9 ]0 q
system by intercepting int 01h and int 03h and redirecting them to another4 c. f" v* T  F- T4 o1 @7 d
routine.
4 y- E  r. k) i: DIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# e6 w5 x' i9 ?8 @9 u1 U
to the new routine to execute (hangs computer...)+ M1 u3 Q2 K" q% Q7 d: N+ \
. {( d/ Q; Y  q4 B6 j. Q6 ^- e
    mov     ah, 25h1 s; |* v0 _) Z2 Z
    mov     al, Int_Number (01h or 03h)4 A0 Z/ T3 L) @
    mov     dx, offset New_Int_Routine
1 z# w: T$ n; b" Q    int     21h
9 n$ K# `! v% I2 g7 n1 Y
# R3 i, i6 a8 ^. R9 }__________________________________________________________________________+ p& Y: G! ]( c6 E
3 a4 c5 o$ V* R+ a7 \
Method 09
/ d0 V; w. O7 A" J1 N- z* C* u: g=========
% O5 K$ J, l: P$ i8 `/ R& e; ?
1 K1 b6 i2 F* l- f; Z( j* s! iThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ @) p7 k  R- n) W. D
performed in ring0 (VxD or a ring3 app using the VxdCall).
. w) l. `9 Z8 Z" @* S) BThe Get_DDB service is used to determine whether or not a VxD is installed
5 Y; P- I7 [' r: }4 F9 ufor the specified device and returns a Device Description Block (in ecx) for( |; q3 ^* d! E! `
that device if it is installed.; Q- q- |: T0 a+ S
# n8 B' Y; v2 i- Y4 C4 r
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 x8 H0 U; F2 {5 P9 O9 c8 e$ [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& T% {" ?# ~  |/ V) Y  Q   VMMCall Get_DDB8 c, C( ?+ `  r" P  e1 _1 f
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* c/ h; g+ r+ J1 t( @9 s* ]  i' e0 E3 @* \# [
Note as well that you can easily detect this method with SoftICE:  B8 m7 S9 d" i/ X
   bpx Get_DDB if ax==0202 || ax==7a5fh4 ?: J& B4 r4 c
4 L' M4 \1 a! x, a' c/ J9 D) Z5 q. J
__________________________________________________________________________
/ E% M/ m9 ?3 ^; s8 ]& _* x1 {# q* q$ ]0 i& j! \
Method 10" `$ \3 Z) u' A5 v3 [
=========
+ E$ ~3 e$ ?( E/ b9 x) j1 N; e! ?+ M/ x( m  h2 h0 l
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with( s7 G7 Z# Q( |1 V) z
  SoftICE while the option is enable!!" k* j0 N! U8 C, G

& D2 q- y) ^1 f0 K+ UThis trick is very efficient:
. G' v/ g& N0 w8 X1 E, fby checking the Debug Registers, you can detect if SoftICE is loaded3 H" V2 |4 q$ ?
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 r9 w2 e# x# t( z& T- p% K4 D1 J
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( f& ]4 M+ x# a! M; f! svalue (in ring0 only). Values can be manipulated and or changed as well& O  ]( _5 ]; f  H
(clearing BPMs for instance)
& l2 i& R& ]5 |9 v9 l( H, Q+ Q. k3 o! r' M0 H4 G$ e+ u% c
__________________________________________________________________________' E. o9 e4 l) ?3 K6 x; Q$ y
: k! v' t- I5 R5 U9 b( t
Method 11* U5 K) b1 D0 y# `# p7 h
=========. i) w) J$ f5 c
% w7 @1 F. Z4 a/ ^1 u
This method is most known as 'MeltICE' because it has been freely distributed
$ l. E+ i9 h* n& bvia www.winfiles.com. However it was first used by NuMega people to allow
, P& \! A1 O  @# \& K) @3 i, ASymbol Loader to check if SoftICE was active or not (the code is located( x7 [& B9 ?. l7 l. _' J
inside nmtrans.dll).( K) z4 k' y+ b
* F$ s- j# U$ t" O
The way it works is very simple:
  I4 f' U) l2 D7 H7 r0 _It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ u; M8 Z, o) b5 J, H' e
WinNT) with the CreateFileA API.1 g: f& v3 X! j# M1 j! y

3 B$ Q8 f; f: j! D, P; \Here is a sample (checking for 'SICE'):$ o+ k% A; H% T! @" \( \

# u% W5 b  |: e: tBOOL IsSoftIce95Loaded(), q; S5 {. i3 U+ ]
{
2 }& s" s: T% s' B- I   HANDLE hFile;  $ ^8 M$ p/ a% \
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. R/ X: l5 y% {( \8 W
                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 O9 O0 Q" [) d1 }+ Q& V! b
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ v) `% x) n( C/ l/ {7 S' z
   if( hFile != INVALID_HANDLE_VALUE )# q) x+ W* I2 ]# G0 Q
   {
9 @& w- a, C7 ]+ n      CloseHandle(hFile);1 D' d3 B9 p6 [: E
      return TRUE;
* c* K4 x0 \2 F8 d7 o' D   }- |1 I2 ^- _0 S
   return FALSE;6 a0 {: l2 [$ K5 }. o+ l! N
}  w1 p+ R$ \* X% D5 M3 T$ A3 b0 j) O

' G; N' u: Y7 {Although this trick calls the CreateFileA function, don't even expect to be
  Y1 `4 z8 d  X0 n2 Lable to intercept it by installing a IFS hook: it will not work, no way!
5 y$ ~% ~1 y$ F$ K' SIn fact, after the call to CreateFileA it will get through VWIN32 0x001F+ x5 i$ s0 _* f0 o, k0 |
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 e& V% ?! N* N' U* W* \+ H+ [and then browse the DDB list until it find the VxD and its DDB_Control_Proc; g9 s. s( c. y, F+ B5 ?' T
field.8 Y! E# p, ]$ Z$ F; M
In fact, its purpose is not to load/unload VxDs but only to send a
* u; ]3 k8 o3 {2 EW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' J. S" \6 Q! Z9 j5 }to the VxD Control_Dispatch proc (how the hell a shareware soft could try
8 X; b: H: |" ^, E( dto load/unload a non-dynamically loadable driver such as SoftICE ;-).
: l" V) s5 c! Y" p9 W) I9 yIf the VxD is loaded, it will always clear eax and the Carry flag to allow
6 w; E6 k( i# \4 g* Z# {its handle to be opened and then, will be detected.3 J5 _! C1 h. ~- T- Z% w
You can check that simply by hooking Winice.exe control proc entry point0 O8 Z) T. b$ M! o3 W
while running MeltICE.
' L' E* H1 u1 @; d- [6 a
* c! e0 Z! x3 ~8 O0 e
, [" W8 v( A  e& R9 _  00401067:  push      00402025    ; \\.\SICE4 N' n4 Z1 a5 U) l6 {3 l) ~! I
  0040106C:  call      CreateFileA% h0 k! M+ f* p& E4 j
  00401071:  cmp       eax,-001; P. c* @% e" x- s! E) y
  00401074:  je        004010912 q4 E' w4 s' ?

% @5 V8 S' Q! G) T2 x( r
& }7 u( L& j& b- k6 v: ]3 lThere could be hundreds of BPX you could use to detect this trick.
1 h$ a1 J; f/ e/ a+ N-The most classical one is:
/ j+ p5 P0 J- I+ a6 ^  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||, M3 J, _2 w4 f$ S* [6 `# v
    *(esp-&gt;4+4)=='NTIC'
4 Q' ^  }0 y6 g6 v0 S- I: A2 M, c6 Q/ h  O; \# i8 a
-The most exotic ones (could be very slooooow :-(0 M4 Y: n* _2 @3 R
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * d2 x, y* {; p7 ]& u: f
     ;will break 3 times :-(+ L4 p9 ~4 Q. r. f9 b) h: D  d
+ N9 C& q* k; L) p
-or (a bit) faster:
& }' Q% k; e6 I3 ^: }; B6 q2 e7 ?, e   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& u$ H" {$ \( X
+ C; g" H$ {# g2 t% q. Z9 X; m
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & B4 m1 b8 F* d2 w
     ;will break 3 times :-(
$ [: \3 H- z" x8 K, p- E( V+ R9 Z4 i  E. F
-Much faster:  W% r  B' u* [
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'- j! C% G. Y* m; l5 N5 V

3 C. T  A9 _- j" p" N4 X: lNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
. a7 H$ O' Y: z! Y- p' ifunction to do the same job:) t# b& |) u$ a6 p4 q

3 t2 K7 r2 ^: A+ H! \   push    00                        ; OF_READ, Q2 m/ B4 O, J- G: ?; x- e
   mov     eax,[00656634]            ; '\\.\SICE',0: I6 _% U/ v9 U/ |* w7 X( e6 b6 k
   push    eax" j- v* w( F2 c1 d
   call    KERNEL32!_lopen
: V/ J/ ]7 |/ w2 M7 Q: _   inc     eax/ y0 x- l/ J+ a2 O
   jnz     00650589                  ; detected' p0 Y" v  Q% G4 k$ a+ A6 h
   push    00                        ; OF_READ
  b9 d) _' W& L4 Z/ t   mov     eax,[00656638]            ; '\\.\SICE'
" j( B+ ~& ?  O   push    eax
1 c% k6 q* @' W5 S  ~3 x: w   call    KERNEL32!_lopen" r5 n2 ^" o9 Y& c1 j$ u
   inc     eax
; p2 O+ Z9 x  r  k) s   jz      006505ae                  ; not detected
7 S; D& n* b6 {! v* S2 }/ h$ J* ^4 w3 ~9 b
. i7 V; ^2 `/ v! Z" P! T9 s
__________________________________________________________________________0 b. [( o6 y5 c

, g+ x1 s% K' {$ U$ AMethod 12
, Y4 q& [+ R' l=========
6 o2 o& S6 X+ T+ r3 l. k( \. a9 i$ t4 |# Z0 ]
This trick is similar to int41h/4fh Debugger installation check (code 057 q1 _0 \3 U+ |- D, {
&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ U1 {1 k/ R7 x5 L
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.* a. X* v( p, p, N% }; q) S

4 X8 Q) a; U2 Y. b3 M% b   push  0000004fh         ; function 4fh5 R9 X, @1 ^, z+ A  x/ H& A
   push  002a002ah         ; high word specifies which VxD (VWIN32)
: m8 J' D1 _4 W1 d$ [; r2 G4 ^                           ; low word specifies which service3 l+ Y7 ^, N1 V5 b6 L
                             (VWIN32_Int41Dispatch), d. f3 v' b5 F* p" n+ i, y" ]+ Y; b
   call  Kernel32!ORD_001  ; VxdCall9 l* \. u  N8 V/ c
   cmp   ax, 0f386h        ; magic number returned by system debuggers
, r7 s. Y+ c+ c) m8 r" {+ `   jz    SoftICE_detected
3 u1 ?' {: m( M, g3 M+ \
: m/ k8 m; ~& v6 GHere again, several ways to detect it:# T  l' j2 @* h5 y4 |  `

7 h; N$ _/ q  S2 a# \5 Y( }    BPINT 41 if ax==4f
3 \) }+ Y1 F. X$ G
) C" I! i6 k" N% t; b! ~    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- f+ I9 M1 ?' i4 |3 L% n# f9 i- O+ x' u, Q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
, q* C5 P- V1 m: O: [) i, s
0 f$ k) a/ Z8 M0 S  B    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 U9 }" Q% A$ B( }5 d

- i) Y$ j4 k5 [  D+ D( f__________________________________________________________________________, ?, p) Q2 M) Q# n7 S% b, {8 M
* e' M- X& m- ~4 x
Method 13) p% e: Y% \4 d$ ~4 ^% h
=========# y1 s, f  V% B0 ~+ i- M

" \" R2 W& P* m5 i, h1 [Not a real method of detection, but a good way to know if SoftICE is
) e( Z; C5 S3 E. I' a2 ^" t0 s5 _installed on a computer and to locate its installation directory.
6 e& a" O. h8 T+ T8 F2 RIt is used by few softs which access the following registry keys (usually #2) :
5 h) h& U$ s( F5 k: R) F8 g" H4 C4 x1 u& R' |- S7 C. R1 |
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ ]% @5 e; N7 u# y1 c/ v0 E
\Uninstall\SoftICE
7 r, m6 `. ~3 H. v-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
" W/ }6 L: P! O) F-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' j5 a6 k' g+ D+ ]+ p4 a) @  e\App Paths\Loader32.Exe( x& B/ R/ f" T, k

4 E0 r* I3 o. j+ }3 `6 q7 i" F1 `2 x3 k
Note that some nasty apps could then erase all files from SoftICE directory# P4 Q  x' _+ g0 Z! }# f
(I faced that once :-(5 [0 E- c! K1 C# U. O0 l% k% |

, H+ v8 Y. h8 o: @) F( ?Useful breakpoint to detect it:
- _( i- L1 r: H" K" M0 P
( G/ G9 Q+ @) q  g     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& c, @2 C" u' \  C7 X/ ]4 M8 U
( V3 T( m8 J1 t. Y" i8 P/ h0 b__________________________________________________________________________
6 V& ~" S4 C& w% X
" G; G' \/ m+ I8 A  Z9 W- X& v, W" F/ G& |8 h: _! w$ a
Method 14 , ]0 {7 K: ~/ i
=========) e4 z( d* J7 h) ^1 |! x
6 S; d, G+ C, X6 Q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ l% F7 \1 n- l  E9 ?+ R
is to determines whether a debugger is running on your system (ring0 only)./ l& F2 f4 x' x$ ^/ p& r
% h) u5 Y! E& Z8 |, F1 M
   VMMCall Test_Debug_Installed  S0 t: m- {+ s! D7 u
   je      not_installed
$ K& i  B8 ]: ^( N3 g. X+ D& ~# n+ J6 z7 L9 I9 g2 b
This service just checks a flag.
' ~- Y( ^# z7 ?$ v7 |0 c# U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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