About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) ?- L2 h' Z4 l- i! ~
<TBODY>/ o# w% ^5 e$ j/ W
<TR>/ ~( I( e" V0 u5 E9 G
<TD><PRE>Method 01 % b( O" |) S) J* w$ b) @5 T# ]6 p
=========# z! V6 ~7 V) h0 y: E, F6 }2 O
" Y- Q- e# E4 J9 o! b" O# v9 d! D
This method of detection of SoftICE (as well as the following one) is
, M$ b3 w# y+ dused by the majority of packers/encryptors found on Internet.  b% w1 o0 e/ C0 W
It seeks the signature of BoundsChecker in SoftICE( e, G. Y# q' V2 @  u

6 J8 C0 G1 }* R0 i* ?0 I    mov     ebp, 04243484Bh        ; 'BCHK'
. x1 j7 \$ z" j. ?# ]) x' F2 [7 E# B    mov     ax, 04h; V7 f5 V8 @% K) i8 j% j: u) y# R
    int     3       / o. f$ J' L" C6 y7 v
    cmp     al,4+ Q! g, g6 O) z/ \0 o8 s
    jnz     SoftICE_Detected3 v6 V5 F# {4 z+ x, o  @- G

: d' `2 j5 R1 T___________________________________________________________________________  \/ Y% G9 L. Y4 F+ d" B: p8 V
7 `. [$ D7 m7 ~2 R- A* I
Method 02' F8 X8 e% f+ b" e1 `
=========
1 u* G! W" f4 ]$ I6 u: U3 H/ v$ Z' l+ z# ?3 r
Still a method very much used (perhaps the most frequent one).  It is used
7 Y( F8 U+ }' W# T5 `- p1 Uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# j4 I& }8 m! Q0 U( l0 P) m, b& Qor execute SoftICE commands...
1 ]5 I  o+ H$ hIt is also used to crash SoftICE and to force it to execute any commands5 K$ L% m6 `8 h+ f: J0 b- o
(HBOOT...) :-((  
. d) p/ ]8 q/ B* t: S# H8 D, O. w. S9 `' x' o0 Z* j
Here is a quick description:: E' G0 J; X% L% _' d" m! \  {
-AX = 0910h   (Display string in SIce windows)6 G$ f" r8 h% o' U
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 P7 d# U4 l4 c9 t-AX = 0912h   (Get breakpoint infos)
! o1 H+ g) A% f) z. U1 p-AX = 0913h   (Set Sice breakpoints)
8 c- Z3 H+ J5 z# K9 {7 E-AX = 0914h   (Remove SIce breakoints)  E& A. R, I# x' a2 g
0 ^4 f. b  D8 K
Each time you'll meet this trick, you'll see:2 ~+ {, i  u3 P; ]) A6 ]
-SI = 4647h/ p8 z0 c+ r7 i& F4 j
-DI = 4A4Dh  `& M  Q) C; N* b+ x5 ~8 }5 Z
Which are the 'magic values' used by SoftIce.9 ~0 g/ ?$ \  x' u
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ f9 u% }( G1 R; H8 \0 H; o0 i
2 F( x! E% h2 C. h: B' oHere is one example from the file "Haspinst.exe" which is the dongle HASP
5 n, `% i" B. s. @& o' j( F! KEnvelope utility use to protect DOS applications:
+ B- Y! ]% o) J# L& W
4 n3 r9 }0 \6 o
% ^$ k/ `' D$ W7 T/ S4 D4C19:0095   MOV    AX,0911  ; execute command.* F! `( X& k0 g, g! s% i& i
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. D& }) h+ E. }/ O, `4C19:009A   MOV    SI,4647  ; 1st magic value.
! G8 e6 A/ b) b% e* ?' }6 e4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 j4 V- ?, @* F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ ^* s. F5 ~2 \0 N4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 O- m! |2 b3 p4C19:00A4   INC    CX1 m; b7 H5 S) Y) w- ~
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) {3 S3 W, t% ^& c4C19:00A8   JB     0095     ; 6 different commands.
) G8 V! M4 I. @, {: C( B4 g- ]- ]4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 ]! Q: d1 U4 w' x: _
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ |2 }& [. b2 k3 o- t; M# \

% L& S$ c+ W  a, y4 ^4 v* H+ GThe program will execute 6 different SIce commands located at ds:dx, which
& K8 j; Z  ^& @% s; o- Gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& D1 K  \1 T; S( W( h6 \1 m  n5 p7 v% ~
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; r/ j7 n" p6 V" q___________________________________________________________________________
" R- Z8 j7 p8 m$ I7 Z. ~" p; A0 O# ^
0 M4 a- W" W% `! |/ T3 ]6 k/ S8 R$ W6 ?5 ?1 z: V
Method 03, [, f3 u- L! {9 Y% t# n
=========
  @# \4 e3 m8 q3 A# a$ ?, f% y1 U9 s' u" ^% T; H# ?
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: P. p7 {' E9 O6 b(API Get entry point)
2 w4 a7 Z5 p* R1 q2 j# S. v        4 T& A" ?) ?* p$ x! Q4 P* G4 G

2 K$ E0 c- Z& D& Z) g& v    xor     di,di
6 a9 x( E- l( c2 `, N    mov     es,di7 L" z. b' Y2 K, W4 |" E
    mov     ax, 1684h       ! T' i7 o. z0 @" C1 o5 z" e! u- }
    mov     bx, 0202h       ; VxD ID of winice
3 P5 d6 a5 \0 P! U8 X' ~% K    int     2Fh
# p. @; |( o: L/ E    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ M, Z2 }2 K0 f8 }3 \, K! L    add     ax, di* z5 C: d, S7 _% g# H, U( X
    test    ax,ax
' E  ~8 b# X# Y+ ?    jnz     SoftICE_Detected
+ [4 P8 d- T; s" k. a, N( N
2 z- i5 \# \0 s! v* _& S7 M___________________________________________________________________________
. X, b2 d. z% a: t
# T- {( V7 N2 {2 pMethod 04+ {) k) U" p' ?3 I0 Q2 f8 ]
=========
; c9 @, }5 L* s; J* D
3 y! [0 Z! S# D5 a( Y) GMethod identical to the preceding one except that it seeks the ID of SoftICE
  F) F0 f, g* A3 q3 @6 yGFX VxD.
6 J2 G( L( e5 a9 p. f7 v4 \0 ^& ]* y
2 P8 K1 U9 O# K; q7 [1 \4 d* P    xor     di,di4 L6 K  R* `( r
    mov     es,di
7 O4 F. x) s  ^    mov     ax, 1684h       , W$ K, W- B# o
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
- o/ M% W. B' D9 O- x; x    int     2fh, c  a8 b8 r6 f" i
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 f% x9 Q) @+ \8 B8 E9 }    add     ax, di4 B3 N* j" g  r
    test    ax,ax% x* u8 o% c- u  u! v. J
    jnz     SoftICE_Detected8 E" ~( A& N3 A4 X* W+ G
& \0 E/ V+ O  R
__________________________________________________________________________
" N) U3 J& {) L# m2 t( W9 c+ [7 D! e2 Q! f7 p* ^

$ u5 _5 t1 k+ u8 Q  m( ZMethod 051 N7 C+ \) r3 q% S. S
=========
5 m5 q' Z7 m. E' Q- |3 g7 [  n. _* ~- n/ e: F6 S0 O4 k% b
Method seeking the 'magic number' 0F386h returned (in ax) by all system, t- O5 \) s* e' f) I+ |
debugger. It calls the int 41h, function 4Fh.& v$ v; c, e7 @, I* s8 n, k
There are several alternatives.  
. b& S/ `0 i6 i. x- y) K( O9 |, P- {# \5 Z5 a! w/ x3 C
The following one is the simplest:
$ ~2 }2 A2 m7 _
1 X+ ]4 |: _4 U  K  f+ ?% u4 x" P    mov     ax,4fh
9 L1 |% e+ F) A1 n, }    int     41h
, O% S) b! [- w( I0 v, q; W  v    cmp     ax, 0F386
2 c: P) A- c- t" P0 g! `    jz      SoftICE_detected
: q+ D3 W: i! Q& y
8 z. o! ~2 d* ~/ ?7 n) {) @+ _- r* g4 G5 Z. K
Next method as well as the following one are 2 examples from Stone's
  S" R  W! N2 h, g+ R: n"stn-wid.zip" (www.cracking.net):0 q4 [1 `5 x0 i" z) H3 A, q
