找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. q: X( D. S6 L! j. _5 r
<TBODY>0 v4 b/ M8 o/ r; M& e  U
<TR>
0 T7 w6 c' U3 b) e6 n# s9 j<TD><PRE>Method 01 % T( P9 A" S* o) k: J2 K% W+ k
=========8 M) h8 v" k: F7 H

9 X" I# i; T# c7 }9 j/ SThis method of detection of SoftICE (as well as the following one) is9 U' l. u" F8 x5 m* {
used by the majority of packers/encryptors found on Internet.5 r8 B3 ?5 s- {( F
It seeks the signature of BoundsChecker in SoftICE
) i, I% I# Z- Q3 o: r
* E% ]5 t( g# r/ K    mov     ebp, 04243484Bh        ; 'BCHK': Q2 ]8 c: f4 N7 N7 N  _
    mov     ax, 04h
7 C2 b9 x( t* Y+ [9 F1 s7 s" O% ?  O    int     3      
% Z. F$ \7 U, w/ a2 A    cmp     al,4( C/ |0 a+ q# s2 U8 Z( E
    jnz     SoftICE_Detected3 B, S; Y  O0 a

+ J) B) G2 ]. S0 e: C" v9 S___________________________________________________________________________
5 N- C/ y* U% J6 F2 A4 H: w& q  K- q/ H/ X
Method 02
2 N1 U) f( j9 J( h3 D0 y$ Z  V=========% J5 r1 W, v8 \* ^) E" |

" E& @4 i) ~5 F) C9 b9 j0 }& qStill a method very much used (perhaps the most frequent one).  It is used
. V1 Q7 E# ~. E* |! P5 d! C# kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 ]+ Z, Z/ m0 X1 s3 e, D0 ~
or execute SoftICE commands...0 c& j+ X7 B4 B7 w9 |
It is also used to crash SoftICE and to force it to execute any commands
$ N- G9 C7 D! Y. Z* O! S(HBOOT...) :-((  - R8 Z3 _. m' g) g; H' x  N

. F* ^* H1 I+ ^) N3 b2 ?. Z$ vHere is a quick description:
% b" A) X, I, p- D- t-AX = 0910h   (Display string in SIce windows)
9 j4 u3 V3 z0 Z4 Y/ g$ ^1 c-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. v( @+ g) T5 t0 Z4 U' `( O-AX = 0912h   (Get breakpoint infos)
. `- O% ]2 e5 {-AX = 0913h   (Set Sice breakpoints)
& s( s, w9 _' K3 D-AX = 0914h   (Remove SIce breakoints)
/ z+ g! g' Q+ Q- e) G7 O. e4 `. V) L: h
Each time you'll meet this trick, you'll see:
# U  f8 O' k4 ?2 Q/ U-SI = 4647h. q5 E9 M( f7 w! K+ u* A
-DI = 4A4Dh& p/ M4 F$ k- ^$ Z7 O/ S& F; n6 C
Which are the 'magic values' used by SoftIce.
; O6 E, M, A8 PFor more informations, see "Ralf Brown Interrupt list" chapter int 03h., H" v' U2 D/ E
, i' t6 g  x5 j- p" [0 C* q
Here is one example from the file "Haspinst.exe" which is the dongle HASP
9 u: g0 p' }9 U1 _- R0 K; F7 gEnvelope utility use to protect DOS applications:' F8 w2 R  a2 R5 X# h% N

2 a# Y8 q$ Q/ ^1 ]1 R) U* ?2 k7 D# Y4 n
4C19:0095   MOV    AX,0911  ; execute command.
( C, C# w7 L) j, u; j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).1 H* j4 Q2 s1 V1 t( {, I
4C19:009A   MOV    SI,4647  ; 1st magic value.1 ?& ?+ y* W* A$ j2 B! F
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
' ^) h' i+ p: x4 c2 c' K4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) N! ?2 E# x3 u- f1 _' A1 s- |* A3 S
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
$ G+ P5 U/ B" @9 X9 w" B) P5 f+ b' ]# I4C19:00A4   INC    CX3 S; u8 O, e) \) E/ F5 y7 E' ?
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ D  p9 O" [2 |2 }
4C19:00A8   JB     0095     ; 6 different commands.1 Q$ ~9 M  k- u  d  I! x* o
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
& [* m6 b3 w/ {/ h4 L; E4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% C5 R$ K+ v0 L: z" `
) J( Q4 S$ H1 [The program will execute 6 different SIce commands located at ds:dx, which
( m6 z# s' ]5 M4 A' x. h1 vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.7 w" m/ e' ^% U* P. o

. o8 p4 ^# S( C8 ]: w8 n  j, h5 }, B* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& p6 ~, i" J4 z! u___________________________________________________________________________* N* h( e9 T' `( W) ]+ i

  X' z0 _5 C( o" N- m" n, x7 H5 f+ T: ~, g
Method 03. }* I, X3 }# ]( p8 Q* ?* z+ t; l# w
=========
8 z6 A7 k" d1 a" |" z
' p) d* t; q% p7 ^4 e  CLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* _! x, ]( H; ~% N% Y(API Get entry point)9 P+ ]# A* m* I4 ?5 d% v
          H) i6 W2 n- @0 u5 y4 d
% [2 e$ k/ y1 Z
    xor     di,di/ i4 x) ~( I; j
    mov     es,di
, X  d) l4 }) p- K    mov     ax, 1684h      
& b% M) u# k! Y! j2 i% O    mov     bx, 0202h       ; VxD ID of winice
$ \% [" h5 Q! G6 y, x# O    int     2Fh) k5 Y, J/ r" t# J% b
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. P+ c8 @6 @2 y; P, W- f$ h* }! b! h    add     ax, di
% H6 Z* G0 V: u9 k% M    test    ax,ax
7 y* w/ [" g5 o* {- l    jnz     SoftICE_Detected
; X4 y  v4 E7 `& ^8 j
' ^$ K' o6 ]: ^/ m" Q___________________________________________________________________________6 `7 L/ `! _; K
( O6 Z! ^8 b; U$ P% `
Method 04' q$ _6 ?0 U* y+ [. ~/ S3 P
=========  T9 _. Q& Q& c1 }2 c: h3 r6 h# u
' P( D4 R* n' V  V# v+ `1 e
Method identical to the preceding one except that it seeks the ID of SoftICE0 [, {8 U9 v0 o3 ]4 |
GFX VxD.1 r2 a/ ~$ c0 N: w1 j0 x, j
+ ^+ m: i4 @, [  K0 a
    xor     di,di
( m+ R3 W0 Y6 j/ v6 o    mov     es,di
* ~4 H; N* |3 z4 E* m: s    mov     ax, 1684h       4 B" ]6 d! |4 g3 H: Y1 F$ ]
    mov     bx, 7a5Fh       ; VxD ID of SIWVID) p- m  f: ?  f$ `
    int     2fh4 p7 D& s- b% n8 I& a8 P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point& Y8 Y- Z% n8 X3 W3 c. G% m2 o3 C/ K
    add     ax, di8 z+ v6 R5 `) q- i" A' k
    test    ax,ax' F) {+ H, a8 I& K. }
    jnz     SoftICE_Detected/ Z- B. ?+ e+ M( t; j

/ H7 a2 A- M5 o: O. y1 ?__________________________________________________________________________
$ s7 j1 B0 Y7 `/ m) X! E- h) Z! t: Y0 Q0 w# s2 g
( V5 F& v( S0 A0 o
Method 05
  w; O/ A/ n. j9 s& q=========$ Z+ u. b& j% K& o7 ]  n3 U

( f/ e6 Y' p2 v3 Z% |  xMethod seeking the 'magic number' 0F386h returned (in ax) by all system  W0 c) A1 D0 m1 c8 w. U
debugger. It calls the int 41h, function 4Fh.
5 q+ \4 @) Z2 C: n$ dThere are several alternatives.  - z. p  Y! p! U2 h2 e
5 w, C2 E: L/ v( ]5 h# B
The following one is the simplest:3 f6 X/ I/ y+ e7 g

4 g2 K+ }1 h# ?$ s0 |    mov     ax,4fh
7 x2 B! \) H% ^/ |; ?- l. d0 }    int     41h
# q. j8 N8 c( d    cmp     ax, 0F3862 m$ K8 b+ y9 g- Q
    jz      SoftICE_detected
1 w: V6 f; I( k; S6 b9 d1 J7 g, h. R9 J
1 ^, [' s# x0 i4 ]' ~. o8 l
  E. \$ G. C4 T) \: P$ _Next method as well as the following one are 2 examples from Stone's
  n  l1 K, q9 u, p! Z"stn-wid.zip" (www.cracking.net):! A1 P1 l7 {! u' |
0 m( z0 ~. P: m( v
    mov     bx, cs
; f- H# D" G; T2 d    lea     dx, int41handler2( Y( ~% t! z  f- u& Z' t
    xchg    dx, es:[41h*4]. b5 Q: A; G% M. h" ~* J! I
    xchg    bx, es:[41h*4+2]
, Z3 N- b3 B! C6 p    mov     ax,4fh
2 @0 V+ q0 M* [6 z+ d    int     41h
) ?0 i) [/ M+ A' \+ t9 d. _    xchg    dx, es:[41h*4]" P& k) L1 h8 o7 w$ u8 s- i" J8 @
    xchg    bx, es:[41h*4+2]* d, m# e' h  h. L9 y. a+ ?
    cmp     ax, 0f386h
) T  j1 g, [9 I8 D    jz      SoftICE_detected$ I$ A+ q7 t7 O$ w, M0 c- R

! V1 j3 B- [1 xint41handler2 PROC
3 s+ ?3 h( b: n( H. E* ^    iret) m& K2 M! L& p& Z
int41handler2 ENDP
  w3 B5 m7 E9 h. D
3 X& i4 d8 ~2 h% n; W5 |2 |$ Q" J8 p( ]& J  m# {+ x
_________________________________________________________________________: k$ O: _& T( e/ e& r2 ~

; L2 t" l1 q6 d2 _; e; [( B0 \5 _
* _$ V: j1 K2 bMethod 06
$ c1 \' S- D: q. @  y+ y=========, j$ z- ~5 M7 G+ f( J" S4 T7 o
5 G% |3 @, k+ b# V
9 x& V% h: n& G& h
2nd method similar to the preceding one but more difficult to detect:2 A3 U! V9 Q# [) m! K3 W

* b6 \, L( J- U
! k$ m1 r+ E) w. \3 X# Y( rint41handler PROC, \, B: P* }. |3 s3 H! [7 ]1 K
    mov     cl,al
2 i. |- r6 O( @' `    iret
( I% j+ n  h/ K3 M; }# A$ Kint41handler ENDP
7 a: T# c7 H2 d- S" X! O9 b
% z- R5 K% _& [9 T
: K4 v" n# K2 t" D- i8 D; n7 Y    xor     ax,ax
0 H+ T( V0 r1 y7 ~    mov     es,ax0 a; Y, s6 T0 ~3 x$ K
    mov     bx, cs$ m% c. ~0 j6 x( I3 M$ M
    lea     dx, int41handler) F% d& v9 }2 d
    xchg    dx, es:[41h*4]
4 o) ]+ ]$ c3 v/ n& J# j    xchg    bx, es:[41h*4+2]
1 g  O- ]7 [! a  D2 @    in      al, 40h
, ?2 H+ d) ^9 p) H    xor     cx,cx( A4 B6 D9 Q! B) q& s- D8 v
    int     41h+ D; ?( B# z( ]7 {9 E/ x8 K$ ]; r
    xchg    dx, es:[41h*4]
" |( o2 P% @& D; m7 L% c3 ]  R: g, T    xchg    bx, es:[41h*4+2]
# Q9 V+ ]% W0 y8 m    cmp     cl,al
  D8 U# a$ Q/ u% m2 {% Q2 F8 c5 ^    jnz     SoftICE_detected
- K& H5 }/ E+ o: c  r* v+ @0 U% k+ t8 T/ P& x' k
_________________________________________________________________________
  i) q, E; ?9 R# r/ c
