About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 b3 X" P" ~5 [3 P, f4 A5 Y
<TBODY>( l+ ~) ]/ w) @' M+ b; J
<TR>
) C& [- a" h7 w( A6 E& |" I% x5 ?<TD><PRE>Method 01 * W+ S; [+ z0 }
=========# Y+ L: o7 P% l

/ X6 a7 e* E( z; V5 w, `5 h- q: zThis method of detection of SoftICE (as well as the following one) is) d7 N" [; ?* U( c' W7 m1 J
used by the majority of packers/encryptors found on Internet.
8 }+ o+ @  o6 d' vIt seeks the signature of BoundsChecker in SoftICE
  V+ ?- C# K* g" W& u2 K& |" Y4 O! Y9 J0 z  L
    mov     ebp, 04243484Bh        ; 'BCHK'" R0 D5 z& w) }: v& z$ y
    mov     ax, 04h
9 R( |9 ~$ I6 J" @8 o* C    int     3       5 J! ?  c* v1 i2 ?4 w! X) r4 a- P
    cmp     al,4
% [2 c3 P/ o, i4 p    jnz     SoftICE_Detected" r. R+ j( h. k) z  f
1 _) x8 `1 Z0 H7 J
___________________________________________________________________________
7 M2 e9 `; C* }6 e/ N/ k: E/ P4 T# U0 F" y+ C$ ^( ]
Method 02, w/ w5 \. a: u3 B. @- V
=========+ i: B" ]2 S; g1 b( R
+ V; n# o; v2 h) w! I* H# K) O" x
Still a method very much used (perhaps the most frequent one).  It is used  x1 F6 j' L& S+ h. {2 o( P& R" H# C
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 b& y6 Q4 k6 o" qor execute SoftICE commands...
  e& f! X, ?- f6 R: e9 xIt is also used to crash SoftICE and to force it to execute any commands- m; s) o2 J+ k7 T
(HBOOT...) :-((  
. d: E/ A3 O) B/ c% J: v* `
' |4 ^" `9 h- s- K9 N2 X" a7 GHere is a quick description:
% I+ Z4 a+ D, z6 F0 Y-AX = 0910h   (Display string in SIce windows)% Z2 U4 m8 q: F2 e
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 ?- N  f& x. g, `+ i7 n, u-AX = 0912h   (Get breakpoint infos)
2 S) P% d6 D5 a-AX = 0913h   (Set Sice breakpoints)
+ S* }2 ~) G6 R-AX = 0914h   (Remove SIce breakoints)/ q7 t2 s; I5 h/ {1 }+ Q2 p/ F
$ g( P" K! {* u/ n
Each time you'll meet this trick, you'll see:( k" i) D& k0 T( f7 N  t3 L3 w
-SI = 4647h
9 d) r! M6 O& x2 j) U-DI = 4A4Dh
" w) Q& C& g& `" H% GWhich are the 'magic values' used by SoftIce.
' F; h, e2 W! O1 fFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: s$ h( ^" x0 v8 y
9 z9 U# E- b+ M) m/ A" D+ H' r5 I! P# QHere is one example from the file "Haspinst.exe" which is the dongle HASP# z+ c/ h! e+ q8 G$ H2 A2 j& _& p
Envelope utility use to protect DOS applications:
- N: a  I1 g8 T9 G& s6 \3 Q
" G( g, y3 C+ O  e
. D6 \: M2 }( D' Z4C19:0095   MOV    AX,0911  ; execute command.
0 C) }( V! j6 _( l4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
+ J1 z2 ?0 d8 H' Y4C19:009A   MOV    SI,4647  ; 1st magic value., v9 p0 D- O* g& t6 t: ^( h& y
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& F0 W& T0 F/ E( t4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 e0 J2 `. c+ b$ D9 i8 H
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: o9 n. ]- @$ V( J, Q9 G; A4C19:00A4   INC    CX7 l  n4 c; F" r, ?: Z+ u' ?
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
% n8 Y% C$ w/ s, S4C19:00A8   JB     0095     ; 6 different commands.
- {) H# \; E4 O4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* A: o! h$ N( J5 {4 Z: w4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)1 L1 {( p4 Z: S1 ]7 k7 t
$ v5 ?2 J& q2 T0 ]
The program will execute 6 different SIce commands located at ds:dx, which
7 i1 c8 z" a' t* dare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* H. ]2 ]9 U2 j8 L( [% Q( A2 l( c. I5 p" H7 \3 h
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 H+ Q3 B1 z; q, K% o0 r9 A& J3 r
___________________________________________________________________________
6 i1 k$ M* d0 ]  L; c0 U: A( Q/ M4 ]) ~: I3 [0 k8 u

2 s/ E2 G8 q# \Method 031 r9 _  U! B' P
=========
* O- `, Y3 c9 e; e4 g5 e
9 ?" U  ^4 [. r4 ~) Z7 N0 pLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# `1 G4 H+ N0 I8 i) u) h(API Get entry point)
# S% Y$ V5 Q8 U, J; m+ `        
& i8 z) K" \7 N, m
' `& s0 B% T: R& F: r+ i& g    xor     di,di! [- B+ ^: L* I( S9 Q
    mov     es,di
' R! H/ t3 a, i    mov     ax, 1684h       3 {/ j  H+ u% a& t
    mov     bx, 0202h       ; VxD ID of winice
4 h' c$ y% }& ^    int     2Fh9 c$ I, @! T' D6 V9 S) R' S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) W) f, h0 Y/ A! \3 h* o    add     ax, di& \$ K. l2 A9 I6 A( D: I
    test    ax,ax9 B0 W/ w; y$ B0 {( Y6 o
    jnz     SoftICE_Detected' B* d0 ~* Z0 X

- d5 ~# M' n0 Y! p6 ?/ ?___________________________________________________________________________  m4 K" [4 R* A9 n: ?5 ~7 y
( `' Q, J7 q0 f6 j2 ^
Method 040 B& j2 S  ]* q: Z" r2 o
=========! p. m) d; L$ m% h9 S5 G' s( e8 |

. {7 r9 t$ n2 S$ J4 D' y' B7 HMethod identical to the preceding one except that it seeks the ID of SoftICE
, O; o, ^+ `. }# x3 `8 _GFX VxD.
% K$ \) H7 w% i, a1 y2 `4 r6 F# Q  f1 x: v# @  o( a, F
    xor     di,di
' ]6 b+ I- v+ H. s, Z. n- f    mov     es,di
4 m: c5 B5 W( s' t    mov     ax, 1684h       ! J+ g. \+ i6 I9 b
    mov     bx, 7a5Fh       ; VxD ID of SIWVID: Z7 e$ N9 R3 i  p+ v! M1 ]' x' }
    int     2fh
% Z% }: V: _! N; B- d4 [( W' v    mov     ax, es          ; ES:DI -&gt; VxD API entry point- W# a9 x6 e/ F+ V4 j
    add     ax, di
" N6 b, M( R) X- E8 x    test    ax,ax
' n6 z, \* R' A/ Q2 _    jnz     SoftICE_Detected* `) I5 l' ^+ _* y8 x+ L

( Q7 G* w2 S/ k5 M4 |' P! M__________________________________________________________________________
0 Q8 b/ V9 h3 g3 e. ~( ?
; s) N' b" R6 S$ m
" P; h' c4 F2 ]8 G' s- xMethod 05& B; |2 g$ [2 `2 L
=========
! Q9 X# Y. x- F+ Q2 O6 ^# W/ I" [
( g  H( E% k9 _. a* i1 V( y$ yMethod seeking the 'magic number' 0F386h returned (in ax) by all system/ Y0 g0 D4 @8 i
debugger. It calls the int 41h, function 4Fh.+ e$ o+ s2 }# t1 B9 `8 c' l
There are several alternatives.  * t$ [/ K" l4 j  V; T/ K; Z

( y8 s9 i: n# @: i0 l& lThe following one is the simplest:- J5 t  Y# G7 ?) ~6 D, O# Z) r

! c+ M* y+ b; \3 [8 v5 R8 `! W+ w    mov     ax,4fh" T8 B4 p9 k: D4 e  c0 @$ ]
    int     41h/ J4 p! h. @/ _* a3 C/ j
    cmp     ax, 0F3861 D' O! Z9 P' w  M$ ~( ]' l: G
    jz      SoftICE_detected
  r  ]! G) A7 F* C! k; a- V7 x" \; ~+ F9 p
5 I9 @  ]  H  C* I% @& P
Next method as well as the following one are 2 examples from Stone's
4 \5 a* X" Y' i: e1 q"stn-wid.zip" (www.cracking.net):
, ]8 ^4 P( f% d6 I% m
7 G# J6 a# q: x: ?# w    mov     bx, cs! F( G/ ]  R1 h8 O6 ^" R
    lea     dx, int41handler24 N" z) A" o( k* Q8 R' B7 ^4 q1 k
    xchg    dx, es:[41h*4]7 F+ S4 }. K' T+ Q7 i" Y4 U
    xchg    bx, es:[41h*4+2]$ j  ~" Q* l+ Q, v8 p$ ^
    mov     ax,4fh
. W0 D' ?" H! t2 h4 @# z    int     41h
/ s+ }) H( s) p. \4 G1 v    xchg    dx, es:[41h*4]# C- s5 t. l+ d4 }: L
    xchg    bx, es:[41h*4+2]
  x6 r. T% Q6 t( D, [1 M' u& w& o    cmp     ax, 0f386h
. w9 @( a( b2 b. B$ b    jz      SoftICE_detected8 \, r/ a+ q; {4 L& b! [, k
7 o# W* \- X1 T. V9 v7 ~0 J& `4 ?
int41handler2 PROC7 O+ o7 Y  C+ u6 x2 t* c
    iret7 n% B- O+ i6 q+ O0 V
int41handler2 ENDP( f3 z2 ]) ]& N! H
1 t% m+ ]1 k6 C/ M
: \+ w2 R9 X  q1 M% X
_________________________________________________________________________* f1 F' E9 b9 E, O

9 P$ I" }" p7 l( W1 S* U1 E
' E* L( V0 I1 g" O7 f, PMethod 06
0 ~' ]8 N. n. W. {& X  }=========
! [9 N( ?. w) k+ X/ n; L* n8 a% m0 I+ p6 Y0 d6 ]$ }; Y4 p

1 g& k5 [. Y5 X8 g3 ^' A2nd method similar to the preceding one but more difficult to detect:
  e: E* `7 }! c3 O
+ f) N0 t8 \% H4 v  {1 x& N' I8 b* {- V8 y
int41handler PROC
1 \3 G( d; N! X7 W  s4 u: G  _    mov     cl,al
( ^& ^  p4 h4 ]. ~8 M0 @& {1 C    iret! W- S& y5 K1 c
int41handler ENDP
* o" j% n% K! Z& b! m4 m
2 }9 v* S  U& r4 R; K+ U
5 I+ B' C0 r" s5 Y) P: C    xor     ax,ax. O1 @6 {" `2 E. S( n
    mov     es,ax
: o' v7 L; t! n8 r    mov     bx, cs7 a. m/ _$ L* Y
    lea     dx, int41handler
. G% c  {% u2 a) v' c" L    xchg    dx, es:[41h*4], |2 z: b; ?0 {
    xchg    bx, es:[41h*4+2]& S" M9 R9 {1 K/ G7 d& |: \
    in      al, 40h( g) y) `8 C5 i+ _
    xor     cx,cx
% F3 t. p3 O( ~+ b. h0 C5 |2 s" {: R    int     41h
' ^, O7 r! m# c, @! A3 R    xchg    dx, es:[41h*4]2 e- r" m& J2 X% q
    xchg    bx, es:[41h*4+2]
6 S. y- p* `( }0 ]/ O9 a    cmp     cl,al
7 o2 \7 `1 _% t, y" H! [    jnz     SoftICE_detected
7 u5 q6 @0 P& D2 Y' y2 }/ S0 W  @- g
_________________________________________________________________________
; T+ v( N  ^* o& U* i9 a8 M. h  V7 p: \, R$ @$ x5 O( V: |( f# I8 g
Method 07
/ w6 O$ L9 J, c0 J=========( I( k% G- `- D' u! @

4 t4 W6 D- h% NMethod of detection of the WinICE handler in the int68h (V86)+ t5 G2 ^. [, j# B( N

9 i3 N' H: F  D2 N/ E/ j    mov     ah,43h
9 i. n% Y, {  m# q3 i, }    int     68h- ?' j9 x* Z+ I6 g9 m
    cmp     ax,0F386h
! h* C- C4 S7 C5 n- h+ U    jz      SoftICE_Detected, v( O" W+ o; \

4 ?9 [5 Y, S, ^. J! P3 k
- x! h8 k* a- e8 e5 h! V8 |3 `( z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit( ~0 d1 D  I+ M% q7 \
   app like this:
6 h# I, M( v& W& K  F' v. w3 a# B4 ^9 v* c5 }
   BPX exec_int if ax==68
0 ]% c8 v& T' K* W   (function called is located at byte ptr [ebp+1Dh] and client eip is
) b% f, h' ~2 b+ h, F" I+ I   located at [ebp+48h] for 32Bit apps)9 V: W7 @  i+ I8 w0 V' U
__________________________________________________________________________: @9 N0 l5 f6 M7 K% A$ @/ i; Y& v& R$ j

% @1 `# A; F! K2 X$ U
7 k- U8 ^; E% E0 S& ]  fMethod 08
; B% I# F9 \# z7 x; e, C6 X* K* G: T=========! N7 h. x' f+ m) t

4 M4 v: [# W% v& RIt is not a method of detection of SoftICE but a possibility to crash the
( l+ Z* v0 I1 e7 s8 Usystem by intercepting int 01h and int 03h and redirecting them to another
, W& K6 E$ X  b- R  R  m' froutine.
6 Q) l$ T/ x2 {6 h! TIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 A* |8 R7 Q) [
to the new routine to execute (hangs computer...)
+ k. K/ _# N1 Z; F2 J* S8 F4 G) @" u9 k: f
    mov     ah, 25h
( S! i3 k4 M! r# b/ {+ r    mov     al, Int_Number (01h or 03h). m8 z# j( {: H- m, K4 `- J& T; T
    mov     dx, offset New_Int_Routine
; b, ]( H5 E: n4 o2 @; E    int     21h$ E1 J/ ^4 o1 l
: k& \/ }+ W  a) Z3 S) ~& h6 c
__________________________________________________________________________3 a! A1 o* n9 |: t- N

6 }: b* l! k1 QMethod 09
# f8 [, [' `. \" J=========
/ k; g; v! ^' C7 J
( |. R8 L! H8 s) PThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# O5 h. j( d1 F. L, _0 y1 f4 y1 Dperformed in ring0 (VxD or a ring3 app using the VxdCall)., l: z' N  q/ D: o
The Get_DDB service is used to determine whether or not a VxD is installed
0 u& a+ ]( P, Z/ T- R% Afor the specified device and returns a Device Description Block (in ecx) for1 L' R* m, C  p
that device if it is installed.( }% f6 X5 Z# ~5 p2 P& E

: }7 q+ K8 M& C' ^1 f- B   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 r# m3 P) F# j) e9 ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 [. X0 `  [/ a" C/ |8 E8 p
   VMMCall Get_DDB
$ s* e" C9 {. s   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# m# ]% V! o, C; Z* d

4 M- `1 M  E1 D' l. r; d1 B7 KNote as well that you can easily detect this method with SoftICE:
2 B9 ^! z; F. O9 \. T1 b  x0 O( |   bpx Get_DDB if ax==0202 || ax==7a5fh3 z7 p# E) ?8 H% i
2 e3 w2 [: {$ z8 t6 O
__________________________________________________________________________
) e' B& Q% Q- b4 c" z
3 T. z& U9 i- F( e7 YMethod 10/ w9 @: n3 z' I( c
=========
* G# N$ c8 \: W& o5 F2 l# Z+ E' Z
3 [) `# D9 ?9 N4 G2 U* f0 W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ n$ _3 {4 `6 h% H
  SoftICE while the option is enable!!: D; d7 K8 _$ @- r9 b

- D5 _5 y3 e$ XThis trick is very efficient:
3 S7 i7 `# V* X: M+ `0 bby checking the Debug Registers, you can detect if SoftICE is loaded
+ M# @- \8 e0 w+ }# ~(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, X6 j1 L% h! ethere are some memory breakpoints set (dr0 to dr3) simply by reading their3 i. ~  Q$ t5 F; b7 r1 R
value (in ring0 only). Values can be manipulated and or changed as well
* G8 N# s$ s/ r& f. {# d. [  i(clearing BPMs for instance)7 T+ B4 D, t6 Z" c+ b  `6 ^
5 N: K& E! s# Q- e6 z! a) c
__________________________________________________________________________
) X& o: _0 V4 N, n" s' D  T, R9 z! ~
, j" v' u! r6 a' f% bMethod 110 X. J! S0 U' _! L9 d
=========$ y0 O! P% `0 c

$ j. e. G& F. r/ m  f1 Z. J$ ]This method is most known as 'MeltICE' because it has been freely distributed4 t2 h- v/ [4 c7 K
via www.winfiles.com. However it was first used by NuMega people to allow) C- o7 K5 d/ D
Symbol Loader to check if SoftICE was active or not (the code is located
- [/ b# L2 `7 D0 o3 F; o5 c* H9 V" Vinside nmtrans.dll).
. h9 n6 ], h: N6 E; s: E! N; q+ G8 s
The way it works is very simple:5 u! T5 M% h$ Z' n1 u9 F, h& q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" }1 h# E  T& B7 s: t
WinNT) with the CreateFileA API.
8 {4 \! p% i2 D. M/ K9 b( q2 o- h3 ~% M4 S' z  M5 l* }5 P+ M% c, b
Here is a sample (checking for 'SICE'):
8 S: C) h) p0 O' @4 U# t
, ^5 e( ?. t& o3 DBOOL IsSoftIce95Loaded()1 w$ y9 {, j  f9 o
{. F) T8 j9 X6 C! r
   HANDLE hFile;  
* z3 l1 d" }4 S% r   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" [) x" }8 |* |- j8 F% k                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 J* e8 m# N; a% @0 r! Q3 U. X
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' D4 t; D% V$ m1 d/ G/ j
   if( hFile != INVALID_HANDLE_VALUE )
9 D6 m# i0 K9 w; _! P7 d   {' g  R0 c( x/ D' H, E& R; e( g
      CloseHandle(hFile);" H6 D8 t% ~0 M: V( L  D: N, z
      return TRUE;
0 Q# ~: m8 u. N  H& J# I& D3 b; L   }
% P% h5 L* s) O5 V) d   return FALSE;
( j1 w, F* a2 d; K& i( _9 u) e}
! s) Y, z( a4 M7 C. Q) n; S" R5 d! w8 n$ z+ w' P8 f
Although this trick calls the CreateFileA function, don't even expect to be
  v: S+ {# C; j2 y6 F: Hable to intercept it by installing a IFS hook: it will not work, no way!
7 t" e. k) n" m) |# |; mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
5 _3 y) {3 I+ x$ R4 N. ?6 n  Jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 d  Z  t1 O+ T* h% P4 G7 o9 B
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 H# T3 x1 n5 S; t  j6 T6 m
field.
2 c7 X2 S( y' D/ i2 _# IIn fact, its purpose is not to load/unload VxDs but only to send a
5 x8 k; o7 E- ^$ }) _$ e- bW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ C5 `1 T/ n( g* i: M& {+ k( M
to the VxD Control_Dispatch proc (how the hell a shareware soft could try& [. @0 ]$ B% m7 W! F* c
to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 I  P2 N8 t/ ?
If the VxD is loaded, it will always clear eax and the Carry flag to allow' Y- ?0 O; ~/ n" P4 x# a6 X
its handle to be opened and then, will be detected." U$ H2 ~% s7 P  a) f9 o
You can check that simply by hooking Winice.exe control proc entry point( U8 T( F$ F. q' k1 O+ q- o
while running MeltICE.
" l, o- R8 a- T  s4 t' Z" Z- Z4 w( U
8 i& ?+ z+ f4 ?- r; e* k3 p! w# t
  00401067:  push      00402025    ; \\.\SICE
/ @) W* U" G! ?  T; q- S6 R' t  0040106C:  call      CreateFileA9 I5 R5 M) S# ^$ W
  00401071:  cmp       eax,-001# a: x7 T: M$ h" @  o# b- r
  00401074:  je        00401091
; S# d- A3 b8 ?& k3 J1 `1 i8 i2 |: b

5 D% y9 a8 K  @8 F0 N& w5 e' @There could be hundreds of BPX you could use to detect this trick.
1 M7 k1 b6 @' Z% L; j9 n( b$ Q-The most classical one is:
; b8 `  x4 Z0 D1 r# I  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
: L! m; V/ H' D# s1 H) M    *(esp-&gt;4+4)=='NTIC'5 R$ z1 H; \1 _1 F8 H8 o2 C

* M( U5 X) ?! R/ u-The most exotic ones (could be very slooooow :-(
2 {5 u" O# ^# ]2 p0 v   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % _3 f; ~2 |6 @. A" x& f6 j
     ;will break 3 times :-(
. X! c+ T& C% L5 z: j2 y) s( U! \5 b6 x) @- J# t
-or (a bit) faster:
  k* e8 r* Q$ G4 v   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 B/ O1 N+ M& j/ v0 N' d; L+ o2 s- w1 l2 A- r7 n
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 R5 B7 L# `% K9 `% G9 p     ;will break 3 times :-(5 e$ }" t% W9 Y) l/ m) W0 t3 s* g
( c0 {4 k( F) P% m
-Much faster:! D1 Y. x- D; z$ K# f, E+ b0 v! l5 S
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( _3 a7 {! z6 o  P6 |, c

+ h) o4 y4 K5 Q1 i) Y2 Z7 kNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
5 c! h+ D; A% k$ j- ~# l8 I; {1 _function to do the same job:
( E/ I1 K/ D8 A' Q2 t% w% s! V8 {; s) G
   push    00                        ; OF_READ
7 ~4 M, i. p+ E6 ]' u   mov     eax,[00656634]            ; '\\.\SICE',0( u# P6 `! K* ^) O/ O  g& N
   push    eax
- j* m; X; s: {8 i7 i# C$ a   call    KERNEL32!_lopen3 s9 C$ [& R5 t; O' I. T) G
   inc     eax* n. }; f, J0 a
   jnz     00650589                  ; detected
, k! M3 S) Y% @; |   push    00                        ; OF_READ
1 Z. G6 C9 u# b# Z: q   mov     eax,[00656638]            ; '\\.\SICE'" f. S( ?# O$ v0 F7 U# C& U
   push    eax& W( M: p+ o7 ~5 s! T4 M! Q: w9 J
   call    KERNEL32!_lopen
( s) Y# O' }1 ^+ `7 p, a   inc     eax
9 D* J5 R) e; i. h/ t) s   jz      006505ae                  ; not detected3 Y  r( [  s" I  V5 ]- R  v
4 d* b1 ^9 w( v: i2 _; C; h' X

3 Z2 D  x8 j, [4 m% Z__________________________________________________________________________/ C. E  O1 s/ c1 h

% j) L/ i2 |7 ]/ eMethod 12
) r; U! B3 d6 g3 t8 \2 W=========6 L' S  k) D; D# g
( _1 A4 T% J: b
This trick is similar to int41h/4fh Debugger installation check (code 05
3 O9 h9 [! o  c. E+ \' n&amp; 06) but very limited because it's only available for Win95/98 (not NT)
# @, R( L$ u7 ^" p3 Ras it uses the VxDCall backdoor. This detection was found in Bleem Demo., `1 a5 s$ X0 Y" P3 c

: H) v& p" `  K) A, L% y0 K   push  0000004fh         ; function 4fh
( d* g6 c& O/ U% w   push  002a002ah         ; high word specifies which VxD (VWIN32)
, _7 e8 s4 n8 z, i$ Z                           ; low word specifies which service' t& j9 b5 X& u/ M5 [1 X' u, A
                             (VWIN32_Int41Dispatch)2 g2 V+ U: W+ }# h1 ~
   call  Kernel32!ORD_001  ; VxdCall
6 R, p" H# X; A/ V   cmp   ax, 0f386h        ; magic number returned by system debuggers: u! ^# U  {% a+ G0 _  B
   jz    SoftICE_detected. v% R' y; W7 P9 ]  \

* ?1 P+ S8 w' `& Q1 E8 ZHere again, several ways to detect it:; G  x3 m! g* L- N3 ~8 e
4 r& J# J2 g( K
    BPINT 41 if ax==4f
, K8 n  U- {5 w# ~0 q
8 @8 Z8 ^  @( s  j    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) q. R; I" t0 b% S% a9 X. k1 C/ l! d6 w, I- X! e9 a* u1 r
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( W' b8 h( Q/ _9 k- y
$ k' M# u% k; z# ~# m& X, i8 b
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ q2 m' c+ g  N- _4 q
+ ~2 ^' S% q3 D__________________________________________________________________________
( ^; r7 r% D$ {& j0 n3 Y1 ?' K
& m6 w  Q+ U) O1 W  `; D, lMethod 13
* Q8 V/ r+ A3 v=========
5 R9 f( a* A2 x5 c$ [. O! Z5 c! a7 M" q; C
Not a real method of detection, but a good way to know if SoftICE is
. w8 x! n: V4 u. p) {( L" linstalled on a computer and to locate its installation directory.
! R8 R' f2 p& tIt is used by few softs which access the following registry keys (usually #2) :* `1 {# U6 t) S$ y: M7 e& U$ n
2 Q( Q& U" |) c
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' e. [" T+ o4 m  s
\Uninstall\SoftICE
+ ]8 o, K* m; C8 o9 _' b& M% k' P6 A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 F/ {: Z0 T. U2 s8 ^! [
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, f) B( ^: t+ Y' V
\App Paths\Loader32.Exe8 [: ]- k- L5 u
& T" n* K; Y  t) }( |& [; `7 D* l

. s7 i! N* q6 N2 R8 V, D# qNote that some nasty apps could then erase all files from SoftICE directory( B% i* l) w$ w! D: W. I
(I faced that once :-(
/ o; h6 f# |! X7 D# o! y) a/ T% u; y
Useful breakpoint to detect it:, u% l$ y0 O! X5 o" ?

+ a: [$ @* i8 e8 {$ H     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ z" w& L! R5 r/ R, W( H/ |! \/ [
* b4 k& I8 v2 Q__________________________________________________________________________( n7 B0 N2 f! I

: q& w& _5 C" U' h$ \" Y' M- H& I& I" m7 p
Method 14
3 ~+ W; ?6 b6 R4 X=========
* M* B7 z2 ^0 Q6 Z2 d0 e$ Z$ M: j/ c/ q. Y& p/ j  r
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 [4 e# F* h3 e# xis to determines whether a debugger is running on your system (ring0 only).
, E0 J3 S- D" X: x5 b' v# `) i' U1 e& D, {
   VMMCall Test_Debug_Installed; }3 B/ ~7 p( y+ @# [$ D. A
   je      not_installed
% o: {# {; v; G9 J4 I
" r9 b- H7 g9 C+ yThis service just checks a flag.7 N- ^' b+ K  C% k- z
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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