About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( @' N# C0 \, I<TBODY>
7 p3 K- v3 ~" B- u; s8 g# _  m. ^# m<TR>6 K. A3 W$ X7 g- i/ L
<TD><PRE>Method 01
, b" _. U2 U' ?1 H$ @% @=========- N7 w6 V+ n8 S. R3 a9 c4 v
+ ^5 X8 m* E+ F+ S2 H
This method of detection of SoftICE (as well as the following one) is
5 V# a3 p+ H+ v3 Z/ U: M. w% b. ?used by the majority of packers/encryptors found on Internet.+ z' a! {! Z9 |
It seeks the signature of BoundsChecker in SoftICE0 B( N% f  L# Y* \) t$ [
3 a8 s7 v9 q$ K; y
    mov     ebp, 04243484Bh        ; 'BCHK'3 x, s0 f6 K1 ^$ o( w9 Z% o
    mov     ax, 04h
: m2 b% Q4 V# {1 G    int     3       0 l/ {' N1 A% Z+ y9 Q
    cmp     al,4# `# U6 @: t2 X
    jnz     SoftICE_Detected  ?' Z5 J2 W, b+ G* i: o; f

* U' I9 g+ E" G% |* r___________________________________________________________________________3 `$ g5 n5 l! M" j9 |5 F' V
0 y. e- o# f# \& a6 N6 B
Method 02" C( H# D. S' y/ |9 e2 i
=========4 k2 z7 ?0 t! N

* G/ S& [' m+ k# D* HStill a method very much used (perhaps the most frequent one).  It is used1 a' j- a1 e1 R% F7 ?7 \
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) a5 W& v0 ]) o8 T' o" X& W. @" Uor execute SoftICE commands...
) G6 m# P. ?% r1 F' gIt is also used to crash SoftICE and to force it to execute any commands
" H* Q) w" O6 }(HBOOT...) :-((  2 @8 a! m8 O+ M

6 Y( o# w, m& E6 p' yHere is a quick description:
% N! X) v. O5 x, o# M5 \-AX = 0910h   (Display string in SIce windows)
& J9 w8 w" B! r3 b. q* h- e  Q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* I# a0 }) {+ T) f$ v( _- F
-AX = 0912h   (Get breakpoint infos)2 f$ S" n, G9 O( d( F* N$ M% Z* V
-AX = 0913h   (Set Sice breakpoints)& V4 \0 K1 r, S- v3 J
-AX = 0914h   (Remove SIce breakoints)5 F* }+ g" c  r* X8 V" E# ]: t

5 ]( l$ a5 E% e- g+ ]Each time you'll meet this trick, you'll see:7 E9 g0 Q9 y. ]/ a5 w9 l
-SI = 4647h8 g$ h4 m6 u% G" J, C$ m  e
-DI = 4A4Dh* l. U; G4 n; O! Z- r
Which are the 'magic values' used by SoftIce.
( r! [: @' L- K6 h- |' M' QFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 v7 }0 D  O6 Y4 R3 s4 D3 m6 g0 U4 `& M- ^
Here is one example from the file "Haspinst.exe" which is the dongle HASP
4 h: G6 a) x9 O  e+ c- ]+ sEnvelope utility use to protect DOS applications:3 j- A; h- X! @" @! m

5 b" x7 o! Q/ u9 y; @& h: N0 @! U/ B4 \; V
4C19:0095   MOV    AX,0911  ; execute command.( a4 |. Y+ W# ~/ Y0 d8 G+ O0 U% x
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# k7 h/ w* L4 z; U  b% e: p
4C19:009A   MOV    SI,4647  ; 1st magic value.
/ u  ~$ Q) n) T4C19:009D   MOV    DI,4A4D  ; 2nd magic value., r# c! }7 F0 J, n0 x0 X/ D
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 R! F4 r" Q* g5 N& x
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- G# ]* L% P4 H1 f. m
4C19:00A4   INC    CX
' B+ X3 n. i' e% y0 J) X. h% [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ X  d% Y0 _2 e6 o* \) m/ |3 w$ Z* N8 p
4C19:00A8   JB     0095     ; 6 different commands.
; T8 S! j) q: e4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# J4 f# X& F1 ~+ R( F
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& n. S: E; ^( f2 x3 y# R9 X# b

9 Y9 {+ C; ]9 r1 zThe program will execute 6 different SIce commands located at ds:dx, which
3 K& `" m8 F* T" J" @are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 `0 `: K/ m: B7 P& W" o

$ }' Q$ M9 c+ N  _* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& C  r6 }) r$ `. u/ j
___________________________________________________________________________  d- i) s& O- q, i* d$ n

