找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
2 G9 C/ _8 E  q- M7 T8 H<TBODY>8 c3 [9 R' s6 _  w
<TR>
  }% `, A' z6 {" a<TD><PRE>Method 01
7 g- [( i0 F/ J3 d3 o=========6 ^4 J+ x) Q/ N9 o; F' z( ?3 a3 D
  S2 T8 h; v% ^* d/ E
This method of detection of SoftICE (as well as the following one) is$ z( k! K% H! N
used by the majority of packers/encryptors found on Internet.+ q. C% k- m1 y; F/ a( \" Z1 u
It seeks the signature of BoundsChecker in SoftICE4 t, Y& I' f; l% d! d
* r& j; v. {8 g% o' |+ ]# E
    mov     ebp, 04243484Bh        ; 'BCHK'# K' R; w: y9 ^$ T
    mov     ax, 04h8 g# K0 d: |! S' Z+ P
    int     3      
! v2 x7 h0 N0 ?/ A  n! i    cmp     al,4
& l7 x- B8 k# V! I4 i% u: n9 s    jnz     SoftICE_Detected
$ Z" H( k7 P1 B5 ~: t3 P* ^+ J# ^& n, Z
___________________________________________________________________________. ^' x8 h5 i9 x# z

! ~0 V: J( p% ]; E: a+ S! a& R: ]Method 02* g& u3 e1 F7 }0 O. Z# @+ R" E4 d
=========
0 o9 h' E" \0 G: t6 l' i* r2 r' H1 u! M0 m
Still a method very much used (perhaps the most frequent one).  It is used
0 d" m4 w9 Y5 v. w7 P9 ^to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! s) E, j% q, l8 D9 \3 Jor execute SoftICE commands...' I/ ?2 z0 @8 [& o, H
It is also used to crash SoftICE and to force it to execute any commands
7 P& o* h9 p. A5 F(HBOOT...) :-((  * M) D1 `( s3 ]) I4 u9 t& p, j

5 ~  D8 A0 U8 x- AHere is a quick description:1 `2 D1 w; c5 @% S) A4 t8 h( c
-AX = 0910h   (Display string in SIce windows)
2 g4 J$ I9 w7 d/ O-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 z1 v5 |- i/ Y* h7 {5 k/ k# ^. S9 r-AX = 0912h   (Get breakpoint infos)
% E6 U7 `0 O7 N6 v5 Y- S' Q# R-AX = 0913h   (Set Sice breakpoints)8 `9 O+ F: f7 E- [9 w; B. u1 n
-AX = 0914h   (Remove SIce breakoints)8 X6 h( k# `( o* F: r5 r" _
% M8 S8 f* D- [
Each time you'll meet this trick, you'll see:
9 w0 j% R& `0 s& D0 F-SI = 4647h1 O7 [) }# S% c/ w) \# b& q4 R* a/ }
-DI = 4A4Dh
$ c$ _& {3 `, N( RWhich are the 'magic values' used by SoftIce.. E# [% x% d" ?) W: ^' u5 J0 \
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* X" g+ s8 ?* m8 U6 i- s. E
, E9 D+ s+ J  t; ~! X  P
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" ~3 M$ D8 j( ~8 U/ fEnvelope utility use to protect DOS applications:
5 f$ l+ W: \% E7 n9 @# F# Y. D7 h' Y0 _6 e# A+ m
8 x& _$ P4 G6 P7 ~2 U% m# [1 z
4C19:0095   MOV    AX,0911  ; execute command.
7 O7 Z2 q% L! b: k( |6 `5 s4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 \  b/ f( s& R* @! f! `( z0 V4C19:009A   MOV    SI,4647  ; 1st magic value.
* w+ K  R; R. }. \4 ]" Z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  b  \. @* E& [4 h8 O' [8 ?+ {3 S4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' J0 _6 c- f7 q9 y" |4 u
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute& Y& I) H# l, e/ a4 o' Y/ t
4C19:00A4   INC    CX" C, v8 n1 Y( ~; T: M2 R
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& Q1 x0 b1 m# \  h( V& Z4C19:00A8   JB     0095     ; 6 different commands.4 }! U* f7 c( t) K. D1 z8 b
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
" q  k, _& S% w/ o4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, M* r; B) l' _% N1 b
2 a1 X4 Z- S2 l3 oThe program will execute 6 different SIce commands located at ds:dx, which
& Y- P2 Z  o* |/ X3 M4 W/ Pare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! t) J4 P" r% Z0 C, l8 a; E2 `6 T- G! Z9 V
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  r9 ]! ^( F( l, \0 t2 f
___________________________________________________________________________# R; N& h3 V# B  @( G
- j( i& N3 c; N2 ~

& \& }$ P! w6 v1 S1 x0 yMethod 03- g3 t6 S) J  x% O
=========
" Q9 N. c" [1 Y# l
/ i9 i% N, a9 `3 `Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 b4 R' N# W/ I
(API Get entry point). q9 E, a) B2 c) f
        / a. j# x) r) t3 l# w$ p2 j

