About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 o: t- \# v9 c+ N. w* j( g# |<TBODY>; A! {2 ]: h$ g& U3 `* h
<TR>
' u( N' k: k' W  l3 d/ R<TD><PRE>Method 01
1 ?! Q1 z3 A6 P& b2 S=========
7 P* u. Y- k  z2 F6 l
! T( _( e- e* l, oThis method of detection of SoftICE (as well as the following one) is8 W% M7 c) t0 f# X
used by the majority of packers/encryptors found on Internet.( B2 A6 O+ G1 s1 {% k" b0 G! g
It seeks the signature of BoundsChecker in SoftICE$ z$ [4 ^2 `* ?5 U& F; n/ ^9 e

0 j$ O. i  w, ?6 b* j    mov     ebp, 04243484Bh        ; 'BCHK'
& v7 W0 ^6 @' @7 o# p3 h    mov     ax, 04h
7 O4 F: }6 G0 ~7 {    int     3      
# E, ]+ q- e  T! Y( F% i    cmp     al,44 T+ W: F/ B, \7 x% ^/ V
    jnz     SoftICE_Detected) U4 ]1 f+ o- F6 T3 o2 {
8 p. N2 @9 C* f% s9 y' Y( m
___________________________________________________________________________! f; U+ ^7 ^0 r# t
# K" t( V( W( R, u1 [
Method 02( y8 C. V' J) X. |7 V3 G. P
=========
. i6 T' K% l  D; {* ~7 w: E: N
8 F; y1 h& y2 ^& rStill a method very much used (perhaps the most frequent one).  It is used. P% q9 @8 P7 p. C5 Q9 t: r
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,. F" q, F: e5 d) A; ]" _" c8 t
or execute SoftICE commands...+ ~9 P+ k/ v* n1 L
It is also used to crash SoftICE and to force it to execute any commands# |$ U! f& X! Q& Z  Z+ f
(HBOOT...) :-((  : x6 \5 q) h$ {- h, t0 o- C' B
! z/ y# D! n, f- w# ?
Here is a quick description:
* H) i. c! a% d-AX = 0910h   (Display string in SIce windows)" r! M( L  j" {1 Z6 i/ ~- ^6 E; A
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 u6 B, |& H$ j/ b2 t-AX = 0912h   (Get breakpoint infos)% z; X0 }# D% q5 M. C* b
-AX = 0913h   (Set Sice breakpoints)
+ \0 M1 I$ }- @8 q6 d% {-AX = 0914h   (Remove SIce breakoints)
- j; m$ `6 ?& y- S) U( ?) U; ]$ C3 \# J( z
Each time you'll meet this trick, you'll see:* [8 L" E. y  ?) N' R
-SI = 4647h: _5 I! _1 ~; I4 K- R! t% [
-DI = 4A4Dh
# d+ g& K+ V. g- n. G! z0 WWhich are the 'magic values' used by SoftIce.# f& X$ Q4 [3 f3 B& l
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% x; v! V5 J' P: S$ y# s

' c" h; \# f$ z9 A0 j8 M9 JHere is one example from the file "Haspinst.exe" which is the dongle HASP1 f! E4 Z8 Z* n0 K* Y2 K& E$ S
Envelope utility use to protect DOS applications:9 H( k" E' j/ `2 l

2 A3 n1 y0 P1 v6 h( z
+ N. G- c8 f( a4C19:0095   MOV    AX,0911  ; execute command.2 ~8 R: D7 z! O6 ~
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 t- H; ?/ p  h$ t4C19:009A   MOV    SI,4647  ; 1st magic value.* q6 m5 V  A1 L/ N% u
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 P% e7 K3 C) f4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: H' g$ r% ]( S$ g4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  D0 Z3 ?% M1 h" ~& K' ?4C19:00A4   INC    CX
# H: o9 P" h+ _7 E* B# A4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute  \% b8 T2 `* }
4C19:00A8   JB     0095     ; 6 different commands.1 w. y& ], ^' L( F
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 @$ U& h1 \, o' b1 Z- T( E
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& c3 p7 e/ H) r$ P& z/ Y% K" X$ e0 @
The program will execute 6 different SIce commands located at ds:dx, which( ^& r" P9 L6 d7 i# U$ B0 k1 s; z8 N- x. L
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.# r0 S' |- u/ o

: g) w" j) b! c6 \* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, t$ s4 B% K; H___________________________________________________________________________6 e9 m/ i" T/ X3 b6 M# p
4 k" n6 Y2 u8 V& C
# T4 Z: o# A5 X+ ]: h
Method 03
6 w: J! Q2 j2 o2 G4 p=========, q9 G; j+ d$ g0 q
$ u* ]/ q+ B& I# b5 j5 ^
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 t; k+ i1 m1 d* v# d8 m(API Get entry point)/ `6 w; h; ~3 e: }4 \
        
( b# B" ^" E- M
+ `: y- j3 @* ~7 `7 ?4 I3 q, a    xor     di,di- ~5 L+ f  W0 J
    mov     es,di; k6 j4 f) s* D" D4 C" {" N# A7 A
    mov     ax, 1684h       ! f7 r$ i0 t1 q) s. N
    mov     bx, 0202h       ; VxD ID of winice
% ?3 p. ?7 N2 G- P; I: j. r0 g    int     2Fh% C! _& t' _4 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) \& x1 J; M" X- B. Y- \, {! C    add     ax, di/ p* E# }1 J( b# a! w4 y$ N4 h
    test    ax,ax" A- x6 ?1 {9 p' J
    jnz     SoftICE_Detected
0 M. n! x% A+ ]2 ^2 A- S* r" X* f7 v5 K. B4 \; a" Y0 C+ {) Z
___________________________________________________________________________
. M: r  |- [6 U, H% q2 u! ^$ n, j9 N
Method 04
% T' K1 i9 I& Z# v2 e  [  r( L. Q=========! W+ U" V6 A$ Z

+ u1 T3 m8 b$ Q6 _! x% WMethod identical to the preceding one except that it seeks the ID of SoftICE
* I( f0 s3 ~; R5 m% o; JGFX VxD.- D; d0 g% T2 _* x

/ T* h8 {% _7 h+ G& _; y. v    xor     di,di
# [) B# ]/ u0 n, Z, K  y    mov     es,di5 H, c: m  V. v% D3 {$ L
    mov     ax, 1684h      
- x& C( G- n( D    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 k0 \8 p0 C* ?! M    int     2fh
1 i) c  @+ T6 ?9 K& N% C( U    mov     ax, es          ; ES:DI -&gt; VxD API entry point: f6 ?7 p5 E* d9 T4 p( f
    add     ax, di% ?3 A, Q3 j3 p. `; u" t
    test    ax,ax) b! H7 h* b: M: r) m6 P+ F  u  y& R/ f
    jnz     SoftICE_Detected1 ?- ?8 s" n5 D
1 c! N6 Q5 O& k0 l
__________________________________________________________________________8 j2 ?& Y2 j( @' r3 K  {
5 z1 C; B" R) J1 [6 j) B

! F: P3 \7 N) d, H  ?Method 05
- t7 y# ?2 u+ y8 u& m4 o=========
9 i5 R/ u6 y4 m" w. x8 ~0 `/ E- L- u9 M$ C+ `0 {4 _
Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 @! S0 g' ^9 S& h. R3 J  P( mdebugger. It calls the int 41h, function 4Fh.
; H% K+ C/ N* f. HThere are several alternatives.  
/ k& J5 I: _( Z2 E
* G' [, A4 x# q/ B% D+ fThe following one is the simplest:
2 J/ K- I3 q/ v$ d( p, L* k; T% M9 [) y4 V7 Q$ W( u+ [
    mov     ax,4fh
4 h' Y& k1 |3 S! k    int     41h
* [+ ?* F8 F* X( W3 t3 x' D1 p2 v; B    cmp     ax, 0F386# Z- ~$ Y, v# H2 o& ]+ B: v- h) x
    jz      SoftICE_detected. D! }$ X: c% V- w1 S5 i3 p  |

  t) N. e$ ^+ q0 t- A3 o6 a! ^3 f$ i' c4 x
Next method as well as the following one are 2 examples from Stone's
5 f. J& F% |* c# c; D- ?"stn-wid.zip" (www.cracking.net):
9 `  U3 r2 ~7 `% F1 J4 p. s1 P% r  U% f4 w$ Y
    mov     bx, cs
& k% g) S' ?/ O    lea     dx, int41handler2; b6 n9 ~9 ^" f; {" p
    xchg    dx, es:[41h*4]% \: V. b# U$ w9 P' {! @) Q
    xchg    bx, es:[41h*4+2]' a# I% N( v; Y5 f3 `: _
    mov     ax,4fh
3 I& U; s+ w( q" |, {    int     41h" E8 b* w$ f0 y' b/ k" G6 I' p- r# [
    xchg    dx, es:[41h*4]
2 e0 x" [- t# S    xchg    bx, es:[41h*4+2]
( v) A5 b* [" W    cmp     ax, 0f386h8 {" H9 M+ ~4 {: p. X- s# w
    jz      SoftICE_detected& n, l! b! J! s

& i& x; H' Z: A  |# }int41handler2 PROC
) \6 i/ x8 Q/ B9 [1 g    iret
/ G7 O$ f) O8 a7 \+ |# Y/ p( I5 Bint41handler2 ENDP9 P. u$ H% F8 a" k# z1 U+ G. w  m

. c8 U; s* Q1 A! n3 Q; z: ^4 H3 w( P  C
_________________________________________________________________________
8 t3 m; k  U6 J. Q% ~/ ^4 v# q3 V& @& Z$ ?
: G' ^/ h7 `6 j3 m  |! j
Method 06& x: r4 |1 I& W
=========
' I% B* B- U3 H
( o' o' s- b5 J+ {/ z) A' h) z/ ?) w& v) L" v; V6 ?# Y; b4 A1 L
2nd method similar to the preceding one but more difficult to detect:
. N0 F4 y( D8 h4 A6 T* t' U9 v! L( f) g* T
2 D& l3 t8 M8 s+ P
int41handler PROC4 z' S! R' o) M2 e; \6 V% F& L
    mov     cl,al
/ u' l  Z0 G# K" }! i$ O6 y; y    iret' M! S" B# x* m# q/ s: f& [6 ~0 `
int41handler ENDP
9 K! T& J/ r% N' k
  t. C7 [: N8 [; F$ K! M; F
6 ^" n' _2 m' x2 N$ F4 ?    xor     ax,ax
  ~- W0 y0 `3 e6 S. j8 N) K5 w    mov     es,ax6 T2 t. b/ u9 \* e" [
    mov     bx, cs9 l0 w) k& b3 q& H2 [
    lea     dx, int41handler  u' Q5 H8 J- i4 g! Z1 E
    xchg    dx, es:[41h*4]
+ |4 U, y; W: `7 S    xchg    bx, es:[41h*4+2]2 H1 d8 {1 |/ J
    in      al, 40h* s) I% r  _9 W; l. N' n
    xor     cx,cx
0 x+ [$ ]& @) v/ B' v    int     41h" z4 T- S6 }4 g& Q0 m: \
    xchg    dx, es:[41h*4]
6 m, ?9 {" B! e) }/ y+ ?0 K) {    xchg    bx, es:[41h*4+2]
% {. v: S0 O% b/ u+ L1 G% R    cmp     cl,al
$ G8 p5 ~0 z5 i6 p+ o; |3 {) c    jnz     SoftICE_detected* R! S# Y% q# r$ s3 q
) G; }9 j% f, E$ R! M  A. u2 q
_________________________________________________________________________  ]. E% B4 ~0 s# q
* ]3 N4 j  a/ E5 D0 \( V
Method 07
+ }: F( R- O1 [; A4 \/ T=========# D, E% b6 z+ C

0 [& Y) h; H- X# f& bMethod of detection of the WinICE handler in the int68h (V86)
. Q3 t& h+ x$ c6 }# o" Q/ O* R; T! c# a
    mov     ah,43h
0 z$ l, a4 n7 w2 s* Y5 e. e( ]    int     68h
6 e) o; t* T( ]5 [, Z; E    cmp     ax,0F386h
7 j2 P5 r$ t! H) t* n' D    jz      SoftICE_Detected' Q+ t" @+ [/ M2 F

0 D3 e7 K# C9 u) J$ D' K
4 D# |8 {5 d8 `, v1 J- d' _=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  R/ q: P% |9 ]9 G1 Y6 H7 l% g4 W   app like this:2 c( R. ^6 F0 ~4 W) M

8 l8 T+ l9 x" n+ }  O9 c) J1 s8 B  L   BPX exec_int if ax==68. C; [+ N1 f6 F& c$ ?# J4 d8 K
   (function called is located at byte ptr [ebp+1Dh] and client eip is& b+ u( w7 y' e6 }% V, O5 w+ q6 G
   located at [ebp+48h] for 32Bit apps)0 m! U3 q+ E6 C/ q# ?1 Z
__________________________________________________________________________3 M: ~+ J/ c" U; U. @. p
" I) z- X3 n) N# Z+ a
; x: T; X! N+ _- x2 u
Method 08$ h, f4 u& [2 O5 F% D
=========
6 z1 e% R- O# K, j0 l9 `8 c6 P( F  m
It is not a method of detection of SoftICE but a possibility to crash the
2 T3 E  L1 R2 h" E) ~  }; S* jsystem by intercepting int 01h and int 03h and redirecting them to another6 Q/ f1 |8 {$ i
routine.
- G, X: q- }. D# a5 o: d( EIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
3 D7 v; v! V4 l8 Yto the new routine to execute (hangs computer...)
8 X3 X1 g; c) N" Z4 u, d& V3 x4 V2 G7 C4 ^
    mov     ah, 25h4 L' B# g1 j! Q! p
    mov     al, Int_Number (01h or 03h)& Z0 i3 A  f' b( B6 t
    mov     dx, offset New_Int_Routine% i/ f3 q& [7 g% t
    int     21h
3 x1 L$ R! ?% }1 R$ I% i
( ]0 {* {7 r6 [9 Z! ^__________________________________________________________________________
' m" P3 D& [9 w* P: q% \7 X
2 \/ e) k8 U7 D, M4 `" B; u' oMethod 09
7 ?7 w/ ^: k: O  O1 j1 _=========
! z8 a" F2 c( W) L% ?
6 T8 c6 ]% V) {, p, R" I- fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  j) ?9 I+ o+ K* x7 v0 t& n" e9 ^
performed in ring0 (VxD or a ring3 app using the VxdCall).
* e, O$ i, O' a# `3 tThe Get_DDB service is used to determine whether or not a VxD is installed8 b' l( n4 w3 V3 M4 Z
for the specified device and returns a Device Description Block (in ecx) for
' Q0 c  Z( b  T: C$ Lthat device if it is installed.
7 V* N7 u3 Y  [' ?2 j8 ]/ a3 }8 \
0 M  |7 G( X: W7 n# z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
+ o! M/ x/ y! A- R9 `3 m9 C+ Z, D   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ u, v, ]! `7 X+ Y. Y0 G* D+ R
   VMMCall Get_DDB. G2 A9 y$ n( f" g7 M2 W
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed+ K& D; ~5 C" Q: _% G9 |. J

  r/ x, n3 k; g" r) t% ^Note as well that you can easily detect this method with SoftICE:! S5 ~' b# c" p" P. {, O
   bpx Get_DDB if ax==0202 || ax==7a5fh
) T7 P8 v' p6 g: V1 z8 h  e8 @8 Z2 v( s" a# F
__________________________________________________________________________
& ^) r$ A: L6 H2 }! j* u" L# ?( C* w+ Y/ |2 c% ?! g7 f0 a
Method 10
& x" E6 s  q9 \: l! ^3 O  F=========
3 N3 l" A. C$ S" o; l- T/ Z  J) u9 p9 N! S* T! n! s" D( P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ u+ K' \& d; M! x2 m# E
  SoftICE while the option is enable!!& M( A2 L0 ?2 b! ~* U: l; G
& S0 t, B6 z7 }. c& t# E
This trick is very efficient:# f. V9 R, Y0 _6 d
by checking the Debug Registers, you can detect if SoftICE is loaded, \: |% V5 @0 J: {  u4 t% b
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 p: Y- B' ?, m" H
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 K( G  G( A: u! t
value (in ring0 only). Values can be manipulated and or changed as well$ E9 h& V: M% _( N5 a+ c. u
(clearing BPMs for instance), U/ o2 N  \" ^3 p) W
+ g1 K; k+ \* k! F+ ~/ E6 {* I' g
__________________________________________________________________________* H: W! r) C4 Y- N
9 _! g9 i8 Y! z4 @* }/ \
Method 11# R6 d" Y# n( V# f
=========
/ }! H& p$ @' q1 e8 z" v
5 _( K% \) ]9 J" OThis method is most known as 'MeltICE' because it has been freely distributed) b3 g1 B7 h8 e
via www.winfiles.com. However it was first used by NuMega people to allow
7 U, |0 n# q  J+ rSymbol Loader to check if SoftICE was active or not (the code is located- }6 K  C  b; a6 T" i
inside nmtrans.dll).
- r& P5 z9 [) {
7 }: D% ]( i4 X) i. {( h1 N( {The way it works is very simple:9 A; m2 _5 ^' v  |
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
9 r$ s4 s9 M- b2 b* V* {WinNT) with the CreateFileA API.
: w4 A6 x* N" S- U6 {( a
, o4 n, J7 |+ v8 Z+ X; S. EHere is a sample (checking for 'SICE'):
, A$ t5 M* E( F6 G
  i& x5 ?2 c4 m& @* iBOOL IsSoftIce95Loaded()
3 y7 w3 Y: |& c{" E' L0 E* @, q, J, F2 m
   HANDLE hFile;  $ i2 C+ k  q) G/ T4 ]( x3 _
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ b1 r0 i: i# s* ~+ D
                      FILE_SHARE_READ | FILE_SHARE_WRITE,. X: p1 N2 \1 q7 x
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ f1 b2 C( A3 y: D1 A, ]: M   if( hFile != INVALID_HANDLE_VALUE )
  M8 G; e5 i& e$ A/ X   {  r% R5 g' P  q; \
      CloseHandle(hFile);. O, i1 E8 m. c* y7 E0 j, y2 G
      return TRUE;
1 A6 y5 J4 m* G   }# J  n4 o  S# q5 B4 [& U
   return FALSE;
1 ~  ~5 N; i* K" t, {6 p& {( e, E}# r# g+ H9 u7 e# }

2 s9 `* k8 }( WAlthough this trick calls the CreateFileA function, don't even expect to be
2 O3 ~3 ~6 i/ `( Mable to intercept it by installing a IFS hook: it will not work, no way!
! P) B, G! l$ j+ _; ^; ?5 [In fact, after the call to CreateFileA it will get through VWIN32 0x001F& a  j4 W+ j% Z( v$ B3 `7 i
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 _1 n% j1 M; T3 |% y) d
and then browse the DDB list until it find the VxD and its DDB_Control_Proc% A4 W5 o9 w- n/ z; v% Q
field.
8 d4 r/ w  ]$ cIn fact, its purpose is not to load/unload VxDs but only to send a 7 s* c7 B5 s: R- W9 @  b$ ^
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( K8 ^& k  I* Sto the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 f* i1 M! N  [% Z* u/ W, mto load/unload a non-dynamically loadable driver such as SoftICE ;-).2 X% h, u. N$ l
If the VxD is loaded, it will always clear eax and the Carry flag to allow: M1 S4 J0 H! H
its handle to be opened and then, will be detected.( c& {6 {7 r0 c
You can check that simply by hooking Winice.exe control proc entry point
$ q- @# @1 F% ]9 @while running MeltICE.8 S- T  B- B! D$ x& S  p4 U: u
7 G' E* l, \. E' e0 r
/ v# K0 e% V5 f  x. m+ C( F1 N& n
  00401067:  push      00402025    ; \\.\SICE
2 \; e/ P1 L! w5 U8 B  y# }  0040106C:  call      CreateFileA2 n- L- {* C( X( t
  00401071:  cmp       eax,-001  ]/ n+ B, I& C) u- Q
  00401074:  je        00401091
' y  o) N' e1 J- ^  S3 ~
8 }7 `. i- H& o8 K' A* F& d1 n2 f' R; O4 F; a1 w! X" S! V8 q
There could be hundreds of BPX you could use to detect this trick.$ a1 C# x/ Z* [
-The most classical one is:
, U2 I4 J5 t+ t. q  M  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; S, K6 a$ b( Y& e
    *(esp-&gt;4+4)=='NTIC'
' X# Z" Y! ^+ e0 W& A% e1 N
( U  B' D' S9 E; E- R8 B4 ^-The most exotic ones (could be very slooooow :-(
& u2 z9 ?) q  H7 r4 Y4 S" D   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 A) Z* i, b# \     ;will break 3 times :-(; q0 T6 u+ x7 w0 j. L
: @% W! p9 X& ~# a) ^% U6 D
-or (a bit) faster:
! q3 B& ^4 B4 a* c5 `1 a, E# H   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 p0 j. i+ g% B$ r9 ^5 F1 b9 B+ N, F' p( ?$ C" _
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
  V' y$ b- S9 i9 U$ F. I$ h3 P, c     ;will break 3 times :-(
) p" z) [  H( f( b, k: t+ W) I5 y1 i+ N; ~
-Much faster:: K( C$ m7 L" c$ g$ _
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 E; E* D9 @9 X+ d. z; {; i2 U" }
: }6 u* {5 D, E9 h* F0 xNote also that some programs (like AZPR3.00) use de old 16-bit _lopen4 T3 \/ P5 J+ \( t' `
function to do the same job:
( z# s8 b# k4 r" w3 K
8 p9 D8 h$ j9 n5 W, E# y% T   push    00                        ; OF_READ" S2 v  C8 H. M/ ~9 |$ H, t
   mov     eax,[00656634]            ; '\\.\SICE',0' ]& n. U  u% Y# [( n4 J6 f5 R
   push    eax+ a3 O: _) B' }$ f& M
   call    KERNEL32!_lopen* e  P$ U+ U+ N' H* ~  g" y4 ~6 [
   inc     eax
0 Q3 J8 J* r7 ~6 n. m4 E) J1 w7 ^" N   jnz     00650589                  ; detected
3 u( k$ Z! @7 ^& l8 ]   push    00                        ; OF_READ- X" H' h+ \/ P. A6 H$ |
   mov     eax,[00656638]            ; '\\.\SICE'
: k9 q+ l# K' }) P$ ^8 s7 ?   push    eax
+ u) |: Z: O6 H9 l1 [% F# K# A% ]   call    KERNEL32!_lopen& y4 `' f8 h$ @) W$ l1 @4 m) H$ t9 @
   inc     eax
# {) |) x' q' \! k   jz      006505ae                  ; not detected
8 g1 v9 L! z5 @" s/ d" }( n, e% r4 b7 w+ l, G

8 c* @6 ~* @9 w6 G7 q% ]__________________________________________________________________________% x6 b4 S( b* R; l5 P  q

% u+ q9 b  r+ G/ F8 JMethod 12
1 r! B8 |  N: I1 g" y9 c1 }" D4 W=========4 y4 z. J. ?& B& \3 ^) u. ^. ^
) z/ }8 @6 ]" H! z3 T2 ~
This trick is similar to int41h/4fh Debugger installation check (code 05& h1 \7 ~& n- ^: H& P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)- T; ]3 Q2 G6 {* f! @& Z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 V, E7 s$ H& _4 I6 N  k+ v1 U9 U2 i+ H2 B$ G
   push  0000004fh         ; function 4fh8 w' y, f  d4 k  }. q2 E0 _7 R+ r
   push  002a002ah         ; high word specifies which VxD (VWIN32)
  V. I. \6 a# L; K+ G: d                           ; low word specifies which service
2 t9 q% O: ^  `) f* |- D# o                             (VWIN32_Int41Dispatch)
0 N( Z' a. X. ~, D$ o' R* I   call  Kernel32!ORD_001  ; VxdCall4 H- ^/ X$ Q6 B2 `. H
   cmp   ax, 0f386h        ; magic number returned by system debuggers
. Q6 K; H. o+ ?8 h+ G   jz    SoftICE_detected
6 a, @4 Y+ D* k4 j/ i& M. ^" U# D9 k: K
Here again, several ways to detect it:" e) W) w% B+ r$ y
5 K! m) C' m  }5 f) U: L" H
    BPINT 41 if ax==4f3 v! O2 V) o9 z$ L; z3 V

2 N1 G* f4 L) l# |: t- g6 t& G    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
$ X+ x- P( k+ a. n- K( `2 A! Q* y3 z- m& T. V" d
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 N* e( P/ Z! h
& U% {0 G  L5 ~! g! d& v    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 k. z7 A, P/ k* I7 h
& W) W5 K6 v) A3 T4 r; ^) O
__________________________________________________________________________
; E! x2 Q) U7 s! Y( @% g* k2 _
# V0 Z' P$ \9 A0 W/ X' Z; rMethod 13/ \% ]6 t9 K+ t* z1 N2 t
=========7 B& i; V0 l/ @# t8 _" h; h/ R$ T
- f- ~- \& H; y3 I
Not a real method of detection, but a good way to know if SoftICE is
4 r( d9 [% y$ P& d9 B- w9 Q; y* I/ uinstalled on a computer and to locate its installation directory.
' ?/ |$ V* v0 ZIt is used by few softs which access the following registry keys (usually #2) :: _. w. O, o& l2 T

2 D5 |4 b4 e* W! c2 P4 v6 P  l-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& X7 a0 m/ C' ]2 u% a! s1 L  P\Uninstall\SoftICE. z5 ~" f/ ^% a6 _5 ~
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
0 s# P! d; n, [3 `, ~1 u0 p-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* @7 V% d6 x/ w  G
\App Paths\Loader32.Exe: @  h4 A$ i% n8 {5 J+ a
9 d( C( {  Z& T3 W7 M2 [# N1 f

# e6 S  p/ P4 x2 h: y% Y/ ONote that some nasty apps could then erase all files from SoftICE directory
; M; v# T3 S9 f# L( P1 H9 T(I faced that once :-() b3 f. Z0 l4 @
. ?9 X( B& h, [+ c9 A
Useful breakpoint to detect it:
/ x' e: j) b$ X3 j( A1 B! q& u* o- _3 h  X7 a
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* O; j- M+ p/ w8 N+ d
0 F# Z; C) A4 z8 L
__________________________________________________________________________
$ f' @/ L9 z* R0 F5 X  D* h- ]
+ i* ^5 w! m9 U2 f& S6 o, |3 M+ A' N: }; H, Q
Method 14 0 B2 k7 L( V" |; z0 b; s
=========' h' n9 n. f( {  d
3 q! K9 h0 }  R* _7 a" l. e6 o7 |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 @7 e4 x' E+ }) @- l  _) z& e6 C
is to determines whether a debugger is running on your system (ring0 only)., B' L: Q& ~6 I, ~  Z8 \0 Y) K" Y6 _

  C1 L6 B$ Z' t! n$ x1 b  z" j) H   VMMCall Test_Debug_Installed' q5 M. t; O! ]
   je      not_installed* H6 a; w% x1 P4 E4 Y7 ?$ S) d& [
1 c; l# D/ U7 [4 v9 P6 J% i
This service just checks a flag.
2 T2 n" j8 w4 |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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