About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 r- x2 t  ~' i- U: V9 l# U% {
<TBODY>
" ^, y+ \( ~# Z' J5 g- z<TR>* a5 w! k! Z6 z- Z: W
<TD><PRE>Method 01
% A6 f& u9 [0 }, D: M6 g=========$ ?3 d1 \, ^; ]. q* t( j
9 Y. G1 `, Y; G% R) S. n
This method of detection of SoftICE (as well as the following one) is/ {' p3 C1 Z& A8 ~
used by the majority of packers/encryptors found on Internet.
2 ~; |4 Y# h3 ]It seeks the signature of BoundsChecker in SoftICE
( d) L* h: @; `% O4 t
* E2 @8 n, t" V: f  ]    mov     ebp, 04243484Bh        ; 'BCHK'
9 v% [; N9 Q8 d  J( f# \$ q    mov     ax, 04h0 t; L* ^- o; k$ [; K
    int     3       ) v* Q# m( c6 l
    cmp     al,4
* `0 Y3 l1 c) [# v0 S0 C    jnz     SoftICE_Detected
0 Z$ k% v1 f# n4 [$ \
# {- Y' [# E7 ?___________________________________________________________________________
& z4 b% y3 L* m( \1 B8 f7 ]* {9 S+ M( N+ w* m- g# j: E
Method 02& L4 q: A9 p& N
=========* q; C; f8 ~) ^  l# s
0 P; D$ ^3 I6 `5 y/ W. l
Still a method very much used (perhaps the most frequent one).  It is used' a- y1 T3 H8 m; b) c( K3 Z. e
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 `# \: }! ~! k3 q! U
or execute SoftICE commands...$ I7 e( R3 E" g. u1 k3 n! f
It is also used to crash SoftICE and to force it to execute any commands
# |9 X: S4 i) e  J! p$ R2 ](HBOOT...) :-((  
* l* h) H2 O% `+ ~& @* ]6 L+ Z, a2 m+ w' ], }& u: c
Here is a quick description:
7 X$ \5 f& _1 M5 k' U) ?2 j-AX = 0910h   (Display string in SIce windows)& r' l. {7 `' g) L: a5 {
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
' |, ^4 X/ a) Q-AX = 0912h   (Get breakpoint infos)9 n. l, G6 r. ]+ Z- N$ }* z
-AX = 0913h   (Set Sice breakpoints)6 a2 x; B4 z& J: r1 L; \2 p
-AX = 0914h   (Remove SIce breakoints)0 M! ^4 p9 K. C& C" d7 d# D

' p, B% ~4 ^) i& U  C* mEach time you'll meet this trick, you'll see:
8 G$ x7 u) n- m-SI = 4647h' Q" s; s$ p4 \- R
-DI = 4A4Dh
5 c2 F! \: m& h& K& p1 V' k2 a- JWhich are the 'magic values' used by SoftIce.
: Y  y) V  e- A* W2 P5 f3 CFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: i- s, M# M5 P# C: q( @
2 F( X  i: W$ ^4 M8 S* ?% \* f2 `3 DHere is one example from the file "Haspinst.exe" which is the dongle HASP8 d" m0 I- B3 L/ Y. [
Envelope utility use to protect DOS applications:
- A$ m" d6 m/ O. G3 K0 f( {. u
; k( ?2 U1 s& o- f& Y7 M, a$ `) I
( n0 P2 _* d/ Z9 p! q7 h7 h! s4C19:0095   MOV    AX,0911  ; execute command.
* Y' _. f- e, L3 M; f/ m8 j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ U: G9 {+ s( x8 m. Y4 w) Y6 c9 Z4C19:009A   MOV    SI,4647  ; 1st magic value.) V" J; k  q0 ]  [' i5 f( ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
' g; \7 r% M) N4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
1 T7 z$ _( P+ X/ A+ A4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
1 o) ~4 p8 ]# p. X) h& I4C19:00A4   INC    CX
# _3 I; l. i$ B7 a1 `4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) x2 d5 H& w# U. E; T2 P* u4C19:00A8   JB     0095     ; 6 different commands.
  V; `7 M  u  k4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; [# a) q4 q0 G0 G# e* i$ _: ?6 P4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 U9 \5 x( E. R* J, U7 B" ^; J- X
The program will execute 6 different SIce commands located at ds:dx, which* E6 s3 Y; ?3 a! M  U5 n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.; @; U9 V1 m- i

! e% k- q9 ^( n* Y* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% L5 M' Z1 z9 F4 l! ?___________________________________________________________________________3 O2 ^' l) B4 X" O/ A7 g! c# {

0 s% ~$ ^8 x3 `( E
9 c, h# J  h. w/ nMethod 03
6 z& Y1 O6 Q+ K7 s+ L! A=========
. ~( F9 Q+ `! @0 n
# q/ [9 p0 n, ]( sLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 `/ W  Z# V/ r8 O- @( @, C
(API Get entry point)3 Z2 C# `4 Q6 {8 o( l2 F' r
        
) N) r0 X3 j' v, `! g; c* k
0 @0 `( @: b+ [! l# P    xor     di,di+ ~- I$ I# Z3 V- N' q# W! d# ~' {. ~
    mov     es,di$ s9 a- e, g7 z/ n
    mov     ax, 1684h      
6 T' B* L3 @8 u    mov     bx, 0202h       ; VxD ID of winice
! X3 K. n4 Z1 G4 |  l9 v    int     2Fh0 J" I  K' W) g" f; x. z- i, [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 Y' z+ ]% n8 ~
    add     ax, di
1 N8 v  _0 i! N$ ]    test    ax,ax# G1 K! T# s# J9 D! t; L6 w. I
    jnz     SoftICE_Detected
9 ]- {: a+ W" Z
' r/ J. R0 P. h: J# A* @' x$ W___________________________________________________________________________0 z8 R+ ]" u* D6 }4 L
8 F: X0 r, O- ?. x7 d4 Q6 L" P
Method 04
; _& j8 @' N( R3 N2 W) z=========
. W8 S, y' n0 z" g0 m' z
$ [, c! z+ p7 V* c. S+ ^9 mMethod identical to the preceding one except that it seeks the ID of SoftICE
; G1 I: X! e+ s  g4 w) ~; {GFX VxD.. w8 p8 V6 z/ ?2 M6 q

' M4 i$ b/ p" d3 g& |    xor     di,di
4 f: ]2 X7 l# N/ ?/ b    mov     es,di7 g9 ~/ E4 d# S% _
    mov     ax, 1684h       * O9 }  k( q- c: X6 R/ Q! z( ~# s
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 D& K" Y2 O, S8 h' X) ~6 r    int     2fh
7 P) S% X, {- Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 y2 S& Q8 N* o2 B3 G* f  }% b0 q# [
    add     ax, di
  S) b5 M8 a+ ?! i6 G$ G/ q6 R& @    test    ax,ax
' r# W' l8 X! J9 w: z, D    jnz     SoftICE_Detected: O7 c8 c9 n2 X! J0 ?! [) I, Y

2 r# @( [4 \4 }4 I, I__________________________________________________________________________
  Z6 n# W  }8 x4 S! O5 ^  {; B" q9 Q! v, W8 v
9 _. o/ P- E8 d! k% E& x3 Z' a
Method 05
, z# S6 f* B2 D; k=========) V9 J  P% Q" Y7 O( Z1 b2 }

: x# y0 [/ ^: Q7 _Method seeking the 'magic number' 0F386h returned (in ax) by all system
  l, m' R0 r: E9 E$ \debugger. It calls the int 41h, function 4Fh.
; l5 s) U  h+ ]There are several alternatives.  - @) w, k! t7 z! g
  m# D+ c) [+ x5 @4 [. g) i. J
The following one is the simplest:" F, R5 y5 a) n

3 l( n" |2 H* s" m    mov     ax,4fh
6 c( l4 H! C* R, m$ K* V    int     41h; }; R6 }8 b* \9 R! }/ K
    cmp     ax, 0F3861 \. z8 T0 f- @4 W% n) ?" c
    jz      SoftICE_detected
2 t" h& y; ~8 `+ M) l
5 V: l4 D6 G% {" M- ~( P& k+ I* j/ @0 c' H
Next method as well as the following one are 2 examples from Stone's
+ x9 A: z8 l& ^; d4 R"stn-wid.zip" (www.cracking.net):
" H9 q$ Z) d7 i( M# F; Z7 Y8 H
/ w6 y3 ?- Q8 F# G, n! r9 [    mov     bx, cs4 _; ?: V& Z% c& w0 _7 D. b; x) S
    lea     dx, int41handler20 z, V) M' H6 A: G* ?& G
    xchg    dx, es:[41h*4]6 W' Q9 G5 d- \) f; z+ V
    xchg    bx, es:[41h*4+2]
- i) ^$ r; B4 v5 n& P# X$ w5 r# n    mov     ax,4fh8 o* x' T5 ]/ B, T
    int     41h
