About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" Q" M$ ?% N" X/ K5 k
<TBODY>
6 z2 I9 k/ i  Z; @9 _' ^( \<TR>
0 n' U9 Z! }' u+ I* {<TD><PRE>Method 01
6 x& q) i0 n- W0 c8 n0 a  u0 R=========: `" m# I7 `* p& V

$ v% o5 {2 ?# ?This method of detection of SoftICE (as well as the following one) is
( W( v( j  j  X4 G/ Iused by the majority of packers/encryptors found on Internet.
; I8 r3 R# i1 T$ A' ~It seeks the signature of BoundsChecker in SoftICE
/ ?, ]: U5 x0 I- h3 \
- n, w: O7 ?6 Z8 Z    mov     ebp, 04243484Bh        ; 'BCHK'
/ V9 m1 K' \* P; {" c    mov     ax, 04h8 }% m) s% a8 r( ~: [3 D/ @
    int     3       + |/ a' m' g6 z! g* z5 Z* {. f
    cmp     al,41 j0 Q$ N" V/ s
    jnz     SoftICE_Detected
9 o+ h+ d7 i; e, t* |, r/ i6 x) V; C3 k9 _/ X! E- I
___________________________________________________________________________
8 n; m! n8 T1 M: {6 i  a) X
3 r/ ~8 |3 P2 gMethod 02
9 x8 l+ ~4 r* C=========
- H4 d6 T& C0 D$ O+ W8 h6 W4 Q6 G8 ~; n" e  a! o5 P; s
Still a method very much used (perhaps the most frequent one).  It is used1 K* M1 |8 |1 J, l5 m5 V
to get SoftICE 'Back Door commands' which gives infos on Breakpoints," w! Q- a# {9 R* I/ m* F- W5 {
or execute SoftICE commands...
3 ]/ k, U% }( VIt is also used to crash SoftICE and to force it to execute any commands- b, g! J  ]& ?1 x7 z
(HBOOT...) :-((  / a/ }. |6 r7 Q( R3 `$ Y7 w

+ U, [! C9 T( rHere is a quick description:* Z; L; `/ S3 P" b7 c: \
-AX = 0910h   (Display string in SIce windows)
, s. e$ a  Q; r3 H; M/ g-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 f; `+ a& I" p3 w! x-AX = 0912h   (Get breakpoint infos)
% N* }- M$ C( ?4 p% D" Z9 i-AX = 0913h   (Set Sice breakpoints)) M$ B( y/ _3 l0 d  b( V$ D% P2 l
-AX = 0914h   (Remove SIce breakoints)' a2 p/ S  S% p2 w8 @
8 ]$ Z/ g2 w/ C  ~- F
Each time you'll meet this trick, you'll see:
9 M" b% i9 [" s" o3 U-SI = 4647h
. V" I: t+ H! z# o0 Q-DI = 4A4Dh
( ?. `9 ?1 \  J! g9 S& w' H+ ~Which are the 'magic values' used by SoftIce.2 g- R) D+ [! ]5 O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, h8 `; G& p; ~2 G& G5 H! ^- M: H% S0 E1 s
Here is one example from the file "Haspinst.exe" which is the dongle HASP
! K& z+ E$ }, TEnvelope utility use to protect DOS applications:
& O& {  I$ R+ s" D
# ]# L  I  J8 x, l; F, w/ T/ m& O  a" `+ a! G1 k* v( d  W
4C19:0095   MOV    AX,0911  ; execute command.
( B8 {; m4 p1 q+ g4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ k! W5 k* v% |+ }
4C19:009A   MOV    SI,4647  ; 1st magic value.- Q7 ^4 {% b( U3 {: Q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  F1 Z) S, j& V4 k0 F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 C; w7 R. D( Y9 p
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute1 n$ H$ s; X8 q4 f- Y  I
4C19:00A4   INC    CX
# z4 i# F4 s" A* O, r4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' R; O! j4 t. [2 n/ L( l
4C19:00A8   JB     0095     ; 6 different commands.' I; V; s2 @: I7 D' j* c2 U
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 u/ D; }5 }6 K
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ k7 I- n5 y0 z8 p' ]
/ N1 q' S7 Z0 y( N6 e$ uThe program will execute 6 different SIce commands located at ds:dx, which
. T3 ]1 V* @0 [, kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 K$ H8 C$ G1 z1 x6 P6 z, |3 W& H" [9 A1 b" y
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& N& m  Z1 D5 M& d- ~8 x
___________________________________________________________________________
" f8 ~' O% \* r! Z% I# v5 l2 ?+ s& V$ [+ v+ u5 w

6 d/ g  a5 A- G' \Method 03
" k; e2 l( h" b=========
" T5 W0 K8 R7 K' w9 P5 ~- V; T9 B  k* K( M* q
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* Z# N- a. k, l' F& J7 U  ^, F( W! y
(API Get entry point)
9 r$ N+ g( X; R' F0 c        
: [% Q' M6 E2 [
0 H- ]9 r/ J  u- l  ]9 m    xor     di,di' ]4 u0 e' K6 Z2 n6 x! g
    mov     es,di5 q! [- g9 e$ X" l. ]& L* k, C2 x  x
    mov     ax, 1684h      
+ s' b: k: `6 J. [) R4 e    mov     bx, 0202h       ; VxD ID of winice
# q' a% v) }" L/ i    int     2Fh8 A+ P  ?, U$ C1 W5 ~) \" d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- |; X1 ^+ D0 w5 W    add     ax, di; m8 O( e" N! K6 w  L! I
    test    ax,ax
% p; i1 X, e& l5 V; l7 n    jnz     SoftICE_Detected
+ H$ b9 R) t7 l
+ s3 y' W* L  H___________________________________________________________________________
  p  H6 W  J& j& g' W0 j% Z" |7 Q5 @3 |
Method 04  X9 Y  @9 T! F$ v
=========2 l$ a/ L" ^7 z) Z  |2 b9 ^
( k5 m. H1 b1 e4 M" |
Method identical to the preceding one except that it seeks the ID of SoftICE
0 }: N3 [& N' j7 A+ ~5 N# RGFX VxD.
1 ]) g) i! R4 F. n. v( e& U6 U& I( d, c' D7 f" s; c* T
    xor     di,di- \- B8 w6 d" R6 s. ~
    mov     es,di1 F) }9 N9 r. \. P
    mov     ax, 1684h      
/ |) t: A; h+ S' E2 \    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ i1 q$ Q( k4 E3 P+ D
    int     2fh, o- W" ~) z1 G$ u9 M  q; o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% W# v) M3 b" `1 m; f* [! Y. @# w
    add     ax, di
0 t6 l* v) K" V. y    test    ax,ax2 J0 r# G. D! @, f+ f6 W
    jnz     SoftICE_Detected3 c* {' g2 ?" f5 h- _

( Z9 m" V3 c$ b& N/ Y+ t7 y2 A4 |7 Y__________________________________________________________________________
$ C$ U) a% r1 m( r& _. s' [4 i, L9 f/ Q" W( _
% N- L- B% M0 g$ S
Method 059 [1 p  P- }; k% T1 Q& t
=========
( E# ?$ X2 h* z# v8 q
4 Z' M, _$ x2 H/ LMethod seeking the 'magic number' 0F386h returned (in ax) by all system
% R$ l$ m: E: z1 Y  I5 Wdebugger. It calls the int 41h, function 4Fh.
" f- W( @; _# d& M; v9 n: ^There are several alternatives.  
$ g3 M- b6 R7 N# Y2 p* A% V2 p5 K8 M. J6 p$ }$ d3 Q
The following one is the simplest:2 d9 O, Y& N5 G: c0 t7 h

# {" v$ i% b5 R6 c' A. U  R6 T1 D    mov     ax,4fh
& _+ c, v' W( O" q    int     41h! y4 z7 ^2 b' L5 ]
    cmp     ax, 0F3863 X4 a/ _; H8 h# e* p
    jz      SoftICE_detected
5 Y2 Y% [5 w& l* G1 z% R0 B6 m+ }) C
  L2 C, q2 E5 Q  |8 v
Next method as well as the following one are 2 examples from Stone's
% Q* C! \5 \# K, c0 r"stn-wid.zip" (www.cracking.net):
3 Q9 N) x. N0 u/ r" O& |) ~) ?! Y
8 b$ m; O! Z% Y' f- J0 \: }2 B    mov     bx, cs- S/ v4 g7 h( y3 I
    lea     dx, int41handler2" S) O9 R6 P5 y: s! r7 y$ N* H
    xchg    dx, es:[41h*4]
. X9 g( `1 \5 e) [) b# K# P: ?% }0 p    xchg    bx, es:[41h*4+2]
3 D$ v8 U) b0 v  p1 }( X    mov     ax,4fh
4 `$ h4 M, d. L6 a. S    int     41h% h) g- q, Z! p" M9 d2 `& k
    xchg    dx, es:[41h*4]8 u" _: L+ j8 T: Q1 [
    xchg    bx, es:[41h*4+2]$ o' Y' H# S4 k) g6 w) ^+ u. n
    cmp     ax, 0f386h
8 K8 [6 b4 K) b* f; ^    jz      SoftICE_detected
. I4 _. D: U) U9 Y# ^, s4 E5 X9 y) H% A/ l
int41handler2 PROC
  r. y8 I% a+ G) d0 S    iret$ c7 c) G+ D" U: Y+ {9 v# ~' O
