About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  P' o8 h* ^3 {2 k% A<TBODY>* W, o  ?( F  J; ?
<TR>9 [: W& X. |5 @, G; U. P
<TD><PRE>Method 01
% D! e* u' ^  b# m=========9 H' a* O2 q6 @4 u1 g
! G  ]0 k( h; r% Q2 p, J" b4 G
This method of detection of SoftICE (as well as the following one) is
8 F; \' r1 z0 I6 E2 jused by the majority of packers/encryptors found on Internet.
% o) T) G9 D8 ?  N# nIt seeks the signature of BoundsChecker in SoftICE
" R, ?$ J' I7 Q* N: K4 V4 H3 w/ V( e9 s: |3 B5 s# U
    mov     ebp, 04243484Bh        ; 'BCHK'
0 }# Q( V  i$ b8 R/ `8 S  k( n    mov     ax, 04h1 k2 T9 k4 S! Y9 o/ m$ }
    int     3      
6 T" u4 O. t- X1 X5 O    cmp     al,4% W1 Y5 p2 @, q/ o: j: a8 R
    jnz     SoftICE_Detected4 x2 k9 r) q. K2 Y+ o9 N

  e' X( ]+ S4 n. {3 A9 g3 h___________________________________________________________________________/ f, Z+ Z; B8 M, D& V
: C: d. ^' D2 H( c# _% y$ r$ q
Method 024 A: L# T0 _" x3 j- S
=========: @0 |2 \& k+ |4 D$ d& Z

  ?+ y3 s" x% A+ b/ VStill a method very much used (perhaps the most frequent one).  It is used
