About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 d) c: e1 Z- [6 s9 l<TBODY>4 g  K0 m6 O9 N0 n1 R
<TR>
9 R, d: V( c& K3 I5 U9 g) ?<TD><PRE>Method 01 ' O6 `) G7 D/ P( R% G: c9 y
=========
7 o1 ?- R1 o' ~$ _
+ P: |' ~- U8 L/ }; w: t: }/ Z" x; _4 eThis method of detection of SoftICE (as well as the following one) is$ y& X3 Q( K7 n5 z5 P1 P
used by the majority of packers/encryptors found on Internet.; E7 B, E4 s# i4 y- Q- {. |6 L
It seeks the signature of BoundsChecker in SoftICE
  R# R& S$ G" I3 s+ i( j, |
" k5 ~' U! Y) d. \    mov     ebp, 04243484Bh        ; 'BCHK'7 g0 f5 ^8 C$ F: P+ m
    mov     ax, 04h
2 r; }% W, P0 E) ?8 G" A3 C% a1 ~    int     3      
: |1 z8 Q* x. E( Y9 C    cmp     al,4% H  _' K( V5 F0 \: e) z
    jnz     SoftICE_Detected
6 b0 V5 q2 G& B9 ~9 `
+ k: i& E( ]8 D# a0 U% ?___________________________________________________________________________8 j% r( w6 L+ ^; t7 V& s
, i0 p7 P1 m5 i' V  I) Y
Method 02, {1 h: N5 d- k
=========
: N" d% @8 h' Q1 ^' U, f* y0 F  w5 B( H1 d' w
Still a method very much used (perhaps the most frequent one).  It is used
6 w, B8 B+ F! N! Tto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
" E3 Y& ?1 }  n, v8 |7 ^! _' bor execute SoftICE commands...# ^* k0 u. ^/ V# O
It is also used to crash SoftICE and to force it to execute any commands. s8 y/ R6 R* j  ~$ J
(HBOOT...) :-((  ) a% N, C8 M" z9 k
6 x& E4 S: |: a' O" z! q
Here is a quick description:
, v9 P; z2 C2 B# l- |+ N+ i-AX = 0910h   (Display string in SIce windows)
! ^2 ]& ?# s" ~, k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& R2 c. s+ i& _-AX = 0912h   (Get breakpoint infos)" [9 I; a4 J/ p/ l- J
-AX = 0913h   (Set Sice breakpoints)0 e$ @. f; x" O1 p
-AX = 0914h   (Remove SIce breakoints)
/ D7 G, a* D  W, `! y! b5 w3 t* U% j
Each time you'll meet this trick, you'll see:* o* ?  w' G, m; I9 y% x4 P4 N
-SI = 4647h
# c* b. E* D( N& Z0 T-DI = 4A4Dh5 a% y. Q- N' z
Which are the 'magic values' used by SoftIce., ?- V  F' F4 s: W0 s1 U  r' G# U
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, F% }. [! \! |6 n( S( Q
* P, v# _1 s; Q+ n! @Here is one example from the file "Haspinst.exe" which is the dongle HASP) L! s! g2 p) L' j# U/ B  p4 q
Envelope utility use to protect DOS applications:/ W1 G" {" b" _1 D% x( N% B6 @1 F
8 S! O5 r* p( w  U: H# n

, {9 O+ e8 x( ~) m. F  f4C19:0095   MOV    AX,0911  ; execute command., o6 Z& E7 z& W  P* T
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
8 k6 Z6 [- F9 f3 [8 z4C19:009A   MOV    SI,4647  ; 1st magic value.
1 R2 |0 l" i2 a+ X/ X) U, V, r4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
$ i' m: h/ S7 k/ ?% d& E4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)$ j% i0 [- V4 f8 y; w
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. a: `0 u  R+ O- V$ S: w3 P
4C19:00A4   INC    CX( v  r$ j8 n2 R# R2 c$ u8 `
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) h, n1 @  H) j4C19:00A8   JB     0095     ; 6 different commands.
6 h% ]9 l, f: W( q% ~4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
( V+ v3 ?' j. c. r% S) y' J' x4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)( c! p+ \7 V5 a2 V8 W" ]
' y2 L  B4 s5 q( M% l0 a9 S0 G
The program will execute 6 different SIce commands located at ds:dx, which. t! K6 y5 v! [" o" P! a
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 s- E9 e+ P0 Q% ]+ _! [( S1 g8 u
& j% ?- p- h, f, f$ F3 O" l  m7 F* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: T1 K+ B9 Q7 H# H, G( t___________________________________________________________________________1 o( a6 y0 I& U5 G8 T& h
- n4 ]9 f1 q( |! s$ \" }

+ h! I( X3 z* w0 g2 @) yMethod 033 n. V# F' t( O. t- A; s
=========
" x9 F" w0 d- b7 ?' G
  c- H8 a# _5 w) H. v" [  N3 N' CLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ B) ~9 T+ R3 M1 A; m' ]- O. ^(API Get entry point)9 d- w. g- b4 G9 |
        
; g$ W% W0 V1 p, m/ _+ J2 x( _( {% x. k. [" ?$ z
    xor     di,di& _; X& x' w+ D+ ^& Z1 B
    mov     es,di
$ y5 U& [0 J6 p4 d1 y    mov     ax, 1684h         u* ]; Q4 I. w: S7 p& Y& E
    mov     bx, 0202h       ; VxD ID of winice
& V1 T/ h8 L* p+ o. z& @8 r% r    int     2Fh
: b0 J+ N* m. I  X) e7 r$ I' ]    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) X2 Y) t3 t4 b: N" ~    add     ax, di
/ l9 v5 f9 r, P, G    test    ax,ax) ^8 M1 G$ e$ r5 M0 l( }
    jnz     SoftICE_Detected
6 X' p3 j' l+ y2 H) k& v7 S7 b  A1 }5 ]! H4 }
___________________________________________________________________________
" G2 K& j) A% C% e
  j6 P7 [4 S: }) B( [' iMethod 04
/ v7 _( l- R3 @6 ~# ]- w: X3 U=========; a' i  F5 \- ~! H

9 C& z  G8 v4 d* J- ~Method identical to the preceding one except that it seeks the ID of SoftICE' Z7 D8 S) X2 y& O7 r9 S* ^
GFX VxD.
: P* m- L5 l  G, D. S6 F
) L- G; r! c# a    xor     di,di. ^5 b! f1 r% |3 K1 O3 _
    mov     es,di' F( I& T3 l8 T8 n
    mov     ax, 1684h       . b  q! G! d( _% N
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( V7 l4 a: h+ u; Z# {' ]9 k    int     2fh8 h4 y0 i% F$ Y* ?, \# x3 \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 _% V# N- ]# \5 P    add     ax, di
4 E; K! E# t% M( j& t2 u    test    ax,ax
! d3 [! a' T+ M- J- I3 W$ O    jnz     SoftICE_Detected
% x0 R; r7 O1 j$ k. j9 R2 U3 @
8 _% E2 {/ Q& M__________________________________________________________________________
5 F1 t  t  e% ~/ N9 O5 n6 F% P( l; H5 Q0 e# r- o$ i( Q7 N: j2 d
( `* R# a3 B* W+ X1 L" L: y* u
Method 05& X0 J( y6 i, |  P
=========
8 B9 }. p+ S  k/ l/ V
4 c' Y& z+ A7 [- o, |Method seeking the 'magic number' 0F386h returned (in ax) by all system, a% ~# J5 a+ A; [
debugger. It calls the int 41h, function 4Fh.
( @8 |( h2 f. ~) S& `1 ZThere are several alternatives.  0 p4 |0 O, r8 s% |2 H3 R7 M9 o
  P8 g; W3 U8 n9 R/ B
The following one is the simplest:4 L0 e0 M" P3 k* i) a& Q* G

( V. f- G. }/ E6 e! V3 e* Z    mov     ax,4fh6 C9 ?  a+ F6 r) x, M3 C& U' X
    int     41h+ G, O- Y+ R& C& ]9 o2 l
    cmp     ax, 0F386
, s4 z# M7 T. w( c& J2 b    jz      SoftICE_detected
  e4 Z9 J. \# _9 W# D
" i7 g. s- p+ D( K# w& ~. I# |: h( i# `
Next method as well as the following one are 2 examples from Stone's , z9 a/ ?5 f, @# ?/ A  K
"stn-wid.zip" (www.cracking.net):" S! l1 Z4 S- r+ _8 a
; h$ r1 v& R, ~% j, ?) I2 _. ?
    mov     bx, cs- Z9 ~# j9 v* t
    lea     dx, int41handler2
  f  U8 y* _( q/ Z3 S* i( e  v' o    xchg    dx, es:[41h*4]
$ B! O% x+ V2 \% E' t* G) Y    xchg    bx, es:[41h*4+2]
+ N$ z' G+ ?! h. |" D  ?6 ~    mov     ax,4fh
* M# q  ~% I* g! c    int     41h5 ~- A. k) f2 O2 P4 {4 i, Y( b/ K
    xchg    dx, es:[41h*4]
; }5 J+ _: S0 Y* j+ L& r# Q; R    xchg    bx, es:[41h*4+2]
! E/ s$ q+ w" ]+ j    cmp     ax, 0f386h
* M7 G  W- j1 }# K# _: ]. A; t    jz      SoftICE_detected9 n. _- ?! N/ O0 }
. A1 x+ p$ z5 o. ~5 F6 D
int41handler2 PROC2 j9 T) m9 F3 W+ d3 r4 ?8 ?4 p
    iret9 P7 Y/ ]& {+ z9 J
int41handler2 ENDP
, o- [7 R+ Y0 h; I3 l
. }& E$ h: O0 {( o8 R$ Q# R2 B7 F1 c- {3 ?; ~! r+ [$ a
_________________________________________________________________________! m1 v8 Q. l9 C/ @
! J6 q" l* l6 L1 m* J* P# _  \
  U; w, r# v7 O3 Y  \7 f6 j' w
Method 06
2 ^( V7 x# g$ k% L2 Z% \- q+ L=========5 U, r$ s" D& g& ?9 N* {

* c4 |2 ]# H) z
# j  u! Z! N' k/ z# @2nd method similar to the preceding one but more difficult to detect:
9 h: N5 g5 b4 V6 R- F! ^. ^: a
% N  ]3 C: o8 K% M2 E
' t- f- ^  m& t6 |$ Z- Dint41handler PROC6 P' }; ^( e5 N( ?8 E# }. s; q
    mov     cl,al
* L! e( U# X" V) ^1 d- J    iret
& d9 f. g# a- G% W- Mint41handler ENDP+ m7 U% T7 p. l# C/ Y& K( p
* _  C. K% }) l$ j9 Y
# O& p2 y" s0 o9 @" y* w% {
    xor     ax,ax
. N; ^' i- o! {    mov     es,ax& r7 }+ d% B; k) q  y1 C9 E
    mov     bx, cs
( d/ a1 w) j/ c! S; _! o: Q4 g    lea     dx, int41handler9 M) B9 `* d0 P  l  \
    xchg    dx, es:[41h*4]  p( D+ n. L: _1 r, ?* X# T1 K" t
    xchg    bx, es:[41h*4+2]0 U9 J% d0 V* u% G
    in      al, 40h
2 b+ w  S5 Z3 P8 W9 L* A    xor     cx,cx  p0 D1 T% H3 S$ D
    int     41h
+ {7 r, U4 n1 C0 P+ M. h- r    xchg    dx, es:[41h*4]. Q2 d/ R: B& h; n
    xchg    bx, es:[41h*4+2]' @) H) B+ s$ r! c1 o8 u
    cmp     cl,al
  v/ l% p! `( D, o    jnz     SoftICE_detected
9 Y) {& B$ c$ \' C- k! M$ ^) G7 Y0 V8 z7 |6 |9 X
_________________________________________________________________________
/ e; U. _5 A7 y. }- `' |9 T" _4 ?
& ~5 |+ u7 f# i7 n% l) }( XMethod 07
/ U- x  S' J+ v+ n$ c9 U; q=========$ ~9 M  C4 u3 S6 r# F* {$ K

- _7 {" V) e, D, wMethod of detection of the WinICE handler in the int68h (V86)
: `( Z4 M  d) u  U/ E
0 r& V7 G, i9 M; _    mov     ah,43h) K; u* r( K- X* G
    int     68h) k( o( @8 H$ W$ [
    cmp     ax,0F386h
8 n9 T  v0 C7 k5 h& o- v    jz      SoftICE_Detected
: v' ^1 y1 v6 R5 f# }9 }1 K; X
& H1 C. s  q2 g; \- v  X* u! e: e- F6 e8 Q. p) n; R" z- E: w
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% v" ]# F1 I& Z2 C! P, s% g6 b
   app like this:
8 k' g8 e! z4 v: V. D* o  y6 Z
2 H5 Q1 r0 R& j! ]; }. k& E( p# C   BPX exec_int if ax==68
2 i2 ?8 U& c# {( k1 D6 H# k7 X   (function called is located at byte ptr [ebp+1Dh] and client eip is# r* N. e7 R0 _; P" @- O0 p0 @
   located at [ebp+48h] for 32Bit apps)4 j0 S9 M$ U" W- i5 F9 C
__________________________________________________________________________
) M$ n3 o4 i9 f# S5 q5 M3 n( T7 e
8 g2 k+ G* @, n8 I9 h
* X$ w, x4 s% X  x9 Z# `& ]7 {& xMethod 08
. b# t) S: b/ Z3 h# i=========( S: i' ]# w# n+ \- p* V. }" U5 d# c

& G! U7 `, I  }$ AIt is not a method of detection of SoftICE but a possibility to crash the$ E" A3 d2 c1 H/ z- X/ H' B
system by intercepting int 01h and int 03h and redirecting them to another
; y7 H7 f  \: r0 D3 e2 troutine.- R) }$ O- w( v! B2 P: ^" b& e: T- D
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ v9 _9 c. h9 W
to the new routine to execute (hangs computer...)
+ E7 u- j: \3 U: _8 w  ~7 N) C6 U9 k! w% r5 Q2 }% }
    mov     ah, 25h
+ o% w/ S5 o0 y. C1 {, n, h# c3 o    mov     al, Int_Number (01h or 03h)1 b) k/ b! c, V; o0 M
    mov     dx, offset New_Int_Routine
* E6 j. F1 S& j4 V6 J- y    int     21h
! |  v! s# }+ |1 j9 ~+ w( {0 n" h2 o
__________________________________________________________________________3 x) j7 p' s- z+ h/ o
# G6 `' @7 N; d- h3 `% P; V
Method 09
  \( M) |, |' r# x; \% F=========
& Z/ X& C& B& l9 M0 R0 D4 E
2 R" {2 U- x' fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 \/ E1 i! Z, `: b/ H1 l2 P% c3 F
performed in ring0 (VxD or a ring3 app using the VxdCall).
# A7 {% r7 `2 Q+ v* c$ OThe Get_DDB service is used to determine whether or not a VxD is installed
' r; f% v: i/ ]- \( d; Ofor the specified device and returns a Device Description Block (in ecx) for
8 t; P9 d& v. L2 Dthat device if it is installed.2 R0 Q  N. u; w; x- T# b
3 G' ?; |; M3 h7 r
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ K. g8 N: R8 L- Z% @4 k' V
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" h6 z, u8 Z) R5 J; }
   VMMCall Get_DDB* Z* K9 _/ G& p( ^& L+ l. K
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: U+ Q7 Z, `+ V: K! N! h7 ^1 [$ X  n7 w7 @
Note as well that you can easily detect this method with SoftICE:; s0 _5 [$ ~  x
   bpx Get_DDB if ax==0202 || ax==7a5fh
) R6 Y% z4 d$ I/ Z% ]+ v
% I+ w' t, H, h. c0 [% ?__________________________________________________________________________
, j' u0 E9 j& c# @% B2 ^- J! I7 T! Z8 l4 R( P+ Z
Method 10
% Y+ V) h; B& S$ B( @=========
; H/ @, J5 Z7 f
: y* p4 e% i! P2 z( R! {=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with( C- B$ W4 a9 `: s3 n
  SoftICE while the option is enable!!; ?  V0 F. E+ z. v& n

; c; M& y1 M- d) yThis trick is very efficient:# w4 T5 h* T4 V+ W) l8 g& @
by checking the Debug Registers, you can detect if SoftICE is loaded% A: Q- T4 M9 O! c! y$ m5 @7 c
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 A5 N$ O9 d& V' D1 L( w( Q+ P
there are some memory breakpoints set (dr0 to dr3) simply by reading their$ g. J& ^/ o: |) o! b, Z; G
value (in ring0 only). Values can be manipulated and or changed as well1 ^0 W+ T! O- Z3 F
(clearing BPMs for instance)
+ k% ?1 \* V1 w% K* `- f& U  P! W6 p# ]
__________________________________________________________________________
2 _* c+ P& ?5 ?  ^1 J( m. _
! b( M/ l$ v" W3 E9 MMethod 11
  V. o. Q  @" n+ H( x=========
, o3 p4 X$ A+ o: i* t. @9 j* s4 R* E' `
This method is most known as 'MeltICE' because it has been freely distributed+ z8 D- ]( ^* v, a1 g5 g* P
via www.winfiles.com. However it was first used by NuMega people to allow9 b% h* H& _! x( p' T
Symbol Loader to check if SoftICE was active or not (the code is located8 C( ~: m8 Z8 o) u3 u. Q% N
inside nmtrans.dll).
* i$ a" n' o& d& n6 U) }$ O7 L5 w) A3 ^4 ^+ w
The way it works is very simple:+ Q$ I3 T# L" U9 F
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 M* Y! Y8 [, u. Z' r0 {WinNT) with the CreateFileA API.' c* D  c/ W* r+ ?/ @1 b4 u. M/ _! a7 T
! z+ U" @, u9 r: t* G9 R0 M& D
Here is a sample (checking for 'SICE'):
- Y4 N) V4 _- e
; [- ?! E9 X; F& n2 K. cBOOL IsSoftIce95Loaded(): Z* N1 X) C' a* V6 v
{9 i. w2 ~$ X! s! _, }
   HANDLE hFile;  , y9 f. W1 _9 K( Z% C
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
7 I# ^+ h, p8 H$ t                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 m5 X$ ?9 }5 q0 B1 _( H
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ P( W8 J1 Q- Q8 h
   if( hFile != INVALID_HANDLE_VALUE )
' D0 ^; }  N$ `) V) k0 M   {
) \, F2 f, ]; m% v      CloseHandle(hFile);
3 }! C. F6 ^! [. h  P0 p( ^- ]$ u      return TRUE;
6 q5 D0 E  G* C# T5 m2 U. P+ k   }
+ u% W1 A) f- ^$ v2 r   return FALSE;
$ _* s# k' l% @2 g}+ a6 |: g6 A- @& a* L

% c* q; `7 Y8 SAlthough this trick calls the CreateFileA function, don't even expect to be9 O- Q8 C. g+ ~" z2 |
able to intercept it by installing a IFS hook: it will not work, no way!; G3 ~% I7 [9 W/ h3 x6 p" F
In fact, after the call to CreateFileA it will get through VWIN32 0x001F" b+ b; ^7 c* [( C. E3 j5 b" t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 ~- c3 L1 v# X( W! i1 `* D, Y9 X/ Jand then browse the DDB list until it find the VxD and its DDB_Control_Proc# u+ X0 G7 B3 ^: W4 z8 D9 ~
field.
8 o# A( t  g; p: R7 X6 r) S& W4 ~: kIn fact, its purpose is not to load/unload VxDs but only to send a ! a4 B: H  K* Y7 E( M5 Z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# O! \7 a7 \9 G3 m" \! K  a4 I6 {1 W
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
# F: C  b' q' S' D. G6 J5 Mto load/unload a non-dynamically loadable driver such as SoftICE ;-).
: `- e! @, t1 b6 [! [& L) lIf the VxD is loaded, it will always clear eax and the Carry flag to allow
3 W) |  ^. N8 V8 b) I8 E4 Dits handle to be opened and then, will be detected.7 A6 p# p) H' ^' C2 M0 G& G4 H3 H
You can check that simply by hooking Winice.exe control proc entry point
. g$ Z) m+ K: Q2 V8 S2 `( L8 twhile running MeltICE.
# {5 M6 h# ^/ I7 T
, l. @0 s7 E& h- \, ~. H7 A- r0 _4 M/ x* C
  00401067:  push      00402025    ; \\.\SICE# h5 F/ t% `6 N& r
  0040106C:  call      CreateFileA
' ]& |1 y+ r% H  00401071:  cmp       eax,-001
1 }* V: F; J+ N$ H  00401074:  je        00401091
) ^. P' P) n" u
; D- F; M. W8 @& F
- H$ P; H. a& W- d( C3 X- W5 UThere could be hundreds of BPX you could use to detect this trick.) h5 O) D; ^' A" o; n
-The most classical one is:* X" T5 D2 S0 o7 D- n  [8 ?
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 Q( \$ v. T9 g' R    *(esp-&gt;4+4)=='NTIC'
" x5 f7 o' G6 Y0 L$ v: r# N8 O0 Z
-The most exotic ones (could be very slooooow :-(
! v# n; l: L9 f% A" Y   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 E8 s+ C% y2 ?# Z     ;will break 3 times :-(; d: p2 x' w, @' I& I% L( b
3 }$ M% _6 r' O- X+ E4 u4 m
-or (a bit) faster:
" o0 M4 @( L. I. H7 Q  }* J, E  g9 e   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 C( P1 Z3 f1 s) j& [

" X" K2 s3 D, K! o9 M7 D   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* [$ \8 v" x% P+ w+ ?! b/ h     ;will break 3 times :-(3 U5 ^# Y% x8 ^1 Z, [

$ i. m1 q) q: G-Much faster:7 I% ~- X7 m$ e' |# M
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 m' G. I; I3 O2 r. r$ U! b8 V3 s- y1 v5 J0 b6 @
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 e( B% u' ?6 I5 [
function to do the same job:
7 D8 B) b5 o! O) w" d6 C3 r& W
, t# s" j  V$ z' x# w   push    00                        ; OF_READ
  R/ a& G8 C" X4 J3 O9 ^   mov     eax,[00656634]            ; '\\.\SICE',04 G. u7 A+ S- R& x% a2 |/ y
   push    eax7 J2 N9 F# Q* \9 Z" Q1 b
   call    KERNEL32!_lopen
0 Y! t4 G$ h( T* I   inc     eax' J+ V1 p( w2 v' H0 y9 X
   jnz     00650589                  ; detected3 @; ^- v# x$ A* v
   push    00                        ; OF_READ
8 K# j: Q. `1 {0 G   mov     eax,[00656638]            ; '\\.\SICE'( `. u4 d; l: c
   push    eax
* N$ l; h' I* j. X   call    KERNEL32!_lopen. M) F( X! E8 j# t4 Q/ N3 V4 e
   inc     eax
# I6 T% h' x0 t. H& P: _# {  n2 m   jz      006505ae                  ; not detected; t- s0 r2 i2 E
( T# |3 e* N& a

! D2 X3 Z  E! D( ~; x' o* }& I__________________________________________________________________________- ?% ]  N" Q+ U

& r+ Z. _. D5 ?, GMethod 12
( I7 C: E# I: D7 w=========
. J' U9 k- z3 k' U! i4 D
5 P# }, t1 v! EThis trick is similar to int41h/4fh Debugger installation check (code 056 H# L& P! Z1 D0 i6 I* O) Z1 J
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 S; `* W0 _6 M5 bas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: F: V' n; n8 ^) A& |
, S3 _- r6 @# K$ B/ p   push  0000004fh         ; function 4fh
, x1 @( i" q2 g, _# I) H: m   push  002a002ah         ; high word specifies which VxD (VWIN32)
" W2 f  u  f2 `* w0 A                           ; low word specifies which service
: x0 L: d6 |6 E% J. f* A                             (VWIN32_Int41Dispatch); B& {7 }" O0 D/ g+ E# T1 L
   call  Kernel32!ORD_001  ; VxdCall
( L+ N5 f5 C3 w- {* h7 P   cmp   ax, 0f386h        ; magic number returned by system debuggers
. a7 p/ e  F2 Y, A/ y/ V   jz    SoftICE_detected
, {5 U$ D6 B0 t$ o( h6 X3 J5 N! z% W- m' T& D0 Q
Here again, several ways to detect it:
' Z7 |1 b3 B/ N* [& R" j" Z5 P, C4 l! g0 v9 `$ \( K8 k/ K
    BPINT 41 if ax==4f) H3 |- ~( c6 ~$ P- j4 T9 m
" p% Q$ R: [- T8 [& P
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! `! o0 z  a1 E  s5 s, g1 s+ h8 D3 k5 W3 T
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 g4 u$ J- t$ k! f3 }* J7 w* H

4 d, L2 u  n! N1 U    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!/ j( F* W" Q5 _5 b6 j
6 e7 a$ T+ `0 ?* _, o
__________________________________________________________________________
/ |( H3 c5 J3 s  N4 t. v9 C) H' S% n: Q
Method 137 o, q: U. A2 s8 c" h
=========
6 |% D% W2 p- _7 a
, e' @' R5 T/ u1 D7 C5 XNot a real method of detection, but a good way to know if SoftICE is
: j1 p4 U  N$ q8 k/ finstalled on a computer and to locate its installation directory.! a2 H' p/ _# d& l- k+ x
It is used by few softs which access the following registry keys (usually #2) :
0 g4 ~+ b$ s6 P. d  _, M2 s' _) ~$ E& \5 P; }
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) p/ F3 X2 ]1 Y9 ]\Uninstall\SoftICE6 K# g3 [$ w7 a- I. M
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 t* J  @2 q9 v; ~
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: v; o% B4 u0 C: z\App Paths\Loader32.Exe/ ]5 M, d: z/ a" H+ ?! T

- u  w9 Q: ^- Y# T1 \* N! ^, [0 w# T7 a. X* S* |2 d
Note that some nasty apps could then erase all files from SoftICE directory
( M- `) `# b6 F4 V& @8 u/ J(I faced that once :-(4 w( K2 q! _( }0 o: f; ^

  u( a% Y! L5 s- b/ X1 AUseful breakpoint to detect it:
* ?9 V5 P8 l9 ^1 \  [" v
# z* T  ^) Q5 J: p$ U( V) K& D     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 [; [* v2 S6 G, G' _( {* \, ?" t/ B- N  G. Z
__________________________________________________________________________
0 D1 `2 H$ b6 I% V0 P+ _( B2 V+ i" m3 P7 m0 j6 F

4 }) O! z1 ?0 ?Method 14
" H7 S% }* \7 ^' {* k=========
& Q5 `) s& g* H/ J
: F, P2 K  l0 ^A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* L; X6 |. r- ]) |! q; Kis to determines whether a debugger is running on your system (ring0 only).' i& U# w! s! ~3 I5 _9 _4 p" Y6 B9 D

( i) [; Z* g  m5 w- K7 x   VMMCall Test_Debug_Installed4 J; @& a. z- U5 S8 l4 k
   je      not_installed
: i7 q, s8 _. k/ J# _1 w5 ?. o( f  |* U- F! X
This service just checks a flag.
! B! \6 c$ g& H+ g. _</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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