About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% b+ k: ?1 H) R1 s9 Q& s" P
<TBODY>+ w* @% N9 U( }; a
<TR>
0 u+ J5 ^2 e0 z- h* ^' y+ E' S<TD><PRE>Method 01
6 G2 T" h) ^& s. F$ a4 P$ |! I=========
2 r9 O) P2 g! X0 ?7 A+ L4 M' h
3 ^- A- N! b5 }/ y# {% VThis method of detection of SoftICE (as well as the following one) is
% f3 Y8 `3 |4 K( V. i, |$ Rused by the majority of packers/encryptors found on Internet.
$ Y8 E' W$ ]; L/ xIt seeks the signature of BoundsChecker in SoftICE
  }- d5 k# W; g! [( z- w8 _) l% E7 h/ O2 t* F* V0 s; K
    mov     ebp, 04243484Bh        ; 'BCHK'2 y1 N3 H$ s6 w& i9 \5 `
    mov     ax, 04h
5 ?. V0 |% z! Y- l1 _    int     3      
6 ^/ A! b7 p' S+ e& C2 K    cmp     al,41 E9 h' O4 Y- c# t% G# f& O/ Q- @
    jnz     SoftICE_Detected
8 @" `% k: U7 Q. y- ^+ }8 {: v: x1 M  z
___________________________________________________________________________0 M  p- a+ N2 S: r( _5 y

" N9 r: b4 j) a' v. l- S  u& W( eMethod 02
+ F+ v! F$ i1 x=========( m9 a7 L7 ], k& p, E. s+ t

- X$ ~8 N% \9 j5 ]* |# u! DStill a method very much used (perhaps the most frequent one).  It is used( P" C1 w0 `2 U8 P! b( U# X
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
& e: _! C6 f/ E6 y, T) U2 {) X  wor execute SoftICE commands...
% l6 C2 P$ x4 ^' DIt is also used to crash SoftICE and to force it to execute any commands8 v( C/ P* p2 S! O0 L1 y
(HBOOT...) :-((  ; c& T: s6 X; ?3 O4 T( m

( k. D4 C" E4 S; g0 o3 X5 n' }' pHere is a quick description:3 G4 H9 ?* h% \% f) ^; r
-AX = 0910h   (Display string in SIce windows)
' {9 p& s: h$ W2 i/ T8 Y-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 r$ p6 s! O* w6 C
-AX = 0912h   (Get breakpoint infos)
( x/ r0 Q3 S- N8 b$ m7 I-AX = 0913h   (Set Sice breakpoints)
: E) `" u1 N- @- r: f/ o8 \9 Y-AX = 0914h   (Remove SIce breakoints)
% X4 a# K# N! ]/ |* T, Q/ U" ^6 s: I4 `! Z
Each time you'll meet this trick, you'll see:
2 H) `6 x: W  f" x, ]; f. @) A-SI = 4647h& @% p+ a. j6 n! H6 e6 s
-DI = 4A4Dh. L; c8 H+ X$ G5 Z( E7 ~
Which are the 'magic values' used by SoftIce.4 F' Y8 `0 Z  i; _7 z  x3 ?
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! }: C8 k6 ~7 n4 C! b# }6 T2 B% O2 O& M8 H$ t, X8 |9 i
Here is one example from the file "Haspinst.exe" which is the dongle HASP
& Y# K9 P: z3 t1 R& NEnvelope utility use to protect DOS applications:$ C6 t- ~1 S2 n7 a& j0 d. V8 ~  |
' K+ s* X, d8 h" B" C

6 v, X( r5 e7 |3 N5 G$ h4C19:0095   MOV    AX,0911  ; execute command.7 S# J0 u6 u4 \: v) F2 ]
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. \" V) }3 ?) E$ C
4C19:009A   MOV    SI,4647  ; 1st magic value.! v# u# n$ }* _: |
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.' M- h' O' B$ {* @
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" }) r$ o; t$ k; W" }4 B8 {' \4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: {  J0 O% F$ v; c- |4 M4C19:00A4   INC    CX
0 K, X2 {+ K9 w" k4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- W( {- _# y8 ?2 W2 i5 d' t
4C19:00A8   JB     0095     ; 6 different commands.
$ q3 L  Y; o2 q; p, S4 y! {7 e4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 z& u+ U2 j5 Q! K" o5 x4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)+ f: ]' @4 M. ~

8 l, V" U" i! Z& d9 z( L: LThe program will execute 6 different SIce commands located at ds:dx, which% m! h' g  |* b  m/ q
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- J( m2 h. W7 T) a& |5 _8 s
0 q% D. A0 S. P. C* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.; Q; j4 W; C, R* w( J1 v& T
___________________________________________________________________________
2 O3 l' F- G1 R& U
; k) O+ H$ o! C, v/ K% K1 u) P: W5 Y! I4 @
Method 03
. G( Y, i. g5 F6 w- i/ v=========
, m  D6 R+ {% K) Z( D( g4 b2 K, Q* F1 y' e
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 x  v# x6 u: i
(API Get entry point). K+ d1 B2 O& j7 L+ ~& W% _
        
, w2 Y  b' c- R, n6 i& x2 E$ q/ M, C$ F3 e
    xor     di,di: B8 n8 u, T2 R8 P+ m# ~
    mov     es,di
* I1 S9 S- Z  ^! |# m& E7 R" [  n  P    mov     ax, 1684h       8 e1 z$ E0 k* t
    mov     bx, 0202h       ; VxD ID of winice. {! x- G8 N% Z# d0 y) I
    int     2Fh
; F% `' k+ {3 n    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 n, N  Q& @8 {    add     ax, di
- t3 J3 z% ~9 z1 c" Z. C! Y. y    test    ax,ax
3 S, Z) r8 G5 E" B    jnz     SoftICE_Detected
/ Z8 V) l' U9 L7 E4 ]$ v, w" o3 i
: H! n8 _$ H4 k* Y+ V) ^___________________________________________________________________________
+ \+ G4 e* r- Q' }$ H0 t/ a
3 ]' W% c) F. `/ v6 q# S$ EMethod 04
( ]+ T" ^6 o8 x% `  N3 S=========! Z& U4 A7 p: v4 j7 ^2 |
# e' j4 i9 A* g' |) b6 ~
Method identical to the preceding one except that it seeks the ID of SoftICE
. |6 i' O: J3 T$ u3 jGFX VxD.
: t* g; D/ j" E# H4 Z/ i
( J) a% t& F8 W5 A) z' [4 B$ ~( U    xor     di,di
' Z3 J! A5 p( p8 D6 s- \* ^( O0 ~% {    mov     es,di+ D  ]# w6 I6 P# _" s0 f
    mov     ax, 1684h       + W, s/ ]# V9 ]' t( N
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 E) k0 \, k1 j3 h$ m2 F    int     2fh
1 ^: r& V9 ]. x( `! _% D    mov     ax, es          ; ES:DI -&gt; VxD API entry point: Z( G3 D! _# G+ K; r% m/ q0 R
    add     ax, di
0 Z! G4 x; T4 ?$ f3 H8 v    test    ax,ax
- h5 A+ L, H3 G/ r" Q) P+ h    jnz     SoftICE_Detected
1 h# ~6 s4 |8 `/ v# y5 U( J+ h* Z" s  Z$ J7 d
__________________________________________________________________________9 Y  C/ I1 A3 J' J8 H( u9 J2 v: Y

5 o" f, a4 I6 O0 F# E. Z) g8 M! C& B! X& x1 Y0 v& B" i4 \$ d
Method 05, c" X" E) R/ h! x- b
=========( [& p' e: w+ l$ P
4 U8 V( B% z! L8 y# M0 `
Method seeking the 'magic number' 0F386h returned (in ax) by all system
8 [3 d# u/ h* G: mdebugger. It calls the int 41h, function 4Fh., U) p% p5 H6 T; S+ W/ m4 c+ `
There are several alternatives.  
0 W4 {. Q7 ~' e( b0 \% \0 b2 S7 {% z, ^3 q4 |4 b: D
The following one is the simplest:
! ?- X5 }9 @+ q1 Q4 ]# a: t. \4 F
    mov     ax,4fh3 s2 F3 q. C' o$ X2 ?
    int     41h) G, W  s4 z+ r( j: T: J8 c! s5 x
    cmp     ax, 0F386- u/ b7 G1 k3 E' y3 F$ ?
    jz      SoftICE_detected0 r# o; Y: J* Y! J7 g& a; x( s/ C
8 p( R. W0 l: a- p* |0 H/ ?: G5 {9 M
+ t/ }( R3 U6 A2 z6 v
Next method as well as the following one are 2 examples from Stone's * W0 f; t! y' m# i* V1 ~
"stn-wid.zip" (www.cracking.net):& x4 J# f6 d1 Z& a, R6 G1 v
5 y; Z! S7 e# ^( p
    mov     bx, cs
* \# m) D) y; w+ Z( S    lea     dx, int41handler2
' ?, g, i  {% N+ }3 a    xchg    dx, es:[41h*4]
% W" Z7 _; h+ |9 n    xchg    bx, es:[41h*4+2]
) Y: ~! ?7 O* _) ~2 d1 [    mov     ax,4fh
. `' }* a, o) z% }: w, g9 p    int     41h$ b7 v7 R2 g" M, l5 m% R. q5 _
    xchg    dx, es:[41h*4]# Z( t+ b6 ?5 ]3 ~2 P
    xchg    bx, es:[41h*4+2]
) X( o* L  l' C. J4 ?    cmp     ax, 0f386h
+ }4 S+ H* Z  }3 c/ G, X    jz      SoftICE_detected4 `' g5 w+ P( s3 |4 e. c2 K: i& Y
: L  c" K/ p1 d7 R2 D
int41handler2 PROC- n- v3 d+ Q( E# p2 l/ f/ d
    iret( c( }/ ?: ]5 W; T: b
int41handler2 ENDP
% l3 g* [2 y/ {* x: B
$ \# u* S+ y$ i% ~' N, N
: |' L% b8 l: j0 b  x$ x_________________________________________________________________________8 g  Q) Z4 Y% X. z$ d8 h' y" H8 a

/ r5 ^$ A& |: y$ o4 F1 |2 i* }8 C) h# y( k" S* B/ L
Method 06
. C: k/ O, e( k5 t/ }5 i* o=========3 }- T$ \0 h' W) w' F4 H( u; {; U
0 ^8 n& B6 ], |' G

2 F& m' _) Z* [! Z  m: |2nd method similar to the preceding one but more difficult to detect:
$ M  _$ n" Y" n1 n0 u) j- b* R% w
  C' `. \) I. W% f' ]& c; E; K* k5 Y7 ^" e! L0 J9 o6 n
int41handler PROC" R) P+ l1 F+ T8 Y7 i
    mov     cl,al* O% q: [$ ?3 O9 W. C2 x% J
    iret/ _  W; M  }! Q2 Y) _
int41handler ENDP0 ^% V1 e, W. m5 W6 Y' K+ B. L+ u; X3 J- `
5 G* V( ~$ K8 N) ~( z8 S7 ?. F

( {8 M( p5 I4 c# Y! k% B: j/ c    xor     ax,ax/ F7 e" w( X9 d/ H0 H: l6 D
    mov     es,ax& \. k3 C' }* C+ ?1 Z% L6 G
    mov     bx, cs. a2 i- i% h- i5 ^! W7 h# h
    lea     dx, int41handler9 ~* I) U8 r0 W3 y( J* C
    xchg    dx, es:[41h*4], l; m- H# U9 P' T3 I
    xchg    bx, es:[41h*4+2]
6 O/ c; o9 A/ E; u. t/ H    in      al, 40h% `4 s: P0 c; ~, b( [! J
    xor     cx,cx/ V" S% V, g# n& O# b  i  U
    int     41h6 v: G! k' z7 U0 n
    xchg    dx, es:[41h*4]0 f' ~6 m& Q( W4 S
    xchg    bx, es:[41h*4+2]3 I, }# [, l8 s5 z9 I' G- o
    cmp     cl,al# U: r/ E/ w. k7 |( o  Y
    jnz     SoftICE_detected
; G2 W) M# a: O' c1 y% i" q! H$ T- H& G4 V" ~5 E! Y7 ^
_________________________________________________________________________
" O# Q0 z* v6 ^! U/ a3 k3 c: L
Method 075 N  u" s+ }, ]& X2 c( _+ E2 x
=========* H+ Y$ k* v4 S0 |! P5 b

; F& Y! U" _9 u7 B, WMethod of detection of the WinICE handler in the int68h (V86)& J* U: F7 Y- y7 P' I

9 W9 `5 D0 Y7 ]& t    mov     ah,43h$ }) y2 z% T, d8 `, u
    int     68h: Q% o, Q5 D. ^1 a1 T
    cmp     ax,0F386h; L- R3 U) V/ k5 y+ `- p
    jz      SoftICE_Detected3 I+ z* ]. d8 D. x$ @
5 c* U5 X/ F/ f+ X5 d: l8 q
+ M5 x: z- i: f, ^6 t
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, \( T$ I. M. Y+ x1 l* D/ z
   app like this:- x6 K* ]) _- d! C0 V" O
1 }$ I( ^. \" u( c2 E" q9 F" P
   BPX exec_int if ax==68% p0 R( {% h- ~* w# b2 ~$ M
   (function called is located at byte ptr [ebp+1Dh] and client eip is5 n- S& M* U( h! X
   located at [ebp+48h] for 32Bit apps)3 U5 Q. s! b) E; N2 u0 M4 d
__________________________________________________________________________
0 [/ x) O$ L5 P1 |7 I  w1 Q
" c/ A! H0 T( Q( u! p
2 i3 W# A$ `$ I% MMethod 08
8 O- _% w4 U. _: C7 f=========- H. ~2 U; T1 K& C& l

, [6 Q# q; s" t8 F* c$ _It is not a method of detection of SoftICE but a possibility to crash the
* ]2 I* ?" Y6 J. X# isystem by intercepting int 01h and int 03h and redirecting them to another
- s$ z. v, w8 \1 Kroutine.# S/ v( A7 v( z; ~* l4 P" }7 I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; Z# T/ O! ^% j  q+ \$ ]to the new routine to execute (hangs computer...)& {# c% p9 v) Y) H( e% p
. Y1 _8 o# W& \8 s* A8 A5 {
    mov     ah, 25h  P4 Z2 h2 C- G0 `8 S
    mov     al, Int_Number (01h or 03h)4 _* x# ?( u1 u
    mov     dx, offset New_Int_Routine
- K. Y7 V: k0 _% N! U. G/ c    int     21h
" C8 W3 Z3 \9 i8 c. J1 J6 Y6 Z8 i4 ^% y- o) Z) i
__________________________________________________________________________" Y% M" E- ?5 ^  X0 j7 G* f
7 L1 z! G7 k6 `5 d$ b) C: H
Method 09( C0 s  @! `2 Z
=========1 |3 \5 p: d- P* \$ |# F, A/ P6 `
" r) _4 I, z) t' C0 V; \6 X
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only# M0 Y/ d* g2 L6 ~7 w
performed in ring0 (VxD or a ring3 app using the VxdCall).; l! T: Z' x$ M) B  o- V
The Get_DDB service is used to determine whether or not a VxD is installed
! i: L  a. n9 Nfor the specified device and returns a Device Description Block (in ecx) for* X, L) k. ]+ M: t# c! g/ a
that device if it is installed.) g1 Z* g; n( @6 _
  S7 q+ h7 A  t/ e, S
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& L! F: P' F$ |0 |1 `: W
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ c* ?8 M% x  S6 @
   VMMCall Get_DDB
$ O$ _9 O8 ^/ S4 j9 b) b+ L   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
4 a6 ?9 P4 g3 L8 n5 x; s* ?# g7 j* Z) n8 `7 O
Note as well that you can easily detect this method with SoftICE:* E% W5 J5 x" _3 c& P% Z
   bpx Get_DDB if ax==0202 || ax==7a5fh
  b9 i& Z$ ~1 V. k1 X+ k: N+ z) n
__________________________________________________________________________
/ g& s, E- X- Q; J+ C" R. T  S  e, I
/ u( e8 p3 S' F1 UMethod 10
# i; v# `7 A: \# f+ |! u" O! I=========6 N! y; p# D4 ~: {- V& P
0 d2 N( G1 J8 `3 x( I5 J
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 r: H  F7 r) B. x
  SoftICE while the option is enable!!$ r% G& e6 i0 |) i6 T% d

# y' h7 m7 v# `This trick is very efficient:2 H( D6 U4 S" ~& Z/ C+ J& g( c$ z1 J0 e
by checking the Debug Registers, you can detect if SoftICE is loaded% b+ F& X6 X7 r
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if7 `6 Z0 K7 L" Q2 }: o6 Z
there are some memory breakpoints set (dr0 to dr3) simply by reading their+ t7 w' Z9 |/ b. q1 q2 t
value (in ring0 only). Values can be manipulated and or changed as well5 D. u6 ?( z- \5 L. g: K
(clearing BPMs for instance)
  t+ A3 A5 W: r% S: ]- h) D% P) L& M& G0 X% N! g
__________________________________________________________________________
& f; p# ?, s8 G
: B' A. ~: A3 i# {# EMethod 11" d, R1 f2 Y: {2 L& H8 Y2 b2 ^' U
=========
5 w/ ?4 w( h, E" {3 _5 R- `7 H& [: \7 U3 v
This method is most known as 'MeltICE' because it has been freely distributed. b* I6 ?1 D* L* G: F* e  B" T
via www.winfiles.com. However it was first used by NuMega people to allow
2 R% z8 X( c+ s9 C9 O' XSymbol Loader to check if SoftICE was active or not (the code is located$ [* G. r0 @1 c4 ^$ A* J' f
inside nmtrans.dll).
+ I* @1 @/ S" k# C; _6 h6 f* ]# G( S6 X
The way it works is very simple:
8 L6 r4 y$ R  _. m6 HIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for6 d8 G5 ~3 O- u* o+ m1 U' C
WinNT) with the CreateFileA API.# k$ z! a1 f4 B* X

' r7 _8 f6 e; d6 T6 ZHere is a sample (checking for 'SICE'):
. k; a% b+ F$ T, s0 Y8 x% w4 `$ o, d( P3 F
BOOL IsSoftIce95Loaded()/ k* U/ Z+ s  ?3 q# L2 U9 [
{; y4 y1 L, ~! }0 R* O
   HANDLE hFile;  
5 {+ ^' \* a& s0 _2 D   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 _& M$ I- g) l1 @- P* u                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* z9 ?$ g# j9 a( h9 G                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
, H. I3 S; G  w& }" g  S! c   if( hFile != INVALID_HANDLE_VALUE )1 E" F: S6 N* a+ k- v: D6 V" Z. n! x
   {
. a% m) }5 E2 n8 E      CloseHandle(hFile);/ v# F" E2 C$ T4 y
      return TRUE;8 M+ Z, h" @! d1 f
   }( z9 [! }* D; U1 P: J( m+ r6 J% @
   return FALSE;
+ w6 y7 N4 e& X7 G0 T& R}
* Y0 p8 A' A- U) s9 z( _
1 E$ Y/ c: t# R$ eAlthough this trick calls the CreateFileA function, don't even expect to be
6 j: I3 _! E, ?able to intercept it by installing a IFS hook: it will not work, no way!  z/ d# e- N9 x+ |$ O8 Q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, H6 f" Y8 w7 Z" Pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function), x. N7 V2 Q! Q# Q/ P) j% Y
and then browse the DDB list until it find the VxD and its DDB_Control_Proc1 ^4 D# k4 V' A2 Y4 V8 @5 _
field.
1 ]  `" T; d/ z# i4 ]  hIn fact, its purpose is not to load/unload VxDs but only to send a / E: i, a7 S( q3 l: A
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); E2 r& o& \0 D; o8 ^" K, H
to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 ~3 f- X8 [3 `1 v2 w- U) Q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).' K+ T' F# h! I: r' @
If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 `* J9 Q. P, Vits handle to be opened and then, will be detected.& n8 }/ k+ m+ Z5 m
You can check that simply by hooking Winice.exe control proc entry point
3 d" H; O) _: ?1 c" kwhile running MeltICE.
( J$ V: D' q2 J' c5 z# t
) l, L' p8 I) y5 v4 G* N2 h8 N7 O6 i) E( h- [
  00401067:  push      00402025    ; \\.\SICE9 l  G8 ]. |3 W2 f2 f& L
  0040106C:  call      CreateFileA: ^  f8 t' W; m$ [+ K9 e
  00401071:  cmp       eax,-0016 \# ]1 v/ [0 G$ u2 i* V
  00401074:  je        00401091/ r2 P, d# X3 P3 A( w
$ k. _9 k! `+ d0 V

% Y/ Y& K( Q" P1 ^8 W4 eThere could be hundreds of BPX you could use to detect this trick.
4 \5 K  U! f, J3 h5 ]( Q-The most classical one is:
/ Q0 A; l  }7 S* X  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* w& `* h! s, b# ?8 f3 O    *(esp-&gt;4+4)=='NTIC'* w2 I( m- K0 D
+ q. A1 s/ U7 W; l. E& A. q
-The most exotic ones (could be very slooooow :-(
& X: C3 ?+ G  I+ K   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ J. ^3 n& ^' @
     ;will break 3 times :-(
% N/ b. Z6 @  T. }$ w. V* X, O2 g' A4 i9 {" |! Z# ^
-or (a bit) faster: % y' O9 i+ ?1 P% T+ o2 t  J( N. n% L
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ p1 V, l# f  ~$ V# O$ t# h5 P# ~) k; }& K5 J
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 c# f- a# ~% {: `! |
     ;will break 3 times :-() }2 [- B3 u$ a" n! R# f- J9 {

2 t6 j" V4 z6 s-Much faster:
+ f, W( J, _" ~% K4 Z# b* J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, g- q, i* Q8 s8 I) B; G
+ v# k0 u( \# p1 ENote also that some programs (like AZPR3.00) use de old 16-bit _lopen
- p, V: L& d, D9 \3 N2 P3 Gfunction to do the same job:* u. D; W6 q! Q7 @7 `8 L* ]
; |0 S: j7 W1 f' ]% e
   push    00                        ; OF_READ
: W& X- s4 e/ h4 [   mov     eax,[00656634]            ; '\\.\SICE',0
: Y' |! K3 h5 G5 @2 _) F   push    eax8 V/ B- {) s+ H2 I4 G
   call    KERNEL32!_lopen- T" F2 \5 o6 J" `. F% x0 D
   inc     eax( Y; d3 R- T  W
   jnz     00650589                  ; detected
# u; k) f2 h1 J" A8 i   push    00                        ; OF_READ7 g7 e. K1 }* t1 z
   mov     eax,[00656638]            ; '\\.\SICE'
8 Z! k0 O& W2 e: z% P   push    eax
* G, {9 M0 U) q/ _" B   call    KERNEL32!_lopen3 }& N+ X$ d# b" w; `
   inc     eax
- Z; l9 b$ q/ e+ B   jz      006505ae                  ; not detected
0 }9 y1 G; J: j' T; X3 F' ^% P3 g" O' d( ~* f4 A: j* r8 w- T6 d
, L+ c* `9 v( L
__________________________________________________________________________
. ?4 L- Z  o- H. n1 l
" I3 z4 ?: g" p8 X; _! c( FMethod 12
1 M1 \; Y3 v7 q' g# ~* b) d=========8 U4 K' C0 `  n- o0 J1 W

+ \; D+ }" X# QThis trick is similar to int41h/4fh Debugger installation check (code 053 ?+ o, g3 u# ~! \; z3 q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' y/ X" \' p' e3 Ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 O* g" b" O* u' X9 P" p

$ f3 [% |  ?. Q   push  0000004fh         ; function 4fh
! B9 u, i8 M5 e3 D5 d& Q   push  002a002ah         ; high word specifies which VxD (VWIN32); q& x" j1 D4 j7 P9 ]; E
                           ; low word specifies which service
( h# d: K$ s4 L  U                             (VWIN32_Int41Dispatch)4 u3 a7 a! z  M  B5 |
   call  Kernel32!ORD_001  ; VxdCall
0 d5 M% D4 c$ s6 b2 b" W   cmp   ax, 0f386h        ; magic number returned by system debuggers7 F* B0 K8 F3 o+ `
   jz    SoftICE_detected+ Z) B8 ~: O; A+ o+ x, _9 p  o- M+ V

9 R! C$ F) D/ c9 C# }; K6 G! ~Here again, several ways to detect it:5 ~5 B7 b& O5 _! D. w+ ~

/ }8 L  W# b9 h' h( S  g: }    BPINT 41 if ax==4f  v7 B; X7 ^" o4 I$ u4 p2 b- H
: C; x8 b1 d0 B7 M" E- o  B
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) ]% q( G$ W/ Y: I% A7 r
2 w8 v) T- J9 |4 ?9 U& q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. F: n( C0 B, p$ x' Z2 b" E0 k4 m$ O" g2 t% @8 u
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& p' B; A; ]6 m& ]

( Z$ Z3 {7 M& o$ t__________________________________________________________________________
& t& t1 N% N- M! y$ \9 F
, Q& o5 k" T  P- ^2 t. _" OMethod 13
) Q0 h5 z1 u$ k' E# h$ l6 m=========
0 w( g! w5 m9 n3 m1 h) Q, a4 I2 J* X) F: N8 N
Not a real method of detection, but a good way to know if SoftICE is
& K9 s( O- N9 c/ Pinstalled on a computer and to locate its installation directory." Z* q/ F  q* R4 o7 q7 I
It is used by few softs which access the following registry keys (usually #2) :3 y* K6 Q) T5 h$ N5 j8 M( o

4 L' h1 {: h% L. [-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ q/ l5 E  H( p& L\Uninstall\SoftICE
. j+ O( S7 {1 T  K# d; Q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 U# \' L5 V- q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 p$ }( o% u7 v9 K* r" P" u2 k) i\App Paths\Loader32.Exe
4 h; O( j% u$ B1 X4 J" L+ r+ {) N% ~/ M

; N9 U- n% h0 N2 t9 S; pNote that some nasty apps could then erase all files from SoftICE directory
. w. ?; I1 `* j4 e) X$ {3 M1 A(I faced that once :-(1 }3 E8 F2 U  i

" g4 V+ ?$ t6 N8 u% K5 |7 \8 I; S' zUseful breakpoint to detect it:
& }" X# J4 `" N5 n
4 m( x+ r) O0 p, F. d( y8 K     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  x/ o; G: R6 X3 W7 b& w; j2 A* F1 w! l2 J
__________________________________________________________________________
0 {3 a0 I+ }5 h1 `1 N) y9 I5 S& F/ V: Q

, s' {( N" @% N3 xMethod 14 / @, Y% b& [7 m& l" O& t
=========
3 \: f" Y, d. o9 R. A3 x  @8 s5 c2 L7 N! X# O
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 P0 j* w1 X: e$ Z7 V5 N0 jis to determines whether a debugger is running on your system (ring0 only).6 d; z7 D! S. [( E* v% M& {
" Z8 |# n& r' G( \1 i
   VMMCall Test_Debug_Installed
7 Q9 |- w# G6 c& b- Y1 s, c6 o" [9 n   je      not_installed
/ c) g! j- E6 V4 |* C; F! c! g6 H" A7 T
This service just checks a flag.
% h7 e, J& F0 J8 T( S! ]' ]; C</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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