About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 I: a: n% N$ p* }* ?<TBODY>
$ c1 X/ X  S" P9 S5 t<TR>, V  C& W7 d1 w0 J
<TD><PRE>Method 01
$ ?' C# F. K( F# a/ \  |7 |+ `=========& r8 \( j/ T0 q, w4 f, T
# {/ A1 V. b8 P5 i
This method of detection of SoftICE (as well as the following one) is1 n3 }2 t7 r8 j, b8 Z
used by the majority of packers/encryptors found on Internet.
/ {% I1 @8 S  {: n. NIt seeks the signature of BoundsChecker in SoftICE
- l7 s  w; I% H. S2 {5 v6 B+ H8 ]0 f/ b3 T. ^1 R( T9 B4 S/ F" v
    mov     ebp, 04243484Bh        ; 'BCHK'+ J- ]1 Y# r0 ]" U7 c% a
    mov     ax, 04h. A9 U- h, `6 ^: v, w6 {( E' \- _
    int     3      
. \# T5 S  S2 ^; ?- s3 H0 v8 ~    cmp     al,4' F, f3 U8 O+ N' w
    jnz     SoftICE_Detected' i- i# }" l* ^, V/ `) e

4 L: k' \' ^! |; c* o% f3 u9 ^___________________________________________________________________________
3 r7 H2 h: M/ `% I* b7 c, C
7 c' \9 i& E1 P% [8 Z& \Method 02
2 K7 i  V, G! K8 E4 r=========
8 t6 t( D" D( D: w
$ |0 M0 ?& {8 ~6 F% u- R4 QStill a method very much used (perhaps the most frequent one).  It is used$ `- A8 I/ u% y2 }
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ }: u3 E8 n; t! Mor execute SoftICE commands...! V, h" p" w) G( @) b
It is also used to crash SoftICE and to force it to execute any commands3 \$ o( [9 Z3 z! S
(HBOOT...) :-((  
  M' A, I% F; }. k3 {. U: n/ {+ b. J. C  H9 G! e
Here is a quick description:0 D5 g, R5 D" U) L
-AX = 0910h   (Display string in SIce windows)" f6 Y8 F, K3 R3 o" p
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- t7 ?+ Y$ N% l
-AX = 0912h   (Get breakpoint infos)' H3 @) _. ?! Z; ^! h0 @
-AX = 0913h   (Set Sice breakpoints)! ^. r/ L. {- c* I: J
-AX = 0914h   (Remove SIce breakoints)8 y+ |4 y) P# @. d
5 p+ _4 [5 O- c9 ~7 y! \# [2 F
Each time you'll meet this trick, you'll see:
8 }* u* i/ j( C" `3 U3 n5 Q-SI = 4647h
: g# ?3 z( Z! f+ s& r-DI = 4A4Dh  L, k. k3 [( d4 w2 |/ f+ Q7 }8 o$ P
Which are the 'magic values' used by SoftIce.
8 o# V% [! @% m$ C: [For more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 P3 D4 |% Z  d7 }+ W
. C+ k- W2 b4 B% o+ R* D& y3 j* x8 U
Here is one example from the file "Haspinst.exe" which is the dongle HASP+ ?$ r7 o2 x" \4 h0 K& b9 Y
Envelope utility use to protect DOS applications:
' ~# q) j: x" q) q: Q1 m* e+ Y! n8 N

0 s! y: b; u* `% W1 _3 G4C19:0095   MOV    AX,0911  ; execute command.
) f( P2 x. z3 R  Q* I0 f  E6 P% _* i4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 Q# a, {* S8 q4C19:009A   MOV    SI,4647  ; 1st magic value.
" a: L- o$ U7 X& Y% d4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. B8 N+ B! B) ?7 M" M! N5 |7 c4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
, w/ ]5 d: r1 g- V6 N+ ?* `6 c9 R5 _4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute5 S* Y3 c2 Q. k/ H$ P
4C19:00A4   INC    CX
, s- ]* I5 E. ]2 Y! o4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute1 y2 ?3 j* U! J
4C19:00A8   JB     0095     ; 6 different commands.6 }2 d  w2 C% |/ v% D+ ?
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." ^( k0 v- y. P+ v8 c8 ~
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
! |1 R- P$ z# ^$ d# }. X2 R6 n  |* V' ^5 p. [4 m0 _1 I/ o
The program will execute 6 different SIce commands located at ds:dx, which
; f+ x+ L! \4 M) ^are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! w% U- _, J! j( U! U  H, h2 ^" u& o8 `9 B0 n/ p
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
) n% t' `" {  s( `6 L/ E! m___________________________________________________________________________$ C8 s( V9 C! N1 s6 e
! G: A1 D$ ?" s9 O
1 S  r3 }% e- q
Method 03- w+ @# ?0 u2 C( A2 ]
=========7 d$ L6 C7 D! B# O1 ?9 w2 f& m

