About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( `0 u7 O  L2 c0 z2 E<TBODY>
: W$ _! [4 @$ M2 A* ^<TR>
; A3 {+ l3 [# W0 ~* S% F$ L<TD><PRE>Method 01
( H& u# G; t3 q) P+ U- P  {=========% ]4 U0 ]# T& q  p1 t' @4 K

8 g7 Y$ @1 I9 T6 }5 u/ X" iThis method of detection of SoftICE (as well as the following one) is2 T8 K1 }9 C& I- o) l
used by the majority of packers/encryptors found on Internet., L$ B/ L% P7 y! U1 n
It seeks the signature of BoundsChecker in SoftICE9 `! _: r: I% v1 Q! N, N- D8 \5 l8 z' s

* f, B# [3 _3 w: V6 p0 A    mov     ebp, 04243484Bh        ; 'BCHK'' D4 \+ A6 o4 M" N5 b3 z# l" H- o/ u
    mov     ax, 04h
( Z' K. U# w3 q    int     3       % {& U0 ]9 d/ ]! b3 m1 V
    cmp     al,4
5 G% n( Q0 \  ~+ U/ C# z% d    jnz     SoftICE_Detected7 ^, w5 O. Z# b! o% H% j! S  e% P2 |
: a4 o/ G: c3 P5 w
___________________________________________________________________________1 X: Y/ M8 P3 g- W7 X/ N

& x( F$ o6 X% I. Q9 zMethod 02+ ?6 _( V+ m. O; H) M/ N
=========
6 X" t8 ?; x4 n7 D0 L# Q) U7 {0 K' g6 u! _
Still a method very much used (perhaps the most frequent one).  It is used
; }9 b  x0 N0 _to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% m- H+ D+ k! @& kor execute SoftICE commands...
2 G) O+ v6 Y, _/ N% kIt is also used to crash SoftICE and to force it to execute any commands5 a6 Z! j# }0 `# A5 q
(HBOOT...) :-((  
) H, W$ c+ D, o- G4 V1 ?* f6 Q$ ^  r
Here is a quick description:! R( Q( w. i4 d" t, S" X
-AX = 0910h   (Display string in SIce windows)
; }$ [! F& x8 F6 B-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 d# L- {& L! s/ E-AX = 0912h   (Get breakpoint infos)  O" _: Z4 [( s
-AX = 0913h   (Set Sice breakpoints); \% C8 p/ N0 [  u
-AX = 0914h   (Remove SIce breakoints)
8 g  r5 N$ Q; @7 O3 z
. c4 i" \( [, y# W  @& {7 q; C7 uEach time you'll meet this trick, you'll see:) M* {0 v, @3 N
-SI = 4647h; z+ h7 p7 N$ y
-DI = 4A4Dh. }$ P# c4 v; P+ l7 }
Which are the 'magic values' used by SoftIce.
  g) s7 I- F' d. F/ k) lFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 x0 v+ e; c4 x8 E8 A
+ w( x2 Q+ i9 ]3 s( D4 w
Here is one example from the file "Haspinst.exe" which is the dongle HASP
/ l$ L7 A2 z8 T3 x/ T! i7 R: MEnvelope utility use to protect DOS applications:
* X2 I6 w9 t% d, t! J% ~! @. l
3 k! ~1 F1 b; A4 }! L
% v& {, X; I0 Y! ~  n4C19:0095   MOV    AX,0911  ; execute command.) ]3 x/ }! ?+ R8 t" X* D5 n0 D) W
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; r! L+ Y( Q, X  C4 I: E0 y+ ?
4C19:009A   MOV    SI,4647  ; 1st magic value.
! S& c, b- \5 d. l) |& B2 B4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" n  n; Y8 F& Y: I; H  b4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 R$ y/ k: T1 q; f" R. @  n
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# u8 Q2 U% o& Q% A5 n5 o9 D8 ^4C19:00A4   INC    CX% F  O! T; A  H$ j
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
$ N: T2 M4 \) N( @- j. h8 R4C19:00A8   JB     0095     ; 6 different commands.; x2 I& S9 g" q+ e( |+ [
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 U' M- C% `. m1 O) E' I; q* t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 B* V3 o3 f2 T" s  L2 L' J

2 c: \) |9 P/ {8 D" yThe program will execute 6 different SIce commands located at ds:dx, which0 i7 y6 v) p/ y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% f$ z0 ~# m# z8 k4 Z3 O) C
' r+ J9 ]6 `) I4 g: k. e" X# H* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% ~+ w2 b- X2 L3 q1 |: H
___________________________________________________________________________+ z  P) u/ X* X4 j: z" [
; U/ v6 j) y5 J) V$ P$ c
+ X$ Y6 w3 C6 R5 I8 j
Method 039 ~* h6 ^5 a: {. d9 ^4 Y9 T
=========7 J5 C, o5 ?9 d* ^1 f. e2 g2 L* j

" `* r# c* k& u& {( `& u7 tLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h1 k8 ?7 O3 Z" H; W  D' P, H! r8 Z& A
(API Get entry point)2 G% e# n+ X/ O. K" R& Z9 b
        
; r/ _6 l" x; {1 Y* S$ O5 [4 }& n
' [1 I7 b& O1 [3 M  K& t    xor     di,di1 q8 e2 z% B3 j9 \( T
    mov     es,di7 o9 y4 c" r7 T2 E
    mov     ax, 1684h      
/ _$ R0 Z7 A1 p    mov     bx, 0202h       ; VxD ID of winice
8 }4 h, {$ _! Y    int     2Fh9 o% Q7 L, E3 E- _* `
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 A$ [0 b# q/ y' N- z# H    add     ax, di3 B) B9 j- T) y* x
    test    ax,ax
: l6 N' A" @# f! |6 d    jnz     SoftICE_Detected5 j5 w$ L# \# w3 w) F+ h& n7 u

- p  V6 S3 M+ a___________________________________________________________________________. U. }- H+ V$ G( M3 p+ h
1 R3 g5 M  H- G$ Z
Method 04& q& F) [- v. f+ a: R* ]; r
=========
& [  \1 p) ?; Y3 l" F8 G0 `, p" A& K
4 W3 ~) b- @6 M+ F% l& N: dMethod identical to the preceding one except that it seeks the ID of SoftICE
; V' X( Z& N2 k( L* J" i4 K, [$ fGFX VxD.
& a- J* _1 l6 T% N+ M4 E# [' R- @
    xor     di,di7 Z: W" s% P- q4 x! N7 C( h
    mov     es,di# z0 S4 @; D; \9 ^2 \
    mov     ax, 1684h      