* S  s2 ^1 C: O9 Z
+ ]( z; u% {. z( ~' Y4 |Method 035 L/ u5 L* z8 t+ k. t
=========
+ `" ~6 E/ l) I" V# m/ q
6 v2 [* {: t* H" D( VLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 R, ^# a- `' p5 Q6 u/ Z! j
(API Get entry point)3 w' p& Z9 R$ A" g9 A' l' g
        
, z6 m  M! e" `+ C. W! k- g) w1 i$ r8 I4 g7 j
    xor     di,di
  f& c  E6 F! j: t    mov     es,di
/ c8 I& p* q& z# F$ F( P6 X    mov     ax, 1684h       8 R! M, o: _' i# g
    mov     bx, 0202h       ; VxD ID of winice
" i. g7 j: o- s" Q$ R    int     2Fh$ C  Q( X, z% [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ `; b$ N% X5 S5 W2 {& k) Q9 ^
    add     ax, di- e% N+ M5 }+ A
    test    ax,ax  ^8 ^4 ]  T  p$ O: A
    jnz     SoftICE_Detected" ^9 W2 e' b2 z* l+ m( z, l( z% o
' ^  ^2 V) d  e9 w
___________________________________________________________________________- ]) d! J0 u! I% i! F5 u) {
" C+ K3 N( y9 O! v
Method 04
, D% C$ O3 \0 W, d* s7 Q) L=========
; }# Q! s/ B% W9 `- c
8 k3 d" N: A. VMethod identical to the preceding one except that it seeks the ID of SoftICE  W/ N( a' ?. M! m
GFX VxD.
' K8 `$ Z7 P, d" M3 M' I# m6 ^) q) B% P8 [* z/ f( W' J( ?
    xor     di,di) s! ]) R7 }1 r2 `: A: s% i0 U+ y
    mov     es,di5 x5 I4 x  O4 \+ p( {, C! L  u' i$ B
    mov     ax, 1684h      
9 a5 C; s7 I) {1 s    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 Z. [% k. i1 \7 S    int     2fh" }+ n4 K8 N& K* x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: ~* b0 l. `& S
    add     ax, di' p. i0 U' I* y$ E! C7 h
    test    ax,ax
  n8 z% S& m3 ^9 N    jnz     SoftICE_Detected' D* t) ]5 y1 F3 s2 S" {
; N+ G) q: Q+ m9 i2 Q7 s3 ~
__________________________________________________________________________
' _! P: \4 Y/ D! q( H( P* g# d
/ ?; B0 B$ y$ o) e) A- L  V& k/ x# w9 ~" t/ P9 A
Method 05+ t# i4 i) [5 j$ i# D
=========
' W4 l/ Y4 C! [& f
% f, U  ^) h/ Y1 I1 q" p: |Method seeking the 'magic number' 0F386h returned (in ax) by all system
. j/ |8 y2 [( e. F( ]" w8 X. Ndebugger. It calls the int 41h, function 4Fh.
( J6 V0 x- A6 r( D: l6 PThere are several alternatives.  / i" ?. ^0 J; R/ U# e: w
6 C* ]5 t7 g( @6 j% M
The following one is the simplest:1 }  n$ Y3 m' N& @4 _
& l: O2 e9 [) e- z2 ?  m4 Z
    mov     ax,4fh  ~3 A: p# x) u: {" h
    int     41h3 j% a7 x2 \; M
    cmp     ax, 0F386
1 s; W  \9 ~6 w, h- t& L% ?4 }    jz      SoftICE_detected9 h: a9 p# \7 T6 k0 q+ w
7 [' G4 W* z7 }; i* y( _: S

2 Z& N. z' g& ^0 kNext method as well as the following one are 2 examples from Stone's - J* A% S' X1 W( x" x: g3 h
"stn-wid.zip" (www.cracking.net):
. q- ], G) q; }& X- H  _/ F9 R1 G. d. {" k
    mov     bx, cs5 x  Z/ C" W' B
    lea     dx, int41handler2
2 p3 _% Z2 f. V$ l    xchg    dx, es:[41h*4]! N# ]2 t& s# A& e# v
    xchg    bx, es:[41h*4+2]7 Y# ]( d$ T9 H7 }
    mov     ax,4fh& y# m& r0 C9 ]7 R+ h% I% a$ j% @
    int     41h. ^/ P- U+ m3 ^5 Z( i% p; Z1 ^
    xchg    dx, es:[41h*4]
- ^- N/ c) O7 v    xchg    bx, es:[41h*4+2]
+ b2 X, r/ M! g- W0 r% C    cmp     ax, 0f386h
, y5 T$ t$ J3 [2 h6 k" I; a    jz      SoftICE_detected
) B6 Z7 U5 k& z: z; n
& r; o. ?  b) mint41handler2 PROC3 v, K  T7 k9 E4 c
    iret( G& B2 J7 B' c, ]) n9 l- j
int41handler2 ENDP
6 H: o* I4 {6 B  H5 e" r* U: ~8 u6 X& h  R

1 `8 p" |  U, {_________________________________________________________________________) t3 A) e, r; ~! o+ w! p

0 w- i- U( a  W; y. q' K; @) E7 ]
+ E/ ^7 ^: y- OMethod 06" F4 |9 Y% q1 R- M0 L
=========
/ E4 R, V7 Q) Z( x& Q6 b0 |& i/ ^" w) ^& m: o
" A/ j( }4 w+ {  U- S
2nd method similar to the preceding one but more difficult to detect:
! t! \' g9 b- O" t$ A+ P% R! _
6 c' ~8 F0 l7 s+ |, O* C2 a2 E" r
int41handler PROC
) Z* T* Y- i" J4 y+ K" b    mov     cl,al
% z' Y% Y5 I8 Q, Y! L    iret
0 c+ h* x( ~2 f0 \1 U7 Aint41handler ENDP6 h& n  E2 s- ]6 s  w* G. |

, p/ W6 H% N4 i
6 p" \$ }% y+ t    xor     ax,ax% R: P) U, [! C) c) U
    mov     es,ax
, M2 |3 p/ q0 H6 L' I) y    mov     bx, cs
: A( z% ~# [* ?/ o1 _# l: X/ H    lea     dx, int41handler
0 F! V: ^: G- R& J1 @) D7 T( o9 E    xchg    dx, es:[41h*4]
% y% o, C4 W) V- U5 P; w/ E    xchg    bx, es:[41h*4+2]
/ g  R) X7 R6 ?6 l5 t& N    in      al, 40h/ D& [& S" N* s& @
    xor     cx,cx- E# P9 T& m1 b7 c) _; f1 R: g
    int     41h6 b! g1 k/ }9 c. O) a* M3 M7 y: ^
    xchg    dx, es:[41h*4]
. @. S9 c8 `# Q; y- p  C# G    xchg    bx, es:[41h*4+2]
  Z9 h" W" ?: K& @    cmp     cl,al
' @1 D  U" N2 o* X1 p    jnz     SoftICE_detected) A1 s' s/ x( P" b6 _( d" n% h* S

8 c3 j7 e1 q6 {  ]_________________________________________________________________________4 _' p7 Z  z3 g1 e5 p* X( B

) k, N% ~# _5 DMethod 073 }3 y- v; k2 K2 ~+ m
=========- h2 U" i: P- s4 ?1 q

3 h4 @; G5 X0 h+ w' Y( }Method of detection of the WinICE handler in the int68h (V86)! a  n* a( u3 h1 C; k, _8 \
. B6 v; ~" J; H6 v
    mov     ah,43h
+ {, [* M, X* M3 E5 ]6 K    int     68h
! q5 q  l1 [7 f: l    cmp     ax,0F386h/ H1 n, p2 k0 l/ k7 N% B4 U
    jz      SoftICE_Detected/ |( {& G; o& }3 {  D$ p% E
. X& ]. j5 Z3 P" u2 @+ T0 x! t3 {
' h% @) G3 f7 Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, ~9 t( L0 I+ q! F, R- a6 C7 }5 J% L
   app like this:2 V# Q/ B9 f, H3 D- X

1 ~' o$ I% d+ j- C2 F   BPX exec_int if ax==68# @  a' _' v6 j) {/ v
   (function called is located at byte ptr [ebp+1Dh] and client eip is
# W& K; `* D! {, `* P! x   located at [ebp+48h] for 32Bit apps)
+ |8 y7 p0 p) r3 g, \, U; X__________________________________________________________________________
3 M- _0 H( Y# _4 ^; H% f2 E$ R1 M/ J6 M, r5 i
6 ~) A% J* n2 d" B
Method 08
6 Z& u3 X$ L: g=========
0 G( [* d5 H. g% w' O
5 `# y  d) g) ?2 F% O* O: r  }It is not a method of detection of SoftICE but a possibility to crash the
' k" P5 i: A5 r# Ysystem by intercepting int 01h and int 03h and redirecting them to another
2 R4 I" ~# L1 e4 K! aroutine.
9 f( W2 ]3 k- G: X, K, j6 U: D" z9 X* iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
1 o. A6 P* s* Q) @) Xto the new routine to execute (hangs computer...)
/ @( ]. D) v1 H( _" Y: t0 G$ k# ~6 o
    mov     ah, 25h
) `7 p3 E, S' Z. V$ o    mov     al, Int_Number (01h or 03h)
& ~: \- i: l! ~& j0 c2 f+ c4 c, L    mov     dx, offset New_Int_Routine
6 Z% F) O5 d8 E  e! Q. _    int     21h  z" e9 m) r# V' j1 H/ B
. L/ ^$ z3 f3 R# a( u1 S/ [7 ~4 ?9 h: t
__________________________________________________________________________
, K- d7 S& c3 \$ f: \
" i, L9 D8 U: @! cMethod 09! G  y8 F5 P2 N
=========: U; c: E" g5 ]% u9 A. {4 z# P
- \  C) \# u; L3 U, ~- c2 K6 S! x
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 ^* D# t) Y3 f3 y2 {3 H9 ~5 Rperformed in ring0 (VxD or a ring3 app using the VxdCall).' ^& Z  B  {0 ?+ o  C6 n) [9 x
The Get_DDB service is used to determine whether or not a VxD is installed
4 r; h0 N' O* Y8 Mfor the specified device and returns a Device Description Block (in ecx) for
" Z' v6 }  R. Z) Vthat device if it is installed.! ^' O' p! _6 H* `) @2 K
/ I5 Z  Z5 z  `: q* K
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
* K' {: c& S" m1 P! K+ V) V; a) A8 r" [   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), r1 `7 Z  I% F
   VMMCall Get_DDB1 }: ?) ^4 v! `( s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; O7 t( H: `8 H( Q) V# o) T( m
" C" v" s2 P% G2 D) w3 TNote as well that you can easily detect this method with SoftICE:3 d9 k! Z" l3 o* ^
   bpx Get_DDB if ax==0202 || ax==7a5fh
  V( e4 P  O' B# Y2 e; m( M4 R4 x  ^7 K) X
__________________________________________________________________________
$ I: Y" Q2 k2 {4 @6 `2 v  p+ f7 s& W2 [9 o; l+ _% S: c0 r3 O' ?# Q
Method 10% T. {; r# J  S4 \5 i
=========, g- {) n3 T8 T9 l

2 ^; d7 y* r; W$ T3 U1 d=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
; `4 F# O, y: P( P/ J, D  SoftICE while the option is enable!!
4 E* H3 p9 l3 X' h6 a; u: b4 T: C- C. V! c* _1 o# C! v# I% C. l
This trick is very efficient:
) T- s4 \: W. v) U& qby checking the Debug Registers, you can detect if SoftICE is loaded* K/ L1 y; Q" H
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# I- X9 y7 }* e, Q; I( ?there are some memory breakpoints set (dr0 to dr3) simply by reading their# Y2 c5 C- q+ |) \5 ?) w: @
value (in ring0 only). Values can be manipulated and or changed as well9 H7 Y+ T. ^% O$ j) u4 @( U
(clearing BPMs for instance)
. R6 j3 I' P, a5 f" ?; c, b
  u, u$ ~, |8 \4 \__________________________________________________________________________
+ r8 I  K; b0 L# |0 I/ T0 e. m: c/ G, ?
Method 11
8 H) z, i& v: c=========
0 t/ s% Q: H; S% O$ m2 ?2 \' W: X' R  d
! E. B4 a+ D' [. o  F3 a2 Z* {This method is most known as 'MeltICE' because it has been freely distributed
* W. z1 ~5 J' n8 @) l* T9 t2 Fvia www.winfiles.com. However it was first used by NuMega people to allow
% n4 s2 E4 I' dSymbol Loader to check if SoftICE was active or not (the code is located4 R* g7 G  G* k
inside nmtrans.dll).
, x* Y6 }5 G9 G0 A' c+ c' m% T2 U" N5 l) P& G
The way it works is very simple:% V- F) X3 _0 p1 x$ ~- p0 }
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! a5 A7 [5 f0 I; w4 _
WinNT) with the CreateFileA API.1 L* x9 K4 v; `1 {+ G
# W& s0 A% L) K0 G: `. t
Here is a sample (checking for 'SICE'):
+ F) f2 t# O. G( s
2 K5 |$ a0 `' D! E, `BOOL IsSoftIce95Loaded()
  X( @. _" a$ X{
) }& p9 J- o: _9 Z6 n8 ^' _9 P& U   HANDLE hFile;  
9 l7 l2 Q1 j5 Q8 }% v   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) H* \* r: ^0 ^$ P( n
                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 i+ A$ w2 ^; V, m# i
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 {6 _! E  G! z% {1 }4 \   if( hFile != INVALID_HANDLE_VALUE )! S# m) L7 X! R9 d1 y+ k
   {: S% [  G4 H3 t% G1 v5 n
      CloseHandle(hFile);$ R$ M! F: f' e2 g
      return TRUE;9 L5 o: ~2 g# a+ z
   }
" z$ d6 d; I6 \2 W   return FALSE;
( y& c3 F! D; v+ W}
$ D8 Q2 e" I% q3 x3 ]
9 {; W2 o0 K% d1 }8 F+ gAlthough this trick calls the CreateFileA function, don't even expect to be
  k) P3 q. ~, N; t; G9 M- F: Iable to intercept it by installing a IFS hook: it will not work, no way!: h/ R7 a% U5 j
In fact, after the call to CreateFileA it will get through VWIN32 0x001F% \, {; K; H, @0 s- @
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: H) B; F7 d/ y( G2 k2 }and then browse the DDB list until it find the VxD and its DDB_Control_Proc
- M1 U6 E# ^" D7 _field.
8 x+ n: x: V! ?5 y& e: D1 o5 vIn fact, its purpose is not to load/unload VxDs but only to send a + ]4 ]) `( W# M, ^% o0 `$ i1 j
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% ~0 I5 R% M3 R$ F. _to the VxD Control_Dispatch proc (how the hell a shareware soft could try6 C% Q' C  x% D# W0 U. `+ j
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
: A& d3 u1 k7 j; h3 ?: n& j" m* LIf the VxD is loaded, it will always clear eax and the Carry flag to allow
( b$ @! p) Q- M, w' D3 h6 p, t% Uits handle to be opened and then, will be detected.9 U, p- {6 n3 M
You can check that simply by hooking Winice.exe control proc entry point$ }9 ^! |% d6 H% D. _4 e
while running MeltICE.
! n% h% o" R8 u, b9 \/ V* `
1 }  X1 u0 g3 n+ _3 u- p) O
: N+ w3 T) X& L& u- V& h  00401067:  push      00402025    ; \\.\SICE
  E- s4 q% q. _5 `' o  0040106C:  call      CreateFileA" ^" B% j& [2 @: n. o  ^; f1 y* R
  00401071:  cmp       eax,-001
9 Q! p) m0 t. j% G& S& V# }  00401074:  je        00401091# @9 i  P$ w& D6 e- ?! h

  W" Z; g! E4 F9 n& ?$ M7 {3 ?  q. v
There could be hundreds of BPX you could use to detect this trick.0 _; l( ~$ B$ A4 `' g% }5 C& t
-The most classical one is:* P  g& Z7 F- J/ s1 M, F
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' d% `4 l# r$ \$ u2 Z6 Q- ^: I5 ?
    *(esp-&gt;4+4)=='NTIC'% c) F, @: t# k- N( Q
