About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
2 I2 C6 p" V( X<TBODY>
7 z% q% f* R0 L( U<TR>3 Z: E( F9 C! o3 J$ P3 R; Z6 M- u
<TD><PRE>Method 01 3 ?5 P3 q' r# M) ]7 |  L! s
=========
: D7 |9 O! ]' t4 r/ K  p; ?3 D5 X, [6 S) e9 _# N) H6 U; q
This method of detection of SoftICE (as well as the following one) is. V( J2 H. F, I6 N6 T3 K
used by the majority of packers/encryptors found on Internet.
! e- p8 m7 r0 Z' w. O+ D% W, I& jIt seeks the signature of BoundsChecker in SoftICE
& {- Z7 G7 F( v6 S& m7 h" Y8 D; K5 l, G' w' s, M0 n
    mov     ebp, 04243484Bh        ; 'BCHK'8 Z; i: ]0 H, K1 f4 o3 x
    mov     ax, 04h
/ u9 m3 k6 d9 J% W6 j$ J7 W7 E    int     3      
( g7 }( ~2 {" o    cmp     al,4  ]3 l2 t, u1 ]/ d8 C% ~4 _
    jnz     SoftICE_Detected* K* Y& q# B# R+ g- l( F- W; o9 z1 {6 p
( n+ G8 p/ G8 E+ f  r9 R
___________________________________________________________________________
9 S! C5 s$ p7 J! C3 G: P. h* G$ Q! g+ v+ r
Method 02
/ d3 G4 R2 c) z8 w& j3 X  X=========
! E3 ^3 @7 |5 u" f) U/ P3 I. r! a# w2 @4 j) j4 f9 U1 ]1 K
Still a method very much used (perhaps the most frequent one).  It is used
# P4 T! n7 r- R) p6 ~, jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 P3 r) Z7 g1 X$ B, ?6 `- Xor execute SoftICE commands.... L0 P- Q: S6 o) k2 P3 g
It is also used to crash SoftICE and to force it to execute any commands* C" V# R3 i" U" [
(HBOOT...) :-((  ; C" G" e1 m1 }/ M
' u  ^6 h3 e: O; @- f6 s
Here is a quick description:- L' K: z- G% P3 V" d" x, X
-AX = 0910h   (Display string in SIce windows)4 L  q' y- P( r7 |' S7 b7 D. m
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% R3 {- k! g' |
-AX = 0912h   (Get breakpoint infos)
4 T% P9 Z% q3 O! C- Z7 u& H-AX = 0913h   (Set Sice breakpoints)7 N  O3 _  d) h& P/ b* Q+ O
-AX = 0914h   (Remove SIce breakoints)
, [8 t& C7 p$ N# r* W' D9 G
: D. [' j0 B9 Q$ E1 O$ D2 bEach time you'll meet this trick, you'll see:6 F9 ^( x# N+ k& w5 u
-SI = 4647h. X! v% R6 S) T+ P+ f( _
-DI = 4A4Dh
4 ^+ U# [, ~- b8 h$ E1 Z. SWhich are the 'magic values' used by SoftIce.. d) c+ P- b* {' P* i
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
* K) ]( z, ]3 ~3 T% t0 L
. `$ v! b1 m7 T5 {( FHere is one example from the file "Haspinst.exe" which is the dongle HASP
8 P6 u1 z6 N' V; s/ REnvelope utility use to protect DOS applications:
) X! n- Y# n. c! R; t$ h8 X( G! Z4 @( y& x* b

& U- c" K4 n/ c$ ?4C19:0095   MOV    AX,0911  ; execute command.
7 g" V. `' T  \4 y7 l9 ^8 v4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* x5 }) J( f# t8 m; R
4C19:009A   MOV    SI,4647  ; 1st magic value.
- Y) Q7 L, }  o7 Z' H3 p4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! p. B4 b+ r2 a/ T. {9 n( v& Q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' l; ?8 ~3 J. B& v. e9 p% B  X& [& w  Z
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 Z2 D% Y2 C1 Z6 \/ w; h- M
4C19:00A4   INC    CX. a) z0 ]& I: r2 b  r) P4 S
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 }$ R1 B) p) z* K/ V" _
4C19:00A8   JB     0095     ; 6 different commands." p% @, K8 k: }7 p/ V3 Q
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 }" `# b1 A/ L! ]7 b4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 h) l4 r2 ~" P3 ]: V1 i$ w
0 l. v! s. [" W7 X7 y5 Z
The program will execute 6 different SIce commands located at ds:dx, which+ {5 G5 C$ t+ a% E. |/ Q8 z
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
5 ]0 [; e6 i' b  V8 P
2 {+ \0 h8 N6 \* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; e2 V( S- Y8 T4 p___________________________________________________________________________
! @- ?  m- w' e; v
. l' x3 {5 ~6 X. E# i- N+ ?7 l$ h/ x, L9 _% V2 q, \
Method 03; C% J* ^9 T% n7 v/ S% U
=========5 [) B! A6 `- q) ^

* R2 B; }1 E! \0 f! g. g! nLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* E7 N! X4 _$ ]  `(API Get entry point)3 k/ @; D$ J2 [1 Q8 v" Y3 @
        
1 G3 L8 D/ ]3 E* z: S
7 a6 x( M4 {2 p- B$ X" v    xor     di,di
: _: }8 D( \1 q7 u: r    mov     es,di
" F$ \: f+ D& {    mov     ax, 1684h       ' s8 `. B$ n9 c4 _* V8 F( N7 R/ D
    mov     bx, 0202h       ; VxD ID of winice
) T1 D, y) }! t4 H    int     2Fh
% @7 u# C9 ?* C4 \% u    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: a( Z$ M* `& E# I' f) y7 w    add     ax, di
5 Q, h6 c8 \- v, h2 W1 A    test    ax,ax
5 ~5 f. n1 L+ ^: Z    jnz     SoftICE_Detected2 P3 i9 k( L8 O: K, ?3 x, e: x
! H' M- d0 h' V! Y9 R8 v: o
___________________________________________________________________________" g- |' X8 h7 ^: ^

3 ?; z$ g0 u' k6 zMethod 04
6 P# H* T9 T+ t0 `# {=========
& m- n  Z$ `/ D8 f- J  M; A9 W* T5 `
Method identical to the preceding one except that it seeks the ID of SoftICE0 X5 |0 Y8 U, X$ }  `# r$ H0 a
GFX VxD.
$ w0 `" H( W5 {: v5 w
) T" u, D/ m4 s2 @! S    xor     di,di
2 f+ ]* e4 r) u8 R9 ]$ {3 T    mov     es,di9 E) B; P) \& ?$ A* m
    mov     ax, 1684h       5 {# f4 _8 s; `* S$ G3 `* F: P" R
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
- h# x/ e$ V2 A0 D    int     2fh, {! W! m3 y, Q8 w1 a2 ~
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; a3 x7 U( ~& n5 P; l7 a& A+ w; ]
    add     ax, di; n0 [, }6 `0 G: ^+ h# z
    test    ax,ax- W& m4 C* b0 Z9 m  T* ]4 ?# ]
    jnz     SoftICE_Detected
0 I. l7 G' e$ a% j( b& ?/ r
+ s1 a! x2 M2 Z4 T% ?__________________________________________________________________________# t# a" H" Q- f

  k: [" i# J6 ~, j1 @1 b; j
! o* X2 ^0 H% ^( O% Q# c5 t- xMethod 05
$ A( T. N' K: W- H9 z=========% s2 O3 P1 N& c" N
( q7 d8 o. L1 g" B% W3 S
Method seeking the 'magic number' 0F386h returned (in ax) by all system) k$ Y6 X  A7 a/ m7 Y2 q
debugger. It calls the int 41h, function 4Fh." h: ~* F0 \4 Y5 k; }* v1 r. \+ _
There are several alternatives.  ( E; W" [( O. _+ ~! Z) d

" \. \9 P2 P* {The following one is the simplest:0 y; W% t* i1 R2 t) ~# m& A

) E2 t' U: |+ z    mov     ax,4fh
, w! O( G7 e' E; B+ C2 R    int     41h5 X+ G6 w' u( m% y; T! b
    cmp     ax, 0F386) b7 T$ o# J! U4 }/ T
    jz      SoftICE_detected. E: e2 k% ^. C9 X" i* T! G5 o; p

6 p' x9 d. ^6 \
/ d3 V8 v# L* U9 i4 d- SNext method as well as the following one are 2 examples from Stone's ( r4 M, N, {7 o6 ]' U  J
"stn-wid.zip" (www.cracking.net):$ b$ b; q$ r5 O" c; \

/ b8 q$ z1 j. r5 K+ Y5 I    mov     bx, cs5 B  k; G; Y2 j+ y# l7 Z& a( ^* [
    lea     dx, int41handler2
) j- z6 S6 V9 b0 w' o    xchg    dx, es:[41h*4]
  Z# a2 }, S' V. j" d5 Q    xchg    bx, es:[41h*4+2]$ e% F) l& c* X( |3 h- O
    mov     ax,4fh2 @: \* `* ~8 j! K
    int     41h2 d# c5 r6 Y! e1 b
    xchg    dx, es:[41h*4]
" B& x0 x; ~$ G1 N    xchg    bx, es:[41h*4+2]7 R8 v# f# h1 w/ @9 I1 v
    cmp     ax, 0f386h# q. q% }' ^' D+ D& T
    jz      SoftICE_detected/ n0 d; o0 l1 a$ `) r  [# K
, @$ m  C9 s& {( w( u" e6 Y7 }" W: F
int41handler2 PROC# K; n" P" w2 ]2 k- g
    iret+ G9 Z, v" ]! U% T$ {2 N9 }
int41handler2 ENDP
# _" s: [0 [5 u0 A4 r* k8 Y  ?9 o1 Z" R8 P* q
: E% A: B+ `3 r: {. J
_________________________________________________________________________
5 n8 |1 `/ d1 u  N3 z& ^: x- [
9 M% L* ]" Z% W  r0 d1 j  @4 d- \8 z# ]5 F
Method 06% o6 G/ Q; U* O1 j" U/ L5 w: Y/ k
=========
7 s' E" {8 D4 T' S
/ i  P9 f9 f7 l* {- i" b' M! n
. N% c) [; Q+ S0 d, ^2nd method similar to the preceding one but more difficult to detect:
8 ^- v2 @! n8 ?' X$ Z
  T* W/ c0 i* ?2 ~. [5 v) J) @5 q! d, Z5 b
int41handler PROC5 `  k7 A( X6 D6 b  G2 V& R3 R
    mov     cl,al# N. u5 [& t" P0 F0 M
    iret
* F& w3 n8 P- N) v: b7 a) vint41handler ENDP: V' t. t/ \6 m) t, {) f
$ L1 F. X5 ~8 v5 M+ c, f
' S" ^: @$ |! r& |( H; b) Z( |2 i/ w
    xor     ax,ax5 G0 e3 _1 f/ m* k: u
    mov     es,ax
$ m# V5 K% K  L7 q9 m! v    mov     bx, cs  N/ o/ `% ~9 K
    lea     dx, int41handler
) G& Q0 k; P) P. y6 b5 J. @/ G    xchg    dx, es:[41h*4]
. P$ @% W1 U: |+ d' P" {% }9 |    xchg    bx, es:[41h*4+2]3 |& ]. U. U: S9 z' z
    in      al, 40h
