找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 i2 t, T% g4 B1 X
<TBODY>6 L% b  L: N* l8 T( X
<TR>
: c2 U; ]  N2 |<TD><PRE>Method 01 % P& y" d9 }2 }, o% g
=========$ T' e8 ~) J% G/ c

  W4 r+ _+ d& T' E* i: E0 q9 lThis method of detection of SoftICE (as well as the following one) is, x% [& V6 Z. N! D# k- A
used by the majority of packers/encryptors found on Internet.
% c9 S0 Y/ g4 b) j7 _1 }2 K% UIt seeks the signature of BoundsChecker in SoftICE
0 }# j6 W$ k) T4 S
* ]5 p/ [+ D( M- x2 w    mov     ebp, 04243484Bh        ; 'BCHK'
' d& c. r$ ]5 D6 J0 K+ C    mov     ax, 04h
7 }. i& B4 Z. j5 ]. X- T8 t- O( g" M    int     3       ' F4 q! ~( m, P& f
    cmp     al,49 d/ e/ k* b" _  l5 m1 q9 R4 L
    jnz     SoftICE_Detected
2 o3 X6 U! S- ]8 `2 }' ^
- Q- V- q+ _) @___________________________________________________________________________% J  N4 v" M& J

& z( s8 i7 X0 t$ c' u8 R* e) D! H0 KMethod 02* A/ F1 X( k! I0 I& a0 m
=========; s/ r& F2 y$ \. v
: d) z4 X/ l' a/ |
Still a method very much used (perhaps the most frequent one).  It is used
$ W# ~0 F% i' @: xto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; \8 g" J' v) M! X9 ^* P) Gor execute SoftICE commands...
) @$ O& r9 C6 g9 ~7 |2 MIt is also used to crash SoftICE and to force it to execute any commands
5 L4 A; b' U- l4 ^* s(HBOOT...) :-((  % W+ D- ~2 I! x/ J9 G* W2 E: U
/ G" D: x8 R; n* D
Here is a quick description:
$ i- M8 m- J$ \$ P  ]! n: k, y7 Q-AX = 0910h   (Display string in SIce windows)# F# D, n: r3 o2 P# B
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' |8 k& w+ y9 \' B% a0 U) G  z1 b
-AX = 0912h   (Get breakpoint infos)
* |' s: O: M4 N8 w* z  l-AX = 0913h   (Set Sice breakpoints)) B2 |% H3 P7 a) K! I
-AX = 0914h   (Remove SIce breakoints)
  U; ~* _8 {, i% g% F3 ^- |) s
: u8 h2 C. ^9 K# I/ W5 SEach time you'll meet this trick, you'll see:+ n2 N4 E2 W  V9 v0 A' e( p% Z; E
-SI = 4647h
; n7 ?# j) M6 I4 @+ S-DI = 4A4Dh
" k0 p% I' Y3 U! p9 S0 GWhich are the 'magic values' used by SoftIce.1 K6 q1 R! O  b* A1 z7 ?
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& P! y( R0 t$ I1 p, ~' Z: H6 W

4 `* _- }5 \* Q# }4 a! ]) @Here is one example from the file "Haspinst.exe" which is the dongle HASP( V; U. V* W! W8 ]
Envelope utility use to protect DOS applications:
" v' m2 }& q. E3 c; u3 p1 Z
; T1 w5 d; W/ A+ c5 D; K0 |, q0 U
& B, T: v" M! w+ [' _% \# ~, k4C19:0095   MOV    AX,0911  ; execute command.( x& V3 g2 }6 \; `
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
# T( a/ P: j, i7 O2 V3 [4C19:009A   MOV    SI,4647  ; 1st magic value.
+ E$ D0 d! p% c8 ]4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
' T5 ]8 }, g1 r, L4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* S( b: k; ~" J6 l! {
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% y2 T! ^$ |; u) G
4C19:00A4   INC    CX/ H# E) P: y0 F9 \$ N3 B
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 j9 \& ?7 o& {! d
4C19:00A8   JB     0095     ; 6 different commands.
; e9 Y) B' T* b; a& g' {) y9 h5 b4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ ]: ~% u# O8 a/ Q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
) ?/ w  i- I7 n+ U
, @, g4 ~/ M0 |  n5 `+ r$ n7 YThe program will execute 6 different SIce commands located at ds:dx, which
! w& H% m5 z! R( q7 N  `are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% q: ^: m2 G% F& O4 D+ s" |5 n+ [; U

