About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 P* z1 o* h7 Q7 J
<TBODY>
9 ]4 i9 P  m4 U! |( ]<TR>* q# J4 x  ~. a
<TD><PRE>Method 01 : v5 t; m2 j. e% ^; X8 p
=========" Z  J, ^& q( o! W0 f. Z

7 a# C$ B" I: i2 Y7 w( f' FThis method of detection of SoftICE (as well as the following one) is
. d% \2 B8 ~+ rused by the majority of packers/encryptors found on Internet.$ o9 `/ J: ~7 J# `+ Y
It seeks the signature of BoundsChecker in SoftICE
2 X; a: Z! s- a/ U
2 ^) N9 \2 D# O* f( n9 s: [. i    mov     ebp, 04243484Bh        ; 'BCHK'* I8 o- N& R$ q- u0 L: v0 a
    mov     ax, 04h: E# M4 W: z5 _2 h5 c: o* N
    int     3      
+ e7 F1 D9 h; ?" c    cmp     al,4
0 k, x( n4 ^: o% i    jnz     SoftICE_Detected9 F* X1 u; G& P! I

* a* }) a8 R/ u/ x___________________________________________________________________________
" ~" N, r" g6 N; k- b% ^$ Y- C' y# {+ a9 R9 r
Method 026 {, `( Q* `2 H  |6 C# Z* x  D; d' o+ ?
=========
& j. r4 L1 X9 \7 {6 S4 R' k. ?5 V# I+ }: y
Still a method very much used (perhaps the most frequent one).  It is used
* u9 Q! R& r( K$ Q+ a4 Cto get SoftICE 'Back Door commands' which gives infos on Breakpoints,, P9 \* N" l8 E
or execute SoftICE commands...
, N8 \5 X# N, Y0 d) I" m2 yIt is also used to crash SoftICE and to force it to execute any commands1 a* ^- `. V! f2 ^1 q0 @
(HBOOT...) :-((  8 M& H* K$ g7 B' W' B
( T1 K9 J; m  J
Here is a quick description:
7 q% p1 A3 Z; I1 q-AX = 0910h   (Display string in SIce windows)4 B, v* l" d4 v7 y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! k& a4 ?- v" A& i1 r-AX = 0912h   (Get breakpoint infos)
% Z0 j; o* ]6 F2 s; ^0 I8 Z-AX = 0913h   (Set Sice breakpoints)- i4 @. h" `& C+ Y
-AX = 0914h   (Remove SIce breakoints)- Z4 f, E5 \) M1 _7 n
6 j0 s9 Y4 Z$ K1 [6 x
Each time you'll meet this trick, you'll see:" Y6 q" ]* N0 s9 z+ u6 `7 ?) V
-SI = 4647h- E" o- F. o* m
-DI = 4A4Dh. m  T( x3 k) l3 P2 P0 y
Which are the 'magic values' used by SoftIce.+ C3 E- a+ g3 ~5 c+ j- i
For more informations, see "Ralf Brown Interrupt list" chapter int 03h./ v0 d0 n) Z# N4 K6 o
) A  @; t9 K$ M
Here is one example from the file "Haspinst.exe" which is the dongle HASP: z" K1 k/ {( G& n
Envelope utility use to protect DOS applications:
0 t% x8 m- Q) |  P
' ~1 b$ n3 {! ]8 N% A. _& V2 Z- O
7 V+ G; R4 x, E9 {. J4C19:0095   MOV    AX,0911  ; execute command.: k0 m5 e5 l5 H4 u+ a) O$ i
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).' S' q6 j% Z5 ?; ?
4C19:009A   MOV    SI,4647  ; 1st magic value.
  B7 ~; \2 K4 P0 A: i4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 g9 t3 D' A) {; P$ j2 n/ [; M
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! |- R4 p* v1 W9 ]: p7 i  _4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
2 g9 H. A% E' |# D  v$ u; u4C19:00A4   INC    CX9 k" X' R5 `# D) |# {
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! s8 s: b0 q# `$ I8 L
4C19:00A8   JB     0095     ; 6 different commands.
7 U. a# \# O0 |2 Z2 d4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. l0 g- Y- i& T/ R( s+ ]/ Y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 P" D2 U9 f& e3 M+ k# R; H

/ J5 D& E! {% F9 J3 i- u- vThe program will execute 6 different SIce commands located at ds:dx, which$ o$ V/ ~5 B- A/ t1 `
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT." L/ [. f3 _$ I1 j4 {2 O$ [2 D
7 ]* D6 m& A- {
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' [2 i" f5 u3 i* C2 W$ T___________________________________________________________________________
0 D" E5 _- k! g- P3 |: Z/ \6 F* [! T) y
8 O; E0 k+ Y. ]) w1 [% j1 ]7 O: n
Method 03
$ j- J( {0 D) t$ m6 \$ m- W=========5 l7 x3 z+ u9 t3 ?3 G, d& H4 U9 H

' {0 c/ ^9 `9 {# t5 a: p5 ZLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 D) ^3 E% X4 S; G7 C8 @' I( e5 a(API Get entry point)) ]  o( P' u  d( W: N! F7 f( m
        2 P4 @9 g, _4 z9 `! H# ^

1 l# K: e# Z9 W( I0 Y, ]    xor     di,di
& ?. B" L# ?! J) g" t+ M" m, A    mov     es,di9 C: \* d7 i& K) y" x8 B# v+ X
    mov     ax, 1684h      
4 [# h) I$ r' u, H3 h/ U    mov     bx, 0202h       ; VxD ID of winice
$ D, J" Y9 J" E1 g    int     2Fh. S4 D0 u  ^) i- M3 m4 b- v) `
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 C  |7 M, Z, B% T    add     ax, di7 q3 }! s# f& [7 S
    test    ax,ax/ ^# t) p. H9 Z: S
    jnz     SoftICE_Detected5 Y) s" b% ~& W) Y  Y' ?6 x
- g1 z3 H! {. k" s3 h4 X
___________________________________________________________________________3 h1 Y( a. O6 s2 I" f
- K- s' y" x8 M8 {
Method 048 C' t% G5 \3 m- [1 w- V9 M
=========( P% a1 x/ P* [$ Z6 }

% [6 d0 c$ @  n0 qMethod identical to the preceding one except that it seeks the ID of SoftICE
, p- h) {( I, x, }) D, eGFX VxD.
9 P0 ]! g5 a. X* X- ~. d) {1 F
6 t) k6 l  f& u$ d' |: K    xor     di,di5 l+ p$ W* x4 D" j
    mov     es,di
, n  x' N! t: {( e% t, J2 e/ e    mov     ax, 1684h       6 A. W0 j# b: K% O9 z1 ?+ m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
' V( |, p9 D3 O    int     2fh
/ Z7 K4 h. F0 h$ Z9 I. C( m( }/ P    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 Z5 c7 n+ r2 n5 A4 {0 x
    add     ax, di1 W6 W8 f" [1 X
    test    ax,ax% |4 I% a( U4 z0 ~
    jnz     SoftICE_Detected
, l. J* r) K- G
* }% i) y/ o# E5 ~0 @1 ^( u3 R, h; F, L__________________________________________________________________________
- m' T/ A8 X! n! @  @  l
- z8 b# D" w4 u% w) k, G
) g/ Q) Z, n0 a6 V3 [& J- pMethod 05
  ]- B" _- F& f4 q=========& L( R- l+ O- F% A  P$ O
* `  w) l8 p9 _$ [
Method seeking the 'magic number' 0F386h returned (in ax) by all system" a: v+ D& D1 w* I
debugger. It calls the int 41h, function 4Fh.
1 R4 z( ?7 |$ Z/ A) ^( t! TThere are several alternatives.  # B2 Y- V/ m$ H" Y& ?
, N$ v5 R  g. R5 G0 K
The following one is the simplest:: y8 x1 [8 z# ~0 J: I! X2 F) E8 R: ]

/ b, V5 |5 v6 h) Y8 A8 V+ e    mov     ax,4fh% G2 l/ ?  }/ T7 C5 }2 g& ~
    int     41h4 D& ~# a  U- K8 N4 h
    cmp     ax, 0F386+ S/ O1 @* l0 e* S
    jz      SoftICE_detected
% ]( q5 A0 @& C  p# i$ T0 x/ a9 s- o# W0 @* V: z
9 t* A7 {- }, N0 s' r% {6 S7 Q
Next method as well as the following one are 2 examples from Stone's
/ L4 K+ k( A$ t( k"stn-wid.zip" (www.cracking.net):
' X+ ]  s7 e, S- Y/ F; u, l1 w  l" V! U0 _
    mov     bx, cs- U+ w  c7 [1 C
    lea     dx, int41handler2
+ C0 Y9 H5 ]& C! i0 f9 c    xchg    dx, es:[41h*4]' }; H5 E& U9 T5 B' g$ \! u
    xchg    bx, es:[41h*4+2]( X+ ~! Z8 ]* g+ T
    mov     ax,4fh* K" w) n+ _8 p4 M0 J
    int     41h! J' \: h( Y7 `. `8 Z
    xchg    dx, es:[41h*4]" ]+ C( y. O* k. e
    xchg    bx, es:[41h*4+2], Q( a5 X3 m. Y( m+ b+ B$ y
    cmp     ax, 0f386h
6 G0 X8 Q' H) D: z- \    jz      SoftICE_detected
6 s8 k6 N0 u9 J6 R! g& z  {2 u8 K% w! D7 n
int41handler2 PROC
1 }, Y! H: L( H6 |! q* I" ~    iret
7 k2 q2 N( [& [int41handler2 ENDP
* s% X# y3 T+ H7 p8 {3 M
$ k! ?- {; e  v* G5 ?, `$ x! Z: S/ h8 f
_________________________________________________________________________0 ~) {% w1 a* s9 ^. d" L
7 U* U" I2 n: U% B( i% e9 r2 ~

7 i1 m: U6 X" J6 m3 ?5 fMethod 06/ E/ |4 U- Z( V4 d5 [
=========, k$ l% G" D2 f
4 q9 V! v6 B' e  b& @7 U% U

* A' L3 U" \% E7 n2nd method similar to the preceding one but more difficult to detect:( r9 I) n0 {* X/ N' {$ S* C4 o

- w; }! i: R+ V% v3 l4 A% P2 [. J, i0 q1 e
int41handler PROC
! O+ }* m' [2 W8 `7 H. f    mov     cl,al% v, P8 m( f: Z8 f  E; o+ o
    iret
& N3 I6 f9 E  i+ \/ N; m3 eint41handler ENDP
2 h; G1 z. \1 j; {6 g. k; R8 C
5 d$ I  ~6 K7 v) h5 W5 e& }2 `& L6 W$ N' t& A# l( s1 a: `
    xor     ax,ax
7 U7 K1 h- ]) k6 S    mov     es,ax2 a1 R- t- y2 j
    mov     bx, cs
