About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' S) ?2 F+ x! c9 y8 S<TBODY>, X# q" r8 V. `: {" i  V
<TR>
6 |, j: N1 Y5 c0 a<TD><PRE>Method 01 # |. L" M0 q9 F) X
=========- C" a8 E' N# M

5 D" @7 o* H# Q  O/ `) ^This method of detection of SoftICE (as well as the following one) is
: S8 m4 ~2 v, {used by the majority of packers/encryptors found on Internet.' q' P" O" R! o$ A4 ?' B' M9 }$ O7 ~
It seeks the signature of BoundsChecker in SoftICE2 s" q, I6 O6 q

2 i. R; P6 t0 U! j4 q    mov     ebp, 04243484Bh        ; 'BCHK'
8 l; e* B2 H- u+ v  N1 ~    mov     ax, 04h
% ~: l& m: N" ~. k+ {7 U2 ^1 Z. ?    int     3      
4 F0 T9 E% x. p8 W* n    cmp     al,4
( c) a5 n0 a% [0 o2 b) O3 F# x    jnz     SoftICE_Detected9 T/ t3 s1 K  m3 t, r4 [- u( g

; e! B; C9 q9 i: u7 S___________________________________________________________________________
) [8 @" @  I8 |5 w3 G* o
- N# M3 m+ ]! g- {  TMethod 02. L. R( d/ K: i' \1 Y% w" S
=========7 n- \# d# c/ ?# c8 d( ]: S

" K( q+ p/ ]. W- M& K" I5 f. {Still a method very much used (perhaps the most frequent one).  It is used$ J2 A6 }+ r" m+ Z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
  m& _( v1 O! E! D  {1 o8 U" bor execute SoftICE commands...
7 h* p8 p% h" n5 u6 T% g" vIt is also used to crash SoftICE and to force it to execute any commands1 j0 @) Z- G* Q
(HBOOT...) :-((  0 I: C4 t% x3 S
1 Q3 `" h4 V& G& K. r
Here is a quick description:7 K7 m& R( ]$ r4 V
-AX = 0910h   (Display string in SIce windows)! ?4 i$ b( q3 x7 R
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
, p  y$ ~4 s! Y3 P-AX = 0912h   (Get breakpoint infos)
$ Z$ r5 R) Q6 E% x-AX = 0913h   (Set Sice breakpoints)% v( D+ J5 K. w3 q3 m& O
-AX = 0914h   (Remove SIce breakoints)
5 N# D  v1 W( ^2 |! {& ^4 ]  o, u* \, q
Each time you'll meet this trick, you'll see:
  O) P8 @7 M% s- }; `! L2 j5 o-SI = 4647h1 r. @1 ^, R  ?  Y
-DI = 4A4Dh8 E6 [4 Z  @. q5 y
Which are the 'magic values' used by SoftIce.
6 _- |) }8 ~9 O8 C9 I" zFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 p; s+ s4 F& ]$ \
; K8 C" C# y( m" Z  s7 E2 @
Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 Z  C# Q9 z5 e* H% ]' FEnvelope utility use to protect DOS applications:) R1 V% l: w8 x$ J6 K

; D' C4 V# ?; G5 S7 U- M
5 r( s% B) u* p3 F+ _4C19:0095   MOV    AX,0911  ; execute command.9 [! s8 R$ m) U1 s" G) W
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. |9 A3 b7 i5 S: X. B* b- y
4C19:009A   MOV    SI,4647  ; 1st magic value.
6 ]" P3 T# F* \9 v0 \7 `& Y. _- a4C19:009D   MOV    DI,4A4D  ; 2nd magic value., B! i# u3 z- [5 u3 [4 g
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
# F5 A/ B4 H: q) w5 @6 S+ ^4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ F1 S) F: s7 s6 _4C19:00A4   INC    CX
! g$ N+ V8 p$ g2 G4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; O& y  I  {: J3 x: i# j
4C19:00A8   JB     0095     ; 6 different commands.
$ A3 y* L& ]& b& f$ W  ^' Y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ `7 n/ T# e0 D3 |6 ~: M; Q
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 d0 I3 P" n3 Q) W& _# }

# i: {6 ^: {+ lThe program will execute 6 different SIce commands located at ds:dx, which
/ U5 M0 x5 I, z  m* [1 c, }& Hare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' y+ ?, `8 i9 \* F  E  b3 }, N! w2 E5 x6 }+ f3 p5 B" ^8 T/ {+ j- e* G5 W
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: e, ]) `+ C0 W0 z; ?! j. v4 x4 B___________________________________________________________________________9 M2 \) x0 O) z. w6 `4 G
. \: D4 f; q) m
4 P% r, N3 \8 t9 |5 S1 L' \
Method 03
- I" P% q. v$ z: \- |9 O- B# ?=========
" `. z" Q% m$ z" c7 {3 r9 b/ P
+ Z* ?7 s7 n+ BLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
6 O9 y5 o4 Z. J+ H(API Get entry point)
% A7 |, H& e& y% K4 p- M        8 \9 r; D$ W0 Q2 y* [- D

& O3 r! y: ~- ?  Q: j! p    xor     di,di" m  N7 ~, _- r/ c5 ]2 ]
    mov     es,di
+ Y; I7 o/ G) b' v    mov     ax, 1684h      
5 S3 O" y- c- v/ P* P4 B& K    mov     bx, 0202h       ; VxD ID of winice" _% v8 q4 j( ]& c, y7 o0 U
    int     2Fh" b" ?6 [' K. w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 q4 c- ^7 ~9 M8 b) K6 D* w7 s: a  z    add     ax, di
8 R; L) W) a+ Q- J* M4 u) i8 V    test    ax,ax- ~' v& b+ h+ y4 ~( z: n& e- ]  N. m
    jnz     SoftICE_Detected
