About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>7 U/ f5 |6 D, X" P
<TBODY>3 ], y. Z' v+ [3 z) l
<TR>) g) h+ ?1 k! j4 E2 S
<TD><PRE>Method 01 : G0 g, ]) n( c! L' k7 \7 a
=========
! K7 w" I0 L0 F3 o% Y
' w* a7 D9 z% d& Q0 @This method of detection of SoftICE (as well as the following one) is
- H9 {0 ?1 R% E* G+ y# `! vused by the majority of packers/encryptors found on Internet.( @8 H8 W5 n" |3 Q4 _- o
It seeks the signature of BoundsChecker in SoftICE
" ^) ?4 R2 M! D, M" ?0 g4 `& V5 p4 G! S
    mov     ebp, 04243484Bh        ; 'BCHK'
+ {2 n: ], V% `: p' |4 T    mov     ax, 04h+ d7 N3 T3 m* C! N* u" o
    int     3      
; @- b( ~" |$ U* }/ F3 ~    cmp     al,4
+ k) I& |1 I. t  T$ |8 S/ q    jnz     SoftICE_Detected0 m  W  X8 M. @) E
1 R4 j. B' v* a, O
___________________________________________________________________________
) {4 `  l. K8 x  v% ?. l# l- Z, g6 R6 t2 @6 P/ L' z% O
Method 02
- P8 x! {% Y" W3 Y* [( e( G=========
1 V8 ^; U; o- v9 D* E* D) U4 o4 G: I, Y: m* S+ r! B
Still a method very much used (perhaps the most frequent one).  It is used
/ A  E% ]! Q& n$ }4 U2 x( h6 t' uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ r7 `8 Q7 r* s+ I; [- Cor execute SoftICE commands..." C: |6 [  s( G0 O# g
It is also used to crash SoftICE and to force it to execute any commands6 Y- r: c1 a" V4 U! ~" {
(HBOOT...) :-((  1 Z  i' j$ [: l/ \: G  r; q

% J% x$ C" l) Y0 I6 MHere is a quick description:. ?3 K  D6 D  v- ^% x0 J
-AX = 0910h   (Display string in SIce windows)+ A5 c0 I* i/ Z$ O
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ c4 q9 u- @3 _$ N- K-AX = 0912h   (Get breakpoint infos)
! |! o+ ^5 x+ ~: K, a% N-AX = 0913h   (Set Sice breakpoints)
. h+ s# s* S  T* r* I9 Z; s  y) {-AX = 0914h   (Remove SIce breakoints)+ G4 y3 ~; s3 L9 C5 q" Y* I6 x
# e- ^8 g/ e+ ?/ p8 N" T7 f0 y
Each time you'll meet this trick, you'll see:
7 d+ T& P; S8 F-SI = 4647h
7 ?  q2 u6 G2 Q7 e& b# M-DI = 4A4Dh% v% w% q' q" \$ ~
Which are the 'magic values' used by SoftIce.3 [7 ~" h$ B4 {5 ], C
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 e0 F/ m' H' b" {% j0 }. N+ N. f  ~+ \' q% f
Here is one example from the file "Haspinst.exe" which is the dongle HASP
* ~8 o  F3 v, ?6 S. ]: rEnvelope utility use to protect DOS applications:. |$ V. o. h" ]/ H1 H9 ^, g! [0 f

5 x- S5 m9 S# V; m, b. X6 D2 e8 I3 y; G1 N( l
4C19:0095   MOV    AX,0911  ; execute command.& h3 V/ @+ U, r5 @
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
8 F- t3 i- O+ _. S3 S: Q4C19:009A   MOV    SI,4647  ; 1st magic value./ O0 R/ w  ]/ x6 e
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 G& C8 M/ H* p' R$ Z, w  c
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 K5 c$ N% x0 c4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute' A% \& O: P7 p1 W
4C19:00A4   INC    CX/ z; K; p0 U3 A' H; |
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ n; k3 Q9 g$ I+ e( P  r
4C19:00A8   JB     0095     ; 6 different commands.4 d8 D5 p# F& n5 t$ N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% [# n5 Y3 I7 L, @0 Z4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 s$ h; \: e. y# N  H  c' {+ j
9 _8 s* J. N4 b% u6 eThe program will execute 6 different SIce commands located at ds:dx, which2 B1 |. p; X7 ^, k/ e# b: E/ ]
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 [( f- e) r. }3 B$ `. Q
+ l; q; B( l& {! [+ _. o% V; r
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 m- L1 m* w1 Q1 E7 W8 s% B___________________________________________________________________________
% R2 R' Q) J- \6 E6 b( i( b* p
" L% \- G5 w) m; K2 C2 C, R. d) O- [! ^- ]
Method 03
- N- z. W, B6 `=========
$ p2 _) K0 e# O
) G( @) S) m' W& Y, f4 q/ vLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) X' N; f/ o' ~: Z. h- P; j  Q
(API Get entry point)4 T; I3 s# J# @# d
        
1 p! T, u1 F+ E- Y( Z9 `8 k* Z9 g' B: V. R
    xor     di,di- y3 k* O5 l/ z% U4 c2 j
    mov     es,di8 q4 ?( h" B; h- C2 M) h. ?& b
    mov     ax, 1684h      
' g; m3 a% f' J* l3 L' d3 j" B  s    mov     bx, 0202h       ; VxD ID of winice  S7 G6 p0 e. c
    int     2Fh
3 k- M* l! Q7 Q3 V5 V: i    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) z8 {6 S: T; K' N7 P. p    add     ax, di$ |" U4 l+ D: }  q# U
    test    ax,ax
0 l  i0 ?4 d. E    jnz     SoftICE_Detected" g' M+ e& G' f  b! V9 q
' z) g1 Y# R0 w0 `& s  |- _, N
___________________________________________________________________________$ p5 ~+ o, u1 P. Y, i, A& x* _

+ ~, e- K$ X/ ]* v2 w* o! h( EMethod 04
5 E$ G$ G/ m5 @4 o- q. b=========7 J2 s* H& j# |" ~& P! H  _' g
; r" q* E2 b, u) K7 s. z
Method identical to the preceding one except that it seeks the ID of SoftICE, N6 l4 V! L4 F8 j" r4 M3 m
GFX VxD.1 `0 N, Z, C$ i: z3 A0 _

( t2 F  @+ C( u    xor     di,di9 W+ Z: O2 g/ h* n$ I3 C
    mov     es,di
! @2 ^' Y0 a/ ]* M    mov     ax, 1684h      
& ]7 x% V; b1 s8 |  t: f2 G    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 t4 c6 o8 E! ]. x2 u1 S    int     2fh
9 B2 v3 u* v- ]& o6 E+ k3 k* U2 U" E1 Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; O, m* Q: {6 A" [1 G, _) R    add     ax, di/ e1 J) M! H- T2 A% G
    test    ax,ax
+ ^5 {$ D8 w& X5 ?3 L! l    jnz     SoftICE_Detected
8 b. p( U; F  g* s
. W3 K, }9 Z, k. u# ]__________________________________________________________________________
  H4 u+ l: c; V) {3 _2 Y" {
" M) l8 [  n: V5 x" {9 V) N
. u+ u, N% F, d" G. iMethod 05
9 h* i( ~% `. Q; p# n- ]=========
; {8 y  [+ V6 W+ a2 |# X4 |& a2 e  e1 Q7 H. O  B
Method seeking the 'magic number' 0F386h returned (in ax) by all system3 Z0 V- g0 e# `, d) P
debugger. It calls the int 41h, function 4Fh.; {* _! c3 j3 p3 c4 u
There are several alternatives.  * s6 q$ M, f3 b/ U

' U/ @) S( g% T# xThe following one is the simplest:
/ o$ j. [" W) J" J- X7 z! l
' Y. U3 F7 s: A    mov     ax,4fh
# a! r; p/ a' m; z9 O0 b. J2 d    int     41h
( v$ H! z  N) ~' S3 b    cmp     ax, 0F386
" `0 H2 e6 [& q    jz      SoftICE_detected
; ]1 t8 e5 g  s! C( h1 R# y' c7 Y, i0 I3 \4 b/ R- r  w# h

6 B, K0 |7 Q4 D4 XNext method as well as the following one are 2 examples from Stone's ( K! y2 q( v* s, H0 w; U. X
"stn-wid.zip" (www.cracking.net):
! k7 f7 S; g& ~& S
3 |" \4 H% U1 v& R* V. G: q    mov     bx, cs" v3 _- s6 n! ^6 ^) f" O- @
    lea     dx, int41handler2; J- b: T3 p! |+ |$ x. w2 L
    xchg    dx, es:[41h*4]: G$ Q  i2 f" S& B% d" j* V
    xchg    bx, es:[41h*4+2]
' A  a6 W4 {9 {9 J8 p2 I) }& s    mov     ax,4fh+ G- f% d/ N# n
    int     41h
; @# W% J. b6 e# X    xchg    dx, es:[41h*4]1 F* C) f$ c4 s2 O: T* i
    xchg    bx, es:[41h*4+2]/ }5 h' r  I; _# ~: ?) _9 L
    cmp     ax, 0f386h. t9 T/ y4 P9 S  v9 L
    jz      SoftICE_detected
5 s0 r% d% p* Z# o- G; U: o1 q( ?' s( h2 ^) q  W
int41handler2 PROC8 |6 x7 W7 z- G7 Q4 B* }7 B  x- |
    iret# N: |; D# q) r: F
int41handler2 ENDP
; ~' E" I* Q0 \7 w
  f. B- \7 B4 ]6 o, K$ }( Z) B
& K6 c- v7 x* Y! ?0 V7 y2 w. k- y+ I_________________________________________________________________________) ?$ S! }2 y8 ^# d+ g* \

