About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 a! a- ~2 }' m<TBODY>
" U" ^# L1 Z3 A<TR>
# b( s1 E* _4 q8 j3 ^4 U<TD><PRE>Method 01
8 C1 p) p" D( R$ j* I$ ~! ~=========
) L0 H8 k9 F6 |) o, R7 R) s  U# Z! J, l- l- Q4 j
This method of detection of SoftICE (as well as the following one) is% d* A5 R& g  |( i: }" i& ~0 j
used by the majority of packers/encryptors found on Internet.' J3 [6 k& \' P9 H# c
It seeks the signature of BoundsChecker in SoftICE
9 y0 M: v  T: E- G$ m8 L% H1 f! s, ]1 M1 M2 p
    mov     ebp, 04243484Bh        ; 'BCHK'
+ G! ]8 T2 n+ T" X& ~, r& f    mov     ax, 04h" u# {, j2 e$ c! ]( i. v5 m( j
    int     3      
) |* Q4 u4 K; b# x    cmp     al,4
" X) s  y6 o0 }/ U6 Y. A    jnz     SoftICE_Detected
% R/ M6 P! T! e5 l. }6 T$ }% A3 O. `  {
___________________________________________________________________________+ T( |( a  }+ Q& I) Y- B

4 [6 s+ m' C  e1 b2 D0 |Method 026 c% q3 u: l/ {4 Z
=========4 E7 C/ A- y9 T- v+ B4 c4 T- @/ b
# Z9 s( `* W, U) p
Still a method very much used (perhaps the most frequent one).  It is used
+ v2 j4 Q/ j+ Y& D7 V5 |to get SoftICE 'Back Door commands' which gives infos on Breakpoints,% f& H3 U& {; E, F: J1 K* H
or execute SoftICE commands...
. k6 Y- e: o7 \, W1 ^3 KIt is also used to crash SoftICE and to force it to execute any commands3 |/ Q* {; v% D4 m' T
(HBOOT...) :-((  2 {, ]1 X, B) N8 |; ~: T: d  i$ G
, D/ [: {6 w0 `: }- V
Here is a quick description:4 ?4 k& D3 C' V7 o
-AX = 0910h   (Display string in SIce windows)
; o+ ]$ c7 ?8 I% n, T4 U& _' K* k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 b1 l, b) @; R7 Z5 t1 w# [2 g1 b-AX = 0912h   (Get breakpoint infos)5 N7 Z3 l( P: E  A1 m
-AX = 0913h   (Set Sice breakpoints); C& C7 }; i" l* a% J6 P* g
-AX = 0914h   (Remove SIce breakoints)
: Q5 {. a' u( p( A$ I! h" @
* M9 w. I% a0 e- y% KEach time you'll meet this trick, you'll see:
9 W- E/ r' S% z7 l" l2 i4 U7 T/ I-SI = 4647h4 z# ]0 X3 [- @+ p; D2 q$ T1 c7 c
-DI = 4A4Dh
* ]8 U- |( @' oWhich are the 'magic values' used by SoftIce.
7 M0 @- g% S* x8 |# HFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) s, y: l' `7 T! u- ~8 o6 h1 z' A" d* X# c
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, T# z3 `8 \6 W% W, GEnvelope utility use to protect DOS applications:( n! d- A% H% `7 ~" C

; J+ I9 s: U/ g# a0 C# W
9 S  T# l  d$ u' v2 h4 ^- Z2 U; w4C19:0095   MOV    AX,0911  ; execute command.
1 K3 m+ Y+ D1 h$ o/ {2 `/ D4 g4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, v! y4 _0 T( U# Z9 Y* c% W& z4C19:009A   MOV    SI,4647  ; 1st magic value.% C( r6 {8 p* `: e9 h& |2 B
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- C6 \  U' c5 N4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
. D! r; \6 |7 ~- ]& V4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ C+ Z  M: d) t6 X$ S9 k4C19:00A4   INC    CX; H- L& y* V3 W. H5 X# ?
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& N5 ^4 Q2 a) P7 K6 u4C19:00A8   JB     0095     ; 6 different commands.# ?5 F" c- b" X7 r' g
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 E% R+ ~" A# s! ~% r; p+ f
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 v) C4 |; v6 t" L  @& V
: c0 A$ ~; q6 A* E& }The program will execute 6 different SIce commands located at ds:dx, which
% h+ k% ]5 H& z( I+ F$ oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ ~5 j# \: B6 f4 ]4 R0 e6 c
) E  ]; ~6 R* F# v+ d# {8 V* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 B$ i6 [/ r7 a+ A/ [) J# ]+ o
___________________________________________________________________________; |0 \1 i0 h( L1 g4 \

8 O9 x( V! c5 B6 J- \. H- u. o2 A4 _  \) i3 N
Method 03
7 ]& O" a. B9 ^) m6 N8 @# I" l# m6 ^=========' X2 c4 h2 ]0 R( h
% n4 p- W. R! B  C
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 i/ j& o" e7 w4 H) l  \1 F(API Get entry point)' O3 {. \5 l; b. m$ x- ?4 m! y
        
