About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# v* V. W* r  R" I& Y4 I<TBODY>+ t/ [" o& m  P; Q* N/ H
<TR>
3 d6 [$ O" u0 O<TD><PRE>Method 01
3 `% l% r* o$ K$ b! x# E6 Z& F=========9 d4 r; E- g3 }* z8 J  e0 |
+ }* s  |9 g5 R( h2 n0 b* F' r- Q4 `
This method of detection of SoftICE (as well as the following one) is
8 U2 |' i2 A: p; hused by the majority of packers/encryptors found on Internet.
- A% F# L  p0 X& \It seeks the signature of BoundsChecker in SoftICE
- s; l* o" e& [& {- ?+ ?* J) A7 w$ g; c& t5 K; h
    mov     ebp, 04243484Bh        ; 'BCHK'
6 N+ l  L: O( l% J" D. C$ ~( `2 w    mov     ax, 04h2 j0 K9 z$ B7 Q1 z) P/ f
    int     3      
( v% W; j4 d2 `- f0 ?% m    cmp     al,4$ F( F$ Y, k* ?+ f
    jnz     SoftICE_Detected
0 p7 Q: n3 i+ }
) F& d1 r2 S/ @5 Z___________________________________________________________________________
0 q* G3 {' e( f6 y) S4 z
' i) p, |4 Y" k# Y3 JMethod 02
) ?! G+ C; X4 z% G4 n% A=========
, x; M0 ?9 Z/ m6 _( [( j9 O* H  {) |, P  Z6 \
Still a method very much used (perhaps the most frequent one).  It is used/ t, f' M# a' s' C
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
. f$ t6 `) S* k5 M5 Z5 bor execute SoftICE commands...
, O/ J9 K$ t+ z1 h- OIt is also used to crash SoftICE and to force it to execute any commands
- t8 `! b& z2 F9 q(HBOOT...) :-((  . v) n0 V- n' a4 M# o: X$ ]* A

6 y$ Z$ `3 M( h- k7 h' OHere is a quick description:
# S1 I* |/ S3 J3 Z4 N% D8 W) L0 \-AX = 0910h   (Display string in SIce windows)
- h8 _/ ]! Z+ y/ g-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ B7 t& O+ l7 S8 i( C( y" V-AX = 0912h   (Get breakpoint infos)+ C8 L9 c. H# X/ M
-AX = 0913h   (Set Sice breakpoints)
5 n: m3 T" O$ G! e-AX = 0914h   (Remove SIce breakoints)
! m. E2 J; L' u$ C
* m% O( e4 Y. ]/ }9 s+ R, `Each time you'll meet this trick, you'll see:
  K1 A( @; z% c2 s7 j7 _-SI = 4647h& M6 v5 @$ I! v% X. D0 P) T- [
-DI = 4A4Dh' X: J2 |& X; E- X
Which are the 'magic values' used by SoftIce.$ |+ ]0 Z% _2 F0 r4 p9 d$ f" J( h
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ {0 \6 f0 ]1 Q; B/ e4 ~- u
7 x, A# }5 q0 }, Q, RHere is one example from the file "Haspinst.exe" which is the dongle HASP/ T* W3 _& s: Z; D5 M
Envelope utility use to protect DOS applications:
9 `* F3 T& U  K3 y- P# B  G0 p2 ]

: G. z6 Y0 c, k4 H. I4C19:0095   MOV    AX,0911  ; execute command.
+ S2 }4 P' q9 |& k- E8 j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# ?; s9 y+ m% w9 U4 V
4C19:009A   MOV    SI,4647  ; 1st magic value.
0 v0 |) ^7 m  V4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( }$ n" t4 [- s, Q8 k6 \) O, X4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" l+ {# g/ r; w5 x; L, }+ F+ L4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute5 q6 s( O' d' B$ |* h; z
4C19:00A4   INC    CX: T; g" i0 r( A& c* R2 v" P
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# U0 Y& a0 F0 i
4C19:00A8   JB     0095     ; 6 different commands.5 L8 l. a5 ]4 J( O; Q, g
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 w5 ~$ ?- j& B' a* T: \
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% ~' W4 S- D! @# w9 @5 G' O9 C# ~4 i$ h
The program will execute 6 different SIce commands located at ds:dx, which$ v0 y6 C, ]0 ^! g- Y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! u- y! a& W! h/ L5 |) ]! u( _4 b
- S6 S- v; E/ H6 F7 P
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ I2 }4 D* c" R) n1 H___________________________________________________________________________
7 `# F! g9 E& A, h9 A6 Q
: \1 W/ e# v; e2 A, n8 a1 f
3 M/ |  k% O1 j% K6 z$ `* ]5 qMethod 032 H& z" m; Q2 w' U' @6 a; `& F* l4 G7 @7 U
=========
4 r7 n$ f: Z) g
& v8 S) v( T  C# J* T  O% ]" LLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
. N- ?% E0 }& [9 p; ~(API Get entry point)- n7 X) M3 |) g5 N
        & w! _* ?5 s) c+ A3 D

