找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ x1 D- y1 j7 K3 b' k  W& I% _5 X<TBODY>
8 g6 f4 I' [  V. o2 {+ R9 D<TR>2 Y, _  l3 k8 e1 T# ~; \
<TD><PRE>Method 01
! m' d, F& g) S6 F/ ^=========3 t0 n+ J- T: C% i: F
3 Z8 v  R" K) X% H. i& F5 j; m- R0 w
This method of detection of SoftICE (as well as the following one) is: Z8 h0 h" i1 a& x- `/ k
used by the majority of packers/encryptors found on Internet.
0 v" @! t! w! l0 [( pIt seeks the signature of BoundsChecker in SoftICE% L9 Z5 V) x* Q+ f& d3 {

. A9 r" T$ ?& e. C    mov     ebp, 04243484Bh        ; 'BCHK'
5 N8 k4 `  \* O6 l5 q    mov     ax, 04h
0 E$ l1 E' V) N# t( a    int     3       . n7 _# x1 |5 b+ u8 p3 G/ Y
    cmp     al,42 ?8 O: }& S$ q, o
    jnz     SoftICE_Detected
- G# u5 K3 E( r0 h1 m8 h& y
$ \* i6 T$ D8 _: v___________________________________________________________________________6 }. I* Z  A5 T2 w9 u) K

, y0 B3 d) ~2 G+ H9 r+ f; VMethod 02
* M% Y7 W1 k# V3 q* I4 L8 l$ M+ w=========: v7 a' O$ x4 F, i7 q/ R* P
: O/ t+ X+ P) g
Still a method very much used (perhaps the most frequent one).  It is used' o8 [: E7 G" L7 ~& W3 m- {
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ L& r4 a+ s3 h6 o( @or execute SoftICE commands...( o4 Z4 I+ y) R  m
It is also used to crash SoftICE and to force it to execute any commands4 y+ C. N3 S4 M* s5 C( u
(HBOOT...) :-((  
" W+ S8 V% i4 J% R4 W' ?" b$ i- m3 _9 ?& s5 X
Here is a quick description:, X; @  k9 v' ~* S, v/ G
-AX = 0910h   (Display string in SIce windows)3 V3 M, w4 ?- `! c. j& S
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) e$ T% I; n  y. a$ T) q7 o
-AX = 0912h   (Get breakpoint infos), _; Z! X8 h' r/ M
-AX = 0913h   (Set Sice breakpoints)
2 S+ P  t. X: |$ g% r) q% C-AX = 0914h   (Remove SIce breakoints)
3 V. o: S$ D+ C/ i6 ^& l
* s2 e- D* V- c2 h5 XEach time you'll meet this trick, you'll see:8 p4 A6 Q, J. d5 a9 E
-SI = 4647h- E  x% g! [+ @2 m
-DI = 4A4Dh2 z9 C. J4 v' B2 O# a/ B
Which are the 'magic values' used by SoftIce.2 ?; G% {6 m5 s2 k
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
3 X0 P" q# _& C- C. f' y3 `2 f! N. _# ?1 {
Here is one example from the file "Haspinst.exe" which is the dongle HASP- N: w3 N* w/ ]
Envelope utility use to protect DOS applications:
0 ^! t+ G% [# g  M+ J  J$ `: b5 ]( H' F9 u1 ]' J- h5 v. s
! T4 W6 b( l/ o) B
4C19:0095   MOV    AX,0911  ; execute command.' w% U$ ?4 w8 _( b. g7 M' o7 n1 L
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 J, P# B3 O+ }0 G$ x
4C19:009A   MOV    SI,4647  ; 1st magic value.' J; U( ^  {$ k* a
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. R6 I0 b  J2 T' ?# N3 Z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*): a! l7 J) d* N2 j
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
) p, H3 y1 |, {4 U& f  ?$ a; n4C19:00A4   INC    CX
$ j( N& v7 \! H; g+ V' _7 t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute3 J. n  i$ |) P4 o/ O
4C19:00A8   JB     0095     ; 6 different commands.
  t5 R, C! |0 @1 m4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& m( g. a# A4 Q% t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' |. w% I+ q; k
1 \# z# X5 E3 e* w3 q* x( t
The program will execute 6 different SIce commands located at ds:dx, which+ ?4 l  X. Y0 G% S% D* f
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 `! A. j# J0 s+ C, o3 w! `% o! c
1 _7 K- }! @8 S* U- Q; q! m* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.7 I# P; j4 q, ^  i" u
___________________________________________________________________________2 M+ h* |3 \2 p: F- U2 ^
4 c; r/ J& q* U6 c2 A. k7 u

9 M# L/ O" ]' h/ m# A8 E8 LMethod 031 D/ `' r3 O' W/ ]
=========
8 l0 w- c" J2 G4 ^5 O  K* ~, y/ V$ x6 [1 R% n! d) q
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
- a; C: L; r" l( m- l(API Get entry point)& G' p5 i" J) q# j  n! t! g
        ( G& ~& z* F9 x; N

- h( K: \. n( o# O. I' l    xor     di,di# j7 I4 j; {" \* U7 j% {" f2 T
    mov     es,di
  Y1 P; J/ ?2 T; _5 X7 W    mov     ax, 1684h      
, m/ g$ M; ]1 H    mov     bx, 0202h       ; VxD ID of winice' U6 t6 U2 U6 ], W
    int     2Fh
. Q) c9 g( Y- w5 x- \7 q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 y! N8 D* R, w0 _- r    add     ax, di3 c7 B% N! L1 m1 }. U
    test    ax,ax
; {3 _( `6 r, o; [  |% E1 m8 |    jnz     SoftICE_Detected
6 o' U" D2 r7 [  H" Q, i9 h: w7 B' G! K" U" q" o
___________________________________________________________________________
" b! }" B$ c8 @( n1 @
4 A/ `  s% f: p9 v% k" ]- wMethod 043 ^. J. ]( ~/ S: y3 N' W5 |; ]6 j  j- f
=========' s7 P' C5 B  _. Q7 V5 }

$ m# H$ U2 }2 V# x0 S8 ?; OMethod identical to the preceding one except that it seeks the ID of SoftICE" U) I" o/ o" w4 C. ^
GFX VxD.: O. ^/ d. J3 w; _. d6 F3 W# S

& F* _" @) ^6 {( T6 b* [    xor     di,di! G% S  R' P6 C9 n. ]
    mov     es,di5 W1 U) t. |/ \
    mov     ax, 1684h       0 y, {( `- B+ b! v) E
    mov     bx, 7a5Fh       ; VxD ID of SIWVID; x) z+ ?) W% H+ H8 G( Q& C1 s6 I
    int     2fh8 b* f# p4 l6 w% \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ y6 d; e# s3 A* [$ C3 r    add     ax, di
0 n- x7 P9 U& i  s$ M5 S6 Z    test    ax,ax4 m+ c1 N0 b6 a# R* |2 A# z8 W
    jnz     SoftICE_Detected' t8 `$ C$ s. @/ Y

& E: g4 `; C, n+ W6 x) [7 q0 j: U__________________________________________________________________________) d; |0 O' `: l! Y7 w
" y7 Q& p! p; b9 B3 ~9 I& t" v; R0 g6 b

3 U* k/ ]. B2 ^( OMethod 051 N& h5 i1 K" m+ Z* j
=========
7 F) j1 v$ W) ~( v/ |" B0 L' I- O8 X) |6 g( F* V
Method seeking the 'magic number' 0F386h returned (in ax) by all system3 W) D" g4 v# }" R" [$ w; b
debugger. It calls the int 41h, function 4Fh.8 _$ G. ^% E8 s1 A
There are several alternatives.  ; C' c2 d" k0 J7 N' F

9 A0 u: H6 S4 i: B# WThe following one is the simplest:, Z1 \: |: ^. b$ m& P
" b+ I1 x/ ?9 Q; ?* Q- N/ z: l9 }: c
    mov     ax,4fh
7 H4 j: s$ C0 b( X3 z, l    int     41h( L9 }% w1 e" q8 }
    cmp     ax, 0F386
) s2 m9 O' F$ g# ^( G; g3 V    jz      SoftICE_detected
( V+ V& N; [7 ~! i, ]# d. Q4 d+ n. e( q$ d! v/ x) _! E. l

- f0 \; T  s, j; X- y$ CNext method as well as the following one are 2 examples from Stone's 5 G# I& B; n1 g% k3 }/ i0 {
"stn-wid.zip" (www.cracking.net):
) H: {% J+ H+ l$ `% X4 Y9 p4 t% V* v& ~7 f6 z, r- s% L
    mov     bx, cs  Z  b3 G2 j" H' Y0 [+ r" Q* {" k
    lea     dx, int41handler2; G5 ]( I0 [4 q  m+ T5 M- X5 h
    xchg    dx, es:[41h*4]
( m* ~/ k! N: Y8 S5 h3 m    xchg    bx, es:[41h*4+2]1 n- z) {; i- O2 `4 A5 v" J
    mov     ax,4fh# {& s9 N# b5 h; \+ T2 p
    int     41h
. _' ?3 h# ?6 V' z    xchg    dx, es:[41h*4]' F" j2 l8 D& N. f# v3 j! ]
    xchg    bx, es:[41h*4+2]3 A' g# V* ^" }& n( b
    cmp     ax, 0f386h1 \9 N8 T- z1 y* Y( D! I( @. P3 F
    jz      SoftICE_detected! N6 I4 U  E& g) ]; S/ T0 k

6 `1 [* j) x  Iint41handler2 PROC
" e1 e0 U6 z4 Y0 @# i$ H5 r    iret
1 V0 T2 t8 D+ G8 T9 Zint41handler2 ENDP
8 T7 C8 W3 ?+ \2 {' N1 U  K6 a/ u- g, `" J: Z
. P7 ?% T# t2 H& F' y! z
_________________________________________________________________________
- z( {9 A7 a* r; a+ S* j
; a" @8 Y" l& _6 F6 T+ E
5 L* f2 Q! _; e* G& `* T) ^9 EMethod 06
% m. k- u: C: A2 L6 a=========
+ h1 t  F1 M9 ~# C# e, Y" i, G& N% H8 v. G0 H" q  `8 Q/ i+ B9 `( @5 n! ?0 Q
: @' P1 w+ ]: F& Q1 {; ^
2nd method similar to the preceding one but more difficult to detect:
1 ?' C% p% q+ E" M; m/ g& ]
* V0 ?" X: ^& N2 |- ^. l
0 N; H, D+ {7 h8 ]; S, l; cint41handler PROC. n+ [, t! t7 M# P2 C
    mov     cl,al# R; c4 E" F3 [8 i( ?4 T* I# s  Q, `
    iret6 O/ f9 ~3 d. d( y. D5 S  e' S% i7 D
int41handler ENDP6 H- ]1 K) Q& _* ]

; j) s  d6 g9 C  U
2 E/ g8 K$ V! }1 K    xor     ax,ax" n, B; p: i2 ]5 j, y! ]. a' n
    mov     es,ax
7 q% |& T2 A2 i    mov     bx, cs
2 Q3 L- f8 R: T0 ?3 s! y/ Y# M    lea     dx, int41handler
7 s# x; E3 z) E, Y( p    xchg    dx, es:[41h*4]
% b" R: \, R" N2 I; h6 N4 C    xchg    bx, es:[41h*4+2]' z2 I/ k2 ]8 H; x0 F8 T
    in      al, 40h
9 x. _+ l% `/ z    xor     cx,cx
5 h8 X5 T0 {) y" Y7 {- R1 m    int     41h' T$ y' d% q1 z. V
    xchg    dx, es:[41h*4]) ^# o6 r- @* l3 l
    xchg    bx, es:[41h*4+2]
9 T2 `  l7 o9 J1 r+ p, ^    cmp     cl,al
& `. d0 X! K# a. ?    jnz     SoftICE_detected8 `! u0 j- R  w5 S; \, M5 [

2 p, P$ x  b; z1 W+ ]& p$ m_________________________________________________________________________9 ]$ _6 u' o/ h/ I4 w$ ]/ {0 O
$ l, F: B- V% Y2 J% S" p
Method 07
7 o) T3 l; \$ q3 T=========9 u( z/ n3 C' k0 Z
0 |3 `+ t7 F7 L5 P, i
Method of detection of the WinICE handler in the int68h (V86)
; U8 T1 E/ y% V5 u9 h( s. w4 e0 n  M. p( x# y' G/ B7 s
    mov     ah,43h. I8 c- e% [# T) \0 l- q- i& e0 w
    int     68h$ S' S9 G/ d4 |. d' v& R5 E; c
    cmp     ax,0F386h4 q, E: i; l: [6 Y
    jz      SoftICE_Detected
8 D3 G0 ?; `( U) }6 C% S
2 X' \& e% q3 G; m
( o2 E& [" c. p0 s2 j, {=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 z; P) y; G$ E9 ~- [* H1 _   app like this:# X0 g% L, w8 k6 e* V7 c9 ?
- ]9 b; @8 f" Y3 M3 \
   BPX exec_int if ax==683 ^7 m% y7 u% {& Z3 f
   (function called is located at byte ptr [ebp+1Dh] and client eip is  D0 D8 @* L  A5 N8 [1 R- A6 t
   located at [ebp+48h] for 32Bit apps)
! ?0 b' U5 K; p2 K- x( Z5 M0 |__________________________________________________________________________- G. W& t* z# x3 w
4 r$ ~6 F# j! U; g9 R

' i3 `8 z# P: q1 D& C7 rMethod 081 F4 {/ F: j' I4 \: ~8 R  J
=========8 A1 o& j, F3 W0 q: H3 ?- _+ R
4 F" b1 u! U* p3 |
It is not a method of detection of SoftICE but a possibility to crash the
, d7 y7 R9 K5 V3 y+ s' x' csystem by intercepting int 01h and int 03h and redirecting them to another! h) i8 Z) q3 M  B0 A' u
routine./ o( }$ t2 s! ]9 X5 @! z4 d
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ U! ]6 o' k( e. D! @2 d) l0 s
to the new routine to execute (hangs computer...)9 Q+ H( i) i' K$ Q1 ]8 J# T