' J7 k# A/ u3 T: v4 q3 P% y' M3 X9 V. a2 }! ~6 D3 F! d( v
    xor     di,di, `( @# a: H* J0 P" Y4 I. [
    mov     es,di
1 e* D. `$ R& W0 X3 U: {- r    mov     ax, 1684h      
  J$ m) E* L0 d) P) U    mov     bx, 0202h       ; VxD ID of winice8 T$ D/ M) G0 s% y. W8 g6 G9 {1 W
    int     2Fh
  ^) z# _4 c" A1 [3 B) r. {    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 q) D8 b# P5 I, u3 S    add     ax, di0 [: K! r3 [/ S8 M) k9 _
    test    ax,ax
# C- E4 \5 t" z# \# A( s! f1 z    jnz     SoftICE_Detected0 l8 ]+ m7 ~0 t- D2 v; ~8 a7 c
% E  r8 p% I" \$ Z2 _4 v  @: `4 x' M
___________________________________________________________________________3 H6 A2 [$ m, J2 m0 |
+ \4 I' j0 q2 E6 W& M
Method 042 [. |, v7 V% L# R) E% Z! F
=========
) P, I( F0 `  ~& J: M; Q$ w- S, E2 ~4 g" g! `
Method identical to the preceding one except that it seeks the ID of SoftICE6 B& V0 i( c( |' K
GFX VxD.
/ K# S3 B+ b( @7 v; `4 T' V/ e( h+ S" v8 I9 h
    xor     di,di6 ?) f8 {5 n% S* ~& ^4 Y
    mov     es,di
# w. l6 b) l& K- X    mov     ax, 1684h       5 W, t' H' Q1 G3 p# @' T  t
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 s( m0 a  m( s8 N% Q* L    int     2fh
. ^4 j; w$ C% I* J. Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' ]1 ^/ ~% q; L/ f    add     ax, di
( [0 D, Z: D+ d6 B: ]0 z, g    test    ax,ax# X0 F! T3 I: U6 n
    jnz     SoftICE_Detected/ C, Y1 h4 |. O/ o7 U+ ?; k8 T
7 l* Z# z$ p6 O
__________________________________________________________________________
: c( u# r  l- G- A- I6 D4 E, _) q+ ?
1 p  }7 K& X' \  q) J- t- }
Method 053 a: R+ K$ j: T" T
=========
7 A) \* Q' D( V2 H) d  E4 `* j9 ^$ a* V9 M4 O: V' X# o
Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 Q0 B( M+ C5 M( K" o% s: r! Ddebugger. It calls the int 41h, function 4Fh.! X6 w+ T7 X; G; b8 O
There are several alternatives.  $ |" g6 Q2 E1 f( Q. v* Z
6 \. I  e. p' T
The following one is the simplest:
- i1 Z& e9 ]* \# s# f% z5 K  K2 T( D& r5 K* H+ K$ P( v
    mov     ax,4fh$ E2 \/ E* D& x" r* J1 u8 P9 S
    int     41h
6 g9 }4 Q; g7 `$ Q1 p- x    cmp     ax, 0F386
2 n* s8 D( e+ c6 _) ^! K: i    jz      SoftICE_detected
; O! f. A, P# I0 E+ n, [" f, A9 z" ^4 K. Q7 u$ y) q/ f( X  p. w- J
' x  r" n7 y# S* T) T7 Y/ q0 E$ \
Next method as well as the following one are 2 examples from Stone's
) I8 I' S5 k9 ?6 \# e"stn-wid.zip" (www.cracking.net):& Q; K& _6 V; _, c, f& M5 {* M
. u6 h0 ]6 t7 {) x, o
    mov     bx, cs4 w  B' B& r9 L8 P
    lea     dx, int41handler2* }5 p) A) n- Z  Y0 Q: T
    xchg    dx, es:[41h*4]* ~+ R# b& Y( b& v8 a5 V# w
    xchg    bx, es:[41h*4+2]
+ a  v; k  W! @5 I% M; T) x+ L# ?    mov     ax,4fh5 |, I7 F  Z' M6 _9 T. I- T+ j
    int     41h
, @) y, {( h2 M; H    xchg    dx, es:[41h*4]+ Q! Z# c: ~, I
    xchg    bx, es:[41h*4+2]
, p, U4 ]0 F/ Y  ]    cmp     ax, 0f386h, B2 l! m* Y) u
    jz      SoftICE_detected
9 F7 d6 }! J7 s7 P
4 B6 G# c  A; O5 Y/ D0 |int41handler2 PROC
0 R5 a: E& Q6 A- |    iret& y: Q5 v% u# H& e+ v
int41handler2 ENDP
9 D% j8 n# R5 E( j- L+ U. p/ f% R2 b# }2 Y" W/ h8 e& P/ }4 j
0 o" Y+ k' j5 D4 p
_________________________________________________________________________# d9 Y/ U% T8 [
# @7 E( R3 [; g$ W. O+ Q. w8 _

& Q. q" E: ]( l0 ?) G6 h3 oMethod 06- }! M7 u  }% E4 K
=========/ T4 g% o5 T2 c6 }
. q8 l- g0 [5 z0 p3 `
( n2 s4 m1 q3 p' n$ f' T4 S- m
2nd method similar to the preceding one but more difficult to detect:
3 F5 B1 d7 V9 q( A5 E+ A# {; i- ?! L: S
  e' t( U" {1 X; c1 q) g; R& h
int41handler PROC% v& E& g0 ?' D% |/ G' S0 ^! E# L
    mov     cl,al- v) M' ], y9 s- Z8 t
    iret( Q" l$ E5 l6 c8 O/ Z8 w
int41handler ENDP
# X" B" R1 v* U; a8 g7 L% D: v1 c0 q3 a( O. A

& j2 s. A& P% i+ Q* |: P5 ^4 v    xor     ax,ax
# @& G8 Q8 t# X/ C0 {    mov     es,ax
) o& O# W1 `3 @) A5 e7 |    mov     bx, cs
' k8 q; k) i2 C    lea     dx, int41handler. e5 n; V4 H, k' d
    xchg    dx, es:[41h*4]" c( ]( B+ M3 ?1 c4 G' D
    xchg    bx, es:[41h*4+2]' s+ h) R& v5 J
    in      al, 40h
  {& S" _) F0 G( a    xor     cx,cx
2 t" ^5 A% I* w' M8 G- {$ g    int     41h
+ z& o. _3 I/ N& w; j    xchg    dx, es:[41h*4]1 ~( L; W8 a$ @3 X, I+ ]
    xchg    bx, es:[41h*4+2]
/ F. v  k- ^  O2 F% ?    cmp     cl,al
: v5 g5 _! t3 k6 M' K    jnz     SoftICE_detected
4 O# u. m) `+ W' |' w% U; W' X8 p5 U& F- L0 u" p8 u5 d) t0 @
_________________________________________________________________________+ B  _, z0 l7 w$ {8 ?+ p
/ r. o5 z) p9 ?" R
Method 07
7 C4 K; e0 e, Y, R0 ^- |=========
( p% f7 u( D8 g2 T
) i7 s- h' n) p2 gMethod of detection of the WinICE handler in the int68h (V86)
- h; M0 i/ M, }5 f& z8 Z
/ ^8 T! j' [" d+ ]! v    mov     ah,43h
* Z' m7 T2 O: a7 i7 m( I6 M0 h    int     68h
0 Y, L7 q' Q! y8 N- d9 y3 z, T# {    cmp     ax,0F386h+ j5 x1 p( J* j- H. d5 b1 I6 \; v& z
    jz      SoftICE_Detected
. @9 x* x) F: G8 h0 o' N
" }: ^) X9 E& ~* t
- r. X( w- J$ ^8 s9 v6 r3 S% L=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
! ^4 K) y8 S' t! I; f: B6 ]   app like this:
, m+ Q, k& t! A- \, [+ d$ f4 e- Q' I$ O8 n0 N+ n) O
   BPX exec_int if ax==68
6 N5 a  T( D" h, z$ G   (function called is located at byte ptr [ebp+1Dh] and client eip is
$ M6 g3 y- _1 z9 z* B   located at [ebp+48h] for 32Bit apps)
5 B6 `+ V& O: y+ s* L8 V__________________________________________________________________________
6 W2 \' e  K0 N* g( ~2 b
% L: P& O* o. [. ~. j2 ~, Q2 I
) O& i2 K$ D- u5 `, V! m* PMethod 08. \+ T6 g  o8 m$ W# m, m7 H& W
=========
9 z5 ~+ m% j1 q( E) K3 S. ]
  v7 C5 x2 j5 MIt is not a method of detection of SoftICE but a possibility to crash the6 e0 U. ^3 v+ v/ G2 M& I3 ^; W4 w4 k
system by intercepting int 01h and int 03h and redirecting them to another0 a* t6 g( h4 x) ?& E6 [4 y
routine.! \% c+ }4 m% a7 z" z2 G. ~
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  ?# P# C2 ~1 S, J+ \6 c" Oto the new routine to execute (hangs computer...)" v6 h3 v5 L- T0 o) S5 [

/ ]8 w) e8 O# U  i$ [; ?    mov     ah, 25h
* h+ ~( s7 b( B+ i    mov     al, Int_Number (01h or 03h)
8 y0 v0 a6 @6 X  Q' l, I    mov     dx, offset New_Int_Routine, K9 @% q; W" |# H9 O3 ]3 c) i% h
    int     21h6 I- E5 G* M1 {1 K
& c0 A8 z  i) T" }+ s5 Q, _
__________________________________________________________________________6 b$ t9 z# t4 S  c, f
; R  I; w. ?% W/ H/ x
Method 09% H" p( V6 A! ^9 q4 P
=========
! C* m0 a  L+ i! Z; B! L& v* @7 R0 J3 u" \1 ~
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 w2 W# F! i8 I1 x. c  g$ hperformed in ring0 (VxD or a ring3 app using the VxdCall).
. l) P# H( K$ N7 f- n$ v* P& @The Get_DDB service is used to determine whether or not a VxD is installed4 D- {, r# k) ?7 t, ?6 o
for the specified device and returns a Device Description Block (in ecx) for1 [5 [! C1 t6 t+ k$ ~+ ?
that device if it is installed.
: C; d" G* s0 d6 L$ G3 ?6 W. u1 S) {, h' ?
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
6 c, v$ C  H8 ]: y  ^. I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  m* ~* D' O7 M  h! T+ [! p
   VMMCall Get_DDB
3 @" V% d1 i% y: y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 ]3 y: h$ G4 U# p

' q4 ?' p, O1 b' @Note as well that you can easily detect this method with SoftICE:& D- {" G) i( W
   bpx Get_DDB if ax==0202 || ax==7a5fh" z4 C, m% R2 w2 o  S. v4 T
* L# S9 ]* w% d9 e; N- m3 D
__________________________________________________________________________: f" u5 `+ r0 J/ u0 U' H$ P. b

; e3 p% ^8 T! P( B( |; pMethod 10
# s4 i# F: g' w, b3 K=========1 f4 U4 X8 d) o, m( V
  H/ h  \$ K- Y' z) `8 e
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 h3 ?- z; F+ w! H" m3 t
  SoftICE while the option is enable!!
1 Z  x0 T+ C0 X0 p& s" p0 R, ]: y2 I% y! Z
This trick is very efficient:
& f0 d- K2 {: l  P7 hby checking the Debug Registers, you can detect if SoftICE is loaded6 ^$ _- N( u" s1 Z) X6 _* L
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
3 u5 g0 d# C" x4 F; P9 t- ethere are some memory breakpoints set (dr0 to dr3) simply by reading their4 F1 `2 d7 X! y9 m6 x* ^
value (in ring0 only). Values can be manipulated and or changed as well
4 v* z4 T, |& _' K(clearing BPMs for instance)2 U9 J, A3 m( C' P& h! l/ ?! ]9 H

9 ~" E4 B# j5 a/ t0 u: i6 \__________________________________________________________________________
  W8 `; F# G: P8 p4 }
- A! j  @5 M6 r; hMethod 11
7 u. E" R- E$ @8 `; Q=========4 _3 H' i- _6 ^# K3 a; n
9 ]0 Q9 ^8 N( d, k9 {: K
This method is most known as 'MeltICE' because it has been freely distributed8 r; {/ {: y$ O9 i/ W+ e) n3 e
via www.winfiles.com. However it was first used by NuMega people to allow* v% P* M. v- \& y2 e' U6 [; `8 `
Symbol Loader to check if SoftICE was active or not (the code is located5 P' C5 L* i. U: y8 s& ]
inside nmtrans.dll).* h  E3 U8 m3 k
, e! O' r4 e! \, V
The way it works is very simple:
9 A- |# g8 U/ Z3 MIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  i/ s; r7 v( g3 T/ C
WinNT) with the CreateFileA API.
( d( S3 l/ W# H; c; Z* V2 V- t8 f* S9 `) C7 x
Here is a sample (checking for 'SICE'):+ O# }6 Z- m/ g% t! u  u+ s

, t0 T. W3 N( F6 I/ I7 yBOOL IsSoftIce95Loaded()
/ k: f; N3 M" p: e  s: Y/ `, H9 T{/ r0 p1 Q1 u' J! f/ s& ^
   HANDLE hFile;  ! s- y3 o) u3 O- M
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( N: {* k! R/ b3 ~' Y                      FILE_SHARE_READ | FILE_SHARE_WRITE,
, h, J( v$ ?0 X9 L6 D1 d6 y$ e7 h                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* ~/ |$ ]6 k2 C
   if( hFile != INVALID_HANDLE_VALUE )
) @% r0 ]( T# U+ p- B0 W   {: z) ?. d. S. u+ x; {9 z
      CloseHandle(hFile);' n0 Q' |: Q# ^8 ^% Y# e. a+ \
      return TRUE;: W' Z" V: G1 H9 E& X
   }
4 m  W4 Y7 [- n3 n( T$ a   return FALSE;
" b+ k0 z/ i( M0 m4 A}. h  f$ a- U# `5 b( G( y. ?
' ~; X/ o$ K( r! r1 K  W! q
Although this trick calls the CreateFileA function, don't even expect to be
# e0 L: e. W6 L6 l  {able to intercept it by installing a IFS hook: it will not work, no way!
2 w' l, |3 m: M0 B4 i/ OIn fact, after the call to CreateFileA it will get through VWIN32 0x001F( C. s7 E/ i. o5 G; U8 L
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 ?( d" x5 u/ s- {" d, o
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 Z1 k& v) I2 @4 b! xfield.9 q0 |! M1 C( G4 N6 k8 q
In fact, its purpose is not to load/unload VxDs but only to send a / H3 u, w8 E0 V5 |3 c1 o( F
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# ?" |3 `2 A+ t; k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
, R" I& Z4 f& F( k4 o4 lto load/unload a non-dynamically loadable driver such as SoftICE ;-).
% x9 b" N' G* `. ~$ u1 tIf the VxD is loaded, it will always clear eax and the Carry flag to allow& L. a) W+ Q& U- n( d6 c( T1 z
its handle to be opened and then, will be detected.8 r. J6 n& I. I0 |
You can check that simply by hooking Winice.exe control proc entry point% q0 ~. J+ \. h1 _; a
while running MeltICE.7 Y' r+ g1 u1 O  E
& Q7 P3 {3 a- y8 U1 W/ i9 s" R

3 }; z- A6 M; A9 |9 {  b  00401067:  push      00402025    ; \\.\SICE
2 t1 y3 w( g4 X8 z  0040106C:  call      CreateFileA
6 c5 A: ]6 {4 L9 y* B( V  00401071:  cmp       eax,-001
( P8 m6 L7 ?$ L5 S$ n% D4 E( S3 U  00401074:  je        004010919 v8 u9 ?6 _) U

3 }9 }) v6 t% q& A$ v& ^+ E7 g3 v) b2 l
There could be hundreds of BPX you could use to detect this trick.- i4 V: m, l" {9 [6 g: `
-The most classical one is:
6 |& s/ ?% h3 j' |5 f. o( f2 }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* }; l, l# b4 u9 C) Z    *(esp-&gt;4+4)=='NTIC'- S% ]6 p: U; P# L0 Z- a, y& C# o4 t

' F0 L& d# i# }' J-The most exotic ones (could be very slooooow :-(; y/ u" P2 N6 w# V3 j" q" n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 l) v( a, h3 I% A" z     ;will break 3 times :-(: e! }9 s5 J5 ~! ~1 s

6 D, m4 }  @0 b: D; a; E  T-or (a bit) faster: 6 Z% Z9 \; r: w% ?: @7 E
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 F8 f5 g- G/ p; K4 D, t' q) L) A3 {- ]5 z2 |7 S9 o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  4 c8 F# E( S' z9 P0 f
     ;will break 3 times :-(- g0 N, T" R! q9 L+ h* l/ h

2 Q$ K! ]" e# m7 [4 D, \  Q; j1 `-Much faster:5 F& _% \- P0 W; d; H
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; Z0 i# x- O2 ]9 H8 c4 L
0 t9 a/ ~: V7 [% v/ ^  L# rNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 {; A, F/ O0 S  a& mfunction to do the same job:
$ I. H, x/ H6 U1 o: \: e% T5 M6 f2 \
   push    00                        ; OF_READ
9 S" w+ {9 x+ Z6 r2 D. L   mov     eax,[00656634]            ; '\\.\SICE',0
  }* e8 }( T7 V4 d   push    eax- A' Y# H# d: ~! f1 o2 l
   call    KERNEL32!_lopen
' R" \" k7 U/ o4 x" X1 k9 P9 ?1 @   inc     eax- K% S8 J) c" ?7 L! s4 \, L! i: G
   jnz     00650589                  ; detected9 g! I9 M- b6 K% d+ G/ A
   push    00                        ; OF_READ9 r* @5 Y# H/ ]& Z
   mov     eax,[00656638]            ; '\\.\SICE'
! B/ M6 B0 y6 X: q7 h   push    eax6 ^$ [' n/ w' Q' t9 O9 X
   call    KERNEL32!_lopen
! [: r$ `) I9 X   inc     eax
, E# u8 W  r, R. d( e   jz      006505ae                  ; not detected6 H: c+ V4 o5 s4 ~7 O

, B: S* n& Q. ~/ Q" B1 \& T7 d( x. E
__________________________________________________________________________
  w5 Q6 I2 I: h1 S7 j' M
. w3 b: t( W8 J) @% ~& w% Y5 MMethod 12) y  r5 R3 l/ B9 z+ O, B
=========
" t; U& x( H: Q/ _1 Q" f% P# o  U3 k0 K+ p; D$ i' F
This trick is similar to int41h/4fh Debugger installation check (code 05
1 |! C1 ^: L3 ^3 Q4 g&amp; 06) but very limited because it's only available for Win95/98 (not NT)& L# Y6 `" e1 g3 B1 X
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; {, Q8 Z, F6 ^# `

) Q% w  Y/ k7 K: m   push  0000004fh         ; function 4fh3 G# r8 g7 }/ k$ o( o7 B
   push  002a002ah         ; high word specifies which VxD (VWIN32)$ O# i7 e! r! d! _
                           ; low word specifies which service, m. e& w, ]4 B( ]8 n! L, f4 Y* [" g
                             (VWIN32_Int41Dispatch)
3 ]$ [! X6 ]6 x% l1 S   call  Kernel32!ORD_001  ; VxdCall
8 ~" l3 }! I5 {9 o   cmp   ax, 0f386h        ; magic number returned by system debuggers7 l2 z( O9 d" ~! s" n1 X
   jz    SoftICE_detected
' K$ R- v" h2 a% \1 s4 Y5 Q
7 w5 T( U* X! ^0 ZHere again, several ways to detect it:
/ i$ B% H' U& m- B1 x! P6 l: |: @4 R9 {* l- _
    BPINT 41 if ax==4f/ W" \3 B8 k0 ~& n

1 Q: Q- S5 C0 u  a    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one. b+ q( p/ I" @! t/ o) N
) B& c7 x3 W% ?: L; D6 d5 C3 Z! z
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 Y. V# G0 t3 Z: T- @' G- X
0 B3 }% J0 R! k/ H
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) o4 [' h) Q$ Z( q3 @8 l" S3 H  ^

7 e: M. I9 @4 j% g2 r: {__________________________________________________________________________
( h# `# e! n3 M' d
! `3 t2 ^7 M1 f' J) n( r# |& ^* _+ {Method 13  A/ @& ?1 x9 V4 {7 `
=========
! {9 ]. n" x# s) D9 Y
- {6 m- n% A0 [3 V2 O2 b) ^( V8 DNot a real method of detection, but a good way to know if SoftICE is# Q; R5 A9 E1 h$ S" Y' l
installed on a computer and to locate its installation directory.7 f% {: y" s7 n) T4 a3 \
It is used by few softs which access the following registry keys (usually #2) :( W; c( h- P* b/ O1 a- D" f( C
) v8 ~. d2 d/ K( H
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; m: N6 D; d2 ?" t" e
\Uninstall\SoftICE7 k6 v5 P+ e' l" @7 c  C9 b
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 {( E' B$ `& A6 l4 ]4 ?
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) v" z$ `2 q# H" S+ x1 q\App Paths\Loader32.Exe
7 \0 K5 n& t/ A# {4 S
0 m! j  Y$ r! L+ v: q" q
2 F. Q' v( Z& K7 ]1 u- D6 y, [' JNote that some nasty apps could then erase all files from SoftICE directory
1 ?' k4 p+ ]- ?; g" M* [8 f1 k(I faced that once :-(
  X& s6 s* l! }4 s9 Q( [1 m8 n% t
1 C, c' F) c3 [+ f+ \Useful breakpoint to detect it:
* J+ U& `8 e! A7 m
* E5 S1 z5 Z; F     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ P2 {" ~+ n- i& E6 d" }" F
: C: D& s; }% ^2 @9 E! K
__________________________________________________________________________
7 t* B* D: Q+ ]" j5 H: g' S; T9 [( ?5 U" [8 h) @
/ D: C0 r; X9 L0 D. ?
Method 14
! K8 f9 |0 P; s& h=========. r5 p0 G) [) z! v+ h* C
/ Y% N6 u8 M: o- D0 c5 V0 C2 r+ N
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ m/ J6 |0 |" n  |is to determines whether a debugger is running on your system (ring0 only).
; V. K: v# r1 t; m5 [6 x' ~3 K* X% ?6 g7 O' b
   VMMCall Test_Debug_Installed
6 W4 u, g# s) R! F+ |" e2 ?   je      not_installed2 S/ t8 V0 J6 W% o$ Y
+ A' K; [: d) Q" U3 B0 w( V
This service just checks a flag.* b' h9 J) s8 j( }# w" o
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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