About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& N) n8 Z1 a; r
<TBODY>4 v( f' T0 Q  Q& R; x: w
<TR>/ @( e" n6 {4 f8 q2 R/ O
<TD><PRE>Method 01
3 T: z8 A. }! b7 B" ^, i' Z=========* ?7 R9 K8 ^: }9 z8 K0 @# q

1 r7 r3 a2 h" P0 GThis method of detection of SoftICE (as well as the following one) is
) H' u& i2 C5 ?6 }used by the majority of packers/encryptors found on Internet.4 w$ w0 d& z2 T
It seeks the signature of BoundsChecker in SoftICE1 P( I) I9 j  g  E: U& b
4 I7 W+ i5 p* Z& I, u
    mov     ebp, 04243484Bh        ; 'BCHK'
0 S0 \2 N6 i) O/ r    mov     ax, 04h
; G2 N, k5 j# h* I4 G0 P8 p# G    int     3      
* v% D0 J" a- I    cmp     al,4
! E' s3 ^! L: E9 @* T9 h8 ]$ a1 g4 L3 D) x    jnz     SoftICE_Detected
1 i% S5 v( y- y# A6 d) e. c2 L& Q" R: R) h( g; J, g5 Z
___________________________________________________________________________- }6 |- G+ r+ M$ M/ M

5 t% y8 w% M* {+ [; s) yMethod 02
7 E+ @& O. U$ x& w$ }) _4 ?( j=========! H; @) k( M& p- m: o9 I% g

  H0 |& u' A7 [2 aStill a method very much used (perhaps the most frequent one).  It is used0 |# `+ ?/ h/ z" U  {8 ]
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 g# j7 T/ W. vor execute SoftICE commands..." L1 m0 _9 h1 _% s6 o  N. U
It is also used to crash SoftICE and to force it to execute any commands
) Z5 w6 J5 K! p4 H5 P3 N(HBOOT...) :-((  ' y- R+ A; N, f+ R5 A

- G% J! K: @1 @, DHere is a quick description:( E! y, i: w, _2 w1 s+ r3 |" @
-AX = 0910h   (Display string in SIce windows)
3 S1 I( F0 t! i. P' u9 Z) R/ N/ [-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 k! S% K) Q! H8 s2 q0 s- Y
-AX = 0912h   (Get breakpoint infos)
  R( }! S) P. R-AX = 0913h   (Set Sice breakpoints): S& K+ [; h& A  E" K4 F2 j
-AX = 0914h   (Remove SIce breakoints)
! g. @6 ]% d  E$ I- ^! J7 M8 X) P  o4 V: p, z1 Q! e) K5 ]7 g" ]
Each time you'll meet this trick, you'll see:( N5 q  ]; f$ s' i
-SI = 4647h
; N$ p' f$ u' q3 L9 U; s-DI = 4A4Dh4 ]2 Y2 m/ U) r( K" P) v7 N4 r, y
Which are the 'magic values' used by SoftIce.
) v1 J! o+ ?  I. fFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.8 I! U' x. [" C' _  E, c

' L& z& q0 I: h' rHere is one example from the file "Haspinst.exe" which is the dongle HASP
6 O5 O  i# J) ]& W0 Y$ xEnvelope utility use to protect DOS applications:7 B- y6 b( R. W8 e
- v# F3 K* e3 u9 b