& i. M( W* P9 i8 Z8 b& e1 R+ Y5 QLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 K; q  i: i* g! D8 j(API Get entry point)* R- A6 s* x$ t# U
        
" |: i% W* y* q$ \. L0 O3 K
1 f$ Z6 M. N6 i" {    xor     di,di; }7 d& w  D! u- V# I
    mov     es,di- L: H: w6 r/ U# G3 m
    mov     ax, 1684h      
  {$ ~8 M6 G9 S5 J  i    mov     bx, 0202h       ; VxD ID of winice
& j) o! p4 Y0 X  `- I% f: G5 o6 C    int     2Fh" W. W& @& ~. J4 q  V* t" q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% O7 Y( X) G4 s- Q$ _& W) V0 \$ Z
    add     ax, di
) w. F* O. c& g* m0 g0 }5 a    test    ax,ax& e: M% q: k  D$ R3 m. n  k
    jnz     SoftICE_Detected6 n3 u" s$ v% m& M* h

8 [- L' l% x( w; G6 h___________________________________________________________________________, \$ J" Q! C# Z) ~
3 F% y/ A! p& j1 U# K
Method 04! U7 C: N' D: v' Q
=========
5 u1 ]& u* \: o& V4 [. o9 M
; T6 S9 N6 t3 C0 w( h+ yMethod identical to the preceding one except that it seeks the ID of SoftICE, ~: j3 ?9 h; O5 i
GFX VxD.
/ J" p( O8 o7 I+ u, l1 z  c! z5 K. m1 H+ P/ ?; F
    xor     di,di
; s# j- ^# X5 G* Z    mov     es,di. O( w; Y8 `( @
    mov     ax, 1684h      
& I: M/ M* A1 Y$ [    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% [8 }) K$ F. L4 o3 X: ~    int     2fh. G9 w% [; ]" }# l# \  A$ f
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; o3 j4 X6 u9 D- g  n$ S# K1 ?    add     ax, di
2 e$ r/ C. s$ B    test    ax,ax
7 E9 O$ K; n; y  j4 q# W! i    jnz     SoftICE_Detected
4 _+ k. j+ Z7 ?% z4 o7 y$ a5 p7 G; D; i. d& F: _
__________________________________________________________________________
) q. |3 G; t3 n: z  Q# o6 s4 [( W. u, l, i. ~( H9 O7 k! a# R3 L3 A

2 U0 h; g$ m" x. \/ X9 SMethod 05
" Y  p' `+ Q/ [& w/ o$ k=========0 e8 B2 l+ S( ]0 P, }' o1 L, g
* ~' w$ s" t! v5 ]' ], N
Method seeking the 'magic number' 0F386h returned (in ax) by all system
* ?* [. w! l: a: p- P. }: Ydebugger. It calls the int 41h, function 4Fh.
3 H" v* w, G' ~  }) Y4 d$ m* Z/ AThere are several alternatives.  
6 {; e: X/ |, l: M  p0 q5 C9 Z6 V* o0 J3 A6 z5 W
The following one is the simplest:
# m. s/ f7 x. Z+ m5 C# _$ C2 b3 l& R! }
    mov     ax,4fh
- O+ a; W0 o  x8 }: r4 E% i6 C    int     41h5 A2 F4 [8 W( i& H  J& v
    cmp     ax, 0F386
' C! n4 ?$ W8 X3 F( O    jz      SoftICE_detected
" L+ ~8 \3 e: a) N, D' g4 W0 F" ^" x. d+ r# g* R
# Y- Q  p; s6 E7 C3 |
Next method as well as the following one are 2 examples from Stone's ; U$ V' w8 f2 F; y2 S
"stn-wid.zip" (www.cracking.net):
& V8 S# T, t" V& U8 B$ M0 i" v- x
$ X  N# x: v. J0 Y- F- Z    mov     bx, cs
) |7 H6 g: i) ~4 [$ O: v1 K    lea     dx, int41handler28 g+ Z% A3 w% P, w
    xchg    dx, es:[41h*4]
" Q1 B  c# q+ l" T9 a    xchg    bx, es:[41h*4+2]* U* [* R. n0 }- I
    mov     ax,4fh
- ^6 l  P6 V$ b9 A. I7 ~1 a, l4 z    int     41h
, u, i1 W3 U( |7 h% ^    xchg    dx, es:[41h*4]
- S3 ~" v: h4 {! F4 x    xchg    bx, es:[41h*4+2]
8 y: F8 q/ o+ r8 h0 _    cmp     ax, 0f386h
' h/ {9 S" }0 V3 i& I4 V7 p    jz      SoftICE_detected
# \* R% e0 a" Q. b* r
4 m4 T1 @9 n0 U) k7 yint41handler2 PROC2 K7 n3 }+ U! P; c, U
    iret% a' G4 y& Y" z0 Q
