About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
/ l: \% @3 c; {; ?: G<TBODY>
4 n9 n' \" i1 Z5 ]& o% q$ H<TR>
* n3 w6 ?/ a% s  s: F<TD><PRE>Method 01 * n( t. Q& T6 k0 G
=========
+ M) x. b% {* t) e2 O1 ~
& ]: q+ f! J5 J2 s7 ~6 k/ q3 wThis method of detection of SoftICE (as well as the following one) is
# E' e3 ?+ ]) s7 ], K8 vused by the majority of packers/encryptors found on Internet.
; ^. ]1 R0 N" xIt seeks the signature of BoundsChecker in SoftICE! ~& J+ V3 J  V# M' q

4 w& [0 D9 N( ^6 }' x    mov     ebp, 04243484Bh        ; 'BCHK'
7 U" r6 \1 M( p- Y# U% G4 A" G% z5 h    mov     ax, 04h
2 ~/ T, u# x4 n0 N$ K$ [! ]. l    int     3       4 v9 k7 @! H7 {/ a8 V9 g; A
    cmp     al,4: m% d) R  n- m- o: V
    jnz     SoftICE_Detected( x% F& T% s3 O) y  j

; _7 [) O0 D% S" w; j7 D# B/ l___________________________________________________________________________4 H* P# C( H# W; f4 Q8 W, X6 o

' B  H% Q$ v" JMethod 02
% h) s/ X# ~* s$ a=========6 _+ T7 @, R) ?% e& I1 [2 Z$ e9 a
9 v; H  n6 `& h, j0 H
Still a method very much used (perhaps the most frequent one).  It is used
+ m. h' [! Y( n+ W- Ito get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( S% D; \1 N& c3 }; c4 Bor execute SoftICE commands...$ m; c3 [2 r& w5 M/ [, j9 `
It is also used to crash SoftICE and to force it to execute any commands
# B3 X. p* `, x! R! U(HBOOT...) :-((  3 F0 f1 b$ [# a

1 k2 b0 ^' Q& S$ t- [1 EHere is a quick description:4 J1 J3 ^" `2 f* {  t3 }  M6 B1 g
-AX = 0910h   (Display string in SIce windows)
* v) [* U2 [/ l% V% n-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 I# }/ V% E9 v4 I) |* O+ G-AX = 0912h   (Get breakpoint infos)
9 ~3 K" o4 ?2 b-AX = 0913h   (Set Sice breakpoints)
) C6 @. Z+ ~" q# x( k4 e5 `-AX = 0914h   (Remove SIce breakoints)
+ U, ~+ n0 _7 L
! W' v% H3 x4 J( t6 PEach time you'll meet this trick, you'll see:6 ]; {. N: G3 t3 K. U  B" Z: @
-SI = 4647h/ k$ X. Y- w! J: t" I4 R
-DI = 4A4Dh8 z8 t: w1 {2 k) J& S' {4 G
Which are the 'magic values' used by SoftIce.+ B) M& ~! ?4 P1 l: B
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
+ H6 a, x) T. t* t% Y
- g5 T% v, R- SHere is one example from the file "Haspinst.exe" which is the dongle HASP
. }0 v, S# @& m. d  r. K1 Y% j, ~1 Y3 KEnvelope utility use to protect DOS applications:; m% q/ z# W& o  T
! p! E$ v" H7 I

# g6 w- X5 v) I9 ^7 i4C19:0095   MOV    AX,0911  ; execute command.( O5 \3 y1 P2 B' J
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).' y0 B9 I6 n# m5 @/ v/ h+ @: H
4C19:009A   MOV    SI,4647  ; 1st magic value.. h' `& F* e9 F5 H" W
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: M" w3 }* A. p; H  U9 B4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
  W  a5 O- d- f9 ?2 m4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* V" `% T; t' K
