About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 d; [0 b% A0 m3 u<TBODY>
" }' L8 }% l' m: i<TR>
% S9 c: @9 @4 b' j# ^<TD><PRE>Method 01 + P6 h+ f. A; H& U8 X
=========0 [! U" ^0 h- g8 q& f* h

' i  W, Y- n+ _This method of detection of SoftICE (as well as the following one) is; }+ @: M6 `/ ]8 L2 [+ q
used by the majority of packers/encryptors found on Internet.
, ?6 a0 k% |2 N7 ?It seeks the signature of BoundsChecker in SoftICE
3 Q9 M' p, @, p, k+ k( h5 X
2 T4 E0 n( R/ N3 @, G6 l! g    mov     ebp, 04243484Bh        ; 'BCHK'
: q( U0 Q1 d9 b2 |; s6 ?  \( d    mov     ax, 04h
  w' C; ^$ e+ B$ {" m4 G4 x    int     3       0 F9 R9 v2 O6 Q- n+ k( ~0 W
    cmp     al,4- T" A1 {: h0 I
    jnz     SoftICE_Detected; k& }7 w7 J1 r# E% z8 c

' F4 @! b( Q% a___________________________________________________________________________
- z) V$ Z+ ?7 X% O8 u& b  @  t; {' m1 ^8 X9 t
Method 02
6 G# d* M$ T- q4 {9 B: e2 L, c2 K  q=========2 L- X& o) `) F" s( \6 z' ^0 P1 E
- G$ g1 e4 q* u* s9 k. j
Still a method very much used (perhaps the most frequent one).  It is used; u! A, V+ y) e; b5 u2 {$ o8 ~
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,( h; |' C7 v% t* c6 g
or execute SoftICE commands...
. x7 i* [% c5 U! K$ yIt is also used to crash SoftICE and to force it to execute any commands
, Y4 L: W% E: y/ @, b* m3 P9 y- A(HBOOT...) :-((  ' W4 N) V  B0 x1 u
. h3 p, D% W* K- _9 `
Here is a quick description:
" c7 t+ h* P6 E* \* H3 m-AX = 0910h   (Display string in SIce windows)2 b( q" l0 E. E8 E6 A
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 {0 R- ^6 e9 b-AX = 0912h   (Get breakpoint infos)
8 h5 O# K  j3 F) \" c/ n-AX = 0913h   (Set Sice breakpoints)
7 ~( R* b& W% R% b-AX = 0914h   (Remove SIce breakoints)+ I  ?; S7 W5 ~  f8 t
5 I2 Z" c% n+ C8 h4 M. L
Each time you'll meet this trick, you'll see:
; N* u$ k# C4 K1 j* }1 [-SI = 4647h: d! a3 V# Y* I$ Y! \
-DI = 4A4Dh
- u- V0 q9 h$ m2 B9 V/ lWhich are the 'magic values' used by SoftIce.
9 ^" q3 ~" x6 M$ e1 M0 Z! qFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.: s2 v6 C5 |- a
$ k* I) D8 S5 G
Here is one example from the file "Haspinst.exe" which is the dongle HASP: h0 B6 x6 w  j/ R; q/ L+ p
Envelope utility use to protect DOS applications:
  G7 o+ A- |: @% L% A
8 t: j4 j: x1 n2 B% k8 h
( ~0 V" D% U" r4 z" t! W4C19:0095   MOV    AX,0911  ; execute command.) j( j$ g* z, d7 R8 M0 H6 b
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% R; x" p) V! O! A
4C19:009A   MOV    SI,4647  ; 1st magic value.' @+ q" k/ P/ Z' X$ F
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.& [6 ]4 X7 f, N4 H1 ^, A2 r) v
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 P; }7 z* H* X/ `. v3 f4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ m- s" f# n5 a! |4C19:00A4   INC    CX
! m3 M9 i/ O# ], x# p2 u( o8 J% G4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 N7 u+ |( F7 P" F0 ]4C19:00A8   JB     0095     ; 6 different commands.
# A  r/ a# R# o- I) t4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# e- u+ S) h8 J5 u4 L3 G
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 ]- e& H7 X2 j. f2 e- `) q
! Y! I; b! [/ @9 h$ m% o! o5 M
The program will execute 6 different SIce commands located at ds:dx, which% o3 m, ^. `0 J+ x! F
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( s" t% K# c: I0 E' |
' ]! a$ D" ^5 l1 K0 W( r9 S* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ i% E' G. Y6 s/ \$ }/ w5 z( D
___________________________________________________________________________
9 G8 m1 d+ C6 u  e1 w. b6 y" {( [: d; E3 x
% f7 _( S4 B7 J2 Y; n
Method 031 M. Y- A1 |, V8 Z7 ?" [. l
=========# z# |1 E/ T) I* ~4 w

7 \5 A0 Q1 c. ~$ q$ T+ yLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 M! A( L3 x  u; ?(API Get entry point)/ s% J' Z2 N) b. n- E- K+ m
        
- G: U* c! A" K5 h4 z/ C
- {  P8 K3 u5 `/ R# G. Z    xor     di,di2 l5 n6 V. Y. \& D3 R7 w2 w
    mov     es,di- Q/ U( F, _6 c  l0 a: V
    mov     ax, 1684h      
: Z4 G. M! \. Z' C* _. e    mov     bx, 0202h       ; VxD ID of winice
. V' k6 U/ p1 \! s3 e* \' b$ u    int     2Fh0 [" T  q6 k7 X' R: G. z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: L* i, V7 _1 y    add     ax, di* s, |- n2 Y: Q. T
    test    ax,ax
- E8 r- d- `% S& Z7 Z) B* A& T! O    jnz     SoftICE_Detected, J" d5 b( G% l
9 q) ~3 P9 D  O( B6 p
___________________________________________________________________________; R1 ^* |) [$ [3 u
; F+ U# b7 \/ {; l# E" A  z
Method 04
3 a% v! L$ k* L5 c=========
, y; ?! f' e1 v& ~/ A" K6 {9 `0 o& l) [# B7 S7 b
Method identical to the preceding one except that it seeks the ID of SoftICE9 _, X0 h' I8 Z/ C# F3 ?0 {
GFX VxD.. ]+ e; [- C* u$ g6 K  |) i2 Q
! K+ ?, {2 S' w
    xor     di,di
1 U2 e; o0 M2 K& `- w! I8 h    mov     es,di) j+ z. Q/ A  Q
    mov     ax, 1684h       8 v: J! g5 R! w1 q: y
    mov     bx, 7a5Fh       ; VxD ID of SIWVID& V* u+ O& S4 l3 \& X
    int     2fh" o0 O% p4 _# ?% y' R6 M+ Y' P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* A" u. J3 }% m1 |    add     ax, di( h* l: _: I/ m1 v+ t% E
    test    ax,ax, T& u, h' K7 }. [: Q  K. u. C& R  c
    jnz     SoftICE_Detected' D8 @# N! ]8 s

9 f+ d5 z( a5 ^% N$ @* o2 |__________________________________________________________________________  O) j- ]. a8 y1 t8 Z

) J% V0 y4 t! p8 p0 y
; I, {: ]& F0 }1 ~Method 05  t6 S3 A( `1 R& |) o' \
=========% J+ i! V' G2 @4 e2 b, }1 {/ j

3 N& Q2 q& i4 q" ?/ c% f7 N% I" @Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ g! W& V7 {1 \3 Cdebugger. It calls the int 41h, function 4Fh.
) Q  p2 w+ Y* k, s! g" K" h5 O1 ~& tThere are several alternatives.  
5 y* ~, z1 [6 @( {% K% V. D
1 B* ~. h( Z* YThe following one is the simplest:
5 D; c3 }& k  D: j) s
1 G! u% L6 `5 f/ z; [    mov     ax,4fh$ H4 ^) ]8 s; `$ q1 b; z' E
    int     41h8 p' g+ p% ~3 i' g& s% L; i* f
    cmp     ax, 0F386
0 P  ?# M) F8 b' l+ \    jz      SoftICE_detected/ ]& a: T0 H0 G! @( p0 r6 M# `/ w1 J
" Z5 L  R/ a  ~! d9 i
+ p8 K0 @; ?! N$ I4 G! {5 |" V
Next method as well as the following one are 2 examples from Stone's
. F; t* T% ~" Z"stn-wid.zip" (www.cracking.net):
  L0 z+ n+ j3 {$ D$ E
% A; {8 V) H* Z4 O7 V    mov     bx, cs
) h; B3 n9 o' C    lea     dx, int41handler2
' ?9 l* }& {  P) ^  U, n    xchg    dx, es:[41h*4]
: H& O4 g8 L( a; [1 X0 T$ U- Y1 z    xchg    bx, es:[41h*4+2]
' y5 T* J7 J" r3 g" K    mov     ax,4fh8 p# y. C% k; b: n- D
    int     41h
, \" o! F; f  \9 P4 ^    xchg    dx, es:[41h*4]0 J6 S' ~+ @7 B
    xchg    bx, es:[41h*4+2]. U; _6 M# C# O
    cmp     ax, 0f386h+ f- X7 p! p+ b* s- J7 M! f
    jz      SoftICE_detected
- Y& y# ^: X6 ?5 |3 D* x0 N! R4 b6 R/ A# s) }6 ]& }
int41handler2 PROC
! T2 }& a( ]) r    iret& K' `9 b, o# p
int41handler2 ENDP
2 b& p  _# d) c( N: p6 C) |
3 \5 Z/ W9 |1 A- R- I% E& \4 s) `" h& c$ _7 P9 q/ D6 u
_________________________________________________________________________
& s) `* j- n1 B. X& K
- f- S1 ^8 f9 H0 K6 ]2 u5 ]) g3 D" N# D2 Y
Method 06# k) t& Z* M1 C1 L' r3 F
=========
5 {; d* q1 j  H- V' t# v! r! M4 x" m! D8 G: I, J" H% }5 S

5 I( R  P! S# Z; D2nd method similar to the preceding one but more difficult to detect:
; s: q) s- h+ w5 N& A( U% ~2 O) p/ j: L+ r+ [

0 C  f- @, J0 m! N4 ]! kint41handler PROC, f6 i. x/ C( x; i6 h
    mov     cl,al
7 U$ J$ R0 u7 [* S6 V& }& G    iret/ ~( r' v( e6 E- r
int41handler ENDP- [8 K8 x. ?4 Q

% O& K! t3 G! a# N; c+ C& W9 J2 N) b$ B* \
    xor     ax,ax# k# i6 z- H# c: G1 d) Y
    mov     es,ax
6 T) I+ {6 N0 ^8 i$ O$ P# B7 J    mov     bx, cs4 T3 ^$ d1 l& n) s) A
    lea     dx, int41handler
. d' N2 @# x& R0 y/ F2 l2 y    xchg    dx, es:[41h*4]
7 Q0 k2 {  O: I! K9 |    xchg    bx, es:[41h*4+2]
* x. a1 `4 q( o    in      al, 40h0 A& c  I1 ^, s! A& c) t2 b
    xor     cx,cx
  t4 s( b" `' j3 Q1 _* N    int     41h8 q4 Z) [3 a+ C9 d  V' a
    xchg    dx, es:[41h*4]
6 K* N7 K2 Z: q) e, j! P# D8 K    xchg    bx, es:[41h*4+2]
  F* j9 r$ {# T8 j' K    cmp     cl,al8 k, ^+ Z+ k0 q, F
    jnz     SoftICE_detected) g) u5 E2 P$ M/ l

# Z; z$ \! K4 J3 _6 P* p: _/ k) Y_________________________________________________________________________7 _* T, p! s' k0 c

' ^; V8 c# [7 o" w4 aMethod 07
* e6 c' q$ {9 \  \=========$ o9 H1 O% {- X

7 O( ?1 N# `& y$ a7 ~) N" n9 B* E* hMethod of detection of the WinICE handler in the int68h (V86)
8 W8 v& o# e) @8 N6 c" ]" s" @3 b7 c9 Y) g7 g- D+ D
    mov     ah,43h
2 ]. ?- a7 m% n3 I9 K, O* b    int     68h2 k6 W( \+ ?% _& l1 J$ k* ~% e
    cmp     ax,0F386h8 r# V0 u" Q: T% L5 n* K
    jz      SoftICE_Detected+ s; F+ [! f' I! H2 X

# H7 L3 X! f, A6 N: W# A
0 ^/ j5 o1 v+ A" Q/ q9 D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
+ \' v* Y1 t) ^' `( I) @7 u$ K   app like this:
: i8 M# K0 F* G' u3 y* U( ]4 J* }. G0 l% |  _
   BPX exec_int if ax==68! |: T, d7 U2 S
   (function called is located at byte ptr [ebp+1Dh] and client eip is# s4 T  b  ^+ E, m5 c
   located at [ebp+48h] for 32Bit apps)& t9 o% f! ]; d: `, `
__________________________________________________________________________
, Z9 o- I. k9 }1 @* Q
) O9 B; d# d  s) D
6 ^* ~9 F& W- V2 z8 H! CMethod 08/ ~3 S# B: ~. Y0 a' @. m
=========' x* [' K3 A% x0 ~+ H+ R

3 E( v4 s; @) y' Y* }! dIt is not a method of detection of SoftICE but a possibility to crash the
0 {1 {  z$ y$ m0 X' Qsystem by intercepting int 01h and int 03h and redirecting them to another
7 h) `) ~8 n5 _+ groutine.& {( C. p6 t8 S  s+ N5 }+ n5 C, a
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ z; a& e/ ]0 qto the new routine to execute (hangs computer...)
1 M+ |: @# S2 ~% w7 p7 }4 |  {
) [+ X' E1 |9 K8 W    mov     ah, 25h
, P7 }% N6 s7 h( A5 c- j& C    mov     al, Int_Number (01h or 03h)* N$ ^2 _, j$ ~
    mov     dx, offset New_Int_Routine9 W. `# _/ i4 }
    int     21h
( W2 R# {: P7 K1 h' T5 s! W1 w- z9 x* K& j
__________________________________________________________________________
' M& B3 z+ v) k3 q
! E" k( ]1 z- ^Method 099 C  Y7 q: p& Q% i% r
=========
. L1 y& g8 j  v6 M" X3 V" w+ p' D+ v- w- i! q+ k2 @* k, {
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: c. w) {' X1 r; H* c
performed in ring0 (VxD or a ring3 app using the VxdCall).
. \% I, v. d. F' r' S  GThe Get_DDB service is used to determine whether or not a VxD is installed
% x; r1 ^6 X( Hfor the specified device and returns a Device Description Block (in ecx) for
$ ?* g& w7 u. ]& W9 j: u6 @that device if it is installed.
1 {7 g+ E4 W6 |% M4 \% S6 ?. E% C9 ?2 r& ^
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  Y! A, \" P) [5 C1 Z1 N! k   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 a) s4 ]6 @9 m) E  N
   VMMCall Get_DDB
. O! a9 M5 S) x7 ?. X" _- y6 V8 v   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! A2 ]' \' U* z6 n1 C0 }; Y, X
Note as well that you can easily detect this method with SoftICE:
  b/ C! F  K, J) r   bpx Get_DDB if ax==0202 || ax==7a5fh
. a( ]: k3 F# o# D( V+ a
2 T$ s% G4 a$ I# Y) `__________________________________________________________________________7 a: q9 E# e7 _% k2 Q

( A4 R5 P+ V1 g' y+ m3 t. xMethod 10
! t" h+ y: O9 i3 D- g0 _- V=========
( L7 J8 y5 ?6 A: M: G
3 \' ^1 ?3 I  x6 l=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) Y% m8 Q/ N7 S. A1 s& Q
  SoftICE while the option is enable!!
0 b. W& D6 X  }0 R( K; J- P2 f
This trick is very efficient:
# N9 n, }4 {* ^4 x4 ~- Dby checking the Debug Registers, you can detect if SoftICE is loaded7 y1 U! G6 U1 |! _0 Q, z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& Z8 y# L+ h; A2 r1 {there are some memory breakpoints set (dr0 to dr3) simply by reading their4 H, T* O8 G; V; j& U: ~- u2 N" X; Z1 [+ g
value (in ring0 only). Values can be manipulated and or changed as well  D9 E: y, G% _! }! }
(clearing BPMs for instance)$ q7 K* I9 ^' ~+ x1 o! u" o: w3 n
% T* j+ a4 N5 f+ Q8 {4 a- ^
__________________________________________________________________________
' {: A! o  B7 x; }+ c! E8 I7 K( }6 ~
$ G0 S6 J2 @5 o  w/ IMethod 11, D; H4 e( f1 c# U" z& u
=========
$ k. X  B4 H6 P, ~5 c, l, a6 z) M' K+ ?% G* E. M' }7 n+ ?1 C
This method is most known as 'MeltICE' because it has been freely distributed$ ^+ U* m" w/ R# i( d
via www.winfiles.com. However it was first used by NuMega people to allow. z, }) t7 |' X$ I  H  b
Symbol Loader to check if SoftICE was active or not (the code is located
1 y& `& t$ ~" S( Q! g1 zinside nmtrans.dll).  R8 o1 [$ N& I5 G- n7 ~! u, e
5 J# v4 \2 }1 @( H' x
The way it works is very simple:
) b/ G# K- K2 g+ O+ K% fIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ u0 V* ~0 e8 _/ M* \
WinNT) with the CreateFileA API.
4 E; z" r9 `" ]+ Z9 p; |6 _+ G) J8 e4 J
Here is a sample (checking for 'SICE'):
2 q. ?" |0 \& C* s2 D7 j
5 y  k) m( E3 r2 G* ~" q8 i5 u, TBOOL IsSoftIce95Loaded()( j# k  h3 W4 G0 F) A! O  W
{
$ k0 H) H- G/ t   HANDLE hFile;  9 f' S: q. p' |; K
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 C1 C0 Q- q! S% b9 B2 [5 m& Q, C                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 F! N0 M9 z5 Q+ _: A- B6 V8 F
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);5 B% |& T; L: c
   if( hFile != INVALID_HANDLE_VALUE )1 Y# J! g- B1 s
   {
. w' z- }' G; x3 L4 g4 z7 O      CloseHandle(hFile);
8 |! f' F$ O& @, Y+ U5 D9 y      return TRUE;
* `" w) }3 X" _7 i1 a; l   }
. b- H2 P# T: }8 Q   return FALSE;
8 h1 V; y2 W" ?3 c. t}
0 O, T/ ]# R7 ~" y& i8 N0 A' B0 {( |! E8 o1 k% f
Although this trick calls the CreateFileA function, don't even expect to be' n2 `6 ^* o' M
able to intercept it by installing a IFS hook: it will not work, no way!
4 k( E! ~7 I3 `& jIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
$ o! o: n8 ]' j5 U5 mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% T! H+ b# R, ^+ U5 A
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ y" N" k- s& H+ P1 I0 S) p
field.0 i- Y# C7 x1 N0 A  x
In fact, its purpose is not to load/unload VxDs but only to send a
" a5 [/ O9 M8 C" UW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
  S  N" F3 A$ R3 j. t; Qto the VxD Control_Dispatch proc (how the hell a shareware soft could try, ?4 B! e5 j) @$ e7 T
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ w4 M1 D5 `8 D! Y1 d$ h" _If the VxD is loaded, it will always clear eax and the Carry flag to allow
) k+ N% P. {9 F# D2 r( |its handle to be opened and then, will be detected.
9 u, o1 f: O; Q) w9 H& X) qYou can check that simply by hooking Winice.exe control proc entry point! k' j9 c8 x' s, N" ^$ K
while running MeltICE.
6 Y' {  |) ^8 a4 [
  d' H1 k9 L! C; j6 w$ f5 t  p
3 {5 H2 ?8 W' X  00401067:  push      00402025    ; \\.\SICE) F8 k' e5 r# p5 u
  0040106C:  call      CreateFileA
, P' ]5 u1 Q, h% k  00401071:  cmp       eax,-0010 |" M' x& ?4 W  F' r
  00401074:  je        00401091+ Y- ]# R: D0 {8 F( y5 n

* z6 I( e- p3 K* B7 _- w$ h1 E; X* e$ ^2 H" q" l- C# I) v
There could be hundreds of BPX you could use to detect this trick.
# D* b! u* L4 |% P-The most classical one is:
, z6 E$ y& N7 U* G+ Y6 Z$ S1 T" t  a  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
( N8 n3 I' m6 z+ `" }9 A1 N$ N    *(esp-&gt;4+4)=='NTIC'2 i* e$ e1 O! O, s4 P3 z) {
4 Q8 e+ i: h4 q% L# Y) G
-The most exotic ones (could be very slooooow :-(
: A/ d; v% J  P" \! l6 f   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 F; O1 s* S% H! L     ;will break 3 times :-(% C6 G. ], ]0 ]. D. \
2 ?' _  X0 p3 b$ m' m1 v
-or (a bit) faster: 2 T6 E  p% C" U4 q% d
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, k. T, |  ~) q4 `# x5 n8 J9 Q+ a9 x. j% n; }
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( c9 q; }- Q  @, S% U0 Z     ;will break 3 times :-(
3 {+ H8 ]+ h+ F8 z! ?% u
: b( t# A9 l% `. c+ Z# z-Much faster:6 W$ `( A) q- @9 [( M% E! I" Y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ d0 K; T; s) q9 ?+ F" q

2 U7 k( j9 I5 ?Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ E* g, a3 T2 j" u9 nfunction to do the same job:
  T+ B1 k( c! q* y
- M) \. G/ M! M* [8 T: e   push    00                        ; OF_READ& Q, w, S, X+ W+ W5 K
   mov     eax,[00656634]            ; '\\.\SICE',0% H# ?. K7 O3 w6 D- l7 m% o! Y
   push    eax
2 y& t! H' D7 V: A   call    KERNEL32!_lopen
, D4 ?. Q4 n% i5 j0 L% n. `. I" j   inc     eax% G4 `/ k: x7 _  k6 I
   jnz     00650589                  ; detected
0 K8 l; D0 j; a; J0 _4 L( R   push    00                        ; OF_READ
  a, [* ]3 i9 @* A9 P2 @   mov     eax,[00656638]            ; '\\.\SICE'
3 L4 b# m" H# \; G: |9 E8 \   push    eax
  y: f4 M. J+ o) Q% ^, n) P( e   call    KERNEL32!_lopen
. ^' U/ S# ~, A  z" `   inc     eax5 @- @1 u0 i# Z& {# u
   jz      006505ae                  ; not detected
  m; N6 e2 }1 X$ z' I! |6 v. C$ Z$ |* b
4 H# p6 e8 N  B" F
__________________________________________________________________________
# V# u: S1 @/ w$ Y! g  _$ ]4 n$ A
Method 12& o0 j" i7 ?- a4 p2 {% p: g
=========) x; f! i3 P5 T3 M" R% p0 N! u

4 v/ ~* W4 O9 [0 d8 ]3 Y# W; lThis trick is similar to int41h/4fh Debugger installation check (code 05
7 D; [, |: R- M6 T. ^$ E&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 C$ n' d/ Z3 {. U' P; G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: C1 M% Y% E3 N, K9 O
& R9 }: Y! W( _# k  i9 r   push  0000004fh         ; function 4fh3 \4 k" |# n' r
   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 L" h9 o/ A" q% G; g! `0 s                           ; low word specifies which service* M: ]4 K4 @5 s9 |/ T+ h
                             (VWIN32_Int41Dispatch)
/ U2 R' P: e# P   call  Kernel32!ORD_001  ; VxdCall
: T5 [3 N, L0 ~" i" r   cmp   ax, 0f386h        ; magic number returned by system debuggers
  h) {, F( q9 S$ o$ f   jz    SoftICE_detected
; n  |  Y4 I( e9 X  Z+ M4 w8 g) ~- \# F( {
Here again, several ways to detect it:
& V: c: P$ |1 |! u" n
, a0 F7 E  v) L7 e0 M9 V    BPINT 41 if ax==4f+ n( S& S4 x& X4 r& L

5 ?9 m3 m. t  t    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' m% G( z3 O! O6 @; }5 R' j. G: c7 n/ f6 w; O- w% B
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ w8 N1 Q% L& y; Z
7 J" v( Q7 i( ^' S    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& `) N" U2 H' B; P
& f, c0 c  l; a% K' `! b* _
__________________________________________________________________________
, C5 C2 l% j/ U+ o2 B7 {
/ G. F3 z9 c  ]5 r% fMethod 13
6 g* h0 U! ^7 Q4 h6 o=========
! H7 e1 a# z; l# J( B2 Q2 \' a1 O2 X
Not a real method of detection, but a good way to know if SoftICE is+ }. h) {# L; z( o9 B; b' z% b
installed on a computer and to locate its installation directory.
$ h+ p; Q7 o: N( V8 SIt is used by few softs which access the following registry keys (usually #2) :
: [. S0 ^/ X( d/ g$ k0 M8 y& |3 X, h: p, J3 {& o- O- c
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 Q8 m! I( {# V( z
\Uninstall\SoftICE% B$ P, h6 i3 |: v
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( ]; l, s: h) K9 N
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ s* X; {2 L' j0 c( g0 B\App Paths\Loader32.Exe& U. {" h- a0 Z8 f2 L
$ N7 j( A  x) C$ X- Y: G

; W" `% R& j  kNote that some nasty apps could then erase all files from SoftICE directory
5 M5 s5 P+ q9 s/ w(I faced that once :-(: Q; j9 A! O9 y
4 l3 l0 e5 y5 q6 G! }+ w) i
Useful breakpoint to detect it:# _( X4 a5 C1 f7 c  ~2 m
' `- l) C5 T, e1 [5 O0 N0 ?
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 j  g0 P6 z: i& O. i
$ a6 r1 F: n+ P__________________________________________________________________________* Z& \) J9 C. l
: ]' X! |. ]5 ?- _+ r

# ~* p8 d8 l4 `7 o5 r& kMethod 14
8 m$ S, _0 V1 s; l  P7 C9 [; U=========
2 U" Y) a: B" b3 l: Y* C0 F3 _' g
. ]4 T% K- k9 j# ?: ~* f+ d* ^, hA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, }+ a1 f& k' z' f, g3 [2 Mis to determines whether a debugger is running on your system (ring0 only).4 T$ V, Y: x; X
; n& Z6 j8 l9 y% o& u& C" I  L
   VMMCall Test_Debug_Installed. z8 e* _& V" Y  T" W6 J  `2 t9 b
   je      not_installed
: p0 H5 T, h! T' Y, U, u+ U* q* S/ B. ]& h6 Y. b( B2 d5 K) L
This service just checks a flag.
$ J, R# e+ Y$ U1 _. J$ O</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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