About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& N8 i; ?; [2 U. i3 ~5 V<TBODY>
% G' `' w& ?0 O6 l* g+ q0 B<TR>
! u% D  p' {: W5 v( A3 P& L<TD><PRE>Method 01
9 r3 S6 A6 ?0 h) t$ W% p+ i  l=========
! a: ?7 p( ]1 P. y- A8 F0 h2 [# k6 g( b2 p9 Q4 J4 Y
This method of detection of SoftICE (as well as the following one) is
5 Q9 p6 R8 o8 Rused by the majority of packers/encryptors found on Internet.
8 l" \. ?6 U* Q. q8 {9 bIt seeks the signature of BoundsChecker in SoftICE5 P& L/ V5 R, b9 U. K

5 S* ~: c8 A! s& l9 q2 q. {7 U# B    mov     ebp, 04243484Bh        ; 'BCHK'1 a" f6 O% a% g& J0 c  P
    mov     ax, 04h" [( x* |% v. c8 I& Y% e3 K$ n
    int     3       9 A3 D# t/ m. K) B& d: m
    cmp     al,4
) z6 L: L2 }7 M% E& Y    jnz     SoftICE_Detected
9 T2 ]; }4 r) X3 p& c2 R. E; ?  O5 c
___________________________________________________________________________* I+ M9 ~% S9 y6 h' B
( }8 W8 ?4 S1 Y
Method 02
5 x2 W) v4 v# Z- h& k! z$ D=========  V4 o, \/ u1 S6 t* X/ a
! x) V' W: I' g! o
Still a method very much used (perhaps the most frequent one).  It is used
2 T! G- y6 O' ~. P! R& uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
* h2 ?- O. N/ a3 a! Ror execute SoftICE commands...+ Q3 \8 g, N$ q0 I5 }
It is also used to crash SoftICE and to force it to execute any commands$ ~; v" R2 h  E: S( \/ W8 h
(HBOOT...) :-((  5 r! E; F  l( Z5 X8 x% Q+ G; l

1 z8 d# Z3 j) Z6 c! }/ b0 t( o: IHere is a quick description:/ s" d5 ^- I0 U2 y! u1 m6 y) J
-AX = 0910h   (Display string in SIce windows): N/ U% m$ w! g3 Z3 L% ?5 W1 H, C% W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); Y& P  Z" ^7 S8 P7 N7 z8 a' Y# q1 U
-AX = 0912h   (Get breakpoint infos)
& {" {; c: y( w3 p/ h% K-AX = 0913h   (Set Sice breakpoints)
/ K& _: ?8 _: X-AX = 0914h   (Remove SIce breakoints)
9 C/ H; ^7 x% ~* Q+ x2 p% ^5 X* a; J4 q" v
Each time you'll meet this trick, you'll see:
2 G* p; p; ?1 j-SI = 4647h1 j1 P+ e. v3 T1 E" S
-DI = 4A4Dh
. x1 m4 \( o- ?. KWhich are the 'magic values' used by SoftIce.7 J2 S" Q5 m$ J* ]
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 C/ n) m( [* l
) y* A9 ~+ d) N7 A6 x: `# N
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 h" P# M5 P' I7 H" C& m  Q3 v- m
Envelope utility use to protect DOS applications:9 |" f( v# u0 R# k: I3 t
/ P/ p& d8 x1 O* P
! B/ L4 k9 L  l4 l' j1 N
4C19:0095   MOV    AX,0911  ; execute command.6 U4 y8 @# L! F5 D8 ^7 ?
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
; r  J$ A5 C- C* }. U% Y+ X4C19:009A   MOV    SI,4647  ; 1st magic value.& ^# r3 s$ E) F# e( k. t
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! q( G1 J5 k6 G. E0 w: W$ N
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& V9 Y0 C: w8 \* q7 C2 M' f* a7 H8 o
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ g( c: V0 Q3 O1 V1 a7 ?4C19:00A4   INC    CX) b) O' K# V' M$ t
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, Z6 Y4 C% Y& f" @# r5 F
4C19:00A8   JB     0095     ; 6 different commands.
1 Z* m; @7 ^$ v( ?* {4 f# Q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' s$ h: `( e) [, p" `: `! [: Z3 W4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 o* ^& ]3 \3 ]4 G/ f0 z4 s  F, i
. ]5 ?- @5 Q/ |, iThe program will execute 6 different SIce commands located at ds:dx, which
+ |5 F, J! b  K% W+ }$ z$ fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 B6 ?1 h0 e! x' `
' ?* b6 O) x8 r
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.. q0 X$ S) j3 K
___________________________________________________________________________) L, Y5 r2 T5 u- ~

