About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# J' p7 ~4 m6 Z% Y<TBODY>% e, t( K5 O2 }1 F
<TR>
$ m% Z5 |, n1 M2 `<TD><PRE>Method 01 # U5 D# {' x2 ?4 r# @2 [6 w
=========
7 X9 o. A1 [9 ^* p" l" T
3 I- O$ `! s" j1 X/ a. lThis method of detection of SoftICE (as well as the following one) is
) W! p8 y9 k3 r+ e8 }* Kused by the majority of packers/encryptors found on Internet.
0 [0 L0 s" z  B; f. Y$ k6 P0 }It seeks the signature of BoundsChecker in SoftICE- x5 N4 S$ J# J. m8 I3 E0 C- y
% F5 N! s) W; z
    mov     ebp, 04243484Bh        ; 'BCHK'& \$ a; u# j" x$ [; i/ n0 t7 i
    mov     ax, 04h
& o6 ?7 y2 L" _( ?4 P    int     3      
/ w: N+ m* v% s; E    cmp     al,4
- j* A8 l% p+ s7 M    jnz     SoftICE_Detected; W8 t( M9 {9 F& E

8 c# P' Q' [6 O& s5 ^" B___________________________________________________________________________
& s( j( E, c5 q- O
& L. M" B. Z' t4 z' N( M1 X: MMethod 02( o; N# B/ _: ^3 r" `1 S/ Q
=========
3 z$ J* {7 G4 j/ j! x0 r: B3 a0 y9 J) }
Still a method very much used (perhaps the most frequent one).  It is used, k7 ~6 n' E' R$ t/ K5 L
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
& B; B) h7 `# u% \. aor execute SoftICE commands...2 e) e" T/ U* p& q8 d9 z
It is also used to crash SoftICE and to force it to execute any commands
* h2 i0 Z( X' k- N& V3 u(HBOOT...) :-((  , c: U# T- ~9 n& J' Y. A: D9 }

0 r4 }& z5 c& R( |' [  e, s  CHere is a quick description:0 j/ h+ m# @3 V( H$ T8 y# s
-AX = 0910h   (Display string in SIce windows)
' A( z1 }2 @+ c9 U* a! q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
' N4 E8 J4 o$ v2 I-AX = 0912h   (Get breakpoint infos)
% K$ P6 a1 }) J( ~7 o& k-AX = 0913h   (Set Sice breakpoints)2 u1 D! ?" `3 i) p5 I
-AX = 0914h   (Remove SIce breakoints)
) ~) w9 g, C/ z( T7 \, v: E$ ~3 T4 j( a( k' Z" [1 _# L
Each time you'll meet this trick, you'll see:7 `$ \, F4 N  d! A
-SI = 4647h
) ?* n% s7 e% D: D. F-DI = 4A4Dh# T; ~) ^' G* k0 R2 [! I
Which are the 'magic values' used by SoftIce.: |! Q8 r) Y3 h" j! W4 J
For more informations, see "Ralf Brown Interrupt list" chapter int 03h./ q3 B8 B' A; e) ~# ?+ y8 U! t
# m; c. t; U& I$ q$ |  B( U% z
Here is one example from the file "Haspinst.exe" which is the dongle HASP
  x2 `0 B  U8 h8 AEnvelope utility use to protect DOS applications:
( N) X# g  D  ?0 Q) a& f3 J( j6 s5 j. n. \5 y! U- D( z5 V
0 P% B# a5 @% m1 @
4C19:0095   MOV    AX,0911  ; execute command.
1 s6 }9 X4 H4 F% y" I4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).1 m+ m/ b, _: n: P% z# v
4C19:009A   MOV    SI,4647  ; 1st magic value.
4 ^* O7 [0 E& Y7 |  H( N4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 z, G0 y; g/ h: c; Q. D' g
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- w9 n- R8 C" ^" `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" x5 l& W( Q% C8 V4C19:00A4   INC    CX+ f& n, _4 ?# P" L, ~9 T* e1 J% u! W
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! F9 S6 V  d5 \1 \8 M5 J# f$ k
4C19:00A8   JB     0095     ; 6 different commands.
4 }/ _; q  H' M! {1 U; U1 E! w' k4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) S3 R2 ]6 C/ D' U
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- F% \  o; e& h
2 y7 c+ A! H0 B  v# |& n; {The program will execute 6 different SIce commands located at ds:dx, which9 \" G8 S2 M& {8 s/ y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 C; B! W# C( K# z  j

9 `4 K0 `, R& k+ l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* u+ F/ d$ l7 G! j6 A) [% H___________________________________________________________________________
- M, I- H( f' X6 k/ R) T
7 `6 v& l5 q$ w% z: Y! ~! }% T0 ]2 X
Method 03
1 C3 }2 G$ M9 C! r=========
: p, e7 Q0 g1 w. q6 t) O9 @8 B! W( H' P. f* Q( G) ^
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, |5 f) I; J! G(API Get entry point)
# F/ e& K' o+ {  Z. g3 O        " [  G! ~- U# V! x3 w7 j8 r

' _* k* n: _1 U/ C! ~    xor     di,di5 V. s3 F% ]: f( B
    mov     es,di
  C8 {! _6 A6 @. B/ Q7 x5 y- U    mov     ax, 1684h      
9 ^# I0 O( G1 y$ C9 T2 _    mov     bx, 0202h       ; VxD ID of winice* {9 l3 E) W8 I6 V! T  J
    int     2Fh
4 Q  p* w& e9 x    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: j7 D: E2 C$ E0 r    add     ax, di* [+ `: G8 U+ m, B' T0 n2 r; T0 x
    test    ax,ax+ g" V% _  _* V" J' h
    jnz     SoftICE_Detected; S8 A" D; D# a6 Z; g
8 e) M1 G0 O' x# L
___________________________________________________________________________$ Y+ Y: k- @, a1 R/ e4 R
6 b: a) u' g7 @) x% v" Z: q/ S9 Z
Method 04  U- c& [) N7 v4 z" r3 q
=========- U" n( Z1 I8 Q6 |  N0 h( V
# }% Z. I/ h  Q) J
Method identical to the preceding one except that it seeks the ID of SoftICE
" m8 K, i/ c8 j1 WGFX VxD.
3 O( k7 f% x. m! j5 O2 N9 R3 I; _7 K* g* j2 n3 Y. k
    xor     di,di
- B. U- _) D+ ]! x1 D+ n1 A. E    mov     es,di2 h- i6 h3 J6 s  z( f
    mov     ax, 1684h       7 Z! y; C! `% ?# N! h. j+ V
    mov     bx, 7a5Fh       ; VxD ID of SIWVID- ]1 Y! p9 `2 }8 z: T) P
    int     2fh
4 \  Z' j) v. |! L" u    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 ]8 d; p* B# _- _
    add     ax, di) V' }1 Q6 e9 `' @( f
    test    ax,ax( S+ p4 }+ @6 y0 ~6 W
    jnz     SoftICE_Detected" Y$ D( `4 d) `; L/ H

: x; \9 o2 r2 B0 m__________________________________________________________________________
2 p2 N- X# d( t. G8 u9 r( Y3 m; E- l9 ^

2 X7 {. h. a  U! b* \3 m+ [Method 050 b- v7 d" Y0 I4 I
=========
; O; ?$ j  F# l& K! b$ L! A  b7 A1 Q+ K' w# T4 u3 F7 z7 v+ z5 C
Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 E8 J% Q, k" `4 c* m5 vdebugger. It calls the int 41h, function 4Fh.
2 J  x; F1 W4 h5 F4 \There are several alternatives.  
3 G5 B3 t5 R6 G2 a' P2 v& e5 b: A6 ]1 a* m
The following one is the simplest:
: h  c6 @' N; h& {1 t5 ]/ @: O. Q) l2 ?" v2 V3 S! M6 Z) Q/ Y
    mov     ax,4fh
/ y+ d+ `+ o9 C  A& a  {    int     41h0 f1 d+ D/ E: a$ l
    cmp     ax, 0F386
$ [) `. x# ~. c& |; r- y; y    jz      SoftICE_detected; J+ w, u* C$ x( t, G- t8 `

1 m4 ?* v  s* `7 m: z; b
4 [0 `2 ?( y8 c& n" \! }3 G, mNext method as well as the following one are 2 examples from Stone's + a* ~' c/ L+ ^6 G
"stn-wid.zip" (www.cracking.net):
% s4 f7 K; d  A4 k8 f. k% t- ?" }) G  r+ Y# V% t
    mov     bx, cs2 X1 D( D2 K$ b( A% [, h
    lea     dx, int41handler2- |7 A4 g8 u2 T
    xchg    dx, es:[41h*4]$ E, A+ M7 e2 G+ m& h; ]1 u& M
    xchg    bx, es:[41h*4+2]$ C  x7 Q+ n% P
    mov     ax,4fh
9 Y( ]! v- [0 X* n    int     41h4 g( p3 X" ]$ d8 d- Z; q, l8 n
    xchg    dx, es:[41h*4]
, R+ j9 m( i0 U/ N    xchg    bx, es:[41h*4+2]
" u: y! ?: r7 z# A    cmp     ax, 0f386h
  X9 b& U7 C- P  y' ?; \; m! H' o    jz      SoftICE_detected
& O9 t8 a8 {: z+ J3 ?+ R- M
, ?; f1 d1 `5 L* u; Kint41handler2 PROC
# p& e$ M3 i; e! E9 \6 C& ~# l    iret8 L! c& p, P9 q. U4 M
int41handler2 ENDP% h) {7 E6 Z. \1 @9 [
/ _; z7 Y3 J& y6 P  \, x, Q
6 {$ Y, ~6 J) C7 ~0 y# k" Q
_________________________________________________________________________
  L5 M, m7 \1 Y- }. U2 n# f+ d  n: K0 F) m) b4 a4 j! }% b9 ^$ J
! h1 {% I- J! H* O/ G
Method 065 e! k& d/ z% j. c# }" ?
=========! B- v. l, k5 x
1 u, ]" |  @- D9 u! L
2 a* w/ U" n% W3 D7 U! N* G
2nd method similar to the preceding one but more difficult to detect:' ^! y% L. B3 p" N# F0 S! O4 z

2 C' X' Y; p6 J: u- K1 F" Q6 G0 c2 @8 l: a. H& ]9 {8 K
int41handler PROC5 t' _' z* t3 r+ j
    mov     cl,al# H0 T* m& `, Q# r8 G( j
    iret, y8 g9 V" b+ X4 U4 ?
int41handler ENDP
# X1 t  w# g  ^* U9 \( T6 k
8 I  B& G! J9 d, p0 g4 E+ K( a/ z( A. r8 t
    xor     ax,ax
) q4 e: D; {6 P7 }: F$ ~    mov     es,ax
/ _$ ]/ S% l$ ~/ f    mov     bx, cs
5 x8 `$ H( y0 A' s8 e/ F    lea     dx, int41handler
- b  E1 U% n* F, z+ @    xchg    dx, es:[41h*4]1 w) ]& z! l/ j5 d4 f1 ~
    xchg    bx, es:[41h*4+2]
5 t: o. E" {( D: e8 b7 \+ ~    in      al, 40h
  O. e- |" P" a& \0 Z    xor     cx,cx
1 b+ o# I* W* |7 n9 \    int     41h
7 \$ V1 H* H! N- G    xchg    dx, es:[41h*4]
- ~$ b. c, Q+ `$ @    xchg    bx, es:[41h*4+2]
  g; q) ~  R7 o1 |  Y. h: d" E' H# d& g    cmp     cl,al
# K& g7 |1 [0 @" F    jnz     SoftICE_detected
% h/ l( k% }) x0 r
0 {/ V+ j" d$ n- p_________________________________________________________________________/ P3 ^1 d0 n: W" f& n" G" v7 {
- u( L( {  R4 e
Method 07# M+ y+ |4 o# H; f7 _
=========0 H" E# d$ \3 ]9 ?- W' D$ f4 M

2 a6 _: z7 E+ A+ L4 k3 YMethod of detection of the WinICE handler in the int68h (V86)2 Z5 O7 c: B2 F2 w- j
/ T4 L6 g5 x  r6 j% W3 u: A4 _
    mov     ah,43h
& G/ V1 @2 P8 E0 M& F7 J! Y    int     68h
0 P8 ]  ~$ m3 \: b& F; Q, @    cmp     ax,0F386h
: R2 b) h* z6 F: f1 y( p    jz      SoftICE_Detected
- ^; q! z9 r; t& }2 H, P# M$ |" C$ ~! s8 @$ y9 c
4 B( A, y* L; N  k) l. G
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ Z( m' s, g2 B0 t6 T5 \$ t6 x
   app like this:
. W  F4 r  l2 R+ Z1 |- a. t- O/ r4 q, |! Q: \& t
   BPX exec_int if ax==68
$ l* R$ U$ ^  b: b# [   (function called is located at byte ptr [ebp+1Dh] and client eip is) l" _. G2 r5 u
   located at [ebp+48h] for 32Bit apps)
, ]% Q* ?# l& k9 B( m; k. z__________________________________________________________________________
3 q# E3 z$ K3 ?' |/ q: m" {. _6 L
# u& o% L) W9 P6 O) ]
5 F, t9 Q8 P& y7 j; b, k' Z* }Method 08
: X2 _9 `) c2 Q8 H9 a=========
3 u% ~0 z. `% x2 H) z0 d
3 i3 c+ A/ T/ d# p, K) c& cIt is not a method of detection of SoftICE but a possibility to crash the
7 j- Y$ F6 P  z+ b8 t. T5 F/ p( [5 Csystem by intercepting int 01h and int 03h and redirecting them to another) w) V4 T& ^/ `; T& M
routine.+ P! K  G6 b7 V6 s& u  f
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 L. X4 D- n! @$ ]# Pto the new routine to execute (hangs computer...)
) F* w! u, h) W9 \1 G# q
1 \9 ~2 @* w& s2 [* o; i3 S2 c; }    mov     ah, 25h, [, p' v: h# ~, j; j  {
    mov     al, Int_Number (01h or 03h), x7 v2 ?0 O$ @4 h; J: d$ L; F
    mov     dx, offset New_Int_Routine) A9 u, ]5 ~1 ^' s, @. ^; _4 K8 Q
    int     21h& ^+ j! W6 E1 C7 E' w4 A7 w
4 o- Q1 a) C, {( v/ U
__________________________________________________________________________- B; {, c4 G7 t, r

/ f6 B: f4 a, mMethod 09
) D" r3 z  o( e% o6 o; V=========" Z- |/ U# l+ S5 f2 y1 u

4 |3 K: |$ d: |' z7 K# q: cThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 c6 n2 ]' }8 X4 Q. v9 N% Fperformed in ring0 (VxD or a ring3 app using the VxdCall).# L# d) G! o- B6 G. g. y5 R/ T
The Get_DDB service is used to determine whether or not a VxD is installed/ V$ t2 K+ T) `8 S7 ~* w
for the specified device and returns a Device Description Block (in ecx) for
- d: w5 y0 u% [' f7 fthat device if it is installed.2 O9 i% C( p: w7 V1 u

7 i. e. J' ^1 X8 |. g' K   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# K# p; {) m0 Y$ y$ u$ P& H! W   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 {. M2 V" s( b! B
   VMMCall Get_DDB
& U! M9 B" r: R   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 i' }  H2 y3 t+ X8 N9 ?: g* d, f  U5 p; ~) _
Note as well that you can easily detect this method with SoftICE:" ~# W2 ~  F* H( R
   bpx Get_DDB if ax==0202 || ax==7a5fh
: q0 ^4 `* @; D2 v+ _- \! L* O, ]' `- S4 V
__________________________________________________________________________
- ~. R6 P% e2 u7 p- f
/ z! q6 W1 m. {7 q# E$ A8 aMethod 10
) G( s5 c4 I$ h* r=========
/ ]$ G( k+ f7 {. d: r5 }1 k2 }8 v/ z. I
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 j* ~' E: u! ~" {( W1 U
  SoftICE while the option is enable!!
# ?/ f- s! ~: c1 e4 ~
" M% D) I/ y0 L" @  i  hThis trick is very efficient:
9 {0 Z( T. U, z% Z+ Fby checking the Debug Registers, you can detect if SoftICE is loaded
2 |& O) K* Z, h. a! a(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& J( V) P; d1 y9 L! B" U
there are some memory breakpoints set (dr0 to dr3) simply by reading their" x8 ?3 m% q! G7 y; ^3 T
value (in ring0 only). Values can be manipulated and or changed as well
3 j0 `8 h( W- l, t, ~3 u* N4 g(clearing BPMs for instance)" t/ o) z$ {- i

, @8 I* c, {- u! \" X" X__________________________________________________________________________
0 B6 T4 i; l( {3 \! W% r. k7 U
8 b) T4 K1 L2 S8 J4 B9 d  VMethod 119 L$ N  R0 D. U: d
=========% I5 [- F0 J6 ?6 o( d

. V& O3 Q! x# S$ l' ^1 f/ B9 hThis method is most known as 'MeltICE' because it has been freely distributed
' @! B7 E  \8 k9 I/ L  i2 ]via www.winfiles.com. However it was first used by NuMega people to allow' ^1 u, e, T  p! i  q
Symbol Loader to check if SoftICE was active or not (the code is located
0 j9 q1 v. q* G( Y3 g! winside nmtrans.dll).6 }0 z  W9 e4 T$ L- e% _

: {9 h( F( N: u$ b& \The way it works is very simple:
5 G3 U$ R% y& T3 \8 Z6 ?It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ r& u5 @$ U# L1 U
WinNT) with the CreateFileA API.5 X% H$ D( W& U5 C( p

( A+ G- d3 ?% {" pHere is a sample (checking for 'SICE'):6 F# X- w! B9 M/ R& I7 w/ R& f

& |/ r7 l: E( C. F( J* g& ^3 kBOOL IsSoftIce95Loaded()$ n4 f* z2 e( f! d* T: g2 [
{
1 p# C3 h% |& _' M   HANDLE hFile;  - j8 b- \! C" D  I
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 J; g; z& M0 w% V( u- {                      FILE_SHARE_READ | FILE_SHARE_WRITE,; f) f) l9 V2 ?' r" A, L
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: w4 j9 k1 K2 Z$ @+ j" E   if( hFile != INVALID_HANDLE_VALUE )+ Z: W6 t4 v& {, U9 B+ d
   {
; p$ g& I- `/ `5 e; k+ Y, _& L7 y      CloseHandle(hFile);
5 b) s3 w# I1 R8 E( D" C- n      return TRUE;
- b' h/ ^* _) A: n0 Z   }
7 q# X2 M7 Y" J: x% W   return FALSE;3 P. O; K; A$ r; ]# F0 B) @
}
# g% w. f! j& _% K6 H1 i9 q" t
" |( m- z; D9 p6 AAlthough this trick calls the CreateFileA function, don't even expect to be
& B& _: ^) W2 |3 Zable to intercept it by installing a IFS hook: it will not work, no way!+ R/ o3 P: H( e* C
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; h; M# j* W) R. ~, I4 {( r+ k( [6 T& A
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 A% k* {' f: s5 V- x6 dand then browse the DDB list until it find the VxD and its DDB_Control_Proc
' y/ a0 Q4 x: v/ I: @field.4 x9 I1 `% K2 `8 ~! o# D
In fact, its purpose is not to load/unload VxDs but only to send a
& }* @: b1 R( HW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" W3 p5 B4 ^4 |
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ }. [+ G0 v* O% _to load/unload a non-dynamically loadable driver such as SoftICE ;-).
' o/ S- \# T% K* N. R" A: I, Z. NIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 f, F' E: t9 ?0 S9 S+ A, Q- Eits handle to be opened and then, will be detected.
& T4 O9 Q9 B1 ]$ A6 FYou can check that simply by hooking Winice.exe control proc entry point% [6 i' O* {' Q) _
while running MeltICE.
. Z+ Q3 B* B: L/ o2 i* m
5 x- p/ A' [# [" B( ?0 n# u+ j' ?* A' M
  00401067:  push      00402025    ; \\.\SICE$ k; N+ e  k8 H6 O# H2 M3 T
  0040106C:  call      CreateFileA
  u6 z+ J- T) ?: p3 a2 W  00401071:  cmp       eax,-001. \2 Y* g5 M( T& T, g5 f% i
  00401074:  je        00401091& i2 J0 |) d' @, d9 j

2 H2 _+ h# S4 l2 _$ c+ m( S2 B) h. t4 j9 n1 x4 e9 n3 s& h1 N
There could be hundreds of BPX you could use to detect this trick.
: F  P3 k' @( j: n-The most classical one is:& n$ o1 b, p4 b1 @: l( e
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- M" J; G" \4 _& d' E- n# s
    *(esp-&gt;4+4)=='NTIC'7 P& h0 `% J) C
$ L' q( I- i/ [. t9 ^
-The most exotic ones (could be very slooooow :-(
: N5 P! |; |4 j8 T# F   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( M% v3 j6 k7 z- X# \     ;will break 3 times :-(5 U0 {1 V$ ?3 l; E

! ]2 M2 z, Y+ R4 ?2 {6 ?-or (a bit) faster:
* _9 y3 u6 D# Q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 d) I# W3 C( f

* ]9 T* @% {* j' ^, {4 s   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- @$ [; q; P7 j5 V( C. n; T- {     ;will break 3 times :-(
9 z! b- S  p! T  i3 g3 s; N  i( A7 A- U
. D( V8 \- {4 n( i% x-Much faster:
$ v7 V+ w7 f; g3 M: ~! w# C   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 ?1 m7 g% x/ V( q4 N( q/ \8 N5 w# {+ p. i1 h1 r9 k! V3 h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 U  F2 T9 s$ Q- `0 tfunction to do the same job:( Y1 F# B: P* s( Z9 a. P2 |' N
( M7 k% i! S7 R3 N, n: `. Z8 E! t
   push    00                        ; OF_READ1 z! x* X% _% T1 u4 _
   mov     eax,[00656634]            ; '\\.\SICE',0
) v$ K* t( Y7 @- M3 [! B' I   push    eax2 w+ {' `" l! I, u# d& p
   call    KERNEL32!_lopen
# ]4 {! V8 V- S* O+ e9 F   inc     eax& H2 ]  Q( B$ s% H
   jnz     00650589                  ; detected* q7 C0 T- l; m
   push    00                        ; OF_READ1 C: _2 i5 H% @, J# z5 ~  _, V3 N
   mov     eax,[00656638]            ; '\\.\SICE'. Z$ U6 w( p5 \; t; F7 c
   push    eax
  A3 D( p- ?6 d  U* c( w2 |   call    KERNEL32!_lopen/ l$ p5 n, o7 S
   inc     eax
( ~  e1 q5 E' P% P3 b5 `   jz      006505ae                  ; not detected
; l' ^. [/ z# L" c6 b- X) ~7 ^  J. M& D" }  x) }
# g! k0 }# j0 R- h) ~  h
__________________________________________________________________________
, I) _. e! G9 r! w$ t5 u& W3 r5 p% s% |! U" g
Method 12& H  I. R$ t4 f# g9 A+ p
=========
) e; n$ }" y8 }' R7 }
( J8 |! R" s& F  C2 @9 ?This trick is similar to int41h/4fh Debugger installation check (code 05) b( T! U' O5 x
&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ \' C7 b9 o0 N  ?' D/ ^( c
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 l8 O) X# i6 Y8 m. Y: [4 {% d+ [1 p4 Q- ?
   push  0000004fh         ; function 4fh0 }- u; \3 L& b5 |" U
   push  002a002ah         ; high word specifies which VxD (VWIN32), S0 G: g, P0 h) w( Y/ ^
                           ; low word specifies which service% B4 H, A0 {* i/ z
                             (VWIN32_Int41Dispatch)+ E5 g3 _5 w6 f0 h0 \' I6 l; w) A9 D, k
   call  Kernel32!ORD_001  ; VxdCall
$ t1 V' x, }& {. H0 ?   cmp   ax, 0f386h        ; magic number returned by system debuggers  f# W7 L4 ~& `$ w. X( f
   jz    SoftICE_detected
5 K3 g; m4 _# ~% ^7 L% h8 b0 t- X0 T5 x$ U" r4 I
Here again, several ways to detect it:
5 O2 L8 G2 ^; h+ M( g
0 q4 v- s  ]. [/ Q3 }! M% _    BPINT 41 if ax==4f
% I" s& {5 k- d! ~5 E& C
7 [' H2 B0 s6 i* v% p, N    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! Z' @0 G7 D$ t2 M, b" x* N' j/ O6 N
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 E& S/ p3 e- n8 U
$ M2 I7 ~; W1 C2 u
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# a( k9 A7 K( O( n8 @# t: ]! L

" U! b. G, j3 i% o- T__________________________________________________________________________
" u% |3 P- @% m/ c$ _7 y9 i* A. ^) Q8 i3 j& T
Method 13
) t+ k3 L% F7 u, K+ c* j! e) J=========+ W; i6 r* G" T  Z9 S% X

0 q# E, c7 c* u+ v( M; j4 _Not a real method of detection, but a good way to know if SoftICE is; \+ t# w" I( H/ {: }# V: V/ ]
installed on a computer and to locate its installation directory.
5 Y; {* O5 d5 I3 ?9 CIt is used by few softs which access the following registry keys (usually #2) :
( t; N8 k7 }  o6 p
* C& B) |# F+ u& m* N-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: Y6 O5 r, W) p' [/ h* {8 q
\Uninstall\SoftICE
4 H8 u" ]# X( I5 q: r-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( r. d  O' A5 h) x-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 g% K' _! Y: l& A5 Q/ c- i3 O. H6 f- w
\App Paths\Loader32.Exe3 `3 e7 p; o! q4 {" R) J& P
7 d8 @5 Z6 G) N. s/ h9 c
3 ]1 W- |0 g8 ]
Note that some nasty apps could then erase all files from SoftICE directory
% r( `1 f& h' U& K7 v9 s8 @(I faced that once :-(
7 d5 c+ {3 t; j: ~8 Y5 G5 |  s8 C6 k! c
Useful breakpoint to detect it:
. d$ z$ }8 @7 G4 X( J- z; X
1 h0 e. _* r/ `* O2 M+ w     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 S% o1 H9 {4 H& r' _1 t4 A
9 n# |1 S6 k" I
__________________________________________________________________________
) F7 I- k. T2 m) E! O0 z: l" ^7 K
& s; Y1 p4 p( @% a6 o, d
Method 14 ( `2 H9 D; T0 z8 s" c
=========2 q2 S- j& k' _2 a% ]4 ^+ h

1 n3 T0 G! x1 u. h' c( \. s% x9 `A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 Z6 T) T% i. P8 c
is to determines whether a debugger is running on your system (ring0 only).+ ~: M3 Z4 W2 v* r4 s

7 L; D1 r# f" [4 F* x: A( r/ L, y   VMMCall Test_Debug_Installed
, ^3 ?* w8 m5 [* k, i9 A   je      not_installed. [/ h0 r6 D0 M
# T! w5 ?' ~' j- e) B8 t& f
This service just checks a flag.
; D4 u6 B$ f; `# x* U7 P</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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