About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 H) s0 Z- s! R! M' {5 l9 w4 Q<TBODY>- @8 ~8 z' T" V
<TR>3 C4 X$ |; G) c( n
<TD><PRE>Method 01
0 w4 N8 N; N2 ^: a=========
  ~$ K8 D: G# F* v& r
" M9 x6 H; h) k: H" x  _5 \) VThis method of detection of SoftICE (as well as the following one) is9 x, a: X- N! E
used by the majority of packers/encryptors found on Internet.3 A$ |. s, E/ s% N6 e, g' _
It seeks the signature of BoundsChecker in SoftICE: h% V, d! b) O% h; D
9 u/ B! `% M8 y8 W
    mov     ebp, 04243484Bh        ; 'BCHK'1 ^  F0 x: J9 x* V( g8 L
    mov     ax, 04h3 f/ _5 r8 ^4 U# T1 ]7 w
    int     3       ; b* I! C* h% j2 t
    cmp     al,4
1 D+ ]  n% }4 e3 {  F, a    jnz     SoftICE_Detected- |. L# ?* @4 P/ I" z
6 z: C5 X' U/ q- V2 @
___________________________________________________________________________! V* |. M, f0 U

% a4 b* l, ]7 a0 ?" T9 ^$ V: U8 d, [Method 02. o5 R1 d8 l; k
=========: A! a% F$ U$ c) T2 p  Q. B* i
8 u5 n" j: n- T  m0 z& j
Still a method very much used (perhaps the most frequent one).  It is used
% S3 z9 _6 X! i! U6 X. t: {; J( rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
. Z6 u6 c2 Q5 P' ~4 Oor execute SoftICE commands.../ S6 P6 N+ q6 A- {! |; S+ H# l
It is also used to crash SoftICE and to force it to execute any commands  U2 O7 s- q. ^) V8 |! |' i! Q
(HBOOT...) :-((  
3 p2 u1 C/ G: W" q- S1 T% b1 F/ @8 n* `3 o6 y3 E6 C2 U7 ~
Here is a quick description:
+ \' e0 C( f  y" N1 O% p% w-AX = 0910h   (Display string in SIce windows)+ a8 |; p$ c* X
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 W# U1 \( d) w& [' E+ P: V
-AX = 0912h   (Get breakpoint infos)
! a8 I7 ?! n' W- E: d. @) h( w-AX = 0913h   (Set Sice breakpoints)
, X1 D# `; W: c8 y) Y: s-AX = 0914h   (Remove SIce breakoints)# i% j1 Q* e, ]5 I# V. \
( v0 C0 w( Q) h! O
Each time you'll meet this trick, you'll see:
" }& n' m( e. E- w4 D- @6 G-SI = 4647h' |! W/ h1 @5 r% `7 E+ g
-DI = 4A4Dh+ l" U6 e5 e) w1 Y; ?
Which are the 'magic values' used by SoftIce.2 c# ^1 j/ j( ]3 o4 M+ X* ~
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 y8 E3 @; q1 t) U: W: J4 e

