找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>! a0 w  E* M) w1 m; H
<TBODY>9 Y8 p3 F% Z& d4 u3 \+ r1 b, @; \
<TR>
$ j, y, f  y( x7 ~. O<TD><PRE>Method 01 , ~' F8 |- [  k/ @$ U
=========8 \$ L! F6 ?& Z% q4 l

2 H, V' E) R, IThis method of detection of SoftICE (as well as the following one) is
4 P- I0 o( l7 G( ^used by the majority of packers/encryptors found on Internet.# ^" w. @+ P9 F5 e
It seeks the signature of BoundsChecker in SoftICE
" D+ ^+ J' L4 d6 P: Q9 R: L% p7 l# l/ @+ K( f- i
    mov     ebp, 04243484Bh        ; 'BCHK'' G6 [/ ]1 y' B9 _/ u
    mov     ax, 04h
" o6 l/ }& n  A    int     3      
2 k' ^8 M/ A. X& Q' u4 t, r9 w' g. r: {    cmp     al,4
) {% U4 M$ o1 X2 @& n    jnz     SoftICE_Detected( r3 x0 y( k: M0 y
# ]  Z9 G- i4 i) Z
___________________________________________________________________________, [/ S- w0 s; F/ I

: t( S# e; y2 Q, GMethod 02+ J+ ?. ^6 Q, t, p# H
=========
6 W2 B' ?# k% }0 P, E/ @; F! f  c6 n0 l$ I! [& I3 N* d1 i5 t. J; G
Still a method very much used (perhaps the most frequent one).  It is used
/ v8 i& z  v- f. \: z7 X6 Rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: K" @, |; X) h; n7 [: b( ^6 d' Q0 kor execute SoftICE commands...) f% n6 t% A' n6 _0 `* p) U
It is also used to crash SoftICE and to force it to execute any commands
; s9 ?4 t% ~% V+ J/ s1 [5 [(HBOOT...) :-((  4 A/ F6 ]8 u3 r: O

1 v! x  e$ B( ]& t% ^- }. I+ E- yHere is a quick description:
2 U* k7 ^2 v; W% Z1 O& l-AX = 0910h   (Display string in SIce windows)
; d6 p& e0 c: V2 m3 s. \. z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 u6 U# ^" Q. ?7 I( Y-AX = 0912h   (Get breakpoint infos)
  p4 R# \* a4 C, g" H9 g-AX = 0913h   (Set Sice breakpoints)
' r. a4 B( d5 w5 a6 S-AX = 0914h   (Remove SIce breakoints)# i; S6 f" P: m, r

$ P  n, a/ n7 n5 h+ n2 n' H& REach time you'll meet this trick, you'll see:1 {" F7 M9 T" c: n
-SI = 4647h/ V$ e  i8 L4 j" t' j5 v9 U
-DI = 4A4Dh
# ?) s; r' t# k! bWhich are the 'magic values' used by SoftIce.. q, w6 P3 v1 S8 B) L2 {
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.. z! p5 u+ _, s7 |' Q5 N
& W" P+ `. j, e) E* Q( v) E
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" n  P# d% m  s6 Q' H) T; DEnvelope utility use to protect DOS applications:4 k# p$ I9 R+ Y  x; o

) {$ W6 \$ [$ W/ F# g6 |$ f3 {4 m
0 l7 R! t5 _8 a- l4 i* Y& |6 h4C19:0095   MOV    AX,0911  ; execute command.( G# \3 k0 v; l, s6 t4 D
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 }! R9 E: I7 |# v8 h- }8 b
4C19:009A   MOV    SI,4647  ; 1st magic value.7 P. {9 D- D' k( t4 y" Q- l
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 c  a& _& a. Q. W# ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 u  l7 G3 m$ _
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ y7 i* A7 W$ |2 w) P0 `! ^# ]
4C19:00A4   INC    CX
& @0 i& m* c9 K/ g: T2 f9 N' |( |0 i4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 s! t8 l1 b7 y* Y4C19:00A8   JB     0095     ; 6 different commands.3 P! x. e+ B: `) h) f5 d* A
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 g# D: N9 c- O+ u! g: L4 |0 K4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 m) }# K8 k- j
0 O1 y$ ?  [/ H& K- V* _
The program will execute 6 different SIce commands located at ds:dx, which
' r/ Q" I- t6 J5 [are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( l* \4 l0 K$ M# b0 W. o
( I& t) v& ?1 ?) O0 V' n( H* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
) N) z5 @* y2 n, R7 s___________________________________________________________________________
% x5 D5 v8 h( F" B2 u- \+ e) G& t/ y& J

6 g& r& r" I( s! vMethod 03- \- N. m9 [3 ~* M) T8 h3 j: B# r& w
=========
' r: a( f5 Y1 \  b9 Q) M) h0 w* Z, w6 ^5 ~; V
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ [" |( |: b4 `! H& f(API Get entry point)  w% t7 Y( Y( R& x8 N. N% d4 G7 X
        ; @0 P  B0 q$ y' g" w. @) W
" a- r& n% L/ z1 ]
    xor     di,di
+ c2 @7 P" o3 S$ O( S- L    mov     es,di5 K6 }4 G  F& z1 H: o1 F
    mov     ax, 1684h      
. |$ x+ Y, X* p% |# o, {    mov     bx, 0202h       ; VxD ID of winice" V! t4 M3 `  i( ]7 o- K4 i
    int     2Fh
1 }' p- H& n6 j" t; Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ [: |3 P- ~& b1 |& i
    add     ax, di9 P3 q% F: Q" Z
    test    ax,ax/ M3 G! v7 ?$ ?" C& j: T
    jnz     SoftICE_Detected
; g2 P/ S4 F5 y% ^7 T4 e6 M+ F: [( W& n5 _( r3 N* I. B7 O
___________________________________________________________________________
; L2 U  u+ k5 y8 F" K
; ]" t6 \. `% OMethod 04  f. G, T8 |$ o2 O% i
=========
4 Y8 M0 g# v- P' G+ i
9 h, D3 U* |4 m( s- b) m& sMethod identical to the preceding one except that it seeks the ID of SoftICE
9 c$ D5 K# t* Q" ?% vGFX VxD.
$ F: t. R5 n0 G
0 f( y7 d  o4 A! I    xor     di,di8 ]; s  `4 ?, U7 Y2 |/ B
    mov     es,di3 Z( G# x- q; A1 U/ I# B; O  T
    mov     ax, 1684h      
8 ^! l5 W/ @. q% H3 l    mov     bx, 7a5Fh       ; VxD ID of SIWVID" ~0 L# K# t# x4 p, S
    int     2fh8 R/ ]; u) z9 l) o3 V  U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ T  n4 `) m! X. E    add     ax, di6 H/ |4 S! K# }2 j, g9 L# I
    test    ax,ax* r! o. l! Y: x. {; @
    jnz     SoftICE_Detected2 C0 {) r9 |- F+ Y3 E) H
& r% A: ~. M+ h1 j; k4 O4 `1 n
__________________________________________________________________________
% X# a- X: `/ Q3 n2 V0 r4 v/ \$ G
. @- q. w! T. W* C
Method 05
& I5 ?6 y3 }6 i4 w0 w# R" C=========  k! ]4 Q3 _1 K5 R# f  H8 W2 J) i* f

% I$ g+ Y8 l" R* H+ Y3 `& u! gMethod seeking the 'magic number' 0F386h returned (in ax) by all system
% Y1 x; f0 {3 U6 ldebugger. It calls the int 41h, function 4Fh.& ^! J- ^! D& U0 _( E0 s  {
There are several alternatives.  2 T9 k# a. ]  V9 h
3 z& l$ F9 C3 \& e# z$ m) f7 t
The following one is the simplest:
  y9 G" s7 W# o+ }8 F6 W- U5 n  W; h9 H( B8 A
    mov     ax,4fh
( a1 z( j0 g- ~    int     41h* K5 T7 J+ _) m- X+ _. y
    cmp     ax, 0F386* }1 x% d$ s: @
    jz      SoftICE_detected
* X4 c' q9 t& k# K  U5 k6 U9 B( L) ~; A# }7 Q+ j

# V8 H+ i+ X! Q2 u8 K1 eNext method as well as the following one are 2 examples from Stone's
4 w7 l( S8 }6 D"stn-wid.zip" (www.cracking.net):
: N. ], n& t& B& n+ a$ P. A
% B# x9 B2 F# @    mov     bx, cs
6 {0 K/ X' b9 L& `6 |    lea     dx, int41handler2
0 U( [" l; M8 K! f4 G' p    xchg    dx, es:[41h*4]6 M2 K& R. W" W$ `: F
    xchg    bx, es:[41h*4+2]0 g- q3 Y7 g3 w  [0 u  n
    mov     ax,4fh& ~! h& A/ k, e5 q& _
    int     41h
' p* p- z2 z4 w8 L    xchg    dx, es:[41h*4]; ~/ y$ B- f& L; _* C4 }5 P  J
    xchg    bx, es:[41h*4+2]( h) i2 g. H' s) `
    cmp     ax, 0f386h
% T" W( h% D+ g    jz      SoftICE_detected! O" _; N, X% _" \6 c7 p! V$ S6 `
# z. T( r! k8 J' S! J
int41handler2 PROC# ^7 m+ y) A* J% a1 X; ?: F  P
    iret4 `6 s% h* I, Z. H
int41handler2 ENDP
( p  w! Y) T6 R, O6 K
+ H2 J6 R% I* E+ Y, ~
; f$ _; S0 x: U_________________________________________________________________________
- g3 ?; W2 ?' B% S% Y& M. }: Y& V1 q  ]. W( A7 Y% q
- f# M! ]7 `  c3 G4 }
Method 06
: k" ]/ M  l! p3 k3 U7 U+ {=========
, @, [7 l7 y0 f& ^$ _
+ O! e4 A/ ]! s3 ~: L
* @- s  d7 R; x8 ?+ w. U6 P5 L( y2nd method similar to the preceding one but more difficult to detect:: T% T5 N3 i) l7 A9 j! z4 |6 s( Y

- u2 h7 M& i% j7 c0 @3 ?$ `$ ]" g  y" w, T
int41handler PROC2 c" l) X2 p8 @5 W
    mov     cl,al
' f. S8 C3 Q0 g6 Y    iret0 `! t9 y7 e6 ?  I3 F
int41handler ENDP# ~8 n+ y2 W' G2 S( a6 |/ X0 B

% V. @  W, E' ~; K6 [4 \- y
. U- N- E& m- U5 N: n$ \    xor     ax,ax
! L3 Q; O( u* d! J1 z8 P. ^    mov     es,ax
1 L0 I; v6 h1 ^& p5 U8 ~9 i    mov     bx, cs
' ?3 e- @, j  P% b0 r9 T    lea     dx, int41handler
8 ^1 ?" e% w, z9 ?( c+ R    xchg    dx, es:[41h*4]6 J& ?% I2 |, n# \& _9 N  B: P' h
    xchg    bx, es:[41h*4+2]
4 Y; _4 C1 O% ]: X) t    in      al, 40h9 ?6 Z$ l4 g) s* f0 x6 W1 c
    xor     cx,cx
) z) |4 [) P4 a4 h    int     41h' _* B3 S6 g9 Q, E9 R5 W# v. z- Q
    xchg    dx, es:[41h*4]
$ x( @/ ~& s/ E) S! J    xchg    bx, es:[41h*4+2]0 s, }$ {5 Q6 f3 e" i% t
    cmp     cl,al" x# @& k& j: j2 P' V9 m
    jnz     SoftICE_detected" V. J! ^, u. N- d( R
* H6 n, N8 u5 i, W; c5 _" H
_________________________________________________________________________
: ?) h; M2 B1 h- P3 q
) v- U* n; l& l- }( GMethod 07
" o$ c3 K$ B" G1 {9 {# u$ R( P=========
% o+ R0 i3 t1 P3 j' {  ^/ y, T5 s! |- z/ g  v. i1 Y5 z; x
Method of detection of the WinICE handler in the int68h (V86)2 R( ^) W( D# }, e3 I9 h. ?3 k9 h
5 \' k; k2 a4 k' X
    mov     ah,43h' k0 r! A/ N5 E% l  n
    int     68h
; x' N% M6 I4 M9 _* I5 F/ @' _" _5 e    cmp     ax,0F386h
# E, K9 V% F' B/ z0 k0 k    jz      SoftICE_Detected
/ L4 h; M/ W& e8 p3 K
8 o; y+ r$ T5 E" g6 ~% S# w2 Y
% {4 \: F4 i- }3 M9 f5 x( ~=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 v) j% _5 S& b5 g& y   app like this:9 l  H3 C* |0 P  f# i# ]# T

+ R0 v: D  v5 h  q) O4 g+ e9 n8 j   BPX exec_int if ax==68
# a1 c# A9 D& o4 q" p   (function called is located at byte ptr [ebp+1Dh] and client eip is; p# ?6 j' P4 V: \; `- P7 b  R
   located at [ebp+48h] for 32Bit apps): F. C+ s: B; \, p
__________________________________________________________________________  j% V; L; L3 @. ?6 y* A

9 L% B  }! h6 i* N$ n/ {: w4 W& z0 i
Method 08
# x, x2 R! t* B* Z, S9 n% _1 u=========, x6 O# [1 W3 [8 a2 m, C

+ l7 Z3 v; Q1 w( ~It is not a method of detection of SoftICE but a possibility to crash the( p/ }4 c2 t) m" x1 S7 e- b. z
system by intercepting int 01h and int 03h and redirecting them to another
4 j/ o4 |; z- @4 Z( C7 w* v3 B$ ?% Kroutine.
2 w5 T8 V6 v9 Q! T! sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 N. j# _: B# W
to the new routine to execute (hangs computer...)& z* N2 n" h2 d4 m

( m! s; r/ N; M5 c% Q    mov     ah, 25h: \$ B0 n8 C! ~& E* W. g. y
    mov     al, Int_Number (01h or 03h)! h4 j) z+ B- S9 q& f2 G8 V' b4 L
    mov     dx, offset New_Int_Routine
: _1 f5 u, K3 @: b2 B7 `    int     21h
7 A: t9 g* Y- Q5 `8 H1 M3 @8 K" ]: C9 t+ g
__________________________________________________________________________; ?& e$ [) h5 k+ ]( V' h* W

7 f! o: V0 d: e+ Q7 C% K, p- eMethod 09% q1 S) T: S& k) K" Q# \
=========
! k9 P7 Y( o0 e$ f
8 [9 y$ o. P# |; FThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 e: ?$ S. F2 }( `4 j# ~
performed in ring0 (VxD or a ring3 app using the VxdCall).* M9 U0 t, T1 ]# L2 H
The Get_DDB service is used to determine whether or not a VxD is installed
& c& Q* D; U' b, J7 ?for the specified device and returns a Device Description Block (in ecx) for
* _, A( {; p5 Z; ^0 |) w+ Othat device if it is installed.
; w* F1 T, k  E( I6 K( i9 r& T2 O7 G2 l, ~6 O1 `% L
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( o1 R% \+ y1 X( ?3 @6 p) U   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  ^, M5 M  a5 R
   VMMCall Get_DDB' Z" f) _- g7 o
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed5 J1 {/ w2 E$ b) ]6 Q  \+ C; \

; b. U2 \! Z4 _4 H* C- |Note as well that you can easily detect this method with SoftICE:
7 P* V0 H; }  a0 n   bpx Get_DDB if ax==0202 || ax==7a5fh: w& E# @5 g+ ~% ~: ?% |; \& v* W; D- d
( g4 t! F' A4 W& l/ F9 L
__________________________________________________________________________1 d' B. E5 Z$ E
& U$ q/ C% k$ m9 p
Method 100 X. o$ e- A3 W  o- f
=========
8 L; @/ M* b* m  `, `7 Y( R. v3 J+ G. b! S
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 ]: L$ n! F6 r/ D  SoftICE while the option is enable!!
" P5 ^. H7 c, h  f" N7 v' t4 _2 J8 Z/ ?' K5 ^3 W  `' t+ }
This trick is very efficient:
' j! S) w- ^1 m1 g* [( h7 Z" [: \by checking the Debug Registers, you can detect if SoftICE is loaded+ {, q& Z, r3 U% j# b' u
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 s$ N& h! [- C' Cthere are some memory breakpoints set (dr0 to dr3) simply by reading their
4 `% F  }: g" c4 X  H  Uvalue (in ring0 only). Values can be manipulated and or changed as well
( `" Y4 C+ e1 p/ V, v% b(clearing BPMs for instance)
8 s. I2 I: F# n9 ~' A  D- |6 t; o9 D" r; s* S5 R
__________________________________________________________________________' L5 O) U# e# I1 a% M
/ {0 k1 ]+ B% j: U/ P; O2 i
Method 11
' @2 Z! e; Q. h. W, {& d=========
6 Y: N& l/ k) u1 u4 |6 P/ D& g8 S; \3 J3 o
This method is most known as 'MeltICE' because it has been freely distributed
8 r( h: L5 \  _via www.winfiles.com. However it was first used by NuMega people to allow' ], y3 v7 f1 s' B" w& X
Symbol Loader to check if SoftICE was active or not (the code is located: `  T1 \  m4 E' j. }, B, j& r
inside nmtrans.dll).
3 h: t+ v6 c* ]& @4 M: @4 t
& ~4 j1 P: `$ ?0 c3 iThe way it works is very simple:- p' `1 n' g1 d- c) v- [' I7 r
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; Q2 m* ]. W, D6 X& A
WinNT) with the CreateFileA API.
" m" t. T* r" S$ _5 |
2 S, @- s! e0 M4 x, nHere is a sample (checking for 'SICE'):. |5 \6 t& X' ~# O" |2 u

* O! n/ Z% J- ]- z3 X; d& f% CBOOL IsSoftIce95Loaded(): u1 @  g9 G% Z) C& X- Y" ^- f
{
. v9 o) I/ d5 C6 u, K# |   HANDLE hFile;  
" r5 ]' n8 C3 `: x0 ~   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' u2 w) |/ a3 f                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# p; g5 Y6 n$ E                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( d! m" q& t+ b* e) s   if( hFile != INVALID_HANDLE_VALUE )$ P8 {% U# I+ {3 ~
   {4 ~/ c6 I+ I$ j8 ]9 L  M' l3 R+ T
      CloseHandle(hFile);' a( h. P" ^& s
      return TRUE;
! ?' {  Y, \; W3 Q8 E: t* m   }! F3 f) I/ S# w3 w# \. f" k
   return FALSE;
9 p0 h4 w- w$ o# g8 u+ s9 g}' B6 {" A+ O; D1 q/ M

0 J  h- t6 _, yAlthough this trick calls the CreateFileA function, don't even expect to be3 b1 B/ ^; ~: ]  \. Q. R+ u1 o
able to intercept it by installing a IFS hook: it will not work, no way!, s1 s& I+ D" q+ a% z. p0 ~+ m  C
In fact, after the call to CreateFileA it will get through VWIN32 0x001F( z. r% [4 a( C) U7 c
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 `( P. S: N+ C( |4 d
and then browse the DDB list until it find the VxD and its DDB_Control_Proc7 B, Z4 U' {8 H9 }* T
field.
8 C# h4 F* V! {8 sIn fact, its purpose is not to load/unload VxDs but only to send a
- s' {/ o2 A9 e# n* pW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 w/ c' C  ^& o' o& g4 [
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) R; G7 B3 Z" \2 w( b, Mto load/unload a non-dynamically loadable driver such as SoftICE ;-).. p3 H6 e5 T6 w; L  }- s" m
If the VxD is loaded, it will always clear eax and the Carry flag to allow
1 E7 b' i# c9 D" J$ V/ D& Eits handle to be opened and then, will be detected.
, d# n) o7 D" @2 \$ D7 [; ~, E5 ?' EYou can check that simply by hooking Winice.exe control proc entry point; X4 t, l& b" ]" T: r( W
while running MeltICE.- v; W+ t9 u5 P  C, \

* e* f; T8 j$ w1 l
& r( o# I9 U! t1 P' B  Q  00401067:  push      00402025    ; \\.\SICE7 S7 x  ^; `4 ~1 c$ N; a- Y/ p
  0040106C:  call      CreateFileA! |+ ?' P* l) X2 `/ s* N
  00401071:  cmp       eax,-001
% R% y( Q9 d/ v& x4 J& o6 q5 M  00401074:  je        00401091
. f* T4 Q4 x# E9 J; l4 M0 R) V. G9 X
4 m" B0 W* Y& V" W
There could be hundreds of BPX you could use to detect this trick., l; g8 r/ {- m5 ^* l! F6 ^# D  ~: _
-The most classical one is:
" q3 j) X% I* A- e  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||8 o' A) a2 I4 E1 Y
    *(esp-&gt;4+4)=='NTIC'5 G9 W8 c" f4 @9 H, U
" b& ~8 C1 _5 k  U- K/ C
-The most exotic ones (could be very slooooow :-(
8 N- Z. e/ L5 p& u- P3 m+ s7 p   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * s/ a* c7 x  S: R. E. t
     ;will break 3 times :-(4 e9 g% W) ]$ Q. a! i0 ~& K
- Q0 E" u: K  [! d: G) G  X* r! F
-or (a bit) faster:
9 m' N) `$ s+ y) {   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 g2 ~3 M0 x7 p

1 p6 m0 @8 y5 u8 g   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 F+ i" Y# K* T6 Q/ a) s. a     ;will break 3 times :-(1 D) P4 r: s4 Q  n

3 r* j, z1 J( F-Much faster:
+ e! d1 w6 q4 p! ~   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; ~' ~2 S2 K5 `8 ^& a

8 p( {+ ~3 E) C$ {* E& ], a, N5 Z$ ]) [Note also that some programs (like AZPR3.00) use de old 16-bit _lopen& k$ A& P+ T  n5 Q# y( m
function to do the same job:
6 s. R0 f7 s2 J( W$ b/ a) u4 ?5 `, b1 ]+ [5 e6 [
   push    00                        ; OF_READ  P- n8 R) F6 \8 p. _- u6 p4 O
   mov     eax,[00656634]            ; '\\.\SICE',0
$ u6 g: s( G. M2 T   push    eax' [; F7 h$ V. w
   call    KERNEL32!_lopen6 n+ R% G3 F& q( e+ z4 m4 i
   inc     eax# j3 p( x0 t7 ]( h
   jnz     00650589                  ; detected
- W6 k7 g, P% r9 H9 {' a* m% p1 @% i   push    00                        ; OF_READ
, R8 }& c/ s! f6 c% J* O. m   mov     eax,[00656638]            ; '\\.\SICE'
/ G7 K, Y) m' z" @1 P4 E5 e# n   push    eax% v) J& Y2 ~0 E; X3 U2 c
   call    KERNEL32!_lopen2 Z4 ^6 u0 Q6 `$ j9 M/ f
   inc     eax6 y% p! @4 Q) n( @% r7 R. H8 N  a) k
   jz      006505ae                  ; not detected
6 [$ d* X% R; d. e
( k4 s( w" ~% n) I+ P% u: q$ N4 {8 C/ l
__________________________________________________________________________2 h. _4 N* v( D- [- u  H4 q8 `6 L

, z9 S" N3 }- WMethod 12& k. q# |' I/ ~& F
=========% Y7 k& h. Z2 C& f) Q# n, s8 P

) v- {  B0 \5 _1 P# z8 @: b5 NThis trick is similar to int41h/4fh Debugger installation check (code 05
  }4 }7 k$ c, U) e- F$ t' h6 }&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( F& S, s2 l# M3 R% jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 }/ X7 {/ V2 F+ |; s, `1 k! I8 B" X: i! P
   push  0000004fh         ; function 4fh
/ F7 j0 _+ h6 s6 S  R6 w   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 G; L& ^/ _& W* v& `3 }2 M                           ; low word specifies which service
; x9 t: S" Z  @, g; O  t                             (VWIN32_Int41Dispatch). w9 @/ ^- P4 z8 V  f* Q, [
   call  Kernel32!ORD_001  ; VxdCall
* f7 C7 x+ N& X. ?! s. E- U   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 X9 j0 t7 X5 x$ d   jz    SoftICE_detected
  b7 X  ]% t/ F* F& M
2 U4 S4 G  n# j7 i" k# b3 ~# RHere again, several ways to detect it:- V) y3 M$ K& ]3 i" v, R

! {" ~/ H* w& K  J    BPINT 41 if ax==4f
2 k# Y$ C* A. L7 P  Q# I6 N2 B2 e( ]% {, @+ F
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
( M( a7 b, T; G0 W1 t# q5 D( q$ B  f3 E* M' S4 A/ b. w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: f) i! j; Q  ]0 v2 n$ T# \( R
" _$ g: ?: j+ O$ _3 a4 {4 D9 c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 @- l0 @2 S0 d0 ~

1 q9 P$ p- r2 q: H2 e; i2 V; c__________________________________________________________________________
" v: B& x0 B+ ]# s; r8 I& D
( P+ M8 |4 C; KMethod 132 w2 I# D) g0 t/ I6 v) N  v
=========
$ P2 k' |, n3 f3 v7 [0 I1 Y6 {& Y0 x9 Z8 p8 P
Not a real method of detection, but a good way to know if SoftICE is1 ^9 D0 k; y8 s( @- c
installed on a computer and to locate its installation directory.. E0 s/ Z& Y0 h# Y# g* D
It is used by few softs which access the following registry keys (usually #2) :
. u, Q  {, b2 d5 E3 P' y, O
0 v# v9 d+ h2 g" I-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. u$ |; `- |0 |2 F* k1 I/ B3 H8 F% o\Uninstall\SoftICE) T) d7 r! ~9 e8 d
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# a+ {7 G& ^! z# Q4 S' V) O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ x/ T4 @2 l9 i* H! g- B# X
\App Paths\Loader32.Exe
8 T3 Q4 v" A8 V9 I" t8 t1 _$ P2 a# o/ A) n9 H& J
  A4 U, K3 C4 M4 d
Note that some nasty apps could then erase all files from SoftICE directory3 b( V( g+ i8 P4 r
(I faced that once :-(
5 l3 W0 A* j4 z. R: e# H& c, N
5 j7 P; H. n5 X# B5 OUseful breakpoint to detect it:
3 G) s  ?( y6 i$ b. d
6 M5 t2 [# {! ]% ?     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
: U3 x' ?0 j; v6 o" R3 H4 U4 ?4 U, o% W  D; b/ n5 w9 k& T
__________________________________________________________________________$ N; Z0 g: @; C' c6 P3 g5 R
8 K$ M, E; ?1 t1 L1 Z0 x, g
! t9 e! ?1 X' W  s
Method 14 " P1 |4 Y6 ?8 w3 r$ ]" g
=========
, {: Q3 u8 I6 j; ?$ g
- ^3 i2 v1 b2 x# k. y9 x/ ^; S! cA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" ~+ @4 n7 Z3 a5 `
is to determines whether a debugger is running on your system (ring0 only).
. p, Y9 {" Z2 D- w: g% }; ~" n, b; r9 M5 S& A3 s
   VMMCall Test_Debug_Installed
. b6 ]% b6 D/ N: i6 q   je      not_installed9 u+ O& [2 D/ N
8 p) k) v2 ?) D1 j3 l
This service just checks a flag.
1 u6 p% {' O' t) P8 b, x</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-11 01:11

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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