( M$ i' {: t! {! i  @7 i& A9 s& ?1 w4 [; c
Method 062 W0 o8 S; u( d) U% H& }
=========& c. v! [3 e4 ]0 U- X
+ z5 Z. O5 z- l: `. q) V& G

$ D: C3 t1 y9 C+ |2nd method similar to the preceding one but more difficult to detect:
; L$ Q% G, G4 D
  P7 G# s  x" K" ?$ s+ Z# ~& S+ Q9 |6 A/ ^% S' E' r
int41handler PROC
7 e; {' M$ l& a9 Y) K. p- S    mov     cl,al; W9 B! y  B% |8 q
    iret
3 j7 S( N  _& O( ~5 Vint41handler ENDP3 g; O" Q# |6 p1 W; f0 U

' _! ]1 J: v& C$ k+ b
; H6 p+ E/ a' N# ^8 u; r    xor     ax,ax
1 [9 w7 a/ ~1 ?1 ^    mov     es,ax
9 ^# w0 g1 x! [' n, a5 M    mov     bx, cs' \, ]4 @# Q2 g
    lea     dx, int41handler& s( w& @8 Z6 ^! _
    xchg    dx, es:[41h*4]
% e% e. ~8 F! l1 `    xchg    bx, es:[41h*4+2]
- p2 P% z! c' T3 L5 d/ w, K    in      al, 40h6 Z+ b4 c3 R) A& f# A( C9 {
    xor     cx,cx! a; o& `: e6 b6 O
    int     41h
8 n- b+ O- f; j* ~# u    xchg    dx, es:[41h*4]% {& r0 b8 s( ]$ E- ]* [+ E. }: l: {. q
    xchg    bx, es:[41h*4+2]* w7 H* N! u" Z3 G8 }/ J
    cmp     cl,al- p1 A1 w$ g4 Q( P4 X! S
    jnz     SoftICE_detected* n+ X6 \' q4 S

; i2 ^7 \3 L* M# C# W& r_________________________________________________________________________
7 G- _9 ]6 U1 b7 r8 z
- G8 ~* H9 w- u$ q+ cMethod 07, y* c$ z1 r, ^3 J
=========. C2 w% K* j& T1 ^# o& W0 o

, r! u9 @% y2 @( H* i' V' E/ }Method of detection of the WinICE handler in the int68h (V86)( Y7 C: F7 c1 y3 K
6 p- c: B  t( g8 F1 b
    mov     ah,43h
8 V* z/ |( j5 j$ ?; h' i8 @    int     68h- i, L% _0 [3 o! |& B7 b
    cmp     ax,0F386h8 l% Z. l' C8 G3 @: g" M
    jz      SoftICE_Detected- L* i+ M# V5 X9 X

0 e+ j$ f% n8 V: E! s5 H) M! j; s% K/ Z! ^5 o1 Y8 C* F
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ U" [) p9 [* M) H3 m+ x: a" A
   app like this:
4 I7 L1 E. C9 e; p" n6 Y1 h5 O. [) r6 j5 L" v2 M
   BPX exec_int if ax==68
5 Q2 |: @! K" Y  j   (function called is located at byte ptr [ebp+1Dh] and client eip is. {" K) ]: h9 O  |$ O6 u
   located at [ebp+48h] for 32Bit apps)
$ i/ s* e$ n# z* W4 D" a. W8 E__________________________________________________________________________  j" Y! l4 ]1 F. r

6 ?! i% O/ N0 j5 Z/ ?
5 H$ D4 S& q, O4 y  ?+ kMethod 08
6 e. A7 ~1 P/ x' j3 Y=========; n! D9 X3 B# x4 o$ m, ^
+ B" h2 i/ L( U6 T
It is not a method of detection of SoftICE but a possibility to crash the% z/ @2 E6 e1 i7 i' t
system by intercepting int 01h and int 03h and redirecting them to another
* _% B+ M, E3 S( H0 [routine.
1 ^& C/ L4 c: U! A' J: [It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. E( {4 v6 z, `8 ?7 [' l
to the new routine to execute (hangs computer...)
7 L; v$ ?- R8 \
6 {! m8 O& f- \( O! ^    mov     ah, 25h
+ z4 U0 n6 r  {# [7 _2 H5 R7 t    mov     al, Int_Number (01h or 03h)% f$ E: E, C' N! _8 M8 X6 z' Y9 f/ T% |" E
    mov     dx, offset New_Int_Routine
, x, p9 ~: D+ Z" K) Y( K    int     21h
& \$ W( ~9 p" N2 a3 s) t* X
3 ^  A2 {0 W3 B* }5 t' j__________________________________________________________________________# k* Z: ^; Q, j9 b5 |- u+ O0 L5 H
5 Y8 L2 z. ?1 J
Method 09& |% y: I% N: b& X) y+ y- V$ ]) q! o
=========0 h( E8 [% R. w. i* a0 R. C& _9 Z

; t* u+ M7 u$ O. L7 v+ vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% k; V7 i; c' m% _. qperformed in ring0 (VxD or a ring3 app using the VxdCall).# z6 ]4 f% j8 D# I
The Get_DDB service is used to determine whether or not a VxD is installed
5 `) Y% s$ }; G& v3 [- x9 h! I- Vfor the specified device and returns a Device Description Block (in ecx) for& }& V$ I5 b9 p) ]) u0 |
that device if it is installed.) h9 l& }' x4 j2 K
* T$ o7 J1 Q: w& e
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID5 G! u1 Z3 w8 o/ \  w& F
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): k9 H! L3 Y! \" A1 @( S6 c
   VMMCall Get_DDB2 V; O# t6 M$ I$ L; T7 m( J
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. b$ |! j1 B* }$ y# x
; y: J. L8 p" l5 p# x. w# b. UNote as well that you can easily detect this method with SoftICE:; K- o. M4 F& N3 E. r
   bpx Get_DDB if ax==0202 || ax==7a5fh
) e' y2 {8 V" o$ D4 ^
7 D3 B' I8 m' P+ e' H" Y$ x3 E. A2 g__________________________________________________________________________
" }  t4 A. Z* u- a
- B; \4 i9 z6 \9 j  d3 \+ TMethod 101 O/ }& P. _/ W+ d9 b
=========, O; k: |) }4 }
. m$ x! y1 b0 F2 z$ n- o
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 Z# u! _" ?. j; B! Y  SoftICE while the option is enable!!! L! [: `" Z8 X/ ^
( w/ T) t5 A/ F% f+ o
This trick is very efficient:' u* t+ e% u" G  y/ f' g0 P
by checking the Debug Registers, you can detect if SoftICE is loaded( J& i8 W3 H) |( A+ f
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 _$ ~$ g# J- ^* M2 x. O1 m' t, I: uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
3 O2 J4 O: t( g/ n$ D" Rvalue (in ring0 only). Values can be manipulated and or changed as well7 b" F% O7 L4 r2 q" x! D
(clearing BPMs for instance)' M, O; H" f) x; f

2 s4 J9 C& V9 H3 Z" f" ]__________________________________________________________________________
7 k5 e7 Z& S8 n; n9 \! b5 W1 p& ^
& P" P( S5 W( v3 h5 i' f+ [$ R6 m; rMethod 11
/ C1 e( M- L8 K/ T4 w+ T=========9 P9 c* b3 N7 U: |1 y9 m' u- k

0 M# Y/ R% a; B9 n" iThis method is most known as 'MeltICE' because it has been freely distributed
. U+ x2 S7 D9 H+ f4 P* rvia www.winfiles.com. However it was first used by NuMega people to allow
0 o% v+ P& X! xSymbol Loader to check if SoftICE was active or not (the code is located* I) d7 w9 a* N) V
inside nmtrans.dll).
/ S: E/ w$ N) L* l+ {1 r; W6 @1 L. m! g1 v
The way it works is very simple:1 p$ k4 U0 Z0 U/ V
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
  y, E& S' p: I. A$ I" H3 p& i0 nWinNT) with the CreateFileA API.5 o/ G) s, M/ e/ K2 R. s

$ [9 s8 C- m; PHere is a sample (checking for 'SICE'):
) N9 ^1 }0 A8 l. D$ u' b: s
' k! B! P: N4 {( T8 v5 LBOOL IsSoftIce95Loaded()( ]5 q3 G: H$ L5 z' Q! n! W1 ]
{  X! l. R9 B) }" ?1 _: }$ N
   HANDLE hFile;  2 h! o* T* _1 b2 E! G/ |
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 F/ u# q- i, s4 }) ~
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 T/ i' I' t6 M' J2 u. M4 ~% J% Z                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 D* p0 |1 V- _% L# F   if( hFile != INVALID_HANDLE_VALUE ), m; M/ u$ J  X8 K0 d
   {
0 y* ~9 j! W/ x% B  ]) ~# I      CloseHandle(hFile);6 N( A. f9 ]* N# e9 U# F
      return TRUE;3 W$ l$ T' Y2 {9 e& l; V; F4 _
   }
  s' p$ D4 p! G/ W   return FALSE;+ k$ {3 I! Y+ _" V- u
}
# G* `" J. T- d0 J" y6 U4 X+ n9 v* f/ g$ X* }8 t
Although this trick calls the CreateFileA function, don't even expect to be
) c+ z& R# O. G, l: V5 [able to intercept it by installing a IFS hook: it will not work, no way!
) ?% L2 M3 A7 dIn fact, after the call to CreateFileA it will get through VWIN32 0x001F4 M, O$ u; L  s# n
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
' ~4 t$ _0 b1 ^" @9 V+ Z3 Hand then browse the DDB list until it find the VxD and its DDB_Control_Proc
1 H# Z& g. M- f3 F# Afield.
" F; L$ ^; I% CIn fact, its purpose is not to load/unload VxDs but only to send a
$ \' ~# o3 ]; O9 x- d% YW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 X  f: g, ?# C# S0 j& Z& H
to the VxD Control_Dispatch proc (how the hell a shareware soft could try8 s0 C5 c6 N5 e" g
to load/unload a non-dynamically loadable driver such as SoftICE ;-).' j! C' W) D0 `0 H* H
If the VxD is loaded, it will always clear eax and the Carry flag to allow' r# H2 \: g  m/ ?$ S% B
its handle to be opened and then, will be detected.4 [% a, l0 R2 Z
You can check that simply by hooking Winice.exe control proc entry point* M9 A' n' d- K) z( Y0 w, U) Y" S
while running MeltICE.
" `) I5 b2 a$ w1 h  n: r  x
; z* G/ O+ D  O& B$ r. w$ R  y* {7 x
  00401067:  push      00402025    ; \\.\SICE$ G/ T7 R, ~0 w- q: B7 m. t0 k
  0040106C:  call      CreateFileA
. p, P/ _$ R. c7 u' d% A$ o9 J  00401071:  cmp       eax,-001
. Y  n$ t  j& p$ L" J) Z  00401074:  je        00401091$ Y2 m" }0 h; b& _& W2 b" x5 \( k
5 i' X9 ~: h2 z

