About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ h% }  Y% b# J( g
<TBODY>" F4 C! f# z: g' w! G6 n' ^: P  L
<TR>5 k# x* Z; m) N& _
<TD><PRE>Method 01 ' M: ?9 w. Q6 u3 R' R
=========
, K: I, x  [; Q$ j# L
2 I7 e% }/ ^: o7 q* rThis method of detection of SoftICE (as well as the following one) is
2 o7 s5 `4 F' S# \2 A5 u% N1 k7 P4 {used by the majority of packers/encryptors found on Internet.& H/ ?, Y: A  Q/ n7 Q- V5 c
It seeks the signature of BoundsChecker in SoftICE+ B3 c; d5 L6 Q

! H/ X5 @* a1 h: |2 Y! C    mov     ebp, 04243484Bh        ; 'BCHK'. W2 j. e$ Z+ @2 D+ ~
    mov     ax, 04h( p; i7 Z% e+ k" f( Z
    int     3      
* H: `& I' L1 v+ ^% \    cmp     al,4$ ^3 u! l+ y- x7 f& ?8 X4 G
    jnz     SoftICE_Detected8 h$ v2 t" E) C
, b" b5 Q4 |9 g  e
___________________________________________________________________________
; s# }3 F0 M6 z5 m, n* Q, n8 C% g
4 p# h7 f# U) r: J) x& S' S  TMethod 02
% b' F' h7 w( U1 @( U=========+ [& M5 W: s  b2 \

& e$ A* Y; D+ U9 i2 r! KStill a method very much used (perhaps the most frequent one).  It is used* h; G5 j9 |( x# |) S7 \# e; `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 Z. Y2 P, p& j- W  A5 r
or execute SoftICE commands...' \4 \  ~) U4 c( w  ~# w
It is also used to crash SoftICE and to force it to execute any commands
0 {" f2 A, l  ^(HBOOT...) :-((  ; i8 X$ p& n( w- F4 B  Q) ]1 ]; q' W
, V8 @/ S6 f* \$ x- T7 O/ ~1 x/ [# k
Here is a quick description:, B5 F: {/ j2 o2 x9 p
-AX = 0910h   (Display string in SIce windows)# H: @& J) [. Y2 A- e
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" P3 o* D8 y& _2 M" ?  s7 U-AX = 0912h   (Get breakpoint infos)
2 K* {! g3 s+ i4 D% S, k/ _& U8 I-AX = 0913h   (Set Sice breakpoints)8 e7 {: q) v9 W6 a
-AX = 0914h   (Remove SIce breakoints)
: I0 @; o2 s* N3 u7 V* b
4 `& v4 ]  q% NEach time you'll meet this trick, you'll see:
( t7 B- T- z) J( Y2 v, ^) Q8 O, Y1 |-SI = 4647h$ n+ w' p7 k. W
-DI = 4A4Dh
" X- e% Q; i: R: a3 t  TWhich are the 'magic values' used by SoftIce.
& ]4 P! ]( N1 J! h1 @$ Y$ b3 tFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" R6 {  A. P# ~! X/ t' s* B* ^; i2 f& |; R
Here is one example from the file "Haspinst.exe" which is the dongle HASP
9 O# U( Y7 U; f( J6 E" m. TEnvelope utility use to protect DOS applications:
0 L- Q: p1 e6 y* V9 i3 {3 y% c
/ l* D# r+ z6 K6 W" U  U* ?3 W& l$ D( @$ ?  ^  H/ b
4C19:0095   MOV    AX,0911  ; execute command.
! ~) @2 Z5 x+ i- t- K3 B4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- A: h4 p* T/ d: B7 j. p2 H( A$ F4C19:009A   MOV    SI,4647  ; 1st magic value.
, ?  q# h5 `, E) n5 w3 @4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
) s. O& d; h/ G8 d4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' a% R% J7 W, Y# m" y) O) s4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: D& d, h6 r6 b
4C19:00A4   INC    CX
9 R5 m8 X1 b  ~% m3 ?! V. }4 E. [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, x. f6 |6 C8 F( H) }  H& o; J% c4C19:00A8   JB     0095     ; 6 different commands.
& p- l( P, v) ?0 c3 R9 w4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) x# N6 U' {7 U
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& G1 e: k3 z  x* G  J' _( J: s* U% _, d" |9 |- z
The program will execute 6 different SIce commands located at ds:dx, which, W  p7 X# L( V" o" W9 m) m+ ]+ ^
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% p$ l: l! w+ J& L2 _$ l. o" K) z% K5 b1 a  F
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ G# Z' G" p; ^& b" y. ~
___________________________________________________________________________" j  p, K( P# M
: a" h7 C, ~- m) V& N( ?

, g! o  P5 h( ]" H4 X- D: aMethod 039 I" }# D" W, F4 {& P
=========
; V$ q3 z$ [3 K* X5 g8 N! n4 f$ Y2 V  [! ?7 L0 k% @% X
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! W  f3 C* q4 `: ^7 K2 `) g& Q
(API Get entry point)
. h( v4 N' ?' ?8 u        3 Q9 Z9 h, Y+ u" d8 q) @6 W

# F# N5 Y7 ], b$ E" x$ T; N: p    xor     di,di& h# Z, W! w: @4 k3 |* ?2 {$ [
    mov     es,di8 c2 D- C6 T1 D% v+ L0 d2 Q
    mov     ax, 1684h       , f' X9 M( A  \2 m
    mov     bx, 0202h       ; VxD ID of winice0 \3 G# Y+ l+ a2 V/ \
    int     2Fh
9 g- g8 O! a" m' ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 A0 Y1 m+ v8 F2 Z) ^8 w# B3 T/ W
    add     ax, di4 Z) U% w9 O  `6 l& ~
    test    ax,ax3 v; d( T. o2 b$ W- o- ~% G
    jnz     SoftICE_Detected0 T) s, X4 G7 g. m
$ F. e- z. y- A& C
___________________________________________________________________________
- D( b' U% Q7 H% l) X
, U+ N3 X( H" W& p' H' ~Method 04
' N3 ?9 w4 c. |1 B5 T7 E=========0 a+ e# H, F7 f% d& K

- Q4 h1 I% `5 D8 V3 IMethod identical to the preceding one except that it seeks the ID of SoftICE
# F1 \' J2 M3 d( HGFX VxD.
" Z' d4 \  Q* Z
! |  t2 U# Z, D5 H( M. ~    xor     di,di
& u3 f) [; ~1 k8 L7 I0 a    mov     es,di2 Z5 d8 n. Q8 N/ O
    mov     ax, 1684h       0 e% V/ J2 m' N- S4 I
    mov     bx, 7a5Fh       ; VxD ID of SIWVID4 J, ^% N3 L0 |# |# N: v  `
    int     2fh
3 t/ t; Q; c2 d8 V  H  n8 B: m    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 L7 T, O0 f  f
    add     ax, di
7 ?# D. S$ M& T    test    ax,ax
' Q2 M6 O$ O  y9 ?5 `! G! W    jnz     SoftICE_Detected
/ m9 ]/ F! O+ [$ @) C: T& E% v9 q/ o* U: H7 I3 k2 f; z4 H2 T
__________________________________________________________________________
5 X6 n; f: l0 V0 N
; k( z: }. Q" g% L3 {/ g$ K6 s. ?* `9 @; K6 }
Method 05& r) o0 R5 D$ M' e6 g* _
=========+ B% g9 B# D* X

+ y) f4 B" z* ?- A+ mMethod seeking the 'magic number' 0F386h returned (in ax) by all system( A' |! P# {6 ~" c* i/ |4 ?
debugger. It calls the int 41h, function 4Fh.
5 w) N  `5 {1 [2 I6 g: |There are several alternatives.  
2 p2 d7 j; b) M. B  a+ M" t% m; V7 f% e" ^* T0 D
The following one is the simplest:
% J# G4 N9 h9 i1 P# [0 p7 `; w1 j% x4 q% z& ^+ F
    mov     ax,4fh4 I3 Q4 W% G+ V- l$ v5 z
    int     41h