4C19:00A4   INC    CX( Q# V% H" d) K, \
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 `" y  Y3 F" p4 \7 x' B9 j4C19:00A8   JB     0095     ; 6 different commands.) }' E- d0 w* S: a$ J& n  X& F
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; ~* f# ^& T# I/ D: a" k% B1 [4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 x8 N7 A2 V" `& Y' s6 {
2 `+ H8 P* x/ \( o% J
The program will execute 6 different SIce commands located at ds:dx, which
) H! \: |% E9 J8 {( m7 s: nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 }- v: ?" b. @! t) i  F  G8 C+ e5 R
/ C7 T4 B! f0 D4 x
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ p; j* M+ s" e5 F6 L7 O, r
___________________________________________________________________________3 ^0 g2 y% e' g# [% |

5 x, o5 S# p# ^
, X$ N$ {  J9 P* E) `+ j* CMethod 034 o' d5 F$ U  o/ h5 T
=========
+ m5 D( q* g0 k; |3 D* y& x
# C+ X( B2 B2 R! NLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 b$ d7 ^" [& }, {9 y(API Get entry point)
& m8 K, t7 e1 ]3 A' t3 P        8 t. O" L4 x) D' k

8 J, H( |: `4 x+ J: U; p    xor     di,di
  ?" i8 r1 }- z0 m% N) `7 }6 K    mov     es,di
+ {" p9 I' S$ g- N0 k    mov     ax, 1684h      
% B/ M% e3 @. R# G0 @0 \    mov     bx, 0202h       ; VxD ID of winice
  {0 |8 A% ~% d( X/ |5 |) y4 d1 S    int     2Fh  H+ C; x0 ^( `
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) d" X! S4 j% L
    add     ax, di0 t+ L0 }  o' U* H+ A& G$ F
    test    ax,ax  Z$ @6 W2 j/ }
    jnz     SoftICE_Detected
+ w- h9 b4 I/ E4 \; y+ v3 Y, _! e7 U2 P" P8 ^
___________________________________________________________________________
) M: u' C' c* |+ b0 @$ `2 ?
; S3 ?0 Y' i: g* E" WMethod 044 |' o1 z7 t1 [+ K+ p
=========  U; N$ s* x& P( O0 G
$ v1 m" W/ |1 w- F# F; ^( s
Method identical to the preceding one except that it seeks the ID of SoftICE" Z! m' i6 ?( j1 F9 h
GFX VxD.2 f# g5 o* b0 F

6 ]6 o) j# {" p' P& [/ i    xor     di,di  Y8 r5 ~/ o" |/ I0 Z( j& r
    mov     es,di
4 _, [) J/ x' v5 @; ^) B    mov     ax, 1684h      
& B! S. \% E- M/ {& ]" z; o; m2 K    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 A$ k: m3 m/ d6 ], c
    int     2fh
' W1 |& _# n2 u7 x; |8 e, D    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 U& z+ x, v6 Z, t6 W' @% n4 P
    add     ax, di
9 ^% n" U7 r2 E2 _$ y1 e9 B2 \    test    ax,ax) f* ~( U/ ?. w
    jnz     SoftICE_Detected7 n/ W8 Y( e- ^1 c3 s; x# ~
0 E" l% ?4 S8 m+ Z7 T
__________________________________________________________________________
( w+ \5 S3 O6 i; O8 b. _8 w
: v7 a3 ?3 o9 Z7 J6 F" M9 H( O  M8 j9 ^% o/ t9 {- U
Method 058 ~: T9 x$ J3 e6 k1 r" z' U
=========
! j  U+ B  q5 _- @/ v. l
  H! o( `6 b& g6 o9 pMethod seeking the 'magic number' 0F386h returned (in ax) by all system
! p# T. q! `& Z/ @debugger. It calls the int 41h, function 4Fh.5 j0 P5 w% y1 T0 t+ h. b# M8 D% {
There are several alternatives.  2 u6 T5 u0 n. I

; S3 R4 t: o0 R; o- B' IThe following one is the simplest:
. o. w4 s, s9 H" g: Z: s; _- }1 @& d& T( V) b* a* r
    mov     ax,4fh
" n, I+ @# S; R3 U  t    int     41h" q& t& p( H, ^/ ]: u5 L: s
    cmp     ax, 0F386
$ V7 e& {8 V3 g3 e2 i. I$ ^) E    jz      SoftICE_detected$ I  X/ Y9 L3 V; I5 [

2 N* h) _7 F0 k1 s; _9 y$ z9 J
8 L* ]# K& j7 g1 ?$ BNext method as well as the following one are 2 examples from Stone's
2 e: i! ~- U) d0 b* v7 T"stn-wid.zip" (www.cracking.net):
+ C4 O1 o  H% Q& y2 W: p% H+ z& i3 ~# B  I: b
    mov     bx, cs- k! Y) }: x: E/ e
    lea     dx, int41handler2$ M' s7 b( P* `8 r+ x6 Q
    xchg    dx, es:[41h*4]
. ~. |7 J' r$ M+ C/ k    xchg    bx, es:[41h*4+2]# a6 c* [1 g$ N  t
    mov     ax,4fh
) b! ]" N# g2 J    int     41h
5 A8 y9 H9 T/ t1 r* C6 k4 ~9 r- b    xchg    dx, es:[41h*4]. \- }. y% U* `% G! r- K
    xchg    bx, es:[41h*4+2]( B' D. x7 R, j) c( F2 d5 a9 i
    cmp     ax, 0f386h
! g/ W/ j+ s# t& ?5 x5 ~    jz      SoftICE_detected) q9 x& t1 b" |. {5 u- p  L
( ^* t9 n. A/ a
int41handler2 PROC
: p. h2 Z% i- D3 J3 C    iret7 @" y$ E4 L, [$ A
int41handler2 ENDP; D2 _- t+ M; v* x
6 A) |; ~/ }! _, v" k
( b7 O8 B9 P8 l
_________________________________________________________________________
3 @% q& m" W7 M9 k6 t, t
4 N; Z0 t1 R. Q. r7 H3 I2 c' U3 w7 W8 X$ J7 [, J% `% ^* B
Method 061 \% e, f7 M3 R& O3 \
=========
, I9 H) }3 d; B, Q
- L$ e; @  R9 j0 o9 Q2 B: T& l
% W4 a# c& I; ?0 G0 f. C+ X0 I2nd method similar to the preceding one but more difficult to detect:+ Q9 {! U7 G6 J  J, ^" H