' n: h+ s8 ~" U1 Z8 o1 H    xor     di,di
  Y. G, a8 T) j# e6 W' s+ u* [; X/ A    mov     es,di
8 ]/ G: E" Y- \- O' A    mov     ax, 1684h      
- T  M* C7 v1 E. j    mov     bx, 0202h       ; VxD ID of winice* M& F& ~3 Y% d; ^6 y9 P; m- g  R
    int     2Fh
* |4 q2 k) h9 Z+ O& L2 q    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 c& S" R0 u9 S* d8 L+ t0 D
    add     ax, di
/ K/ h3 |0 M+ `& }    test    ax,ax4 J' f# N9 c7 h0 P+ k) C$ {  ^
    jnz     SoftICE_Detected
* D4 _& a- E4 {) D  r- r* \
9 r* W% ^, J+ J4 u8 s; F4 N1 |___________________________________________________________________________  @# u9 d2 X; h5 D' @3 \* S

- t7 s3 \- y& ?; U; IMethod 041 \+ A3 x' e: b+ i% ?/ E
=========
/ k- ^- M. l  G* w+ H  o
: ^4 p7 ?+ |! `4 [' h8 F! ?Method identical to the preceding one except that it seeks the ID of SoftICE1 L8 N, o0 A$ e& l' M" U4 x
GFX VxD.
# X" j5 I0 F6 [- Z3 r: p+ t, [( Z0 ~: ^' L/ V$ F
    xor     di,di
- ?  l8 M) \) H' N: ?+ P2 \  |    mov     es,di
- D) a1 D5 U# v( ]4 k4 ?# {    mov     ax, 1684h      
( M8 }; s: ]3 i( V$ b2 z+ s2 X    mov     bx, 7a5Fh       ; VxD ID of SIWVID; V  a$ N; d: Q1 u. A' m
    int     2fh* I- X! l- k) J. d, o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" ^0 [9 o7 `9 B/ b    add     ax, di- n/ Z) _7 S) F2 l' c
    test    ax,ax9 y" i2 ?3 v2 S; z8 M
    jnz     SoftICE_Detected2 ^$ |* Q9 P, p

