找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" @0 L' F6 n; t- l2 I8 {<TBODY>  L# }, B) A5 P! z- J! F$ S1 i
<TR>* W' h' u- z' j" o  |+ g% }5 W
<TD><PRE>Method 01 * E8 U% H% n+ @! e4 \. y" h
=========
# g. G6 g5 O2 o8 c# u! u1 M/ L
- J" L6 S# E2 k% n0 \This method of detection of SoftICE (as well as the following one) is
3 s) M- D5 A2 rused by the majority of packers/encryptors found on Internet.
+ s5 J1 o+ f" j0 ]4 H1 jIt seeks the signature of BoundsChecker in SoftICE/ P/ Q" b9 H$ T5 h: B$ ~1 k

/ m9 x8 ]" j: t* o. w6 m  o    mov     ebp, 04243484Bh        ; 'BCHK'/ B. C- N. W4 \6 ?6 c% X
    mov     ax, 04h
3 t% h9 O- c8 Z4 _, f9 r. Q    int     3       8 D! l4 y, N/ j3 F
    cmp     al,4. t# Y. a' q; @, X) y6 Y
    jnz     SoftICE_Detected8 P8 K6 I1 L- C2 I0 u3 {2 x8 y3 B) N

) F8 d5 Z6 B! \7 t1 k7 j___________________________________________________________________________
6 K! d( J" w$ T7 n! _2 Z4 p% X. r; n% ~7 Z, e, [$ R: N8 S9 a6 G
Method 022 y; W2 R' t: \' j8 n
=========
8 Z* R( ~" i* E5 V+ D9 Q! n. _% c6 i' z* `
Still a method very much used (perhaps the most frequent one).  It is used. @- K- E& y. i# @% O
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( a# [$ I1 o0 }or execute SoftICE commands...8 z: K7 |3 }8 I) W" e$ P1 k
It is also used to crash SoftICE and to force it to execute any commands" y- R9 ^$ T1 g) Z
(HBOOT...) :-((  
: N2 B) g8 }. a! v) }# \8 D$ d7 @1 j+ n9 l4 d
Here is a quick description:
' C9 }5 v9 b9 \  w-AX = 0910h   (Display string in SIce windows)
: z8 u% o  p' F( P5 u-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); t3 E* b$ y: B, l* Y
-AX = 0912h   (Get breakpoint infos)
$ ^/ T/ H! w9 d2 |3 j-AX = 0913h   (Set Sice breakpoints)4 U9 I$ r! f4 b% s; |9 S
-AX = 0914h   (Remove SIce breakoints)$ c+ N& C& T1 C! l
4 {* H! f. k8 e& [9 n
Each time you'll meet this trick, you'll see:
# @! G" d% k3 Y8 ]7 f( K$ `-SI = 4647h( V$ U: a6 C( }8 ^
-DI = 4A4Dh0 Y+ L) ?. ^) ?1 @
Which are the 'magic values' used by SoftIce.# m- C1 ^6 h! x- ]3 B8 i
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
3 J. N# \2 f9 x% l3 {8 g9 g" v  Q( T
: N! S, u0 L0 P; Q1 ?+ ^Here is one example from the file "Haspinst.exe" which is the dongle HASP3 r* H: d; d# k7 z
Envelope utility use to protect DOS applications:3 _' ^$ J9 \$ c
( b* e& \9 ^9 L5 H% ~: M
; l* B  o2 l, \1 o$ g
4C19:0095   MOV    AX,0911  ; execute command.
6 p* ^8 @7 R2 r. X/ j! s' Y5 F$ \4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- r6 i. Q0 j+ [7 W3 Z7 z2 h% K
4C19:009A   MOV    SI,4647  ; 1st magic value.- F4 ~1 y( L% Q7 z/ V0 ~
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& k8 B0 r. E' h. ?2 @4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 @: P, K- B! i( [2 N$ G9 X. R4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 p1 e% g" @& n5 U. n) g+ D4C19:00A4   INC    CX8 Z) ]. O- A) s5 F8 [1 [) F4 M
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute3 k3 L/ p3 j0 P( f" t4 b5 G
4C19:00A8   JB     0095     ; 6 different commands., p4 C+ E' H0 m. Y- g8 m4 g
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.( z# J7 }9 I1 ]! c* r) Y6 v5 \
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ X* C9 j1 m6 u$ A$ q; z: Q& _6 a( X5 `+ t4 F* k& Q+ b
The program will execute 6 different SIce commands located at ds:dx, which: d8 _8 `* G4 v) a
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 R( F+ y" y) I  D) W3 o
. R6 @. `& w6 [* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
# a3 Q" D% O" A- N# L, O! N___________________________________________________________________________
* p8 I& Z; e% _8 o9 B  i9 g, l" j5 q8 S1 k/ @7 V8 I! N% }& ]

  i7 h2 A, X0 h# o7 S( d  a$ Z$ fMethod 03$ o5 m; Z- z1 i, i0 J2 A
=========
+ M6 ?  c# X" M- f  d5 m# b# R9 D/ L+ p2 J
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 m. k, P7 k9 f3 V1 {# T(API Get entry point)
8 {% F  s4 V7 m: Y7 ~; x! i        
4 _: @1 Y; y5 ?5 S7 W: _( z; w
7 w1 ^# r7 C# ?6 D/ ]    xor     di,di  @. t) z4 [$ F4 C
    mov     es,di/ U/ j& s4 h# m* K2 K1 h
    mov     ax, 1684h      
& J% _6 @, y7 M& }$ `    mov     bx, 0202h       ; VxD ID of winice
$ I4 P/ M; l  n0 D    int     2Fh
3 o; |2 w3 l: V1 i8 p# n) q    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ z6 m" l+ r. k% y" y! ^1 T3 W# ~
    add     ax, di3 b5 `' w; L' C. J. J& b2 `3 H: Q
    test    ax,ax
  M* A  r9 C( |+ H5 R    jnz     SoftICE_Detected- C# H, C) N! L9 Y7 {
, }$ u  V2 }' L4 Q5 K% q% s$ o
___________________________________________________________________________
% j, o0 S" p- k4 B; \! d7 ~2 Y8 Y0 m4 ?3 L# h
Method 04
- i' i3 {9 U+ |: C/ _: F=========5 O% H( m# O4 S/ b$ D0 A
: \0 e. [/ l1 D! V* c
Method identical to the preceding one except that it seeks the ID of SoftICE
0 Z) Y7 I, p# S% y! P% s& DGFX VxD.
) V8 P/ h: c( E/ I  ?( t) A2 d
0 U; _* z' Z" q; a. U    xor     di,di+ Y1 c6 R1 k4 ?; u3 Q( B  Y' D
    mov     es,di/ ^% E: d) a. ~+ m( P
    mov     ax, 1684h       2 ~2 J6 c8 d/ M6 f( f& q5 b
    mov     bx, 7a5Fh       ; VxD ID of SIWVID- r5 b4 h- v4 Q  h
    int     2fh
% w2 H6 p$ c9 e; N! o. ~: G    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ y$ a3 \# x- f3 ~3 D9 [. h    add     ax, di" f6 a$ [' y5 a
    test    ax,ax
' P5 |, L$ i0 ^% s* G9 \2 J' H  s4 t" p    jnz     SoftICE_Detected
2 L7 q) W* L# w9 I9 Q' O& M! e$ y. D- T. U( C/ t0 [: K
__________________________________________________________________________
0 _/ G' t$ t6 d  ~
- q2 U( I9 Z( |2 I/ E
* O; n2 Y, V, a3 H2 e4 @Method 058 y. I7 I2 w5 [6 h
=========, i4 A$ J' o& _/ Y2 V6 J
0 z) B% C) ~7 F4 ^- }* Y
Method seeking the 'magic number' 0F386h returned (in ax) by all system1 A. P2 c& |. o5 m# M6 S
debugger. It calls the int 41h, function 4Fh.
& H4 ]2 l4 I7 b6 Z' vThere are several alternatives.  
1 K  K$ L) [+ _- E
. Z$ z. E5 }, T: G$ H8 `7 `The following one is the simplest:
& a5 G8 Q8 L7 T+ I. x+ ?$ E& x3 b4 g8 z$ P2 b7 w0 d/ |
    mov     ax,4fh
% l4 o0 r7 {" s    int     41h
1 c* x; f2 v1 Z/ e9 V/ ?4 R    cmp     ax, 0F386
1 w1 _: O0 \6 ~7 A' E* I  ~    jz      SoftICE_detected# S% B- R/ ~* q9 d

3 H% D  U) C+ c' ?0 Y" f! q: p: p& ^2 H3 |  @* ~% m  o
Next method as well as the following one are 2 examples from Stone's 0 j/ P; r' h+ s/ e
"stn-wid.zip" (www.cracking.net):8 o! n- Y9 |0 F$ w% u
6 a# A% ~4 {  d
    mov     bx, cs" |8 C9 a* z# u. G
    lea     dx, int41handler2
" R8 y3 m0 A# h* U( K1 |8 n$ _) ]    xchg    dx, es:[41h*4]* G1 U: y- g  X8 G
    xchg    bx, es:[41h*4+2]
2 T4 E1 c) t4 n    mov     ax,4fh
- p+ H) B: U2 \& c. M( p    int     41h
6 n8 ?0 \9 a/ m% v! N" Q0 u& y    xchg    dx, es:[41h*4]+ o" E" V# O. I( t, s
    xchg    bx, es:[41h*4+2]
) W! n/ u' Q. D. ^, }0 e6 Y    cmp     ax, 0f386h) w, _- h2 r+ A4 q
    jz      SoftICE_detected- t# a$ Q$ z7 d, r% h

& x8 c1 a& o( b; B! d0 }/ ]int41handler2 PROC
; M9 d3 ]9 z% R& A9 j4 x6 h    iret
/ f  m" a8 c" ]* x4 N' R9 U& fint41handler2 ENDP$ Y6 f" F7 |4 o+ C5 K6 Y9 |
; `! g2 x# @) Y. i1 ?' |. |0 c) B' T
2 K+ o  q* W3 D- t5 C4 a0 M
_________________________________________________________________________( s, l, x2 W$ y" G9 `
% Z! v" V- R5 G9 c+ T' e