% b0 W! ^9 L% H9 L5 y3 N- M! H    lea     dx, int41handler
- s( S! f0 T3 H0 H' Y* e& o    xchg    dx, es:[41h*4]8 E2 E. Y: k  E1 Z. M# f; L
    xchg    bx, es:[41h*4+2]7 N9 T  _' r/ _5 y" Q7 F
    in      al, 40h# \/ I  A- x  }
    xor     cx,cx
' O7 v* u( X, j2 y    int     41h
+ U+ Q" I; c( r: b; t    xchg    dx, es:[41h*4]: F1 c% I  E  D' d
    xchg    bx, es:[41h*4+2]8 G  d: ?/ M: j6 R4 Q
    cmp     cl,al
, F- P$ r  ^9 {, ^  ?    jnz     SoftICE_detected" d7 H, b  D( J5 ~* {' j2 G6 }' d

  h/ X  f( h8 `2 V8 o/ C_________________________________________________________________________/ f( X: J/ \$ p" [  h. ~' l4 E
  v# C& C# M% F: t  E4 l+ ~# b* F
Method 070 j- E. T5 M6 G, S0 O
=========4 V8 t4 V2 g$ m0 P9 }& g) ~7 j
3 r+ A1 b' u) n% L, H, m
Method of detection of the WinICE handler in the int68h (V86)
; V5 g# K# T+ [1 F. h) G& z& n6 Z
' `. }$ Y9 O5 C8 U7 S    mov     ah,43h# z. g& Q/ h, F" q
    int     68h
$ H1 M' m% i& z' i    cmp     ax,0F386h
) L- g9 n4 e! _0 Q4 v( C    jz      SoftICE_Detected* m6 @; ~9 g# E4 t& Y3 W) b+ m
8 ~: g1 p* y% y0 m2 X1 e: Q) j; l

6 w0 U4 Y6 z$ p: c=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% S$ k  m; r4 \4 m$ @  G2 a+ K
   app like this:4 O% g- J# e/ e! s0 G1 h6 |5 _

- o% _  X6 R! q   BPX exec_int if ax==685 n% C+ m' S: C7 ~; M9 Z5 {& [
   (function called is located at byte ptr [ebp+1Dh] and client eip is, V) k8 s* v+ x
   located at [ebp+48h] for 32Bit apps)