9 z; \! S+ x2 m9 a    xor     di,di
: S, ?. R& Y8 e/ T1 r, A; Z! f    mov     es,di
" ?1 ]0 m5 i& l    mov     ax, 1684h       / F" r* z- {4 T
    mov     bx, 0202h       ; VxD ID of winice. V3 r+ U7 r& f) D7 l3 [2 F
    int     2Fh
1 S# i- t$ _# f3 A. x, Q+ K) p    mov     ax, es          ; ES:DI -&gt; VxD API entry point, P. E9 h. p5 L) `# b9 y
    add     ax, di1 i2 ~8 p6 n0 r: P  B4 K8 H
    test    ax,ax4 m5 L1 H4 P* l( G1 u$ {
    jnz     SoftICE_Detected/ O" ^7 L7 w( R$ J  W  q; C# C

/ z8 `1 |. }& _3 g8 l: C, h: i( ^___________________________________________________________________________
: R, w" ~! p4 j& K4 |  A
0 b! f- K5 y7 F) p( c. t4 ZMethod 04
+ X  J) `. {  e1 {1 t=========# |" s. H1 t# m$ P1 a  Q
) Z" R" m! P. H; d+ W8 ?; L
Method identical to the preceding one except that it seeks the ID of SoftICE1 X/ c! V& R" o0 @3 ~
GFX VxD.
4 m* {& a! [5 j* o" \# ]& c
  ?% w- E1 _8 @- v; h' K    xor     di,di
. @  C' i, S% ]( W: g    mov     es,di
  c9 g  H5 J9 T    mov     ax, 1684h       ; ]3 B  O9 l; e( Q
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( h, q2 B; g$ K$ x  y5 b: h4 n% l* Z    int     2fh/ V$ j' x! K" @" \$ R/ |) V
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' ?2 J! K/ I5 E9 ^9 A, W5 H& G3 K
    add     ax, di
! N' q, I9 |+ c& S$ i' d    test    ax,ax
6 m$ v( b3 m+ v+ ]8 m    jnz     SoftICE_Detected; ]& {" u% X7 y
4 W1 f2 ^' A1 a" P+ A  `
__________________________________________________________________________
/ L& D6 I% [0 i$ W! K5 @
5 x' j% ^, d5 F. H1 _7 `/ i7 X" u' {0 [- J# l/ ?
Method 05
) @; ]# Q4 V: S=========
3 ]; `4 S% r! T$ z. t# V+ C+ b* i$ y8 w9 D6 q9 Y7 e' [
Method seeking the 'magic number' 0F386h returned (in ax) by all system1 P$ }  h6 Z7 F1 A
debugger. It calls the int 41h, function 4Fh.0 }( o5 p+ I8 V, ~
There are several alternatives.  
& D6 D' e9 Q5 m* |
; H* C- A( N  @& WThe following one is the simplest:
, Z, _6 c2 g8 {9 Z: M7 Y: r( ]+ N/ c1 w! \# E
    mov     ax,4fh
+ p* d! q7 E) x    int     41h& x0 M4 B/ {2 R# L  \9 i
    cmp     ax, 0F386
; a6 Q$ R! H6 R9 M; G7 T9 b- t* ?    jz      SoftICE_detected
) ]. `+ d4 n/ ]* A9 ~3 S- r- x3 Z& M7 D# w

. ^' l5 i0 Z3 @- b) C+ |Next method as well as the following one are 2 examples from Stone's
. k8 ]5 j% E+ }6 ~6 T- \"stn-wid.zip" (www.cracking.net):! O. ?6 ?. n% |% R
# x/ g7 @5 b, ~& {1 X  I
    mov     bx, cs
, P- a  f6 c% J5 Z  ^    lea     dx, int41handler20 P% R2 S. I7 ~7 D3 V$ ?
    xchg    dx, es:[41h*4]
! J, ]9 e6 i, z; B    xchg    bx, es:[41h*4+2]
+ k) k4 B8 G9 t# u6 r" L    mov     ax,4fh' u( ]; p' a  u' _( Z; S, Y" p
    int     41h( R5 T0 x0 A; ?% w/ K, E- C) w
    xchg    dx, es:[41h*4]9 K: a, j  N! i9 ^& t
    xchg    bx, es:[41h*4+2]! a9 s  _0 O. `% _( X
    cmp     ax, 0f386h
. o' W! g# o- Q7 t( \& `) h; U    jz      SoftICE_detected/ \2 y- c  Z* Z" ~" P6 J( _3 z
1 |1 y8 N3 Q* R. Q, O1 [; j4 R* Y
int41handler2 PROC$ y' w% _6 u8 ]. f
    iret  n8 a1 }7 y' n% f$ V( J/ |
int41handler2 ENDP  C6 g' h0 a( I* f6 X  N0 B
' v0 `) E, e9 S% c. q

( M" d8 c, ]/ K8 ^# J& N_________________________________________________________________________8 e8 L9 H1 O4 W! J4 o* p  b

$ G3 ~; Q: c& _, y/ D! o, Q3 S3 r( J7 X. h8 c3 Y( H
Method 06: z& L  {& ?0 v  F6 c
=========
- d" c3 A0 k3 B! x1 F. l8 ?& O
7 x9 \4 v; g% ~5 Z7 u" \
- g; J7 t! M- Z  R! r4 l2nd method similar to the preceding one but more difficult to detect:
, f- |# U) e4 l2 D; |
' h& }; e$ m$ n' l+ ^' W% T
, b2 S' j: f6 r1 e0 M/ t- fint41handler PROC! L+ t  g; @7 j' I' y. D8 W* Z
    mov     cl,al- \+ s0 ~, T) r9 M9 b
    iret
; V' G9 [9 e# A7 w  Tint41handler ENDP' g" M$ I" N6 ?; m, [4 k. t5 G

9 ]8 R* o$ P8 ~# p% {0 I
& \- P; Z5 k: x6 D2 N    xor     ax,ax
& d! o6 w2 c, O- I+ B$ A' c+ `7 S. F    mov     es,ax7 u/ A- o: S  ~  X+ i
    mov     bx, cs
  p: H# g9 x1 V    lea     dx, int41handler/ I) E6 V: D0 ?! D8 |: z% [" ]5 T6 u5 n
    xchg    dx, es:[41h*4]
2 Q* q" V: ^- Y8 q    xchg    bx, es:[41h*4+2]* e* ]2 E; Z5 }/ E3 f
    in      al, 40h$ V' a: T# T2 q# g: N2 i
    xor     cx,cx4 h( @% ?( c/ M$ E5 Q6 J3 o
    int     41h
# B1 @/ ^# n4 Y# r' M5 ?9 F    xchg    dx, es:[41h*4]1 `5 Z4 R+ E$ [& I- i, w
    xchg    bx, es:[41h*4+2]
& M& D0 U6 L6 V) I    cmp     cl,al" F) e' [4 g! c7 J, r- S8 S
    jnz     SoftICE_detected
1 c" C2 G" K5 B2 g6 J8 Q; C: w/ ^, H' ~+ H: s
_________________________________________________________________________5 b7 f5 o( n; H" l6 s, _% y8 Q$ l5 q

7 e% J/ P* x' b1 E9 k# YMethod 074 g, c4 L% d/ `5 z3 i' J8 A
=========
; G. Q* [8 }) T4 n% {5 V4 Q/ Q) X
- D* C: I/ L" a; hMethod of detection of the WinICE handler in the int68h (V86)5 ^* s) T: v2 x% Q6 e" I/ W
& o( D( S$ f  Q. a. ]
    mov     ah,43h( ^7 T; p5 l# {. J9 Q3 I
    int     68h9 B, _# L* k- e0 s
    cmp     ax,0F386h; a1 Z8 u7 T& W+ K6 y6 e
    jz      SoftICE_Detected
7 F% g5 O; m% Z% X" F! L
) z4 n2 b- D8 ]6 P+ S. V& t; f6 @
1 |. d" Q6 @1 k8 y! I" f+ V8 T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 H: I8 `. y$ U! b6 D9 c   app like this:
$ w& C% K; q7 H8 j
: I9 M. B3 N& u: y/ h: ~& X( F( q+ n   BPX exec_int if ax==68
% s( W/ a& X6 h2 d: Z   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 a7 f8 v! V/ Q# v- L! v1 |8 D- O6 F) a   located at [ebp+48h] for 32Bit apps)
$ y9 o0 r, f( u% L) x__________________________________________________________________________
2 C1 }' J# [7 j% z( K# H9 i0 t3 Z0 M; L6 B* @4 n

7 a. y7 X, g+ y' BMethod 08
/ Q$ J4 s+ ?- |& e5 u=========
8 a2 D3 \: N& I+ M0 e- R2 N2 ?
% o5 l1 i  a$ H# c% B7 A. ~$ UIt is not a method of detection of SoftICE but a possibility to crash the  k" g1 T' y) T5 E5 ?/ x
system by intercepting int 01h and int 03h and redirecting them to another
* n6 M8 p( ~4 C' }routine.3 \0 Y3 q/ ]3 \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 |! g( C, n% H9 X. M% M2 Ito the new routine to execute (hangs computer...)
7 i& o7 N; W. f# i# c/ _
" L, b2 l; i( Q$ ]2 k$ w    mov     ah, 25h
% u3 ]6 {0 T1 ?) Y7 j    mov     al, Int_Number (01h or 03h)
: Y0 [5 V' h& l! ]1 `$ g, P    mov     dx, offset New_Int_Routine
4 t9 \2 b. r' z# X    int     21h1 t2 d% q1 m6 T* }
5 G* Q, }8 c0 O+ u$ J  p
__________________________________________________________________________
2 N: p  P4 X2 X% z( R7 ^. |* a# e9 ~4 v) w
Method 09' d& g$ V" j' ^) ]$ B2 h3 H
=========
# p. ^( o  d9 Q- L, R1 b. v! N7 i: J, @4 @  y' v
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; ?& e. D! C; [! w' `7 ]; C4 kperformed in ring0 (VxD or a ring3 app using the VxdCall).; U2 k3 }2 Q% F( T! s) ?
The Get_DDB service is used to determine whether or not a VxD is installed
" y4 [: _7 u  t7 z& u7 f; [% B+ Ufor the specified device and returns a Device Description Block (in ecx) for0 |" j* D) [) g- v$ Q# a! f) D
that device if it is installed.+ ?/ p' k* M! B( t) F! {, w' f
; y( a$ g1 N+ ]( ~4 j& ~/ r  s
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. P  a' Q  u; ?! P5 s( F8 Y# F$ g
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- N/ ^9 J; M6 O
   VMMCall Get_DDB
) B2 W' x, r& k, r/ `+ d: i   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed) p5 r1 g: c% u; X7 R# B

5 t, ?  I( [9 o6 GNote as well that you can easily detect this method with SoftICE:$ Z7 y  c- g2 m% I
   bpx Get_DDB if ax==0202 || ax==7a5fh- b. a: J$ }# V
1 ]* F# a" p8 y( U2 B1 p! t4 a, F
__________________________________________________________________________
% M0 ^( V; O) c. x( J* x! C0 D
" ?7 x, l  x7 s2 o% Q' IMethod 10" C5 ?' f- X% Q9 j* ?8 f
=========. L0 N: `/ O% k, w

* n, h- {$ r5 n/ j9 |=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with8 Z  C) b0 ~) n6 J+ q6 R
  SoftICE while the option is enable!!! ]3 _: j6 W$ e" z1 Y
$ ^' M% ^, X/ z$ B, b
This trick is very efficient:
2 y# o9 u( V. \* L5 D/ aby checking the Debug Registers, you can detect if SoftICE is loaded
' X( O% T1 F! r  ], @; R(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' t& S) g7 |6 sthere are some memory breakpoints set (dr0 to dr3) simply by reading their
$ x- v7 _+ A. @3 K5 z, A! |value (in ring0 only). Values can be manipulated and or changed as well
* h1 u0 }$ l) b; T( Z: O(clearing BPMs for instance)
  e9 ]2 Q- A4 w; G7 J4 \
) C1 O: z! L; g  A( ]& M+ E__________________________________________________________________________
$ A2 X* ~6 X* W" {# F; \
  @0 D9 Q: s( Z# mMethod 115 e. i; ?9 W& ]( e9 ]
=========
* Q0 D4 v/ W& K) ~4 j- o
: j8 b0 h" t/ ~This method is most known as 'MeltICE' because it has been freely distributed  Q1 m# {1 I2 M/ F
via www.winfiles.com. However it was first used by NuMega people to allow& c/ C- _, |. ]7 l0 n
Symbol Loader to check if SoftICE was active or not (the code is located% G3 g9 s5 l2 T( d/ [/ E" V
inside nmtrans.dll).
  N4 S. C+ `8 B1 s) v: X2 b+ _4 F4 l. [! q
The way it works is very simple:
" u, [6 d$ b) kIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for0 y5 l0 G1 C0 H
WinNT) with the CreateFileA API.
% h- O, p0 {* X, x6 \2 ?
. i7 Y& F3 d  E& c/ U3 RHere is a sample (checking for 'SICE'):
3 j/ z+ A5 V8 t& u# ~. Q7 c1 |# s, P. C8 P  p( v
BOOL IsSoftIce95Loaded()4 l( q$ {0 o" g9 W
{7 e& e8 d8 U" J! @7 c3 n& ]
   HANDLE hFile;  , a' E: y" e' V" r9 L2 u' h
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) p) e& z8 U7 Y' [& j" o1 Z8 Z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
$ }: R% n9 A5 p$ _9 O) D+ s                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 f7 R. g2 l6 H& E9 o3 ^7 w# m7 \# ]   if( hFile != INVALID_HANDLE_VALUE )9 v  {( N6 ~( \9 e7 X' \
   {# U! Z6 i, [+ y% I
      CloseHandle(hFile);
: T& p# m0 g4 T% M1 _      return TRUE;8 V, u- F" f" C, h. I2 y3 Q
   }
8 K+ m9 f; Z; k   return FALSE;
3 l+ i0 V  D: |) n! ^}
" c) |( F. c0 S: o. n+ k; @/ d* o
Although this trick calls the CreateFileA function, don't even expect to be
, v/ ^1 A: T# b' B9 I, Zable to intercept it by installing a IFS hook: it will not work, no way!
; G, H8 b+ ~, U4 J. QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F" S( n( x3 _5 n
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)! X% ^0 G" F4 u- t6 U+ U- R
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 ~; J% T- y& V: H' q3 T% S
field.
0 x* L" G# j2 R$ {5 Q( ?6 ~% YIn fact, its purpose is not to load/unload VxDs but only to send a 4 O% K; N* M8 v8 d0 }
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 p- e+ v5 k( a" O1 {
to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ w0 |. x. D2 G3 j2 |1 {( \5 L+ k, L
to load/unload a non-dynamically loadable driver such as SoftICE ;-)./ `$ x2 T- y3 F3 O' a  T+ |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
  O' h9 e; k9 I* x  t/ Oits handle to be opened and then, will be detected.
* K3 o0 H- ~. h; |8 AYou can check that simply by hooking Winice.exe control proc entry point5 t1 y& U: X+ b
while running MeltICE.
3 C+ q" Z- D) B% s
* @5 P+ h% M' {( n8 [: u6 s3 v0 {$ O3 J* i2 ?6 u5 r) y. |# `' ]) P
  00401067:  push      00402025    ; \\.\SICE
! P0 ]7 S, Y- w  0040106C:  call      CreateFileA
# K$ W6 w  [  S+ n; u5 F  00401071:  cmp       eax,-001
3 H( H: B* c8 y! W+ d  00401074:  je        00401091$ Y( p2 C. D9 u
; x" J/ `) @- o% A2 e
5 M. F% D0 g) U0 ^. C8 H6 }3 r
There could be hundreds of BPX you could use to detect this trick.0 w7 y2 F- z( X; o0 [' y7 }
-The most classical one is:+ U5 }2 ^5 \( D* ~0 t$ G
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ X9 D7 c# J' ~8 d7 P    *(esp-&gt;4+4)=='NTIC'' z/ Y* z; ~+ I
$ p' P8 f8 }9 W$ N& S* B2 F
-The most exotic ones (could be very slooooow :-(
4 A* k+ }! b% {& L   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , f( j2 m; ^/ V- f0 i8 _' _
     ;will break 3 times :-(" U- p+ _& T7 U1 l, N0 Y
8 k- n# j) o! ?) I6 C3 p8 c9 X
-or (a bit) faster:
. x1 `, j, J% x4 n   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'); |$ n4 x$ u% O7 D: T, p  J

4 Z/ `4 S0 x+ l& |   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 p2 x8 Y- j) P     ;will break 3 times :-($ d2 Z' ^6 p; _$ c: E/ c/ c; J

2 k* F0 _  I3 n! N, C3 ~-Much faster:
4 ~6 _( A- k5 o   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 k4 W" {/ K6 Y; H# y" h; _+ M9 S, ~9 }" N, g, F
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
' a. I! C# X7 V# h9 C. ofunction to do the same job:
8 j0 @9 e, Y9 c9 _1 j" m( L- X2 ^+ w0 g1 K# x( c8 m
   push    00                        ; OF_READ
- t( r0 x/ f' r( B) d& w, ^   mov     eax,[00656634]            ; '\\.\SICE',06 X  C  U$ S/ I  H( ?
   push    eax4 U, j$ ^7 A; Q7 ^7 ?- Q" q& Q2 d
   call    KERNEL32!_lopen
" l5 r, o3 f5 d/ l# Y& M; O   inc     eax) Q% c7 F1 @  f6 O. H  H6 F" v
   jnz     00650589                  ; detected, Z: y4 w1 g1 D5 o8 K. z  {8 n
   push    00                        ; OF_READ
& ^& _* ^4 m) ^. G0 @5 {   mov     eax,[00656638]            ; '\\.\SICE'
7 G; d9 V* x/ b3 f   push    eax
: K$ M* `1 z0 ^, K* J. p% }   call    KERNEL32!_lopen
- h9 J: G$ n6 d# l* l- l   inc     eax
( \+ ]4 o( q3 G   jz      006505ae                  ; not detected4 ?5 N/ R3 ^- R+ i# N3 e. K, L
4 A- l, {. K+ o% l
. k& ]$ @0 Q) e% [
__________________________________________________________________________
9 p& @  J1 j' F" p
7 ~! n! v+ Y6 ~! l# y. Y- T; `Method 12( H' ]) |6 r/ [( Z& F; E
=========" _9 _& X) t" G* [: N
5 T: J2 s! j8 U$ y' f
This trick is similar to int41h/4fh Debugger installation check (code 05( |8 M+ R; y8 |. j# W+ M
&amp; 06) but very limited because it's only available for Win95/98 (not NT); M7 L8 l# `. R3 N# w
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 t6 y  [7 G3 ]3 t/ |

* t+ S/ B4 \7 c$ |* j' f   push  0000004fh         ; function 4fh
/ \+ X" x9 R1 ~, E& W% ^   push  002a002ah         ; high word specifies which VxD (VWIN32)' E5 t# ^' d) m8 M4 I
                           ; low word specifies which service+ v- f( {8 H* Y6 A7 e; v
                             (VWIN32_Int41Dispatch)
/ I% o/ P5 j6 A% y; {2 Y6 _   call  Kernel32!ORD_001  ; VxdCall, N5 ^) s4 E% A# w" _- E% S
   cmp   ax, 0f386h        ; magic number returned by system debuggers1 e* x. A+ [8 ~0 Q5 X/ q: q
   jz    SoftICE_detected
5 \! l" X+ |" s+ o0 W5 I2 k- G4 \& I( N: P$ o3 k
Here again, several ways to detect it:7 s- L- j" P6 D
$ t" E$ V3 h) \( E1 G! C
    BPINT 41 if ax==4f
3 C& G* E4 G  K' Y- w9 M2 e
9 A2 F/ ?+ ?  e# C& D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
# }+ \9 y4 Y. V3 p! W# C/ D
) U# b# c, e8 t" }  h7 ^0 x* r- e+ K    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; s  `8 G: K3 H$ z3 q+ X* l3 e7 h- V1 X( L# ^
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; }) T% j) @" [0 F/ B1 \% V. f/ X+ e& O/ v- N+ l" D
__________________________________________________________________________
1 \- S5 P/ i$ H9 p3 {$ G
, U# K6 O, O# H) jMethod 13
( {) Y( a2 u5 M! y8 @8 b. t=========- U0 F4 f, w5 a- r, K: Z; f
* g! x( U1 W/ O' C) T9 \- t
Not a real method of detection, but a good way to know if SoftICE is
7 `: c: r1 r( W- v6 J$ V* j  I+ Binstalled on a computer and to locate its installation directory.: ~& C  x/ X* g1 f+ _5 L4 y, a  w
It is used by few softs which access the following registry keys (usually #2) :& }8 k8 b. d" H  Z. C: J* n

' V( g' }5 P9 W4 U: k* r: p-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ d  _0 B4 M& y+ D, y\Uninstall\SoftICE
" X0 f" p' b8 y* ]-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# {+ j/ g- V7 G! p( U-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* o2 x+ X' |9 M# X' P
\App Paths\Loader32.Exe2 g5 L- s* Z! M- E: _
  Z  ?5 n) k7 ~4 d9 s* ]

& o. q$ B! T8 U# g1 tNote that some nasty apps could then erase all files from SoftICE directory9 e% ^" M$ f2 d2 K9 n& l$ l) ~
(I faced that once :-(" ]' u# I' B! e0 {1 K2 m& d, g6 d& H

2 I( j0 ~" v, n7 |- L7 fUseful breakpoint to detect it:3 P5 _/ Z" V. p# l& D# j

% b! `# T9 h. L, ?. P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ b. g# j% _* h$ U+ ]3 `
" d* z6 p9 X; b( O% i8 }__________________________________________________________________________# n$ @" A% ?1 F$ @0 ~* O' ]% `

2 T2 {, `4 X5 B# d) P$ W, w- ]8 h  i) i! ~7 I( {1 C: |
Method 14 0 m3 X" Q( e1 x7 \" W$ z
=========
( ~* \8 c* C; Z. ~- z4 e# t/ v3 c; D% Y. d: L% [8 a& q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ y# b0 B/ \! i& n/ l. His to determines whether a debugger is running on your system (ring0 only).
. o# H! _  V6 ]- _( d$ N* a9 n$ ~: A1 S  P- y( N
   VMMCall Test_Debug_Installed
% C" u% p  {2 r; q   je      not_installed5 K. |7 P, O/ Y8 p

: b( r4 e: M3 M. ?( }& R, X" UThis service just checks a flag.
6 q; Q2 }3 N0 R</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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