About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; O. R! T" L3 ~, J: G' T<TBODY>3 C* u$ C6 T! S$ ]
<TR>
. s- R3 b* S' _& ~" m9 H1 B) O<TD><PRE>Method 01
  r: C8 I& P. R- R: v=========
1 ]: d8 W* n8 U6 t
  g0 f: [& R) R% {This method of detection of SoftICE (as well as the following one) is1 A( K3 S" G2 f5 ]$ O6 C
used by the majority of packers/encryptors found on Internet.
6 \2 d8 ~) }1 F+ ?0 TIt seeks the signature of BoundsChecker in SoftICE3 m0 s/ ?4 a: n1 F) R) k
/ L, a: G4 [; P  C8 q) u
    mov     ebp, 04243484Bh        ; 'BCHK'
" y  L) a) U7 N$ ?7 ^+ R6 k    mov     ax, 04h2 V7 S" z- j; y3 B
    int     3      
1 e5 t4 {3 X- c/ ?% \  @1 W8 O    cmp     al,4
8 }; p: T: R4 A% {+ H* t. |    jnz     SoftICE_Detected
+ T1 w$ o! I9 b8 ~4 w
7 v1 V/ b. f, {. O6 p___________________________________________________________________________
5 ^1 r0 H: T4 x4 H) d/ O& C4 d9 |3 |4 R1 o( Y0 b
Method 02
5 Y2 j" Z; e& O: w- q( \  A=========  [  ^  S+ s. F. D9 p7 Y9 k
: K0 A8 i- u1 A* u1 E
Still a method very much used (perhaps the most frequent one).  It is used
8 t" E3 J4 A' \& @. ?" fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 V  y( W7 g( F+ D1 Uor execute SoftICE commands...
; P: v$ ]/ Z- L3 KIt is also used to crash SoftICE and to force it to execute any commands
0 k, u+ k  Y5 S% @( v(HBOOT...) :-((  
' ?+ f1 @1 U  Q  E: W- [
/ e7 Y: W: H# i: _* q( _8 S+ ^, d/ WHere is a quick description:7 E; x4 X6 Q/ A7 c- o0 s( q' _
-AX = 0910h   (Display string in SIce windows)
. W6 l6 V# O7 V# i( e( D6 c-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ ]. {7 V  {6 D# w3 W-AX = 0912h   (Get breakpoint infos)
7 ?! ^4 {. n+ n7 z  a- c3 \5 n-AX = 0913h   (Set Sice breakpoints)4 e( p$ ^6 c* v) }+ }6 q0 Q. s. V
-AX = 0914h   (Remove SIce breakoints)
5 T6 Z3 ^- o# ~: M1 q" b
( j1 J) |- G% V" d6 XEach time you'll meet this trick, you'll see:
" w" Z5 Q/ h. z; ~5 [-SI = 4647h/ H; @/ w6 d1 V1 K3 p
-DI = 4A4Dh4 @$ Q4 e; L9 a6 d# M* [$ J8 l; N+ r
Which are the 'magic values' used by SoftIce.
: V4 k; \3 H, f9 c3 Q2 PFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- }+ d/ y6 x3 @. Q/ _( i* G
+ U: I8 {9 Q6 ]/ {Here is one example from the file "Haspinst.exe" which is the dongle HASP6 K& I& K+ i/ `8 R
Envelope utility use to protect DOS applications:
) p$ }, k  h; {8 A2 S7 O( u. {& B# i3 D7 M, @# [
( i/ s. `) n; l: a* C
4C19:0095   MOV    AX,0911  ; execute command.- Q$ g' a) }8 \( V/ _
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! }" C( W& }3 X5 d" P4C19:009A   MOV    SI,4647  ; 1st magic value.$ ~3 i" k$ s' ~8 g( P4 ^7 ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  S7 i. O" r( c# }& ^1 R
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 X2 k. ~! {$ }! s( @/ I) @: z
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# _/ n0 e  F& r4 R, F9 o
4C19:00A4   INC    CX9 A/ r. i; [& V0 r) g9 H
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 Q4 J7 M1 |% M. D
4C19:00A8   JB     0095     ; 6 different commands.
; M( V5 k3 k6 t* M* G1 u5 ]4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
5 ^' _5 Q! d- j; }$ |9 m4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 ?7 ^+ ?$ b1 {( X# u* x7 Q! P) Q* p" H8 w3 I# x
The program will execute 6 different SIce commands located at ds:dx, which% ?  I0 c8 G' V
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ w7 ~( x6 i8 R6 h0 D

, k0 }1 o# d" m' Q/ v: w& f7 ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* z( s. i1 D0 u5 i  Y
___________________________________________________________________________
0 n# U" J" J7 c3 e4 w
8 V3 E7 _, L- Z8 O( ]- }
" I2 Q% O& q* ^; n" j- H5 O' W% Y* GMethod 03& g3 e: F! W% ^8 R* d* |; P9 K0 l- y
=========3 Z0 z" b& B+ a& r  m

7 H0 d4 ]$ J5 {& s6 ^# o3 t' h) [Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 o1 \' S+ Y+ C& Z. n% E% m(API Get entry point)
. w' b4 W; j  z. E3 v; ]' c6 i        
% M" p/ Y8 L  K5 U
0 {$ g% u# F4 P    xor     di,di. h. e0 y6 [5 b3 E
    mov     es,di
- l7 ^0 p( P: Q    mov     ax, 1684h       9 j+ J* T. u5 t8 L
    mov     bx, 0202h       ; VxD ID of winice
& [" U2 G6 t& g; t% m) f    int     2Fh, o4 w3 d& A. Y9 J2 I
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 [2 T6 O. o4 F4 J0 G6 H
    add     ax, di, _9 I7 r: d9 E9 ^0 G" v
    test    ax,ax
: o7 q, ~: D3 E" J( v( i    jnz     SoftICE_Detected; a7 R. c1 p  s' E5 i; }0 ^, m8 C
& |$ C! z; q, N9 p5 G2 D' z
___________________________________________________________________________
* [0 L: O6 \9 W: Q+ u5 m7 s! g3 k' f& M, N  _
Method 04( [6 e& M$ Q9 y
=========/ a& e  |4 v. Q! ?
' B5 I6 d. I/ u
Method identical to the preceding one except that it seeks the ID of SoftICE
: i$ Q- x6 t: _: O, k% PGFX VxD.
! c8 p. {' K9 ~# h
) h& s! n/ a& f    xor     di,di
/ C0 \) Z. ~1 @' P4 m# a0 r  M3 E    mov     es,di
  C( P( [: D; ?    mov     ax, 1684h      
% @. q& C( A; ], l$ @# V' s2 G8 H/ J    mov     bx, 7a5Fh       ; VxD ID of SIWVID) h+ c( [! `2 D7 j' n4 N
    int     2fh
0 C( F( d! O- Q1 v6 s    mov     ax, es          ; ES:DI -&gt; VxD API entry point. D3 `0 N1 y' W% s3 j7 P
    add     ax, di( H0 X, g# ~) y" u$ h
    test    ax,ax
+ r% ^# W6 j% _    jnz     SoftICE_Detected; T+ m6 Q, C1 B. ~6 ?
. N5 e% Z, U5 f8 ^" S
__________________________________________________________________________
, u- ?8 u7 m0 E! x# e# O. n8 b' P7 O) |4 X

/ O0 `: C: {! f# n' j( F* WMethod 05
, F, [( @( W6 `) P8 r7 @=========
0 b2 U8 Q# T/ z4 ?5 Q
. _; T4 {0 }" Z" n# G1 R' z; V& c) sMethod seeking the 'magic number' 0F386h returned (in ax) by all system* j; K1 x, Y, x/ f% ^
debugger. It calls the int 41h, function 4Fh.. j" a% C. V+ `  J2 q
There are several alternatives.  
' A) ]& @! W6 Y" G* v# [, r
" W4 I; B) ~6 G% W' a* ]4 F, SThe following one is the simplest:
2 K2 K! ?, P: }; h7 f  B$ [& D; e" J
4 o0 \7 B3 V. G    mov     ax,4fh3 K% I+ x1 T  _) H
    int     41h9 k# k5 r0 Z, `% O7 H4 ?- A
    cmp     ax, 0F386. M* M( J; W7 l0 g( L
    jz      SoftICE_detected
5 n9 J$ ]- U+ r3 w3 |* W% t1 q* u% y# x, P4 ?
* g8 T$ e. l$ h1 d3 ~6 P
Next method as well as the following one are 2 examples from Stone's 5 Z; x2 t7 h: }; o- [$ o; A( A
"stn-wid.zip" (www.cracking.net):6 F9 P7 @/ ^8 V/ D
2 k  B% F8 P1 c: k
    mov     bx, cs
) T( s: X" w9 M/ N- o* V    lea     dx, int41handler29 ~8 R- T# ]6 i2 o4 m5 Y" a" w" ^
    xchg    dx, es:[41h*4]
2 h6 @0 x( N0 W! K    xchg    bx, es:[41h*4+2]
* Q0 K) c- {( p$ ^4 M% m* h    mov     ax,4fh2 u7 J% {4 j# g$ r
    int     41h
; c, Q# r. ~. ^0 @    xchg    dx, es:[41h*4]
6 L& b* U. m$ ?( U, N. @& q0 {    xchg    bx, es:[41h*4+2]" t0 {  b  n( s
    cmp     ax, 0f386h* r; m1 m: Y) t# d
    jz      SoftICE_detected
0 O" ?7 O; Z2 r1 a0 q$ G: U- n9 ]5 A" p2 I
int41handler2 PROC
9 n( m) M) O  B/ S' V7 h/ Q1 `8 ^    iret6 O1 Z# J: v' R) g, |3 ^; N
int41handler2 ENDP1 P1 ^( {* s9 W* v+ }9 w3 W" I+ i
- p" G; y# Q# c* ^( G
. k( c& x  m# V$ v
_________________________________________________________________________
& v  E1 y* _! P6 L, Q
+ Q) Z5 a( p+ \4 `" @1 o2 V; |& O& `
Method 06* y% [; D+ {9 P( [% B
=========5 c4 Y; ?* c2 _. @0 i

5 n# N' {1 l) b2 H& e0 l6 L, S. \6 a6 W, z/ [
2nd method similar to the preceding one but more difficult to detect:
4 K9 j8 W/ g' d! t* F2 {
( ?+ _& h6 i( G6 Y; ]' \! c- h4 q+ n. W. F# N% x
int41handler PROC& [/ u, I1 f6 o0 W5 U
    mov     cl,al
% [" L1 J5 B) S+ @& S; V7 s    iret
: ?' ~$ P! t+ Y* L' dint41handler ENDP
& f0 Q$ X6 s, M8 C: u, |( `% Y+ O5 ~  [& }3 G3 j! X0 d
# u* x. Z" N' X* N3 j
    xor     ax,ax$ Z9 v6 ^) ~& K
    mov     es,ax; G8 F0 z/ T7 M3 D( L
    mov     bx, cs
3 t" k3 }0 Z  I' S. a    lea     dx, int41handler# I) P2 Z5 w; V* V1 W/ a6 `
    xchg    dx, es:[41h*4]6 s& k! W$ r5 s1 y
    xchg    bx, es:[41h*4+2]
/ q1 Y: e% U- {! A: R- ^* I    in      al, 40h
: ]! X8 P; Q( {% Z0 u5 i: m" o" G    xor     cx,cx
( R. k6 i' z; {: ~, v4 _* y    int     41h* T8 @  I, v! p2 A3 {' X2 E, a
    xchg    dx, es:[41h*4]  u) U6 [% D0 p8 h: D0 E4 o6 h) V
    xchg    bx, es:[41h*4+2]5 i  s, F( H( @
    cmp     cl,al
( H3 A4 ^3 ?# f8 V5 W7 X    jnz     SoftICE_detected
) s$ c/ Z6 _! K/ Z7 Q2 F& l0 W0 t" j2 {% ]7 |$ n2 O8 i. n7 e, K
_________________________________________________________________________  }. \# X8 {3 C" q; T- x( w

5 V4 v+ G; t6 s* KMethod 07- m3 |" Z7 v7 f: V8 y3 C
=========0 O1 @  l# s2 R) \
. [) I+ }+ v1 D2 O
Method of detection of the WinICE handler in the int68h (V86)
$ ^3 n, N# R8 c
- r0 z. y2 Z& R  f6 j0 N& A    mov     ah,43h
6 m/ W0 u  ?& m* _2 X; j    int     68h
5 e+ [4 E/ d$ I    cmp     ax,0F386h9 v, j$ m& i1 i: _. v, \, Y
    jz      SoftICE_Detected% [% `; p, R6 C
6 k7 S- H/ ]2 G, _" `6 F: q3 b
1 z; P2 i4 [0 c* k  k' @3 c: n
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ E  ^+ u7 c: n1 U* r1 Y
   app like this:
' \! k7 U# w, V1 x3 S9 o+ _2 X+ u  ~. @( ^
   BPX exec_int if ax==68
! c$ a* p% I1 l& S, a& ?   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 K' f! ]& G6 I/ V   located at [ebp+48h] for 32Bit apps)
& m0 d& X8 K# h$ w__________________________________________________________________________  Y# {0 j* I5 y5 s/ E

0 }2 u/ c. i3 [3 S  c( [+ p- Q: e# G  [% L7 Y8 h+ W; q
Method 08
3 s* [- R) K+ Y1 v) }% f+ V5 j=========
7 ?" G1 W3 ?5 b0 w9 F
) b2 M  N2 V' Q7 L0 {It is not a method of detection of SoftICE but a possibility to crash the
3 s) i  ]6 n% }0 |9 @; nsystem by intercepting int 01h and int 03h and redirecting them to another
& }/ R2 [% g( y* eroutine.
# |+ f5 w5 G/ s' O! I+ X1 P  ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 ]. ~0 o+ ^2 `) o
to the new routine to execute (hangs computer...)1 G  ^/ g! K4 A

1 r8 T  @* S; r, z1 `    mov     ah, 25h+ f& s! x& c7 t7 F2 N! D
    mov     al, Int_Number (01h or 03h)
7 T* K# z! `+ m# Z( z    mov     dx, offset New_Int_Routine) n0 P/ N& v0 z0 }( i2 u4 u
    int     21h5 Y' h, C- S3 V+ r  U* R) x5 F

$ ~0 ^0 H4 ^. A4 B$ ~* F- I0 T__________________________________________________________________________
2 e# g( C  P3 ^1 s- W
, Y$ P' R5 Z1 U' U4 h6 gMethod 09
6 Q! J; D( o* P" F0 ]=========
& S, Y& `$ X) x" o
: d4 |: U' [8 u2 Q; R& ^This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" S% o1 y. ~. }( {( z3 K
performed in ring0 (VxD or a ring3 app using the VxdCall).9 S: l, P! l9 M- t8 |7 @+ k
The Get_DDB service is used to determine whether or not a VxD is installed3 O4 \- Y3 D! A& z, U& [
for the specified device and returns a Device Description Block (in ecx) for
3 g  h7 b* `! B) v3 ]* ~" F9 fthat device if it is installed.
- P$ b( w& j; G3 j, M1 Y' Q/ p8 W9 h% R7 Y' k. O5 \
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 G3 T/ |, k6 U5 R/ {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 C( N; ]  k  d1 Y: D' E: d, |3 _' L
   VMMCall Get_DDB
( Z% u9 H  N; W2 }" `1 a0 e4 K   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 W8 }. ?+ Y2 ?+ G  e' e  k9 t- M$ g' q8 |( S- }! c
Note as well that you can easily detect this method with SoftICE:+ S6 f; d  Z% }2 [+ [3 B
   bpx Get_DDB if ax==0202 || ax==7a5fh% t0 I1 O7 _: ^
6 J; v2 V  H6 Y  R0 ^
__________________________________________________________________________, ?' z7 g; d) Z) _$ X: u: [. Q; c; G
0 M/ s0 M) D# u* Q* m
Method 106 J$ u" V- I" ?8 t1 q+ p7 s
=========5 g8 J1 k4 d- e8 v& E
4 [: ~8 y. a9 B. d% Q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 Q. y+ s, d8 l& T
  SoftICE while the option is enable!!" R* h& w3 I. G# r1 V% g
) p) _8 R( M- x7 \% [7 l2 w" R3 a
This trick is very efficient:
4 D4 ^$ p* Q+ [& d0 }; h8 J. xby checking the Debug Registers, you can detect if SoftICE is loaded
7 P8 i8 a5 W* ]6 d1 {7 ^) O; f# ?9 m(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. w" C' y" U9 k& r) e$ Kthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 w8 P; ]( j: l5 ]) R8 j
value (in ring0 only). Values can be manipulated and or changed as well
% j9 b  w: q, E(clearing BPMs for instance)
! N2 S* i! |0 w. M: C0 `4 t; R  ?
__________________________________________________________________________
6 D2 O; V, i) e% n* H# \) r# l) k9 ]9 G. R. ^
Method 11
! ?7 |6 T' o6 K" _& C& ^0 @=========
3 S* g5 H/ G" J, P7 z8 }$ h) R4 x  Z4 o' @. x/ Y) `
This method is most known as 'MeltICE' because it has been freely distributed
  p; d4 z2 c! n" j5 y7 I/ h8 ]via www.winfiles.com. However it was first used by NuMega people to allow* l8 j5 n+ I. o4 x+ ~5 [
Symbol Loader to check if SoftICE was active or not (the code is located
1 i- d# ~! R' P( R6 o) f5 _4 iinside nmtrans.dll).
7 a& l9 t/ y/ P+ b/ U2 j
& }, f' F& t$ v8 h* LThe way it works is very simple:
) ~" n# @; ^# G5 _  i4 `It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# H+ }# Z0 }& B7 i0 N
WinNT) with the CreateFileA API.$ b! ^9 E/ x% |

, ~: B& a+ H: K" M9 b: THere is a sample (checking for 'SICE'):7 {2 D; ~( ]. u: f) Y, a: w
# I2 v( ]& g8 L9 Z8 Z
BOOL IsSoftIce95Loaded()0 t: |" v! L2 H1 N
{& M# {0 [" i& C4 D9 v- E
   HANDLE hFile;  7 Y/ _8 {" K- M, U
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! @* b7 }! j  |  H                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& b$ {, U- I0 V6 f# ^                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( Y9 z% W  o* u! L4 u
   if( hFile != INVALID_HANDLE_VALUE )
$ I6 H, n& Z0 ]4 Y   {
" _4 [1 T4 a* m+ D) g0 v      CloseHandle(hFile);0 A' @2 p+ P1 ?& J0 Y  r8 E
      return TRUE;
, {# I* U6 U3 g5 |( C: M  e/ D   }
! \9 b& o, v4 }2 h: s   return FALSE;* P! E- [6 Q  H% P
}6 k+ D, n* q; u, Z

+ p' N" W7 q; F8 \& ]Although this trick calls the CreateFileA function, don't even expect to be7 q, R1 x; \$ d' c. A4 ]1 d! l! Y
able to intercept it by installing a IFS hook: it will not work, no way!  `6 x; z6 g2 h% V, _+ q: C; H5 J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
; D" `9 \5 r* h, {) v; [3 O2 @- Q# lservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% o; j1 \( H; V/ L& ]0 ?. E
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
) Z5 x3 x2 u  B- ^3 J  Q/ X' l$ p8 yfield., |% u, U0 C5 R
In fact, its purpose is not to load/unload VxDs but only to send a / K% }- s# T2 j7 g' H, B
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)4 e( b( d  t8 o" O$ K, V
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
# m* Y0 ~5 ^- u: E5 H: sto load/unload a non-dynamically loadable driver such as SoftICE ;-)., R8 x& c+ q* o
If the VxD is loaded, it will always clear eax and the Carry flag to allow1 ?* G$ a1 y* f3 K0 U
its handle to be opened and then, will be detected.
) C  E. ?* s# R+ U4 b; yYou can check that simply by hooking Winice.exe control proc entry point# V* B/ n/ Q2 a7 C9 H
while running MeltICE.% C4 d4 [( \: d; J4 t. l
/ @6 ]& I; ~4 e' L7 D
- I9 Y, j9 l- D+ d
  00401067:  push      00402025    ; \\.\SICE
- v, O" p5 d% f) k. `0 }  0040106C:  call      CreateFileA5 Z! V( H9 \, c# M
  00401071:  cmp       eax,-001  i/ `% n: P) y, G2 R& t! F
  00401074:  je        00401091( ]8 m' Q0 b1 ]- r1 I% A' @

- R1 Q) S8 z8 {# M  r: `4 P! [9 B# i+ [  W) I( }
There could be hundreds of BPX you could use to detect this trick.9 r: Y  z9 [& u9 E
-The most classical one is:3 y5 v9 s4 O: f; ^# w' m
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" r0 H" x0 d5 e8 x9 p$ q" l* S2 f
    *(esp-&gt;4+4)=='NTIC'6 O* v1 b' i# x

* w9 D; M  X; c) Y4 {& _-The most exotic ones (could be very slooooow :-(" j- n+ q( D' S' `1 g$ _
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ ~7 u6 f& Q0 F- u/ W* L. w  E1 j     ;will break 3 times :-(( [2 L& k2 r" _, ~
5 }) T( o. V- ?0 f
-or (a bit) faster:
4 i# ]8 k; P& U, z4 A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) Z' r+ ^: L8 [$ _
" K  {- E6 `. V6 K   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & c& O/ [2 E9 i- g8 R. m8 Q8 i! R$ w7 b
     ;will break 3 times :-(% L  [* C, y& A+ l8 w
* w6 R! Y' C8 n! i2 `* S
-Much faster:" [9 q7 @8 W6 c( S
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& ^: X& N5 K1 J: j; p
  o0 |# m  j- C* g
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
, g, _0 Q3 x; V( _function to do the same job:6 g. i; x9 G! ^# h; X0 i

! _0 B# ]3 }4 N( V   push    00                        ; OF_READ+ d5 z% {5 Z* c, B
   mov     eax,[00656634]            ; '\\.\SICE',0
+ f8 x. f9 R: @! I7 e3 U$ T   push    eax1 T5 b1 V$ c+ G, }; j
   call    KERNEL32!_lopen
9 @- {% K" O& Y, g6 X   inc     eax
# t9 T" F2 e% Z1 a8 g% f. [5 X% T   jnz     00650589                  ; detected
9 s6 l% B! r% D, R, S) b6 s% i   push    00                        ; OF_READ; Q+ X: q: _4 d4 k& ~7 `
   mov     eax,[00656638]            ; '\\.\SICE'6 Z- H: s5 e: @! Q  C3 S- R
   push    eax( @( f* |% M4 Y
   call    KERNEL32!_lopen
+ |# c+ U6 j9 S, M   inc     eax- ~; e. r; V! O% T% L
   jz      006505ae                  ; not detected, U  u8 \; R! s/ Z$ M( b% D

% y/ J" }9 _. ~/ p/ S. X, g7 D# h- a! o* N! J. L' Q$ d
__________________________________________________________________________
7 ?2 G6 K* r9 r# d2 s
6 K/ V  b6 {+ y* F% I8 G4 \( nMethod 126 h1 c8 G' x% e5 |9 ]
=========  h; C' x$ m4 j2 ~" J& a6 f8 t

% j# d" J3 _% H3 i" M- n& FThis trick is similar to int41h/4fh Debugger installation check (code 05
! v2 X9 g3 ^0 y5 |# Z6 e&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ I5 t; M. e6 m/ W/ h
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; g+ o: S# e$ X6 b8 H
' X: b; t' w" r9 h9 P3 E
   push  0000004fh         ; function 4fh( n- f! f; o0 A- Q+ {7 _; S- G
   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 w' E7 Z* e1 C7 |' v# P                           ; low word specifies which service; u3 s' l7 i, X  W
                             (VWIN32_Int41Dispatch)
) X$ _  l& f2 o& l) k' C" [   call  Kernel32!ORD_001  ; VxdCall; H8 A* }0 s2 Z- ?4 n$ v
   cmp   ax, 0f386h        ; magic number returned by system debuggers/ |) q: A( L% H' z# l, V' {
   jz    SoftICE_detected# Y5 m) S/ y; t7 M' c- I0 N9 F
( p- [3 N+ E# \/ ]' F* l1 f& I$ \
Here again, several ways to detect it:* D5 |# }$ F1 X  _, A. b4 f- F7 \6 {: l
2 w* _; Z; {, m5 P5 b1 u0 z. u4 Q
    BPINT 41 if ax==4f
: R9 ~4 K, I. l$ S/ I, v/ Z% `. g8 v# e" n/ Z# Q. X. s
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- [- N" u0 E# i8 K/ f- _' H+ N+ {$ N9 f/ A; J" o/ {
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. n! c! S5 Q- _3 \; @, a6 e* D) Q( K' v( g, i1 W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" d* h( G" \+ G2 ~$ p
( w) J2 {# ~4 t" r2 _4 U, ^3 J8 A__________________________________________________________________________+ B' t3 j9 \: U* p# S. M

  h% E1 k" r' q& j" gMethod 13) H# N% H* a4 R" M  r
=========" s0 q$ D% ?" Q( c

3 `3 i, L) N# j; Y" `. C2 O6 V8 NNot a real method of detection, but a good way to know if SoftICE is
* E, j. M5 A2 E# r) hinstalled on a computer and to locate its installation directory.  D, f6 }' {7 B# s) O4 z! G
It is used by few softs which access the following registry keys (usually #2) :/ s4 F6 ^. M7 F& \! z

/ }. s& ]$ W3 D4 ^6 X* }- D! a-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) }$ z; z3 v& P8 A\Uninstall\SoftICE
8 R3 k6 v/ o# ]9 i4 n0 S-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ u# b6 {. n8 {) V-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 t# {7 M, R5 m! n) U3 \6 f. t\App Paths\Loader32.Exe
" a: \, [' C3 j
  D8 R8 L( ]3 ~' u. |
( y) I! {- j+ H, u8 [0 H5 f, FNote that some nasty apps could then erase all files from SoftICE directory5 f4 j( m- ?+ \4 q9 m* t+ `% `4 @
(I faced that once :-(
, f1 N& w  }# {8 L% l! {' j4 K+ ]) j# |
Useful breakpoint to detect it:- |* A: ]5 V' h* D. k
* O7 h- _  N# Y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', C7 a* J& r6 R/ _( @
. x9 M" J, y  s7 h
__________________________________________________________________________
& M" B) p+ D2 v% a6 ~* S0 x) a0 J% G" a

$ T( D+ c" E+ q2 E7 kMethod 14 ! q' q% s3 \# ^& p$ L( o
=========$ E$ ?; ~  L# A7 K( @) H

6 s& h# z( _9 bA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 ^1 h. b' ?" _- `' _/ W
is to determines whether a debugger is running on your system (ring0 only).
2 k: N4 ]1 X9 r  s. y3 C  w  k) Z' R8 B" V) H# F1 S& P
   VMMCall Test_Debug_Installed
. h  U0 r( S! r% o+ e3 c( {   je      not_installed$ P9 c3 L) j9 b) ]9 @, a5 a0 o; s9 F
' }' G' [0 s7 e3 T# H1 q  M
This service just checks a flag.7 j% f4 D! L! t+ Q% i' t
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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