找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
. X; D" r" g/ I+ h$ G1 t<TBODY>
- M2 M* V" M0 x0 g: F$ X<TR>
- F' `0 A; M' v$ L; k<TD><PRE>Method 01 8 y: o  M3 w$ F7 u9 n5 x* J0 u
=========
3 Q. y: @6 f+ [1 o% i3 s
: z" k5 Z$ N( NThis method of detection of SoftICE (as well as the following one) is
! p8 m1 c! K. C9 m1 [5 zused by the majority of packers/encryptors found on Internet.
& u( b; C6 g' W1 V  ^5 v' u* SIt seeks the signature of BoundsChecker in SoftICE7 H! @! r7 ^: p! }3 ]" Y" c
; U% i, O% C' q- ^  E
    mov     ebp, 04243484Bh        ; 'BCHK'" K4 U: c' O" h% ~4 z
    mov     ax, 04h) }* A  \: O, T! O
    int     3      
2 X# D' w7 n+ ?6 F8 j: b1 {2 ~0 [. r    cmp     al,4- u: D4 h! H; D: h
    jnz     SoftICE_Detected
) Z3 i0 j" p: ?8 I3 Y' y+ x( G: @* @3 P6 e8 ?- U- l4 E
___________________________________________________________________________# K2 R, `* F: y" _0 J( e7 A3 V( H" H- O

, {4 H' C; v( g" C* S4 j  WMethod 02
" j, V5 r+ c+ `=========$ x# C- E0 M, n

, e6 G. W' ]- ~7 l$ M" vStill a method very much used (perhaps the most frequent one).  It is used0 `7 ]! W/ q6 m
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
* N/ C4 z. T0 |or execute SoftICE commands..., R& x7 D6 r' W# m
It is also used to crash SoftICE and to force it to execute any commands+ N( {7 ?; x8 O# W
(HBOOT...) :-((  ( X, T& w. A8 r; e; L

1 ^4 L. |1 b+ R; R9 tHere is a quick description:7 U" q4 d3 `8 P
-AX = 0910h   (Display string in SIce windows)
) b. _, p3 ^8 g! t-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" _8 b& Y2 C: ^5 d. u9 ~$ D-AX = 0912h   (Get breakpoint infos)
% C% r" V# n) w- J% ]-AX = 0913h   (Set Sice breakpoints)$ t' x2 ~# E4 ?/ F* b/ w
-AX = 0914h   (Remove SIce breakoints): z. w. p$ R( n. ~/ }+ R) x0 O6 d

7 u% A5 [; P, K* n0 N* rEach time you'll meet this trick, you'll see:1 Z: s# f& a# ?+ C1 x
-SI = 4647h' y# B2 _1 k% X/ p0 W! g
-DI = 4A4Dh- g. ]1 p3 o. W3 i. `
Which are the 'magic values' used by SoftIce., b4 [6 X8 M1 c! Q  R
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; h% v4 _  h% d+ c! n

0 C8 y! S2 l9 j% lHere is one example from the file "Haspinst.exe" which is the dongle HASP# |- s8 E1 ^7 e2 Q8 i* a
Envelope utility use to protect DOS applications:
7 F5 @$ ~- \/ G& m7 g
! u$ j& f5 @2 E6 }' n" @3 o( q3 V7 }7 [+ n/ u
4C19:0095   MOV    AX,0911  ; execute command./ I8 b* J" t1 l
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ O- X: L+ F0 n  S% Q5 U
4C19:009A   MOV    SI,4647  ; 1st magic value.- t+ E  r2 d* |- r+ a. {$ Q, x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.7 }' Z5 t5 N+ _( k
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ I% X0 m3 q5 ?5 X4 w4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute' Z1 J- T/ [' {
4C19:00A4   INC    CX
# j) ]" z0 q: Q9 H7 j" ^: z$ N* c- ^: i4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 Y2 G* |& f+ \4C19:00A8   JB     0095     ; 6 different commands.6 E) _+ r: w, C% h( U
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, s1 }  p* U) e  _4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 V* H6 T: O( N' `1 A# X

7 c) _: c6 C: e7 s5 xThe program will execute 6 different SIce commands located at ds:dx, which
; ]5 T. t3 N' G0 Eare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 [" U* W4 E6 i' u' V8 z) K& B6 t
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 B. |, V8 |+ W___________________________________________________________________________! C& m: t/ r5 H

) P4 g& E0 [  j# }  ?' q. c. H, B0 S& [4 D- A6 q
Method 03/ Z! v( k$ \' L" ?, d# {  A
=========
' }( k- w# z$ R: a4 L4 ^0 \  {& y# {; n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h- v; R. K( n$ x  o( [6 Q! c) j
(API Get entry point)- }; o: L- y/ S7 ~+ \5 c7 J
        
3 r* C! T& v+ [; ]7 J% Y
3 k5 }- X/ P8 L2 [" I# n/ K    xor     di,di
) Y! T% O6 [% i8 G1 R9 W    mov     es,di; V" T- d  Q1 s4 W: u
    mov     ax, 1684h      
- \* N0 c! G% k    mov     bx, 0202h       ; VxD ID of winice
  C9 _/ _8 I% l  S5 i4 U    int     2Fh
. t8 s% j2 Z3 s: Q  E' S! g    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 i' y& P7 ]* v
    add     ax, di, _( B8 a9 k* e- L# x2 O
    test    ax,ax4 A$ S( C5 _  V, L2 H6 ~
    jnz     SoftICE_Detected2 S% p4 e. E! d' L' |0 j

/ _3 O4 `6 i' F4 }4 \! B. A___________________________________________________________________________
. p$ P8 X0 j" s% j  h/ l
  l4 E6 `1 L0 |Method 04
: W0 U' S/ \' _=========9 {3 k. m2 D0 [+ `

% z; u6 P( G) O3 P& ^- f* QMethod identical to the preceding one except that it seeks the ID of SoftICE; P* }4 l1 I2 M) ^5 {1 R& e) L
GFX VxD.
- ^6 T3 g" R5 _/ x* x5 Y1 D: [
, g& A1 h% p/ w    xor     di,di5 D* A# ?( c* w8 S/ W) s
    mov     es,di
% Q7 M7 {) ]7 X7 ?. z6 U3 l& Z    mov     ax, 1684h      
3 L3 d3 Y1 F' m    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 x# ~7 I; y% M5 @6 U8 O* t
    int     2fh