' L$ Y- V( F' z1 x- _0 Q! ZMethod 06
7 v6 N( K. T2 K, u- n1 D=========
( _/ D2 B% j8 g  N  m
  J- _- H' Q/ D0 Z% G
4 a, R7 i; s4 ~0 J2 A2nd method similar to the preceding one but more difficult to detect:' p" E3 w/ f; i6 D

  z4 v$ B, X3 N2 n$ h5 J/ r8 D+ Z0 J; }4 C% N+ ^4 h. T
int41handler PROC2 R% Y9 B' c8 ~9 A( L2 _! a
    mov     cl,al
5 W% \; h: Y9 ?% Z0 X- n+ f    iret5 L. Q0 B9 @' l6 t( D
int41handler ENDP
7 j6 R% B9 S! C  M$ |/ x3 X/ Q. M: z8 V; {

. Z& A: ^4 g3 ^+ G- ~    xor     ax,ax
/ R9 \) F8 t$ a; C    mov     es,ax3 X; E+ M- a* y" D- z5 D
    mov     bx, cs; p3 m6 `+ j6 D) i- G. i% z
    lea     dx, int41handler
( S; E5 r# X0 d$ M, p4 P5 x; u    xchg    dx, es:[41h*4]5 _% N: d9 |  _; W2 G! L
    xchg    bx, es:[41h*4+2]' P2 \" d) r+ T& q; a; `) L
    in      al, 40h
