About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 `+ p, B$ b" M3 j6 J<TBODY>
8 s4 r  A, U# l/ x. E1 ?<TR>
& m4 C4 _4 b+ Q, u/ }4 A<TD><PRE>Method 01
- Q9 I. A5 x; ?9 G=========
: g2 Y* L! d2 f. G  e1 x+ z8 d4 w; A  c
This method of detection of SoftICE (as well as the following one) is  u* U- ]- Z+ d+ I, O0 w. D0 s! s) `
used by the majority of packers/encryptors found on Internet.
' E0 \- a" ~, h4 ]It seeks the signature of BoundsChecker in SoftICE
- l; Q: b0 B+ C+ ^) @: F* |; q; ^7 K5 R
    mov     ebp, 04243484Bh        ; 'BCHK'
, Z" t( L  c* v. P    mov     ax, 04h
; `& y; C" Z% O% W3 L    int     3       . D2 Y  T( c' X6 F5 G. S! n, Z3 Q
    cmp     al,45 H) E) M4 q  U9 ^2 ^( t' g  i4 S
    jnz     SoftICE_Detected
+ A) r" J/ {0 K! \: H" w
, S6 d% j; W4 G# @3 q  l' L4 ____________________________________________________________________________5 ^3 U" K2 K  [  m2 o( Z

0 I3 W/ u9 [5 J0 JMethod 02! r0 `! Q2 U& g
=========
+ n% F/ U+ ], a3 y  {( k1 D$ }8 M( X. M# `8 Z
Still a method very much used (perhaps the most frequent one).  It is used
. Q  D8 z/ I. M, F* Qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,, m. b) L2 i5 P5 L
or execute SoftICE commands...; D* U1 Q$ S9 M. {- R4 q0 @, D' K
It is also used to crash SoftICE and to force it to execute any commands
1 @! o# x7 f- A- J(HBOOT...) :-((  $ j( ^9 ?/ @: D
. Y& N' F/ K1 ]7 Q  B
Here is a quick description:$ S2 M% y1 l/ U
-AX = 0910h   (Display string in SIce windows)
* `2 k2 g. k1 \' h* h, C-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 s0 w$ s7 C+ l6 Z3 M5 x& J( s-AX = 0912h   (Get breakpoint infos)
! A! j! I( B/ y% d! K-AX = 0913h   (Set Sice breakpoints)/ k! u. V' q8 ^( V  g
-AX = 0914h   (Remove SIce breakoints)
( J& a  a; F$ {" U$ u, J2 C  Y& p, H% ]4 M( D) r5 n
Each time you'll meet this trick, you'll see:
9 v+ x/ i' @" G% `, B7 N4 s: ]! J-SI = 4647h& @+ e, n% ^; j; h  {3 [9 q
-DI = 4A4Dh; K, V6 `- @1 T! f1 U
Which are the 'magic values' used by SoftIce., J0 \9 ?* v& W/ v+ X* l
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& ^( f2 r4 O% Z3 A

4 }3 z9 L0 a0 H' J9 U( _Here is one example from the file "Haspinst.exe" which is the dongle HASP
2 ?2 Y3 |2 u4 E" A& d! W+ Q( u+ NEnvelope utility use to protect DOS applications:( f$ l; G* w8 r+ B

7 n/ D" r, h0 {  H( o1 B( a) b) U/ K% V
4C19:0095   MOV    AX,0911  ; execute command.* v, ?2 n- O3 }/ ]+ ~
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. |/ J+ a! D- s& r/ T3 S! o1 ?$ W' G4C19:009A   MOV    SI,4647  ; 1st magic value.
) O8 e" l# u# {3 b4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 q2 K/ _: s0 k: b6 \
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*). A6 b# O) {: f3 O! m, Z) i
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 l' y- a2 R6 p$ H5 r
4C19:00A4   INC    CX! G% g. C9 }) [  }
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& l- c9 u0 s: n0 T. [4C19:00A8   JB     0095     ; 6 different commands.
& c# O& l2 ], k) Q. }9 A6 M4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: h. f# O6 |7 k! S/ |& v4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 V. M6 s1 S& Z0 D/ C
: Q) |  M, t7 S- R1 e
The program will execute 6 different SIce commands located at ds:dx, which
4 l# P  x  ^% fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
" U, Z7 {+ Y+ B. T1 ~- W
; g/ ]% m( X! L1 G* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 h% J/ {2 |% r___________________________________________________________________________
4 s; `+ f, D7 ^  M: C0 _7 F
2 J/ U4 k: {0 }4 P
2 K6 a8 |8 ]9 b9 A. c9 y( HMethod 032 ~' b. s  e5 L- U
=========
$ f4 H, T& v* I# e6 b( T% V0 a  E$ X8 O' B8 y; z1 I
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* E1 ?, E2 {8 @2 K* ?; G& J
(API Get entry point)
5 W( N. ~7 P) c9 R        ( b! \2 R& u/ d1 j
# N% D0 O( ?2 F9 J: Z
    xor     di,di
( K/ [, P7 s8 [* k/ F3 I6 M    mov     es,di
4 S$ Y- S6 x6 ]3 O7 G    mov     ax, 1684h       ! D6 c; ^# [/ p
    mov     bx, 0202h       ; VxD ID of winice) V1 [! d% F* }3 _  j5 \
    int     2Fh! Z) k+ e8 U' Y3 h4 X1 F8 e
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' o  J; b& Y- @1 x! _1 O
    add     ax, di
' F$ w9 B: V4 q  q5 x8 q  v    test    ax,ax
# a+ B( S9 n8 T' C    jnz     SoftICE_Detected2 o+ P4 C  m7 ~1 e- K# v0 l

$ X0 T! x2 x) ^5 P___________________________________________________________________________
) J; T6 _2 S9 i
8 P3 V( Y5 Y7 N  a$ L" }1 `, \' lMethod 04# y1 C0 B5 P3 }6 p7 n! j
=========# O8 v6 t- b7 ~% l% j. X" E- J
# S" Y, [& `3 ~1 s4 s1 v! j
Method identical to the preceding one except that it seeks the ID of SoftICE( t0 z# K+ p- j  x7 v
GFX VxD.
7 q( r9 o- f, H4 T7 ^+ d7 U& X! Q, @1 M
    xor     di,di7 L( v  ?5 M2 ]7 k% `
    mov     es,di
! V  M3 ?( U2 P3 M4 I& g& W) r    mov     ax, 1684h       6 j# ^/ p/ Q, q) a  Y
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! a* h6 ~7 N' ~5 A    int     2fh4 x0 K+ |. `! ?4 m" x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 Q' @" `+ e& Q7 Z" U3 q) f    add     ax, di5 Q9 O3 m8 l  y: O; o! c( G1 M
    test    ax,ax! q, R. q. H- a2 B
    jnz     SoftICE_Detected' N- H8 B( U! n# H
6 p9 G8 u- c  a4 T' t7 p
__________________________________________________________________________
( }: R# O4 @$ m+ ]5 b7 x1 D/ i
+ ]5 c( j4 T/ r; p' ^. s1 C& E
Method 05
' h! O* U6 k2 Q+ B=========
, z; J3 _/ ]- A& k4 |% Y) r0 {9 i' \# b. _1 Z) j: x
Method seeking the 'magic number' 0F386h returned (in ax) by all system
; h. v/ V% T4 }, }" Fdebugger. It calls the int 41h, function 4Fh.
2 C$ F& T4 ?& ^( T- I! ~% G2 rThere are several alternatives.  ) {% R' W: J) {  v4 [
% y# q4 Z& |; t, P3 b" B
The following one is the simplest:
+ W" H$ z6 Z: {7 S
/ ^4 ~6 w6 d9 C    mov     ax,4fh
6 g) B) j7 Y" y0 f% g    int     41h
1 _6 @4 h1 M! ]4 h5 Q0 B* U# z, t    cmp     ax, 0F386
, H/ j" J" R7 [; e    jz      SoftICE_detected
) z" s) D/ U- l  s' H4 X+ l3 F" B3 f

" |0 v( _, K$ Y1 q( ^Next method as well as the following one are 2 examples from Stone's
& ?5 P$ Z8 w9 Q% ]# ?. i" ~"stn-wid.zip" (www.cracking.net):! B9 ]5 c' L0 A- n" k/ E* F% S
, L1 p2 t% a# m9 C/ N( w* t
    mov     bx, cs$ D7 P% H5 w! v4 i6 P( @  }
    lea     dx, int41handler24 R0 h( N* O" L" T1 I3 R
    xchg    dx, es:[41h*4]/ _$ M0 U) S- t6 h8 t8 t9 A
    xchg    bx, es:[41h*4+2]
5 {; Y5 V0 X" b; C1 Z1 A* d8 f+ l    mov     ax,4fh5 H6 w  _! d, T/ a* g
    int     41h
2 ]1 A) z; e  h3 Y    xchg    dx, es:[41h*4]
4 ?+ v# f' Z- z0 R: |0 [% K    xchg    bx, es:[41h*4+2]
# `, \! ~0 x; \+ D5 Z: p2 _* F    cmp     ax, 0f386h
- W8 h: _  z/ @0 [2 c    jz      SoftICE_detected
2 Q1 w* K& q7 S- W& ]# w  Z2 c, W: }, c( ]
int41handler2 PROC( j$ d6 w) `% K  h6 e! I
    iret+ ^0 v' S! S& S/ s( ?
int41handler2 ENDP' o6 a& w  E' J: S5 C( K% R

6 h! h2 @& z+ w5 M7 q3 h# X1 X
* R3 P5 L0 w- o' b# c. `) B3 H_________________________________________________________________________' u2 X6 v1 v9 c" Y$ T

  r) t  H( V6 ?/ u
0 B9 _' u! e4 e. NMethod 064 V6 e0 M- [7 Q, }6 `5 \1 l" D
=========
2 N, l% w5 a$ |6 P. z% a7 S) Z# M. V/ j% Y% H! N9 `. z3 v- \# A) Z

  {( c" z: _- `( O/ g8 Q# Y7 }6 ]2nd method similar to the preceding one but more difficult to detect:, o; S9 A: h# l

- z" B, n7 ~/ }6 I: s( S! ?- V0 C) {1 v0 G: O
int41handler PROC# c- Q/ u1 l$ |% o" Q3 q
    mov     cl,al
( V9 C  p# f# ?! x6 `    iret1 N" e5 r+ d$ u$ O; U; R
int41handler ENDP
6 }8 k& F3 o# g9 A* B
( }1 r% Q9 R; F3 ~7 k5 J% \/ G  y% |1 H$ ]3 a
    xor     ax,ax
2 M, T  H$ ^' h, j; z    mov     es,ax6 u# Q/ R1 }" Q0 P! S; H
    mov     bx, cs. n1 g' u+ T. s% D! Q$ `4 Q5 N5 R8 U
    lea     dx, int41handler
, ?" x$ L; Y- o8 E1 @/ n4 P    xchg    dx, es:[41h*4]
; t" P8 D5 ?0 N8 }" J    xchg    bx, es:[41h*4+2]
5 o8 D  l7 Y5 ?0 w+ w- h* a9 \* g    in      al, 40h
- J: w3 P0 Z5 m; ^) g3 D    xor     cx,cx
/ B  j. C0 ^6 l3 l$ V    int     41h
' z$ x4 l* `% [+ F6 l) H  T    xchg    dx, es:[41h*4]
+ H8 Q- T) E. V    xchg    bx, es:[41h*4+2]1 |8 F: J( s2 |$ ]0 S/ o
    cmp     cl,al
0 f( ^" M, A( T; O& I- A6 j    jnz     SoftICE_detected
* o, P7 F' r% r" U% |* M3 H( l/ v5 J  y1 r0 t4 U& `& l# v8 L/ t5 \
_________________________________________________________________________
9 M' O* T  D% \1 E. q
$ b+ }5 B& ~1 a$ kMethod 07) ^: n3 x$ p! X+ [
=========7 h2 m; k1 M: o6 W: T* C
$ j: X3 e0 B. e4 ^4 [, [7 r) p
Method of detection of the WinICE handler in the int68h (V86)) s" f) x& q% P7 _$ s

$ M1 v% E/ P( C+ B/ S/ W# s    mov     ah,43h
# W7 z/ \4 x: ~; j# X% v    int     68h
! D5 `" Y! N! J0 E    cmp     ax,0F386h, [2 ~+ s1 O  k1 m) i- b
    jz      SoftICE_Detected! {6 k) D* d6 p. Z! H
! _) v1 z6 ?7 @6 r$ [
5 ^5 o, p0 A0 S0 q4 X# y- }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% ~* m& D8 w2 Y& V3 I; N6 |
   app like this:) x) \8 f; ~  P1 e' R
6 W& j. @2 \9 [8 @' L
   BPX exec_int if ax==68
9 M' O% |$ e2 S, T* e   (function called is located at byte ptr [ebp+1Dh] and client eip is
# g3 X4 x4 j$ I/ M5 p/ w   located at [ebp+48h] for 32Bit apps)- w+ P; d  f) q4 d7 B- I
__________________________________________________________________________; a$ w/ J1 j7 x  _: l4 g2 j
4 }0 P( \$ W6 x( H/ ?. ~0 z
* Y" @% M5 T; {7 T- K5 o
Method 08
. ^# W( ]. L7 {; k& j=========
$ q, [, R" h8 y: R
0 N% c1 d' X) b. d9 a" cIt is not a method of detection of SoftICE but a possibility to crash the6 k6 Z& y$ x5 ~; L! ?
system by intercepting int 01h and int 03h and redirecting them to another
+ C# U0 T8 S8 r2 B& \# b5 kroutine.
! w0 K/ q: X! h: S# D3 n* hIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 Y0 T% G$ X; d, I6 {to the new routine to execute (hangs computer...)+ o9 _, ^+ I' @, u) N1 k. [
/ P( N- G. R) u+ G
    mov     ah, 25h
% c6 f, i) R5 m9 S7 C    mov     al, Int_Number (01h or 03h)
5 x/ C2 O0 L% I4 a3 b8 w    mov     dx, offset New_Int_Routine) B7 G1 m1 W! M8 B
    int     21h% u- x  W4 z' I2 L; t2 W% k7 @5 ?
) E; `& V, I  R. n- w
__________________________________________________________________________3 O" M  g' t0 a$ U$ S; V

; C8 t) F7 }' yMethod 09
3 y( R$ F8 x2 E=========! n4 I% y4 g# {; k* i

+ N$ e  ^  v0 w" G$ `2 x  dThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only- \3 s" \& u* Z
performed in ring0 (VxD or a ring3 app using the VxdCall).
- z7 r& F, |1 ]2 I! K. bThe Get_DDB service is used to determine whether or not a VxD is installed) v  S1 P; C" ~4 `$ y% u* V
for the specified device and returns a Device Description Block (in ecx) for' r" ]4 Z" t0 |2 Y: A* |' B
that device if it is installed.
9 G; ]3 M; E. J5 @$ Y. s
/ ]' Q6 j' \  q5 K, a0 G   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ o* a% w3 E$ w( d: R- z8 x) v* f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)& J) y2 }% ]7 m0 T% I& W
   VMMCall Get_DDB