9 M3 G) ^4 O) Q6 T
) y; H. l0 `1 B, `' ZMethod 03
  }, e, o) I+ j5 j/ o=========
$ V1 o( E+ E: }% l7 N
2 v, C( Y' y1 }$ G- K* c; ELess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 i3 d0 ?' N: W, ]& Z
(API Get entry point)
  q. c. D+ B% p8 J        
( r: ]7 h- p& N& r% a/ q/ P$ ?$ I# M
3 I3 h3 J' X! ^; j    xor     di,di& P+ Y! ]9 D0 f
    mov     es,di5 t# B/ c$ c) T/ I6 ^, p0 s
    mov     ax, 1684h       ' Z* K8 ?) e6 b' n! h
    mov     bx, 0202h       ; VxD ID of winice% \/ U' Y! m9 k$ Q
    int     2Fh) L6 b$ R5 ], D( r! U4 z) y8 }* q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 Q3 U1 b, m7 q
    add     ax, di$ C0 X& Y# r+ T7 m9 q
    test    ax,ax
# @9 ~4 A3 @% `+ R1 S2 {% b    jnz     SoftICE_Detected
2 ~$ p5 B6 ^, L. H# u  g; N1 m# X8 k$ R4 S$ U
___________________________________________________________________________1 p. @0 }4 v( w2 v; p
' Z- a/ Q+ _6 R2 G! l
Method 041 E7 B# n6 m; r: D0 F. E9 K
=========- q. m8 H  I' Q& j6 v3 B$ ?4 z0 x

! c  X  F4 L' `" _( \( k" oMethod identical to the preceding one except that it seeks the ID of SoftICE
  ~9 G( g+ C5 w. {3 a+ R5 ?GFX VxD.* m. B$ i  n7 h* A) o

3 {+ G4 @- h6 U: y' \. C    xor     di,di
& k& F: l, B/ u+ l% z    mov     es,di. D6 \# r! ^0 T# K
    mov     ax, 1684h      
, Q5 F  i% w1 S/ D% M8 }" z    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  \9 Y& r0 N/ H% y. @    int     2fh
% v3 k; G  \3 x! ^6 z& |    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ a9 @+ g9 L- ^
    add     ax, di
) z1 |& Y* y0 R7 y( E: x' B    test    ax,ax2 s; k7 s9 S" x! I7 g1 t
    jnz     SoftICE_Detected
# E- a) I. F+ J: s' I" K3 s9 s
__________________________________________________________________________
0 _$ P5 b+ X6 g% S, L9 A2 y0 s6 R+ u7 G9 f

7 T& s. r% N. O0 s3 [4 R- q+ yMethod 059 v. ^) }: {: r
=========  T+ b% D* z8 ]. s$ M. J

# K7 l1 ~- n1 C5 Q) _0 C! sMethod seeking the 'magic number' 0F386h returned (in ax) by all system
) [# g& t: @6 g1 V2 _6 X2 Rdebugger. It calls the int 41h, function 4Fh.
0 I8 }* ?/ z) @4 W7 U. m( }There are several alternatives.  
; i$ ]0 l; X# S* [8 A$ j8 ~( @6 u+ H) |
The following one is the simplest:6 m' z7 m& Q: p& Y
  v1 K2 S  V7 E. c
    mov     ax,4fh
