About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>/ f; ]  y3 k# y2 X- R
<TBODY>
0 W! k3 ^& N4 r5 `( E<TR>
& f& T* A: c% d9 P1 Y: G<TD><PRE>Method 01
) l. T8 ?9 }' y7 g=========, ?5 D4 Y$ I; e4 `- A9 ?
; k( `% }( K# P- ]2 b) S5 [1 @2 I+ ^6 Q
This method of detection of SoftICE (as well as the following one) is( V7 p3 X4 i% Y5 c' {) B/ P
used by the majority of packers/encryptors found on Internet.
4 q5 r4 v) ^7 I' tIt seeks the signature of BoundsChecker in SoftICE' ]5 Q( e  a# M; s- J1 [

1 ~6 S1 n6 }4 a    mov     ebp, 04243484Bh        ; 'BCHK'0 |* m- Z/ L" J* j- V' x# n
    mov     ax, 04h
3 X) B7 V$ Q8 t' O! \    int     3      
  s; x( d& w% C' E' L7 ]. h& @) j) s    cmp     al,4
7 g$ @) |! d1 _- s: b* l! M& u    jnz     SoftICE_Detected
) P1 l  t* p* m3 C% q6 X- Z+ Z' D2 u9 [
___________________________________________________________________________! {2 Z( o8 w* d. u

3 U/ c7 f8 z9 @Method 02
/ g' _% V6 v1 I6 z) c$ w8 ~=========- f9 P' {5 z; ~% O8 d

4 [- C; R, A3 P+ j( wStill a method very much used (perhaps the most frequent one).  It is used
0 Z0 u2 u& r5 Jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,% i1 T' y: G% k* L
or execute SoftICE commands...
; q% H& n2 ~$ E* T2 M& [# FIt is also used to crash SoftICE and to force it to execute any commands
# Q- [8 X# Q5 N+ X5 j0 Z! E" h! v(HBOOT...) :-((  
3 f/ S" B, J. v3 B3 Y+ P" ~* G* O4 [0 R* y
Here is a quick description:
, y( M# |* y7 g-AX = 0910h   (Display string in SIce windows)
, ~% x% j( R) b( ]5 i: F-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 L* j  F& t5 T" O" G-AX = 0912h   (Get breakpoint infos)
& A0 T# u' W$ _! \2 [- _-AX = 0913h   (Set Sice breakpoints)
9 Y1 l1 a! i& b2 X3 I-AX = 0914h   (Remove SIce breakoints)
' K8 M; \6 ?, M( u) |+ D3 u
7 [, F# X0 l6 d/ k8 t  \9 d+ FEach time you'll meet this trick, you'll see:# ?- |' H9 j4 N8 F8 P# f  v
-SI = 4647h* {. ]" R) |, R' W9 ?
-DI = 4A4Dh
7 A7 E- A3 H1 \3 A2 B& z4 N, OWhich are the 'magic values' used by SoftIce./ a  {" Q! f& C8 {5 q. m
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ Q8 ]7 A1 |% |* X( }7 C
$ M( D* X  O) \7 j. h2 q
Here is one example from the file "Haspinst.exe" which is the dongle HASP6 `& S8 e$ K# }& k7 ~
Envelope utility use to protect DOS applications:
' L* K2 ~0 q/ X& K0 O7 G9 h
( L( Q9 D) u- A- d! |* f5 X( u* w& D3 X' L5 J* m: Q
4C19:0095   MOV    AX,0911  ; execute command.
2 ]" r% c, x9 H; B/ \8 a4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- i* C  Y' h, r- C$ Y# ?, {
4C19:009A   MOV    SI,4647  ; 1st magic value.$ Y3 r. ~9 n2 ~2 f+ Z1 R
4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ G3 T9 ?1 R( b3 N. A
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*). f; n* D- S6 s* M8 P
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  y9 y: N2 I! e) i( d
4C19:00A4   INC    CX
! r1 ?$ a- p8 L7 w4 o) [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, M; N0 B) E' R4 J- M. x  o
4C19:00A8   JB     0095     ; 6 different commands.
  V- X$ a7 R2 x6 P$ N. r! j: F- ~4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ v$ I5 w1 @8 x$ D/ s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- K$ C1 U$ F9 g7 [( n) c9 k' S
/ e2 ^8 {5 D  L6 L6 M% \The program will execute 6 different SIce commands located at ds:dx, which  p3 {$ j% J( u3 x1 Y9 o
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.1 `6 c+ Z1 p* \3 r; i
' i5 Z9 U/ s& X
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
1 n: X3 m: Z5 y; z, N/ @___________________________________________________________________________2 b$ x0 x- o: q5 ~0 Q6 y" a( y

' x+ B2 Z9 E- n, w0 v5 u. O# i8 w; u2 P2 o7 m
Method 03% ~) l6 L& _$ W2 \5 v" M
=========9 t7 L$ X# i. z! T
: ^0 R$ R4 k" q# D3 `% I2 U
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( F; a- t% d" n! L+ i(API Get entry point)
' F% }; C( H( a* I: r/ z/ y" C% P        
# q2 R2 l( u- o, M+ A1 ~4 s3 @, C+ j/ E6 f: u3 R
    xor     di,di
# c3 ^, u" }0 _    mov     es,di8 ?/ w; @: Z3 a5 k" o  _
    mov     ax, 1684h      
7 j9 T) _( ?% |1 ^6 R    mov     bx, 0202h       ; VxD ID of winice
. y* I7 I$ D# F+ t( O. b$ O    int     2Fh
; ~4 t' [, Y# U5 e9 W; y: X1 h    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* s& y" ~& t& W/ |5 v    add     ax, di# ?6 _3 Y0 C  u- y
    test    ax,ax- l2 Q& u  y3 t  G: h
    jnz     SoftICE_Detected( e% n5 ]$ r% O' |  p# y) J/ `. ]

) }8 n% ?$ j) ^' @4 |___________________________________________________________________________
: c; I' W5 [) R1 j! ^* W- k* _- i1 o1 G3 w; M# q, |4 u, a
Method 04
: w; e; l7 O1 `+ B- r, _& l1 D" W=========1 J1 h# |7 V/ g
, f/ y4 R0 P; E. |/ M- X
Method identical to the preceding one except that it seeks the ID of SoftICE
9 E4 k8 c$ C# K" f$ n' YGFX VxD.
8 ~7 y+ F% N! @8 h9 h# |
+ J0 R0 `0 K2 h    xor     di,di
; D8 m5 v+ T" t' n6 n, D4 W    mov     es,di( M; j: L' k+ s% U
    mov     ax, 1684h       5 W, q, z  u" ]) T% M
    mov     bx, 7a5Fh       ; VxD ID of SIWVID  I0 W5 X5 Y7 H& v6 Z
    int     2fh4 Q; }" v3 f( T! d9 Q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  e2 p* u4 n, y; J  l; ?
    add     ax, di
' j6 Z  [  h! @- r& ~* M# {/ y- `    test    ax,ax# D' W, Q# m$ k" y
    jnz     SoftICE_Detected8 P0 t7 a5 [% u8 W6 c7 p3 O

5 h; S1 Q1 v5 `# k. ~__________________________________________________________________________
/ d1 @0 _# o9 `6 `& R: o+ J2 m. K/ X' O. O
2 z, S4 [  t. {, v# c. Y
Method 05
1 q+ M" d4 `/ b0 z: b=========
6 U8 J4 g, \3 Z; ]
. x; U/ {4 x* R+ D% E, w: |7 GMethod seeking the 'magic number' 0F386h returned (in ax) by all system) W% I; J! {2 X9 }4 k, _7 f+ P
debugger. It calls the int 41h, function 4Fh.
7 v/ k+ o: h# @3 F* sThere are several alternatives.  - U1 |3 a4 e# b! C; _$ c- }6 h
, P# C0 G) J' J6 d0 s9 k& T
The following one is the simplest:
# y6 k. B9 \! a4 p* ^! T1 `, L
% M9 Q, c# e7 _) `+ z/ z    mov     ax,4fh$ p" h  w! V4 j. D8 g: O
    int     41h
: ]- W' C( k' C1 j9 O# N    cmp     ax, 0F386
+ b3 ~1 b( k4 B) {    jz      SoftICE_detected
- O: A0 ^% D8 W+ _2 W! u9 F) |, Q
& p- C# B. }* k+ _3 r0 W+ I9 N) _$ n  _; Z* R
Next method as well as the following one are 2 examples from Stone's ( \$ d. o  K' c7 y) s
"stn-wid.zip" (www.cracking.net):
& ?1 L; [! `4 P' b# |# Z6 w7 m
; {9 f2 y1 v4 M" ~    mov     bx, cs
/ C- ]* o. g8 ?! D  U7 o9 _: p    lea     dx, int41handler2- j  o$ X( O  h  p! V
    xchg    dx, es:[41h*4]
# u7 v( Y! a( J( i+ A) x  j    xchg    bx, es:[41h*4+2]  J* G$ A& u  S) L& |+ O0 F
    mov     ax,4fh$ g, x! ^' p( D( p
    int     41h/ v7 l' B# S" u% J* S0 w4 P
    xchg    dx, es:[41h*4]/ t) A1 z$ _1 B# k+ `: |1 w
    xchg    bx, es:[41h*4+2]5 k2 a' T* v7 _, p( c$ C
    cmp     ax, 0f386h
2 s! j( W4 ^  {) Q    jz      SoftICE_detected4 w: C3 K1 M0 @6 I7 l0 I

# H: J# T* ~6 j4 m+ wint41handler2 PROC2 I, K; l0 ~2 c& X3 ~
    iret
% k2 Q& Y5 k' [1 F$ lint41handler2 ENDP  G) ?2 E; A9 h- o8 ^0 R2 |5 }

, k6 Y! U2 Y% N! ^1 {& d6 k3 `3 f7 ^. w  U" J- g* h
_________________________________________________________________________1 G! D1 H  I& K4 G, w

3 B; w( k6 C. b( Y0 y, N5 R! E2 C0 {7 L8 _) t
Method 061 ^! T- S. ]9 e" X! ?( K
=========
# q. T% J( K0 i. w
+ v0 `5 x. L7 m( ^0 Q- |7 ^7 r* D1 F. {. x' T
2nd method similar to the preceding one but more difficult to detect:
- t- v1 f* D6 o# o
% o3 P. Z, q( E% }0 y* |8 k1 |0 h2 r- p# ~3 L$ C
int41handler PROC9 r+ M. E" n9 Z: B3 P
    mov     cl,al
2 W2 V2 Y; C- P" s7 W; N, d, h    iret$ u( I+ W# M( k5 O5 ?  W0 X, P
int41handler ENDP
) q. v: D% u6 y# p
7 @$ o$ H) T% }) }* V
7 ~$ H. F; i' K; H4 ?) \" Q+ G    xor     ax,ax
& m" X1 h+ D5 R2 o, s5 v8 |& v: W    mov     es,ax; C6 I8 `* e7 z$ O
    mov     bx, cs7 {& y8 r* E' A  o1 b
    lea     dx, int41handler
" \, d4 N( M! S) f  O3 q  O    xchg    dx, es:[41h*4]
* y4 o/ ]3 ~3 I" E2 s, ^/ h! `    xchg    bx, es:[41h*4+2]
. R: H6 p, y% ^4 t    in      al, 40h
+ a( G0 m0 G; F, i6 x2 k* B    xor     cx,cx+ ]: w$ j& v4 R2 C% O. _4 b! d" ~
    int     41h8 d5 ^. D- Q+ c+ F9 I) H4 b
    xchg    dx, es:[41h*4]8 t1 T# S+ u  l: [" J/ j6 u
    xchg    bx, es:[41h*4+2]: y5 w( i7 G& ]' I+ Q0 c4 |; i
    cmp     cl,al