7 `' o' k3 j+ v    cmp     ax, 0F386. ^3 M7 v8 R$ D2 S! a& _9 E: `
    jz      SoftICE_detected
! g2 e+ f+ J- n8 \' |( S, I+ h' f, h, @" R
* j0 ?) I- E  p2 q5 V  I& P
Next method as well as the following one are 2 examples from Stone's $ F" f# l) S" u, N5 H& a' D3 `
"stn-wid.zip" (www.cracking.net):# P: T, n+ R6 Z3 ]. ?% W) g
$ K- p0 t) {; u, p" N$ y1 q
    mov     bx, cs
; _1 m0 h8 b6 T' T) a" E( k7 b% z8 z4 M5 \    lea     dx, int41handler2% Z3 B, y1 m2 x1 N
    xchg    dx, es:[41h*4]
. `- U# S+ A' i1 E/ p: ~    xchg    bx, es:[41h*4+2]5 f5 K) l2 U. l# f
    mov     ax,4fh
& Z4 J7 ?' a  ?    int     41h
+ W. M' i9 s4 s    xchg    dx, es:[41h*4]' \! D3 {8 g" R8 ~" a, b
    xchg    bx, es:[41h*4+2]( N. g& N7 y* D6 K9 n# F7 d
    cmp     ax, 0f386h
, I1 E- n, [$ v# ^    jz      SoftICE_detected' g' c/ G6 O# d: j' Y

+ `8 w/ [( o6 Dint41handler2 PROC) R- X0 k9 m* G; _5 e
    iret$ E: M9 ^+ }  [4 Q( k0 u3 N
int41handler2 ENDP' q- G+ C+ w7 a3 O5 h
$ R# n: }8 T0 H1 L' p' s5 |# W
' {. C- Q6 }- N9 z
_________________________________________________________________________7 G, x& @) E# t7 P2 G5 B

/ f/ Z+ |, X/ D$ ^6 D# O
+ `/ G# W) i4 D& bMethod 06
1 U0 {) d% u% R( b# v6 O) ^1 b=========
  o9 q9 N4 E1 v8 r' Y5 u
/ ]0 T% v4 ^: v1 ^( s0 w' }* b5 f, ]- w. Z
2nd method similar to the preceding one but more difficult to detect:, e) L" W. \$ I

2 z# j: t+ s4 r! r6 R5 ^1 [& N0 F, `9 K, B* F) W: t
int41handler PROC
: I$ D) z  b4 \. H+ [- m, U    mov     cl,al" `* }3 t0 }) o; t7 L
    iret
2 `0 [! ]" ?! Gint41handler ENDP
- g) y+ G3 a; S9 g1 H& e! z1 A) n$ s% y

* v* a( O( e( [$ c    xor     ax,ax
, @4 y, h9 }. s  a    mov     es,ax
. ^3 y9 J7 w( s9 u, T' ^; h    mov     bx, cs
: [5 D) f6 Z4 v    lea     dx, int41handler
: z/ i- J1 z0 }6 m& R    xchg    dx, es:[41h*4]& P# a+ A. p1 ^1 u( |& a
    xchg    bx, es:[41h*4+2]" f. {2 U" U6 v( B. T  s
    in      al, 40h
- H' B0 o# f7 T1 h8 G1 A    xor     cx,cx5 u! }9 t* j; A  a5 {- p
    int     41h
  g5 d4 X+ Y: `' _/ J    xchg    dx, es:[41h*4]
& R, }& t5 q, v) q: U8 T    xchg    bx, es:[41h*4+2]
/ \& r; g9 f" E5 c    cmp     cl,al/ \3 h! X9 }6 V" t
    jnz     SoftICE_detected% R2 Z! k4 Q( {$ S: u6 P
# [5 i2 U/ y2 ^* r6 M; K
_________________________________________________________________________
  p6 J! E$ P2 C# {+ l5 B( h
, C  o+ W* ]# F6 dMethod 07
! `0 `8 w: G8 G3 k; R=========
$ }; T: i  v/ T( k2 H' L: V3 S) W7 G
Method of detection of the WinICE handler in the int68h (V86)
$ M( R! b) @+ p! I! N, k8 y) v; `, d. Z3 p
    mov     ah,43h! k, X1 K* M7 ^
    int     68h
& J4 L2 ^; Y! t  O    cmp     ax,0F386h4 W, `( h  [4 u/ z/ o1 i/ L' o
    jz      SoftICE_Detected. A6 W  l; N. }1 I5 M, ]0 L) m! X/ M/ p