# E" ]& k4 Y$ c) Y4C19:0095   MOV    AX,0911  ; execute command.
' |! v* ^0 x7 j- a0 k) ^4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ m1 `3 Y; D8 S6 x/ \8 M
4C19:009A   MOV    SI,4647  ; 1st magic value.6 D. p, L& i& [
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- `6 S, `$ D& s" B/ w/ A; G
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% v- {$ E3 @, u) X) t& t4 I& e# U% q4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute& F$ @8 Z  {+ D6 Q) J
4C19:00A4   INC    CX
' {- o; w2 R4 c5 b2 J& e6 g4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 ~( Y. b, h5 n5 n, l) }) ]8 I5 w4C19:00A8   JB     0095     ; 6 different commands.
+ e# {' Z5 i3 |! n4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, i8 d& t2 a% V3 `$ n4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 `; W5 U/ k5 G7 a& }; n
+ `$ ^* i( m$ x0 B! D8 |
The program will execute 6 different SIce commands located at ds:dx, which% l, T1 {% B$ Q0 \/ [9 b7 q6 ?6 I
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.1 B  U, M+ |% q
  w0 u$ `# X8 f1 y* q6 s, b: u" W# E/ j
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ N) V: {" m6 E3 H___________________________________________________________________________
: G8 h# _6 M/ T0 P, s- Q9 a% J1 x0 Q" F% }: N' `
( A- L% x$ c- t8 u
Method 03, M- g2 p5 \& r9 P$ v2 M' p3 ]
=========
# o) W, I! G1 N; @) [0 [6 t
' y# D2 K4 y2 O3 [; n" OLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 r$ x% W' N; L# e1 C  t0 u2 z
(API Get entry point)
& W3 `2 w' {+ b% M0 @5 N        , P0 s1 z4 E% z- Z- ^$ R+ n5 x. }( K

" D7 M& o* f' z. m+ C+ Q( `! e    xor     di,di/ q# |; N1 f" M) \  z
    mov     es,di
; ~( X- f6 \) |* l4 d    mov     ax, 1684h       , O/ q6 z8 `6 B/ V3 Q
    mov     bx, 0202h       ; VxD ID of winice
% g9 C/ X- u' B6 |. k9 I; \2 q    int     2Fh* t4 ^+ ^- E% v* W7 L5 C" o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  {1 E4 j6 y0 @
    add     ax, di. _+ p: v) }6 C3 p  Q
    test    ax,ax
% A. h" C  _( a5 K2 K" }8 U" d: \    jnz     SoftICE_Detected8 e7 g' A+ I& m7 V! J: ^

, v  q( [  V9 M* i$ I) v___________________________________________________________________________) Y2 L  `/ f4 y, J$ v  `

: Q' M- \+ T1 e! yMethod 044 Q& `/ k! D8 z7 t
=========: B0 X" q6 t; h% r( `) \5 h' c

/ [* k3 ^) S$ ^: v( k5 V# p, V# jMethod identical to the preceding one except that it seeks the ID of SoftICE
1 }; A7 e# S/ \/ `/ TGFX VxD.) U( w3 j8 Z6 J% b
3 o+ |& J" U" O! x: c
    xor     di,di
1 C7 l  t5 N  t9 K! k6 I    mov     es,di/ M( _4 V) Q2 G1 J, L9 Y. H
    mov     ax, 1684h       " @8 w2 j* M5 @
    mov     bx, 7a5Fh       ; VxD ID of SIWVID! F: J/ w0 n5 v, @0 c  T8 o
    int     2fh
7 H1 K& f1 c& G$ L$ d6 I. v8 {    mov     ax, es          ; ES:DI -&gt; VxD API entry point# @) X: `0 N6 \4 H5 K, i' O* M+ R
    add     ax, di
7 ?- T! {+ C- t+ _2 @0 ~7 V    test    ax,ax* n7 d5 J% c6 q9 v) h, y! P5 w" T
    jnz     SoftICE_Detected9 D3 w8 s$ N( I7 @* {! p' C

9 u3 p  i  q6 Z( B__________________________________________________________________________! X+ N1 {# t# g3 g
% c7 F  X3 r8 ~
  m/ S5 ~. Z% D; F9 G
Method 05/ o6 |& p% A& `/ t
=========& j; \' r4 d# J! R! b( h% \2 S; n

3 @! @9 O, k( vMethod seeking the 'magic number' 0F386h returned (in ax) by all system$ Z( i& s6 g+ F7 f
debugger. It calls the int 41h, function 4Fh.
6 e5 m) N. e$ s8 M0 S: rThere are several alternatives.  
% ]& I! E# f$ M
: `' b( k5 ?( S* ~: zThe following one is the simplest:7 r+ U& g- a/ i' R+ T' r
) \, C8 x& t6 m. b* x
    mov     ax,4fh
4 |2 y$ C: {1 U) j    int     41h
6 j5 k/ i- P0 |: w    cmp     ax, 0F386) Q* a* n" G2 i' c/ s
    jz      SoftICE_detected
( @5 p+ I0 g7 n, z1 b+ C
2 W/ g3 j( r8 t  E5 ~: ?
% }2 F- m- s0 U) @8 I3 P3 L+ @Next method as well as the following one are 2 examples from Stone's
1 ^4 I& `5 X) [1 P% `6 U. P2 c5 q* m"stn-wid.zip" (www.cracking.net):
5 e3 m; @3 J$ e& M" s
1 K6 P- i( R* g' A0 z/ Q    mov     bx, cs) u/ e: y# ~' g1 u( x# E9 t' J
    lea     dx, int41handler2
, Z: w* b# ?! {. Y. O    xchg    dx, es:[41h*4]
4 }7 Q) j. Z" s1 q* T" d8 L    xchg    bx, es:[41h*4+2]
$ h8 ^6 u1 k: f* N    mov     ax,4fh, {. H* q  b) }) M  \' J9 O! i
    int     41h
$ m7 T( A% P1 X. t0 p    xchg    dx, es:[41h*4]
: v0 i+ U% z3 k. f2 W' t    xchg    bx, es:[41h*4+2]9 H- \- Y! U! r8 J3 f# ]
    cmp     ax, 0f386h
: F# I# O& L0 ^0 s) I+ b3 C    jz      SoftICE_detected  v9 r0 A/ ?9 T2 _

$ P5 V8 H: ~% o! lint41handler2 PROC2 x/ }) ?# B' S+ @* L/ F
    iret
% W0 |- n: W: l( s  J* P# H* u$ nint41handler2 ENDP6 W# k  l& B6 ]7 c% z% e) T

' @) s; P* C1 u9 W' I
0 Q+ O: p& V# h% j% m/ u$ N( y_________________________________________________________________________
7 f" ]& t/ N6 f& J- \2 V; ~1 k7 F. ^' e& b/ x! Z2 u1 @% g3 |

4 z( Z7 M  [7 M; a) @( `Method 06) L8 m! L1 C8 h% ~! }4 D6 |- f2 p
=========/ |, H: l7 ]2 \) o! n

: l8 T% L6 f" F9 E% L# U* G
0 c7 R! F# y( B3 l( \4 z' ~2nd method similar to the preceding one but more difficult to detect:# `# i2 n6 _/ \6 X  Q
& H8 h, v, w& Q

% a7 ~, w5 d& d; @int41handler PROC$ G  ?# ?; _0 }6 h+ _  p2 j
    mov     cl,al
. Q' B8 }+ W& |) ~; w. H) N" U    iret' s! y+ `4 ?5 N& z! f% ~2 o' e- l
int41handler ENDP- _+ _6 @/ }7 w1 Y0 n  g

) w1 [8 E$ Z, X
2 z9 t% ^7 C9 H2 Z- [  W2 e    xor     ax,ax
: S1 E2 }+ ~* T- \; K9 {    mov     es,ax8 m$ F; [( y$ S9 s+ w8 }* ]
    mov     bx, cs
9 b- y2 d. ]! N% ^    lea     dx, int41handler
  }8 u) w9 v- S% Z5 b& z% |    xchg    dx, es:[41h*4]
4 N4 _! R1 }8 o" A; o8 U    xchg    bx, es:[41h*4+2]6 c0 m: Y- M& S6 B
    in      al, 40h
6 W2 p% v" l4 M' ~0 L# W5 x4 }# X    xor     cx,cx# K2 C7 b" C4 Q* D$ H9 U( r. n
    int     41h
) M. U% J! v' b$ E, h    xchg    dx, es:[41h*4]9 U  [3 |6 N6 Z: \- r
    xchg    bx, es:[41h*4+2]
6 r5 K' Y+ u0 @+ S    cmp     cl,al' n3 d3 o0 o! T* o9 \& V, C
    jnz     SoftICE_detected
& B6 M; u2 W( C
! b6 R# {& i" l  S* p_________________________________________________________________________& L3 h% Q( P" O  q; u+ }% e; z8 i

# X0 m* N# p$ c. }; f+ B* WMethod 07/ t! q8 L' k$ Y+ @7 q
=========; @& b% B' _% n3 z
5 Z, R7 s  J% s3 A- K
Method of detection of the WinICE handler in the int68h (V86). S7 C8 p* d1 i/ X6 A* r
9 |3 U5 |4 P+ x
    mov     ah,43h
! w4 G; t4 |4 o6 e- Z7 y. k9 c: [    int     68h
* y  Z. {% S4 \0 q. K    cmp     ax,0F386h! h/ m, J1 }8 ?; [$ @9 k2 w
    jz      SoftICE_Detected# k+ Y% X& X1 Q: T

9 q: F0 F* _4 O% }8 s, i2 d) n" A& |# `1 l
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 N! z5 u: K% [& C2 r   app like this:2 b2 S2 C5 }+ W, |6 t2 c' {
7 b: O, K- G7 C
   BPX exec_int if ax==68
1 z6 L( h2 o* W   (function called is located at byte ptr [ebp+1Dh] and client eip is2 Y5 U  d& y) K" }
   located at [ebp+48h] for 32Bit apps)$ ]2 G; `7 D, Q) L
__________________________________________________________________________) m' G: y5 m) O0 y. B
: P$ L/ J! A* U1 L" H$ p

* q; a: `; I. kMethod 08
  r8 K3 B' \, _! }5 \- v1 {=========
# b4 ~5 n" u1 W1 m# \8 ^6 |& s6 \& x
It is not a method of detection of SoftICE but a possibility to crash the3 a# I. S* q/ l+ v- R2 V( ?* K+ I
system by intercepting int 01h and int 03h and redirecting them to another$ \0 V3 G6 `0 J6 o3 Y
routine.( k+ x' @# }' M- ^$ Z$ h1 [
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ {- e1 U6 U0 x' i" Hto the new routine to execute (hangs computer...)
8 @6 B1 @- v1 T! D% H; _$ ~+ ?2 I6 n
3 E8 W3 G# S* \    mov     ah, 25h
; M0 h( y/ f( s7 Y+ g    mov     al, Int_Number (01h or 03h), \, [6 y1 Q! |5 v# K5 X6 U/ k: k- @. f
    mov     dx, offset New_Int_Routine
% v- @: S/ W0 [# I    int     21h
; Z& a6 P8 Y1 w* z7 r: S' T) y$ j( C. I( m
__________________________________________________________________________
& H" J" g6 N- }* D
: o" \( K* R) B- Q' f" cMethod 09
9 h0 y7 ]- B4 A  o1 h=========
. Z* M! i: N+ D# P# P. w/ B. y3 Y) j; ~& m$ h4 V
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' I- |" ?3 H& C' tperformed in ring0 (VxD or a ring3 app using the VxdCall).
1 H" k6 \7 u9 Q# x$ g. ~  sThe Get_DDB service is used to determine whether or not a VxD is installed& ?3 W( L9 n5 ^6 ]$ o
for the specified device and returns a Device Description Block (in ecx) for
0 g$ M. `5 D7 athat device if it is installed.5 {; G* T; T$ p1 @' }2 T
. E; H: S% Y  M% Z3 I+ q6 z# |
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 ~1 s" V; U2 U
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): }# Q( `; ~! ^1 S4 m  c
   VMMCall Get_DDB5 ?! F9 L) h" ^
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( Z* G  i  U+ M6 _

3 u' \' W9 s8 f4 K2 t2 lNote as well that you can easily detect this method with SoftICE:0 V$ C0 Y; ]9 ]4 r. N
   bpx Get_DDB if ax==0202 || ax==7a5fh8 D6 v" y+ v6 q; G1 k0 `: `

1 r+ w9 T/ q% E  Q__________________________________________________________________________' K1 O2 Z) b2 u" q& y9 m
( w1 @/ Q2 O5 D: k/ h- }
Method 10' j$ a- ]& L9 U0 G
=========( \6 X& o" ]7 N5 i7 t8 Z: i

! w9 p2 D, I, K1 a! T. k! q=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* d( M) O" j0 {8 }2 }  E* H/ d% N  SoftICE while the option is enable!!
8 v) r, C9 O4 o, g* {$ S$ @. V4 v! z1 [* l
This trick is very efficient:
/ K1 A" k: O2 T# T. qby checking the Debug Registers, you can detect if SoftICE is loaded7 y* ~; {5 C1 ^3 Z9 Q0 U# H
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ w( l/ b& j3 r  e3 S( lthere are some memory breakpoints set (dr0 to dr3) simply by reading their6 `6 C5 M6 B1 R% j" V5 |
value (in ring0 only). Values can be manipulated and or changed as well4 k/ h6 \  O  p5 g3 f$ Q
(clearing BPMs for instance)
5 w% J; s6 @' L2 C0 l9 W  z7 U: c* _& a1 a2 B8 e
__________________________________________________________________________  {" q+ {' P* q; b5 h6 _9 o

! i& G5 I0 \2 A6 w7 ]1 s% _Method 11* ~" L0 u# k' M7 }
=========
8 ]7 [) C0 O& v+ s; i' u6 y! _; @: X$ y
This method is most known as 'MeltICE' because it has been freely distributed
$ @  y/ j  y) x% ivia www.winfiles.com. However it was first used by NuMega people to allow8 s: i( a6 H2 k$ U+ _
Symbol Loader to check if SoftICE was active or not (the code is located
/ J1 t$ }) y/ I" K( u/ dinside nmtrans.dll).
3 X$ X3 }9 B( Q& g, U. m, O% u3 x! O9 I, U+ ]' D* y1 U
The way it works is very simple:+ b6 E' P* `- k
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
$ X3 F7 Q" k. y6 `7 G( o2 FWinNT) with the CreateFileA API.
: Z) V4 i" `, |" Z0 P; S
. P; _5 W; `0 \$ UHere is a sample (checking for 'SICE'):: Y" L" e: t6 C

% j( j; k# r5 R. dBOOL IsSoftIce95Loaded()! b# Z! b. w8 Q8 `# M8 T
{
4 g- M) E4 x% t- e2 V, Q$ T/ A   HANDLE hFile;  - ?/ R% R6 a2 e* m, s' t& M, p
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# s1 o( f( q3 C8 R' @                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ @+ w5 a$ \  t                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* x+ X! \' r$ b; s9 O   if( hFile != INVALID_HANDLE_VALUE )
8 p: P8 v% |1 o7 u1 c   {
7 U2 e5 L  z) {& Q7 c1 x      CloseHandle(hFile);
8 @" V" ~2 h) d# z      return TRUE;
6 t1 G- G0 @3 t+ Z. T3 D% e   }0 @! Y' P! |/ U, p, u/ N
   return FALSE;
. r) D( m8 p6 A8 Y' y}
* ^9 G: o. g! F. y7 H: O6 P4 ~4 z0 @4 H/ o
Although this trick calls the CreateFileA function, don't even expect to be) \. x5 r: Z$ y+ n
able to intercept it by installing a IFS hook: it will not work, no way!1 \) R8 J1 {! P0 Q7 c9 j, G
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: H# d& x6 f" m, ?
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ W9 _& J3 N  f' `1 r& N9 J1 `and then browse the DDB list until it find the VxD and its DDB_Control_Proc+ a& T) |: D: B: w
field./ P+ n' n) Y1 h# [
In fact, its purpose is not to load/unload VxDs but only to send a
5 T5 k6 M7 e# F4 \5 Z; d+ @$ K4 oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  ]! E6 s1 B4 `% W: n$ N# C. H# M
to the VxD Control_Dispatch proc (how the hell a shareware soft could try8 N, w' @: T6 y$ I% ^' ^
to load/unload a non-dynamically loadable driver such as SoftICE ;-).& O/ `: Y9 ]7 r! Z- E. w8 \+ [6 t" o
If the VxD is loaded, it will always clear eax and the Carry flag to allow
) g9 F  \3 [2 g  j' z" Eits handle to be opened and then, will be detected.! u! n. T) Q4 W- b- j
You can check that simply by hooking Winice.exe control proc entry point
- v1 C. `  {3 |' i! e0 ]6 ?while running MeltICE.
% I% S7 L7 s) w: t- J2 ?2 G0 _
7 ~4 a' M1 R8 ]3 ~. T0 g: P' M% g1 y: B0 Q9 M
  00401067:  push      00402025    ; \\.\SICE3 W3 a: e* x! ]9 h( w5 b
  0040106C:  call      CreateFileA  v4 z5 w9 H: X% i. Z$ L) l3 F
  00401071:  cmp       eax,-0011 |5 j8 U, H( u' C9 I3 x
  00401074:  je        00401091  W9 W# V/ l+ i3 h$ k7 _
8 q/ G" n8 _& J" W" w9 i+ n
2 H9 C" Y; O3 D
There could be hundreds of BPX you could use to detect this trick.
- n/ ~: q0 w- b: K* ~$ c-The most classical one is:
( ?) v9 z0 K' v1 Z5 e0 g  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 D( t5 N3 r- \# Q$ \; K8 {
    *(esp-&gt;4+4)=='NTIC'
1 U$ n6 \8 t4 _7 a
6 H+ ?/ }- @. Z2 x3 j-The most exotic ones (could be very slooooow :-(* ?- r. c0 |  S# G
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- ~: V% f7 w' L     ;will break 3 times :-(7 r  C" v8 Q/ _

4 G# Z& ^0 E7 T' H2 H6 A8 a  j-or (a bit) faster: + F# Q" K  C0 z: r) k* d
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! [0 p' s5 y# r! u- t8 H% U
9 t5 o5 a9 F1 G4 }) ], W, p
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 v6 _6 n. @8 ^/ i     ;will break 3 times :-(
& l' F1 A$ p  c2 y5 g/ j# u; `5 B3 E- R" z3 t; d
-Much faster:
. z9 b9 X. i8 Z, N8 |. t$ ]   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 W& G( p" G& Q
1 D( ^8 ]3 _( R3 m1 x8 Q; `
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. h. n! H% @; t  g9 h3 @function to do the same job:3 ~7 U, g( c- u7 f# g7 R" d9 @

0 j/ B7 x, n- l/ X; {   push    00                        ; OF_READ7 s5 h# n, Z' A& J  C6 @% i
   mov     eax,[00656634]            ; '\\.\SICE',0$ c" P  U  F. P$ `* c5 t
   push    eax
' T& f9 m# G4 E% I# }' @7 ], B   call    KERNEL32!_lopen
  ^( c: R* A1 n- H   inc     eax" M7 r. Y5 a1 u# \" e( a, D
   jnz     00650589                  ; detected( t& Q, \2 |0 q6 `" Z7 h' T
   push    00                        ; OF_READ
6 D. [! C3 z) g- t. m   mov     eax,[00656638]            ; '\\.\SICE'1 K6 V7 g" z3 S: g0 V" R* T) [
   push    eax
: t( Z, A! ]5 [7 z4 y; k   call    KERNEL32!_lopen2 Q0 J( I0 m5 {6 t7 o, f
   inc     eax
0 p, J( M. R* [, B1 c  E$ T# E+ l   jz      006505ae                  ; not detected
+ s8 T  i5 A& S& w/ A' ~& k0 b9 s; ~+ V4 O/ q1 w3 A* O+ Y
1 u6 u" n: z9 p8 ?, d6 d& |9 X& x
__________________________________________________________________________0 U+ k) r: N. r4 `  G' y9 l8 R
% o# L) b: x  U4 `+ y
Method 12: i  G5 t/ f! `$ v3 z' y: h
=========1 E* m; @5 W0 d% s$ K0 v

3 B( }# a9 C. x2 z6 g7 eThis trick is similar to int41h/4fh Debugger installation check (code 052 ]' [% [! Z! D
&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 N. }  t7 h) ~2 g! C
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ {3 R2 y( ]" a' U: j0 d  T; M4 a" Q- h3 b8 R4 g  j
   push  0000004fh         ; function 4fh6 n5 D# i  `( m' u
   push  002a002ah         ; high word specifies which VxD (VWIN32)' ^, T3 K* C# ]
                           ; low word specifies which service
4 P: ~  ~  v9 |" ?& x) ~7 h$ C. @                             (VWIN32_Int41Dispatch)' q7 d: m; H* [
   call  Kernel32!ORD_001  ; VxdCall; g  A; E" h' v) t! }6 @
   cmp   ax, 0f386h        ; magic number returned by system debuggers
, ~1 O- K, G( X   jz    SoftICE_detected( p, U9 p) t- V' {9 ?
* F1 c: M: I/ Q, }3 K& E! H
Here again, several ways to detect it:+ }( g1 q& g8 x

  g7 k. l6 ~) ?/ d    BPINT 41 if ax==4f. @9 ~/ r+ K  d  R! N" O) Z" x

* X/ e% ]1 v& w    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" H- }5 h; l5 k9 G8 J" r7 a& @4 \8 O7 a6 J1 r& Q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 i* {* u6 T, I. d+ l, f5 y# z" m
3 k) h5 o9 x* C6 y  k& b* i: A+ p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- M6 }9 p) ?, K4 N/ B0 f

' T, P5 D! n- o2 y6 J% R__________________________________________________________________________
6 ]" _0 K% Q% E8 o0 }! s. _
: _, J, N! G: R9 YMethod 13
  r1 Y! r4 q+ p=========
, T; h  S* s+ K2 Q* |) B& V+ m9 i
. r0 H4 J) z" M$ wNot a real method of detection, but a good way to know if SoftICE is9 H6 \# F% n. a+ I
installed on a computer and to locate its installation directory.
( x9 V" N4 S3 w# D; FIt is used by few softs which access the following registry keys (usually #2) :1 {9 a/ I) l4 x5 ]6 O8 Z
( y0 r* m, V# k$ n. w! \" E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, t4 t& h; E. N8 o8 u" g\Uninstall\SoftICE
. l$ t: _; q" x-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
  s4 m6 j9 t% a  z& D-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- o' T, n( @' q5 u9 b
\App Paths\Loader32.Exe
2 N9 W  r- K& E; Q! k6 r# V: X/ N* C3 V% E' t% J

% ?9 v3 G; a% x5 R. G+ p5 S) uNote that some nasty apps could then erase all files from SoftICE directory4 W, E9 k8 a- K
(I faced that once :-(% R3 I6 F' j& N8 H" z5 o" v
9 L8 y  X. J& ?' h. F+ w) }# s3 m
Useful breakpoint to detect it:; b/ [. b$ \" h' b  J5 _

: |/ }5 H7 A5 t  G+ l     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
4 L- E0 ^: u2 e1 v$ b0 }4 V. F8 F: K- ^6 q: d# [* v  H
__________________________________________________________________________; S9 {: B+ O) D. t4 N
0 ~2 y  n. T. s7 U
* r: b. E6 H9 L1 ~6 y, o) ^
Method 14 : u( X* u! d' h; l4 p8 |% q
=========& o4 O) y, @3 ~& m, L+ j* P

3 P/ d% g0 ~) Z" Z$ _  m% @" ?/ gA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ @# x0 V& h( z: K# m! d
is to determines whether a debugger is running on your system (ring0 only).3 e$ n2 H0 W! P+ O4 h- }# q! W) |

  @& c/ \, q# ]2 @% f+ _   VMMCall Test_Debug_Installed
1 q; I& ~8 b/ \2 b$ |   je      not_installed
9 U" ^6 A9 o2 V  v1 {5 H
: X) w9 S6 J; ?) w" dThis service just checks a flag.8 T& |6 i! ~7 O/ N: i) Y" g
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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