. A4 k. P  A/ _    int     41h
9 r4 V0 A) d0 C& ]( W    cmp     ax, 0F3861 v/ U/ F! u$ b" Y- @0 N* R
    jz      SoftICE_detected
+ g% x( J% M. X% a# p' i0 a- e" t! k: [

/ a2 ~0 z2 N8 g3 Y+ A/ {1 XNext method as well as the following one are 2 examples from Stone's 6 J) K- M$ ]4 s! p/ ^2 k5 }* k
"stn-wid.zip" (www.cracking.net):5 c2 l2 m- O2 E) f& `6 K
8 g9 y! [! P+ E3 i+ K" p7 @
    mov     bx, cs
& V3 a# I5 G3 Q$ x5 `    lea     dx, int41handler2
! _3 s6 ]" ~: b$ a/ j    xchg    dx, es:[41h*4]
5 N+ v+ {: v0 |, R/ _" g    xchg    bx, es:[41h*4+2]5 n  Y1 \* F! P( v, `: c, _: }+ G
    mov     ax,4fh) R) x2 F5 C6 j, }) ^  n
    int     41h& F; n  b& |2 k6 B9 `6 v( z
    xchg    dx, es:[41h*4]# g! H6 B8 ^8 `. o
    xchg    bx, es:[41h*4+2]3 c7 q5 @- x3 Q
    cmp     ax, 0f386h
" Z! C- q+ l& M4 v; X    jz      SoftICE_detected
6 |4 V! X: J0 A- J2 Z, E4 S) F2 U$ x# g( c
int41handler2 PROC" s; E1 g' o  _0 ?/ T: Y0 r
    iret
( f" ?5 i( V* ^% |! X. g# v/ tint41handler2 ENDP
0 S7 O% {2 ]% P% P* m% n# B
( t. E, s8 S/ p- h2 E  H) S  X. v' ]# x0 l& k1 `( ]7 E0 Y3 d1 _, s
_________________________________________________________________________
! i7 a1 g( E: g) Y
* p8 T3 ?$ C4 o2 ]2 T1 S) M  Y! w% [( v
Method 06! S2 S, }$ R2 e1 m* v
=========
( P) s/ D8 @" ^) L. |2 P- R; P
  l& @* x7 s! d/ d: }0 g" w
, y2 n) v* B& D$ ^* [5 C2nd method similar to the preceding one but more difficult to detect:
% T! N& M* x/ D0 {
) R4 n/ Q- {/ l6 i" D- J, P1 I. N  `- `& \, r
int41handler PROC
0 \7 @0 p' z- q+ B9 w    mov     cl,al
  C8 U6 F7 C5 F. O5 Q    iret- X: J# E( g: p" X
int41handler ENDP
0 `4 _" p3 N& d8 p5 N; H* _6 S+ ~8 Q- C' w1 N. A% W
0 s7 d" _; \3 ], |& c! ~
    xor     ax,ax, C7 |/ e( r; _3 Z
    mov     es,ax
. G% o* h( i0 [8 ~6 C: z; H" Y, I    mov     bx, cs
$ h, ^1 L6 X+ u5 b4 B    lea     dx, int41handler
3 t& E* b6 W2 K; t0 q) t/ Q    xchg    dx, es:[41h*4]
) o4 Y8 u! _- E% W    xchg    bx, es:[41h*4+2]
8 r# x  e1 O4 k" U! v! {3 _+ s    in      al, 40h
& [/ b, K: C2 t3 N& Y) ]    xor     cx,cx* X" @4 t9 u- }* R
    int     41h* A7 k; a8 ~, R* U: K4 H
    xchg    dx, es:[41h*4]4 d9 h6 t1 n- b6 a$ w" _0 f2 W/ i$ [! P
    xchg    bx, es:[41h*4+2]
/ z0 ^0 O& C1 ?; K; |5 Q    cmp     cl,al
) p* a0 V! F9 [- I    jnz     SoftICE_detected
* Q+ X  H) U: _- E( \* a$ k! y6 K, b, d: K/ B& m- a
_________________________________________________________________________
0 e  L: u/ B& C9 _: @( m
. [7 a, g( z# @  O5 M7 H8 J: YMethod 07
$ a+ J6 V, l' b=========* S1 l% l! G+ I8 L! F

' S5 L, `0 w! Y) aMethod of detection of the WinICE handler in the int68h (V86)& k) b: F% J& q( Q' q

- H% E3 x/ |" [    mov     ah,43h: I+ z5 k. c. _& C
    int     68h$ \6 }6 ^- S2 X' h
    cmp     ax,0F386h
