About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: ^3 g0 I/ M0 S3 a/ P
<TBODY>
% U# K/ a4 G- H<TR>
5 J$ Z1 j2 I' X* |. q& Y) V<TD><PRE>Method 01 4 _( V0 y8 \+ r/ Z  x/ j7 p
=========9 b7 @' X2 ?$ O- y/ P. m

- w3 v8 Y$ }, c" CThis method of detection of SoftICE (as well as the following one) is$ r. s, m, h6 o: p/ H
used by the majority of packers/encryptors found on Internet.7 `- D3 _, E9 p4 V
It seeks the signature of BoundsChecker in SoftICE
& ^, G3 Z) X5 M0 w" _/ ^. A3 T! }+ y3 f# G5 E, x
    mov     ebp, 04243484Bh        ; 'BCHK'% d3 N; h/ t" V1 V( G4 R
    mov     ax, 04h6 u" \8 n1 P9 m
    int     3       2 B& u/ c6 h  ]/ z
    cmp     al,41 h9 Q. z. \1 `: r+ t
    jnz     SoftICE_Detected
, z- g; q1 m4 Q& m
0 w3 [3 @% Q6 X* i1 u' W___________________________________________________________________________
, _5 @7 r+ R* S( F" t- D! c/ D! X+ w  h2 w" I
Method 02
, O& N+ [" D+ Q7 T3 _7 u/ r' N=========2 E$ V/ Y& m  |4 p2 b' r
& S, n% [3 D5 o8 Q7 }/ j7 I
Still a method very much used (perhaps the most frequent one).  It is used3 y1 X- F4 a8 x/ o6 i
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 d& p4 l% l0 b2 _1 Yor execute SoftICE commands...! n+ L0 E5 `+ o7 M
It is also used to crash SoftICE and to force it to execute any commands
! f# l4 d9 @0 A! G- ^(HBOOT...) :-((  , s8 L" l/ o' M* v3 Z
0 i- ^7 F8 m# k+ d
Here is a quick description:
. C) L( X+ \/ a0 {% }4 [-AX = 0910h   (Display string in SIce windows)  S! Q2 W; c* `: z. T
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( Q: [1 ]0 X' E5 Y8 H  `' k
-AX = 0912h   (Get breakpoint infos)
# x# a. M/ u1 D  w1 o-AX = 0913h   (Set Sice breakpoints)7 |% ]1 T. c3 {1 w& s0 w* I
-AX = 0914h   (Remove SIce breakoints)
# M9 t  m% M9 @; g: r; h3 g4 Q
8 B" ^6 t  j4 S( H5 ~9 pEach time you'll meet this trick, you'll see:! w) z% c( U. n1 |) I% C
-SI = 4647h
! n7 [- j# x- e6 E-DI = 4A4Dh
' L! }& ~) s; x- O2 q% gWhich are the 'magic values' used by SoftIce.
% q: `  i! V1 {2 yFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% U/ g& L& H& A6 S
' o2 W8 o+ Z) J, R
Here is one example from the file "Haspinst.exe" which is the dongle HASP
) z- U0 ]! U$ H7 p+ qEnvelope utility use to protect DOS applications:
# a, ~0 g3 U' {& h+ \6 y# x+ w5 b+ r, K$ Z7 ^' _: W) b  T1 |

& O$ x& E1 L/ B6 \' @, Y# b4C19:0095   MOV    AX,0911  ; execute command.. O. W1 ?9 T' n8 H6 T/ |: P
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* j& q& |7 m9 O& A% H% m7 B* M4C19:009A   MOV    SI,4647  ; 1st magic value.
- y) D; g. B0 v. C4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; D& O7 e% R" P9 Y2 e! I) m% o4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 W+ U0 W1 ]. P
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) r! q; f) J. V( h4 I$ B
4C19:00A4   INC    CX, ~3 r1 X$ w- r8 l1 G; _8 ~6 {; _" D
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& S$ x( t, B% f2 ]4 b9 B7 C9 y4C19:00A8   JB     0095     ; 6 different commands.
( |  I& h' K3 R9 w4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
+ i, o, \+ ^- a% X% ^  y' P6 M4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. a' I6 O# p( a8 \) p- y
( |  z8 z1 e# A% k  p, }( G" uThe program will execute 6 different SIce commands located at ds:dx, which4 X5 }( c4 Y% i" l
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.# x8 \! m0 l% G  {4 d( ^
9 A+ \. ?: d( W/ B8 p9 M  f
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 c' Y3 V3 k" Y' i% z" g___________________________________________________________________________3 D- e5 a' E8 ?$ t% ]( R

6 @1 I5 `0 P0 o4 c4 `8 W3 H, z; R9 ]8 B0 B) G8 j/ R% |# _
Method 03
) i% `1 M6 _3 M! {=========; G- Z2 |- y- f
' d% p( P2 M1 B7 N3 m
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h$ h: S% d& w; Z2 c
(API Get entry point)
: k9 O* M- f3 C: |% Q+ N        2 m) e! K* ^9 M/ v# V. o
2 N, J6 ]2 k+ [7 z/ x; d
    xor     di,di
! S$ K7 ?  {( O3 N6 [& b. a    mov     es,di
$ ~0 k( L! K7 I. L( j" s. A8 d    mov     ax, 1684h       0 G: a" F7 b! S0 J$ v9 ]
    mov     bx, 0202h       ; VxD ID of winice
$ l0 Y) n' b$ T. y: C    int     2Fh
9 @' o* z* h; d9 i3 U3 E8 H7 l9 \    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 ~# G+ A! W0 m8 F1 P% k    add     ax, di
+ i0 T4 ^3 p! Q$ Y, U0 T    test    ax,ax
4 c  e6 p/ O! Z. N    jnz     SoftICE_Detected
- \1 X: c! M; n0 O' ^. Q, ^2 o- r1 W% U) e2 Z
___________________________________________________________________________+ H8 x* L8 J5 i' Z9 B

! f& A0 U! N3 NMethod 04
% W$ E0 B# |$ ]9 r+ {/ V3 ^% u=========
4 a9 ?. v, Y) o% V$ ]
7 b( x9 n  Z4 w, I( E  V2 o1 S+ `Method identical to the preceding one except that it seeks the ID of SoftICE
1 e$ K1 i" G1 f' s; I! z; D" KGFX VxD.
9 u$ R& ^8 {0 e' ]7 G" ?5 D0 f. Y$ ?* H2 C% c9 ~( G( z7 W
    xor     di,di; }% i# `7 X$ E& B6 P
    mov     es,di( R# [; z( ]% b' g% J0 S6 w$ h6 `( w0 y
    mov     ax, 1684h      
; `7 H, D" z3 C+ n# R) M# G: |$ O, R    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 P* s; c0 c# ]9 H, `    int     2fh
$ B3 ~# {! [$ \9 e2 }    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ V0 p& U5 q' M- }8 L1 M
    add     ax, di0 k2 v# a2 d& h  Z4 A
    test    ax,ax( b- y5 B, h% Q) v  w8 R8 `
    jnz     SoftICE_Detected. A! j9 x7 P  a; u, C

3 Y2 v% Y# ^4 U8 d__________________________________________________________________________
' \: Y& g- U, m$ ]( m5 ~3 {7 ]
4 I# m$ K3 R+ \/ e( g% l  Y) a$ I+ U# e0 k$ Y# r: w5 u0 x; f, I* g
Method 05
# `/ Y9 s/ ^2 C; m+ s0 x* c% @=========- y& ]' f0 l& M. u/ m. r, X
: a. f$ A# E0 t1 P' d
Method seeking the 'magic number' 0F386h returned (in ax) by all system: s" C+ {7 T4 j% [  `8 T
debugger. It calls the int 41h, function 4Fh.
4 F. @9 c3 |8 n% v% cThere are several alternatives.  ; [6 {$ q! i! J( h8 i- F8 N. f" x/ v
! z& e1 `+ v8 A) s  x# F, d1 x
The following one is the simplest:6 o% V! |+ C2 Y3 q4 S8 A) ]/ O
0 B8 c, P2 N) q, z5 @
    mov     ax,4fh, j( F& {- v& q" x, X! @
    int     41h7 P* J. F) [8 v, U! M5 @. `
    cmp     ax, 0F386
) ?* [% x0 W8 ]/ c( I" C5 G4 g    jz      SoftICE_detected
8 W) ?; W4 E  x  j/ L5 @# X$ j. O* V5 i3 M

2 ^1 [: @+ g2 J8 ]7 z7 ?+ T. n9 [Next method as well as the following one are 2 examples from Stone's . B# a2 A* c3 L5 A  b# ]. s
"stn-wid.zip" (www.cracking.net):
1 B$ K$ B) w3 E# y. d$ Y7 s, K1 a& B) X7 s9 x4 X
    mov     bx, cs; H  m' Y% \; P0 G+ ]0 n7 s, w
    lea     dx, int41handler2
9 w! |6 ~. T# L  x- }    xchg    dx, es:[41h*4]& |' d7 u6 `2 @2 G
    xchg    bx, es:[41h*4+2]
; N0 ~, v' d) z; }0 V, s* P' [    mov     ax,4fh1 V4 p6 v. r5 a7 H; n, q. E' G
    int     41h* r# n" H; }$ V& S4 W
    xchg    dx, es:[41h*4]
$ v6 g. f% R% [    xchg    bx, es:[41h*4+2]( w. o* `( o. ^) H% ]! L' c7 \
    cmp     ax, 0f386h4 b7 q# |9 Q% g- |% y, B
    jz      SoftICE_detected+ m. B- d  D$ a9 k& ?

3 ?& I7 ~3 x! ?# j3 xint41handler2 PROC3 C- x0 I( t! x7 N+ S
    iret
! i# W+ e+ m" P* K9 s* W. F3 \: ^int41handler2 ENDP
$ I: Z' ]- I8 _; F
1 s9 `: z- i2 I$ c% W! z
* P" s8 ^1 a# B2 i4 U% ~_________________________________________________________________________$ a  w. B2 _9 [6 R

7 t1 |. r( t- M7 K7 W5 ~2 S, \& p8 m  L
Method 06
2 B# h6 E# t' G. H& {' N=========. r9 s: f  |- `8 ^; |
3 h0 b+ k. |; n8 d% P5 v& M

# b9 Z9 s' `: j4 K2nd method similar to the preceding one but more difficult to detect:8 {0 V' _+ `4 k; a4 E

2 I' b  o, b. D6 a3 j6 h
$ v# o# r' z0 I& s5 f. S. pint41handler PROC* S7 G4 F0 a5 [7 W% m5 `/ Q
    mov     cl,al, N) ^, D& }0 e  M
    iret( M- H0 Y; @; {# f
int41handler ENDP! t! C2 l$ R  e' H

& X8 ?# w+ p" q; b7 v' r, \/ e
' U) z+ \' Y# B# P8 J- ^; t- ?    xor     ax,ax2 b, O: M  o' Z) H5 t2 B
    mov     es,ax4 c9 n3 k! e% ^# l0 o& e3 t
    mov     bx, cs
6 B1 S0 C* l* m# C" m    lea     dx, int41handler7 E' _2 p9 {+ J* v8 P. T/ A% B2 u
    xchg    dx, es:[41h*4]) i2 `; J$ k& P8 Q8 T
    xchg    bx, es:[41h*4+2]
! h4 R) y+ w! t, I0 ?: K4 z2 `    in      al, 40h4 z/ \1 E  }  h5 }) i# j( N& d
    xor     cx,cx9 b% R$ D6 d1 _, e+ z
    int     41h' \, n' ^" g4 O8 H  E( g& z
    xchg    dx, es:[41h*4]
8 [" r6 j' a" k! x+ z* B" E    xchg    bx, es:[41h*4+2]
. ~& Y- }4 C8 d8 b1 u+ d2 p$ V    cmp     cl,al9 Z* C  {5 B$ w+ q, E0 W
    jnz     SoftICE_detected$ ], O7 ?0 o' x! ]( U
8 S4 m3 w3 k) _: y/ c
_________________________________________________________________________  L6 q. H$ f/ k0 C! _5 R
. j8 c; L" n2 @' `+ k
Method 07; X! n2 e* y' d+ q4 r9 W6 ^- t
=========
; |0 x0 X8 ?2 K% n7 f& Y" O* b: w/ Z& _6 ~. T4 j' ]4 J' Q; k
Method of detection of the WinICE handler in the int68h (V86)
& C( I: O( o  W4 N' c% n  ]+ y# K% z) ^" W+ W6 G( Q/ f/ g/ u- C
    mov     ah,43h. I$ Q/ p8 q8 u) [/ K' a# t
    int     68h
+ ]4 m. n( w$ B, ~1 X    cmp     ax,0F386h' L3 U7 R) h1 Q5 B- y( R3 F
    jz      SoftICE_Detected
% [; i( i$ i" R
) T+ y' z" Z5 j0 k* r; t, H; C
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit  Q2 N1 Q7 g7 }7 p% Q0 A
   app like this:
9 C1 v! \. a9 I( E) k/ S  m0 d
. u# z/ q2 i6 [4 o0 A: g- O   BPX exec_int if ax==68( R3 B& e5 T2 B" C
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 B& D. R: ~( [4 O9 g3 [. S' H& _
   located at [ebp+48h] for 32Bit apps)
$ T6 m; c7 P0 y+ Q. d9 s: Y__________________________________________________________________________+ t  ?' u/ Z; T. T4 E5 P+ o
* e% S  C! z( W8 u! t% C

% x2 }: u6 |1 z7 tMethod 08; F6 |  H( [- h+ g
=========
! N. J: i3 h; B& C* w2 `3 P: G. E: V  X
It is not a method of detection of SoftICE but a possibility to crash the
3 t8 E- `8 ]- F$ _4 E9 Gsystem by intercepting int 01h and int 03h and redirecting them to another$ z! o$ S' N& K4 W7 m+ m
routine.
0 \3 y" e% i* |3 Z& z) @+ IIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, J) o5 F7 [# c2 Lto the new routine to execute (hangs computer...), H' n; @+ R& B1 R% {) u) \
+ Q: u5 E+ U! |2 S
    mov     ah, 25h
2 ~; X9 x$ W  Z0 _1 n' W/ t    mov     al, Int_Number (01h or 03h)
! q2 F  i) L  m2 o# m5 |! N    mov     dx, offset New_Int_Routine. [& O+ t1 N( K+ E
    int     21h( A4 }3 D! S: T
+ c1 b0 U7 o7 `- [6 c0 `- O6 U: F9 V
__________________________________________________________________________
% [: _0 G: y" ^* H: \+ A, ^# W) Q  ^% M) N' d
Method 092 m9 ?8 s5 v6 j! o7 R
=========0 m- N; S. W$ l% n" [7 a

( Z) T) X, S4 m3 u/ ~) q8 dThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! L( Q. h6 A/ `
performed in ring0 (VxD or a ring3 app using the VxdCall).
0 S/ D  N: T! @7 p& C; CThe Get_DDB service is used to determine whether or not a VxD is installed
2 U7 t" U7 A" |' n& Y2 R! q6 hfor the specified device and returns a Device Description Block (in ecx) for; C% e* X9 D9 l! I; I; [; d+ z* |
that device if it is installed.
  |, D+ J7 D! {& \4 k! l4 P9 a
7 `  M+ E8 V3 e  z* n0 o: I" m   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 X* J& Z7 D# B- P+ q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 x% P# D* O5 C0 q
   VMMCall Get_DDB+ s- m6 v/ M6 M' q7 Q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! y: c$ H4 O  a8 h5 D9 n, [' ]: h
. ?8 L( L; K3 N) \
Note as well that you can easily detect this method with SoftICE:
3 b+ |1 a; m/ }   bpx Get_DDB if ax==0202 || ax==7a5fh
( x% T1 a3 o2 C5 q6 u: M- u& v' [" C& Z' C) l
__________________________________________________________________________* o4 F: R; c: X8 D: E

: U+ S" g$ I" \" Q* xMethod 10
: Q! \9 \" L; z3 }=========6 |9 V6 w+ T$ u! k
# g5 G$ o* Z6 s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with8 I5 n6 o0 l% m8 d; F) i8 d5 X! t
  SoftICE while the option is enable!!( Q8 y2 U  f1 Z

1 L' t7 i5 m  y) k6 m4 A8 H0 vThis trick is very efficient:( V. |4 z1 g$ q" s* B
by checking the Debug Registers, you can detect if SoftICE is loaded* u3 c8 o  k# @( [, Z3 A. M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# {$ ^' Y) }* q8 I: g7 v$ Cthere are some memory breakpoints set (dr0 to dr3) simply by reading their% c& b  l5 V1 ?
value (in ring0 only). Values can be manipulated and or changed as well4 g7 n" c: }4 h0 T7 G
(clearing BPMs for instance)" n; x& [& r. v% p: d- u
/ U# I, v0 u/ n  l6 [0 P: e
__________________________________________________________________________* x( y5 v- R/ K* o

& l, n- c* F% C: @- h' c7 i" SMethod 113 B- p8 D7 D. t2 z2 x- r
=========; u) y5 |9 |# V0 o& f1 f
7 p3 L! M+ N2 u3 C- s
This method is most known as 'MeltICE' because it has been freely distributed
7 a5 j$ x" I6 _: X1 hvia www.winfiles.com. However it was first used by NuMega people to allow& N0 L' s/ q% c1 S7 D
Symbol Loader to check if SoftICE was active or not (the code is located, u  m2 A+ T% ^9 p: q
inside nmtrans.dll)./ ~. M( i  b: u+ _7 \
8 ~: x5 I. K, w- x
The way it works is very simple:" K# u! ]) X) W0 U; P
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; {; {- d. ^: C, P
WinNT) with the CreateFileA API.% S7 E3 W7 n# y. c; {! k+ o8 [; R" J
6 B& S; }* b) J: n+ m; C
Here is a sample (checking for 'SICE'):% q+ s  I5 w  J) [3 R' R$ T
  n3 z! @) S5 T4 v- A& M
BOOL IsSoftIce95Loaded()1 E' a& |( I7 d8 Y! A/ r( Q
{
& \% l8 z: y9 w, _5 {   HANDLE hFile;  
: _6 J+ j. d7 D   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% V' G5 K, \( F! ]- g% a; C, g9 D                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 s2 ?  n" j; {; ~+ [1 |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 Q/ T% L$ q7 t* S# \- \+ B$ ]
   if( hFile != INVALID_HANDLE_VALUE )4 e# @' E3 r% e/ n4 m1 z
   {
$ Y) L) U& D8 T# j5 s7 K      CloseHandle(hFile);4 |  ]  t; n1 N2 L- D
      return TRUE;
: U1 `. ~; e, u; x3 u3 o8 S: I2 T   }! F/ s* N5 S4 w3 f  R( i
   return FALSE;# S9 v4 d  Y' K) c7 R- N
}1 D4 A8 R' ^7 |0 C4 \5 ?

1 `4 F, D1 y6 A0 RAlthough this trick calls the CreateFileA function, don't even expect to be
$ q% ^8 d6 s' c7 [+ _able to intercept it by installing a IFS hook: it will not work, no way!7 p9 V3 m8 w( |6 R
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
$ L2 v, a* y3 ~$ |; oservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) b1 U) h: D1 A; [/ O6 b4 V0 c
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
, o' z; p% h0 y" |: qfield.; q, Z2 j! q+ m9 B6 w; P
In fact, its purpose is not to load/unload VxDs but only to send a 6 a3 |* E5 `! f. P  a6 |$ y/ O
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 b2 A0 K. H9 `# r5 q: A. c0 K
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' u, N* y9 F2 J( M4 g$ _
to load/unload a non-dynamically loadable driver such as SoftICE ;-).3 z" f) U4 D( m* x0 }' n
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* f4 U" _; q. K. A# Q! B. ?its handle to be opened and then, will be detected.
8 E: l4 ?1 {! r, ~6 y4 P2 fYou can check that simply by hooking Winice.exe control proc entry point
8 W; `/ g$ v2 n9 j9 l( `# H! Fwhile running MeltICE.
4 l* d) T+ F6 P4 J6 m# m7 A. ~: B) A7 J& q3 O, S, B' k8 W/ G2 _
- `' @) @1 B4 A) ^& E
  00401067:  push      00402025    ; \\.\SICE
) ?$ Z3 j; T2 f" }0 V  0040106C:  call      CreateFileA
. z8 s" r: ~% A: V1 ~) v* ~" a  00401071:  cmp       eax,-001
! M# S7 I% j% |6 ?9 n) M  00401074:  je        00401091% ~# T! o# q+ d, F, X" r# d* K! m& |

) s3 G  o- _1 l* M& l$ d  l9 O8 l' C' V0 O, ~5 \: q" \
There could be hundreds of BPX you could use to detect this trick.
, V+ A1 e+ y) ^' D-The most classical one is:# @% G/ W: `' k# i
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 ~) b% P5 y) Z6 t    *(esp-&gt;4+4)=='NTIC'
1 D2 o' G3 _! r6 [' }7 R7 Q0 `# N# t7 _! k: w4 F! f8 x
-The most exotic ones (could be very slooooow :-(- ]+ P- k! Z5 }3 U- N
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 c+ K+ l5 `( k7 f: y8 ^     ;will break 3 times :-(
; p- t6 m: G9 `& T; V7 x, _# U3 a/ T1 x& }" k2 @
-or (a bit) faster:
+ K4 W; B( P& J   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) p- ?6 |. f6 e( y$ g# F$ p& ]

7 u  B9 K+ N2 v; M  \   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 \2 l$ V0 ]$ g     ;will break 3 times :-(
) c- n4 q0 f8 T3 _/ u$ M
! t, v) S( b: L$ f-Much faster:
* S. ]5 k0 {- H) _2 h( E: n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# H+ l& E: o3 |( c* g; F( j5 ?" g4 g5 y" u) j/ e% @
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* b+ V4 i3 |5 D9 `' w% P% efunction to do the same job:
; H% P8 _% i* |( h4 E& R
: c+ x$ c9 I3 K' E' N& e% d9 o) [   push    00                        ; OF_READ
" N4 a/ C$ u0 c) \  I- H   mov     eax,[00656634]            ; '\\.\SICE',06 W4 K% V# [7 t4 L" }2 u
   push    eax/ L- ^3 A, A9 J" O1 q* m' O
   call    KERNEL32!_lopen8 x" W* |+ Z. S- e. C
   inc     eax9 Y5 }; |$ Q: W* S" ^; M: {
   jnz     00650589                  ; detected
0 p! \9 U* F; v& z+ D   push    00                        ; OF_READ& r4 O! q& {0 J. H! N: U4 G
   mov     eax,[00656638]            ; '\\.\SICE'' Z( `  S5 M, E/ V; L
   push    eax. c6 H7 e) ]  R! s( O. F
   call    KERNEL32!_lopen4 Z9 D, ]3 s& @' X5 T
   inc     eax
  F( Y) B  [3 U* L" j0 c( B   jz      006505ae                  ; not detected
, g6 m, \9 M( Q; L3 W/ \* d
$ @: J3 Q4 d8 U$ U( Q5 B1 W% ?- m, i; b. A  O- E  o
__________________________________________________________________________8 r7 m* r- M: h5 z2 e2 ?
7 }' g& s  W! l+ ~& u: I
Method 12
- _9 \/ w) `9 C$ o6 D=========
6 D- p9 c" T. Q; v6 n
" X4 L4 E; A  P- c6 dThis trick is similar to int41h/4fh Debugger installation check (code 05, ^' p, A  k0 Z
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. Q8 I+ {1 `- U7 q: Vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 N2 ]( Y/ C$ `8 u! K4 E' ]$ ]
/ z5 Z3 @# X+ v" M7 [/ \   push  0000004fh         ; function 4fh0 `& C: m3 i* o5 X) r2 K& r
   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 W( ?' ]! \) ?& K* w4 K( U- l( L& X. G, M2 G                           ; low word specifies which service& u8 m# W/ h$ F5 t
                             (VWIN32_Int41Dispatch)
- B. {+ v6 q, U2 u# c3 |   call  Kernel32!ORD_001  ; VxdCall5 [% Z7 d1 B; E5 g: t! v8 _" T- Q
   cmp   ax, 0f386h        ; magic number returned by system debuggers
3 z' f6 ^3 i8 \. n) B+ C- B   jz    SoftICE_detected
7 ?  [+ b3 x# J0 D& U; l, a2 o# ~  }0 j+ f" v  D0 U
Here again, several ways to detect it:5 A5 x" n7 v/ U# e
: z2 F/ d, i! @' d* n
    BPINT 41 if ax==4f
" w3 x5 c) z: C2 y: ~8 s
6 S8 i, \- d6 w/ U* Z$ g0 o$ Y* q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 k& d& ~' y2 o3 O4 M5 b0 H, [! A* x) i8 m
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' ]& g. }9 D3 D' g! I0 K) ~. ?9 i/ I1 ^% i

- I- @6 N$ g& U8 K    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 {8 L8 V6 D) t$ o
# K$ B8 u7 c1 O, X/ |5 V
__________________________________________________________________________
( D0 }+ T2 p" }! O. S- q0 Q  |6 d
* O& P7 M' x( ^8 RMethod 13
  Y+ Z6 e% x5 r' Q: b7 z! a$ f=========
/ J; a. ?. K9 Y+ |' ?$ e$ k1 v% ^) f* _5 D
Not a real method of detection, but a good way to know if SoftICE is
4 _( L2 \+ F9 i9 Q; Ainstalled on a computer and to locate its installation directory.
2 Z9 z1 G9 s  B( U& t0 g( dIt is used by few softs which access the following registry keys (usually #2) :
5 ?6 H, t+ |7 J5 W- |6 D
$ K4 ^- C% G5 q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- O3 F7 y# [! @" y1 |6 v# e6 l\Uninstall\SoftICE% t$ Y' y0 _1 s9 k# a
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% B& F  p3 F1 y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 N2 s4 U* E5 q) e. f
\App Paths\Loader32.Exe# _# W, D4 c7 e; M5 S
/ X6 |% `2 B0 }6 H+ I8 J. O1 H3 M2 U  F
' e! o) ^' N4 g1 Z; w, J* _# H* d
Note that some nasty apps could then erase all files from SoftICE directory
$ R/ y* x$ I# p6 _(I faced that once :-(- V8 P/ M) W# [! @  R$ L4 Z5 {

/ V& \. R6 B  n0 g$ nUseful breakpoint to detect it:
/ g/ o) X" q" W9 f
: s3 p/ r& ]( e% f/ Y     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 m1 U! {& s8 @. h6 c( n$ G+ H9 M# D
2 ^+ t( Y  m. w$ c
__________________________________________________________________________
4 _# v: D) a0 ~3 j8 H% v- t5 z1 `! Q! F

2 Q' G( L* K+ `! m. L3 tMethod 14 4 v, T7 C# D' Y, ?% D- k, A/ t
=========
: q$ K  P4 g  l. R" [9 {0 J( ^
  z$ H' ~! X% g6 k% L5 C9 C6 WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 T8 @/ _6 n/ s3 }is to determines whether a debugger is running on your system (ring0 only).) \) f* f  c% Z# t- I

) c2 [( C" j- N   VMMCall Test_Debug_Installed; {, k8 k9 d- ]
   je      not_installed, y0 A0 i+ o1 j$ r

1 B' R. M- q1 k6 R1 C( V" fThis service just checks a flag., j8 \2 l  x5 Q+ c" X, C& Q2 A
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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