1 K: N; _; H, @; A. j  d0 D6 jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) y3 j% H3 w3 k/ _  for execute SoftICE commands...# y% _5 U9 B; {, C' ~
It is also used to crash SoftICE and to force it to execute any commands
4 V$ X3 a- E9 O% ~8 X* m(HBOOT...) :-((  
% w: e& L; V5 y! W2 v& M* p5 p2 U5 j
1 S# ~: e! ~' y, tHere is a quick description:
: b* v. n" O! P/ P- \: D-AX = 0910h   (Display string in SIce windows)+ ]! s. y9 l' m6 D, ~8 C
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 \5 L! `" C9 H# F. S-AX = 0912h   (Get breakpoint infos)4 E, U8 P' G) a5 e9 G  k( U5 q
-AX = 0913h   (Set Sice breakpoints)
% u6 x. A& k6 f2 _' _-AX = 0914h   (Remove SIce breakoints)
5 r- K' |5 V6 i
% {' v2 h% t* t2 hEach time you'll meet this trick, you'll see:
# ?* V7 t  b: a  x) Z) `" C-SI = 4647h
- L$ V5 |/ f$ U-DI = 4A4Dh- K3 F: X; r* |7 i. M
Which are the 'magic values' used by SoftIce.( D) i# H4 Q$ y3 o! E
For more informations, see "Ralf Brown Interrupt list" chapter int 03h., E7 D% O" _5 t* s1 m! G) G1 H% T

& R2 X+ J2 v/ l& `; J$ CHere is one example from the file "Haspinst.exe" which is the dongle HASP3 D4 ^! m+ x9 S* X
Envelope utility use to protect DOS applications:: L5 O/ F6 ~5 o, G+ G4 B0 Q& l9 \
( f% d5 U" c- M6 |" E

3 i, h' R( ]! l5 S0 M# w4C19:0095   MOV    AX,0911  ; execute command.  r3 x. }: ]; ~6 W
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 W' s) M$ C% e( U' d, R4C19:009A   MOV    SI,4647  ; 1st magic value.: a3 ~/ k* O+ c2 P2 U; G
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
7 R, Q! D6 h, y- M0 ]1 z+ m; q- ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
1 ^3 y  p, B$ }3 Y/ i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 M* x! f& }9 A9 @6 C6 b: p2 P4C19:00A4   INC    CX' Z# I1 h- n4 M& k9 m9 E
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! U* n" E( c3 d- L' q3 Q/ \% f- J4C19:00A8   JB     0095     ; 6 different commands.( l% r0 I: Q: \% `+ N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 m6 X6 [2 o4 S/ N/ x
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( K( i' K* G. ?  ]/ _) Q( ?
) y9 `5 Q1 K, e1 ^& ~  A7 PThe program will execute 6 different SIce commands located at ds:dx, which
  a& Z0 K7 }! f8 [. `are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ \7 a$ F* ~1 S( x2 o, d1 E% _( p
! g- R' q  [/ N
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
- `+ h& G, \1 n. b# s___________________________________________________________________________9 \( F/ k! {) Q, n/ |+ E6 M
3 e/ J/ S1 c3 M. s) ^# P5 `  Y% _
, ]" i4 B1 c4 X! P6 l
Method 03  q! I7 S& |) Z- F9 F* ?
=========
) h8 R! O2 x% s, O
* c0 @8 A5 h. {7 X( G$ Y6 _Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 f7 m5 e8 s- f% P
(API Get entry point)3 Y' [3 ^. d, I+ E+ J. q
        ' ^* Y4 ~3 m# W+ @% `: L1 ~
) ^) t( a1 L. X
    xor     di,di  ~. i5 w" D! n" N5 P; h6 L
    mov     es,di+ l0 u3 e6 f! h- V
    mov     ax, 1684h      
; C8 _! E$ ]8 j# j    mov     bx, 0202h       ; VxD ID of winice  Q# k2 X9 }! g3 M# d& A9 I
    int     2Fh' m% l- p/ U  `; D
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 c' T( c2 I$ r; v
    add     ax, di% Y" L1 `/ A. H/ L
    test    ax,ax
8 m4 n, e4 `/ h" m+ C) O; n( {    jnz     SoftICE_Detected
/ s; ?. h0 f5 I6 I7 H* V
, b( X4 q  e6 n___________________________________________________________________________
$ n$ }' k1 h7 {9 T" R2 ~# _8 V& n, g
4 a. F0 J6 _+ V' e2 {7 ?Method 041 J# W& N' o+ Z; t) D) K0 ~& b
=========% u- y6 r6 E. @/ M+ o6 J( }

9 l4 p) l5 W% KMethod identical to the preceding one except that it seeks the ID of SoftICE
7 G. X6 p! t- f, Z3 bGFX VxD.8 v5 J! Y; b5 c  ^# A5 ]) h
' Q" x# d8 F7 f/ X2 O6 B1 r
    xor     di,di
' @# ?8 B0 R: H3 E    mov     es,di" C; F6 i' D$ I" V
    mov     ax, 1684h       & a; x9 X0 m  |
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 ^0 D: L" f: P2 @4 F    int     2fh+ c6 B. E: k2 U" r. F
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) V7 f. x8 G5 C$ T8 \* o% K    add     ax, di
# v. b9 F, \- K- @1 h: |9 W, ^% b    test    ax,ax9 n0 J% `- y* j- k' X
    jnz     SoftICE_Detected
' d. P# p* q: u1 o8 _8 G; F- U! N! C0 u1 e/ F' J. g* f
__________________________________________________________________________
4 q4 V  H! m$ Q) o; a& h. @' Z9 S2 J' @4 }$ v6 D- t
" p5 q7 a; N. H3 Q, E: o
Method 05% G4 l# R$ h$ p
=========
7 O# n. Z0 d" J" q8 V2 Z6 M& `/ b, w& @9 V
Method seeking the 'magic number' 0F386h returned (in ax) by all system
: Y% e4 O0 i( O/ t9 qdebugger. It calls the int 41h, function 4Fh.
/ m! K+ h; i' ]+ ^& F" Z& mThere are several alternatives.  
7 j2 y, r8 c0 v! a  R& P' g& Q3 X( P9 Q0 Z) L
The following one is the simplest:
6 ?$ y/ ^3 y2 m, r( j! Q, Z+ x- A$ A# @
    mov     ax,4fh
2 {/ D% Y* ?. R% V    int     41h
. F1 r5 j$ q3 t! Z    cmp     ax, 0F386
) ?1 {( f* e9 Y0 _5 l& m' e    jz      SoftICE_detected
! Z* N$ w" p5 `3 T* X. T9 r3 Q; _6 |) E" z$ [

8 e# w+ F% g: M# N# T: TNext method as well as the following one are 2 examples from Stone's
- X- i/ `" H, G7 Y+ R"stn-wid.zip" (www.cracking.net):
% Q) d5 l; T# C( m- Y/ ~( S% d! F. H" d! ^7 a6 }( Y! u
    mov     bx, cs
) j0 l7 T# Y# h, F* K1 U/ w6 T    lea     dx, int41handler2
: |' l: k7 A4 o3 I; b    xchg    dx, es:[41h*4]8 V4 F5 J2 O0 p9 ?8 T: O8 k7 J
    xchg    bx, es:[41h*4+2]( J) J& s) y0 W9 P8 i
    mov     ax,4fh
" V4 s% h7 C! j8 y% B* S    int     41h
, {1 z% _4 C6 D8 K! V    xchg    dx, es:[41h*4]0 |' q4 a' }6 n' S
    xchg    bx, es:[41h*4+2]% ^% ^6 z% ]* ~( c
    cmp     ax, 0f386h. Y( q) @: |2 A. O7 |  g/ M4 R5 \3 c
    jz      SoftICE_detected' B2 r! V& x# }& ?
3 L9 ^3 w; [7 D
int41handler2 PROC
" L6 X9 H: `. t( Z% q+ ?    iret& d$ k, M, q! p0 F/ `% V
int41handler2 ENDP
; I: }! u) v, w! R3 H0 F1 F$ [
9 P( L) B* I* S& K4 e. @
4 Q  ]( \4 g; @1 s2 __________________________________________________________________________
/ b5 \' e$ @/ H. g. n9 _" }/ l
; m, Z' x% V) M9 C8 a: H2 |* \9 b/ S' c7 i: U
Method 06* G- u2 b& _3 y3 _
=========3 T9 v% P  _. v, }2 @9 f* A" _
- o8 n( u6 c) Q. l" q
9 i7 d* X  t, Q. J
2nd method similar to the preceding one but more difficult to detect:
5 }  K' Q: I5 S: W" A, f, I  ?+ Q3 |9 b6 F3 @0 s0 i

* |; N7 s2 R5 g9 X% h4 Sint41handler PROC
+ i) ?# t8 j* p0 s) i! g    mov     cl,al) h4 ~) @- z7 a- X- Z* H* H; R
    iret) T7 b  l4 y' j' l9 i
int41handler ENDP1 D2 B/ f% o$ }

: b; G2 J2 ^3 `- l
7 D5 q& c* }1 w    xor     ax,ax
! V; s# b( s( Z+ [7 c* c7 m2 @    mov     es,ax
4 v0 A7 W+ C6 ?9 m) F* r% M    mov     bx, cs4 X* t  X- m" a8 b8 a1 M7 m
    lea     dx, int41handler- l& t0 `3 l: T3 h# d
    xchg    dx, es:[41h*4]4 \+ Y$ ]) g+ Q3 E* G
    xchg    bx, es:[41h*4+2]- r! A" L3 I1 Y6 L1 \  d' k
    in      al, 40h
+ G& ^5 B7 p/ c7 J    xor     cx,cx
% j% d/ F) E! T  a    int     41h( M4 S* P, k; T1 a1 J$ Z
    xchg    dx, es:[41h*4]
) V4 j, ~, m! f  K; e' A. R- k% X    xchg    bx, es:[41h*4+2]( t+ H; G, a# `
    cmp     cl,al
. r) Q9 C8 {6 o+ h9 t    jnz     SoftICE_detected! n0 n3 h  o& Q. Y
+ z# W5 M7 W) P: q
_________________________________________________________________________% I  I. S) {3 l8 O) w

& b) S1 N' i! _. b$ t  bMethod 07/ e0 o8 G3 K5 g1 ]# ^3 \! L
=========
0 V" ?3 ?* s( [$ d7 U
8 _( I, c7 M& n6 \* N& iMethod of detection of the WinICE handler in the int68h (V86)' E; \3 p$ ^1 |5 T. K  g9 g
7 s8 A/ \- F5 d' s7 Y
    mov     ah,43h2 E) z9 k; k$ ]; I+ l: L
    int     68h% G5 ~- e6 C( N) |, ^. y0 |
    cmp     ax,0F386h
6 H" |* g" a, U1 i) m    jz      SoftICE_Detected
1 P. t2 w4 {4 ^! J, y* B8 ]! O1 E9 O( G: l! A# f+ D
* Y; N) ~0 r0 z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; H( `/ b5 Q( x# ]1 W
   app like this:
* ~) n7 q. w; g% o# ~1 J9 x  N# z: r/ r, W1 c- Z  U
   BPX exec_int if ax==68
" D) c4 q2 r! R% K: n4 d   (function called is located at byte ptr [ebp+1Dh] and client eip is3 F; }) `+ n- n; D
   located at [ebp+48h] for 32Bit apps)
( f; D) a) x. \) ?/ j( ^' s; |; ~__________________________________________________________________________1 q% A0 |5 Y) f, d7 ^

/ x9 s6 k+ `9 Y1 m0 y
. }: W7 d0 G; q! A& F. U) C* qMethod 08' _; R, N1 {, Z$ ^, _# i
=========
+ X% n) O  G- k4 u2 D3 j3 L8 G1 Y
: H: d3 X/ r1 [1 cIt is not a method of detection of SoftICE but a possibility to crash the: N% ~# Q/ p% [2 S
system by intercepting int 01h and int 03h and redirecting them to another
* A: v" n  ?4 q; Y$ y& U0 Croutine.
  e9 T3 K1 l0 Y% @& b; V9 [8 oIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
& b" Q+ B, ^$ r6 Ito the new routine to execute (hangs computer...)5 i; y: d( P" @* D

0 [, ?! u/ c& k; w9 K0 w! L    mov     ah, 25h4 n' A% w! G- b7 A% Y$ P
    mov     al, Int_Number (01h or 03h): E. ^0 l8 @) ?! b/ w( G
    mov     dx, offset New_Int_Routine
- s: s( r3 h3 o& ~8 M    int     21h
4 \" z& P5 p9 ?0 O- a+ d/ x& R% z0 {+ H! Z$ V- J" d+ s! o- J: H
__________________________________________________________________________4 d1 w% H* a( @; b( i- Q
" U2 q- G/ D3 K# R$ _5 s
Method 092 b" U4 d: {& A6 D2 i# U
=========
& a: c+ C0 H3 v1 b1 v% ^  |0 m" V0 s$ y) \1 _
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
  k7 \3 S/ ~" s- }$ fperformed in ring0 (VxD or a ring3 app using the VxdCall).* \, N4 [' a* c* Y. N) `! h
The Get_DDB service is used to determine whether or not a VxD is installed) o' c* {+ q1 C+ j, o% {* ?& x
for the specified device and returns a Device Description Block (in ecx) for8 r% i* V! N8 \
that device if it is installed.: Z' R3 T' Y* r" z% v+ @/ X5 B