$ v, `5 S( d7 h! V7 s& t7 U    xchg    dx, es:[41h*4]! Z4 g0 [  f( M5 l' Q& ~5 i
    xchg    bx, es:[41h*4+2]0 A' R, d. c8 T/ M
    cmp     ax, 0f386h, I3 k  F8 N1 }: }
    jz      SoftICE_detected3 P. m3 \$ i. N: }. k
& V( z% k( [1 V4 [
int41handler2 PROC
; m% q: [1 W; E+ H& c- i5 K( I    iret& A% c1 i! D7 l" y2 ?
int41handler2 ENDP
& z0 P) `* [/ E3 Q1 b
% }0 a, `" N5 L5 }/ Y1 ?+ p) T8 h$ `8 s/ R
_________________________________________________________________________9 S3 t7 [( ~: _6 A
5 l2 k) ?3 h' o

5 G/ W' ]+ d6 t4 o( [$ r! GMethod 06. m, ^$ L, i) o! _
=========
4 K) `) l( C8 F: J  J
! _9 ^5 s( y4 S" ^  b7 \" g9 M2 b0 k/ K3 L# ?7 P: L3 }8 a  i
2nd method similar to the preceding one but more difficult to detect:8 [& G: J( l/ D( B
+ |# U7 R2 X3 |% G7 A% r7 k

* L4 u1 w/ d& Y1 |int41handler PROC
+ g. l' I& [. U# z8 {    mov     cl,al$ X; b( \( @, g' P9 b6 k( B9 F3 F
    iret6 V% `  q/ P* ~. n: K- Q
