About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>, X+ N4 x8 s' n7 |, k
<TBODY>
0 j. i0 g! P/ B# ]9 n<TR>5 Z0 u% P$ ]4 N* b! N
<TD><PRE>Method 01
8 b' ?5 S7 w- s/ \- ?7 ], U=========
& G3 t2 |! f# T0 k  e
: g* q- w9 e, u) G6 \' RThis method of detection of SoftICE (as well as the following one) is
; L& u, m; y2 H" a* _used by the majority of packers/encryptors found on Internet.
: e$ K0 L, J) @* VIt seeks the signature of BoundsChecker in SoftICE
9 z* w! h1 u; r7 y/ n2 w! j5 A: |' ]: x  _8 _2 u" T
    mov     ebp, 04243484Bh        ; 'BCHK'0 ~' }) P' L* s7 _! ~( G5 G/ y
    mov     ax, 04h
  i5 M" \* d$ @, z4 q    int     3       8 D4 Z! c* R# l( v+ N2 z' s
    cmp     al,4
, F' M+ B+ _: ^7 v4 H    jnz     SoftICE_Detected9 X" O4 f( d; Y+ E" i0 G1 {
+ j& a/ @4 g& f9 H' R
___________________________________________________________________________
+ q  e, ?' T8 r. P) X( q! x- Z6 {3 Q# c0 ~3 S* u& i6 }
Method 027 g1 E* u1 Q- o" t8 L4 ]  _9 N
=========
  D% R+ H0 W1 B( m' R
7 H. J" @6 b: A: XStill a method very much used (perhaps the most frequent one).  It is used
$ t7 g! c' r( {6 a  ^# b# kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
7 d6 {0 L/ N6 s- cor execute SoftICE commands...
9 [: l1 {! G0 p& m" I1 I: b0 x! bIt is also used to crash SoftICE and to force it to execute any commands3 m* \6 l+ w, i5 ^# x8 \6 F; H
(HBOOT...) :-((  
; e$ L  q% s5 t( |& n; ^: H+ y0 u, J4 O
Here is a quick description:
( S8 G8 ^$ E/ I. Y, H  _. i! ~-AX = 0910h   (Display string in SIce windows)
5 Q4 U2 g" o' L$ F; c6 l-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)/ P" v& J9 d1 ^- b' P
-AX = 0912h   (Get breakpoint infos)% e' O) |: L$ Q0 z* F  O8 B
-AX = 0913h   (Set Sice breakpoints)2 t$ e, ~. |5 i% G- d
-AX = 0914h   (Remove SIce breakoints)2 c, ^0 x) h2 J. ^! j$ L
: m* `" K5 `7 E  s5 s" T( {
Each time you'll meet this trick, you'll see:: A6 \! t" x6 p
-SI = 4647h
9 p0 M! O6 o, b/ T! n; Z- B9 V-DI = 4A4Dh3 u* E3 x  [' l$ @$ M
Which are the 'magic values' used by SoftIce.  O' l6 c0 w; {$ e& X
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.: D6 `- J  V8 _; o4 j3 h

! C0 }- z& C8 BHere is one example from the file "Haspinst.exe" which is the dongle HASP/ T# z5 [2 r4 W( ^5 {% c" M8 j
Envelope utility use to protect DOS applications:
3 g; X8 `' c& i+ ?. @1 G3 k8 O# t" E( {5 b* _

% f' x$ l0 g& R! j# F8 w9 N4C19:0095   MOV    AX,0911  ; execute command.
- M& U- _7 G, F- U. i5 |3 N4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# W, N& B" ~$ c. ]7 ~9 x$ V) j2 ^
4C19:009A   MOV    SI,4647  ; 1st magic value.; ?3 c" q4 W5 K# D" O+ m
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! h& m* i( p2 t8 w9 K
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" S" o/ Z3 f$ ^' }) W# U4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% U, o- k+ z3 e; k  j
4C19:00A4   INC    CX
: K' s; [6 Z( X4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( h; t9 Z* G" [- i$ s8 D3 b
4C19:00A8   JB     0095     ; 6 different commands.8 \. `0 ]* ?1 \/ {. m- J9 `; v, k
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
2 R& b2 I7 @3 }3 w; q$ M4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  x+ ~. ^# `6 S5 _$ g

) p+ b6 ~9 }/ n$ I8 @The program will execute 6 different SIce commands located at ds:dx, which# U' x, ]" @' t" f+ Y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 w/ a- ^2 C" P, c' k
% U9 b* ?; d% C3 O( X& l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, C' Z* v! }; J/ T" H) W% X2 Q5 f___________________________________________________________________________' q1 {1 N- `. W3 G9 R
( l' C( l6 m0 ^1 o
- \% b* }0 V+ n- O; \4 @8 g
Method 033 X9 o1 U8 O" o3 Z4 a
=========
0 f! _, I* ~. H6 S6 D( w- `( u2 h! @/ z/ g* b( D0 ^! i
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; V2 F6 x" f( {/ [& }9 x+ f(API Get entry point)
3 ?  g2 A& v9 w1 C, T; {3 V+ e( \        
+ X& i( t; b6 p9 c8 k4 z& |- Q
. _) v% B( }- Y% X4 D    xor     di,di  y# h! Z, ?" q% x
    mov     es,di1 A+ L2 Q. m3 d- q' W% F. k
    mov     ax, 1684h       ! ^; d( i2 ]. Q3 E3 v" s# n
    mov     bx, 0202h       ; VxD ID of winice, {/ i! w* N6 _) m
    int     2Fh  {2 j6 S  p) f# K
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# k0 R( [1 P, o4 f    add     ax, di& G- q1 [: y% O( H
    test    ax,ax3 Z0 |$ _6 P8 G4 U4 E+ C9 \
    jnz     SoftICE_Detected
. `% z! O# ?! h0 ~
" y$ ]/ h; f9 y$ J/ b2 G8 f  V___________________________________________________________________________3 G* A3 Y0 |3 R! F
' ^( @% V9 e" G7 _: Y# q1 a
Method 04; m6 {% i9 f0 B9 _) ^# @
=========
: z: c) S. }6 |
; T0 w) h1 p' l- J4 G0 o& {8 n  EMethod identical to the preceding one except that it seeks the ID of SoftICE
. n1 q7 y9 U* f6 w% q. ZGFX VxD.
5 S- F' q7 w, H( d7 {% s% I9 D7 n* B6 k
    xor     di,di
; q% ~( c8 n7 |# y' Y3 H' y1 L    mov     es,di
) g9 z. l, z8 H% ^0 p/ X    mov     ax, 1684h      
  [& ]" e- Y8 a    mov     bx, 7a5Fh       ; VxD ID of SIWVID; {1 l0 z9 v, `% D
    int     2fh+ L; ~+ X# A+ R+ R  Z5 s- X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- {" J( y+ j" G, i. S' N    add     ax, di0 v; Z3 R+ d7 b, f- N* p
    test    ax,ax
% v! _" p2 p  h8 y& B: i/ ^& H    jnz     SoftICE_Detected8 \7 K2 U# W6 Z, ]; ]) R
/ a3 h  H! z' R6 T4 d
__________________________________________________________________________  b0 ?) P; K! d

7 `! [, K/ C) Z# q5 |$ \8 F) ]3 w9 F0 ^. m, T
Method 05: {4 O! t/ ]- w' j9 s8 Y
=========! x* {: a8 M1 V* f

1 p, n) R, Q: J' A4 t6 _Method seeking the 'magic number' 0F386h returned (in ax) by all system/ ~0 s; `3 K8 D2 s& |: s. e: `
debugger. It calls the int 41h, function 4Fh./ U0 T% ?* j6 p! I$ S' v7 Y* c" q- b
There are several alternatives.  
& P$ k* j6 U& L* I  k6 I8 q  S! ^" @7 S' P) D; {6 w/ t0 [
The following one is the simplest:( y+ k7 R3 G; ^$ T0 w

2 l) i( J3 [' j6 m; P$ F, }- Z    mov     ax,4fh
) k1 e6 ~# g3 Y0 `/ `& ^' U    int     41h9 D  y( x9 |/ \! Y. w
    cmp     ax, 0F386
1 q0 V$ {  Q- |2 C6 e! z6 j3 {$ N7 z    jz      SoftICE_detected
2 w+ M* `9 y$ A6 Y  I) E
2 y' {# M  Y: c, t' n8 R  l5 o
% L0 q- X5 A& l* c, dNext method as well as the following one are 2 examples from Stone's
' I) I' C# E. \9 R( L9 F"stn-wid.zip" (www.cracking.net):
' ~  x+ G: @  X2 D# [* ^7 [( r) T- j% \* ?' A1 X0 T
    mov     bx, cs0 K: Y: ?. ~/ U4 Z  E  J% h2 q$ W* k
    lea     dx, int41handler26 t3 K1 ~+ S- S+ C- K9 E
    xchg    dx, es:[41h*4]9 `. T- c( }# [
    xchg    bx, es:[41h*4+2]3 n1 W5 e# |7 H) }9 {
    mov     ax,4fh/ y' ~+ f/ W/ j9 w% R+ h4 s9 p
    int     41h6 ?! d0 H- R# F! w! S& f3 h
    xchg    dx, es:[41h*4]. v) D; }; @# o3 Y8 r5 c0 l" {
    xchg    bx, es:[41h*4+2]+ R- \  L5 [1 {* o1 W0 {. b
    cmp     ax, 0f386h% P* s, @* k, x9 K1 c" a
    jz      SoftICE_detected
! s9 b" i3 U5 R4 J3 Q# G& n
+ n4 V& A" ^" x: m# M4 ~int41handler2 PROC) G! f7 D/ h: [& |5 w
    iret% A* q# A' T5 N/ g% q* ~  ^8 T( H
int41handler2 ENDP
) X( e, O% ^  S& ?# h$ R% s8 u: X! I

$ r) d9 h2 N' ~+ G8 _- c: k_________________________________________________________________________
  G" Z: l$ X% V/ ?* ]! @% ~' x$ l" H9 T0 k8 v9 |% V, [, E
0 Y! v  R% B7 A3 L3 g- }1 B
Method 06! j$ L2 g( z2 t9 t! G1 x
=========
( j* [  ?; b' p9 m# N
8 p& [8 }0 u' P  o5 z8 t; u" F2 I2 J! ^/ ]/ S
2nd method similar to the preceding one but more difficult to detect:
8 S- U! O2 W2 I- ]1 z2 j$ L: M+ P$ b! t* B7 E! z" c
% S. l; H7 _  X5 T" T) V
int41handler PROC0 _$ r1 Y9 }3 f7 b  u7 t
    mov     cl,al/ m6 d2 w; |9 w3 W5 T7 ^
    iret" C( `: k+ W5 ?$ [- ]8 \
int41handler ENDP5 l& x: l6 O* o
4 C4 n$ s% c$ i3 L) v4 u
4 K- P+ h' @8 ?
    xor     ax,ax
+ X4 r  ^; ?, q  ^: l8 b5 u- r( k* _    mov     es,ax
- x. J0 d% E3 B' R+ E0 \; l    mov     bx, cs4 O/ |  G1 R# h* K, U
    lea     dx, int41handler
  R1 F! @% U( m7 u( W    xchg    dx, es:[41h*4]( A- F0 v+ M: W& z3 o
    xchg    bx, es:[41h*4+2]4 a: ~" v( R  G% e' }4 ~( n
    in      al, 40h6 k4 s( S" M! q( w
    xor     cx,cx# l7 Z) D6 t7 h+ o5 I" P5 X
    int     41h
; K3 f6 T: f! }2 H7 p6 ?0 H    xchg    dx, es:[41h*4]
  z: r" X7 _  g; `; |    xchg    bx, es:[41h*4+2]! r5 T4 S. Y. j* A, z0 B, B5 V
    cmp     cl,al
- T+ |1 K5 ~, N$ B+ m4 T    jnz     SoftICE_detected+ i0 T$ s) [- b

/ N. T: M  X. L) H, h- p_________________________________________________________________________2 {! Q. Q5 z! y9 Q
" c7 W* d6 J; c* o+ u
Method 07: z* j  ?! y, U) _/ [
=========
, f9 O# \1 V0 G% ~! w7 T- U/ T. P
  d  {; D; j" C) CMethod of detection of the WinICE handler in the int68h (V86)
; m; L3 Q4 ^2 \, q3 O/ k7 U! _4 k+ q
    mov     ah,43h" ^+ u; R& a& T! _7 I
    int     68h
1 \7 N. Y' m: [% r$ O1 s+ I    cmp     ax,0F386h7 {, Q7 J- D8 I  f# w" k% {+ T
    jz      SoftICE_Detected0 C% |" W0 [3 W
* U: ^; r2 {1 c

. z6 |, Q4 w( D6 B+ j- I=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 X. }7 w8 w6 @" a+ q5 x
   app like this:
" q3 A& {9 S" Z* R0 f; _( z) a2 g
" a4 ]# N- N4 {# u5 q+ _   BPX exec_int if ax==68
5 c: y& u# O0 _& r: y3 P, l, Q   (function called is located at byte ptr [ebp+1Dh] and client eip is/ F1 x" d+ l( V) j
   located at [ebp+48h] for 32Bit apps)" k: [! r: j. P5 C4 ]/ }2 n
__________________________________________________________________________9 ]" Y4 D2 m: J1 i
5 Y8 D5 Z( X% j; w

& t3 g' i3 G: }3 _# f+ ~2 {/ H3 iMethod 08
* [6 @" V' \) H' L3 Z) i# b=========: i* @6 i7 j0 P! ~' y7 G
7 [- \+ D% _2 N( P2 T) X. a
It is not a method of detection of SoftICE but a possibility to crash the& q# i6 Q+ w8 n+ L5 }
system by intercepting int 01h and int 03h and redirecting them to another( j3 X9 F8 i0 o  _: d5 K
routine.5 J; o2 F/ c$ n  E3 @6 h
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points! `+ f; W) p- a+ d
to the new routine to execute (hangs computer...)/ V  \" {$ D% H8 Q9 J0 u, I

" G9 F* `2 o6 ]; o3 p4 X5 c    mov     ah, 25h! s4 ~3 y: p# W3 f' ?' N
    mov     al, Int_Number (01h or 03h)9 a; D0 C) a  v7 k- p" I
    mov     dx, offset New_Int_Routine' F* [7 T7 W5 `
    int     21h
) c6 z# }' t6 S
; y7 ^# L* E7 i: h__________________________________________________________________________) \. F3 _, @$ e8 m! ]

: H0 `; S* B" Y% h5 ^" GMethod 09  L9 s2 ?# q% p+ x* k$ g
=========
- N; \, `5 f+ l' m/ z' k
; ?0 Y- ^* d! xThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 R0 `8 y+ N: P) V; Q0 b& P6 q1 c, jperformed in ring0 (VxD or a ring3 app using the VxdCall).* Q- c, @- i( E( g9 N3 [* f
The Get_DDB service is used to determine whether or not a VxD is installed
/ N1 V' K: D: P# C) Zfor the specified device and returns a Device Description Block (in ecx) for& j/ F( k6 N6 \/ p$ {9 U
that device if it is installed.
$ n4 o" H  \: Q3 f: \( S2 G" D  d0 y" a
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 ]; j! x" P+ s0 }! ?  P2 d
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 Y1 s- G6 c, n* D
   VMMCall Get_DDB
9 ?% l; _& ~3 k5 ]7 _" x$ C   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed5 @4 F; G3 p9 j) s$ b; X) R. }
. v! M  h5 E" Z: \- F
Note as well that you can easily detect this method with SoftICE:  `, {4 m- L3 e+ R
   bpx Get_DDB if ax==0202 || ax==7a5fh
# X% |8 {  {6 R( c+ G+ L+ c% z9 r4 X9 v1 Q: }8 f0 }
__________________________________________________________________________& E$ g! X* i9 b5 E4 ^0 e
* c  o: M0 T+ a
Method 10
8 R* v8 H6 [* ^$ @( G+ A* c=========
9 y, y# Z* K* K: V3 c  C
, E1 b4 b& N( L/ N0 {& u=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
  S! q& @6 Y* T. ]  SoftICE while the option is enable!!2 M1 k0 I& q4 i& y4 [& D

% ^' \4 J) n  z' o: kThis trick is very efficient:
$ l6 H1 W- p/ P$ S4 E$ u# N$ V$ mby checking the Debug Registers, you can detect if SoftICE is loaded
7 y4 U$ F7 [. S8 H( f: e(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 h6 K6 V9 _7 A- uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
8 _6 d3 R( J3 r, nvalue (in ring0 only). Values can be manipulated and or changed as well
" I& u% S" {4 t2 E) ?(clearing BPMs for instance)
5 T. y5 q6 [& U, E
& J" u" m- t. S. e( H/ M( B- B__________________________________________________________________________+ X2 b1 X, X8 u. @7 v% r

! a# }$ ?* G: t- ~1 j/ nMethod 11; ?& u+ v' g( U# d3 t# E* U
=========
% T2 G' K5 ?' ~/ _  |8 A0 l" h: H5 f+ f8 [; u2 n4 F
This method is most known as 'MeltICE' because it has been freely distributed, r3 g. `: [; p9 w3 b  }6 p
via www.winfiles.com. However it was first used by NuMega people to allow
& U8 B; g, d% Q/ P! X- _( T( p- dSymbol Loader to check if SoftICE was active or not (the code is located+ d! F+ s" I' y9 I5 B7 k
inside nmtrans.dll).
) E. |* H2 C: E+ m
/ z* E4 J7 ~( Y9 [/ Q' R6 {The way it works is very simple:
+ H8 \, {9 ?" i* w* GIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
, |, l" B/ M8 Q1 p; YWinNT) with the CreateFileA API.* e( G5 [3 }- L6 \3 r7 X0 H* V

- Q, c3 d9 o+ ]! p. k1 O& vHere is a sample (checking for 'SICE'):; Z2 e* i, {' X  Q( f8 i- |
4 |) G  e* {' W# A) [& p: l7 I. z
BOOL IsSoftIce95Loaded()
( ~6 l& N7 U2 {5 f; A0 j: a* Q" M3 r{' M' B! G# g$ }  C; O" G7 w
   HANDLE hFile;  1 r  s6 O. o, B
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ z% J1 q( A. m                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 H: A! v; a: b9 e: p                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, R) u5 `0 i' `% b* V5 ]6 M) q
   if( hFile != INVALID_HANDLE_VALUE )
* N/ Q/ t; q, O* O3 N   {
5 o9 i, L% F/ v7 i+ n5 Q9 |0 w5 H      CloseHandle(hFile);
0 {* L5 q+ H" p1 n: L      return TRUE;
1 ~$ t  \5 j  f1 {$ a+ z   }- ^. b, k+ {3 u
   return FALSE;( K8 E$ |' c6 e, H# Y
}6 K# l. S$ p% ?3 Z

8 i4 j6 g8 e" M, x, e! Q  PAlthough this trick calls the CreateFileA function, don't even expect to be0 }3 @- w; y1 S4 i0 D2 K$ a0 H/ `
able to intercept it by installing a IFS hook: it will not work, no way!
/ ?5 B( W8 {: o7 }* z$ g( k* P* s- |In fact, after the call to CreateFileA it will get through VWIN32 0x001F, C( W6 @* A1 n; r4 `
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 b1 ?9 C( R7 H
and then browse the DDB list until it find the VxD and its DDB_Control_Proc' `: \* P* l0 E9 ~9 W  [: Q
field.: C6 G0 F! j1 d( v) H
In fact, its purpose is not to load/unload VxDs but only to send a
1 \0 \) v$ w4 n% U3 VW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: u- n& h5 t. Z3 A+ n( @0 I/ d: Dto the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 e1 B* L8 `" q$ C  c! \* D5 K' x6 Yto load/unload a non-dynamically loadable driver such as SoftICE ;-).- n2 v; s% P6 `5 I* H3 |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
. c! d# `$ Q9 ^1 L6 y3 Zits handle to be opened and then, will be detected.
7 T* f+ \) v) BYou can check that simply by hooking Winice.exe control proc entry point3 _( ?, Q3 C4 D7 e2 t7 I9 H7 h
while running MeltICE.: z4 R( d9 I% P; X1 S
( `, E% _" T3 f! f. x7 t

- B% W/ d/ O5 D+ v* p" V  00401067:  push      00402025    ; \\.\SICE* W& Q. r+ ~- A, c: |6 `5 a5 L, e7 d% ~
  0040106C:  call      CreateFileA
  _5 T7 }. r  U6 a) h* z! _  00401071:  cmp       eax,-0012 F  z% Z) P' ^$ r) W5 A! g* P2 }
  00401074:  je        00401091+ Y2 C' a9 t( ]" F) F

; F* z' ]8 t1 w1 H  k7 r/ o8 K; H. L6 }
There could be hundreds of BPX you could use to detect this trick.
3 |% e, h2 L8 C-The most classical one is:
. h7 a6 w( ?/ w! K; E2 {% D) y/ v( g  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 H! z5 K2 O9 p: E! i; A
    *(esp-&gt;4+4)=='NTIC'2 w# c1 r% q; T# ?* T3 K
' K' a5 Q, F: A$ F/ M
-The most exotic ones (could be very slooooow :-(
- N5 H9 O9 [5 P2 h' \   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 X9 L* {* G1 T' {+ `
     ;will break 3 times :-(4 [% ]: S2 r. c0 E. \6 m. w: k
7 N1 m, N, i, _# n: q- T" C( D
-or (a bit) faster:
1 X# r7 z0 ~3 U2 K* t   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')4 C3 i. X4 Q$ w* ~; a) B" U
3 L) T" |: I0 C6 B4 Q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
. b4 O+ N4 G: ~7 E- L( q. z     ;will break 3 times :-(
& E, e7 [  J1 B9 B9 E8 T/ o; \
) U( z, ]# Z/ f8 F8 ^-Much faster:
( ^+ o# X, P3 w5 X! c5 ?   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
) ]+ h# n& D' K1 G0 F; r' j9 I" G5 v3 [9 K4 @8 c, Y7 a
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen' k- O5 `: ^3 @& ?
function to do the same job:
" ?8 Z9 b4 E* s3 K0 b' K, x# U; S# N; ]! F3 q% K# k3 Y
   push    00                        ; OF_READ
; _3 p2 `% `" b3 x% J: S: _   mov     eax,[00656634]            ; '\\.\SICE',07 {8 G+ L: h3 Y$ O1 a6 n; r
   push    eax
3 N% S9 B) Y/ Y$ @, p; @/ ]6 M6 a   call    KERNEL32!_lopen  F5 l- n2 h/ P- S
   inc     eax$ Z( l' t' s% m5 r/ Q
   jnz     00650589                  ; detected
7 j7 j* |0 t0 x9 O5 w. F! ?   push    00                        ; OF_READ% a' B4 p8 N6 p  i( a/ L3 R. t% g
   mov     eax,[00656638]            ; '\\.\SICE'+ |+ N8 Y3 |9 ^5 k' ]+ @
   push    eax6 W& b; K# H$ E( s
   call    KERNEL32!_lopen0 l0 y/ O  s8 m* a$ z! e+ [- @6 w
   inc     eax6 B4 Q- d! E3 v7 h% W; w
   jz      006505ae                  ; not detected9 H& W. t* P/ |/ H( Q+ R. ~

9 w/ O" f9 Z) a, ^- l
9 a3 _0 @: o, f2 Y; ~/ |" L__________________________________________________________________________( Z$ v; a% n7 |
2 o  [# q% W3 j
Method 128 I) h( G$ v% E9 D( J- o, q
=========
# I$ e2 i9 R% j. v- C( O1 V( r7 n5 G( H
This trick is similar to int41h/4fh Debugger installation check (code 05
, s, w4 |; L) `$ H% N&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: H3 y" B9 ~4 K0 B! X1 W6 xas it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 _- ?+ p8 S$ |1 j2 D

! z( n- I7 k* w& h  p   push  0000004fh         ; function 4fh/ c& J' }% n; h- _! k
   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 T$ O0 F$ J! l! ~) V5 z                           ; low word specifies which service2 u' _& n5 E7 O; V4 A) D! }
                             (VWIN32_Int41Dispatch)% v; H4 v, _% F- t! D7 Q
   call  Kernel32!ORD_001  ; VxdCall
0 O9 P! z  |/ c% P, o- W& W- @" V, |9 t   cmp   ax, 0f386h        ; magic number returned by system debuggers
- H1 M( j0 F9 X) ^0 N- G   jz    SoftICE_detected
  V( P' P$ `& X9 q
! u, ^; r% e" sHere again, several ways to detect it:( m7 g9 t  N- _

* o2 E% v) _' Q    BPINT 41 if ax==4f
- j8 u/ B9 R( i( J/ b
2 `' Z1 u$ e, b) q) V    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 w  I# I5 ?. m  A
+ E; ^% l+ L2 [8 `8 P    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' u8 q5 p; A% b0 t# A* G& i9 B6 {5 x$ @$ Z5 X, m
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 E: X/ q, t) b3 U8 u

$ p$ K# P/ Y% l5 ^__________________________________________________________________________' f0 }- N/ P% u! i( j

" D7 ^3 G7 ?0 ]; GMethod 135 U3 {( f4 f2 T5 O
=========
$ t) U3 h& O9 f+ s6 L2 A/ \9 X; W- t0 D' |& M8 p: ?5 g$ J/ `1 t
Not a real method of detection, but a good way to know if SoftICE is9 m# d/ |- B4 ~. Y8 L/ d/ P5 D
installed on a computer and to locate its installation directory.2 V, x9 \. a* q
It is used by few softs which access the following registry keys (usually #2) :
2 N. v( w8 m" {  W3 J4 o+ B
3 U" X, R" v8 J' N( l. Q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 {/ T" s/ w0 z1 J7 X
\Uninstall\SoftICE
' X; h  }& M/ \6 W/ h-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 I! z& i3 l0 ~' _5 i- A( T: z
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 m8 D. V- e7 M0 t- G
\App Paths\Loader32.Exe( S9 x$ n+ E# G1 |" p5 v

) S4 [1 y$ N) T
. b, I% w3 O5 k8 j+ N5 I$ TNote that some nasty apps could then erase all files from SoftICE directory
2 j: I$ R2 t3 ?! l+ W! ^8 s* H; n(I faced that once :-(
# f* k+ ?; y8 T! Q! n4 x2 n4 v9 X+ X% _' L! p7 j
Useful breakpoint to detect it:
/ y. i% H# W1 m7 y/ {" @
' z& r+ }5 c  G" U3 ]     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) |+ C  M2 `% D! O- g0 \. Q
0 f$ G4 x, o6 v* c) M__________________________________________________________________________
, j6 d& v/ G: `4 _
" Q8 a+ ~0 U$ e( z, b/ J: V  e8 M% S- I) G
Method 14 5 n# j; c; }: o4 }5 H1 K' _8 I
=========% j6 {8 G5 U- e3 _0 L
; u' f7 D6 d& L
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 M: }6 O* D8 ~7 ^9 l- ?/ y3 P8 Kis to determines whether a debugger is running on your system (ring0 only).- z: }& ~! B/ z/ F4 G

- }5 q! l* l$ F$ H* U   VMMCall Test_Debug_Installed5 Z4 v) X; u8 z4 @& u" I
   je      not_installed
5 x) d, s$ _7 C7 O4 P
1 X# T2 a  p4 W2 RThis service just checks a flag.
7 d2 H( V- A0 M' ^+ B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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