( J# B' _( U# I    mov     ah, 25h3 y# z; B. A/ j: x
    mov     al, Int_Number (01h or 03h)
/ V! E6 U! l+ T7 W, x    mov     dx, offset New_Int_Routine
+ M* K# l" F: L" [) M7 O0 l    int     21h
3 c+ g1 u4 w5 e+ j# z  |; A! P5 q7 R
__________________________________________________________________________
# {4 ~8 i. |3 T$ U" g) D# o& t. ?; O" `% v( [( ]/ ?
Method 091 z5 q& f+ a" f  [4 T1 @) w+ I
=========, v' t$ U( d7 s- i9 u( q
& H: y- R" J' N! A0 x
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only3 E/ B+ J3 r$ f9 P, s5 ~
performed in ring0 (VxD or a ring3 app using the VxdCall).
& _) Z+ z" l3 L; t( h" nThe Get_DDB service is used to determine whether or not a VxD is installed
7 m& S5 @+ r. i! H1 O6 Y& ^for the specified device and returns a Device Description Block (in ecx) for
7 i# ?4 {7 J) ]) `that device if it is installed.
9 I! k% V2 J* t9 c! v  E6 R5 n  b3 X/ Z( A5 Q; o- K
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 x% x6 t8 n2 ]" S& W
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" ~% U$ ~4 M6 N' Z   VMMCall Get_DDB# B+ `# \( A3 g- u3 a/ V
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. ?, e7 q) G( |- y2 g# W% H
1 ^6 z, A- l/ |* pNote as well that you can easily detect this method with SoftICE:
9 ^- P* T5 ]7 ^# ?7 G+ i   bpx Get_DDB if ax==0202 || ax==7a5fh; M/ C- L/ r5 N* x# Z8 g