( C( P# j: l8 \- _    xor     cx,cx
9 u0 q# `9 `1 V/ _% y6 E    int     41h
) b2 Q( E# }0 G( T7 p% J    xchg    dx, es:[41h*4]
( P" t) N; C- ?8 u    xchg    bx, es:[41h*4+2]
9 c& g! H$ v$ A2 @    cmp     cl,al. }4 @5 Q% a. X  Q3 }
    jnz     SoftICE_detected' ?5 D- H2 R0 |, B" f

1 v9 {" _1 m! ~0 W5 `_________________________________________________________________________5 n5 U$ b1 t6 V, O* [& c5 C3 Y

- S6 V! M1 K5 @/ hMethod 07
) Q5 G6 F# a8 m+ E8 f) F/ \7 {=========
  p/ g4 p2 y7 J. h2 y( n# Q
9 W1 A2 z9 P1 |/ ^! Q9 BMethod of detection of the WinICE handler in the int68h (V86)2 O4 U+ I! K+ k  {. T
$ ~8 Y- `2 k4 l8 u# s
    mov     ah,43h- x. Q1 u; [% F# k1 {+ Z8 y+ v9 E7 Z( Z5 C
    int     68h
( I6 O) r- p2 D$ ~  q* W* G    cmp     ax,0F386h) N6 a: v/ U: m- H4 n
    jz      SoftICE_Detected2 E4 Q! E7 u6 G' a; h
- t+ G# p1 u; o6 ]
& }7 m" n  q# a0 y4 i* G% e
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 J7 V- C0 l! E- J. W. z
   app like this:" R! U( P' B! O$ r

6 W6 D4 ^( p6 L  P: q; r   BPX exec_int if ax==68
" a" n& m8 j7 p7 v' x   (function called is located at byte ptr [ebp+1Dh] and client eip is$ Q% U5 s+ D, p
   located at [ebp+48h] for 32Bit apps)
( B1 }, G2 z5 K! U4 K5 P__________________________________________________________________________
9 Y9 R( u* C2 E9 @2 P+ x! W! L$ {5 i3 u

& h8 l$ ?# U+ KMethod 08
/ R5 F" K: B, V+ D, N=========
) B3 C" z( S9 m" V7 }" j9 ?  D1 x# z) M$ r# s6 d
It is not a method of detection of SoftICE but a possibility to crash the: G; i5 a+ j( B9 ?- b, ^" L$ t
system by intercepting int 01h and int 03h and redirecting them to another' b( Y: p" F3 |
routine.9 [* B7 z# V5 W0 }3 ~
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, t1 L: S9 I( `: X- d  x/ M, S6 C. e
to the new routine to execute (hangs computer...)
% T; R1 c  E+ h! P9 U( d' O2 \  c+ G4 \
    mov     ah, 25h+ Y4 M: v# B; ~* I
    mov     al, Int_Number (01h or 03h)
0 n0 {5 j  X7 T. C0 H    mov     dx, offset New_Int_Routine
4 u' Z2 P6 f2 w    int     21h- c/ E7 t4 i' y7 y$ a. j+ Q* {7 h! E
0 ?( Q# r) x) z. T$ B
__________________________________________________________________________6 n0 |9 `1 y8 @/ T* q/ E9 Z" O
# s" H2 D  ]2 h( c7 F4 ?0 M" G- z& \
Method 09
7 Z/ @9 w* M" j3 x=========- ^; F0 n, Z! g, [- Y. O9 X
# x" j9 L1 l7 E) |
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 n+ z: G! W) D5 I5 I2 e! b  V
performed in ring0 (VxD or a ring3 app using the VxdCall).
- e* G* [+ X% G2 `' z0 _# DThe Get_DDB service is used to determine whether or not a VxD is installed! u7 C* J% L# D0 R
for the specified device and returns a Device Description Block (in ecx) for5 _9 {( e( p5 G- p8 g1 j* X
that device if it is installed.
4 c1 e/ @% h) @  u2 V# l. P( \6 A- T/ O$ Y
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID5 P7 V3 v1 g% [* d. M3 n
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 }- l  q8 T0 t( i8 l
   VMMCall Get_DDB
8 |/ _) \: C; P4 r; d* {   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed0 B5 F  b- h  u$ u! X9 L6 ]

, i* n) }# v$ N2 l0 {Note as well that you can easily detect this method with SoftICE:
' ]* p2 w9 P7 ~7 U   bpx Get_DDB if ax==0202 || ax==7a5fh( z, L- F) H/ ]  N+ _) i+ {$ _
$ J* f( O2 m/ r9 K: j
__________________________________________________________________________# u! a/ j2 p+ J) o; q* A7 ^) a, b( l
0 ~' W, X( [! \: @
Method 10
9 z$ l7 H( J' Q- C& A=========
4 ?" T# \# ]1 G% Y  P9 R; b: S
' Y( e+ Y/ H8 y7 m: P=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 B' z7 k/ x' F- H5 J  SoftICE while the option is enable!!9 B/ o( O0 l, t0 P
  l/ l" q% g5 Z( u/ c! p! L
This trick is very efficient:
1 h4 }4 u" E6 X9 M' Vby checking the Debug Registers, you can detect if SoftICE is loaded7 n$ Z" J& j) D6 n1 d: i. J3 g5 V! {
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
- |, J; C8 q, Q; S: a! n- Y. Bthere are some memory breakpoints set (dr0 to dr3) simply by reading their
9 j. ?/ B; ]+ d3 E3 o4 xvalue (in ring0 only). Values can be manipulated and or changed as well5 o7 P$ d6 d' P, k
(clearing BPMs for instance)
, h% n4 w% I  t: I: @0 H7 a8 L0 ]5 V
__________________________________________________________________________3 C2 u: Y4 Y1 j( g

+ e$ E$ G, j, K, J# `7 f4 aMethod 11
/ Q1 g* x9 F6 L' l: t! z=========5 n% t# ?1 D. r8 n6 {

* P' Y9 X5 o. }* r5 [  ?This method is most known as 'MeltICE' because it has been freely distributed0 f- w  p8 m/ x! P
via www.winfiles.com. However it was first used by NuMega people to allow
1 P! V6 ^  a1 k6 b7 ^/ v0 E, z  ?Symbol Loader to check if SoftICE was active or not (the code is located
6 X6 s' J4 ]$ n9 L# Pinside nmtrans.dll).9 l" h/ g( K9 ?* S
9 E3 }, j, @$ I4 E, x
The way it works is very simple:# N( g6 O1 ~' \. W; s# F
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 p) @+ F# m% r
WinNT) with the CreateFileA API.2 c' O, j7 f/ H7 x" {- _: \7 N
' T* W. x7 D+ v- \, ]
Here is a sample (checking for 'SICE'):  f/ }3 X! Q3 \( s* g8 x( v+ }* Z
+ k0 D1 Q6 H: K( w9 n  J$ I
BOOL IsSoftIce95Loaded()+ u" o6 I, @( m% B/ U/ @8 o# K
{
6 L) q: j1 r4 R: d, f   HANDLE hFile;  , [& H) J- T+ W6 V/ E9 z1 |
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 l5 J& o) A- G# P
                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 V- _5 X! }  a, `/ ~
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 R3 t; X* g/ ]. z5 L* f
   if( hFile != INVALID_HANDLE_VALUE ): G0 h% n0 ^' {; {
   {
2 _9 \; Y3 Q0 ^4 A      CloseHandle(hFile);5 G0 n, z. s* Z$ z6 n( S9 D
      return TRUE;
  S8 J' Q: [6 s! L( j   }% K( O' W9 f- p3 A& O
   return FALSE;  G& g8 G. Q% I( }1 _" J& F
}
# W) a+ A9 u* c6 ?
# d% r" P5 Z3 c% d2 _, fAlthough this trick calls the CreateFileA function, don't even expect to be
# @9 q9 C0 K; g4 \able to intercept it by installing a IFS hook: it will not work, no way!) W3 P- @9 t2 c0 G6 g" j( w
In fact, after the call to CreateFileA it will get through VWIN32 0x001F9 `5 x, e6 X: s; p) W" l
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 u, C+ \6 J- W% o9 E; m1 e! E8 ]. i
and then browse the DDB list until it find the VxD and its DDB_Control_Proc; F) s8 _2 [7 h" i# a( i
field.
; T' j; C( j; U! H, v, n. V1 q, aIn fact, its purpose is not to load/unload VxDs but only to send a
& B  ?& J% ?  `' OW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 L0 X8 M5 w4 {3 K7 q, ?) kto the VxD Control_Dispatch proc (how the hell a shareware soft could try
" B& m. @$ J) T% Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).) E0 u- C* R' h. Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
+ W2 g% v5 W" \" u) wits handle to be opened and then, will be detected., @6 x+ l' L& R9 n
You can check that simply by hooking Winice.exe control proc entry point
6 Q; `& L$ c. i' T4 F+ Xwhile running MeltICE./ ~1 y& ~, Y5 E) t: N1 S
$ N; i( J  ~- i4 o" ]

+ J, b9 z5 o3 `1 q7 s  00401067:  push      00402025    ; \\.\SICE9 Y" X8 {, f& b$ w/ q
  0040106C:  call      CreateFileA
- \1 m7 J9 ~2 _! `, |7 k. H  00401071:  cmp       eax,-001, c% b( n7 r  ^4 Z5 S, Y
  00401074:  je        004010918 j- w2 z( Q/ Z$ a# }( O% x
* B9 z5 h0 Z" n1 O  \3 e
( x  }0 k5 C; R; b
There could be hundreds of BPX you could use to detect this trick.6 K2 r$ ]- ^) R
-The most classical one is:( a& a) f: r1 L9 H
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
. i' ~, `9 O) O6 k* y+ X    *(esp-&gt;4+4)=='NTIC'
* \" N' J& @& I0 p+ C5 }" o
0 v  A& B2 T6 E* i+ L6 k-The most exotic ones (could be very slooooow :-(( k% A* \- e1 v2 t4 {
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 e+ F" i' `. H! q% P9 T1 W
     ;will break 3 times :-(0 W+ j5 x% U& P% H8 |; A# u

6 ]/ E! R  ?) p5 x3 x' x$ i* F-or (a bit) faster:
! G9 m1 N2 P+ ?+ V. M9 F5 k$ A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
' b2 ~7 \& F$ \1 B: a# f) k) x& z! k. |3 \2 V2 z! F+ E$ ?& L$ @
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- k" D8 \& G1 n, F     ;will break 3 times :-(
1 J9 J& O  B9 Z2 M% \: ^0 K+ _! ]1 W5 `, O
-Much faster:
6 i* ~) B! G7 x+ t   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 ]9 B4 b+ a5 M  ~+ i) [
( X, ^- l4 S0 h! lNote also that some programs (like AZPR3.00) use de old 16-bit _lopen* e6 u8 W1 m6 `( P  F
function to do the same job:' y- P) A1 B2 \3 i6 _( ~; U0 d6 I7 o1 ^
0 g0 d$ O( n( t: E" k. c) g
   push    00                        ; OF_READ
. `/ u  p) H' x8 H; _# ]- q   mov     eax,[00656634]            ; '\\.\SICE',01 k  r. g' Q6 q+ j& [3 a* F, R
   push    eax
) z' H5 K' c3 Q3 K( |/ w/ y1 J   call    KERNEL32!_lopen: y9 p4 r- h, ~. @
   inc     eax9 @6 T4 M" l; J* F9 A
   jnz     00650589                  ; detected! W, V  c& }1 ?, A9 D
   push    00                        ; OF_READ
; D+ ?5 t+ |+ F2 H  L   mov     eax,[00656638]            ; '\\.\SICE'
/ @: W5 l+ e, }5 ]$ |% Z2 s   push    eax7 s* m8 h+ L$ N4 n" r2 D8 E
   call    KERNEL32!_lopen
3 j4 |3 I% a: V: V   inc     eax- }$ [# i' x- V" D
   jz      006505ae                  ; not detected5 T* p7 g8 z# g- h8 w& H

9 f' x0 \1 R- [! e0 B  K0 I! I4 \- }7 r% y7 A
__________________________________________________________________________, L3 V2 K7 r  B+ O8 h4 o: k8 h/ x+ k$ M

, k% q4 J; k& X$ Y7 I8 @0 k- K$ gMethod 125 D0 A2 h+ r% K' t9 }& C
=========
/ ?! `# v1 q" o0 F* [' q) j4 U9 w! q" [# J. w/ N& u3 E0 n
This trick is similar to int41h/4fh Debugger installation check (code 05
; z1 {+ I4 O/ t&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ \+ c6 k( F- a3 _* pas it uses the VxDCall backdoor. This detection was found in Bleem Demo.; H! w  k) j4 ?8 d

1 g: e7 V4 l4 x   push  0000004fh         ; function 4fh
3 W/ }( i) M1 i, h' O/ w   push  002a002ah         ; high word specifies which VxD (VWIN32); U* N, y6 S2 [, p
                           ; low word specifies which service
5 ?4 ]" ]# C# Q1 h7 w4 p" R                             (VWIN32_Int41Dispatch)
* G+ ]. X' U+ ^1 D1 ]) ^   call  Kernel32!ORD_001  ; VxdCall7 J1 l7 k- p0 Q, M1 B
   cmp   ax, 0f386h        ; magic number returned by system debuggers! M6 B$ y0 m4 G. s$ X7 W9 U
   jz    SoftICE_detected
' j- ?. g- \# J, F  b
9 {: y5 `, H0 c( s4 E% \/ A0 l+ ~Here again, several ways to detect it:" Y: e$ j3 [2 Q7 _, p

; e2 p* H7 ?. E( n, m0 i9 H# O    BPINT 41 if ax==4f+ B' L6 a- \; m5 s6 y! x/ k% n

2 A9 q+ \1 O" e    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 [9 N7 E$ D+ T9 q0 C
0 {! a6 s  d" N9 }7 L
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ a4 M! L7 o1 O3 W/ u! J- I
4 I" Y- E  O$ Z
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# s: W3 _2 p! d2 \

2 h) j/ q1 s( z- a* l5 e% M__________________________________________________________________________
- P( {& k$ y9 ?9 u% ~1 R
2 h/ w! y* z4 `, XMethod 130 L1 J" w5 E5 k" B: j, ^. a, D
=========* n, B$ g  P& v# |' l% ~) E
2 a: x8 u: d4 P4 }
Not a real method of detection, but a good way to know if SoftICE is
0 P" _0 ]2 R. b4 |- V0 ]2 w1 T& minstalled on a computer and to locate its installation directory.& |7 N: f8 P# v! J- \! K, W
It is used by few softs which access the following registry keys (usually #2) :0 b; r- v; w% y; i- E- y4 _

# ?5 D7 ~8 n7 b, r  q6 x9 E& K-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ K1 a- i: F5 E' l% ?
\Uninstall\SoftICE
* a' J+ x& h& W+ ]2 O-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE: }& P0 y( ^2 K
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  f% L0 ^- E  t- w$ C- h6 i( N\App Paths\Loader32.Exe
2 M# X9 J' F/ O* B, D0 ^+ G
8 F, D# v) o. @7 o( b- q1 e& e5 q4 e* I2 Q) i/ r3 _
Note that some nasty apps could then erase all files from SoftICE directory: B! o* v- m9 z  e4 Q
(I faced that once :-(
6 Y& w3 F5 n2 ]% m% T, C
! b! y$ g  W/ r2 A! [; z8 Q: l6 ~Useful breakpoint to detect it:
. Y% H  \2 H) `0 [& m/ T  B! r: I3 h& B+ y1 \/ I9 B
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 W7 c4 }2 i' h) _* f
# ?# Z& M, K, @. z% E+ q__________________________________________________________________________* k0 F0 ]$ s4 R; |4 J' G  O# m
! i+ r. E7 h7 q7 D0 a- [. h

1 h- r) V* S% w* fMethod 14 ) T& Z2 L4 P( o
=========
# D( v5 \% O( _: b, x6 x) H8 d. z1 ~( I- y, x, r
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose- V. f, m8 _0 ?$ {
is to determines whether a debugger is running on your system (ring0 only).  r9 k3 s0 M) x; B( C3 |6 @

0 \7 ^7 E; W4 {   VMMCall Test_Debug_Installed( D) y7 g% t  a2 v! K* y9 s. _
   je      not_installed/ Q" H+ A8 m2 W! p! o+ C0 {$ j, A

3 `1 h: Y9 r) ^% ZThis service just checks a flag.
7 q9 e, h% b1 K$ R</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-7-24 05:42

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表