About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 H+ w0 }& H$ K5 s" Y& W) h# [<TBODY>- Q8 S5 q" C+ i/ F- n
<TR>1 `7 p. f0 P0 j3 y/ u
<TD><PRE>Method 01
/ @* c8 g, v! _1 ?, _=========7 R; o8 |$ w" Z2 a
! J" m7 R. \0 X8 j6 E% Q
This method of detection of SoftICE (as well as the following one) is
3 q! w6 F$ b5 yused by the majority of packers/encryptors found on Internet.
9 O; |* Z# U  D7 V* j1 ^# K& @It seeks the signature of BoundsChecker in SoftICE& I3 D% `9 `) [; P9 A
6 N& V. H& C9 Y1 {& t- U3 Z
    mov     ebp, 04243484Bh        ; 'BCHK'' D* J, B; m! c0 |: j) T4 {
    mov     ax, 04h9 _9 }7 D( o' p3 y1 J7 @
    int     3       7 R; x; _% @4 }! c. }& X; @( E" c
    cmp     al,4
" Q" b7 f' u# P5 r& c    jnz     SoftICE_Detected* }$ C; Q4 w! a- }2 q" d; {

! R, z+ m% M* |7 L+ f/ s0 z___________________________________________________________________________8 G: ?1 \" ?/ ?/ K
4 E) m6 _- h4 y) Y& X) t
Method 028 ]/ G" L  B: T  t
=========0 j( ~1 k1 O! J# \1 V

7 H. X# u0 L  @Still a method very much used (perhaps the most frequent one).  It is used
; n# H: W2 L9 x8 z2 H, h3 r1 qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,. L( u" ]+ D5 ~3 ]
or execute SoftICE commands...6 Z$ F' R: V  l4 o5 i
It is also used to crash SoftICE and to force it to execute any commands! G0 P4 i' X. S  K
(HBOOT...) :-((  
( @$ ^4 s/ |& r- \2 u7 g
0 R8 q( }5 t1 H$ JHere is a quick description:' A0 p. W' q8 a1 h5 D6 i8 D/ z
-AX = 0910h   (Display string in SIce windows)
1 z5 k( _. @0 m-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 u) B) T" a2 [% s5 H- w-AX = 0912h   (Get breakpoint infos)" q$ F! n: ?" s$ L, Q5 S
-AX = 0913h   (Set Sice breakpoints)
2 g' z3 l: u/ Q9 a( K-AX = 0914h   (Remove SIce breakoints)
6 _& @% K0 }4 i2 o2 V( \7 z2 Y$ x+ A3 _
Each time you'll meet this trick, you'll see:2 B9 G. u2 G7 S2 ?0 S
-SI = 4647h$ V8 l5 O6 ?$ }% K
-DI = 4A4Dh  q* ^9 c: G# M6 a7 j' c" y6 _
Which are the 'magic values' used by SoftIce.
) A: F  b- G. }- A- ^8 d% mFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 A% K9 J* G1 T# G* m* b5 S
. N1 l4 k4 O/ e: K, i
Here is one example from the file "Haspinst.exe" which is the dongle HASP
/ ]0 {: ?" V- @1 E4 s8 REnvelope utility use to protect DOS applications:
( z' R2 {" h3 {4 v( `
' z' C' z+ _* K3 s8 f
2 n/ d  {- k1 t- O  f& K4C19:0095   MOV    AX,0911  ; execute command.
) _- \8 O* S5 w% T$ D, v8 z, g4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 `6 ?( K/ C' z8 b
4C19:009A   MOV    SI,4647  ; 1st magic value.1 Z, l  |, [  o4 h( ^/ O1 s- g
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.& Y1 g* @* N& F* ^
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
. p1 o! u. e# r, m' [4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# k1 [8 F* y: B, y( m3 x' e( T4C19:00A4   INC    CX
+ P) R1 ^% W. D' {' u% t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 ^: T/ C* a% H$ y4C19:00A8   JB     0095     ; 6 different commands.
1 q( G1 ~. p6 R) v8 [% N4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 H+ `+ A. d' E7 l; B# f
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 T( r/ W- W- r* Y1 y0 @  {0 ]4 e

( q4 M4 r/ r! Z  J5 _9 n' a4 H% KThe program will execute 6 different SIce commands located at ds:dx, which: {1 a5 M; v- K  p& v( S0 Z, ~( {
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! R; x+ \4 ?+ e

% {0 x4 c5 X7 O4 q' R, a. z; i* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, a5 y! U2 K. X% v___________________________________________________________________________" c+ D6 W4 s3 o% V
9 P. V% z- }& y" ]+ ?  t
: {6 L% `2 Z8 R: F
Method 03* U& H7 G+ b+ J4 s& z: r
=========
0 Q; W0 t+ n) V/ L7 j5 A3 o
6 y0 q6 Z: N: Z/ [5 k. [: ZLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, h4 ^5 z, h( p) e+ o9 r; Y(API Get entry point)
% Q8 @1 t% Z% ]1 e2 \' `        ' `% }  J' a* {% T, v0 I
* w" q; h7 Q7 u8 ~
    xor     di,di
7 e, f- `" s/ L3 F4 P    mov     es,di* v  P6 M. @* m5 q5 o1 s
    mov     ax, 1684h      
6 \1 \8 O; u1 l    mov     bx, 0202h       ; VxD ID of winice3 Q5 P, l6 n( D5 B. o% ~
    int     2Fh
' ]$ i! m/ J' E/ r: G    mov     ax, es          ; ES:DI -&gt; VxD API entry point) Z' ^! R+ F6 u5 I$ t: q0 t
    add     ax, di
, `6 K7 _0 ]; S6 O    test    ax,ax
4 ~& w( K& h) S, g, i; _    jnz     SoftICE_Detected1 L  u9 _! ?& J- M3 r

% ]- m6 d7 @; k2 T/ g2 C8 Q___________________________________________________________________________
' O. d2 k2 ^0 g
7 g; {8 m" E' jMethod 04# F! p; ~* S- h3 {$ @0 t
=========
! r. H3 g$ x1 L6 U5 G, d1 @" d; m( u
Method identical to the preceding one except that it seeks the ID of SoftICE1 s; m; u7 B5 O9 C" M
GFX VxD.6 C# Z; y% x# x4 ]
8 ^+ ?) k' G+ x) h
    xor     di,di! X- U) E4 K' p  i
    mov     es,di
5 I& J( n8 y0 U( D. M/ I    mov     ax, 1684h      
+ k% r# C8 Z) y( R7 W1 i    mov     bx, 7a5Fh       ; VxD ID of SIWVID; _+ i# ?) r# h; y2 W) T
    int     2fh
6 ]2 N9 O6 L6 @; i4 Y  a( f    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ v. q" m, w( f  T# o    add     ax, di
. d$ `0 t! K( P. a2 T    test    ax,ax& ^2 F" d, M" y
    jnz     SoftICE_Detected7 j8 d4 ~. `  ^% X+ M
' ]; l0 o2 C. Q. Y5 `" w
__________________________________________________________________________# V6 a: t, w/ {0 i1 Z

9 T) H, L0 |8 Q% v' u% _8 G0 _/ b& o. C" |6 A5 a
Method 05; n/ m- ?0 T# ^* S1 n4 M
=========& y0 _% v' y% A6 A, f
1 `% l2 Y' R" u+ L5 [2 R; ^
Method seeking the 'magic number' 0F386h returned (in ax) by all system
, Q/ B# R  S0 E3 ]debugger. It calls the int 41h, function 4Fh.% C  }$ p5 s* {
There are several alternatives.  
, L6 B* J, q' T" u* w
: v0 T9 ^; x8 c; jThe following one is the simplest:
7 @; X/ l' _( a" r' s
, ]# j- b* M) t. S' x    mov     ax,4fh
& n3 ~* Q, j: S- P+ D1 z0 B    int     41h: _. O0 A! M% s! C" g# L  a# `. `7 h
    cmp     ax, 0F386
/ {& z: E  u6 c! H0 X# [    jz      SoftICE_detected$ t' u9 _7 h: h- }. s

' |+ L# U9 `  Y$ o
3 K8 u$ L3 J1 l% HNext method as well as the following one are 2 examples from Stone's
$ a; U  W2 [6 Z8 P8 m4 h"stn-wid.zip" (www.cracking.net):
' d3 S, v# o& @6 o. ^2 q! x! D& H) E9 ?0 x" U0 L
    mov     bx, cs
+ B6 b  u# x4 _0 B    lea     dx, int41handler2
. K7 X3 @. G% \, \# V# I! p    xchg    dx, es:[41h*4]
0 f' l2 b. W6 {1 Y% H    xchg    bx, es:[41h*4+2]
& f% `6 }6 M' f" g9 U/ K# p" Y    mov     ax,4fh
+ ?6 F4 e5 ]# V% E5 t    int     41h
- G9 o& h- O2 l0 X8 L& k7 X( w7 c    xchg    dx, es:[41h*4]  D! G2 \6 P- `
    xchg    bx, es:[41h*4+2]
5 F( F- ?8 p: l, L: g+ q    cmp     ax, 0f386h8 m; H! r6 J0 d9 `
    jz      SoftICE_detected$ V& \  k$ p' y$ t1 ]

& G4 W2 R/ w% I, Y) I7 yint41handler2 PROC
2 K) _/ T) B  P; D, a    iret
; T2 s* @* ]" [* k2 sint41handler2 ENDP0 W6 e2 x7 L$ q
) Y1 A3 q' q1 \. l) c* J  D2 Q0 _5 U
4 ^9 v& b3 H+ Z8 }/ \0 L; u
_________________________________________________________________________
+ D5 n5 v4 G: V& ?! d) w0 z
$ c* F- d' A; Y' A: Y
# A( F/ ^! ?$ I/ F! {( jMethod 06
/ {4 e( y* P- w6 o* P; X0 c=========1 l, Y1 O5 Y- G
0 ^+ k$ |* }& x6 B6 v
2 N) L' j. W. T. i2 N0 o& J
2nd method similar to the preceding one but more difficult to detect:
' P, R/ E: N. P2 `) D/ r- N% Y  h- u7 m. K0 `  K( V+ V

% h! Z- k: o8 D: C3 [* N# Oint41handler PROC/ ~, f4 J$ f4 H" T! |+ }9 B
    mov     cl,al
- n; q# V7 j' k! l! L: }! ?4 J' ^7 i    iret% W* Y; `3 U( t+ {1 v9 P
int41handler ENDP
, R" v" u% G6 i+ i8 B4 c  `1 {* f. C- r" _! D& R
, a  g, j) L1 @
    xor     ax,ax
# u( _" |! e! c# e2 s5 P+ W    mov     es,ax0 d: w& @. R( R6 B, P# G
    mov     bx, cs
) ^' t- r0 }0 e& f    lea     dx, int41handler/ L; H: v! R# b0 m/ Q5 f8 X
    xchg    dx, es:[41h*4]
1 ~' ?- ?2 v$ F" a' v    xchg    bx, es:[41h*4+2]. J# F" g$ P7 J/ G- R( C
    in      al, 40h
- F: ^$ u2 {5 n) @3 ^; B    xor     cx,cx
5 b  p9 C4 D6 @8 {0 b8 V. S    int     41h
' M& w2 w& w5 R; f' R2 S( b    xchg    dx, es:[41h*4]
! {' a& z& Q+ X+ M2 V    xchg    bx, es:[41h*4+2]
# P, G1 j- _  G+ S    cmp     cl,al
* Q4 I0 x8 W  f) a9 `6 `    jnz     SoftICE_detected
* p% D5 H1 u7 G% }. e
" F$ P+ c( Z/ |$ C  A_________________________________________________________________________
5 V+ ~; R0 X; d' s, \0 \  `/ l' S
Method 07. ~5 i# P% a* r) R4 s
=========& U( b: T$ U& C4 Q: _+ B
8 l6 N7 P8 @3 Q! L
Method of detection of the WinICE handler in the int68h (V86)
  I. ]4 D2 q! p  s# }# O8 f. D
* v. }/ C- l& X6 P! B- l) g    mov     ah,43h" L  {0 p; h" O, d* N
    int     68h
7 M% Q* N9 B2 m; e7 E; s9 p    cmp     ax,0F386h% g" |  J+ s1 P
    jz      SoftICE_Detected
: m% E* C$ _/ n0 E6 j& v, j
0 t& k, p: `! D5 Z( W- h$ e# o  {! {: {# q4 D" t: q( v
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 Z- ?& ~* g$ s# ?5 E   app like this:
9 S9 C" N% H% D8 d( ^
8 b2 m3 S: d! O8 D' M$ r+ P' `+ {   BPX exec_int if ax==68* J+ ]: G. |& @3 G
   (function called is located at byte ptr [ebp+1Dh] and client eip is$ @; w7 X- k0 _3 o" r
   located at [ebp+48h] for 32Bit apps)
$ J& W0 A1 N! {' G' a__________________________________________________________________________
+ e7 e8 S: E' c
& W/ ~' }) Q+ T# P% R, _1 I7 A: Z& A5 g
Method 082 y5 ]6 @0 |1 y7 j5 ]& L7 P7 g4 }
=========1 r" ~1 {/ e  z$ R2 s0 f
2 H6 b5 V, V% F: W
It is not a method of detection of SoftICE but a possibility to crash the
+ ~$ I. A6 J. ]$ I5 U1 F. j. Lsystem by intercepting int 01h and int 03h and redirecting them to another2 q! g4 r3 D7 e; h( q
routine.
3 d. R7 r8 A. S9 A6 S* [3 sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points1 F2 I8 c" T2 s
to the new routine to execute (hangs computer...)
& Q: A4 T6 ]" g5 Y& {
7 p8 i. q- d$ z/ J    mov     ah, 25h
7 x' I3 s: ~' C    mov     al, Int_Number (01h or 03h)
7 G# |9 i% d! e% R    mov     dx, offset New_Int_Routine
: z/ I$ v: O( W: R' z8 d    int     21h3 V) f6 Z% ^1 O/ }! N- t& \

* `* }& X# r5 N' W1 q__________________________________________________________________________
2 Q0 M5 a' Q& a. E0 {
0 i+ l: m$ _: g+ ]Method 09
5 `3 Y$ q* X4 |9 F& M; b) O0 [=========
; J  e+ H6 R: }+ |9 u1 Z" Q' k  c
( m5 z  r% A& n3 u9 R! B3 ~This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" i& Z0 h9 \+ s3 ?% z
performed in ring0 (VxD or a ring3 app using the VxdCall).0 H( C- u- q6 d4 \3 E# f2 E
The Get_DDB service is used to determine whether or not a VxD is installed
7 x8 i# T3 F' }0 u6 Lfor the specified device and returns a Device Description Block (in ecx) for; V! }" Z/ @) T7 |" S9 Q- \
that device if it is installed.  P7 h  H; B7 O$ _; `

  l1 \2 D3 I: ?7 B  i" D   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 K, r" {, M' A7 j; t% K( D7 _+ d
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 j6 C7 |; F( l2 v- f. ~1 W   VMMCall Get_DDB" S6 j2 `( _! _$ s9 j# F
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed$ D. J: ~. v: C- R) p# B
' H- Y! C- @* J* C
Note as well that you can easily detect this method with SoftICE:
, B3 |% u$ e6 D% N   bpx Get_DDB if ax==0202 || ax==7a5fh
6 i/ w) D6 ~" z( w/ q1 a' Y1 }. \% {/ I
7 N7 w0 b1 {; F4 j) `, M$ [: M__________________________________________________________________________! ~) j: a, x% J& }& g; C% ]' b: B

9 k8 }% H* F1 n4 \, }& xMethod 10" ?- Z# C7 q' q
=========
1 i4 [! h4 a" l% n: ?2 [( w  Q( ^) Y0 U7 `
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% `' R% D5 r# x4 r( L) h; o
  SoftICE while the option is enable!!
2 b8 X- i' p4 V* }% C. o3 v1 e2 Y; n
4 X3 W1 b! [/ }This trick is very efficient:1 f0 Q( l# x  X5 k; L" f
by checking the Debug Registers, you can detect if SoftICE is loaded  i' v6 _" E1 g3 W! i
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& {* C7 ]% @$ [4 ]7 d
there are some memory breakpoints set (dr0 to dr3) simply by reading their# `4 K% l9 Y7 b; x8 Y
value (in ring0 only). Values can be manipulated and or changed as well& `, J8 l7 O3 c
(clearing BPMs for instance)
( p% _4 o/ L: p; d3 R; v7 r8 A
+ I1 T, c! ?& V: _2 L7 S__________________________________________________________________________6 w! A: u+ ^1 t  h# `, G1 |
/ D! B2 P2 _9 I: j, x( ?) \" ^% T  p
Method 11
5 ~7 o$ l, q+ K# k: `=========
) \' g( B6 [: I* {# b; H
  E# m4 h7 F1 C$ o2 a7 m0 u" JThis method is most known as 'MeltICE' because it has been freely distributed
; w9 c8 M, L; l  D* Svia www.winfiles.com. However it was first used by NuMega people to allow+ N! A/ G3 S% M* h, \
Symbol Loader to check if SoftICE was active or not (the code is located
  t. |# f3 X  R, E2 minside nmtrans.dll).! v, p/ b  m9 w0 G  J

% K* B1 U5 P5 @7 ]The way it works is very simple:, l1 K% i0 }1 y. I$ N! Q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ e+ f- L( @+ {
WinNT) with the CreateFileA API.
4 d6 d: j- Y! E4 O) X. `& y5 f- Z( I1 u4 i
Here is a sample (checking for 'SICE'):7 M; i. e! i$ M

+ E$ |3 a' i6 r* u- K2 ~  w2 q, {BOOL IsSoftIce95Loaded()
0 {; @( j; Z9 q7 j5 B. r; d9 K{
) s/ @6 E; ^. `% e+ O: Y% x' Y   HANDLE hFile;  
1 r- g+ r* H0 a* h" o   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
; Y7 a8 w1 H3 g' m( ?* K                      FILE_SHARE_READ | FILE_SHARE_WRITE,# ]; K) @8 Y: ]! F& T# w, w
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ S% {$ [$ z4 ]. u" |. p4 N
   if( hFile != INVALID_HANDLE_VALUE )
/ d$ ^7 P/ r0 N; s   {
  G9 i% a' m* F, H6 J! O/ U      CloseHandle(hFile);2 p( j& {( t0 l
      return TRUE;0 d# ^  w* m( Q- g1 O. S. K( x
   }
1 s/ |* S4 s) T   return FALSE;
8 B( h2 f3 g) s/ w. Q9 `}
; s4 y: ~. z' f+ |
+ a" E+ u+ ^5 c# f  G& e6 o- h& uAlthough this trick calls the CreateFileA function, don't even expect to be* f0 T( b1 `' H6 }
able to intercept it by installing a IFS hook: it will not work, no way!
: r4 D* l& z/ O5 g% u2 a& x" jIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
7 i, c! w# s1 O+ C1 b" X4 Yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, B- S( l: A0 e" f9 `and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 {; p3 N! j8 I& M- B: Qfield.
7 m) B* n' |* q  ?6 bIn fact, its purpose is not to load/unload VxDs but only to send a
8 y4 j- Y3 c7 U. U- @/ |# _% W6 NW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( @7 o+ q. a& K7 F# Y
to the VxD Control_Dispatch proc (how the hell a shareware soft could try& Z+ B2 g7 r$ V+ S2 \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
, ^5 S9 W& i1 MIf the VxD is loaded, it will always clear eax and the Carry flag to allow8 b/ N7 p+ C2 u# ?9 l7 Z
its handle to be opened and then, will be detected.0 A7 \0 U6 D, B. F8 w  ]8 ^
You can check that simply by hooking Winice.exe control proc entry point, I0 @% \# l+ m; L( {
while running MeltICE.3 Q/ \; F% g# {# x! X0 t