int41handler2 ENDP$ O5 n& w3 [2 f& H1 f2 W) L5 _% i- a

) N( R6 T: o. h4 Z$ ]& C5 A0 k
_________________________________________________________________________! t' P& Y6 n- D5 G9 k

, l' l. I1 G$ W5 [5 R/ W7 U0 K
0 i; D1 ~1 ~0 N7 j; w3 qMethod 06: @5 c4 c( F/ g: x* Z! x, X
=========# n. }8 M; ]/ Z" A  C
' `% b- Y3 g' n- [' J

7 Y1 T9 e3 C! H$ c% }1 C/ }2nd method similar to the preceding one but more difficult to detect:7 D+ c  U  v+ l4 F( y

6 S6 w8 k4 N. q% W0 c& H( O, H; R+ D% z. V8 ?
int41handler PROC$ O/ I. O8 z* Z5 _! v8 F, K
    mov     cl,al+ t. o" o2 T* Z; @7 N( b9 B! ^
    iret
! X6 Y6 {1 A, Z- I$ Aint41handler ENDP- v; F! J& s7 v1 k. s
' T) r  \4 A# f
4 I  a, ^1 v% d  P" Z4 y" q
    xor     ax,ax. S# W1 b# W4 \8 ^6 R" F( E& y
    mov     es,ax+ U7 a& N/ X) o4 U# C
    mov     bx, cs/ W( {! e  f0 F9 S& X
    lea     dx, int41handler
+ o; u( [- i  m3 O' ?9 D/ l    xchg    dx, es:[41h*4]
: v- c- V2 L+ x/ a/ q* l3 G3 \    xchg    bx, es:[41h*4+2]% l9 ~: ]% r( w! S
    in      al, 40h7 Z- Y5 Z- ~9 O) i, N) a( G- R, Z
    xor     cx,cx
+ O4 b( T6 p' q( D9 J1 p& ~2 V* R6 x    int     41h9 @/ G3 V" R, I2 s) B9 ^$ |
    xchg    dx, es:[41h*4]/ \' e& [# d; w; d- ^2 ^" x
    xchg    bx, es:[41h*4+2], R1 D' _# |4 t
    cmp     cl,al
; D0 u+ H8 h4 x* ]1 _2 V    jnz     SoftICE_detected3 u1 V. Z! M7 D3 U% P2 R+ z9 m1 G

# O$ M! [! @; \# e, _7 \_________________________________________________________________________
' U% E) q  L6 h1 |$ W
6 k! S$ |! d" N" v  W' q8 BMethod 07& a) M3 b4 c# C1 C& m  ?
=========+ [8 _2 f. }8 y% c- P) u9 U" g

7 I' G  z; \/ O$ Y- f- N0 |4 \) {Method of detection of the WinICE handler in the int68h (V86)
& ~, ^  i% H1 j8 r) {
8 V) Y. b1 g+ _    mov     ah,43h
# B: v  _" y; A  X5 A    int     68h
/ v; N1 Y. |$ ?    cmp     ax,0F386h9 U, i+ M/ `7 Q! `
    jz      SoftICE_Detected* I, _/ H5 E: c5 L

6 n8 H' Y+ @' d  f! C) I3 y' P
& L5 U$ T  g8 F& [: X; _6 E0 j, {=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 ^- e  _- \7 {- O5 q   app like this:
) f2 T' R  y( _4 _* f) O  y- k- M- Y) w4 e
   BPX exec_int if ax==68
$ X* L0 ^" Y6 i  H; X   (function called is located at byte ptr [ebp+1Dh] and client eip is
' ?2 n+ o& |! c1 f5 m   located at [ebp+48h] for 32Bit apps)
0 F* e& T5 y0 z0 Q* F& Y__________________________________________________________________________
. I: Z6 @, o  P3 @
7 R, J, f  o& r3 I
/ ?& Q4 s+ t0 ZMethod 08
& s3 w( N9 X' |=========
* V8 ~, x# k+ m# I8 p
' @& O! R4 ^  q$ H) VIt is not a method of detection of SoftICE but a possibility to crash the1 E$ ]* d9 G, O& r
system by intercepting int 01h and int 03h and redirecting them to another- V' N) x! W; R" h: r1 V( n
routine., e. m8 V2 g/ L' [6 O
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
) r$ |4 f0 w" d! x; Y) Q/ ]& D$ rto the new routine to execute (hangs computer...)
; t, ~, i* s6 b. q5 O! l" Q, ?
9 P; h; n8 u& O4 i+ x9 e    mov     ah, 25h1 H. u, i4 e7 I9 Z: \
    mov     al, Int_Number (01h or 03h)
2 ^3 p9 L) b: p* P  ?# o    mov     dx, offset New_Int_Routine% U+ n4 `: h* ?. n3 D+ T* t
    int     21h
' z/ |! K! y- M" Q8 R9 b1 t% F" h) n
# m# y' T0 J* D) @" D/ \__________________________________________________________________________
1 G/ P/ [* W- V3 `7 x
  n  o; l$ [( B8 X  `5 T* j" g5 bMethod 09
+ [+ C& ^- }( }=========
, \( H1 o' B% x2 w. C9 \6 s2 G, y6 X' n4 b  l, h
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only$ f/ ~. M, @+ ^  M$ M3 s7 X
performed in ring0 (VxD or a ring3 app using the VxdCall).& L8 @$ Z6 J3 S: c
The Get_DDB service is used to determine whether or not a VxD is installed
- O! q- H/ [, U+ k* Gfor the specified device and returns a Device Description Block (in ecx) for
; j3 {7 C5 B+ ~# D8 k* q) Hthat device if it is installed.
  `( r* R9 B4 L0 R/ L2 T% A0 I1 [2 q" `+ b
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( \3 L3 i; N+ E. n# B& D4 r
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ c6 X4 B* T2 a7 I
   VMMCall Get_DDB
3 l) e$ Y' `3 B0 G0 I3 W   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 b3 L  C0 W9 S! w  H- b6 F/ W
* h! p  B5 k* ^; pNote as well that you can easily detect this method with SoftICE:* m/ O6 o9 P  I' ]# l4 T) h
   bpx Get_DDB if ax==0202 || ax==7a5fh
: Z: n7 H2 ?; W; J8 G) i7 c
6 x" @% P/ x+ H( p( @: ?/ ~__________________________________________________________________________
# u  w+ D  t% f  l" p/ J% e3 `/ g; F' H2 ~
Method 10) e* E4 _- @4 i4 t- f
=========3 W4 Z- \2 G0 `# A) C

+ h/ i- y* F- [9 c% b=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" b& s6 |2 X3 w4 ~3 |  SoftICE while the option is enable!!+ I* @& H3 N/ d) t0 F
5 X! L& U! c' N
This trick is very efficient:
; c$ d0 S' L" \  M; s& ^by checking the Debug Registers, you can detect if SoftICE is loaded
8 _4 C7 w9 R3 q) b) H& a! A(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 Z6 H3 ~3 c' e" `4 Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their
3 f8 d5 W8 U( w9 h* Gvalue (in ring0 only). Values can be manipulated and or changed as well" M: ~) c4 [9 K0 f/ \
(clearing BPMs for instance)4 t' K/ _( Q$ T" T% W( L6 A" @

: d# U0 o8 s+ g7 F' \__________________________________________________________________________
$ H. [  h3 ~7 X' a4 r
  U6 E+ x) g3 G# ?* B/ bMethod 11
4 a+ y0 @9 `% U* n7 W=========, d- ?; _) j9 e, [, m" q" {. U2 Z% {
5 d8 I2 n: z6 X6 f, J2 x  ^
This method is most known as 'MeltICE' because it has been freely distributed
- f6 t' k7 _6 k0 F: @via www.winfiles.com. However it was first used by NuMega people to allow
  z* a  X: K( Y7 L- vSymbol Loader to check if SoftICE was active or not (the code is located
* V$ Y. B2 p) x) r6 z) I3 [inside nmtrans.dll).. \' ?) M4 \+ Y2 a" i
5 F: h/ P; g  \+ U
The way it works is very simple:. N# O2 T' @. o) c( ^; ^
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 h/ r) }9 L, X& p/ i8 G2 t
WinNT) with the CreateFileA API.
% }! G5 [" N0 X
9 Z, p" @4 y* r2 h- nHere is a sample (checking for 'SICE'):
6 I% f: ~0 b" ]8 L9 `# @4 K6 a6 Z4 }0 f4 {2 m  p' N3 I7 l% [* A2 e
BOOL IsSoftIce95Loaded()
( c# ^* ~) ^: h. s{
; t$ L0 ]6 r! W' y7 p   HANDLE hFile;  
6 ~9 W1 n' [+ l% O* K6 v   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' x$ s/ ~/ ]* s; R, ?4 T
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
$ T/ z$ ?; U- E, r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: E$ z8 r0 x$ F( O5 O   if( hFile != INVALID_HANDLE_VALUE )
& w; O4 p* e& r5 |0 `! J   {
7 b* j' r; d* a/ f1 x8 w( D      CloseHandle(hFile);( w. t% l8 u+ e) L' J- z1 M- U
      return TRUE;! F5 U3 f! W' C2 ~
   }  V+ d( n% V/ e/ u- W/ j
   return FALSE;
7 R% e& t2 y6 ]5 A}
* ^- ~/ c. m+ T1 ^
$ R+ G. J* |% `. j! M' N; LAlthough this trick calls the CreateFileA function, don't even expect to be" W7 \# k6 R! \+ z* b& j9 |0 ~5 M  v
able to intercept it by installing a IFS hook: it will not work, no way!
5 A9 `& {6 {0 x$ `0 rIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
. M0 B/ X9 x5 a# K! ~6 F- Hservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ p- t! T0 ~+ F" jand then browse the DDB list until it find the VxD and its DDB_Control_Proc; {% N+ Z) |- I  y5 ~3 d
field.: W1 ^& _. }' R' f' R# J
In fact, its purpose is not to load/unload VxDs but only to send a
6 r! i/ b- i* d- t$ FW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 ]9 N- S* p( G3 @
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ e7 Q9 s8 X+ Z- Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).& Z% k. ^$ _4 O4 ]) U$ Q; H! X; E
If the VxD is loaded, it will always clear eax and the Carry flag to allow8 ]5 u7 c! u4 }0 S7 k4 j: f# n/ K) e5 S
its handle to be opened and then, will be detected.
. b% z3 ~) k; ^6 U. ZYou can check that simply by hooking Winice.exe control proc entry point
1 b: C& \- M0 gwhile running MeltICE.& d# q! X, Q$ W4 w; |" ?  z8 N