. z9 Q, C# `6 O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
1 Q- F" c6 t; i# k___________________________________________________________________________
7 d- O3 W1 e! B
9 O: ^  p6 o* G8 O/ D! c, U3 E' U. ~" {& e  F( C0 q
Method 03
, @2 }: |% L( f) c  B4 J) _3 c=========; U% T8 \$ y; h

4 b/ n! x+ L: c' gLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' e2 T3 D2 H" M
(API Get entry point)& G  g0 M, }* k/ S; a4 N
        
5 M9 _0 ^% {+ a/ e
3 W2 N$ ~2 B; Z8 K+ E    xor     di,di
- z; X' X  n2 D/ o! |4 X' R* b( u    mov     es,di- Z# A" n* z  f- O1 j3 b
    mov     ax, 1684h       2 j9 \7 T8 F4 g
    mov     bx, 0202h       ; VxD ID of winice
9 V9 ~; m, |' `- M    int     2Fh
6 a8 c6 T5 P0 s$ i; m- d    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ L6 g/ d# d- K8 g1 b6 O    add     ax, di
4 A! k/ E, _3 O    test    ax,ax
- \0 ^% ^/ B" i5 k: {- B    jnz     SoftICE_Detected
6 ?- u& K9 }% o5 t
: X7 q2 D$ D0 j- N) A8 M  p# z___________________________________________________________________________
% w3 T- M1 e. k4 }( C1 Q  h& P) q& k+ L" g8 k
Method 04+ Y/ K7 x+ X& k7 ]0 }
=========. d; r# j5 n9 w$ P

! }9 F, F" g# S  ^Method identical to the preceding one except that it seeks the ID of SoftICE  ?" r3 N$ Y/ A% t
GFX VxD.# u; C' N" c# T) u( d. z7 |0 w0 E

" U' _4 T$ u6 ]  g' c( s4 l    xor     di,di# v7 w5 A( h" ]0 x( `
    mov     es,di
2 c' i: _* e. l    mov     ax, 1684h       5 e+ i& b7 f: w0 ?) Z% f
    mov     bx, 7a5Fh       ; VxD ID of SIWVID- n9 K! }8 D7 y$ L1 V0 O; V: {
    int     2fh- [0 X' {9 m$ K. G" \: w* m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 L# g, S/ ]( Z3 Y/ J. a+ l0 U3 P    add     ax, di
- {) j) E5 Y1 l5 h5 s$ l    test    ax,ax: Z2 l  f  K2 ?# E
    jnz     SoftICE_Detected. d% n8 O6 j( I" q
5 p# Y% G7 ?+ ^: B$ B. P
__________________________________________________________________________
* w7 O, d3 p+ `. q; z. u- O* P& J
# O9 F1 y: Q5 V+ x9 \% d0 b/ m# d" W+ `
Method 05
: R) V& d  S2 C* I=========
+ n6 T! `8 z( d2 R' m* M8 M
# v  C# X% K; F! {. ^. d( {/ RMethod seeking the 'magic number' 0F386h returned (in ax) by all system
' H! V  F6 @5 T- {7 L+ Z- Sdebugger. It calls the int 41h, function 4Fh.
' ]0 b$ q  \7 B) N- f& a0 c! XThere are several alternatives.  6 [" W/ N8 Y" `3 t3 w9 _

