About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, d. A3 X, [: O6 [<TBODY>( M) M& a4 X: x. g' O0 c6 g9 i( [- u
<TR>
! o0 N- N7 _5 ~+ A<TD><PRE>Method 01 & g& `) `3 Q0 M' @1 w
=========. G& r# p; D4 c) g

. f. V, Q" o1 HThis method of detection of SoftICE (as well as the following one) is
! }1 }) q$ h" T7 z. S, Wused by the majority of packers/encryptors found on Internet.
+ T2 H: r  C: h' U1 N3 VIt seeks the signature of BoundsChecker in SoftICE/ k8 K9 n9 U3 ]$ A, j
" ]: g/ R1 V. p8 a1 A/ F! c: [+ c! J
    mov     ebp, 04243484Bh        ; 'BCHK'
# [- ^9 h/ f0 {( U1 k! G* W    mov     ax, 04h" Q! p, e# m- K6 I' h& w5 X$ @
    int     3       - I( b; E8 _8 a# a  a' j
    cmp     al,4; v% `, b- F  p1 r; ~1 d& p% E
    jnz     SoftICE_Detected
& Q& v( v5 N$ _4 g0 w' d- e% |
. H' `4 ~( r% u$ j- O/ B$ \! L___________________________________________________________________________
1 J0 g! s+ J. ~& k
3 y! C/ d4 i. X5 |Method 023 k3 S' q) u1 J2 Y/ f  Q0 X# _
=========* c7 q9 u# a5 s7 d  g0 `- W

6 e* Q6 a& ~$ Z) AStill a method very much used (perhaps the most frequent one).  It is used) G: S* D' ^' @/ E' W. o
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,& O$ p7 j3 K: M9 R' Y" E; T) C8 \
or execute SoftICE commands...* X' [' y3 Y1 _. p. p3 T
It is also used to crash SoftICE and to force it to execute any commands
5 n/ I6 p+ M5 }+ ~" U/ s(HBOOT...) :-((  
4 `" h! z/ n8 p" h7 A% t4 Y  K2 X9 R! ~
Here is a quick description:
3 J& o: x6 Q0 r; l! R-AX = 0910h   (Display string in SIce windows)5 z+ G4 P3 T2 J4 E
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% X) m7 f' Q- C( s4 a1 M# S  O
-AX = 0912h   (Get breakpoint infos)& B1 ?$ f+ y3 W6 A0 B2 _  ?
-AX = 0913h   (Set Sice breakpoints)
$ F' H3 |9 I# e7 g# |" @: f- ~- S-AX = 0914h   (Remove SIce breakoints)
7 S: h# C$ h3 @$ p6 J4 ^' o+ u. ~% \; W: l  r
Each time you'll meet this trick, you'll see:
2 N- x- B* ]% ^8 q7 D+ {-SI = 4647h, W$ z2 {/ O  @2 E5 _+ N
-DI = 4A4Dh
! T7 r! t3 ]/ f: v1 C3 z) Y7 ~Which are the 'magic values' used by SoftIce.
4 J: M! V# t- a" c! eFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ P( ?3 Q7 p0 F( w
; H. E5 ~" `' Z/ [8 O- M. e( ]Here is one example from the file "Haspinst.exe" which is the dongle HASP! `9 I' M( H# |
Envelope utility use to protect DOS applications:; b2 g' ?" c3 }# ]& Y
/ m; s: d$ B! N+ `+ |, h) Y

9 B3 h5 }  R6 s+ R0 ?% I' j. W4 m4C19:0095   MOV    AX,0911  ; execute command.( I4 K6 Q/ v: r* l) @$ n8 O
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  X: z9 W0 S4 E
4C19:009A   MOV    SI,4647  ; 1st magic value.
" M7 x: a( C& {% J5 F& P/ q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.( P4 T  e1 ^, E$ i+ R/ _; E  R- z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
* d7 H! F, D4 ^# Y& @$ k: E4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 n) j% l% z$ d. Q9 O, R4C19:00A4   INC    CX8 U# j! T! V+ ]( r$ j: G( S! u
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
% P& }; z2 h  R, H9 y4C19:00A8   JB     0095     ; 6 different commands.0 q1 I* ?% H- {9 W
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. f/ r( Y, j" C; {( E1 a1 \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 v: y; K. D0 ^) {2 S

0 d4 `' r! H) m1 R, |5 OThe program will execute 6 different SIce commands located at ds:dx, which
) m9 U1 W) p6 T0 Gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 r0 P( h2 v( z, ~/ j" t
2 ^* H9 F! P4 O  Y: w7 S7 ^* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: e/ y; e1 |0 |3 |___________________________________________________________________________: u4 y( O% U/ Q; N9 {# D

4 \" ^: G0 w& D6 p# n9 N
" ~/ ]5 k( k# L' c; f0 lMethod 036 R: Q4 g+ j  G  V, v( X
=========
& L- ~/ s1 n7 W3 ]8 k. r. I7 `0 q, k/ p1 k( \
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, u( K, J/ b$ C' @( v/ x8 N(API Get entry point)  m" k- }+ v, ~5 [9 r; |, h
        / R& |! D6 U. L

( }; z6 O& F( p: f+ x5 T8 ?    xor     di,di* [! e; u" I7 H0 A1 W
    mov     es,di
0 ?" T  @' T+ V  J( V; n) \- U    mov     ax, 1684h       & b! p# b( u8 J( \& H, `; G9 P
    mov     bx, 0202h       ; VxD ID of winice
5 V) g' \% S4 ?7 K/ t8 A    int     2Fh
8 I7 L% D9 L$ q1 [* Q- `    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 \& q; Z- @$ m1 R/ U; C    add     ax, di+ y4 _& L2 h8 J. \
    test    ax,ax
, S# N" w9 H+ n! K; x2 e8 m    jnz     SoftICE_Detected
& o* x( Z% O3 G( x' Y
( g! \' @. q% j- d5 j. Z& x" Z___________________________________________________________________________8 [- c5 j- O! `, u# U6 k
) A3 L: q+ q+ v
Method 04
0 _  y& W, ]0 |7 q( t4 a! S/ P=========
" @, K- [( W/ `& F3 a! x4 ~, S# C, ^& Y6 B# v5 j3 Y
Method identical to the preceding one except that it seeks the ID of SoftICE% Z- N6 Z$ r7 B# e0 Z
GFX VxD.
) y& R, c. \0 S4 u6 m! c- e
& x# K  w5 q8 K) k4 k    xor     di,di
* W1 M" _! [1 W3 P% T    mov     es,di4 o$ M; |! U! s
    mov     ax, 1684h      
4 a& p1 Z( {. o' m, n2 y8 F    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 x9 ~) q9 v8 J$ N' X! @4 v- K. A3 y
    int     2fh
5 R4 ?3 c; y7 d! k! @6 W    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  P- A4 v; k# O) O" X, n    add     ax, di$ p: o+ B5 K  O! }
    test    ax,ax
- u$ m- |3 u) g7 h9 ]3 V% ~+ T    jnz     SoftICE_Detected; m9 |  Q  U  Y2 f6 [1 F( g
* V7 U; g: \% y9 i& t
__________________________________________________________________________
0 g, j( Y# ~/ P) q/ \7 U, w. Z! F) O% [

, k8 U/ U* w" RMethod 05, \# i, t. ?1 ]' P1 U. A0 M! [
=========
% E& |% X+ m: r7 N9 B# H
' C" y- T/ T0 PMethod seeking the 'magic number' 0F386h returned (in ax) by all system
5 h; \( ?0 g2 s+ s5 xdebugger. It calls the int 41h, function 4Fh.
3 a  [; M7 s' `, I% T9 \; @. ]% HThere are several alternatives.  3 K" ]  ]( E# \/ g3 v) g
1 u3 l3 v6 c3 C6 [# W/ H7 a
The following one is the simplest:5 N3 k/ E. j- Q' F" o: G

& u3 \4 g* B4 I  H0 h1 Y0 G* I$ A    mov     ax,4fh9 C% m  d  S, @0 n
    int     41h) m* E& q/ }9 z9 }( M0 l8 s
    cmp     ax, 0F386
8 D; W( P, `# c  j    jz      SoftICE_detected
( C) m1 g, H/ g3 P4 Q9 A8 M3 U* ~2 o4 Z, |0 e! B/ L: W1 W6 I2 F

7 Y  y  q6 u" j; D# ~6 v- {/ fNext method as well as the following one are 2 examples from Stone's ; s  @/ ^5 X8 E6 [" K
"stn-wid.zip" (www.cracking.net):
( o9 G5 R# U. {
! c* M* B- U) i6 A( T    mov     bx, cs
# Y, P3 P+ ^. o" d+ ]    lea     dx, int41handler2
0 x/ [+ D* D& R8 m& \    xchg    dx, es:[41h*4]
. X$ R! O6 P+ Y8 ]' ?8 B    xchg    bx, es:[41h*4+2]7 G% a' J: \, t
    mov     ax,4fh  t" s6 V0 i5 A( g6 G$ f
    int     41h* `2 p5 ?2 u7 e0 Y* R4 d# a( _
    xchg    dx, es:[41h*4], [4 R6 l5 r  K8 }0 `: r
    xchg    bx, es:[41h*4+2], ^" h4 p! l+ o+ T( U& W" a
    cmp     ax, 0f386h: y4 u% e& {! B% h
    jz      SoftICE_detected; b' S5 B% \8 Z9 O
8 n% Z' O  {( Z$ K
int41handler2 PROC8 I% Z, Z1 p$ S* [  [9 P+ [! l1 ]
    iret
1 o1 l. B1 Z# ~int41handler2 ENDP8 ]# t- f! [6 T6 R! ~4 |  b1 ?( `% b
# x8 ^, {$ i$ U. T

, H4 _0 O' M- _1 g4 U_________________________________________________________________________
! W2 d, d9 s* H
( q7 B# A8 d5 m7 x$ M/ b6 _$ ?$ W
' J* w5 p. p. Q8 b# CMethod 06
. B6 L  N3 r8 k9 j$ K4 l=========3 U( R* B4 |6 \# @' I4 H3 u9 O

* K! G; a! U' f, @' m$ Z% y2 @$ v7 v' I% A" h0 ^/ [1 ?
2nd method similar to the preceding one but more difficult to detect:' k& R5 N! z+ j$ X: f# f1 r! e; J; A
7 ~# n" P  D* s) O

5 i) j0 I/ N9 a* K4 k; _int41handler PROC
1 U6 K# i! U2 E1 w* ~% |: z% }    mov     cl,al1 \0 ]8 I* N5 P% b
    iret
& u" \& g' h  H( Xint41handler ENDP7 z5 N  M6 ^* s, ?# m5 v- e+ M  `) O

/ X9 b; K; v6 A* B! p2 E; p( f" M- N
) G% Z! M( s8 S    xor     ax,ax
7 Q1 n# g0 v" ^/ P    mov     es,ax) X9 N- ~  Y9 u7 S  P* ]& G0 h
    mov     bx, cs$ _2 j& |& F$ y' X# p
    lea     dx, int41handler
9 m. s, C( Y$ @; m9 O7 r$ u    xchg    dx, es:[41h*4]
' ]1 Q+ L. @! ?( y# x" W6 P1 ?    xchg    bx, es:[41h*4+2]
" x7 S$ \# G1 f4 Z9 p0 H) a* O! K( e    in      al, 40h$ n4 P2 D2 o* G
    xor     cx,cx8 H4 A/ h! G0 Z
    int     41h
* Z0 U" G5 S2 R; h/ \5 H    xchg    dx, es:[41h*4]. L  Y# R. d4 V" \, V3 t1 Y
    xchg    bx, es:[41h*4+2]
3 {$ j: ~8 O% `* p6 L/ W* z9 o    cmp     cl,al# k* V0 D' ^4 ^; h/ r0 i
    jnz     SoftICE_detected
: O7 f2 O! `" w, `4 c, b  G, E+ R6 y2 P+ j; J
_________________________________________________________________________# K; d7 o6 e6 J; ?; @0 W% h' {

' A8 e& u. x5 fMethod 07/ y/ h. {  i# F0 n: H: X1 l4 ]
=========
, H# h( C* e  h' `1 j" z+ W
1 o& o! ]5 m1 l8 C8 cMethod of detection of the WinICE handler in the int68h (V86)
, e, `+ G. O9 L) E! B
9 K. O' D' y  B! s* h2 r& Y    mov     ah,43h- `% Y$ z9 \$ P4 n4 L9 j
    int     68h8 M9 M1 u1 R- _; j  [- ]' V. s
    cmp     ax,0F386h
, D: u- P1 {# _' `' Y    jz      SoftICE_Detected
- O' R6 J" I" e/ ~: \9 A1 u9 i$ N* f0 A

6 F8 C% {& K! R1 h0 v=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  s) K2 r+ q8 K( G% ?   app like this:
( D6 \8 T( F' g5 {' W) Z7 j* c: m# }  D% Y. r; }
   BPX exec_int if ax==68
" d" V/ j% N) W" q4 r   (function called is located at byte ptr [ebp+1Dh] and client eip is, U. d* x0 l. T/ |7 T
   located at [ebp+48h] for 32Bit apps)) f! D9 K1 G2 C
__________________________________________________________________________3 \9 T. G. @& j0 a$ G6 Z
. r9 N! v8 i$ V, Q3 c" t

6 M2 }- |' m! {Method 08$ [. k/ {* w3 s& L2 J
=========
- t3 ~; z5 j7 h
2 Z* H& {1 w- uIt is not a method of detection of SoftICE but a possibility to crash the  I7 J9 f& W/ q" Y" T
system by intercepting int 01h and int 03h and redirecting them to another
7 [( T& x, R9 J. w2 c1 \routine.
. z2 m/ ]3 L9 o/ }1 vIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% X3 Z8 ?2 S! F6 o2 c& {' Sto the new routine to execute (hangs computer...)
# o2 \7 E1 B1 Q7 m2 ~. b8 k+ P$ N% S8 Q, C( g. u; F4 u3 D) y
    mov     ah, 25h
8 p0 r- V8 G* ~3 h    mov     al, Int_Number (01h or 03h)* Y, h9 y0 f- {; P+ Y
    mov     dx, offset New_Int_Routine
- J9 Y$ d7 t+ A* V' J& g& ]$ E    int     21h! x4 h. D/ J3 ?1 ]& g+ C
, p0 Z4 B$ R2 P* p6 G2 r, A0 [
__________________________________________________________________________% C. i' n) ]$ R: E* y

1 U# @. Y1 q5 `# g. H+ r3 e4 }% SMethod 09
: l  C8 F2 _8 c& Z4 t! g=========9 \: ^: }( g6 ~( U6 {1 G0 v

% |5 i/ \1 b4 i- }2 hThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ j. m: L! q, q' q7 m. ?performed in ring0 (VxD or a ring3 app using the VxdCall).
) P; b. n9 {1 W) AThe Get_DDB service is used to determine whether or not a VxD is installed1 i% N7 I, |6 c' s
for the specified device and returns a Device Description Block (in ecx) for8 @/ a- b( Q4 J
that device if it is installed.1 {' {* s( o2 N. X* k

$ Q1 d* n. J$ M2 F5 M   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& [0 }( i8 J7 P/ f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( r, P, J! ]# `3 b; D   VMMCall Get_DDB
: D0 A" @$ G9 r6 C% P$ l- x   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" t; T, i# N3 z+ J' j7 }
' S6 E8 j+ R4 c' C  O" [
Note as well that you can easily detect this method with SoftICE:( Y) ?' N# S1 h( y2 M% \$ N
   bpx Get_DDB if ax==0202 || ax==7a5fh
) N6 L6 k5 A  r# F% k+ G
% S" Q9 c) f# d__________________________________________________________________________
- A. u0 p6 e8 T/ H! r- _
6 E; W/ n. `) E0 x" N2 qMethod 10: v- }& Y# `/ A3 f2 Y
=========
% U. u1 R% ^8 K1 G" h
. `( P& V( M8 ~7 ?! x9 v9 i& K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' }- g) T) @  i4 ^" v  SoftICE while the option is enable!!
% r$ K' _+ g7 f0 b2 f' y6 V# U7 h! c1 ~9 f5 R5 B
This trick is very efficient:5 }: ~; s' m3 E4 h# L- C
by checking the Debug Registers, you can detect if SoftICE is loaded  I; Y8 r5 x, e. e8 y
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# q9 F( K4 n& ]5 F4 Mthere are some memory breakpoints set (dr0 to dr3) simply by reading their
1 s+ c  U( e/ A8 Wvalue (in ring0 only). Values can be manipulated and or changed as well
7 c. G6 n- M, y; {(clearing BPMs for instance)
. F. l$ X/ Y% S5 w) @) d  z/ @0 [
__________________________________________________________________________% i* A1 K, E3 v- t$ t4 X& z

/ M, o; K" S  Z# N6 oMethod 11
+ M- X, U/ k6 J* w! {! F2 j=========! w2 O0 R. f7 O# |: [5 U1 B# `
! ?$ Y* K* Q# \3 L
This method is most known as 'MeltICE' because it has been freely distributed
+ s% ^2 T7 h  j7 H4 `via www.winfiles.com. However it was first used by NuMega people to allow
# v5 a- G% X. ?# a% S% e7 F% t/ W/ aSymbol Loader to check if SoftICE was active or not (the code is located
, K5 a  W. n( e# G5 L2 ?% }inside nmtrans.dll).
3 P$ L& Z5 {/ f9 l6 L+ [& s: t5 F( _' N& B' ^7 C7 z, s2 l/ ]8 K" z2 z4 D
The way it works is very simple:! L- q. G6 v9 o6 F$ D5 R
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 [7 E/ r- v9 T1 a; ~1 ]0 x/ @; w
WinNT) with the CreateFileA API.+ J# ?$ C' P5 c% j9 x1 h2 U7 M8 c0 {

2 i. y0 q* i& k6 W  t6 JHere is a sample (checking for 'SICE'):  ~# @  ?- V0 }7 m$ H
. t8 a% N+ I) C" y1 m8 v
BOOL IsSoftIce95Loaded()
) ?: A$ ^) H# Z# T8 _{. P5 t7 h/ T3 d! I4 Q* E; y8 z
   HANDLE hFile;  
. J8 p8 N1 r  o2 ~   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
3 A5 V/ f" T$ q% N& Z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. V3 H" b* E' K. l4 [                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# P# s  ]1 o8 b
   if( hFile != INVALID_HANDLE_VALUE )
+ L$ {& ~- X+ G  ?; M   {
; `7 N. Z9 ^0 \, a8 T& |; `      CloseHandle(hFile);
2 g" b+ b- Z+ W: A* ]      return TRUE;- {% z: l% `  j6 C/ l+ ~
   }! C: Y# r) ~* B# [: k+ H
   return FALSE;
5 Q' }6 D) _7 ^. b* K1 s}6 b( P2 e, n6 w$ L* A; C# m+ N, W

6 _9 S5 c) Q1 nAlthough this trick calls the CreateFileA function, don't even expect to be% q5 A( W1 q) B# N7 w# ^
able to intercept it by installing a IFS hook: it will not work, no way!- ]. U# I* h+ q; w" u
In fact, after the call to CreateFileA it will get through VWIN32 0x001F( w" k0 Y) s% ~. D, M" U5 Y
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)6 W3 d2 ?, r; j: H
and then browse the DDB list until it find the VxD and its DDB_Control_Proc. b, K7 Y2 j: j. t( h
field.8 g2 w9 J4 c4 k3 i' z8 Y; `7 y
In fact, its purpose is not to load/unload VxDs but only to send a 5 y+ J6 V; |. E; l0 O6 D
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( r. [  l# x( j0 r9 U- o1 jto the VxD Control_Dispatch proc (how the hell a shareware soft could try2 M9 L, w- Y: S/ h3 W  M( |4 a
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 `* B6 \5 C) F# b# V8 kIf the VxD is loaded, it will always clear eax and the Carry flag to allow
0 l3 b# r, [+ u8 o' {/ ?& i6 iits handle to be opened and then, will be detected.
  A& E  M- ^# X& n! wYou can check that simply by hooking Winice.exe control proc entry point
6 s' H$ g1 E! h+ b* fwhile running MeltICE.2 d" B4 O1 ^. j* e
% B/ x( q) u/ |9 f+ ^8 L5 F
3 K  v4 `0 u" v! s
  00401067:  push      00402025    ; \\.\SICE
# ]. _) a$ }- ]. T7 j0 w, B  0040106C:  call      CreateFileA7 i: w( ^8 w1 y+ k7 D% x! b
  00401071:  cmp       eax,-001" m: F, b( [1 u& _5 l) j
  00401074:  je        00401091
' ?" O( A& i$ h* F3 e, u% D$ H( y; A. O( p
2 P7 ^  B2 L6 ^, ]" p/ J
There could be hundreds of BPX you could use to detect this trick.
4 o; }+ X( n5 G& N* Z-The most classical one is:4 W; D+ e$ T* d$ Q' F
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: v' U2 \; W+ e: f; _: d" _* m
    *(esp-&gt;4+4)=='NTIC'! O$ r5 h! c  Y2 X# K7 Y
0 `; ~" v+ g0 b9 p3 ~% I) h+ p9 a2 X
-The most exotic ones (could be very slooooow :-(
6 `$ \" C6 A! l4 a   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( [$ p. i8 A- b5 }( [9 K7 L: b     ;will break 3 times :-(
- I5 h2 M0 K, ]8 Z1 c6 r+ z$ i& r& j# m0 V' N% F% K
-or (a bit) faster: 5 X( [9 U5 d# z# X& K3 u
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
5 @8 n, R- j% h- s. c+ I0 }7 B3 G2 h4 s, Z4 H: n4 O4 j
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 [  ]# Y/ ]* K  Q
     ;will break 3 times :-() n9 x; l9 g3 V+ `) k
# g& [% Y: _% l& ~( j* n( y4 i
-Much faster:3 }4 e! D, X, e: u. ^
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'+ R6 c+ {% _) M8 e2 @- Y" s; V

4 W' [3 {9 l/ o. CNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ e$ T3 [# P' J) K& jfunction to do the same job:
! s1 Q% T, g+ Z* N) p$ l
7 i) J4 L/ v1 `4 t2 P   push    00                        ; OF_READ
0 ^1 j+ H; m3 d, V) B# m   mov     eax,[00656634]            ; '\\.\SICE',08 G  ?0 i& E, K. B
   push    eax
; o! l! A5 H* j. W' o   call    KERNEL32!_lopen
' M$ F" I8 R$ y9 i0 k- [+ i9 L. ?   inc     eax
2 A+ Y- m' P$ l   jnz     00650589                  ; detected5 e( L# u& A' F2 ~6 m; l
   push    00                        ; OF_READ
1 [( G3 g+ u4 \  i& Z   mov     eax,[00656638]            ; '\\.\SICE'' s' }" J$ Y* L3 f+ ~
   push    eax
- Z5 W. ?' Z6 W, y' B" Q' o. m   call    KERNEL32!_lopen  c+ C6 w' t* J! p: i- x
   inc     eax, }6 c0 I; x8 r) i
   jz      006505ae                  ; not detected
' U% j' V+ t" M. t8 b
6 \2 a7 s$ _' A; D% t4 {, c
  R# t, }& h8 c: l8 j__________________________________________________________________________/ ^3 \- R5 c8 m" d

7 p: G$ n% L& ]: }9 |Method 122 u: f; D  C) |8 F' d% m2 ~; F
=========: i& @) ~4 |7 ~, w$ i8 g
: J. T/ J" D8 E
This trick is similar to int41h/4fh Debugger installation check (code 05
! \* N* e, k5 t6 L( w. B6 ~&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, n" z! Z3 _+ f' @5 Ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.7 H( `0 e0 l" ^
6 k: P3 W9 J( R" g+ o8 Z
   push  0000004fh         ; function 4fh$ m* d' z- n5 Q0 ]$ k% ^
   push  002a002ah         ; high word specifies which VxD (VWIN32)( g9 c1 v; H1 P, \
                           ; low word specifies which service
  G+ @: C! E  a' v$ Y+ a                             (VWIN32_Int41Dispatch)
0 V4 D$ N5 t9 p2 H* s9 V   call  Kernel32!ORD_001  ; VxdCall
* s# `8 u, |: F, y9 i- v: H   cmp   ax, 0f386h        ; magic number returned by system debuggers
8 B5 w; j5 Q- E9 t: j# L5 `, C, I   jz    SoftICE_detected
: g) d1 W% Z8 m+ n. i/ B4 V( |) {* `
Here again, several ways to detect it:
2 k' V2 v5 R' e) I- v+ w2 Y
9 I' J' H3 ^5 G$ D1 K: N    BPINT 41 if ax==4f. l" o4 O" ]) N

' N$ }6 u" x2 i2 Y9 T8 v    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( ?2 K; s0 i; c+ R1 ^6 n

3 T9 b8 a# o. |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) X+ Y2 U8 o- G& d" X
7 b; S9 O5 @$ \' d. ]6 Z
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# H, q! z# o; F- X: R+ B8 w# k- \
, y1 d; r! x9 P4 z$ [
__________________________________________________________________________% t5 F  V. Q4 ?, o7 Q, B/ ]  s
5 s  H+ S; V4 P3 A! L1 k2 ]- S  Z; A
Method 13
; p2 }& f# C+ o" V; p+ S) c2 L=========
- u3 H; G! Q5 S% ^) v8 P# i% y7 b1 E' c( S
Not a real method of detection, but a good way to know if SoftICE is" w. ]! z3 t% h( U- e6 b7 n6 M2 a
installed on a computer and to locate its installation directory.  p( n# n7 l  K& v6 z7 o
It is used by few softs which access the following registry keys (usually #2) :
( o  X4 N8 b9 F& r) F* f+ d6 n9 _4 H6 u
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ s7 P* w& W- P, {% f5 O9 d
\Uninstall\SoftICE2 b2 d' l% w' c, w
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, I9 v2 P6 U3 t' V
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- w! q1 E# T/ m* H) Z\App Paths\Loader32.Exe
) s: H& Y3 A: F
9 j' t# \9 N; L/ S/ A% f: j+ I1 ?" Y- {) [
Note that some nasty apps could then erase all files from SoftICE directory
. o1 N1 T0 v+ x4 r8 A* z(I faced that once :-(
0 y% J6 k& T6 f/ H* V9 q3 W! B8 P8 I: f! S$ I
Useful breakpoint to detect it:
0 v: z* Z5 T5 x% a$ @- j
0 u: B% k  U' M+ G5 t+ n9 r& m     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 X8 [% V3 |$ u. e6 q" T, Q( ], P. c
__________________________________________________________________________
+ s* P# {0 L- H7 Z
' d  p' s) H$ F' n; e6 J1 a
( v# D7 L+ \- @9 GMethod 14 1 p" O% e# Q; l5 w2 {6 g; p
=========
( R4 M' K- o8 b4 _6 E8 a5 ]/ A( K0 O4 c% G; h0 G) q# P& Y: Z6 O
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
- u. H$ `( J2 K! S4 Uis to determines whether a debugger is running on your system (ring0 only).# u  p  W1 `7 i" l" ?
3 t/ _/ B- ?7 E8 F; g
   VMMCall Test_Debug_Installed2 N( X9 `! g" }- z( _2 D+ s
   je      not_installed& H8 a' X- J, ?; K* d, _7 A

0 A# h6 n8 c( N/ @" [5 xThis service just checks a flag.
$ u$ h2 G6 Q4 |! W</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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