找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>( J$ n1 g  k* A5 ~8 s
<TBODY>& J6 J( x7 j- v6 s7 A) \+ p, C
<TR>/ X7 i) ~+ n1 `2 L; K9 {
<TD><PRE>Method 01
1 v0 `8 W1 h1 E# P4 R5 q=========- @/ q3 l" Z- Y
/ W- P& S$ b# _4 W
This method of detection of SoftICE (as well as the following one) is# m- q( S( d5 c8 H6 W0 h- j
used by the majority of packers/encryptors found on Internet.
  B' _( j" Z' X. F6 |0 CIt seeks the signature of BoundsChecker in SoftICE
3 _0 W8 E1 |7 |1 v) `: k( n. v1 b* F% n) @
    mov     ebp, 04243484Bh        ; 'BCHK'  e  T& k5 U% U
    mov     ax, 04h
9 q/ t+ u$ I+ l- M0 U* R8 q    int     3      
$ L5 R: c- \% S& {; i9 Y' ~5 M    cmp     al,4
" o! `4 l: a: e' }    jnz     SoftICE_Detected
. t. s  E# l6 d+ r9 j% W* H: E8 t- ~' H  P
___________________________________________________________________________
, E% z0 ]( O% ]4 r2 ]0 M  U# s) s, G  r% g# l2 _( y( h& D
Method 02! G# J8 S3 v( s. F* Q4 p( E9 l
=========
4 I# f8 S. h# P0 k) T' t  H& w" j( G7 O; {1 f3 D
Still a method very much used (perhaps the most frequent one).  It is used
3 }' Z( S3 Q: d9 ^to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
7 _8 {. D. S1 V- zor execute SoftICE commands.... P4 B5 a8 y- D; O+ K7 s1 m
It is also used to crash SoftICE and to force it to execute any commands
3 V5 F/ S% L6 `; E(HBOOT...) :-((  
5 M3 I1 P# D' i: @
5 P" E9 J/ v9 i' Z+ y! OHere is a quick description:8 R, _3 g% e  y( @
-AX = 0910h   (Display string in SIce windows)
) f+ g  s" n$ Y9 h% Q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 J& W" J) p+ d9 U! p% d7 ]8 i8 ^
-AX = 0912h   (Get breakpoint infos)
* u- T" A. D; [/ Q( D5 o5 r-AX = 0913h   (Set Sice breakpoints)& U7 e, J6 e: W: T9 X
-AX = 0914h   (Remove SIce breakoints)
1 ^5 X4 @4 Y1 I- x
, f  Y& Q! f3 ~" y' ~% v, b7 m: @. |Each time you'll meet this trick, you'll see:
; m; [! y+ V0 ~# z6 Y! h5 m-SI = 4647h( K& p0 n5 `  n) w& `
-DI = 4A4Dh$ s; g0 l; [; h% z
Which are the 'magic values' used by SoftIce." _* G# B  b4 M. V  o8 ^
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 m) P* L8 W4 s
+ [# O2 [5 |; w. c* l2 ]  X, yHere is one example from the file "Haspinst.exe" which is the dongle HASP2 V9 q6 a7 c/ z: ?+ h& i0 j1 g
Envelope utility use to protect DOS applications:9 A9 E; H8 W# D& j% {' f, m6 x

; L- _3 ]8 D" b+ K6 i+ J/ m% E) |5 X
4C19:0095   MOV    AX,0911  ; execute command.4 u* @: q- h7 [% P1 I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., b; u% Q8 p- X7 D' g' U$ u4 c) C
4C19:009A   MOV    SI,4647  ; 1st magic value.. ~6 v6 i7 p% R% o, q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.( U3 \4 R* z2 B) }
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 t. M: v  U. m; C. e3 f$ R
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ H+ k7 }, Z- p1 {4C19:00A4   INC    CX
7 B/ U2 }$ A' S/ q' F9 \4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# [1 i2 b- t. \0 z- S! Z4C19:00A8   JB     0095     ; 6 different commands.
* g0 T8 W+ `/ S3 q0 I4C19:00AA   JMP    0002     ; Bad_Guy jmp back.! V* X: |* }  M+ Y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ e) f# f2 U3 J) [2 j6 }
& ^: j6 I$ p6 b) i
The program will execute 6 different SIce commands located at ds:dx, which! M& y; N2 e: v
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& k8 t6 c% z$ X8 Z+ R+ O) q. ^3 N; G* L5 I: H6 r. T  Y8 i
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.7 F# J1 u7 O8 e. J6 e
___________________________________________________________________________
& E$ l8 o  Q- o5 G
9 h8 O7 f2 x7 o; X( U/ h9 _/ ^! H
! T" Y! S. G" x( XMethod 03
% D2 p0 L4 s5 Q=========* B* u" A2 @6 ?% ]4 }3 r' M
+ C# a4 [: S+ @3 r
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' B+ @$ m/ U% h& f2 _
(API Get entry point)* f5 l0 q% k4 I  p# O, x2 g
        $ ]; f. n, O4 m$ k+ Z4 |
. x  O: E& F3 E$ G
    xor     di,di
3 B; X( A. E& T6 p- [    mov     es,di
8 u( \: ^0 f, d# H. \5 `    mov     ax, 1684h      
9 }8 Y/ ~+ _7 p4 |/ b/ K; @: I    mov     bx, 0202h       ; VxD ID of winice
! J  G+ S) f: i8 q- S; k    int     2Fh: [7 _7 W* |' v, ?
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' u) ]- K. s) b+ |8 |5 B4 N5 M! ~5 ]    add     ax, di# j; N9 [% d& S" p
    test    ax,ax5 X% T& X5 l0 E; Y- [4 ~
    jnz     SoftICE_Detected* Z" h5 O6 o3 Q, }3 t' a
! \; S! P. T8 g7 p
___________________________________________________________________________5 x( C. I- O. t
0 Y6 u8 g$ o- w4 i6 C8 a0 S0 B0 p
Method 047 E8 ]" g9 p: i8 s
=========
6 I8 @  j  h- ?/ d! a% |
8 I$ r4 ]$ d1 n. \Method identical to the preceding one except that it seeks the ID of SoftICE
5 j9 y( G; f6 u" N( nGFX VxD.
2 ]4 }  w9 b% x4 f5 ~, I: U
  i( m8 ^0 g- C% z* ~    xor     di,di
' C* K- {' s& K0 R% d    mov     es,di4 m: c. T9 I5 l/ a
    mov     ax, 1684h       2 g1 ~$ B4 `" ]5 A- k8 F
    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 s/ ^9 e, }1 v1 Q: \% S) S+ q
    int     2fh* I/ l, j& e& t) r, Q7 P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ N3 `8 V2 X. ^! W+ ?: S# o. X3 k# B
    add     ax, di
6 @! p! A3 F+ M0 [    test    ax,ax
8 r! e+ H0 W: w3 \    jnz     SoftICE_Detected
* ^; Y9 l3 v) v" N; u: L. d) F1 W
* [( f1 _+ x, K__________________________________________________________________________4 V" t6 W2 W6 O2 B/ k& O
1 Q1 B; e! Q8 T

3 a7 ]/ z$ d- Z: {5 ^, UMethod 05
3 z9 n' F: V9 g! R9 Y: o! ?: q=========
; V# t+ y4 C  R# I* n) M( k8 [; Y* F
Method seeking the 'magic number' 0F386h returned (in ax) by all system/ l+ T& }; H- V. ~6 N3 B) G
debugger. It calls the int 41h, function 4Fh.9 F& {/ T' d$ v2 t" s8 W! b4 ~
There are several alternatives.  
* b4 G' X8 f; H, D0 @% P% _6 z) R% _9 C/ B. Z5 D* M$ E8 n: T
The following one is the simplest:
" h0 ?8 n  r& h) G( R& b+ L. l% b+ P
    mov     ax,4fh  G4 n6 e+ k: t5 x2 }
    int     41h4 f; k2 k8 t! z; K
    cmp     ax, 0F386
$ }. Z# N6 j3 q2 }( O, ~    jz      SoftICE_detected
1 ~9 P. D; E4 I9 c0 E3 O" U6 x7 ^3 B8 ]7 F& S
5 R' S# d& i4 j
Next method as well as the following one are 2 examples from Stone's
+ m4 R9 S+ f* e/ U5 }! T/ k"stn-wid.zip" (www.cracking.net):
' ?9 v3 D: F( B( C. A1 B! c, m; S/ a9 M" f, \+ x& M3 D
    mov     bx, cs
% k- c- u0 e! [) B9 k    lea     dx, int41handler2* p4 a" Y/ K. u# p+ z: w
    xchg    dx, es:[41h*4]9 V, |- X/ ]* M5 t
    xchg    bx, es:[41h*4+2]3 j, `2 C. W5 k6 G: D+ s# |, P
    mov     ax,4fh
; C5 A5 \7 ^9 v    int     41h* G7 n) G. u4 L% H* {
    xchg    dx, es:[41h*4]
* U: C( ^- O1 Q+ ]+ C9 A, L& L2 p    xchg    bx, es:[41h*4+2]
5 g( V' L0 k& L# o8 j    cmp     ax, 0f386h* r" j  e" Y& D1 q) G
    jz      SoftICE_detected: |. [; q0 s: W3 j
3 a8 w2 z8 b; r
int41handler2 PROC. |& j, p. c/ y4 V5 U
    iret7 X  g4 r$ Y/ U
int41handler2 ENDP* X% u! ]3 {0 h4 V
; }  p- r9 c- ?
0 B2 V! O- g6 P. M4 x3 g# ?
_________________________________________________________________________5 j1 I' E3 t: v( s2 c

( S) h/ |' T* o5 J. Z& y; x1 r5 x# A+ {2 x4 I( g+ g0 S& Y: @
Method 06- i6 P' h+ l. Z# [2 q2 s
=========
% y! Z6 a5 ?8 r& ~2 F' A
; E8 [: M# p, w# f+ `. z7 e2 C
5 h) O3 l* X+ L# c3 u! j  t3 D) Y2nd method similar to the preceding one but more difficult to detect:
/ x, A* r, l$ T& d% D6 {( R  g
" |& N1 ~9 F* \' B2 E0 w2 @
- m, s' j8 f% y2 {8 s7 X% g+ _int41handler PROC1 K$ c) q& _. q9 I* ^9 N0 }
    mov     cl,al& R$ h9 v+ h- Y( e6 B
    iret* o" Y3 d! j/ l3 T0 x
int41handler ENDP1 u' j' I4 H0 N; Q- X' Z

2 T" x( q+ {4 {% ^* k" D$ X! J) }+ J# Z
    xor     ax,ax
0 K: P" [" p* a' V9 J    mov     es,ax" t9 _- h& d# V6 N8 K
    mov     bx, cs1 V8 Q* f( f5 t& h1 Y; N. N8 J
    lea     dx, int41handler
  r; X$ F; ~( i( ]8 U: W) M/ D: _! r+ o    xchg    dx, es:[41h*4]
+ `8 V- d: m. ~; q; }    xchg    bx, es:[41h*4+2]
/ q0 P1 j: n; ]    in      al, 40h
- W  ^: \  a, P  v$ h    xor     cx,cx2 T3 I2 b5 b+ A
    int     41h; s0 h& y  s- h5 K5 H
    xchg    dx, es:[41h*4]; n- F) }, ?* {; a. Y  v+ q" C
    xchg    bx, es:[41h*4+2]
9 }& f  O  e6 m. b; T    cmp     cl,al4 ?: F3 H: Q  W: |" w7 Q! y
    jnz     SoftICE_detected4 |8 ?+ x% q' E0 q! b6 v& W% v' ?; q( o) H) p
! n8 j  ^- z5 X+ I5 d- |7 j
_________________________________________________________________________* A( I: U: Y: I! Y, F% q, V

, ?7 N3 ~2 H' h: pMethod 07# E6 H' D6 H, b7 |. y
=========
- t8 u. e( g* A% t3 n' h$ N3 _; X/ D
Method of detection of the WinICE handler in the int68h (V86)7 t; A. I% Y" \

9 j2 u0 c8 d" l. t    mov     ah,43h
, p4 H: V6 S4 X! b5 l- z- a    int     68h
4 |5 M0 }9 J2 `& V9 `    cmp     ax,0F386h, U* ~: y" }! r; ]7 q- R
    jz      SoftICE_Detected
6 q  t- @; A/ q1 }6 Y2 P+ h4 x" [9 h
: P4 t( U- `4 g8 H) L6 T% L+ C1 ]- \$ ~
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit  _9 ?; i9 d( T' }' B) k
   app like this:
: J  |5 E! y3 J8 G+ H; d  c- _2 P
6 n9 N4 g" Q- [+ A: A   BPX exec_int if ax==68/ j  m: V, r9 N0 X/ ]( }" [
   (function called is located at byte ptr [ebp+1Dh] and client eip is$ s: e, n" Y( P4 g
   located at [ebp+48h] for 32Bit apps)+ \$ e2 ]2 n9 P& a
__________________________________________________________________________9 m: I1 {4 O& J% h
2 s0 U; ~+ {1 s6 o1 ?5 y; U

, K& ^" g# y7 W: G( RMethod 08# B) n( T% ^' P/ i* q; @
=========* b* _, c7 `9 w4 u' s

1 f$ v7 \% b5 {$ I0 F' l  r) H( I% [It is not a method of detection of SoftICE but a possibility to crash the
" U$ n* |5 K& [! f. Ysystem by intercepting int 01h and int 03h and redirecting them to another
+ ^5 C" A5 M: D7 Eroutine.* [6 s( R1 g: s6 \! B
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( H5 W% h- x2 g" M) G1 A6 Qto the new routine to execute (hangs computer...)  M8 B, X2 Z; Z& V# m4 {
7 {$ ]4 H( t" ]' S4 P# s" y. H
    mov     ah, 25h$ S% R* D7 e5 r. k. @' q
    mov     al, Int_Number (01h or 03h)7 O' |" {8 T. m
    mov     dx, offset New_Int_Routine3 Z; s9 Q4 M- Y& h
    int     21h" l  T% k& Y$ e5 B) R

7 z2 p7 T6 E4 Q3 c8 v__________________________________________________________________________7 [' W5 L) `+ ]9 t. A

( t% m  D# z: X& g- `8 BMethod 09
7 x/ D- W& e9 l4 Z! [, P1 i=========. [% P: a$ S/ ^, D3 I4 @
# \( D1 A: M2 t& s6 a, R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: l  K# I) g: h4 }9 Yperformed in ring0 (VxD or a ring3 app using the VxdCall).- R( I: L7 o  @2 p1 D1 ]
The Get_DDB service is used to determine whether or not a VxD is installed$ V/ T) }& y% v# I9 h" F6 a
for the specified device and returns a Device Description Block (in ecx) for
  ~$ j* l/ X6 i7 ^that device if it is installed.9 B$ \; R3 ~. N* B. L0 p
- R# W! @5 z; x/ X* Z* X
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" X, g! P. N' ~. |$ v4 Z+ O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 M' `' ~5 h8 r6 q   VMMCall Get_DDB
$ Q8 w) n' a0 J4 u# q   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ I! f. ]; P* |0 j5 s, c; x! M. ~- k
Note as well that you can easily detect this method with SoftICE:3 k' Y- R$ _+ m& J
   bpx Get_DDB if ax==0202 || ax==7a5fh# _* D( o& j  a  o  P
7 }8 d& w5 D- c8 O; |: F
__________________________________________________________________________
7 f. t) W9 x- ^3 ]: d# n- D- {, V+ o' u& n6 U5 ?
Method 10
7 @; L/ }9 Z* |=========
: |, A. }# s# l, [* p8 {' M1 F1 Q8 f! `" {$ b2 [/ _) w$ u8 |3 m$ A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 r8 \/ ^/ s1 _* n0 l  SoftICE while the option is enable!!* o2 s* q* Y  h$ x( J
) h7 w! B5 |+ ^2 e( a- \
This trick is very efficient:! i0 ~( E2 @- {
by checking the Debug Registers, you can detect if SoftICE is loaded6 B+ r* B' S) D. f  a; t  k) p2 {* W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if  I1 a1 `9 P6 D" S6 S* `: g: y
there are some memory breakpoints set (dr0 to dr3) simply by reading their0 N' {% y" D: f& U: c
value (in ring0 only). Values can be manipulated and or changed as well8 F# K2 y; Z  j( S& ~- P2 p: E
(clearing BPMs for instance)1 V! g( ^" b$ @7 v; H

. y( h. _1 u" ^, a- J- p) o__________________________________________________________________________7 `  o  }1 k1 K8 D  @) O# }

  J% m. X7 ]1 j& EMethod 11; y; {1 ?7 A1 w$ X: g, X5 s  j
=========
0 |- s0 P, q* `8 Q' }
% p  Z- X8 I, R2 F0 z3 Y0 n: yThis method is most known as 'MeltICE' because it has been freely distributed" Y- ]6 N  B1 C- M# V) m  i
via www.winfiles.com. However it was first used by NuMega people to allow
/ ?9 Q% _/ H0 T, R0 d. K/ DSymbol Loader to check if SoftICE was active or not (the code is located
% K+ l' B* F5 D0 e4 [inside nmtrans.dll).' ~4 M5 y; F+ m6 g) w  ]

7 X' R4 |. z. RThe way it works is very simple:
( @1 I; {8 d, Q+ U2 J7 _+ u* {$ dIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: N8 D1 |  U% H# T' b0 ]. ^$ @. O
WinNT) with the CreateFileA API.. I8 w& G9 U9 m$ m' y2 c2 Q
' Y' E, B( c* Q) r4 y7 i1 |
Here is a sample (checking for 'SICE'):
9 v! b6 s1 j/ S# s& A5 H5 G- Y. d% c% u
BOOL IsSoftIce95Loaded()) |  g, \1 a  ~" u) k8 W
{
) y2 K, n" K5 o" p0 m/ a   HANDLE hFile;  
. }, J+ W5 s6 P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ f; R4 J5 F% @& z% N0 A
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) e8 Y' R5 s0 m
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 l3 s2 U) w8 Y! G: ?   if( hFile != INVALID_HANDLE_VALUE )
' c; ^3 |/ W* F" V: f& P$ I0 [. ]   {
2 z$ _2 u6 `1 q" Z$ M& O# T      CloseHandle(hFile);
4 I  A1 C* j3 Y# E      return TRUE;9 {  R/ U* _8 s1 ?1 t
   }  K4 X: l7 i1 ^2 p1 p
   return FALSE;2 K' Y5 @7 h8 ~0 T. q  l
}
5 _+ C; q! q% e9 G6 e; N* F% X. O9 K7 [6 K  L4 _. l1 a
Although this trick calls the CreateFileA function, don't even expect to be
* Q+ a, w7 D5 N; o" `: [# p5 J1 v  qable to intercept it by installing a IFS hook: it will not work, no way!# A: Y: Z2 u4 h4 q. L
In fact, after the call to CreateFileA it will get through VWIN32 0x001F$ @; D, x% U; h/ x7 p0 ?
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- t1 E2 Z9 e3 X7 T" }; M
and then browse the DDB list until it find the VxD and its DDB_Control_Proc  @6 f& Z2 E1 T0 L( T# E
field.6 N- F# J, E& Y1 w  Y+ @
In fact, its purpose is not to load/unload VxDs but only to send a / a8 J6 o0 u" h+ ]% H6 R7 L# z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( H' N) O" L! v, a, A6 `to the VxD Control_Dispatch proc (how the hell a shareware soft could try3 `8 q. y/ v; V! S6 r
to load/unload a non-dynamically loadable driver such as SoftICE ;-).: b' A# m/ X* B1 \( u9 p
If the VxD is loaded, it will always clear eax and the Carry flag to allow
, [+ d+ [: w' p" u% W- r+ Qits handle to be opened and then, will be detected.: ~6 Q+ W2 I7 s+ `; W% Y
You can check that simply by hooking Winice.exe control proc entry point+ b- ~* [* P8 ?3 g0 K
while running MeltICE.8 B9 M9 J& x& l- c
$ Z+ }# ]6 v- b% q! w$ S7 C
/ ~/ W0 _4 A6 m) l
  00401067:  push      00402025    ; \\.\SICE
% K& f: y% X( M! U2 L7 I  Q  0040106C:  call      CreateFileA
9 p3 {& }/ x0 |" d% {  00401071:  cmp       eax,-001
7 S, i; J- D) u0 H7 b7 L. [* w- O  00401074:  je        00401091% d: ~, h" Z6 S' o

6 x4 w, D: o* x+ ~% q( g( Q
% ^$ T" n% A3 L2 p( e+ q# sThere could be hundreds of BPX you could use to detect this trick.
: P# g* p& f. A$ o) a-The most classical one is:
! r3 s$ _. m& q8 Q; i& Y, ^7 `  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ G0 z- ~8 e2 c# z3 s    *(esp-&gt;4+4)=='NTIC'! c4 a# |8 X  N/ h
+ }9 w" W$ p0 i5 `& |& f
-The most exotic ones (could be very slooooow :-(
. o" i/ T$ B8 K+ k   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& B3 o+ E1 p* F! q% _2 n! l2 Y     ;will break 3 times :-(
; K7 I; r0 B7 ^% Z( Z3 s! _& q3 g9 w1 R" u8 M* {
-or (a bit) faster: $ P3 \0 r( n; q; O, y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! E. |. H8 B8 P, q
0 y1 K$ Y3 s/ O7 [
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
$ L/ H- W# ~0 t% |5 L9 ~' F( Z     ;will break 3 times :-(
/ u. G# {% D% B2 z) F8 r4 f+ x9 j1 ?  l
-Much faster:5 I2 o( e5 U4 N  Z' c5 `/ ?. m
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 W( q$ U& o& ^; m1 N) z0 i. _6 k/ P
' J# u6 E7 R# ?8 {2 L
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen" w- y( F6 ~2 q9 m
function to do the same job:) l# q7 A, ~# I. x# G0 O/ U

8 j: ]7 i! G+ S$ _! h( e" @( N   push    00                        ; OF_READ
9 W9 |3 C: |! D3 a. O9 ]& `   mov     eax,[00656634]            ; '\\.\SICE',0  w' S& M1 N# b( C0 M7 j- y0 ?
   push    eax$ `1 \" y" h4 @4 X2 W
   call    KERNEL32!_lopen' X$ H" k* x' Z  h
   inc     eax
4 `7 j$ j. X! ]$ X$ e4 k   jnz     00650589                  ; detected( ~% g4 f3 k* F' s* N: |& i
   push    00                        ; OF_READ
$ P1 u! L0 l* D# n   mov     eax,[00656638]            ; '\\.\SICE'
8 Y3 u( g) I- s0 ?   push    eax
/ S: E9 J. O; l' O   call    KERNEL32!_lopen' |  {' [/ U( F5 {
   inc     eax
$ z. F1 S" Y" n. I' w- Y4 A' ?   jz      006505ae                  ; not detected: v+ @7 E& h0 Z1 {# `5 R$ h: _
" [# L# B5 ^& N/ E
) D& x# O6 b2 m! r' \
__________________________________________________________________________. F% g( H4 z* H7 [3 L; X

, @& w  W+ T. O. f. a0 n6 k6 y* E$ B1 t9 pMethod 12$ Y, A4 Z- U( j, _. C: b4 r% a
=========
/ F3 t5 c% B% }2 S. k! \; d
2 B  t" F  [5 y& ~This trick is similar to int41h/4fh Debugger installation check (code 05
& m7 j" O* s6 I: L8 S0 v. e&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 p- o9 Q4 \2 r( U2 z0 v6 v5 ~- Gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.# z1 v' I. W! t, g" L

( a+ h' F- S2 f   push  0000004fh         ; function 4fh
0 m) _1 [5 M2 v1 E: q) O6 l( A0 |   push  002a002ah         ; high word specifies which VxD (VWIN32), }$ f* ^( I" q9 M9 G# ~* R1 s
                           ; low word specifies which service
! G( O7 C; Z" y3 U; F- Z                             (VWIN32_Int41Dispatch)
, r0 r5 O; n2 {( @, Z6 ]$ r  g   call  Kernel32!ORD_001  ; VxdCall
7 h3 g: e2 a& L/ s0 X) l  d# F   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 h; L) ]: P3 q: K/ n! E& B   jz    SoftICE_detected4 a/ S+ b6 H2 x- f' _
7 G. J1 m% m9 P1 C
Here again, several ways to detect it:
# ~* ~3 y' v8 s1 C; Y+ c6 w+ V
; D! N: e( T* C8 U: Y5 @    BPINT 41 if ax==4f/ Y  Q/ Z, T0 @6 I' c
8 l: s8 ~  y4 O) K1 u; v3 g& \
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one  ~. p# I9 m5 c8 t9 K+ T3 V5 A
9 Q0 ~8 g) A# w4 K3 I
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 p& T) G2 E) t6 Y* u9 V9 r7 ?
, e2 C; E+ r9 M9 m- A; r
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& K! L3 i$ E: o

+ E+ v3 `7 E* |" u  `__________________________________________________________________________
2 Q5 Z9 y: ?) }7 \: q: Q7 j8 V9 s& D. y& T8 I0 O- U
Method 13; h# M% ~1 w) ?  n6 f3 O1 c
=========
5 Y% P+ r" w5 U- \: n" F3 M8 h" R+ V% y8 A
Not a real method of detection, but a good way to know if SoftICE is
7 k2 S1 @, L8 a  \$ T) n4 minstalled on a computer and to locate its installation directory.; y& `* ?$ `' H( h
It is used by few softs which access the following registry keys (usually #2) :# Z6 F. ~9 _. j; m
1 y5 l, A3 \8 H) n1 G+ o0 g( k
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- l  J7 q0 R1 t* W\Uninstall\SoftICE
2 m- b' A/ e, e) g-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! @8 v. G/ k0 t+ Y9 E-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 |6 S6 `+ D% S; x9 \" G7 l( W\App Paths\Loader32.Exe
3 M$ M8 D2 i: t0 H/ g
' {" b+ E/ ]" z- t- o. j- l: _
$ ?0 ^: N- w" I- @2 _3 hNote that some nasty apps could then erase all files from SoftICE directory$ O  e' A/ c& j. U' O3 ]1 K- b4 g
(I faced that once :-(" U- s2 _3 ?* ]% K' ^5 y
6 q' [! h8 j" N: h! t2 ?4 o' k
Useful breakpoint to detect it:
9 x, l" Z* p: v' `1 y7 I
6 v* o- f1 B. l     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ M7 y$ L: ~  `. @* {5 B( A3 N
+ V! c8 T( D& D# m  s8 O__________________________________________________________________________# c: }  x4 ~. u) C6 e

. \2 @& W5 i# P! t8 m" u) F% s* K& O, Q) a8 d) U3 c$ |( `, A
Method 14
& W: _. n7 B. _4 Q=========
' V( [5 p% _3 B3 u/ Y+ Y( f4 {) |! m& g7 [7 x& m- k+ O, @; K0 b, H
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 U- f, ~1 c5 |7 ?is to determines whether a debugger is running on your system (ring0 only).
2 @1 W& o( a9 t( h; X8 ^4 ~& D6 p
' O7 M. ]. s6 E( U% N& m$ Y) s   VMMCall Test_Debug_Installed2 m" @5 y6 Y5 V) Y
   je      not_installed9 ~  F( K' F5 ~* @

0 G0 s3 a, X6 D) J) f" }This service just checks a flag.0 v# e; @+ B9 `! s
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-3-26 05:31

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表