int41handler2 ENDP9 b0 o; M' A9 f8 Z. c% u' m2 ~* z9 k
$ c; E: x, t3 d4 R8 j- x

3 A# k/ T3 t7 v/ \# __________________________________________________________________________
3 s' `0 `' |& J
( c; k8 j4 g2 S4 I) s
/ m  _% {& B1 o( P/ hMethod 06, d$ ~/ m$ [2 }! X  Y
=========
: P) G" i; Q" f% q: }6 s
0 Q9 B0 F& C6 m& p: m0 t3 h: x2 {8 z6 T% l" j: K( Q
2nd method similar to the preceding one but more difficult to detect:
$ H) K& q( _5 K7 `$ n/ Q2 @" X- @# Y3 N6 b- {! K0 L

# J2 G4 s) T) C2 vint41handler PROC
# Z. s* q. ?$ Y4 j& R8 l2 }    mov     cl,al
* X* t" n3 C4 K    iret
0 h9 c; S2 L* g1 H' O7 h( Oint41handler ENDP
  a0 N1 ^! R. G" R4 w. Y' f
* B, }/ U. {4 Q* s' ?3 f, R4 ~
! l5 L3 B% H% {4 L9 `    xor     ax,ax
* F0 t. [2 V- _    mov     es,ax3 B+ \& b7 U) d% F; ?0 _2 B
    mov     bx, cs/ O! E' c/ u1 d# }1 D; R7 K
    lea     dx, int41handler0 u7 m: @& L% x( n: u( v
    xchg    dx, es:[41h*4]4 |+ }. Y1 O) [3 p- I! h
    xchg    bx, es:[41h*4+2]
9 a& r9 M, l. D; |    in      al, 40h) h2 S6 b, n/ c
    xor     cx,cx" }. K* i4 ?' a$ i# b# \
    int     41h
# x% H8 G4 F' L3 [    xchg    dx, es:[41h*4]
6 o2 b( Z9 G5 |- n" D    xchg    bx, es:[41h*4+2]
) D8 g2 B2 ?; B+ ?6 i    cmp     cl,al& P) \4 g! V4 l" `* O2 d
    jnz     SoftICE_detected
