About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' R# H* i( J7 g8 M
<TBODY>
! K5 J: n$ J+ _<TR>% A" i5 _$ Q! T* g+ e6 P+ F  [+ ?
<TD><PRE>Method 01
3 b$ f: O6 N8 \- V* R=========$ @  e6 d! n8 b* ?5 H

% R6 \; y3 l1 b: p) @  N2 VThis method of detection of SoftICE (as well as the following one) is
: }2 R. w5 F' N% l7 W9 N3 bused by the majority of packers/encryptors found on Internet.6 w( `' w, u; ^7 O
It seeks the signature of BoundsChecker in SoftICE
' S& X. v( K1 [# t0 T+ u/ y5 ]% O7 o* B
    mov     ebp, 04243484Bh        ; 'BCHK': u2 s, ]6 l- t2 X3 N- T
    mov     ax, 04h
8 G1 {$ t" p0 n( M# ?/ {    int     3      
4 }1 v% N, r* K* \# B) W' C+ |    cmp     al,4& J, }+ Y+ r& F# s: H( C% B
    jnz     SoftICE_Detected$ h5 }! N7 X7 o/ U; a: P& n
2 `6 L2 G: \$ _* @2 {  o
___________________________________________________________________________
: j. N0 J" J& K' G+ Y4 U0 a8 f3 Q* f+ K8 ~! c$ D$ `
Method 022 o" U" l5 F' q+ z" d& J5 J
=========: g0 A2 }1 O5 M
( e: O- K: X/ N$ k) l! ~, i3 a
Still a method very much used (perhaps the most frequent one).  It is used1 }) `( r6 ~+ N: u
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
& Q* n% S+ q6 A7 v9 x" X8 A2 t( por execute SoftICE commands...# {% }9 o" ^+ N, p" _3 e
It is also used to crash SoftICE and to force it to execute any commands% e/ O- i# w5 @. j) D" e
(HBOOT...) :-((  $ Q0 \# k. w4 L9 s. j4 x

, l1 A* U8 g8 Y: {. g* [+ [! ]1 iHere is a quick description:4 w$ z0 n9 y/ x* m6 s7 u
-AX = 0910h   (Display string in SIce windows)
# j  A/ X0 y" m9 a' o8 H-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; s8 @0 m9 d& M2 c5 f& b8 c) I-AX = 0912h   (Get breakpoint infos)
  G" Z) d' U6 i- A; r, x-AX = 0913h   (Set Sice breakpoints)
. D$ T: M5 s9 c) _" g-AX = 0914h   (Remove SIce breakoints)" W6 z8 n5 j7 s7 `
- n$ w4 e# }$ O% p4 G7 Z$ J* S
Each time you'll meet this trick, you'll see:
; I' l! @9 S8 y, t6 h-SI = 4647h
+ R/ H0 B3 q5 p  X+ J8 e5 F( F, L-DI = 4A4Dh( T3 s3 c7 _( f6 a& w/ }* T
Which are the 'magic values' used by SoftIce.5 e# T" D* w+ `$ y3 M: F
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
2 A  I% Q: q3 W+ s
5 x3 W2 ~2 z  b$ S( WHere is one example from the file "Haspinst.exe" which is the dongle HASP7 K9 Z/ z. d  h* K2 e6 T! O
Envelope utility use to protect DOS applications:
9 w$ X" J* v7 Y- f; k. D$ J# T2 _3 z5 c* C  B( p
# j1 ~& B: O( V, n+ i
4C19:0095   MOV    AX,0911  ; execute command.
/ z% M# R8 J1 G7 o) ]* f4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 F2 [. s  \- F6 l$ h# B5 r; u' h0 H' g4C19:009A   MOV    SI,4647  ; 1st magic value.  ]  |7 x' i& e  x+ h" f, @7 \
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! K$ W" _' J, |0 r& F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ K6 b% ~9 J& W' x4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 E" h' \5 [( J* D8 j
4C19:00A4   INC    CX
3 m& ?5 q- s- E9 ^4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute9 r7 F( Z5 m0 T! L6 V! V& Q
4C19:00A8   JB     0095     ; 6 different commands.! h3 L) u% A$ S( e, D9 [% L0 O
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 c9 A, O+ G2 d
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% W5 v/ q0 R* {/ U1 n( U: @
& E- C% p* _% F/ y( l4 l
The program will execute 6 different SIce commands located at ds:dx, which7 C. c- M- u$ C+ f6 ~
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 y+ Z5 T- c1 r( R- ?+ d# n# l
; Q) E) g3 E5 X' f* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 w2 Q5 m& ]4 j, D& s6 E___________________________________________________________________________
& h* U; C- z: Z6 \6 G/ y5 k% l# O- U, O" x( R5 N! j

: ]" v8 _. A% ~' L, z; JMethod 03
5 p3 F% U4 a/ Q# c1 W0 j# [=========% m& b+ L5 {3 t

4 w/ Y; ?* Q# `% ALess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& ~- S& q( E* |2 b! j(API Get entry point)
/ f' ]7 y$ T' {/ v  q) Y4 M$ x        1 d2 I" y4 M, w7 p5 W2 ?  k
2 U/ D& F3 q9 }1 |0 H8 i8 f( Z
    xor     di,di
' w5 E1 i+ r% ?$ R4 m    mov     es,di
. A* k  Y9 ^* F! B. a3 S% k% P+ {    mov     ax, 1684h      
4 _% R# V# ^9 W) ?    mov     bx, 0202h       ; VxD ID of winice
) }7 @- i' ]- ~0 g    int     2Fh
7 u( G4 [: X. s& W    mov     ax, es          ; ES:DI -&gt; VxD API entry point, ?2 Q& P0 V) ~' S" p) Z
    add     ax, di
. S4 ?5 X. t4 Z8 h# j  F6 o    test    ax,ax
5 y5 f6 i5 p: h9 ]0 Q" P    jnz     SoftICE_Detected9 @+ c, A8 b+ t2 M, v

( X; m5 M, {/ @/ d. r___________________________________________________________________________
# @( N! K/ Y, e- E8 J* S7 a2 p5 K* t! U; @
Method 047 n5 n) q9 k  e2 v& Y. I) a
=========+ I( T; T* i; Y# J$ _; g
/ Y: k5 y- C1 E' ~
Method identical to the preceding one except that it seeks the ID of SoftICE
  v2 S5 {9 o9 ^7 [GFX VxD./ k3 q5 S! J6 x8 V3 O

4 D. b3 d0 v2 [6 ^3 \) F    xor     di,di  a  n# j, }5 t7 h
    mov     es,di
5 Q; {6 N- u, _% J- ~3 k    mov     ax, 1684h       & r% K: L. T5 r! B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) b7 }; b# R# i" h' e# M2 |    int     2fh
, }( `4 }8 a* M4 t    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 ^3 b" X2 {' D1 T/ I! x  [; j    add     ax, di6 ]5 d! _1 E2 c
    test    ax,ax; Q$ Y2 a: o, K) o7 X8 [* h1 u: E- e
    jnz     SoftICE_Detected# M! c1 ^5 f7 u# {% @6 R

) s' d# W& M5 q1 _( X% U__________________________________________________________________________
8 h9 n- |. p1 D
& y! f& O' W5 }  F- f* {6 @
; R. i% \2 w0 l9 MMethod 05; e  I# G4 h7 `# v' U  |
=========
( e- a; R5 ]5 x; v1 S& x+ Z1 N! X$ [
8 R  F8 H, N9 T6 {+ I1 C% W) PMethod seeking the 'magic number' 0F386h returned (in ax) by all system1 E- R! z* x. i
debugger. It calls the int 41h, function 4Fh.+ a0 g1 \7 v# [' G, a$ n/ n) R
There are several alternatives.  - H7 t; S. Y6 W+ Q. s+ J8 w
) l! O; V( q7 f
The following one is the simplest:
9 h% b! H' w" M! J+ @# g3 M/ K, ~5 B* v4 [& d% t9 G0 O
    mov     ax,4fh: c5 i" d6 B- Y6 j! U+ F
    int     41h
- `  }. S( V. h5 d" Q' q. ?+ @    cmp     ax, 0F3862 m5 s" H- y" I! E1 H; l/ g. |
    jz      SoftICE_detected
) n8 \* s% T- B: W0 n8 o: I
4 ]' T, k& G# [8 E! r
. d6 b$ v% X& g# H. nNext method as well as the following one are 2 examples from Stone's
+ ^/ g% y+ ]1 G- H4 s"stn-wid.zip" (www.cracking.net):# s8 n; L* {% B7 J. v

, [5 x$ Q) F" p% o: L" h    mov     bx, cs
; ]/ `: w' D7 m0 \! t. \5 C    lea     dx, int41handler2
, `8 A9 ~1 {; G! r; i. l    xchg    dx, es:[41h*4]6 H- j2 k, M% y% @4 `0 U
    xchg    bx, es:[41h*4+2]
) y# m8 N' y2 P# k    mov     ax,4fh( F" M6 v2 t; s# ?2 t0 r
    int     41h7 i0 n3 N! w* ~7 X
    xchg    dx, es:[41h*4]" E/ Q  e6 P* e% K
    xchg    bx, es:[41h*4+2]( q0 |) E: [5 \6 r% ~
    cmp     ax, 0f386h
; u- ?% R6 i5 ^( i% M, B0 b1 z    jz      SoftICE_detected
: k  h/ y4 L& R; k) y) G$ t: N
0 E: ]8 _' w5 @: pint41handler2 PROC
/ x. n1 G% |4 x5 v  S    iret0 G4 K5 n6 p0 q5 W0 Y
int41handler2 ENDP9 `& t& N+ T2 s) \. H
7 m' U2 k2 t; G1 M6 x, p
2 F8 a7 Z- J2 N, C, Q! f
_________________________________________________________________________; l2 G/ c% I' _/ p: P  V) [2 v
- p$ c- v4 L0 p/ t. C& m6 ~! X

, v, [. `1 @& ]1 z$ U6 OMethod 063 M( [4 Q. }; t/ m
=========
. y% D3 z3 e' G- A8 s, N
2 ?, X6 d8 T) y* e; W! A/ ]+ J! ^. x) D2 Z, q$ Q: u
2nd method similar to the preceding one but more difficult to detect:
/ H# g6 W& `" n8 F9 ]1 K" B- @
; x3 H( H* Y& X9 L, d% Q, H* F
' V, m$ Y0 T; j0 X7 Vint41handler PROC6 ]5 c- r) ?& P! v8 s. I; a, |
    mov     cl,al
8 L6 c5 D% E: D7 I$ P    iret$ T# ~8 J. O7 x1 J9 J
int41handler ENDP# U0 A, J! ^/ v
5 O% k) |, D" {1 V; I% l1 O% E" M

0 I, q- D* u3 ]    xor     ax,ax$ r: r8 O# h* T: K$ K
    mov     es,ax4 c) w1 R' U& I+ a2 F
    mov     bx, cs
% V6 v* G) L; {' n    lea     dx, int41handler) i3 F1 O& S- z+ O
    xchg    dx, es:[41h*4]0 f: R7 U0 e# T1 S4 ~" [3 s
    xchg    bx, es:[41h*4+2]
4 q* ~6 M. K& B  L    in      al, 40h
% ~  d0 Z) i0 S" M9 C# v, J" d+ s    xor     cx,cx$ q( j; x1 _+ d9 ^2 ^
    int     41h
% V, z7 {# k& c    xchg    dx, es:[41h*4]: @4 `/ _) C2 _2 s: @7 @9 T
    xchg    bx, es:[41h*4+2]7 C5 s: [7 \4 R' Z
    cmp     cl,al
: V3 D, L* d& M. @$ C7 g: t2 V    jnz     SoftICE_detected
$ u% A2 w9 g$ O4 `& U+ D& w
7 G1 {3 f; J6 Y3 a) P0 R9 g_________________________________________________________________________  L7 w- v# |* ~8 Z, M# h7 f/ G- E( E

3 \* o' g3 i7 q3 Y/ ]! lMethod 07
' {! D% K: k) Q& E/ B. ^/ Y. p=========" Q; r. B/ ]7 w8 Y
! v0 @# p5 O7 b4 u7 ?( I" e
Method of detection of the WinICE handler in the int68h (V86)- H6 q6 I1 W: d1 e
3 }6 B) G. u/ `, O1 Z. ~
    mov     ah,43h* E! J) V9 {6 j8 v! ?
    int     68h# S7 R/ X" x8 l/ Q3 V
    cmp     ax,0F386h& d  H$ M1 {& H1 m2 W( y, M+ R
    jz      SoftICE_Detected+ c9 ^% I- E! ^! B4 T2 o1 m
8 l" h. @) d2 t$ w

% `; R1 i# ^$ s2 X# \" G  _) s=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; c  n, U* s& I8 S; G4 b2 J5 c2 Z4 f   app like this:
8 @$ j( S) ^( ?5 D
  o4 I: L3 g- i6 s, M* ?$ d5 f   BPX exec_int if ax==68
9 o% P# {) [# y+ G5 E8 F7 o/ z. P   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ P7 l. w/ x6 B0 y   located at [ebp+48h] for 32Bit apps)4 D4 x* n0 L; t9 K8 U
__________________________________________________________________________
# V) x& Q. z! {: I0 I  f5 d4 |" Z. J1 M: ]& V% B
$ f! e% N) l- G% J- U( }
Method 08. A4 \, H* j* e3 k$ |
=========
2 Q& e; W6 G7 y2 }: Z
' ]$ P1 \* C$ x/ N! Y: QIt is not a method of detection of SoftICE but a possibility to crash the
% w: b! j$ g  U, Q( b% Zsystem by intercepting int 01h and int 03h and redirecting them to another
6 a/ h3 l# I: N* @) P7 V: Lroutine.6 Z2 L; [, C! y  p/ R' Z0 @
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ J  Q0 T' x* F& m8 S' O' ~
to the new routine to execute (hangs computer...)8 A3 c" D) {2 s& P7 }# ?
; ~4 s4 T0 Y1 ?1 z5 {! M" F5 l% C( |
    mov     ah, 25h8 v: A/ n/ x# r4 T% p9 S0 u7 C( Q
    mov     al, Int_Number (01h or 03h)
: I- L2 i) c/ R    mov     dx, offset New_Int_Routine
2 M. t- t: X5 @# v5 V    int     21h
! _& i' M, H1 e7 S6 a" L! u% ]# z' e1 t" I8 m2 r* ]/ P: ?! C- J
__________________________________________________________________________
2 b4 J" P. @, e) J+ e5 r1 M9 @; D& P1 I( B2 n
Method 09; T' i( \8 r" X/ R  G
=========0 B  o4 J* ^2 D! z1 t/ Z
/ k% J) z  ~) P+ ~; ?
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& s/ n! G4 P. o& {) H5 v; n! z+ Y8 Kperformed in ring0 (VxD or a ring3 app using the VxdCall).
. M' Z, H$ D) i# G) F5 A5 X9 I; F3 hThe Get_DDB service is used to determine whether or not a VxD is installed
/ p: [2 G. l- N+ P" j+ ~/ qfor the specified device and returns a Device Description Block (in ecx) for
/ w9 {$ l- \3 X3 A$ Y5 |that device if it is installed.
! g. Q) m2 q' `/ j
  w$ u' ]' A6 g# K4 I7 @   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  y) B: L2 c! d' ?1 V. t8 O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! _) }' F* Y0 c   VMMCall Get_DDB) O( Z/ P, w( m+ p- g0 H$ X$ h
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
0 r! Z: O3 G! u7 {& _+ ^% t2 A3 ]4 Y/ \" @7 ~" t( [1 r) y
Note as well that you can easily detect this method with SoftICE:
# D9 u3 Y9 J8 N" h5 S( N   bpx Get_DDB if ax==0202 || ax==7a5fh# |7 C0 f. }/ b+ e5 I1 p* l
4 }6 `# |$ T; _$ ~! M! A
__________________________________________________________________________% H3 }; D2 u5 U: q! d; R
- S3 v1 Q, u; t. t7 J  N* y7 K
Method 10/ W/ b) o4 t0 J& e# W7 @7 ?6 s
=========4 l0 f: L; k6 B. s+ m2 j( U
( H% H- M% d* i9 I; U
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with( a: z  N, |: `5 Y* d1 w
  SoftICE while the option is enable!!) k- K' ^5 @' u# O0 X( j8 }

( v3 l4 ]) r+ J7 g0 P6 JThis trick is very efficient:
. E, u  b1 l$ p2 Xby checking the Debug Registers, you can detect if SoftICE is loaded; H! |6 K! Z* K. c% P
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ y" I& t1 F; _9 @# J3 R
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( s, H) a  p( H1 ]/ d% evalue (in ring0 only). Values can be manipulated and or changed as well4 {# y6 k: Y2 k% l% n
(clearing BPMs for instance)
+ g7 |- L1 [& R
9 |5 F! e1 Y" [7 v( k# @+ |__________________________________________________________________________
) ^! T: T, O0 p3 V) U
1 u* }8 m' T) S7 ?, L, \7 `Method 11! A5 m/ O  @! p
=========
$ [) _- U/ ~4 Z9 R' ^! A
& l3 q; B$ ?9 `This method is most known as 'MeltICE' because it has been freely distributed3 a+ g3 t& K) ^4 n# J
via www.winfiles.com. However it was first used by NuMega people to allow
# }. A& I1 {7 |: F3 d2 \9 b1 \4 }Symbol Loader to check if SoftICE was active or not (the code is located
/ p! [0 I5 s) L2 binside nmtrans.dll)./ T1 x' v  ]6 B4 R& \
4 b! ]+ [0 C9 g- @6 v
The way it works is very simple:7 o* i0 q6 P- S! ?/ A, @& d0 k& v$ U
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
+ {% I/ @  {/ ]9 e' R6 h, `WinNT) with the CreateFileA API.
3 ]2 q3 h( R8 h& I7 L( x" d# Q2 u# j2 x$ W- u! z
Here is a sample (checking for 'SICE'):% M. b, c% w4 O" {

! G4 V8 j; t+ Z+ T* Z) TBOOL IsSoftIce95Loaded()
; j- f9 n+ H9 k2 M{
9 ~/ a0 f  w' x   HANDLE hFile;  + E/ I$ W0 C- C. C5 g7 L% q
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 a# y/ q5 Z( G" y' I
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) E& w- M; ], C, Y' |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) o  V' i- F. r- T9 u   if( hFile != INVALID_HANDLE_VALUE )" O7 i0 H% d  O! U* K4 m* ~0 V, V2 G
   {
0 f1 C: |: }  ^8 L+ k      CloseHandle(hFile);
9 k1 C) ~: v! x& |      return TRUE;9 S" {" S9 @# v$ N1 h
   }