. s- T, I% z6 ^+ f/ |__________________________________________________________________________
- t! c) f9 A  }
; `: P6 w6 r! C( n' U$ c) h3 f% p+ ~3 F# p8 E4 g; L# S" k6 {$ a* E6 q& T
Method 05* i3 ^6 u4 K! C  [  t
=========
" G5 i4 h6 H# Y  e
2 S( _! Z/ I; j$ @Method seeking the 'magic number' 0F386h returned (in ax) by all system
- F( U8 h) m+ N/ L" B( |debugger. It calls the int 41h, function 4Fh.
" {6 N- \0 w8 \- T$ M5 ?There are several alternatives.  + ^( }2 U& N0 @7 O* N( s
0 b* L5 J8 r0 h/ l* x
The following one is the simplest:3 m( I( {+ ~+ o
  ]& K7 i7 B: x' O. q
    mov     ax,4fh
9 ]; P( H! k) h( i5 o5 U" }# H. V    int     41h  l) i' P3 m1 a3 b, q
    cmp     ax, 0F386
3 z+ G. y# I- |4 M1 b+ N& ?/ ~2 Y    jz      SoftICE_detected
# W- d: \* K) k8 ?; C$ k& M, {3 {
8 W& [) j7 b: O+ Y" V/ a9 O4 [5 W8 ]9 I+ f
Next method as well as the following one are 2 examples from Stone's 2 r$ g7 x0 a: X8 o1 U) Z0 q; l; p
"stn-wid.zip" (www.cracking.net):
) j, }  s$ P8 V# P: M' C! s* B& t
0 u% S  ^4 z3 t. b  z2 {    mov     bx, cs. r# ?. o2 d1 i6 u
    lea     dx, int41handler2. O$ a5 h% O4 G
    xchg    dx, es:[41h*4]
" _' U# l6 v) e6 q' F; [' F( b. ?9 y    xchg    bx, es:[41h*4+2]
; ~6 z( i$ `% a    mov     ax,4fh
- q% N2 b1 L0 F* U8 E    int     41h3 |( g* q5 Z8 I( {7 U! z
    xchg    dx, es:[41h*4]$ Y- m8 `( |8 _$ i; n
    xchg    bx, es:[41h*4+2]
/ `: t& b1 Z( l( {. M+ Q    cmp     ax, 0f386h
7 _; X2 m8 l) b" j: R; q6 Y) C    jz      SoftICE_detected
: p2 s6 `: ]7 D! p4 }/ K3 ]' A7 b0 O: @5 X  t
int41handler2 PROC
% V2 e% o0 J: ~! s' ]    iret7 K7 }5 E5 ]* m; u/ z
int41handler2 ENDP
: J' X) _" {% p% ~+ ]' i# o7 H+ l5 Q; \% V3 }& z

- G, Q& [+ l+ ?. X* d7 b. V# ~_________________________________________________________________________
0 P% Y% Q6 @' ]1 ?0 T3 _& h, s# w( W9 Y/ a, H) j/ U8 U7 L' s2 E

  {4 X3 U* X% d: e& ^Method 06) l: r; f" b/ N! b6 g
=========
- Y( a: M. u6 T3 a) b) S) T6 _  \$ C) U5 T5 p  s$ x3 S
5 L  S4 R5 p0 Y
2nd method similar to the preceding one but more difficult to detect:2 N- W0 E: V0 D% P

" l! q9 i' r" X/ P( `0 ^; D( \
4 C" r! G, @: `int41handler PROC
9 @- r9 U1 Q' T# d- ?8 n1 o    mov     cl,al( _+ k' j* z2 m; }+ Y/ b: O
    iret
% ~# ~  ~  v0 F0 C4 _; S! y( fint41handler ENDP2 Y4 C' W! e3 M/ B! s

* ~, i" |' `5 j, R2 ]+ I8 h) k' q
$ X) [& W0 j) h9 z    xor     ax,ax5 h9 k( K& Z! |0 ~5 p
    mov     es,ax
6 \( R. A, W, R. P" P    mov     bx, cs- ^- I. w2 w) q8 X
    lea     dx, int41handler9 ]: Z3 _9 l# W; m/ f- M
    xchg    dx, es:[41h*4]! L- v* N6 E" Z, i* k/ R+ a
    xchg    bx, es:[41h*4+2]/ x* @1 V: e. q7 j% Z' D: J% p
    in      al, 40h0 f: y0 w8 T, c7 H
    xor     cx,cx
, `$ W( e3 y6 I    int     41h
6 f3 y1 d$ r: h; F: j0 x    xchg    dx, es:[41h*4]1 r+ ^8 t- _$ d4 A1 \
    xchg    bx, es:[41h*4+2]
! B5 u% _8 l) X0 [% X$ n  G& A    cmp     cl,al
3 e; B7 f* C+ y% x& v( M. |    jnz     SoftICE_detected
4 r4 a( f. S' G/ q1 Y- G) x
3 o8 x, Q3 S0 g7 a. q$ M_________________________________________________________________________& P$ X# b. N/ f2 E  w9 H

: L% U, b6 Z! o1 B' Y* i: xMethod 07% f6 I7 J1 g8 }
=========
# ?7 @7 D9 `" K0 w  Q: T6 Q  l% Y; O
! ^; [$ ?7 O: o5 i0 ~3 qMethod of detection of the WinICE handler in the int68h (V86)+ C& k, ^9 n0 C4 P

# v7 e( M# d5 ^+ a: G    mov     ah,43h- i- S. G' [1 ?& b6 s
    int     68h
/ `- i/ z, N' b    cmp     ax,0F386h
. ?# L" O$ c: q) D    jz      SoftICE_Detected  k; e2 z$ f0 v  y5 b1 d4 I
9 p* C: {0 B/ J2 Z

# P! _8 k- P( l% A=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 T1 Y  u# j8 s. A: _   app like this:
( _9 |0 I! m2 x& s; H. Q
" [. }7 O9 V5 _/ G/ |+ w/ k   BPX exec_int if ax==68/ x( Q8 @( [1 q  u7 D$ U% q7 G
   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 `2 s  A, V, w7 ~   located at [ebp+48h] for 32Bit apps)  R6 r# W- s( @5 ]' H8 i
__________________________________________________________________________
$ J: e0 s% I( ~5 {( @$ K% {
8 E% ^7 [+ j$ k; @& @9 e# i: j5 G) q0 V( k
Method 083 Q9 c; v- V% Z2 Q% X% v$ v/ I6 H
=========
( Z$ M! n! {2 h% r5 a7 ^- C; S2 M( }) q! z; g- u
It is not a method of detection of SoftICE but a possibility to crash the
: m- i) P+ n8 {/ S  L* ]. |system by intercepting int 01h and int 03h and redirecting them to another2 Z4 h3 l) o! f2 p
routine.
% a# g4 N+ n* W- u0 w0 `9 |: ^It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- Y4 D/ M; h+ l, D, Gto the new routine to execute (hangs computer...)0 w2 K& N0 ~) T2 i6 z- ?

2 Y! B# S# s) f. |! b4 L2 Z' ^+ U    mov     ah, 25h
) W& O0 n& `; n+ p    mov     al, Int_Number (01h or 03h)
* h. @  D9 ]# N; q$ L1 s3 ~    mov     dx, offset New_Int_Routine/ A0 O+ t8 x* w* i
    int     21h. E1 V$ E* g5 @2 h2 _6 c. o, w
+ C  N8 d# h  ?7 q
__________________________________________________________________________5 D, ~' w, D( G) K! Y/ u6 D

" L5 |0 Q$ O- C) b5 y/ xMethod 09# K- C$ ?! B$ s7 b/ S7 h" e& D
=========
! i  w$ l' @6 f7 s4 f: s/ m; z! L9 r  |* }: |4 @7 }
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% i9 k) k! a0 M
performed in ring0 (VxD or a ring3 app using the VxdCall).3 I* q' N! G. f. g
The Get_DDB service is used to determine whether or not a VxD is installed9 u1 G4 S3 ^. m2 `% q  b2 r
for the specified device and returns a Device Description Block (in ecx) for$ J3 c* B$ e- p& w. `" E
that device if it is installed.
& t7 p0 n% c, f8 ]9 i, }/ e
7 N" t0 S* l" F( z+ p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) R" z) |) g8 D) f   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
: @/ a8 k. `/ M+ r( O$ f' A9 K   VMMCall Get_DDB3 V8 E* i; X# O2 s3 O: O
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ g: F* y/ U0 j2 K# ?0 ^$ ?! `4 y) {$ T2 {, T0 J! K7 U; h& V0 w
Note as well that you can easily detect this method with SoftICE:
4 ]0 F2 ?+ C9 S* ?9 h+ l" k   bpx Get_DDB if ax==0202 || ax==7a5fh
$ _( x* I5 x6 T& r- w8 p! m# |" e: R" \' `0 Q2 ^+ b" w
__________________________________________________________________________" l3 u0 s8 s( o# L2 ~
7 B' E8 O2 C) x
Method 10
* J* n0 N2 c2 ~) T( _' k=========0 S* A# n0 T$ m: t
0 S( W! z' o' V% l! G3 H, c5 U
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 U- `* u  w* I- }
  SoftICE while the option is enable!!1 A. @9 H  S$ Q6 P
. Y! |2 w7 W- q) r
This trick is very efficient:
1 [- \1 ?9 d' ^" I  v( `by checking the Debug Registers, you can detect if SoftICE is loaded# |& {* A2 g8 F# a- l% s. s
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) e# D* J) @: H& z1 n! w- g% c( [- ?
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 n6 c' b! ?# x$ d! _4 [value (in ring0 only). Values can be manipulated and or changed as well
* {1 @7 O( r! }" L! E1 I8 ?(clearing BPMs for instance)
2 P1 O7 f5 @4 o3 R; o  n! J, e( D+ r/ ^; n  M% A7 u% @! F
__________________________________________________________________________
6 D5 C  U+ Z! y4 f% W* L6 ~& a9 r+ k) [; R* v9 w5 {
Method 11
6 i- {6 P# R! s3 D/ I) j=========
4 ]4 v) \1 k/ V1 D1 m
0 T- {, H# b& G% W( C  s$ F' ~0 hThis method is most known as 'MeltICE' because it has been freely distributed, o/ m5 O1 l* q; H4 Z& f
via www.winfiles.com. However it was first used by NuMega people to allow
* l; x7 g; Z4 L- hSymbol Loader to check if SoftICE was active or not (the code is located' ~) o- ?$ ]5 {  c+ r4 U
inside nmtrans.dll).& V& i- @" ?+ x5 Q; j) C4 w
2 O' N- h! D1 E
The way it works is very simple:
- I& p! P/ x  rIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
  P4 X! ^% M3 Q8 EWinNT) with the CreateFileA API.$ L: g+ s1 h& W- M" j: M5 D  P" M

$ H& c, F9 E* xHere is a sample (checking for 'SICE'):
1 F7 i' l9 ^0 f" h+ M" C! j, p( Y$ g" F" n
BOOL IsSoftIce95Loaded()0 D# L" Q+ v4 F2 D
{
7 x2 H% ^$ m( r8 v1 b. `' o   HANDLE hFile;  8 u0 ?" x! V7 F! z3 ?8 f3 A2 V
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: d! Z0 [8 L3 S, U) V0 u3 q9 ~( F
                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 k/ w0 w% k- x2 j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ k4 I& h% P8 J+ p5 f9 n& C, M
   if( hFile != INVALID_HANDLE_VALUE )
/ \2 d2 K7 q! @6 k" D9 b   {
' C0 V3 K2 D# f  F! w      CloseHandle(hFile);6 A) M9 X. V; p0 B
      return TRUE;: e6 [- L# y& K7 w$ g
   }- t+ `# U/ w) H. W" x
   return FALSE;0 Q, L* ~; n, u! ?2 j' r/ P
}
" f( `3 o* y3 l/ w  ^  d' k2 w; S6 |' N
Although this trick calls the CreateFileA function, don't even expect to be/ z' D# F/ o- H
able to intercept it by installing a IFS hook: it will not work, no way!) o* S/ B( o. j2 D, [% \
In fact, after the call to CreateFileA it will get through VWIN32 0x001F% w( I6 ^) F0 F) ?7 o
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ @; k- |0 U. q5 ^4 Pand then browse the DDB list until it find the VxD and its DDB_Control_Proc
* s! Z7 g+ t' b6 p( I! N) bfield.
4 @2 ?/ ^: Q! FIn fact, its purpose is not to load/unload VxDs but only to send a # L+ S) D/ B% Y$ e3 V
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  v! N; M0 P& e( p  f
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
( |1 C0 k; U  V: Tto load/unload a non-dynamically loadable driver such as SoftICE ;-).8 ]8 z$ c% d. g8 I
If the VxD is loaded, it will always clear eax and the Carry flag to allow
9 I" c( r! E: I/ Q9 Hits handle to be opened and then, will be detected.
! W3 O" s4 c6 y1 e) V) ]You can check that simply by hooking Winice.exe control proc entry point- j) s, Z2 x# F6 ~
while running MeltICE.
7 C' i  n. G' O9 t. @0 `% I1 h& P1 ~$ I* e

: d* F( K. v# D2 W  00401067:  push      00402025    ; \\.\SICE
7 \. D# Q& A$ U: V, u9 z  0040106C:  call      CreateFileA
" ?5 S! y  c0 J/ W* g5 y" E; n* f  00401071:  cmp       eax,-0018 u) {/ T  W4 X+ O) |' \
  00401074:  je        00401091
- O  `! V% {3 z- m+ J! I: k; s1 @* @5 _, x! m2 M0 S, k

. O' A* V6 B( a" zThere could be hundreds of BPX you could use to detect this trick.  A, ^' y& d5 q5 K8 d+ h
-The most classical one is:, y' t$ h' n8 ^! y) R
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) R4 _+ j! b4 \7 t' C: w6 |2 ]; Y
    *(esp-&gt;4+4)=='NTIC'
4 w. T" ~5 G- @. ~1 W: w- X! l
" F/ j6 L- t: [2 D6 K, K-The most exotic ones (could be very slooooow :-(( a" E2 G% z% r0 B6 }/ J: _8 J: v
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + [$ W5 p& p4 ^3 R- M9 \
     ;will break 3 times :-(
% a, ~9 q- D; |! q# c; v: H$ i" O& y8 U9 y& [
-or (a bit) faster:
' j' ^. I& N5 f" o, i   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- p; Z8 i/ Q% V. F( q( k9 q* s
+ V- A5 ~8 o- G! N1 P0 l! o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( c8 s5 V1 k, y7 x1 w) N( v
     ;will break 3 times :-(, M3 i; Q  {3 J$ q
1 v4 b; j, @, C) p# \) N
-Much faster:, A0 t  H& t) J8 O
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; K3 A( n1 A, k2 u6 L+ G8 F, ^  w2 A9 y9 P; P# {
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen* n9 M+ p3 W6 v% B0 {, s$ C
function to do the same job:+ i" @- }% H% _! |% R& ~; ?

& u% U  M& ]( k& C+ l+ ?8 F4 f! k- k   push    00                        ; OF_READ& G* T, K0 t. B0 d
   mov     eax,[00656634]            ; '\\.\SICE',0. l2 [2 W" u6 v% o& k' G7 p
   push    eax/ |& l/ c( G4 h. v
   call    KERNEL32!_lopen
- C+ [6 g8 ?/ W$ G7 Q   inc     eax6 w. q8 n( \  q, h
   jnz     00650589                  ; detected
4 T& M+ }# s' H' ]; J! _   push    00                        ; OF_READ
4 K- y1 _  w( [   mov     eax,[00656638]            ; '\\.\SICE'
3 v( Z; ]* E, m2 g7 m5 S   push    eax
7 Y8 I1 S" d6 Z9 z( P   call    KERNEL32!_lopen
* J! @) f& x; a   inc     eax
& v: [: Y: b8 r& ?   jz      006505ae                  ; not detected
4 d) t7 G+ G: _% N
1 v( [- \/ v1 r* d3 x0 P4 y0 E; O8 h7 e5 f: e6 I- v" \2 H) t8 b
__________________________________________________________________________
; [. N- K8 L; J  g. I1 }% T6 b# c9 ~+ V0 V# [) L0 V1 P. K0 k* k$ B
Method 12) C2 D* }* H# p" n
=========
& u1 L+ s- I2 {* a9 b
2 ^9 d. N! _9 f. }$ l4 g- ZThis trick is similar to int41h/4fh Debugger installation check (code 05
0 T' j# l9 ?9 d. Z8 \&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- z. W5 Q7 H- vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 C3 H4 {2 ?4 W6 a, F# r
' D: u' b1 B2 n( W$ R   push  0000004fh         ; function 4fh- B  Q. k- H8 s! J
   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 t  }' ~$ Q' F7 O7 Y                           ; low word specifies which service% p; x& B) I0 K6 M# a
                             (VWIN32_Int41Dispatch)
1 N& m2 ^" V: H  B( a   call  Kernel32!ORD_001  ; VxdCall
( S" g5 E2 T  u) f- O3 s. W   cmp   ax, 0f386h        ; magic number returned by system debuggers
: G- a; f4 \+ J   jz    SoftICE_detected& v6 X1 T4 `# f. W
; K6 w: L8 T  Q5 r' h# g
Here again, several ways to detect it:. t4 z1 f) ?1 r( f' W9 o3 o6 ]
4 B2 g6 ~6 ]1 B
    BPINT 41 if ax==4f& v) @; _. w0 r3 w

4 D& N& Y/ o8 B: R9 S* {8 N. ~2 j    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- G8 O% a8 j: |3 }

  @0 t9 h0 F6 V' @7 I    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A6 b; l9 T/ w$ B& b  @! K6 R
. l" ?* C- Q' C
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 h) A+ C7 s9 u$ C8 S$ [4 o5 K
0 n  {5 ~0 t  j0 N$ a( \  h6 |
__________________________________________________________________________
3 w5 {, k/ ?9 y, F
+ P4 l; T+ u* z, W. T, n- z! a* @Method 133 N8 h1 ?# i( O, V. d# P
=========
" o3 e7 H4 p) H
5 M% }! h, Z9 ~1 Q) aNot a real method of detection, but a good way to know if SoftICE is
# O1 z. u0 m9 m$ i5 Qinstalled on a computer and to locate its installation directory.% R5 \! r5 \0 f* z4 D5 @' f3 @
It is used by few softs which access the following registry keys (usually #2) :
4 e: h0 B3 S; n" [0 w
) f+ f& F0 A; j5 _7 b' `& S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  r$ ?. z/ A/ C' z$ Q\Uninstall\SoftICE
3 W+ E3 n! `' o. a. m-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 Y3 r3 @$ H$ M# F) J-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! p9 u4 i: t1 V- ?' N7 w
\App Paths\Loader32.Exe! k( L+ a" F; z5 ^) u6 Y

1 B  w" @4 c8 K( o; U7 p% E" F( I
$ F. O) W; V# Y" V$ ^7 [! k$ KNote that some nasty apps could then erase all files from SoftICE directory( E9 C2 \" \" ]5 S. b  u, G
(I faced that once :-(2 b" I% e  c( m; g7 R6 I
, ^/ _0 K) G! H- r) x: N
Useful breakpoint to detect it:
' J: _2 A) H) ~
& y! T; \6 K. w3 b     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 y+ ~# j  r& U! C

3 a; H; u0 _/ r1 ]' ]__________________________________________________________________________
2 W# _. Y3 f: J
+ v! S6 \8 X5 C: t. I- k
) D8 q& F' S8 jMethod 14 5 ]9 g: z1 F6 s4 g8 z
=========
8 F0 b$ B' T; P
6 }, v6 C  H7 T# x+ g. a6 GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 b& D' C3 J: v& s, ?
is to determines whether a debugger is running on your system (ring0 only).
! u- r  V5 V; P8 p& k, z
$ a" G4 v+ `# P   VMMCall Test_Debug_Installed+ z+ B, Y( E4 }4 P) W7 C
   je      not_installed9 q- o0 Y& f! o  O# ?- P, W
( R; [& \4 Q0 X% P7 X" r
This service just checks a flag.
) K! _; w8 o4 O9 j</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-12 14:47

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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