5 x' N' Y( B1 v  ~3 J! x__________________________________________________________________________: M, A6 v# U' x) B5 e
& k9 r* H3 s6 J' M
Method 10
. F" z6 Y8 V, n4 M=========( D1 H* K* J$ h! a9 e  B
, \* N; f. P! n" s" c) U& A8 _' Q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 t3 P& Z$ g8 |+ S1 P7 X; T5 N  SoftICE while the option is enable!!- e$ h/ {/ e' B5 g# W/ P8 j8 D
" z% R  z) y4 d4 ]* t2 k7 e
This trick is very efficient:0 D9 V( M  q1 F7 u
by checking the Debug Registers, you can detect if SoftICE is loaded
# n; a) }4 ?! N# g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 a* W; _  P- xthere are some memory breakpoints set (dr0 to dr3) simply by reading their
8 _7 ?& j+ [2 P0 g2 q+ gvalue (in ring0 only). Values can be manipulated and or changed as well
6 B% G; i, o7 n! D, ~# F. X$ u0 C0 j(clearing BPMs for instance)
# L. G6 i0 c4 ^, V2 n0 c% l
. C; j) e2 `! B! y: {" x' o9 |__________________________________________________________________________
$ g2 g# ]% E' I: V
" M5 o7 w9 y# L) b( FMethod 11
. B( Q# \8 W. q3 z=========0 A0 K+ h. K0 W8 G
5 Q; S/ r: l3 e) M1 j
This method is most known as 'MeltICE' because it has been freely distributed
$ o3 p' a( ?1 M* bvia www.winfiles.com. However it was first used by NuMega people to allow
2 P. n9 `4 a* s( c% C1 W' fSymbol Loader to check if SoftICE was active or not (the code is located
+ R3 m$ P- z: X! F7 C) Ninside nmtrans.dll).
% q  c# l6 k( W6 h; s
8 k) M8 G* C; S. I% ZThe way it works is very simple:' e) ?' M# |- \9 ~9 V
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 M1 t& r# F  u* lWinNT) with the CreateFileA API.
1 j/ |8 e. m4 W0 J) d& u! t6 t4 l% P+ }  w" [1 H6 N% p! v0 q  W+ h! r
Here is a sample (checking for 'SICE'):
1 q0 w  I6 M* z7 L
7 G6 Z: C! h0 l- S3 WBOOL IsSoftIce95Loaded()
6 g4 ]# ]) c7 t! T: N7 t" H+ [{
  \- O' _! Q- v3 c% i6 g0 M. Q   HANDLE hFile;  