int41handler ENDP
2 }% W( A# K- ^( N9 G2 b5 D6 l- O# ?% s& o1 u2 M. s0 \. @: k1 j

( E$ k! \, ^5 X. \9 O6 e  q    xor     ax,ax6 B& Q3 \4 q! N' }8 @# ?0 y3 B
    mov     es,ax/ r4 ^$ @& N; H, K
    mov     bx, cs# `5 B# x; G# o, h8 {8 b/ t
    lea     dx, int41handler4 f2 k. L3 v0 c) B# r, d% Q
    xchg    dx, es:[41h*4]
: G  w, L/ i1 X1 o8 e! ~    xchg    bx, es:[41h*4+2]* H0 E- ^- D8 [4 ^+ g' c$ s
    in      al, 40h
& h$ H2 _/ {0 m1 H' s! O0 S    xor     cx,cx
/ e3 A7 u2 r& n- T    int     41h
% P5 v8 u1 g) i% F, x    xchg    dx, es:[41h*4]+ D' m( _8 Z3 E& g0 b
    xchg    bx, es:[41h*4+2]
9 k. f  ]3 r# P1 r5 C4 O; N    cmp     cl,al
: G# K8 h  h* w, R$ ^    jnz     SoftICE_detected
  k, g! r0 j, t% F; X4 e& N5 A: I1 @7 V3 O9 A' p( Q
_________________________________________________________________________, E+ j, {+ ?7 F% o! X, S' _

$ G6 H' v6 L8 R* K6 R2 @$ E. yMethod 07, `1 ?* h) G, b3 f* G0 i
=========" L7 E3 p; b  w/ S3 A: V2 p

3 s  k% O1 B4 E3 K# ZMethod of detection of the WinICE handler in the int68h (V86)7 c, z, D0 k0 X; X. ~$ ^

8 i' J  u) S7 [( Z    mov     ah,43h' K# J& P4 q" C- Y) x- i4 D( [
    int     68h
& l1 Y8 n3 L  S; H; ^    cmp     ax,0F386h2 T* L6 c* N2 B- C, Q  S8 f
    jz      SoftICE_Detected
2 C% Z6 ?' W, A; O: b) e' o' ?4 g- ?' T# J4 J! c* t& {5 b9 g8 j1 H

0 v/ d: Z& f) c8 B; K3 w=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 I, I3 K# o. g. i( h
   app like this:2 D0 e- O' ?% T' Y
+ t. b; ^  @; |4 ~" H& x
   BPX exec_int if ax==68& q( L7 ]- u4 j/ K) k
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 i2 b, ?) {4 e4 e7 Q$ ?$ C6 q
   located at [ebp+48h] for 32Bit apps)
