About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>  ]7 p/ b; [8 X* Y% }! G/ j. }
<TBODY>: _8 Q8 g, w2 U( S' h3 j" j, y
<TR>- u. V2 ]' k0 @
<TD><PRE>Method 01
% g) Y) Z6 E3 [, k=========
8 R% H) x9 `9 q/ r1 J
9 b' l0 N7 t5 U- O. R' T. PThis method of detection of SoftICE (as well as the following one) is
! o% I" i0 q+ a- P' w: |used by the majority of packers/encryptors found on Internet.
  W5 @6 Z! }! q3 W/ i6 l6 R: @It seeks the signature of BoundsChecker in SoftICE
7 ?+ y5 O! v: O9 @* I
" |6 \9 K% F% y    mov     ebp, 04243484Bh        ; 'BCHK'. n: L3 {8 p$ h) v
    mov     ax, 04h& [4 e3 A9 Q7 C) o2 P: E
    int     3      
( r5 N' W+ |- o    cmp     al,44 u6 O7 U/ \0 q% h* V
    jnz     SoftICE_Detected
9 m& B( a' c  ^1 x. J7 ?
! _" `# L) I- G' K+ ~$ h  k___________________________________________________________________________8 `, E' f$ L8 N

7 Y' l7 |' K' ^, V7 D( sMethod 02& ~, z5 K/ m1 X$ `* Z: A
=========+ c' @  U- A  s+ G3 q0 Z% R
: V; ~# M, H, I$ s. l3 U; V- u3 q
Still a method very much used (perhaps the most frequent one).  It is used8 {* V. y3 v: a; O* E9 e
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,) y" E( V( s  K4 z2 G" m
or execute SoftICE commands...
( N: X2 ~  w* O, v  Q# uIt is also used to crash SoftICE and to force it to execute any commands# E9 ]* P+ \. m
(HBOOT...) :-((  2 q) K& Y0 m( H* ~2 e

/ U3 R4 x8 V% q; U9 e" e2 ]Here is a quick description:
7 V: L( O8 G8 a-AX = 0910h   (Display string in SIce windows)& {6 m) O- D1 G+ T7 S+ G, {
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" g, P* ]  _4 O-AX = 0912h   (Get breakpoint infos), y) G* z  g& q) W  w4 u. [
-AX = 0913h   (Set Sice breakpoints)* {7 K' g$ ?& F9 E, l
-AX = 0914h   (Remove SIce breakoints)$ M3 R: M# k) f+ z* M

1 i' e$ E1 u9 EEach time you'll meet this trick, you'll see:; O( i0 Z) h5 y  N9 k5 n
-SI = 4647h
* Y( @; ^: ]3 c6 G" V5 {-DI = 4A4Dh0 k. K% ]" G! ?, ]
Which are the 'magic values' used by SoftIce.8 ?4 H, ~* I! Y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 M5 \, c* f0 q% `
7 ^, Q$ x8 ~3 H# P* }9 w1 xHere is one example from the file "Haspinst.exe" which is the dongle HASP6 @9 t5 G" T3 b. k: q
Envelope utility use to protect DOS applications:
% \# j' M3 H& O
: C0 Z7 n; [( Y# d  M' n$ D$ X8 Z. a  a
4C19:0095   MOV    AX,0911  ; execute command.$ k/ x  u) E" k5 T+ m
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 c3 K& Q5 j: B, ?+ J/ N6 W4C19:009A   MOV    SI,4647  ; 1st magic value.
( i9 C9 `% z* P# ^' A4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 g" H4 H; w6 u) y% J6 D4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# n, A0 o. Z5 @- f: U7 i) ~
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; ~: l! A2 V( o) G: s6 s4C19:00A4   INC    CX  v- d" u# R/ f5 y  L
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) \& _/ [# p% q# n  u$ W4C19:00A8   JB     0095     ; 6 different commands.1 L7 x' n/ k1 r/ |% C% s* i+ b3 @5 o
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
( ~' l" V! I% h2 V: M4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( _+ Y" I! |( n# k3 b. k+ r3 v
, d/ L" u& L) p! gThe program will execute 6 different SIce commands located at ds:dx, which
# [* S( o: D# V. rare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  Z8 _5 M* y, f: x% S0 f$ k2 |) D
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
4 `* w4 K! k2 K9 M  w___________________________________________________________________________# a+ }" ~- A4 V1 j5 [9 v

+ @/ F& {* x1 O, I# Q7 \+ k: A- s9 _2 s& S% R3 x: _! U
Method 03
- O  G3 d/ p) j& w3 B=========
4 N: h* c& z  c: q/ B% v8 U4 N6 u- E& \1 @( h9 O8 }
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 w% j, }# P7 l* B4 k, E. O* E
(API Get entry point)
8 G1 |4 x2 S$ P1 y* h) [* {! M( W3 I        7 I% d2 w1 Q: W& G

8 |; l2 z* A( k# p    xor     di,di- F7 }+ s0 i2 ]; [2 a
    mov     es,di
8 J7 ^/ r( y7 r$ X0 h( x    mov     ax, 1684h       0 y0 s! {$ S9 N8 R: T
    mov     bx, 0202h       ; VxD ID of winice8 f7 ?6 [7 t/ o, W
    int     2Fh
5 u  O9 V( y6 Z+ V; h: o    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ x: |6 u' g; ?) [% q; r    add     ax, di" Z; Y/ V: S7 L9 q# w: h: a9 v
    test    ax,ax. G/ I$ f* a2 M
    jnz     SoftICE_Detected
& g; K# x. {+ B+ P; W2 g5 ~1 U
2 j# u7 L7 v, n, X* m+ X( W___________________________________________________________________________
% R3 {& t" U* y; V& p
6 s- `# p* Z5 \) Z1 |Method 04) {7 |" Z! t5 K; C* Y8 C
=========' j: J: z% x! h  u8 L# R0 Q) _
  A6 T; ^( u3 @6 a& T
Method identical to the preceding one except that it seeks the ID of SoftICE
) H6 O2 S0 l' ]" t6 U  uGFX VxD.* ]) V  B& n2 E4 e8 r5 j1 }

+ T0 ~( ^" G$ N+ O& D: |    xor     di,di
; c3 J4 i0 @" T. u3 p! r    mov     es,di
0 U; A2 Z# E! }, Y    mov     ax, 1684h      
, P0 r! v6 O7 C    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 N6 s- P3 ~+ a; g
    int     2fh
% ^" o: Q$ l) y7 a/ y/ m    mov     ax, es          ; ES:DI -&gt; VxD API entry point, V. ~2 F4 ]2 E9 K' T3 `! r
    add     ax, di
1 H7 X6 n! }# u* i    test    ax,ax
; c) _8 L7 b8 m& z    jnz     SoftICE_Detected
; c; f7 R' \6 N/ {, f0 A1 W7 X% i# u, b
__________________________________________________________________________
0 e& j& v, y: `) }& E+ G( T( G
$ h! \! ^8 ?3 X* F. q; V+ \: H
6 `8 Q. y1 W& j& f  |" I- d/ \Method 050 c  ^. `% x' [" `9 ~& @+ V# s
=========6 t2 b( P: A3 {7 h

7 S9 P, O' v+ h; m: _Method seeking the 'magic number' 0F386h returned (in ax) by all system6 [$ p1 @' U1 I# e* n
debugger. It calls the int 41h, function 4Fh.0 i7 b; p9 w$ ~9 C2 t7 t
There are several alternatives.  ) N+ M9 z: G# {$ ^! u" Z* r

+ R- A1 w6 J( zThe following one is the simplest:
3 ?6 @; @7 ~9 G" |0 }7 @: ?9 I, k0 ]
    mov     ax,4fh
) }! Y/ s( e3 A* m% o: I    int     41h
' ]- Q* _; B3 E2 r5 n. r/ g    cmp     ax, 0F386
% T' |: [3 N$ t, ^    jz      SoftICE_detected6 d. c- H; Y  ^$ N! }0 d
+ }3 E( G8 [. T- d

* E' I' J" J" rNext method as well as the following one are 2 examples from Stone's : y2 }- U. O8 n6 C
"stn-wid.zip" (www.cracking.net):
( }( |; F% z' g6 U. P9 h" h5 M+ v: Z3 r& U& T3 p
    mov     bx, cs
% t% J4 h/ L* ^, x    lea     dx, int41handler2
' q) |5 J! {! ~5 }( x; K    xchg    dx, es:[41h*4]
+ {8 _; {; U7 u6 Y) s9 s6 L    xchg    bx, es:[41h*4+2]
* _/ A/ W7 M: x, r" O5 R7 ?' f    mov     ax,4fh; h% W1 H+ }  U: `3 m6 T' U1 b
    int     41h
8 L9 b6 O3 H& S) Q& {0 m    xchg    dx, es:[41h*4]
1 u# e! K- o  K2 t+ i    xchg    bx, es:[41h*4+2]; V, e% Q: r: H' v7 P- `
    cmp     ax, 0f386h( y6 |5 L1 V( l7 {
    jz      SoftICE_detected
* o# F1 T( [/ s7 e( Y' `
* c3 q2 Q1 T6 o3 p9 q2 lint41handler2 PROC! h; `; G0 i( ]7 K# C5 _9 @
    iret1 X, g9 B. V' f  q" y, B1 {1 j
int41handler2 ENDP
6 P( y; l$ D0 T" u6 o4 V4 N9 i( g3 P' n. h& \5 e  y: ]0 D1 s

1 v& m# @0 k& d9 E' ^_________________________________________________________________________
5 H8 _$ j+ s! A" R
( Z3 v, V& s+ Z8 {! N3 a* F1 m" T
+ A$ e  ~% \4 k1 c+ y2 V2 Z- k0 K% {Method 068 W% S* Y, i& {% O& k: y
=========
8 X7 {4 w+ U, s' i+ L* A/ O+ A
3 W# E3 D' W+ @9 x6 E, d: S
5 }, W6 v) z( ~. d2nd method similar to the preceding one but more difficult to detect:9 s( e5 k& _/ Z* f9 X
! `$ X6 L. n- `5 f0 D

! Z) R' D# _* ]% Gint41handler PROC' @6 [2 E- M: d/ b2 S! C
    mov     cl,al
, ^- c1 u  n& P2 C1 r# T* D% k    iret
* p  t4 H, Z  C  s! b3 `+ jint41handler ENDP4 ]: f7 m1 O4 K  ]4 ^9 g* U7 v% M
- F9 P$ F9 E9 F2 i6 V
0 C( Q5 @/ o' a9 }: g
    xor     ax,ax7 C6 x; q; H8 V' k+ w' v
    mov     es,ax5 K. {: L3 {+ }$ o, v
    mov     bx, cs2 X" @; b3 i% q: l
    lea     dx, int41handler# M9 n: ]8 I1 x, p% R
    xchg    dx, es:[41h*4]
% ~  `1 m7 z; O7 O4 t6 e$ K    xchg    bx, es:[41h*4+2]
6 ]+ g0 t, n- G4 M    in      al, 40h/ g& i! ]& m8 I/ e$ |: o
    xor     cx,cx! a5 x2 ?4 B7 H$ ]% Y/ k8 ^
    int     41h; _; w. i, {& k( d% e
    xchg    dx, es:[41h*4]; v$ w' B, r: b! P+ q
    xchg    bx, es:[41h*4+2]$ a. q, N& a. d3 J5 g9 E! i# _
    cmp     cl,al
! B  f% V  n5 N8 N( {3 @    jnz     SoftICE_detected" I) E+ c5 [+ p# a/ X/ O

/ a) Q2 V  r: R+ E0 z_________________________________________________________________________
0 M+ u9 S, ]* S* j. l% m" T1 e
7 H- Z' f5 R: N  A9 g. W% hMethod 07, E5 a1 @& d0 C5 p) S3 V  L
=========. [  {( Z* H8 ^$ k( p, N/ Q3 U( X

1 s) @$ [0 p' ^' n9 a# w0 OMethod of detection of the WinICE handler in the int68h (V86)0 D" c3 M. S) B( S7 I. e6 ~
! `, ^7 M3 G1 y* D% ]3 J
    mov     ah,43h
- R: e/ N7 r# \) H. T    int     68h: R8 B( Y5 E% R0 Y+ x- w
    cmp     ax,0F386h/ L& R/ ~# }9 s2 l/ |, @* @5 B4 }
    jz      SoftICE_Detected
) u2 |& m) {/ K9 ~0 A/ N; u
* A, P9 \  N3 X" {
( i- l8 z( o, _, i. N=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
' N2 ]5 x3 c. R9 |/ n2 w/ ]   app like this:
+ h# X0 k: A! I1 g0 b  @1 h
7 T' V* g3 }# k  l" l6 W9 K   BPX exec_int if ax==68
; f( M6 Y2 O4 D0 m* i/ l  R   (function called is located at byte ptr [ebp+1Dh] and client eip is) e: b8 G' C9 N
   located at [ebp+48h] for 32Bit apps)
( l0 x5 A3 o  A' K. }! s6 l__________________________________________________________________________
6 E, m3 X& ~; l; s* [4 {% Y1 U+ \8 F* o' l" P: c. {
* s7 T+ ]' L% E! @% b
Method 08
1 ?( I$ g, b; t$ g* p/ Z=========
8 v( d1 M7 B" O& Y: p" b5 X, u4 ?" {+ H& k
It is not a method of detection of SoftICE but a possibility to crash the
/ O4 h7 j; U" D8 f* Esystem by intercepting int 01h and int 03h and redirecting them to another- k: b6 ^0 I5 S( D: ~7 e
routine.
* G# ?% X+ S) I8 CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points" M, u' z+ H, W3 h- ^) C# [
to the new routine to execute (hangs computer...)3 F% Y( I; m7 o7 W4 Y; l0 g( g

4 A; {* s& y/ I2 U, G$ c. _    mov     ah, 25h, v4 Q! E$ h" [6 R5 P: ]
    mov     al, Int_Number (01h or 03h)
- ]" q. c4 Z# N( |  U    mov     dx, offset New_Int_Routine8 }8 P! e9 I: e3 n: w* X$ M
    int     21h
) x& _8 B, r, H7 a7 h5 }
, g- U7 a) n* \: t! ]& M# v, b& n__________________________________________________________________________% ^- r3 R( I# C" q- p: y
2 d! q3 P5 {0 Y
Method 090 D) M! O  ^7 B! `  P$ l
=========
- \4 U4 t; W# ~5 @0 j/ @
3 P. d( P# t0 Z, w! S! LThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only$ {- N3 z( ^( y$ H6 s# k
performed in ring0 (VxD or a ring3 app using the VxdCall).
; ]. I3 v; A" @/ WThe Get_DDB service is used to determine whether or not a VxD is installed
' F0 `; A" H2 I9 cfor the specified device and returns a Device Description Block (in ecx) for
  G2 i7 S5 h0 j, \that device if it is installed.
. K3 K+ m8 L1 l6 a$ _$ `, O" h8 t- @% \7 O
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID- W( c; H0 _0 l/ M8 I  T+ n6 j
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! M! G* ]$ x) z$ J   VMMCall Get_DDB7 a# j5 i5 @) S7 z7 @& h
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 a( Z/ I) U* v5 Z
" z# t3 L6 I4 |* R' N& W
Note as well that you can easily detect this method with SoftICE:
' @2 S2 u9 b+ O" m# w, A3 y   bpx Get_DDB if ax==0202 || ax==7a5fh
; U6 d4 o& Y4 ^- B' `% W/ L" ]
& X# w$ ^3 [, G- o__________________________________________________________________________
$ Q2 _/ r% d1 R* U6 H: E2 l. d
: S" y' P3 T& S" n- P; UMethod 10
. c+ O) k) X6 z  {/ e% @1 ~6 Y=========; a" E- M+ V5 c& g5 G
3 b/ F) g% `+ K. \0 {8 W" |/ q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 d, _7 r9 o( A$ @, }, y  SoftICE while the option is enable!!4 i: I; ^  H9 Y8 I
. {+ u/ r8 p$ C" h9 B
This trick is very efficient:1 ?9 s* X; }& |0 K1 F) V) D
by checking the Debug Registers, you can detect if SoftICE is loaded$ l- u- A6 v+ r
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 Z; Y* L4 f8 x9 U! c/ G8 q
there are some memory breakpoints set (dr0 to dr3) simply by reading their
' Q4 o9 |6 Z5 a5 n% O: Pvalue (in ring0 only). Values can be manipulated and or changed as well
6 q5 H# U# s. m# F$ T+ h2 w6 {- b- A(clearing BPMs for instance)* g4 n9 }. `. g, J! a" [

4 i$ E. q9 C( a__________________________________________________________________________
/ O6 x5 `1 c3 W+ i2 J
$ k- G4 r* T1 z3 B0 R; Q) p/ M( pMethod 118 b- H9 O; d! H& x( ]  a* c7 w
=========% O) d  L, w' b% u
4 z) \& x" R: ]1 I4 X8 ]$ {
This method is most known as 'MeltICE' because it has been freely distributed
6 T6 I) K7 C% m( a- Rvia www.winfiles.com. However it was first used by NuMega people to allow1 R' V4 c+ L# A9 F5 b! V5 a* e- u6 F
Symbol Loader to check if SoftICE was active or not (the code is located
3 O; T* Z- t/ linside nmtrans.dll).4 S: k6 G9 Q2 o7 v4 L- {, @$ ]! t
' b9 ^  i7 N2 H, Q
The way it works is very simple:9 R2 a2 f# W' u# j; U; q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. L; c+ b3 w" TWinNT) with the CreateFileA API.  s; f; i2 O3 R  f% k/ @& u
2 \3 m# M/ j" \
Here is a sample (checking for 'SICE'):; {2 u3 q* S' W2 z5 V2 A
/ V& r: x1 G3 y7 K% g4 ?
BOOL IsSoftIce95Loaded()
" ~" s2 q# r9 K{/ ~  \' o4 K' k; d- k
   HANDLE hFile;  ' K* g; ?( ~. g$ o8 ?
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ |% {; H/ `5 T  i1 W                      FILE_SHARE_READ | FILE_SHARE_WRITE,! T1 d! _: {# D6 B3 L: \2 J
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 _: n+ F8 m0 x5 n* i   if( hFile != INVALID_HANDLE_VALUE )
+ G/ [$ c( Z2 n2 T3 p: X   {1 c5 X5 F+ Q9 R) d8 L3 s5 q; z( k
      CloseHandle(hFile);( t0 \- ^# b- V4 Y: @
      return TRUE;. \2 B" o, R. ~  x
   }3 N/ A9 u" P% O% N6 u
   return FALSE;: M1 @7 `- d$ R$ U6 ~4 {
}
! |) q5 H" U4 ]( e3 H( v
6 I( U) T# l+ e, s& ~: q' SAlthough this trick calls the CreateFileA function, don't even expect to be
7 K. T6 `  P; v9 iable to intercept it by installing a IFS hook: it will not work, no way!
6 v8 x" V- j# {In fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 s) U; ]$ ^$ Xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ d) C- \: N2 A, a9 t
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
. h6 Z* M/ c4 |- l! s5 L. r- wfield.
& I! c5 X; b" p6 _% SIn fact, its purpose is not to load/unload VxDs but only to send a
" r' U# s/ y/ [, Z# Z5 g2 D: fW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! W4 P! {7 {. G: ~& {5 }6 v3 vto the VxD Control_Dispatch proc (how the hell a shareware soft could try: s% w) A) T# e+ C3 Y8 G
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
' [7 Z. E; m( k8 S- TIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 V! |4 t& o6 M8 kits handle to be opened and then, will be detected.
7 y: c# L0 |1 _4 z4 M7 XYou can check that simply by hooking Winice.exe control proc entry point
) ^2 }5 n6 o; f7 @7 T) I( H( wwhile running MeltICE.
. W+ o; {$ P% M0 m1 Q$ L5 Z' J1 |' t  }

( Y$ q! C0 o% p2 ?6 C5 B  00401067:  push      00402025    ; \\.\SICE
! R( V0 g4 F- i+ ~$ B  0040106C:  call      CreateFileA
- a2 [# ^$ U( \+ `8 x0 V. i  00401071:  cmp       eax,-001( g4 F. @7 U3 G- p
  00401074:  je        00401091& z; A2 a, z! C+ {, Y9 L) K

' f0 L8 _  d7 x( f! S
7 c. I& D  W1 L5 P/ V) F% h4 VThere could be hundreds of BPX you could use to detect this trick.
% _, S+ S' M4 p, B' v-The most classical one is:3 w) ~# U8 P3 a# U
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 _7 F0 }$ {# ]) d0 O
    *(esp-&gt;4+4)=='NTIC'! w$ ?7 E, ?  n/ Y6 \

( f5 D/ A9 K, w- J: b, p-The most exotic ones (could be very slooooow :-(
' [( C( n' b; t( y0 {) s8 |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 S! I% ?7 d3 l+ F& R; U" ]# {     ;will break 3 times :-(
  l( j) Z: f" L' r9 M7 S6 o, K% e. N' }/ l* ?
-or (a bit) faster: 2 _5 F2 p% q" \0 \+ N0 a8 `: w
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')% N4 o) u9 ^; M( w. n5 K$ W

0 ?1 r/ A; l% B8 g! y   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 j% L* d) L* u) C& o! q) w2 s     ;will break 3 times :-(+ n' K7 Y8 A( j3 a9 _9 T$ `' u# y& s

: U, l( l: Y9 T# B" ~. z-Much faster:
- B5 G! y1 |. d6 Z! ~   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 ~- K/ C6 ?* t

4 O, r! X* r* z/ mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen  P, x; E+ o% [" a3 K
function to do the same job:
: d6 \# F% T7 Q3 P  A( {' w% Y
5 f3 H8 Y" h, D+ e   push    00                        ; OF_READ
3 Z2 l! [! c9 {" t   mov     eax,[00656634]            ; '\\.\SICE',0( M. Q+ b& V* J5 m+ G; g
   push    eax0 B1 K! o/ x+ H) e& p
   call    KERNEL32!_lopen3 Y& N1 S: h, j/ \+ X
   inc     eax& f- u- q0 D& j9 o! P
   jnz     00650589                  ; detected' ?, ^8 Y( m! v, m! `
   push    00                        ; OF_READ
0 s/ J) @+ g$ M8 I" B# P   mov     eax,[00656638]            ; '\\.\SICE'0 e, j& d% }& m3 b: g$ G+ @
   push    eax
2 |7 B% Y* U. y   call    KERNEL32!_lopen
: Z% R( G. F) t( S" o. l* P   inc     eax
. u) T/ a: `( Q   jz      006505ae                  ; not detected
+ k1 P2 W3 }9 G7 w# k, V% J- n1 s) y) r- u  N

8 K: G# a. m9 I) i__________________________________________________________________________. V9 y: B" d& @' Y& z

/ v( N* @5 v( r. R& Y4 zMethod 12
  }/ T9 J: `3 |) Q7 h=========3 a# N0 [" W. h7 W$ M
) i" y; r, {6 g, A) @
This trick is similar to int41h/4fh Debugger installation check (code 05
* v. ]5 `' z8 `+ A2 d: k) S1 c&amp; 06) but very limited because it's only available for Win95/98 (not NT)6 B  n0 R/ [7 f* N
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; K8 ^# g6 l5 p) h. k# ]& n! q/ F. V) K
  \* [! s3 \0 d1 v0 }( ]
   push  0000004fh         ; function 4fh
' O4 V+ z2 U* B* N2 @3 H0 @3 F, l; |+ v- ?   push  002a002ah         ; high word specifies which VxD (VWIN32)5 P( C/ S4 m: J8 L& y2 Y1 ?
                           ; low word specifies which service
2 z% g* O0 ~9 ?                             (VWIN32_Int41Dispatch)% B% p% u5 x# N9 j! p
   call  Kernel32!ORD_001  ; VxdCall1 Z! E- L$ \4 k6 ^) q+ ^! a
   cmp   ax, 0f386h        ; magic number returned by system debuggers' |+ D3 e4 L; n! i
   jz    SoftICE_detected* h: y  C( g( U- q: t) S

+ ^' i5 q: b) S# t% E0 THere again, several ways to detect it:6 h6 V- {4 _" h+ \9 b
5 E" q# w' Z7 s4 m2 D, l: F
    BPINT 41 if ax==4f
) g* Q5 x/ o! T: W
! I. S: G" i  U( p' a8 q3 e: T    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! k1 I2 A) T8 O# A( V/ }6 k
8 l4 F8 m3 J+ N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ j9 |) P$ h2 u# |* v
: M- Z# ~9 ~. `6 Z% N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, A$ i) e& g' u# }9 j3 g- p/ r

) o: ?5 B/ O' X__________________________________________________________________________# E4 F# r6 l/ k

0 L# U- m7 ]; e1 @' l4 x1 @8 E& jMethod 13- [7 v0 P" C' [: Z. @
=========
) ?1 R6 W' z3 k+ ^6 {8 s, ~! Z
& `$ H) \) W- t5 b- T" zNot a real method of detection, but a good way to know if SoftICE is
! c( z3 N% o& D( ^% `' ninstalled on a computer and to locate its installation directory.% R6 _- H1 }4 i7 f- Q) [
It is used by few softs which access the following registry keys (usually #2) :; b+ q% X$ h6 G5 ?6 K  v" n

" |/ o; a% a# B  R! K! Q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: C; P7 ]' e6 m9 ^) t1 p1 }
\Uninstall\SoftICE- C- g# o7 s8 H
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( X# [( `& g5 y% j, o3 h4 v-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 v+ R. R; K' |6 `2 J) I\App Paths\Loader32.Exe/ s3 q! F6 I  v7 f3 K
+ m$ X. ^! A' t' D0 }2 h8 B" ]7 p
$ B- s5 ]' W2 H* u) l7 b( W
Note that some nasty apps could then erase all files from SoftICE directory
* o$ o( l& {1 E4 V(I faced that once :-(
: u: R' k, `4 |; ]( i: _# h0 z6 t& u- S) d! @
Useful breakpoint to detect it:
0 F. A+ k2 ?6 I; U* Y
  z! `3 y! z6 Q1 O     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  G3 Y; B" }3 v' M

! Q/ a: _( Y9 [. H, Z- j1 e- T__________________________________________________________________________% t# x6 ]/ w/ {( c  _3 F7 c

7 G' \0 }7 r$ G1 p* F# i% F% Q4 n7 y% [. f0 j, R
Method 14 ! k6 F9 x! s, C) U7 J7 \' S5 L- y
=========
" q- K; r, k- l) U. ?" T* L( G" n3 T, C$ ?" ]
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 c& M3 f5 P2 ?) C% Mis to determines whether a debugger is running on your system (ring0 only).1 A7 v9 W7 Z2 }% n

0 L  g3 _/ z  K: D" X   VMMCall Test_Debug_Installed, t) b/ D5 Z+ i
   je      not_installed
% u3 r9 S7 O7 d) e8 D
: C3 ~& O, B; l! {3 q6 qThis service just checks a flag.
* A; b2 c! F/ |- T, b) w4 k% u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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