4 A2 j& c) I" K7 u
3 G! J8 e  B. O+ i$ G4 B/ x; A+ R" {
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
7 M" M) q/ \( |1 I* M   app like this:6 d) ~5 m- g9 m
0 t0 M2 U0 {6 Q3 Y9 u5 U: @
   BPX exec_int if ax==68
. D4 j; [& C# i   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 M3 c+ U/ [' C   located at [ebp+48h] for 32Bit apps), j1 ^) t- E) j. J
__________________________________________________________________________
- U5 R& _: r3 X) T: F3 q7 Q1 y! _5 z, S! l2 @( q: F
7 @' G- G, {1 @- X! f
Method 08: U1 {; i" `; |! a" p, m
=========/ m+ y" x/ g5 ]- v- t
2 v* N" G, y1 X3 x$ K
It is not a method of detection of SoftICE but a possibility to crash the
9 B% W+ B4 C5 h: i9 @. t; j2 v( S. _/ n5 [system by intercepting int 01h and int 03h and redirecting them to another* t6 v* W# [: k' ^
routine.
' ]5 a4 J! s2 _1 w. o9 sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 u8 J+ X' |8 u" C# A0 R( F& W* |! Bto the new routine to execute (hangs computer...)) R7 I! F0 o: G2 T

6 f6 n$ ^- i0 ]4 M4 p. c    mov     ah, 25h$ a5 W! Y; p9 O) E; u, D' \
    mov     al, Int_Number (01h or 03h)
  ], I  J! o8 N7 _    mov     dx, offset New_Int_Routine
. E3 a+ i$ H, X1 ^7 U7 x    int     21h0 R4 s+ Y3 y' G1 Y
/ p+ V2 ^, \4 f4 Z0 ~+ P
__________________________________________________________________________
8 a0 v, A! U, [2 [
9 N: u2 Y- }/ ~" Z# N5 {- l" gMethod 099 V' G( z9 M2 k2 m3 s# Q
=========
) f% Y6 ]4 w6 S" M; T! V- Y
/ s# I6 r; g( k% l5 A+ N" h+ n: b0 jThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, ^: o8 O$ k) x1 u( S" Vperformed in ring0 (VxD or a ring3 app using the VxdCall).+ |9 G. Z$ {9 j
The Get_DDB service is used to determine whether or not a VxD is installed8 U) W, i* {  b" _
for the specified device and returns a Device Description Block (in ecx) for
  v& k, Y1 h/ H% Z; ]$ ]that device if it is installed.