; N/ g$ r0 `2 V4 m) E/ X: `1 }__________________________________________________________________________. T* U' y$ X# a) P  P. N" {5 o

; S6 T  ^8 R- _7 Z! k( v/ t: c" }* u
9 }- T1 T; l- s% ~" @1 S* \. z: ~4 UMethod 085 g* B2 @# R' d: v# }
=========" J, j6 T1 {( j7 d
, `9 l% d- ]  c
It is not a method of detection of SoftICE but a possibility to crash the9 p& f1 K( S9 V3 v
system by intercepting int 01h and int 03h and redirecting them to another) J/ F- k: u$ q9 L+ d
routine.& }+ [: F! E" k, Z7 k
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" [4 ^1 g+ ^9 ]! _/ a7 vto the new routine to execute (hangs computer...)  |3 N7 K0 ?5 a0 ~8 i/ z, t

6 }5 @/ f  l. y    mov     ah, 25h$ ~8 W2 \, A  T- W1 N4 D
    mov     al, Int_Number (01h or 03h)' H( n7 h6 g8 @9 o, w* u+ r7 x& b
    mov     dx, offset New_Int_Routine& f0 Z3 f" I# G, u/ G1 V
    int     21h1 \4 v6 D! y! k

+ S: e8 m1 ]5 ~* o# J3 u/ s$ ___________________________________________________________________________" q9 N" s7 S/ I0 Q8 u- ~7 Y" w
" V4 g9 ?6 D8 p  o% y, j: M; Y- Z
Method 09: S5 L# o/ z, R* i) m* @
=========/ R: X# J8 O1 @- N4 s. b6 o/ R
9 @; k0 T3 [- Q, K4 C
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
  ?- D' b: n& F. F; G6 |- R' z1 R2 _performed in ring0 (VxD or a ring3 app using the VxdCall)." \6 E0 ^5 A0 ~* M7 E  S0 M
The Get_DDB service is used to determine whether or not a VxD is installed
/ K* T5 e" d# ^" ~+ ^2 e5 Y5 ofor the specified device and returns a Device Description Block (in ecx) for
+ E- C% @! m  q- `4 u& ~that device if it is installed.
7 S" r7 P* k, K6 X7 r0 A& D4 G2 U! J& E( f2 I! J, {- `, O
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 [4 H2 H6 y8 B9 @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  I2 t/ ?8 u% Y3 f3 H
   VMMCall Get_DDB
, }5 s! y8 v5 I: o* @, f) m: f   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 L6 [3 H. ^/ D+ N6 K& s

* |$ r% x  p! ]: ]6 ~Note as well that you can easily detect this method with SoftICE:
! h2 q6 a3 g* a( w( }7 @   bpx Get_DDB if ax==0202 || ax==7a5fh' ]8 T) }5 [  d* G0 b
5 X4 h6 U5 Q; y' V
__________________________________________________________________________/ k6 X  S; }! @. B7 W