0 G# Y2 o& m3 {5 R8 _Method 07
3 j3 F+ Q0 g. u: E4 z/ T+ I9 @$ L=========5 ]1 q2 k, `" f6 o% {6 K

; Q6 `+ f4 ]2 y9 _Method of detection of the WinICE handler in the int68h (V86)5 S5 f% G5 i( Z: ^' \6 J

  `" A+ V! e0 [7 O1 r8 M    mov     ah,43h$ F: Z/ w+ ^* Y* P) p. Z- Q
    int     68h
8 ?% @, }; t) c+ V. s    cmp     ax,0F386h. j1 r5 U, g4 z/ D6 i; I
    jz      SoftICE_Detected1 A  @, S: u" i! I0 c  Y0 |. g5 g  t$ O

0 S: `# Q; t) @: B2 n5 L( Q
9 l4 S: Y! Z  ]  O6 |5 h2 y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# L8 L# _) w8 w- L6 P( P( i/ W
   app like this:+ H3 N& J8 E, p/ y3 e
! x5 {4 d6 N' x$ ~* h8 F& j. Q
   BPX exec_int if ax==68. E* Y, P9 X9 N( I3 T9 t+ ^& ~% ^
   (function called is located at byte ptr [ebp+1Dh] and client eip is
; l+ @$ |% U2 G; P, P) x   located at [ebp+48h] for 32Bit apps)/ I5 X9 i$ f& R9 @
__________________________________________________________________________3 U* w# [& ^; ]6 W  [9 ]
% ?$ {! P, {$ e: Q% G0 A
5 B9 ?6 B% S  V5 a" b5 F5 q' R- u$ \+ \
Method 08! y, T/ p& @# f4 O  @$ }
=========7 c  r0 @- X2 _; s' R

3 v  l: Y" o) w( `: qIt is not a method of detection of SoftICE but a possibility to crash the6 X; u9 J2 ]  b1 D
system by intercepting int 01h and int 03h and redirecting them to another' A; p# O0 R3 o# q9 x
routine.) B0 P: Q0 f  E0 v. W" Y, ]& i
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 D: m" y: [: A; |) p+ M9 Z
to the new routine to execute (hangs computer...)
8 c7 U! A: m6 k/ L6 n7 L3 V7 x( D) }' v$ Y7 X$ A: o+ M+ I
    mov     ah, 25h
' E: N& g8 D- B- d. t    mov     al, Int_Number (01h or 03h); }. j5 E, r( r2 }3 r5 w/ W
    mov     dx, offset New_Int_Routine
  w; @* k; M- M6 Y  l    int     21h
+ x" T; X7 i9 j) q" B  R( p+ o* @) S/ L: X4 r' |: ^6 g2 X# }
__________________________________________________________________________: s4 l- D5 m& ^1 `
6 T  e* n6 v% }
Method 09, M9 d6 I/ p) a; p1 }; V% _8 V
=========2 Y" [9 M2 b' x; W. E' _# N
. [) c6 e  V' D3 H4 T% r
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 c) M8 _1 T  ]performed in ring0 (VxD or a ring3 app using the VxdCall).0 A% D1 m6 p( ?* }
The Get_DDB service is used to determine whether or not a VxD is installed
/ T  Q- @3 F2 U+ Z2 q$ [3 Ffor the specified device and returns a Device Description Block (in ecx) for
/ M1 i: M- e! jthat device if it is installed." n! i. O. \- M/ ]8 N. Z4 \9 {- X

1 k1 F. s5 H0 Q# L& _6 x   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID' [/ U# _% }, R; U, J  \4 c  Y# j. f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- P& n* z8 S9 z, h
   VMMCall Get_DDB) r# b$ c' ?  ^, }1 c) [7 o* \
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( X: G$ @5 M8 V: Y( o. p/ ~* s/ T6 c  J3 _' m; W  |
Note as well that you can easily detect this method with SoftICE:
) a6 T. t! r( j: x   bpx Get_DDB if ax==0202 || ax==7a5fh: U: H7 O  r2 K, L

) B# M: @; P: s2 T__________________________________________________________________________
; ?$ I  y1 z/ W8 b* n! P. V5 Q) H0 @
Method 10! k" ^& J& H' l# d$ M+ t
=========' ^6 [  p3 F! F( Z3 ~. u

6 ]5 D, B; q2 u& P; R1 r1 U  v+ E=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, }9 t/ m6 v% Z! v% H4 ?% \
  SoftICE while the option is enable!!7 r, K5 d# [2 r+ a3 Z! k8 j

6 ~- x* T1 Y- g3 m. N* K" o2 Q: `This trick is very efficient:
7 @1 ]7 F2 m; u/ ]& i, V1 @5 Iby checking the Debug Registers, you can detect if SoftICE is loaded
$ G7 E& {. n; V+ ]3 @4 W(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 z3 v4 w" z4 [% B* S7 T
there are some memory breakpoints set (dr0 to dr3) simply by reading their4 v8 v, {5 @6 [6 e) n
value (in ring0 only). Values can be manipulated and or changed as well/ A0 m0 b+ k3 E( i% U
(clearing BPMs for instance)1 ]$ H" Z5 S! Q4 E9 j9 f+ g

+ X- L! g* I6 v& b4 Q: r__________________________________________________________________________
' Y( |- D. A! x) U2 x, i0 v7 E* h2 v1 l
Method 11( \8 _2 x! F) }7 g  ^! ~
=========
8 }" s$ D- W) j- s; t& p$ }+ ]9 q1 P+ E6 x6 M. [8 H
This method is most known as 'MeltICE' because it has been freely distributed
' D# u/ V0 Q$ _+ @! f& a9 K% Vvia www.winfiles.com. However it was first used by NuMega people to allow
0 K( f% g* ^+ zSymbol Loader to check if SoftICE was active or not (the code is located
$ d" H. D) z# \8 e1 Z8 e  f9 `inside nmtrans.dll).' M  L- X4 Z+ Y, F
/ v, G0 R* F2 e2 ~. N3 Y
The way it works is very simple:/ m  G& z$ f/ M% ^
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: J$ Q, d" P) c1 V5 @) x0 N& jWinNT) with the CreateFileA API.; a# A5 \  o2 r0 V: c  R' v
8 N. P' d- s$ f& B# Y+ D9 l, L# v
Here is a sample (checking for 'SICE'):! U  A8 K# R1 ^; p, T
8 h3 X5 L0 I) h; |1 t8 h- c
BOOL IsSoftIce95Loaded()
( D! Y) F* ^& x% K8 |: z3 |0 x# |{( ^* ~6 z, y+ q( K9 L+ r7 e9 u
   HANDLE hFile;  
# Q6 i7 G# f8 u* o: g2 N   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 Y) P- [; d6 e7 m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 L' v6 s$ g( i" I4 `9 F                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  G, E$ a8 ?' S( n% S) E* G
   if( hFile != INVALID_HANDLE_VALUE )  ]/ u. p+ \4 @4 w4 J$ n) z$ {' s
   {
8 L- }& J% d* T8 \" i: N      CloseHandle(hFile);5 b: n" ?3 Q3 {/ j4 P
      return TRUE;5 `: E$ |: M* l% C/ C3 q6 M4 h
   }
! M2 }, o9 b+ F6 j   return FALSE;3 d* B' \" I& p% z7 m
}! l4 a6 m# y0 i) Y- P
; Q1 ]5 Y2 V" g
Although this trick calls the CreateFileA function, don't even expect to be
' H9 |' }. W/ Q# qable to intercept it by installing a IFS hook: it will not work, no way!
/ J* ~( [) H) s  [9 [% {8 g% EIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
" c# F; @8 y  o9 n; G! Tservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
2 l( u, |' Y# c5 O8 E; f' ~2 K$ Pand then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 Q' }, o) k: Ufield.
$ _4 d4 I- o2 R# y' T- wIn fact, its purpose is not to load/unload VxDs but only to send a . C! o' Y" Z  N* B9 ~9 Y2 m) y) H. U
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" H- y- w3 F3 E( ]3 u% S0 l: X
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; y' {5 D" n0 r/ Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).
" K7 s0 l" d( a- S8 @. \2 gIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 F( p, i; T/ v5 aits handle to be opened and then, will be detected.
8 @; ?1 I4 G: _; P3 ~9 N0 YYou can check that simply by hooking Winice.exe control proc entry point
1 z0 L. U' m6 v5 ]0 k$ ^while running MeltICE.& i' t: Q" Q  v0 g' E
: `$ n/ Z& k+ C% W% v: m4 R( _

, @) w6 S) S8 O  00401067:  push      00402025    ; \\.\SICE
9 i2 R( J3 i7 B! r  q  0040106C:  call      CreateFileA( h4 r$ A. f- D1 h
  00401071:  cmp       eax,-001
+ v8 L$ L; d. o5 n  00401074:  je        00401091
' K% T, r1 @  u4 N, C5 @, T: t. l0 b* g, S' u- l4 ~/ w/ E' b+ T0 _8 y

: Z0 ^3 X. |+ tThere could be hundreds of BPX you could use to detect this trick.
. D6 n" y7 S+ d" ]8 q' z-The most classical one is:( }9 F5 x3 F& \/ ~; m& O
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ ?8 `2 d) R1 H* p4 x  N    *(esp-&gt;4+4)=='NTIC'
7 J" g; \7 c, E$ F# v, C. D. D# g/ D% [: }& z
-The most exotic ones (could be very slooooow :-(
+ M: m; N4 D+ N/ Y' d   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 ^& w0 w/ r- O' o# m/ r
     ;will break 3 times :-(
5 s  F) y0 B8 A- U
/ p0 }; M# D/ [& b+ P8 T- G, Y-or (a bit) faster:
$ _. r+ `. f) _- g1 w0 P   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# B9 y% O% f. g5 T2 w) x# Y

4 D% ^; ?2 `4 p( F0 s3 y( P" {   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: v+ c$ L  w2 Q4 B+ K9 m     ;will break 3 times :-(
& T( \4 _6 k$ K. e- V6 T
8 ^, s: B* R% y4 w' n5 x- d/ |8 w-Much faster:
$ Y# H, d7 ~- @; w  Y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 Z6 g; \, m- @
! T8 X$ o2 G1 M5 }3 Q" Q9 s' vNote also that some programs (like AZPR3.00) use de old 16-bit _lopen  O  B& C/ s6 F1 A
function to do the same job:3 _5 h  ?0 f( p! c7 {

3 ~1 X/ ?3 [: E   push    00                        ; OF_READ! K  i- L' |, X' Z6 v% Z
   mov     eax,[00656634]            ; '\\.\SICE',0; Z( M4 z( L3 o* }( r, g) c: I
   push    eax. E6 C6 Q& S3 m
   call    KERNEL32!_lopen
0 M' r; b! c' i4 Y- x   inc     eax4 O  n. F( |2 x- H
   jnz     00650589                  ; detected
! u% G; h) A- S: Q# e  u   push    00                        ; OF_READ
# q  z; }3 Q5 L   mov     eax,[00656638]            ; '\\.\SICE'# k$ E6 M; ^4 z; H" L
   push    eax8 c. w, J7 A$ c
   call    KERNEL32!_lopen" p* t* |/ v0 T7 `& f5 S! A2 F
   inc     eax
9 c: G  Q# `! r5 X   jz      006505ae                  ; not detected) b0 z2 i9 ~, T8 a$ w( [6 J4 D

8 z8 {5 a2 d$ f0 ?
5 k" {2 C3 x$ P: P__________________________________________________________________________5 N$ t2 s2 a) |! l6 r% T
) ~2 V- x% [. y0 H1 Y4 S
Method 12
8 Z7 Z6 j7 k4 y=========% i4 F0 Q4 k$ S6 S

; r* Y/ y% C1 I! J4 W" q( N3 LThis trick is similar to int41h/4fh Debugger installation check (code 053 ]  T7 L9 ]+ I7 a+ n: i7 ?) h
&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 r' k1 z4 u, S
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 d+ k: N/ Y& y- [  v; S
+ w% ^7 Z' W4 T/ P% I/ l: c( J' v   push  0000004fh         ; function 4fh
8 p2 z6 z- Y4 k- U8 G/ P   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 ?6 V0 X% G3 s8 E& a9 |                           ; low word specifies which service
- u4 \9 M) u% r( a' q                             (VWIN32_Int41Dispatch)( H, H+ q5 g+ L4 A* g
   call  Kernel32!ORD_001  ; VxdCall3 B+ h2 N, K% {( w% N, X
   cmp   ax, 0f386h        ; magic number returned by system debuggers4 F/ v4 ]8 v+ V; |6 e5 o- `
   jz    SoftICE_detected/ l8 \7 A" ]' _* ^8 {

/ C. y, ~1 X( \" r* A: J; p8 o; p* uHere again, several ways to detect it:* n) O1 B) v* h. U* X8 I- u( H

5 q: P0 w# @, C# l0 Y0 m4 `    BPINT 41 if ax==4f
: \* I. C7 g; Z4 ~# Z) q/ L' W
( e7 U6 m" |1 p- }  O- c0 d0 a    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 h9 P6 l" T& u, w% O/ w8 B( P

* L. S9 d7 j- A0 i    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' g3 b5 Q3 S9 P% `7 U' ]8 u; Z6 x9 l. S& R5 }+ A- j& f( _
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 B0 W) S8 ?+ I: L; d
9 O  l2 `& c2 w9 I+ ?& ]' J% W1 y
__________________________________________________________________________
! F; R- N) y9 W$ v) ?: ?
$ w% U1 N4 `, o8 ~1 v1 L+ o2 C# M' fMethod 13* C' s: [( V% f
=========# ?0 c6 E' J! @9 d4 v6 d. F9 _

7 j0 U7 i6 ]5 `! R9 o8 Z4 hNot a real method of detection, but a good way to know if SoftICE is0 }- V2 f; }$ c6 o" D
installed on a computer and to locate its installation directory.; G: f& u8 Q$ f
It is used by few softs which access the following registry keys (usually #2) :
3 L. [+ V  E6 n. y$ T7 n
1 |; F% X. g: j! M) N2 {. C- J) G: b-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' }5 u" V; Q' w% N, w# [8 N3 c
\Uninstall\SoftICE
  \" o7 K  u6 Q: V+ g: L-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE5 m, _: E  W8 d% T, L* J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& i( t/ l* L5 x\App Paths\Loader32.Exe
7 {  L. j2 G. i/ b* {4 b1 m; F' [7 [6 R
* E; Y* o3 @: e2 }2 G$ Y
Note that some nasty apps could then erase all files from SoftICE directory- c7 m2 G$ ]$ D+ u
(I faced that once :-(
) ]/ o8 N6 f( P/ Z) L( \& \0 m
7 ?% y: ^5 M3 Y2 N9 i! s5 }6 X9 _4 bUseful breakpoint to detect it:
+ I# ]+ J8 R  ^, l1 g  T: i, c0 @" D7 X
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. c% {% `4 S9 p0 v, n7 F1 X+ o
# d( i+ b# n! x! M__________________________________________________________________________) Q" g0 O3 Z9 S: r2 s+ v
  ?$ X1 p( [' `8 q; J# V1 k

+ N) ]7 h2 ?0 `Method 14 6 r+ p! W9 C1 g) j. p6 N, l
=========
! X  K. b  N6 a0 i- a0 E  v: S$ y1 p+ `4 H  q- {( V
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; P8 w- D& y6 U2 H/ V3 C6 bis to determines whether a debugger is running on your system (ring0 only).1 R% j" M! W+ b4 B

' ]; }7 o& r1 @% h3 E8 T6 |   VMMCall Test_Debug_Installed
7 [( Z* z; G2 Y9 e& C   je      not_installed
: D1 ?4 L8 c) y  a/ q, y
) |2 _- z9 \# |0 G/ o8 U, b" f$ QThis service just checks a flag.( j  d4 y3 P) w% q7 E
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-5-20 15:02

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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