About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. h  G& n$ P  l+ v% K
<TBODY>7 F- l" l) B( C2 ?
<TR>
2 K) }9 K4 i& d<TD><PRE>Method 01
$ [( ~6 b: t  T7 _=========
$ d$ L5 w0 Q' I, c" l: S5 r; m! c% [; h- X1 v, }5 m5 k7 t8 n
This method of detection of SoftICE (as well as the following one) is
' U+ u4 r: o2 E. ~, t* F1 `used by the majority of packers/encryptors found on Internet.; `1 J; K) M: u
It seeks the signature of BoundsChecker in SoftICE
9 K+ V1 \) x1 r# C% ~+ a
6 q' f0 r! I. S* c' \2 l    mov     ebp, 04243484Bh        ; 'BCHK'
- \) q) o  c  F    mov     ax, 04h
2 f! M7 Y: }. X3 ?    int     3      
, w6 ~8 }, ?# |4 l    cmp     al,4$ p' v( Z" q# G: A* b& W& p
    jnz     SoftICE_Detected
- g4 v, z# a& `4 y. Q1 c% L3 A. J9 i9 p5 e8 T
___________________________________________________________________________' [( L# l* C- I  a: N* d. j

/ o. X/ o1 L' _5 _Method 024 \3 b5 [. k3 T4 f2 r) I# i
=========3 f' V9 }+ R9 }& x  `0 \+ I) I
' n$ U, X! y6 G
Still a method very much used (perhaps the most frequent one).  It is used
( c; [( P  ^0 t7 d; eto get SoftICE 'Back Door commands' which gives infos on Breakpoints," l& }) a/ n6 a
or execute SoftICE commands...
, ]. W( P1 ^6 a" [It is also used to crash SoftICE and to force it to execute any commands
  s- J0 @0 l4 x6 {3 d(HBOOT...) :-((  ! A: t/ M) s- s! Z+ E

# s9 T8 D$ c7 `: a3 j. LHere is a quick description:
& z5 y# o( a5 I/ f" ~, j+ _9 j-AX = 0910h   (Display string in SIce windows)
5 V0 z/ h; g3 Z* x9 i-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 z. m5 e  W5 V, t& C+ i% x-AX = 0912h   (Get breakpoint infos)
$ B0 f7 l$ G7 }- ]! T; c4 W8 S6 Y-AX = 0913h   (Set Sice breakpoints)
: m; J# ]6 Y7 V# ]& o-AX = 0914h   (Remove SIce breakoints): O& t6 ?  E  z* h( S; N5 A

$ M7 _" D( @& z  j! ?! _Each time you'll meet this trick, you'll see:
8 V* ^, A- |, |5 P) @3 T2 u-SI = 4647h5 F" t  }" S: x2 V. V
-DI = 4A4Dh
  E+ o% Q; m* o2 U2 iWhich are the 'magic values' used by SoftIce.
$ ^$ C# R0 w' d5 y3 B2 cFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
. [# f7 H0 g! X! a" s) y6 _8 C% q# R0 u" S
Here is one example from the file "Haspinst.exe" which is the dongle HASP! W3 ?7 g' k9 z7 ~
Envelope utility use to protect DOS applications:# z0 y( j7 c$ g" b% \

' Q' o1 Y9 P/ ]6 W; ]/ T3 ?  i2 [
" L1 ?! r7 W+ h4 f  X" L# |; K4C19:0095   MOV    AX,0911  ; execute command.2 n0 @% ~; g: _; E: r
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% |5 ]& W( `! _9 _3 c) {% |( M( e
4C19:009A   MOV    SI,4647  ; 1st magic value.
0 ?. N# s9 ^* m' M: t! W$ h9 n4 a4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) x" v; J1 C# o6 D; F$ c# F
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& R. B/ k: Q! I1 }9 M% l4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  j* l* M2 T+ {# Y: m( k; W7 x
4C19:00A4   INC    CX/ A  B5 h7 v, h
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 W9 S/ N  d7 D; `9 f; N5 S/ ~
4C19:00A8   JB     0095     ; 6 different commands.
5 V" r+ h, R( N. g% b1 I0 o4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, k% V1 i5 K" ]; A! ?- V( X0 |! `3 x4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 Q* \3 T% Q7 g& i- z3 O
5 q# i% u, t- uThe program will execute 6 different SIce commands located at ds:dx, which
- H! _# V- ^+ N! |are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
/ f& f( |- Y( K0 H5 n. l, o. V4 G1 r8 {$ o8 L" {. U) m
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: c, d+ Q# |* g' D1 n* `/ l2 E2 Q___________________________________________________________________________
  x! V% }  X9 M% O. A4 m: U( N- {8 e/ D/ U+ g1 L% f

( u" _. M0 m) I: s8 eMethod 03
" E" V( h- X: Y% C+ p" U=========4 F: c6 W9 \; x8 n
! O) B8 r/ o7 c6 U9 y
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( [$ K% R( O" Z( u! M, P2 @(API Get entry point)
" s8 P8 H2 ^& Y: d        
0 Y+ J) m- o. C2 S, Q
( A, M: A$ Z- p2 p; S( t6 K    xor     di,di# o$ D" g  v3 b9 F; O7 c
    mov     es,di+ N$ A2 Y. ?, l4 O' [0 j
    mov     ax, 1684h       ' ^% G: |: a3 w
    mov     bx, 0202h       ; VxD ID of winice2 k3 |. p& y( n( C& i
    int     2Fh. O! U3 T; r+ m* e
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 Y$ U& Z# P2 ~7 \& Q7 G. N/ M! B8 `5 s    add     ax, di' [6 C& c& a; ]3 K1 O
    test    ax,ax
& d4 o% y* }& r! F9 u    jnz     SoftICE_Detected
$ ]" z. G  p9 W9 _5 z# d* n0 B% z2 Z! ?$ \2 I/ }: k1 X4 ?
___________________________________________________________________________
8 W9 J7 B5 W: D/ r7 o5 ~; f. R/ S& |7 [
Method 04
9 R/ ?( r$ ?/ i/ x, d7 j0 j% ^=========
5 G3 {- \( B. A$ v0 X  u# A! u
6 P* b9 {4 A; B  s5 L; aMethod identical to the preceding one except that it seeks the ID of SoftICE5 |/ s8 N& |, Q% Q' \
GFX VxD.
6 w# v  B' j# J: D6 r, N
; [' ~$ \& p  \# Z    xor     di,di; }9 h3 G; q* O8 x2 j
    mov     es,di
( @. `: i& R" ?' D1 I    mov     ax, 1684h      
5 G  G. k/ f, O    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 z  g$ R2 J" S6 E' V: o
    int     2fh3 |% c% q* E9 _2 Y5 }& u- {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 }* b' j, D- P0 b& {  B9 E& \1 V
    add     ax, di
4 ^( e. Z% ~- D. h  l8 i    test    ax,ax
3 N. t/ o: }- I- K. g    jnz     SoftICE_Detected
" y. v* X; K6 ^7 ^- C
$ K% ^$ I% G- V% j__________________________________________________________________________
) j0 |  R3 m, s/ U8 U4 x+ ]1 M, F# Q3 ~5 Q& v

. F8 u0 V. F) ]. P8 IMethod 05
, L7 M: P5 @/ ~- f, M( b, V=========; @8 _) J: M4 G

6 n) I) ], K) k+ q- M  e; HMethod seeking the 'magic number' 0F386h returned (in ax) by all system# P8 R3 P- f$ c/ G, @# u% W8 d3 [
debugger. It calls the int 41h, function 4Fh.
: }6 l, z9 }# C5 WThere are several alternatives.  $ W1 x5 @" g7 v" S

# Y* P9 U: |% w* A3 MThe following one is the simplest:% \$ z& y; x( d+ J$ J- y+ [

# ~9 g$ M* I( K  Y3 b' r    mov     ax,4fh; Z' P# \/ m: A
    int     41h
0 s- j3 N' s4 |8 E    cmp     ax, 0F386( ^; O6 \3 H& t
    jz      SoftICE_detected
! _; ~) }' Z% \0 Q: C; b" _% D9 Z+ ]: |

! k2 u( V9 F0 f5 w2 I6 @Next method as well as the following one are 2 examples from Stone's ) A. y/ r+ I6 w9 e4 p  P: Y. ]1 v4 _
"stn-wid.zip" (www.cracking.net):& N7 x8 f& l. Z- q4 L2 W( H/ |8 s) y

/ W" O) e+ }; b7 V& t  Y    mov     bx, cs
& H/ a! Y. {/ K4 Z* K2 V    lea     dx, int41handler2
. q) c3 a, Q4 v$ ]! M    xchg    dx, es:[41h*4]
! b, k' t# v3 T* s    xchg    bx, es:[41h*4+2]6 ~! y) X+ b, b; r  K
    mov     ax,4fh
+ m2 ?3 h  C* `7 |# U4 n    int     41h
$ |) A! \1 _: ?; M$ F, E    xchg    dx, es:[41h*4]
1 J0 d2 s+ I- L, ^3 X8 J    xchg    bx, es:[41h*4+2]
, s- S8 F2 c9 l+ `& C+ a    cmp     ax, 0f386h
7 ^9 Q: X7 v( d8 d9 m$ u  X2 P    jz      SoftICE_detected7 j1 h6 V( {* z- u, l3 l) D

& y. w1 z" @: Kint41handler2 PROC
. Y% g5 v4 h+ m  r. t    iret$ q! A4 J+ ^9 @1 e7 ]/ F
int41handler2 ENDP" p4 S: I  W% g' U# `! K$ t1 H
$ p9 x- u' ~" y7 i7 Z6 Z6 C$ \4 ^4 }4 s
$ u& V1 L- U6 u* O& @+ q
_________________________________________________________________________
) `+ U  }- p9 ^# w
) ^  g) N( e; e* i6 s* }9 i4 `8 i  v+ |( X( L$ G
Method 06" m$ z5 V( _- c# A. ?
=========
3 I9 e- [+ H' B" f2 h
9 Y* h: `% W% A' B2 P9 S% ~4 {
: f( x( [) x; O% F" [2nd method similar to the preceding one but more difficult to detect:6 f$ P7 ~6 n* t$ T

' p5 F& R  u' i! k; \5 G/ s* e7 h: u3 V. n) l
int41handler PROC- j: \. u/ F/ L  v- M$ S8 Q
    mov     cl,al
' u; k- k& G' ^    iret& `2 \) s( Z5 A
int41handler ENDP
5 t/ C7 F1 A; p/ \( y$ b" j/ l6 ]' l8 B7 d& K4 Z9 Y

/ R6 R% Q( }# p# M8 O: R    xor     ax,ax
' W$ B0 ~; h* U$ B    mov     es,ax* J( N3 {4 S6 P7 \
    mov     bx, cs  F4 |* t: |, y3 }1 \/ |4 ~
    lea     dx, int41handler
1 o7 P4 o. b3 j" Q) v, T    xchg    dx, es:[41h*4]  k3 @/ i( h1 v; e3 D  C
    xchg    bx, es:[41h*4+2]4 n8 E* l$ B( Z* ^
    in      al, 40h
- |4 a: b2 N0 x+ q/ U6 G    xor     cx,cx
: c' `8 W/ X' S4 a* [    int     41h
) t5 r5 f, H) f! d, \1 l' F; c2 l    xchg    dx, es:[41h*4]
2 O. f) U  E, h1 U! ?( A: j8 e: w' k    xchg    bx, es:[41h*4+2]
4 U; W) w* C9 j# h+ m+ N+ i    cmp     cl,al2 H* s/ h& c" J0 p) T: Y  y/ X( D
    jnz     SoftICE_detected/ J- t0 `6 z! z
( o( R! M/ Z  J( l& ?
_________________________________________________________________________
9 Z: J$ S3 I" S8 r
! ^3 h$ C4 F2 {3 [' MMethod 07
! ^9 a+ S! d5 [4 M: L; K=========
% C. d5 ]4 P! N: N9 z8 \4 G- A8 g3 d% D3 \; ~- x5 E; P
Method of detection of the WinICE handler in the int68h (V86)4 P  `! c3 R8 \$ C

# L, o5 t; d& X% t7 m    mov     ah,43h  {# v& b5 P! ]! S7 ^: V; h
    int     68h% I. ]& Z" s, f' f1 F
    cmp     ax,0F386h
" H- Q5 [5 I+ u) E; F4 A5 g. G! `    jz      SoftICE_Detected# S. H5 y& n1 Q1 L3 m8 l

  {! R8 z1 O. l: m/ L8 f
8 F$ u( B: }1 v, e=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. B$ `+ ?+ l' c; a, W* u   app like this:
- C  Y7 x( x- d% l9 V/ n# N- o% h6 U/ c/ k- p8 ~
   BPX exec_int if ax==68" y9 w$ s5 t+ r
   (function called is located at byte ptr [ebp+1Dh] and client eip is! m. n9 ]' i  d# J' r* [
   located at [ebp+48h] for 32Bit apps)4 `6 @' z& W( E( Q/ ~
__________________________________________________________________________
$ T3 j0 I2 `; ~* q6 Q9 t) U- F: z4 g+ o. J) o0 L
6 {$ h  N: w! X' s* e5 e
Method 08) y" L+ \( Y. i3 O3 y# i
=========
8 D: l: o6 r' @2 ^9 _. D8 e6 i
/ n" ^9 K4 n* Y" [. I4 g6 @9 VIt is not a method of detection of SoftICE but a possibility to crash the
% s$ q: v7 q9 w4 z1 Gsystem by intercepting int 01h and int 03h and redirecting them to another
4 @: x* P" P' M, xroutine.; v9 h+ F" b7 w% W: ]% \- r  E
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ l! E- Y6 t+ @+ y9 ^+ ~# h4 E
to the new routine to execute (hangs computer...): h# ^" b& p( C

7 \2 Y' z8 n8 d2 A/ E    mov     ah, 25h4 D( F' X5 |9 `2 {* b% t' v* G
    mov     al, Int_Number (01h or 03h)
/ t1 k* H6 n5 B0 d* `/ I    mov     dx, offset New_Int_Routine
. v% y1 H2 Y7 k. Z: |3 o6 l    int     21h  ?4 v: I& @+ A5 ]

# L& _; w* M- x: a) {__________________________________________________________________________
9 r) }5 S8 F2 B1 _
7 S; f8 x$ X. p- i% nMethod 09* y6 q& p* f& I! ^/ J
=========
( K8 K# Z: w4 G* K, I/ R7 B+ x% N4 N+ J
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; S( F, |2 F, R% V
performed in ring0 (VxD or a ring3 app using the VxdCall).
8 d: b3 K0 X& Q# x& a& j9 ?2 v# QThe Get_DDB service is used to determine whether or not a VxD is installed
8 B; @( J/ p/ |( Mfor the specified device and returns a Device Description Block (in ecx) for2 j& Q( e, Y0 e; k; u1 k
that device if it is installed.4 e1 i* V7 H1 m( v8 k2 }. I
, u7 }; y- @4 P/ a& z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 R1 l  M+ G- P4 ^+ o+ P  ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( F4 K. q0 H) {5 {6 n   VMMCall Get_DDB
3 D$ M" G+ Z+ t; T, E0 e   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 V# x$ |2 j! G  S9 @6 @

9 T$ T( ^8 H3 f" `6 ZNote as well that you can easily detect this method with SoftICE:- V) N' y% q& a- t3 H# w( q
   bpx Get_DDB if ax==0202 || ax==7a5fh) p+ f( R, K% D; I8 D( ?4 z1 F
% G  B0 o; H3 {4 ]2 g6 u8 k: X
__________________________________________________________________________
5 x* q3 V9 w' r) O; n5 A9 t
. y6 |+ R& {/ e* Z( T, n  OMethod 10
7 j5 U! A; C, V% G, J=========
- ]( i+ e3 S& Q0 E' ?# D% v2 H' R$ \/ |6 u
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# }, P% Y+ \; G, q7 ~
  SoftICE while the option is enable!!! V& @+ L1 U& F& A( N

; m6 {5 D& I8 G! N: o- U) jThis trick is very efficient:8 s- j- f  F. W( N. |  }$ m' R
by checking the Debug Registers, you can detect if SoftICE is loaded* U, v! I3 h+ N+ L$ _8 E5 W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ g2 R% \! M2 Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their
4 n6 k7 \' Q( c4 x6 wvalue (in ring0 only). Values can be manipulated and or changed as well2 b0 n2 q6 K0 J3 M1 a% r1 I9 a  w; j
(clearing BPMs for instance)
' J' e' l  \" N/ x
5 b5 E& K; {" Q* o: L2 b__________________________________________________________________________
/ U/ [9 e) }. F, w1 ~( V6 S  ?
  u$ T+ u! j% W, C. L% H$ u  }Method 11
) Q/ c  p. F2 b8 w=========
; q/ L4 O; F8 {8 b( h, [
% E. T/ J0 w" b3 o* q) J! XThis method is most known as 'MeltICE' because it has been freely distributed
% S* M9 `: Q7 z2 H3 i9 g& a/ ovia www.winfiles.com. However it was first used by NuMega people to allow, S' w$ d! K0 E
Symbol Loader to check if SoftICE was active or not (the code is located& Y& z/ B% j( T# a3 R* J; `1 D2 b
inside nmtrans.dll).# \8 v0 _2 ]  E9 y3 f+ k+ ?
) O* G7 w7 g3 \$ ^
The way it works is very simple:# M1 f. z0 _+ Z# h9 s8 E+ \
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for, R, }8 G9 H8 V8 p
WinNT) with the CreateFileA API.0 H+ h# R5 ]! n, z0 L
& B4 u6 x+ s$ X! b; C7 g% }
Here is a sample (checking for 'SICE'):7 u$ S6 ?' s) T8 p5 x
) |) D* ?) }4 c4 l/ u" k: ]
BOOL IsSoftIce95Loaded()
3 b& s) H# D; U! J5 v7 m9 g8 m. x{
) `- o% \  `1 ~; L0 ^- o$ u   HANDLE hFile;  
5 |8 `+ R4 Y: I   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,! L9 X6 v) E! \9 _: g. V' {5 ~
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
; }9 B0 }$ ^- m8 {, M$ j! F                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. F: j8 }3 z5 U0 H: _
   if( hFile != INVALID_HANDLE_VALUE )
- q. q/ V( u$ X" u   {6 w: a2 R. U! L4 Y' W$ n; M
      CloseHandle(hFile);! K/ ~# D5 m# }8 {
      return TRUE;" U* j5 T9 z. G' u. A7 _9 T
   }
* t2 M& f. x( r4 ?- N+ |! B   return FALSE;' T! x- ^/ Y8 R/ u- y' ?$ I
}/ i+ ]) |1 ~- _. b6 i, {
) o6 a, T" m0 Y- n6 @0 X; Z
Although this trick calls the CreateFileA function, don't even expect to be$ X5 u# m/ H* s3 G4 \! d5 E
able to intercept it by installing a IFS hook: it will not work, no way!
9 i5 O7 w* `( GIn fact, after the call to CreateFileA it will get through VWIN32 0x001F$ u2 d1 Q! q) e. p! n1 P7 z: o
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 b  `% R' ~: D2 }( a; r
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
' A' V* y. t! j$ `* G: `field.
% N( s% N! N3 pIn fact, its purpose is not to load/unload VxDs but only to send a # b; \: T( Q( s$ {/ r0 `, A
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)- ?% L9 O. Q" q4 L
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" I' W# n% Q( I2 R2 x* [to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ c" v5 _6 V9 B* A7 A. DIf the VxD is loaded, it will always clear eax and the Carry flag to allow
' Q' j$ t1 |( M) V" t7 d& Aits handle to be opened and then, will be detected.9 a; Y' c- C* Y9 W
You can check that simply by hooking Winice.exe control proc entry point% Y8 R" h  z2 }2 M1 t
while running MeltICE.
' N  A' l; C3 S% e2 M9 _% w% |( S

6 @6 J. Z0 }: G# ?  00401067:  push      00402025    ; \\.\SICE
4 q+ s$ u4 m* Y/ Y8 L: f  0040106C:  call      CreateFileA! @) v$ R# L, V% v1 S6 L  t
  00401071:  cmp       eax,-0019 s! G, o3 \, W2 x8 s
  00401074:  je        004010915 X: ^) b0 n) K- n$ {6 v) n# K8 r
! q4 r4 k/ n- F0 r
1 S/ `+ O# K! D* R+ N6 R
There could be hundreds of BPX you could use to detect this trick.2 G/ B8 ~/ q  p; [8 E
-The most classical one is:
/ P# Y( c/ d" y0 r  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: k5 L6 z* Z0 R. |6 R
    *(esp-&gt;4+4)=='NTIC'
4 d2 I# g1 c& `
$ l) F: N& ~9 p, L9 A5 T-The most exotic ones (could be very slooooow :-(# T) i" X# ^* p2 j' q& U5 B
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 j3 }: P% x. h# k5 J% |     ;will break 3 times :-(
9 S; n: u5 G$ b, {# ^
  _  J  k- s4 A. P4 M8 X7 G-or (a bit) faster:
, U$ t- j3 j- j* S! t" G   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). w: z, ?+ R1 j# A2 |

+ x* ^- u6 A6 ?" V/ ~/ i: m   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 w+ V8 O; v, w% @4 x3 X9 I     ;will break 3 times :-(1 I% V, z' x4 N
& K+ z, S- [, f% C9 S
-Much faster:$ W/ D# A0 A1 i( _' Z( Y4 x: ]
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& a6 {9 P) ]- b, ?7 K2 D

- @; \5 n2 m$ q" q- @# \' F5 t6 eNote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 X3 b' W/ T. ~* t; S
function to do the same job:
) }: m1 Y3 a" W5 b7 D! T$ @2 |0 m
+ [* o0 |( B* B0 ]% L- |$ Y   push    00                        ; OF_READ2 f1 I. @* X& U: M3 E1 c
   mov     eax,[00656634]            ; '\\.\SICE',0
% P, P( `4 P: K2 J7 R' a   push    eax
5 W" U  z( X" G) Q   call    KERNEL32!_lopen
- v0 t1 U/ p0 J   inc     eax; U* ?5 w- c% K& ]
   jnz     00650589                  ; detected1 b' j# b/ F. T" F: z- t
   push    00                        ; OF_READ# z' v8 a9 Y* h* I% Y6 i
   mov     eax,[00656638]            ; '\\.\SICE'
# U! q9 N/ H8 O   push    eax2 P( y1 W5 u. n7 B" a; y% I
   call    KERNEL32!_lopen7 a/ i6 @* u  k$ Z8 m1 O
   inc     eax# f  J! x4 e3 v# C& A: W2 f
   jz      006505ae                  ; not detected
: j8 D: `- y3 k2 u
7 z! ^: c' l% k. H
% p( U6 m; C7 A" ?__________________________________________________________________________- o' D. b% v6 ^+ V8 [; H6 ~

. N: Z- Y! G" s! K) V+ DMethod 12, G; U# D8 v/ f& A( S
=========
! b) b% U3 [6 z: \6 `
$ T5 \: e$ E% G* bThis trick is similar to int41h/4fh Debugger installation check (code 05+ r& m( i& y  @. h* S4 f
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
7 L$ B/ R) J3 u6 g; _* |as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) i: i) {/ t0 Z# l' {5 @; x6 Q5 D' B- K6 u( ~6 L% R# R! }# w; h
   push  0000004fh         ; function 4fh! S% x7 H  E0 w# H/ L9 I3 C
   push  002a002ah         ; high word specifies which VxD (VWIN32)4 R$ Z8 G$ t% T
                           ; low word specifies which service
3 k7 `3 [4 k2 P& d7 a                             (VWIN32_Int41Dispatch)
& U+ b+ g' ]5 K, m   call  Kernel32!ORD_001  ; VxdCall$ Q2 {3 F" {1 g' p8 d2 M( z
   cmp   ax, 0f386h        ; magic number returned by system debuggers* Y* r! ~2 }; G  X! a" X" F3 ?: P
   jz    SoftICE_detected4 Q% y7 c) {0 Z) p8 s
2 w5 ?2 U/ p3 V: R2 w2 a
Here again, several ways to detect it:* K0 C' @' a5 V/ R; C! T

( A5 n" P0 t8 Y# u$ Y: q    BPINT 41 if ax==4f; i% w$ q: `8 o  T  C2 N

# \8 V5 ^2 [3 P4 t3 [8 B" n    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 X1 D/ w5 W+ e' {4 O' F  i: l* x6 k3 d/ B- J0 r. C
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 N; ^' z) H, P1 s7 Q" @% I$ j! R% B
/ J! e; [/ x, `2 m0 {    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!* t  g' C5 Z) M0 J1 Y4 q( w7 E
; U4 |; c0 n! s" l
__________________________________________________________________________
3 s6 Y% J+ U) n" S
! x' J2 F0 u0 F- NMethod 137 v; g' a) ^. k% F$ ^6 [6 a
=========6 I  G  D8 _. t7 i2 ]
  c, A1 w0 n. d- l. c
Not a real method of detection, but a good way to know if SoftICE is
3 u- g) D7 Y+ G5 d" Hinstalled on a computer and to locate its installation directory.
7 C8 i+ z# q& M6 J& UIt is used by few softs which access the following registry keys (usually #2) :
, W. c) x9 N  |4 J3 G" U+ g1 \6 S: W, S" f
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 H0 p; p# O3 l4 ~: N\Uninstall\SoftICE
5 u. [9 J/ U- h% N3 `5 W- B2 Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
; d# \5 S, h1 i" }2 X" }-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% C* w8 R) m! ?9 H5 O' S$ K) h
\App Paths\Loader32.Exe8 A9 _; S" l* A/ }0 h: r% |7 C/ ]

8 c7 u6 q3 b& _3 a/ a" ^9 b
$ a+ R# c8 X# J: S2 QNote that some nasty apps could then erase all files from SoftICE directory# @& P3 i7 Z7 ]( W* {( f3 B( H
(I faced that once :-(
1 h( ?; N4 A5 V- ~0 J) W. ?2 {, [' \) E
Useful breakpoint to detect it:
  M. L6 {7 j" Z/ t0 x9 j+ R+ m$ n4 k2 b: J- b: `5 J# g
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 i! D  [- }5 f( ?

$ j$ S6 |" O2 ~2 q__________________________________________________________________________. A  L( A' |" p& r  S7 z

+ D  n; w8 J6 Q* |- a3 M
# ~9 ?. ?- ~) O+ I$ t7 z" h$ M; EMethod 14 0 q* T8 P7 h/ d; {+ @
=========' W: o& F5 o4 ^3 z

( A/ Q# e9 \. UA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ k. q! \4 ]; c8 `is to determines whether a debugger is running on your system (ring0 only).! E3 q! R3 B2 V9 ^) z+ u% x  Q
! c% D0 _' s, `4 n( }
   VMMCall Test_Debug_Installed. H* U. |$ N$ }; ]' X: l
   je      not_installed( _& C: s; L) ]* M
! q; V. W% A( J1 `4 n
This service just checks a flag.
  [$ d& O( w, @8 |# A$ j$ q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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