, x3 N6 G" X& o8 f4 N2 B    jz      SoftICE_Detected9 f0 P8 F  K3 k5 u# a( X
: L7 l# B0 `0 t8 |4 q; t

. x) P0 D2 X% L: }4 C# d7 J=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 o2 o* P* c9 B  Z6 n! N   app like this:2 k; V( e: P7 Z; R
8 K5 r  D# n7 _' d" I2 A
   BPX exec_int if ax==680 }0 q; @: }3 v, z$ t
   (function called is located at byte ptr [ebp+1Dh] and client eip is# X9 L' Y) t& ?; k  x7 e, m) b
   located at [ebp+48h] for 32Bit apps)& \* X% K/ F. b; e, |8 Y
__________________________________________________________________________$ B% n6 f' g4 n

" o* u- R' v. s8 z8 a5 o$ i6 d( h/ l
* r$ y  g5 g: e2 ]# m8 ]Method 08( H5 }* e: h) Y+ E- a9 }9 |2 W6 M7 A
=========
, x9 |: _  b% S
. O# I3 n/ y6 q' H# uIt is not a method of detection of SoftICE but a possibility to crash the
3 {7 s/ l2 A3 m) l0 X8 z3 Fsystem by intercepting int 01h and int 03h and redirecting them to another
. b: x$ S/ O* C0 p. _% proutine.
0 Z3 Y% Z% P  [2 ~It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# L$ R4 o, i/ B5 E# n
to the new routine to execute (hangs computer...)  j: d! M% w- ^) o' L: Y

! K+ z7 B- b1 q: t, O0 W- ^& m    mov     ah, 25h
8 f# c) O% W7 f; L2 o# ~+ X. i6 }6 t    mov     al, Int_Number (01h or 03h)+ }  u  U/ X1 L3 A3 Q
    mov     dx, offset New_Int_Routine; K. d: @/ v0 _, Y  }
    int     21h
