About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ L, }- ]3 c9 z' K" E" g% i
<TBODY>
! J, D  H; {0 @/ E<TR>
5 T% g: u% F. b+ j  T<TD><PRE>Method 01
. N3 l7 p' F! [( j0 u=========9 N7 r6 C. f% ]% @. b" ?4 h8 r, c

/ |* B; C" [+ J& p# [% R6 H; eThis method of detection of SoftICE (as well as the following one) is
. a& C+ y% D, m( iused by the majority of packers/encryptors found on Internet.
8 M6 U: s3 r# w% t+ G4 JIt seeks the signature of BoundsChecker in SoftICE; ]6 |7 j; I* j2 d0 K3 u

/ x( {/ b+ N) s* ~3 h3 Y. K    mov     ebp, 04243484Bh        ; 'BCHK'
, V! Q$ p% l; U  p4 o9 F( @/ P    mov     ax, 04h: Z9 G) m+ `# m6 ^; Z
    int     3       ; u2 _- L- C& f$ {
    cmp     al,4
  ~2 j& D9 D) E    jnz     SoftICE_Detected
9 }4 i( W' ~8 Q  g  h1 ^
. ~! N( D! J. a* M___________________________________________________________________________# S6 o  y$ D4 m

/ u3 V3 z* C2 a; `6 jMethod 02" T) [/ L6 Z; ]+ F% {' R
=========& B3 V; g& A: i# \* r0 x3 J$ J5 w
/ G8 {" h( f. P) \+ \
Still a method very much used (perhaps the most frequent one).  It is used
5 m# e+ H" m2 l  n) t% G% T$ ^to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ o/ w6 y: c! g# Hor execute SoftICE commands...
3 U' c1 o' X. l7 ]7 CIt is also used to crash SoftICE and to force it to execute any commands
0 N6 B' b9 p; X) [: n(HBOOT...) :-((  " j- \# \8 f. v) X/ K2 B) ]! N
% L5 n3 L& v8 T! t) Q# f
Here is a quick description:
! m8 |4 {4 i. t; F! }-AX = 0910h   (Display string in SIce windows)2 l/ h5 a  g: ~7 D7 a9 f- ]
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 W1 R1 o( E) I7 N0 M& h3 }; l) ?- m. d1 I-AX = 0912h   (Get breakpoint infos)
& F# m  Y6 f7 P( {/ @-AX = 0913h   (Set Sice breakpoints)
' C/ X. l  x/ F* w/ x; @. t4 C: ?-AX = 0914h   (Remove SIce breakoints)
. V/ c% Z3 H: _( }* J1 F  f( S0 x; I+ B9 L0 G4 }
Each time you'll meet this trick, you'll see:, V+ I* B: Y, \2 b' _6 O
-SI = 4647h
- w0 P! ]3 r$ U, D5 |-DI = 4A4Dh
2 Y: p& @$ e# pWhich are the 'magic values' used by SoftIce.% z  T6 o7 r) T5 p+ V8 F$ `6 D5 t2 s) Z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* M/ j# n& x- k1 Y& l0 d

' \2 X& q# j: y7 F/ Z! mHere is one example from the file "Haspinst.exe" which is the dongle HASP
# H' Z6 T' j0 y: H: S6 V# dEnvelope utility use to protect DOS applications:( J2 J2 D# ^8 p! c4 z3 q% Z
- A7 H# u9 n1 `; u- u8 t2 r

