About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>! v) R/ }6 e0 S" o8 A+ G
<TBODY>  O9 e9 K" @1 j/ b
<TR>
$ d2 ?, s- Y5 M5 y& F. Q, @' n! ]<TD><PRE>Method 01
9 Z1 {' b$ S- T# U/ p7 h=========6 v. y$ s2 c6 @( \' d8 m" O

7 V4 d7 ^" X4 H/ ]; dThis method of detection of SoftICE (as well as the following one) is4 O. r9 R# g$ P- \
used by the majority of packers/encryptors found on Internet.
/ t/ Z' n: Q! i; i/ J' kIt seeks the signature of BoundsChecker in SoftICE
+ Q8 n; E$ `. C: W! ]) k0 H4 }' E  f
    mov     ebp, 04243484Bh        ; 'BCHK'7 [# n2 Z8 L% W5 F
    mov     ax, 04h
, I( y/ t4 N& U2 u% P9 `    int     3      
9 z' u1 H: f+ X5 p( J2 h    cmp     al,4: U: v; W+ c' o- W; J2 [5 i
    jnz     SoftICE_Detected
, @9 X. f. U$ U
; E  y+ J! V( M+ _6 Z___________________________________________________________________________
  f! L0 g$ j0 R/ `
" b, p3 o3 W4 C& ~Method 02$ b# x* ^7 d9 u" k
=========7 n! ^& R" X9 b0 F! x- ~

1 W4 R; @4 C4 N3 V' qStill a method very much used (perhaps the most frequent one).  It is used
4 ^. c" L- d% k0 f5 O) Qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ x, S# k; B9 F3 dor execute SoftICE commands...
3 [) W; y  |& @/ CIt is also used to crash SoftICE and to force it to execute any commands9 ^1 S- Z5 f! V; @; }7 c
(HBOOT...) :-((  2 G1 t5 W: c  {3 \0 l

; X; l& y# C# M/ \, p  ~Here is a quick description:0 F6 }  `7 k  G$ T
-AX = 0910h   (Display string in SIce windows)& O2 A$ J+ g1 {. H
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 u# ~1 a  o( K* Y2 p# q-AX = 0912h   (Get breakpoint infos)3 O: L& j% E$ u1 j; P# {+ k
-AX = 0913h   (Set Sice breakpoints)( E( @8 B7 |5 w6 w! t+ Q
-AX = 0914h   (Remove SIce breakoints)
$ ^5 A  [/ {( u$ _; U
3 @8 R- O* s% l- E) uEach time you'll meet this trick, you'll see:
3 T6 W' G" V8 V% Y8 {7 Q9 x-SI = 4647h: {) U# l( j) K, ?& V/ I+ s
-DI = 4A4Dh
" t6 m7 l* m0 u7 m4 ?. ~! T: ~Which are the 'magic values' used by SoftIce.
2 ?/ V& `8 s3 O. ?For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
( s( L, a3 U' \4 Y3 n6 I+ j: x: m6 ^- Z4 d" O
Here is one example from the file "Haspinst.exe" which is the dongle HASP
) N# }' t( E0 x# N- _. EEnvelope utility use to protect DOS applications:
. c2 {( {3 o; q  z3 t6 `6 M4 W, g9 H' J& E; t' G4 m
: a- U! F; Q/ u: n
4C19:0095   MOV    AX,0911  ; execute command.9 h/ R3 O( ?: l2 J# I. y4 ~# m
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. U' n4 H" k- [! {+ r  }4C19:009A   MOV    SI,4647  ; 1st magic value./ z0 I; p+ ^- n7 _3 r
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& m, t) s: w" z% v2 G4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 u- j  @& \& z$ m3 ?
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute, m7 D. W" c* K' [) N
4C19:00A4   INC    CX  c& G5 g/ w, ~6 g* u1 N
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 ?4 O& b2 i/ O1 \2 G% E4C19:00A8   JB     0095     ; 6 different commands.
) A( V2 ]) Z0 {5 ?  v4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 m% M, A& l! Y. [1 p, {4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :). H  Z: c( @2 v& n/ f) _8 u

) P! t5 c: J7 G9 {  N  }The program will execute 6 different SIce commands located at ds:dx, which: K8 x$ P$ S; X) j9 T# a
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.( M) I2 H, S  @7 r# ]) `

5 h. r4 ^9 R, ^; M6 y" [% i: Y2 N' P* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
9 W6 p( f% B! }+ r1 @, e8 F. j. [___________________________________________________________________________2 r  R. y2 n6 W/ h

. w# w" N6 D$ j# g5 w0 u
* G0 k9 @' r" X2 A4 W. jMethod 03
' c! I- x; h. i9 x+ P8 y2 u=========
. Y9 ?* @; r3 D' [+ y1 f& |) P1 I. T3 R- K" h
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# O* w2 U- }& J1 U! s(API Get entry point)
4 O* N4 V: U2 i- I        
) t- g9 B% D- [
0 f( s  T, D9 C) \  ?! h    xor     di,di
% h( x: v! \- }( G    mov     es,di
" n; {7 x% c/ E) l    mov     ax, 1684h      
' t9 [9 ^" `6 T, _, @( L& v    mov     bx, 0202h       ; VxD ID of winice
8 M/ V# |: @" d1 N4 q    int     2Fh
# P5 T! a% C4 `    mov     ax, es          ; ES:DI -&gt; VxD API entry point. K, f+ t4 d8 n4 d
    add     ax, di' S3 N  q! l& [6 P
    test    ax,ax
( k- o- v' C( {2 F    jnz     SoftICE_Detected% p; n! F' R- ^& K* z  j- N2 L4 M

% `. a1 @9 v$ x6 K* z. X___________________________________________________________________________
# B6 b( H! A: K% D! Q0 x: A# C" R, ?& I  L2 B% z* T% ~
Method 048 N" x: _- t6 m
=========% z: ~: C3 T& H+ m4 t  i2 p

! d) D7 e+ K$ d: J! d' U" GMethod identical to the preceding one except that it seeks the ID of SoftICE( l3 I& a/ A$ {9 w) \
GFX VxD.3 A% `! v6 X$ r9 \" X; A1 B
9 U$ M  }8 w- f8 H. x! D# D4 R1 q% s
    xor     di,di7 x7 f' S5 q* y, f4 l9 |& b
    mov     es,di
* y. `$ |5 K/ {; l' [  y    mov     ax, 1684h      
( |' t7 b7 R1 X7 A- `    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# O0 f! b0 j; E( U8 v: L    int     2fh: t* @% r4 O, r' W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* ]6 q. R. p, M. c# c) Q    add     ax, di
1 V* K' n% c8 n+ _0 y6 N    test    ax,ax/ x& T0 ^$ N8 Y3 n0 E+ R
    jnz     SoftICE_Detected
+ D* [/ q5 l; ~$ F  t9 I* `' m) ~4 O) l# r& e( V7 e
__________________________________________________________________________
( G& ^& f) ?0 e' {. h" f
+ j" a& N0 b. i7 ~- K# @2 Z; z3 \% v4 Z( T, O
Method 05
1 h% k7 P/ _- E) c# D  K- L( T. A) Y=========- {4 X( a# `9 @$ J* u) l1 G  |
, P3 r5 \4 o- M: D
Method seeking the 'magic number' 0F386h returned (in ax) by all system
% \7 O6 e0 S. n4 O# W7 Vdebugger. It calls the int 41h, function 4Fh.
6 d) T2 P) c+ I1 ^& WThere are several alternatives.  / h3 p) q8 z. Z* i* T+ V

( j6 C& i9 M3 L: eThe following one is the simplest:
4 ^0 H1 d( `5 \5 Q% S' M  X# f$ e5 C
+ U) }  t7 h' I8 V9 S    mov     ax,4fh
, \7 R* @. g- _    int     41h
  a- X9 H1 f9 }0 p8 H: V! c    cmp     ax, 0F386
$ T" o: z8 O. u4 Q) P- j# B    jz      SoftICE_detected
' z3 i" X+ ]4 c2 I; S! f( M/ v2 D8 ]' b% C& J
& s8 I5 |1 p) v/ j' x# ^) `
Next method as well as the following one are 2 examples from Stone's ! H# O! Q; }) X4 ~6 Q
"stn-wid.zip" (www.cracking.net):
* r* Q, Y( d1 u5 a. [& c- ^9 w# A- ?  F% r
    mov     bx, cs
1 E7 G' U* \6 v6 u    lea     dx, int41handler2
6 g: y) [1 c& [8 z+ S$ i" z    xchg    dx, es:[41h*4]) G( H" s" ^- _* x
    xchg    bx, es:[41h*4+2]7 @2 \. z7 S/ _" i- O. j% p+ d5 F& r
    mov     ax,4fh
- {5 p% q3 \: c  ]0 v    int     41h3 m( e! ]$ i( k$ k7 Y: Y
    xchg    dx, es:[41h*4]( g  A8 _$ p& J; ?, g! x9 p' `
    xchg    bx, es:[41h*4+2]$ l4 P, L: d& a# A/ T- G6 L
    cmp     ax, 0f386h
0 N9 J" X- x. K  y9 |, d    jz      SoftICE_detected
( `8 @( {( k+ \  B9 p
3 w0 T2 M5 C' O) Sint41handler2 PROC
/ i' O) r  I+ F5 }# D    iret. c" `6 h+ s5 e+ Y4 @8 g3 a7 [  U
int41handler2 ENDP
# w3 u' {/ h* R2 l# G9 L
, Z- C- }8 i( I4 [5 M, Q# T
: s7 c5 n0 s$ [8 F% J$ b_________________________________________________________________________
) z9 H# {: I2 X2 E7 ~4 h
8 G' r2 Z+ q  j, h" |( E4 i' k0 p+ U4 S# N0 y6 M% M
Method 069 b/ K& C( Y6 `- W
=========% K& G* O4 U5 j5 w  b. ^) F0 u

' o9 L  q- z# }
: Y* v$ ]' \) @$ T% @0 @2nd method similar to the preceding one but more difficult to detect:
3 ]' n- `/ i2 U3 u4 }& P, {2 x% u4 T* P$ `/ P9 F# q$ c
- |) w6 I. i! h( r/ I) l4 ]
int41handler PROC
! i0 s' ~+ ^4 [# y1 ^8 u    mov     cl,al, ?- s% X9 J% ]. g8 k1 S2 l
    iret
' b1 t: L8 I; j+ Y9 |int41handler ENDP/ m+ Z/ T' Z! A5 c8 {7 j
) [1 v& U( k5 W& x/ A

0 z3 J. P' I5 x2 @% B9 l    xor     ax,ax
" v, a8 a4 R( L$ J* R- F9 C    mov     es,ax+ R2 M0 E6 T  i. {2 J& u+ a: m0 ]$ ^
    mov     bx, cs
, k. f1 A: G! x    lea     dx, int41handler  U; F/ y5 J" U2 x6 S# y- ~. Y
    xchg    dx, es:[41h*4]% [* r' \3 t! `: L  T6 B! J3 N
    xchg    bx, es:[41h*4+2]$ j' T; r1 \* T& D# V9 b6 M4 _
    in      al, 40h
) M/ I" M8 f- j# {5 Y$ u    xor     cx,cx
4 h1 ~! \1 e( ~    int     41h
- M1 R! W( y# S    xchg    dx, es:[41h*4]
: Z" S% [5 |' n2 F: ^5 I    xchg    bx, es:[41h*4+2]
/ `. r4 \; O% l- |1 V    cmp     cl,al/ |- V+ j2 N& N) g5 ^. ?
    jnz     SoftICE_detected
' [5 z4 A* r# v3 |% _
* \+ @& \1 l% }8 |! E) Z_________________________________________________________________________
, Y2 r( _( _8 i! F: J7 K" l, J) E! ]' ~- j$ ^  S9 s
Method 07
' x4 o. i( f& c9 Z=========& o8 ^6 e" h. t8 `* P! R' H
9 C1 Y4 O9 W7 X) Z( h# V- N, ~6 K
Method of detection of the WinICE handler in the int68h (V86)
, D3 P1 @" F8 n6 o5 |$ ~+ h2 s3 E) r7 U: f% w0 J. m* \; t
    mov     ah,43h; D- U: R. ]& N7 V
    int     68h
  X# `3 j; l6 L' [8 q( y2 U    cmp     ax,0F386h; ?& m' d4 S6 h0 {& M9 g
    jz      SoftICE_Detected) T  |- {" ?0 I% {7 M

! V% M# i% o! Q; E0 [: f8 s3 ?# f: t: p
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 O) ^* R* @5 H- y, I5 P   app like this:* ^. T7 a. r: o" G7 O
8 h$ P: g6 q* v. O
   BPX exec_int if ax==68
; D0 a9 C) ^2 p. e& g+ z1 H% V, F   (function called is located at byte ptr [ebp+1Dh] and client eip is' r- e3 n, G* k' |* w4 k+ F) t
   located at [ebp+48h] for 32Bit apps). R8 x2 E8 `; {
__________________________________________________________________________
/ l5 x: l- r$ @  C- K9 {% A6 X/ G0 S
# r. c* O' u/ K" ~
Method 082 I  j  I6 ^$ O6 _
=========6 a( z4 w  V% P

3 e  y2 c; v; I6 n' l7 U6 _+ }It is not a method of detection of SoftICE but a possibility to crash the
6 ]9 h8 k- r) p' Fsystem by intercepting int 01h and int 03h and redirecting them to another& C1 f* f0 J3 ^. D
routine.5 I2 t3 B, L0 n  x
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' ?# y' U4 D/ ~+ Y8 T* Ito the new routine to execute (hangs computer...)
4 I8 H/ w$ B" P2 M: i. i9 z- u5 y. F! a* {& E; O: B4 H: W5 t* z, c
    mov     ah, 25h
8 w! q* e/ t% @/ A    mov     al, Int_Number (01h or 03h)7 k) a% m' s* s( {& A% ^
    mov     dx, offset New_Int_Routine
! e* Q) n5 b' _" z/ }! V    int     21h: c3 [! l: X2 [  [9 b

! t: @& z1 `3 U/ ?1 |5 U__________________________________________________________________________
: O$ D  U/ {0 E8 j4 A6 J
1 T, s8 b" v- {6 \6 P. bMethod 09* x$ v  ?5 ?$ V3 L1 F; B
=========5 J" F$ l; F" m7 ^% e: l9 W3 l

- g- {# k9 G& L$ |  [- UThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! a. Y' h4 w, ]2 b/ iperformed in ring0 (VxD or a ring3 app using the VxdCall).9 s# z, ~& @: N% O. x
The Get_DDB service is used to determine whether or not a VxD is installed
( A+ k8 K: z* [$ d( cfor the specified device and returns a Device Description Block (in ecx) for
$ U1 r8 {( t+ ^; c8 O! [that device if it is installed.
4 J( j$ S+ B/ \7 p" f5 U7 H0 r# {4 j, b8 O  k
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# U' e7 P1 F( g# S
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 I: i9 r* @* |( j1 C& F   VMMCall Get_DDB" H( Q4 o! b0 Y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 D: I/ u2 L0 y* f* r

2 W) o3 O( j: _$ c& J. uNote as well that you can easily detect this method with SoftICE:0 R- ~5 b8 `( ]( O. B
   bpx Get_DDB if ax==0202 || ax==7a5fh% D; h; R' q! A( W" O

2 I4 i: @7 ^" K4 _& O__________________________________________________________________________( b: n  e5 A+ ^: S# i% z% e
7 R/ _+ r2 ]9 D9 t3 K0 `
Method 10
$ H5 }3 z# e) Z! w* A7 [/ A0 i. c  @=========) j6 u6 ?; W# ~  N8 U
' p& I& q' O$ O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
7 F1 d; O! o, w; ?" m+ a- Y0 q  SoftICE while the option is enable!!* B; h! s0 P! p7 Z. t

& F$ m; b* }( j% g; pThis trick is very efficient:
$ F- [& ]* a, p, k5 Y* Xby checking the Debug Registers, you can detect if SoftICE is loaded
4 T8 ^- m2 _% t4 N. j(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 [- j4 {( A1 i+ j' C) lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
/ d1 A  [. b2 m3 E( M8 W* Yvalue (in ring0 only). Values can be manipulated and or changed as well1 {4 V" Y$ w" V# P- J8 b$ E
(clearing BPMs for instance)
5 v: W5 X, i2 e7 v5 D- O* h7 B. D. Z6 ]8 o6 X: H4 \# |
__________________________________________________________________________
4 N% N. G' z! |& E2 ?
( S' b8 E8 z1 wMethod 11% C% @& }' I: m) T0 e5 W8 X
=========
4 a& i; h. r+ m) v* _7 S' l- P" `7 ~1 P
This method is most known as 'MeltICE' because it has been freely distributed
$ G) D; y" i' P& ^via www.winfiles.com. However it was first used by NuMega people to allow. @$ Y' @9 n9 ^' Z; M/ v
Symbol Loader to check if SoftICE was active or not (the code is located, s8 |6 B" y7 P. @
inside nmtrans.dll).! q: u# ?0 c- r+ w' J% G' _  S
/ B( }/ ^; ?+ l' P
The way it works is very simple:& J4 k. e0 H' m0 r" B! r
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% ?: ~" {  q' l9 s2 ~* XWinNT) with the CreateFileA API.
8 Q: `; c5 F5 t2 j- R0 o( |% M# ]5 p& z7 Z! N: b& r
Here is a sample (checking for 'SICE'):
$ C/ P" K. {3 c1 q
: c6 S) Y6 u: Z: j& _; G, CBOOL IsSoftIce95Loaded()
5 f. r. j: h; }  Y{
. W7 R, A6 y! g; h0 T% b   HANDLE hFile;  ! a8 j* S1 l% l8 ^+ n$ r
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,/ \" z7 ]/ D  T9 A: @. T& J
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 z" S: _1 X8 q  K1 ~                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% w2 f' G- S4 P1 k5 O5 e
   if( hFile != INVALID_HANDLE_VALUE )% I% U8 ^( K" m, g3 `. h
   {2 ~; T0 ~/ N1 i$ x1 {, @, j
      CloseHandle(hFile);2 L: p. r6 c: J$ m2 u: ?
      return TRUE;
" T7 J  C' Z1 r8 |; k   }' J  L* |- ^# q' C( z6 V0 ~
   return FALSE;3 D& F4 v. }) V" ?; t1 O
}
6 \1 n/ k7 @, _2 M/ r- z
. G6 s9 G7 @5 w/ Y# D& _/ |Although this trick calls the CreateFileA function, don't even expect to be
& G# |3 @: s* R1 ^" ?  {5 O( vable to intercept it by installing a IFS hook: it will not work, no way!
( P# s& ]+ F. i& C- t3 ?+ L3 v$ \In fact, after the call to CreateFileA it will get through VWIN32 0x001F" x/ m( n3 v8 {
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 j) G3 X' G2 t
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
1 e# D" u0 }- H6 `+ Wfield.
4 `) V; F9 T  E  [. c6 AIn fact, its purpose is not to load/unload VxDs but only to send a : z0 u) ], J( W1 q7 m5 J' O% k8 |
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE): _7 B( M6 ?) }5 z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
. W/ H* f. N. I% Fto load/unload a non-dynamically loadable driver such as SoftICE ;-)." b: n4 K, J( Q$ J' T
If the VxD is loaded, it will always clear eax and the Carry flag to allow* l( b, j. K+ u; q
its handle to be opened and then, will be detected.
, U: @) w9 P9 mYou can check that simply by hooking Winice.exe control proc entry point
. _& W+ O0 S8 u0 X+ C+ Kwhile running MeltICE.* ]0 z# u+ w9 B

7 C; i. r0 r" h3 \' `$ B, d  B! u  Z4 q- }$ }3 l6 [
  00401067:  push      00402025    ; \\.\SICE
( ]9 Q% s/ R5 b, V8 l5 q  0040106C:  call      CreateFileA. I' K6 H  X3 K6 @
  00401071:  cmp       eax,-001; {+ \, C3 o$ `# S: H% @( ]
  00401074:  je        00401091
5 P' Q( k$ q5 u9 Q" e& X" T/ `$ T
6 y5 R& y3 t$ E/ Y; {8 u. J6 M+ M  J7 b: m+ W! ?# l6 s( P
There could be hundreds of BPX you could use to detect this trick./ _3 _" Q0 K( h  g& ~
-The most classical one is:  \7 u3 l  @2 r$ w
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
( H8 ^6 u4 J' ~- Z+ B6 I    *(esp-&gt;4+4)=='NTIC'' P: g  n4 R2 C. n# x+ M- @

) [" z$ @& D( B7 U/ k5 l-The most exotic ones (could be very slooooow :-(
/ V* D& ^$ z  f0 _   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ) {+ W  I& d* m: t2 ^+ }" G3 S
     ;will break 3 times :-(2 c$ Z3 C" ]7 B$ T: X. `% L. v

+ }# I5 L* S4 A* \1 Q; v9 t4 E. r-or (a bit) faster: 7 N$ l3 B! d4 z* O/ r1 o' R! l
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ S7 t& C& ^) n& z" j9 J3 ^1 ^6 k- [* C
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ G4 p. ]; L) r" M6 {! P1 N4 N     ;will break 3 times :-(
0 s- P  U# i, v4 D* J4 ^$ g9 e# h
7 ~( z( @" F0 e8 O- x2 p! V-Much faster:% ]& f; b! Z7 Q8 F% W
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 k2 Q, O$ ?0 c  D3 @

- s3 n' _+ @* |0 y) Z$ mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen& y' A( S* ~3 Z, L3 j! x1 b- _2 Y
function to do the same job:
" i6 Z9 M! f/ k% F8 B( z$ [6 y0 Z% a' L; P3 ]/ f1 t
   push    00                        ; OF_READ
, t, d# W4 v% R! ?7 U4 X" C$ `0 z   mov     eax,[00656634]            ; '\\.\SICE',0
& r  T! @. Q) g% Y   push    eax" f$ \- `, t& N! U) H7 {/ L# Z
   call    KERNEL32!_lopen7 E: J9 @# J% R+ b/ x  I( d3 P
   inc     eax0 q' I( f% O4 y1 M% D) c3 w8 t6 g2 r3 B
   jnz     00650589                  ; detected- h/ O7 r2 G7 y( b. ^0 k
   push    00                        ; OF_READ! e- h' \0 ], R% \) s) Q; H. w
   mov     eax,[00656638]            ; '\\.\SICE'
8 {" e2 G  ?) w+ n9 o- l7 [   push    eax
$ Q# N3 r% R( y5 b   call    KERNEL32!_lopen7 F" B& z+ o% Q$ U! c. ^
   inc     eax
. |+ K+ B3 C, [   jz      006505ae                  ; not detected
! T6 [/ D. k6 G, C' }: D5 t
) @+ y% Y% d  _$ E  ~; P! Z+ ?) n2 Q0 j9 M- ~
__________________________________________________________________________
( i. l' I) G8 c* h7 w( B: X: m  v. Y2 {$ a' g/ Z
Method 12
3 F: J, b* b- f$ H1 D% S=========+ F8 l3 q0 o6 D7 {7 J

0 ~* E. C9 H8 A$ j8 |This trick is similar to int41h/4fh Debugger installation check (code 05
0 s4 Z( V, t( W3 R1 }&amp; 06) but very limited because it's only available for Win95/98 (not NT)  C+ i2 {& Q: R; x3 F8 q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
. p) @4 U; s/ X5 Z# }/ q' J4 k6 L: V  K0 W2 z% m7 J3 w
   push  0000004fh         ; function 4fh
7 U+ u' [3 \( Q8 J   push  002a002ah         ; high word specifies which VxD (VWIN32)' ~7 b( r" e% ]4 x, ?9 L
                           ; low word specifies which service. L6 o: F" \5 L0 R# {
                             (VWIN32_Int41Dispatch)
) p1 I+ Y3 B  d   call  Kernel32!ORD_001  ; VxdCall
! H' x" q& b1 U7 b3 f3 N   cmp   ax, 0f386h        ; magic number returned by system debuggers2 F5 }" ^0 b) i5 z
   jz    SoftICE_detected
+ x/ {0 D2 g  {+ n1 S+ F
: s. P8 O; l! W- v: lHere again, several ways to detect it:
( v, y6 b( t, W- d% m( S, n! V3 T% H. w
    BPINT 41 if ax==4f
$ Q" }9 g; c2 B
4 w2 T8 e  c' Y* R, G' B( o) \9 U6 R    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) w  g: g8 j* Q; ~. F+ Q) q7 e  x9 R: v  l7 P
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A, G2 _) D# [0 c9 ?. J9 b# x# }
6 V5 }: X" {+ t  f
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( X: v$ }# R* M! u6 T$ R4 S# s& }( k9 T- S+ ]( ]! m" r
__________________________________________________________________________& B  T! H1 c+ F8 n" B3 Z& @
. s3 V7 s- E9 f8 Y; ]5 @
Method 13
6 |5 {) C) D" h=========7 O9 s. _, v0 P7 n& G% q5 g
! k5 N: Q* @1 e
Not a real method of detection, but a good way to know if SoftICE is# U6 {$ M2 g* Q' Q% |$ A, r
installed on a computer and to locate its installation directory.
6 _- R1 @* x. H/ U. cIt is used by few softs which access the following registry keys (usually #2) :& x1 j; j" K# L. v2 Y

+ Q' R, n4 o& l* _# L-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- X& u5 i% V* g/ \9 ?( w1 l\Uninstall\SoftICE9 i% [6 L2 ], W0 a7 {6 C5 h! c. z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( Y, I7 e+ N  @
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 A/ Q3 Z( P  V2 V8 h
\App Paths\Loader32.Exe
( k& |2 G3 K; ?- H( h
8 J3 C8 z! `% m; P6 N
  n6 [& m( s( O- G8 j8 G- JNote that some nasty apps could then erase all files from SoftICE directory$ A& v, c7 a! r+ {7 V( O
(I faced that once :-(% x3 |% X& [) M6 q/ K

; b4 i) _7 M( X$ J8 @6 KUseful breakpoint to detect it:
, n* s; v3 {% _8 ^% g) i. z! b' x& r% U- L. h" O" X
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
7 a. t- j9 o) _! t8 c( k
& M3 {4 S& k' O! t/ [__________________________________________________________________________( _6 J3 ^! {5 l) F7 s5 V1 w

9 x+ ?8 N4 g" ~0 [
! u* H# f' f4 ^3 K( L4 c( \Method 14 $ h" o( S/ o& z. P& k+ v" [7 I
=========, ]2 b. t3 Y  [8 d4 H
5 c0 b8 B+ H* G/ L9 k  L5 z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 ^# m  v( ?# I3 e4 H: v4 Y
is to determines whether a debugger is running on your system (ring0 only).
2 \* W% W9 \7 X1 p0 H
7 g: N+ H# v5 H0 @" t, J: S" v   VMMCall Test_Debug_Installed
! ?+ V6 c) f/ g2 n   je      not_installed% h9 Y4 |! h3 ?6 E& g' o
/ r+ }6 G* @1 t% x* M- P
This service just checks a flag.  C. X& }" X: W
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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