About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% p4 `8 j4 r3 y( v5 B" a$ O1 h<TBODY>7 w% ?* s! X' c+ _: F/ F
<TR>
8 \. \7 T0 I- o4 M' G/ a<TD><PRE>Method 01 1 g! B' ~# D/ U  G8 b
=========# F/ ?& s; `* s( t3 t" I1 Y: m
2 C0 Z' S' j' e
This method of detection of SoftICE (as well as the following one) is
1 p$ l# i  e+ Z* p! Q0 Yused by the majority of packers/encryptors found on Internet.( I0 r  R1 s7 Y, G; r$ o  e
It seeks the signature of BoundsChecker in SoftICE! X) q- ]1 V8 ?% r/ n) @

" C5 L5 B0 ^% v+ l5 _: n% U1 y    mov     ebp, 04243484Bh        ; 'BCHK'8 ^0 w+ L1 [) u$ I5 ?! T
    mov     ax, 04h" ]4 C7 h# ?$ ~
    int     3       8 H3 _. H; a$ s/ }$ p* |
    cmp     al,41 r+ I( D$ T' K4 y5 S
    jnz     SoftICE_Detected" o( U" _3 h9 A# S8 W5 e

2 M" ^- b, `: w" _- c___________________________________________________________________________
# |# @3 R5 I2 \, \' j4 ]9 E6 ^) j  G& @0 _
Method 02
# t3 Y+ ~, [$ q) {" T; u% ?! |- ^=========
- P/ E( X; H% H( }5 t7 x$ v' c
Still a method very much used (perhaps the most frequent one).  It is used4 V/ C( y& e5 L9 g5 W, E
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ Y7 X  D# ~9 ?3 h. Jor execute SoftICE commands...
( ?0 m$ Y( \1 ?& l% `& TIt is also used to crash SoftICE and to force it to execute any commands
, n3 P& q) ^- t  r2 O  P6 j(HBOOT...) :-((  
4 k5 K) V+ P0 [9 {5 f, ]; J- J7 d5 r" x8 K0 E9 c" @
Here is a quick description:
; V: J$ N( A3 X/ l: z0 [( |- Q$ ?-AX = 0910h   (Display string in SIce windows)
8 u  E: m; k# ?+ V+ r-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- j. e' i5 d" C; ]+ U6 e4 G1 D
-AX = 0912h   (Get breakpoint infos)
) S! \2 n. C5 u% R-AX = 0913h   (Set Sice breakpoints)
$ O1 P3 q9 l" B6 n. O2 o8 C-AX = 0914h   (Remove SIce breakoints)1 k7 d* `* q* i0 _* {# f& g& |3 y% V
0 t5 ^& u2 G5 f* @
Each time you'll meet this trick, you'll see:
6 ?# g) U- [' E-SI = 4647h% h: ?( X* i* w$ |( ^
-DI = 4A4Dh
1 O- {1 Q4 H: M* j( L" q$ vWhich are the 'magic values' used by SoftIce.. [8 q5 }" ^& w
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
5 L* L0 d$ Y8 S3 f  F. [* h; ~/ h4 J8 f* C0 W0 l
Here is one example from the file "Haspinst.exe" which is the dongle HASP+ S. T7 O  I$ n$ Y0 Y# J
Envelope utility use to protect DOS applications:
4 T5 {2 ^8 ^  K& d- Z# n- [/ v- w9 s
$ w0 g/ }8 N7 V% D6 @3 Z. Z& I/ x' \, y, p
4C19:0095   MOV    AX,0911  ; execute command.2 N% K9 J5 e' k3 \
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
+ W8 f) v: k  s- r$ d# k4 d7 N; X% o4C19:009A   MOV    SI,4647  ; 1st magic value.5 w4 Q) b/ m* s9 K; o4 |
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" l; G$ ~0 n5 _0 F, w* A# r) H! [+ d4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 d' v; g4 {. E" x
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  T* z# |/ [2 A8 @) Y
4C19:00A4   INC    CX5 c& r! B9 \1 o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! f; c' n& C% S6 ^8 `  O4C19:00A8   JB     0095     ; 6 different commands.2 c/ h+ E& g) z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; f) [+ u8 ~; y! ^4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
$ R9 R) h* H  g) ?5 k. P! u
* B  t$ e! W. c, d( yThe program will execute 6 different SIce commands located at ds:dx, which
1 ]+ r" ~( t7 D3 K- o# A9 ]are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.7 e' t7 n! t9 U+ G

* a+ w, ~- x& \5 z* I' f. u* O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( n! Z5 r/ v# ]6 N& ^6 D
___________________________________________________________________________. E0 A- R5 p9 A7 d8 B

) A9 n: W- F' C2 K8 A) |8 `8 x% I% L6 g) E) j7 {
Method 03/ c1 A9 |% j$ w4 H' K8 A
=========2 G. H# K6 ^! W8 S$ ]
, g7 w3 e/ o' n# [" `
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 c' `; p1 D# F8 R
(API Get entry point): s6 F: ^7 ?: V, q6 K
        # m6 Q) X6 g6 X; v$ R; X
6 R1 Q7 o" b! f& [) Z4 q6 ?6 O
    xor     di,di
. y8 m, R# s2 O& w' x& ?5 w  o5 g    mov     es,di
- t+ D% k, I; U: j    mov     ax, 1684h       9 h; m9 E$ A1 X$ z( B- o
    mov     bx, 0202h       ; VxD ID of winice. w) m. q+ o$ c- i4 x- l- e; W
    int     2Fh* q- Y/ x4 `* i2 L' d/ V/ K0 O) G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* u" M1 M# L, d6 _5 F* [& o/ l
    add     ax, di& L( u  J9 w! I0 ?# _4 t) k
    test    ax,ax
# R+ V8 x3 u3 m9 w    jnz     SoftICE_Detected( |0 p2 D+ P' K% D3 |* \

! ~2 l7 r/ I: L___________________________________________________________________________5 l$ z- }3 z/ t3 L# h
) m% O: Q8 {  x) j; F
Method 045 N; k, K$ v$ V, n( x( z
=========
% K/ k0 N$ C: z9 k1 Z* @+ t/ b% S" w; Y/ {1 i
Method identical to the preceding one except that it seeks the ID of SoftICE
$ I- R. B. V" n* YGFX VxD.2 @5 Q. o* d) ]1 o

* m) T  x4 B2 _7 E& V    xor     di,di
) q# t! K& z2 h8 Z2 |$ ^: N$ }    mov     es,di, h4 y- w8 ~3 C  k6 `% }- U3 R
    mov     ax, 1684h       9 ~4 L6 K& ?, ~4 n* m# C
    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 L: n7 w4 B" ^3 |2 U0 i( o1 v) u5 ~
    int     2fh
6 U; o% |  C% H7 K    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 ^  E8 Y7 |  y& U    add     ax, di3 g( _9 A" s! c( H' u
    test    ax,ax" ~5 J7 V2 I! S. i3 {
    jnz     SoftICE_Detected5 V- J$ N0 x+ Y( \4 T# `5 F  i9 M* v
/ A1 {  U6 I6 M* S7 o/ Q' }
__________________________________________________________________________( r, d4 q8 d1 j' }  K, H% o

3 Y# R- h& X: z4 s4 u& U( D' z
% C) g- U$ O$ P# yMethod 05
$ P7 R# j% m6 @  e2 [- i- B=========
$ Z  E7 r# I1 t2 O( x: G
! t" ~' H; b6 b" N# tMethod seeking the 'magic number' 0F386h returned (in ax) by all system
4 G2 r7 h& M  E0 l+ K2 wdebugger. It calls the int 41h, function 4Fh.
1 V/ V9 e- {1 W& j  n8 z$ _There are several alternatives.  # @( b/ b! {0 l

0 R  g/ z7 S, S! O* B( i  \The following one is the simplest:. f2 }. e9 [! N  L+ E# L

7 q# ]& z# p) J  `    mov     ax,4fh
5 V; Y# @- O3 L3 y$ G9 i    int     41h: z* u% e/ u- T5 D1 a4 i1 Q
    cmp     ax, 0F386
  ]  g2 e& o7 S! s( F) v( p% E    jz      SoftICE_detected
; I8 D9 F4 J$ \( K, Z( S
# M2 @0 Z  D' S% [7 C0 Y" ?" @# J6 E1 g6 k- `
Next method as well as the following one are 2 examples from Stone's % h- `$ A( L& K; }" m2 L7 S
"stn-wid.zip" (www.cracking.net):) [  i  H$ x/ v8 D: l
8 E2 b1 W& o+ Y4 D5 x2 T" U; W" g: ?
    mov     bx, cs
/ T# p' [3 g8 i; Y' W    lea     dx, int41handler2% X  q1 v0 L/ k7 V; [
    xchg    dx, es:[41h*4]4 N2 w' g: Q- Z+ o! s: M- f
    xchg    bx, es:[41h*4+2]
+ H! p; j+ B; V    mov     ax,4fh
  B4 i7 Y, V. W" [9 U8 d0 t9 H    int     41h6 P% t8 x9 |, Y% \$ w8 o" T
    xchg    dx, es:[41h*4]# B0 g3 j+ r: `
    xchg    bx, es:[41h*4+2]
% I& M5 P6 y" O5 ^. g    cmp     ax, 0f386h
6 Y0 b& H* v. u% O# Q$ \    jz      SoftICE_detected9 c) v9 X3 p1 `6 ^, Q

. i) z! ^$ U/ u" \( E7 x& hint41handler2 PROC
; n5 c1 m: n4 [! K4 _    iret
- a& \7 F: u0 b8 E' h" vint41handler2 ENDP
# j+ F/ y7 T9 |; O$ v* k' g/ j7 |4 X% r) J7 N

7 [" n7 i5 t" m2 s0 d$ M_________________________________________________________________________
1 J. b6 C6 \. g/ f
+ f0 t# A$ U  R  J0 O: N
3 ~- S  R0 d8 K3 A4 kMethod 064 r% g* J! M7 q& E/ E2 [
=========2 C" t+ m6 G! @1 U
; Q# ~' z& Q& }% x1 \, N9 F
1 i$ @" }5 ^( x; E5 t
2nd method similar to the preceding one but more difficult to detect:9 i  C0 I+ X" h4 g
: _7 u3 m- J) @4 Y8 b8 Q+ t4 `

" v* D1 ?/ G8 xint41handler PROC
4 e! g3 n% j1 |+ L+ F# v3 \    mov     cl,al
0 l  T( L" E% q6 P    iret
4 |' [8 n) x2 s- [  ?int41handler ENDP
( h8 p- S4 m, p/ L: i( i$ ?, @  ]7 B" h$ L  {% v0 |* F

' B2 [4 B& b5 u) [6 ?    xor     ax,ax
/ ]8 R* z0 O0 E) r# T    mov     es,ax
( v- u4 b  |" B# T    mov     bx, cs
# f% T+ T) C. O% p" c    lea     dx, int41handler
2 @" C5 h! S( {8 N+ U% }9 F3 h0 _( D    xchg    dx, es:[41h*4]2 `) U, ], f9 S5 k9 K0 w
    xchg    bx, es:[41h*4+2]
# \: K) c- u7 g; a& j    in      al, 40h( s2 }# R, X# J0 @3 C
    xor     cx,cx% u! s* e) b6 y0 s/ W$ i* o
    int     41h( p( q# L5 f) ~8 S/ c, @8 A
    xchg    dx, es:[41h*4]
) \3 N' i* K+ N9 ^3 U3 g    xchg    bx, es:[41h*4+2]
; ?/ m2 H+ _6 h# [. \4 J    cmp     cl,al
9 e" ]$ w" K1 K% E# X! P( ^' D    jnz     SoftICE_detected( q% X# R% h' R& i$ T, c$ c4 W
. v6 w. V" y1 g2 r/ q  l  C. W. X8 C* i
_________________________________________________________________________
5 k4 E1 g1 b+ G* z& `' Y! z  v! V# n- g" O5 Q8 @1 R" i. D
Method 077 E& m$ B3 B8 }" J
=========& _/ v) F" a; o( V  F' i

  x3 m. B+ p" i" MMethod of detection of the WinICE handler in the int68h (V86)
8 X9 `8 m8 a1 b1 L3 S
- ?4 W4 G, U3 y/ ]    mov     ah,43h
; N' i+ `# }) c    int     68h) g! a) j. X: J
    cmp     ax,0F386h* U) B( G3 p2 j% v, F* b
    jz      SoftICE_Detected. }$ h% F" I8 v
) b7 j1 W) Z7 h, k# R6 f  F- m

+ o; c% y# I1 r- C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 M4 T! ^: Q. ]4 j  H8 M   app like this:
( Y# e. K5 |3 Y5 q8 z6 H+ B9 u8 |& @! T( V  u( m& ]+ v2 q/ E7 k
   BPX exec_int if ax==688 E$ B7 l8 I3 L) y: @& R
   (function called is located at byte ptr [ebp+1Dh] and client eip is
4 Q+ E6 M% A9 I. J9 O$ }   located at [ebp+48h] for 32Bit apps)
" I5 D8 s1 _* G__________________________________________________________________________: P$ D) b0 l; T. m$ R

8 V# Q& |' n# d* |: D
" f5 q) Y7 g5 dMethod 08
- Z* ?7 L" x. P3 v1 R=========
6 }  G. o. Y& S$ B$ ]0 r, V
! ?% h, B" N4 r! Q3 T' q. eIt is not a method of detection of SoftICE but a possibility to crash the
  p0 f5 c: c6 V% ?system by intercepting int 01h and int 03h and redirecting them to another; C7 \1 K+ L+ \, H% Q
routine.. y8 U& p; G3 `' J; Z" }
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 c' p/ \9 Y. _/ z6 a( ~' oto the new routine to execute (hangs computer...)2 b/ Q: c, C: J4 W

8 _: ]( t$ m. j' `5 A  o$ A5 e% L    mov     ah, 25h+ f$ C7 I8 x9 h7 v; `
    mov     al, Int_Number (01h or 03h)
0 g, h, y+ E6 p( @1 _6 Z, z    mov     dx, offset New_Int_Routine2 f; \6 [. Y- I. {  P, M
    int     21h' ~2 U# D2 y# v3 k. S$ d0 u. U
% O; N" O/ q' H0 I7 G6 N7 Z8 j
__________________________________________________________________________
3 \* d6 z4 M2 [& y$ L1 F: O
3 b6 Z4 ^% ?' Z3 I: p9 nMethod 09
- {. e# p2 ^" u9 F=========
$ n* q/ G" X" T! y  L  J* G  o6 i- q  a! u+ J
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only& L$ \" x/ A3 e6 L: z: K  p. H& f
performed in ring0 (VxD or a ring3 app using the VxdCall).0 I0 v4 S! w+ l# L2 Y  U
The Get_DDB service is used to determine whether or not a VxD is installed' G. w: q9 T  k5 D8 Z& x
for the specified device and returns a Device Description Block (in ecx) for: D, y7 I( x8 _" S0 o2 A
that device if it is installed.- U/ |( T$ J& [
, o% }3 ?! O4 G( u  h
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& K. r- |) K/ l" K+ _0 ?9 @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 J+ O4 j3 Z3 J( ]   VMMCall Get_DDB
1 j) I4 m+ g3 N. M   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 f5 }$ A; i* @) o) O: B
7 g" K: M; ?1 ?9 M2 u6 tNote as well that you can easily detect this method with SoftICE:
6 J  g8 }4 ]0 U" `: z. m   bpx Get_DDB if ax==0202 || ax==7a5fh; j+ Z/ i+ Z. M2 U

  |1 \1 d* R" j* [" S; N9 E# |__________________________________________________________________________* o! v$ [& f# t7 M4 P7 f$ B$ X

! O; E2 A4 {: u/ DMethod 10+ M, ^: z& l3 D+ d
=========
& q5 N  l3 ]; f% y5 f. Q, s- k( \! G# X
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 F: D% _& N( w& g
  SoftICE while the option is enable!!9 M! M4 X* E: m7 j

' C+ W! j  L6 e) T3 J9 m6 OThis trick is very efficient:2 I1 X$ \, P8 e4 h
by checking the Debug Registers, you can detect if SoftICE is loaded0 x" ~# I0 X% G, j, U8 A! `  S, c
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 m- D/ k3 ]" mthere are some memory breakpoints set (dr0 to dr3) simply by reading their
! F, k+ f& P7 N  W: J4 Cvalue (in ring0 only). Values can be manipulated and or changed as well2 Q- v  S- y; E, f
(clearing BPMs for instance)
% \$ K$ X3 \2 q1 D9 g1 x; e( E/ k* X- q) S8 ~" j
__________________________________________________________________________# q# l' ]# K4 g- Q) P, y
# l* r) s' J) \8 c9 D" ~9 n
Method 11
1 ~4 n2 H6 {1 K5 B2 v7 X- b. ]=========' }( J6 ^9 G! o& ]

9 R' s4 }# S1 q. XThis method is most known as 'MeltICE' because it has been freely distributed9 ~8 Q& r9 t! v
via www.winfiles.com. However it was first used by NuMega people to allow
( L* y9 J2 o5 N9 b; E# Z( V4 {Symbol Loader to check if SoftICE was active or not (the code is located
! x* |6 c# I7 Z3 x1 e3 A% Qinside nmtrans.dll).$ _# Z) c' l  ^2 G4 a+ l5 r, r; t
2 O6 s' a' ^6 r! U/ s% a$ O
The way it works is very simple:
. l% n5 q+ R' P! i+ s4 P5 c/ s4 FIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 Z. W; K: o* G: Z" |- ^( a) sWinNT) with the CreateFileA API.
4 v+ {8 `& }) V* v6 }$ u1 |) M
5 y; a7 e$ l9 _8 p" x$ s( wHere is a sample (checking for 'SICE'):
9 g9 p- P2 H; ?' y" S0 h6 [! _6 Y0 M/ q: M
BOOL IsSoftIce95Loaded()
2 J1 z8 Z* [  t: `{
; V# q/ c( Z. y   HANDLE hFile;  
$ r5 A; B! C( d( y: g+ _   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
9 q" e, J1 U  o) E6 b# H# {                      FILE_SHARE_READ | FILE_SHARE_WRITE,2 O! h6 ~4 q* E+ E+ ]6 F3 [
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 }, A( e( s& j) d. J, h   if( hFile != INVALID_HANDLE_VALUE )/ D. \  z& r6 Q. |
   {  v6 W1 s4 O# X7 y* h
      CloseHandle(hFile);
6 k' Y2 ]& k* C7 A      return TRUE;* ?" R) {: Y2 z0 k9 x4 f' B+ U
   }
6 v! \) Y; i3 y( {( u   return FALSE;. K( w) [- l) F0 l: J6 b) N
}
! d) G- L. `# ^) r" c. D+ V( Z& U2 J2 Q: t
Although this trick calls the CreateFileA function, don't even expect to be
) F8 U4 \2 M+ F: Z& J3 Rable to intercept it by installing a IFS hook: it will not work, no way!
+ O0 d$ z% U) E, h3 ZIn fact, after the call to CreateFileA it will get through VWIN32 0x001F! @/ f1 e3 J; l# T$ W
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! ~  ]/ ]% ^: M; h# v, |, U9 Iand then browse the DDB list until it find the VxD and its DDB_Control_Proc, |3 w3 Z, z' W) j1 O
field.
0 s. A9 Z, }2 k' A0 d6 uIn fact, its purpose is not to load/unload VxDs but only to send a - P+ k" ?$ h+ u/ |  y7 x/ J
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ m+ k+ T6 {0 J3 x6 I5 Q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
. }9 G/ Z; h  T& q- u. Q- K2 t$ nto load/unload a non-dynamically loadable driver such as SoftICE ;-).: A' o; g$ H! ?9 P
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* H8 d& c$ g/ ^& j) w, Bits handle to be opened and then, will be detected.
- f/ x1 S" j. ~You can check that simply by hooking Winice.exe control proc entry point/ n, \4 X& m5 V2 `
while running MeltICE.
) x  ]+ Z3 ]5 `/ m/ u8 v1 L4 ]( e2 R  @
3 u: n  w, ^: H; Q) N0 A6 m, j
  00401067:  push      00402025    ; \\.\SICE6 m- K2 _7 F! X. b+ \
  0040106C:  call      CreateFileA9 C. C+ g+ ~& I7 J. B0 P
  00401071:  cmp       eax,-001  p% p, p* E) u2 G
  00401074:  je        00401091$ A3 E$ C9 A4 e

# \& k- D6 e# a* z. L1 X# u) N" c2 i* E+ o+ L' z' G8 n
There could be hundreds of BPX you could use to detect this trick.8 {3 E1 b% H/ ]$ v* k
-The most classical one is:
& L7 N  K) W5 n( @  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||& R& B; W9 k" W& I
    *(esp-&gt;4+4)=='NTIC'
* a) q' o# p) U8 P
: ]6 G) I1 O& ]8 h1 q: v9 p$ [. S-The most exotic ones (could be very slooooow :-(0 O7 @. j4 g' l3 `0 j
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & }# r0 Z: H! X' X  T
     ;will break 3 times :-(
- C  O# H. g# Z  z- w$ x4 b7 {$ f' B; ^! z0 |
-or (a bit) faster: ( J. c" T8 b: r5 N3 C! q8 z) d
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 Q! I: s. [# D  g: {& Z' {

6 D$ F" }: Q4 B$ j4 ~6 \   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ; B  u) T% U& ]+ I
     ;will break 3 times :-(
) `$ q0 F5 ]* s6 A0 Z; x1 l, }7 ?' j6 Q9 u$ D4 D
-Much faster:: a+ `9 G9 w2 [3 d1 C( V+ I/ u
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# o/ \0 O7 A: n+ c

2 R5 V* o' K& FNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 c" h, y9 [! z% I4 I6 ]function to do the same job:2 |. ?. s( Y9 S; J7 _* K, b* j5 q
% f$ B$ h  t$ v+ b% i; Y" k! T6 g
   push    00                        ; OF_READ
" t1 S; l+ b, ]+ B   mov     eax,[00656634]            ; '\\.\SICE',0
9 X, ~( ~* d$ N2 Y   push    eax& l/ w$ a0 ^$ k9 U- A
   call    KERNEL32!_lopen
8 V2 B% r2 n9 ?) m* ~# k0 R9 p   inc     eax' `7 L0 _, O8 o
   jnz     00650589                  ; detected5 o4 }8 v3 F+ [3 K
   push    00                        ; OF_READ. Z# |' G9 _. ]6 H1 Z- U: z' q- ]
   mov     eax,[00656638]            ; '\\.\SICE'% f. v6 A. z0 ]0 Z4 [9 G
   push    eax. B) t5 \3 x6 X# J5 x, g, G
   call    KERNEL32!_lopen: `- m& h! d9 g( Q& J+ E% ?
   inc     eax
: R! B. f, i6 H& G" B- t   jz      006505ae                  ; not detected
2 L9 S0 e4 _2 N* s9 T/ D' [1 @$ \- Z2 R: u5 D% i' ]
+ O& z. V  X5 C! Y
__________________________________________________________________________( e. ?  n) \) {1 o; E

# F+ C+ x+ p) b  R% ^Method 12* T/ w9 b1 Q3 l1 N
=========
$ k: K  H4 O1 D& \/ t! p! F! D+ V9 L* i& @3 D3 ?
This trick is similar to int41h/4fh Debugger installation check (code 05
1 ~; v6 B! j% e9 u3 O0 L3 }: K# m&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 \1 s+ ~$ i# b$ k! B, fas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, }4 K) T. p% C' f8 ]& F$ e
8 D$ Z$ N, z  Y7 x5 n9 q4 e+ q   push  0000004fh         ; function 4fh
6 O! \  d/ r5 |; q/ a: a0 _, k( K! F   push  002a002ah         ; high word specifies which VxD (VWIN32)8 u+ D% E- e$ a& \: K8 b
                           ; low word specifies which service
0 Q0 D( {8 }( w" Q9 X                             (VWIN32_Int41Dispatch)
7 t$ o( ^% O" k- ?/ d" L   call  Kernel32!ORD_001  ; VxdCall
+ M! E/ @+ A. E; n! k   cmp   ax, 0f386h        ; magic number returned by system debuggers
; W# b- T/ H2 `   jz    SoftICE_detected) R1 n8 U4 |) O1 D  A

) K( }8 z# R" p' E+ Z& eHere again, several ways to detect it:
* o( d/ m$ c+ a3 ]0 K6 |
8 E! J9 r4 ^' G+ X# f* I    BPINT 41 if ax==4f) H5 O- d8 w. e$ m+ a
1 P8 v0 P. ^1 Y) V7 C* y/ K
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 s! d6 D9 }: e
: S/ c% b4 p) m( o/ }    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. M8 w7 b6 t: H% g  y

+ |4 H" L/ X2 n: p& H    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
8 A+ t2 F9 J& C( P- L. @+ R& w9 |$ a. k2 W+ `5 O) h9 @
__________________________________________________________________________+ M3 m0 _( l7 J& k7 S

  R- O) r) M, K8 `9 n6 \Method 13
, ?# D7 v' L* ^* }; N0 h3 a2 m' _=========9 ]' {8 \( J4 Z8 K. C

2 ~. ]/ M6 T& t; TNot a real method of detection, but a good way to know if SoftICE is: f" H5 ~* ~4 F% d9 Y  N. Y2 [& u# u
installed on a computer and to locate its installation directory.
2 {1 U( L2 H$ c+ U; WIt is used by few softs which access the following registry keys (usually #2) :6 F, M4 P6 \7 S( G! G8 e7 J0 i& {

" w( J* |/ h- W* x1 E1 f' W-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 f- I0 C+ r; M2 z# E$ W1 R
\Uninstall\SoftICE
! V' ~  `9 t9 M-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) r1 w0 r7 q6 {9 j
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ I0 A- F6 D! z" `5 @9 I- Q! d& y\App Paths\Loader32.Exe
8 I7 _1 Z. I8 c9 Q! r7 t
" v5 G; x, z( H* R+ r: J/ ~- s* H# a3 F
Note that some nasty apps could then erase all files from SoftICE directory# a6 T: l$ Y9 l2 O; z& W% R( g5 b
(I faced that once :-(
8 m' V& s0 g& B, V2 W1 v  [3 K5 H, r4 z8 d+ E+ f1 k. A
Useful breakpoint to detect it:6 z/ N. g8 G! ?! }, K" l

/ H+ t% U( R4 ~     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'# U, V8 R$ `% H) A# W  l; f

$ z- D# u, s# J' A( ___________________________________________________________________________+ q& P! |4 }* Q( e- x

7 q- o# Q# k  h; o' l$ ?3 W: w# J/ e4 X3 g7 A/ G) ?* r+ e
Method 14 9 B8 b8 q9 c! O: D1 A# u
=========
% y- Y, ^) d  u$ N7 ]2 z8 R7 u" w8 A% U4 }
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: V- \  [2 p4 o  p! D$ Kis to determines whether a debugger is running on your system (ring0 only).- o' i# r" i3 r1 t5 o% l. a+ i

8 m* x! I) B7 a1 }$ l   VMMCall Test_Debug_Installed7 B3 R0 D# q: x; J: l
   je      not_installed
, M: s/ Z+ b7 _. g; k- g+ ]. p
4 Z$ E. d2 |1 a- A% P* R) sThis service just checks a flag.( {  R0 G7 E0 H& s6 U# P# W
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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