$ G; [" N5 J8 j5 ~$ r    xor     cx,cx5 z+ U5 J0 d& p0 {/ K
    int     41h
0 H0 n# k3 S/ r8 ^0 t: Q, M( }    xchg    dx, es:[41h*4]
9 E$ b) p0 H) J7 s' V* h4 j. e    xchg    bx, es:[41h*4+2]
  U- r, e) f! J" _3 d) [    cmp     cl,al
* \8 D  L! ]+ D7 H4 k    jnz     SoftICE_detected( `5 t6 g% F& D5 u0 c" ?
$ z/ E. `9 @: m" h' s' F3 y: o
_________________________________________________________________________
$ s- v! w6 O2 C  M: v) a' x$ O
# w) B% w" I/ l, sMethod 07. d4 ~/ f1 u) H1 Q
=========, W% `0 x% u* v% E* r$ T1 A

: d; f1 M# f7 A7 T) S6 vMethod of detection of the WinICE handler in the int68h (V86)- i! d" V2 _% k- R7 L( M

" C+ T0 T- r6 n7 \. _4 Y8 L    mov     ah,43h7 C( i+ N, T8 H  C# P
    int     68h% n0 y& ~; L( t* S$ C% ^
    cmp     ax,0F386h. M  q0 w6 P1 [6 s! X
    jz      SoftICE_Detected
+ F' k: F+ `5 Q7 m$ g
" c" s; c2 e" r
* o. E- j- r0 G/ g* h6 w! N6 w=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# y1 T8 e& O- l) r
   app like this:  c6 q" F, Y  G8 m4 W$ _