! l$ _5 M4 J7 X
-The most exotic ones (could be very slooooow :-(: @* o7 [! g& D5 |8 B& R( W' A8 P
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 K3 w1 ~+ y3 q, O3 O" U
     ;will break 3 times :-(
- l3 M# |- g/ E: d
, V! `5 C! h6 s-or (a bit) faster: - ^5 k0 l+ k- z. T8 y) m& c# y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) \; n  K$ q8 K; n$ b6 L
* s0 ~! k/ g* ^4 K4 V3 a; U# L8 H
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ K4 b7 _: ~0 Z' _+ j, g) _     ;will break 3 times :-(
* A' u& c: x5 W  m* N8 [
. m: v9 j4 o& T# @/ _) B2 _2 r-Much faster:% e. N; I+ ~0 T
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* d/ w  A% D2 t# S
4 z6 L/ \. Z- Q0 w% INote also that some programs (like AZPR3.00) use de old 16-bit _lopen
) ]3 r! V. ?( M1 V& `function to do the same job:3 Q4 L' k/ H" k% z+ L

* n4 t' I: L3 G- N& }) y; D   push    00                        ; OF_READ8 a, m4 Z, V% ^# ~3 g7 F
   mov     eax,[00656634]            ; '\\.\SICE',0
" Q$ R' D: V, j' H* p   push    eax. D* M2 k# D, Q2 J/ Y. f2 \& Q
   call    KERNEL32!_lopen
' o6 E( H6 R( N/ ]" E  ]   inc     eax* N% J. N& Q0 Q; f; G5 [
   jnz     00650589                  ; detected
8 `3 O& }7 C4 ?9 ~! ^( _   push    00                        ; OF_READ* {! ], ^& f4 F* o7 p
   mov     eax,[00656638]            ; '\\.\SICE'
- |* k! T; t# N  Q   push    eax
* w/ x: _& s- M( ^# @, c6 o   call    KERNEL32!_lopen0 U6 K, ^% {; f7 W3 P
   inc     eax5 q, H" ^5 t8 }" |9 I
   jz      006505ae                  ; not detected; X9 F1 w& c: E7 T, V

% \$ x2 o7 h8 g8 \
0 m" X! }0 j# j. S$ R__________________________________________________________________________9 w0 ]# V% [1 u$ z
% `8 W% \' q' ~3 Y" Q
Method 12* w2 d* J% d  t: A( G1 c
=========
; C% u% g8 t( X
3 Y0 C. @4 {3 Z# P: H, B( ]9 xThis trick is similar to int41h/4fh Debugger installation check (code 05
* W' z( u- Q3 p7 J3 d&amp; 06) but very limited because it's only available for Win95/98 (not NT); q* d8 e$ v4 M0 W1 o9 Q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.7 ~6 \! z0 _+ D) B5 P; a

- [- O8 I' f; v* F" h$ D   push  0000004fh         ; function 4fh
- D. ?) G. `6 ^: i, y   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 m0 c6 q. S# ~; N& P                           ; low word specifies which service7 h' f7 ]9 @! G; K8 {
                             (VWIN32_Int41Dispatch)# |% x) D4 E( v) q) `) B& `
   call  Kernel32!ORD_001  ; VxdCall
6 X4 M* C$ b* C: N! G6 }   cmp   ax, 0f386h        ; magic number returned by system debuggers7 B' U# t' C) G$ d0 K
   jz    SoftICE_detected8 j% c/ g5 s7 g# F

% t' ~) r6 c# `0 V5 [% JHere again, several ways to detect it:
. ~; K* m! ^# E- D+ H6 _7 j9 ^4 e" v1 X! |
    BPINT 41 if ax==4f
- m3 Z0 ~9 j3 x2 b
* N/ M; M$ o4 S' I/ T7 Z& z1 [# Q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 v0 X0 i0 t; k( k. Q3 G5 w

0 ]7 \: N3 N# i- k: W& g    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 ?8 D, ~" W2 i7 l

' G4 C/ u9 _# L, o' m, [+ K$ K    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 |7 I  K9 ?# {5 E2 M

3 S0 {0 f3 E% h% _5 y" x9 Z__________________________________________________________________________
% f. K* T+ P+ Z) `7 W7 y! A1 J; \; q" y( _+ d. S- k
Method 13
* o/ q" p* r0 j+ D4 n=========( [2 V( \& l7 c) ^4 B" s5 w6 M
! _1 O: O+ O9 j/ q- N# l
Not a real method of detection, but a good way to know if SoftICE is5 I7 [& B4 t  L% m% F8 N3 I; H
installed on a computer and to locate its installation directory.- b. d! |; b4 T2 g
It is used by few softs which access the following registry keys (usually #2) :
/ Y4 X: b/ a* _$ k3 f% F' v3 T5 F! P5 S0 v
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 q% J) Z0 A, T8 H- ^* _\Uninstall\SoftICE; D- `1 @) D& K
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% z" z) {' d$ }* V-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( [0 M- Z5 u8 h! C5 q\App Paths\Loader32.Exe
, M$ f4 n: N. O. C% ]" i
: J/ o! ^% J& }. {* N4 z! d2 T
/ J2 o4 c8 ?3 c; }Note that some nasty apps could then erase all files from SoftICE directory4 m# p! {8 ~, H7 v3 P3 m
(I faced that once :-(& C4 J$ N  f' o2 M
; F2 X7 w3 h9 A' Z/ G6 S
Useful breakpoint to detect it:) Z# N$ o/ w0 z. z4 d7 P

8 J) J& j) t+ U     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
7 u  Z% N9 f3 _( d9 t7 B5 x; u) `# B4 D9 r, Y8 }5 \: n
__________________________________________________________________________1 T( j* W# k( E. V- F6 C/ u
7 o) Q; K' L' b/ O

( H6 I' {" B2 y4 Q# ^Method 14
( ?* z* ~; X" M1 x* W=========
9 ]7 l: g' ]# O7 m  f3 b
$ L, ]6 m7 O- L, N  C0 x! y! \8 JA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# R* H$ ]  @8 K1 ?: o3 ?is to determines whether a debugger is running on your system (ring0 only).% W7 ^6 r' \0 J1 @- M: w" S$ ]

+ M) m  I, L) M+ |+ }   VMMCall Test_Debug_Installed8 `$ g) ~) B: B% j* E
   je      not_installed, ~& |# Q) a& J; m6 [8 v$ X

' z3 ]0 x- g8 c7 @This service just checks a flag.7 E4 G3 S% D# \# C& `0 [8 ]
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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