1 ~4 O2 A$ {7 h1 q+ O) FThe following one is the simplest:
, M) N4 [/ F5 `9 s% k
3 G  M( g& C( u8 N8 k4 e7 ?    mov     ax,4fh
$ F5 w7 c. P5 q    int     41h% }9 G0 m" t8 c  K2 @
    cmp     ax, 0F386
, Y4 f% y3 M; Y& q9 C$ U5 k7 O& g    jz      SoftICE_detected
3 J& R6 o6 r+ L# ?2 G+ C7 i- e* x, U) `" g4 G4 i0 o6 ]. P

# `( U5 n5 d, L' }Next method as well as the following one are 2 examples from Stone's % u' Y; N3 Q" |  E  x+ I& u
"stn-wid.zip" (www.cracking.net):7 T9 g; ?; {+ a7 ]

1 K' k3 ?' j" M# i/ w- A2 T" C, [/ D    mov     bx, cs! B2 y+ b/ K* i! i2 b
    lea     dx, int41handler2& ]5 e1 e# ^/ ~* y" E
    xchg    dx, es:[41h*4]
; O. }. ^7 d5 v) {! a/ K    xchg    bx, es:[41h*4+2]
' p9 f- g9 L+ a" e    mov     ax,4fh0 y1 C: L* M9 r" |, w5 G) n
    int     41h
% N# F( y- J3 t/ p4 \    xchg    dx, es:[41h*4]- `2 k( \/ Z. _+ r" D( H
    xchg    bx, es:[41h*4+2]. Z+ f  g* Y, V7 U9 D. ?
    cmp     ax, 0f386h$ M' p9 \5 j& f( Z
    jz      SoftICE_detected
  l: Q( k& r0 J9 f  Q( ^8 |1 Y' d7 A' ^0 W% P! ~: i
int41handler2 PROC
' C" \3 H# l  M8 Q& Y, K, c    iret
, i" m2 y( f4 t+ T* f8 _6 c: Y2 F9 T  `int41handler2 ENDP6 D0 c$ J% W5 @6 _- f+ Y

7 }# P0 `# t* o+ n! d  r7 {5 F$ j3 }6 P6 o
_________________________________________________________________________
& P5 @4 [8 w8 P/ j$ i6 u7 B. w& x3 `  v9 }( a3 o
3 Q2 h: G, L- W( y
Method 069 G9 C% D8 Z0 s
=========
$ U: T8 m; h' f  X2 f7 _0 [3 o' M; r# B! {

: Q4 l( \: s# c2nd method similar to the preceding one but more difficult to detect:
- c: W) V% I8 i4 w* Z
4 T+ I: g+ s0 {' `3 f  k. d0 [& p9 x! o# d" M4 P# v9 t6 O; l
int41handler PROC
; u2 Y  v) ^( R9 H    mov     cl,al0 _6 v- l  p: ?, T1 M: X2 x) Z& @. f
    iret; H0 J2 T3 h9 R" t5 O
int41handler ENDP
1 o& v8 N& v$ Q
5 J( v  @2 ^1 d/ D' y
* q! s: Z, |6 o    xor     ax,ax/ ]* i9 @1 u- h+ i
    mov     es,ax! j; X0 _7 `4 n1 @0 {  c& N* i' a
    mov     bx, cs
' m/ n* T% O9 t( q4 T5 _    lea     dx, int41handler+ u1 T0 G8 {. ^) E- r! }+ `
    xchg    dx, es:[41h*4]. P1 }! T' V, P, t
    xchg    bx, es:[41h*4+2]
$ g0 e9 c8 R7 M- e    in      al, 40h  ?  ~8 n0 N( |( {- ~4 v
    xor     cx,cx
( I; I( c; ~2 N# ]    int     41h
% v3 M1 h+ R; B, ^$ J4 Q    xchg    dx, es:[41h*4]
9 o( J4 V& Y  Y1 i7 ?- f* W3 Q* P    xchg    bx, es:[41h*4+2]! x( f9 D& q2 c: H* ]) ^
    cmp     cl,al! N+ ?/ x4 P- I4 R! h$ X' e0 j+ e
    jnz     SoftICE_detected5 |8 V7 C, ^- q- w0 w0 O  R) \
2 M" V  R- `- \# c8 {$ G2 h
_________________________________________________________________________* z7 p. U) M2 ]# m  i/ l6 T' M

0 Q& a1 W- I: m7 s* M% z4 EMethod 07
# V$ g9 _3 A" \8 k=========. {0 W3 a0 L, s& p# E2 u0 X4 x
2 D* q- i" e# X8 S# v' L: x+ R1 A
Method of detection of the WinICE handler in the int68h (V86)
4 _' K$ s. O( G* l, K2 J0 a9 q
& c* j5 B* M9 V* E; o    mov     ah,43h- K9 k, D8 }# J3 |
    int     68h
* T# z1 Q( Y8 O    cmp     ax,0F386h0 z3 A0 ^" A6 \( r" T3 n
    jz      SoftICE_Detected% N  l8 W9 J1 d4 u) I' f
! z( t6 b6 r( Y1 m; Y
: T! B  t- }+ d; P, f' F7 ]; \( Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: J5 x. x: n0 s( Y3 ^& l   app like this:. r" M1 s9 M, z* H+ Z
  @' x4 S$ i+ ~2 ^" e
   BPX exec_int if ax==68; s7 n  j8 q1 H* v, H( g8 c+ J
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& i( l" V( s5 i* a& E: R$ S7 P7 o+ F   located at [ebp+48h] for 32Bit apps)3 Y  E7 W# r2 r8 O# a& u! d& [5 ?, \
__________________________________________________________________________4 a* u1 ?: Y+ w* N/ N( l3 \* ]
% b; p7 `3 b7 J1 u) a
6 a, ]* h, }9 c/ f) d) \
Method 08
0 e; V( \6 g6 ~5 t0 e* H. V% X=========
) f* X! K+ e( K4 ]+ \4 L  J' R# L( n2 [6 o% Q' Z
It is not a method of detection of SoftICE but a possibility to crash the' G0 ^' \9 d) C) b9 |
system by intercepting int 01h and int 03h and redirecting them to another, c( g8 ^' m/ U& i# X
routine.
( {- r& V4 O. [4 T) n9 B4 CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 B1 F2 A0 a) f! p) ]5 q7 t
to the new routine to execute (hangs computer...)/ Y2 o, X- b. k( _5 Q& c% C, N1 J

. [2 B. h& Y$ V% ]    mov     ah, 25h
7 C2 w) e% k7 D9 Q' G0 Q    mov     al, Int_Number (01h or 03h)
& \* N7 _! I- j: M    mov     dx, offset New_Int_Routine
. ]7 l, P0 j$ N+ G    int     21h( N0 O2 w- Q: K6 A( P5 t' p% @
- D' A0 K. l, `7 |0 @
__________________________________________________________________________6 c. s3 v1 F8 A9 ]9 j+ @; p

, z. s) b: O* A* v8 }5 y) {# QMethod 09: m, i' T, Z! j- s8 r! f$ G4 |7 I) j
=========
' p& I1 w* Z7 {( i
# R' c/ Z! i# o  F% Q$ `This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% p9 n2 g3 ]4 Q
performed in ring0 (VxD or a ring3 app using the VxdCall).1 L0 U' T5 }3 O: A! Y% n$ |
The Get_DDB service is used to determine whether or not a VxD is installed6 l3 ^/ r2 s% O/ M: a2 k
for the specified device and returns a Device Description Block (in ecx) for
, \4 J7 d& l9 `# ~that device if it is installed.
2 }& T3 _" o  t. \' d2 Z+ q
/ u% F; Z$ c0 @7 W   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
8 ^* ^7 O  [( L' k   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 I. N3 f2 l3 S+ U   VMMCall Get_DDB
: M9 d4 {" Q# n( q: O( N& D( v- \   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 [# x% x8 l* t
# o; K9 k4 @0 c$ H: s
Note as well that you can easily detect this method with SoftICE:
$ ^0 [2 ?  x: U8 a! e   bpx Get_DDB if ax==0202 || ax==7a5fh
' J- y1 l0 B% `3 b7 Q7 y4 G. Z; O/ S) A1 Q) O* S; W
__________________________________________________________________________
% m3 S6 \+ M: z
! [0 I+ K+ I3 L/ j% Z! XMethod 10
) W: X/ z0 ]+ K8 |1 Z/ s=========: q% f& x  S( _7 t# B! g, f% K
4 H# g4 v& M$ p; B/ s) T
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 j( \! ^* P- `2 c) u  SoftICE while the option is enable!!
/ l1 O; G8 m6 b; `2 h% @6 E) m- d
This trick is very efficient:; B8 Y. K; P" U# m8 B
by checking the Debug Registers, you can detect if SoftICE is loaded
/ o* z4 ?- w8 H(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% M3 _  o  ^, F( D& lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
7 t( P- l6 _5 F; _value (in ring0 only). Values can be manipulated and or changed as well
2 M4 h3 @9 \4 W- y7 H; h, y6 B: Y(clearing BPMs for instance)+ {6 h' ?5 ~7 T( k0 n& o7 D+ e
! u( \" f  S7 M1 v
__________________________________________________________________________
2 F2 J! l$ X# Z* K7 p/ e: P; ]: a( D6 f! A7 y! ~
Method 11" ~2 ~+ H4 v* v" h9 Z4 o' |
=========
* V% @) t+ {+ W. b* a2 B2 @- w
This method is most known as 'MeltICE' because it has been freely distributed" t1 T5 ]" D* m. C
via www.winfiles.com. However it was first used by NuMega people to allow/ A7 G7 I+ v( ^+ p9 E
Symbol Loader to check if SoftICE was active or not (the code is located
$ D: g: h+ R& ]9 P' B, Binside nmtrans.dll).( r/ F' y4 U" Y; G! {, Q+ R: \

/ A# h9 n7 a& B$ H, c$ VThe way it works is very simple:5 J# p9 i: C6 O1 @8 l- u
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: a* d5 W# P8 Y+ r' Q0 X0 K5 z
WinNT) with the CreateFileA API.5 R! H# e' q0 G! S2 o$ E
- J; ^; G' K, `( g; j
Here is a sample (checking for 'SICE'):1 @; S6 l3 Z, i4 |1 N( [" K( v
: k/ E- z! ~+ I
BOOL IsSoftIce95Loaded()
" x% p4 Q+ ^$ i{, w4 s$ @9 v9 u; ^8 ]- C
   HANDLE hFile;  
% c, B+ M9 f' e3 n# B$ t   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# F* K( ~* C* f& |
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* v& \+ N1 u4 ?1 B' @                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! k( z$ h' k* X9 f- P- j   if( hFile != INVALID_HANDLE_VALUE )! N5 m3 `  l) G; |1 }4 x
   {
2 E1 k7 {' P" a/ }/ y      CloseHandle(hFile);
4 B, A' z2 M) C1 H, h# Y      return TRUE;
5 X9 G( H  ^, b6 ^+ ?8 T' H8 h# a   }
7 b8 d) S0 I7 k/ A- b1 R   return FALSE;6 X1 z+ o! B$ h3 _
}
- @0 }. O; l7 ^" @; l* }
* K" S- C/ W, U: J0 i4 Z# ~Although this trick calls the CreateFileA function, don't even expect to be  v  j( k& V9 D. l
able to intercept it by installing a IFS hook: it will not work, no way!
, k4 @5 q. h" zIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
  q3 @, u( h. ]  N5 y0 Rservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" N* v6 B( {% y6 E2 L# Y2 Qand then browse the DDB list until it find the VxD and its DDB_Control_Proc
& A2 q8 n  m' s, Pfield.
) |! A2 F/ P/ U4 Z" P+ t8 vIn fact, its purpose is not to load/unload VxDs but only to send a
- Z& K4 f& s0 P8 `W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 L6 ?" `. N5 ]2 u' y. `to the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ O7 q, N7 D3 o) r5 W6 ~0 s7 \6 c( U4 Ito load/unload a non-dynamically loadable driver such as SoftICE ;-).
2 n5 T+ a" W9 R$ N8 r1 _If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 P% J$ B. p( S9 q3 v2 U: uits handle to be opened and then, will be detected.
) k6 M$ |% {2 E% _You can check that simply by hooking Winice.exe control proc entry point, U/ }9 |3 b" |/ o
while running MeltICE.
( q( U( G, Z( D
9 @9 i* }& d( H: z! i& v. u
3 Z2 _; P8 z, t  00401067:  push      00402025    ; \\.\SICE
: ~1 t- b) _( f* L  0040106C:  call      CreateFileA
% @: e) r8 n& m5 l1 _6 f  00401071:  cmp       eax,-001
/ \; U. e  E5 W! ]2 {9 ?  00401074:  je        00401091
) m& @" W# Q7 u
1 g& k1 r  x  k; q5 c2 g- E, z3 N1 s. q9 b% P
There could be hundreds of BPX you could use to detect this trick." Z: M3 a7 ~# B0 f
-The most classical one is:1 Y7 }& P& u4 M- \7 Y! M  n
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ F. C( ?, Y" V
    *(esp-&gt;4+4)=='NTIC'
7 ?* o7 ?) q" v
" t0 a; R% f4 h$ S/ b+ Z-The most exotic ones (could be very slooooow :-(& v9 h0 u6 |/ `& `. m  t" C2 o6 V
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  1 g" O' U: j% _& k8 b
     ;will break 3 times :-(
% e% z, s! C6 G& C! ]1 w# O: I; ~4 d# P& c3 v6 C
-or (a bit) faster:
4 b- I1 q' A3 ^8 ^1 c: g5 N   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): N6 C2 ?0 Y; ?& W1 `. k9 K1 ?

/ @3 h& g% |; N  H2 g; @   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  " x/ M, J  W$ [5 X, @8 t
     ;will break 3 times :-(
3 y0 Y  F- S. ~7 ^) g3 _# P# Q5 N0 a- x8 G7 U& }
-Much faster:
) L: I. u8 Y5 Z6 w) R8 ?4 k0 l; D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'/ k& B7 z; t9 a% t% W- T: [

: k- D& O* e2 mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
  U! T' B& \2 @# M+ j2 xfunction to do the same job:- i3 u9 ?7 v- H" d: g5 c& x! X

5 u# X, m: q( m9 b   push    00                        ; OF_READ
+ ~  l( M) L5 Y" f$ e+ M- V   mov     eax,[00656634]            ; '\\.\SICE',0' d, T8 `* e: Q# Q  d$ b
   push    eax
, _/ G/ `3 Z- }+ j: Z- _   call    KERNEL32!_lopen$ ?: _, W; Z( W
   inc     eax- B8 d! y- d5 X- L% Y* p2 G: D
   jnz     00650589                  ; detected
$ ]1 P& l) q: |2 d1 W6 }   push    00                        ; OF_READ% o4 P% @6 S9 `5 q- X. |  E
   mov     eax,[00656638]            ; '\\.\SICE'# M2 I0 W; Q% z% I8 T$ e
   push    eax9 A. T& N9 K6 [& F/ Z  Z% x, Q. Y
   call    KERNEL32!_lopen
# M5 T4 x  ^  G0 a/ {0 A   inc     eax
% y( K) Z( x: o# m, v   jz      006505ae                  ; not detected. H" O7 T7 p) I8 M. |2 D/ E
5 ?5 f/ K: ?1 s( G0 i* {* T: m
9 X) P) l$ L# l
__________________________________________________________________________
- F9 b! G6 r! Q; z$ v7 Q. t! p
" M9 p) Z# t! P% O* U$ A# l" b: q  G* kMethod 12
9 k, u$ p* `  `: s=========% T# `+ w' Q, D  K* F. p  M* U
/ U( n2 f' w) b' G
This trick is similar to int41h/4fh Debugger installation check (code 05
, U+ ~$ c. o: k  n$ Q, k9 ^&amp; 06) but very limited because it's only available for Win95/98 (not NT)* Y2 p0 u$ i% G; p
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.* d4 W4 y1 v! s2 z

- D5 l$ K& S1 I5 y   push  0000004fh         ; function 4fh
$ ~- U' p7 f6 m$ ^4 v0 u% S6 J1 }, E   push  002a002ah         ; high word specifies which VxD (VWIN32)+ k: q8 A, l5 U/ W
                           ; low word specifies which service- w8 ^9 F) @: V4 V1 @" E! e
                             (VWIN32_Int41Dispatch)
8 y; d/ `: m* S7 ?   call  Kernel32!ORD_001  ; VxdCall- Z  v/ q( V" ]2 d8 ?' g
   cmp   ax, 0f386h        ; magic number returned by system debuggers5 g7 U$ w" \) ]7 m7 x: @
   jz    SoftICE_detected7 z/ O! A" v1 `. \& }

$ I+ i9 @0 b: z& u5 t) IHere again, several ways to detect it:9 @) r- q. {( C3 m

; ^; y8 c9 L5 B& \! P& }# }    BPINT 41 if ax==4f
' M+ Q# b+ T7 N- |* |& q3 R* G
+ H$ F2 E6 e1 n8 D8 P# Y  n) m    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* g. u& T. M, O$ f) F. z- b
4 R/ g1 v2 `! G
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: r* n2 J2 U9 E$ b+ t0 H
9 c4 c- e( ^5 w: w/ m! M* y7 \
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( `/ a- S1 g: \' a! j4 o

& ~; y" n4 Y' o. x, B" f) ^6 S5 M__________________________________________________________________________& t4 }# p2 @5 n( T5 v& B( r
. K0 W9 s1 l+ Q
Method 13- B: A! Y) {! o
=========6 X# a& O8 Q1 }3 s* y/ Z

6 J" M+ K) A& D* s! R7 x" d4 |Not a real method of detection, but a good way to know if SoftICE is
) D* H( A5 I* o; pinstalled on a computer and to locate its installation directory.1 s# m6 O- A# Q# S
It is used by few softs which access the following registry keys (usually #2) :
) t6 ~* F! y% Y
! u! Y. Y' o; X4 t* I& p7 {* L-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# Q1 J$ h% X! @0 f\Uninstall\SoftICE
0 ]! T; }# b) D) F& i! }! f' `-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ G; q9 ]& d2 {  `3 o
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ a8 c. V3 e: T! G6 V\App Paths\Loader32.Exe
5 [6 K; l. r! N  i
( T- k' n' Q: A8 `2 V6 Q5 W. ~. f
Note that some nasty apps could then erase all files from SoftICE directory+ G  f2 X: _+ L
(I faced that once :-(
5 K" [8 J# m8 h$ J% K- w4 X# c7 p) {4 i+ P2 \
Useful breakpoint to detect it:# @0 {; b6 h: c/ e9 |+ F5 j
) I8 k* C0 O7 l7 w4 a3 C: ^
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ O; G; _$ _) ?. ]0 s; U% g/ \' u" K! H' p
__________________________________________________________________________
) o# O# B/ t  W2 _) X+ ?9 y) a/ Z' U' U7 |3 J
3 O0 {' w# u* q4 ?# t  C; H' u
Method 14
/ i, M9 S8 N+ _0 {, B8 h, f9 ?=========! R1 J! b7 A  g/ K$ t

' d; ?' U/ [& V0 vA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ S! O3 n" D/ g. O) [is to determines whether a debugger is running on your system (ring0 only).! }  Y" Y5 f! P- v" L; G

9 b1 _' P# H6 P% J4 F   VMMCall Test_Debug_Installed
' B% \% _9 g  k+ H   je      not_installed  b* i9 h$ B8 ^5 l' F1 k4 `0 H
; `+ X( |0 f: |. ?( u. g
This service just checks a flag.' v! s, A- ?# p$ @$ V& u3 n6 ^1 q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-20 13:46

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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