$ J' E, a/ m( \; J$ }Method 10' d; g; ~7 N3 U) B7 s+ f
=========
* u% D! b! x; w6 I7 H  G4 W! _
. e/ X, X# q  \, o=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with& c& {- p" ]+ m7 c/ _" r
  SoftICE while the option is enable!!2 P5 T9 Q* \6 I, G9 x

& s' l0 U1 a+ v4 t( lThis trick is very efficient:
# Z/ I1 }% q$ z* oby checking the Debug Registers, you can detect if SoftICE is loaded' k- v$ n: }7 P
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, D* y8 m# H8 `, ~+ q- w
there are some memory breakpoints set (dr0 to dr3) simply by reading their
: T. p7 H( t* R( e1 s: a3 |3 Avalue (in ring0 only). Values can be manipulated and or changed as well
. ~( ]  Z4 W1 j7 Y3 \4 x(clearing BPMs for instance)3 W9 v: S) E# Z- H  M8 Z  ~  T

5 w, _( P4 E+ i% A: M__________________________________________________________________________
! u5 p7 g1 ?7 B5 z( X
) w/ @4 k6 _7 Q  w4 [+ P, OMethod 11- F6 C- _" a' Y8 l7 Q* l9 m
=========. q$ V" s4 a2 [" H6 Z

+ q/ r' H+ A$ E3 O# J+ j6 V" SThis method is most known as 'MeltICE' because it has been freely distributed
2 i$ g7 Q9 ?6 Q  j# |) Pvia www.winfiles.com. However it was first used by NuMega people to allow# Y; u2 X: J$ r
Symbol Loader to check if SoftICE was active or not (the code is located
5 w4 ], n1 Z: n: i0 X2 Z6 Pinside nmtrans.dll).
3 a0 I1 ?# H3 w# z' }1 |/ C* Y) H* Y" n  g$ P9 K; N
The way it works is very simple:
' H0 |3 e) b/ o" X$ kIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
1 b% t+ J" l& d, Z1 X* oWinNT) with the CreateFileA API.
" x5 c5 x: `4 N; w
5 r. l4 x4 X# ?Here is a sample (checking for 'SICE'):
0 D, T; ?' m5 X! e3 j& y4 E- f+ l1 D8 Q/ S( k
BOOL IsSoftIce95Loaded()
% E) G# L9 i2 o{7 |  W1 a( J+ n' K
   HANDLE hFile;  
# {! _/ K2 ^/ W$ C3 j   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
9 D. y4 C- u7 |5 Y/ }9 ~. F                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* w0 _' N0 L( M7 J5 {, r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; i. @" h2 d# ]9 n1 \   if( hFile != INVALID_HANDLE_VALUE )% ]6 y/ F5 o6 U
   {4 ?4 K" E4 i0 j2 K4 x" Q9 P- U
      CloseHandle(hFile);- X& N; M* w9 o# @; b  J( N+ A
      return TRUE;
' h0 R6 q8 I3 H   }
) w7 ?0 q2 B. S: V* U  l1 x' m% Z   return FALSE;
  ~: l8 \6 o$ l7 v# {}