' @  \6 ^/ `! {8 V   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 e' `, s3 E6 z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ N8 F$ c; H# ]) u$ T
   VMMCall Get_DDB( @( P4 ?; b$ C& P' _
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 U" R, ^- S$ u% u1 r, ^
: e4 ^" ?# A" y  G# w
Note as well that you can easily detect this method with SoftICE:
2 ?% C2 k3 ^+ w% S. T7 J1 m2 o$ E" }* F   bpx Get_DDB if ax==0202 || ax==7a5fh
5 Z% j* p* b9 a5 N1 \* K$ K
1 A8 r" L$ V  l5 m' Y5 j4 d__________________________________________________________________________2 v# H; v1 ~9 C" S5 M5 H* G; U

) y4 W. u5 q/ z" cMethod 10" Q% ]3 e0 b& Y% O
=========3 a2 F0 q! ^7 `" w0 j2 _0 N- W
1 B9 z( J% R1 x! R+ F
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: V' d9 m, ]0 S* o4 e( V" l
  SoftICE while the option is enable!!
* ~1 K) c& D9 U3 Y# U# E  {4 K5 Y+ m: ~
This trick is very efficient:% A- p4 w5 D4 T2 |4 E
by checking the Debug Registers, you can detect if SoftICE is loaded
; A! B. t5 V+ K6 y/ U3 @8 X% g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( n8 T7 h. M9 Z2 Y3 f
there are some memory breakpoints set (dr0 to dr3) simply by reading their. }# H3 E8 T. ^& ]) q& d' E2 k+ m
value (in ring0 only). Values can be manipulated and or changed as well
: l' D" A  w8 k6 B6 V(clearing BPMs for instance)8 Q$ ~. F' h# `6 e+ I  y! ^
) Y4 t& @7 t) f; b
__________________________________________________________________________
. ?5 z: V" m! k; R
. H% i6 n4 \! XMethod 11! a% i8 l5 v3 ^  x" b7 S
=========& h8 {0 l1 O4 H2 n
, z  [1 m( T5 w! E* L; Q
This method is most known as 'MeltICE' because it has been freely distributed4 Y% ^. Z0 H, d& c
via www.winfiles.com. However it was first used by NuMega people to allow) o- f9 Z+ f) o7 ^
Symbol Loader to check if SoftICE was active or not (the code is located
2 K+ Q/ T2 Q: ^& x0 Binside nmtrans.dll).* S  t0 L+ W( ~& h  x( A- W/ x) Z
/ m: w) m- U- k. R1 D; j3 J& C
The way it works is very simple:/ k8 Q0 [! Q& B0 ?2 m- \+ h* G1 k
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ q) K8 w0 m, ]+ [, xWinNT) with the CreateFileA API.) ^3 l6 n+ P+ i" [
- E8 d% ]* i: Y) S* w
Here is a sample (checking for 'SICE'):2 T0 x' j: `1 X7 m  J% R
5 t' l# c$ w, I4 ?. j/ `3 c1 D
BOOL IsSoftIce95Loaded()2 P5 r7 Y* D9 B0 j
{5 q, {& k1 E1 ^% B
   HANDLE hFile;  0 Q/ h- U, m/ ^! p% `$ A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 v, _1 X2 B  c- j                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% w+ D! o$ \3 [4 o) z2 h                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
, t& ]0 h" G  v* @   if( hFile != INVALID_HANDLE_VALUE )
+ W8 O1 N5 a1 r: X# k   {
  K; I9 m5 Q% U+ r( V& A" }      CloseHandle(hFile);
( ^( Q9 ^2 Z+ {0 K      return TRUE;
- ], o- U3 L6 b; {2 L; @   }9 U! D; [6 r) H3 C! s- R; d
   return FALSE;
& G; Q* W- b. Z: [8 k8 F}
+ S' i" Y3 H( O+ o' f6 ?, v- D2 u3 \+ V
Although this trick calls the CreateFileA function, don't even expect to be
3 |, N- c0 ]( \! ~2 O( m4 @1 bable to intercept it by installing a IFS hook: it will not work, no way!
! @" R8 n* a! j) b: L, @* c# BIn fact, after the call to CreateFileA it will get through VWIN32 0x001F$ L0 e. z. r7 A' F0 Z
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( b8 W) d2 U0 ~/ a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ h; h  c+ m; Z6 `
field.
/ d4 `( p- p# t7 mIn fact, its purpose is not to load/unload VxDs but only to send a
* `4 n: f4 u! \5 t1 IW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 [- F. q( _* w* wto the VxD Control_Dispatch proc (how the hell a shareware soft could try4 J* `/ ^( y# T4 ?' N, w* E6 V4 a) T
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) b7 Y- _# U6 y  x& W' {6 L9 vIf the VxD is loaded, it will always clear eax and the Carry flag to allow2 t8 F8 x* I% D: R5 C* q
its handle to be opened and then, will be detected." o1 t. o( m1 L2 ^& M0 t
You can check that simply by hooking Winice.exe control proc entry point
' V0 A& b' ]! D8 ~while running MeltICE.4 N) O1 R( O! `& z; \* ~
2 u, w# W, j! f1 a

; i; s7 g. c5 x" T* h% u, Y  00401067:  push      00402025    ; \\.\SICE8 n- {7 T, O* ]& D+ \4 |  f$ H
  0040106C:  call      CreateFileA' A+ j4 G$ z" p, a4 v* P
  00401071:  cmp       eax,-001
. G: n' Y3 p( ?/ {1 M) }  00401074:  je        00401091
7 M; B$ S5 {  B$ H9 B; j. z
% \/ g1 T; @3 u* e3 [8 m0 j& Z% t+ H/ t/ @
There could be hundreds of BPX you could use to detect this trick.& x  z. ~  Q' X3 T+ s7 I% j. X6 I
-The most classical one is:
! t3 N" v0 G6 H  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! y! d  W' M8 `7 B* o' Q+ A' }
    *(esp-&gt;4+4)=='NTIC'
( a" u+ I/ t) q! K1 V
& V$ z% J) q: l3 v* i-The most exotic ones (could be very slooooow :-(+ q, ^1 g6 S5 O  }$ w4 A6 S* {' k
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
) Q! W/ \. {: u- d3 ~     ;will break 3 times :-(
; d6 Q$ f8 C5 ^5 e  a) x, i& l
-or (a bit) faster: & X) T- v/ N4 i+ s0 y( M% l
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( T; C, ?' M+ g( h8 t; g
: @/ S* ~* O$ k; B; S2 V
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  4 ~. D" c) b% w; T# [  Q
     ;will break 3 times :-(
% L* a8 m/ S: T& b# u/ I" {8 d) @/ w3 W4 i6 r
-Much faster:3 ]3 D6 E- c, v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% c0 H% Z1 j, [! R5 s* c
: u8 o8 T$ X) ~4 d$ N& sNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
. ^3 [( [# g/ k4 j. B* W6 H2 Afunction to do the same job:
2 j; c# u- x$ L, |8 Q8 W" F+ ^5 |! e; I$ k+ U* @5 {  k0 ^
   push    00                        ; OF_READ
% Z5 m, I4 H* J   mov     eax,[00656634]            ; '\\.\SICE',0/ P' l5 E! _6 ?1 \* p: U5 R" L
   push    eax) ^- d# D* {, I1 }& ?7 G! Z
   call    KERNEL32!_lopen
. [: t5 B- l; i' {4 d/ L/ `   inc     eax( Y9 V* V/ i9 {! d9 J6 T5 d
   jnz     00650589                  ; detected
% n1 O) a7 T% {/ k7 I7 V) ~   push    00                        ; OF_READ
- D7 @* B7 Y. n* [4 f   mov     eax,[00656638]            ; '\\.\SICE'
4 Y) {6 e+ V6 ~9 d0 B1 i8 y   push    eax
1 Q3 u7 T6 S( S1 r# Y, N& X   call    KERNEL32!_lopen
  r% S% R5 v- x   inc     eax
7 s( V0 P; t# R# Q! C   jz      006505ae                  ; not detected
/ K7 g" [' R. x1 O" t
! \" j+ q4 i( V4 W! k% X% ^* z+ [% R. I3 K' G& R; k
__________________________________________________________________________! y- S5 t+ j1 k/ R7 z3 e

) |0 q/ f" {  a# X6 b+ GMethod 12
- O# K; B) S7 h: z0 u0 ~( M+ ]=========- A  s/ A& n! D( ]
1 {7 [+ n  y2 D" l
This trick is similar to int41h/4fh Debugger installation check (code 05
1 n8 Y& ~9 C- U# q" q&amp; 06) but very limited because it's only available for Win95/98 (not NT). f9 z  w( f$ }" z  L* T5 A
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
+ S( E: u2 J' s4 J* C* N  V- K1 W' K& {  F' V
   push  0000004fh         ; function 4fh7 t& Z7 l$ r% d
   push  002a002ah         ; high word specifies which VxD (VWIN32)
7 h8 j1 [- \1 V$ n) X0 h5 ?                           ; low word specifies which service
- q" t+ L+ g; R& c* o: D$ C                             (VWIN32_Int41Dispatch)9 G, J) L5 t3 X/ C3 }/ z& _( E! B& i
   call  Kernel32!ORD_001  ; VxdCall1 m+ ]5 c0 O' o: ~: F8 r
   cmp   ax, 0f386h        ; magic number returned by system debuggers& Y7 i  r7 U1 [( V1 f0 ?! n: b6 j+ d) ]
   jz    SoftICE_detected1 |& ~6 F9 H0 v! S4 s# v+ T1 t  m, B

% E. Z% ~( Q# gHere again, several ways to detect it:4 ?/ u; i; ?9 I) n% T9 u

$ V( ~8 |8 T- y3 R! ]% {    BPINT 41 if ax==4f. a6 T7 C# }/ ~6 R8 M

4 z" S* w# s6 w! C: ~! p* q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one+ v% F* o, m: _: j
- T# ~& ]0 l, v# {$ V
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ ?( E! u, {0 z7 `& H
( y; Z5 G1 n2 ]0 Y( B* [6 Q    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( b9 ~$ a- j6 y4 R; b0 P4 W
* y* u/ @# L6 E" d( z+ F__________________________________________________________________________$ O) O9 X8 Q% X

% e$ U6 N8 g( XMethod 13+ b' c, |$ x4 M$ C) E. t$ U
=========: s0 h( B9 h/ {  t$ d9 W

; x. p+ h" n1 `. [. aNot a real method of detection, but a good way to know if SoftICE is
) V, G' b/ Q6 ^+ Jinstalled on a computer and to locate its installation directory.  p& B* b7 p& n# [: j; k* A
It is used by few softs which access the following registry keys (usually #2) :. P: q& j7 _. A+ V! d, l8 P+ N

! u! ]. s8 P/ C, V, ]8 j; m6 @-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 `1 t* ?9 M3 p4 z- P\Uninstall\SoftICE5 _# y5 R6 _3 M1 S0 s8 w' U
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
; Q5 C8 m( ^2 m* m) Q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! u9 D1 d( h7 w; v
\App Paths\Loader32.Exe) {: b# K  @' l+ {* z$ _7 V
$ L2 U# l8 [+ \/ o
8 M2 ~' K4 v8 |/ v2 s- z
Note that some nasty apps could then erase all files from SoftICE directory
, M4 A" \1 H0 j(I faced that once :-(
1 A8 Q  H) n0 F
: J0 @' D& i  n1 mUseful breakpoint to detect it:) o  S6 G2 x. i. e9 v) u. s) G

5 R+ V  i- e/ a+ H$ @9 h     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 w& w3 x6 P; \

6 j- b0 d1 f% K__________________________________________________________________________) ~% W* k9 ~' D1 b0 @1 w) t! J, a

# K* y" |- O# }, |  m6 @5 x6 x: v, `: [1 Y8 j  g3 U7 `
Method 14
5 t) s% J1 q' C" J=========
3 m3 I0 b5 E8 K8 d% b* a0 F3 D, A. a2 {$ |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 f2 Q( d) k; `% h: a8 p, V1 T" d* N8 v7 v
is to determines whether a debugger is running on your system (ring0 only).
$ ]8 F, \2 Q; K4 u0 d+ ~, {5 F2 v5 N1 R  g! I; y4 V/ W; i
   VMMCall Test_Debug_Installed
* `7 O' f- }( P1 i   je      not_installed
2 t8 Y! J2 w8 |% |0 ^! f3 @( L$ D
% n& @# f1 J" L6 y0 x" V8 EThis service just checks a flag.
7 ?( B! m; Q8 g" ~, d</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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