4 n7 w8 [: `# ?   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& i; `6 q( y8 s4 I- a" k+ J$ J/ }* Q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% F1 M) x+ w: d- ]1 v6 ]! R2 g                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);3 l* M6 @0 X4 O. N2 L
   if( hFile != INVALID_HANDLE_VALUE )1 I6 n! R9 ?8 l) u
   {/ C% h5 G: y$ v% W7 d
      CloseHandle(hFile);
+ U/ U2 v6 H1 ~: g4 _) y      return TRUE;
# e- y/ s1 S" W/ z# Z3 d- L5 X   }
' _0 x4 l0 M; X+ P& L0 `4 \( s   return FALSE;' P+ l7 D, A6 x6 p6 N
}5 ?* T# b6 |- ~6 U4 z) j

  h* o8 a! O& M% {- EAlthough this trick calls the CreateFileA function, don't even expect to be, {2 L* g9 @6 x5 O' J$ W
able to intercept it by installing a IFS hook: it will not work, no way!
" C- u  s# U8 \+ |4 pIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 F. r+ u' X- e3 g. W: jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
1 i) O' _& b1 y( C% o$ rand then browse the DDB list until it find the VxD and its DDB_Control_Proc& a/ Q2 h" K' |% U! Z
field.3 ?/ K+ `. c0 Z+ q
In fact, its purpose is not to load/unload VxDs but only to send a ; V& W* V0 ~7 {# W
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; x& ^* L, S& f6 ^, l4 Uto the VxD Control_Dispatch proc (how the hell a shareware soft could try8 V; d1 t( ?# g; f& p0 E; e
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
; Z# O" k- R  Z0 D+ V6 PIf the VxD is loaded, it will always clear eax and the Carry flag to allow
: n) ^1 Y$ j' G% P0 hits handle to be opened and then, will be detected.
2 Z+ |9 L" B4 I" wYou can check that simply by hooking Winice.exe control proc entry point5 f1 o7 K5 B. y) ?* e
while running MeltICE.3 `( a  j9 u# X$ t

6 B# R% ?  W/ Y% X
: S7 \8 B+ Z0 D7 p1 z9 a2 {  00401067:  push      00402025    ; \\.\SICE
$ B5 h* z- J2 e  0040106C:  call      CreateFileA
% P; ^8 o6 I! z' s  00401071:  cmp       eax,-001
1 m  Q4 Z, V! B. Y  00401074:  je        00401091
" O  U- t7 H5 b4 ~8 d# x5 [3 d- e) o& Z

& p' M$ X; S* O" p6 K0 yThere could be hundreds of BPX you could use to detect this trick.
) L/ Z/ A, p: K8 C" ^-The most classical one is:8 r) q5 k: |8 H6 e; r- D0 J
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 g' R1 K( \: `/ J. p4 M    *(esp-&gt;4+4)=='NTIC'. W3 a0 `/ B6 e

$ ~6 b) z3 z2 D2 }" G-The most exotic ones (could be very slooooow :-(+ @; w4 O9 o, n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + z$ W& c, U5 n5 B  Z+ L
     ;will break 3 times :-(7 }: N; o, k, b0 e+ c! e. `5 ~

% J8 A8 M  M! r" ]2 B* c-or (a bit) faster: " V: X0 q# x" \: A: x$ H
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 U1 }. R/ K8 [; S8 t1 s/ ?
/ ~9 Z  Z3 G: s  p9 q  |   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
# R: c/ P1 w# k3 y' T5 ~( g     ;will break 3 times :-($ S3 ^+ |+ W4 u7 i
7 g) Q4 g1 {. R+ E0 u. m0 n* T  z
-Much faster:
6 M' h' j5 ]7 m$ B% w$ n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 ?, `! r: ^: O
0 a" }) W3 v; @: E' |* t' ONote also that some programs (like AZPR3.00) use de old 16-bit _lopen) L; ~) a$ a: I/ C& E! R
function to do the same job:" e- n9 o1 k% U- F/ Z