! Z" N$ W( p( X! |  WThere could be hundreds of BPX you could use to detect this trick.
5 F  t0 Q+ \7 c6 ?-The most classical one is:
' A) c; d; c( \' V: y1 @/ c  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 ~, G( }+ [: g' ?) W    *(esp-&gt;4+4)=='NTIC'$ s3 f- @: |6 Q7 p+ K
3 F, e9 o4 |: c9 n0 E6 _
-The most exotic ones (could be very slooooow :-(
, s+ _/ q& i+ _! h  D% o   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  # o$ t2 }. S: A* X: d
     ;will break 3 times :-(
  p+ j0 y4 S. B" r2 M+ ^4 c& W3 u, I7 E2 ~* `6 g/ o' f
-or (a bit) faster: 6 g/ K' C& F( n
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ h% ^7 X& [3 _, i
  ~# p8 g+ N, f( m( @   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 R* B) Y- _9 A     ;will break 3 times :-(
" j) K% O* E, z0 E$ r2 u3 M
! D8 \$ q; X" Q* u/ j+ l/ p-Much faster:$ ]% B9 V( i; B; H4 i) |8 Y% H$ N4 W3 G
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', n9 L5 S( c. f  o* }( t* X7 p
1 G7 j9 n4 i" ~0 A' n
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
; i. J. e& ~" lfunction to do the same job:
8 s% ?4 I$ \8 b" J% h* G. U( `: A' m  q3 L# r4 F" t' ^
   push    00                        ; OF_READ/ m8 v2 m% c* J0 p0 e
   mov     eax,[00656634]            ; '\\.\SICE',0
; _+ k$ H% M8 o- Y3 u( d   push    eax* a5 z9 I* K7 J& y/ C3 y
   call    KERNEL32!_lopen
5 s& p( M; R: c* j# k% u' J# q   inc     eax2 y/ j4 F% j) a3 I
   jnz     00650589                  ; detected+ I8 r5 Y# a. I- A: v# l
   push    00                        ; OF_READ: P1 c" Z* t; I3 @7 [' u
   mov     eax,[00656638]            ; '\\.\SICE'9 I) D6 ]+ S8 }
   push    eax6 m# V' I1 z' A9 L2 J" D+ e1 B
   call    KERNEL32!_lopen
, z% u5 E  U% L   inc     eax; K5 K! K2 G. D
   jz      006505ae                  ; not detected
! `- U8 C; s2 h9 ?" j' ^; k; R$ D9 ]6 g+ P( v1 L
+ h4 _+ m* v" l* ?: z
__________________________________________________________________________: W% I& V  _, e' z

$ c' n+ y# |7 u0 W" }Method 12
! @/ t) x2 w" J4 S0 a" V/ @=========$ o- a' g. T- P1 X) A( R
5 \: U& N' R0 ?3 }' u
This trick is similar to int41h/4fh Debugger installation check (code 05
; D( U+ b& [+ R; |9 z7 d&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ _4 A! U, O  h. j. L1 Y: z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.% X- N% j1 k, y- M" A9 O5 Z
" ?& h$ b) y' h* p5 V7 x& s
   push  0000004fh         ; function 4fh
* Q5 @* R# p) d, n* @   push  002a002ah         ; high word specifies which VxD (VWIN32)5 n2 x: H* \) A9 U# t
                           ; low word specifies which service
( b$ C* ^5 {- R/ |& c" D; J                             (VWIN32_Int41Dispatch)
4 R& \3 I: @/ h' U2 R8 T   call  Kernel32!ORD_001  ; VxdCall) x( \3 g2 D. @( ]0 F( @7 S9 e% N5 A
   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ w* J7 f6 ?7 Z   jz    SoftICE_detected7 n5 M+ U8 I, k* p2 g
3 b! X: K) X) z+ l, ^& B
Here again, several ways to detect it:
! S) G0 `  K* D8 V4 w) _( i. c2 C8 o
    BPINT 41 if ax==4f
2 n) e# ~2 _/ M8 m" o8 ~1 d- ]- j" V; }7 x; ~* v) j- t4 Q
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* @2 s6 G6 D# m  n2 E) U0 c* b4 S( v$ R
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 X8 I, T9 z+ a4 K. O  O3 f1 v
; B9 A' \* ^) V/ y! p0 ~/ @! @    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 o; b9 O7 @6 A2 f5 \; u5 D. `

0 a9 Z" Z6 h- v: {! \__________________________________________________________________________
/ v' ?- q7 J/ T% p+ V" Q' Z0 T, C2 s: T' Q0 v
Method 136 j' Y  @/ x# U6 i9 x/ F" k" S
=========; f2 I' R1 x6 m3 x5 |
1 V% Q+ ]3 R; L1 V' X
Not a real method of detection, but a good way to know if SoftICE is8 G6 W+ s2 j9 |6 A7 }! @, W
installed on a computer and to locate its installation directory.  s/ c4 J! n2 y( }0 }+ p
It is used by few softs which access the following registry keys (usually #2) :+ x( p3 O0 [  }& U% r
* ]6 N6 H; v7 ~; u
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- b- j6 a$ E# S3 J; _+ ?; w! j" B
\Uninstall\SoftICE
9 h# d6 {( }+ `-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE0 d# a& ]) J; t- Q6 \# n8 @
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 g- `  D$ d# Z0 O9 G
\App Paths\Loader32.Exe! {! Y( }$ n% Z9 n
7 |2 {0 Z) s9 |; O: e; K" u

4 e/ x3 f4 g6 H1 PNote that some nasty apps could then erase all files from SoftICE directory
4 d5 ~' H5 g0 G+ [& B(I faced that once :-(
# K6 `& t; }% g# d& n5 g+ U! q7 T/ K& P
Useful breakpoint to detect it:
9 U1 O# o+ n8 Y2 Y9 l1 R- w% \
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
( e+ D; p, O: n* a
; L/ l" m. h- T$ E* @; f__________________________________________________________________________0 K8 E5 C4 ~, P5 c' B; F
1 s3 v/ R$ D% r8 M- H+ r2 q0 F: o( C

6 E2 D* P) y7 `6 jMethod 14 & K. q1 y; \2 G0 _
=========
5 l2 K- Y; `$ B4 |5 ?* |! J( V
3 \" w0 H; b5 j4 K  B8 c9 ?+ LA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( o& C1 k4 }4 ?! c  A; v$ N' d3 vis to determines whether a debugger is running on your system (ring0 only).! T; p! T/ Q+ a) A9 F# L$ S, o' a+ J
" k" j% U% u  T. S
   VMMCall Test_Debug_Installed
  P* A- T2 r, A* v   je      not_installed  y5 J& H0 u5 c( n

  {1 P6 Q/ L4 H2 w6 Q) [+ OThis service just checks a flag.
% a4 T. M3 s+ y7 N. }$ T! M5 O2 z+ [</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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