About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" B- ~" F! A" u' Q
<TBODY>
$ T1 Y# O- z9 N% ?. Z1 h& V<TR>1 }7 n, q0 ^- A+ f/ \6 s5 `
<TD><PRE>Method 01 2 K9 Y$ I) U! O2 {
=========$ k2 [) ~; n6 c& {/ u
( T! v. T. [, ~) x
This method of detection of SoftICE (as well as the following one) is
+ r% P& a, o+ m- N2 Bused by the majority of packers/encryptors found on Internet.) a3 O2 f+ r8 \2 w/ d5 f' S8 S
It seeks the signature of BoundsChecker in SoftICE) u% n, B1 i% p. L3 ]0 y6 P1 n
  j7 _0 O& H6 y! d8 \
    mov     ebp, 04243484Bh        ; 'BCHK'/ Q& h8 E9 i( N' _% c
    mov     ax, 04h- ~3 U, b+ |9 A5 ~
    int     3       2 {0 k5 H6 A: F; L7 C+ {' F
    cmp     al,45 N1 s% S1 [( U& |
    jnz     SoftICE_Detected! ^8 g  q* n  ]: v" s: R
; }) Y( A8 d* M1 {: F8 M6 c
___________________________________________________________________________- v% L0 b* _& x# n1 Q0 s2 }
! f' r' N3 m/ t. V) p& x
Method 02; i  @1 z7 O2 ^! Y
=========; f  }8 K0 S. j7 T6 w: e* O/ D

4 V% f. U& U) @& VStill a method very much used (perhaps the most frequent one).  It is used
8 F" I* i" f1 o7 x8 c' z$ vto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
" ^% L% K/ o8 G2 _" X: vor execute SoftICE commands...& ?! y; Q- p6 M( f6 ^
It is also used to crash SoftICE and to force it to execute any commands% B- y- f9 Q( l9 v* `' [# Y. `' ?
(HBOOT...) :-((  % f) L' e# G" w& @4 B% I' D+ u
* o7 q5 D7 x5 P' W/ Y$ p
Here is a quick description:
7 V0 H3 E: r* C0 q/ S! M4 O-AX = 0910h   (Display string in SIce windows)
% C' ^, W% Y8 c2 ~$ a-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); @7 q, c" Z$ L2 a
-AX = 0912h   (Get breakpoint infos)- r; F* e. R8 y: n/ [
-AX = 0913h   (Set Sice breakpoints)
- E4 `0 h( N& y4 f-AX = 0914h   (Remove SIce breakoints)
2 b( X2 u+ r/ M" O# v
2 R6 s+ M2 F7 H# `" OEach time you'll meet this trick, you'll see:
! f; _, ?. |0 z& @-SI = 4647h
  y8 k# {8 v0 [" j) ]-DI = 4A4Dh' U8 y8 J3 h3 P" ~" V
Which are the 'magic values' used by SoftIce.. y4 F% X5 P2 C8 `' U
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
8 y+ u% U! }; Y7 e) x3 q9 m2 n- T7 K" A6 z# s' g) H
Here is one example from the file "Haspinst.exe" which is the dongle HASP
7 K$ X. K7 U, g% n& F! WEnvelope utility use to protect DOS applications:
  Q3 l: h6 ^: E- |4 S4 I" ], }. p

) E  B+ m3 y; S% B# B; H4C19:0095   MOV    AX,0911  ; execute command.
/ e; r4 r& ]2 a% j* x1 [4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
; k) G5 Z% B6 J$ |1 ~3 a4C19:009A   MOV    SI,4647  ; 1st magic value.
0 l" u: |% t+ ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 S; Y( ~) p4 i
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
2 a8 u6 j" ]- w/ c; r4 m4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 k4 _( C7 U0 C
4C19:00A4   INC    CX5 B0 l: `$ _( Z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! X4 Y8 E# L2 x0 [. F
4C19:00A8   JB     0095     ; 6 different commands.6 {1 Z6 o6 k; l- }1 z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  L5 c1 J' f4 y" u7 U* P6 w7 V$ }4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
) y) N. H1 H* U9 s2 s, y
( T" O- h+ `: A& q$ m/ `3 `' J. bThe program will execute 6 different SIce commands located at ds:dx, which, ~& Q! E+ w: e! n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 a% V( G1 _9 V5 a, Q! m* n/ \9 P. t! O0 p" P" m
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." u, m( z) x; h/ @1 w; J
___________________________________________________________________________5 ^2 d! N" G+ i6 f' h
# u" {2 i) q$ G  j- H( N

2 F) @$ L4 ]7 Z& y! [- x# EMethod 03) f7 v( z4 {/ W5 k
=========0 t, O+ E. V3 n7 {' h

# O5 u% i, Y' iLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, b# D* v5 T4 v" J" p(API Get entry point)
% v+ {3 u' z  _7 @* k& F) E        / {5 w' L$ V5 R- w1 E+ s& `! X
4 [/ i/ x1 u, S! g# W1 k
    xor     di,di
7 c# X2 @- L$ x    mov     es,di7 x0 Z# T  ]$ s, x- `# ?% s: g
    mov     ax, 1684h      
' `6 q) _: d/ ~. b6 [    mov     bx, 0202h       ; VxD ID of winice
, x% H& b# v5 p1 \9 p    int     2Fh
, t8 g6 E  H2 ^7 g$ @0 V: R/ O    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 D+ E8 y3 g; B6 B
    add     ax, di
- w6 p: H. I: x7 M' u2 M, h5 q    test    ax,ax
3 n- N) m/ n7 _- n7 i8 [  Z    jnz     SoftICE_Detected2 M8 T0 r' o: a( d+ C& I

; e/ G& a3 T. v5 e___________________________________________________________________________3 l# Q  f6 S6 j
( c1 K5 o: D' I
Method 04; Z/ P7 o8 G- `
=========
# ^: Z. w, Q! T9 A9 d4 K7 ~, n2 A. u% s) C8 O1 }3 D
Method identical to the preceding one except that it seeks the ID of SoftICE
! V- q2 Y4 ?7 {  P6 p) e$ BGFX VxD.. \: [& M3 J) U$ e$ P3 w/ V

) e/ v* i6 O; m- R7 V. O) p    xor     di,di7 h: Z" r1 @+ Z0 w% s  I: F
    mov     es,di
' f. F: ]3 K, @6 }' Q6 M! z0 J  m    mov     ax, 1684h      
- ]; q* U) O' M$ e    mov     bx, 7a5Fh       ; VxD ID of SIWVID' ^  e% r, I5 ]  h4 h' d
    int     2fh) c9 F$ ^* H. G2 k7 e+ N4 L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 l/ |0 Q! N" w! W0 }( t6 o
    add     ax, di
5 a7 X+ d8 S% O7 v    test    ax,ax1 V$ V. z" ?9 `" I
    jnz     SoftICE_Detected8 N. T/ |! C' c: p

8 u9 d% h# F" o! n! f* W! p% C__________________________________________________________________________! ~! A# w* W- V5 m# t5 f
! U  Q: Q* z+ p% a3 }' v% X* S
  _  I0 ^& ]& H+ m3 r
Method 05
0 _% z( n8 g- b=========
- v1 Z' B4 k/ e- c: l- z5 ?/ r  S% Y; A% T; J' N  L
Method seeking the 'magic number' 0F386h returned (in ax) by all system7 l( }. W( q  b- ]& f+ ~
debugger. It calls the int 41h, function 4Fh./ Y% u3 O( Y8 v) c' {
There are several alternatives.  3 S" e1 r; K2 r# g
# v8 Z: F( x- ?5 o; d8 L% V& W
The following one is the simplest:# [. r6 G) A0 C* ]$ R! a# K

( {" J7 V9 c9 ^8 _" P2 F+ H( [1 T    mov     ax,4fh1 \* T0 n; w/ Y( ]+ k
    int     41h
( ^4 k) b0 L  u( m+ x, X8 S4 Y    cmp     ax, 0F386
; h; G, [) ?- ^1 v1 ^    jz      SoftICE_detected
" P5 |5 H4 [+ c9 r9 U) F: x* T
' N, O/ c3 z6 q  ^8 v! M) `
% c  b' o& J/ j# S4 {/ E$ C4 Y1 |Next method as well as the following one are 2 examples from Stone's
3 R; `1 e) _9 [( j, @7 e  H"stn-wid.zip" (www.cracking.net):
, R3 `/ X- F4 |8 k) R/ X
6 M0 ?  t% @1 f: D    mov     bx, cs& s7 Y: i9 X0 Q8 C: _
    lea     dx, int41handler2& x1 Z" S# G# P  Z1 U
    xchg    dx, es:[41h*4]7 [+ z4 j1 o* D/ B5 _
    xchg    bx, es:[41h*4+2]
  U7 R" j/ t& i" W7 S    mov     ax,4fh
& a; b, e, M% _  ~& [+ U7 `    int     41h/ u# S" ^7 L% m; O* H0 s  T0 j
    xchg    dx, es:[41h*4]
% O* k1 d! e! Y! p2 i+ p  Y    xchg    bx, es:[41h*4+2]' r) x' k* d1 s+ \  X! ^: z
    cmp     ax, 0f386h2 Z( b# T- g# P7 c4 [
    jz      SoftICE_detected" O$ H! M! q% E0 H! O& S2 G4 P

- h4 ~% V! t* N4 g$ r+ M, P( {int41handler2 PROC" ?$ P" E$ s2 G
    iret2 M# A8 a" U& Q6 O, O
int41handler2 ENDP) F+ E& _9 T  Z' Q* M
3 K3 {3 A4 x4 }7 n# o
0 g' D* `) ~. ~2 T" R. B) H2 V2 ?
_________________________________________________________________________. \5 W, G* ]0 D- c) x
7 Z  i9 |+ A) b, P" n4 R
% P# W4 @# e$ p
Method 066 k* j8 U# @3 n" N' M6 n
=========% B. A, F* \4 r9 R7 `
8 l  T: ]& v( C. ~# D; m- c. I

3 m! k' ]3 m8 @' z2nd method similar to the preceding one but more difficult to detect:
# D# n: V. ]$ `) V! y+ }2 _* m/ o; i5 p, R' i  Z3 m; j
* ~* M* n/ V3 l' S
int41handler PROC! _; p/ X4 f1 z* \4 q/ q! A8 p
    mov     cl,al
' S$ Z! |5 a- R' D  D& s    iret  n# R7 V: O; u) N' }0 z
int41handler ENDP2 p2 p, ?3 b% Y' m

. P5 H+ Z9 k- o
7 P$ Z0 q+ O) }& B    xor     ax,ax
+ f& B% c& d0 _4 P1 e0 ~    mov     es,ax
  u* W* u6 x7 Q* W: _    mov     bx, cs
0 A4 z6 n9 h' U, w) p( Q: Y" D& C5 ]    lea     dx, int41handler
! d# i6 ~7 g' M. |" j    xchg    dx, es:[41h*4]/ _9 @9 Q; m' T
    xchg    bx, es:[41h*4+2]
1 i6 G, Y7 k! O# U) V0 t    in      al, 40h
/ }' Y; K# _6 F; @9 O# O+ c4 ^    xor     cx,cx/ X$ j! T  p+ q( A4 d+ B& H
    int     41h
+ ?5 `1 T' _5 T; C    xchg    dx, es:[41h*4]
" F/ `! z: R! e( i    xchg    bx, es:[41h*4+2]
7 }9 y. V2 [6 s6 R& ~/ ~0 r3 P- E    cmp     cl,al( ^9 A! O( n( R4 }# \. E* B
    jnz     SoftICE_detected
, U" G8 p8 c+ ?1 S  X  h9 W( b3 Q2 l# Y1 r5 ]7 n- h5 A
_________________________________________________________________________
  ~& `6 {4 u! M
0 {. n2 _9 k/ G; x8 V: j/ ]Method 07
# i1 Q/ ~& H- d- O+ J=========* D* a" X* V" W( t1 u3 ?6 T4 K

$ |6 H8 Z( D, _, x4 }* j) aMethod of detection of the WinICE handler in the int68h (V86)
/ X8 s7 R# ~+ x5 j6 S
. r' e# ]8 s' t4 o# }! _    mov     ah,43h
5 q* L2 t! |; n3 I    int     68h+ M- ~0 K1 w3 ?' R0 u% z
    cmp     ax,0F386h
# y8 ^: [8 O3 a2 D% [    jz      SoftICE_Detected
  j+ p# a& H; X2 F" V$ f
6 y8 E* B5 Z0 X/ r6 y, ^+ Y
! h: _+ g4 T: U" ^0 @% t=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  k2 u3 L! X% ?/ z   app like this:6 _7 ?+ v- T; D0 `

0 [. L) u4 o% n$ d+ c% c5 r, f9 C' v; v   BPX exec_int if ax==68& W+ l$ }7 _" r5 r. @$ b
   (function called is located at byte ptr [ebp+1Dh] and client eip is
% H/ l( I: ~2 ?   located at [ebp+48h] for 32Bit apps)# V5 G5 ^/ S( d' f) t$ ~+ h
__________________________________________________________________________
+ m2 _5 {& d6 h+ L- u, g
9 b. ]' ^) v; L* |! C
0 E5 t5 J/ i/ f  I- pMethod 08
! E4 _  M; _% C. z=========
0 E1 ~& O5 W5 }. X# ~/ l% ^8 g* b) [) ^5 V9 [
It is not a method of detection of SoftICE but a possibility to crash the
$ n' E: O4 t( K* C7 c* P. `& Zsystem by intercepting int 01h and int 03h and redirecting them to another
4 s8 |! c% }8 N/ X* e' c$ @routine.
; [% o- N0 J' V8 }It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points0 X6 A) {8 p" P1 L$ H6 V( a8 f
to the new routine to execute (hangs computer...), G- u; s1 p0 L# ?$ x% l& g% w
# `5 A/ Q1 T+ s! t
    mov     ah, 25h: I7 k1 `8 R$ T% @+ r
    mov     al, Int_Number (01h or 03h)
6 m+ a5 Z+ h4 F' u  y    mov     dx, offset New_Int_Routine
( I) H- G$ W: r& X    int     21h( R/ B/ H, @6 o! E# n4 E3 i

2 f) r( t7 b9 ~0 U+ |' U__________________________________________________________________________' Q8 n8 D+ m) O3 \

4 @. c( J/ h/ r7 w% LMethod 097 M" F/ K6 ]9 S
=========
' G1 G( Q5 h/ ~- x: q* p
- }+ I: H0 Y7 ?3 b! e5 W3 t. _This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
( b- t% g) k) {) h4 fperformed in ring0 (VxD or a ring3 app using the VxdCall).
! z4 c/ e; R( z4 ]' cThe Get_DDB service is used to determine whether or not a VxD is installed
) k5 B, p% O2 |for the specified device and returns a Device Description Block (in ecx) for
9 q7 x1 J  i& W$ Qthat device if it is installed.
  i0 _0 v9 o# N/ j& D2 o8 `* \2 r. p' S1 o- s
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ X" g5 ^6 L1 s   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), e8 z* I: ^8 r2 L
   VMMCall Get_DDB& X" A; w/ M4 D6 v! E% X7 q' U
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  f/ L7 g3 _) F, W
/ @. F2 n+ \# Y" Z) o2 y0 l
Note as well that you can easily detect this method with SoftICE:- {0 Y, D) ?* y7 S+ {( I* V* ^
   bpx Get_DDB if ax==0202 || ax==7a5fh
3 f, O* V, \7 n4 A: l4 Z- n% ?5 o; q& e* D2 z7 l
__________________________________________________________________________
/ [" f+ e; j# P. O4 h* z7 x1 R/ z' w% _1 M8 S
Method 10
! F( X5 J3 X; c5 L. d# L1 p2 X. i$ Z=========
6 i9 i3 R3 I8 Q% K0 z5 J( ^' T, q+ ~6 c" n7 }/ {7 R( P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 B) e% V, F  P9 {. q. V% o
  SoftICE while the option is enable!!/ r0 v; i, F* W0 Y

7 M3 L  P! n" _) s5 [$ EThis trick is very efficient:
# I* r( ?3 |, B7 fby checking the Debug Registers, you can detect if SoftICE is loaded
8 N6 C. r% H* e1 s: R1 |(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. ]2 o6 Q0 A5 z& G7 M6 E6 x/ W# S* Othere are some memory breakpoints set (dr0 to dr3) simply by reading their, O! Q' X+ \& x0 [  L5 G8 m# C) l0 B: |
value (in ring0 only). Values can be manipulated and or changed as well0 w9 z1 G/ w% |$ Q
(clearing BPMs for instance)
; |: g+ @# ~7 T, i5 K  x% ]& ]" Z' S  |/ Q8 A! N
__________________________________________________________________________; j9 |6 C. g* Y- u

2 t- a. G1 _/ H0 A0 [7 i2 jMethod 11
+ f" x$ Z1 \: O=========+ H6 ]8 j2 U4 \% b
' i( `5 Y$ V# c% ~' \' _. ^1 H' |
This method is most known as 'MeltICE' because it has been freely distributed
1 n  e, [" U0 i2 t8 m3 V/ vvia www.winfiles.com. However it was first used by NuMega people to allow4 G( F) Y& O9 b% y
Symbol Loader to check if SoftICE was active or not (the code is located
8 X$ u5 T+ u& R4 Linside nmtrans.dll).+ A# ]6 W3 j* R4 p6 F$ C8 J& x( q

5 ?% h. @. u- M4 v9 v0 cThe way it works is very simple:
0 e2 a  z, {# U+ N+ f& AIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 t) k% n. R8 NWinNT) with the CreateFileA API.
7 [! e" q' }, a6 Y9 E9 n6 J. L" V2 `3 Z! J
Here is a sample (checking for 'SICE'):6 e7 P' j: c7 L+ k' [7 A
4 a3 |- Q% t. b& U6 _% Q/ O" I' N
BOOL IsSoftIce95Loaded()8 L7 S8 k  R3 u( Q" T. b* r
{
: e1 w' M! H: v( g0 W   HANDLE hFile;  ) W! b5 ?# `/ Y& Y( `8 g  M6 ^8 t
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( V% F4 D% \* ~, F- J( t* S                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- Y4 g0 X" z$ e) `                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& [0 E7 z0 D6 T   if( hFile != INVALID_HANDLE_VALUE )
* {! z% ]  l, t   {3 m4 y( L* Y( M. }
      CloseHandle(hFile);; t  I  T+ r* r1 ~
      return TRUE;4 z0 @9 Q/ l0 L8 C# y
   }
9 d9 R8 {6 N3 S) H9 \" @   return FALSE;2 z. ^/ _7 z" g+ n
}& i8 o" I+ `& ]$ h5 U

# Q3 d2 }2 m  {5 kAlthough this trick calls the CreateFileA function, don't even expect to be4 e+ `5 ]! t5 ?& q4 N+ a% b& \$ w
able to intercept it by installing a IFS hook: it will not work, no way!
" b2 ~/ p  [5 T3 A4 w& k) q3 CIn fact, after the call to CreateFileA it will get through VWIN32 0x001F( W3 y4 I+ `2 ^& h% ~: e: \) m
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 G( q- ]% V: H3 @' ?
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 y# x7 i! I, }* s
field.
& m0 L: ?, |8 V. b$ bIn fact, its purpose is not to load/unload VxDs but only to send a
7 ?  b2 B! N% D3 K; ~W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- c/ w2 h3 p, |- ^. C( k+ @, zto the VxD Control_Dispatch proc (how the hell a shareware soft could try
- Q7 U2 K, \3 V* [+ {to load/unload a non-dynamically loadable driver such as SoftICE ;-).! B, Q9 t- I9 B" j0 z2 q
If the VxD is loaded, it will always clear eax and the Carry flag to allow
/ Y' G# A7 g/ F1 o, P) n3 _its handle to be opened and then, will be detected.
" V4 e" @4 n1 a. A4 j, W. ?You can check that simply by hooking Winice.exe control proc entry point9 R* Z6 a8 }" c$ R$ z  u8 v  t& g
while running MeltICE.6 G$ h2 F6 L& n3 M8 t9 s3 I7 [) q
$ B8 W( d9 h9 o) Y% O3 ?* _
. `' ~0 |9 T! e. n/ l
  00401067:  push      00402025    ; \\.\SICE  M/ [- Q* V; ~4 g4 h' d
  0040106C:  call      CreateFileA  d5 N1 [3 \! _4 `. h. r0 t" p
  00401071:  cmp       eax,-001" M! ~; {% U3 ^7 t) e% P3 Y
  00401074:  je        00401091
' L1 [0 ?6 _" N% r" ^% J( K8 e1 a7 l/ A" ~* ^  e
  A8 M: x- M+ `* j* A3 T8 O
There could be hundreds of BPX you could use to detect this trick.
  b& ]* I3 \6 l1 Z-The most classical one is:8 U8 B' G0 P- f$ U# z$ O2 Y8 u, T' d9 i
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 X# g& q3 r* |9 @  V# i: Y
    *(esp-&gt;4+4)=='NTIC'3 L1 f0 O8 u  X! F% f( a6 |. B# d4 V
1 O3 x# l$ M6 w7 c1 i
-The most exotic ones (could be very slooooow :-(
5 B( k; F2 E& g   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / O% h  m, b" k0 \4 q. s
     ;will break 3 times :-(
" s& x/ i* |' l
8 l% ?( R) T  ~$ M9 f& I2 J-or (a bit) faster: : K& J, S, p/ a7 Y) ?3 u/ U
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 s! l0 v0 R7 a; @/ _
) z' A* p/ `  C) A   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
+ F2 I' [) s! c5 m     ;will break 3 times :-(2 d* t& ^) C/ N5 y
, T& l; a& ~& y0 x2 f: _
-Much faster:) ?! K0 o+ d" I9 y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
) j6 x  }; {2 j( J0 ~# K- @6 q$ L1 U
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
! r# q9 m9 R: ]6 x5 a0 s1 Y8 Dfunction to do the same job:
& r+ y- z  L0 _9 e- t3 R2 X  A# p. M9 x+ E3 j0 }
   push    00                        ; OF_READ5 N9 D, U  ]; E1 U$ n9 ?8 m8 {
   mov     eax,[00656634]            ; '\\.\SICE',0
$ y7 |6 o, T- e; B8 T   push    eax
4 T& [7 T- X& S9 [! R* T   call    KERNEL32!_lopen) b5 N$ k  y5 I0 P' _7 z
   inc     eax# R8 S  X3 Y) s2 X
   jnz     00650589                  ; detected
: g" }/ W# q- c; j( S! H9 y   push    00                        ; OF_READ& A& S9 z, O% L" T; |# ^: B( @
   mov     eax,[00656638]            ; '\\.\SICE'; @+ y7 U# [" Z+ G0 b/ O. d
   push    eax) B8 }& m- |. [2 G; \
   call    KERNEL32!_lopen
' ?4 \; Z6 @0 @   inc     eax
! g! ^' o# a7 Y   jz      006505ae                  ; not detected# m/ {8 x5 e" k  A5 g
& [1 r  l7 @5 d) b4 c, S. f6 y

/ l) q" P7 h% g& E5 y# i8 X; I0 y__________________________________________________________________________
/ O" n* t  N4 ^  Z4 V2 x' d$ y: m! U4 d
Method 12
: T8 N5 X0 n# p& K" K: H=========
! c% N7 H: H* @8 _0 ?. L% I2 Y7 S1 J* b
This trick is similar to int41h/4fh Debugger installation check (code 05
; b5 j& T  C0 s$ a5 D- t8 e; C&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ H4 |$ A0 O: }; f$ F% jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.. k; l" C9 A/ V

; k/ G9 @* {8 p8 b4 e3 Z$ K0 k0 `   push  0000004fh         ; function 4fh
( `4 v' d* ^6 Z' D. Y! R   push  002a002ah         ; high word specifies which VxD (VWIN32): `2 P) i+ w; B. m6 ?
                           ; low word specifies which service
* l* i  U6 t/ y( m7 G4 h                             (VWIN32_Int41Dispatch)
0 S+ C  |. ]* f* \   call  Kernel32!ORD_001  ; VxdCall' _; B# U  \/ W, t  h/ C
   cmp   ax, 0f386h        ; magic number returned by system debuggers: r. t9 u0 @! \* n7 B
   jz    SoftICE_detected
: X4 F. `/ o% x9 w
3 R; s# x) i+ L0 `2 U$ [Here again, several ways to detect it:  ]# x, Z0 s' A2 w' }

+ D1 Q: M7 y4 `% _' k1 J    BPINT 41 if ax==4f  w2 Z6 v% q' r

# O4 B6 D& e0 r. }8 ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 t; I1 x* G6 ^+ ~
6 M) p. N) b  _2 @) ], q5 p5 F
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: n: a0 _$ V  X5 l, j& A3 g8 I3 }8 u. V' S7 @* b% U  ?4 T  E0 i" l
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!" l) i& d) V$ m! k9 }# o
% ^) q8 ?4 i) i# V$ R% n4 A
__________________________________________________________________________6 l1 M1 W% D1 h7 C$ D

* @' V2 x" V2 N1 V, {, jMethod 13
5 [# K5 E/ B- h=========9 u( ?+ i  Z4 c$ G# w

5 p, X% K- O- X' KNot a real method of detection, but a good way to know if SoftICE is" P1 @6 `9 i' c" p' b  Z: ^
installed on a computer and to locate its installation directory.) P* [0 x4 C2 R9 G. |
It is used by few softs which access the following registry keys (usually #2) :
, B8 P% H( m* J, K7 R( {/ Q4 t$ v* U$ _; U' C9 E0 R- s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& _) T4 |8 Q2 Z5 ]" e
\Uninstall\SoftICE. E6 m0 G( {' l) h
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- n3 y& ?- x  T' d5 W-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* s5 t* f. T3 O" C
\App Paths\Loader32.Exe& ~$ m2 @) ?% `( e

" E. P2 Z0 z/ D' I" T4 [' J! S
Note that some nasty apps could then erase all files from SoftICE directory
2 G+ d# N! U; d(I faced that once :-(
/ ]4 n" l* C+ w: I. W5 p0 B6 ~0 i5 Q! u$ o* b
Useful breakpoint to detect it:+ G7 P& F, e" e0 j
! s1 \; t4 T' r9 f8 c! h) `7 ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" G. `$ N: p) I! y# l1 l' ]
3 v9 x! B8 F: c0 Z8 F__________________________________________________________________________
6 n/ U5 L/ E, g3 I- n0 }, i3 q2 n% p2 `7 x6 _
  e7 l% z6 I3 Y- B1 J
Method 14
9 O% x7 P' h, i$ F. F( l=========3 C' Q0 h1 n- l1 R" ~
8 U# f* T2 I! u' V# c
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! z1 _6 k- u  F6 e) _
is to determines whether a debugger is running on your system (ring0 only).0 ]; k2 q2 [1 m/ D/ C* E) n8 W

5 c1 a8 \7 I/ D# x   VMMCall Test_Debug_Installed& g3 |4 I8 ~8 u1 I6 y; R
   je      not_installed: J+ |7 _8 E2 u. x4 e

5 I: R; q  p& `. f, S) r( `This service just checks a flag.* E9 ?. H2 m0 g* x4 U- ^- V& f
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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