About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
! W7 I2 W& c" p' y<TBODY>& f' `: ~1 v! l$ V2 p" ]
<TR>
; i* E: g" N6 J" w4 D  M0 s<TD><PRE>Method 01
3 W, _; p; r. O6 C7 D=========
' i8 }  [9 d" I! f; Z8 t. k, j* h  b2 f7 k6 |" b# @* r7 R
This method of detection of SoftICE (as well as the following one) is
6 u. p* S3 s( T$ h8 Tused by the majority of packers/encryptors found on Internet.
! G/ `" Q4 U2 C1 s& PIt seeks the signature of BoundsChecker in SoftICE3 ?) J/ f: f5 O
- F+ ?! n( \9 @
    mov     ebp, 04243484Bh        ; 'BCHK'
0 u( f; i! O; C" U3 h7 ]    mov     ax, 04h
5 h1 t3 R- ]% M! _6 d    int     3       + f  A8 ]2 n# d$ T
    cmp     al,44 d- M2 r- ]) R- m# w5 D; @
    jnz     SoftICE_Detected3 Y, [4 @+ e) p/ K6 i' L
: \5 `  r/ i+ i5 E& q7 l
___________________________________________________________________________
6 G. k1 F( M4 b  b7 _2 o( i2 ]3 @7 j6 G7 {- u* _$ g) [1 q
Method 02% P1 r4 W2 v/ `
=========% h0 I6 l3 n: f& O1 D
6 U( {6 p- M4 Q) u  ?* i
Still a method very much used (perhaps the most frequent one).  It is used
" c, ]* X0 ~1 w+ rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
- H: Q; {- Y; zor execute SoftICE commands...
# y& Q0 q1 a5 t$ H- p/ d. C. M/ _It is also used to crash SoftICE and to force it to execute any commands
1 U2 s! r. [% F! ?- h7 o(HBOOT...) :-((  3 d2 r! z6 o9 o) \
0 \1 S7 N2 Y( h* t
Here is a quick description:
3 O; L3 ?  Q* }  k: t8 s. j-AX = 0910h   (Display string in SIce windows)
, X, Q. ~0 e3 F0 K' B  Y3 [; K-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 \6 w& q9 Y( y9 t0 {- B-AX = 0912h   (Get breakpoint infos)( k& P/ F2 Z3 N' D- o
-AX = 0913h   (Set Sice breakpoints)
: d& r/ R- _9 g, H2 q-AX = 0914h   (Remove SIce breakoints)6 E$ q- y8 s$ v4 j; c% g' f
4 u" T$ |4 S2 Z& G# J8 E
Each time you'll meet this trick, you'll see:
) _. Y9 G- d. L) k  p3 z-SI = 4647h
. L7 b. E% ?. x9 j-DI = 4A4Dh# I) M2 [6 Y- K
Which are the 'magic values' used by SoftIce.' w* N) S; F0 b; e
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* E9 x7 E8 p. H- D% ?
( |9 F& T4 m' n) c) B8 B+ b
Here is one example from the file "Haspinst.exe" which is the dongle HASP# q' e: A( M1 G3 d# L* t; o
Envelope utility use to protect DOS applications:! b, r* @1 |& R2 ^! W6 b+ ?- o
7 j1 U' r$ C. q
5 J& B  R  X4 Q+ }7 N8 H/ ?
4C19:0095   MOV    AX,0911  ; execute command.
) r. D: _7 w+ A2 U( Y0 Q) b1 M4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 K5 Q/ R6 d1 w3 ~( k2 K4C19:009A   MOV    SI,4647  ; 1st magic value.
  j1 h3 v. N, }5 [4C19:009D   MOV    DI,4A4D  ; 2nd magic value.7 j3 p( z, B8 v+ t2 i
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), I/ |0 M& |& W  }: U6 k% k9 M
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: J" S3 }4 m% _' }8 [
4C19:00A4   INC    CX- R" S8 h- F# y0 Z$ R7 y$ W/ z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( {( p8 ]: r) r8 ^
4C19:00A8   JB     0095     ; 6 different commands.- a( g+ K! E5 |& t* X1 K8 N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 d& w! T: N( ?1 m  h4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 J1 `2 u6 R# h: _2 H7 }8 A& p" d- n
The program will execute 6 different SIce commands located at ds:dx, which
$ Q( Q2 T5 r$ ~$ A# Oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 S7 k1 v& |5 _% z. b
3 P  ~/ r9 \9 D; [* |( k( U+ c* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
7 \( }# f$ ^" D9 g( _+ }___________________________________________________________________________6 E5 _4 J1 r$ X0 j
( b: V1 T6 Y- X& T

' L/ A% x: M% {# VMethod 03
( p7 L) Q, |# Z$ ~8 E2 I=========
" T! f3 F7 P$ y- c2 W4 j3 M
0 O, n( h' p9 d! f0 Z& O0 ^3 mLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
" ~; D! Q# m6 C7 A(API Get entry point)4 `( R% `/ ?' Z7 k# a; x+ B
        
2 I* @/ C* _! a  e" [$ |
% \1 r: u$ k: V    xor     di,di
5 L# C% {  h7 W% K$ s1 h    mov     es,di6 y( y" t! x+ b+ b: B3 X( K
    mov     ax, 1684h      
1 k7 w$ l* u" G% M8 Q1 B7 \    mov     bx, 0202h       ; VxD ID of winice
/ E# Y/ k& }  R5 }2 d5 s( _8 y    int     2Fh7 A, b' F4 s$ A& B  A# }
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" ^' F/ H6 x/ P4 f
    add     ax, di
; C; f' n2 i4 v    test    ax,ax
5 s# m3 Z% @: f; w% L! [  W6 t1 P' R    jnz     SoftICE_Detected5 j  ^$ C, U8 [' b  Z! `
) ?& K7 I) \8 K3 A" |" k
___________________________________________________________________________( k9 Q! j' W1 f) V

: v. i6 b" ?8 S) rMethod 04( E  k5 J4 ?5 L5 W1 e
=========0 }7 W# B% h! F& Z' M3 m( R

3 a! i6 g! p* KMethod identical to the preceding one except that it seeks the ID of SoftICE5 H, `( E( b  ]& _- M
GFX VxD.
, K2 u  G2 p% h, F: w) `& F4 C; _# {$ N
    xor     di,di; t; {8 ?" x3 I7 j
    mov     es,di5 M5 F% e5 R* C3 \5 B: _
    mov     ax, 1684h       1 A2 D3 s+ A, O) U: {3 }
    mov     bx, 7a5Fh       ; VxD ID of SIWVID  V5 Y& z6 R; z5 Y) O" }
    int     2fh3 C: P  F! q$ M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 n1 h8 c( D/ g6 Q1 C1 g    add     ax, di' c" {, X8 k' C5 ~: E, V8 H
    test    ax,ax! {- a7 G+ W" {
    jnz     SoftICE_Detected; u8 T- b  [* C

: ?* ]/ c$ v+ r' n__________________________________________________________________________; P) O7 b% r: D
* f; I6 _( b* L% G; r

4 Q7 o, v; j7 mMethod 05
5 a/ |7 a7 Q* n& |/ E. S=========
2 F! \; x" L" ^, C. V, A8 c7 l/ V$ G* c9 w
Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ ?- B0 R5 e7 }& \5 F& Pdebugger. It calls the int 41h, function 4Fh.
: @( g7 o9 E$ X0 r6 CThere are several alternatives.  + z% O# a0 L, p/ s

8 [& I% V- w: m# a1 d; m! J7 `The following one is the simplest:
0 I: }. t. @* r# L2 q$ U' ^" m& I# v' [9 x# S
    mov     ax,4fh- l, g4 H! z' ~( S" S$ B
    int     41h
6 l$ z( h2 G) E8 @; x. _. H7 l/ w    cmp     ax, 0F386! J. P. r' K; d( F& p8 B. p
    jz      SoftICE_detected
5 x2 J! P: s; x" @: S* @6 `' F* I( K! ?# M4 H" r; j

( v$ l2 G! k, x/ ~. z, uNext method as well as the following one are 2 examples from Stone's
: o* |! M3 d) @! u! u' k4 b"stn-wid.zip" (www.cracking.net):
( M/ D9 ]6 Z/ T; J! |# I0 R/ p1 `# O4 J, y. C- M$ g
    mov     bx, cs; \  F4 G4 L, ~( p
    lea     dx, int41handler2
8 X$ X) a7 ~; a1 W! I8 y    xchg    dx, es:[41h*4]
3 p3 S: Q1 |( g) j9 x/ @+ u' [# _( J2 D    xchg    bx, es:[41h*4+2]% b0 r* [- a: Y3 E  ~, ]# F
    mov     ax,4fh6 W, w; Y! K- a- d
    int     41h8 b1 ]% k* R$ Y' ~2 G/ i
    xchg    dx, es:[41h*4]
/ R, ?6 _2 B" P! G" z    xchg    bx, es:[41h*4+2]! @' ~0 u% F7 \1 k# L4 T; o
    cmp     ax, 0f386h
$ O9 t$ y2 q# S# F    jz      SoftICE_detected
. E/ L1 ?+ ^! B; }# ?7 L0 P. ~. i' ?! e6 e% S
int41handler2 PROC" f; t2 }3 k( W
    iret
) N; Z7 I$ i+ s. fint41handler2 ENDP
; W9 O' \3 B6 b: R
4 @0 y% \8 Z# [6 p' z
% f, _* N* R+ m! t7 ]_________________________________________________________________________4 M) y% d) A: O

) {% ~& D2 u) n. a- P4 L; H, A# Z" V! F! o. }+ _; E+ X
Method 06
. z2 s7 |. Q( Q: ^/ g* z=========) w3 [& w8 K* J1 _
1 b( B  z9 j/ v, J- J

9 B1 g" }9 s9 \+ x2nd method similar to the preceding one but more difficult to detect:
" Y  w5 e% p+ ~: l. o0 @
6 A3 h% ^1 H3 F- @! d8 K. N' F
# N1 d, q# `" e7 ?int41handler PROC
) l" a/ _, p" W    mov     cl,al# c3 \! w: F% [# j* H& l, T0 o
    iret" a( G( W8 I6 x2 S& t3 `& F
int41handler ENDP2 y% W; G' g/ s6 m: u
, h# a+ r1 l6 g5 }9 {8 Y

) [8 Y1 W- B' T# k% N% D! z$ t. Q    xor     ax,ax
# a, k7 U9 h6 m    mov     es,ax6 W4 N5 o  y2 Z2 z4 _1 v+ A
    mov     bx, cs
. T  j$ g: `, ?    lea     dx, int41handler+ ^* g% [1 N. S' q+ m6 H4 I  i! I
    xchg    dx, es:[41h*4]* i  a$ |8 b& c- t" D: O+ q2 h) u
    xchg    bx, es:[41h*4+2]7 z2 B  _: P# {) ]6 D- P
    in      al, 40h
+ I! U- k  O% H+ k    xor     cx,cx1 q& q3 \: g$ O6 N" d4 {
    int     41h/ T& y6 z; |+ y1 u
    xchg    dx, es:[41h*4]
' n4 g: M* v6 {- z1 F* y    xchg    bx, es:[41h*4+2]
3 Y8 b) v* D; r1 J" F. S' q    cmp     cl,al+ r9 @: v5 {2 D7 k. r& e1 N$ M- h% v
    jnz     SoftICE_detected
" b0 B6 U5 G/ |+ O' s1 g' v$ s# S7 g& x, F6 ^; k1 c
_________________________________________________________________________- E) I8 T9 d0 ?6 U9 X( P" G
8 f4 g( ^& \( J1 T- I/ Y$ B, a* X
Method 07* e* r5 ~( a/ N- [! j: P5 o
=========, L1 h* ?3 v! l: G

5 W8 C3 n7 v: O6 E9 F$ {* iMethod of detection of the WinICE handler in the int68h (V86)5 k( A% i. L" f. h, y
0 w/ x0 m6 E* H" f- C  Y9 J0 Y
    mov     ah,43h9 j8 C& I& W) U: G. n# A. f8 u4 ]
    int     68h
* v2 I4 v3 a) {7 W  L    cmp     ax,0F386h
8 h- C- n+ M" X. u    jz      SoftICE_Detected  z+ ]+ G- \2 C% b* y3 L( M

  J7 U* _9 E4 @$ O) _. b  U. O
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
- W. N2 C, _9 V   app like this:
! e/ u. X# x* l" @6 J3 Y" P  @' H* ^  Y, Q
   BPX exec_int if ax==68* z2 q4 L4 K% Z+ B% Y" R
   (function called is located at byte ptr [ebp+1Dh] and client eip is8 o& a: d0 X' ^/ {7 P
   located at [ebp+48h] for 32Bit apps)7 H& d: i- W% a( N4 W
__________________________________________________________________________
* V' ~! c. t, ~+ s7 @" L# P. @) ^( k
) p2 n7 f& X& i3 m. {
Method 08$ {3 g5 @  c; C- W2 q! s* Y
=========$ g- B6 ]5 D2 j# ^( B$ L. A! L
( s6 ^, {0 N+ V( B/ h
It is not a method of detection of SoftICE but a possibility to crash the
6 {  P* g. v1 o4 o& t0 W5 `system by intercepting int 01h and int 03h and redirecting them to another% E7 \( X5 Y, J3 z# S  I
routine., z8 C( |0 L$ u( B4 ]
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: q* N3 x0 w. G. B! p* Eto the new routine to execute (hangs computer...)5 {6 S7 P. V( W% v9 n
4 _" j4 v9 z& \1 C& \' O
    mov     ah, 25h
  j* Z% E7 a+ \$ q    mov     al, Int_Number (01h or 03h)
) M  P- M2 J0 b# D5 {! R    mov     dx, offset New_Int_Routine# v+ @- K7 B0 m% x9 {% n
    int     21h/ _/ ]- S0 K6 k5 y9 x$ h/ \7 M
3 G& M, J5 J3 P* \1 W
__________________________________________________________________________
4 e$ A2 q3 ~+ ^$ r' M( j
# D7 S8 y, e% J8 jMethod 09# X+ l3 V: W  a) c  _& ?
=========8 n( h& i6 T! l, i$ T% p( u" l

- d" k. L. T: Y/ ^This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 }# q* s% f: S8 c. \7 {: H) D" z
performed in ring0 (VxD or a ring3 app using the VxdCall).
4 g+ x/ U5 X+ S7 F# [The Get_DDB service is used to determine whether or not a VxD is installed6 ?5 b5 v' Y: Q# U+ O8 y
for the specified device and returns a Device Description Block (in ecx) for0 ]: N6 R7 v7 R
that device if it is installed./ A  L9 k% \! p/ h3 }' r3 H

3 y1 S; I* z6 U3 v* u" u   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: N* i) c/ Z* |/ X
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 U, P$ ~* t5 T1 N" h
   VMMCall Get_DDB- F! n7 Z! X1 z
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 Z' h* P) O, V! X% k
& k: Y9 F2 R- s9 D
Note as well that you can easily detect this method with SoftICE:
" E4 H; ]3 i. m, g8 x* n   bpx Get_DDB if ax==0202 || ax==7a5fh
/ Q- H4 V! r% Q& J9 K9 T) c  R' t# a) F5 j+ i
__________________________________________________________________________' G: Z3 w8 ^" o+ C) _! ]2 ~

. _% P2 [4 K- Q2 hMethod 10/ ?4 n% y# i# A6 R( S
=========
, s) A' f% h5 N$ [
" U1 v: X( H5 t  M2 Y9 Q! @=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 B, B% X  u4 I
  SoftICE while the option is enable!!( y2 z; N5 s3 C3 u3 |8 l

7 h: v4 g. z* i6 P: j' c9 W. @This trick is very efficient:
9 }( S8 c" }$ m; m$ bby checking the Debug Registers, you can detect if SoftICE is loaded* a# `- \- W0 C% X1 m) H2 Z- M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ O8 k' J, g$ i% s& h: a- F; ^
there are some memory breakpoints set (dr0 to dr3) simply by reading their0 p! W% j' _& g$ Z! \1 a
value (in ring0 only). Values can be manipulated and or changed as well
3 L7 a2 Y+ D0 v2 I- n(clearing BPMs for instance)& N, c5 S% c# J% y

$ u. A2 c7 r2 Q0 K% i8 D__________________________________________________________________________; L  A3 @$ q3 E: q1 ~* h2 ?
3 s' j4 V" J* M
Method 11, x- R  s% O- m. A% U/ [3 [
=========: ^, R/ t, I2 ?7 X* c
' z$ U' E) I, x$ C" {7 H, d$ s3 n
This method is most known as 'MeltICE' because it has been freely distributed
3 ~8 K/ O0 e' u& C+ D: e/ Rvia www.winfiles.com. However it was first used by NuMega people to allow
2 N0 O5 t! D! d; F% J# f6 P, u5 YSymbol Loader to check if SoftICE was active or not (the code is located# O1 Z( P9 b) |1 N
inside nmtrans.dll).0 i. `5 D4 R, N/ c
2 m% I; D" [9 b. a
The way it works is very simple:
: X) D6 j! j" n* b# X, r8 V7 C5 M, IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 J- R* [9 ?6 T' {9 D! d8 Y9 Q
WinNT) with the CreateFileA API.: g/ k" L1 _. c+ N2 C1 s

  v9 l7 o- N8 r6 qHere is a sample (checking for 'SICE'):
- a6 ~; ?) g# p) ^) t7 @8 ^; E  W9 i' q# {
BOOL IsSoftIce95Loaded()1 n7 E( Z! F1 C9 `
{
% z. y' c; ~0 H   HANDLE hFile;  
: ?, p  X+ ^. r: O) G1 u   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
7 l3 y& z0 F; X0 z                      FILE_SHARE_READ | FILE_SHARE_WRITE,& e4 L9 ^$ \7 _1 y+ W4 T% j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ~2 k5 o: H: z   if( hFile != INVALID_HANDLE_VALUE )3 \/ U# P4 [& ~, O8 B" s  q
   {2 a: ^9 ]$ s' e0 I" K
      CloseHandle(hFile);7 z. A0 o7 A! p4 G* v- k
      return TRUE;5 B1 |+ _5 I+ Q! g8 l5 M# T' V% i. T
   }$ {5 a9 v- r; t* T9 @
   return FALSE;
. `$ H% p( o9 o& c  o8 j}
- l5 H& F1 Z/ I5 y7 W
8 E4 ^7 @0 J$ e. T( ~1 KAlthough this trick calls the CreateFileA function, don't even expect to be
/ Q! r  a# H& ?able to intercept it by installing a IFS hook: it will not work, no way!; R2 M, p% \% n8 @
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, P4 K% U$ L7 h4 G. i% \
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 n( U/ w- n3 G( l8 v$ x4 Y
and then browse the DDB list until it find the VxD and its DDB_Control_Proc5 H' U; X9 t( f, y; w7 y
field.
- Z" G/ K3 }: o* R; ZIn fact, its purpose is not to load/unload VxDs but only to send a + V- X" m7 z" t7 S" ?$ T
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 }, V5 _/ v6 A  I3 a# \2 M6 d6 k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- q4 v! k5 T  X0 Bto load/unload a non-dynamically loadable driver such as SoftICE ;-).8 J" m* Y1 M+ s7 g- o/ q" W
If the VxD is loaded, it will always clear eax and the Carry flag to allow" ?& q* I& r% g8 g! H0 C
its handle to be opened and then, will be detected.
6 W. I* S8 ?9 T. H5 s/ zYou can check that simply by hooking Winice.exe control proc entry point" B: f8 Y5 ?7 f& x# ^& b4 ^/ Z; v* s
while running MeltICE.
+ e" I" ^1 ^$ Z  y0 j1 j
! Q' v3 w! J  i+ S- H1 z3 S9 |
( @% V4 u: A: b' s  00401067:  push      00402025    ; \\.\SICE
0 Z2 P( W% F; k, H; h( i  0040106C:  call      CreateFileA. Q4 C7 J& H' G5 R/ j' s7 P
  00401071:  cmp       eax,-0013 V! |* d9 L" _1 G( M+ G7 m
  00401074:  je        00401091
) T0 h* S6 [7 R: c! J' d* L- f1 M4 K0 R- z: I$ ]4 ]5 ?, w4 a
# e" H# L8 Y, x+ l% o
There could be hundreds of BPX you could use to detect this trick.
; x  @+ |# d6 [! ~  b-The most classical one is:
/ ?2 Z7 J+ B# ?; f  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* \& d% K" l) Q$ ?5 L' R0 [    *(esp-&gt;4+4)=='NTIC'
% l& q3 X3 \/ A% b8 @
( Q0 o, k) W, S6 \-The most exotic ones (could be very slooooow :-(/ f" w" G! T- L$ ?/ R( I2 K- ~
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
$ y' ~- T0 j- h# W- I     ;will break 3 times :-(
% K/ q2 g% f" z) L2 y( t' e# y4 {7 ~7 j  d9 X# m+ o0 Z
-or (a bit) faster: 5 u7 E+ j$ B" Q$ R! S
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 G7 c; @: d! F) }+ Q5 h( C# X8 m& n$ I3 u( Z- w8 U
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : Z) g# V+ Y+ F+ ]
     ;will break 3 times :-(/ [; J9 N4 l2 y- z
" ~( e; s$ K# j/ p
-Much faster:$ M, }. g1 A; u* e% t9 r4 E+ \& p
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
) n/ b0 X. h. m; p+ C5 b# [3 ~& u! @' u# l" _2 y
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen! V# u, \1 D) F/ c. L
function to do the same job:
: Z3 p7 L. y2 l# ^: |, h7 B+ r' h: q! G9 Y2 J1 o; P
   push    00                        ; OF_READ: l( N* A  ?$ `! Z6 X- {
   mov     eax,[00656634]            ; '\\.\SICE',0* ?: ^; B- O; n# Q
   push    eax# N( s: Y8 w, Y) K
   call    KERNEL32!_lopen+ r! M: x/ d7 d4 |' R4 ^2 D$ ]
   inc     eax1 r& k+ |" O" A- t5 E
   jnz     00650589                  ; detected
( K/ u, @6 \& C( r   push    00                        ; OF_READ- J4 E7 I" u  h( l
   mov     eax,[00656638]            ; '\\.\SICE'
; r! Q1 a& D" W  G8 S! H2 [   push    eax
/ K, l  ]2 _5 V2 _9 }" L   call    KERNEL32!_lopen$ v; h: F6 B2 H4 C9 J& i
   inc     eax# w% }1 S: c- D4 T
   jz      006505ae                  ; not detected
* F+ J7 T0 u( p0 I5 R) d; ?, `! _% y

9 S% w; G0 ~4 @, b' d0 q+ S__________________________________________________________________________
% {& l5 X  K3 h7 P! J' @
. v: _' _/ @; D+ b" v& }8 V+ OMethod 12# {. l  e7 i& L3 b
=========2 k# U0 ^3 i5 J7 p3 c+ N
  c0 k9 f6 v3 [8 x' o
This trick is similar to int41h/4fh Debugger installation check (code 05- E4 @0 X3 M& a! w' v* [
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! M6 |. o% @( Q$ b0 H8 g* `as it uses the VxDCall backdoor. This detection was found in Bleem Demo./ E* g: P* ^, L# ]) P  W8 i

: `7 g- ~  ~# v0 B0 f/ a   push  0000004fh         ; function 4fh: S+ ?# |$ b% i' J! t6 r1 H) j  j7 H
   push  002a002ah         ; high word specifies which VxD (VWIN32)  X1 Q+ e* [3 }; t/ e
                           ; low word specifies which service
% J- G! p' x3 {% \( R                             (VWIN32_Int41Dispatch)
# w  F: h4 X8 S9 J! X   call  Kernel32!ORD_001  ; VxdCall
! z6 _" y- i2 f# m# P   cmp   ax, 0f386h        ; magic number returned by system debuggers
; K$ v- S3 l3 E3 }' f% h   jz    SoftICE_detected
5 e; M  Q! X: z. ^! W3 A- |& @' ]" ~4 \8 O7 H0 |% Y: V. y
Here again, several ways to detect it:
" j( I& F1 v# P
% v: i4 z% ~* V5 U    BPINT 41 if ax==4f% M& v, E5 K  U9 \' I8 J1 _$ w$ X7 \

9 h% a% e. n( c" M- d: S    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' ?* L( t. X' ~' Z; E4 b, K9 D, B6 d( n  g
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A$ \7 t. I2 s% K9 K
2 l; X( d# M7 B3 }
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- O" Y7 X8 b1 P! u2 b. c
, S. N  _3 Z3 Q
__________________________________________________________________________
' R! U( a& X$ U& T% d. Q+ x4 ~9 {
  ~2 m9 m, c0 YMethod 13' ]8 O# C, _& W% I$ u
=========: r, B% _" e0 N, w6 H6 c
: u- x, F( a5 G' Q4 x$ S' ?7 |
Not a real method of detection, but a good way to know if SoftICE is! v2 Q- X# X' f5 T  r; ?
installed on a computer and to locate its installation directory.9 I* _6 M* _5 ~. v9 V8 Q
It is used by few softs which access the following registry keys (usually #2) :8 f2 {) E& @: {1 O; s
, }( p, U' n# x. _
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 v$ P2 A# C6 i0 K\Uninstall\SoftICE+ y% ~& S& {9 y; M8 q* F( B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ ^% O; Y' t# ^9 j; Q* v- x-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% Y8 c7 o$ W, M+ k8 T
\App Paths\Loader32.Exe, s  ?1 e3 G3 b& S  o( D. R7 \

) q$ e- ~3 R  T' A4 V% Q
) J8 j$ j' p' I; }5 M  ~Note that some nasty apps could then erase all files from SoftICE directory
4 w0 T2 y, j5 E/ I(I faced that once :-(: v  `7 D. s" X8 y' }' S8 J

9 J) M' P. z( O# R9 |3 @Useful breakpoint to detect it:
+ B: Y- @: u9 F0 r5 A6 Z) s5 q$ y1 ~' a2 i  T7 P, g+ c# M+ H; J
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 f; K# i) Y& H- T+ s

* s+ @$ r; _9 k' y) F" Z# F__________________________________________________________________________* \" p& m+ G( t. k: E
. E- j9 @& W& s# @( d5 W1 |4 F

3 _, ~* f0 O# JMethod 14
1 Q9 ~# ]# h4 }( L4 {, G7 i, j=========
. R4 ~$ l/ [2 X. X# c
7 I7 t- x. x, }1 n( K, A0 hA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, m/ i& p, x$ I0 c* Z
is to determines whether a debugger is running on your system (ring0 only).9 W7 m& l# i. z, T: b  n" n
& P2 s3 C* |8 d4 L$ y7 _- @
   VMMCall Test_Debug_Installed$ e# k% Q& O) a0 \& ]  b' G
   je      not_installed
2 r" c. j3 j9 Y- V* o% M2 A: H9 K5 b; Y( D7 ~' L; K
This service just checks a flag.1 s9 P' @4 }9 A
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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