' D% ?0 H( C1 J2 s, f5 }" A( L4 m6 Q: S, ]1 w5 S. Y
  00401067:  push      00402025    ; \\.\SICE
, Y2 f. c5 t- S! K, m2 y1 H  0040106C:  call      CreateFileA/ t, L9 F, H" `2 O% b( X- y
  00401071:  cmp       eax,-001
' B4 O# X# ]2 r9 I" w& E) B2 ?) [  00401074:  je        00401091
) p$ z  g8 P! v: E) p& M
, \/ x; N% O/ R0 f  r! h2 V, F
" w2 S7 b: |8 f, n4 l  N' gThere could be hundreds of BPX you could use to detect this trick.
' l% M4 y5 h  i, n" a-The most classical one is:
; q% T0 f# w% k5 ]) ]8 p$ e4 F* J  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ s$ D, I- ]! h3 ?% x) N+ m0 l4 @
    *(esp-&gt;4+4)=='NTIC'
  }- M% c% w) f5 m1 L5 D3 C
9 X' s9 l: P. M; e; b+ {-The most exotic ones (could be very slooooow :-(
1 }8 e( r9 f& W3 d   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ H3 K* M/ x. f     ;will break 3 times :-(% r# X; x4 R- y8 [# q

# j' h/ `: q3 u( A, A-or (a bit) faster:
- X; c7 [" {3 ]5 v' [   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 T1 f+ r: R4 ?: @
% H. q4 p3 U" _. H   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 C* r) y% t; T) z9 O
     ;will break 3 times :-(
2 g9 a, d6 B9 h# M6 E& g
/ d1 t' X7 ]' B- @/ Y7 D, v$ L, {-Much faster:5 f9 @# M. X9 `$ \- U
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! D8 A+ }" y2 T+ I- ]
, |9 L- f% S. t. \Note also that some programs (like AZPR3.00) use de old 16-bit _lopen/ L' b0 O  s$ {3 p
function to do the same job:' M+ T& |4 `* O5 K

9 H7 B8 H8 l1 u% t) v8 t. f   push    00                        ; OF_READ
* s' T3 N; `( K   mov     eax,[00656634]            ; '\\.\SICE',08 ?: x! d: l- R
   push    eax
  D9 d$ V: C& I- l$ V2 e/ Q   call    KERNEL32!_lopen' s: g6 D$ d4 E
   inc     eax+ @# }; }1 `' H; z" V3 X
   jnz     00650589                  ; detected/ v/ P8 h# b$ O3 \+ d3 E
   push    00                        ; OF_READ
; }, ~+ Z3 c- [0 w   mov     eax,[00656638]            ; '\\.\SICE'
1 |2 @( ~0 Z) ~; g1 _. t, I: ?+ ]   push    eax3 u/ y/ T  @; H
   call    KERNEL32!_lopen
2 @7 c4 l# U- R7 |6 F   inc     eax$ m1 d" Z. I5 T2 E
   jz      006505ae                  ; not detected
# O) M  M$ w' t3 ?6 H$ L! f! z& Y- c% F

' v. l/ W' H0 O$ G__________________________________________________________________________
! ?0 D, r! A% g. u4 z0 B1 o( f
1 X# k! [+ _% aMethod 121 |+ @- l& F0 A% H" Z
=========" h' d; f0 W  S  I) }) d

: l7 T) ~0 i3 b, l2 f6 ~  I/ HThis trick is similar to int41h/4fh Debugger installation check (code 05
% [; V  [5 L  D/ j3 f&amp; 06) but very limited because it's only available for Win95/98 (not NT)# ^" P& {) ^. x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.8 y8 C. M! b1 M0 q. n0 c9 z

5 [& s4 F1 A$ N. S5 [   push  0000004fh         ; function 4fh! I0 ]# L+ ]7 `* q% G
   push  002a002ah         ; high word specifies which VxD (VWIN32)- ~% @% h. q2 s( K0 A/ _
                           ; low word specifies which service$ T) c% g$ S6 G
                             (VWIN32_Int41Dispatch)' t0 j; P' B- S# F
   call  Kernel32!ORD_001  ; VxdCall: ~0 |( \9 g- E4 p4 X( {' b
   cmp   ax, 0f386h        ; magic number returned by system debuggers* E  v1 Z9 Q: |. U
   jz    SoftICE_detected
7 c' \9 D, a( s3 M( Q$ g$ o; Z* c% C/ f$ R4 H
Here again, several ways to detect it:/ m2 S2 d1 H: x7 A2 U# x$ m
# r' k3 \2 l$ C) j. y6 ~( {
    BPINT 41 if ax==4f
7 m8 s" r9 r  J! v: z
! v1 I9 T% i! N    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 M+ N; W' H4 z( }

3 Y' D' q5 B7 t) S$ }! O    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A% I" F# g# g6 q
! K9 k: C* }: p" h2 j, ^  e. N2 a
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' [+ n, |! p, O4 g5 W. v4 s0 w5 |+ h" E* J: g
__________________________________________________________________________7 D6 b1 A0 _7 E) V3 {

1 s: @2 K2 {; [- j9 s" XMethod 13- X$ d* o5 o5 [4 ?0 a+ F
=========1 C0 z" {3 Z; u, @

) p" U  i1 F- P' c+ @# F6 k" bNot a real method of detection, but a good way to know if SoftICE is0 Y5 W( @1 `; T3 h, r! `
installed on a computer and to locate its installation directory.
: a& N& a+ q3 U* s6 W9 f8 [& eIt is used by few softs which access the following registry keys (usually #2) :" D0 P8 u) q. U. f: }, @; @9 s2 a
/ M% r/ Z4 ~$ E+ X
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 B2 m1 F8 }4 {2 `/ E5 m\Uninstall\SoftICE7 ~" g. ~- D( d, l; `9 t
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 q+ R3 |$ ~9 w1 U$ E6 L! a  ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 `  ^1 W) r; [1 S
\App Paths\Loader32.Exe7 z2 B& \, t6 G* P* _4 U- C

6 N, x) J8 D) j( a: w' d+ O% c, D6 z2 y' I+ L) `
Note that some nasty apps could then erase all files from SoftICE directory
9 U9 D8 U0 ^% o" P. U(I faced that once :-(
) y; X( d$ d6 Y0 I; \9 }& h- W! W& ~' t+ H4 {/ Q, Q
Useful breakpoint to detect it:" l, \0 y3 z: {' m0 X" C

3 `6 _) {  ~  Y: V3 J5 k/ Y. _% z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* `# w4 C# T; l" y

3 X& l8 n$ T% P4 r! W9 ]! |8 K__________________________________________________________________________
; i% ~5 A$ j6 b# v3 u
; o. a' C- `# ?! k/ T% Z+ F) }3 o2 u' [( S) y5 ^+ H
Method 14
' V  {5 l! P7 ~$ ~) }/ U=========$ _. q1 g$ Q2 b9 M5 j" K) C
5 w) W5 g  ~( N, k  \' ~$ s
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ H3 r4 a; @1 S2 `5 t' B
is to determines whether a debugger is running on your system (ring0 only).
# }! U' Y& B- O6 H* {! B" {& t  e! M2 Z$ c% p
   VMMCall Test_Debug_Installed* ?4 a- Y2 k# s' F! f! P/ C. l
   je      not_installed  ?! F1 D, H7 o7 z' P* M
- y* `- y& @$ X6 Z
This service just checks a flag.$ }& E* Z, f9 e% t
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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