5 t  N* l3 E* f1 n1 V/ B) Q. ^4C19:0095   MOV    AX,0911  ; execute command.8 n- |+ {( A' u, g$ r+ n
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 X. S' d/ x% A2 @9 U' k% t4C19:009A   MOV    SI,4647  ; 1st magic value.
' w- T$ z! Y  V- k( n  C4 s' u4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- \) n" Q4 B% J, D6 E& q6 N4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 J% r: v+ S4 L# t% f2 p4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ ]" S% X( o) n4C19:00A4   INC    CX# `1 j! B9 e* Y( G3 D' g$ r  l! t& b
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# ~; D/ }0 U: f& y4C19:00A8   JB     0095     ; 6 different commands.
0 P$ i, i- Y" e# z  n4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
5 N4 I8 m) u9 C# ^  k3 o4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
* A; Y; O, F0 O. y- G
4 I' ]/ Y' v. N. v8 d% [The program will execute 6 different SIce commands located at ds:dx, which0 y8 x, B, d2 L$ D  s# Z; [
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ D* `# J) M6 `( N! @2 P7 u& V* [, _8 l4 X% T  R# B$ I
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., w5 V1 i8 n* C7 b% u) O
___________________________________________________________________________
4 N* a/ U6 k  ~" b7 a2 w1 m  ]
/ ?2 A3 J# w: |; O8 n+ E' _. S" g
Method 03
1 ^) `5 m" o3 ^, V3 ~" L=========+ t. O; C8 ?* V! a

$ G, L0 T9 M" U6 @  XLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 E3 ?2 T' `* P$ ~(API Get entry point)
; E( R9 U# V6 n1 E# X        
. B+ |4 q% m" M3 {: e* m3 o: q) y2 e8 q7 C; ?$ ?: f% f
    xor     di,di( E2 D: e, v4 u# ^# k. m# c2 A; P
    mov     es,di
$ O8 _% m$ h6 p) L    mov     ax, 1684h       1 V7 q# \0 J. K) f
    mov     bx, 0202h       ; VxD ID of winice7 s% l% A) x& f6 l" U$ Q
    int     2Fh& b: W8 Y6 G' G' O7 `2 w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 F9 x! e# \& k( d7 t: w% f( k1 n, ]
    add     ax, di
% o3 Q/ ?1 |/ j! w    test    ax,ax
) \7 R5 \1 d+ T) y; R    jnz     SoftICE_Detected+ V' o( o) F/ W$ U6 [; `# I+ w

3 U1 A6 p8 \; j5 X___________________________________________________________________________9 r3 i) q/ T* X5 m  P2 ^

