About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" y7 R" b0 W4 V$ V4 @<TBODY>5 ]9 H! H5 z- B3 c6 Y  g4 |
<TR>
) V; D) N- _, u& v" g" p<TD><PRE>Method 01
$ u& d4 v1 i0 V4 k=========
( Q& e' X$ J2 g& q/ e( ]2 G' D' U" G: A! t, K! t& L
This method of detection of SoftICE (as well as the following one) is
; X0 h& f( b: g- [& E* L+ O, z7 Bused by the majority of packers/encryptors found on Internet.
& t: M3 |9 u1 ]4 ~0 w6 ~2 GIt seeks the signature of BoundsChecker in SoftICE
- y2 k- W: h% W0 r/ l, Y2 o0 e( {5 ~' i
- d7 O: N5 i7 A! B; b    mov     ebp, 04243484Bh        ; 'BCHK'% f, M8 L2 M4 C6 n* ~
    mov     ax, 04h2 v: D; P! W: z' J2 b; l. x0 Y. t
    int     3       " p3 |5 @' Q. }1 ^+ N* V; j# H" }9 }
    cmp     al,4  W/ C& h0 m; r: i
    jnz     SoftICE_Detected
( ~4 j. u5 N' J' \9 E
3 r3 R% ~2 s8 s$ ^5 x- `' P___________________________________________________________________________, O! x5 d) E. }0 k/ x' h. ?  }& G6 g

+ k9 q* P# P  i2 e2 RMethod 02
$ I3 t$ R! m; `=========) J+ J0 D& v: R
8 K" ^. Z2 v' |( a2 g# \8 L' `
Still a method very much used (perhaps the most frequent one).  It is used
/ ~9 K  N- W- z9 q( T' x; Q, n- sto get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 m8 H- Z, \" @8 A( q- `
or execute SoftICE commands...
9 w  e# J, ^$ f2 I: ]It is also used to crash SoftICE and to force it to execute any commands
6 y' W& E& _' O(HBOOT...) :-((  
7 D5 r3 Y9 L3 S" t0 T* i5 h8 e7 |2 s( _! {* t# q
Here is a quick description:
; s% v/ J- O0 o6 Q0 @9 V: v-AX = 0910h   (Display string in SIce windows)+ ~. S' `; ]: |3 e$ e
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) ?% c( o1 Y. j, \7 ^7 j& O-AX = 0912h   (Get breakpoint infos)
7 @4 H/ k' R8 l$ S/ ^8 |-AX = 0913h   (Set Sice breakpoints)
6 c% q0 n$ }$ i; L$ ?7 @-AX = 0914h   (Remove SIce breakoints)$ f. F' a8 V9 W$ `  Q' R( Z' d
% u( ]/ \4 J& {7 F- x4 }
Each time you'll meet this trick, you'll see:
' M2 q1 C9 O. X-SI = 4647h
4 a0 P# t( @0 n: g-DI = 4A4Dh
' n' Y( b# x9 c  ^  H8 IWhich are the 'magic values' used by SoftIce.- {9 P- N# s( F2 r2 s6 e2 N
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ g# |. v: r7 |1 W$ j  o) n) ~! ^2 T7 J9 W7 v0 S# w: t, u
Here is one example from the file "Haspinst.exe" which is the dongle HASP7 c- e, C1 Z: k3 T- F
Envelope utility use to protect DOS applications:
# v5 {" q$ f( J7 s  P% B% L
3 x! s% ~3 G: V0 s0 [0 j5 Y9 X6 H3 k; s7 g7 W# q) r
4C19:0095   MOV    AX,0911  ; execute command.# x% J3 Z* P  ~' t, G+ b
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* y' d2 p2 A% R! w2 _4C19:009A   MOV    SI,4647  ; 1st magic value.+ `+ ?/ s* Y4 P) B
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 P1 v8 }0 q: \: p% G# C- P
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ B9 O# G, l6 w9 C6 R! o& e4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 E7 O" F2 j- x! `+ d
4C19:00A4   INC    CX1 B) i% J, C' ~9 a" x% c' e, Y- B
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" I6 k2 n8 Y$ T# `$ M4C19:00A8   JB     0095     ; 6 different commands.
5 [4 C" V, F7 C4C19:00AA   JMP    0002     ; Bad_Guy jmp back." d6 P) r& C2 H4 E" D0 e8 E' y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 ]! l+ G( M3 n: N
/ h6 K- W" L0 OThe program will execute 6 different SIce commands located at ds:dx, which- h) f! o0 v3 u- Y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 q& V* q) s' n

1 a. L. K, g0 u; f: E* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
1 m1 ]$ w; y! }: w1 g7 ~, H___________________________________________________________________________
# u) h" n  p' z; H$ q$ N5 s. P5 Z
+ I$ O7 ?5 ?2 ~1 E% ^+ e$ {8 |! q
Method 03
' l! n0 W0 Z9 h+ y=========
: M' x2 ^- Q3 H! `2 R" K3 V4 U5 f8 s- g( q  k: `. ]' h
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
! f6 ^2 @' ^, Y  C7 l( u& w(API Get entry point)
; _7 ~7 C2 z" W5 |        5 o1 _5 l( S$ g
7 F- t5 e* G1 W  `& h+ v+ i. p7 ~& z
    xor     di,di
$ u7 `! r1 H5 R3 Z0 Y, D    mov     es,di
" M5 q: F9 K6 W; Y6 T( B1 C0 X9 i    mov     ax, 1684h       / |# N( i) C! A% q& o' U
    mov     bx, 0202h       ; VxD ID of winice
4 i8 i# g# _7 K, K% ^& J3 U    int     2Fh) _- D) f2 W3 J: U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# {) V$ z6 }5 @; Y    add     ax, di/ [: y+ s$ I! L" C; Y
    test    ax,ax) D6 X0 S, o  F4 Z
    jnz     SoftICE_Detected$ F- }* u$ d0 {; z3 [! }
1 ?, Y. i3 b) H$ ?" l4 A6 @* L
___________________________________________________________________________
) L  `9 |$ D6 l- w. @! X' z/ X
& J* A% `2 v: mMethod 04
0 L: B$ J* [. h9 T=========3 m# k1 P! J5 }; l3 b: c- X
1 R3 l! b: |- u7 J7 r- G2 R9 J$ t
Method identical to the preceding one except that it seeks the ID of SoftICE  L: e- j: M1 u& U, I+ e
GFX VxD.
0 U1 H0 d- L: @* A% u  h" t5 q: P
    xor     di,di
' I  t* G# A$ J    mov     es,di
* P0 W: |# l6 E% Q* d3 p, P7 O    mov     ax, 1684h       ' S8 A$ ]( V0 h, L# E! y+ t
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! ]9 T8 m. z* D! p6 C    int     2fh
, |( @" P7 h) z) v! F    mov     ax, es          ; ES:DI -&gt; VxD API entry point, \* l, x& b& Y* i1 R: u! ], F
    add     ax, di* m& C' f+ s3 I, U1 B+ a& Y
    test    ax,ax
% v- A7 D. A  A* {4 ^$ @3 y    jnz     SoftICE_Detected. c+ c% @( G" e& B

" D/ H5 B2 D. @) N3 c8 R8 A, ^__________________________________________________________________________
2 |3 Y! u1 d! v9 ^$ U# F8 g- q5 @% S$ V
+ v0 W$ f* p% X2 w4 M
Method 057 p" B& A0 q& H6 X  t
=========+ U% a: B- I" h5 h$ g! z
9 O, p  f( L8 N" z: l- S* {
Method seeking the 'magic number' 0F386h returned (in ax) by all system& D, ?- S' M" ^# R& {
debugger. It calls the int 41h, function 4Fh.$ U6 ]3 h4 A) z% S# R; E/ ^7 ~
There are several alternatives.  
- c2 Q1 j# f6 }
3 Y( S6 k0 T9 x6 d$ E( g! EThe following one is the simplest:
* w9 r+ t, ]! W9 o0 m+ T
8 R5 H$ x1 [3 D8 W+ u    mov     ax,4fh3 J0 Y1 Z  {2 V# d5 a
    int     41h
/ Y  r% {# u2 j; N3 H    cmp     ax, 0F386
- l$ R7 p8 s" [9 u5 a: N1 _    jz      SoftICE_detected& E! F! ^$ q: i- S) C: _2 d3 v

( ~: }, V) b) ^
$ y4 M; {# ]' a! }$ e% UNext method as well as the following one are 2 examples from Stone's
  E# k+ {. j1 u"stn-wid.zip" (www.cracking.net):
% ?7 t7 E% J, V) Q, V* n2 g( ?7 O! f& {# Z9 f+ Y0 ^' c- v% ?
    mov     bx, cs
$ [7 m6 @* o3 v. [3 Y' W, T% K, v    lea     dx, int41handler2  Q/ {6 k$ Q# o/ K" \( _+ ^; |0 K1 ^
    xchg    dx, es:[41h*4]; j6 r8 F% C! ?, G
    xchg    bx, es:[41h*4+2]1 m( f+ @$ y) ]0 `7 k
    mov     ax,4fh
. D- l6 K# f6 ^; C2 H    int     41h
5 h- r& q( W% H5 F1 w, x: F    xchg    dx, es:[41h*4]- v: N2 H& ^* b# @
    xchg    bx, es:[41h*4+2]
1 M" J. U: K( U* z/ W! w! t- W0 l    cmp     ax, 0f386h, X0 {) F/ R" i: e# j7 z
    jz      SoftICE_detected7 r9 }: B" h0 ^; p

; T+ P  E8 V% u& n; J" A- Kint41handler2 PROC
  A. Z  r4 d+ T) r! u    iret, H0 m: O6 Z: k/ }6 J+ a
int41handler2 ENDP0 n5 d3 `2 C2 q; p( M

  C/ u+ k8 D' S. O- M" b& h% Y" n
# C: e7 R3 X" T9 O+ Z, {_________________________________________________________________________
# \* f1 }5 P( m' c8 v2 Z2 N
( V% [7 {- m( @3 X; J' @8 m, _4 |# m' E# {2 F. x
Method 06! Q1 P" E1 g7 x8 R. J, }
=========
$ `2 ]& r* K& |, l* }. v! l( F: ]6 A& ?/ r- b4 W8 c

+ v% g% `$ S: q; f2nd method similar to the preceding one but more difficult to detect:
2 T& [: v# v7 m- Z  ^  j0 ]8 K
7 P. k8 v# k5 m# ~- |* h$ E6 |$ c) x! S
int41handler PROC! N. l& }8 j2 `2 H7 E
    mov     cl,al* I, L! @; X0 G' Z6 _4 i# O
    iret4 x- v' b! z% H
int41handler ENDP
- A; y( v7 a# r* i2 e
0 N# a: F( }$ w2 [& C
3 m& g3 p4 y) e, W    xor     ax,ax
3 v; r$ f- R8 }( ^    mov     es,ax
, f' v' y! m. l% j, B    mov     bx, cs
% e7 \$ [8 }% X8 K; F0 y& h    lea     dx, int41handler
3 b4 j; t! A3 E    xchg    dx, es:[41h*4]/ o5 F( r0 z3 ?1 t0 F& O1 y" \
    xchg    bx, es:[41h*4+2]* o3 S/ \, t1 G& t2 v' o$ [
    in      al, 40h# \' m) A! g, ^6 q' e
    xor     cx,cx8 C1 C- P3 c+ s2 h  H. k7 H' G
    int     41h3 c8 ?) x* r8 j
    xchg    dx, es:[41h*4]
# x* Z/ t3 W+ F    xchg    bx, es:[41h*4+2]# d: h' b: e+ t% h
    cmp     cl,al+ S1 I, P* ^, |! ~( S& T& o
    jnz     SoftICE_detected2 {4 K" J1 x% ~$ u
+ Y# L  E$ L0 K$ y- {$ y6 [
_________________________________________________________________________
- O  W9 I( c, \6 f9 X8 C3 p7 N' u$ t/ Y+ H1 f7 O6 P  _' `
Method 07
1 A7 f4 b7 M& \+ u3 B2 u=========5 t3 W" q# ]) n/ M. C# F& Y

4 T/ k! f% @5 G! C, dMethod of detection of the WinICE handler in the int68h (V86)
8 h0 D2 P4 D6 @# \
, P3 i7 d6 T! P, y    mov     ah,43h
: V4 H9 u! {' ^, U    int     68h9 G0 v  b) U, W$ [( J
    cmp     ax,0F386h$ `7 U9 G# k: L% X
    jz      SoftICE_Detected
7 B/ H4 s( q9 E" O
; ]9 V0 V" l. ^% K" z" C7 V+ L4 q2 y7 i5 i' u1 x( u. T
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# u. `# r8 u) }
   app like this:
$ Y) B3 J' k  ~8 [3 C3 S1 R2 D6 {, @# Y9 e. n
   BPX exec_int if ax==68
1 R! C5 y" X3 Q! M+ _+ c1 E- Z7 f   (function called is located at byte ptr [ebp+1Dh] and client eip is6 J6 D# f$ F; t) \% b. h) x' M
   located at [ebp+48h] for 32Bit apps)
* t! G3 Z1 K+ l- k5 H! u__________________________________________________________________________. |2 S5 J" q8 ]! W, Y  w

, u# a# ~/ u. _% w  I1 y" Y: D6 t( u& s  O9 n% _, n
Method 081 V/ Y' j2 d; q* f) z
=========8 j! m  K4 N( E
3 a3 _1 q3 v0 b; I4 J6 ~
It is not a method of detection of SoftICE but a possibility to crash the6 b9 }& }6 Q) I7 q' c+ }3 L* ]+ b
system by intercepting int 01h and int 03h and redirecting them to another8 _- D' L; S: x- z- q% e
routine.
$ S. z$ s6 H7 j* }& u* Q. T, t+ _It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 S- u; d- h7 N! @" V
to the new routine to execute (hangs computer...)( z2 O4 p/ e5 r. H: m! F% l

- n- r' y; Z) L3 j: P( v    mov     ah, 25h
$ L: U  D" U; G" L+ a( Z1 n3 {    mov     al, Int_Number (01h or 03h)
% `  h* L5 J; G2 g    mov     dx, offset New_Int_Routine! z' D5 @5 a, \
    int     21h
8 d9 _0 s* d( q, R9 q1 g) C) r# K$ g0 C
__________________________________________________________________________, o+ X: x3 L. y) A& x$ W9 w3 y
" O" c' T7 B. _0 Y* G' D
Method 09
- u/ p& N- U/ R* x2 w) C5 t. T=========$ o5 H+ C2 r  Q% J
! V/ s$ a5 s5 {0 H# F5 v! \
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ E) N+ ?$ L" K
performed in ring0 (VxD or a ring3 app using the VxdCall).
& Q( }7 v1 [1 z' m8 x  F4 lThe Get_DDB service is used to determine whether or not a VxD is installed
- c$ q: k4 t9 R+ E+ gfor the specified device and returns a Device Description Block (in ecx) for
3 z2 L+ r) G8 R- qthat device if it is installed.4 z5 n, X1 y5 N" L- x5 t4 Y  S

( p/ `/ s- s1 u" t   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: l! h4 P! n. P   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 C8 M. }7 x6 W: _8 y: z5 z% L   VMMCall Get_DDB* m9 ~% w4 o8 \& b/ q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- B6 y+ G- ~* }& S. @  Q$ h; K$ O7 _: k* R
Note as well that you can easily detect this method with SoftICE:% ]+ I& J; N3 ~6 e3 A( U0 V- K3 [9 L
   bpx Get_DDB if ax==0202 || ax==7a5fh
" A% ?; g2 M# Q4 R7 D/ |$ M' V6 H2 c0 D" B) p* M! B% d
__________________________________________________________________________* O  B7 j. D% `0 _  F( G& E! f! t

& B1 s% T. |& Y) j2 H3 A' k9 s0 qMethod 105 a1 U7 v8 n! F1 t4 i" |$ e! K
=========+ X7 J4 _. D, a) b5 u" ?
- b3 }: J7 H3 x4 e  r% Y% }4 R
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! s0 H& U5 u0 s! P' H( _
  SoftICE while the option is enable!!
9 l9 J/ m3 U9 X3 q9 u, T* \* ~. K4 I) I
This trick is very efficient:
4 x' N7 G; P& F- f( ^# d- Pby checking the Debug Registers, you can detect if SoftICE is loaded# |" s0 E* ^& `8 _9 \; y" g
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: A# B2 Y- g/ h$ O) F- l( rthere are some memory breakpoints set (dr0 to dr3) simply by reading their. j0 \4 V# M2 s+ ?  a0 R
value (in ring0 only). Values can be manipulated and or changed as well* O# o0 u( o, c, `
(clearing BPMs for instance)
- u+ k$ q( ?6 u. I* E: p4 l# d# z$ I+ P) J# P0 x
__________________________________________________________________________
4 [7 A2 D6 K" }- `* h* o
4 \9 u& ?8 h  q, p, ^; {0 G0 xMethod 11
7 z  @6 F1 Y- T, |( G' a=========
! X& ~9 g' F2 r
! q' E, L& O1 I$ tThis method is most known as 'MeltICE' because it has been freely distributed) K$ a& Q, N8 v- n+ R
via www.winfiles.com. However it was first used by NuMega people to allow2 C) O' b5 V% w+ S4 |2 P
Symbol Loader to check if SoftICE was active or not (the code is located' o0 n0 O2 ]# F4 {
inside nmtrans.dll).
) c0 z8 P9 j) c& V2 W+ N( R6 k
: Q! Z; v7 S2 o. o, C3 PThe way it works is very simple:
/ M& j  X2 i. B4 j( \! NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 a3 L) v# K# C* @7 g& O$ O
WinNT) with the CreateFileA API.! y3 w4 {% B0 T: O
" ~& O6 f! `  ?1 b5 I
Here is a sample (checking for 'SICE'):
5 s5 w! Q; q- o) o- U) N* E2 |$ l- Z1 S  J3 U3 V
BOOL IsSoftIce95Loaded()
- d% W/ {) i& m/ n. F/ U. V2 J{5 k  \2 s+ P' h" n
   HANDLE hFile;  
. A! H: j/ L- C   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE," g6 h7 G( C# h
                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 t& C  _* ~: d: Z9 H( z1 ]9 l
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( f* u1 `0 e# |5 Q7 e   if( hFile != INVALID_HANDLE_VALUE )
1 h: S: Y- n5 J1 E- L1 }% C  }" P   {
$ z3 D: @% b% H/ _# r2 E8 ?      CloseHandle(hFile);
9 X; ^% l% `7 Q1 @      return TRUE;! M1 K$ w2 X! {9 c. R
   }
1 e4 v+ A7 P# X& `7 o  ~2 Q7 Y* D   return FALSE;; s7 }" l4 ]1 U5 f+ G4 K# q9 }0 [
}
. |, u3 s& J! d; ~
+ C) I5 _8 c: x( l$ k3 ZAlthough this trick calls the CreateFileA function, don't even expect to be
# v2 D( H( E+ G( Q+ R) S( Jable to intercept it by installing a IFS hook: it will not work, no way!6 @7 c. o6 t, J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
; R- q" I, \  C& v! wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ |% g: N- Y; _2 d
and then browse the DDB list until it find the VxD and its DDB_Control_Proc7 r& E" Y! l3 K( Q9 g+ a
field.1 Q# C) \1 b% d* G
In fact, its purpose is not to load/unload VxDs but only to send a
+ P- O5 R" S* a6 Z7 hW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( [6 d# t4 E! U6 S! D/ O, R& ?
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 p3 n9 ?, i0 h* F, Dto load/unload a non-dynamically loadable driver such as SoftICE ;-).9 Y. D  ]1 ?  c# \' y; ?( w, S1 b
If the VxD is loaded, it will always clear eax and the Carry flag to allow4 Y# L. w& T( J( j$ v8 @+ ^; P9 T
its handle to be opened and then, will be detected.
8 L0 h6 X7 X  |0 L3 w- z: O. _You can check that simply by hooking Winice.exe control proc entry point
% C- a; x1 m4 e* Cwhile running MeltICE.+ H  ?7 [; j/ n# _* U; [
/ Q, n2 Y/ M1 L& i2 i. ^
/ ^5 w) Q/ k0 P3 i2 W1 j6 L
  00401067:  push      00402025    ; \\.\SICE
! W- ?/ \1 I  u! S  0040106C:  call      CreateFileA/ N8 w) U" y& U  y0 x: l, ^1 w
  00401071:  cmp       eax,-001. M4 t3 o3 d( r
  00401074:  je        004010913 |3 P( r) y+ ~* d) y% {$ H1 A( M

8 A7 M% [! l# b: K3 Z& a+ t, r/ t/ l* Y3 c5 M9 T2 y- u
There could be hundreds of BPX you could use to detect this trick.
/ J, ]( T' h, N' g% P-The most classical one is:
8 v0 ^0 q; f/ U4 w- I  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, v  I, ~" b2 S& v    *(esp-&gt;4+4)=='NTIC'
$ Q- f2 P8 [. _$ V4 }
$ z; D. w& G! M- Q/ w; n-The most exotic ones (could be very slooooow :-(# B; q/ u4 i. w' X# O2 P
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 \7 }# V# B% Y; H     ;will break 3 times :-(% O" ~! G7 H. P% Z) f0 t, S) p; J
6 z2 o" j! F; U) M9 b3 V* g, [; p
-or (a bit) faster: 1 p* x2 w/ r" a2 v+ N
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 p1 r- s3 ]- y) e/ y6 j
8 r, Q2 @" ~6 F% g% c   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
  Z: N. z$ N7 v$ n  K     ;will break 3 times :-(1 D' o6 q, _* Y

& N& m+ X  I- X" g-Much faster:$ }0 {3 \4 B  C0 I0 r7 h$ i; q
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! w/ }- t2 ^" i/ @( }3 U) s
" a7 y5 v$ T( D# p+ v! z8 SNote also that some programs (like AZPR3.00) use de old 16-bit _lopen' J( d4 h$ R- n
function to do the same job:( H+ v3 W" F1 K3 a+ h5 P; |

( K6 H9 s4 @! ?+ x: [" N* a   push    00                        ; OF_READ
7 B$ I2 r2 ^+ ]5 X0 q3 O% I   mov     eax,[00656634]            ; '\\.\SICE',0
' q& a$ h" C, F8 y) i3 e   push    eax$ a/ y4 y& {7 D; f% ]1 L
   call    KERNEL32!_lopen3 @* {! y# r! M! @/ [" j/ K# s4 r
   inc     eax$ A& C, Y6 a. M2 ]' B1 L& C/ u  ?1 J
   jnz     00650589                  ; detected
8 q1 E2 H9 Y8 a% e   push    00                        ; OF_READ9 V6 t; Y2 [) Z7 |8 T2 {
   mov     eax,[00656638]            ; '\\.\SICE'
: X4 ^# c; p6 p" F8 L# Q, P   push    eax( i8 Y- t! P: _3 r; O- ]
   call    KERNEL32!_lopen
! B( R+ ^+ L6 M3 v1 F  T   inc     eax  W. x$ q& N! X
   jz      006505ae                  ; not detected
6 a! r8 d- y' V: e$ ^. e, m" D1 v
& i& I5 y4 \/ \6 S
% q4 q+ r5 M  K6 U__________________________________________________________________________& m8 D7 ~4 o5 T, }
: Z4 y  ]4 e+ }5 }: W
Method 12
3 x* {) h" {5 ]/ ?# I- e=========
- k+ l, y- M0 d+ r
8 U% X$ t$ P) ]This trick is similar to int41h/4fh Debugger installation check (code 05
) r" q! `% E8 ?( G) z/ i&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* l6 p5 {, Q1 Q. w. W/ k; D6 `as it uses the VxDCall backdoor. This detection was found in Bleem Demo.& J& s/ V" m9 S. H" l+ n( G5 T
& Z2 o4 V' y8 |" L  m
   push  0000004fh         ; function 4fh6 L: H; w1 A3 D% E( Z
   push  002a002ah         ; high word specifies which VxD (VWIN32)
6 @$ f& e$ m  `7 g; R7 b                           ; low word specifies which service
4 I% |1 Z# A8 R' N) b' e* d* u5 U                             (VWIN32_Int41Dispatch)( O3 p" T! ~  }+ \3 w, J" s  I
   call  Kernel32!ORD_001  ; VxdCall
( J3 s* @0 Y+ X  J   cmp   ax, 0f386h        ; magic number returned by system debuggers
. a! Z# t& F! E& t+ S1 f1 s7 D! E   jz    SoftICE_detected
- o( ?0 m/ k8 \$ i. L) t! x/ L' g$ u' }2 ]
Here again, several ways to detect it:& ^/ ^  y* g# O3 \/ d! O: e0 d: F
: _# Y9 Y! u, I7 D! W- Y) M6 N3 u- g
    BPINT 41 if ax==4f; F; M' Y7 ~4 Z) H% [7 J4 G# I
$ }- @! Y( n+ I
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 y/ ^* O3 Q8 @# G# J% O- x4 E

9 f5 F( I' e' O6 W. A* y3 w    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
# ]2 d' t) c1 F0 {
( j; n- h8 K! h) p% h9 ?    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 q4 t8 m* H: q, ~+ b  Y; w( Z8 s; B4 u% E+ I3 t2 h/ l2 F
__________________________________________________________________________& s' p' w/ K# c* E2 v. H

0 d) C2 ^# k1 k; a0 g# }Method 13
0 N1 Q1 a* p7 ^, Q2 L=========
2 d* z4 _7 X  G7 m, V# Q4 n/ {" f; i; y- r9 {
Not a real method of detection, but a good way to know if SoftICE is# I3 C2 Q% A1 U# n# p
installed on a computer and to locate its installation directory.5 M" w" j9 h1 t
It is used by few softs which access the following registry keys (usually #2) :
4 Y8 [! D3 d* [# h8 b9 ^# o2 i3 {& A
% g1 ~8 a- N& {-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 B: O( q2 R+ t& N. X* k1 v/ i' Y\Uninstall\SoftICE
7 W8 h' t7 o: F) p, E7 i+ z. C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# x/ p$ c: \+ W% b2 H-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' ]2 s- \/ e! h0 D$ e
\App Paths\Loader32.Exe
3 `/ M( ?; o& Q- L! h/ F& I1 V0 I; y( ]2 Z# E$ I. C
& T7 O7 k: ~6 ]7 N0 W
Note that some nasty apps could then erase all files from SoftICE directory4 j# @6 T5 S& N! m! d
(I faced that once :-(1 z) a  S& Z7 x

" _" x. [" U+ z/ _2 p/ _Useful breakpoint to detect it:' P6 M9 G( i& Y$ D
# I7 J8 y) k4 E6 a1 K& p; c
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ \" ^: Y) ?8 H7 v* A7 c0 X, ?
. ^; f5 Q/ x0 b' V- P+ J+ s__________________________________________________________________________
4 Y1 D3 T+ b; C3 P- x4 G( T: g8 m5 `- P! {: T, g
% r2 g6 o1 I' T
Method 14
  I- @. F( ~, X4 E=========
% y( S: h9 w. V( A# A1 C) [, K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ v  Z1 Z" M: h: c5 a3 k9 a. Fis to determines whether a debugger is running on your system (ring0 only).: _/ p/ S6 J1 E. T" P- ]6 k
1 o( w" \- n( M6 t9 e" y! b. ?
   VMMCall Test_Debug_Installed
0 f) R8 F. x' q5 D2 b5 ]   je      not_installed  _/ ^* F+ M+ i1 |0 W

- h  \% s/ E" G1 S2 v  DThis service just checks a flag.0 K/ f$ m( Z) V2 p1 o
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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