About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
: N  D4 _+ G! t% f8 V<TBODY>
9 a, l+ W6 Q  H' X" D" T+ F<TR>6 f& r% \" r; j: C3 p( ~0 V; {
<TD><PRE>Method 01
6 [- t$ T+ W7 t; c5 O" |0 ~7 k6 d3 [+ m* q=========
/ B5 y6 m' F; P3 b
; C8 G6 k- ^2 e2 p9 h2 N& W/ }3 bThis method of detection of SoftICE (as well as the following one) is
5 T6 f2 S# M& b$ yused by the majority of packers/encryptors found on Internet., S. J$ |+ |# {* V6 r
It seeks the signature of BoundsChecker in SoftICE9 W* s# w0 H$ a# g

8 j% G* p# @7 v2 s6 X& q    mov     ebp, 04243484Bh        ; 'BCHK'8 t1 f3 Y7 n" s0 B9 y* A
    mov     ax, 04h
8 N, W! ^: o& s' x) ?    int     3       0 O2 N6 D; }$ Q
    cmp     al,4
' o/ g. P! i0 v- H% \    jnz     SoftICE_Detected5 U0 M$ E: Z" J8 h% P9 ^  s( X- Q/ I

! M- E. X" V3 V2 R& j  P% V7 M___________________________________________________________________________
; }6 W. x4 S- J7 P7 @
- _0 Y8 l# d/ M1 f$ QMethod 02
- S1 `; i5 K6 d1 x  i=========0 J% P# S& d) r$ H2 y+ n: i0 c

) z# k  _1 ~- c) P7 E2 [0 C9 X( bStill a method very much used (perhaps the most frequent one).  It is used! E: D0 U( A0 e5 t* j
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; Z4 C! |3 F- K9 e) i8 n6 X8 q
or execute SoftICE commands...
% S/ I: ^1 w7 m: n% y  g$ }7 S  l% }It is also used to crash SoftICE and to force it to execute any commands8 ^; t) q1 d' q: n
(HBOOT...) :-((  ) z/ h' g" ^/ l) ^. a  G
# q4 R" A$ [: @; D( A& `
Here is a quick description:
. j/ y* {+ a0 c5 B-AX = 0910h   (Display string in SIce windows)
# n* v5 R( {) x- N6 N-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. n4 G  ^# y$ ^4 S# @-AX = 0912h   (Get breakpoint infos)
, H* b8 }- @& `) M& \3 A. L' t1 u7 U1 B-AX = 0913h   (Set Sice breakpoints)
9 n% v# }% _8 w+ h' M$ @! c-AX = 0914h   (Remove SIce breakoints)" i7 S+ E* Y3 Z

/ O# H' X5 t4 GEach time you'll meet this trick, you'll see:
1 V6 n2 k0 Z, x/ d-SI = 4647h
4 ~- P4 _" K0 G( }-DI = 4A4Dh. s1 j( J/ b* w# Y
Which are the 'magic values' used by SoftIce.' R8 S% ]5 h2 r5 P5 n9 R
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.: _, a6 K( l- L& @' {: f2 u

+ c# [- z3 y4 tHere is one example from the file "Haspinst.exe" which is the dongle HASP
2 I2 c/ m: s9 A/ J- s: l$ |: JEnvelope utility use to protect DOS applications:
9 ^5 J  }' ^# Q. B; D  e0 j7 B/ P& O; k' l' G
  q) \, X& [# L: b, m. y( m
4C19:0095   MOV    AX,0911  ; execute command.
9 [% f0 D' t& @4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).7 I! z; W. D2 R4 R5 t* X6 a# G
4C19:009A   MOV    SI,4647  ; 1st magic value.
9 S( M. V' c' U4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 e* F! i% @$ U  r- ~. I4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
4 P9 P5 ]' i' g; G; m% V4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
( u- Z0 S2 [/ _' z  j* `5 V4C19:00A4   INC    CX8 Z! y& B0 w0 r5 M; t" u
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, q& @  `5 f9 Y6 ?
4C19:00A8   JB     0095     ; 6 different commands.# e, Q6 M" R7 \  D, Y* {  O
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 x# Q5 k+ C$ B" ]  X8 R1 `9 M
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
$ c3 h& @9 E# q& [. V# d, G3 h7 Y/ o# L' n2 g; B* j* P
The program will execute 6 different SIce commands located at ds:dx, which& M( u/ j1 K0 ]' J: T: g
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 P1 c1 g& C; j9 n# [6 t7 ?# p6 y