1 J% C: U- Q6 y3 F! j$ j__________________________________________________________________________  J, U! q1 g$ W* T" {- g* |

8 p8 M' \2 |" N8 q, W) E, P! A* \3 o. r7 H$ \9 h  Q
Method 08! n! \" j8 m$ m! U  n1 I5 X
=========( }( o! k) Q& Y5 Y, U* _
- a* o, T$ |! s- E  R  ~1 K1 a/ S
It is not a method of detection of SoftICE but a possibility to crash the0 ]! M: a; J2 p+ B6 _1 X- q; f
system by intercepting int 01h and int 03h and redirecting them to another8 j9 G- H7 ]0 |  q. s) j0 v
routine.
* S% O9 w; w$ ?) k0 N) q1 F: eIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
. q% X" S$ n- tto the new routine to execute (hangs computer...)
. T  x! w  j& G3 a# B! \$ d" {8 O1 G- [" e/ ]/ X4 F1 \
    mov     ah, 25h
$ [* U( |+ X7 S8 F. B' U    mov     al, Int_Number (01h or 03h)5 Q/ M% |5 T* i9 _, g; y3 w! b
    mov     dx, offset New_Int_Routine
& ^. F% Y$ t% {0 U6 N9 e9 l    int     21h! m! }9 L( A) H' V# M

: N+ ~  @3 H8 M# T7 i1 k__________________________________________________________________________0 Q, L  U, ~- C2 f, A8 o

. J5 `6 A0 |$ j# _" H0 w7 ZMethod 09
- ^2 H) `3 c& ?, a$ }=========7 i! g% j# S: b0 Z
( ]# z& \- P. c( l, q: f$ D6 l
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 F4 K2 o% N' X8 V4 b2 Y# j
performed in ring0 (VxD or a ring3 app using the VxdCall).6 I, R# A1 b7 S2 O; ~. w/ D: e+ S
The Get_DDB service is used to determine whether or not a VxD is installed" v  y- e1 M: L& @
for the specified device and returns a Device Description Block (in ecx) for  p! W- e0 ^; C
that device if it is installed.6 E- G( B0 x0 j5 V( `
# o$ }; V( t3 ?9 F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( ~3 r  w( ]6 f7 j
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 x4 K/ t+ n8 ]" ]5 n. m) D  Q. ^% Q" b
   VMMCall Get_DDB- l+ m- @- t! R" N% N
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 E1 o/ s8 d( N! ^3 b# j

0 V( ^7 `, C/ d1 F0 YNote as well that you can easily detect this method with SoftICE:7 T4 b7 q$ d' b! A! r0 q% _, u9 G; v# h
   bpx Get_DDB if ax==0202 || ax==7a5fh
) |) r( Z# o0 y+ E7 @2 N* |' T8 T9 M1 @' g/ y4 u
__________________________________________________________________________
! l" B; }3 n1 w0 m8 m9 \: {. N; A/ C- }1 s" D3 d3 I
Method 10" d6 C8 K. Q! A
=========
9 L4 _0 }, R) E- ]! _
$ c6 h6 s9 Q. \' {" @. e! z9 G) k=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" @2 f2 Y2 c' E, ^9 T- a6 A  SoftICE while the option is enable!!: R8 l3 m/ Z5 f0 z3 L! T
/ x, t; z+ [/ }, b+ D2 m8 Y: d
This trick is very efficient:- K6 V( O3 Q, X5 K( p( H
by checking the Debug Registers, you can detect if SoftICE is loaded% Z3 }% N* ^. M: C% C
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, L* n) g) z, R/ }- y; `there are some memory breakpoints set (dr0 to dr3) simply by reading their; X5 N  ?! ]8 F* ~/ W* n
value (in ring0 only). Values can be manipulated and or changed as well  D+ q) b" h% r1 t
(clearing BPMs for instance)6 [1 T1 l5 Q" E$ L

* w6 J6 s+ O, U1 W2 \. p# A__________________________________________________________________________
3 u4 U8 ]' R: ]" u! L( E( ?: v* N. w( ~0 k7 N4 }( [0 |" T9 d' k$ r
Method 118 g& J9 Y: u' }$ W* Z
=========
0 T5 g; Y7 l* J4 g  B  p5 V3 V2 K4 l4 |, ^, _4 V; a2 T
This method is most known as 'MeltICE' because it has been freely distributed/ q" q% Y: Z! H, T
via www.winfiles.com. However it was first used by NuMega people to allow4 w2 ~$ K! B4 C
Symbol Loader to check if SoftICE was active or not (the code is located
" ~# Z" H' @/ K+ ?+ i  D7 N. D9 Kinside nmtrans.dll).1 Q' E6 s" r7 N

2 w  o6 \$ v+ R) D8 y# g5 EThe way it works is very simple:
: p; S, U' Q- p9 NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. Y$ d0 b2 h  i6 ~2 }WinNT) with the CreateFileA API.7 G. w8 Z5 l: M2 L
& J4 [2 |6 L% @
Here is a sample (checking for 'SICE'):
" q) b% d: F$ p# R1 |& Y) u4 J  c, k; \/ L
BOOL IsSoftIce95Loaded()
  K0 Y8 I8 e0 x0 U# v( G( H{  k- C  L8 _' U! \- i
   HANDLE hFile;  
% C2 B9 l1 I/ |   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% v: \( }# b- `  z5 N                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 I. C# D+ S& B6 ]/ J1 ~7 o$ H
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) a1 B4 i7 x& P* j. s   if( hFile != INVALID_HANDLE_VALUE )0 [, f1 d6 V) U; u6 K
   {
3 ~* C1 o" F- @5 D1 T      CloseHandle(hFile);8 @3 T# |3 o4 N8 X$ T
      return TRUE;/ o; v) |  w; r( m0 Y
   }* j2 Q9 S0 Z  ^- `- P& o
   return FALSE;
% c, Y) ~: q  y3 L4 |$ e& j; s}
1 b4 ^, R& ^/ i! U3 l3 e+ r4 O( |; t# v2 J$ `
Although this trick calls the CreateFileA function, don't even expect to be
) ?1 k/ U5 t4 r+ Cable to intercept it by installing a IFS hook: it will not work, no way!' w# ?  m4 z4 H. n4 V$ j
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
( G. W' L1 g. [6 F: oservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 u, i; ?! `6 \; ]. r: _4 o; d
and then browse the DDB list until it find the VxD and its DDB_Control_Proc4 m: N3 }: j5 H4 c; u
field.
9 k5 E/ J/ Q8 L: G0 \0 ~! vIn fact, its purpose is not to load/unload VxDs but only to send a + G4 E; c; h6 I1 J2 x2 b
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 d% E: j# ~  L- Hto the VxD Control_Dispatch proc (how the hell a shareware soft could try( A) Z) c6 z& K$ J9 U
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ C/ m: S' I3 A3 a% y; gIf the VxD is loaded, it will always clear eax and the Carry flag to allow7 i, V. g4 g7 ]& w) s9 H
its handle to be opened and then, will be detected.! B, S8 e) z; |0 t' W( H
You can check that simply by hooking Winice.exe control proc entry point
+ q( T/ p+ Q8 D9 \! @( j$ hwhile running MeltICE.
2 r1 u9 @5 r7 I) M: z3 \
) X  a, l# N6 k0 F; U" S; V
7 a9 W- h! P- Q* a" Q. E  00401067:  push      00402025    ; \\.\SICE
5 i9 c4 d; W- N' f, q5 A  0040106C:  call      CreateFileA6 O; S: y; E) t& u5 P
  00401071:  cmp       eax,-0015 N0 t% {3 m0 X/ l: M) \# M
  00401074:  je        00401091. L" j5 k7 j1 Y0 N8 i4 ?. ?