4 y* l- {, B( y$ ?
   BPX exec_int if ax==68# \* |5 \8 @7 n- q, T
   (function called is located at byte ptr [ebp+1Dh] and client eip is$ Z9 g. B9 p, j0 W+ ~
   located at [ebp+48h] for 32Bit apps)# b( }6 Y# E7 D1 t& P; Z. o
__________________________________________________________________________# a9 j9 ^! J" i6 v: E, t
# g+ f* f7 F1 S' N5 l

5 j) c& x* e- N% kMethod 088 @5 f2 d5 D2 P
=========
; U$ A5 c/ A5 K+ n. |- {$ u6 t& r- ~9 h2 [2 X! G  |) r! B5 J
It is not a method of detection of SoftICE but a possibility to crash the  w# Y# f8 ]3 k7 ?) u
system by intercepting int 01h and int 03h and redirecting them to another
( N( u$ F9 F8 X. @: D& Q0 o* z6 Qroutine.
2 a# `& [: I) k( W4 _It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 q% P8 g* U5 q4 i
to the new routine to execute (hangs computer...)* _  m' _9 `* I0 _8 q  c
  ~, {* _' r  H' W' Q% G) j
    mov     ah, 25h
% J9 u0 C& O& b! \: @% C    mov     al, Int_Number (01h or 03h)# M, J# A5 x+ F8 T2 o8 c
    mov     dx, offset New_Int_Routine6 t; O3 b) q& }1 X9 `
    int     21h! Z& L, ^3 q: y. c- J; ?( m

7 @4 K( J. n, j1 q__________________________________________________________________________
- _3 y* ~" x" o5 h1 d' X
1 n, O* J! i8 l/ UMethod 092 l$ C2 x9 P" X+ Z& A! L' b9 F& U
=========2 W' p2 @. X5 O

4 F4 v9 B) g) _0 [2 JThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 Z( x" l8 [" e! O& W4 B
performed in ring0 (VxD or a ring3 app using the VxdCall).
; h; |, V. L- @7 |4 c8 SThe Get_DDB service is used to determine whether or not a VxD is installed
% c4 N2 b, Q7 J- m1 C$ M) r6 F+ h$ Cfor the specified device and returns a Device Description Block (in ecx) for. ^9 `! Z2 M/ q! P! |! o
that device if it is installed.
' M7 x# J, Q5 ]! R
& Y  P* C: c: H! n" r   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: L! p& @- o0 h6 }$ ]0 P
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). i, [" T8 [! [4 X- H1 p
   VMMCall Get_DDB3 y# e4 L" N8 o5 t
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& p% v3 w( `2 [; a4 c5 p( b3 c7 ?; `3 o  e
Note as well that you can easily detect this method with SoftICE:
0 r' N% Y1 G$ S# t( j8 v0 ~   bpx Get_DDB if ax==0202 || ax==7a5fh
2 T; A( Y( v7 F- G7 |$ `1 n6 P3 y1 u
__________________________________________________________________________
( w8 p( y/ O, }1 Q1 f/ |& _7 [, o- C1 y% P' h) i
Method 100 B- o" C5 m. }- U: a% j
=========
2 ^/ [6 m- o: F, j( W# p- F4 R  O4 c; L: W1 {
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ L1 {- `% x$ v0 u5 I  o$ f4 p
  SoftICE while the option is enable!!  ~% u. I2 Q3 Z% `, y8 J

; r1 ^- H) P7 \: o/ ]& UThis trick is very efficient:
" O' O4 d( s' _& s2 e; w2 iby checking the Debug Registers, you can detect if SoftICE is loaded
3 P. p2 h+ H9 i6 Z(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! W4 z! m% Z: ^0 y, a0 L3 V, b
there are some memory breakpoints set (dr0 to dr3) simply by reading their% C4 c5 q1 {9 F# U5 Q# K6 ~
value (in ring0 only). Values can be manipulated and or changed as well' b: w: B' U5 d* J- Y8 `3 {: l5 t
(clearing BPMs for instance)
  H$ `- \1 b7 E& }% _$ ]( _1 [$ E: m; t$ ~8 T4 T; y
__________________________________________________________________________. y9 V: l. ~1 H0 A
2 f6 x/ B* ]( r3 W: Q6 m
Method 11
9 p: w' b+ O$ j# W( b! G- x=========, B  a2 L, Q" R+ X9 ?
* v0 r2 c  z! t
This method is most known as 'MeltICE' because it has been freely distributed
7 c; {- K- g1 S* D) Gvia www.winfiles.com. However it was first used by NuMega people to allow
) Q( M1 V. u8 M& y  C' _' x7 rSymbol Loader to check if SoftICE was active or not (the code is located
+ K; M2 s. L+ g. f+ G: Iinside nmtrans.dll).) d! Z2 d8 t' r5 b$ ?: q# T2 ?

/ l* }1 {7 i; q/ rThe way it works is very simple:5 g0 w- G1 b/ W% ?: x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% T' {" v+ Y) d* f# P% H! KWinNT) with the CreateFileA API.
3 B# u' X( a' c" g' U0 b0 H0 ^7 c1 z/ o4 f. l2 T% U% g& V( v) E
Here is a sample (checking for 'SICE'):' N+ Q0 w3 M1 C5 Z
) \& F& n0 \2 C) |: J' ?
BOOL IsSoftIce95Loaded()
0 S* Z6 [7 |; `4 K2 r9 W{2 \5 S9 @  v* A7 D; x
   HANDLE hFile;  ! v7 y  H# {& L5 R' [
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,6 u1 |5 z6 F: y0 C
                      FILE_SHARE_READ | FILE_SHARE_WRITE,& }$ b4 E0 }+ q) r2 i% W7 [/ h
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  ~0 u9 q. V, ]. a' h& m   if( hFile != INVALID_HANDLE_VALUE )
1 X* q; w+ f0 f   {6 q* p% o8 T2 S6 T+ d
      CloseHandle(hFile);
% B$ S! ?# B, u      return TRUE;: S8 C  K( j+ Z+ S+ Z. |
   }
3 b' A# ]( Z) a* x% Y9 g3 z) w; @% c: }   return FALSE;& @5 t, v5 n' B, M# k4 T
}
: X: q# H( U1 h7 g
! X3 C5 r" k/ S' b: i. sAlthough this trick calls the CreateFileA function, don't even expect to be
  @/ G4 L6 m" E! F9 K; v+ |* vable to intercept it by installing a IFS hook: it will not work, no way!
5 ?" \  a) t/ D2 _In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 `7 D& H1 I2 m6 X% iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' i1 y" H3 _6 }2 p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" W9 @0 ?9 y% a$ b( v" V4 ]5 F$ v- cfield./ l2 T2 v& u, L- H
In fact, its purpose is not to load/unload VxDs but only to send a 8 z( L9 G$ `) s" |
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
" H; f9 d. N! _. ?to the VxD Control_Dispatch proc (how the hell a shareware soft could try
' U$ l+ a  K& z' z6 N6 sto load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 M8 v2 P# a; k/ \4 Y8 lIf the VxD is loaded, it will always clear eax and the Carry flag to allow
/ |, o! {* R; `& [  F: fits handle to be opened and then, will be detected.
5 z. H4 U+ M8 B3 x) \) l9 \5 aYou can check that simply by hooking Winice.exe control proc entry point. [5 c" x$ G' Q4 L# {( V( k# E$ `
while running MeltICE.8 Q% G9 a$ k% K& ?
" M7 T& ?3 C$ y7 @% d1 Y

( y, q+ E" B- i; [7 ~. \. Q  00401067:  push      00402025    ; \\.\SICE
$ C: r3 K, H9 I2 V6 P  0040106C:  call      CreateFileA
. M& d. a# z2 l% T  00401071:  cmp       eax,-001' C0 e" P, I7 m9 a: s+ c4 n( o
  00401074:  je        00401091$ [& t/ L( Q. t% d
% x0 [$ N/ @, p9 b6 a" F: f
( j7 v# G( c9 j! ?% u
There could be hundreds of BPX you could use to detect this trick.0 ?0 L# b4 \" u) h
-The most classical one is:
  T% D5 T# I% c  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ R! y; b# w( a' |
    *(esp-&gt;4+4)=='NTIC'! q& r2 ~' N5 e. G" ?- Z
# G* r8 S1 T" c# D& y& Y# E+ C
-The most exotic ones (could be very slooooow :-(
" U/ F: n; @5 C5 p( C" N# P/ i   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " w) K* y5 T4 O" D8 ?$ B
     ;will break 3 times :-(& b  {- p3 m* v5 p( ?$ k! S
4 Y# I7 p2 |( D6 a
-or (a bit) faster:
! m3 ~& n* l3 F7 y% ~# E7 T   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
( i7 I0 N3 t& n' `1 ^+ \5 p; h3 l0 W. ~% [; b% D$ z; F
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 N- Z( n" a7 k. a% U( g     ;will break 3 times :-(! K. w. |2 e! L( d( _

2 Y4 o. C; `6 f6 A! z% H-Much faster:6 s' j' Q) j# l( N' x! {, t
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" L) h2 i7 e/ @7 s. ~

6 y$ ]) m0 e' o( d2 h& ZNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
0 l1 @! n4 T; E7 T7 q/ nfunction to do the same job:7 }; Y* a/ G( e# C; L/ Q* u* c
7 p- ]! b$ {' c+ s* U1 {( x5 u
   push    00                        ; OF_READ  e4 f* y) ^3 T; Z3 T: [7 A9 ^
   mov     eax,[00656634]            ; '\\.\SICE',0( @8 Q9 a. s% ^7 n4 _
   push    eax
' w' s* A5 a2 f# \9 x   call    KERNEL32!_lopen
1 X& A7 w: A* {   inc     eax& l+ l) J6 Z1 R/ r$ K) J
   jnz     00650589                  ; detected
8 g* V5 q' O7 m1 |( g/ X   push    00                        ; OF_READ. t8 S$ ]  l# I! s! B
   mov     eax,[00656638]            ; '\\.\SICE') X- @3 o9 g; C) r8 ]8 t
   push    eax
% E) S5 J1 ]: e- K4 ^2 [, F8 [   call    KERNEL32!_lopen
  j; M0 t( d1 e2 ~- y# d' s   inc     eax
1 q' r0 |. Z" \9 V# F   jz      006505ae                  ; not detected- u" J& W/ j4 l. b* c
9 _8 p, l! A3 p2 [2 ?

/ m0 E! }' t5 ]8 i# `__________________________________________________________________________+ S1 H8 y- _7 G' n* d

# Y4 G) }7 O" w2 o1 X+ LMethod 12+ b, _% q& P0 ]% p$ T2 `
=========
' ^4 O9 z- |5 X2 T) {4 V
( B- @9 v/ }$ u) IThis trick is similar to int41h/4fh Debugger installation check (code 05
) S8 C: J; J/ Z' j&amp; 06) but very limited because it's only available for Win95/98 (not NT). U# X- B: h( @( z# C
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
+ \4 Y' i+ Q6 T: a: ^+ I" w! \+ E4 x7 L  ^. I  o" h3 U" _8 O
   push  0000004fh         ; function 4fh
! o8 H9 [3 g" |' e. r   push  002a002ah         ; high word specifies which VxD (VWIN32)* F7 ~6 ^6 A! F( }8 ?
                           ; low word specifies which service5 j4 ]' |8 U% G3 `+ |
                             (VWIN32_Int41Dispatch)
% H* U  {% H- i* ^   call  Kernel32!ORD_001  ; VxdCall
6 _& ?, G  D6 X6 i: H, }# ~   cmp   ax, 0f386h        ; magic number returned by system debuggers/ Q+ {8 Z, i: \- h: M% _) @
   jz    SoftICE_detected( T% D; C4 E8 m$ Z5 t' o5 I4 F

, Y2 b: v& x' e8 U( g! T" kHere again, several ways to detect it:
1 @% M7 v2 w+ d; f
% ^" ^+ w' h. n1 {$ ^$ M: \2 o    BPINT 41 if ax==4f" E5 x2 n3 W8 V

6 z+ X: f/ t) c' J& f7 S    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 k( e3 S$ I, {9 v0 n% \" f

9 a6 [7 s" [4 g: Y1 B( N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; N% r3 d1 p8 `: B" O# k
# o5 U- F3 j9 ^0 r    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- _' Z; n0 C& L
( y( ^; S/ J& r% x. W# \9 u__________________________________________________________________________
: U1 m; Y/ K. F: @, a
- }- `# Y( T# Z1 q7 K/ `Method 134 j  m( J' d- W/ @9 a
=========3 ^1 o8 }+ D. z# X3 |6 ^
" [# `& }8 F& C8 D& V2 f+ L
Not a real method of detection, but a good way to know if SoftICE is+ p: U$ b: A( t6 D7 `6 q2 u* u
installed on a computer and to locate its installation directory.3 d; v2 ?0 [' r. r" P0 L
It is used by few softs which access the following registry keys (usually #2) :
# Y. U  b6 N, k* F4 g
) C/ [( T% J$ T-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! n1 B6 h4 o" b/ f9 }
\Uninstall\SoftICE4 ]; v# U% n8 D, ~! b
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# f& L" X. G( E- C  {4 R. {( n) o
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( }( d( l% g& _\App Paths\Loader32.Exe2 V2 ^2 O8 Z8 q) r# G( V
5 r0 [& p3 G5 J3 I
1 W0 h% B5 c8 {9 `
Note that some nasty apps could then erase all files from SoftICE directory; z8 Z$ r5 w3 h* ~4 v8 L7 l
(I faced that once :-(
2 I8 b' s- A' ~4 L3 y5 }# g* y& ^- N. Y) o5 @( `
Useful breakpoint to detect it:+ D" z4 \6 K' u8 b1 E7 s
% m3 V- F5 ?. |& T6 Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) b. q# [9 q9 z. N$ U1 A  p6 V) b7 d: u2 b
__________________________________________________________________________7 c1 u: T+ L5 H" z; o: D! f

7 H$ g9 H+ h; r+ g# O& M
# D  D: E; J6 ]Method 14 0 y5 w3 q( `. s8 v  n% o! Q
=========+ I; F# q9 p. `: \9 F3 o
; o" P* |- n# t9 \+ G/ C
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 x' I% \' C( w( a( O
is to determines whether a debugger is running on your system (ring0 only).
  c; N9 v6 Y' c# k0 i7 c6 ]1 A2 j' t  _" J
   VMMCall Test_Debug_Installed2 \$ f% f/ d  t' @9 I
   je      not_installed5 L/ y3 I/ d3 }' `) I6 ~% k; s

) j9 E' ^. `8 `# kThis service just checks a flag.
: O9 D7 \7 n* i+ Z: R9 S7 A</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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