* ^$ X' L6 W; ]! T' X8 r* }# N/ y+ `. c8 o
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! ?- ]0 S5 C; S   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# \! f" X: G% N, i+ V, V   VMMCall Get_DDB; p5 f, k2 o/ X/ r, _
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 r0 e4 D3 M+ A3 k5 s; L

, ?2 D$ o- t2 c8 k: cNote as well that you can easily detect this method with SoftICE:- ~2 E( D" b& C% [; N( _5 D0 d
   bpx Get_DDB if ax==0202 || ax==7a5fh! \! Z! l* w: y" O  p
8 ^1 |  k' P" m7 I. |- l2 [
__________________________________________________________________________+ G( P( o# b1 d9 L" j0 ~

" [4 K" K' b6 a' `& ?* z" EMethod 10* [+ ]4 E8 W( t: [& Y
=========+ p7 z  M1 x3 _- r' ^
7 L/ r# F3 G6 J6 O- e  o- o
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 S7 C3 f2 Z) [% h- d5 M  SoftICE while the option is enable!!  I! p; n8 ^! }4 K& Y
# C5 w! N$ k+ a7 i1 [. [5 w+ B
This trick is very efficient:. N7 V9 d8 i) S( j2 `4 n- ]
by checking the Debug Registers, you can detect if SoftICE is loaded! @7 ^, W: U$ r3 V5 j/ y3 k
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, f! t7 D: E8 [2 B$ W
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 ?" C5 Z( r; U& Uvalue (in ring0 only). Values can be manipulated and or changed as well+ h" b/ \; \9 B6 w+ T
(clearing BPMs for instance)
; `. D. K) o. J$ _: y2 i& v/ w5 e, c2 ]
__________________________________________________________________________
. u: d; j' ?8 t' b$ ~7 l. |& J
0 |; ~+ D! |1 P! O7 k; bMethod 11
0 g% F+ j0 _4 z& p1 Z2 z; \2 P  |; R1 \=========9 ?0 s$ C8 c! W3 U
/ j: `; F" ~1 U& J
This method is most known as 'MeltICE' because it has been freely distributed* A. B" F, w, B$ X) w/ c+ w
via www.winfiles.com. However it was first used by NuMega people to allow" D7 ~- T& t" C% D' t
Symbol Loader to check if SoftICE was active or not (the code is located. i# F& E, |7 m) C- a9 H
inside nmtrans.dll).
9 p2 \: D" ?3 H# \% M0 }# s+ Q) Z: w% N) y/ t- R" Q2 A: f
The way it works is very simple:3 v3 L5 q6 Q3 w& V) f7 R; b7 J
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* y$ v! o" D1 }/ PWinNT) with the CreateFileA API.0 s* o. r  \) x" }5 p/ |# m( G
% n) j2 q2 ]0 Z( k
Here is a sample (checking for 'SICE'):& U  v6 t/ Y4 t$ y6 j
) m0 L8 X( O! v* f% [. n
BOOL IsSoftIce95Loaded()- ]+ U/ x- `( H3 x7 e
{, @3 W6 w7 u2 r" _
   HANDLE hFile;  # `* ^9 L' E$ z% Q
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
8 o, X% t8 d( o: v4 ~/ R" S                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! Y9 r7 `: g% I- \                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) M9 D& Y9 L( @7 ^   if( hFile != INVALID_HANDLE_VALUE )
; H/ w+ T9 `- m" g7 o1 A# u9 N) P   {
7 b9 I3 \& t; f5 S0 ^. o      CloseHandle(hFile);
4 T* \; u9 V+ S0 @- T      return TRUE;
1 {9 a7 i; T% s' G   }% ^& O5 v0 t- O7 ?% Z* f, J& e9 D$ q
   return FALSE;" G7 ~7 _, q. P: b6 i- i
}' d& Z% U/ E. w% [. \; ?

# t( l5 _2 b. G$ ~) RAlthough this trick calls the CreateFileA function, don't even expect to be
* E2 ~9 ?" m+ s. Y! J7 J, X6 ~able to intercept it by installing a IFS hook: it will not work, no way!
" t2 s3 o+ R" L: SIn fact, after the call to CreateFileA it will get through VWIN32 0x001F4 ^% B8 `$ L7 t$ B7 i
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) c, P, [1 \* {and then browse the DDB list until it find the VxD and its DDB_Control_Proc
) F5 l* W7 y+ Z# l! L5 mfield.
$ o) S" Q3 \7 j2 vIn fact, its purpose is not to load/unload VxDs but only to send a . ?) |% v: C. t% _0 @- ?
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% c" r9 u8 e2 @
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 @* L  D  S+ _! F' I& V1 V* sto load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 N6 y+ m7 d+ N+ NIf the VxD is loaded, it will always clear eax and the Carry flag to allow- W# g6 T) U% G3 R$ O4 f" R( a
its handle to be opened and then, will be detected.+ l. ]; I$ H$ P
You can check that simply by hooking Winice.exe control proc entry point- R2 k  Q6 ]3 M" A1 o7 |# ^# T
while running MeltICE.
9 b0 {* u5 @* v; x" I% Z. I4 g! a7 [: C0 {; U9 B( ?; k1 r6 o
* ?, A* ^, q- z, G; |* T
  00401067:  push      00402025    ; \\.\SICE
8 ]! `5 ]4 l9 Z! C; E& ], j5 q  0040106C:  call      CreateFileA/ i' t) F9 V4 E6 N4 F0 ^
  00401071:  cmp       eax,-001
! @6 \% `- Z; Y1 _  00401074:  je        00401091
! C. ?$ x' i  y# @7 y2 ~" |3 l" J, s1 @
- E+ U  E- X) I" S3 ~1 `. M
There could be hundreds of BPX you could use to detect this trick.
1 C, r% H9 ], s  a-The most classical one is:3 p0 O8 \0 s( O- ^0 ~3 P7 a
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, g: w1 I3 W9 g) y    *(esp-&gt;4+4)=='NTIC'6 w+ c; ^5 z+ m1 o/ X$ z
4 y! Y4 S: r6 H3 w& x1 w
-The most exotic ones (could be very slooooow :-(
) [9 c4 r$ F" ~( ]   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  k% {6 M! \  x! C# F     ;will break 3 times :-(4 B6 f% I3 b& [
6 [( m- P; R8 S% r8 ^
-or (a bit) faster: & [0 K; ~0 y7 K& x
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 P9 u: {/ U- d, o
! f  _9 Z3 q% g- m   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* c, w- [/ [, t     ;will break 3 times :-(% a' f$ ]# B: @5 \6 i; k
- p  R  y( P9 Q: C, k
-Much faster:, L% P' Q* U$ \4 Y7 B- U
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 @& L% z" M6 [
2 ?5 w: h8 ^# D# M0 w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 q4 S$ l2 A3 u% s
function to do the same job:/ F" r7 \( ~; N2 \+ B

3 ^/ _$ [6 i- p1 g6 d1 ]: {   push    00                        ; OF_READ  G* t( h( M$ V: ?! ^2 a
   mov     eax,[00656634]            ; '\\.\SICE',0
  u' t) P- l- b$ n, K3 F0 H   push    eax% b3 q% X& J' F
   call    KERNEL32!_lopen6 X3 c1 i- E: o- o( x
   inc     eax
  ^+ }# `# N9 H6 v2 O   jnz     00650589                  ; detected
) R% j" Y* W. ^# y$ _$ [7 x   push    00                        ; OF_READ
  @& c$ z- }, @# f# n- B   mov     eax,[00656638]            ; '\\.\SICE'
+ ?9 H4 C* k$ Y2 v3 \, v: ^" c9 |! E' Z   push    eax
$ F/ H8 J" V2 |7 W   call    KERNEL32!_lopen/ W9 O! L* t3 u
   inc     eax
6 I* C* E  D6 l5 n# g. V" w. |   jz      006505ae                  ; not detected
3 p& H% Y, a- a5 E' P& M2 m( L4 t! W& ?  G

3 I7 s* X& ?- C3 W3 l, J/ s__________________________________________________________________________1 j/ w4 _) X- ]8 W0 d
% o7 }5 Y$ r' S( d: x* T4 a
Method 12, _/ L$ e* s3 ^
=========
; x' [$ S- Z) L. n3 h' l" G4 P, ~2 u, z
This trick is similar to int41h/4fh Debugger installation check (code 05
- L+ L4 Y; m5 J( m+ S( C5 n9 Z&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 `5 m9 K! A% p8 L, H
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 M) Q" V0 b) U+ \, v0 j) _$ |2 n* v6 P4 f/ ^
   push  0000004fh         ; function 4fh" _2 y7 ?6 f5 a4 Q- z9 Q2 b
   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 @9 [, h1 f- u: ?& D                           ; low word specifies which service  c. e" g* o6 D  @7 H' q5 G1 y
                             (VWIN32_Int41Dispatch)
( [! V* s) z/ g( x7 w  U9 I2 j   call  Kernel32!ORD_001  ; VxdCall
% x/ _, y8 m! i   cmp   ax, 0f386h        ; magic number returned by system debuggers
) T$ }  w$ \1 K& ?1 A; G( _+ [   jz    SoftICE_detected4 u& U, D& u% X, a

8 p. D, d% n, {3 _4 w) M. A0 Z0 F2 QHere again, several ways to detect it:/ }4 a5 l1 H4 |* N7 ^

8 L3 M% [  Q& J    BPINT 41 if ax==4f
2 n5 {; I8 _, t
% d1 O& r( o; l$ u/ i0 t  M    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* n4 s) W) P& P4 b) e/ f* s7 S. L; K) v/ P2 Y6 i/ W
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 G6 p8 }5 z% d; d7 U2 k4 U" O

# L8 }2 W' M+ O- q    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) z) O: M1 _4 |" D7 i8 o+ V# x
" R! x3 n: T* Q( d3 s9 {" |0 h
__________________________________________________________________________( e5 F( d6 f  k8 p' G3 M

& E9 Y# f: N& v8 HMethod 136 A2 _: f2 Q0 K3 H- l
=========
5 k0 [/ Y1 W) `" R
2 A" Y/ J- @# F" ~. ~Not a real method of detection, but a good way to know if SoftICE is
: L( U. Z# s* s4 r& Minstalled on a computer and to locate its installation directory.
- u; U9 D7 e: B4 y2 q, _It is used by few softs which access the following registry keys (usually #2) :( _/ W( P( f2 X( o: M! e

* u. O$ g  K" @1 j-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! v# g9 p7 @7 z; \6 [+ k\Uninstall\SoftICE
  k1 J, z! x$ i2 s2 J-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- ^6 R" k5 a" i2 [* H$ F" K-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' X; a" r* o$ e$ ^\App Paths\Loader32.Exe
) K$ ?8 f1 C5 Q# ^6 j
# g' Y# L* k/ _) F( j+ o# n) F% c; [7 x9 O, T5 X1 K
Note that some nasty apps could then erase all files from SoftICE directory
( t! ]" ]. J) O6 {1 x(I faced that once :-(- e6 A& ^1 K; ^/ D( {$ i

7 ]9 q9 l0 ^) g. f' x/ r$ aUseful breakpoint to detect it:3 L0 J+ F! s! C2 l/ d8 U- i' @

! r3 D4 f& p( r     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ x6 |" }% O. P1 ?
9 d" Q) z# b0 A* ?7 {6 A__________________________________________________________________________' N0 u! F! i- h9 `
, y: g$ l3 c2 u

" J: T- q* {5 z( j: x5 _0 tMethod 14 " ?; h7 H0 `8 Z
=========. o3 ^9 ]. w) q! _% t* X0 W

, l- S+ C' R& o. v0 U! GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 R) @7 L6 ~# l" d  H0 X2 ^is to determines whether a debugger is running on your system (ring0 only).5 V2 p) w2 e! O0 ~+ Q

7 c& r5 O# v' z9 Q( a( f; w   VMMCall Test_Debug_Installed( h( z+ U- g: U
   je      not_installed' T& V! @. W' `3 b, ?0 U( a9 ?

7 G8 V- U/ x, m( u1 v+ ~- AThis service just checks a flag.; W& D  P; u# Q* r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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