找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>  w9 N( L) c3 l
<TBODY>
2 c' Z% p2 X* {' F: h<TR>4 O" {* i7 A. D3 |  s3 E. S
<TD><PRE>Method 01 7 v: y5 x. j$ S7 q
=========, n0 i1 c, t4 K  b1 f
& ~5 G6 v+ H8 n# c0 o
This method of detection of SoftICE (as well as the following one) is. a/ Y. _  ^3 X" z, X
used by the majority of packers/encryptors found on Internet.
; e' j7 ~; R& G1 aIt seeks the signature of BoundsChecker in SoftICE
/ O& Z1 w/ `8 ~6 L9 A
6 x' h0 r+ D- \" Y  n# S/ d% F    mov     ebp, 04243484Bh        ; 'BCHK'2 x. w. |. t8 g. w& ?: p$ M) ~
    mov     ax, 04h6 v9 L6 j( O: p
    int     3      
3 B" h" H6 x( ~( g    cmp     al,4
4 X  W7 Q# y5 R    jnz     SoftICE_Detected$ i, B: l( e& u

/ r: Z( D0 D# P' J8 r  t/ r! }___________________________________________________________________________: V7 S2 u8 X! s

3 U( W* E  c  u1 o) SMethod 02
6 |4 |/ K: r7 Z& N. o$ k=========9 T- H8 z$ A# S6 }* z# C! Z
+ A8 n  l; V. k, f
Still a method very much used (perhaps the most frequent one).  It is used, q5 J5 P* E: r; D$ h8 M" `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 P/ U7 N+ d/ Z$ f" T$ M
or execute SoftICE commands...
' N! e, \! g7 v: H& I* A" g1 qIt is also used to crash SoftICE and to force it to execute any commands+ `& n/ x6 n9 O+ j; x
(HBOOT...) :-((  
" G' \! ?. `9 g; x) J
6 Q4 E7 j: T  eHere is a quick description:" \# V4 r# g! l4 {
-AX = 0910h   (Display string in SIce windows)2 M2 c1 }" y0 S
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( y, z6 j" ^: u& i0 l8 J# M1 L-AX = 0912h   (Get breakpoint infos)
- j1 w) Q8 a) i& v4 d-AX = 0913h   (Set Sice breakpoints)
% Z2 J& A/ V* C0 Z6 c. C. @: }-AX = 0914h   (Remove SIce breakoints)
8 ]* ~$ u1 w, d5 l( x+ P' C% }  B4 R4 m8 a; z$ T. }" d9 e1 P
Each time you'll meet this trick, you'll see:
, l1 |1 M" m  k' m3 S-SI = 4647h9 w( D$ E- `0 `; V) ]. }
-DI = 4A4Dh
- v6 O. Q- W; I$ t; wWhich are the 'magic values' used by SoftIce.9 R, A4 C0 ^* M- Z$ A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
7 i6 j# ]; _1 O, P- n/ p
) l7 h1 y- t1 {' B6 P% ^  ]* \Here is one example from the file "Haspinst.exe" which is the dongle HASP; r) v. z. ~$ }8 X4 i) o
Envelope utility use to protect DOS applications:8 {! ?3 b7 X+ H2 V# w: H! V( L: O4 t

! Z# L7 d: M4 P* }' y% |$ s& V& f" A# ]* ?5 h% Q5 q: K" x2 s" m, Q
4C19:0095   MOV    AX,0911  ; execute command.+ b. c" Z7 }) Y# o; [) w8 B
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ X. A7 I2 I* l! `; ~# L9 n6 K1 U4C19:009A   MOV    SI,4647  ; 1st magic value.: C4 Q1 d8 p# r  G# W5 N2 C2 q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; J. H( ^. e( b1 ?, s
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
* w* X" T+ w2 G4 j5 k4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 N8 M  K" }  R3 \0 y
4C19:00A4   INC    CX
9 ]+ A+ T; `4 N( g/ m: f! W4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. }1 B) r% z5 c6 N6 P( B
4C19:00A8   JB     0095     ; 6 different commands.
0 g; C3 r3 g" d, i* [7 w$ [4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. P3 a% W$ X9 p8 d0 q8 \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)( k; B( s) I% }8 Z! R

0 B- K; S( H; H7 kThe program will execute 6 different SIce commands located at ds:dx, which5 W' |3 ~+ U# ], {1 ?0 a+ e
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
: H0 F* u5 z- J$ n2 N. S5 u7 i4 }! a2 u9 N1 c5 ?
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
# e4 `+ b" C1 S; i2 H8 \___________________________________________________________________________1 s$ n; O! O1 n" K4 `9 }
5 m  ~5 g' O. J' q/ X  z

; T( b- o" {% DMethod 03
. V$ Q% J6 f( j) W# n=========' F3 ^" F5 W) |( [3 K

+ g- A6 }- X' w' \# k# \Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; L* g/ E, L  \& {(API Get entry point)
; c$ Y1 H! C- |( i        2 V5 ^& }, v9 ?9 Y

& B; c& p5 S3 e5 n! x( e    xor     di,di
8 |& n! k; u1 Q1 j/ m' ^  _; t    mov     es,di& Y' }8 E0 M* v" p
    mov     ax, 1684h       * I# Q: _* ?+ G! ?8 o/ p
    mov     bx, 0202h       ; VxD ID of winice( d. d3 X9 S2 s7 Y1 F4 K
    int     2Fh
* E- b% \& s: {, d+ a    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ l4 ?0 N& r1 S6 b4 [
    add     ax, di
1 K) `$ ]( U7 e) @    test    ax,ax9 h$ D# a7 u% i! [
    jnz     SoftICE_Detected
9 E; w8 {' S! d+ {3 ?2 H+ J& u6 y- Y2 X' X" X; V2 a
___________________________________________________________________________
8 ?% B! h7 b6 n* M$ c! t# L- m: b4 R  G, h2 W
Method 040 B" f4 w: D3 d5 X! y; y; Z
=========2 I' j- u  N* [8 V, U

0 P( B# i0 F( eMethod identical to the preceding one except that it seeks the ID of SoftICE1 |0 k+ o  B6 Q7 Z7 ?8 u* m1 Z
GFX VxD.
# C6 b3 X5 M9 Q7 }3 K7 g2 W; q% t2 G& R+ _
    xor     di,di
7 ^& f( n' I. j4 y    mov     es,di) i, S* y( Z* S0 v6 i& h
    mov     ax, 1684h      
; |$ e5 C: o5 O! y/ r    mov     bx, 7a5Fh       ; VxD ID of SIWVID" x9 R* x; D( C) J+ X; F
    int     2fh
1 Z8 }3 R8 {; D# b$ v/ r    mov     ax, es          ; ES:DI -&gt; VxD API entry point) ]8 F0 I9 l$ ^# b8 C$ b
    add     ax, di
% O; V" V0 B3 p  w2 h5 }2 w/ R    test    ax,ax
/ c/ P; [2 O4 ?, B; c    jnz     SoftICE_Detected
  s7 q+ t' }1 D6 ~; i3 R$ X: H- x! x; F7 {5 u5 E3 B
__________________________________________________________________________' @) @+ E, n1 a/ L- Z* j/ s' V. }
" }. M: r" A6 Z$ a! e
6 q3 a2 m$ ^  ]/ O- B7 G
Method 05" d6 P! ^7 w* E: W0 \+ }$ k& J
=========/ V) x3 T+ @( I4 G+ F# n
( h& \7 y) W. s4 U
Method seeking the 'magic number' 0F386h returned (in ax) by all system
& p! O3 a3 w' |) f5 n5 q4 gdebugger. It calls the int 41h, function 4Fh.
; f! @" f6 b* G0 Z% T) LThere are several alternatives.  & x8 W; k# U% n! q0 B/ b

$ ?8 a* Q0 e2 E, pThe following one is the simplest:3 Q, C9 s/ w& s& l- h

+ r( ?" m8 h: E, }! |: x    mov     ax,4fh
& |3 D- U+ {% k    int     41h
, k- B% F% D1 T& l! `9 ~    cmp     ax, 0F386* K- ~4 o) ]# H6 e0 s- @
    jz      SoftICE_detected
& o+ K% r3 U& J; Z' N# P: Y  l) Q4 K% e( l1 K: l. x

# T* _, w% J4 U8 E; n' V1 HNext method as well as the following one are 2 examples from Stone's ! X  b% s: l5 ]" c4 h2 P' v2 [
"stn-wid.zip" (www.cracking.net):
1 t7 Y* y) R% K- X% f, u( T7 n) @: P6 l3 L+ `. w' f1 _
    mov     bx, cs
2 h4 E) }/ z0 K    lea     dx, int41handler24 q/ \: O' V: w" C
    xchg    dx, es:[41h*4]5 R8 e; L# b5 O4 i4 h# Q7 U1 d& Q4 ^0 L
    xchg    bx, es:[41h*4+2]
7 k0 h1 Z3 o5 `9 T. @    mov     ax,4fh
% c  [8 Q! Q7 W    int     41h
) {# W, L+ h( w' |( k. F  W    xchg    dx, es:[41h*4]
3 ]! X; f# u: U9 Q    xchg    bx, es:[41h*4+2]
* X0 p' J6 i- ^6 y' F    cmp     ax, 0f386h! ~7 a8 {: P# ^' p1 V
    jz      SoftICE_detected# C8 n, |% F' F
4 t, Q0 l7 e+ v: S* I& E
int41handler2 PROC% L: t5 x" d- N# @' p
    iret" D9 [: O" U; I4 C
int41handler2 ENDP; M+ D+ m! Z" K, b1 b8 d0 s3 _5 N+ P
) t  S3 [  H/ K8 ^7 n/ F; E
! |4 F/ Q0 t% P
_________________________________________________________________________
. t0 s1 j' X* f9 p1 O3 g' M* c& G0 Z+ `- v/ z
" V* ?; m) r% [  `+ T
Method 064 [# `" M4 v' T$ x  `9 {
=========' M. {* P: i1 }) J
7 r1 i* d5 S5 H0 c' W
) B5 q( z1 G) e) @
2nd method similar to the preceding one but more difficult to detect:1 e+ U. f, A+ m) [

. N  X" J2 C/ W. {
. H1 J9 T$ @$ Iint41handler PROC  h6 c+ y$ Z' z* o
    mov     cl,al6 p) j) z0 ^; ]6 H4 a3 b
    iret1 b: E" V2 P' d; i; U2 W2 p- W# E. ]