0 S9 Y* w8 T9 p' q1 }3 ~
7 k& `; J; Z) ~, m0 z$ u' ?, ?  00401067:  push      00402025    ; \\.\SICE
# Z4 A9 ]- U. z+ _9 _  0040106C:  call      CreateFileA- k  o) N: @9 R* E; L5 ~1 V
  00401071:  cmp       eax,-001
5 b# v( @0 M' E* g! E  00401074:  je        00401091
0 D; \+ F  Z9 `9 g9 T9 p
1 ~7 ?/ ~7 }$ |) A/ }* z
6 J' V! c3 u5 S! f& D! ~$ J! ^There could be hundreds of BPX you could use to detect this trick.
& j7 ?* K! w2 `" p( D-The most classical one is:
! G+ c7 k4 I, v$ c  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 g- v/ _1 \! A4 R    *(esp-&gt;4+4)=='NTIC'1 w$ `+ N+ j$ s. L
6 A) Y6 F1 y+ I7 x" o* Z
-The most exotic ones (could be very slooooow :-(4 P; H- O8 Q) s
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . v8 k1 I4 D/ H& o7 J
     ;will break 3 times :-(
' h1 |2 v5 k6 E/ S3 `+ c2 \5 ~4 U: b" C3 z% d9 }
-or (a bit) faster:
* v/ O, G8 u; w   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) \- V. m9 V1 U, R, P0 f8 V" r
7 B# X6 R. o% q# Z0 G7 p   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 M. J* P1 Z' Y* H) G1 P! \     ;will break 3 times :-(& w1 P* g# h: t5 ]/ j( W3 {- ~
9 [) d& w1 B: V) F, e
-Much faster:
( P/ v. n7 ?$ @& o   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 i; P* Y8 w( l( L; t6 S
  W/ I7 V& H" m# Q7 zNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
! f( A6 C, H! C) A& nfunction to do the same job:
7 I5 y! u4 N* m: z- W6 }
, f( F9 T' P2 L0 I) Q3 ~   push    00                        ; OF_READ
! G. J1 Y/ t( q. u5 \0 i3 n   mov     eax,[00656634]            ; '\\.\SICE',02 {1 N" S! r5 o# R% x; r$ G/ P
   push    eax3 A9 w/ d2 Y7 y9 b( b' c
   call    KERNEL32!_lopen
: y4 [0 l) R/ E& y   inc     eax
( Z8 \4 ?, s. c; A* K   jnz     00650589                  ; detected
1 F( V+ S* P7 k% T3 d( J; Y. M  S, p, T   push    00                        ; OF_READ
) ^- [% g- t( a* D* I- y4 C2 k. E! G' N   mov     eax,[00656638]            ; '\\.\SICE'
$ c4 e- U. L4 E, X2 e1 J( m$ y* {   push    eax
7 D: p+ s* T2 i1 M5 p' P7 M( ~   call    KERNEL32!_lopen
; I* V/ \$ h( k- Q   inc     eax
3 @' O: q2 t9 a1 g- ^6 w% p   jz      006505ae                  ; not detected, ^0 h6 Y( N* m' f' r: b7 }) ?

) H, J. C* O- T+ f8 A6 e& l' {! I. h
__________________________________________________________________________
  W2 [: n. Z8 U, \  Q4 A
% E9 [4 L* y$ l" V7 P: P3 IMethod 12* f" j# R8 B) b
=========
8 Q# p# v+ h/ B6 Q8 R) {! B/ p0 w/ z9 ~
* M& }& n3 E+ O, r! m1 `( {This trick is similar to int41h/4fh Debugger installation check (code 05
7 t# h7 E" H: B, W3 H- X, W&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 y: d3 q( \9 w, o3 D' eas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; h* c: ?5 H1 n; ?' [0 Z8 y* z' F7 p* M$ h7 j8 @2 u" B! J
   push  0000004fh         ; function 4fh
, c2 \2 I8 o; r3 e. o   push  002a002ah         ; high word specifies which VxD (VWIN32)9 U) d3 ?5 {; R1 J: }9 m
                           ; low word specifies which service3 N" T' [, q" d: ~: S* H' O2 p
                             (VWIN32_Int41Dispatch)0 I6 E4 R. D! v: F6 Y2 ]8 Q( G. y
   call  Kernel32!ORD_001  ; VxdCall
9 L' I" ]$ ?5 p. C. j, d   cmp   ax, 0f386h        ; magic number returned by system debuggers
( g) E' N1 l* |1 T3 c   jz    SoftICE_detected
  L7 x0 x: N& l* r) \# x
! {' `9 h; f4 q1 N, wHere again, several ways to detect it:% j7 E/ C/ e4 E' T/ C' l2 f" u, `
9 h8 W! [6 Q. H: ~7 ?
    BPINT 41 if ax==4f; V/ F+ y* F) F$ J0 Q
7 B8 C/ G8 M- Z& U
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! L; H# {+ H7 }" g* ~

  u- i1 a0 H# s9 I% |/ Q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ b- z0 E% l! x$ Y$ y+ F4 r( Y! \. ]- U: b: |
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 y% w& L& z: c/ B# B6 }6 T

% J1 D' \8 I( |6 K; D3 ^# Y__________________________________________________________________________
! u' L4 l: G* r6 A# }) n
/ e. @) m% O  S- zMethod 13# V5 `8 e( j6 F# F& p4 _
=========
% A3 b3 }; y5 a6 @- g1 Q
$ }# x; C8 n9 Y0 Z+ \# o, fNot a real method of detection, but a good way to know if SoftICE is
* ~. y; F' z/ tinstalled on a computer and to locate its installation directory.
( ?% v6 S& @4 l4 w. WIt is used by few softs which access the following registry keys (usually #2) :
; V# v9 n3 p  p- F8 K2 Y7 R7 m! I; p/ z) d  X2 p- b2 r) O
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  A9 e5 E' Y4 l+ j4 X) `" P: I3 [6 d\Uninstall\SoftICE5 \6 J* i& g. D6 [, [
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* I6 L; p3 v7 ^" j8 S; {. }$ J2 M-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* H& E  c& J% o5 w
\App Paths\Loader32.Exe: ~/ ~; Y& g$ a

% p+ Y5 g! o" e+ J: M6 \6 ~5 R( X) r( T/ T
Note that some nasty apps could then erase all files from SoftICE directory
; [# c* F2 Z( B  v(I faced that once :-(
+ j) U# R) U8 ^3 C
/ p2 g9 P" D8 o' }Useful breakpoint to detect it:; k# Y5 l# k# R6 \9 d% e% B: b" r

' G' _2 _6 t& o0 ?     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
2 z" s3 _! H5 [8 J8 _  q4 i# D/ i& I  |$ u
__________________________________________________________________________
  r; T) T7 `0 t  Q# F  N# d7 `0 w0 ]$ r4 U5 }' x

' i0 B( s3 n5 w- i0 nMethod 14
! b, f9 r3 C  A2 f7 K$ V6 u% p* w=========8 G+ Y# @  V( G  w1 a
: _6 P2 v. T; g( D
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose8 I# \; b: l8 T9 p: q' M; u: W
is to determines whether a debugger is running on your system (ring0 only)., v: ]9 m' p# q) l- `5 e

+ L4 q: f: |; n. c% B   VMMCall Test_Debug_Installed
' @2 s8 R3 j9 H. U3 i   je      not_installed, ?  p- J, q$ O. s( P
  a2 c. [. x+ Z6 a
This service just checks a flag.
" o0 R. v5 ]! E* q' k/ h0 F: K& o1 K</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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