About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>0 S( Y$ a  g4 i
<TBODY>
  Q+ h+ S, |& ?* }. }/ Z8 b* j$ f5 R<TR>
" t2 Z7 G/ p# i: ~& v<TD><PRE>Method 01
! k( S. q. }& J$ q7 u5 ~4 y=========
5 r! s; M0 H& {- L
. ~2 X2 ?1 U1 i5 IThis method of detection of SoftICE (as well as the following one) is1 `. S+ Q! I% H
used by the majority of packers/encryptors found on Internet./ ?9 l6 U' G) [3 S+ I+ j$ n# v' q
It seeks the signature of BoundsChecker in SoftICE: g3 z! i& h% D8 ?

7 O2 `( z' [# A+ k; G. d    mov     ebp, 04243484Bh        ; 'BCHK'6 s% I- l. f% q# O5 F( o
    mov     ax, 04h6 j2 T8 y8 g9 W/ a# a
    int     3      
, D( S; d5 Z2 f/ ?    cmp     al,4
( H: I/ b+ @+ j0 r2 j    jnz     SoftICE_Detected8 L/ J3 g$ E, f7 T
! Z+ s5 g2 q0 A
___________________________________________________________________________
# L1 l% M  L) G9 e+ ?7 f3 h: z  w) g5 O4 W+ x; ~5 u' e7 M
Method 02% y) L5 B" _6 ?- ]
=========$ G7 T4 z+ ]# L6 t

# V  S3 i5 A' PStill a method very much used (perhaps the most frequent one).  It is used" p" \  Y( h4 L2 Z8 I
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,' Z! Q! j4 f5 a3 \
or execute SoftICE commands...
( N& L! R4 i2 s3 _) F# lIt is also used to crash SoftICE and to force it to execute any commands, B) T2 x2 l, T" F
(HBOOT...) :-((  
+ ^' [3 k4 a0 {  ?
+ C0 Q  Z3 y! d/ Q. |Here is a quick description:
$ h( Z( o7 h* l. k# J. W-AX = 0910h   (Display string in SIce windows)
) Q( N2 n. E; D; l" B, f( J-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
' y) X! e% Z0 x. h0 G-AX = 0912h   (Get breakpoint infos)
  K7 ]& \: m, f9 U. I6 Q8 O-AX = 0913h   (Set Sice breakpoints); E# F: K  _  g& W3 _. \
-AX = 0914h   (Remove SIce breakoints)
! [, ~8 I5 ^+ }5 Z, w% T+ I: w) @1 s& f# s7 m3 H
Each time you'll meet this trick, you'll see:- @3 T: N! G1 n: \7 C4 _( S# Z
-SI = 4647h
8 Z3 K4 J- U; G4 ?# b( p' ~-DI = 4A4Dh9 k% ^6 q- [2 u+ y
Which are the 'magic values' used by SoftIce.
5 c* b' A; X) z5 \) B2 V% CFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 p2 `" \& x6 ^0 ?& s
7 Z! R, O7 W9 g- s5 b7 x# e4 l
Here is one example from the file "Haspinst.exe" which is the dongle HASP
0 q5 [! b9 M6 z+ |% nEnvelope utility use to protect DOS applications:
2 ?' i  H$ J' `" b1 l$ v. z) V& c3 o; k

2 q$ i% i* Z7 r$ W  N4 z4C19:0095   MOV    AX,0911  ; execute command." v0 V, w) l" i( R# M$ m2 |/ G; I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% R  b6 o- {$ L9 s. S6 b  V  \1 d
4C19:009A   MOV    SI,4647  ; 1st magic value.1 h2 `2 V: ]% x2 X
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& P6 f2 M% K3 f4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 h" m% B1 L+ O2 f, m2 D  E' W3 v
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" G, o8 \4 b! |4C19:00A4   INC    CX3 `9 f7 v8 s: v5 l. x% m
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ g& G, s. Q5 ]/ q
4C19:00A8   JB     0095     ; 6 different commands.  A* _( n8 k4 s- [3 k' \: O/ ~+ X: h
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 s1 G! s" B  k. R
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' t4 ^" w( L9 K( c1 |
& g6 `8 l2 \- f. z) rThe program will execute 6 different SIce commands located at ds:dx, which* D  I* e2 ?5 x5 ^, A  `) G
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# X# X- X9 ~" m3 R
4 m* I9 K3 G& K) w7 [( l5 m9 C* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# M# `1 ^9 k/ b
___________________________________________________________________________
% q, x) R) z- Y! w. N$ e
0 E  Y0 ]( x' ^* X4 s, p" _& s; ^% g6 v& g* F" c# Z- k
Method 03! L/ C3 G7 J* u* S% u
=========
; H: U: Q: E; G, R2 Y/ a/ k/ M4 m: J" m' P( F
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  Q9 i5 \8 l4 z- }& _" Z/ g(API Get entry point)1 [! ^- z' O$ |. D
        
- P# `* O3 \8 w* |; {6 @& T+ N4 ?5 s' i5 N
    xor     di,di. G+ k' f5 y6 z2 O8 a: ]  ~3 S
    mov     es,di
  D: @' T( ]5 X  M3 l, t) A    mov     ax, 1684h       " a& S% J/ y0 a8 M
    mov     bx, 0202h       ; VxD ID of winice6 {, {: r0 l( I
    int     2Fh' v) I, E3 z3 L, h
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- n) V( ]! N9 S! Y) U9 L6 v- ^
    add     ax, di
7 I+ J- }' q3 r6 Y% U    test    ax,ax
+ k& Z! c  \9 b+ X3 f1 q    jnz     SoftICE_Detected
( q( u9 v" b+ _  f$ w8 }& J% o+ V! h+ `. ^. |- P3 ?0 w
___________________________________________________________________________2 N' p2 F, s7 [

9 a: a) Y2 c+ e5 g" TMethod 04
5 d; h0 ^' J% Z+ J( L=========" }( Z7 j! m8 `. j8 X$ ~+ ~+ C" {

( l$ h& \5 [) F$ pMethod identical to the preceding one except that it seeks the ID of SoftICE
7 t; \9 D! c8 bGFX VxD.
' }9 i- U) r$ y8 O
, |* C& d# U, f" N) Q' D, u    xor     di,di* t; [, ^+ C" U
    mov     es,di( Y5 I5 C0 s! V, h) _) b+ i
    mov     ax, 1684h      
6 @& i# y7 j0 ~    mov     bx, 7a5Fh       ; VxD ID of SIWVID4 J3 ~9 i% h& F% ^8 U
    int     2fh7 [' N. y) a. w. M* o0 z0 {  m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 _3 U( B$ x& V5 G- A/ ?3 A* @
    add     ax, di
6 }" D& I; |* |! C    test    ax,ax
' Z8 `2 ^" g- B/ @& M; \! a    jnz     SoftICE_Detected) B5 d4 Y: t3 r' \. K, Z

7 @' k# s6 g' \__________________________________________________________________________
) O2 v! Z# K7 g2 x: j" t+ t: h% L: F* [3 Z4 d. `, o4 E4 {

, |7 B0 p8 [2 ]+ O% }Method 059 b% a$ T. I! l* T& K- N
=========
- [" [  t/ C& a/ d% f) N9 D7 {
Method seeking the 'magic number' 0F386h returned (in ax) by all system
$ U* Q# ~9 o, H9 Wdebugger. It calls the int 41h, function 4Fh.
3 d% e6 ~$ m  a# WThere are several alternatives.  ' |, M$ w0 h% Y' D7 ~0 f* D# }

$ R4 q, o( b; n. rThe following one is the simplest:& m$ }! ~8 T0 t& F( m/ Q
! u1 p( R) d9 |1 s& N  B3 k2 C
    mov     ax,4fh
/ u( u& j# E+ J. A9 d; E    int     41h
( m! J( _8 q$ b' z2 Q% W; c    cmp     ax, 0F386
  ?3 V/ y0 n8 I6 q    jz      SoftICE_detected
% w6 N7 X* e) _( `6 g2 Z" Z
* v8 O& M* C1 ?1 Z6 V' T6 m! O( j' |" _- f* o
Next method as well as the following one are 2 examples from Stone's 3 @6 F/ x% P# Q) u3 D; `
"stn-wid.zip" (www.cracking.net):
3 {/ _. I7 E3 _6 y. l
: Y4 O( f9 E- j0 _! p( R$ c  W    mov     bx, cs
4 N# a/ \& X, }& J' A    lea     dx, int41handler2
- D0 P, G0 N( z! q) [3 U" C    xchg    dx, es:[41h*4]% E9 o( c1 O4 ~9 U
    xchg    bx, es:[41h*4+2]
$ f, j; ?/ a' S* y4 U* w- K    mov     ax,4fh
% U& _6 [8 m; ?( q6 P    int     41h" y# u) j/ Z. P& e& |) |+ f
    xchg    dx, es:[41h*4]
% O8 F' x- B  C4 p9 p8 I    xchg    bx, es:[41h*4+2]
" A- A5 m% M# E. L' Q+ i    cmp     ax, 0f386h- I9 s5 t$ z" Z( p" ?8 d
    jz      SoftICE_detected7 u  Q% x. T: ^: y

  r% s+ l, ~; l6 ?8 e* sint41handler2 PROC
  W! M" N: O% Y: Q. y    iret0 s2 A9 q  m! t! ^  Y  \2 _' D; Y
int41handler2 ENDP( w' v, M9 J& z2 d0 [
5 E( M  O; j6 \1 v# ^4 ~) ?! `

  m( t% i5 V" u2 P" l' }_________________________________________________________________________& u! N, V( h! Q8 J
6 _/ x, ~, f% w& [

% A' Z( r5 X5 ~. R8 J1 x2 q7 MMethod 06' V- a4 {8 n  o* Z* j' O
=========
& r1 a5 M4 k# q9 c6 f
% x* E0 f; f8 T7 ^* q6 y9 G9 ~# U' V1 h  i* H/ _
2nd method similar to the preceding one but more difficult to detect:
2 t& Z3 {, U% X8 S3 r; n  ?" t
8 O; y- d2 B# u. o4 Q3 }& ~8 z8 m: u/ R2 h# I
int41handler PROC" k' E% f. k: G
    mov     cl,al& n- e. T& j' ~$ I
    iret7 Q. k3 b$ E$ }" R! a- i
int41handler ENDP% _" E, r$ [5 U1 L( x. N6 w& K

: `# w, Z0 b& m% a/ b7 C6 `- ^5 I8 _1 p6 h4 O7 R$ H
    xor     ax,ax
7 ^+ l* G/ c0 o    mov     es,ax( G* Z) ?- R3 f! X0 |) J4 H
    mov     bx, cs
- Q8 e% f5 f; L5 ?; o/ T    lea     dx, int41handler
0 S) Y- f5 v6 T% u    xchg    dx, es:[41h*4]
! ]8 t6 J; T; z/ L+ ^: ]    xchg    bx, es:[41h*4+2]; v1 c0 j6 G( W4 i$ Q" o
    in      al, 40h
- G  N  y  V0 a% |  s& F' ]    xor     cx,cx; R6 ]4 O6 ^" z+ |) w+ l
    int     41h
5 U6 G2 m# D* _2 Z    xchg    dx, es:[41h*4]
& c, f8 y+ x/ y9 e# C    xchg    bx, es:[41h*4+2]
" x- ^; x3 A5 c    cmp     cl,al  Z8 {' k# P  j5 l3 G# ^
    jnz     SoftICE_detected& [, w# H% G* R8 @/ o2 A

2 e- C% M: E) j0 ], D+ m  m_________________________________________________________________________
& @8 d( @/ U2 E. m! B
8 _! y" n$ D" @* F8 HMethod 07
: c' }, a, P% ~: \+ J6 H=========% N! l6 V# T8 x' n3 b
) R1 _2 T, P, k+ @- g0 ?
Method of detection of the WinICE handler in the int68h (V86)0 V5 o+ N. Z; g
7 Z7 m0 V' C5 u1 |5 P
    mov     ah,43h
; w$ B& Z6 s) a# g+ K! k    int     68h
9 D$ l2 i/ t0 q& O, z; y    cmp     ax,0F386h
) _5 s6 U" X: W5 Z4 Q3 ~- v    jz      SoftICE_Detected
: D( E, M2 t1 U. ^7 d9 P+ E; S; J$ b7 i+ k) g
$ S  B5 m0 ^6 M) z2 M/ h' ]
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# C. I6 g+ g5 i' Z
   app like this:
& t/ _1 W$ B+ s8 b! u
( {5 h0 S$ z# i  N! r' h3 M4 N7 d& N" `   BPX exec_int if ax==68
2 a; a5 ~4 f- W$ b$ b  J2 n' v   (function called is located at byte ptr [ebp+1Dh] and client eip is
& g; D1 X3 {$ K' S/ h: _: g7 n% O6 t: P   located at [ebp+48h] for 32Bit apps)" U$ B1 P0 p9 u7 L
__________________________________________________________________________
  K- U, d8 B) L& }$ K
# ?! f* K8 R* e: z" d' n* G6 s/ N3 x/ e) O4 @4 W
Method 082 G& a& Q, J! q! U. X" G
=========4 `0 a$ U* T. P( y2 f
, Z9 B6 P/ B+ U0 {# g9 ?3 F# g
It is not a method of detection of SoftICE but a possibility to crash the
* @* V2 F0 P2 |/ h$ [* Xsystem by intercepting int 01h and int 03h and redirecting them to another$ ?: ]2 Z/ ?, o" D; D
routine.
, O3 S3 h8 P+ ]2 XIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 l) S) g8 [$ L& b# f) }
to the new routine to execute (hangs computer...)& |$ Y8 W; x6 n* D! S
" n/ n8 J' G% v& m# a
    mov     ah, 25h5 M5 f+ q- c  w. k% _& s
    mov     al, Int_Number (01h or 03h)* O0 Y. ~' V5 `0 T/ r
    mov     dx, offset New_Int_Routine
5 ^4 Y+ u! C  ?. f6 A1 A& \' x    int     21h
' n1 f2 u' v. _: G. |+ U/ \( [5 D* j% D) c
__________________________________________________________________________" E2 m  B# E/ V, R
4 n! b4 q, h1 }
Method 09
6 ?% |  I4 ^  x( A( q5 p=========  I; X: \6 `9 u& h

4 {# h. Q& \- h7 D0 wThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! \6 f3 C( b: O, ]8 N
performed in ring0 (VxD or a ring3 app using the VxdCall).% t8 m# A7 H1 S  z' M# L3 C
The Get_DDB service is used to determine whether or not a VxD is installed
" c8 i) ~: Z2 L( X/ E+ \for the specified device and returns a Device Description Block (in ecx) for
- B. T' I' w7 _- B9 ?that device if it is installed.8 ]' m. r7 k7 O) n- h0 q* E  C
2 U8 F( p9 s4 V; [+ D
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
0 i, R! i6 _+ |; U1 _5 }/ b   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
/ v3 y/ ~- v5 Z: v, D   VMMCall Get_DDB/ K3 e2 y! \7 G" _
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' o: L& K. C2 ~5 i  Z
  `) A+ ^" }6 E9 uNote as well that you can easily detect this method with SoftICE:1 p9 f# q. |; ?# c
   bpx Get_DDB if ax==0202 || ax==7a5fh4 h+ B  n6 P+ ~7 S+ a4 X

3 }5 }/ j2 e$ c& K5 N6 m__________________________________________________________________________! ?& X3 z) |2 R$ D/ S& y7 U7 |
# v+ n2 W/ Q6 L3 t
Method 103 X* r7 u' P! A: ~
=========: Y8 o) Y' ], H3 D0 i
1 u" J. @2 W( u" m
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 c5 s, P) L  M) I# K# O: B/ {
  SoftICE while the option is enable!!
6 G! S( |2 N) J! V3 o- W# j2 G, S
+ q0 m% J% l/ _3 a2 K, hThis trick is very efficient:5 g% v2 `' i6 q' p" c+ l
by checking the Debug Registers, you can detect if SoftICE is loaded8 Y2 {  T; D# S5 U" i7 J$ a" }
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) O+ _; g+ I) \( X
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 U; g) T& M$ v1 kvalue (in ring0 only). Values can be manipulated and or changed as well
! O; M0 V( N& h7 ?(clearing BPMs for instance)
* c7 a" b, H5 P  i2 r( G1 b5 j' R' q% C/ h
__________________________________________________________________________
# M9 _$ K4 l3 G1 r) j" v& e1 i1 O: \9 ^& x: J
Method 11! {' L/ o. {+ z
=========
' d4 O; }% G, I) Q2 P' R
3 [* j/ |3 c- Y1 g4 O) ^This method is most known as 'MeltICE' because it has been freely distributed) A. i. {& r* [0 h# i* q$ l
via www.winfiles.com. However it was first used by NuMega people to allow
) N8 d0 x1 ?0 DSymbol Loader to check if SoftICE was active or not (the code is located+ U  x8 U& [( l% P# M
inside nmtrans.dll).4 ~: {  S& P7 r) c7 N

5 w) |. [, I7 i% L3 B1 I0 k- `The way it works is very simple:& p) \6 {/ I8 U0 E# B0 v
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 u& x# C3 S/ W( h9 t! A' T
WinNT) with the CreateFileA API.
! V: c, Q, @" n( K! H$ }( }1 i: d% ~: u* L6 }/ M  k; L* |3 W" o
Here is a sample (checking for 'SICE'):
, l' s5 h! [8 k- d0 ~9 X, C; G: T0 E; u  Z# D
BOOL IsSoftIce95Loaded()  _. N! R3 X0 a6 C+ Z2 p$ S
{0 K9 R( K4 z# C8 @- u3 j
   HANDLE hFile;  
. {, [- J. s( O3 k   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; S4 ~' ]' ]: e4 S9 h$ E, }) {) A
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
2 n' ?/ i4 x+ X9 I2 m                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% r4 j3 D4 Z* b6 ]- c0 c
   if( hFile != INVALID_HANDLE_VALUE )
6 P$ t5 t# Q& v5 J# d7 O   {
8 Z! D% B, t/ X" Q      CloseHandle(hFile);; N4 _. T. L9 I( Z7 Y* e
      return TRUE;% j# ^% c+ H. H5 w: X8 Z( s
   }, o: Z8 B" C# \7 d  k  K! p
   return FALSE;6 H/ l; C! B" x2 n7 u% q
}! t& [- k9 h$ {2 {

; u) X; h% K3 Y' UAlthough this trick calls the CreateFileA function, don't even expect to be
* g% O5 A1 |8 k+ f; B0 X' Xable to intercept it by installing a IFS hook: it will not work, no way!
# y" j' Y) V1 X2 e+ ~9 v/ wIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
, j! a: K* p" Y4 N0 eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)6 \, o/ b+ q/ g
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 T9 i; g; i- N6 mfield.0 p( C) b9 s/ O
In fact, its purpose is not to load/unload VxDs but only to send a
; F0 `& Q) Y, }: t% X/ |W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 M3 ]# q8 Z$ r3 d+ V
to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ @% e4 `7 o. F, g- k
to load/unload a non-dynamically loadable driver such as SoftICE ;-).- ^% O- c; y, x
If the VxD is loaded, it will always clear eax and the Carry flag to allow+ p  S7 S( d; p8 i# x; v9 `/ ~* j
its handle to be opened and then, will be detected.  _- l7 t+ c; [0 z5 b9 B, N
You can check that simply by hooking Winice.exe control proc entry point
: v% W  F) j( ]6 j8 ^# jwhile running MeltICE.
, O4 ?/ q! Y/ z" H; t1 [  I8 n6 J8 ]" f

9 j6 g$ z' Y- W  00401067:  push      00402025    ; \\.\SICE
  B) `, t; P  r6 ^6 n1 r  0040106C:  call      CreateFileA
$ |: p$ w* o6 W* J  00401071:  cmp       eax,-001
* G6 c" }" `# n' D9 _  00401074:  je        00401091$ d$ @2 k6 C" M
% s- h3 S- }; j6 U
/ {* U0 m  {# O4 F
There could be hundreds of BPX you could use to detect this trick.
* p  |: a4 G2 U" }3 c-The most classical one is:; J! @& }) |( z0 U( r
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* j- p' M' j9 D8 H4 a% i& x    *(esp-&gt;4+4)=='NTIC'$ {9 f  _" {0 j
. s, h3 ]8 h# b$ J1 l- q' n
-The most exotic ones (could be very slooooow :-(
" ]* o: i" |' T* G2 f. M$ U   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + c+ T; @7 W8 R# D2 f# B2 I: [
     ;will break 3 times :-(
3 p1 P, e, z: Q! ^
3 ^8 V/ f% Q+ o6 R2 k; @! d-or (a bit) faster:
2 v/ G% v8 F! |3 |* W" r7 I) B   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): s; u' [# I2 n# n9 U. O3 X% {6 B
) \0 a6 y' ]3 ?" I
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( s8 b2 H* u/ o" g. W9 S' F
     ;will break 3 times :-(6 a" o/ |" \, _9 ^9 o9 ^0 Z3 T
- Y8 F& O0 w$ H3 F2 x
-Much faster:
' ~& _3 T' R& i. f5 K, L   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! g% m+ f% G. X4 H0 h$ W6 H

" W5 b+ ]  x4 g) nNote also that some programs (like AZPR3.00) use de old 16-bit _lopen/ S) H4 D7 M( |1 s' N" c  t
function to do the same job:* x' y. V/ _( o  r
/ i3 L' T  }! y+ b- f# L' n
   push    00                        ; OF_READ
5 m7 s7 w! Z* `   mov     eax,[00656634]            ; '\\.\SICE',0) l8 J, `, q' j8 ~6 l3 ~1 J" [
   push    eax# G: A* o. a+ c
   call    KERNEL32!_lopen4 f& l2 s2 m: Z
   inc     eax( W* ?& N" |9 p% X& h. @
   jnz     00650589                  ; detected
4 T2 w4 F; s+ M   push    00                        ; OF_READ
  f  k( a. K- {  Z4 o8 y5 T   mov     eax,[00656638]            ; '\\.\SICE'
8 V' T3 {) f/ {$ Q* |   push    eax$ [2 A# r8 P4 N* H2 K5 f" U
   call    KERNEL32!_lopen& ]) S7 r3 D1 Q1 B2 J) J
   inc     eax
2 n( |& U( B% @* w" e+ Z2 N   jz      006505ae                  ; not detected4 z8 L* H" }+ L$ ?: _3 g
2 v! N& V! |* v8 ~
% N/ v  X; B* t; F9 v/ a  a
__________________________________________________________________________2 j6 Y. O0 m+ i: H7 O
% T- b# D3 f3 U0 T9 P; Y
Method 12
* n+ H6 B6 H- I=========
1 D  D' `/ q- s0 P% M& c
* |+ N: g( f! x$ CThis trick is similar to int41h/4fh Debugger installation check (code 053 I( W/ {, ^  y/ J8 H- i$ A
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! ?( u: N: n* Nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.4 l0 Y; p: C$ J+ X; l
) M  f3 S# O6 D3 s7 D4 b
   push  0000004fh         ; function 4fh
8 l4 m- K/ ]& e) ~5 D2 ]) y" ~+ X   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 O0 s; e( x% b                           ; low word specifies which service  M9 _6 z; ?" k* a* P5 E
                             (VWIN32_Int41Dispatch); M( o/ ^) q" U# o5 U
   call  Kernel32!ORD_001  ; VxdCall0 T: m+ l$ |* u
   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ F8 X1 y2 J  P: S; |/ \   jz    SoftICE_detected
: t( N2 D; H& m0 M! i5 H/ O( N' K. G9 s* z1 m
Here again, several ways to detect it:+ P5 E1 n, Y8 x# H  x. h* T* L5 [& p7 v
: v- z$ w- C# Y8 Y/ E/ R# v
    BPINT 41 if ax==4f6 w5 K1 X% @2 ~2 b1 }5 |- B' z

& g) J- G  X+ I, h# z9 o    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 L% V/ U0 A2 C: Z9 U" i" X  M
. f% @( ^( j4 `    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; k. M0 ?- O3 v$ u* x' Y8 t
# q) Y0 L8 [$ }( l; ^6 c: Q" U- K
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; [  g- ]+ h# w, S: p' g6 a# R
" R2 Q  m& ~0 r0 ]& }4 m
__________________________________________________________________________: H$ Q& N4 }% {: e' c. G# b- ?$ z

1 P& r  A* ]' [/ X$ LMethod 13
: h9 B. x* J" J=========
6 {. l3 @( l4 K6 a" w* z0 e" |, x7 ]0 @' B$ V+ e$ b! {- h4 v( ^' K3 A
Not a real method of detection, but a good way to know if SoftICE is
1 Y7 ~2 C. J7 H; }installed on a computer and to locate its installation directory.+ [- J+ |: `8 r2 Y
It is used by few softs which access the following registry keys (usually #2) :
2 D& k& j! y# R# L$ h" K( f
0 e% `1 l8 D4 ], l6 [$ o- i+ E-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# {  `) x  @: B9 g1 ^- n\Uninstall\SoftICE7 C( k/ O. _- C3 ?) ]2 ]% z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% S6 C% `; ]4 k; q& }$ S1 v+ q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 \3 A% F' ]( x; }+ P, b) s
\App Paths\Loader32.Exe% n/ l$ r+ }* B+ U
: u  }2 M8 q9 \# X
( f- |* ]  z8 L& J
Note that some nasty apps could then erase all files from SoftICE directory2 W" o9 e5 g7 c3 O9 F
(I faced that once :-(# ?2 }" ]' |5 Q+ x3 ]' _" b* s# e; m

: M! }3 L% E3 NUseful breakpoint to detect it:# ?2 Z2 ^/ \9 c: @+ U$ I% c6 e

1 ~- M* g6 S. M  r# Y     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& L, R& j% t  R& M8 @* ~1 a" N, `8 m
# I9 M* H* x; N7 b( ^$ x__________________________________________________________________________7 O, p7 \' A' R; {' e4 c' ?
2 E, c; H: ?7 T4 D* A

  D! e; t% p+ ^. o; bMethod 14
% Z2 M$ j5 k" ?3 Y- y5 c5 [5 C$ c2 `=========
! B( P! V7 b* `$ L( w# C7 R
% @' j1 }! W$ WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ M8 R; f8 m8 o3 [/ }
is to determines whether a debugger is running on your system (ring0 only).' a! L/ T4 ]( n! \& \8 z

: N6 d6 w, _% V* l   VMMCall Test_Debug_Installed7 Z; V" x, M; v+ s6 _# [  S
   je      not_installed2 K# Y" H6 ~- @) ]. p( j8 P; a4 Q
& j' K: }5 e, \7 [* b6 B* A0 @8 g
This service just checks a flag.
$ ~# ]  _5 |& b) q& F% Y1 k</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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