0 {) \& D8 h; R$ u    mov     bx, 7a5Fh       ; VxD ID of SIWVID, }; ?6 \% G1 P' _$ M. i
    int     2fh
9 @6 S" J. F" X* v$ b5 O    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  [$ c8 Q: g  w    add     ax, di
( u4 y: A7 K# i4 L% N  t# J    test    ax,ax
3 w$ v0 u  F: j( R; J: ~    jnz     SoftICE_Detected
' z  \% O( C1 W# m- ~3 n2 V! m7 j
__________________________________________________________________________' N* A" g2 U/ l4 T1 T6 u
, @9 Z4 ^: b; @4 Q' E3 O  A0 P
  N& u0 b1 n7 ]
Method 05
1 b. C3 a& D( q4 K0 n; @# m6 [3 Q) ?=========
& Q( i9 f1 }; U+ ~) ^' o4 l4 r/ f8 T) }3 l: s1 M" K4 f0 \' n
Method seeking the 'magic number' 0F386h returned (in ax) by all system
" g& g0 u! Y2 ~! C, [* \debugger. It calls the int 41h, function 4Fh.- G: f, A5 x* x! r
There are several alternatives.  
/ i( E" [+ l6 @8 p
0 s9 e6 i, X5 T% e  {' U9 aThe following one is the simplest:" Q: }4 Y# r; m- x$ K9 u
7 j( t$ W; o( _- L  M
    mov     ax,4fh
2 b8 b# a( Y% a9 n. `    int     41h
' J  V" r* b4 @5 z8 m; w4 ]1 Q    cmp     ax, 0F3862 s; O6 L7 u* I# z
    jz      SoftICE_detected
9 r% h" g' k" e. u9 h( A' i- `$ T' @' ^5 y# ^$ Z( g- m

- p* m6 t! y+ sNext method as well as the following one are 2 examples from Stone's ( U( y: h) s5 a7 V* }
"stn-wid.zip" (www.cracking.net):8 G9 R& }9 e% ?( p1 r9 l- g
' ~  ]$ D' c0 h# Z: }+ d) d
    mov     bx, cs
7 y  v* h5 d# a. w' k& J! J. F    lea     dx, int41handler2! x2 i. R' J* l( q! v
    xchg    dx, es:[41h*4]+ X& c$ ?, q7 h% l$ q
    xchg    bx, es:[41h*4+2]
8 G* |* A; k5 k# ^8 \    mov     ax,4fh# X/ u( R  j: ~, C  [
    int     41h' U6 E8 p$ w2 m  B4 P1 {: b0 N
    xchg    dx, es:[41h*4]/ }0 f2 I' Y, E; K, {; o
    xchg    bx, es:[41h*4+2]. {; d, e; g6 S; |
    cmp     ax, 0f386h
( O2 z- Q: m$ f. q7 I! U    jz      SoftICE_detected
/ E$ ]% X( V, R' d
" B* `" u$ f( q5 {int41handler2 PROC' ?- a# Z) j" S- g
    iret
# t- o5 S1 `. b0 uint41handler2 ENDP
6 \  X- Y+ O( A2 g" R7 a
# w. S3 e" C8 G2 A' f# L4 w5 `$ X4 |4 o8 a7 H# d# U7 h0 F4 g
_________________________________________________________________________
+ _- q- k) l: N# V# V, Q
$ }# Y/ D, q6 Z# \
4 ~5 a# V; ]: j( bMethod 06
7 B3 C5 y9 y; z/ N# `8 N=========6 L: S, O. \. `" S' g3 b7 K
0 \( I+ e; L3 a5 o( _6 e8 @7 H

0 `; D7 M' U/ B" O/ }% K! ?1 h1 S, t2nd method similar to the preceding one but more difficult to detect:
; d1 I) b0 V, v4 F% G+ ~0 F. Q5 \' @- `4 m8 t( @- B- B) A+ d0 P  g
+ h+ A' x; y6 A
int41handler PROC
6 A& @  [, T: v* l  N! g' W% i    mov     cl,al
: r9 I- s! F* `    iret
& A6 v6 S( B% eint41handler ENDP" b, O' U2 z# r8 g

( y5 l" Q- @/ g8 s
, C% I1 D# x+ f4 _* u$ n& O- m    xor     ax,ax
/ {) w: F) A; w" v& ?/ h: p    mov     es,ax5 p# R6 ?* Y$ R) [7 r* s  z: c+ Y
    mov     bx, cs
1 g1 J0 k4 ^  [7 n2 v& ]    lea     dx, int41handler0 c% ?2 H4 U$ E; Y; _: `/ a; L8 Y
    xchg    dx, es:[41h*4]
5 _6 n3 u' T( \1 M) L  k    xchg    bx, es:[41h*4+2]7 s, ~* z8 G# `7 q
    in      al, 40h
  o# }( h' s+ O5 ]    xor     cx,cx
; Y* c! \$ k+ Z5 F    int     41h
; T6 \: C$ `: h0 A5 Z5 ~    xchg    dx, es:[41h*4]
. a. ]; \1 j$ P    xchg    bx, es:[41h*4+2]4 W  j" T+ t8 m5 i
    cmp     cl,al
) V4 X2 o/ g5 {0 G% l" X) m6 Y    jnz     SoftICE_detected
3 ]7 j+ n* Q9 G1 B) {% S" E/ n' B* N$ ]: j: F( y
_________________________________________________________________________
6 \  K  }& w: W: c$ k
* a: m" H" _0 y! D/ a0 V8 mMethod 07
, g3 `( g! ~8 h0 Q=========9 a, A5 K4 G$ b. }! b2 B

1 Z' c- \* a/ E! \: M3 e' U+ _Method of detection of the WinICE handler in the int68h (V86); J2 x; n' F% h0 M" P' E
! i  o8 D: x4 `
    mov     ah,43h8 w9 D$ f# g( ]- M
    int     68h2 a5 W/ U6 E9 I% j
    cmp     ax,0F386h# H3 ]% r- h+ _4 o; H9 G
    jz      SoftICE_Detected
5 x- z3 g7 {' x( U$ u. o+ ?* ?; H2 s! f6 ^
- _# V" n1 R2 s2 a  @* C& {
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 {6 X5 [! |. M: `$ v8 B4 g
   app like this:
$ c* H7 ^9 X6 y$ Y/ W8 a
6 ]1 h6 e4 y5 V   BPX exec_int if ax==687 [" _& H5 z, m
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ d; s, _  _  B" O   located at [ebp+48h] for 32Bit apps)
8 M- {# |; n6 Y' o% D0 l8 E: i% b__________________________________________________________________________# T- S$ j" c) X5 F+ x
1 p3 Q: {) s2 ^3 r4 Y' ^( O4 J$ q
+ q* z2 {0 J& w
Method 08" _# o( l6 ~# x" {
=========9 _: G. g, ~7 Z+ G9 _
! \$ t! A' c! J8 a8 h3 H
It is not a method of detection of SoftICE but a possibility to crash the
5 ]9 v! S# r1 s3 S3 Csystem by intercepting int 01h and int 03h and redirecting them to another
6 K% c8 }) {1 _+ Lroutine.# D  |9 `% g$ {* c6 \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
. r3 R$ T, g8 `to the new routine to execute (hangs computer...)  S$ \$ G  d) w8 ?, C

% `- {3 C. m2 b    mov     ah, 25h# P- C6 a- A# I" D6 ^, o
    mov     al, Int_Number (01h or 03h)
: j( ?9 f0 m; d0 X- n! L    mov     dx, offset New_Int_Routine& N5 Z- p( s; L$ i" _3 j
    int     21h
: T. ~) j& l7 Q* ^- {( }  W1 z: h& `+ I" b5 E6 f
__________________________________________________________________________( G* p; N: P/ L# b

" @) r' b- a/ i' e8 y- C# NMethod 091 }7 \: h- v( q* \
=========
: h* C+ }4 p) \  q' O; h6 t  k* Z7 q+ a2 ~  T4 x
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ Q  i+ S3 o4 `$ N- V
performed in ring0 (VxD or a ring3 app using the VxdCall).+ M) Q+ o! ?( Q  c$ h+ u3 j2 @
The Get_DDB service is used to determine whether or not a VxD is installed, T4 |* C; i+ D. Q. V  \
for the specified device and returns a Device Description Block (in ecx) for
5 x; i: Q/ Q5 P6 P- G* k( u( hthat device if it is installed.5 \! B; S( b! K# F, A- t% r
! F2 U+ J# P5 y& e2 u) p  @" w
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* e( Q; N% z* [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 V6 {2 W. ?7 J6 B   VMMCall Get_DDB
. N$ c0 j2 Q: k2 y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 W4 f5 M3 b" R3 Z

) _# K+ P6 S! d7 ?& ?4 DNote as well that you can easily detect this method with SoftICE:
+ L* D1 v) |! d. J' j& p   bpx Get_DDB if ax==0202 || ax==7a5fh
; Q' |' w; Z- p- y/ X. ^# i  v" L5 e; C- s. n. {1 e0 Q8 L( P7 b( b
__________________________________________________________________________( `, x0 Z# }/ ~" v9 d" D- J6 y9 a( I
7 ?8 k6 E" B  a: x
Method 10
7 u7 N  z2 H5 K9 N, t* u/ J- G. v! N=========
+ E. O9 l& K$ N2 u' K3 U, Q  D/ J, f
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 Z0 @0 [" K" F4 c6 ]  SoftICE while the option is enable!!
/ A7 P" A) b! C- U& I' v
7 E/ `0 b/ X( ~, u/ FThis trick is very efficient:" O& d8 T9 J$ y% P) j
by checking the Debug Registers, you can detect if SoftICE is loaded! u( }4 {$ o0 j% M4 [
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! v( m+ C% ]3 S4 C
there are some memory breakpoints set (dr0 to dr3) simply by reading their
1 f# u# L: u( T* Z/ ?, lvalue (in ring0 only). Values can be manipulated and or changed as well& _0 {; i. D8 ?, i0 C
(clearing BPMs for instance)
8 c1 E% ~& n) c! a' S7 B2 v0 a" B3 X. l6 z  z4 ~& x
__________________________________________________________________________
  z; n1 i! Y! C3 b+ i) G0 q: z* G$ u/ L$ z+ O4 Q  g& d
Method 11; k( P+ t) \. k+ p) o2 l/ l3 ~9 P
=========
/ D' Y, E9 h$ |
. A7 z8 a! x3 KThis method is most known as 'MeltICE' because it has been freely distributed* D! t' A: s. P: V
via www.winfiles.com. However it was first used by NuMega people to allow5 t2 K9 a6 I; b+ P
Symbol Loader to check if SoftICE was active or not (the code is located
) m$ ^: n  ~& e! y$ R- Cinside nmtrans.dll).4 G% d2 ~6 Q  G! ?. C6 T0 J1 ~

9 e% x) }+ g; q' i4 t" V8 p' N) LThe way it works is very simple:* L2 Q+ @0 j4 L& H
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) i. M- X+ F. H- g$ c5 o+ gWinNT) with the CreateFileA API.% N# Z; g  P( R
" }4 K9 t  p8 S/ y( K
Here is a sample (checking for 'SICE'):
& |5 a/ i, L: N" ~' `: y: p
3 w6 q$ c" f8 w9 s3 K- I) _! jBOOL IsSoftIce95Loaded()
- A, @* v7 \" G9 F% q9 p{
& I1 s/ ^1 h9 Q8 e# l- P1 q" R& y   HANDLE hFile;  ! g. W5 W$ C1 z% @8 `3 c% J. L
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 P. \" K8 H( r& Y3 q+ C$ Q                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& W& T! O% Z& D% y* }% F% e7 c6 g                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; m, p" _/ S7 d' W7 \& ]+ \: F   if( hFile != INVALID_HANDLE_VALUE )
: p1 R1 J# ]& x- n   {' m# H* J) _$ t4 e& f$ ~
      CloseHandle(hFile);
8 C/ ~$ i4 t; r$ s      return TRUE;
2 J; z; C/ t# ]- Z' ?- c$ b4 `1 K   }3 W1 k! l4 a& C) A% y# V2 ?
   return FALSE;# z8 w- k' J' R3 u! K# O
}
2 U/ e; K2 |* s* J. J, m2 t( E) Y( \# n' ~4 G4 v2 _1 [
Although this trick calls the CreateFileA function, don't even expect to be% V( \& g# }3 }; O
able to intercept it by installing a IFS hook: it will not work, no way!
5 q& i! F  E3 K9 O. r; e4 c  X6 AIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
. q8 B- a3 g  ]service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). U* Q& V! G- c. x' n& j- G
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
- g8 o% ~  t4 ^' P0 u% @! q7 Qfield.
& |# m& f- e3 y" M: gIn fact, its purpose is not to load/unload VxDs but only to send a , v- X$ ]$ ^2 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! P9 D: P4 F3 |* o/ s# c; Oto the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 P! \# @) X* d* ~  lto load/unload a non-dynamically loadable driver such as SoftICE ;-).
" F/ r: l( z% H9 Q2 zIf the VxD is loaded, it will always clear eax and the Carry flag to allow
4 k+ a6 f( I! ^+ t4 }" Xits handle to be opened and then, will be detected." L: L7 c% r/ J* \# l
You can check that simply by hooking Winice.exe control proc entry point
! u& G/ Y! @8 l. n; `* o8 O1 q, Iwhile running MeltICE.& B# `. S# \3 E% U+ K) c

9 _- d. h; B! M: [) t% e5 W! ^7 X! `% r5 r
  00401067:  push      00402025    ; \\.\SICE
2 B. |$ J+ d9 V1 V; i" J- m  0040106C:  call      CreateFileA3 y/ v# @& M' z$ d" L. y2 }4 L
  00401071:  cmp       eax,-001
: G! Q$ S; m9 a2 [7 ~  00401074:  je        00401091
0 z2 h1 U% J' V2 A9 d) k  v
1 S) U. x! q$ y/ p( N
* h# [2 w' `6 Y, B5 I, TThere could be hundreds of BPX you could use to detect this trick.0 @9 z3 D# }2 V1 D4 r- G& w0 a
-The most classical one is:. S) v( ?( L, @, i
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||# T% y, y% s1 X( [% x1 V) y9 u- p
    *(esp-&gt;4+4)=='NTIC'
' L! J3 u3 R; W' L. Q" w6 h+ {1 ]* l( O# q$ f# y3 l! p
-The most exotic ones (could be very slooooow :-(3 e  s# S0 }) V$ _3 p
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( {8 {0 E8 [/ k( }; u     ;will break 3 times :-(
0 O" m9 f4 c  H! V
7 z; ~. u2 v. P- o1 \# x' x  u3 c1 S6 e-or (a bit) faster: ) r( j/ u  A& K9 T1 x
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')4 Q! d- I& Q* m- b
2 G. f4 h# X) C5 i+ Y; [, b- |
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  4 N+ W0 i9 |5 N$ X  R! F5 Z
     ;will break 3 times :-(* i' h! L1 @+ g2 C/ X/ G3 Z; @) l

  [" H- M' C# L% r. W. |-Much faster:8 E. q' `! U/ V; ]$ m) w# W
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
  l& L. k+ X- {8 X/ F$ j  j
/ s* V, g' C& s2 p# {/ y" bNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
% a( [( F0 ?- Z7 n8 g8 ffunction to do the same job:$ I1 Y- p* G! V6 _; Z5 n5 J* O+ w, o1 |9 H
' J6 [8 i- q4 ~3 O- @
   push    00                        ; OF_READ( c4 N/ I4 G2 U! A7 D! U
   mov     eax,[00656634]            ; '\\.\SICE',00 Z5 a* P1 `' r; n5 t5 K  S
   push    eax+ J; A9 W" v1 e3 l8 F) `
   call    KERNEL32!_lopen
- w- Q- h  j6 L  C& q   inc     eax
$ J, h6 O, E1 K. ], I   jnz     00650589                  ; detected
( B" C6 j* y0 m' q0 p+ @1 r   push    00                        ; OF_READ
: a) d' m$ k7 k, L4 g+ s' B7 ?2 x   mov     eax,[00656638]            ; '\\.\SICE'
% G6 j, J3 I. W- S: T+ Q   push    eax
6 N  G. D9 d4 U* J# Y   call    KERNEL32!_lopen' Q! D  A  y9 a* g, U1 m. ~& E
   inc     eax9 T7 s0 o) y) e3 ], O  l; Q
   jz      006505ae                  ; not detected% {& O* `& H" j( \4 S% y1 Z5 {
4 g0 d6 u" w; C% s8 D
# Y# K' M; O2 ^* {, `
__________________________________________________________________________
7 x) d; X8 h: {5 Y& f
+ H; D6 T' R' PMethod 12
4 K% D. Q! m5 E$ q2 E" x# O7 O=========
: G; \2 ~* z% x! S( N6 I6 N: s/ a4 L6 y
  V/ M7 E3 T- ~6 JThis trick is similar to int41h/4fh Debugger installation check (code 05
' n8 j" o. l) T. }&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& w* f% A+ {1 l6 v4 Uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 k+ t4 a9 T: b: J. r! D6 T$ i1 ]) |* V
   push  0000004fh         ; function 4fh5 I$ O) C3 g$ o3 d: S
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 F7 Z% j" h6 d" Z) p/ g
                           ; low word specifies which service# b2 G7 m5 K, D8 y% k# u
                             (VWIN32_Int41Dispatch)9 R  k  p' q9 Q
   call  Kernel32!ORD_001  ; VxdCall& l: L% \; R3 P! \
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 ^& o: x, v) y1 i
   jz    SoftICE_detected
9 @% X' m; j) o. P7 P0 K3 L/ S! Z" u% x% s3 h* k
Here again, several ways to detect it:0 W4 I. Z$ Q4 K7 r/ _9 V3 c

- O8 E6 t- H7 V/ _" D9 f' I/ s    BPINT 41 if ax==4f
) c. {. N0 j9 j3 a3 A8 V
8 F0 S! O" f& I# f8 T    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  c% X5 V: E, y# b, ]" }; v3 k6 ^9 |' @) u: |7 U: ?
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
% b$ R& r  [+ F( i
6 `0 Z+ s) _9 q$ J) b% t* c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
  e# l: h  r5 i+ s4 i' Z" \9 f* x; t1 y3 p/ F- a+ S. D9 ]% O3 q
__________________________________________________________________________! K# x+ l2 \- F: z3 d

! p$ |5 N& o) X# x1 Q4 S- iMethod 133 d6 C, P9 {8 I$ U; D
=========$ t  D" X5 t, a/ L

$ \' a; P, e/ f6 a- q6 N5 {! sNot a real method of detection, but a good way to know if SoftICE is
' \( s# \5 d/ P$ s6 b: F$ hinstalled on a computer and to locate its installation directory.
! Q6 P8 c4 H" N# R) FIt is used by few softs which access the following registry keys (usually #2) :
: G% r  c" j+ t0 |) N& r% T- S, r. l7 L; d( h( P6 W
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 p" c- G% ]  r
\Uninstall\SoftICE
) t- O* c- |- G: m7 U" I& W  Y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE' {8 x+ @7 Q: f  y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 y( x& `6 J% `. v; L
\App Paths\Loader32.Exe
0 Y- Q) o8 ~! M6 T' {- i8 G) R# ]) ?  a+ X, C- H

" T0 v/ v+ r; y3 f! A1 m9 ENote that some nasty apps could then erase all files from SoftICE directory. t4 I  n, a) G5 K% ?* t( n
(I faced that once :-(
2 Q. I% A# \9 Q: l( Z0 w8 S  x% g) h5 D2 `8 }& m, _
Useful breakpoint to detect it:  F7 g: F) n2 N

: |, _1 W  t5 [# b: t     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 x8 E2 S0 z0 Y# |! N( I$ T

5 p% j( f( Q% g- Y8 V5 P+ R__________________________________________________________________________3 }; j, ]6 m6 O- Q4 f* F9 W

4 K* M1 q4 P( T6 \: x: C- r5 K, R! h$ A0 b  d: {
Method 14
1 o; P0 N& W/ t: a: f4 `=========
& I! ^8 a+ M) Y8 d8 [' w; p# Q
5 L5 p- ]+ q8 Y4 t& f3 GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( x" \) z( P& `- p; ^9 Fis to determines whether a debugger is running on your system (ring0 only).
; l0 D  ~' j( S- ~- W' E3 K4 A' `7 C* \( W, S8 O8 r7 s
   VMMCall Test_Debug_Installed
* v3 q- M  o+ _" D% V   je      not_installed) w0 d( `2 q# m5 x, }, }0 O( t
6 M( V2 ]$ G5 _- S. _
This service just checks a flag.
; q1 Y# f/ l8 G+ e+ H, a& \</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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