$ u0 t0 c& \3 W' n; g, {* g' j+ u   push    00                        ; OF_READ. V9 x3 A; }* E: M0 w. t
   mov     eax,[00656634]            ; '\\.\SICE',0
$ R9 H& D  O3 m6 k   push    eax
' c+ g& c  g# U' O2 L$ B   call    KERNEL32!_lopen8 E1 V1 \' t. O
   inc     eax' x4 X4 O8 w# A; W- n! w1 |
   jnz     00650589                  ; detected
, p) Y( e3 U9 l& q3 K! F7 c1 D5 E5 O   push    00                        ; OF_READ& I; D$ H0 B4 i. ]
   mov     eax,[00656638]            ; '\\.\SICE') [7 W8 b, t; M' z
   push    eax
  d7 H/ f+ m0 c   call    KERNEL32!_lopen- S4 Y  Z" T. I1 d
   inc     eax2 _" C' l; b" f/ T2 R
   jz      006505ae                  ; not detected$ E5 e( m, g2 ~* ]/ V

: b9 a6 D8 g% s/ ?
, M: R& b# M  v% A6 E2 V8 h0 C__________________________________________________________________________
# V( i1 p6 c# k- o. N9 ?3 @4 \
/ Q2 \. t; v2 U1 p- H9 mMethod 12
- Y8 f9 f3 q/ o" r& r=========
- L  e. n6 z) z  i; A( k2 ~, v, }3 Y+ T0 ?% w; j" |' L9 i
This trick is similar to int41h/4fh Debugger installation check (code 05
  c: z% K4 P& g+ U( \2 i1 j* I. z&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 J2 U4 G  W$ w# {: z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  M. Y2 u% V, |3 j" m* i# A: M" R4 q  Y
   push  0000004fh         ; function 4fh# N4 D+ S. ~0 T1 F
   push  002a002ah         ; high word specifies which VxD (VWIN32)4 y6 g7 C# c" c, G" D
                           ; low word specifies which service
( t3 T0 a1 i3 {  Q                             (VWIN32_Int41Dispatch): X, G2 M; r9 c5 l+ p
   call  Kernel32!ORD_001  ; VxdCall
1 h. F/ E) {6 m   cmp   ax, 0f386h        ; magic number returned by system debuggers/ b, I' F8 p( j3 H+ D; V! s9 Z$ w. u
   jz    SoftICE_detected
- I0 J* a3 T0 ^2 K  v3 s3 u1 V2 x7 E* e# q* L3 f0 l" X
Here again, several ways to detect it:' b+ U5 B* q3 L/ y" P6 P
8 y$ K% @1 w0 q
    BPINT 41 if ax==4f
3 g) t# [' f0 v( h" A+ _( {
' B8 }$ X* N3 R% J    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
. r4 c( O$ }; E- M# S4 W
" X4 L9 S5 [: P9 X, q2 A1 w- K    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 h* B% l* ]% v0 N" u4 b. |) I( b) \5 d/ \) {: P6 p8 \/ ]
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
6 a/ U) s4 |- Q' W/ M3 \) X3 M9 G1 Z7 h( j3 e1 X% T
__________________________________________________________________________
  j2 Y; F  y- I; }1 B2 K8 u: P1 p' O& }