5 F. x  ~+ Z/ l) U# `. H) O# oMethod 04
/ E  O$ z. v+ A! [' I=========7 G0 o$ A' E' p, V3 o4 j, o" }5 B
4 ^' q8 l" j: m) ~  A7 Z
Method identical to the preceding one except that it seeks the ID of SoftICE1 Z7 D7 r8 a, ~7 N$ O( N
GFX VxD.
8 A9 n0 t( @2 a, @; k" x6 Y# G' \
. `1 J% N. G: d" N+ I* P# A    xor     di,di
: ^  G3 R1 T: t, p/ {% a    mov     es,di
; X8 r, c/ U  A    mov     ax, 1684h       8 P" ^; E1 E  f1 {; b
    mov     bx, 7a5Fh       ; VxD ID of SIWVID" O; v  g% N; u9 T8 K$ m
    int     2fh
/ O$ [0 R  A& s    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# h, K  J9 y" ~1 T4 ~    add     ax, di
- y: x' u6 ^" L5 S2 I, o% |    test    ax,ax) J+ ^+ s  O, }* x! W+ ~' G
    jnz     SoftICE_Detected' l  W. p4 M- J8 ^9 @5 S, W  T
& p7 O5 `* M! T0 f  `6 B
__________________________________________________________________________1 L# x" K. ^. f; E& A9 X  P2 U5 i
) L( u7 f5 Y1 a- o/ C

; H+ g; m* D! F7 WMethod 05' }7 g8 A( p8 p
=========
! l! z8 _) x" a- m7 ~8 e* q2 Q' l( u8 O
Method seeking the 'magic number' 0F386h returned (in ax) by all system
' s! i$ P" ?9 g; m" ~! Qdebugger. It calls the int 41h, function 4Fh.  j& D! F* D: `  |
There are several alternatives.  
- c# Z0 @! w6 a3 q
  m& ]( E$ Z! w: B5 v5 |The following one is the simplest:- Y- g) {7 Y$ U: l! h/ p- F
$ T  V* e' n: e$ L
    mov     ax,4fh: n, }/ K! y+ f0 H  q0 @; k2 T* q
    int     41h1 M7 h8 M+ U* P5 W% D& J( F: a! k
    cmp     ax, 0F386: N1 E& _+ c4 B
    jz      SoftICE_detected  Y: Q4 N8 D- L% t
$ @: b/ K. W  N8 \+ B  y8 M6 L. }
. O7 ?3 t  z5 N4 W2 L
Next method as well as the following one are 2 examples from Stone's & m0 o, {' p2 i% N, d
"stn-wid.zip" (www.cracking.net):
8 Z, y. n. R: l( {/ c8 d
8 Z: s! y% n0 h0 G; u! }    mov     bx, cs
$ d7 R8 @2 ~* I9 P7 F5 M* C2 ]    lea     dx, int41handler2
  p- p$ b. ~+ x4 i    xchg    dx, es:[41h*4]
1 y* @7 T: Y% D1 U    xchg    bx, es:[41h*4+2]
, J$ j4 K& V( }. ?3 ]    mov     ax,4fh
3 N0 Q7 H5 v, t- v    int     41h: g% M4 F1 \8 w6 [
    xchg    dx, es:[41h*4]
6 F3 c  N" ^. |/ M    xchg    bx, es:[41h*4+2]) m9 c5 l# r% J! m
    cmp     ax, 0f386h1 f8 V6 y( d& u
    jz      SoftICE_detected
8 R9 R- B! {& ]2 x6 d0 `; N# c
9 m1 n  R; [. A0 S8 ^8 jint41handler2 PROC
9 W9 a  w4 R: [  y, N3 y9 s    iret4 c6 Z2 \/ [1 q6 @9 S, f' f
int41handler2 ENDP
% `! l' b# u- h! R0 q- d
. x4 N- F0 e3 t( H, y/ h3 @
* R9 G- M0 V4 l, j0 Z4 ]+ ~_________________________________________________________________________
! X1 J5 X& X: ]* P; c
4 T/ w1 O' i) m$ S& j
3 \% b$ Z. Q5 s  \. D, [Method 06
9 P4 \: g! ?$ I, [4 g+ `=========' c$ P0 U% @) O  V9 `2 _
% H+ i5 q( B0 _+ ~% C9 i
: e! f# ~" `. G' u) K5 _( m0 L
2nd method similar to the preceding one but more difficult to detect:
/ P5 {* x% X% N+ E  N' O) P( ~( p: m/ f2 b
( @7 Z2 W% M& S" ?0 P
int41handler PROC
7 x' y; t) e$ {+ j/ t! A" Z    mov     cl,al
$ T8 ~; u, X( Q/ Q) _& Y" Y/ [+ G    iret
' B* l5 b. t. gint41handler ENDP
; R! U1 s9 {& E
; n( t9 D4 q3 h2 {! l7 ]8 e7 U9 c9 u5 G1 r
    xor     ax,ax2 N! K3 b% m0 T3 [1 \
    mov     es,ax
  c0 V+ O3 _, ?3 Y/ L    mov     bx, cs4 e3 d9 i) k1 l
    lea     dx, int41handler
7 \4 b$ n# m7 y    xchg    dx, es:[41h*4]
) D7 W) O' z9 j- \7 K    xchg    bx, es:[41h*4+2]0 o; P# n) P% C
    in      al, 40h& R; _2 Y) H9 G* [, K* v6 H8 h$ T
    xor     cx,cx
$ O9 u2 z( I$ L. T9 K% u) r    int     41h
' l5 R% y( O( J( ~7 `    xchg    dx, es:[41h*4]
/ @% s' z. |2 [# V9 p! {' F$ ^    xchg    bx, es:[41h*4+2]
4 T5 @4 y, H) b- g    cmp     cl,al
+ c! w5 A; f% M: Y( r/ `0 c3 v    jnz     SoftICE_detected) M, F4 z* {& q" y& |7 A
/ c7 K" {" s3 i+ _+ g8 Y: I7 T  I
_________________________________________________________________________
1 n" ~" N3 x9 q3 C7 o2 f: m9 }0 m' Z5 U2 z9 k
Method 076 K$ W0 I) i7 R  a9 L
=========" S& E) M: c# a8 U+ t- _
9 ]& z/ _# @4 V; y+ P0 N, j
Method of detection of the WinICE handler in the int68h (V86)
2 C1 l( E  H! a) ~: \, Y
5 W4 n* m( {7 l' f/ U6 L' P) _+ k    mov     ah,43h
0 r/ D6 h+ A3 M: S6 g7 q    int     68h
( z2 G% m% V) o) \$ z  i1 x    cmp     ax,0F386h
1 y3 H$ U, j! w  r: N0 ]/ P    jz      SoftICE_Detected) O1 m7 x& ^* s5 h9 [0 w

6 d  A7 P6 M5 W4 I" D
) X2 X8 X' \3 q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 ^0 T% b$ m/ |& j% H
   app like this:4 M. N. c" V1 r0 A) f9 {7 ^

( M1 I3 S0 ?! @) R   BPX exec_int if ax==68+ Q2 P) m" \) s1 d8 [! @
   (function called is located at byte ptr [ebp+1Dh] and client eip is; A* i7 I+ Y$ R- \) n; Y
   located at [ebp+48h] for 32Bit apps)  ~4 Z& ?; T- W- }
__________________________________________________________________________) S; Q3 k' s" t" F, K' b8 p8 h/ q

4 |+ r) }- W4 S, U& n
. a2 A9 b6 R. F" fMethod 082 G8 ]5 `% B) {  O
=========. e# Y+ t4 f) e
* _  n6 o# q6 E) b* v& |# p
It is not a method of detection of SoftICE but a possibility to crash the
; U7 K7 l3 Y: V. E- ^system by intercepting int 01h and int 03h and redirecting them to another
  w: m4 p! @0 ~) e3 [2 Rroutine.
/ Q$ y9 e5 _8 G" ~! [It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: X5 k/ _% @0 t0 G# C* hto the new routine to execute (hangs computer...)
# Z3 {) X( R  @) {8 Q( n# V0 T, |) Y
    mov     ah, 25h! x4 O, B) h5 `+ Z/ O2 M
    mov     al, Int_Number (01h or 03h)
- c% G: ?5 j/ A3 Y* [- j    mov     dx, offset New_Int_Routine$ n: L( W; L3 O& |; V; r
    int     21h2 Q/ w4 A. E1 r7 c1 g7 V" O

3 c- E4 e% f7 Y' v. D0 b- j4 S% I9 N; ^__________________________________________________________________________
, m9 S$ k& B6 H& L+ U: ~8 P! ~2 \. A- \" I4 X7 @1 A
Method 09
. |- c5 Q2 p" F( x. J=========' ^- u) Y: g* G6 G* J( s
/ ^/ h5 D/ ^: L6 ^6 d  ~
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 D5 T. ]9 n; a- c+ J* k7 q9 U' A7 `performed in ring0 (VxD or a ring3 app using the VxdCall).
& z; w9 q. a7 v/ ~The Get_DDB service is used to determine whether or not a VxD is installed
/ ~/ F+ B' t- h- gfor the specified device and returns a Device Description Block (in ecx) for, I; H: j6 b/ v6 T: x# o9 T8 T
that device if it is installed.  I* h# B, S3 J) W

8 }  @3 |" ]3 p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 _; n1 t: A( L3 u( h( g: e" I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): H  m: r5 y/ K' {
   VMMCall Get_DDB
" e  b9 G9 K2 T" o   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ \/ _4 {7 {  }* U6 q% C- E# }- T4 w5 ^. U+ v8 y: f
Note as well that you can easily detect this method with SoftICE:
6 A4 Z0 J  l) U7 k' {   bpx Get_DDB if ax==0202 || ax==7a5fh. ~& p, D* O7 X* l) ~

3 _9 X! k- i8 q+ o6 |__________________________________________________________________________
; S; y& t+ P: }
9 x& n, {* o& a% k1 tMethod 10) r6 R& S1 Y1 C) Y3 V
=========
9 O8 k) Y! M4 k- h+ q
8 j4 y" O6 ^, q9 @$ \: C=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
; D6 e' H4 r5 j  k6 P  SoftICE while the option is enable!!
/ [0 ~5 ?0 |! _5 A9 k5 W! ~
5 v. o  f1 S& a! e4 R; ^This trick is very efficient:) r; H/ z( Q/ F/ }: s8 V; ^3 J
by checking the Debug Registers, you can detect if SoftICE is loaded5 y/ y$ E6 [+ B& D' j( O! l. I2 W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 o- j6 x1 M  T. xthere are some memory breakpoints set (dr0 to dr3) simply by reading their
( }+ C- E& S  s5 B4 Uvalue (in ring0 only). Values can be manipulated and or changed as well
, P8 o( V& F- G% s- B- O(clearing BPMs for instance)
5 Q: l7 b2 _* _' |. S- Q
5 g" L9 u7 o: h1 Y9 u__________________________________________________________________________1 z1 O* p) K; m3 P, Q

) `% ?! w  M! K6 L% bMethod 11
6 v) P2 |- C' N, M" H* T$ R6 S7 a=========3 `+ H) C" B. T5 T. b
8 O+ E/ P3 t, `
This method is most known as 'MeltICE' because it has been freely distributed
0 t8 n: O3 w4 o3 Jvia www.winfiles.com. However it was first used by NuMega people to allow5 W6 F/ `, d1 m) w% F4 G3 M
Symbol Loader to check if SoftICE was active or not (the code is located" x- q- P% m" g6 v0 W: n+ T! h6 u5 v
inside nmtrans.dll).2 B9 y# C, `7 t  N$ `) V
' T! p+ ?. {- E3 i$ W
The way it works is very simple:2 T! t2 i4 u9 I# v" z* x- P* w1 R
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! P% d% H& H1 {  w3 G+ v1 V: [
WinNT) with the CreateFileA API.2 S4 y6 p7 M' J( L8 C8 z& u
/ O% f0 `7 r, p# J7 o& y) D' l
Here is a sample (checking for 'SICE'):
& @7 m+ B; s- s3 L2 ~# i* c/ C. I& l! g  Y
BOOL IsSoftIce95Loaded()& T* E  t. Z$ D' u1 C
{
3 G1 D" \( J1 L9 w+ S& Q   HANDLE hFile;  7 r# `3 {% Z  N+ S/ [
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! h3 q, U% ^. w5 z- z& A                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ {4 b( U( l7 D& B0 ]                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  y, ]1 u" i0 ]& y  i8 E3 ^3 m* b
   if( hFile != INVALID_HANDLE_VALUE )3 L; l& f' n9 i7 G, M/ }
   {0 e0 u0 }' u% C
      CloseHandle(hFile);' {9 B" X0 i1 ~5 R+ z5 x
      return TRUE;0 n) I9 }0 e! [1 ?5 d
   }& e' |3 M) }( _" K- ^0 a3 ~  x
   return FALSE;. n- z# o, A% z0 d+ b% F, [' @
}3 [9 f% r: W/ P2 e% @8 q
: s9 b9 d1 ^) O. z9 D8 f' ~
Although this trick calls the CreateFileA function, don't even expect to be
  q% d, T5 J& ^' Hable to intercept it by installing a IFS hook: it will not work, no way!- E! J" j0 ?- z! ~6 a3 n6 K
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
; S' r; k3 V2 E3 s# S; g( Nservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; T5 g. H; ~$ p: y3 x9 S, xand then browse the DDB list until it find the VxD and its DDB_Control_Proc
; E+ A% y& x3 e5 J6 bfield.
& u8 p- x; g6 a5 r) g' {In fact, its purpose is not to load/unload VxDs but only to send a 1 K) h5 o9 G4 ^
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% T8 F2 E, j! z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! `# Q8 i& i8 q/ s% D# g4 Lto load/unload a non-dynamically loadable driver such as SoftICE ;-).* J0 w- b; u1 _8 I) n& Y$ |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
9 Z( m9 y6 e7 Y0 A$ Q4 M4 i" K- Bits handle to be opened and then, will be detected.
2 e0 O5 p9 o$ q: D; J9 AYou can check that simply by hooking Winice.exe control proc entry point
. o  [% J3 H2 ^- l6 |while running MeltICE.% v# x% x- l* i, A) b

1 o1 e# t9 l  x9 ?$ @
, V+ Q9 B. R, T7 h( m# z2 Z8 b  00401067:  push      00402025    ; \\.\SICE
, F' g! k; r4 A2 P  0040106C:  call      CreateFileA. U. c0 [' X( [1 r
  00401071:  cmp       eax,-001
$ ^6 j  _" t. U/ T" p  00401074:  je        00401091
/ B/ D' g' b  S! D" l* ~: g/ ?
7 G" T% l3 z+ A2 _, Z& Z( W$ X
% X! ]4 `% W7 C& G4 aThere could be hundreds of BPX you could use to detect this trick.
& _& P! m' ?9 z  ?-The most classical one is:
! ~! C8 t! h2 _0 o, i1 [  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" ~; Y* F) {$ {0 t5 ^! w7 E2 i
    *(esp-&gt;4+4)=='NTIC'2 F- X- S9 _7 A! g8 ^8 Z: F

5 X. i8 @8 I8 T0 X-The most exotic ones (could be very slooooow :-(
5 ^5 k0 B: J" ?9 L7 h/ E9 y5 \+ s   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* T+ r3 g. q2 U; }. L$ E) e( _     ;will break 3 times :-(
0 a  A% S% _9 d) x) V7 f* A. X
" W) m/ A" H( x& `- s-or (a bit) faster:
. |; [, G5 Q+ w& X0 |7 Z- }. M   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 u  }0 Q# g8 t
! H1 c# \+ a+ `
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 n7 J9 {% `: G' ^+ p( V6 L     ;will break 3 times :-(
  N, C- ]% {; D& w, D$ g0 B
* h% y2 q3 X6 y& ~5 X6 h-Much faster:
1 a+ X: K' A1 g1 Z- v   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', i; F" H! L6 @! E( V9 s4 J" @

  W0 }( |; _) V. oNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 G' M- S0 W/ o. q0 s- t" Tfunction to do the same job:
7 ~$ x" Y! m; `4 L( v
( W; i5 e! v8 x7 P7 d/ v   push    00                        ; OF_READ
) |  V- X( G9 S) Z: L. h2 k   mov     eax,[00656634]            ; '\\.\SICE',0. {( S/ _0 h; t6 n- i1 w+ S; h
   push    eax' k. U: _: b- p8 v
   call    KERNEL32!_lopen) U* f' E5 p: G: e1 E
   inc     eax
# G  B* m- L' l. y7 P* P2 E   jnz     00650589                  ; detected
. m  @8 E$ z$ C4 N: M* L9 i   push    00                        ; OF_READ
9 q  e& d$ _0 g5 ?   mov     eax,[00656638]            ; '\\.\SICE'
3 r, _. C0 X: v1 P) y   push    eax2 |2 I9 C- _# s7 v
   call    KERNEL32!_lopen% ]6 [2 N2 K7 {0 G$ m# C/ O
   inc     eax% ^, r; F# r2 w7 _
   jz      006505ae                  ; not detected
" H9 P$ s; Z  U: A0 D8 K7 Y2 R; _+ R. C8 L+ @8 U+ v& T* v

, \& {; `% \4 T3 c/ b$ Y__________________________________________________________________________
" l3 u2 }  T+ y! H  R3 x4 E2 c  n" ?% f3 z2 a0 [" Z. n: I
Method 12
' t6 g  q1 y+ J5 H=========1 R% E% G1 y9 s, u6 T

  S* z' C  n* h4 [# J2 F+ TThis trick is similar to int41h/4fh Debugger installation check (code 05
/ D. {. l7 k3 a1 l1 Q1 p" Z1 ]- N&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( }  p, y1 l; O9 _% s8 A7 k$ D7 z2 vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.1 w$ i1 o' ^% M$ o$ l, d
& s  U! ^- F: s9 V: K- [0 p
   push  0000004fh         ; function 4fh5 V5 t( P' U! e( `
   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 u7 G5 h' d9 |9 M! n1 _7 V  x5 i                           ; low word specifies which service
. Q: A6 ?) `: Y% L" p# P$ |2 z                             (VWIN32_Int41Dispatch)5 T# \' Z# W* Y
   call  Kernel32!ORD_001  ; VxdCall% z* C; F  E! s! n9 e
   cmp   ax, 0f386h        ; magic number returned by system debuggers3 @) R8 q) P' s
   jz    SoftICE_detected
; z/ m8 i6 F( C5 @  O' X, r
, X- l5 M3 F1 n+ zHere again, several ways to detect it:- v0 f$ O8 N% s" Q
8 U) b2 t1 i9 x4 J  _+ M: M) r3 A( _8 L
    BPINT 41 if ax==4f  K9 X' W: N- o: t  l. s3 p
/ W! L& r2 I" Y- G: _
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( A7 l: a  V+ V9 i

& N& L/ W, @5 p* {8 w, X. o    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A$ Y. e/ |/ G$ s* W
( q2 ~  S9 z9 |& g% C0 b/ p- Z
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' g9 X3 E% w% r9 r

* d4 ]* m9 Q9 w# ~! k# l" \/ b__________________________________________________________________________
. |$ ~7 x) l6 Z% r$ y2 I
* Q6 g' A7 j0 B. r1 A1 X; |0 N+ bMethod 13
& i  L( k1 ?5 i5 e, ^  R=========
8 G5 |2 q+ x- K3 C9 `. F
% \' v. T" _+ r3 g; I2 v; LNot a real method of detection, but a good way to know if SoftICE is
; x  V% w+ v/ ?# \! Y4 n$ ^installed on a computer and to locate its installation directory.4 X8 y: s0 e9 k) G
It is used by few softs which access the following registry keys (usually #2) :  F& ~- D0 d4 z4 T: H1 u1 d

2 n7 B: `8 ]/ M7 E' f1 |. K3 w& H-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 t7 I5 x( Z$ K" U! A+ d3 H
\Uninstall\SoftICE
8 q( y8 L: ~8 I4 ]  A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ l: B0 K- C" n4 x, Z' w: o, u  v
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ O4 K' T; z4 ]9 S8 Q\App Paths\Loader32.Exe" r! F7 y( C; q$ D; G+ `

" ^% I5 o! ]% D9 F- {# P) v; S* K. Q5 o$ E
Note that some nasty apps could then erase all files from SoftICE directory
5 w" h1 Z1 E0 x( }(I faced that once :-(
" D9 k/ m8 ^5 ?" ]0 w8 `, O$ I4 T* s1 }% O" P
Useful breakpoint to detect it:: b7 J5 P% K; |5 A. ^2 {
0 T/ y0 |* J- `9 h
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  ?! S6 a( l- @4 w+ Y
0 q* J6 @4 Q0 z* X__________________________________________________________________________4 k8 O8 |7 A1 a$ ~' j& [

$ S5 x8 a, u$ ?5 j5 m  J; w3 V; [4 f( l; x/ I) _) D
Method 14
, `9 t. N1 N- D& v=========8 _1 B% m0 c8 M
3 V2 |# s1 M+ H/ {* |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 r: u7 `  t; |4 a$ u4 g7 A8 |/ e
is to determines whether a debugger is running on your system (ring0 only).
+ b/ q7 f( V$ \6 X! a$ J
- x) n; e5 k$ l   VMMCall Test_Debug_Installed
  n4 R0 |; q' y9 \# X2 e   je      not_installed6 D& b9 l6 ]* I+ A/ ?

1 T" Z- N0 n: R3 ?' X- x" |This service just checks a flag.
3 N: m/ J6 N/ y& `# }: q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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