4 v: N3 B* e" s( J" F9 n) E0 C1 NHere is one example from the file "Haspinst.exe" which is the dongle HASP
' R( N5 q+ L: YEnvelope utility use to protect DOS applications:
1 ^! t6 \' |2 Z9 a& z
( Z: c' |" T5 z0 U; k0 [0 f" F5 P/ S( ]: l* O- O0 t5 b
4C19:0095   MOV    AX,0911  ; execute command.9 V5 f! `! F  B# y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).7 B( u) Q5 ?6 V" W2 p" ?
4C19:009A   MOV    SI,4647  ; 1st magic value.# ]0 j7 |1 T- F8 W6 I/ Q& [
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. s  D+ G5 h7 F! _7 r
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)9 F: F, v+ q) s) y4 |$ o: [
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 `+ @2 S4 _7 y  Q" p0 Q7 o8 \4C19:00A4   INC    CX2 I4 c' ]: M% m' i$ o) ?' o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- Z$ ?" x5 w+ x: i3 w4C19:00A8   JB     0095     ; 6 different commands.
2 Q  A7 v' h. A4 C0 K$ k& h. A7 H4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 D: X0 u, L3 `8 f
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 |* k( ]4 g$ b" B8 S1 L
8 w  Z. Y4 P  M3 h$ SThe program will execute 6 different SIce commands located at ds:dx, which! S2 q$ j/ i, w+ f- ?  j
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, Q+ W! b$ B! L4 b( g5 h: J
: S: U8 o! E9 q$ G% a" S* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 }7 l0 J0 i& S* p& R___________________________________________________________________________3 H& f. Y# F7 ~9 @1 w

# T% z& K3 N- [( Z, {7 w! |) H2 L+ D' n  e3 b
Method 03/ b% }- c  w$ |0 ?% r* j8 T
=========' s8 l, K- B, u; |

( u  ?3 p9 [8 k9 N: M- b/ X3 |Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. E( e/ [- k# F3 j
(API Get entry point)
: F- z0 u; @- y1 ~2 `- W% K        
0 J7 X  y1 [* P9 c2 r: r8 o3 i( j! L2 z0 y) D1 y5 m
    xor     di,di
, i) _% R2 l+ W% @    mov     es,di, G1 Q8 ?$ |$ H+ e- d- T  d- i
    mov     ax, 1684h      
6 o  A5 ~8 |( P! g    mov     bx, 0202h       ; VxD ID of winice
/ n6 ~# d" |3 g0 a7 V    int     2Fh$ [% W9 G  h: a8 R% L* f
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 m- Y; Z2 l, t+ D    add     ax, di0 n5 {; n# t: A4 U. r7 a
    test    ax,ax
* Y) t; I. V& T- F" r    jnz     SoftICE_Detected0 y$ H* G- M7 p" _/ c

6 s- O7 h" }8 @$ d/ P6 R2 g___________________________________________________________________________
- H: G# a7 i; N/ x5 u7 l6 d
3 G1 F  Z; m! m2 f, a$ `! UMethod 04+ k1 ?% Q9 x6 N7 g& e8 O
=========
1 T. G7 D7 W' e4 V$ @) @, O( c+ Q4 X0 r6 M( L  b* g( N9 _
Method identical to the preceding one except that it seeks the ID of SoftICE. h7 Q$ d3 y" Y" y7 p: J
GFX VxD.0 s; e4 n. C2 Q9 z6 E2 u+ k: k

$ Q" J* k0 {- q! Y3 A1 e2 ]    xor     di,di
- ]. o+ W5 v7 t    mov     es,di
+ P% n( w8 }. F) _    mov     ax, 1684h       . d) C* r% e  j0 P- B8 p
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 ?$ Q6 e) p/ }+ z$ S2 }. X8 t1 h    int     2fh3 d. O; Y6 o2 }+ m% K; m" W% L: S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ i  A7 H+ ]5 c/ f: \; b
    add     ax, di
