About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: G1 L" B" x1 K! r  o' \
<TBODY>2 H  d7 V1 t! [; h3 G/ [8 {; K# X
<TR>
1 J  G: ?/ u9 d1 P<TD><PRE>Method 01
0 `" f+ `( D+ I* i' G* v8 _* j=========8 h$ ?) x9 {; u' Q% K
6 X8 E4 ?, ]; s: l  f
This method of detection of SoftICE (as well as the following one) is: ]' E* S" [7 u/ A
used by the majority of packers/encryptors found on Internet.
- _( k8 O4 B- n+ U! U1 oIt seeks the signature of BoundsChecker in SoftICE
. v1 u' t- W5 Z. G& b* w3 q2 c* L1 z; H
    mov     ebp, 04243484Bh        ; 'BCHK'
' R8 Z, U. X1 y1 R* Z3 D    mov     ax, 04h2 h- V' ?" W4 Z  i
    int     3       7 p  s  C" x( I7 B; n; \
    cmp     al,44 u! m5 M# d4 E2 w" d" s: D
    jnz     SoftICE_Detected# L6 y% B% a3 J) l: \
  \) R8 J6 l: x2 `9 h. \& k* P  L
___________________________________________________________________________
# i8 b) R" z, @! i$ M! W) M! w) A  @+ v
Method 025 ~- `/ k- H6 ^0 y, t' [6 e
=========" z6 C0 u6 ~( ?7 ]! k! m$ H
# C: A- j5 h. g! |' R6 _; \
Still a method very much used (perhaps the most frequent one).  It is used
3 s9 C. I! v8 k( e; Q' Uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 J. v' Z! X1 C! s6 M
or execute SoftICE commands...
  C$ f$ g# i/ i, JIt is also used to crash SoftICE and to force it to execute any commands9 e) S& R9 ]9 p8 D" J" f
(HBOOT...) :-((  
5 Q: R; @# x0 x9 q: P3 @" j& k0 a
Here is a quick description:
4 j* a, l! Z9 E2 w; B# f-AX = 0910h   (Display string in SIce windows)
* C+ G8 w5 b+ `/ C% O-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 ~" \3 Z/ _$ j" r2 X  L& H) m-AX = 0912h   (Get breakpoint infos)
) a5 a7 b! ]! q0 ]-AX = 0913h   (Set Sice breakpoints)
& Y! m% i7 D% ^5 r. E" b. {-AX = 0914h   (Remove SIce breakoints)
+ {- o, d9 B/ y) q( ~# V- i1 x( J4 n% z7 s% N4 t' L# ]; l( a
Each time you'll meet this trick, you'll see:
! E: g$ X( _8 t-SI = 4647h9 \& n9 o. K+ h  A$ q+ F
-DI = 4A4Dh: o  x9 Q% G+ l! ]: h
Which are the 'magic values' used by SoftIce.
  J0 v3 d" I" \% A- hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 v, n! B6 h  J7 ^' h' c. x7 O, N' h( {7 J. z5 k8 i
Here is one example from the file "Haspinst.exe" which is the dongle HASP
+ g, l7 A" t' ]: v( P) c9 ^Envelope utility use to protect DOS applications:$ z. i4 y: R- X- v1 w; y! @8 F

7 x, ^  r$ g. A
- n) T5 X" V4 l" P4C19:0095   MOV    AX,0911  ; execute command.
  j$ X. c- R# u4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 c& {$ o. h1 w! o0 L1 x2 Z5 R+ W
4C19:009A   MOV    SI,4647  ; 1st magic value.
& ]- _6 L  ]. M/ f4C19:009D   MOV    DI,4A4D  ; 2nd magic value.& w8 A6 Z' v2 R4 X
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" p% f3 X! Q' A9 k) O- h( m
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute, Q* S0 \! O, h  R
4C19:00A4   INC    CX
# z0 O, S* b; f: q0 a/ I( C. n4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; c6 _+ v7 L( I" g( X+ }+ x8 b4C19:00A8   JB     0095     ; 6 different commands.
0 E$ i+ O. [; P6 Y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  r: L! @% C- U) }4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 j! x$ W- M* K2 t  N+ ?

! o4 ?; A. F+ b) c% mThe program will execute 6 different SIce commands located at ds:dx, which7 W. \! ?. e% z0 i
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) j3 g% s6 k1 s" m
6 I4 S. w$ w5 I7 I* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( V) \& t. k7 W
___________________________________________________________________________
1 k# Z4 _' o! B. ^* t0 l( c" _7 `# b% w" L3 [& I# ]9 X
# M. {! W" @6 L, C
Method 03% D" I) q2 g( v
=========& H2 g& v* D& v2 E& i# |7 t, f' c
! k1 S3 }! g* l, }% x
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* ^0 {6 |+ P$ K
(API Get entry point)' p8 O, t, q6 V. c
        
8 |' {! H$ C! h! S# L
+ `4 }+ H9 Z" x" Y    xor     di,di
( y) C9 p+ ]& z+ C% l. M0 _    mov     es,di$ q1 ?  Z4 Z" J; x8 g
    mov     ax, 1684h      
/ A8 b6 G3 g# j# v    mov     bx, 0202h       ; VxD ID of winice2 |4 [, S' x3 h1 K) t
    int     2Fh; r6 X+ {/ r: \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; F0 [! j; L  m* W5 y* h! l% A; A    add     ax, di
4 [% {8 c# J  G7 Z! r    test    ax,ax
$ t1 Z% d8 d, a$ w) v) C    jnz     SoftICE_Detected# i9 H8 ?: k; t' \0 v8 S
7 f7 _) `% s& ?; V) U1 m
___________________________________________________________________________' l6 ~  g$ B2 x# m+ G3 v, @

9 e" t+ y; z  S0 K5 TMethod 04
: j* e  F6 b: [=========3 E* u3 p8 [. R0 Z2 u- E9 V' P9 w) S
- M; a" G# O% {
Method identical to the preceding one except that it seeks the ID of SoftICE
" `, [: m$ v% g  J* n9 j; bGFX VxD.( C# s# a3 s% `8 i: e

; l+ p1 h6 m( i    xor     di,di  o( K7 x6 x/ f2 |1 x
    mov     es,di& d* C& _. ]- f2 r9 U' Z, b
    mov     ax, 1684h      
+ @9 z) w* j2 d* u+ M    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* K1 i9 n& q; o4 t    int     2fh9 V1 B# F/ L% I7 b! R: U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 _) h2 n) t8 u3 M2 ^
    add     ax, di
( l! q8 C1 d+ X    test    ax,ax( G$ N' ]0 `8 s( B/ G
    jnz     SoftICE_Detected4 H2 @) N& V7 m1 _; }4 f

6 {6 U6 X: ?: K; z__________________________________________________________________________7 }/ O: Y- T+ G/ v2 C0 k2 N
, U0 E, o3 d. u7 c

4 c8 }) x) i. M% C0 AMethod 05
- y2 i* ^$ y, j! H" f9 ?4 [=========
3 }4 E+ N3 e3 Z, c+ v% O
/ V) [' j8 `4 Y/ DMethod seeking the 'magic number' 0F386h returned (in ax) by all system
9 C& X- {* M6 t8 e4 adebugger. It calls the int 41h, function 4Fh.& X, N' M3 t: D$ f& U" G
There are several alternatives.  : n$ w$ J$ H1 H0 r' N- ^$ q+ c

" R! n! b9 O$ N+ |The following one is the simplest:
. x+ R' j! \' v( J) C5 m3 ^# F$ S( {, X/ Q) V
    mov     ax,4fh4 u1 U8 |, H! ?+ G: V
    int     41h! F) D' K/ a0 K2 W% r2 e/ z
    cmp     ax, 0F3868 @; q; G  z9 V
    jz      SoftICE_detected
: F- B+ c5 y5 g8 N: c$ N( _/ t
6 }' M6 E- F0 x" P  d
% m: D+ g. }- \& i5 ~) g* P+ j5 ?9 ANext method as well as the following one are 2 examples from Stone's
& [* n0 l" V8 U. f" [, P, ?- g"stn-wid.zip" (www.cracking.net):
+ J1 s- F( m) d8 [, E; [* C
  g# R7 ]5 J1 e. c6 I/ ?& k! P    mov     bx, cs
, q2 b: s/ u" c5 H! l, p- H: f    lea     dx, int41handler2( O! G' [/ [. r/ {2 Y; ?: y; T
    xchg    dx, es:[41h*4]
* Y8 z; t# Z+ S: W% x. R  L    xchg    bx, es:[41h*4+2]
; A/ v8 _. s& W( ^# B  C    mov     ax,4fh. L" Z* a) d; v) |& s
    int     41h6 c+ w; K! T# I' E, t
    xchg    dx, es:[41h*4]
. g7 d+ V+ S2 |" c( I" t/ ~    xchg    bx, es:[41h*4+2]7 ^6 n7 R7 e! O$ N
    cmp     ax, 0f386h
' m: `/ l1 r/ [$ y, j3 i& _    jz      SoftICE_detected( a' _  n# n6 ]9 X$ v

) t5 s; E5 A/ F: I6 Kint41handler2 PROC2 [4 U6 X/ n% X2 L% g3 D1 ^" y
    iret5 P0 y# l& z- L) R: |/ `( r
int41handler2 ENDP( j# P. f7 r7 J: P9 V5 _8 e: t3 @
8 ]: _4 J, K: m5 V1 n) @1 s

' L6 L8 E  }6 D" ?+ Y/ d2 x_________________________________________________________________________' q  X0 w. F/ ^3 G5 \- u
- q% V/ a6 \% }7 h/ U( F! g/ {

+ k# z5 b! y, m+ B' R% V% {4 z+ TMethod 06& n1 K4 `. n+ N3 M# q' `
=========
: U% K/ B! R+ Y0 i$ K
4 o: K. O: D8 P- I8 Y1 Z/ V+ R' H) N- _) W- o6 C( e- l
2nd method similar to the preceding one but more difficult to detect:
9 i, t5 ?- Q6 l* ~; E$ \! B; n/ w$ {; g9 f
& t7 `$ H" d  v" y% [1 K6 B
int41handler PROC5 ]. ]! F1 E( T# S  s
    mov     cl,al- _* X* ^+ R, l0 R0 v
    iret: t% k4 d8 f/ W  E" f
int41handler ENDP1 O# w  x7 G% z5 G! g3 }+ ]

4 N1 Y( c+ X* E0 h, t
& e' @( s: ^" u    xor     ax,ax8 Z& S' \7 J9 q2 e6 _+ @+ A
    mov     es,ax4 M5 P4 z1 B" N  ?3 [
    mov     bx, cs
1 o' K0 W0 P* [    lea     dx, int41handler
' Z. p5 U& n4 r/ a: ]; |5 z5 X    xchg    dx, es:[41h*4]9 z$ `" h" l& X- ^% r( @9 l; w$ n: _
    xchg    bx, es:[41h*4+2]" z$ ^0 }1 L- Y/ q; W% f4 W' K. m
    in      al, 40h6 ^. Q0 n/ e3 m4 j+ \
    xor     cx,cx
$ h. O( H4 o( x  ^9 s  O    int     41h
, u3 _$ q4 w7 l* u; a- {; W/ D    xchg    dx, es:[41h*4]
7 v$ ^- T& a2 `. B6 O( x    xchg    bx, es:[41h*4+2]
) w4 G1 }8 G: p& O6 I/ D# X    cmp     cl,al
2 H" t/ _; U4 G1 \) e( r    jnz     SoftICE_detected
6 ^( e: w4 _9 p6 q* Z4 ?; o0 D' V: i, o) ?4 X' \
_________________________________________________________________________8 r7 Z$ U: n7 z& x  i
) |3 K- g9 o# w' K  {
Method 07; [& n! H, m0 D6 j
=========# j/ g! a6 y; i4 E  B! @

9 q$ V8 k: G1 ^5 aMethod of detection of the WinICE handler in the int68h (V86)6 b( Q0 R1 }# u1 e4 f, i! |

: I1 m7 x6 ?7 y. z* G- t9 y    mov     ah,43h
' d, r! \" P* [) _2 \9 {6 ?8 m* @+ F; M    int     68h: C. Q" B, A& x& c9 ~4 B& z
    cmp     ax,0F386h
/ O+ u& e3 X9 o: [9 _9 @2 |    jz      SoftICE_Detected
8 q- A, I, R6 Y" @8 v0 G% }! Q! t! w0 E; O& Y
- `% T% z2 e2 m) O! F$ C4 h
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 k' K# N# @6 Z* `/ ^0 A1 F% `
   app like this:
3 b; j) j8 b5 _2 i0 T$ n7 F/ f( T7 T- k. X- k" L
   BPX exec_int if ax==68
8 E3 }; b& d: E/ Y/ z, V   (function called is located at byte ptr [ebp+1Dh] and client eip is
( u& o# i, [0 r" ^   located at [ebp+48h] for 32Bit apps)3 `3 B# V1 N% M: ^" L& F
__________________________________________________________________________. t5 W: o, r0 A! g+ g! w1 f# D
6 L& ^0 B2 ]4 O

( p  G5 r# {) ^- N- W5 j/ f+ RMethod 088 w; M! k: j' _( H& x* s  [/ Q$ ]
=========
9 u- B  t1 f" O8 j) R
0 G* O( k3 I0 |( K* y1 tIt is not a method of detection of SoftICE but a possibility to crash the- a6 e( T( m% y- R8 c5 S, z  i6 `
system by intercepting int 01h and int 03h and redirecting them to another8 U( o4 \- ^* S* o' s( M
routine.
8 A# K( `5 K: Q& A; w  U" j, ?1 IIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% F. _9 `2 T  H1 wto the new routine to execute (hangs computer...)8 N6 v- g$ }, n
$ E- C, C" K$ c
    mov     ah, 25h
: e. [/ ~* `# |: l! ?    mov     al, Int_Number (01h or 03h)  n, L" J* y, T9 b
    mov     dx, offset New_Int_Routine
' ~3 Q. p* V7 z% K    int     21h# d! Q% Z6 x$ b" t% N, S( i
% J1 E' H! v; m% i( z* A2 E
__________________________________________________________________________4 U5 D  S0 _" _7 u8 K
7 ], b/ m$ x4 Z3 X0 m9 @
Method 09
4 O) O7 j4 ]- B! k1 {/ M( r! n=========
* [: o6 _4 O4 f" \% I# q5 x2 p& p, A( Q( N. \3 _7 j. A$ d
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 J# |7 ^: U. T8 R* aperformed in ring0 (VxD or a ring3 app using the VxdCall).3 _. S" ^  H' P% v
The Get_DDB service is used to determine whether or not a VxD is installed2 j6 W. `/ N: s6 ~
for the specified device and returns a Device Description Block (in ecx) for
& k5 d4 D, G7 _, _4 L& }/ G) Xthat device if it is installed.9 j4 |, \1 f7 ~

, L5 O9 s/ v. ~2 Z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- E" v  w4 b7 E7 ]+ Z1 s0 u   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 j  Z/ P3 B/ P
   VMMCall Get_DDB
4 Y4 P% f; \1 A7 N8 h; N   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 X" r* g  A- u  p# p6 w
3 k4 N7 ]9 A8 g  K0 z" g4 cNote as well that you can easily detect this method with SoftICE:
* M: ^: f! i3 N* ]9 W, O# u& E( z   bpx Get_DDB if ax==0202 || ax==7a5fh
# h: u3 c0 [, D7 P2 N- i/ L6 X1 X6 E7 Q, h4 d. ^4 ]9 r# U
__________________________________________________________________________
1 y" A2 J1 Z! h. O2 `6 s/ v5 ?& s/ g+ G# y6 j' U& ~
Method 10/ B% D! z1 l0 H, b6 n, O7 }
=========9 Z/ q9 l. h5 y1 y2 S) d$ \

, N- @" @. x7 N- o7 S. @=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, u- e# q' D/ R1 ?) z, ~, S- \
  SoftICE while the option is enable!!
! J! h  ^0 S* J. P1 U+ ]* G1 e+ `$ J6 x" c* |4 r8 \3 i: N
This trick is very efficient:
# t6 D$ M# b* K2 A/ N) L( c. uby checking the Debug Registers, you can detect if SoftICE is loaded
+ R$ V9 N+ Q* K$ _( R/ S(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 K: J' Z0 i: [4 c; X
there are some memory breakpoints set (dr0 to dr3) simply by reading their  x7 n+ r( M7 c0 W9 }1 V. L
value (in ring0 only). Values can be manipulated and or changed as well! b  B4 u$ M7 V
(clearing BPMs for instance). x$ k' W  a- W* R

8 k! k1 T2 B7 {/ Y__________________________________________________________________________) ~9 T& V3 ^# r! L+ i+ _' O7 l" q( ]
. B# f3 w9 z% {  _
Method 11
( ~& _+ m7 x/ C0 M% x0 u=========% ~; P  |8 W  D: q2 q. r6 m, d; A! Z( Q

9 P; P  A: D' _, yThis method is most known as 'MeltICE' because it has been freely distributed0 w7 S, t$ n. b( L, N4 Z) j7 {
via www.winfiles.com. However it was first used by NuMega people to allow' `8 k+ T+ }6 }5 \
Symbol Loader to check if SoftICE was active or not (the code is located
5 {! ?6 t) _3 R8 g7 |6 Hinside nmtrans.dll).5 y9 |) n* d; Q: J+ n- U: l! W

8 V) a' g: d6 g, W& y% m9 T3 TThe way it works is very simple:
$ @/ L( F3 e+ U7 YIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. F0 b( y# l  S' _' `$ s4 _& fWinNT) with the CreateFileA API.
. {! O* O6 z' x: f) x3 Z
" M( W' l% F. [Here is a sample (checking for 'SICE'):
0 k* y+ Y/ q, [8 a8 _9 B
7 x2 @, X3 v2 }  c% ~- DBOOL IsSoftIce95Loaded()4 a6 B; K0 D1 x0 R, s# A
{; I( F+ K6 O( X1 C. y
   HANDLE hFile;  
4 B2 h" x1 m. e* X   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% j( q0 T3 E) [                      FILE_SHARE_READ | FILE_SHARE_WRITE,) @9 ~) r) I# @, H. M
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 ^( @7 A& [1 W- ^# \. f   if( hFile != INVALID_HANDLE_VALUE )2 V- Y# \$ W. Y8 n) _
   {& H8 X. q6 C4 @" Q( d8 K
      CloseHandle(hFile);
; G: X+ [# Y$ ]8 Z% K9 q: O5 }      return TRUE;
$ R5 e; w- L6 B1 O) A  j3 ]   }6 |5 f5 _4 @0 z) I
   return FALSE;
$ N$ {( L& f& s) ~9 I}" B# K7 l' b2 c

5 Q3 [9 ^; x- i5 mAlthough this trick calls the CreateFileA function, don't even expect to be
) y' l8 h; J& U! eable to intercept it by installing a IFS hook: it will not work, no way!$ H( X) s' a, Q" V; Q1 R
In fact, after the call to CreateFileA it will get through VWIN32 0x001F9 e, @/ @* p8 F5 l
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). z% |9 E' e+ w
and then browse the DDB list until it find the VxD and its DDB_Control_Proc9 E" J) R( K9 ^; U8 \  ?" T
field.8 Z, h& ?; a+ J3 ^( m
In fact, its purpose is not to load/unload VxDs but only to send a # J. o' z6 ]/ d: L- q- O
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! s" ^' `+ g: N. gto the VxD Control_Dispatch proc (how the hell a shareware soft could try
. g: ?% E' Y9 `; y; \' Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).# I. L- m8 [1 ?6 M6 k
If the VxD is loaded, it will always clear eax and the Carry flag to allow
) T2 d& o0 y0 I: D/ m' Kits handle to be opened and then, will be detected.
: k: S8 |$ Z4 sYou can check that simply by hooking Winice.exe control proc entry point
/ U3 E; U4 E# {, j) E' wwhile running MeltICE.
7 \: W+ B. ?* o3 ~
$ R% G9 x! P* \* u1 P, J+ `+ B6 `8 ^  ?
  00401067:  push      00402025    ; \\.\SICE- j: J/ o4 v( @2 v' g$ P
  0040106C:  call      CreateFileA( b3 c# [. @$ M9 f
  00401071:  cmp       eax,-001% a. m7 o5 Q! W0 x$ K$ b8 z
  00401074:  je        00401091
4 m& a4 c% c7 f' F- O" }$ A* f, x9 B) I1 }
0 ^, I1 R7 m6 l- Z, x
There could be hundreds of BPX you could use to detect this trick." ?. o7 B" V0 ?9 w' s: {1 I/ ^
-The most classical one is:  e2 Q# \& k. [, f) p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; h) K: Y* c& m+ o* f9 K1 ?* V
    *(esp-&gt;4+4)=='NTIC'5 b& e$ P0 h: {8 g
+ W; i$ _, X5 Y  T+ F
-The most exotic ones (could be very slooooow :-(
2 j' b" Y' I" S4 o# s# l   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  I2 q' T$ d  O# N     ;will break 3 times :-(
4 Z; `( N! L9 Y' y% h: B- z8 g& m4 @& E
-or (a bit) faster:
! U1 c9 G2 Q, A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, j% w8 Z  {3 u6 p0 U% v) k, \6 h- r6 D$ r
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + N& m; X. |# Z) u+ i) E- E- ~
     ;will break 3 times :-(
* M; p" w6 ]' G5 j2 k4 W! L& s4 w: }: I" Q! i6 H; A1 f2 e
-Much faster:+ T: j0 m. W' N
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 M) O7 D) {3 {7 g

0 }5 ?8 _; G8 }3 C" x6 {7 TNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ d& L' z. w' r% V7 |) \function to do the same job:
/ J; ?, {0 C2 ^8 E4 A; k+ B" x
% C+ n/ _" d8 ?2 s/ }   push    00                        ; OF_READ
' M; {9 `8 C/ T! T6 D" n   mov     eax,[00656634]            ; '\\.\SICE',0
3 P- I2 o/ |6 H0 B   push    eax& E% [) G9 R8 d/ _8 T
   call    KERNEL32!_lopen
7 F* I0 C8 C; O9 D, |, a( i   inc     eax
  H" t2 F% i0 ^9 ]+ Q+ b4 R; J( }   jnz     00650589                  ; detected1 \, l5 w& I7 h$ F5 j  y# g, y
   push    00                        ; OF_READ
0 ^. p6 w3 P  X3 c3 U/ B+ g: o   mov     eax,[00656638]            ; '\\.\SICE'; M' N& v$ W# v1 v' p$ e5 I# |
   push    eax, a" F- ~1 R$ }2 h( H3 n6 n
   call    KERNEL32!_lopen6 ~/ W/ o) W' s3 B9 R2 t
   inc     eax
  Z0 g1 |* ~1 G5 Z4 o  p   jz      006505ae                  ; not detected
1 b, W, i4 _- x9 L* U! V) S8 h7 n  n8 i, b6 j2 Y/ _. M2 r% s# ?4 C
1 a; A* C. H6 Y( W% ?
__________________________________________________________________________
+ b* Y" w/ t8 o' N, ]$ A, J$ h  C! a$ r) ?# l% y+ g2 Z
Method 124 Y% h2 j9 _, R3 q1 q; v4 D
=========' I3 Y  [# w* D

6 Z* B/ X" R7 _1 j, }This trick is similar to int41h/4fh Debugger installation check (code 054 p, U! `8 p: n" Z7 w2 T& V
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 i& @2 c  j& o/ C$ v7 U" k" ^as it uses the VxDCall backdoor. This detection was found in Bleem Demo.# [# t: b- n% v- Y7 `% ^8 P, ]; B

+ k" ?% S& N. J9 e. @' P  h   push  0000004fh         ; function 4fh: p6 n7 W1 B' p& m9 V- u( s. v
   push  002a002ah         ; high word specifies which VxD (VWIN32); Z  e) S" d8 g- i
                           ; low word specifies which service' G& V3 m2 t' s* L" ^
                             (VWIN32_Int41Dispatch)
" C7 e; H5 }! i+ O   call  Kernel32!ORD_001  ; VxdCall
, a+ L9 d, h+ n" K2 D  V   cmp   ax, 0f386h        ; magic number returned by system debuggers5 _. @6 }2 N1 \0 N: f) o' K
   jz    SoftICE_detected
# Q# @# w- l8 @! C3 _% S# _: G  X: D  g  m/ ~) I
Here again, several ways to detect it:
& l- g" B( m. }
6 s' H3 S0 i+ ]. Z1 w" Q4 M    BPINT 41 if ax==4f
# |. F/ B) R5 C. ?' k- S$ w/ H, b; `" n: h0 I4 p1 j
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
+ {; b# i8 ^3 C5 }" Y3 \, Y' h5 r
  z: P. E  K1 r/ x    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' y2 Y7 Y3 z" J) ?: G1 f
  Z# {! K7 o9 z% d* e7 c
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!$ s2 q4 c5 z9 s5 Y- `' s

' W  _+ P- O7 F+ ]  H__________________________________________________________________________8 @  W3 s" N& u! M7 w" y7 B( P) Z' U

. M- ?  R3 U" u8 i. A: r; MMethod 13
9 E% k" Q7 J7 b9 F=========# H0 C# q+ H- S! ~" z' t$ z2 N2 P

. E" Z, S# l! z9 O) @Not a real method of detection, but a good way to know if SoftICE is
. S4 E& A' ~* E; x; h$ W1 }4 Oinstalled on a computer and to locate its installation directory.# A+ o. N9 Q* q- d
It is used by few softs which access the following registry keys (usually #2) :
& ?) R) l- h% b+ R4 s4 o# {& E8 E& Q' R4 O' o0 d0 {! A5 [, o
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ R4 d3 }* j+ E( D5 J6 V+ ^2 E\Uninstall\SoftICE# |' p( ]- H& M* y- e# q8 P
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
: ?: Z+ E& Q" K5 y+ |! c-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  o% D5 _* }/ E7 O  w2 o
\App Paths\Loader32.Exe
) Y- [0 Z0 W+ l9 T# R: v; `- F+ c! _
6 {  ^' z# I& ]* `: ]; u  \5 M- ]
Note that some nasty apps could then erase all files from SoftICE directory
- H2 ]  y3 v- ?/ h6 P* C(I faced that once :-(
9 T' [4 H2 u. ?- d, v1 F8 V: b+ L9 G% ~( K8 O( l
Useful breakpoint to detect it:
  o+ {1 B- X! o% C& n1 R0 q6 c# I) S* S8 N
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) q) N9 ?. V( R3 V; Q- [* b. o1 F9 C9 g. J
__________________________________________________________________________3 T0 Z, j1 l" T/ j
( w: e0 V$ v) L1 c* V% x) n6 z
' c0 F! w3 A8 z7 ]) Q( y
Method 14 1 N9 e: H5 Y% i5 y- b; z: r% ^& ~. Y$ Q& H
=========
& {- {- w* h# A7 L
5 X2 [1 j8 E! w3 n' H/ P" ?5 G; TA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: z3 j6 p4 ^6 @4 L( N+ l3 d% u' {is to determines whether a debugger is running on your system (ring0 only).; ^( E( s" {5 t+ a7 c

0 M8 {- C  v& b- q% ]* A) e   VMMCall Test_Debug_Installed8 z* J  Z3 U+ K9 n3 B3 R
   je      not_installed
! T/ _- P  j3 w, |2 T  F& @* Y- A6 {  E* I5 Y6 S' F5 U1 j7 ?
This service just checks a flag.
  b5 U, Z5 {5 G8 U; U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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