- K) S# n* P9 [9 h  ]' l
5 ~( z2 [; h. _) K___________________________________________________________________________
" x5 Z' _3 {- E7 b
9 r: W2 W  F6 s3 iMethod 04/ A7 k: j0 x# `! G. k% e. W7 l
=========
( x; m8 h# f, D$ B
- y, e  P, z9 q% h0 e- FMethod identical to the preceding one except that it seeks the ID of SoftICE; C. Z+ T  p0 }- ~+ |6 Q
GFX VxD.% X" y4 Q, ?' @  o
2 G# f2 k: S8 ~- w0 n; n
    xor     di,di
8 `# w* l5 ]4 U8 T1 w    mov     es,di
  n9 w6 K/ q* m    mov     ax, 1684h       - w: q/ f& I5 p5 |
    mov     bx, 7a5Fh       ; VxD ID of SIWVID, f0 G% Z; V0 ]2 h
    int     2fh
3 I" p- e, x6 N0 }    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* W+ J8 m, b4 O: M5 |    add     ax, di
  }- [3 Y- D* T0 m3 H; t1 D  `    test    ax,ax- P; I- x7 {1 e( q
    jnz     SoftICE_Detected
8 z1 j* ~8 |7 C6 {: `* W( C$ C' P: J8 m% q  W& ?) M+ U% ~# w
__________________________________________________________________________# C9 {6 b5 V& m# G6 Q1 X
1 `4 ~7 A3 b: }

+ q& f7 g# s; p9 q- FMethod 05+ ?9 ?6 _& M1 X  a1 D. _$ e$ J
=========  b' W9 P' \8 e, T) C
# k( T& r& o1 e3 o! ^+ A& T
Method seeking the 'magic number' 0F386h returned (in ax) by all system
7 a4 n, f1 S7 U, j- Vdebugger. It calls the int 41h, function 4Fh.
+ w& j# K& ~2 U, tThere are several alternatives.  / M% j9 n$ J8 |2 |. ?1 I7 t( I

6 a5 p7 H4 W' x4 v+ [1 UThe following one is the simplest:) b) z3 H; P7 D- }9 {) x
! a. b/ C5 F+ U% q5 T
    mov     ax,4fh
6 y% w' M% ]) k9 Q    int     41h
/ C9 k% s- d; c; W0 {3 ~+ Y    cmp     ax, 0F386
, W; }7 \( R1 S    jz      SoftICE_detected% V9 ~" q: g3 L

* f. D( `0 l2 ~9 g4 [& y7 Z" ]* }/ t- G% e% S
Next method as well as the following one are 2 examples from Stone's
, X- e, |. g! |1 Y% Y) J6 {* `"stn-wid.zip" (www.cracking.net):- v' ]1 _% m; `( H8 |$ t3 U
! _3 G! c) {) n7 z% K! d
    mov     bx, cs
$ ]1 d5 L4 a7 T2 W" q/ B# x    lea     dx, int41handler21 Y& t+ g( X  \3 }" ^- i, }5 P& z
    xchg    dx, es:[41h*4]
; @8 r5 ~0 ~' }    xchg    bx, es:[41h*4+2]
1 M; J  B: s# R3 m    mov     ax,4fh7 m+ q% n6 S0 o6 [+ o" M% Q
    int     41h" V4 Q) d$ |, [' S0 K( d+ Q
    xchg    dx, es:[41h*4]; A. R" I. a. d, V7 [
    xchg    bx, es:[41h*4+2]4 p& i! g4 H0 I
    cmp     ax, 0f386h
( W" d  [  d# L5 z7 u* v    jz      SoftICE_detected
4 N. Q7 t4 g" ]6 `- V* }" u" Y
/ s" o& N- |# m. X* L9 U+ Y; Sint41handler2 PROC
$ S5 v. ]3 ?6 v2 E+ r: E    iret
# U- q! V) ?- [2 z4 o; E) y! sint41handler2 ENDP
( Y1 f  I/ m+ N% \/ }, D+ ?4 V$ s2 _4 {) Z$ J
" i5 ~0 f; P6 e+ T' b
_________________________________________________________________________4 f/ v: w# Q( ~. `& n" B

+ g' R- h; `# }# G1 j7 R- z* A- B, _! s2 n7 L3 l
Method 062 ]4 w$ T/ E5 q$ j7 Y
=========
! r% O( j7 i4 v/ r- X$ I0 o( A# K# {. e( W
& v% b" R# p3 r( j  l
2nd method similar to the preceding one but more difficult to detect:8 P2 d/ O) z1 |. X6 d# o

1 N0 [# r  d$ {% _0 V3 B: f! U( ~2 a$ L  i5 Q5 h6 g$ c: j
int41handler PROC* \- t$ C6 \$ ~9 v) d
    mov     cl,al) R) N, Y. {  G$ Q
    iret9 O1 x: C# e4 a7 _% Y* _8 a6 f% [' t& h
int41handler ENDP
' _) _6 @8 k* J7 y+ b5 z+ W7 A
) m% N$ K& Q9 M( Z( J. R. @2 W2 D; P) c( x
    xor     ax,ax8 `$ R2 a* Q  g& A- s" c* v# t
    mov     es,ax
/ ^$ [2 ]8 Q1 T+ {9 O    mov     bx, cs
" b( N2 G4 k" q, v% ?    lea     dx, int41handler
7 x" a, [1 X  @7 z% I/ K$ a* S    xchg    dx, es:[41h*4]5 W5 `  V/ j7 R8 d+ A: K7 l8 A
    xchg    bx, es:[41h*4+2]
5 R, A  t* t& V1 H( [- v3 [    in      al, 40h
0 N/ G% d' Q! Z9 }5 n6 h# a    xor     cx,cx; n" s$ f% h5 |8 y8 A9 d8 U
    int     41h& ]' m9 j$ n( E7 b3 ~( T
    xchg    dx, es:[41h*4]
+ V  M# P9 m7 R    xchg    bx, es:[41h*4+2]# q/ o$ c  L; s
    cmp     cl,al7 y) T, H8 W6 i# d: ^# D& @; d
    jnz     SoftICE_detected0 W7 m1 }' ~* P( I8 |

# w  N+ t! Q; t_________________________________________________________________________, G( q7 o1 C/ z5 a% Y6 t# q. L

  x& w9 ?3 L9 P1 T" FMethod 07
" L' n% C& M. L* ?0 L7 V# Y! {=========+ V; _  v$ j8 {( u0 _

+ p% O# y& I0 A. }# h/ y2 gMethod of detection of the WinICE handler in the int68h (V86)- H& d: u( F8 F6 H( _* c

6 t% t8 ^, n4 W* e; o2 i2 {    mov     ah,43h
9 L7 w6 T+ Z0 D    int     68h+ B1 V: l1 r: t. `
    cmp     ax,0F386h
9 j4 s3 |) i  n; D    jz      SoftICE_Detected1 c, F! }9 q8 ], I

$ d% t( T  Q5 R# d; [% e7 m+ U( J6 D  B# `5 t
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 s1 a) B9 ?' C& M" I   app like this:
1 n& s7 P3 W- c6 T. J
- Q/ d" F5 @' Q6 p8 q8 k   BPX exec_int if ax==68; W8 b1 J; B. {$ |  w: G
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ n5 y5 j! V% n+ D   located at [ebp+48h] for 32Bit apps)! F7 Z; `2 b# _7 B+ ~2 X+ X
__________________________________________________________________________+ x( \# @# d* {* c5 A# T) z1 x
8 n  k/ W9 ?4 \* d$ a) G
7 P# A/ \7 t0 [, E( U
Method 080 R& _, N# @& n/ r0 O1 v
=========
& d0 v7 b- u: ]  I/ w9 a; |6 s) c9 W: ?/ Q' _6 y3 P+ E! [  o; n) ^
It is not a method of detection of SoftICE but a possibility to crash the# Z5 Z4 k; j2 y6 v4 w0 z  }3 K
system by intercepting int 01h and int 03h and redirecting them to another
  S! v% Y1 y7 [# l& o7 X6 qroutine.1 Q; |! w: W8 n# o: ]- G- y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* P' s/ j0 H/ N# a' Z4 cto the new routine to execute (hangs computer...)
% M: V4 |) Z: |1 d4 @
1 |4 I0 k" }  p6 Y    mov     ah, 25h
& c9 l( m* X  K5 v    mov     al, Int_Number (01h or 03h)
6 A9 ~3 Q# p* b% z& O; r9 s8 m    mov     dx, offset New_Int_Routine
7 x, n6 Z! ^- V; m, Z8 ]    int     21h4 R' {1 ]) ?1 K; Z
  t% a- ?- W1 d3 h! n3 `: f! m$ Y
__________________________________________________________________________* ]" r6 m  ~. `0 j' z

) n, |4 |0 B, XMethod 09
# V; N; l: g( V+ O% ]=========
/ i. ~( \/ L4 F" V8 ~( H( k& E. Z- E2 O) p7 D6 j
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 \' [  m: {; J9 D5 Z: v
performed in ring0 (VxD or a ring3 app using the VxdCall).
4 w6 u+ h2 `7 }% P9 J$ r/ P# j/ eThe Get_DDB service is used to determine whether or not a VxD is installed
1 Z, U5 C7 n6 ?. ?for the specified device and returns a Device Description Block (in ecx) for
! |8 l) G  s! X( @& z6 Xthat device if it is installed.3 Y) _0 O+ Q; ]% U

% |' @% f8 t% B8 t   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# ~: H, W* L5 s2 S7 ^, U6 I
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
+ _- u8 z- y1 X" d% w; d" X   VMMCall Get_DDB
' l9 `1 X* ]8 W+ K7 N   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 R3 e" m* r+ F! P3 |
! S8 B  z) y/ Y( r
Note as well that you can easily detect this method with SoftICE:
* a0 m# W) V1 U$ [( O   bpx Get_DDB if ax==0202 || ax==7a5fh
* Z7 o# F/ U* h& ]7 L9 a( B
3 j* w: t, p5 i3 y( ]( K. |6 O__________________________________________________________________________
* C: C+ n8 t" J7 w7 l+ b' r: o9 z( j/ y& r. q$ @% N* ], i( P
Method 10
' b: y) }# ]- m9 D=========+ A5 t/ F5 d( a$ V; y& n/ S
2 r& w/ y' L& Y/ `
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 ?  g" ^" R6 `
  SoftICE while the option is enable!!
7 B$ U- o* V7 o# K, q2 U% N; ~8 y. I% ~8 D0 S/ U5 ^6 V
This trick is very efficient:; e- f4 c: M: _& R( @* U" A0 N
by checking the Debug Registers, you can detect if SoftICE is loaded
% d8 Y5 A" j9 G; C- ^(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 B! W# h, E  `there are some memory breakpoints set (dr0 to dr3) simply by reading their
  G9 H" g; @  @; Nvalue (in ring0 only). Values can be manipulated and or changed as well- b( X$ d' q  I% \, ^* j7 z" I. b: _
(clearing BPMs for instance)  ]9 I9 M0 g9 o& Y: J

% |6 m, k  n9 Y# w: J- w! H__________________________________________________________________________! X+ V. X  U- w# ]8 Z3 M

/ \% a8 Q, V2 O+ s: ~8 p1 J+ EMethod 11
& w3 W8 ]. Y- A. K4 v+ P=========0 h" F! i( A2 X/ F; d/ b  _1 e