int41handler ENDP
- |* r: E+ o" i$ e
9 v' E4 X8 D, x$ }$ T/ N2 Z0 M5 F! i" l1 R
    xor     ax,ax
1 v$ X8 g0 _( i: `! O    mov     es,ax: v% {. o# R# J- I
    mov     bx, cs) T9 ^8 [* e. i& ^9 z; v9 E$ b
    lea     dx, int41handler
! G7 O" K( L2 l) M' a. @    xchg    dx, es:[41h*4]. |; {' K1 H, o. R
    xchg    bx, es:[41h*4+2]
8 M) N! w$ L/ r. j/ x" F2 }    in      al, 40h* z- u  g/ C0 L) p
    xor     cx,cx
5 B/ Y# w2 A1 |# ]3 }! b8 a# a+ N) T    int     41h
! L5 K: O% }9 M4 O- v  @+ C8 b5 B    xchg    dx, es:[41h*4]. N2 ]& D# H. h! q' m  W
    xchg    bx, es:[41h*4+2]
  L3 {3 o) e/ w    cmp     cl,al
6 }; W, s6 H9 p* V    jnz     SoftICE_detected( j* a* S5 |' o# j& u" O/ n
# g" j" {! Q% ?, [1 H! J) Y. V
_________________________________________________________________________8 {) K. Y* d1 b7 o+ I/ O/ i
7 V( y: c2 E! F+ i2 B' O  r
Method 077 B7 m! e; o0 c# U" z
=========
5 b& e4 E3 G  |* u  e7 J, I0 M" d
" v' l. l" T8 ~& D& oMethod of detection of the WinICE handler in the int68h (V86)
! E( W7 ~9 Y/ b3 y# T7 g/ z% k7 e, f1 c( W
    mov     ah,43h5 j8 K* w! S+ l% Q& x9 s# D
    int     68h  I% ]+ v4 ^9 P
    cmp     ax,0F386h; [( d  g" ?* {  m4 e2 c2 z) u
    jz      SoftICE_Detected# {$ }, I3 z* z* K

( G1 c, |0 U5 y, v$ D1 [# D& u- A8 y* Y. L
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
! x# I$ T# \% l   app like this:
" |2 I" e* G+ n! e
% ^" w  n" b8 T   BPX exec_int if ax==683 ?: r$ p: Q+ a4 K1 ]1 r. W2 u$ I
   (function called is located at byte ptr [ebp+1Dh] and client eip is2 }7 R; o6 N* k4 }/ j9 |, [
   located at [ebp+48h] for 32Bit apps)
2 k- X5 T% @# @) \1 ]7 V" v9 {& d__________________________________________________________________________$ l$ }2 Y+ p9 ]
, g% |' t# R& S3 [+ ~6 I3 M* k2 E

2 |2 U/ [& ]0 e6 P! `6 vMethod 08
3 g/ w, B5 O7 B=========
5 h4 D6 y: q) D& K5 {/ U) Z/ C/ G  h+ j
It is not a method of detection of SoftICE but a possibility to crash the
. z4 Z/ @4 A! e' P; G) B9 }. _5 A1 bsystem by intercepting int 01h and int 03h and redirecting them to another
! a0 b' m0 m9 broutine.
. q( x% l0 E$ R5 Q' aIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 S( O! M6 N. S" W. {( m
to the new routine to execute (hangs computer...)& A- i8 W+ u9 M& A& }; R: h2 X