9 K0 l- A& v/ Z; V% Y1 U$ J    test    ax,ax
& V- B4 Q. F! B- z1 _    jnz     SoftICE_Detected' O2 i" c% W. ]; D: }7 U
! u: R; k+ G2 u& w, G) z
__________________________________________________________________________
* R1 [% e8 P. P; K' Q7 h4 y% a! Q* p! Y( n$ {

( x2 F1 [: e' rMethod 05
0 `" u+ r% T: ^" g% w) v=========& L/ B  k+ W: H) Q' g0 p
* h4 E1 K! Y' i9 z" f5 |# s) t3 S
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 \% k4 d6 P$ W* A9 q- V) }! f* E
debugger. It calls the int 41h, function 4Fh.
! E# B0 \+ @5 Q$ ^: U* QThere are several alternatives.  & t% }& h" ]5 u' n

+ Y4 e7 I2 I& k% n+ W0 z$ `The following one is the simplest:
3 v  _! ?- h& [" G* W: l2 a0 A# e% v3 d
    mov     ax,4fh
  Q  H! t' Z! G    int     41h
! h& A9 q7 r/ P* ]% r    cmp     ax, 0F386
4 u8 a. D3 i5 W- }# Q2 }! I    jz      SoftICE_detected, A- L! H( N: y) S$ f2 S
- \7 V0 T' r8 h6 o7 S: u- H& k
' H' _3 y7 a' N5 [: }
Next method as well as the following one are 2 examples from Stone's
1 D, P( r1 H+ E# g0 G"stn-wid.zip" (www.cracking.net):7 h5 c5 H& `$ X4 f) r3 L7 \, K
* A; U6 h7 x1 U- W6 B
    mov     bx, cs
9 T& t$ ]+ ]( K    lea     dx, int41handler2
! y$ a/ K# H/ G1 Z/ {( e    xchg    dx, es:[41h*4]
$ [( t% v) T7 `+ R    xchg    bx, es:[41h*4+2]8 X0 m7 o8 s) b6 f( A1 M
    mov     ax,4fh
1 K* ?2 z) k! o- @; i8 d) A6 ~    int     41h" Z- n3 M% G  z! P: C
    xchg    dx, es:[41h*4]" {& b. p7 r# D. H1 @
    xchg    bx, es:[41h*4+2]; I( l! k# P3 P* Z# k4 f
    cmp     ax, 0f386h, h& P; Y' |6 K
    jz      SoftICE_detected
3 P; R6 J$ v7 Q7 n8 Y8 N. w4 Z' O. |# O
int41handler2 PROC
& |/ y' n' w* i- A    iret, w" n, U0 [. }% j, u
int41handler2 ENDP
1 g& c0 j& y* _% J* b0 O5 \" {8 O3 ?7 f9 {/ s0 S+ z

1 q3 p7 H$ ?5 e_________________________________________________________________________! s; a; f, R- z  O- b* c
) k' P! q$ f/ D( e

7 [, R/ x6 P. v8 i. E% x' B9 }" f! rMethod 06( k2 K& R2 u2 I, A+ N' W0 i: Z5 R* r
=========
: F8 W' E: a3 T+ Y+ {# v+ _8 ?" s0 ?1 f6 \

8 ?  {1 y9 ?! G( u5 f( N2nd method similar to the preceding one but more difficult to detect:: ~4 x! P# e& ?% _: f8 z& Y( u

1 F8 {7 b; q. ~( O3 |9 A0 k5 }& [' m
int41handler PROC
5 N* i: Q' T1 o- s& w2 R) {    mov     cl,al
: Z; N. A3 [3 h( \- _8 `* V    iret- J- r# \" G! i3 y( t4 C
int41handler ENDP
$ {2 |# b4 N2 i( y1 D0 \/ z, [, i7 x" |2 v1 o
1 t3 V; @' a$ b3 f) }( P0 g: H
    xor     ax,ax& A! Y, E* Z- z6 g/ Z
    mov     es,ax
1 e' [- j0 r5 W: x* U' e- O' f    mov     bx, cs
3 _2 F: x, R8 |- }1 @    lea     dx, int41handler$ t; \7 V+ M, Z  V2 U% W/ V8 J5 x
    xchg    dx, es:[41h*4]
$ U/ f, W8 q6 d, V% m    xchg    bx, es:[41h*4+2]
1 K# [$ D0 m! A& @    in      al, 40h
& o  i6 w1 e  E4 a0 I4 A9 z( q    xor     cx,cx' m' W1 z. u2 |* w+ r& W
    int     41h6 H( u/ X, ^3 e
    xchg    dx, es:[41h*4]1 j7 L2 K. E  \# G- x
    xchg    bx, es:[41h*4+2]5 |8 _( ]8 Z5 _& ?  F/ k
    cmp     cl,al3 ?+ v+ I: M; Z. n
    jnz     SoftICE_detected
4 s( [1 l' F" ]4 [8 A' X1 d" N. Z2 |  l) r( Q
_________________________________________________________________________  H4 b! I( W( j0 n, p9 |

; S: R4 U3 a+ v  dMethod 07
( n) K  d. G- g: I=========, `+ r% c. A) f  m$ h; P  r
. o! y8 V0 N8 E1 T9 E0 }. Z
Method of detection of the WinICE handler in the int68h (V86)
5 x7 i4 `7 h, N( I% K  R6 i& l
% h, x$ t0 u- l  }" ]! P7 h6 A    mov     ah,43h
0 U) C: K( U6 n! e    int     68h
2 p" {9 E& S( y: A! m' k# {    cmp     ax,0F386h
) o- j# }0 L; y& o1 s/ s$ [! G    jz      SoftICE_Detected6 C8 f. r2 o5 y: H( w; Y  i; C
0 ~% }9 [7 S3 {% `; b: Z/ j

* @7 O' }9 |4 {=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, h* x( C! ^0 R
   app like this:
  x( A' C. T, N+ h
3 {9 z+ P/ d" j8 H9 ?% `   BPX exec_int if ax==68
  R$ b& v: K' e   (function called is located at byte ptr [ebp+1Dh] and client eip is
4 r# Z0 G  w& J; R   located at [ebp+48h] for 32Bit apps)9 l; @7 Q/ I& q& o! d. l' w
__________________________________________________________________________
& D( y9 j9 w9 M( I2 y. m
" d( [- _4 Y: f; N% r2 {' p
; H& ~# t% h3 T- k+ _) MMethod 08/ @" K- i9 y  V2 M  o  C( f
=========
. p7 |3 A6 p% \0 K" c. F( X9 J( h
' m  r- O" z3 A3 zIt is not a method of detection of SoftICE but a possibility to crash the. J6 P2 r8 {9 e; _2 P
system by intercepting int 01h and int 03h and redirecting them to another
* T0 ~( f6 R, ]0 c' @* i( T  eroutine.
( x, q) t! e( q: o8 X3 nIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- _, m1 w+ M' R7 x2 Sto the new routine to execute (hangs computer...)2 Y: w) Q$ s7 z

8 |( H" L4 q! }+ ^1 ~$ x1 c' U& f    mov     ah, 25h/ E* H) I' k, T5 p/ b# g
    mov     al, Int_Number (01h or 03h)+ P9 i& z/ u: J% c# E, K* O
    mov     dx, offset New_Int_Routine
) o! @( u! F9 X, X! p& A! s    int     21h4 Z* i5 O) V) y5 t. z
. i7 y6 o8 Y3 ^7 a% I! [
__________________________________________________________________________9 s. w0 n" T. W7 E$ w# E; E
1 r& G/ b4 \& c
Method 09
; U' S; ^6 y& @: ]* d=========
# F$ `2 D. d( i
$ j- H2 K/ j$ U7 e& w( X: q5 rThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 U9 ~/ e  T8 y3 ?$ @$ V2 x+ |7 Kperformed in ring0 (VxD or a ring3 app using the VxdCall).1 m5 S8 q, t: U4 }3 L3 |
The Get_DDB service is used to determine whether or not a VxD is installed
% j: R+ v6 A- r9 W, afor the specified device and returns a Device Description Block (in ecx) for
5 o  V) m9 s/ j$ W: jthat device if it is installed.2 [+ W! q! w3 J* n: ?

. O8 \  _# K8 ]7 ^( W$ w$ F4 z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
6 `; X' n( e. U, z) r   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& a2 ^' l- F% S/ x: \5 D# x   VMMCall Get_DDB
; }( x& u5 v' e   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 A+ n& p* y" B! I- P8 o8 k- {- n6 ~0 U# u) [
Note as well that you can easily detect this method with SoftICE:
6 n2 _  `1 r' c$ v- \   bpx Get_DDB if ax==0202 || ax==7a5fh
9 `, o) N" l4 b1 i) ?* ]+ L9 o4 d9 N8 R. @$ Y
__________________________________________________________________________
$ f2 U# U3 B" e9 ^7 d/ g9 s/ O* F, g" k& t7 L
Method 10; @9 D6 Q# r4 K0 L' R
=========
, \) a" X" Y" D0 v9 y
: c  ^. k% @0 U: l. U' L=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
( S: g' c4 W2 V' i/ z; G& t9 F% Z  SoftICE while the option is enable!!
8 U6 @1 x8 w' Y* i" F6 E9 n
8 c  l" ]5 S8 [2 v: sThis trick is very efficient:
. n6 \* F% ~  J7 v. Gby checking the Debug Registers, you can detect if SoftICE is loaded
9 {: \/ R) J! x& B- l. D1 K(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 Y( _$ f4 i* _4 Zthere are some memory breakpoints set (dr0 to dr3) simply by reading their
4 n  y  e" ^! ?5 B1 z8 rvalue (in ring0 only). Values can be manipulated and or changed as well) R: K8 d/ b! b, B- h) i5 Y/ C" f
(clearing BPMs for instance)
' ]) c* s7 @- y. _; n5 T' Y, s7 R) Y& b0 C4 C. c5 w
__________________________________________________________________________
/ j* ]8 k8 h" [' A3 S: I, ^8 g6 L, _5 L! o& l$ w
Method 11! S% m0 O$ b; t) |
=========
9 `$ {7 Z; l2 X5 z3 }5 j* Y/ m' w* B  G6 `. n3 {% r/ d
This method is most known as 'MeltICE' because it has been freely distributed2 L" k/ ^. @! d0 W9 @) k
via www.winfiles.com. However it was first used by NuMega people to allow
3 y. o" c9 Q! Q7 |4 Y8 ]Symbol Loader to check if SoftICE was active or not (the code is located8 k$ {5 R3 F1 H) a9 U- Z6 R# ~/ k
inside nmtrans.dll).
5 C' t6 I3 @0 a* {! l/ Q3 w3 L/ q3 a3 j/ I
The way it works is very simple:
" T7 F+ m4 x4 F2 ]  s8 o+ B: H) JIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( T9 E* R. z# zWinNT) with the CreateFileA API.
" \: B) |- u% T0 T8 ]/ W9 l  N4 Y4 I( Z5 T
Here is a sample (checking for 'SICE'):/ S3 B( f, f$ F; ~+ }7 J
$ D4 [0 s; \! }. {$ J7 r
BOOL IsSoftIce95Loaded()
& ^% c  P5 e9 J8 P5 w0 I{
3 g& w$ Y+ w" E2 k4 a   HANDLE hFile;  
/ ~, G# r6 ~( L   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 K- ?( x4 D5 x* ~+ |5 Z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& Y" `8 m6 R) g2 r# V                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ K; g6 V4 f; f" h( b
   if( hFile != INVALID_HANDLE_VALUE )
* ^3 C( M5 o/ v7 U4 F6 F5 q   {) R' h5 u  q5 E  V
      CloseHandle(hFile);
5 I+ k. G( N! O% O* @! ?      return TRUE;
' |* X2 |0 A- ]& u3 b; \   }
) P! f8 N( L) V" @! K# K/ l  y   return FALSE;
! R; e/ h& I/ l/ q}
) m- L. o/ D% i# [
5 i6 }% x& c3 M" \+ P+ W: Z& KAlthough this trick calls the CreateFileA function, don't even expect to be. j$ Y+ x* C) ]5 g. x2 w
able to intercept it by installing a IFS hook: it will not work, no way!
* \3 r" h. j! UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 |2 e) ]! @% f4 k1 \$ ^- i' Wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' l2 A; f4 d0 N( T7 O' K) @
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
, n9 B" u" S/ y4 pfield.# [' M3 }0 y/ ?( `. U: b4 x, g
In fact, its purpose is not to load/unload VxDs but only to send a
" }2 I; H9 y, |4 o( o, Q, DW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
$ b, Z, w& m/ k$ G2 e& M/ Jto the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ F- T; `# M1 xto load/unload a non-dynamically loadable driver such as SoftICE ;-).
( ]: h( N# A' R% v. Z* v3 F0 rIf the VxD is loaded, it will always clear eax and the Carry flag to allow* k. S3 q5 m8 u7 `7 r7 ?
its handle to be opened and then, will be detected.* C0 F9 F# `3 a, [
You can check that simply by hooking Winice.exe control proc entry point) s; O- i" p- _2 @$ L& y0 c  [
while running MeltICE.+ i" H- y9 O  k1 h
/ j- Q/ C5 }3 [8 O( U0 f6 w" [
. Y7 E6 s2 ~8 }1 X# d
  00401067:  push      00402025    ; \\.\SICE6 {, B) ]& `+ n2 ]6 f! e: M
  0040106C:  call      CreateFileA; S& J  Z% q. l  V2 r
  00401071:  cmp       eax,-001
1 T/ z' }4 l. H4 Y3 k/ ^  00401074:  je        00401091
% G5 B3 J# ?+ E% @: G4 W  u0 }$ i4 ?( V8 j
. ?) S; t" S8 V$ a- T
There could be hundreds of BPX you could use to detect this trick.+ K1 b3 j5 c; W! P
-The most classical one is:4 h9 m, m- ~9 D! c1 ?# U
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" z3 t) ]! w! [4 |" J3 A4 {    *(esp-&gt;4+4)=='NTIC'% u4 Z) g: y" E7 I2 R- {) K
2 v6 U8 L2 u2 T- n* P; i" v
-The most exotic ones (could be very slooooow :-(* x" Q' n1 e, j2 Z  M
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; B8 @3 H! U3 _- ^/ n1 R     ;will break 3 times :-(
% b0 [+ z/ L0 s- i2 E1 w1 v) q& \# K9 h
-or (a bit) faster:
5 v# W& p! O) G9 b, A4 w% e3 a# r2 R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# l5 F  f4 X1 @# D" A  p1 W
+ I8 e& d$ i: M# E
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 U3 ~$ h- q/ I1 f2 C1 e- x  N4 V
     ;will break 3 times :-(7 m$ I7 z' S" M: h

1 X" {. k1 D0 b) V-Much faster:, D& o6 t& I& `5 i. _& g7 o# ]* H; K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
8 Z( L) P4 d3 d3 C# ~% T( p0 o4 J7 F, Z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ F2 t5 B# {& I& R7 b  ]& O9 d6 zfunction to do the same job:
; L( K- ~5 F' }6 X2 T5 }  T; o# ?* ~6 K
   push    00                        ; OF_READ9 @) D" C" F4 i
   mov     eax,[00656634]            ; '\\.\SICE',0
5 \% W9 y: ?0 f- A7 e9 A   push    eax* A0 b/ \" {3 Q& o
   call    KERNEL32!_lopen
' i' |* x. F  c. m   inc     eax0 u# L  [, G6 X& Y
   jnz     00650589                  ; detected
5 U1 N1 Q2 o: e. u) l4 f" A4 r   push    00                        ; OF_READ% i9 p6 E9 P) S! n) P" U  A( }
   mov     eax,[00656638]            ; '\\.\SICE'
' m( S' u* L7 H0 i+ a: m1 s   push    eax
2 B' |6 I! x7 C- `& i$ I( L+ ^9 X   call    KERNEL32!_lopen+ E6 ]' ^+ F& w* j  P
   inc     eax  R) i1 u" G- W; h' V, \. R& i
   jz      006505ae                  ; not detected
/ x( i1 Y% N& n' W0 A9 N0 }+ B) [( u4 [

* g1 l+ c0 J4 x3 Z__________________________________________________________________________
$ x* z: r5 d: m/ L7 ^; W* c: ]
1 s2 b9 B3 o9 {* t; bMethod 120 a) G- F4 {0 `# @9 o9 X- W7 O& X3 `
=========
, {' D1 E  ?3 o# U4 X) p% Y0 X
" ^8 H9 ?. v3 Q1 M! S7 Y0 m+ N- YThis trick is similar to int41h/4fh Debugger installation check (code 05: x) h+ [! V1 ^+ ~  g, `2 M5 g
&amp; 06) but very limited because it's only available for Win95/98 (not NT)! _9 m: u7 I1 m9 \' }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 ]2 e; @; Y8 S4 \+ u. `# b
3 N3 ^* J6 B6 v
   push  0000004fh         ; function 4fh
& \2 {1 A, s. {  F: Q* D, t   push  002a002ah         ; high word specifies which VxD (VWIN32)
/ S% h: e5 H9 Q                           ; low word specifies which service
7 u: t. s) E; Z1 J, v* P                             (VWIN32_Int41Dispatch)$ g) K! y1 A/ D- a: h3 \
   call  Kernel32!ORD_001  ; VxdCall  P6 i. V% \* a0 n4 d- N7 K
   cmp   ax, 0f386h        ; magic number returned by system debuggers6 _8 |. c# R* F1 p
   jz    SoftICE_detected
/ O1 Y8 u6 H* c9 }* j" _3 [/ a- f
7 k3 {3 {$ ]: r# v2 _* A8 _Here again, several ways to detect it:" |7 Q9 A  U; h8 d$ L) t% K
4 o6 J9 C* J! E  t" v3 k" J
    BPINT 41 if ax==4f4 a, p/ s" {( i
8 L" y8 t* h. Q! R1 m% p
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- L. P# A6 @6 o) [
! c' @8 `. F$ d2 y4 C
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' B# e1 @5 s3 h1 @$ c" R' Q% l# U
( {3 R1 T8 g5 B  @
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% g; ^$ `0 @+ {( v- e
. s  ^2 ]/ R5 u+ q4 d) g__________________________________________________________________________3 s+ V# U# A/ d2 {+ F

, t; M. [4 y: S: {& ~Method 130 m1 \1 D) J" q& @* j
=========
! P0 G& C8 z( ^! F1 j0 S+ _" b5 g! H* \* D+ {/ a; |, w) X
Not a real method of detection, but a good way to know if SoftICE is# F2 J, _1 O( a1 |8 @* K$ ]
installed on a computer and to locate its installation directory.% J9 _  t2 u; N8 S1 n) f
It is used by few softs which access the following registry keys (usually #2) :
* K( N! |/ S: _; J7 M0 _* y8 A' m' f5 C! z+ c* L7 [
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* b) z$ I: i7 h\Uninstall\SoftICE6 w  J2 v& O5 W/ [! ~/ \, Z; B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
" c7 s7 @" H: K-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* }6 X  W! l5 L" ~- v
\App Paths\Loader32.Exe9 n% H& \7 r2 v

- O$ F% b/ A  a$ Y! q' c. a) j9 o! y
6 h; S0 r: V8 {8 b# Q6 V2 bNote that some nasty apps could then erase all files from SoftICE directory
" o4 @/ b3 c2 ~) a7 y(I faced that once :-(
5 w; ~: w$ j2 `8 c3 Y+ b$ Q
0 B6 C% n1 T/ PUseful breakpoint to detect it:
( G# K1 G; U/ h# i$ a# N! @5 A* y3 U. U1 M. i
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- \/ L, x6 ]4 Q9 s

$ F& B/ r3 @9 _7 {: E__________________________________________________________________________
8 U# y2 i; l8 d) M/ M9 B. _! u+ o* v6 }; R

. k% c, N1 D: I8 z6 q8 \& GMethod 14 8 J1 i. ^' D. ?1 ?3 O" o7 f: u
=========
) o5 j# @+ O$ S' g* y" {% W0 L1 K/ J# i, O
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ _1 V! l' Q  @0 ?& ais to determines whether a debugger is running on your system (ring0 only).. c8 f% H2 a2 n2 \$ l
* ~0 {$ ^& t1 N  }4 R! K
   VMMCall Test_Debug_Installed8 V% J' a* A" V/ }# a
   je      not_installed$ w/ U0 Y, @% `6 G( t9 _; v6 V8 o

/ ~% T, V7 h2 eThis service just checks a flag.
% b, g$ D/ K& Q* T</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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