/ x1 n7 y  Y/ \; ?   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: A0 u! M# [+ h8 Y1 I% X

1 W# F6 X6 O# |7 S) e1 S  _7 S2 gNote as well that you can easily detect this method with SoftICE:
% y; i9 ^  w- G  |   bpx Get_DDB if ax==0202 || ax==7a5fh' V, D" ~) ^+ c# a# _, ?
- z7 R1 g" z0 Z3 b$ y5 b4 U
__________________________________________________________________________
6 v$ e" `2 c; c) S
- X9 x+ K+ L$ g& GMethod 106 I/ s) a1 ?+ `" a5 O
=========8 S0 x0 a8 `! I. Z; N9 h

. t6 v+ l7 k. Y=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
7 T6 f9 N0 b# A  SoftICE while the option is enable!!
$ ^6 @* T: i4 J, F9 v, o' f( V
9 v) y* F: {. [: B1 V# l) `This trick is very efficient:! _" O# ^. S$ K2 K& A* f
by checking the Debug Registers, you can detect if SoftICE is loaded9 N' e! }/ r6 B0 @
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 j  r4 @4 ^3 z- u" x
there are some memory breakpoints set (dr0 to dr3) simply by reading their$ M8 Y) P9 y$ |) q3 V9 m: }
value (in ring0 only). Values can be manipulated and or changed as well- Y' a' e  F+ S& G7 Y
(clearing BPMs for instance)- s' N$ _* i; c: k
9 n9 Q. M$ z2 b  x, @
__________________________________________________________________________
, c. g* z  E' R
/ T' {; I! A! l3 K- ?1 LMethod 11! P% \( W- W" w3 a/ q, H
=========
& g3 U: N" j3 e  V# ~/ I1 ]2 S" @9 J+ X9 f* y1 C$ ^
This method is most known as 'MeltICE' because it has been freely distributed: `$ w' t7 c: n+ U8 x( F5 r
via www.winfiles.com. However it was first used by NuMega people to allow
- u3 l, o" V. }4 FSymbol Loader to check if SoftICE was active or not (the code is located4 o1 S' V9 Q7 K8 @
inside nmtrans.dll).4 _& w) G# u: E' l% t! A
) s2 k2 r6 J8 l$ @# t. l
The way it works is very simple:8 @+ K( o! }% Y2 r* z
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ F( {- H- D1 q4 ]
WinNT) with the CreateFileA API.1 L9 g' t+ }, K9 B& m9 g* R" q
- L: z( x& a+ {7 G! Z- m# I( \' P
Here is a sample (checking for 'SICE'):$ O& S2 h4 |. d# t

  ], S% N' A; |, ]1 J" k+ c, nBOOL IsSoftIce95Loaded()
. k6 b; ^0 A1 _{3 M! h' P) |) T' }! m
   HANDLE hFile;  
8 q) w7 ^3 g! @6 e- Z% n6 d3 O   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,( f+ T  x: f9 \/ c$ n0 U4 M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% W% m+ L. z9 y5 v6 U. l8 S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 j: S) G. q6 H, i. Z0 v4 U
   if( hFile != INVALID_HANDLE_VALUE )5 X7 H3 v3 @  J5 N0 |6 S  z$ D
   {
0 Y  T6 v7 a$ U4 R      CloseHandle(hFile);
, n8 E8 v3 A7 J* z) a      return TRUE;
  [  f4 p3 ^# M2 n* t* j   }
1 c/ k5 n  _  K8 C5 y$ p1 ~- N. V# c2 R   return FALSE;
- D1 s" c% W9 t}
6 l7 `9 X( @9 w# R' [% z- R) L; h) a& G9 Q8 [4 R  F! H$ O
Although this trick calls the CreateFileA function, don't even expect to be. ]5 t: c+ B4 e( W* U* u
able to intercept it by installing a IFS hook: it will not work, no way!
7 b0 z1 u* o% T9 C5 {/ Z4 OIn fact, after the call to CreateFileA it will get through VWIN32 0x001F- n# Y6 K! f! {1 j* y, K
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); H+ G6 P- b, w( X
and then browse the DDB list until it find the VxD and its DDB_Control_Proc; H) M9 H) K* l  S4 F# f/ t0 d
field.7 a' a0 ^, j7 P* X% i2 R, A
In fact, its purpose is not to load/unload VxDs but only to send a % X: ~. a- j% w+ C' H
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 r, N; ^# _3 M1 _  }. U2 r& oto the VxD Control_Dispatch proc (how the hell a shareware soft could try
; p0 S$ z9 d- W" m& q8 B8 ?to load/unload a non-dynamically loadable driver such as SoftICE ;-).7 X7 K. P! e2 ^8 b! r* R
If the VxD is loaded, it will always clear eax and the Carry flag to allow2 h! [' N2 V8 R* z
its handle to be opened and then, will be detected.' C7 ]) M. P0 V
You can check that simply by hooking Winice.exe control proc entry point
0 O6 h" R9 T7 d) Zwhile running MeltICE.
# h6 u0 M" k, R/ Z  L# k. ?2 X" h1 O4 C' I8 m& O$ f

1 x8 ^8 j6 o& g2 _* T$ U  00401067:  push      00402025    ; \\.\SICE
; y4 r# U2 f( s" n% F* X  0040106C:  call      CreateFileA
# b. \& ]1 k- ^& `4 s) _  00401071:  cmp       eax,-001
" [' h3 {  S8 R# y  00401074:  je        00401091
/ w1 {& k5 }3 T
% X3 r& `0 R4 ]# W8 Z' j' J% R2 A$ q5 _: Z4 j/ O- q% o! c
There could be hundreds of BPX you could use to detect this trick.% \: b, R5 g4 E; f5 h" E3 ~8 D
-The most classical one is:
) S6 @  {; ~9 c  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- C" L6 P0 t- n+ s+ l$ I    *(esp-&gt;4+4)=='NTIC'
2 i0 i4 J/ C0 h, d2 w% _* W9 l
: u" E  z2 Y, O* [; w! z" P-The most exotic ones (could be very slooooow :-(8 O' v- U: s6 u2 r
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% G/ s" X' w' G5 A& D1 Z2 V+ d$ n, w     ;will break 3 times :-(
& W  Q; w+ x. g
- N' F& `+ B  h# w1 [% E-or (a bit) faster:
, p+ |: O% |, }% U   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 N* I6 z8 u) d
5 |! o' Q6 m& i   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / }$ t' g/ m2 F& t
     ;will break 3 times :-(+ A& w. m  p, R
$ D% r; B( q1 a: l  |
-Much faster:
! }0 A1 d2 Q, v6 W$ a   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
" T6 _4 r) b9 S+ l2 R
1 @. V7 z( K; Z  R+ k, PNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
% G3 L- Q1 R" q( T4 |8 Gfunction to do the same job:0 J& Z. r8 Z7 T  x

" ?: Z6 Y, F( t  O0 F   push    00                        ; OF_READ
% z3 u* Y& N' \4 }( c4 ?   mov     eax,[00656634]            ; '\\.\SICE',0/ K3 n, N) c* n. O) G; X/ ~4 U& Q
   push    eax' D# a0 F8 P2 F. y( l- p5 y
   call    KERNEL32!_lopen
! r" \: K/ ]( n1 y( F   inc     eax
# g5 Y$ [+ h  {. u6 L7 I: H# w! ^   jnz     00650589                  ; detected9 E* L$ ?4 L- S: `9 ]
   push    00                        ; OF_READ
3 q# i  }+ j; ~, u3 j( {8 x6 K   mov     eax,[00656638]            ; '\\.\SICE'
$ u+ x. _& J& j0 A5 U9 c) k   push    eax
# k& K/ c) F. y) t! u3 R6 N   call    KERNEL32!_lopen- O! l5 _) I* M3 E
   inc     eax
, U+ X; o3 C* O- D+ K, ?   jz      006505ae                  ; not detected1 _6 K& q4 d9 R  w: n+ [5 K1 }

# c" f$ q! z2 d2 W' X4 t$ K9 t5 t" _4 M( g, j$ G6 I2 \
__________________________________________________________________________
# o% w; b: L+ R( D+ ^$ O
( c* H, x0 [; D( O: }- x/ vMethod 12
4 B8 ]3 r& m) X& x' G9 V! [: W: |=========
4 R( E/ p/ z1 x& k8 y6 z6 [# b- I4 P$ ?. m; K# F% N( ~# v$ Q6 M) q
This trick is similar to int41h/4fh Debugger installation check (code 05
! ?$ l* A5 q0 {4 M! t6 z1 R; R&amp; 06) but very limited because it's only available for Win95/98 (not NT), D3 l* S% ]" O
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" r! W+ {- t# Z! f( |* t: M( ]3 X
   push  0000004fh         ; function 4fh% y" ^. J7 i! ~. E
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 c* M- s+ u% m4 l( T
                           ; low word specifies which service
; Y2 m  S, s: I. B0 Z/ Y9 U( Y                             (VWIN32_Int41Dispatch)
6 Z" z  |" b0 z0 }   call  Kernel32!ORD_001  ; VxdCall
! B$ ?9 m- J+ \0 D, H8 z* g   cmp   ax, 0f386h        ; magic number returned by system debuggers9 m7 W' y1 ~' F6 b5 v" j
   jz    SoftICE_detected6 U( G& m0 c1 O6 G% `- ]) t: R
+ w7 P8 D( y! c* t# W3 h, \2 ?
Here again, several ways to detect it:
/ s2 C8 c9 E+ E& V  W. O" g4 V: n# R' p
    BPINT 41 if ax==4f' f" j1 R: N* V$ g. t' `: Z3 T4 X2 N
7 M' [( B& u% L7 k
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 @4 U. R, y! }: f# Y7 Q  K, L
1 j+ R: q4 f; i: O- H) a
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' @8 j* n. {1 _
* u6 M; u0 u7 b9 @/ R    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
8 B2 d% U0 E, z8 g1 {. L6 n5 t8 G: O- {; W# l4 p( k6 U
__________________________________________________________________________8 T! g. d. y7 K6 l5 X/ F

1 S$ D" U3 @( H& AMethod 136 Z" _. W1 M: r) W
=========
  I  d0 N7 f, \' @9 q! q  _
/ `4 G( {% j5 R8 YNot a real method of detection, but a good way to know if SoftICE is- h6 G  P% I+ H! i; d  L6 O8 r
installed on a computer and to locate its installation directory.$ N# x# c2 Q/ E* B0 F
It is used by few softs which access the following registry keys (usually #2) :
  _* S6 F& h8 v* z# n! T
' q+ a- W. u5 m9 V# ?-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 \5 b8 e1 L( s! X) \6 n. Y9 N\Uninstall\SoftICE
5 v! c8 H! o# r9 P& t( O# N" ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
1 |( \. m: U; Z) Y7 R7 B, c* ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 c+ H9 ^' K4 _! j6 [1 @; D$ J: d* [
\App Paths\Loader32.Exe
5 D( O: `, e3 }
& l" ^" r1 _2 {, P4 c" S; y. v# M: N, |& s7 m, S
Note that some nasty apps could then erase all files from SoftICE directory2 W! R! d) D/ h
(I faced that once :-(
6 {" M/ e7 T$ @6 i1 A3 ]/ U$ u8 a/ a1 f) Y( |
Useful breakpoint to detect it:
  Y* P# z3 \6 V& w& |  K* a4 {6 L3 n8 @" Y/ s( Y! C; B( L4 @
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 E3 e  S: E8 y# N
  z4 x3 j2 ~+ n; Z; ^: m
__________________________________________________________________________
8 H# J7 ~& {3 H5 y9 U6 z9 \
* D( E, ?$ i$ j/ g$ P
$ s! @4 L  t5 R9 s' ?0 ]) h6 |Method 14 . ^. c- X/ Y3 d0 U2 w
=========
& F! C6 ^/ O9 j* ]9 O  J3 b& t9 t# k' C
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# ]2 D. h0 d  ?: zis to determines whether a debugger is running on your system (ring0 only).
& q% K: e2 h% B8 i, c( |" ^! o: g2 y( h) M
   VMMCall Test_Debug_Installed5 i& u: V$ P  G2 x, a5 U$ }
   je      not_installed! I+ M- k5 V& V2 E, o# Z

. _1 c) B9 i: b5 _1 a! NThis service just checks a flag.4 @: X( R$ j% z+ j" s+ e: g' S
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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