找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; h9 y$ i# C. e; ]: k! Y
<TBODY>
2 [5 f, P6 r1 F! N7 J<TR>" b4 i7 b! F* h5 k$ i% ^( O
<TD><PRE>Method 01
% ~$ E- P2 ?: e0 r! u: t=========
4 a  `. H8 y& v5 j1 @. r/ w6 h: ?4 f( a; v
This method of detection of SoftICE (as well as the following one) is9 C- w- I- `  {6 R- B: u  }
used by the majority of packers/encryptors found on Internet.
, A1 p* V" L4 uIt seeks the signature of BoundsChecker in SoftICE, u, X/ }& A& x6 e9 u) k: L9 q* u" k

  g% l; I9 A5 Y( [. N3 P. z9 ~    mov     ebp, 04243484Bh        ; 'BCHK'
* q+ |/ \% o8 a5 g& E6 F8 i9 Q    mov     ax, 04h( A. t* J& z# P* ^9 \* q
    int     3       ! o! \. t4 F3 M0 |1 h! s$ ~
    cmp     al,4
0 G# I# b  C8 N    jnz     SoftICE_Detected7 }. K1 J  M' D' ?
, o& }( [4 G& {* |* Q7 N
___________________________________________________________________________
9 W+ c6 Y: F7 n7 `
! @: r2 i  {' ?& u9 yMethod 02' {+ D6 r/ B2 d' d* f. `
=========5 N0 \3 M! Z8 k' M0 h0 i0 p

+ B8 f0 C% i1 X/ v( y5 hStill a method very much used (perhaps the most frequent one).  It is used7 O8 Q  }2 N* a! J9 d( D5 U
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,) c' \- M$ `, ^! i1 z: V. e
or execute SoftICE commands...) D& V5 M9 I5 K
It is also used to crash SoftICE and to force it to execute any commands
0 [2 h; U2 K5 Y% k" P(HBOOT...) :-((  1 m9 n! F9 w0 _" A* C0 d; l- u

0 m: h5 i6 R- DHere is a quick description:
' a, D% v- {8 n  r3 T-AX = 0910h   (Display string in SIce windows)
* }! u0 w1 C5 q+ k' P+ G" |-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( G: G7 A: O' e-AX = 0912h   (Get breakpoint infos)( _- F, Y+ @- s' d6 U% t
-AX = 0913h   (Set Sice breakpoints)3 V8 M! A2 q' `, p2 ]2 V$ z6 Q
-AX = 0914h   (Remove SIce breakoints)
, ?2 F" a1 i0 c4 T$ w; o' |6 r4 m! z5 Y$ |- @
Each time you'll meet this trick, you'll see:& D) t' P9 s6 J& H
-SI = 4647h9 Z4 a( w4 z4 H8 ]1 t; l
-DI = 4A4Dh
# C3 N$ c1 A6 j; x( BWhich are the 'magic values' used by SoftIce.; P  l3 I4 S" R& ^
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
( W/ z) k7 F! F, N! x9 O
5 ]1 {* w. C+ z6 g  h3 `. h* u0 {6 DHere is one example from the file "Haspinst.exe" which is the dongle HASP
! X, y) V) P3 @& OEnvelope utility use to protect DOS applications:
8 z8 w' c  J: ]3 Z. `- U# J6 H* Y
/ g1 g( J) P( P0 f2 P1 @. O5 R  T: N: [% Z
4C19:0095   MOV    AX,0911  ; execute command.7 b6 ^# A; [1 r: ~* }& s
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 h# D# M0 k: }3 V' J' r0 \, L* y
4C19:009A   MOV    SI,4647  ; 1st magic value.
8 O1 G) x$ U, q5 t4C19:009D   MOV    DI,4A4D  ; 2nd magic value.# _  t! f( [: P; b* K& u
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 r7 @3 a! V8 A; x' R4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute5 ]9 u; ^1 x( p  V+ y/ \" X
4C19:00A4   INC    CX9 S: @: N# d- R7 {9 I4 d) o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( P" a1 C, R# {9 J* h( C/ I: J
4C19:00A8   JB     0095     ; 6 different commands.# @" u; k* B! y( E$ h6 |
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! A6 ?4 g" o- ~) @1 U1 O- Z4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 Y0 |) x1 x. a+ z6 S1 J( O
3 S! j& x  l3 J4 HThe program will execute 6 different SIce commands located at ds:dx, which
3 b, g' d; z- iare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ C$ z1 j+ h: _4 c: _' k4 X0 c' ^& w1 H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.4 F: f, ~  P2 H5 }
___________________________________________________________________________
( \4 F% @' P6 W1 t; o
7 H% u% u# N8 X( w) z
/ }1 }! [0 }4 H, f3 hMethod 03" [* P; k. a& Z0 i9 Q
=========0 ^3 Y, N! Z& w$ J
7 [+ z/ \; q9 e6 o  B1 Y
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 `5 [3 z# d6 S' \6 d$ w
(API Get entry point)* j- F& p! N  F/ y' n4 k2 u3 U* u
        
1 S5 j, p8 `0 M% K( s! P* O. m! c6 @9 L( R
    xor     di,di; A: b  X# l5 {! P/ X7 r* s. A
    mov     es,di
. W5 [0 D6 K( L% G( w9 u- S) B- d0 F" m    mov     ax, 1684h      
" G. \, x# V9 R9 B' ?8 m    mov     bx, 0202h       ; VxD ID of winice# e( q, Q, X; h' w" ]" e
    int     2Fh
6 g0 q/ ?7 l  _! q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 [: v& L$ Y% L5 }) Z% E& L    add     ax, di
0 R* l# e3 n7 ^# O. ^4 l    test    ax,ax
% w. d3 ~6 L( u& v* Z) H& @    jnz     SoftICE_Detected
" O: B: P$ [: l& {& J- G1 f8 P4 Y
/ X/ _2 O1 w& [8 Y, I- y% |___________________________________________________________________________
7 J, ?/ v4 ^$ R6 K5 H
' M. N7 s; T0 X1 G1 w- DMethod 04
6 M3 b  Z& |  v4 \) L1 _9 R=========
0 ?' K; ~3 k# Q0 X6 P0 x0 ^. |; P: U% S3 e; A
Method identical to the preceding one except that it seeks the ID of SoftICE
  r/ A( W7 y+ lGFX VxD.+ o, ~. k. ?% u) `  E' U

0 B0 {* b1 @9 W0 x. N; A( g, V    xor     di,di
& k% A0 c3 p6 `    mov     es,di
7 X0 O) p/ [2 b2 G" x6 G    mov     ax, 1684h       6 d) K7 t) H* T0 v7 U
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, }' T+ d2 w8 s+ a+ s    int     2fh$ A7 t* ^1 q& y, M% }
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ B. \5 C( @- J/ [2 D  P+ C; m
    add     ax, di
' o" ^2 ^! l5 N& m    test    ax,ax0 J3 R& H' _  R/ z# a  K
    jnz     SoftICE_Detected
  x1 C  z& ^: ~( E$ |% q
% v/ F7 g( I) C; F__________________________________________________________________________; m4 y$ `4 g# t% h

( g5 S3 h: d/ Y5 B  P9 x- @7 ?0 a* Q
Method 05
: t6 t. F( @( F+ O=========
5 x7 v/ E9 j5 H* X9 m' _+ I8 [! l9 v+ ^& f% C) J
Method seeking the 'magic number' 0F386h returned (in ax) by all system9 H1 S/ c, r! m0 _- x
debugger. It calls the int 41h, function 4Fh.
  _9 z1 x3 M, P0 L. {4 `' f' pThere are several alternatives.  
( s5 e3 _3 ^3 m3 C- W& O& `8 b9 s* F- a' K
The following one is the simplest:) ^3 y& D7 B3 p/ T
1 |  p; D2 f) O* u, r
    mov     ax,4fh
! H0 `3 |, \+ v6 H    int     41h
+ \7 G  n& n0 p- \( y! h    cmp     ax, 0F386
. V6 @5 F! E* r3 s- L+ @; A    jz      SoftICE_detected
' r/ T3 {, B* ]& o+ Z( k0 b; V' C8 X. U2 C8 q

% f1 ]" D' R+ n; `( P% ENext method as well as the following one are 2 examples from Stone's 8 X* s8 ?4 e7 x- @8 S+ a/ U
"stn-wid.zip" (www.cracking.net):
% n2 ^* T# f& t$ _6 i1 V7 |. o; c! ?) y; m  a
    mov     bx, cs
5 A( f$ d: J* F* D# D9 X    lea     dx, int41handler21 d; s: ?9 m1 ~' _/ x
    xchg    dx, es:[41h*4]
: ?  z) U" w9 _& d( `3 _7 u+ X$ H    xchg    bx, es:[41h*4+2]& s. P+ B1 e( ~1 X& R9 i
    mov     ax,4fh
: L3 D% P6 _' s& r3 M# b+ ?& H* l    int     41h6 y7 D8 ^; Y- H: ~! s
    xchg    dx, es:[41h*4]' @2 V) K. j# l- D- c4 J4 B
    xchg    bx, es:[41h*4+2]
: M' J4 k# D0 t5 ]# y3 F    cmp     ax, 0f386h; g) c) K( K% M2 ~$ D
    jz      SoftICE_detected, z: [: d; S6 H  j# B8 C3 g- m
; n$ g4 H0 o) ^- }3 O" i2 H7 h. r- N) a
int41handler2 PROC5 `8 a$ g- l9 K6 c8 g
    iret
1 H; _+ e. V  Y. [* Xint41handler2 ENDP9 g/ L  m: a( P8 ]3 T! U7 e

1 X/ o& g& L( l3 @8 w
( U/ V+ n9 L) j( g1 p# @_________________________________________________________________________
' z% w/ A; w% Z6 V
- X0 B# `+ D. F$ I; |9 G2 M2 q+ |: t0 P7 e( ?; V
Method 06- }6 b9 @8 c+ p3 }! R, _
=========
9 \% s4 ]9 C/ c
5 Z. x5 Z/ w# v( _6 M8 E* n" q. x( P7 @4 J0 L( u0 `4 b$ L
2nd method similar to the preceding one but more difficult to detect:
& y4 v% Z* |- S' D8 D) Q
9 X! Q) z( I. W- a/ ~  _; ]" s) I+ x3 p; Y# k; u
int41handler PROC; L. L' k  K4 N$ H+ U0 X
    mov     cl,al& M! R% f$ a4 h
    iret7 a: U- V  Q. {! a' \
int41handler ENDP
0 v# p) Z9 z3 R5 }4 y5 G! |! O8 ~4 f7 j. n) u( t: e
- Y. ~- z/ {/ r
    xor     ax,ax  w. l) p& t0 w6 L  i
    mov     es,ax
5 v& D4 x+ P+ z' Q+ S' w    mov     bx, cs; L+ c4 a, c0 \; K2 a8 V
    lea     dx, int41handler
6 Y% B. H9 A3 f7 g    xchg    dx, es:[41h*4]8 }' V7 ^0 l2 i2 r6 T; i* {
    xchg    bx, es:[41h*4+2]
$ s  s9 d( {4 q+ ?2 @    in      al, 40h# l5 D, V" @; o; D( }
    xor     cx,cx
- f( x/ |3 ~9 g    int     41h
1 `4 n# `4 j  K" y  ^, N3 ~) R' g) U    xchg    dx, es:[41h*4]
$ y' ]3 N4 n1 W    xchg    bx, es:[41h*4+2]# A( Q1 h  K; u+ }& R+ ~
    cmp     cl,al7 q( h' U+ i: ~& W- V2 r
    jnz     SoftICE_detected+ S" C/ Y/ T; d. ]$ e
% t1 E) H. Q( t9 h
_________________________________________________________________________, P& }- g5 U7 Q9 m" I6 W

, _1 g# h- Q/ V' f, [3 w9 Q# y* TMethod 07. r3 g6 f+ P# ?  E+ P
=========
2 i: K8 L/ F5 M' V
, M2 k0 l8 Q8 a' XMethod of detection of the WinICE handler in the int68h (V86)
& u7 x+ R$ |& T- b/ l8 a1 i* K: U0 j# {
    mov     ah,43h% g4 r" d, ?+ h* G
    int     68h+ Z2 J/ f# B( h( L. Y: u
    cmp     ax,0F386h% j( q% r; S& @; I8 y5 z
    jz      SoftICE_Detected* _' ]. n) T4 K6 g9 t0 ~6 \6 G1 f7 ]
9 U/ {- E2 z" t- T7 L3 r. A  o
8 l  x# I+ D+ P2 I# l; j8 \+ I
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 g* k( q. z' A! A
   app like this:7 E7 u( F8 ^/ Z/ f& v
. _1 c* \) o) G" ^
   BPX exec_int if ax==68" t* D" l9 V) X5 Y
   (function called is located at byte ptr [ebp+1Dh] and client eip is8 g2 N* L! Y; B! D
   located at [ebp+48h] for 32Bit apps)" r9 Y5 X! \' b$ p
__________________________________________________________________________
  S1 U3 u  r  ]! X: h1 w8 p+ {. u8 ~

" R# u" _8 x' {, v4 s* tMethod 08
6 }* k+ `. n  _6 U; K: W=========# @. @' t: A5 D; z) u  f% ?0 w
$ Y( J0 Y2 t5 y6 ]
It is not a method of detection of SoftICE but a possibility to crash the# _# p9 T4 g1 _" J+ [  i
system by intercepting int 01h and int 03h and redirecting them to another
( n! O$ K0 [, S2 O: Mroutine.) u' i% h' h4 j
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' O" W. h) s  O. p! f/ Xto the new routine to execute (hangs computer...)) Z: W+ b% S' _
8 p, c% @2 j: t& \9 `! E
    mov     ah, 25h
# [1 E( z1 a* E    mov     al, Int_Number (01h or 03h)# m. d5 y5 x4 y  {9 S0 |6 K
    mov     dx, offset New_Int_Routine
0 E- f3 y6 n5 [3 {1 B    int     21h
5 B# Z" k6 k7 b8 m' d9 F7 K
/ ^+ c, Q2 A* Q& S3 v( |% f5 t! Q__________________________________________________________________________% g. z' _* Q6 R+ l  h, L

. M% C8 t  x! N& gMethod 09+ a& ?6 k; z9 K5 r  @
=========9 e5 s& o5 w6 W1 b& K: t' e) Z% {

  c* c. r' N5 M/ H: K7 DThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 K+ p. }+ D" iperformed in ring0 (VxD or a ring3 app using the VxdCall).- h1 U3 c) y) S8 j" K
The Get_DDB service is used to determine whether or not a VxD is installed$ }- w' _: n/ g  D
for the specified device and returns a Device Description Block (in ecx) for8 Q( p4 V8 S" D" H2 [6 {5 A- o6 T
that device if it is installed.8 x3 @3 u# e$ X. E5 y7 S7 Y
; Q8 Y/ B# r0 V
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID  S  {- J* ~5 `6 i/ \9 t8 P
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' I/ q; }- u. z$ X( z   VMMCall Get_DDB
8 R2 M% x1 w2 d; A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
3 M2 Z3 M% y2 ^1 r
* o  G3 J! a( i* l( f& K* FNote as well that you can easily detect this method with SoftICE:  c# j( h0 [3 q+ q% w
   bpx Get_DDB if ax==0202 || ax==7a5fh
+ B8 }  [- }5 M) }! x1 l
% H$ y1 L+ \6 q8 {$ c+ [% V# Q__________________________________________________________________________
# H3 F! H, R# @1 S3 D( b4 |7 A5 O$ D4 j7 Q  O4 d+ P& r, R
Method 101 a0 G! X1 y8 ]
=========3 S" o: k4 S6 ?3 R& I
9 O9 u% _5 q) e" I: e( |
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
, v* Y8 G" v$ `$ Q- c  SoftICE while the option is enable!!
0 N  e7 x" d9 g2 v, `3 ?1 M
, ]5 w! S% S& j9 jThis trick is very efficient:
/ ~4 |3 @- w' ]by checking the Debug Registers, you can detect if SoftICE is loaded
/ H  t2 u* s9 E. r# R- j(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
6 q& @( A& h1 b  S3 ^there are some memory breakpoints set (dr0 to dr3) simply by reading their
) h9 I% M; k) `$ ivalue (in ring0 only). Values can be manipulated and or changed as well
! E, _' y/ I4 ]9 R* e( Z7 X! A(clearing BPMs for instance)
% [! @+ N+ ^" `
) L5 H/ S  R: m) d9 W5 ~- ]__________________________________________________________________________
) @' W7 ~! H- Y9 f
* u7 v7 I; t5 mMethod 11
9 O. F9 F, Y  \) ^- M=========
( Y7 A3 h& q+ l/ b2 _+ o( S! s6 ?: m! q$ f# Q
This method is most known as 'MeltICE' because it has been freely distributed. ?+ z9 z4 U- ^& ~
via www.winfiles.com. However it was first used by NuMega people to allow) Z7 O' Q# z/ ~9 t! S( t4 e5 Z3 Y3 M5 N
Symbol Loader to check if SoftICE was active or not (the code is located: q5 I0 D* ]3 q- P  ]  O' ~
inside nmtrans.dll).
( W6 F2 R6 e# B* p3 T0 A" g- M8 H
The way it works is very simple:: F* W2 D) q$ G6 s8 R) |
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" ?- T2 P6 e+ _$ B  L
WinNT) with the CreateFileA API.
0 C+ A0 V/ |% T' L1 }, U$ l+ A% F( x; a
Here is a sample (checking for 'SICE'):/ F" T! }0 j1 j6 d; `: Q: x
, G  `$ s+ K1 Q6 k& L# [+ Y+ H; [6 n
BOOL IsSoftIce95Loaded()
) {' R' P* P" ?2 `{
) z, G# }( W4 O$ B' k8 G2 w   HANDLE hFile;  2 @: Y: l, v4 ?* \
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 W+ S  W0 E0 E# l( E                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ E" }& x) X. W3 U
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* w- O+ H$ u0 a( {  K   if( hFile != INVALID_HANDLE_VALUE )
% J, Z! a% L& Y3 M1 E& w   {/ |& J( W% s" x, F& H5 h
      CloseHandle(hFile);
  g3 S% p& {# L0 L4 m0 t      return TRUE;6 e- O  t/ n+ t& a4 v# e. c5 g* ~
   }
) z: u0 u2 K3 |- R   return FALSE;
5 q3 A- f0 C# J$ H; D2 p4 T}
/ m# F& }' u5 V: v5 s
$ f" K; X: p, n6 w3 nAlthough this trick calls the CreateFileA function, don't even expect to be
8 I0 L4 F& I* O+ n4 h1 ]able to intercept it by installing a IFS hook: it will not work, no way!; {" z  ]$ `+ V7 W$ o* |
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
) }8 y& g6 Y+ i2 s, Q* E1 Eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
* z4 o( y& Y- O# }: k' u4 w9 `& O( land then browse the DDB list until it find the VxD and its DDB_Control_Proc) [. Z5 h+ w$ O$ Y6 b( S+ V  E
field.: o8 D9 w1 z! Y5 ^
In fact, its purpose is not to load/unload VxDs but only to send a
' b; }1 i/ i4 i1 i0 I: i  EW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
$ Z. T& t0 b( r, z9 S$ ~to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) }9 q8 a$ M& B/ }8 t. [( B* R( Vto load/unload a non-dynamically loadable driver such as SoftICE ;-).8 D! l  E: m. G% B
If the VxD is loaded, it will always clear eax and the Carry flag to allow9 |# M6 s7 W8 w0 c, T$ K
its handle to be opened and then, will be detected.
: t8 z2 Q8 t# o+ X4 _* c6 o4 IYou can check that simply by hooking Winice.exe control proc entry point
3 K. V) }7 ~  P7 t+ Lwhile running MeltICE.- I* E% R, q) v/ \9 o

, _7 c8 S( d( ]) z$ d* Z
6 u4 h+ G; A) E  t8 v& Y8 K) U  00401067:  push      00402025    ; \\.\SICE7 \2 [, b& Z8 R7 ^
  0040106C:  call      CreateFileA, X0 O6 K' Y/ a& R( l
  00401071:  cmp       eax,-0010 ]3 D) |. K" t9 V/ {2 V2 c
  00401074:  je        004010915 b" P9 @, D) u0 y* `; r/ r, v$ ~

6 j" R) d4 D1 [& n5 r  n* u6 b8 Q. `! @
There could be hundreds of BPX you could use to detect this trick.
+ h2 C0 h3 ?( f; j8 `( `7 [-The most classical one is:, a8 S; T% [5 _6 G$ f- n% d- @/ P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. K$ G' Y- x& a6 ?% p
    *(esp-&gt;4+4)=='NTIC'0 h6 E1 t) r* T* `! M) z& Q8 c$ L
5 b$ U, V+ d6 p# t* E; Q' h9 @- C
-The most exotic ones (could be very slooooow :-(9 c( S) `# G8 z. A# i' }
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
: Q' S5 z6 s& i& I- a! }     ;will break 3 times :-(# f; ^  {  Q- W4 w; ~

5 C8 g6 b8 B7 K: V1 Y-or (a bit) faster:
. D" I/ x) z) x# n; z# m& ^+ y: E$ S   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& ^6 ], {# Y6 a6 W* M  _; \* W6 r9 t  \4 f2 ^7 D' D1 W
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! i2 l& m8 S) v, ~, y9 D$ _     ;will break 3 times :-(
, E1 k0 a' ^# l" y' ~  e3 v. P6 [  o, X
-Much faster:  B7 h) v2 l5 G. _  G' g8 W
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': d. {: _9 u1 v

8 ]: N) C7 ]+ m9 C+ y# Y& hNote also that some programs (like AZPR3.00) use de old 16-bit _lopen( L9 @% i9 z8 h( P& s
function to do the same job:7 i8 ~: u6 G1 P% k

& e3 \# r$ ], `0 B: x, v   push    00                        ; OF_READ7 X* P  K9 }; T/ n+ c5 Z
   mov     eax,[00656634]            ; '\\.\SICE',05 L* r& [: f+ k6 s6 U
   push    eax
- {/ K4 Z1 ~# Y) v  I   call    KERNEL32!_lopen
5 |4 e  s! l. m3 p3 \; n) e+ ~   inc     eax& }, X  P" t4 E$ b- b
   jnz     00650589                  ; detected
0 D9 G9 T3 z, r+ Q( ^   push    00                        ; OF_READ( E0 N! `% P" J- p3 l6 |( z4 Q% c
   mov     eax,[00656638]            ; '\\.\SICE'
5 @) o  z4 e  I9 ]5 Q   push    eax5 S7 j# C4 c9 e
   call    KERNEL32!_lopen4 R5 C% i' o4 ~8 {/ x# C
   inc     eax: D2 k3 [- l1 S8 P
   jz      006505ae                  ; not detected
. \8 L% A& ]5 C& N+ I, o
( G$ D3 ?% Q4 g1 I
6 R3 C5 a: s0 W1 w/ V__________________________________________________________________________
+ s" e( M0 V+ P& U8 @0 U5 P2 s
: I3 G' q6 r- o# U# u  fMethod 12
3 W9 t& i- T0 _/ w4 E=========
; |/ Y1 b* _4 a+ w- d+ W$ r9 f" I% r4 _1 O! C: r
This trick is similar to int41h/4fh Debugger installation check (code 05) B7 L8 f* A/ n. D9 j4 W$ v
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ ~% n& |+ d& h9 k) w2 ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# @- ]) Z3 C2 ~; F: D- r3 ]9 _5 m: t' ~* Z: U9 H4 Q9 D( p
   push  0000004fh         ; function 4fh8 c( ~6 Z6 |8 m8 F) I
   push  002a002ah         ; high word specifies which VxD (VWIN32)6 O. H5 E0 Z. t8 E+ ]7 d) t
                           ; low word specifies which service
% s0 |* s* r. [                             (VWIN32_Int41Dispatch)8 }+ d, K/ Q- ?6 l) K( B
   call  Kernel32!ORD_001  ; VxdCall
9 T; ]) L# b7 _6 X: q- @4 V   cmp   ax, 0f386h        ; magic number returned by system debuggers
3 \) A3 |  B$ x   jz    SoftICE_detected
$ F/ @. `' K! s9 ?* a1 D# v3 D& V/ z- d/ h9 P+ y! U# x
Here again, several ways to detect it:8 @$ [7 e! J! r5 X

- o, z$ K8 ^7 @: q  @- {- ~    BPINT 41 if ax==4f
( }" Q' N; m: {  n' D& V; z  x' Z1 \' F' C- H
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ G% M$ [% V( `& }% t
3 m& X$ m. U0 M+ H# x
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' q. E5 Y% x) i4 C+ t
) E7 U3 g  s. |) H
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- u! d! H5 X$ F! n7 H  O1 i
9 l" |6 C' A1 B1 v' O# X__________________________________________________________________________
; k, L, B% @. {0 Y! W% O
5 h3 S' ?- r' h' g0 q+ I+ k$ MMethod 13
# M$ c( k, m2 ^=========
3 k' T0 ?& M( Y0 R3 A
2 x9 n. A( p$ J  H# TNot a real method of detection, but a good way to know if SoftICE is
3 ?5 ?1 A, s& J- }: F/ j! xinstalled on a computer and to locate its installation directory.
. J  Z  E5 F- x( A7 \9 y1 {$ vIt is used by few softs which access the following registry keys (usually #2) :
- f, j: t  B7 \8 i2 @( w3 E. k( P" {
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' @6 ^: t; w$ l6 Z\Uninstall\SoftICE1 j% p  m6 U  i) B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 R4 W6 r, J# l( q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 O) l7 {  j' g# j\App Paths\Loader32.Exe
: \" O" Q# f; N- q' t/ \
# i, \" l% X9 A% P3 G6 q$ R. J( z: M1 N( S% w
Note that some nasty apps could then erase all files from SoftICE directory
. l5 n. H( C9 k$ G3 S  f) Y. b(I faced that once :-(: k( k8 R9 M. J0 i

2 V, g+ F" [7 B8 Q( BUseful breakpoint to detect it:. d' `: L; N& c" i8 E
0 Z+ S' v0 t8 ?" @+ C( W/ b
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! m* K* O. @# f" R+ @

: W; K7 e, t; r6 K- C5 \__________________________________________________________________________  _9 ]- X5 t% X, o0 w3 P
( S+ i$ {& s& n' Z4 k

7 C: w1 U- t  r) V& `( mMethod 14 ' ~- R* ]% C6 b$ m# X: ?% s
=========
3 l4 o  E' e* t  s% k5 }
8 N9 C& \" \1 O7 ^" }- ^5 ^3 kA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 {: j, i5 l; h8 ?0 {2 zis to determines whether a debugger is running on your system (ring0 only).
5 w5 o- [8 w$ a1 u8 j. e' K/ N- A0 _/ [+ @* B- T7 U& ]+ }
   VMMCall Test_Debug_Installed# L9 u. I  U7 _# ~
   je      not_installed, A4 Y  J( \$ s

, d- c' k5 C9 J, I+ Y! WThis service just checks a flag.  c8 L% ], Q: a, B/ J; F
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-2-22 01:40

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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