+ [+ O, X& u+ M# p
; Y. p- M* F( c__________________________________________________________________________; C+ ~6 `  s  y& @% P* q7 i7 O
5 A! R/ M3 ^! P) l5 K4 q
Method 09
- i* N' H1 N+ E! \4 }4 F. j# N=========
! [2 @1 C" N: Q6 K+ T
3 ^5 |* L$ f& T9 j( V2 qThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only7 Q( ]) i( @. [
performed in ring0 (VxD or a ring3 app using the VxdCall).
) j4 v1 Y! C/ v! v3 GThe Get_DDB service is used to determine whether or not a VxD is installed3 ^0 R( u- {1 \+ b" Q% b; R+ ~5 t
for the specified device and returns a Device Description Block (in ecx) for( f) l1 X. F3 k5 _
that device if it is installed.3 V- ^" `1 E4 t6 ?8 y7 P

$ v0 R6 x' |- S% P  Z( \   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& M4 O/ R+ @6 {* U3 \
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 ]2 a  _) d5 D4 o( x) x0 j
   VMMCall Get_DDB: M+ G* [) Q& }1 J0 k
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- P% I9 T$ Z) z, r1 H0 P8 @, \' \/ y& @4 n& E
Note as well that you can easily detect this method with SoftICE:/ f6 h6 `9 k7 |" t1 E% R$ p
   bpx Get_DDB if ax==0202 || ax==7a5fh
0 l" P+ W+ p2 b, h- h3 I- i" z
7 j* [" Z0 x% e1 m* f__________________________________________________________________________
5 e2 a  x: H  ~& p. Y9 c+ _6 e% z/ h# t/ ?0 p0 k
Method 10$ G0 }- Y6 a4 w0 W% L7 _
=========
' J4 }; ]" A: Z0 C2 C$ i" A+ ^# e2 p. ]
. q4 b  B7 Y0 z: E, @/ D9 i0 n=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. P. l3 E( ~6 @" F" a  h0 B  SoftICE while the option is enable!!2 [1 \; R) y) a9 X" ?

# T0 x8 W/ [1 ^# ^! k" Z( TThis trick is very efficient:$ T  |9 U. t# B8 t( [
by checking the Debug Registers, you can detect if SoftICE is loaded- t7 p. Z5 z2 C- F' F% F
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  U( s* m3 y! @; Z# Ythere are some memory breakpoints set (dr0 to dr3) simply by reading their, Y- @4 a3 B( j1 B' e) g9 \
value (in ring0 only). Values can be manipulated and or changed as well
* z3 r2 y. z$ q$ `3 N5 n$ C(clearing BPMs for instance)/ f$ z- D" a/ }5 k( [& A
  `& V! h# k0 s# w( E
__________________________________________________________________________
8 C1 t# ]9 h0 B6 p0 r( _
, N2 y& X9 D( \8 C7 ?4 }Method 113 U4 O. a# `+ h# e* W0 n
=========
' W0 F% y& s  `4 `% i6 H1 h  L' I" R/ l2 C" _6 H8 w8 P! o" b
This method is most known as 'MeltICE' because it has been freely distributed5 G. h3 f/ ?* Q6 L: o
via www.winfiles.com. However it was first used by NuMega people to allow" X; y7 i1 Z$ r# R
Symbol Loader to check if SoftICE was active or not (the code is located
9 g+ B; Y2 ]! N9 u& E! B9 z% T8 Ninside nmtrans.dll).# Q/ W; w. n; S0 A; n4 m0 I  B
5 v; n% F! X2 P7 @* {, M7 q. O! d
The way it works is very simple:5 n& r* B8 U' Z' \3 D7 S3 n. S, |
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 t* K) ^- U, KWinNT) with the CreateFileA API.
- i. }% T3 ?! ^- ~+ _6 r
" W( F3 p0 B3 {; a1 O% cHere is a sample (checking for 'SICE'):
2 g9 j7 q, ?% g  ~" l
+ a7 K4 Q6 S* r" t7 ABOOL IsSoftIce95Loaded(); p) T; [1 J- D% w/ q
{
( q, Q1 ~% A: j! P3 s0 Y: P4 _   HANDLE hFile;  
/ A: X- _1 Y+ B   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# H9 X8 Q: W9 a' r. R                      FILE_SHARE_READ | FILE_SHARE_WRITE,) F( d. Y; }% }- j) ^
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) A( [2 f2 |: f* }& r% _* C
   if( hFile != INVALID_HANDLE_VALUE )& ^2 w8 M9 ]# e1 C: }) r6 d) Y
   {
$ D# ]; a: A5 G$ a( @& X6 x9 s( n$ ]      CloseHandle(hFile);( k& E2 t" v$ e
      return TRUE;6 |9 _4 s/ ?8 Z% s+ O6 p
   }& O& F3 f- p( `- x. N, b
   return FALSE;
6 ?  A0 H, v7 B# U}# l$ O7 P$ X' |; N2 R: C

& M* R* O  e) m! ]3 O- IAlthough this trick calls the CreateFileA function, don't even expect to be
$ c7 a/ Z/ e7 M5 f7 |able to intercept it by installing a IFS hook: it will not work, no way!+ y5 ]1 e  b- i5 S  i7 Z4 V7 S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
! B$ r. j" ?5 e5 }# \. B1 Aservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
% u% ]4 k4 O: S+ x/ b8 eand then browse the DDB list until it find the VxD and its DDB_Control_Proc9 y* j1 M# a8 n  D8 R. U. @
field.
! i; |+ Z! R  I! O3 |; qIn fact, its purpose is not to load/unload VxDs but only to send a
: K! f% g+ e) v3 A1 k# P: d5 C' v, tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  N- J( U' R3 S+ ^1 i( v4 M
to the VxD Control_Dispatch proc (how the hell a shareware soft could try4 d% f; a8 ]  i) {( a3 @8 V- j& y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).6 J; `2 N0 s( J4 F: ~4 r
If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 d# L% e3 M, H( H. `8 qits handle to be opened and then, will be detected.! ?1 G+ Q4 X, I
You can check that simply by hooking Winice.exe control proc entry point- z4 M, Q8 r" o, s9 {% ~
while running MeltICE.
1 m1 C' B; o9 C6 ^1 M2 O5 G# ^0 M$ Q0 I% D

, x' D2 r4 T- |, H8 b  00401067:  push      00402025    ; \\.\SICE
0 U, g; g+ n3 r5 ^2 W  0040106C:  call      CreateFileA
6 o- c, M. W, W7 o3 `1 B; e  00401071:  cmp       eax,-001
1 p4 u8 m7 t/ q. a  00401074:  je        00401091
$ q9 |) M( H9 K* @/ y3 E2 D
! p: E( k  z% c9 v4 Z5 _) c! P3 {& }% E9 r+ l* B$ `
There could be hundreds of BPX you could use to detect this trick.' z9 a7 y2 E2 p5 |
-The most classical one is:- H) L8 h9 H2 S; }0 [
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 G+ x& L' r4 R/ b    *(esp-&gt;4+4)=='NTIC'- P* k9 j  y+ ?7 U( m" |

  A7 P! ]. O/ K- c5 i-The most exotic ones (could be very slooooow :-(
1 r( B2 s- l7 r8 S   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % |3 t) f! K8 A& I2 D
     ;will break 3 times :-(
: V1 w. G* V2 K/ w
4 h6 F( U$ K6 E. V' J-or (a bit) faster:
" k- @6 h! Y& u9 V+ a. q7 [# U   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! N4 M2 D- n8 T; [9 y3 ]

% u  ?! S* [4 ~  P( f4 [$ W, B4 \2 O   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ' `9 i9 ?7 D3 B6 E
     ;will break 3 times :-(: @9 R+ R( S" f* S1 s9 R
% k. q# ^( B4 X( p
-Much faster:
- I3 N! n' p% u8 R! P   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' h; _* e$ P' j3 h

, t/ `" |" ~6 R, d. Q" s7 m2 dNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
) v2 ?: @9 [& f# h4 F& kfunction to do the same job:2 j" [  Z2 i3 G; _( V# w
- H7 @. \" o% h, @, ^% l
   push    00                        ; OF_READ2 ~: e+ m9 t+ ]  }
   mov     eax,[00656634]            ; '\\.\SICE',0& e0 R' t: [+ o+ {) }4 n- J0 u1 h
   push    eax
' x7 w! B9 \1 s6 }- z7 U( c% P   call    KERNEL32!_lopen
, R( K( T$ w4 o& D; k   inc     eax. ~9 l4 ^9 ]: i; m: F7 r# _
   jnz     00650589                  ; detected
/ d# M; r2 S; w3 a   push    00                        ; OF_READ
( [, u/ A9 b7 B) F! H   mov     eax,[00656638]            ; '\\.\SICE'% m1 F" z' \! T3 b$ y. w4 V6 A
   push    eax0 B1 [8 m8 a3 |# [% w' `4 s
   call    KERNEL32!_lopen* A: x# K- B$ `6 h: O$ ]8 M0 k
   inc     eax
$ n4 d5 t# @" ?. U& d   jz      006505ae                  ; not detected* A8 g$ U. l, m5 }; _( z5 ^

8 b6 w0 J/ |% m( ^$ k- S& j( i
& |. v/ e5 N, i5 ?7 o2 [( p__________________________________________________________________________* t& A) E9 F" t6 q  M$ W9 a4 Z
: |: l1 @# H0 v
Method 129 W- z, s) L) R& d4 V$ Y
=========$ B+ e# g% l6 G. l9 ?0 a
5 a$ X1 G( c2 u
This trick is similar to int41h/4fh Debugger installation check (code 05
) v" x- S( g0 S5 y6 L; Y3 ^% K6 Q&amp; 06) but very limited because it's only available for Win95/98 (not NT)
# X" W7 `7 }; C2 q. Bas it uses the VxDCall backdoor. This detection was found in Bleem Demo.: I" ^# Y/ T9 x, D. Z+ y
- E' g2 A  Z8 _
   push  0000004fh         ; function 4fh
# e# `+ ^" h0 r' ~& d$ M   push  002a002ah         ; high word specifies which VxD (VWIN32)
' Y  Q4 g" h, @% ^$ T& ~: m% b                           ; low word specifies which service
- q; r- }7 O" i2 j7 Q, @                             (VWIN32_Int41Dispatch)
  C: d8 c3 e( z# w# h' x+ T   call  Kernel32!ORD_001  ; VxdCall1 y/ }8 X; I% u! {* j& Y
   cmp   ax, 0f386h        ; magic number returned by system debuggers0 V9 B5 {; L4 H/ I0 q
   jz    SoftICE_detected
, S7 o+ o& o/ S" u/ F! ?0 E: T' i/ @$ s5 o9 V
Here again, several ways to detect it:! s& t8 m0 Y1 O( |

( Y4 {6 N7 C1 o5 {. w9 G: C  F    BPINT 41 if ax==4f
/ N8 A9 W% W) z! Y
/ F3 k# A) ]- ]' V    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' y* d. ]; `/ ?4 n0 y& t
$ X# b3 X1 f- W' k  O
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. d. T! L6 n1 C! {

+ t5 e4 z' B0 T$ _3 i    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 [: M# F' c/ \; M  L

8 ^. b; x9 U5 l9 s__________________________________________________________________________8 E8 j. ~8 U' l0 ?: U, X* S# d
5 e8 h; W4 x- U" R: ]
Method 13, r" Y" v0 n3 i$ {& b  Y+ e
=========
& z6 |. }9 d7 p( |6 s5 }' q2 K$ T7 k" b) T
Not a real method of detection, but a good way to know if SoftICE is* ~9 k. J3 n# C  N$ o( U
installed on a computer and to locate its installation directory.4 S% ~9 w  q& S! j; w6 y
It is used by few softs which access the following registry keys (usually #2) :
8 H) r8 |& I, G, D; t9 o. G5 f0 Q" c; ~8 e6 v& g
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# h) A( P3 S# p/ Y6 K& ~2 `\Uninstall\SoftICE7 x# g# O8 R3 ?4 i; L8 l0 R% t
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 ?) v! r$ h) u-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  s; ~4 a# z0 [5 E& M# h* H8 c
\App Paths\Loader32.Exe
" ?6 F2 N8 c" i4 E3 K6 z- `
) r6 C& Q$ q+ `) S5 P( N+ w7 P. H7 z  h9 V0 H) y- H- n( k
Note that some nasty apps could then erase all files from SoftICE directory
- K  v4 t' e, d3 k(I faced that once :-(
3 E8 M1 U' s6 ^+ f
# W( q6 j: a  K: m7 \1 U0 zUseful breakpoint to detect it:
: T" ~+ C& `' ]( O1 A4 R- W7 s0 ?; J. E
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
- V0 F. E! o! i+ F* B# g6 t) \
6 e. {: V: E5 Y__________________________________________________________________________" G( z7 j) _& V6 k
* v& t2 z  [' l* a% G

4 j) _) h, h1 ^7 \" pMethod 14
& ?" H0 o$ s% w3 S& \$ C=========
$ I  p; h( F3 j+ L& b/ S* f2 r4 ?3 W4 V% w5 |2 k. y( Q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. T: f* C; O0 T3 j) V+ `is to determines whether a debugger is running on your system (ring0 only).
: F4 h2 x& Z5 d9 S  ~( g9 D
' `3 {6 F6 O; J. U! x( ]   VMMCall Test_Debug_Installed
9 c& L) E  {4 ~4 K0 f   je      not_installed" x7 Z& ]0 s8 z, j7 f
0 k$ ^; g2 k* X. D2 _/ ?
This service just checks a flag.
0 ?. o1 A& l: s7 F7 M</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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