About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 A2 |/ a  c* ^1 E
<TBODY>4 m2 u0 F& P- s0 W2 Q# e  m
<TR>
2 J4 R/ o) Y/ ^% d. c8 F" T& Z1 j<TD><PRE>Method 01
; K1 J' _0 k3 u=========8 t' m# i  l7 \( l9 n- S. o
1 o& e! q' D7 F4 P- }; u
This method of detection of SoftICE (as well as the following one) is
( Y- B' u5 N8 w8 ]1 v/ s0 e( `used by the majority of packers/encryptors found on Internet.
. k4 M. l; M1 V. P9 ~: j$ @( W$ b- n, NIt seeks the signature of BoundsChecker in SoftICE
/ q' Y5 f( w/ K- w1 m5 t% v( x% r! Z( I3 z$ O; _6 T5 f
    mov     ebp, 04243484Bh        ; 'BCHK'
3 K$ g+ `% `) o; ?. q. y/ J! e  ~    mov     ax, 04h; t* H  I6 r' Q
    int     3      
. e$ T( h8 o* @( h$ E0 ?    cmp     al,4
+ J% Y. q( @4 s* A$ L1 |    jnz     SoftICE_Detected
* H- a7 `% H0 z$ o7 h% c
1 g0 q/ e+ D# @! ^- k$ K8 g4 J___________________________________________________________________________
) z/ Y, E3 C% U; {# W( d
! [# Q+ T( N: C5 V8 }Method 025 X/ h0 W* G) i8 `9 _
=========0 f# q4 l5 \8 G. l: [1 I

" O1 q1 z- U5 f4 A( {Still a method very much used (perhaps the most frequent one).  It is used
! X2 J6 S, T0 r4 bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ f6 J: ^% H. T9 p$ k0 dor execute SoftICE commands...8 x9 l& O  e/ D
It is also used to crash SoftICE and to force it to execute any commands
, i1 y/ q0 G/ _4 ^$ s1 ^(HBOOT...) :-((  ( t2 ]1 o4 s, l
5 m& u8 a% S6 X; A) e
Here is a quick description:
/ P% O2 d, O8 t8 R7 l1 f- V-AX = 0910h   (Display string in SIce windows)
. a* [& q5 [+ h/ \+ I-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" Z  b4 [* F# \: \. k
-AX = 0912h   (Get breakpoint infos)7 e6 @& g8 V: l7 i, H- r
-AX = 0913h   (Set Sice breakpoints)
/ S, j& U1 H5 F, W-AX = 0914h   (Remove SIce breakoints): M5 b* n+ |, D) f, f+ m
$ T) x% O# z6 V/ t6 a
Each time you'll meet this trick, you'll see:
7 U, }- N1 w/ I( d+ O-SI = 4647h' e( N5 K4 m/ N9 v- X
-DI = 4A4Dh! y' i2 X- S% b! X% V
Which are the 'magic values' used by SoftIce.
9 V7 x, a- g5 u4 c0 vFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 e7 e& F; D( f" q& D2 l+ q* \
3 ~2 j% ]- H6 E) m9 p# k7 o, x% G* r
Here is one example from the file "Haspinst.exe" which is the dongle HASP  z4 ?6 k+ L9 P( x1 }8 L$ o% t+ D0 |
Envelope utility use to protect DOS applications:5 p+ ?0 w1 N  x' u+ J% X
) Y$ S5 R8 @7 f" ^

/ z9 R2 N6 {. l2 @8 y4C19:0095   MOV    AX,0911  ; execute command." v  m6 T5 }! w6 r
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  Q& P  z: n7 M( @4 ^" }# [" c4C19:009A   MOV    SI,4647  ; 1st magic value.
: o" u  p- ]: p6 _3 v4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. l5 ]& f. {* f. Q3 T3 ~4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 z3 w7 l4 K4 M  [( a2 r
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! [3 B4 ^" `" Q6 c, m1 p4C19:00A4   INC    CX
' k( ~* F3 e5 v( J: ^: B3 }( t4 r4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 \% a" v* F3 T* _6 q. @8 t4C19:00A8   JB     0095     ; 6 different commands.* ~, C* x- c, }/ p/ `
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 s" f( R6 R0 q) F% o
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 ]( }  E9 M1 d% D/ q* C
; ?" c4 k- [  `6 I, C& SThe program will execute 6 different SIce commands located at ds:dx, which
" Z! v9 ?3 o% ?: Y$ B" f. hare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.( W: f9 B( F- r! r7 I$ S2 R

6 p. s' x& b: v1 x2 N( q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
. C% `0 I6 @9 Q# j___________________________________________________________________________! M$ N( J4 @& l7 z  g+ Y3 @

* v: W- Y. v% v0 N2 t' k' W
# {7 |5 y# [0 S6 y$ f+ DMethod 03
' Q# }' ]2 j- E8 F# J3 Z=========
1 F* ~) S: K! u. M1 j
4 \, E" y! w: j/ V- L0 jLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 q, i" F) s  Z' @
(API Get entry point). ~9 ?* D3 P" j4 [
        
$ I8 m% h( O. w9 X$ B
( ~8 ]4 u  v8 t( c0 L' Z    xor     di,di
: ~+ ~9 h& n% m  w$ }- V    mov     es,di" |) g; l+ l. }
    mov     ax, 1684h       - g! t3 c0 `8 v  g- S+ {# z
    mov     bx, 0202h       ; VxD ID of winice$ U; |0 P- q. y- \  t" z  B
    int     2Fh) i4 i. ~, h% A6 r" }' j, z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 W* I  t! d+ S6 B& N- M    add     ax, di( k8 D6 J+ u% D
    test    ax,ax) J$ G( q* l  {. P3 _
    jnz     SoftICE_Detected
; p. p7 r9 n3 T8 [& k: W; N9 D) C% e, f& ?1 A6 {- y7 s0 \2 |1 @
___________________________________________________________________________
& a) |- I6 M' s1 s- b& S+ G# `5 X/ I5 p& n2 o; f* o
Method 04
  z: L: z9 y% f1 a=========  [% E3 x5 I8 x. j
) O! m7 C* I8 `
Method identical to the preceding one except that it seeks the ID of SoftICE
$ S; S  t9 ]7 _) V6 |; d% gGFX VxD.
# K" O' F4 s! P9 {4 n
' L: r1 m7 Y. d$ b    xor     di,di
6 g$ S$ V3 O1 V8 A( d! v; h- A    mov     es,di
: W" T. {9 H" u# e  @' t9 D4 g    mov     ax, 1684h       " `4 J$ G  L6 A* P+ A
    mov     bx, 7a5Fh       ; VxD ID of SIWVID" J+ [. C2 M: N" {, b  H. R( c
    int     2fh* g: H( s. g: G5 _8 i$ C4 g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) N+ \$ ~+ D6 d& ]( O6 I    add     ax, di1 N9 e; t! {6 U1 X2 O  P( X
    test    ax,ax
& ]) _* a, H" }; t1 K& T    jnz     SoftICE_Detected+ t, n4 [) n4 `  N2 `. I

6 M8 K* e2 C/ B/ H3 s$ c, C__________________________________________________________________________
8 m5 j. @/ f# D3 Z, U3 Q9 ~  m- y$ w8 i

6 ?+ W, R: Y$ ~3 g1 U- OMethod 05
  R6 A* E8 g. Q6 `# s* T=========
- R5 Z* _+ n7 D1 b3 j
, _+ {4 }' r1 DMethod seeking the 'magic number' 0F386h returned (in ax) by all system
- m7 y- k% v. u7 C' k& Ydebugger. It calls the int 41h, function 4Fh.
1 r/ m: c$ l& B' P$ _There are several alternatives.  
1 O  j( o. C* M4 l" `( m# B% A" A3 T* Q: M* z
The following one is the simplest:
, Y# v& b/ v4 Z0 H, j" J2 W; U, U& I& e+ N" n5 O
    mov     ax,4fh
& E  f# |9 q0 @4 J; H! G    int     41h4 I$ g: g4 z6 K, z( A" P" I
    cmp     ax, 0F386
6 `0 D0 q* `2 q) [    jz      SoftICE_detected
( M8 @. L/ R0 N- G
/ a! Q: _4 p9 e- U: q
( M! h. ^, b: @! M; [; X- @Next method as well as the following one are 2 examples from Stone's 5 n' X$ \/ \( u, g- ~0 p
"stn-wid.zip" (www.cracking.net):
6 o# [3 k6 R3 l6 h1 Q1 ~7 }3 k8 `" {
    mov     bx, cs
1 _# Z, {) M- }3 {7 \, i    lea     dx, int41handler2' ?3 u; z2 Y" j
    xchg    dx, es:[41h*4]
% L, U: S; {; ?. a    xchg    bx, es:[41h*4+2]5 N0 v: w! ?1 P% q
    mov     ax,4fh8 {- Q& N) ?* o. m
    int     41h
! l8 u1 M' L, d) Z5 }% E    xchg    dx, es:[41h*4]3 e* y) H; G; }/ G; h
    xchg    bx, es:[41h*4+2]
+ x- f! Q* x9 G* ?7 o' o    cmp     ax, 0f386h8 b' W: S# c# T0 J8 L4 M. ?7 b# ]
    jz      SoftICE_detected
5 W$ e+ g* w# X- V! Z, c
) j3 ^! ]& P& H  Oint41handler2 PROC
: S5 H* z( E. N+ g4 \    iret
! o  q' m& T, S0 ]* f! p4 Fint41handler2 ENDP
6 i; B! g& O% w! V, B+ {) V! l9 x
2 \1 w) _/ {( \4 p! e  e2 \+ V' B! {
" r. U0 H) L+ t( E# G! j) S_________________________________________________________________________
4 n' M! s/ B1 I3 B0 \5 b$ ]2 G6 v5 t0 s' F: ^
1 F) R4 \3 X# D; S
Method 06
  z. r  R. ]1 [3 w=========
0 ~: W; A3 O  Y3 s, z" e' h7 a' d% [' z8 ?9 d4 A' o% b

- P, l0 O% a, T( g8 ?! a8 z2nd method similar to the preceding one but more difficult to detect:* n6 s; ^$ i1 P9 T* s' ^. b) ]
% k5 ]) u6 @! ^. I" L: ^
1 B- ~( v) \, u6 I- z
int41handler PROC% m2 P" O( f1 Z9 o6 j
    mov     cl,al/ J- u+ b8 m9 Y3 Z' w7 A
    iret
% e. R* c  a9 x. Jint41handler ENDP/ w; k0 R( P- [. J
6 b% o% }: ~/ L8 b4 e. Z( t2 _; r

* _1 {0 [: E! q9 X) F. c+ K& U    xor     ax,ax
7 O: E# I" J6 F$ Z& L    mov     es,ax% V' s1 m, c1 d# [$ z
    mov     bx, cs6 x  F# o+ j0 ^# s6 j. Z
    lea     dx, int41handler
- z3 f6 M' w. f" [  |9 f    xchg    dx, es:[41h*4]$ v" v" x9 ^) k- {- \
    xchg    bx, es:[41h*4+2]8 A5 d  U% V3 O& F% B( V
    in      al, 40h. r$ c9 l+ `8 E( W: M, s# M5 d3 @; A
    xor     cx,cx
2 W8 x0 W/ A. p3 \    int     41h
( [$ [) a  ~9 ~0 w    xchg    dx, es:[41h*4]
% A* F- W2 w2 S( l6 ^/ @3 A6 C" G    xchg    bx, es:[41h*4+2]
) F$ {" W% |/ g% V$ r' {    cmp     cl,al! _  J* u1 ?$ Y/ r! @( R) r2 J
    jnz     SoftICE_detected
5 g) ~$ E( B( G" R8 E! f' t% U6 g$ y0 N. m, K4 F  W
_________________________________________________________________________1 e" t1 `9 p+ ~" ^. t' e

- o3 ?1 ]3 g5 n0 N% z* ?3 Q9 TMethod 07, ?% a& _" b1 k' F% r4 I0 L- A
=========' Q1 T; s* E# ^9 V3 J

2 B+ f! d/ T5 z2 z- tMethod of detection of the WinICE handler in the int68h (V86)4 U) X$ r7 I1 f5 U( U0 ?/ X( x
5 Z6 U9 D2 @7 d0 c' i* a
    mov     ah,43h
7 `* L8 ~+ B9 |( y) p1 Q# o+ g    int     68h
  {: ~6 Z8 i0 U6 i$ b    cmp     ax,0F386h
! u; ~7 b' }, A+ I7 O+ \3 r    jz      SoftICE_Detected
9 B; O7 s5 Y  ^/ L9 L& M# t" X/ W% C) n6 d
0 m; R; t! j- G, A6 `' z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 Q* Y( L2 @7 z$ x; [* D   app like this:
. w7 u3 d& k9 Y5 _" R7 i2 m0 k
" M0 X9 ^  w" b2 D, _. m: b2 N   BPX exec_int if ax==68
& V& |) _" N8 \3 {) B* M   (function called is located at byte ptr [ebp+1Dh] and client eip is* R  d1 |4 T$ Q% Q4 |$ [3 `( J6 h
   located at [ebp+48h] for 32Bit apps)( {" Z6 I) ]( l
__________________________________________________________________________/ W6 V1 v' D* F9 u% s* ]

5 c3 v* @2 l0 N" J9 H0 H$ X8 l, P  c7 N3 a2 i8 k* K
Method 08. R& F, c  ~. \. L
=========
$ d0 m2 j3 k, s
: g8 z' I  j  ~$ d+ x7 O' UIt is not a method of detection of SoftICE but a possibility to crash the0 z9 M6 z9 e" V# T2 r5 o# \
system by intercepting int 01h and int 03h and redirecting them to another$ h5 d( f) Y3 E# X
routine.
( M2 y# D* U& l2 W8 x  `1 i# ZIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ J; x! }: _6 ~to the new routine to execute (hangs computer...)1 b" Y4 I9 R6 z! [# W
$ h1 Q3 y$ C9 @" Y: u+ J4 G2 Z
    mov     ah, 25h/ D. e2 G( J$ B8 |7 A
    mov     al, Int_Number (01h or 03h)
5 _8 Q3 S% G# t3 @    mov     dx, offset New_Int_Routine
% T8 m( R* B' b' o# t    int     21h. u/ c: l) Z! |+ O7 Z* I7 Z

3 A3 W6 w# ~+ ]% ]7 i__________________________________________________________________________
4 g6 F+ c2 u" ~+ z! s( w( S4 u) A
Method 09/ m+ z- G6 c0 y! E9 `" S
=========3 A3 m8 ?9 q/ n- l; `
6 T" o2 l& B( g. A" Q8 a; L' d
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only2 }' A; e* P( `$ z2 h" e1 C+ B
performed in ring0 (VxD or a ring3 app using the VxdCall).
: v- y$ t, u8 Y: aThe Get_DDB service is used to determine whether or not a VxD is installed
7 C) A+ a, d+ L) `% rfor the specified device and returns a Device Description Block (in ecx) for+ {9 M3 N$ Y) N8 H0 {" t
that device if it is installed./ P2 s% q3 N' _
% P: s: y3 k4 F+ L* K
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 d: a( j- h9 J4 |
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% n7 A! m: A9 `% h
   VMMCall Get_DDB
* N' H6 `" v# g2 u* B' ~% @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 a% W& p2 H1 x5 |! }+ _; G0 t* `. w2 X5 D
Note as well that you can easily detect this method with SoftICE:8 v" u0 U8 A5 n  ~( q
   bpx Get_DDB if ax==0202 || ax==7a5fh" n; m; b- x3 C: R" t

  W& r2 M$ E7 w! }( U__________________________________________________________________________
0 H( M5 r, y! ~: _, s+ k; G
% s2 J( e( b& J1 uMethod 108 R4 U5 s* ^* h9 F* f- e, C/ G) k
=========
: `/ a. \* T" ^& _$ m) K# r# |% ^+ |  z5 [
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ d! |' z( s3 H5 |2 k8 G
  SoftICE while the option is enable!!
% W' b8 n6 S$ ~! d9 r
, R7 Z& H/ T8 w4 k, Z1 D; s* NThis trick is very efficient:2 n2 ^7 ^; O6 Z# [- `
by checking the Debug Registers, you can detect if SoftICE is loaded1 r2 {/ w' k1 H: y( f6 i* }" v
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 B+ t, R- l2 K* v1 k$ I+ `
there are some memory breakpoints set (dr0 to dr3) simply by reading their+ z7 c  ^  o: L3 T6 b  C
value (in ring0 only). Values can be manipulated and or changed as well
) n, e, @0 L3 W* U7 r% J: B(clearing BPMs for instance)% j- N7 p2 T1 ~' M: C

5 d3 h4 [. v; Q3 Y: H__________________________________________________________________________. ~! `1 c( E% z' M; X

' e6 x! H) _' a& f8 K) x: oMethod 113 G! Q) |5 s9 e
=========. K( ?( [" ?& ^( k6 p; D0 I, ^
8 w+ N" F# f; P% U/ _$ A
This method is most known as 'MeltICE' because it has been freely distributed
3 a- B) z) |0 w$ wvia www.winfiles.com. However it was first used by NuMega people to allow( R  e( b& {5 [! Y% |
Symbol Loader to check if SoftICE was active or not (the code is located, F6 e" H# q( l9 m) g% g
inside nmtrans.dll).7 x  d0 a2 H& H. y; A2 W
1 H- a# z7 n0 s0 w
The way it works is very simple:
- c+ U/ L, Y5 ~9 f) [# H) oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 k5 c: j4 Y  S, ]+ ^
WinNT) with the CreateFileA API.7 G, K% Z" `7 p! B0 Q% s4 I* K
) A7 [1 Q/ h1 f- F9 N% i! x
Here is a sample (checking for 'SICE'):' D1 ~" B3 w. y) B7 d. F8 N9 L

: S9 ^, x/ S; D) h4 t7 NBOOL IsSoftIce95Loaded()2 K# {) U- y7 m& z: v8 W7 C
{& E4 q3 a# q5 l- {3 a
   HANDLE hFile;  
& i. l& H  ]; M9 S$ ^) C   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: O% k, |. \  ~( b
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 I! a) X( W2 N6 ~8 C9 j6 r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
5 _. Z9 o! R4 e+ k  F+ b   if( hFile != INVALID_HANDLE_VALUE )
$ N% e- Q3 B' H9 L, x; l   {
' m) W1 ^. J5 y6 g* t! Y  O      CloseHandle(hFile);
) y, z" p# s" e0 @/ _      return TRUE;# \" X& u4 x) D2 I& }1 W
   }) w( y: ]1 q( u: M' y% Q
   return FALSE;4 ]) a# C# N; z- ?+ P7 ~
}5 n) I# X! z) x

5 i6 I% ~/ R; S( q8 H0 _5 oAlthough this trick calls the CreateFileA function, don't even expect to be
2 h; L, m+ t$ g2 p6 f7 Nable to intercept it by installing a IFS hook: it will not work, no way!
/ S/ |* y& |% _( ]In fact, after the call to CreateFileA it will get through VWIN32 0x001F3 C" G- Y  b. c" {( X. X0 D
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
* ]+ k( U# r+ j$ z, R% Kand then browse the DDB list until it find the VxD and its DDB_Control_Proc5 i4 J0 M8 p0 M0 q' F' Q( R
field.) s) ~$ ]9 c  X6 N! ~: E
In fact, its purpose is not to load/unload VxDs but only to send a : J1 S  r: z$ V* d( }3 ^, L* Y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 C5 i! z: z2 P1 r- j& ~to the VxD Control_Dispatch proc (how the hell a shareware soft could try( ^; y( P& m2 u; Q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
- `! s( Y* h) P9 W$ J2 }If the VxD is loaded, it will always clear eax and the Carry flag to allow
! t/ F  P4 A! mits handle to be opened and then, will be detected." N* t6 s8 X: F8 u6 D
You can check that simply by hooking Winice.exe control proc entry point+ _  h2 G- J+ E$ j% P
while running MeltICE./ n# z( z8 J3 p- }! P

: T* ]. t9 r# y3 v
. U1 k8 l' D' Z4 A5 P% J  00401067:  push      00402025    ; \\.\SICE1 c" R, n& }$ m
  0040106C:  call      CreateFileA. U+ c& ]7 ~  F/ ?+ m
  00401071:  cmp       eax,-001* R6 R2 ~9 C# \, {. X
  00401074:  je        00401091
) {9 a4 @" c" C9 C; e6 _4 S' u7 j1 D  A  w
6 ~- B0 Q$ W1 I2 \, Q
There could be hundreds of BPX you could use to detect this trick.
; }# {5 Y1 n( B4 V/ Z: V$ i7 U$ A! M-The most classical one is:
5 Q4 U! K4 S$ R4 m' I$ l  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 ?. B' e$ z5 d    *(esp-&gt;4+4)=='NTIC'% X% S( t% N1 s6 x" l0 q; C) M

6 }' A/ s( [/ O: a* A5 ~-The most exotic ones (could be very slooooow :-(
$ l% Z: T* ]2 U' j9 y$ U   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% b* N: |; G; e4 s! Z     ;will break 3 times :-(
3 n9 L) B7 L$ N, g9 W1 `( m+ }7 P. x; G. b2 a- i' r
-or (a bit) faster:
( t5 }, N8 A, z) y" R6 ~' s   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 i0 `: p( m! p( E$ @) v% n0 R) Y$ Z8 H4 ]: L( N) t* X' @- f
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / I4 U& Z8 a% [& m+ N2 _7 `. g
     ;will break 3 times :-(
, s9 T5 h6 [& N& e, H% Y) J& X9 ]; K3 X
-Much faster:+ h2 E3 D; Z: H9 z
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 d9 T% I7 }0 T6 c
4 e8 F, z. M/ m# X& s/ }1 g
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen1 Z4 P: d% u4 s6 X( Q2 Z7 c7 g8 a
function to do the same job:* W: i) V' a& }
4 D  _! K+ l( P" i/ C
   push    00                        ; OF_READ2 n; M& X  m1 ^/ b2 x* ~
   mov     eax,[00656634]            ; '\\.\SICE',0- [# ]5 K8 ?! P. k8 ]3 I
   push    eax* L. Q, W* g4 f) O! y" u9 W% @
   call    KERNEL32!_lopen2 `# L6 [) X; b5 x: c
   inc     eax$ X7 x: n8 x3 b6 z1 C
   jnz     00650589                  ; detected
, c5 O, F) b8 ~! J   push    00                        ; OF_READ& \4 W) V) g, ^5 d
   mov     eax,[00656638]            ; '\\.\SICE'
# u9 C  B6 V) ]3 M2 `  b   push    eax* e0 a' U, l$ ~
   call    KERNEL32!_lopen0 f" O  b0 Y7 _3 p9 _
   inc     eax
! p" a3 |$ g7 z, [   jz      006505ae                  ; not detected
' J! a! [5 }% I5 L9 c, o9 b0 o
6 Q! {0 T6 F/ N8 g/ ]% u/ v# T  O
__________________________________________________________________________. D, m2 c9 t. d3 u$ o2 a

2 Y1 ?! l% n' g% b4 hMethod 12
& J7 L. O/ n  k+ ?8 R=========
# B$ V$ q; {  F, t+ @1 s( _3 R( i. j( T
This trick is similar to int41h/4fh Debugger installation check (code 05, r$ S: |3 w+ E& s
&amp; 06) but very limited because it's only available for Win95/98 (not NT)# Y1 k7 Z7 v/ e  t5 @7 t4 J
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.* c! c% Z0 K0 B/ G

4 D8 o* @7 K7 j# f* I  [) c   push  0000004fh         ; function 4fh
% [6 e3 Q& @% j& n   push  002a002ah         ; high word specifies which VxD (VWIN32)
( Z- w& b  Y% T* {; d* R- A+ Q                           ; low word specifies which service, i  _  O- Z. F9 |8 w. f1 C' l
                             (VWIN32_Int41Dispatch)
( B* J: q. O9 c   call  Kernel32!ORD_001  ; VxdCall2 s* U: p) W' p! f0 E8 z" h
   cmp   ax, 0f386h        ; magic number returned by system debuggers
8 j7 M( X( M. O) F   jz    SoftICE_detected
4 h; ~  y( {* e  l
5 e. \3 r) Q0 R/ ]8 R) Q7 pHere again, several ways to detect it:
) q; |: I& `# ?0 \; \6 ~, p$ |3 v# }2 W6 s3 R) C" o
    BPINT 41 if ax==4f
3 U7 Z3 O3 n9 C+ X; s, @
' t8 _( S( Y% j$ b) {. j$ B    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- i" @# J* K  J
; I3 x1 [& u2 s. \) ]4 M9 V
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 @9 Z' H4 ]+ c8 U+ R
( t5 v' f9 r& C# U% i; X
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% v% o# g' X( D* W( i1 C' H# R) Q* W7 P$ S8 q8 g' t1 _( a7 t7 a! g
__________________________________________________________________________* X0 B& K$ d$ Z6 q7 z2 n
$ x: r/ J6 j, J3 \" T5 t
Method 13
, G) ~, v- P+ X% A/ ?: ]! I=========
2 }+ E/ F* a6 N3 |( A
/ u/ S  Z7 T! ]$ M2 n% ?7 FNot a real method of detection, but a good way to know if SoftICE is  p6 X) {5 Z' p: {
installed on a computer and to locate its installation directory., U! S% `) q( L* i9 G( D7 h) p
It is used by few softs which access the following registry keys (usually #2) :
2 `4 N4 A0 Q- u8 S& C% ?" [9 y: d
- c- k8 A3 O5 M3 s-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 x/ w9 ^4 N$ ?6 H$ ^
\Uninstall\SoftICE% ?8 p- w/ Y9 P' h5 D
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 e# o3 H( U" Z7 }: Z6 Z  t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, {/ C( @1 r# W* P3 G" ?
\App Paths\Loader32.Exe3 _6 k5 [# a" g8 A+ _
  w( Q$ X( m1 s4 T

# k7 x& j  N7 I* K* O% V  z6 U' u+ aNote that some nasty apps could then erase all files from SoftICE directory
+ V1 D' s2 A2 S7 P& s2 }(I faced that once :-(9 i& X- l+ D$ O  O

8 O# z3 {7 W3 w( ?0 XUseful breakpoint to detect it:
  h: A% r- N, w) {% @& D3 n! k1 `
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
2 U+ A- B5 }6 b* P+ F2 m2 U
7 _! Q9 F6 _1 V# Q6 X$ I__________________________________________________________________________
9 f0 R& C$ r, D- A5 h1 X1 E; n- c- F4 u9 d) `( V& l9 B! l

6 v9 N3 A3 W8 n8 ~7 zMethod 14
1 V& }2 t7 p' Z) K=========0 y' N6 h  ^, c3 S

9 x5 m* m3 o4 b" Q- uA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ J' L  a& F& ?$ G8 ]1 B
is to determines whether a debugger is running on your system (ring0 only)., O- i. O( p) T# W
' ]' N7 |6 q  K: B/ h" R- J
   VMMCall Test_Debug_Installed
( n! F* R  a* y   je      not_installed
& G- K! C4 ^; q8 U  J" }( Y: k3 J' {" [
This service just checks a flag.
( h, n$ ~4 [; D' b</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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