' Z" V! f3 B2 J& h6 c
    mov     bx, cs
6 ?4 X3 D% u* i: E6 l5 `    lea     dx, int41handler25 m: M( S8 O: e# K8 A: i. R- U
    xchg    dx, es:[41h*4]+ E+ {" T" g$ d; u; y, W5 |! U
    xchg    bx, es:[41h*4+2]
# \& r* G" U- |- r0 s  }# W    mov     ax,4fh- b' h3 z, l2 s$ H+ t
    int     41h8 V1 o% @, b( R9 d
    xchg    dx, es:[41h*4]" W6 ~% h9 q; W' n; S
    xchg    bx, es:[41h*4+2]1 \7 F$ N, k5 N  L5 h7 T
    cmp     ax, 0f386h
9 x% T" S" I, `5 ?( c; U# B    jz      SoftICE_detected
+ g! m" z; d( Q! K+ g+ C- v/ j6 v' q$ v
int41handler2 PROC
7 p% \% W' Z% a6 ~9 ]+ A8 C/ i# z    iret
$ ^0 `( Q6 D/ W( T% r3 o0 i7 nint41handler2 ENDP! \+ j. R5 Q1 H5 T$ D9 U" m+ B9 \

1 g8 W, d  G$ B" N$ `- i, Q: `3 W! G4 P4 K: T9 k4 a. l4 e
_________________________________________________________________________
: b, O+ J1 c7 g6 O4 Y7 m6 r
! {1 t" @' V2 `' b
' X$ }$ z9 m) N) G2 VMethod 06
( s6 }( D2 Y6 a6 O8 x" T8 l=========6 c% w* T8 Z; A! R. j/ {  B; V# _1 S

3 `5 S; k. k" Z; ?7 Y
' T. I8 Z5 H, G) G" z8 y$ a2nd method similar to the preceding one but more difficult to detect:
% U& \" A7 M- Z; t; C- ]8 o! k/ J4 Y" B% z- K5 A+ {

+ F3 Z, K4 ]. c7 x/ p3 c* }) xint41handler PROC/ g: j( Z& V% k
    mov     cl,al
# x  H( y+ o- \. l4 [    iret! E. T9 M/ Y8 w
int41handler ENDP
- i- G1 Z: F" w" m2 L* f8 [7 P+ K# P
* \/ Q! K4 r2 ~  m* E9 z, s7 @  X
    xor     ax,ax
/ ~. @) o# |! {5 p* `6 d( |    mov     es,ax; E: |, `% L' a
    mov     bx, cs5 `' |- }7 M2 c* {, w
    lea     dx, int41handler; O; ?, \9 B$ j# z1 h
    xchg    dx, es:[41h*4]
$ Z& X; j2 y0 ~    xchg    bx, es:[41h*4+2]1 `7 ?$ C& }9 |! w3 w. Z% i% c3 d
    in      al, 40h
" J' I7 d7 k6 w    xor     cx,cx! p$ B3 f! I& s, S7 S
    int     41h/ h  V% ^* ~- y+ l5 M$ ?% r( h
    xchg    dx, es:[41h*4]- }6 q% l- D, _8 O! ^# S" j
    xchg    bx, es:[41h*4+2]) u! C" ^! W# h4 y, y0 ?
    cmp     cl,al% W! A! p# N& P; j
    jnz     SoftICE_detected
. R; S" k7 d" {. V( ]8 G) ?6 [
) p' W4 Y( p9 Z1 i5 M: x5 ~_________________________________________________________________________! D7 b+ f7 E! s& N( X
+ t8 O! ^; Y7 R3 T/ t6 a
Method 07) K) ^4 a; U/ T: P; l9 S( X4 \
=========+ X( j( Y: S) X3 ]: I2 e% m

! v0 Z0 I; {; H. g6 j+ v% LMethod of detection of the WinICE handler in the int68h (V86)# e: r% }, Z: Z) a8 n
/ K0 j# u% G6 r2 t2 A
    mov     ah,43h& C% X0 P) y7 R8 K, N0 e& l' p
    int     68h
7 {* z% X3 L8 @/ A- |    cmp     ax,0F386h
4 J6 V5 R& R, }2 c4 ^    jz      SoftICE_Detected' G; t# Y4 _' T/ @& C% H
, G% @- A- i/ u# k0 A, B! P
" s+ y, y) G7 t! H4 F* U, C; d
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: l  ~' b: M4 D6 r   app like this:
4 u2 J1 q% y$ l  q( i2 Z/ O1 ^/ Q3 ?" @0 g2 P) i# W
   BPX exec_int if ax==68
! n' M. M5 G6 T# v# p" u1 I   (function called is located at byte ptr [ebp+1Dh] and client eip is* k0 p: K7 w5 D% F) m; y
   located at [ebp+48h] for 32Bit apps)  g; {+ `- h. y) W0 b( K
__________________________________________________________________________
' O' K7 A3 c. q0 ]* s6 m/ [3 s9 H
" U$ }7 C! a2 j+ g6 V  r* _
- t0 J. R6 S2 X3 I4 hMethod 08
. C9 b3 C/ h  a% U7 O3 z=========8 L# ~( r' H& z4 Z& e  p8 o
  I% }& r% v. s2 t
It is not a method of detection of SoftICE but a possibility to crash the2 P5 }/ }- I! d( f$ ~; G
system by intercepting int 01h and int 03h and redirecting them to another
: T7 F2 w: g: P: f7 uroutine.6 c- n8 j8 b! A5 \  X" h$ I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' P9 u# J: E1 l% h# a; p/ m3 Xto the new routine to execute (hangs computer...)2 N1 g( G$ e# J; x& P9 W

( M) A/ c* b# _( G( Y+ M- ~1 v! s    mov     ah, 25h
6 w* ^2 ~. k" |" b: e$ B    mov     al, Int_Number (01h or 03h)
+ p. [& f& v1 b) b% K2 N' O    mov     dx, offset New_Int_Routine6 W; _$ Q; {9 a) E0 C8 l& d
    int     21h
2 r/ K- q) B  W" Z3 K) u% B; ~0 [5 ]6 z- W5 S) }
__________________________________________________________________________& Q0 R6 e- b# w/ @, [" d& {& H0 ~8 g
. D  D4 C( N, B( p* k( \" e# F
Method 092 ]! s- A# X9 Z. j3 `# ~" r
=========
: V* _8 C' N, ^* _1 F% T
9 Q3 ]. u9 ?/ ~5 JThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 p2 \  u4 E5 o# Q+ zperformed in ring0 (VxD or a ring3 app using the VxdCall).; x$ Y  S9 M9 @  w+ w% h+ `8 j# `
The Get_DDB service is used to determine whether or not a VxD is installed
2 K9 ]" y% H1 g7 x; c1 Wfor the specified device and returns a Device Description Block (in ecx) for% `7 `8 _  |$ [7 Q
that device if it is installed.
" |, v! @; N5 }
- ~$ l" B0 B' S6 w) R: p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID, j7 h* ~- L) j  Q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% z1 s$ E# ]8 x5 T. J" H
   VMMCall Get_DDB