3 ?/ }" c5 L" ]5 F" O: C% h& n( F2 F
Although this trick calls the CreateFileA function, don't even expect to be1 v( _8 y4 ^6 J; R! A
able to intercept it by installing a IFS hook: it will not work, no way!
& i9 q! O2 r8 OIn fact, after the call to CreateFileA it will get through VWIN32 0x001F! y) q  ~5 X! I; @. @
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! z2 i5 q; M7 N+ q. kand then browse the DDB list until it find the VxD and its DDB_Control_Proc( `0 K1 u8 L( N  M' l6 [: z( i
field.# n; |' D* r2 f
In fact, its purpose is not to load/unload VxDs but only to send a
+ r  A; q$ y. Q: N9 WW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; [: l5 y. U& Q! {8 X. jto the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 o$ k* w7 {  K- ?! T+ dto load/unload a non-dynamically loadable driver such as SoftICE ;-).4 Y* q' |/ B6 m+ T3 y, O* j
If the VxD is loaded, it will always clear eax and the Carry flag to allow& b" j; B; P: n% [! K  N
its handle to be opened and then, will be detected.
/ O* N. M' ]3 v6 U/ j* YYou can check that simply by hooking Winice.exe control proc entry point
. R$ w% z, p) L" Q) _$ lwhile running MeltICE.. e. s1 c' S1 n3 }( z9 N9 L* [

' [3 [$ ?; K: G; B$ v, E
( ^; \8 I7 |# [  00401067:  push      00402025    ; \\.\SICE
6 N1 B* p; j: h6 }& a7 R) K  0040106C:  call      CreateFileA
! ]" }+ m9 y- k% f5 m$ O: b' M  00401071:  cmp       eax,-001) ?& l& ]1 o4 j5 p$ d; o
  00401074:  je        004010910 k) T* {: |# Y% r& o$ Z* I

. G1 l; T. ^: |5 G
6 D% o: u- D/ _( q6 YThere could be hundreds of BPX you could use to detect this trick.
* v8 b2 e% n* P' h+ e% {: U-The most classical one is:
/ V. G. M- {  R  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
# }6 b& z3 l( o! v+ j% I) k9 j8 F    *(esp-&gt;4+4)=='NTIC'
: m" [6 ^& T& e# c* |. |
4 L' v: w" P2 S0 O: Q" |" o-The most exotic ones (could be very slooooow :-(8 @! |( L' e, z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & {. P/ ~' T+ U) y8 x0 T
     ;will break 3 times :-(' t0 R1 H3 f! P

6 L* V4 {9 G$ C0 I6 X+ a-or (a bit) faster:
- U7 S  l' X1 Q2 t' w: U; U7 I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 f( v$ Q2 f$ J2 W: a( w& O
. V# u1 Q" s$ s; i
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 o4 T: Q+ q, C' g, Y     ;will break 3 times :-(
6 X2 }4 q5 n# b( Y4 O- O/ _+ g4 o! |3 i8 N/ P
-Much faster:1 T9 @! {. C: c
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': |- H; `$ C* X- L$ i6 G3 w; W

" i  C" \5 X8 U: bNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ ~/ {9 m! o# l$ W: k# nfunction to do the same job:
7 g3 z% ]3 u4 t( N5 t) Q9 q6 Y4 l: E7 Q- F
   push    00                        ; OF_READ
$ ~  D) }4 r/ b  G4 X   mov     eax,[00656634]            ; '\\.\SICE',0
, c7 B3 I  s9 M1 ?( u- k6 c/ n   push    eax, e' Y& Z2 v) D2 K5 M+ _0 w
   call    KERNEL32!_lopen9 p. Y- E6 A( u2 n0 r
   inc     eax) `# I  e4 \- z/ K& H
   jnz     00650589                  ; detected
, i4 M4 s# d7 ~/ N/ a! E$ D   push    00                        ; OF_READ
# s4 G5 c" s( w+ E6 J/ l$ e   mov     eax,[00656638]            ; '\\.\SICE'
+ ~8 I8 V1 V" n$ c5 \7 G3 y   push    eax2 e# t* O8 q5 [3 y( p
   call    KERNEL32!_lopen
2 J; q0 h8 B& e0 m: T8 n   inc     eax3 I" z# u$ {4 r7 E
   jz      006505ae                  ; not detected
8 x# X! ]; H7 J/ _4 ^. d; _4 o% }4 a( H

3 `- v: S9 L3 H0 p) E; R; P__________________________________________________________________________, p; ]( Q2 m- L

) K) Q3 r$ l2 Z. yMethod 12/ K1 _* W! `0 y
=========$ b+ \0 s" i& D! r
5 x# o- Y- Y' F' M+ h
This trick is similar to int41h/4fh Debugger installation check (code 05
2 A# s+ Z& m" D# K% B8 Y0 X&amp; 06) but very limited because it's only available for Win95/98 (not NT)( e' \1 ]4 g1 V  t; r' T/ n
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 a6 F( Q+ m8 [( y2 i$ C' F0 N) O7 P. v- p% @8 z( ]
   push  0000004fh         ; function 4fh
' O: s7 M/ S% e5 P* F6 C& g   push  002a002ah         ; high word specifies which VxD (VWIN32)+ K: o4 Y+ u6 k0 U* y
                           ; low word specifies which service
- |' p. X3 j! Q. ?! @/ m                             (VWIN32_Int41Dispatch)/ X/ j& D: W; H0 N& J. a
   call  Kernel32!ORD_001  ; VxdCall
9 {2 q$ z4 r- e! D   cmp   ax, 0f386h        ; magic number returned by system debuggers9 h% ]  n/ V8 o- Q% N# G
   jz    SoftICE_detected, B% J( p+ l3 H. y
2 j+ S; O. p+ ?
Here again, several ways to detect it:
: ^( p1 ^6 Z# H4 z9 |" G* X& S, m1 t! I( y! N! r
    BPINT 41 if ax==4f
% M! X, t: J  B9 h3 V/ F
- E& m; ~4 b" Y: ?; Z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% H1 z+ P, ]1 n8 s! E; R
: S/ x. F, Q" L6 p- d# o
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A$ R) b$ z$ `% P, j
% U2 Z$ ]4 h8 c: n2 w% q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
, R  \& e- P1 d8 u6 v, C' ?+ Y) c' x0 p; z4 B( A% X
__________________________________________________________________________
6 Y3 N& v/ H+ G" Z
" U& V# A' T! ?1 z& TMethod 13
: a8 [( m2 @3 _0 g=========7 R5 c( Z3 P2 w; p2 y6 r

% _0 c, b& N0 Y+ F% e* ZNot a real method of detection, but a good way to know if SoftICE is
+ N4 c6 p, l7 t; _7 Q5 linstalled on a computer and to locate its installation directory.
/ r5 `7 X8 e$ P  c, gIt is used by few softs which access the following registry keys (usually #2) :5 A! t: p1 A' m4 t

% j# ]+ i2 x3 |4 I5 L" `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 h* F3 U" k* b6 I8 S\Uninstall\SoftICE
8 n. X  Z, k9 j7 p5 Q% I-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE/ q5 H4 _* w5 Y( r
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 g& X9 y1 }, w7 [4 V; ?' j\App Paths\Loader32.Exe; I! {5 Q; V, J: Y" s
$ F  I  e0 _* l8 D7 s: E8 x1 ^' c5 l

% v& l0 L$ l) K; a, iNote that some nasty apps could then erase all files from SoftICE directory
! R3 d; |& |- i0 \5 r5 k(I faced that once :-(
# {7 \; K. y( {7 N5 c/ s- V6 @# v5 G9 V- d; z& ^
Useful breakpoint to detect it:, }- ]* {% ]+ d+ F' C( M/ m

+ c5 U. |  s# w" [     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
2 k( |/ l, z3 c4 Z. a- h0 [* T" X! \* |% [) J: v
__________________________________________________________________________, y/ l( {. ^+ Y) q0 i( [

& H+ m1 G  v3 [$ q' V) [2 f* p2 `& l7 p1 w& N( F, c1 J
Method 14 ) O/ _. q0 ~( n8 j4 A0 d, S1 f
=========) D3 N. r* @2 `, ?

/ q2 G# A3 k9 i3 K1 ?. h; S! b7 vA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% G9 h2 r& ~) M- P
is to determines whether a debugger is running on your system (ring0 only).. Q( g, z$ s  `! B2 P. E) O

( S6 J9 W0 i1 M5 \- ?   VMMCall Test_Debug_Installed
6 |* y0 C0 y/ @' t7 o+ Z" b$ @2 U: P   je      not_installed
  X- z' }& L% b. q% D( g/ K0 L2 L" t& G4 @) c8 Z/ H- t
This service just checks a flag.
! x# }% y/ V5 t: |* U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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