6 g0 m% U0 h! G: S7 n. h4 \$ h! A$ [; y+ p1 Y+ {) U  R' k2 S
int41handler PROC
' ~; u$ G  P# {" w5 K4 U  K    mov     cl,al' T  e4 e, b. x7 m# \! M# I
    iret
6 j; @' `. v* X) U/ \* Fint41handler ENDP
. [& q9 ~) c9 i' g2 O; ?& r9 q) ?$ B$ _
- S1 V$ M! k- y: q9 H
    xor     ax,ax
2 |6 N' _' r; d* G% X    mov     es,ax
. X6 X/ u* _/ L0 y4 |    mov     bx, cs
+ I, |, G7 Z+ Y, |% }, W' J0 ^    lea     dx, int41handler# T+ e4 t- h  l- u
    xchg    dx, es:[41h*4]
6 S! n; A% a9 S3 D+ I$ ]: R    xchg    bx, es:[41h*4+2]* p: o5 G4 G3 B6 q, P- b0 _! ~
    in      al, 40h3 m- w$ x0 R3 y# P" U
    xor     cx,cx" _) N8 I1 ~' L& F' o) B& l3 }6 h
    int     41h. i. [2 L+ x0 L8 S
    xchg    dx, es:[41h*4]
) k5 q8 i6 I, g& o7 L! U8 s8 |1 S    xchg    bx, es:[41h*4+2]/ P0 n' x2 l. l) G( V  m. W
    cmp     cl,al