$ ^/ l' J. V0 \2 X% T
( e; u$ B' V. w8 V9 o- z
There could be hundreds of BPX you could use to detect this trick.
8 p1 I. X) x; ]  Z( Q* U$ U: D3 D; s* t-The most classical one is:
* s1 C4 X6 `2 z9 V  a  c7 ]0 P; W  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- D' }% b+ R4 ~+ Z    *(esp-&gt;4+4)=='NTIC'* a8 p1 |& \" W. P
* c  v1 g  ?# e' w# `
-The most exotic ones (could be very slooooow :-(' x7 C! m5 i; T1 G5 t" I1 U# @# W
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
# R2 l0 T) x6 B5 u+ ?     ;will break 3 times :-(2 a) m) Q+ g1 t$ m2 @+ {( L

7 v% ?. r. ?( ]8 Y-or (a bit) faster: ) D7 i# g; h7 V4 l6 I% \" ~0 w' `7 L' m; b
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; h9 s( j" m/ V9 K# Q3 i; L# r
: x% [! d3 u8 r9 e2 W8 ]6 S0 e   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ R2 t: k* x9 x: j' W     ;will break 3 times :-(8 N6 u: M6 y0 q" M# M
) E3 L  N" g: M1 [  Q
-Much faster:
" x% N3 v) K% A! O: U# a   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; S7 M0 Q4 c$ |
' y9 B: S; I4 n+ f0 [. j
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 y- P/ R7 Q$ ]3 Nfunction to do the same job:
' J. {+ L5 v" D! {5 g3 ~7 B1 W4 H; N" _
   push    00                        ; OF_READ
% G# f5 x  S. L* j4 ]   mov     eax,[00656634]            ; '\\.\SICE',00 ]/ q6 R4 j2 n# U% m3 [
   push    eax5 @1 |2 K3 E# c0 E. f5 N
   call    KERNEL32!_lopen
* i* H2 u- Q' r1 q   inc     eax0 p6 {1 r) t6 w; Y
   jnz     00650589                  ; detected0 `3 H7 I$ D" j) b
   push    00                        ; OF_READ
$ W8 Q) \0 U( t; N& R: T   mov     eax,[00656638]            ; '\\.\SICE'
' Z% K6 q  H; c! w. [: E   push    eax. X4 ^. w: b: Y
   call    KERNEL32!_lopen# B. q7 D; s0 U2 D0 X
   inc     eax* L3 e, U& T# |5 I7 K5 R/ B4 j
   jz      006505ae                  ; not detected& |" Z" ^% w' J% Z$ J  Z% Y
8 z2 e) M- ?; u/ Q# ?5 }

! H( ^/ S! W# k+ u- E7 o__________________________________________________________________________: j1 P8 G  I! B' o. u0 N! N& i
% ~/ u' N* C* {( A
Method 120 D- j8 `7 f4 R1 W
=========
* P, T$ U5 U7 v' H5 R5 `0 F
5 W1 d) p" F! {. y  Z  U- ZThis trick is similar to int41h/4fh Debugger installation check (code 050 \, }5 @/ r8 D* u# e- W  ^0 N' [
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
) B) C' ^, c2 M: E3 i# c8 eas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ U0 J+ ?( G* C9 J
2 o/ p8 @8 w$ U! X8 r# R+ T   push  0000004fh         ; function 4fh
% }' n4 q6 {6 ?, N9 _0 b1 [/ C   push  002a002ah         ; high word specifies which VxD (VWIN32)
/ O: C  Q% W  h/ f6 n7 s3 Q) {                           ; low word specifies which service
" `" D5 R1 Q. x7 ]/ I# q                             (VWIN32_Int41Dispatch)
$ z, T+ {4 v, U   call  Kernel32!ORD_001  ; VxdCall
- D' L" Y  |  F* f2 P   cmp   ax, 0f386h        ; magic number returned by system debuggers
) E4 `3 `* m/ [" T% u* M' D   jz    SoftICE_detected
0 u# A! u# S' r8 Y: ?/ ~. c, L/ c
2 Q9 j9 l0 w' i. uHere again, several ways to detect it:3 S5 w- y, P( a% e1 P; z

9 S; _6 R4 A2 U9 d8 C) ]    BPINT 41 if ax==4f- s& ?, U6 {7 }4 `2 E4 g- K
2 K: M1 P5 t) E- R3 o% d5 T( Y
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
+ P" z3 _+ |4 k, E5 v; D, k; J2 t8 e: A  u$ E
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" R. _( o' @" {* u. ^- a

% _+ G5 b# D* F* w8 y; H3 A# b    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 `1 H, U; I: ?9 A

  ~" s3 S* r: s9 E1 U__________________________________________________________________________