, [$ P5 c! g9 D! b0 ^& K! q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; T0 D3 _& O5 t6 N  M    add     ax, di9 P. b1 p( E% b3 n- R
    test    ax,ax
% O% q( N$ u# i! Q    jnz     SoftICE_Detected
/ b: q' O) p/ |9 |4 Q% [7 r4 u( t+ \
" j. @! Z! m) P8 P3 f# q__________________________________________________________________________
; Q6 v' l8 z. u/ c/ U$ k: n1 m3 k% ?1 M7 L# {
& H' q1 P; q# d
Method 05
* U9 J8 {  M2 S3 C& G$ t0 b3 a=========
. A5 x' k* p6 E
9 k* O  ^5 I" K* d: iMethod seeking the 'magic number' 0F386h returned (in ax) by all system3 F5 ?. U$ D' G7 E) A2 U7 S
debugger. It calls the int 41h, function 4Fh.
# w" D7 e+ A! |$ H! F. lThere are several alternatives.  3 t) p+ w" T; H# r

" ?6 _& e/ Y2 [8 D8 U1 }The following one is the simplest:
- `* |3 `, }$ R$ P
8 B, J# P1 Q9 @5 s    mov     ax,4fh  N# [) y% E; s7 b) R
    int     41h
4 h6 i. O$ Z) [+ Z' K0 p    cmp     ax, 0F386
3 E% @0 s* R; h. C3 k    jz      SoftICE_detected! m2 Y) i9 {( H2 e! x! V& V

# F* z; Z" S* J& ^- X% O
: P: W; g, d8 T9 m* R7 bNext method as well as the following one are 2 examples from Stone's 0 @0 ^6 u, {  O- }
"stn-wid.zip" (www.cracking.net):
# C: [" \1 m3 D2 S; S& o
. _7 G' Q. J; j8 |    mov     bx, cs
: `3 H9 x: X( @$ z6 r$ @    lea     dx, int41handler2; j* _& G% {' F+ N* H7 x* f$ e; l
    xchg    dx, es:[41h*4]) A8 G/ l8 C3 m9 I
    xchg    bx, es:[41h*4+2]
1 E: i9 ]& S4 ]$ u# E2 f; _    mov     ax,4fh8 R/ D: T  t6 d: [, `' h5 W1 N
    int     41h
* q5 \0 p0 R4 M    xchg    dx, es:[41h*4]
# D, Z, i% t+ N4 `7 O2 N    xchg    bx, es:[41h*4+2]
+ s; \$ w) o  V/ j  I/ _7 @    cmp     ax, 0f386h
( N* ~7 E9 ?3 ]    jz      SoftICE_detected
4 Y5 b  i" C) T, M0 F& r  x+ E
! V' G- b6 t, Wint41handler2 PROC
7 U0 Y& S1 q6 G% p2 W; h: s/ [4 ]7 ~! Y    iret; \1 D) I, \" n
int41handler2 ENDP
5 b9 h8 Y$ t9 o6 p' {  ]# i
+ W3 W. l4 J0 `- K2 X* X) A3 T" y& y( m* {
_________________________________________________________________________; _: S. h6 Q4 C

: W- f* K' U/ u$ x* K- ~" j5 h1 I& b: N  G4 L! x2 L  b* y
Method 067 S" [% g: _/ C' J+ b, R
=========
0 W. |& l$ p5 L; @1 [/ h9 v' I* G& K! c6 j8 k6 c+ j
) g3 y8 u+ s, T# }' G, f$ ~
2nd method similar to the preceding one but more difficult to detect:- }0 N+ z% U% e3 m, P

; e; b4 J4 C8 b2 h- s
* i, U& K# r3 d$ |6 n* w5 Z. N  ]int41handler PROC
+ _% l7 g! ^* ~; j. U/ c0 I9 a    mov     cl,al
$ F! `$ y: M, D$ e( K    iret
( x2 ^. ?0 J+ rint41handler ENDP( @, |$ d/ `& }: Y# @- m" z; u

1 Z% s+ r. g0 J( s* Y$ ^' g
1 `0 c* e" v& c+ C1 {) @    xor     ax,ax
1 Q$ _' V  `/ j/ ~    mov     es,ax
( m9 O+ G  b0 c    mov     bx, cs
: u9 M$ ^- U9 L5 f% c6 |    lea     dx, int41handler. E( A3 q' I8 A+ u, z: M- Y$ y
    xchg    dx, es:[41h*4]
2 W, O/ V/ _* v$ g9 N    xchg    bx, es:[41h*4+2]
7 K: X' C+ E# a; f( n    in      al, 40h7 k9 ?, n" e# D( }% A, T) d; v* d
    xor     cx,cx
* ]2 y% a5 d( c! `5 p- i    int     41h
4 ~3 G" A) a" M5 t- y4 D    xchg    dx, es:[41h*4]
4 C2 k5 t# a1 ?. _    xchg    bx, es:[41h*4+2]8 B% q1 |+ c7 J
    cmp     cl,al
8 x2 M1 x9 _2 E* O; J    jnz     SoftICE_detected
& U8 q: l+ G" O, p/ j
+ j! s* r# e; `4 R: [_________________________________________________________________________
* F( N& X1 }2 l* T
5 V2 Q- p6 l2 M) t$ mMethod 076 j" D& w' f8 r) T: m  r+ E
=========
; c3 [9 j/ i1 j. i- F: C# M: @" j9 }9 z; P
Method of detection of the WinICE handler in the int68h (V86)
$ w# D3 q8 l. l* }9 Q
7 p4 O' Z$ I* W1 E. \    mov     ah,43h  _) S: C9 n) m" F
    int     68h3 O+ B0 v6 T9 c
    cmp     ax,0F386h  }! C- l% v9 W
    jz      SoftICE_Detected
" i# x3 ~+ f. ^; v2 v: a! c9 d' p& ]( H7 L1 c

- m0 D" A. L' [( E% V* N=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
* @% m/ j( g  V  |, N% Y# \% o   app like this:
" c9 f/ G; W3 o6 j$ G! {3 C/ K- }
4 o1 k+ W6 _+ L0 Q; h   BPX exec_int if ax==68* G  t, _& ?) t7 Z
   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 _" x' q& t! y& ]. s6 G7 S& W, u; g: b+ X   located at [ebp+48h] for 32Bit apps)
1 L9 ?+ B" Y) ]3 u1 H# G( K__________________________________________________________________________3 h3 h6 `( J2 ]" ~9 G) V3 b8 N! S) M
3 |/ t) ]$ e- v3 F+ d( K% z

/ X: Q0 s3 Q$ y! q9 WMethod 08( [4 O* A0 Z' ?9 h9 G3 j9 V# }
=========
( [, v' x8 X4 v" H, ~) w( o
- x  `" h6 i) R4 a3 {4 XIt is not a method of detection of SoftICE but a possibility to crash the
) g7 @# m/ {" G9 O/ y4 W  ]; E8 Q/ p# lsystem by intercepting int 01h and int 03h and redirecting them to another! A5 U0 N& w! p
routine.
" u% Q) M& ?9 v7 n. d) VIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ L# ~3 c2 n1 F0 }# |! s; Qto the new routine to execute (hangs computer...)
; b4 ?* O- n" N8 c$ ?' D3 F# C. I/ ^  V. l; L" X+ q
    mov     ah, 25h3 L! h; Y6 y4 S! y0 j# O3 J+ n' r5 g
    mov     al, Int_Number (01h or 03h)
8 r$ L2 V! ]+ ]& q1 G" p- j3 v    mov     dx, offset New_Int_Routine& b% b' c" Z: y% j# V
    int     21h
2 Q9 Y6 F, S/ y5 y5 u1 n8 d
; Q, Y; `9 n2 ~( f8 \3 I2 m__________________________________________________________________________) K, \; U$ w2 w

- }  }2 X0 D* V, F' WMethod 09
% W6 x8 C; ?1 G: s=========9 y- v/ T# W1 d
' @6 ]6 E& u+ s$ k, @9 W+ X
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
+ F1 _; p9 t# U# N1 t' t+ b7 C# ?performed in ring0 (VxD or a ring3 app using the VxdCall).
! R5 U& d7 F5 N  d: l( |The Get_DDB service is used to determine whether or not a VxD is installed2 W% p, U9 k! E2 e# l* f' j
for the specified device and returns a Device Description Block (in ecx) for  @0 _  E" f# R! b) a
that device if it is installed.
% z( S9 r0 u3 {  I( O9 A+ c, b3 X. ^7 j) U  Q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& D+ K7 K$ |7 u9 G" R. K1 ^3 W   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 R5 p& D9 [4 K  [5 {8 E7 Q
   VMMCall Get_DDB
0 j& q! q% }% J" H   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# g' ^3 X% |: f9 S

# ~0 t9 v% i" m& W! v8 l. nNote as well that you can easily detect this method with SoftICE:# u( m( c# d/ ^3 z: G) s- s7 N4 j
   bpx Get_DDB if ax==0202 || ax==7a5fh
/ Z: @( G0 q' J: u( p9 D! K9 V/ i6 C' L/ m
__________________________________________________________________________" q' F% J( ^6 U, g

& z& F# y( ~+ f4 @# I, b2 s! dMethod 10
$ @( r" P, G& N' K=========
5 `* q3 k9 R5 r; h2 L* P+ [' z: L0 T' G/ A$ W
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# M8 q/ n4 W5 _- H/ ]
  SoftICE while the option is enable!!
! o  U9 {4 E5 D6 _& w6 B$ Z/ J& b# u; C# |
This trick is very efficient:
/ z( k" V7 f& M1 @9 R# Iby checking the Debug Registers, you can detect if SoftICE is loaded
- u8 O3 v4 Z+ B, `/ t1 i* |(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; I( c8 B9 @) u8 E: p9 ?$ }, @
there are some memory breakpoints set (dr0 to dr3) simply by reading their0 F3 }5 P, c* Y. R+ L9 ?
value (in ring0 only). Values can be manipulated and or changed as well
5 ?1 ^* U4 G* t& j(clearing BPMs for instance)
- P0 c" w# D6 u8 U4 t
, b/ Z5 L: A* A) h* Z+ ?__________________________________________________________________________# E2 G+ @# k8 f1 l/ Y7 h5 s

8 i: I* K' w/ ^, IMethod 11! W- M* ]& x2 }8 l
=========
( [, s2 E8 i* i+ O2 j- M. y( M# N
. ?0 X: a& l. v, x" B. dThis method is most known as 'MeltICE' because it has been freely distributed
8 Q+ w, Q9 Q$ r- [+ yvia www.winfiles.com. However it was first used by NuMega people to allow
2 d  F* S7 f" \8 E1 r+ s* U; aSymbol Loader to check if SoftICE was active or not (the code is located- g. z$ x. Z  L# J- G
inside nmtrans.dll).$ U( N$ B6 ~% d* a4 R+ A

! ^$ c2 b- p( z& t& K) ?The way it works is very simple:
# d7 Q" I/ ?" y. g3 R6 |It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 c+ X7 P2 l2 P( Q4 j; b5 I
WinNT) with the CreateFileA API.
  Q) w, F. h( z! c% M& z# I# f8 H9 ^+ u, E
Here is a sample (checking for 'SICE'):5 e' e7 q6 Q/ `) E* H
: U( ~! a  P3 [
BOOL IsSoftIce95Loaded(); M$ n# c$ [6 r, }% R
{  V  f9 R% z: Y, S0 J5 q
   HANDLE hFile;  ' G. m" z. ?) H. V4 a2 h) \
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ c+ ]* c4 F* d% a1 ~; ?3 L
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
" m. J) `6 I  {                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);- O$ _1 Z% L" v+ k# ^
   if( hFile != INVALID_HANDLE_VALUE )* J* P6 p2 t) E$ i( u3 B
   {
! f3 ^" {2 I$ l; }3 N      CloseHandle(hFile);
* i' ]/ d+ j/ ]6 Z8 E! ]" {, g      return TRUE;# @; j: n* K* |& z+ r: j7 h4 V
   }
+ H: s6 l* l3 o9 P( V2 T/ Z* R6 {   return FALSE;
: J) P) G6 R) j/ I}6 n8 z- H# b7 ?; z
, @/ ^5 P6 w1 t& w, j& M
Although this trick calls the CreateFileA function, don't even expect to be& w& |- d7 ^1 O3 Z
able to intercept it by installing a IFS hook: it will not work, no way!
1 z4 i  H4 U$ G9 }: qIn fact, after the call to CreateFileA it will get through VWIN32 0x001F: c& r! A8 E) S/ k* }, U
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( m4 o) @9 w0 E: E$ K- vand then browse the DDB list until it find the VxD and its DDB_Control_Proc$ }2 y( i$ `- D0 v
field.) D) H: |# U" L1 i
In fact, its purpose is not to load/unload VxDs but only to send a
$ k9 B+ l0 Y' k- i% L/ d% k. qW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). {7 K4 K  o4 g1 S  R9 W
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
2 L* }0 c# H4 B& s2 yto load/unload a non-dynamically loadable driver such as SoftICE ;-).
# {: l" |* Q3 y& M, aIf the VxD is loaded, it will always clear eax and the Carry flag to allow
5 I* C0 z5 W& Yits handle to be opened and then, will be detected.
* e7 c* _( n- bYou can check that simply by hooking Winice.exe control proc entry point% p2 |* q) Z! ]' g! w! i
while running MeltICE.
6 m5 G3 g4 i: a0 i  Y
2 f9 k( F/ q" m' v, ^4 ?; H, Y) ?# V
  00401067:  push      00402025    ; \\.\SICE
  C* k* p( L, L! n) P6 u( G  0040106C:  call      CreateFileA% k  [* z- i9 D5 t* ^; W/ B% S8 V9 d
  00401071:  cmp       eax,-001
$ S$ V2 r% ]6 s) A' M/ ^* K  00401074:  je        00401091
) ]7 J  e. a) B- w" p; f
( \5 T+ h+ [5 v+ Q3 W! a; }4 M/ a# G8 c# V6 Z6 X# @. n
There could be hundreds of BPX you could use to detect this trick.; i$ u" ]% ]# O  s2 r
-The most classical one is:1 T/ U2 Z% H1 R  l4 w( P# V
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 E- j3 _! g' T- P+ S, r) `4 \
    *(esp-&gt;4+4)=='NTIC'9 I$ B; f# ^' r: p
# F5 d" {' ~2 u
-The most exotic ones (could be very slooooow :-(
- H$ D8 S, p; I' j6 {+ i3 P   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : O- A' A! x8 h% i8 O$ J% \3 b# L
     ;will break 3 times :-(7 Z+ d$ ]. }- l! _8 j+ H6 |

! g5 w. o8 A5 o-or (a bit) faster: ' q5 e/ A% r7 c6 z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 [1 f1 i/ [/ k$ ^' N
* M5 j, T2 r# o: L6 Z/ C  O+ U, ^   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  8 ]: k" p" K' e
     ;will break 3 times :-(! r" y& a) p  r) A* ]3 @& r
/ M8 m: Z& s7 O! W+ L; n9 p1 a; |. m% e
-Much faster:, X/ R( X) X+ v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
- {  ]( ?0 G* z& ]" j, L
, @8 g" E& a8 n9 ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen' I" L6 e+ ^) N2 d
function to do the same job:
3 e+ w4 l7 j/ C% m
) T0 E/ [" n+ i) d, D   push    00                        ; OF_READ' J- ?8 c  I6 m9 Q9 S! m- Y5 A: N3 |
   mov     eax,[00656634]            ; '\\.\SICE',0+ R9 K- Q1 n: h5 G) O
   push    eax/ g5 T: E. e4 x) ^
   call    KERNEL32!_lopen" ^# {) j( n; P- O8 D  w2 c: o  x* A! T
   inc     eax! C/ e1 c2 D. b4 U. Z
   jnz     00650589                  ; detected
0 W) q9 h/ r  Q( k" B   push    00                        ; OF_READ8 W# j5 m8 T2 n* R, ^
   mov     eax,[00656638]            ; '\\.\SICE'
1 _8 Y8 p% w. e! O) @7 [0 G+ L   push    eax& C( x5 Y# _+ {# ^2 t# v
   call    KERNEL32!_lopen( O4 v8 C, F$ g" x% Z
   inc     eax
. j3 n1 H0 D" [   jz      006505ae                  ; not detected/ ]9 v# W+ j" e
" x+ ~, W4 w3 {* p* e% c& M

+ ~$ ~' d. L: l__________________________________________________________________________
0 a) \, C$ v. M' }' c
8 Z* t1 c& O: s( A' GMethod 12. T  [, g6 _, u/ ~  n
=========! p3 I  |& i$ w4 l" G" e

: R6 E+ d3 s5 S/ J, R, Z, TThis trick is similar to int41h/4fh Debugger installation check (code 057 |1 k9 K- D/ g; ]( i+ v3 N. W
&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ Z" s  @& I# l+ {: u. g7 y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 y+ _/ @$ Y# M/ G

8 G+ G9 O- Z6 m4 K. T% O   push  0000004fh         ; function 4fh- i) F2 ^; [$ L  b0 U2 n
   push  002a002ah         ; high word specifies which VxD (VWIN32)& [2 E9 K2 _$ T/ `; N$ h* y# X1 ~
                           ; low word specifies which service
9 \) i9 g6 q: P" c+ b+ B' }* d, Q. U                             (VWIN32_Int41Dispatch)
3 s# P. l9 ]- X" F   call  Kernel32!ORD_001  ; VxdCall# Y! i2 I# ~' p( N0 [$ f
   cmp   ax, 0f386h        ; magic number returned by system debuggers; k. A( f  U) O9 y8 I
   jz    SoftICE_detected
# S6 F7 ]* m8 p) t1 r* X9 G8 D; P" E4 U, E# M# S. d
Here again, several ways to detect it:7 x1 s0 y8 ?$ A) E1 E. i
. @0 B; o1 I+ G+ r
    BPINT 41 if ax==4f1 S2 C% Z- [9 W! F4 ^  Q6 n; I2 ~
( A& x/ Q. z2 r7 d- A' M
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' E" A0 P% ?( ]. [( k) k9 ?' _2 E+ J5 Q- \
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 f8 z' k$ L. B! N4 X- ?" d0 K
9 {1 y5 T; A4 B1 Z6 K' m1 S! _( T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ O) q8 B4 s5 w0 [9 {8 ^* k+ m% S8 y( x7 D" |) E# g
__________________________________________________________________________
9 M8 l4 h* Q1 S9 m# m9 \- _6 S0 M/ q$ Y
Method 13
7 \6 [4 U7 A7 U( _1 E/ Y/ z6 c=========
$ l! |$ U$ |" m, I' B2 L6 V9 r: y
Not a real method of detection, but a good way to know if SoftICE is% |( Z- s/ ?8 f# I
installed on a computer and to locate its installation directory.% ~$ }. s9 M) M7 @. Q
It is used by few softs which access the following registry keys (usually #2) :; l) K  p* F+ D
2 l6 a9 c' @/ B# t$ s1 W0 M6 @
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 h5 E; q* ]9 ~" I' B" H\Uninstall\SoftICE: V+ ?& n7 @6 D$ H3 o: L
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 ?- n4 G2 X: F' L" O6 F* @
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# m7 f' V; H: E- o$ i
\App Paths\Loader32.Exe
- l+ _9 d, v% @+ L+ K) m! N$ X, i, n+ {) y3 Z

. [" ~) T- D) c) LNote that some nasty apps could then erase all files from SoftICE directory
. f% K% R3 a9 e- y(I faced that once :-(# Q0 n: ?: V. N3 O9 F) }
  A9 g9 S# E1 [! V5 [% S3 ]
Useful breakpoint to detect it:) Z5 S) i7 s, G( I" W; X8 C+ [# M( ?

. F3 N2 K' d4 N2 D* ~     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% [1 y  H: i; t+ `6 m

; Y4 Q. c' L! @0 F__________________________________________________________________________
1 e! b. y* w$ b2 I3 v' n  |) r6 f+ E: F- a- N: w# v3 U

5 n) f, p0 `, b; |/ [Method 14 . W0 L, s* Z. b& {2 r8 G0 b  [
=========
: G# ?4 Z( S0 W5 A3 G" K$ {+ r5 m& k. \/ ?2 r6 X. F1 V" }
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 T! v# b, ^; ?$ p- \# X/ K% uis to determines whether a debugger is running on your system (ring0 only).
; n  V. @$ ]+ [- Z/ h8 M; X: T
& f3 L$ L$ |  Z: }3 D7 ]3 t  n   VMMCall Test_Debug_Installed
5 @; o0 L7 K5 O6 l0 d6 ?   je      not_installed+ }. N5 Q/ Q! r& [6 K  J8 H2 h: R

- E5 L9 V3 }- ZThis service just checks a flag.. n! L* ^. i0 g" k% A6 H3 o& u- Y
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-11-29 17:09

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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