# d0 }) _5 E) O% {   return FALSE;  l9 L0 V3 F: c- j# X! t# F
}
* {$ U! t/ M& Q7 c, X' {/ G/ n1 k; o" @6 a0 @" B1 x3 E: ?: k. M3 b7 [
Although this trick calls the CreateFileA function, don't even expect to be, Q$ }, G% O& E+ Y4 t
able to intercept it by installing a IFS hook: it will not work, no way!! H4 {3 t9 y8 A/ ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F% W2 z0 `4 [- a. S
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 a# l5 |/ ~/ M% `6 H1 C7 V" ~! Pand then browse the DDB list until it find the VxD and its DDB_Control_Proc
: g4 `6 k4 t4 Z. k# hfield.$ z; W9 s8 V4 ?2 N$ I$ z) v( B
In fact, its purpose is not to load/unload VxDs but only to send a
8 B' J7 _5 ?- w: D0 b. u2 e3 t$ @W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), a5 {- u1 @+ a( V9 k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' O% x) d0 E9 ?5 L: r* _* e; p. B
to load/unload a non-dynamically loadable driver such as SoftICE ;-).; L; s8 x9 @/ g- `+ A9 m
If the VxD is loaded, it will always clear eax and the Carry flag to allow
1 S" ]0 @+ M; L/ n( @0 eits handle to be opened and then, will be detected.
- g/ c0 n0 X4 n* L( q1 y1 lYou can check that simply by hooking Winice.exe control proc entry point; O# I1 g& ]( H( {
while running MeltICE.: t$ K9 o# Y9 [0 H) I
* b  J" R" E0 e, i

3 w5 |5 }) c3 E  00401067:  push      00402025    ; \\.\SICE1 |1 [6 s" d6 ?
  0040106C:  call      CreateFileA" _: m* ?% f7 j  |
  00401071:  cmp       eax,-001# ?- ?( G" c- f4 I4 O! P' }/ r
  00401074:  je        00401091& a4 S9 M$ Z: K
* f  m5 i. y% i( [8 n0 v
1 H# D' n  ~' c
There could be hundreds of BPX you could use to detect this trick.
9 Y5 T0 N, R4 g" [% \-The most classical one is:' q. p. B' [' T+ [7 V
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ s! n( K- A9 M    *(esp-&gt;4+4)=='NTIC'4 O4 ^) D* M) b  b* N( O
' b/ y$ S# u. K6 I* P
-The most exotic ones (could be very slooooow :-(
9 Y2 Y/ `! x$ s8 Q4 @   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
$ B4 \* E2 q9 r$ I% \: R% H; A     ;will break 3 times :-(
3 [* A- n3 z  m( a3 S0 K6 m, n2 d( }9 W+ e( ^/ p3 a
-or (a bit) faster:
9 A0 I4 o" U; R# w6 ^" \" z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'); c3 S& T- M4 v1 p/ `

1 k+ ?2 @4 l. K3 _   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 [0 d% B5 a3 J% n7 T3 Z  N& d9 s
     ;will break 3 times :-(
6 \# {+ [  q+ o7 V
3 t) @% W+ h! N-Much faster:% f) Y2 F) s6 d0 s1 e0 z2 l
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# N# z1 C1 s, e) n9 q
0 p9 f, H3 _; c0 S4 E
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen: y# Z1 y3 A, ]" x! e2 e: I0 d% H
function to do the same job:+ V/ |% n% ?  Y+ P7 ]: @! p' T
& O! o7 g, C- `' ]+ `
   push    00                        ; OF_READ8 g" R& w# _* {4 E
   mov     eax,[00656634]            ; '\\.\SICE',0
; P* ~1 Q; L+ W, Q   push    eax
& N( y0 M6 h% \  K! y   call    KERNEL32!_lopen) R9 C) Q# `7 s/ u
   inc     eax% S; H9 b6 M6 J9 A6 C# Z; o
   jnz     00650589                  ; detected
5 L" f. f$ x9 s% M( _1 W  `   push    00                        ; OF_READ
/ F# ]3 L- F0 X& a   mov     eax,[00656638]            ; '\\.\SICE'. y2 ]% g* j1 |5 @7 d9 o3 H
   push    eax
  }; T! P% |' p8 q$ E! G   call    KERNEL32!_lopen
4 I8 w' p2 ]; J   inc     eax
# G6 ^( F( c0 Y   jz      006505ae                  ; not detected
" N9 e1 U4 \. j- z) a$ K3 z2 a6 i4 F, J
; }/ H+ U8 y2 d  O: {) v9 c
__________________________________________________________________________
8 j/ y% {* R' S9 [5 y# ?! k2 |6 b; y0 C6 V
Method 125 K) s0 R6 H" O8 C; x5 D1 R
=========
+ W0 |" E( \! ?5 F8 {/ `- y* {, v. r! E; [
This trick is similar to int41h/4fh Debugger installation check (code 05, L* ?  U" G3 ^! H( [: y- d
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
6 _4 w! F: r4 O1 D$ n% oas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: K! M( _+ Y1 ~% I% N7 H, p$ `
# f1 z( x- r% R0 a   push  0000004fh         ; function 4fh
* ^4 C" H; T4 U   push  002a002ah         ; high word specifies which VxD (VWIN32)( w& @0 H+ ^8 a! q4 ~/ j" |
                           ; low word specifies which service
- [- Z' \! I" T& J" T' H+ Z$ m5 ^                             (VWIN32_Int41Dispatch)
* n! a* K6 B. p. c2 [; ^   call  Kernel32!ORD_001  ; VxdCall+ W. \1 @9 D- s& o5 z. F
   cmp   ax, 0f386h        ; magic number returned by system debuggers
# R' A0 U4 N& z# b, d   jz    SoftICE_detected
+ L7 y, Y* @( h/ L, ?9 a' G. g' ]* W% S( a
Here again, several ways to detect it:
& |  P7 V; q7 Y& [0 t; s3 X/ B
7 p8 b* p6 y7 M- `    BPINT 41 if ax==4f# v6 ?  Y. w1 G% U- z, ^8 S

" f5 J; \' U; I0 b3 D8 }    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one# p% O3 R. y# M2 }% a
: v1 p6 s% |/ `+ n
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; e8 k7 ?( ~4 m' T! r

9 A2 {% e# c- S    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# P2 T) T; Q: s+ h; E3 L
. ?9 Q, j- _! W* `1 I__________________________________________________________________________2 z' x" h3 E" _! K* ?' W8 M

) B/ ]; o6 {) N# e* m4 h; |Method 13
9 `  ^& _! `2 A=========( g6 v+ H  \" n( ?
( }% l2 Q9 }. t# p7 ^! ]
Not a real method of detection, but a good way to know if SoftICE is
' U, G, q! G, ~# G% c# V8 d3 Oinstalled on a computer and to locate its installation directory.
3 j5 X' l0 N! T0 h4 E2 aIt is used by few softs which access the following registry keys (usually #2) :7 ^* r; R6 `2 S& r; \4 O

2 e# S' u; s6 C-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 x* u; D: S) V+ R1 H! j6 ^. A
\Uninstall\SoftICE& E9 z$ s: T& Y7 i1 ~
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% J6 o; @7 n2 [" ~+ w9 i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. V5 O8 D( z$ k( R" Z! o\App Paths\Loader32.Exe
+ e4 w3 ~3 x; ?: x( _  Q- X& |* u. L: p# C9 I

4 r2 D& f# r4 I( {+ y" d. j# sNote that some nasty apps could then erase all files from SoftICE directory) a" k/ u# U9 e* c: C8 n
(I faced that once :-(# ~9 \! P! [) J) u- z, Q

" R( e6 K/ J8 r: t. NUseful breakpoint to detect it:( t8 @; v( i" s. p- l4 z
; r/ K& @* A+ V6 L% O# t- u1 V" ^
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! Z8 N& F% r/ K: w* c9 z! O2 C1 d8 R
__________________________________________________________________________5 h* S2 i& U" C, P

# Y3 Y* B8 i( S9 z0 `: ?* C4 f
' z$ `# Z5 Q9 ~$ Q4 iMethod 14
" ~1 W6 O3 o6 o- l/ w2 a" e8 K6 o=========
6 P0 s1 Y( z# i6 W* i: o
+ u/ M3 u  h& L+ zA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 |! k! Y8 P9 G! i7 @9 vis to determines whether a debugger is running on your system (ring0 only).* O/ B7 R- b  c$ @' [% c/ E- b: q2 B& K
/ z: W, v1 c$ t
   VMMCall Test_Debug_Installed: ]/ |6 U5 C1 _5 }8 ?9 c; }
   je      not_installed  w  ?3 H0 P' m" A& `8 f
0 _5 b6 X! Y: b8 d- U% k% Q+ t) i
This service just checks a flag.
! }$ B' }2 x! \# `; N  K4 @! f</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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