. f+ L) R  g( {' Q1 R' I$ H: W& O- {    jnz     SoftICE_detected
8 ?5 h, z' x& Y) Y3 i+ F  x: H; k7 l* l9 e
_________________________________________________________________________
$ x6 u9 |: j; ?% v: h, W: h" C4 N* [8 k# ^% K" y! L0 W$ j
Method 07
7 ?7 v6 w% h# P. S' D" ~% e3 c8 F=========% w8 H- B% n) e2 |

9 X/ f5 \& F# E, o! WMethod of detection of the WinICE handler in the int68h (V86)
! A. r" {1 ]1 `, v+ p$ Q" m4 W" }, q( H: H8 e
    mov     ah,43h  [# S1 U3 s: r$ {3 s) ~( w
    int     68h8 I; Q' r/ I( k! C# X
    cmp     ax,0F386h0 N3 u( B+ R$ T
    jz      SoftICE_Detected
& Q  F; f. I6 Q* P& I& c, q8 }5 H: w/ T
: q* H: ^5 U: w' h9 m- l! ]+ Y
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit* d9 w5 J/ F7 Y- y$ C6 x2 o0 H  S
   app like this:! v# U3 f2 l/ k6 F1 I. s/ M. n

& I3 ~8 F: k/ W4 \8 b: y2 D* |   BPX exec_int if ax==68
) t2 d+ x6 I; }' L" _+ F" W+ a   (function called is located at byte ptr [ebp+1Dh] and client eip is/ U1 x+ i1 {7 Y* W; V. g6 H( q
   located at [ebp+48h] for 32Bit apps)
, O6 U6 _* l7 C9 @) _1 E4 m__________________________________________________________________________* d, x3 n* _" J8 G. Y4 y0 D

