About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: ^5 s( O( s0 z! {% _% y6 `
<TBODY>
2 I2 {8 H/ J8 S( w* f- L/ g- A<TR>; [) h; z& k4 v+ P% a0 K) A5 z
<TD><PRE>Method 01
' J% t% h7 b! n, n1 s6 c. a' D. H=========
. K& I( a8 g$ o3 D* S4 p* |! b4 J
, q8 L8 s( w& w/ k! fThis method of detection of SoftICE (as well as the following one) is4 J* N* E3 I( {; E& ?" C
used by the majority of packers/encryptors found on Internet.  p" [6 v; y7 W. U8 P9 x
It seeks the signature of BoundsChecker in SoftICE. {' I' R" O& ^: r
9 ]& D. Q  Y" N/ R
    mov     ebp, 04243484Bh        ; 'BCHK'
# S$ _4 m  e9 G! U4 Y: T    mov     ax, 04h( L8 j+ W" T: {6 k! @0 D& a
    int     3       6 k8 `% M% s8 q  h, U
    cmp     al,4
2 s0 E5 s0 l7 c    jnz     SoftICE_Detected+ [" e  Y& @, V  p3 h
( _' t; ?% O; q2 q6 U
___________________________________________________________________________
: o  h6 i3 k" C+ b8 y7 T& D' I* F  D* A2 h( k  Z/ O/ S8 o+ g9 g
Method 025 K+ |  c2 y  o
=========
( h. l/ R% d# ]6 ?) A# Z
- j' {/ g" h1 b; o* o4 TStill a method very much used (perhaps the most frequent one).  It is used: R/ Y2 K% A+ g$ I* r0 t& \$ k
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ J. e( f$ k; D6 y( J* lor execute SoftICE commands...
7 `/ O2 r. F7 Z1 m: @! DIt is also used to crash SoftICE and to force it to execute any commands0 J* Y% |! ^2 s- M9 n
(HBOOT...) :-((  
2 ?- }  P. ?6 w% g  c- m% ?9 X$ t: ~+ @$ u- _  P; C) B( W/ ~0 J
Here is a quick description:5 _3 B7 a' V# n$ L" o
-AX = 0910h   (Display string in SIce windows)9 G% H% h8 L& D: O8 W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! \& Y, `9 \9 q1 @/ Q
-AX = 0912h   (Get breakpoint infos), ^8 R( l; V1 a4 X; g; L
-AX = 0913h   (Set Sice breakpoints)
1 J3 _0 \% b/ S' Z' l5 l-AX = 0914h   (Remove SIce breakoints)
, _: a$ z! g  H5 X( F
& o" k$ }3 R9 {9 n3 WEach time you'll meet this trick, you'll see:; v7 G1 G7 |9 u: _# t* ^& f
-SI = 4647h- o( v+ p0 i0 ?+ v  M, m- V* w
-DI = 4A4Dh: o( s- d1 z- T
Which are the 'magic values' used by SoftIce./ o7 v9 B4 }0 G7 N4 y; X' a) T
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 i+ Z* _! u# c. ]  z3 W- P( X) z5 h; ]+ h$ m( I
Here is one example from the file "Haspinst.exe" which is the dongle HASP3 j( F0 F% s/ \& {
Envelope utility use to protect DOS applications:) D7 v1 T6 H8 O' ^( S

+ W; f! h$ A9 E! M+ |' P3 H
$ g0 \6 }4 ^4 h4C19:0095   MOV    AX,0911  ; execute command.
9 f" I* q6 H6 M. A+ f4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).& ~" z% @1 [0 x6 P+ L, n
4C19:009A   MOV    SI,4647  ; 1st magic value.) ?; f8 S, k3 a( z7 A( h/ g8 [
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 K8 h) m9 w2 i9 B5 P7 g' L" V
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
. R3 v' Q& |% `9 g- E3 P( G4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: v2 ?4 [/ l: t4 x2 T. t7 @
4C19:00A4   INC    CX$ I+ `2 H7 R$ y0 P& D
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 Y  o" R- {  z  V4C19:00A8   JB     0095     ; 6 different commands.- W: n6 w% f: c7 E
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 U$ T, [1 r0 ]4 |; }
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), @0 x* e7 D# ^" Q1 b
6 n+ `5 l3 g2 w& o
The program will execute 6 different SIce commands located at ds:dx, which, {9 |( ?  ?; X6 y. T3 f4 K; W" o8 }
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 V9 A" h9 D$ `9 Y3 o% O) f- W( ^
* s4 Z- n0 K. L7 y- ?1 I1 v* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, G- a  {# c* ~0 P/ G# {___________________________________________________________________________
& L1 I$ D) c/ V" d, |" T) ?0 \7 d: k
& K9 u; j4 w0 k
Method 031 J7 Y6 ?: L% B4 d
=========4 ^- Y1 ?2 i/ [
3 F8 u' D& z8 I9 l' d0 a# |/ e
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
- i& r7 R: L" i(API Get entry point)1 l+ k1 r* }( p7 _
        
- e" a) [" Q( m9 e7 O/ l6 z, t6 z; w/ Z: }/ Z' j/ c
    xor     di,di& c/ {9 W) U& B1 W( l
    mov     es,di
6 E. x! L1 q* c2 x* n* s    mov     ax, 1684h      
8 M) b! b1 l. N0 c' }8 D/ C' W    mov     bx, 0202h       ; VxD ID of winice  k+ ^/ F7 ~* v3 h& I/ ^2 p
    int     2Fh& @' j8 e* j6 B& |
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ Y) H1 o) I1 U. O% p7 a    add     ax, di
) V1 x" C1 k6 W1 o% [3 e/ {* P    test    ax,ax
$ D9 D, G  u- K1 |6 f' G2 T% D; Y    jnz     SoftICE_Detected& i% ^  m7 b# H0 k
* ~- v1 s, q$ G3 @% H
___________________________________________________________________________& T7 ]5 p& d# f
8 q4 x. f3 @4 M5 W) n# ^9 F
Method 04
! h) E+ M# b$ [: F: l: x=========
/ C$ {1 t* r, s3 r: C* B
& l. |9 T4 ^( m+ C! zMethod identical to the preceding one except that it seeks the ID of SoftICE
" W) O2 m! n5 C" _  q! ~GFX VxD.
; @2 l' S* w0 A1 J3 x+ x4 n% M) H! c+ }
    xor     di,di
& Q, x& o1 H( F; @% l: H$ T1 V8 f    mov     es,di
( X+ p, Y3 K- R% I$ ~+ C    mov     ax, 1684h       * E- w  @; W; X" {& i4 p) V
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
- c0 |8 d% T+ F3 I! C' _6 |7 C    int     2fh
8 d- v& t3 d9 k6 u5 Q5 R    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 ^3 {6 L; r0 o. C# B    add     ax, di
  Z- q. F( a: X9 G    test    ax,ax
$ |, t6 N  {& z7 {& b. \    jnz     SoftICE_Detected
5 x; Z8 p3 D. E
$ y0 u% L& z: k0 I__________________________________________________________________________
; H: k5 [! N+ H( B/ B5 E6 q; E$ G1 N9 Q# `$ E& g8 q+ ~

7 T; V- ?* p6 Z5 J( d4 XMethod 05
9 F1 T6 v: b: g* j$ @- f0 T$ s# {2 R=========
% P* |% {2 e; e
. y. T/ }; C1 {' T; aMethod seeking the 'magic number' 0F386h returned (in ax) by all system
3 N# H& W/ X# U  H" S7 i9 idebugger. It calls the int 41h, function 4Fh.+ m/ g% M2 \4 m) [. K3 q
There are several alternatives.  
5 K: r! s' Z! d: Z# w8 O+ r
" G, I3 c. H' Y. v9 K# P) IThe following one is the simplest:
6 J# b' z5 i9 z8 ~) J4 {' {% d* l3 n* F& b
    mov     ax,4fh* {: A& b, ^* ?" A* x! E
    int     41h
) P" @7 q, L* B3 H/ i    cmp     ax, 0F386
9 x/ f' `/ F- v1 C' A3 Y% o" ^" T    jz      SoftICE_detected
/ \% T0 l$ K8 x8 L# S' |7 {& B
! O/ Q  b2 E2 ^) a* J/ A
) [$ u, Q/ R5 G& i$ E; ENext method as well as the following one are 2 examples from Stone's
$ ?+ r, w% o# E! t8 B"stn-wid.zip" (www.cracking.net):
( v6 i0 E0 t$ G- u8 ]( F3 K& L3 u0 `% S; v0 r2 F9 y
    mov     bx, cs, W; }* g- n: T7 l
    lea     dx, int41handler2
+ V# N$ t2 X- }. }  q) H/ U: m: M) h    xchg    dx, es:[41h*4]
$ p7 ]& m7 ~- M) m5 m& ?    xchg    bx, es:[41h*4+2]
' Y1 z3 A7 M1 N( ~  o    mov     ax,4fh
9 k$ z2 U& K- e# g    int     41h9 g5 @% }6 g. u
    xchg    dx, es:[41h*4]
' B* V1 {. N* O* D" P    xchg    bx, es:[41h*4+2]# x5 E8 n& ]0 k# ]- _0 ]# P( k% l
    cmp     ax, 0f386h2 I4 L5 _" {* l" I4 H% `# a  C4 D
    jz      SoftICE_detected
% c" S  J" D1 G. A/ b0 y
7 ?4 D. e' e. y6 g& l6 R# z- iint41handler2 PROC
6 Z1 ~2 \7 C1 M0 U0 g& q    iret
1 P2 J* O- |# j( sint41handler2 ENDP3 a7 T; |; W8 ]7 \# F+ K0 Z0 ^( a/ z

' u* T' k. ?& p; }
1 S4 |/ y  B0 @1 b) k( R_________________________________________________________________________
  c" t8 ~+ @/ ~$ \5 `1 Z9 A8 M4 S6 H! K% G" H$ O$ v" H
# s% z* a. D3 I  @* p. ]
Method 06
7 N8 k! b4 ?7 I" {=========
1 j0 |1 D+ t+ o& T3 K: G6 v0 ?0 v2 a1 \: H$ C
/ E7 p8 x& O1 \. P
2nd method similar to the preceding one but more difficult to detect:
# ~: z5 X# S6 J/ r" y* M1 i9 J/ Y: B
5 N5 P% {" V) @$ K/ E# p% X8 t" K! m1 t4 n5 Q9 M/ @) T" ~
int41handler PROC7 D* ~1 T# T: f4 V3 s/ [/ z
    mov     cl,al! X1 p: B6 P" R4 a
    iret
; G3 S4 q! S1 s& `; oint41handler ENDP
6 a4 P* O$ J+ K# s9 T# I) Y
0 d; Z9 f3 M' c" Y! ]% O$ m) e# |0 k
    xor     ax,ax! W9 n3 ^0 e4 C* [. P7 B+ m! ^2 p
    mov     es,ax
& x3 L0 P( \1 v8 _8 w    mov     bx, cs& _& z/ [9 G0 p& I3 w- F7 Q
    lea     dx, int41handler. |, C0 Y9 x. N6 W9 f1 f
    xchg    dx, es:[41h*4]
3 F0 s4 w: c+ U4 w/ J9 O' H    xchg    bx, es:[41h*4+2]4 _& k. \9 P/ D
    in      al, 40h2 ~8 E8 a7 S; ]3 ]
    xor     cx,cx
( `* \% V. c. r2 @  B2 D0 K    int     41h2 V4 n1 j' k- x' L# W
    xchg    dx, es:[41h*4]$ g6 d5 P8 s2 q/ I$ h  z- b3 k9 Y
    xchg    bx, es:[41h*4+2]
+ \7 ]$ y6 r% Q+ n% @    cmp     cl,al
3 v1 X2 o8 k1 t% J$ I  u2 D    jnz     SoftICE_detected9 x# O) j8 P8 Z4 x9 X$ I, B
$ s9 n" ~9 d8 V& ~3 K. @
_________________________________________________________________________0 I, h" Q- L5 G7 K" ~

5 H# T9 g) m4 A+ G7 XMethod 07
# _3 a1 @0 U. p! J; D, m=========
8 r6 y: Y. S& [: D0 Y0 O2 P
3 n' C3 v* y4 n/ X! LMethod of detection of the WinICE handler in the int68h (V86)% ~: |# d! X' a0 r; ?2 z
5 ~% b) e4 {: l1 _8 ]9 b
    mov     ah,43h
8 H9 m/ j! I2 L6 I, l    int     68h5 T' M1 X' T+ f0 H9 A
    cmp     ax,0F386h5 ]( L7 H; \1 D/ ]+ i' `
    jz      SoftICE_Detected
% X/ L  j1 Z1 `  a" C
. B* D; @  x3 n& E5 a
: D# w; \/ Z. D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 k. B! F+ i2 D   app like this:
! k- ?' O& o; G0 C/ B% S9 v
5 {% [3 F8 H, s# _- Y7 P4 B   BPX exec_int if ax==686 L3 A7 @4 I+ [5 G( s8 L8 i0 A
   (function called is located at byte ptr [ebp+1Dh] and client eip is
. Y- ^2 H6 ?' O" Z& x+ B7 j% z0 k4 E   located at [ebp+48h] for 32Bit apps)
' W8 y3 n# l: L# B2 d__________________________________________________________________________9 I( }; E' p, q$ P; g
, }. ~) \7 F/ Q. h/ c

: U& l5 ^# x4 ?! Z" XMethod 08
7 g8 p6 l. a+ v3 q=========
& j( _$ u' t8 G' G9 c- {' ~! D  R: |) A7 O7 S& S
It is not a method of detection of SoftICE but a possibility to crash the
8 L) L, L$ X. H% [, T9 R8 h/ D$ Ysystem by intercepting int 01h and int 03h and redirecting them to another6 t6 l+ ]* T, Q; B
routine.
2 `4 L9 h# P, `& ^) m) h$ ]It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
# P) B' m" b3 \- [. b# E. ]0 Ato the new routine to execute (hangs computer...)" X) l+ q9 }& _& x

# W9 x* _9 Y. j( U' _8 {6 \    mov     ah, 25h
( `, C6 [  U- ?; i/ V( D! L& c- w    mov     al, Int_Number (01h or 03h)' T- J6 X" |1 s  M  H
    mov     dx, offset New_Int_Routine, m: N( B* ^1 V* r. A' u) Y0 m
    int     21h
% t) o/ {, t8 l1 K" O0 a; G. l
2 ]) ~0 f' K0 {, H( t6 q" B: w" M__________________________________________________________________________
9 O. {- o% m6 ]8 y* J& M  J
2 U9 j: R/ d# y: h7 x7 rMethod 09$ e& F2 O1 Q4 d  L5 [
=========  d3 r' R/ [" X! @' g2 g0 N" c
" S' {3 k  _$ J
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ r# V3 L' e3 _* hperformed in ring0 (VxD or a ring3 app using the VxdCall).
  C* J, ]( d! m  o4 ?- GThe Get_DDB service is used to determine whether or not a VxD is installed# o2 K8 F- b4 w& |/ w0 j& z0 e% |
for the specified device and returns a Device Description Block (in ecx) for
  M" J/ e; P# N4 O  @. M) k9 n( tthat device if it is installed.# c5 }! B$ x; Z) d4 @

: a" V3 Z$ h- O% V  X   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID  L# `0 V  V! L+ t
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" T7 k+ x) J4 a
   VMMCall Get_DDB2 v) G' B6 `% F9 C9 c
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 q4 h9 G; K* q' ^6 w

* u3 k4 h( ?+ u; z# x( W1 t! fNote as well that you can easily detect this method with SoftICE:) g1 d# z' m  Y9 h
   bpx Get_DDB if ax==0202 || ax==7a5fh0 G7 G7 J8 r/ T5 U7 a$ w; {

+ G% M5 e5 o- m. ]__________________________________________________________________________% q( a: Z7 O8 \3 D6 t7 a. b1 _
/ d+ [: k# Y  F- J
Method 10
* L) O$ J0 _! W1 x; q- ]=========- m% z2 V. A2 m; z7 q

  O6 b& b. T' L' D4 N% S=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! c! ^) W% h/ g1 F2 Y7 H# r
  SoftICE while the option is enable!!
) @. h0 O, m8 J# [% g; L, I! a& g8 K) o
This trick is very efficient:
8 T7 ?6 d) f9 v6 q6 \by checking the Debug Registers, you can detect if SoftICE is loaded4 Y) T) S, G3 I) B/ R; F; o
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
! e& Z0 D. h  q9 q8 Q; gthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 Q* K. ~4 `8 X% [
value (in ring0 only). Values can be manipulated and or changed as well; Z1 o! J7 S, W
(clearing BPMs for instance)
4 [# q; T9 e7 ?; z; _; E7 s) a. Q) n6 j; k/ q& N( Q. S0 T( C
__________________________________________________________________________) X& C+ }- j8 u& ~( m

( u0 D1 q) K6 _) h! ]Method 11: h4 h5 o# ]# A- E0 i
=========, T* [+ X; D3 b; i4 l

- l7 P* u5 P$ pThis method is most known as 'MeltICE' because it has been freely distributed3 W% V1 V  [% q
via www.winfiles.com. However it was first used by NuMega people to allow5 t# @$ f: O% v* E' O
Symbol Loader to check if SoftICE was active or not (the code is located: t% f4 A& Y- K; `& R/ R0 p
inside nmtrans.dll).
( W$ p& L2 K/ d0 K5 [" M* F
, G9 Q6 W  ^) H9 [The way it works is very simple:- e% _2 T" E; h4 W5 N! x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 X4 g  s& C1 |* i- g+ [0 S# rWinNT) with the CreateFileA API., p7 z6 `: Q! Y7 {6 q; e( k3 p* I! o
1 w! P6 f( }( c$ w) I
Here is a sample (checking for 'SICE'):2 C/ u2 `& _& j# a* A9 K
& u9 M, {7 g/ l& `
BOOL IsSoftIce95Loaded()+ }  x1 V$ e! A4 C
{
# _) ~7 r3 K! `9 L7 Q+ J   HANDLE hFile;  
% t+ `9 C/ n7 F9 U! v  m8 P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ |3 e2 R8 ~- C9 V7 Q- M, k, b, j
                      FILE_SHARE_READ | FILE_SHARE_WRITE,' F" T- L- ]& R5 n5 e/ o
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
% c0 U/ l* Z4 X   if( hFile != INVALID_HANDLE_VALUE ), {4 X* T3 k+ X
   {
" t+ Z: |5 ?, a8 J: p      CloseHandle(hFile);
- F! b! D9 i0 C. ~      return TRUE;* x7 g) h  @- j2 w1 v9 X
   }6 n  i% q) w2 U4 n0 \; F, q+ V" M
   return FALSE;
) l4 |2 }9 H4 w% E1 f0 m}
( W6 p3 p1 A+ m% B! U& E
/ I9 Z+ n$ f  I6 A3 ]1 L+ h& ~Although this trick calls the CreateFileA function, don't even expect to be
1 _7 p3 W' O$ g! W6 G: e- ]* Fable to intercept it by installing a IFS hook: it will not work, no way!9 f5 i( `# z! b3 {- R2 Z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F- R+ a$ T3 F/ s6 w7 H. ^  ~
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)! A; E6 m% A2 v) u/ v/ u; _
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
  R* @' A" w. I# mfield.% ]8 w5 k8 \0 K# z  E$ K
In fact, its purpose is not to load/unload VxDs but only to send a ( `1 S# @3 F1 A5 m- T
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) E) C3 X' v1 a! F1 w1 b' c/ ?to the VxD Control_Dispatch proc (how the hell a shareware soft could try$ P5 o2 N( w( i5 c3 E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 i/ b4 ]( C' \5 LIf the VxD is loaded, it will always clear eax and the Carry flag to allow
- w; l' U7 _- n  uits handle to be opened and then, will be detected.
! b! h/ O! j7 J3 DYou can check that simply by hooking Winice.exe control proc entry point6 T: [$ d6 s' H+ B  d* [
while running MeltICE.
8 l: O* K& l: }& {( g% n; j2 L8 j; b: R3 N; k3 O8 Q( y+ H
; i( S# @4 s' R& n' q& ]
  00401067:  push      00402025    ; \\.\SICE
( a2 ~& u5 J- P" W* O& _  0040106C:  call      CreateFileA
4 ?' m* a; H8 [- `  00401071:  cmp       eax,-001
0 ^' [8 ?% A6 |! u2 R# p  00401074:  je        00401091
3 N) g1 [6 w+ V& o7 m" m1 V$ D/ f2 {) ^

: I, V8 Z: @( @8 UThere could be hundreds of BPX you could use to detect this trick.1 H0 f& a, ?4 o
-The most classical one is:
& T6 R2 J3 \( {* t& W  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 ~- C, y: P( e, O% h- v    *(esp-&gt;4+4)=='NTIC'$ a5 U& ?" V5 m) B6 e! q

5 F# v: L/ p* k9 m0 |6 T& b-The most exotic ones (could be very slooooow :-(
! G* E  y1 w% b+ G" }   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , c' @/ m0 k, F" D, n. j$ U% h8 \
     ;will break 3 times :-(4 \5 m0 L; D! o9 B2 {, A$ j) }- e

: @( z- U7 D' @+ q2 P! E  @& ]+ j-or (a bit) faster: / @. M  C% C+ @0 ]; N! T2 B
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 A2 l  M, X7 U( D

/ J/ `' s: D# D+ `! j   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  8 k, r: ?, o: ]  g6 R# F
     ;will break 3 times :-(9 Z) i- ~$ N7 E% V6 \6 h
, u, D/ p6 C9 Q+ L  N) |
-Much faster:
! k- f3 W" R, S  f* q$ X   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' j# E( C% s& U4 E/ n+ {
' l( E* R( f. g# ^7 r, F1 U$ U- U
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
; y. a1 \1 R4 h( z3 lfunction to do the same job:  K; ?! K+ e' v3 H
+ d4 R5 D2 n1 |) H) H. V: ~, B# O' F
   push    00                        ; OF_READ
& r, q6 [0 K8 ?" u   mov     eax,[00656634]            ; '\\.\SICE',03 {6 M# G3 e7 g4 a
   push    eax
$ C" O  e3 k/ \4 V   call    KERNEL32!_lopen
) |$ X& v1 U. y' x. e- b9 f   inc     eax! h) c* W+ C( T7 O
   jnz     00650589                  ; detected
! J# e  Q7 \/ I* B   push    00                        ; OF_READ
, `  l9 ?* H7 `4 J   mov     eax,[00656638]            ; '\\.\SICE'
4 w) e  ^* K6 t) t   push    eax) y2 B# q; u* R0 f5 d9 S" c
   call    KERNEL32!_lopen
# Y3 r( Q8 F+ O& {   inc     eax0 u. n( ]& q! Z, V/ h" g
   jz      006505ae                  ; not detected' f' d) R( f8 D+ R( a0 j% ]
4 N1 W2 B+ [8 C% Q0 H  Q

# d8 D: Q- \6 X" r__________________________________________________________________________1 X- S3 b# P8 U0 h1 L
, o  a) `" J; j9 [
Method 12- {9 N) C4 I. u' x3 m5 {
=========8 S, p5 s/ k2 u5 Z1 d8 v9 t6 j9 E" |

  x# F9 m) R# A# m7 e9 ?This trick is similar to int41h/4fh Debugger installation check (code 059 n" |$ t* y7 b8 s# O* R8 |8 x3 v" X
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" ~2 B* X& P- H; Z: A. b& Was it uses the VxDCall backdoor. This detection was found in Bleem Demo.
+ b, x$ B% x  K# ?- L6 ^+ U1 }! S' D) y6 Q5 V
   push  0000004fh         ; function 4fh
: m; T/ d1 h( _- D6 w   push  002a002ah         ; high word specifies which VxD (VWIN32)1 P) a' _; q$ f' R( e* Y
                           ; low word specifies which service8 t/ a7 Y, f, r' X
                             (VWIN32_Int41Dispatch)
7 ?: ~. m2 k' N5 B   call  Kernel32!ORD_001  ; VxdCall4 m5 J# W# S3 \9 w% ^. i1 e
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 V( J7 k& A. t! {+ k1 C1 X   jz    SoftICE_detected
  A6 D3 ~% L4 h' Y+ J! z- Y/ o! X+ l! x# u$ D
Here again, several ways to detect it:8 T5 W% c/ m6 M! a6 \1 T
# ^. ?3 I  l: A$ A  X9 Y
    BPINT 41 if ax==4f
$ S" q' S* y3 w
( S+ a5 z7 h6 q+ I+ d  M( J    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: j5 o" u' x0 }0 {. i$ ~  v( _8 }6 r9 Q! z0 [' u: a
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 Z2 G8 r( T% J- T
$ y! f" s) d" h7 Y! K; ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ G: c% C* f3 u5 w) a2 v
' `- |! a" b+ o5 b) G; Z  E__________________________________________________________________________
) C: }" u# H; i' X1 M. d" {
  J) ^0 {7 `" p9 h) ~8 OMethod 136 c/ ?; g$ r3 x
=========0 F6 ?! x( q% _$ E) c* n% v9 f: }& s

6 O" g6 f( B0 }, J+ CNot a real method of detection, but a good way to know if SoftICE is
6 p9 Y( r8 z' b+ b" iinstalled on a computer and to locate its installation directory.
. d2 N# i; }; J& B1 M* @: e: [It is used by few softs which access the following registry keys (usually #2) :
% f6 I5 q, W- V% B  T* c3 [8 [5 r6 V5 J( v4 R( Y4 g
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ l( w+ m& ]. k# h' K0 d2 {, l\Uninstall\SoftICE
4 O( O6 t7 ^( q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ t. I9 }3 [. ~4 X' ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' O) L2 H+ S, D/ y! |9 Z
\App Paths\Loader32.Exe
1 N" e; u, b. A8 J% S2 L" N5 b
+ B$ T' U, p  n0 Y. X$ }8 q' a4 y4 ?/ i; U  U; `& s* B
Note that some nasty apps could then erase all files from SoftICE directory, K, I% T* N+ e; L* @" J# P/ \* N
(I faced that once :-(. R* m0 ^' J/ `% F6 I

9 m; f* Y& i4 D8 U) W4 E- B7 ^) XUseful breakpoint to detect it:& ]& j$ g$ ]( T- l  V( Q% _, a* v
5 `5 D  @/ n! O9 r1 U
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# B) D: |7 @# ^2 r" |* O* q% n5 i- v# X! u
__________________________________________________________________________
- d7 k4 _) h) ^. R3 w- p7 O. }5 W3 E0 Z" ?7 [; {
* s$ h4 m# h5 |! p
Method 14
5 t. ~1 T  q" }& y# X+ ~7 J( {=========
' I( I/ o, L  X. B6 ^" S' R9 Y6 |& T5 p- b
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) b+ c1 C1 t' K6 tis to determines whether a debugger is running on your system (ring0 only).
: B1 G7 _* n& D; }5 a: o: ^, X8 ]! e8 z; `' W# S9 N
   VMMCall Test_Debug_Installed
7 ^8 ]  o& P. I: g   je      not_installed2 [! S+ ?/ E  x5 N5 f- M

. ~) Z' e0 t2 m* `; e; w5 g2 tThis service just checks a flag.  H8 P  g9 ^+ w2 F" \
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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