0 G8 v6 s: ?% R* h8 C: q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& g! n- `0 O+ X
___________________________________________________________________________
& O+ R4 ]3 L2 Y. U+ Q
5 C; G3 \9 f$ y7 o& e" q
( S6 y5 Q. H9 d6 A& s. q5 w3 SMethod 036 U9 [5 B* q0 j! I* g; p  a7 m
=========
1 F  q, }# O; b( |
8 i* ^, J; q3 ~- E& cLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& P- Y' ?/ E2 J& Z(API Get entry point)5 T( J; G' M: m7 _- ^. J
        
: r1 A( b# d1 {0 v7 _' j
* X) [" K% y( U' z. _) o    xor     di,di7 S5 h- G8 b# i' p! L
    mov     es,di
4 H2 B- \. T& d! R) N    mov     ax, 1684h       - }( \; r; g" z4 p  A$ `; z1 z
    mov     bx, 0202h       ; VxD ID of winice
; E  k7 z' }$ j* ^. C    int     2Fh/ `5 G/ }  h, Q/ J' R/ w: Z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 F& W, ^2 r2 }4 z# V2 s8 o' B
    add     ax, di
, i$ v# k3 i+ r2 F' B' Y2 G! y. k    test    ax,ax
7 J  g1 W, P& v# e    jnz     SoftICE_Detected
% g- l  e4 V8 E7 \) E1 }" _& K9 V" ~! B7 A  \7 c
___________________________________________________________________________
& F. [2 J% Q: r9 B5 C( v9 s+ f8 v+ M5 h  G* Z
Method 04- t4 M. z# m+ ~/ s0 f& U
=========9 W8 ~  J+ J2 j9 v' n! v3 j
. \2 m4 x% o. }6 N- P+ Y
Method identical to the preceding one except that it seeks the ID of SoftICE
, E: A7 c! e# FGFX VxD.) U$ C" {9 h- U* B. {, J
! D) W* s/ W/ b( Y% r
    xor     di,di7 i" [! E2 {; o# {  b$ E
    mov     es,di* h) i# Y* L0 X- n" q- @
    mov     ax, 1684h       ' I+ X- K1 W) Z9 {
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 K; Y( o: Q( o- W/ H, v' b    int     2fh! o: }& N* i7 A( L! _  o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. t4 P' j. l/ h5 t6 a0 T, l2 t
    add     ax, di
6 K+ p- k$ u" b" |" O    test    ax,ax7 }; v- O7 g2 Y9 F
    jnz     SoftICE_Detected( n# {# R6 F1 z3 C: Q/ a# L

4 R5 P" X1 n. m& W, h# P__________________________________________________________________________
; d! g9 `8 v( T5 T( `. F3 W0 ~
( H3 Y% d* V' P: p) }0 t: v* }
2 J) M& ^9 z8 v9 @# ZMethod 050 N! R) l' x  O+ p
=========$ i4 D5 y" K7 y9 u, e! m# ]
+ e9 @. V  B6 w
Method seeking the 'magic number' 0F386h returned (in ax) by all system+ m& h6 \4 \1 b) v
debugger. It calls the int 41h, function 4Fh.7 Y" ~6 @; a0 P
There are several alternatives.  8 M% L3 d( [2 K3 }: E
2 i1 ~. q% v/ D) f- t& G2 u6 L$ X. j
The following one is the simplest:+ h1 S( q5 v. Y# F5 n

( q% ^  z# E2 p( ]; p0 k/ n    mov     ax,4fh3 R2 j/ L0 E" I+ X5 ?: d- i4 X
    int     41h
& U6 K* \6 u$ G  O) f/ n    cmp     ax, 0F386
, J8 Y  o% }/ j6 c) {% l% E' W  Z    jz      SoftICE_detected
1 u- x) y  k5 q& t0 j
& l4 d! Z) q  f. e* F# Z- F, L. F- `% a* Y6 e
Next method as well as the following one are 2 examples from Stone's , C- t( @7 b2 k/ ^$ M) F
"stn-wid.zip" (www.cracking.net):
4 A8 o6 C4 N. {' T/ m  E; C4 s* s" M. G6 D( }8 W( X
    mov     bx, cs. g: q  w9 C, G1 \6 M5 G8 x! k
    lea     dx, int41handler2
9 l1 R9 y% P, M    xchg    dx, es:[41h*4]
2 {5 \- w3 ?4 N2 [; z    xchg    bx, es:[41h*4+2]: N, t5 H) a8 `, E
    mov     ax,4fh5 R: l! H$ i! ?. y) c; @
    int     41h
1 M7 Z/ t9 [) R* p" s    xchg    dx, es:[41h*4]4 m$ `9 ^+ e( p# `- v
    xchg    bx, es:[41h*4+2]$ G7 B! l/ C& ^! B! d
    cmp     ax, 0f386h  u$ `. i7 \$ c# k6 K, z
    jz      SoftICE_detected
9 h! k6 T2 K) L$ [9 p3 d$ q' R9 w( t9 V2 a& ?, i  a
int41handler2 PROC
& e5 Y/ ]6 l0 c  A- A6 w) S    iret
& o& s, d/ A* v0 d2 Z7 n: y, v9 I9 bint41handler2 ENDP
; y6 C& o. h, y. n% u1 G( U( p6 v/ E  n+ e, `" W! k, m
: J( r9 p$ z2 u5 T
_________________________________________________________________________
# L; m" a1 Z( f9 p; s+ W6 i4 M, S; `, V7 o6 R

8 D3 g1 H5 a9 h; _( @' X9 t7 DMethod 06
) y/ l4 ^6 B1 c8 {* x. ~=========! D4 s; I/ ~( a
3 G$ R* v0 {+ h6 I1 E% w1 y* B8 R
/ i, ^4 u" r. j# P$ x3 s
2nd method similar to the preceding one but more difficult to detect:% M) o, g" H3 N  [
. ^$ G+ w5 \/ g0 @" t! C9 i% d$ d

$ E6 C4 V1 U) P3 N& iint41handler PROC: Q1 v% t4 h, R/ ]4 X, K' x  D1 x
    mov     cl,al
5 |4 D3 p/ v3 ], S" }1 v8 q5 i    iret
' a1 |8 d7 O3 x& V0 n1 o1 p( n, {+ B  `int41handler ENDP
" i$ z, Q5 u2 A8 P' @9 K4 s$ m
8 n% T' J8 r  L' w9 F2 @! d! ?: x. O1 j
    xor     ax,ax% O1 X1 a: t3 M; A, {
    mov     es,ax
7 q: B# L! I& q; }    mov     bx, cs9 z5 q/ o& |1 z, a' e
    lea     dx, int41handler# }& B4 R1 H& x+ w2 U
    xchg    dx, es:[41h*4]2 b4 y4 G/ l& s; L9 q* v4 _
    xchg    bx, es:[41h*4+2]
( i, s: Y) w# G    in      al, 40h; c1 Q3 t( f3 ]/ k  N
    xor     cx,cx8 o% b3 H8 P" Z$ a& P
    int     41h: T( n7 @: p* V; s
    xchg    dx, es:[41h*4]+ z( o5 O8 ?% r1 B7 h8 B$ ^- W/ B
    xchg    bx, es:[41h*4+2]! Y# L& i4 v6 J  |
    cmp     cl,al
1 I! b+ q3 Q9 P* ?5 t/ W    jnz     SoftICE_detected
$ @' F; p" H8 M' B$ O; s6 {/ w2 \: `6 w' p. i: Z
_________________________________________________________________________8 ~% I5 Q3 M9 D! t

6 }8 \) T2 Q: xMethod 07: f6 L2 t1 [! P1 q6 n6 B  b
=========+ P1 Q6 H3 ?0 g4 U

1 o2 h' E3 E! ^1 x4 \; E$ W* R8 FMethod of detection of the WinICE handler in the int68h (V86)$ k1 y  F) {9 z
) ^, \6 m# C$ F9 I$ f3 D; Q
    mov     ah,43h* }) P  |$ f# W7 J! {( Y
    int     68h
% n# V4 @0 l9 ^, k& J! j0 h    cmp     ax,0F386h  ?- `' `$ G0 `9 e. f
    jz      SoftICE_Detected# {% f: E3 b* ^) ?2 C. L
" j5 L' N- f% a1 D2 e1 y
2 {4 e5 b- O" p; v$ k* H
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 v% _3 x! l3 h) s6 G; h; `/ x# p* c9 L   app like this:8 ]$ b4 ^# z7 A: N* [6 ?

" |8 A" _" K- N6 N   BPX exec_int if ax==68- Z2 s9 x7 m+ D; F, F! g% e( I
   (function called is located at byte ptr [ebp+1Dh] and client eip is
0 z( F: |+ K6 R2 L6 P9 v   located at [ebp+48h] for 32Bit apps)
8 S( n+ Y) ]# q8 D0 {3 ]  j__________________________________________________________________________
- i4 v2 A0 j8 C$ C* q
6 y( f  N) t! C% c' @# B4 S0 ~, z
Method 08
6 n- @' t7 a0 r; }% h=========: g  f* {: t4 N+ ?* D6 V

8 H5 ~9 V2 z, k' ?/ ZIt is not a method of detection of SoftICE but a possibility to crash the
  G8 V  ?4 o$ ?# y+ usystem by intercepting int 01h and int 03h and redirecting them to another
0 f- V5 L5 @$ E6 |4 K- I! Sroutine.) o: J% |; U; Y/ l* N) V) H6 K
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, h- h4 H/ |7 i& q3 C! d7 G5 Gto the new routine to execute (hangs computer...)$ Y3 h3 D6 C0 `2 X0 k* k7 v
# B) n) x+ R$ R& h, `. n
    mov     ah, 25h: l, l( M8 G8 D
    mov     al, Int_Number (01h or 03h)  l# A; z) R& p! V4 m4 |& i0 x, q
    mov     dx, offset New_Int_Routine
1 Z$ N* Q, c' ]0 H  i. ?7 g    int     21h* _- i2 A, ~, @1 g4 T  p
, Y# S9 U8 p4 t; R0 l9 ?& Y
__________________________________________________________________________+ C7 J: a5 z4 Q5 @, `
1 z! P' y4 R" Q- d
Method 09
7 Y/ T. B" _1 {+ d* l=========
; s7 B/ ~7 _2 V8 y9 I- |( h; M+ s. O+ A
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 X- N9 b- H, O' h1 Aperformed in ring0 (VxD or a ring3 app using the VxdCall).
, f0 ~7 x! u3 SThe Get_DDB service is used to determine whether or not a VxD is installed. B- D5 f- B& T* ^
for the specified device and returns a Device Description Block (in ecx) for
7 P; o# H! X% h" \. n6 K+ Kthat device if it is installed." \- _/ {/ C! c
: b3 Q6 H7 l, C) K9 ~9 b, F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* D% j' s, Z6 [6 f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 Q. p4 p2 o! B; ?) q4 `
   VMMCall Get_DDB
  G, V* Q% n7 X) [" t. g7 F6 N   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( Y6 [: [/ N& F$ T3 M+ T& ?# h, c9 z) V; }% H
Note as well that you can easily detect this method with SoftICE:9 a8 p+ V) Z! P7 @! u; J
   bpx Get_DDB if ax==0202 || ax==7a5fh7 F0 @5 `6 ]6 P0 f, I% T
$ j/ c6 P, @9 I$ x( P" S% k
__________________________________________________________________________5 H7 q$ U1 V; p. f5 A8 Y

+ I/ J, E6 d& J' rMethod 10
5 o! N" K( F+ Z5 J. V) g6 v/ E: T=========6 W2 k7 w5 T! Z' l/ D3 M

' M7 [3 [* C% @$ b# s1 x( F=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 W8 g: g! Z( x' {) |
  SoftICE while the option is enable!!: f7 ~( Z' A" `5 o! u  P' j

1 P% ?3 b, k# y( c% aThis trick is very efficient:
- }0 f+ h( j% c9 X5 Q4 fby checking the Debug Registers, you can detect if SoftICE is loaded0 P& }% G" O" x1 U  F3 T
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ J- K! L0 V$ o: t7 N% J: Gthere are some memory breakpoints set (dr0 to dr3) simply by reading their9 F+ P8 h/ j. W+ @! @
value (in ring0 only). Values can be manipulated and or changed as well! H+ P# `- e5 M
(clearing BPMs for instance)
4 j: e; g! I0 ~1 T( ~0 Q% Y1 o2 C4 B& W" e4 X. J. V) f, d/ n! `
__________________________________________________________________________
" M/ x* \& \( O( M
6 N  i) U( ]8 C/ h4 C" p) k" eMethod 11; T" p+ L- O3 J- ?' {# R. F
=========4 Q8 J2 p6 H, Z; s' k

6 C& U* p( n6 mThis method is most known as 'MeltICE' because it has been freely distributed
+ Y. T9 q. z7 M4 N3 Y: gvia www.winfiles.com. However it was first used by NuMega people to allow
! `0 v. N/ n8 |9 v5 n+ LSymbol Loader to check if SoftICE was active or not (the code is located, Z- e9 i* T' [2 C/ i. N+ i
inside nmtrans.dll).& D6 b6 _' |- ^7 G: o% V

6 A4 G' O1 E1 g4 s# I( YThe way it works is very simple:" _$ E2 Q- Z7 o# t
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for6 g3 l, d. P( ^9 S) i+ v
WinNT) with the CreateFileA API.
' A7 _0 m& g# Y7 G1 A, H6 r3 k9 n; @* D+ ?/ R
Here is a sample (checking for 'SICE'):
" u0 B4 b. g" a: [4 p1 l' ^5 F* ^9 U0 }- U8 v) d
BOOL IsSoftIce95Loaded()
6 a3 i& z# C2 [; s! H( d{$ O$ S: ?8 m- ]
   HANDLE hFile;  3 H0 \9 H+ U5 Q* p, \# Q" [) ]- ~
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& K: p# s4 _( |2 |+ K% W/ W7 _
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( L. @0 `& a8 p                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ C0 m7 k9 a( |" e7 ^  w: U1 M. @   if( hFile != INVALID_HANDLE_VALUE )
: b2 m( x3 Z" K& q* G   {
' y4 n2 N3 [5 a# c4 z      CloseHandle(hFile);5 m4 h; d  B) B; U2 L2 c4 D# u" {
      return TRUE;( F+ V4 V/ p' A' S3 ^) d3 r# Z) b
   }
) R. j, b) l/ B# ~5 t4 w   return FALSE;
, o( X5 ^* C( P' A  F6 Q" ?# A. C}) A* i! f% @: d) B; j

( D3 t2 K7 h* _9 c1 s2 v6 PAlthough this trick calls the CreateFileA function, don't even expect to be' Q& \- L* }6 o% m- `& b$ D
able to intercept it by installing a IFS hook: it will not work, no way!; ~% h, F/ j: }8 L8 x7 J. O; {
In fact, after the call to CreateFileA it will get through VWIN32 0x001F1 G  ^1 A" Z' T- V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- n3 o9 H, @" @& I$ a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
; `9 M2 R/ w  e8 [9 p; y0 _. [' Afield.
/ j7 W" J; j- r) a, t7 I. jIn fact, its purpose is not to load/unload VxDs but only to send a 8 R+ I; N: h3 h) ?6 V
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 ]$ Z: A! S5 @1 F; `
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 j% n$ k6 G3 G' D, Fto load/unload a non-dynamically loadable driver such as SoftICE ;-).. P# ?7 J  V, X
If the VxD is loaded, it will always clear eax and the Carry flag to allow
% P: S: E: {) B( a+ m( Qits handle to be opened and then, will be detected.
- S: [- t7 U1 ]/ u# `6 G4 EYou can check that simply by hooking Winice.exe control proc entry point
4 _7 X# \7 w! n: I9 Owhile running MeltICE.
4 K0 d* c, o5 l6 I8 _5 [8 H& `8 Z' z& x7 ]- H% Z1 D' a  ]

" O5 g8 F1 y0 k* M- @9 A% f( X2 D  00401067:  push      00402025    ; \\.\SICE
- w7 R) O/ R& E0 {3 M  0040106C:  call      CreateFileA9 U7 ]8 C$ N/ u
  00401071:  cmp       eax,-001& I2 _& p+ H2 ~5 @/ s- J! W' k
  00401074:  je        00401091
) d8 O$ O7 T4 {  s. N4 u4 K( X9 P5 }& q3 L: ]* F
. k; e2 M# G" {/ E  E
There could be hundreds of BPX you could use to detect this trick.2 e, Z  b/ t3 ]- e. K6 ]  [
-The most classical one is:4 Z" z3 P$ E0 m
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! F+ h3 D6 h4 C
    *(esp-&gt;4+4)=='NTIC'
! r" E3 f; Q  S7 H# M. k, Z" f- @  v) t
-The most exotic ones (could be very slooooow :-(# I) P4 T; ^- D1 J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- u8 ^/ k. f4 g- A' ~; [4 f8 S2 C     ;will break 3 times :-(
5 ~3 \9 j! r2 U& c) V( g+ K' o
0 \+ K4 @0 Q* \$ ?% Z, ~' I6 K-or (a bit) faster: 7 [1 ?& D6 K, f! K& A  S# l, L
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ G: t: J4 f# [9 J+ o) P2 B" s/ ?9 f, {$ Q9 s6 X
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  . X8 a! u9 d( X. \! R$ B
     ;will break 3 times :-(
* B* G$ U2 N* {6 M/ Y8 L2 R+ C
* o. ]( M( C. O+ B8 i4 e-Much faster:. s  a" M6 r* w0 {
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" I( U7 h! E( @" u: m

, v, p# G& a% FNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
& |5 ?0 E7 I1 b1 t/ wfunction to do the same job:! v# d2 p, I' t6 `9 x

' x, ?. H  X9 U5 H& \3 e   push    00                        ; OF_READ
0 F, w( m3 C7 W  B/ F+ i   mov     eax,[00656634]            ; '\\.\SICE',0
0 P  Y0 j" e+ g; x1 U/ g   push    eax
! B; }" k# g: q) k   call    KERNEL32!_lopen% {* X% b! k. e& k
   inc     eax+ E/ b4 `  l9 y& U' h
   jnz     00650589                  ; detected
/ I7 G% C8 [3 N% w! V4 \   push    00                        ; OF_READ! ^, \8 H2 t7 B& F3 W& o$ o
   mov     eax,[00656638]            ; '\\.\SICE'' A1 F9 s; _5 A2 U  t
   push    eax  p. X  T" ?& Z5 ]% U
   call    KERNEL32!_lopen
9 d5 a% Z: f2 A% p7 T. s   inc     eax
' C$ G! q$ z( [/ r* \   jz      006505ae                  ; not detected
  {4 d7 Z: [+ g) Y) J7 f. {  Q% j# o* Z! r
+ Q1 f6 @7 ]( ]% k& z' L
__________________________________________________________________________" J3 T4 e6 }$ P* k: ]. ^$ e

1 P6 H. J  B1 I7 B/ _* B7 |. VMethod 12- @+ s3 V  j  W+ P
=========0 J, d4 P* r$ B. J) r8 u

# I) E" L" \# j1 t$ W$ e, wThis trick is similar to int41h/4fh Debugger installation check (code 056 }. m+ u& g  j  h& q2 [
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. `# Y  N, d6 U6 e8 i5 Qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
+ R. X1 q1 K7 Q0 H% S0 _; P% q- p  Q3 n3 v. b0 @- k
   push  0000004fh         ; function 4fh
9 ^5 \. T* z/ j2 v& ^5 T   push  002a002ah         ; high word specifies which VxD (VWIN32)
/ M, k" z7 g7 e6 h$ i                           ; low word specifies which service: L" Z$ m5 s' M$ X' R  g- A
                             (VWIN32_Int41Dispatch)
" `* T# P) U8 @: I1 p   call  Kernel32!ORD_001  ; VxdCall
5 I) @3 U* ~% r2 R# B; E0 T# q   cmp   ax, 0f386h        ; magic number returned by system debuggers" N3 U- o* B8 W- E
   jz    SoftICE_detected6 ~! |. e( q6 k4 C5 `
/ s6 T9 j/ j. F+ j: H" y- ?
Here again, several ways to detect it:+ j* B: ]4 |" x+ t8 ?0 v1 n

( y+ {5 h# p& ]8 {0 h  g    BPINT 41 if ax==4f4 Q0 ^; F& w& A3 Y
& B% Z# G; J6 B- Z
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" j! q# R$ j% d; |

4 ^0 B. A% ~. k5 x, P    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. P" W- q9 @1 L  W. m; j
+ k. q2 {) R8 [! L3 ]/ {    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. n5 y- h9 N! z% Q
. \9 g" |& d, V4 T% ~! d* G; G__________________________________________________________________________8 r/ r  w1 S( ]
: B' ?- i) G1 ]5 a
Method 13
/ ^! Z. H' U8 I# n& Q3 z5 P=========6 n. q9 g# U$ F: j) C& r9 D+ c( U

* s2 ~! W$ I+ b( f& J; \, vNot a real method of detection, but a good way to know if SoftICE is, l: ^8 J; Z: I- o# C# f6 B  O
installed on a computer and to locate its installation directory.
6 l' |; G0 D: Y  n& hIt is used by few softs which access the following registry keys (usually #2) :
: Z1 P6 c6 g% ]. I3 P6 I" B2 \/ y5 [2 m) k, ]
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: h3 w- b  W' ]2 b0 s0 y
\Uninstall\SoftICE
7 Y( c: ?0 l. L: T4 C5 n+ L5 }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, D0 Q1 Y" c3 U' H4 `9 Y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  _& P& G  E& S0 V& [# N
\App Paths\Loader32.Exe3 K$ `$ A0 x3 b( \+ R: j

5 t# Z5 N/ }% P+ v8 q
% _. I  t, s/ yNote that some nasty apps could then erase all files from SoftICE directory4 v- u# U3 T2 N' `. z. c
(I faced that once :-(1 S& v; i$ [0 y" ~3 }# z/ J" ^3 U

. I; Q; c5 y! B1 n* XUseful breakpoint to detect it:  A$ ~  S! c$ x7 p! _* g, l/ g

& z1 f9 n2 b  {' `, g9 Y1 M     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; x  D$ l6 ^' c6 B4 M2 N1 O* t

1 u# F- E/ m3 I) i0 G& ?" D__________________________________________________________________________
" y" |4 h7 `0 G  i) o, F8 I9 H1 u! P7 c- }5 l% ~% G. D
7 _2 C# l- L* `9 k7 m8 D
Method 14 " O6 b3 ~4 A5 @3 `# v4 _1 U: _! ]
=========
& W. |: F- D4 B! ~1 ^4 o7 Q
* J' T5 E2 g5 d8 k+ MA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, W$ u* ^; h% \7 Fis to determines whether a debugger is running on your system (ring0 only).' y5 j2 V0 Q+ S0 P1 ]( H$ e1 R
$ c1 [0 n; ^, u2 d
   VMMCall Test_Debug_Installed
: O$ g5 P# p" O' i& Y6 L   je      not_installed% Y3 F: p9 s; x- I$ c5 H: Q$ ?; H  g

3 O$ ~/ q, R, f: W" \This service just checks a flag.
6 E' f! b5 _- @' R* K) k</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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