- d# @9 j4 K% V
4 _6 r: y2 K, j" {; Y- sMethod 13
  S7 s8 |& @' K+ A=========. w/ b. `: t! K9 T0 @1 u0 c: B

. e$ }$ U3 n  y/ u$ u- fNot a real method of detection, but a good way to know if SoftICE is
* ^, g) _) ]( B5 \2 N2 J# Cinstalled on a computer and to locate its installation directory.* r3 G' W/ `; b- u5 S
It is used by few softs which access the following registry keys (usually #2) :
& ?7 w  l! [- |5 Z, c! {- \1 L! K/ E+ T" J$ S
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, o. I, {0 C1 \( T1 P* q, L1 D\Uninstall\SoftICE
& U5 A9 B! a2 s# j8 f/ L-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- V$ P# ?4 K8 F# V-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 K7 ~" p. T4 s2 Q3 m
\App Paths\Loader32.Exe
+ C2 J( v+ A) W/ D( @/ m
0 O) D) w4 J1 Q8 e2 |* D& D" Y) R5 i/ L  P1 q: i$ g
Note that some nasty apps could then erase all files from SoftICE directory
$ b. z. f( s" m( Q, `* X* v  @(I faced that once :-(( N: V2 P3 D( _, z: R
, V* g4 F) C) C/ W' Y
Useful breakpoint to detect it:0 V7 A; g4 h+ e* j" n$ A" G
; m. F8 i! M( H  @+ G1 u
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
2 @2 |. p$ k$ u* N6 b
2 O! Q3 w6 x# q# r6 S. Z4 e9 l__________________________________________________________________________7 A' R+ B% [4 i8 a; {" |
4 }/ v# d3 A) r' c/ H$ _2 [/ y3 f
: u, V; M* J  B. v* e
Method 14
  k- L  R: o* l- {9 G. }=========
# M4 v/ V/ Z. f# t$ K) r) A# L2 N: T7 T& ?( U1 D
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; U3 r; W6 ]1 t+ C( e1 r2 ~; Gis to determines whether a debugger is running on your system (ring0 only).% H3 f8 P4 t( ^, q
' x% |& m4 S, b( q1 O- L  V
   VMMCall Test_Debug_Installed$ @% {+ m& K  o& W' [
   je      not_installed
# F3 E$ D! Y2 s) L
' Y+ ]8 z. ?  T+ y$ P% aThis service just checks a flag./ H) {# _  ~( u) j6 |% r! y
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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