8 S3 a' x  u8 I   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
" L8 @* D' a3 U; K& M1 J2 @% j8 R  `
Note as well that you can easily detect this method with SoftICE:
+ ?( `8 H# R% `! }4 Y, a! F9 Z   bpx Get_DDB if ax==0202 || ax==7a5fh: D0 ?5 w; L+ I8 I4 `$ K

& H8 a6 p2 v( K__________________________________________________________________________5 ~0 S* g, p9 Y

3 u7 y. N& o' FMethod 10% e5 A' W  O% Q+ L  l' w! a0 K2 L
=========- I6 l& Q: o" z  R
: V2 I8 `8 q' C
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 l+ H; |) H4 F0 z& V  SoftICE while the option is enable!!
2 C& ]) K' l' @6 a- R% U9 R; r( L- [( q% I3 L
This trick is very efficient:
9 J3 \% c9 P6 O) a" ~by checking the Debug Registers, you can detect if SoftICE is loaded% y& X7 e+ D! w! ^5 M8 A; h
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if# @% H& Z# D8 g+ |  h9 [0 c
there are some memory breakpoints set (dr0 to dr3) simply by reading their
% d* l" u  V  l5 Pvalue (in ring0 only). Values can be manipulated and or changed as well
4 f! C1 d) M# f5 A(clearing BPMs for instance)
' |1 y/ f- K# g" V2 \
, f% a$ z- f  G  E+ K8 L__________________________________________________________________________
) Z9 A9 G- }2 B1 U& s+ _" A( \/ ~* n7 r  `- d. u
Method 11- W: L: [  d9 [  U: {, z
=========1 f# [& q- ~' C: J1 r
: Q, z; ?$ i/ U4 f
This method is most known as 'MeltICE' because it has been freely distributed
% P$ D: i3 T) o6 Kvia www.winfiles.com. However it was first used by NuMega people to allow
+ Z1 \. `' U3 V  p' u( [4 G! DSymbol Loader to check if SoftICE was active or not (the code is located, F8 E2 \" R. _- b# I
inside nmtrans.dll).
9 t2 A1 d4 Y3 {: q& t  R
; g6 U5 a" |& y3 PThe way it works is very simple:
" {. i7 ~# N7 k7 Z. XIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
' k  r1 F& T  C4 YWinNT) with the CreateFileA API.; f" k& b3 U+ W6 ]& L. \
9 k7 ^+ |9 J# z& w- J
Here is a sample (checking for 'SICE'):% ~" C+ @( D! r+ v9 k

( |) F1 @% l# ?& V( \BOOL IsSoftIce95Loaded()
3 s# i8 H: d* d6 w! i& b5 I& d{& V  M& v3 R! K
   HANDLE hFile;  
8 g7 p# P, ^1 |   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% f( h6 e- N; k2 b  N- o% N                      FILE_SHARE_READ | FILE_SHARE_WRITE,, b: q1 _# b( O6 v, @
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 e+ @& {' y5 R! c. R8 a5 L
   if( hFile != INVALID_HANDLE_VALUE )
2 I5 E# t  @+ t4 e9 G: R3 S   {! v9 W1 |$ F* P* _
      CloseHandle(hFile);
" w' J' X# k6 H      return TRUE;0 I3 j# S9 w, O( v0 \
   }
. d6 L3 j( ^5 I" S   return FALSE;8 P5 p4 Y% x+ X+ n/ g) K
}
/ m" C3 _8 p" {; M" R' A+ v: b/ P' I& u5 @% O! e" E
Although this trick calls the CreateFileA function, don't even expect to be  e/ i# @- Y0 d4 o$ c$ j) O
able to intercept it by installing a IFS hook: it will not work, no way!; ^3 x5 P# E( R! }& K* ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F4 i, ^; r5 a. N2 J3 D- y$ R) H
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( p- V# K+ Z) l6 h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ _, R" p$ H+ Q/ \4 ]$ b4 K/ J/ Gfield.
% e) Z( w9 t' @  w! CIn fact, its purpose is not to load/unload VxDs but only to send a / f6 Z1 E" [$ _9 G1 l
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 l+ L8 f7 ?& s6 Y* oto the VxD Control_Dispatch proc (how the hell a shareware soft could try
! Z6 V( j' R7 sto load/unload a non-dynamically loadable driver such as SoftICE ;-).) g8 {% x* ?. Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
( z% O! j0 W9 f( a: p! r# m7 `3 Sits handle to be opened and then, will be detected.
& N. @* k, q; M: }0 Y( w1 X3 d& RYou can check that simply by hooking Winice.exe control proc entry point$ }/ F! f5 Z# F+ V1 K! j
while running MeltICE.+ F5 c0 c% d; Z+ g
5 h5 O' c/ I% I) G2 {: s/ Z/ F

2 H4 ~- i# k4 L+ x: v3 H+ E6 W  00401067:  push      00402025    ; \\.\SICE* [. _4 p9 q3 ?4 U) W
  0040106C:  call      CreateFileA
9 k8 l# u. q5 ^  j  00401071:  cmp       eax,-001) l! x) b  O3 p9 V* o' q& w7 B
  00401074:  je        00401091
. u: x* Z( z& _* l  g. {( q
1 m# _9 r& Y% J0 z
2 `+ M& e$ t* N) t6 DThere could be hundreds of BPX you could use to detect this trick.& k1 [0 ]- d# s+ ^$ ~
-The most classical one is:
' h6 e9 ?  t) D$ N, M5 w, B# q, i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. X- ^/ ^0 j( [7 b
    *(esp-&gt;4+4)=='NTIC'/ q  b# t! s  @6 S8 x- w+ U
% u: }7 S4 T0 O: R" i; {) W  {
-The most exotic ones (could be very slooooow :-(
0 A3 O' k, E$ s# ^- s( I   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ Z5 X1 s' ?4 p7 G+ l" E
     ;will break 3 times :-(- i2 t+ S, w' ~0 H$ X% I3 e: u
: I* z; V! P8 E! m. k
-or (a bit) faster: % k: y; e1 I# q7 U! v6 P' n6 H* r
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" r4 c+ N& L3 x( |
8 t/ A9 L  U" g9 X1 ^# X. r5 z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& Y. m% R9 u' R" `' Z8 W     ;will break 3 times :-(! i" G  V0 S$ _5 k* `$ z

/ P4 Q2 i. l" j0 Y8 I-Much faster:% x9 k, ~* y8 u* }5 t4 C( r. W
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 a- `2 f7 ~7 |- p

2 C" q# z6 }6 Y& ?3 m6 NNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ A: `' A+ j3 L% z* }& q, x  l9 ]; qfunction to do the same job:
' v5 R/ y( L; c% w0 G
5 t* a5 M. f1 L* Z3 C" W' G   push    00                        ; OF_READ
; k& O" Q/ h4 A4 k+ {& `$ c   mov     eax,[00656634]            ; '\\.\SICE',0
, x1 v0 q- J, f% V' B   push    eax/ e  z3 ?+ M/ u' A# i: j0 N
   call    KERNEL32!_lopen1 u" r& @" J& \4 [1 n2 O
   inc     eax3 P* G* k8 o$ A6 x3 G5 r6 g
   jnz     00650589                  ; detected
) G! m& Q* I7 {# d# D; G/ B* I   push    00                        ; OF_READ
1 n7 C, W; p% y* `   mov     eax,[00656638]            ; '\\.\SICE'4 E' W# i2 Q4 o6 Q( m
   push    eax. I: M7 `7 o' D3 k; t
   call    KERNEL32!_lopen
* h0 S7 L$ b" t, ~   inc     eax: e) g  o- t8 Q& ~. n6 t( E
   jz      006505ae                  ; not detected
8 T  F' ^0 T4 d) F* n5 K  o) H
4 f+ Y2 g  C) o3 B3 s! b
5 w  [) h8 C% d& K& e__________________________________________________________________________
5 t7 F% O2 S. p, C* M, O, a2 _/ T" j; c3 q# L# p3 B, l) W
Method 12
* d. G, v+ l! v* ~( u+ Z=========+ A, A' e- \6 G

3 m; N( [; [. ^1 C( y3 Z. [7 XThis trick is similar to int41h/4fh Debugger installation check (code 05% v0 m# \; [+ B6 a+ Z; K
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 }' _( o4 u" a* |. t4 qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 b/ X" B$ q* m6 ]! r- R
+ h" v5 R4 b* Q5 C& o: ?/ q; V   push  0000004fh         ; function 4fh
& E2 E1 J) ?% x5 J   push  002a002ah         ; high word specifies which VxD (VWIN32)- N: O, i1 i, J, X$ m
                           ; low word specifies which service) u$ m0 U4 _2 Z6 p. X/ i0 I8 E
                             (VWIN32_Int41Dispatch)
+ @0 a  F: a  v   call  Kernel32!ORD_001  ; VxdCall
# Q2 D0 b& {1 f. [% z   cmp   ax, 0f386h        ; magic number returned by system debuggers/ l( Q! K8 q3 a$ ^, O$ \9 H
   jz    SoftICE_detected
9 F: K6 H+ F' s+ Y* j% ?& h1 n) z5 O; t, ?) `
Here again, several ways to detect it:
- s$ ?) Y! X0 L* g) R  ]. ?
/ U' z9 v0 H) z8 i. `: g# V; W3 u    BPINT 41 if ax==4f
4 `! ^; @7 f! }) `7 X' e1 J' H! A1 |0 Z$ e( S1 Y
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; y4 p4 Z/ |* w: [* L# g5 m7 m7 }4 Z- O! A
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  P3 i- T, y0 D7 M0 O7 E

5 x- |& X3 X# T6 x    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# k2 o* b" @: E3 k& n6 ^

) K6 v+ P* O9 G3 U6 H__________________________________________________________________________1 t$ ?! }, `; {8 O

( U/ A' F- h; C) oMethod 13: y9 w' T' d, c3 ^
=========- X2 w/ Z: [6 c7 k
' }& n$ b/ C2 c* b& H: `
Not a real method of detection, but a good way to know if SoftICE is1 s* h3 F) L) h3 p/ m' c7 v- \' _
installed on a computer and to locate its installation directory.5 O* G: H1 Z' S
It is used by few softs which access the following registry keys (usually #2) :
, T0 f- `+ f# I) Z6 F6 q. h% O" n
/ k5 {, X3 A0 P+ \% C: }2 n-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: F# u% j" N& P4 L. ~1 l\Uninstall\SoftICE
& I  O8 \- x, w6 i6 x-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) A$ A- H6 z8 z  y2 I. `4 x: q5 W
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 D+ |3 D- D& G5 h+ X" y. K/ s
\App Paths\Loader32.Exe
0 r- t5 \% H% Q1 W  S
  U. N! t; _$ {  U
6 B. Y( j; D1 r# Y+ K) I  V" p( ANote that some nasty apps could then erase all files from SoftICE directory6 q/ m$ w- Z2 L  I, ~9 S  Z, n
(I faced that once :-(! O) U* f* Q0 f1 p

+ c& q& [( g' R9 U  S+ Y. C& ^Useful breakpoint to detect it:$ q/ \) T4 W2 W
- E7 \6 A" K1 _' t
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'9 C6 j; P$ K+ n7 N* S( ^, L. B- @

1 T6 F0 d; @* z7 c* S# A1 F__________________________________________________________________________' a. W. Z2 R  l5 i
: q' L6 c9 X9 ~2 K, D% e2 {

5 t& x" g% F, F+ d4 F; N" \Method 14
4 [# Y) P; K! P7 u3 d=========
  v+ Q- K) w4 @, Z
5 D# t+ L: p5 q$ d( QA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* @& `' M7 l  T9 \0 A- @
is to determines whether a debugger is running on your system (ring0 only).
% S' ?* x* I6 W4 e6 j9 \. E, p3 {: Q% h9 I" ?8 w
   VMMCall Test_Debug_Installed* `# d- E7 E  s( X+ o
   je      not_installed
3 E$ r. F# X" F8 A1 r# E7 y0 \- F1 m( w3 r
This service just checks a flag.9 v! w( Z- J; d
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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