1 V% h' c5 `4 w4 C    mov     ah, 25h
, f- N0 t- I7 }$ T/ R9 Y& ?# p    mov     al, Int_Number (01h or 03h)
! N- ~  h' T+ n( ]( g5 M    mov     dx, offset New_Int_Routine
/ W# k0 C+ Z' X8 i7 {    int     21h% N. @! Y  {0 `* a3 z. [  |) e! d$ E
- q* a5 O6 _! O& w& @- ?
__________________________________________________________________________: F2 N& Y4 k9 Q! g
, m- ~6 T3 \& ^/ K
Method 09  ~6 {0 c, {* H2 c0 u
=========
+ a" ]! Z/ w4 |- c) R% g" i+ Y3 C1 l; F6 Z! {
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% q8 y$ J2 f% m4 Bperformed in ring0 (VxD or a ring3 app using the VxdCall).
& j0 t! I7 p$ C0 p8 Q1 D3 Q) S$ MThe Get_DDB service is used to determine whether or not a VxD is installed8 L# d( \( b$ v- p" J" r( T) t  u
for the specified device and returns a Device Description Block (in ecx) for
& O2 P) u+ G" t( l+ _/ O5 j( W  W- mthat device if it is installed.4 D, R' {, R1 E, j7 X0 x+ g
+ I. X; a9 z  Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* D; I: e8 u$ [7 B+ Y1 G3 [. W) ^6 s2 c
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% @' X1 O% j1 r8 G: k/ V7 w% f
   VMMCall Get_DDB4 B4 U! c- ]( w
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 o4 X& A0 J. x: D$ K
! K' N; v4 E9 Q  f) v$ ~" k/ |$ n
Note as well that you can easily detect this method with SoftICE:/ u: ^6 O" V* h4 o
   bpx Get_DDB if ax==0202 || ax==7a5fh
; o% R, p! b* j. `6 y# R$ H* u/ q0 v8 V! ?
__________________________________________________________________________
- n6 Q' t1 G" ?& h6 {; V: b: h. l# H. Y8 C0 O1 |9 p
Method 10
; A; f7 h( w1 p; f=========  B8 I% `& [  ?5 c" Z7 f- ~" S
7 w' u3 d$ O- ]1 e, X
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! r; R9 K; [# q2 H" v0 p  S
  SoftICE while the option is enable!!
# q& M  E  ~4 F" h( a+ f$ O3 o; t$ l! }" c& r" Y+ F0 d' N
This trick is very efficient:
+ ^/ _. X  p* G( Nby checking the Debug Registers, you can detect if SoftICE is loaded
5 X6 M, u7 U7 `2 Z! F9 f5 ]  n8 F(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
5 a) q. ]8 T5 [& _' Xthere are some memory breakpoints set (dr0 to dr3) simply by reading their
3 D, d0 j( k1 s! R* Dvalue (in ring0 only). Values can be manipulated and or changed as well2 R( Z4 F# y6 {* }
(clearing BPMs for instance)* ^* x& A3 \4 N# H
( b+ \8 Q& a6 K
__________________________________________________________________________0 Q# \, Q8 M# F7 U

( [9 o! [4 |1 x7 B/ o2 X) R. fMethod 11
7 v) J1 x7 Y& I=========
; I! X1 H6 U! O/ k+ l& E; Z& t) t) o( \" [4 Q
This method is most known as 'MeltICE' because it has been freely distributed% J6 N8 M6 k: D( k4 W
via www.winfiles.com. However it was first used by NuMega people to allow
: m; ~, n( q: G+ L5 ]. E7 H3 oSymbol Loader to check if SoftICE was active or not (the code is located
$ S3 c  H+ o! ?9 o) @' l( w. Ainside nmtrans.dll).
: W  }5 [; ~7 u" t; l  f* o& {4 z; n3 P5 C4 l) V
The way it works is very simple:
0 Y$ |( K) w  A, a- m5 j: yIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for& p* Q- _) T8 C5 @8 K0 E7 }
WinNT) with the CreateFileA API.0 U: D4 i' y" ^# X8 k$ O
) y$ \; v( j! U; i
Here is a sample (checking for 'SICE'):
& U# t" r: x2 O) Y/ ~  Q* ]' `7 B" C  V3 R0 w" U" Y
BOOL IsSoftIce95Loaded()
& ]* \7 x, z. y# W1 b& H# @$ z. i; `{
- O) M% s8 G. S! _5 J  s   HANDLE hFile;  : x- i/ H4 h" x& U
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ `' d  ~4 c2 _3 b% n) M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
$ e+ s) u, ]) R# S# J8 W' J                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. N3 D: x% H9 d9 B! j   if( hFile != INVALID_HANDLE_VALUE )
* z: }  V/ X( A5 Y" @( Z. m   {
" V# B  ?2 J8 l# D7 Y0 S- v      CloseHandle(hFile);
9 }2 l9 |$ P+ t# v! q      return TRUE;& s: v1 ~, G  H5 G+ q$ a, M9 i/ W
   }
! P" C0 z" A2 {9 v   return FALSE;5 w' p0 v. R0 _! U  m+ ]* y9 s
}
' y$ S! s! H# D. M  _2 z: E6 y
- u3 R+ p+ @0 p6 D, k+ XAlthough this trick calls the CreateFileA function, don't even expect to be
" c5 w. W. G- N, }able to intercept it by installing a IFS hook: it will not work, no way!
+ r$ ~' H1 l( U% d8 V2 ?* e- kIn fact, after the call to CreateFileA it will get through VWIN32 0x001F# y, p: Y$ @7 u2 O! |
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 b! B8 e8 C8 c$ Y9 i+ F( gand then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 v1 d& D# S6 Rfield.0 ], {5 O, l( d( k& ~$ m
In fact, its purpose is not to load/unload VxDs but only to send a
. |( P- c8 Z2 J4 U+ k" c/ TW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
" v3 b& h% P1 s" \' N; `; T8 yto the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 Y7 L) A5 T8 w+ c2 y6 X( rto load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 m8 o1 [$ D' `' y: ~If the VxD is loaded, it will always clear eax and the Carry flag to allow6 ?* v% O2 o* k" E9 {" \
its handle to be opened and then, will be detected.
# A4 m' H& C' k; H# S9 N' ]You can check that simply by hooking Winice.exe control proc entry point
) @, b; w' c# s& t% twhile running MeltICE.
4 d: ~4 v2 F" n
1 L; l- M2 I! C' T2 q. j
# \, `  ~% X  U3 G9 @9 B" B  00401067:  push      00402025    ; \\.\SICE
9 c* J1 T& G# Z) j! b! }1 A1 o  0040106C:  call      CreateFileA
8 J+ m/ q6 W0 z& x; W  }7 h  00401071:  cmp       eax,-001, e- w, Y$ i( d( X) V* |/ P  u: p
  00401074:  je        00401091
& C% |# G# @8 A  B/ L- E% B0 v8 Z8 ]) ^# u4 a1 H1 E6 Z9 y" P
. i% I9 s$ F2 @, B- A% B1 D% ]- Q
There could be hundreds of BPX you could use to detect this trick.6 \6 t6 O9 X2 U/ q, P
-The most classical one is:8 S7 G9 x3 m+ S5 J+ V2 c
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
0 C6 b4 h$ P" J, |7 h8 ?+ C    *(esp-&gt;4+4)=='NTIC'
& L( u7 v6 L* h7 U: [: A
8 z' ]1 S% X6 r7 D* k-The most exotic ones (could be very slooooow :-(1 G! {  a; b3 M% i3 }# P
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; y+ @: p3 v8 J+ Z- V2 M% \     ;will break 3 times :-(
8 I. v8 g% _1 t$ s) _- k& h
0 P  Z, q6 D# F  H, E$ s1 o-or (a bit) faster: + x/ z( d6 G0 i* [# u7 ^/ ^0 W
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# \0 c7 I, v; [6 L% {1 O

( Y" j; Y( O5 n7 b3 P   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ X4 c, e0 J9 x* E: h5 w; C
     ;will break 3 times :-(: L6 a: A% M+ n1 J- m( y
9 r/ E9 v' G9 ^, h
-Much faster:
  Y2 t, h! @3 `( z2 G1 ~   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 ?7 Y' k% B5 }
& t' _1 O3 n" Q# ~3 ?8 |" `" ?) u
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen: m; U! F: J2 p
function to do the same job:% c! M9 F" R6 E) {

8 J" R3 R& A) t' W   push    00                        ; OF_READ
/ s: `$ \  }+ l9 |) ~6 g% u   mov     eax,[00656634]            ; '\\.\SICE',0
& H+ D* r4 x& P; p$ r& T   push    eax. v& h+ K# g% d/ \
   call    KERNEL32!_lopen
6 p7 {- v$ a& w   inc     eax
$ z5 w) T! B. n   jnz     00650589                  ; detected
% o2 N( x  l2 W1 ^% z, h   push    00                        ; OF_READ7 q) u2 k2 l3 W6 O$ I; {
   mov     eax,[00656638]            ; '\\.\SICE'
# [) P% `( j6 U6 D   push    eax: B5 X; `* i& o' L: V# z, H& x
   call    KERNEL32!_lopen3 y% J0 c0 k& M" v
   inc     eax
6 }+ T; D% D0 h2 S+ j' n, T   jz      006505ae                  ; not detected% R+ z: n4 z4 s) Z, i$ _( f
( @# c+ _3 m3 [
/ u# G9 M, O/ u' j
__________________________________________________________________________# {$ b/ A# B  {. r( h

2 }, |5 {/ F/ }3 Y, r& JMethod 12, M# g0 k/ V3 x6 c
=========
$ i. x. N% B; L! Z  A! \) ]0 M8 W) E9 P0 p" a! i, o
This trick is similar to int41h/4fh Debugger installation check (code 05/ O1 b4 C2 b) O3 b+ J& Q- o) i$ O$ N
&amp; 06) but very limited because it's only available for Win95/98 (not NT)- Q" O$ s! L7 s3 B- `2 [' ?8 F
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.- G) f+ r  e, Z# Y

! h8 A% S0 o1 m  ~; c; Y! ]- r   push  0000004fh         ; function 4fh
" R3 N$ d7 t9 q9 @   push  002a002ah         ; high word specifies which VxD (VWIN32)3 k3 o. D% Q  Y9 _0 l
                           ; low word specifies which service. B2 L! @6 q& Y; d! o% b. }
                             (VWIN32_Int41Dispatch)9 ~# X9 P- ?0 Y" y8 ?
   call  Kernel32!ORD_001  ; VxdCall
5 {* o; b/ {9 k9 o( }   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 p% u7 t! _7 ^5 G   jz    SoftICE_detected
7 |5 k# Z7 q% B7 i! l) B, m( i. i4 X
Here again, several ways to detect it:) i5 j- K* |5 m7 @9 N# b$ M1 |" X

  P; t" f; h8 s3 O' l) |  h    BPINT 41 if ax==4f
3 R5 z! B( c. a0 P- t/ f9 I! f3 v  P. O/ `
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* @3 x& y4 h4 |' x" X0 |+ `8 ]) i2 [

' h6 u5 o+ K2 [& k  ~5 |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 Y6 P- O. v- b; v9 d

6 }' B" P  K3 E$ _6 `* `% Y    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
3 V' M5 [1 g7 g  @/ s- \) s6 d7 @6 F* u  v$ d5 |
__________________________________________________________________________* J, H; m: t! p2 p
/ @9 t7 E: W  t0 a  M* s6 E
Method 138 b2 S  G# E$ x$ l# e; i7 K2 S) Z
=========
' a9 k9 y( c" \# ?. ]! @0 g8 Y3 e/ V8 y
Not a real method of detection, but a good way to know if SoftICE is
7 P; z3 C1 L% \installed on a computer and to locate its installation directory.) q7 U' r* W! q
It is used by few softs which access the following registry keys (usually #2) :
+ y7 N( ~3 W! R4 C) Y' K$ f. E5 A( Q7 n9 b' s- s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  j! b, a7 m9 N3 o: l5 l- j
\Uninstall\SoftICE+ g; f7 k7 y8 i
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' r6 A* ?9 X1 P/ W-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" _! k: |9 O. k1 ^& u8 A% h4 i
\App Paths\Loader32.Exe
' X/ o$ L0 c0 c# G3 n) X0 C9 o$ ^, @0 m/ C
& P9 R! ?9 E" i* y. \. P+ z3 G
Note that some nasty apps could then erase all files from SoftICE directory$ a! Q) C# m  z: V' L0 {
(I faced that once :-(  s2 P5 M4 e  Z& M  u4 k

+ B: V* o" M- m% XUseful breakpoint to detect it:
1 @! [3 M+ j7 d# W8 X* [6 }- v1 {7 p9 k$ X) E) }, J# [" @9 Z7 L1 W
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 ^& |' [: r! K% s3 o

' Q1 N. m* u% R* d" Q__________________________________________________________________________' u! S/ V  x1 s
7 ~) q$ e4 M9 U6 \( z+ S

. j6 V" q& h2 ~Method 14 9 _$ V, {( k2 O9 u
=========' J) F; H: o2 B; H, i: j% E# a

4 [( C& S  s5 l, V7 d2 d4 m  uA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% I( T1 H  M7 p0 x  ~* N, y4 o
is to determines whether a debugger is running on your system (ring0 only).# x/ S4 Y7 \1 N
3 U6 E) O5 |) d0 ~9 e
   VMMCall Test_Debug_Installed
. t6 s" u" z. `; ^) ?1 a3 G   je      not_installed: ~) e' w/ q2 x1 v. A# s
( Y' v$ a/ c$ j. R& t6 Y1 m- Q4 V
This service just checks a flag./ O3 y+ e6 @; r2 M* g5 e, x3 `0 _
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-11 17:23

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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