3 @% `. `3 c- I( h0 c2 B0 u" v  Q
Method 08( v2 v- J; Y* K5 b( a- p, i
=========1 O6 u, O/ Z" _* p7 f

2 }# c$ l* A/ I, m5 @It is not a method of detection of SoftICE but a possibility to crash the
+ c" h% p* `/ E, ?% `6 ?system by intercepting int 01h and int 03h and redirecting them to another
7 _5 `3 A' h2 t+ Sroutine.; }5 w" h( H& |+ W' y4 i
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 T2 T; }! f7 s( G- U
to the new routine to execute (hangs computer...)/ |8 E$ @- ^3 Z0 `- k
6 d4 H( c+ {9 `  v( D! E/ c
    mov     ah, 25h2 q- S& x( M, w. ~
    mov     al, Int_Number (01h or 03h)
; Y  r9 J2 |/ N# c; ^    mov     dx, offset New_Int_Routine
- p& ~$ g1 g/ u& }2 U2 k8 _    int     21h
, F" P3 Q1 t( Z$ Y; m6 m
, p1 M/ b6 |+ i7 Z3 [2 o__________________________________________________________________________, G3 V: D7 m1 K9 r6 O1 c

3 h$ W) o7 X7 C' N1 h& {Method 09% i4 E) [3 f( D6 l1 x
=========
9 Q( G) n0 X, h6 I2 m$ T2 |  ?# O3 R. H' Z" B# b) ^2 a
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ {+ O1 i* `! k; g" {- Z" aperformed in ring0 (VxD or a ring3 app using the VxdCall).
7 n5 B; k, |# QThe Get_DDB service is used to determine whether or not a VxD is installed2 S3 B) Q8 M0 u" v+ ?# X
for the specified device and returns a Device Description Block (in ecx) for
( Y) j+ \0 f  g' _7 W$ }that device if it is installed.4 ?5 `6 q- G& C8 A

# h( D' }' P3 j& s4 I, h, f5 w: {   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) C* m; R4 {  {; p   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 i# j$ l9 E/ c5 ?, x
   VMMCall Get_DDB7 l6 W1 v, K2 b6 S9 L0 m
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  H( G2 ^! g# Y8 E. y$ k
& G+ I. y9 a* T, Q& i. a
Note as well that you can easily detect this method with SoftICE:
' _1 X6 t# {" I4 ?4 G+ s1 w   bpx Get_DDB if ax==0202 || ax==7a5fh/ S9 ~2 Y) v- V- |. Y2 m3 A" D
" k( N! Y( m% D
__________________________________________________________________________4 q9 g1 r% x) r- i

6 F/ Z4 m) C% y; N/ lMethod 10- i% U2 K; c6 _6 [: s$ h7 t6 v6 `4 ^
=========7 [7 I6 z. U1 d- u1 q/ ~
3 t4 a# Z: m+ _: a/ ~0 ~
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 s) x* u1 l$ V$ r  L( D  SoftICE while the option is enable!!
1 t( A, F& L* r; P, H7 B0 B; }! Y/ ]
This trick is very efficient:
! n* B# v# L8 \by checking the Debug Registers, you can detect if SoftICE is loaded
! i/ ^( q4 a5 R" K) r(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ M) g0 z! q& m4 f2 ]3 o5 ^, Bthere are some memory breakpoints set (dr0 to dr3) simply by reading their
! c- B) V# N: Yvalue (in ring0 only). Values can be manipulated and or changed as well5 o3 T. [2 @! G9 V
(clearing BPMs for instance)8 b2 Z3 Y$ X8 o. m3 ?" ^) V2 ]

8 A- |0 N( Q: F$ k__________________________________________________________________________
9 j4 K6 G0 f! l5 j
* u& ], K- T$ g4 |0 c: B; z$ vMethod 11- o' r+ W& E1 y! A  C' o; X
=========0 a9 C8 Q+ t# b. m
8 V, ^2 i; W8 O  L3 e
This method is most known as 'MeltICE' because it has been freely distributed
& q, i: p$ L8 X" q  \via www.winfiles.com. However it was first used by NuMega people to allow
; t+ f* K# p8 V2 U* f7 U) @7 FSymbol Loader to check if SoftICE was active or not (the code is located
% I- c. B/ z+ s9 {inside nmtrans.dll).
8 N' H2 j" m' z  F" O9 e/ P1 i& g0 O, M) T. l6 n
The way it works is very simple:
: m; C1 W6 e0 N, cIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- Z+ A; \: u/ t/ s( _3 V7 z  L
WinNT) with the CreateFileA API.0 |$ W. t+ c% p( x/ u+ E
4 A* c3 \7 b* }" U! c" z
Here is a sample (checking for 'SICE'):
1 _; S2 Z5 y+ {8 J" c; ]! I4 X3 z' |; P( S/ I' z
BOOL IsSoftIce95Loaded()6 C+ R! d4 y) p7 |
{
$ p% o: F# [* K. Y& x   HANDLE hFile;  
2 Y5 i, m% Y* y" T! O  D   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) f2 n2 ~- e5 r, Z9 i                      FILE_SHARE_READ | FILE_SHARE_WRITE,
" L( w# x% J! q* Z/ ^                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);: G, W( H7 o- m! g" G. M
   if( hFile != INVALID_HANDLE_VALUE )
' B* [( s1 w% B   {. N# t" t  ~1 ~/ s  h7 P
      CloseHandle(hFile);# G* r+ Q" _) v9 T
      return TRUE;
' d1 c0 V! |9 o- ?   }
- M) V% L" L$ q7 u   return FALSE;
8 S6 p2 R* P, j9 O5 R}
; J* m. q- x9 o2 e5 n( r4 s4 m) b4 ~8 L! `
Although this trick calls the CreateFileA function, don't even expect to be5 o' G2 j# i" \! D
able to intercept it by installing a IFS hook: it will not work, no way!* v9 B* V: ^4 W0 I0 @& K* Z! F
In fact, after the call to CreateFileA it will get through VWIN32 0x001F- g' E  {$ s+ P$ V6 v, N& ?, t8 j
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( E& }  X: p$ M/ N# `and then browse the DDB list until it find the VxD and its DDB_Control_Proc" S1 A: H" c) [3 J( s. A
field.
/ {# a, U' V' t9 BIn fact, its purpose is not to load/unload VxDs but only to send a
& x$ g. P" l& T  ]+ ]) hW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  A" Z+ G( k- i* r- t/ j2 n
to the VxD Control_Dispatch proc (how the hell a shareware soft could try0 N) L1 q$ ^4 A/ h8 U# N$ F
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 j. J$ Q! h+ @9 A3 pIf the VxD is loaded, it will always clear eax and the Carry flag to allow
2 O; u2 p- b6 e( i! [7 J1 Wits handle to be opened and then, will be detected.
/ d, S1 S3 [( k) T+ iYou can check that simply by hooking Winice.exe control proc entry point6 n% C( I+ x% T2 M+ |' I
while running MeltICE.2 m: ~8 d; l+ |  [. g# L
/ I. Z; b$ R$ I, m# |
# H! c/ t- S# c5 Y* F: g' ?
  00401067:  push      00402025    ; \\.\SICE
9 G, a) i/ @, ~+ a* o  m  H  0040106C:  call      CreateFileA4 e# U0 S" q. Q4 L. \
  00401071:  cmp       eax,-001
0 \4 Z4 x1 w9 F1 P; _1 W  00401074:  je        004010911 I$ s7 _7 b: K8 C7 \2 g/ ^7 \

" E. F6 F* X3 Y6 n+ M7 B0 f
' u  D! V+ j! z0 d- IThere could be hundreds of BPX you could use to detect this trick.
, v& U) {3 A0 @-The most classical one is:6 R  f& q4 j, c5 d$ T9 p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 Q4 @/ A  H2 n$ }! P
    *(esp-&gt;4+4)=='NTIC'- m' D8 P2 y% A5 ]2 _7 g, p) r
- D  g+ D8 x+ L. Q' r! @
-The most exotic ones (could be very slooooow :-(
4 Q8 l3 {8 H( c  c% z& Q   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* ^8 ^9 j$ l" j     ;will break 3 times :-(
2 Q% g$ ^* I# X8 J0 M5 L: Q
- c7 R1 I2 a" S$ q-or (a bit) faster:
: E* ]7 D! f" b, m7 G. s   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')/ J. O  U! n' ?8 b1 |6 @
. r1 r( Y" f$ {: ]* U# P: o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! T  T) }! m* Y: F( Y. p3 o* T5 r     ;will break 3 times :-(
* g4 L' s: M( x: L! i, i  d3 ]6 S2 l) p6 O- t0 W
-Much faster:
9 @2 M7 J- U) g0 \   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! n/ t) U% r& i; @# e7 Q

4 a$ z% ~3 V7 YNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
: \$ Z* ^7 m/ p/ Xfunction to do the same job:
& H: f5 |3 \- M1 @8 h, x* o. e+ L2 y. q
   push    00                        ; OF_READ* A( K* J4 ?; Y3 ^
   mov     eax,[00656634]            ; '\\.\SICE',0) j7 M! s* e* J
   push    eax% s0 c2 \5 c* [' \0 z
   call    KERNEL32!_lopen
$ ?; S: U6 j7 z" W" o3 w* g3 \   inc     eax
" k2 V' d- H# C  [  f5 x   jnz     00650589                  ; detected
4 S: |' ~, |7 b4 N   push    00                        ; OF_READ+ {7 X& {0 e( r) f, l: V1 _8 h
   mov     eax,[00656638]            ; '\\.\SICE'
% I1 G2 ?& B& |$ j. @   push    eax
: N4 O: l7 w. i: x5 U6 ]; `   call    KERNEL32!_lopen
2 ]; m( B4 [* p# u# W: Q   inc     eax
2 m6 G& E; ]# c6 x   jz      006505ae                  ; not detected
. [' M/ Y5 M2 V9 O% X" U' \; q$ X7 E
! w5 C0 `  {" Q( E9 u  l
/ R, J  }  s4 K$ M6 Z( D/ q__________________________________________________________________________7 r- e' }7 {# A5 k9 \
/ M# g5 _/ V; \; O6 _! W7 J- m9 [
Method 12
% w8 O1 d# z+ X. j=========
. v& ^  f% I1 h- e6 Q% y& G$ n. W7 o7 R  B
This trick is similar to int41h/4fh Debugger installation check (code 05: n0 |! k4 S0 |, Z
&amp; 06) but very limited because it's only available for Win95/98 (not NT)" }# c8 T; b3 p8 e& b& h/ |
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# H* G5 p- Z! _5 W
2 T4 h8 |  R: b' }   push  0000004fh         ; function 4fh
8 O$ \+ [  {' Z   push  002a002ah         ; high word specifies which VxD (VWIN32)
: X5 U! {' K% r/ ]9 q" D" y* |, Z                           ; low word specifies which service: u6 O( n; `' M% x/ L/ K
                             (VWIN32_Int41Dispatch): t( S, H/ f& ]& h
   call  Kernel32!ORD_001  ; VxdCall. u0 w0 R$ a' z' u' y* {' ~
   cmp   ax, 0f386h        ; magic number returned by system debuggers
/ e8 N: S/ ?( L! X1 M8 ]   jz    SoftICE_detected
6 ~1 x% v! ?4 [" `" T* ~: V6 y' e- T3 g
Here again, several ways to detect it:2 D; I$ h( b6 s9 F
2 O  W0 \7 T+ W6 H0 H+ ]& F
    BPINT 41 if ax==4f
; o9 ^  X' v1 |( J& J
" R$ t  ]# I# t5 w) d    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, O! I1 E1 Z; T7 O+ C
: v6 b$ f+ F2 M7 A' X1 q( r
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 b+ b& p) Z. l4 _
4 r8 [/ e/ }( Q9 Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 `4 `* m: A: t0 h' R7 m& s5 g- d* [' Q/ d+ D
__________________________________________________________________________5 C* |9 u# K6 a) Z% D3 V+ \

9 _& ?3 L8 F' H# t0 C) hMethod 13$ |0 g; s- ?; M) Z1 ^
=========! _; C6 _4 {3 d; R8 v' F; T
. I0 l3 _% X0 x9 m) A+ c5 Q
Not a real method of detection, but a good way to know if SoftICE is
9 t0 e' ~2 A5 p' U9 a; tinstalled on a computer and to locate its installation directory.
# `6 [) f- Z' H; W0 vIt is used by few softs which access the following registry keys (usually #2) :
$ g0 D! b/ a4 r; [& D# ?" F
( @$ e. @7 W9 Q4 H. h( _' Z; i! y- `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) R2 q9 Q7 L  E; Q/ [2 f3 _
\Uninstall\SoftICE4 j; t  x/ s5 y. Y+ d3 L# l
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! b' l. T! x% X- `7 |8 X5 d5 z( H-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* ^- }% P( r  [- D* ~
\App Paths\Loader32.Exe% [) X$ V" b: G

1 m( p6 p$ d$ @# L$ }9 k; I! i
! `3 f2 i& a3 s1 c2 @) jNote that some nasty apps could then erase all files from SoftICE directory
& a9 D# m$ m: e, y) b2 i: U' B* h  r(I faced that once :-(2 a: a7 b4 O' l! f1 a+ P8 |

% Q0 g( N8 j3 p  c/ TUseful breakpoint to detect it:7 ^1 L- _9 c6 ^

) D  V) T4 Y4 h2 z9 Q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
5 N8 v- R5 p/ e0 F; c; I, c
: R6 ]/ M" a' h# n) j$ W. N$ H__________________________________________________________________________0 l( ~2 Y8 E2 f; x+ z+ A6 e
8 Y4 ~5 V, E" g& a2 @
: |: _$ x  u# k! c
Method 14
2 f. ^3 ?. J* x* w# S=========0 G5 c% K  ]; o  r

; J* q! F  U. s' wA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; H! l+ H$ r& {* t* iis to determines whether a debugger is running on your system (ring0 only).
) [4 N$ R) N2 Q
- }( ?- v1 i" R; U   VMMCall Test_Debug_Installed! L! M$ ^- `) ?( y! p, Y0 ?
   je      not_installed" s. l# n* P1 l5 w: H& u0 w- q

, {5 x* Z  _% V1 rThis service just checks a flag.# X* w9 t7 A  z8 g7 }$ f/ \) s
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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