. G8 ?* A* I3 ?* e, p    jnz     SoftICE_detected
% w# Q( K& S2 n" u2 A
4 X! O' u4 {* h' K% }$ i_________________________________________________________________________2 D( A& j+ D; L) S- p$ X8 d' R% k( B
$ ^) |3 C$ M( B% |1 \% F
Method 07" e8 j0 [, y: l+ ^# s% D7 e4 L& M
=========9 p% U: p. c7 u3 `  d
/ H& T) f9 ~+ f7 u
Method of detection of the WinICE handler in the int68h (V86)
! e# F3 }: U" L3 Z! _
& @! h3 I$ g% I8 y1 u* {    mov     ah,43h; b  ]# O- f( J6 ?# W4 U- T1 A& |
    int     68h
9 a& K( Y- j6 c, S0 k$ k7 e    cmp     ax,0F386h
( ^! d; J, b, }& K3 Q0 L    jz      SoftICE_Detected. I4 d$ I! K" z  G7 s

$ g. F) E2 O+ [$ {3 j$ ^) E$ ]
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 L, A' N( I5 n& C9 z- [  f% B9 S
   app like this:+ B" i  v* b7 ]9 v1 l+ L4 z9 C4 {8 r
* T; o) |7 j+ _% Q. E! a  L  j
   BPX exec_int if ax==68
3 Q& i# v2 F; Y( h6 R5 R* L   (function called is located at byte ptr [ebp+1Dh] and client eip is' R! ]+ E- D% f/ u3 S/ Z
   located at [ebp+48h] for 32Bit apps)0 {  }! P6 p7 S7 v! d
__________________________________________________________________________
6 q; K3 e" t/ P; U
* }' B3 V* o$ j( c( B: R" ]+ ^# _
0 T8 F% Q+ g7 L- A$ sMethod 08
- k% \' q5 r% I; s; }=========
1 x2 o& ]; P5 B$ C  U9 w9 e, t3 f' w- O9 J1 \, ]. X
It is not a method of detection of SoftICE but a possibility to crash the
1 D* `# e% @3 K% z' e, Osystem by intercepting int 01h and int 03h and redirecting them to another% m8 L" g+ r: D) ?9 H' k
routine.* u. ^8 A7 n0 R0 v$ Y; f- W
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* S# ^" @, y" {1 I# `2 i
to the new routine to execute (hangs computer...)
1 \, x# Q* w5 n7 B* O! c9 O. d& l5 t7 U, q! _
    mov     ah, 25h* O/ n* I, @& R
    mov     al, Int_Number (01h or 03h)' B- Y* o- P9 v& F  Z
    mov     dx, offset New_Int_Routine
# h; P$ n/ A* F6 j+ i# x: Z    int     21h
( t9 f; }$ ]. S9 q, Y, X; F; V! F
__________________________________________________________________________
  z0 W$ p! `3 l
( C0 K, ^+ i5 l) z% EMethod 093 O# r1 h! @3 p
=========4 {6 u1 h; {8 J; N: G: p
' b& D7 v" s2 |9 b9 ^
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ I9 w4 o0 B7 _0 m: ^7 H5 r' k  f3 N
performed in ring0 (VxD or a ring3 app using the VxdCall).
. \' K& V/ N# p; S& a+ YThe Get_DDB service is used to determine whether or not a VxD is installed
. y( B4 p2 n3 z8 m3 bfor the specified device and returns a Device Description Block (in ecx) for: d) }; m' E( [, I
that device if it is installed.3 B' K4 ^  s2 R; j4 k$ K: ]: y

5 g, }6 D& E% X: ?1 J   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID0 Y: K0 F; i9 r. V! ?" X0 o
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
+ V) Y* T6 g& p6 l; o7 h# a   VMMCall Get_DDB
, c4 V# s$ `* |) t   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed' ?# k1 _2 d& G' k4 I6 [0 V* l

' F# h6 J7 A9 y( _$ D% Q  b) E9 _4 ANote as well that you can easily detect this method with SoftICE:
/ E1 q: N7 F. U3 R" |# F8 X: \! C9 M   bpx Get_DDB if ax==0202 || ax==7a5fh, \7 L. ^* I# p' V6 e0 y

/ z: M8 k( G* D7 g+ i6 x+ a__________________________________________________________________________  s8 h1 T# a- h

: ~0 ]# M8 Y0 j1 l: KMethod 10
" E7 w! ^" m. m. d) J/ h7 w=========! C. a, u" ^$ v# O

  o7 {' h0 G5 L! j( f=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- ]4 O% r2 ?# Q/ T  E( L4 e9 e  SoftICE while the option is enable!!- J9 Y: a+ ~8 Z0 I: I2 ?0 t

0 s7 H; E$ ]8 s5 \$ VThis trick is very efficient:+ @5 J% F8 ^1 t! w' C8 `$ _- R
by checking the Debug Registers, you can detect if SoftICE is loaded2 S. _: A% x0 m  G: t
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
; A# t0 f9 h2 ythere are some memory breakpoints set (dr0 to dr3) simply by reading their
1 g: Q; M3 v, ^3 m! Ivalue (in ring0 only). Values can be manipulated and or changed as well
. y. F8 ]+ R) P" z& _(clearing BPMs for instance)
% B1 S" W: S5 `. H. }) \1 n- p7 r6 b5 ]. a3 ?
__________________________________________________________________________
8 r4 O7 u+ n9 [) y  O& G8 V& s1 P( L
Method 11. p3 `7 n5 ~, p- l! J, m
=========' s( m' V/ |+ F( }$ A4 F

) p. ]4 Y9 c; B. A: w- N4 E3 X; G* MThis method is most known as 'MeltICE' because it has been freely distributed% A5 G; x4 l8 _4 h# k! D
via www.winfiles.com. However it was first used by NuMega people to allow
4 d" R; A6 m6 {; y0 r- N8 n1 QSymbol Loader to check if SoftICE was active or not (the code is located/ b8 W9 \; d1 @* L6 v1 }
inside nmtrans.dll).( _1 z# K7 n% A
6 @5 b5 y2 a1 r" z7 A* C. H) U4 p
The way it works is very simple:
; g$ ?: I, t) oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' w2 V1 K5 o3 g; k: Y
WinNT) with the CreateFileA API.
) ]" C1 h% \2 J5 @1 }' m8 U* z& h( O$ y( c
Here is a sample (checking for 'SICE'):
$ C% `" E' }# t, y. d8 H9 @9 {1 T7 ]: Z+ a6 B  x
BOOL IsSoftIce95Loaded()) V7 S# f1 T% i& h
{
$ K! {2 n/ F; n, o   HANDLE hFile;  
2 z: e1 |+ `2 ?. D   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 P+ a8 ?* w6 l. \
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
" J) x4 Y: R7 w1 I' p/ a                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& E3 L$ @& D5 z: S0 p0 J  p, p3 Z   if( hFile != INVALID_HANDLE_VALUE )$ l7 Z3 n: }3 {: X
   {
; W. d  L: Z! @, c      CloseHandle(hFile);5 [3 r+ L& j: j9 l
      return TRUE;
$ ~9 K3 x' Q6 l( ?. D6 h, Q3 G% U   }
8 z: r/ o5 O; N2 M0 {; H3 P   return FALSE;/ r: Q2 ^4 K$ B
}: b1 g4 w6 r/ r; u+ G
. D# A" G6 X: ?
Although this trick calls the CreateFileA function, don't even expect to be8 X% `& g9 {& A
able to intercept it by installing a IFS hook: it will not work, no way!
) ]  ?; k0 ~) HIn fact, after the call to CreateFileA it will get through VWIN32 0x001F' ?( r  X( H5 z+ a% I; {& J* m
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- R/ y( \: m$ Aand then browse the DDB list until it find the VxD and its DDB_Control_Proc
" X; u& R8 R0 _( v$ @field.- M- c8 H9 A5 q, {5 _, U( H
In fact, its purpose is not to load/unload VxDs but only to send a
# z; P; i7 a* J' ?: b+ QW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% o& W; _0 y; b; ?& b8 b+ R
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ M) Y8 b7 N8 Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).) N& t# \* o& X: ]6 D2 n
If the VxD is loaded, it will always clear eax and the Carry flag to allow3 L$ d- [& [; m$ B
its handle to be opened and then, will be detected.
; `# l3 @8 Q" h- u$ G' zYou can check that simply by hooking Winice.exe control proc entry point6 M/ V* m) _/ j3 [3 [
while running MeltICE.
! `8 k2 K5 e1 d0 N1 g5 C; U8 E
. C& W4 \) `, m6 [6 z4 h$ \7 P+ ?  a. N; k5 X- \
  00401067:  push      00402025    ; \\.\SICE7 Q; I$ V6 D7 P% ?2 K" r! X
  0040106C:  call      CreateFileA
0 ~# X. J  f5 i  V% G  |8 T  00401071:  cmp       eax,-001& O( G" x9 o* b# R7 ]* j1 t8 h% W
  00401074:  je        00401091
/ m" ?7 F3 r+ N) n. ^0 D4 [4 f" Z  n  T4 [2 \2 A. c

1 P8 C. A1 R! M) Q( {' t" t; AThere could be hundreds of BPX you could use to detect this trick.
* D9 ?/ R9 Q4 D* q-The most classical one is:
3 U! Z2 |2 B0 d# n0 ]2 m  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; ]2 u' c! x. G* y8 q
    *(esp-&gt;4+4)=='NTIC'
" u9 ~4 X* M6 [  {* m
, O: `1 n$ X1 Q9 T-The most exotic ones (could be very slooooow :-(
7 Q) r/ L7 h1 |& m   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; B( v) \8 X. z1 c4 D" B
     ;will break 3 times :-(
& J  u1 H9 l7 V6 d, o# x
3 C" Y, }2 O) {0 H% m: G-or (a bit) faster:
6 M4 P0 |$ Y4 r- ?+ ?, F   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 h( j# k/ e- H0 N

- b0 A6 j1 ~! T* q   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + y" L$ s# Y! [3 [+ {
     ;will break 3 times :-(3 t; ]- u+ f# o

2 I. R2 v# N& o, _! n8 I-Much faster:
3 I, z  s" t4 B8 @   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 W5 N8 [9 _5 O
; t; w. Z5 V- S9 A4 }5 \
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen- G$ U% S# I+ ?3 r
function to do the same job:
. N/ m- s6 Y6 c" Y- C% d+ s; ?" r6 t: ?, x4 Z
   push    00                        ; OF_READ
( X9 R5 S3 Z, N: J9 R9 q* i0 k   mov     eax,[00656634]            ; '\\.\SICE',0
9 K! n3 z# `3 b* }! G5 T; q1 J   push    eax
& o( q: S  z: F2 c0 F. @( y* ~" L   call    KERNEL32!_lopen* N: v# ^& e. l$ Q, p4 C
   inc     eax- `  n/ |2 X6 v; }  h
   jnz     00650589                  ; detected
) L& W6 ]0 k/ A& l! ?4 Z   push    00                        ; OF_READ
# l6 ^* N6 U1 _2 n* ]+ D   mov     eax,[00656638]            ; '\\.\SICE'
+ A0 x0 s% I8 {   push    eax$ v1 u! {" I1 g! P2 f% G4 x0 e8 B% R0 `
   call    KERNEL32!_lopen$ w! F: c& b5 E/ Q- i; M
   inc     eax
) ~6 ?! \9 q( U; U. K   jz      006505ae                  ; not detected1 ?" a( {! h  y3 q; G
# v$ u7 N; O# I* M3 v* x. X
( |) a+ Q8 A/ H  W
__________________________________________________________________________
, J8 S/ p8 s" ~" P. n0 N; e
8 l6 e! U6 o/ Y6 aMethod 12
' q  N) {3 _5 T$ F* G; |1 V=========
7 w' [- l5 a2 w2 H+ g& {# t( [  q
. [* M. [" ?# EThis trick is similar to int41h/4fh Debugger installation check (code 05* G3 C  h! Q, [' X; O
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! \9 c( m8 N' }- x0 x0 B" Was it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 a9 [& b- T8 b7 _2 H8 z8 w& K+ s" s/ O8 o1 K* K- a$ p; r
   push  0000004fh         ; function 4fh
1 p( V$ u6 \/ |* y/ \# C' }   push  002a002ah         ; high word specifies which VxD (VWIN32)& X  V& _( L# ~) r. X% g( O
                           ; low word specifies which service0 c! E( _% z" X  [/ |
                             (VWIN32_Int41Dispatch)8 t8 {0 @0 j1 @* P
   call  Kernel32!ORD_001  ; VxdCall
. d% Y( ]. O* p2 [& a   cmp   ax, 0f386h        ; magic number returned by system debuggers0 Y. f1 I  h. f2 g. ^3 U
   jz    SoftICE_detected
6 o( U7 W& X( [7 E6 L7 \9 D# b# i
Here again, several ways to detect it:
: S& F) G8 R% F# O6 o' T5 n
, ?  B6 {, J" X$ J! |2 y    BPINT 41 if ax==4f, M" c5 J, B: m* K
0 U% E5 x% i. j
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" X% ~# d5 K' M( O  _# ?& i* N) I7 w. d! C, r& ?/ K
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 E+ P/ G, A8 \8 f
2 X; N, |5 q3 }' d9 T, v
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, R' H0 `# f+ A2 T$ v

. ~+ N0 G1 [% K3 X8 W__________________________________________________________________________1 E& k. F' J. ~" k

# i4 U  Z6 Z# l( a/ q$ B8 U/ o! fMethod 13
2 S/ g) ~1 h0 u4 i9 B9 c. k4 J=========3 r5 A% F+ ]& ~
. L# ]# S* I* O
Not a real method of detection, but a good way to know if SoftICE is; n" |6 }, l+ G3 G: |! {# H# ?3 }
installed on a computer and to locate its installation directory.% I/ d2 c( M8 m' ?- K6 d6 B
It is used by few softs which access the following registry keys (usually #2) :% S% L4 g3 B* T. Q  l

4 Z, t/ ~5 I# y8 u-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% x8 R# ~5 B, |- ~) |/ L\Uninstall\SoftICE
0 z6 J8 Y0 _) n- X-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, f( s4 }/ u/ V6 E5 D9 z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 T, \3 u$ O0 B  m\App Paths\Loader32.Exe
* G$ B+ k* S8 _9 y( `5 H) Y
# ^0 i0 R6 y4 p! X, \' k/ r" }, |6 R) q/ \
Note that some nasty apps could then erase all files from SoftICE directory: R( S4 o. [3 [
(I faced that once :-(3 h3 U! D3 T& u; x& o# i

" w) d$ ]" M$ E1 K. s! QUseful breakpoint to detect it:* f8 A9 j, Q" {( C1 n% M

& G+ {6 C# b4 }4 Z( P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ c( u: C2 b* a: B0 o5 U0 Y% M0 u+ I9 C- ?0 B' h# Q
__________________________________________________________________________# C3 I7 a: _  R4 Q
8 g: M4 ]8 m, T+ ~1 x, [
+ G0 R) `$ s6 l; D9 K. D! z! p
Method 14
! D4 G  ^* P4 a' C& T! \=========
# U# T# C' L- S2 e' a! v1 k
# `  @+ E$ h3 qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 `$ ~) m( B7 h( Q# Q
is to determines whether a debugger is running on your system (ring0 only).
. G" X/ O+ I; `# c
# H1 o, ^4 j; c: u$ K   VMMCall Test_Debug_Installed
& E: @6 V7 B" f. O   je      not_installed9 P6 D+ ^& P7 ]5 s& m7 S' f# b' P! ?

! h( ]! _- e0 I8 E* P$ LThis service just checks a flag.
" _2 y4 E, @7 a+ h. 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客服返回顶部