Method 132 A+ T9 K- k& g4 }4 T' H
=========
9 n0 u2 X& q7 i4 g2 D
8 k  C  W) q' L7 f' x, ~( ENot a real method of detection, but a good way to know if SoftICE is
% Q- \) y/ n4 J( U* X* minstalled on a computer and to locate its installation directory.
0 ?/ y0 ?$ t4 U: q4 F2 WIt is used by few softs which access the following registry keys (usually #2) :1 V7 Q: f  T4 T% H3 V; h; C9 L
# V$ a3 r. Q4 c) y1 l  W4 `: S
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& y% a+ e1 @# ^4 v! C3 e\Uninstall\SoftICE
# @1 }) o2 I& Z2 ^7 j6 K+ `-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ S" l# G' h7 B4 l- R-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 ]$ ]0 d9 O6 w0 Y# L/ G% @9 a
\App Paths\Loader32.Exe, n) i2 @) h8 ~3 M$ H+ h* Y
4 h& q& i2 S! u1 }3 k( ?
& j% n( n8 j9 k4 w
Note that some nasty apps could then erase all files from SoftICE directory
' f2 J3 b( L, D: Q5 b6 k6 J(I faced that once :-(
" H" ^$ Z) Z% a* ^6 @& C: x
2 m1 z6 M. _1 R7 u! H9 h! mUseful breakpoint to detect it:
" j( ?# N- B2 V5 B5 Z$ J  }# U! y8 @( a
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'6 p+ a9 p* I* D, U9 [8 I1 ~
4 Q  I, s$ P% i) _& J! n* X
__________________________________________________________________________
2 |4 A1 }7 m. O5 c2 e! |& x% G" z  B# y
1 x$ z4 d) V0 Q
Method 14 2 S2 V1 Q: c1 X1 ?# V  g* \" ], [- F
=========
$ X* i* z; z- t4 g5 N1 l! Z0 L" q- T2 V2 l
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ [& o& W6 J# A$ R9 r6 V0 ]
is to determines whether a debugger is running on your system (ring0 only).
3 K; M! b" W5 z- W9 Y5 J- ^" Q" n2 g; ~/ J' C5 G
   VMMCall Test_Debug_Installed' l  G- r4 k3 `2 _
   je      not_installed* f0 g# A4 `7 d/ |$ {; \

! Y6 I- w5 ^7 e* D, k9 V/ w- u3 ^; bThis service just checks a flag.
" U6 s- F$ U# Z# S2 ?' z4 s6 i</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-21 13:27

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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