, e3 r' q' D" c- S8 p9 F* p
( }' ^, C7 f3 \/ H* s_________________________________________________________________________
# H+ [' J* e9 H! g7 _0 n4 R1 y9 Z9 `1 S4 k/ |- k
Method 07- v( B% E0 J, J& [
=========
5 u# W) g) ^6 f# E2 z: T% x) T2 O: ]# B0 {0 ]5 c# `
Method of detection of the WinICE handler in the int68h (V86)% B  ^0 y' a; B5 K

9 y2 Q* d: z( q* s) X1 S; E    mov     ah,43h
8 b; h! H1 p; g  l. o    int     68h$ r  n. u  f$ J2 g- a
    cmp     ax,0F386h7 m% X8 H) b- q; }
    jz      SoftICE_Detected
- @$ v4 s1 i$ i2 h5 @, O# Y. x: H' z! w
( o- N+ u( I6 Q9 Y/ f; _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 h7 a8 L! g' w8 y   app like this:0 I/ y( E1 u9 V

) q' E7 N6 n7 e' Z   BPX exec_int if ax==68
! p' Z. T; j& e# c; S5 L3 ~   (function called is located at byte ptr [ebp+1Dh] and client eip is
, S& Q) ~% z. i0 [   located at [ebp+48h] for 32Bit apps)
! L% ~7 K2 h! a! e__________________________________________________________________________, m( f# v6 ~1 t7 v

$ ?: S( d/ ^$ E" d" y8 E
- j  \+ c0 p5 {6 DMethod 08$ B0 @4 K, c# I! t
=========! C) d: \9 Q8 h" N3 t2 v1 u
  l0 B. E5 s; H5 i2 _% w" d: x/ F6 d
It is not a method of detection of SoftICE but a possibility to crash the
, n9 k3 l# M# C* g( O8 asystem by intercepting int 01h and int 03h and redirecting them to another; {$ `( U7 p& ?% O3 o- W
routine.# }% P8 W; v: F% W3 `" q2 {
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points- p" C. j7 S4 Q9 [3 D/ E. ]
to the new routine to execute (hangs computer...)" {, I& F- }% Q2 W  T
+ @9 r  N9 v; {1 L! [/ F4 v1 q) b; X
    mov     ah, 25h* {8 R8 @; q% {( }, c6 Q/ p
    mov     al, Int_Number (01h or 03h)
& S9 ]9 h9 X! B    mov     dx, offset New_Int_Routine
- U* |5 Z7 e. k4 a2 s% c- J    int     21h
7 e* x- [- O* j- E: }, G) ]& D& [9 r- ~
__________________________________________________________________________, \3 G5 n% v- W) M$ R- k! Z

. C% v6 i+ F& i  R7 m; _Method 090 ~4 v2 t. F; z$ P
=========
8 Y9 {& q& B; e* Z5 ?" C/ y6 G5 U- N6 R7 {
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only, M& ~7 F5 I  y* l! W- i
performed in ring0 (VxD or a ring3 app using the VxdCall).
' N, \1 ]6 B) @  R+ \  vThe Get_DDB service is used to determine whether or not a VxD is installed0 V# F0 w! Z$ T- ~
for the specified device and returns a Device Description Block (in ecx) for
0 d$ t* I5 D# _* g/ pthat device if it is installed.
  F, U+ _/ l! D% w. x
: ^" `1 g6 Y! z3 O! Y* Q+ n6 B( q" \   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
8 c  N0 P& R+ U6 S   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), v! m5 H4 n: @1 a* W6 U
   VMMCall Get_DDB2 T: @* M& g. `, _/ r3 S
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 M0 u. H+ g8 c8 p/ R+ [
! `; e: ~9 V6 Y# F- C, [0 hNote as well that you can easily detect this method with SoftICE:7 M" W$ o- O2 t' p1 Z4 P
   bpx Get_DDB if ax==0202 || ax==7a5fh
" V& s: `5 g" R7 z. m9 S* x2 f! c! Y* A$ M+ `
__________________________________________________________________________+ [( b& U- ~2 T

6 w9 y$ R6 A% l9 M- o5 j. `1 k% L0 Z0 WMethod 10; W* C2 y& j3 @* ?- x6 {% Z
=========& q' C2 `) I# r8 A

7 _. u" K6 j: v% {=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
1 U- M6 d" G" O5 }& X7 F6 [, B  SoftICE while the option is enable!!
0 i" ?$ n: s& k6 E9 e* l, i1 J. p6 U" w$ p1 b1 ^
This trick is very efficient:
9 }8 S' L1 n" h& qby checking the Debug Registers, you can detect if SoftICE is loaded
1 c' d; X& w% o6 h% N  {(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 Y$ X7 Q/ Z% U$ e: y1 l" @: p
there are some memory breakpoints set (dr0 to dr3) simply by reading their
9 L! k+ j; w3 s& _3 _! [  Dvalue (in ring0 only). Values can be manipulated and or changed as well
/ k6 ]. `2 P/ x- c* G(clearing BPMs for instance)
6 C, v4 O# k. e/ l6 I
2 I! P1 M& @; `# @1 t! |4 L7 _) M; t__________________________________________________________________________( m5 N* I' l1 E

! G0 i; n6 w0 Z3 }Method 11
8 j  |2 J# v6 n9 l2 R=========
" j; k$ m9 j. G6 A) w3 N3 D0 z
1 m/ |: |* z* @4 ?; kThis method is most known as 'MeltICE' because it has been freely distributed
1 `& W$ {; F' avia www.winfiles.com. However it was first used by NuMega people to allow# T+ e3 |$ b7 m  G1 i3 A' A1 y
Symbol Loader to check if SoftICE was active or not (the code is located$ z% D0 l4 S) F2 J# O8 C
inside nmtrans.dll).
9 [& f, b* j) f& \: x5 A) f/ ?5 m4 `  y' z/ x2 t
The way it works is very simple:& l" r- h" f0 A: ^
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# O# K% A6 {( }8 Z6 b( i2 @3 kWinNT) with the CreateFileA API.2 Q8 s/ W% O  K# w' k

4 i7 W: S, W6 M: R& C2 FHere is a sample (checking for 'SICE'):
( u, r; [* @2 G& r7 _3 ]8 S; P# B( `, i& L: q; k! B
BOOL IsSoftIce95Loaded()
5 q! ?1 l* b1 K{! \8 h; G. x" y$ x/ O
   HANDLE hFile;  
2 F! ?" _) p4 j# w$ \. F   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 N% o0 d7 b& j8 T1 L) J
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) Y, K8 c1 C* X; p0 {0 ]                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 R1 T- D* a$ _( I( f4 [
   if( hFile != INVALID_HANDLE_VALUE )
, x: N* T* r8 }. K( @   {
4 v5 G" e. |0 z      CloseHandle(hFile);
+ u9 A# A$ U8 a$ G: e0 W      return TRUE;2 p% j4 h* J3 a8 ?" n
   }
8 g$ k% E/ O, P; E3 r. u   return FALSE;5 g: U+ P9 {1 }& A+ t" o( r
}
8 {3 r# s- N2 ~/ s
6 U/ U# }/ r1 V1 q; C) AAlthough this trick calls the CreateFileA function, don't even expect to be  r) Q' M" Y# C6 s' v
able to intercept it by installing a IFS hook: it will not work, no way!6 N  G3 @( {& J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
( o% l; N. u4 S, }& S# nservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 ^( u8 b' x. s# E2 G
and then browse the DDB list until it find the VxD and its DDB_Control_Proc3 j/ {" T! m  i+ O/ |
field.
. r! `4 E0 U- h% X' JIn fact, its purpose is not to load/unload VxDs but only to send a 0 @; r) Z( L1 {9 h+ y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% D, h7 P& d/ C, P: Z% Ato the VxD Control_Dispatch proc (how the hell a shareware soft could try
* k6 L* u, L& l$ `: z& Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).) F, N4 m; a, U8 t" s) w$ z9 w
If the VxD is loaded, it will always clear eax and the Carry flag to allow
, v' K% F& J! b. k1 j% Rits handle to be opened and then, will be detected.
5 g& H( H  i4 `. OYou can check that simply by hooking Winice.exe control proc entry point) F: Q9 O; U* ?. [7 C5 j
while running MeltICE.  ~$ @5 s( C7 Q9 X+ J/ i- z

/ g2 D9 O' |. S+ A0 d/ d, q8 E; [9 z2 ^* U" y+ Y) t5 B( l* s
  00401067:  push      00402025    ; \\.\SICE
3 I1 [; N5 g5 B, P- z6 I  0040106C:  call      CreateFileA
6 }4 E8 m5 d$ X( K  00401071:  cmp       eax,-001
$ h3 |  F$ Q' S  00401074:  je        00401091
- I$ W) E9 e  u9 x) Z& T1 T
: V: w+ \8 U) `" `" L% C
# p$ d/ Y) ^& o3 WThere could be hundreds of BPX you could use to detect this trick.# I& H8 v# x; Z! V) K
-The most classical one is:
- h3 p% r: V9 J2 `  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 @. }6 _. N4 I& s% N    *(esp-&gt;4+4)=='NTIC'
7 w& h. ?7 l8 `3 f! V! l4 Q5 M7 h  s( |, X& t. J) R( z7 m
-The most exotic ones (could be very slooooow :-(
- P$ C( e. `! z4 g   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( O, H; m( X- c/ y0 W- ?( R, k
     ;will break 3 times :-(
. e( o1 w7 `/ D* B
) s, I9 J" S& Q! c/ H-or (a bit) faster:
. w/ U. y6 D3 p   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 i3 i. Z9 Z+ J! X- R3 n
+ g! g+ T. n; k0 p
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  % W: B! ?4 v3 v9 [
     ;will break 3 times :-(
8 `: b) F. H2 i$ g
. M3 ?6 D# R# n' V  K& ^, S$ _-Much faster:
/ A( E  W- ?( k) p3 _2 ^  j; H   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
2 N# X+ N+ O9 j; |# {* n; h8 h+ L8 v. [6 M2 ~" k, h1 r* b  Z# d
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen0 s$ ~7 D8 M9 M/ I  j$ _
function to do the same job:3 m: x) s9 y0 C# }- \+ p

/ T2 _" k, h* ?% K! M3 L   push    00                        ; OF_READ# W* R% m; e; W
   mov     eax,[00656634]            ; '\\.\SICE',0
9 O3 D! P/ b' n9 D% f0 r   push    eax
; K3 `! N- V! o& n   call    KERNEL32!_lopen) k3 W1 E/ g3 [1 F; u9 O5 g
   inc     eax
# z6 f  [( D6 A5 X   jnz     00650589                  ; detected
) ]3 t" a+ r& r   push    00                        ; OF_READ- M% b1 K# M) y: q4 D, \
   mov     eax,[00656638]            ; '\\.\SICE'
& k3 n" Z) p5 m$ k5 M0 U, ~' F3 W   push    eax1 K% D# m' B9 G6 o7 c$ Z
   call    KERNEL32!_lopen  G  x6 q- r! e
   inc     eax
8 c9 V7 i9 q+ b/ h: U3 s   jz      006505ae                  ; not detected
$ R  u; J) q% l- b. }
3 C& f$ A% [  t( u) v- ^" o3 s+ C' I, t8 r
__________________________________________________________________________
$ c5 r! |0 N/ B( O" B6 n2 u: I. G: h' T, H0 `% u
Method 12
: e4 u) [, T6 ^7 l=========
% y- g( O9 K1 J/ x6 b6 U6 H& M6 k. [+ x! B
This trick is similar to int41h/4fh Debugger installation check (code 05+ B' s" T  m9 C; |. h
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ N% w; N/ o! R0 K8 i6 o- i- zas it uses the VxDCall backdoor. This detection was found in Bleem Demo.; [3 |/ D6 y. V% M. O. z6 @) U! A
* T8 E6 a6 k1 ~  _
   push  0000004fh         ; function 4fh6 T1 I0 {! j4 q+ ?! g5 Y
   push  002a002ah         ; high word specifies which VxD (VWIN32)
" G3 j' r$ b/ K  J  ?- x* j) u0 w/ C9 `                           ; low word specifies which service. i: f6 ~: A' i: d$ l
                             (VWIN32_Int41Dispatch)
/ N' q" g4 c( ~   call  Kernel32!ORD_001  ; VxdCall$ I& f5 `! w5 B6 N1 B+ ^
   cmp   ax, 0f386h        ; magic number returned by system debuggers& k- Z* b6 h% ?' p# d
   jz    SoftICE_detected/ r0 H' X4 @( e* x4 y) C
1 w% F8 F( U6 C1 _8 j; L1 J
Here again, several ways to detect it:
/ F7 u& x- C+ w5 c. N% n- q+ `: g
- x! a4 A# V5 o    BPINT 41 if ax==4f( ?+ C! k, w+ ^" ^/ S6 F

6 ]2 }& z% q% B( K0 L    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 [: r$ Z1 {. [; E9 K: J. j
2 [( p4 q* [. H0 W  H- R; E    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 Y* J% N6 J( t3 H+ R+ y& e6 s" Z1 M, a& U% ~5 v
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 X& w5 O0 X2 h: |9 Z! e! L1 \/ f+ z$ o2 F
__________________________________________________________________________
- {* I$ r$ o8 d: X* z  R( P3 c
. L+ Q& G% s3 P+ Y8 `# xMethod 13
' u1 q* v6 Y0 b6 `  Q8 M=========
, z' G* [: A0 `3 C5 j% P9 u' k9 E
/ G6 b! g7 j2 Q- [Not a real method of detection, but a good way to know if SoftICE is
* a1 R2 s2 z2 }5 g' _7 i7 A* Jinstalled on a computer and to locate its installation directory.
. }+ f( s, E& x6 zIt is used by few softs which access the following registry keys (usually #2) :
3 Y8 W  I- O! a$ c  A# C4 u2 V+ d+ a- a, s4 \! _
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 y9 T7 X. r& y8 J$ l# q9 l
\Uninstall\SoftICE
+ }; |2 z9 C  a: F2 }% I6 n4 {-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* y3 R: S' \4 M9 b2 U-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ |& h' Q! T5 c7 g+ Z) V7 s
\App Paths\Loader32.Exe. o7 @) _  \# z2 F
0 s- r+ R% H9 G, e

$ n; m) c. f7 {# VNote that some nasty apps could then erase all files from SoftICE directory
, G* P) N, \! F  k( e- B4 d& ](I faced that once :-(/ \( [" F% t0 K; K) e7 y, f( t+ i. S
6 `4 Z2 x+ a8 G9 v. B6 X+ \5 P5 A
Useful breakpoint to detect it:* s0 q: `2 B# c# Y: Y" ?) L# q
" h' K! O' h+ C7 Z4 d
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 H% u& k0 x: m; M" p

4 [* U$ V/ @) B. K8 j% U__________________________________________________________________________  z& o: C# H. S3 y, w

1 T9 Z, p1 C  c) R' h$ ]8 n. W6 ^& ~5 g$ L/ r
Method 14
6 u- P/ v% ?" }* K9 m5 B4 x=========0 K! s' N6 B9 i3 a) ]

' @- U; q) H  b. @% jA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 a$ Q" S' S1 C, {' u  a$ N" Ois to determines whether a debugger is running on your system (ring0 only).; z& m6 |6 `2 |
% }2 d+ @# F: P, `+ O0 I1 T( N
   VMMCall Test_Debug_Installed
' a$ U5 Z8 a6 c' }3 x+ m   je      not_installed
8 [3 d  V2 R# z6 q3 R2 c% [! ]. C7 V& T+ r7 H# K
This service just checks a flag.9 f8 D. E( H% u4 a; x! v( b( h9 R
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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