7 q* n; K* k4 ], d1 J4 [; FThis method is most known as 'MeltICE' because it has been freely distributed: _1 M) |( L. ~3 ~4 g
via www.winfiles.com. However it was first used by NuMega people to allow
( @% G, G  B* c! _& Y6 aSymbol Loader to check if SoftICE was active or not (the code is located) c$ m, M' p/ k& i8 X
inside nmtrans.dll).
! t" K5 n9 F8 H% b3 L
' k# C. B9 E1 @The way it works is very simple:
$ e: A  m5 }6 w3 GIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 W+ |0 o- _% d9 F
WinNT) with the CreateFileA API.
' g! T) H# r! N) m' ?. l* j2 O; y& B% \
Here is a sample (checking for 'SICE'):+ U  `$ [0 r: K& l

; u; S/ h% k1 [BOOL IsSoftIce95Loaded()6 X: p& p' @2 W/ i
{
3 `1 E& r; A9 \/ H* H   HANDLE hFile;  4 W( n% T! U2 P8 |; }; O5 a  _
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,- I. Y8 F! H! n; ^
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  U2 G$ D& p4 q                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 C0 M( a( `9 X+ I) s   if( hFile != INVALID_HANDLE_VALUE )5 D+ G% p1 f5 }- w; s% E: F& G
   {& v' _- W' F0 k; B, K
      CloseHandle(hFile);
  l! d% y; Q2 j) @! M0 s      return TRUE;
2 L* c, E& d2 `% i8 f3 k7 R   }: F. Z6 i6 |' f& B* n
   return FALSE;( u2 U2 i7 b: C; ~" A
}
5 H& n1 P2 m( K  f
9 x8 d/ S% @+ Z/ F7 }Although this trick calls the CreateFileA function, don't even expect to be4 h; B8 o4 ~8 y& X
able to intercept it by installing a IFS hook: it will not work, no way!
' H7 n' M2 P9 j; I2 p7 NIn fact, after the call to CreateFileA it will get through VWIN32 0x001F* p6 z, w' x$ X5 h
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function), n; V0 g  m7 E
and then browse the DDB list until it find the VxD and its DDB_Control_Proc' s$ v; I* f8 B2 _4 l  `- R
field.6 p1 N$ u) n1 c& ?0 h
In fact, its purpose is not to load/unload VxDs but only to send a
7 g: J& c/ \: r* W% Z: xW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, k+ t$ I7 M* _+ _, c$ xto the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 Y* [+ Z4 t$ V/ ]0 W2 s; S2 N3 gto load/unload a non-dynamically loadable driver such as SoftICE ;-).0 Z. B; a# |* B+ g6 P$ P2 e8 f
If the VxD is loaded, it will always clear eax and the Carry flag to allow
" H! a  U  Y! F5 t+ lits handle to be opened and then, will be detected.- a2 X8 @) t, g
You can check that simply by hooking Winice.exe control proc entry point/ {, v/ k! U3 t
while running MeltICE.
6 m$ K% r- X' T) u. K
3 k/ ~- g# O7 \! _: l: A3 q! t% h+ B( u3 N' Y
  00401067:  push      00402025    ; \\.\SICE6 U$ C* T: ^, i: j% \" X
  0040106C:  call      CreateFileA
9 \0 o$ T3 T9 Q: H) q  00401071:  cmp       eax,-001
! c: w% g5 d  l8 P& b  00401074:  je        004010915 Q6 u! `. ~( C0 \
+ g6 ]$ C, S0 T) G% e
. X  g3 v1 k6 C' h
There could be hundreds of BPX you could use to detect this trick.3 q" K- g( y) ]. z0 l( i! w
-The most classical one is:
( S& q9 z  n! `  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 j! U6 Z& k; |& o+ Y  z, Y    *(esp-&gt;4+4)=='NTIC'+ C8 ?' n1 W) x* q! ^0 ?
2 z* v( Y% d, {9 h- E. [1 O7 V
-The most exotic ones (could be very slooooow :-(4 ?+ o! @- L( `% |/ ~
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* I% e5 A7 }- t: l8 |     ;will break 3 times :-(
6 b# J7 _/ V; ]1 {3 E! \, Q& ?/ f, S& I. g' b6 ?6 y
-or (a bit) faster:
3 a+ v: x6 O" w1 `. N   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 h6 ^9 q, R+ t5 i6 s; h. D  q0 y1 i, A  t* ?& j
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- L$ ~" C) A# I, e: J     ;will break 3 times :-(# K; a8 u+ |1 Y
8 v  t# U) G0 D1 w+ C1 a' @3 P9 z
-Much faster:# `  V: w, c  u
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ Z4 g( B0 k  F: L0 D8 L" z

: k" s8 h: Y% p1 G# X- GNote also that some programs (like AZPR3.00) use de old 16-bit _lopen, E5 F( _8 {* ]* J& l8 \! J
function to do the same job:
9 ?+ J& w, ^" \9 E# Y- e
( R9 ?: ~& M1 R3 n$ C   push    00                        ; OF_READ* U+ |" P( m4 K  u
   mov     eax,[00656634]            ; '\\.\SICE',07 _: P  b3 p8 _
   push    eax
7 a* F4 J8 |& z+ q   call    KERNEL32!_lopen
" v2 U2 K% n) @. Q. _   inc     eax, c+ q5 a6 s  [! }1 I9 |5 _
   jnz     00650589                  ; detected
. H8 D; Q5 M/ |: ?; [) H/ V" N: T   push    00                        ; OF_READ
& A' I/ l0 I% ^  S. t   mov     eax,[00656638]            ; '\\.\SICE'$ }. O$ {* k! o6 I5 o- w& R
   push    eax- E3 v  K" \- v& ^
   call    KERNEL32!_lopen; X$ x! ^6 u3 D+ r; ?4 v
   inc     eax
4 E( j" }" h! ~8 e- I   jz      006505ae                  ; not detected
. _/ k$ |* w/ \  }5 t" D) P3 w) h$ H2 }8 ?
4 s: C% \3 f( M  _) D4 a+ r- @, S1 G2 a- u$ m
__________________________________________________________________________
* }1 z* S, H. f6 V2 B
$ {* k) j" d) P! }) b% qMethod 121 l2 z% C$ W1 G5 K, m9 r; Z% d
=========
2 x8 s) r9 X% m: C
" L" }) r/ w, x& Y) W$ H$ B$ x9 b3 y. V3 yThis trick is similar to int41h/4fh Debugger installation check (code 05
( z: U  z5 _, }) |1 y+ y. \&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* `2 N7 S1 a( ]1 G- \  F% o8 kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) q$ O( [& J8 x6 o6 ]8 X* z  X( v  h8 B6 \, Z  x
   push  0000004fh         ; function 4fh
8 K. P" M. f7 k+ w   push  002a002ah         ; high word specifies which VxD (VWIN32)$ t1 b1 l/ q$ m) F' D9 d
                           ; low word specifies which service
8 k& j5 O7 f, p) s                             (VWIN32_Int41Dispatch)* L  C- j, C' L- G
   call  Kernel32!ORD_001  ; VxdCall, M& M! r$ k3 o. o" Q/ a
   cmp   ax, 0f386h        ; magic number returned by system debuggers
% N- q, k2 h/ k+ [   jz    SoftICE_detected
8 y; [' l1 h# ~$ x  \& w- f! ]& |* @8 j) [! F$ @6 g' z
Here again, several ways to detect it:6 \7 e( C! h4 [8 b# G) h2 L4 ?2 G

& H5 m- y3 s6 P2 R    BPINT 41 if ax==4f. p3 |1 S6 w% l+ ]0 o

$ j/ x* [) J" ~3 H2 {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 U; N# M" `& A" R) j
9 N7 E/ [1 }/ ], U+ t% T) c9 U: h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! J7 S/ X' }6 F" k4 n) k5 _8 h/ X

0 |" M! @) B* o7 T7 M    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- h. t% y2 Z# E' F
, R9 p. }+ a+ V__________________________________________________________________________
& a7 p. o1 h+ e9 F) k5 D5 u0 X1 [$ }9 B( k
Method 13, O6 V; V- o  _6 w3 S3 S8 L. t
=========
3 Z* c5 D1 X% {0 [$ n1 @' {0 |( n/ c8 ~
Not a real method of detection, but a good way to know if SoftICE is$ Z! [. V/ D- i$ B# f
installed on a computer and to locate its installation directory.- l* E# `  \/ v5 \/ ^; G
It is used by few softs which access the following registry keys (usually #2) :
+ v- U! f& [8 \( h
+ m) N; H8 s' B2 z' D& p; L( e/ F0 ?-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 m8 @+ l, r0 y; M7 C2 c! H' b9 Y" v- u
\Uninstall\SoftICE  K4 n6 R% F. I3 a8 `. M* Q
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 C6 ?. Q5 M  r: [3 y( K# W
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' s3 T+ |* R' {1 ?% d
\App Paths\Loader32.Exe2 \( j5 c" {5 Z  i8 \, W: h
1 h) x1 t/ E# e# z5 j
( c+ ]5 V9 r7 g! U: z
Note that some nasty apps could then erase all files from SoftICE directory1 D$ W7 Y% Q: X7 ^
(I faced that once :-(- m8 R! w7 w6 }% f; j. Y0 L

: s; D3 ?+ C( n9 ^$ kUseful breakpoint to detect it:8 R4 G' _# \6 {) d

  v, x. u) Y' W  p     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'0 d3 _1 I6 _; b$ I- h' h

- o( o1 B9 Z% R# [1 I__________________________________________________________________________7 ^, f+ ]* G( Z; S( R

, W# E8 x9 R7 N+ U' W3 |
$ U% {+ g. H3 \3 R' M8 n9 ?Method 14
0 _6 t/ T9 K* m7 f, h=========
6 Q1 \# ^: M6 V- q9 f  V: i' o
) T) X. G" W3 `) q6 e: U1 K) tA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* k9 e1 D; ^; y: _! Jis to determines whether a debugger is running on your system (ring0 only).
0 e, f+ x" I* v5 F6 C  @# B
, J1 Q  \" ^. d3 r- S. s# O   VMMCall Test_Debug_Installed! ?! |" }8 H* h$ @! T+ D3 K
   je      not_installed* P, G) j6 a+ ?3 N7 n

4 o  b. K: m" ]4 p* N# \; }This service just checks a flag.1 O( A* ~$ ~! G4 V2 ^/ b* b2 X8 }
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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