找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& s9 K' ^9 F! E5 m# G% z<TBODY>
9 S8 F; X0 ]$ _5 J$ Q3 @/ _3 C<TR>
+ U9 F" z/ Y. L! Y, e: f( d$ d  [<TD><PRE>Method 01 + U$ f6 C% ?# m  _$ u+ n+ R
=========" l$ M6 C7 z! h$ @' Y) I! M6 L5 ]

+ D' ~! B, _3 e: Y9 D+ VThis method of detection of SoftICE (as well as the following one) is. j9 |6 S9 i/ D
used by the majority of packers/encryptors found on Internet.2 m# Y0 X0 ]& V8 ~7 Z7 Y
It seeks the signature of BoundsChecker in SoftICE
+ Z  S( @0 d. s$ i
$ B! P! F5 B2 `    mov     ebp, 04243484Bh        ; 'BCHK'. {3 p# e4 O5 U( n5 h' x
    mov     ax, 04h
8 G" j% D0 t+ w$ f$ Y1 ^$ W    int     3       ! h" [" N/ _3 X/ f7 p
    cmp     al,4
$ y9 p7 ]8 t4 k+ V1 e: k' H    jnz     SoftICE_Detected% |) H2 g7 T. T, O+ m. g! u

( r9 ^! d1 o8 l; b' ]" j___________________________________________________________________________- M* x0 x; @1 \7 }4 Z9 u- z
) A$ }$ P& s! M4 p
Method 02# c3 G9 F+ o& {; |- B0 E8 _
=========( g4 D( u. E2 F; I6 L
4 }/ v( W  z- A2 s7 {4 _% `8 |
Still a method very much used (perhaps the most frequent one).  It is used! S  m2 I& s4 }  t; b
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,* J; S1 U8 @, Z  s0 |* H* k. I  t' D! }
or execute SoftICE commands...
2 u1 t; l; \& k: `. q3 A" dIt is also used to crash SoftICE and to force it to execute any commands
4 W% n; t+ u6 z2 F. I  u/ O$ `" u(HBOOT...) :-((  9 C! {0 c0 a0 e4 K8 c) \6 O
3 k: W  f$ u  g5 D
Here is a quick description:# u1 K: e$ b: y. B3 b  m( a$ o1 a
-AX = 0910h   (Display string in SIce windows). ]! g" h. T1 G6 x
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)6 [: L3 G9 `" P% \
-AX = 0912h   (Get breakpoint infos), p, u2 P  ]& ~0 O* }5 N* g5 \
-AX = 0913h   (Set Sice breakpoints)
" Y: j1 s1 T0 g3 |! C/ P! w* i# C-AX = 0914h   (Remove SIce breakoints)" \- D$ |+ [0 E9 b: u! G* V. M6 c

( h6 }3 G/ w: `7 R" {3 `Each time you'll meet this trick, you'll see:
" d9 O$ v8 E* Z. C2 w% u-SI = 4647h9 v( Z" }! h' {" U* h5 p" t
-DI = 4A4Dh; [* Y9 `- ?7 |" ]3 u+ H2 ~0 c+ y
Which are the 'magic values' used by SoftIce.
. w1 V# L: m. r  v! l5 ]For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& i' a- D" B) @- ?% _

. S  f: f1 W7 \Here is one example from the file "Haspinst.exe" which is the dongle HASP1 U# X6 \; U; M$ p" P
Envelope utility use to protect DOS applications:2 _( a1 k$ k$ [8 V) e" Y  @1 O
! w, T3 P: b' ?: i/ n$ }

( P4 c! w' Y# B, w4C19:0095   MOV    AX,0911  ; execute command.
! `! O3 y' K: K# z' o4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 \; z! C3 k" `4 |
4C19:009A   MOV    SI,4647  ; 1st magic value.
3 P1 M" r2 l' p* `, u$ {: N4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; @" L8 q8 O1 Y4 Z9 u7 [" ?+ t
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 M9 r1 z# e1 n; i, p0 J) `
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- u& r1 m& [6 A5 F
4C19:00A4   INC    CX& u9 p+ U0 F1 i9 Y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 F0 J: a) u1 G3 T
4C19:00A8   JB     0095     ; 6 different commands.. I$ W2 Q2 a6 R3 j* q, O
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  h) T' r. O( \8 _7 `# h3 i4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& K) C! Y( `: O% K% p* H8 ]- V: q) t2 X+ o. R7 W- o( x8 m
The program will execute 6 different SIce commands located at ds:dx, which
0 u: J+ f  T( T2 t& z8 Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
5 h/ @: i6 A) W% [$ E# S
+ U, E" q- C( P* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 C5 |- D# G2 e. B& o
___________________________________________________________________________
0 l1 R. O# y$ v9 ?
1 i+ b3 Z2 B* E" m
# `0 h9 K! h1 I, `Method 03$ ^' O8 @7 ?# i; E* G+ h0 D
=========
: |+ K/ D# R, z$ b. A9 L1 o2 C
* V* L( [8 M! S1 u8 p3 W" b1 \Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) D) ^1 B" V9 R7 M- w" u  x
(API Get entry point)* H+ U7 X$ ?' ~
        
. N( ~* }! i2 @) k
0 C$ Y6 K" c& z& Y, V    xor     di,di
6 J3 Z- l/ r7 s. ^' e5 r. s    mov     es,di9 r4 H5 U# ?: {0 y. Z
    mov     ax, 1684h       . T0 P- ?/ w9 N7 y  ?& T
    mov     bx, 0202h       ; VxD ID of winice4 _* ]/ W. M* d$ I
    int     2Fh  \6 [: I# e5 @& m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point! m8 k: ~$ P6 Q# ?( Z
    add     ax, di
$ M) v5 _9 k: u' K1 }; Y" b2 v    test    ax,ax
- C6 M  z/ h7 x. x$ I2 G    jnz     SoftICE_Detected9 {+ T8 O9 R- M$ n, T
( i8 @: S6 g8 I5 r- `: U
___________________________________________________________________________; @7 s" z/ f8 E9 \; C8 w2 m

8 K* \/ E' T5 b3 Y" {Method 04
7 o, p1 m  N) Y* a2 L& \=========8 \) l' a0 Q- F' p6 Y; M
; m( o5 v& ^6 o: O
Method identical to the preceding one except that it seeks the ID of SoftICE/ g! ~" C6 A, p% E# v
GFX VxD.
0 P( w- I$ M' i7 N7 K6 N) R- {7 @' E; k1 E  o
    xor     di,di
; y9 d  ^  S/ [    mov     es,di
' ~6 r2 _; p! w3 k% j    mov     ax, 1684h       * V$ M* W" Y" Q5 v3 P: I' Z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID* Y2 x! ?0 Q) I! B8 E
    int     2fh
! ]; E/ D2 a# a- z, S    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 f3 b* z; A* V( O4 P    add     ax, di' ?% s/ D, u; W" X% X( \' p( M
    test    ax,ax! M5 _* O& f+ K8 ?
    jnz     SoftICE_Detected, T$ ?6 g# O" e

& |$ \* C1 M. N# x+ t5 L__________________________________________________________________________. s7 K4 N  c" F/ f9 O
& K; D1 ~) m/ Z# J5 z) q

! R+ q9 l4 [4 n# ?3 @/ W6 L% ^& DMethod 056 X4 m$ I- O1 `
=========$ `  m6 W/ W8 Z$ b' G) ~

3 G7 o7 _! F2 E0 n  t, t1 LMethod seeking the 'magic number' 0F386h returned (in ax) by all system
$ y: O# L2 H- W/ ]debugger. It calls the int 41h, function 4Fh.+ I$ W( e4 n% T
There are several alternatives.  
/ A' W9 R6 G) U" y9 Q) A; G* P  T- H  O
The following one is the simplest:
2 p- {+ g: d& t. G" t% v# s+ U1 c. g4 n* g0 l2 \
    mov     ax,4fh% M, x3 S' U' i+ j4 J) s/ e$ X$ B" b
    int     41h; j5 h3 ^% [( k$ s
    cmp     ax, 0F386
- h1 {; o" ~! j    jz      SoftICE_detected* k% a$ H$ U+ s: ~

; T0 A+ Z, r0 y. k* ~& d3 }1 `8 M- a  `8 R& N2 {/ H3 p, T+ I' O
Next method as well as the following one are 2 examples from Stone's
! g. v5 D1 D' R"stn-wid.zip" (www.cracking.net):
" N- `) `' z, ?( T9 |
' i3 b  |3 y3 C3 ~7 [    mov     bx, cs
/ `" T+ L* R+ b6 J/ F    lea     dx, int41handler2# Q8 ]: d! y; s# n
    xchg    dx, es:[41h*4]
9 [4 {: h0 o0 K4 T; U) Y5 Y+ P) {    xchg    bx, es:[41h*4+2]: ]5 e, [% z4 n4 o) Z5 t7 _
    mov     ax,4fh" p6 e( E6 R. d1 Y
    int     41h$ M7 e! }2 Q6 {4 T7 }+ b
    xchg    dx, es:[41h*4]# N8 x4 ^- t- `( M/ n
    xchg    bx, es:[41h*4+2]$ l- ]& _+ @3 P6 ?9 `
    cmp     ax, 0f386h
! E5 u: [9 K# o    jz      SoftICE_detected( C) y( w. e6 F; q' j) [
/ H+ }' m7 J9 X- v% K
int41handler2 PROC
+ w7 Y7 U( R1 l8 T    iret
2 V% x! |4 i: H/ u: t0 j0 Fint41handler2 ENDP
) X9 N, b) D8 k% I, t/ Z; r3 ~! b* z3 m2 x% x; G3 j+ a% z) r$ H
  `( P% y# D( v6 Z
_________________________________________________________________________- q/ K9 M3 a; F* R/ Y& n& [
" O% d: g' c& u5 ~& j! i7 L8 @3 y3 O
# Y: q$ }6 ~' S4 @4 E. E
Method 06
) b7 Z. r/ i. i& v( i& _8 S+ w=========
0 l5 m& H5 {( y3 `
! N+ I. @) s# c5 x/ X; H
5 Q/ L, _* \3 t- u- o- e2nd method similar to the preceding one but more difficult to detect:
( k  M. z) I; [" T/ o- k* W" c2 h6 V! f
% q3 L' w$ b- e& {8 Q
int41handler PROC
' S( P; Q, P; A  {4 |    mov     cl,al2 l$ l8 J- K- y! J+ l! a
    iret% z: [$ }) c8 }/ `" x$ E+ @4 ~
int41handler ENDP! I7 P; |6 G7 ?" V+ W+ A+ e
& i6 W& X* p1 o/ c  t

4 ~6 j1 D! X4 Y; h    xor     ax,ax
% \0 m+ o1 a0 I4 _: G: n    mov     es,ax" o# u$ X; p0 Z6 G
    mov     bx, cs' o+ }# T) w; v
    lea     dx, int41handler
  o6 F! u/ [, w& K' A# w    xchg    dx, es:[41h*4]
- I0 {  ]. [: J7 s( B    xchg    bx, es:[41h*4+2]
4 `8 L9 O7 a$ Z5 U    in      al, 40h4 r$ q4 X, I* n# Z; Z* Z( I; W
    xor     cx,cx
* l6 K' W+ @) }1 Z    int     41h, t. p+ g: k( J, b! T
    xchg    dx, es:[41h*4]! A% T4 w  G5 q$ R. l9 ?
    xchg    bx, es:[41h*4+2]
; ?0 k4 f/ N7 }! d, ?    cmp     cl,al
$ [1 b, D8 I! [8 t0 J4 R3 `6 s. H' a    jnz     SoftICE_detected
) H- E0 c; r% W
  e/ [) J# h6 j8 t$ Y9 B; w_________________________________________________________________________/ f4 z! C6 k" M: D) C
# a/ M' X; G. m; }8 M& p
Method 075 }+ }7 U2 Y  G0 k" G5 H
=========
# f+ |( ?: G% B9 {% Z( V; U$ l/ {6 }' U7 p* c
Method of detection of the WinICE handler in the int68h (V86)5 \; m% E/ C3 X/ l2 s
3 ?& s3 b* A6 b
    mov     ah,43h
* `! G; d5 ?5 V% E7 B/ w/ g    int     68h$ T  a3 }& r* ]$ |4 n1 K
    cmp     ax,0F386h
( |) h0 {$ O- W. P    jz      SoftICE_Detected! q4 ]3 @& ^& c( a

4 t5 U" c: M; G, |+ m5 e; x+ ~* q9 Y4 k$ W
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& Z" e. `2 _, X2 r) }/ O. m( s   app like this:# H) f  }' a4 Q0 i0 o8 @
7 w5 Y% ]: ]! {+ d2 _
   BPX exec_int if ax==68
# _4 K& A5 t$ L. I   (function called is located at byte ptr [ebp+1Dh] and client eip is+ _4 t% s$ J7 c( s. h. h; u6 k
   located at [ebp+48h] for 32Bit apps)- j; ]5 s* N' s- Y% l1 ^
__________________________________________________________________________
% r, \  ]% K1 l
' ]" m8 N6 V% H; I0 `
$ J& D9 |- g+ t, q/ t& B5 yMethod 08
' A0 ~) u( x; F1 A0 @" O7 M4 L" D=========
; x. W1 R1 ?$ k, T
% C  ?( Q7 u$ L/ x" F/ aIt is not a method of detection of SoftICE but a possibility to crash the
( G- v. C) C2 L$ q2 I5 `system by intercepting int 01h and int 03h and redirecting them to another
7 f; r) g1 X  `% T/ {routine., N. L3 n+ d. j# ^; o( W5 ?5 @1 I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, k/ L  \- y' i
to the new routine to execute (hangs computer...)
( |5 E$ d- E0 l( Z( ?
6 v! |3 P7 _. ^1 a    mov     ah, 25h* G* g$ G9 z) h5 \# Z- ^9 S
    mov     al, Int_Number (01h or 03h)
9 R. o( B5 Z; ^1 ^# x& n    mov     dx, offset New_Int_Routine! T* Y. f2 i/ M/ i" @) i
    int     21h0 d4 G1 Y! w3 t# D6 N2 X  x1 n
7 P9 Q' \& E+ M7 D0 M* H
__________________________________________________________________________
: ~7 s  g0 F7 O8 p+ A8 l3 `  X4 c/ U, k$ p9 G$ l" \2 Q
Method 09
3 r  a2 T' F, [1 M7 X1 f=========! b5 y: E" Q4 _6 S  j* H+ D( I

) v$ j1 ]7 H6 p* Y7 L. vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only' ]8 Q' E  A6 U/ U! V# z" Q
performed in ring0 (VxD or a ring3 app using the VxdCall)., G- d8 B+ W, O; S. i2 l5 j
The Get_DDB service is used to determine whether or not a VxD is installed; l0 Z+ ]( a' m: O# q
for the specified device and returns a Device Description Block (in ecx) for
, V( W6 B5 z) j, Othat device if it is installed.; b' D% F% I5 o! _; }7 B
4 |$ b; n+ ^4 P, S" A0 S7 T
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 D% k4 X5 J( i5 z% Y  e   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 K1 W) d; w  A5 X
   VMMCall Get_DDB
% @. d3 @4 M6 K% _( o( \   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
) Y0 a+ g) }; A# r" `) y. X  W, C
Note as well that you can easily detect this method with SoftICE:
% o9 I- s# u6 R% h1 L6 A7 E2 ]9 l   bpx Get_DDB if ax==0202 || ax==7a5fh4 |8 S: X, t- e1 R

  ]- _. d8 A, e; R1 s; I3 m__________________________________________________________________________& L" O/ l/ x9 C8 X  t; W. K4 Q

% l/ {4 V6 L' _& {: ^& WMethod 10- \+ O7 F0 c( F2 Q  `, K" w
=========
$ |! H0 h3 x- H/ M, R( h, d+ [( {  N- A. n" h% x0 t
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- u3 k9 T: i2 [( B7 T5 p  SoftICE while the option is enable!!
; b3 c, X+ W0 I  v8 k9 g* b2 j; V) Z) J$ q6 y* s
This trick is very efficient:# V. T% Q9 t# ~4 h
by checking the Debug Registers, you can detect if SoftICE is loaded, V. Y, t$ j7 G0 O' Q  {
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( u+ A& D8 _5 ^5 w; R, g$ Q
there are some memory breakpoints set (dr0 to dr3) simply by reading their; W  d. e% J& m  I) w
value (in ring0 only). Values can be manipulated and or changed as well1 l0 ?% y2 k1 D5 F! u  V
(clearing BPMs for instance)* [9 y/ u! ~: R
, A" H5 X: K" x, P: ^) d2 E( m
__________________________________________________________________________
: Y/ |2 g" }: u4 d. O$ }" z5 R
  @# z3 n2 _8 a6 F: {Method 110 }, b7 ^+ ^4 ]3 V% R" N
=========
/ W; X* D  s$ U9 @* f3 s6 ~; F0 X6 {$ q5 X3 R
This method is most known as 'MeltICE' because it has been freely distributed) W% H3 u; H# K! S# }- d6 B
via www.winfiles.com. However it was first used by NuMega people to allow
* ?5 {$ i7 \0 r6 Z  U6 i, o+ D. GSymbol Loader to check if SoftICE was active or not (the code is located0 |/ E% K) f) u6 O1 D) f" y
inside nmtrans.dll)./ Z+ g* i% l; i% c5 k& H4 u0 i
7 Q! I, O! G9 K% m8 v* `
The way it works is very simple:6 e( t/ P9 C7 k+ R- `2 |
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
$ w/ _9 V* a4 M6 H! vWinNT) with the CreateFileA API.
. x& s& ?& k. \1 x  o7 N/ s* E% E/ j
Here is a sample (checking for 'SICE'):
, _$ e6 S1 [4 R/ L, p! c* m5 L/ `) z1 o  H3 Q$ _" H
BOOL IsSoftIce95Loaded(). N, _( o3 L- y" F2 P
{
7 k5 o  N! L3 h3 i# K   HANDLE hFile;  $ Q; R! q, W- S$ v  S2 x
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 q& B$ d. G  ^0 e% ^1 Y- D9 }                      FILE_SHARE_READ | FILE_SHARE_WRITE,( b+ c3 U( _" W) e! }
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( @7 e! C5 C+ }( {3 P# }/ Y# K2 H% }
   if( hFile != INVALID_HANDLE_VALUE )
4 ?/ l" k9 o1 e. `7 }& b# m4 N   {
  L* n* M$ ?( r) `# @$ @( h      CloseHandle(hFile);( y7 [) l6 r& Q( r
      return TRUE;5 X1 k. n' e! c, a- C( s
   }
3 d# z6 F4 ]' j; B- j   return FALSE;
; i# }4 y$ a- f. }+ f}( C% \8 x; ^4 E

( |. s8 o2 w4 Z4 YAlthough this trick calls the CreateFileA function, don't even expect to be
4 c8 y/ ~4 a( kable to intercept it by installing a IFS hook: it will not work, no way!3 `8 |4 ^5 D8 B+ |" }
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
  t! W( W% ~: u6 Q# f7 hservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; ]: K5 m) p- z) m% T+ r7 Rand then browse the DDB list until it find the VxD and its DDB_Control_Proc) ~+ T+ T, C- @$ k+ U8 W( q0 x
field.
6 k% \7 n/ |- zIn fact, its purpose is not to load/unload VxDs but only to send a % H5 J# f+ G; W3 h% o
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 X: |2 N+ v" y% Dto the VxD Control_Dispatch proc (how the hell a shareware soft could try
# K3 V6 N( A& P# f& ]to load/unload a non-dynamically loadable driver such as SoftICE ;-).( G5 E, D0 E. n" ]& d! x
If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 T( r! c  K/ H! |- m: O8 ^4 [6 `its handle to be opened and then, will be detected.+ L( C: ]' o- O1 m3 n
You can check that simply by hooking Winice.exe control proc entry point
  f* k( c, g2 B) a2 j! [while running MeltICE.7 M! N# y$ C( X  q/ ^$ b
- a8 L2 |3 N& T: b
: Z" j; x& Y2 }; q: s" @/ O9 g2 \3 y
  00401067:  push      00402025    ; \\.\SICE: o% d) R* v6 ^+ c! ?
  0040106C:  call      CreateFileA' O! m+ n, T: G' V$ d) F3 S% d
  00401071:  cmp       eax,-001
! L/ r2 O. e* w/ H  00401074:  je        00401091( Y( O. v3 ?) Y% X5 A4 B& H- s
/ B9 O# b3 R; \4 ^. H( y

, `  H+ R7 B: ?4 e+ nThere could be hundreds of BPX you could use to detect this trick.
2 v9 L) Q0 R4 F0 X4 d; J9 Z" N) o  }-The most classical one is:- ]" H0 T% ^4 B, ~8 B* P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% F7 b1 B& \; q+ r# T' s
    *(esp-&gt;4+4)=='NTIC'
! D% p( N5 P/ W/ \# B3 Z) G/ L
* P2 B. O" ?, }2 s. G  R8 b-The most exotic ones (could be very slooooow :-(
. C3 A$ l' G+ ]. x9 m( l+ a+ L   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( N6 c4 @. t8 h1 w! z4 Q$ z
     ;will break 3 times :-(4 H# w, X$ o2 @; d% i0 D: ^
( o6 p6 y' p/ X4 e
-or (a bit) faster: 5 a3 J. i& x& M: H/ i0 v) l6 J
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& c, g$ C( ]4 m: k5 w' }
) T  O% b4 H, B8 e% ~7 X
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! E3 `# _4 i+ A0 F
     ;will break 3 times :-(+ t$ D5 E1 w8 M! a  h
# ~+ d: S! W; ?- b7 V7 j7 @4 n9 H
-Much faster:4 r: Z8 `5 d" t5 ?! o: f
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* a- E. P2 O+ [5 M0 y; a/ v/ d0 }
- o& \% n* _( N  O8 l+ wNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 @+ k: x1 n9 q! g3 t( xfunction to do the same job:
* P/ Z, _1 j+ E# G; \2 G, @' N* V8 R: B/ W5 E  @9 c
   push    00                        ; OF_READ* _% a" x. w" z% ?# l+ a
   mov     eax,[00656634]            ; '\\.\SICE',0
3 \( R1 g0 D  p% d   push    eax
' |* S$ r' M# f9 Q# t. A   call    KERNEL32!_lopen9 G- h% x9 Z) }  _% N7 M
   inc     eax
/ N2 Z' L% c9 i9 X  e8 S  u- b$ }- y   jnz     00650589                  ; detected
9 e. X+ V& T; U: K   push    00                        ; OF_READ, G5 h7 _+ H5 |8 ], C4 U4 Q! S
   mov     eax,[00656638]            ; '\\.\SICE'
. ~4 E8 l, T1 L- D   push    eax! `" W  F* J7 {% j1 ^6 r0 r/ d: |
   call    KERNEL32!_lopen
" L7 g( n0 U8 V- M   inc     eax
  t+ V; g! o' z1 o+ I# E% A   jz      006505ae                  ; not detected
; z  E* \, m4 Q: }: @6 k- u! |1 a% u: [2 w$ T

7 j) H. I+ l( Y5 |3 }% T__________________________________________________________________________8 [' g2 ~1 k7 I. V3 _6 q- Z0 B9 m

: I# Q4 U  j0 }/ ~0 C/ RMethod 12
% p2 m7 H4 z  |' x  A* v=========& m! i- n$ H6 y( N9 |( f- K- L
5 q, t9 L$ M* o8 q( I  ?
This trick is similar to int41h/4fh Debugger installation check (code 053 f& o; `3 q+ Z* U
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, T% l) V  t+ K  s( _as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: X' ]: B6 x- w, t' t/ S5 W" H. V/ A% c
   push  0000004fh         ; function 4fh
/ {5 H% g$ J* D$ ^7 H* s   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ \% L4 Z6 i2 f8 c; {                           ; low word specifies which service4 |/ {9 U/ A$ X  G/ k2 l
                             (VWIN32_Int41Dispatch)
1 R" @& o3 w5 ~" ]   call  Kernel32!ORD_001  ; VxdCall
6 ~0 N" l4 O5 s5 j   cmp   ax, 0f386h        ; magic number returned by system debuggers
' W0 [: }$ y- i3 m3 u' b) R   jz    SoftICE_detected
! X+ I( c/ J! O, S
& W, i3 p: B+ R/ zHere again, several ways to detect it:8 l+ S/ O& j0 |1 q8 [7 o: Q

( B6 ~& J  U; K" \! f    BPINT 41 if ax==4f, \; W+ h' {8 ?6 ^2 t% F) |$ R( Z

, n% @4 b- z7 h6 A( B5 c    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" Y" ~  n2 I& O6 C) z
0 f4 G) B% T. z5 K- h. `    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: _: E7 X+ l% {; M, v6 c/ V

$ u0 K2 h5 l0 N  N    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ @7 ]  `6 u6 }. X; t" v) s$ [& e
8 v1 o! I; p2 G  A- x) ]4 X__________________________________________________________________________
% s) K7 v+ K) R! _. L: Z- C
3 Q: Y$ _' T  ?( ~Method 130 H% s. s5 ]" i& G/ w% g' W
=========
: [# B0 k& a* a+ i  }( O+ Z: d! [7 }7 y( q% J- X
Not a real method of detection, but a good way to know if SoftICE is
4 s4 E# x# Y, X) R& [installed on a computer and to locate its installation directory.
$ b. m3 \# u" p. G: n3 c' nIt is used by few softs which access the following registry keys (usually #2) :: c' N# ~4 h0 H6 B  q$ ?
3 w( Z, q7 a$ @, y$ Z+ A
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( m5 X( o# K- e3 {# T- I, Z
\Uninstall\SoftICE7 ^. ^8 c5 h* m% \' o
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ D- x; Q, F) j$ t" G. O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 e8 D- n7 f; w\App Paths\Loader32.Exe
% U' @# @3 W) {* E5 i
9 Z7 |! ^  [) I, r. a4 b. s4 w2 _) A
Note that some nasty apps could then erase all files from SoftICE directory! J8 r  @. g( d) s
(I faced that once :-(; O- t+ x2 V! l+ A) X& L

" Z8 q9 d  l* V9 XUseful breakpoint to detect it:2 c6 k% f5 X! T. P# |

% j  k0 k* e( Q2 }, y     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" ~! z: }7 A  e9 ?% g0 b* f; k6 d9 t3 h2 E
__________________________________________________________________________2 W" R+ K  V) _' Z9 {5 G
  S# x/ z$ B/ H7 S; f4 f

+ c" Z+ P6 ~0 t* E+ n: SMethod 14   `- O1 A4 L1 F% f/ k
=========: ]& ?% F: D. `% e' U$ P. [
5 Z) Z1 y# W2 m1 ~1 f+ {' w
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, T+ V, w0 l9 _2 @is to determines whether a debugger is running on your system (ring0 only)./ n5 `+ P0 Q$ L% x5 ]

. {+ D: J' K6 H9 w   VMMCall Test_Debug_Installed2 ?- [' w6 Y0 ~  D+ ]8 b9 L
   je      not_installed3 [  M6 K7 b, Z  M. ~
$ d% c2 [/ J: D/ \; ]3 Q
This service just checks a flag.
# e" g$ l  M! }5 u4 `, N( _. _% P* {</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-18 02:29

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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