About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& G9 T& O% `) c/ `0 R
<TBODY>9 O3 [3 z) a, @7 V& o: D
<TR>
6 S( B8 \/ y  T. U<TD><PRE>Method 01 ' g0 C& h7 k. r+ m+ @
=========
6 v8 Y5 L1 }% B8 ]6 H( o% H9 B
; J4 l8 R/ _* j: q! kThis method of detection of SoftICE (as well as the following one) is2 H- v5 C9 v9 x- m/ G' y
used by the majority of packers/encryptors found on Internet.! U4 G/ l/ K% s. S1 g
It seeks the signature of BoundsChecker in SoftICE
% I% M& N$ U- K4 c8 `% e+ z6 M
6 k0 f. {0 `5 s2 u* h    mov     ebp, 04243484Bh        ; 'BCHK'8 N9 S# \# a4 P9 \. i3 F
    mov     ax, 04h  C; O! A) F+ S# {& {6 M8 q
    int     3      
/ L7 q  P* r3 g$ W+ S    cmp     al,4
2 S( w4 e  P& D6 J    jnz     SoftICE_Detected: m& X3 r0 _5 C* ~* Z6 w! c; p8 P

7 o+ \2 f9 e4 ]; ~! Q% b9 i___________________________________________________________________________
1 z$ G* k# ?4 g+ c
" ~% A% o' r2 A0 R0 f. UMethod 025 j; C! Q/ d9 d+ Z0 X8 a' q
=========
4 Y7 w3 P' J$ i; W7 f9 {9 G
' N" M$ r* U4 tStill a method very much used (perhaps the most frequent one).  It is used  u4 O  F) t3 G, L: d4 E3 Z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 ~' t# |2 D+ R# ~) v
or execute SoftICE commands...
5 V: n# W4 ^) N8 L6 G; H) O4 m2 TIt is also used to crash SoftICE and to force it to execute any commands
. B) q: S7 U% I0 N- A(HBOOT...) :-((  # e2 B# j% O* _: d
; @7 R5 Y0 P9 y# k! u4 v
Here is a quick description:* T; M5 D3 U4 q5 M; T. [5 M
-AX = 0910h   (Display string in SIce windows)
- P' b7 M7 h% [1 @, y-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ d3 e$ r/ \& _! j-AX = 0912h   (Get breakpoint infos). ~' w# x; k' D) g* n7 ~3 v5 r
-AX = 0913h   (Set Sice breakpoints). ~8 [8 f; M0 m' [$ l6 F
-AX = 0914h   (Remove SIce breakoints)
1 }7 z/ `( ?+ Q+ S
! f4 m$ H& o3 r0 pEach time you'll meet this trick, you'll see:
0 _) W1 [& K% u! W6 K- t! B-SI = 4647h
% b$ x+ Z# K; `6 `) m. P-DI = 4A4Dh
2 s; D; u8 }4 U$ K; a% d6 }Which are the 'magic values' used by SoftIce.
' F5 P* m  f6 ?8 `! y" L# i4 t6 ?For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
7 Q! j$ j# `0 Q) n, F" @: S9 n7 G/ ?1 A: s6 U+ J# U
Here is one example from the file "Haspinst.exe" which is the dongle HASP3 _; S" W# D- g' g
Envelope utility use to protect DOS applications:
+ R, t) i7 R5 i' T
1 N" B% G' G. T
( d+ a8 P& I& i. g/ g4C19:0095   MOV    AX,0911  ; execute command.
% Q& \& K! G6 b4 k1 l) Q4 `4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
8 x# q7 i3 E( }4C19:009A   MOV    SI,4647  ; 1st magic value.. F$ v5 [1 M" {9 y& u4 U! O
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 {3 ~- E. I' r; d4 g4 h( l- R
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
; a8 ^2 N6 z5 S( m) Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute8 [$ _& J! I  S) P5 L
4C19:00A4   INC    CX2 [5 q$ v8 J- ?- a( F  g( d) E
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" j, R" ?+ |! b0 N2 ]8 z
4C19:00A8   JB     0095     ; 6 different commands.
% ]/ u- C1 i; d  ]1 C5 W" q- a4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 r# r4 K" `8 {6 A1 x4 Q
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
) I* C$ r3 w3 j3 V- V8 @1 \1 |) e, @( H3 z  P& c% P
The program will execute 6 different SIce commands located at ds:dx, which1 H, g5 b1 m8 C3 e" K' ~
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 Y; q+ H7 K5 E. [: r% t! l

' k6 F* H. b1 y9 o* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 y9 L& k- y% g, b( f" N9 T
___________________________________________________________________________
8 x- Y2 L) ?5 P: z9 w' M( t
# W* q/ l, C" B. E! H
$ z% }( Y2 Y% Q! }' m- WMethod 03
6 b0 p/ t8 |+ w=========1 q7 J; ~9 c" V2 ?5 F' L

; d3 p& h+ ?% MLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 n& E( B0 }) m(API Get entry point)$ d  f0 S' K; L# j! v7 d
        
# X% J  h1 _2 b, x
, P( ?9 x8 M2 i5 B7 x$ R5 q    xor     di,di' q' h4 s) `6 [% C
    mov     es,di
, q. T- U: @; t0 e) c    mov     ax, 1684h       0 W" `7 p9 i6 r% ?, [+ E1 `. h
    mov     bx, 0202h       ; VxD ID of winice
7 G3 {& n5 b6 M) o9 N* s* {    int     2Fh2 j7 K7 d, y* N4 n
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- ^5 I% ^. z- }6 I) E/ U9 A
    add     ax, di
/ E% ^' U; ?" H2 e    test    ax,ax! C& V, s& p# n, {: n
    jnz     SoftICE_Detected/ w* q% w% O" t% E! z

& [" _% C/ C7 D1 r. g+ a; {& n" [+ W- ]' ____________________________________________________________________________
! V; W2 j2 f6 l- G, m2 f
# E  D+ A. w6 l: W. |; C* w; gMethod 04
: {; l1 l+ K8 Q4 `0 C=========
8 P, j2 D% o- Y: g) O1 [7 J' l6 V  w6 H( ~6 R
Method identical to the preceding one except that it seeks the ID of SoftICE
5 |0 J; L* m5 a% y+ E) hGFX VxD.
8 C* [* D3 u5 u( f
: z; u7 {# o/ c6 C- e" O    xor     di,di
$ n9 Q5 r# a2 p+ e2 u3 t6 J    mov     es,di
5 K  X+ h' `' h9 R5 O$ B    mov     ax, 1684h      
1 c! j7 ~8 ^" O4 |* B    mov     bx, 7a5Fh       ; VxD ID of SIWVID; W/ ~/ t% r0 V4 I* J3 s8 {6 W
    int     2fh  \# K# }% Z1 y* @+ [! d9 z' N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" J! J' M* f( ^
    add     ax, di
/ [0 {8 I( `: u/ }    test    ax,ax" M" \9 o& e9 V1 U2 ?0 I
    jnz     SoftICE_Detected! a1 Z, r" [& j) y2 p0 |
" ?+ k& r# i  D& Y& [
__________________________________________________________________________2 }2 Q2 i0 T5 y# M' N" M4 C
2 J7 F1 p, r# O- E; O

% ?: J# L4 u( |6 G( [Method 059 q0 L/ \3 ]' ]3 \; j) [
=========. V/ p- Y! Y/ Y% A( n

6 o- V) l  k- }# a4 I& j5 vMethod seeking the 'magic number' 0F386h returned (in ax) by all system
* X9 G4 S" X0 N5 Z& d- Z: x( udebugger. It calls the int 41h, function 4Fh.
8 f9 U& Z: V9 c2 e$ E4 U4 ?There are several alternatives.  
6 N6 ?1 N- k. [+ s9 E% @
" p" y6 s6 r, N' D  T, C3 fThe following one is the simplest:5 w7 Y8 z0 X! w
; G- U4 ?" p1 a% u& x& Y$ S
    mov     ax,4fh
0 C" g) P6 V+ _- U( u    int     41h
& ]( u7 Y! M- i2 O+ ~/ W  D/ w    cmp     ax, 0F386+ ^" y3 E6 p  F- c- D) K- A
    jz      SoftICE_detected
" @, l+ T& v& |' C3 c! N+ I2 V! r* ]% o% d, t
# P+ f' W9 [2 Q
Next method as well as the following one are 2 examples from Stone's % ?1 c8 H% i0 C3 U
"stn-wid.zip" (www.cracking.net):
3 O$ \$ a' g3 k( z# p! _
4 x- N; Q/ P5 T/ m9 L! m! c    mov     bx, cs
6 W9 c+ a+ z' w1 ]    lea     dx, int41handler22 |; d7 M4 w5 V7 ^1 @, l1 r
    xchg    dx, es:[41h*4]
6 A( e' x/ K# o( F0 A3 f/ Q( j( S    xchg    bx, es:[41h*4+2]
% y. e. P7 L9 @5 p9 S* ~    mov     ax,4fh3 s2 S" p2 N- y0 c
    int     41h
& l8 \$ ~+ t* n# H1 y    xchg    dx, es:[41h*4]
3 g9 N8 t) z5 F9 s/ ]4 d    xchg    bx, es:[41h*4+2]+ S) a4 p: m0 Y0 m- S& C
    cmp     ax, 0f386h2 n1 d3 Y1 ~8 c: _: e% T* U- z* D
    jz      SoftICE_detected
% J* s) w( y- j8 f* i; B9 E- ?1 t/ {6 B
int41handler2 PROC+ ~6 j0 J+ _5 Q5 a7 L& A
    iret9 K; {* s1 w( G
int41handler2 ENDP3 ~( Y5 i* g  [) I+ O
  b  p1 k* U# |

' i, X  C  m7 W, o_________________________________________________________________________: o0 p0 ~5 z& g/ Y( Z1 T' K
+ `( G: U  h* l& u' d$ J

; f: ^; p! p* M4 `) Q0 I, E# IMethod 06
$ j1 m6 V( U, E8 Q+ V9 B. F=========
9 [" v8 j  t8 ]6 x1 ^9 e6 r  l
9 L1 U. Y' d! P8 b" d8 `
. y% U3 E! v- }2nd method similar to the preceding one but more difficult to detect:  k0 j3 [6 d/ `1 S' ?' e% c5 t

3 Q& R( J8 z  T8 p1 U6 S0 T8 b3 ]* J- y
int41handler PROC3 `; h& x  w, x. N
    mov     cl,al% p$ L) K- J# c8 H" l
    iret2 Q- i. l# J0 e
int41handler ENDP
8 I. F% b$ o! O7 W7 e$ Q! H1 b( X3 F

/ k) ^5 I7 a: l; Z    xor     ax,ax
5 y  w0 _) F% j; G8 @+ _1 f: \    mov     es,ax; S+ x, w' F6 d( a& h( _4 g% ?
    mov     bx, cs* A# W9 J! i; e
    lea     dx, int41handler
8 M) V, o$ |- p8 \: [4 C; K    xchg    dx, es:[41h*4]
9 `6 s7 m; c" E) u    xchg    bx, es:[41h*4+2]
6 \# |: T4 R7 E  w2 W2 r( |/ ^    in      al, 40h) d% b! P$ S( j6 O  Z5 D" @
    xor     cx,cx$ T4 j( s$ c/ d; I$ d* \$ d+ @
    int     41h
  x, `. x' h$ Y9 q4 g8 f    xchg    dx, es:[41h*4], k  W: v% q( a& R! Z# ]
    xchg    bx, es:[41h*4+2]) D2 q" E% y- D) u
    cmp     cl,al9 C& w- b+ O- w, i' w) w" L
    jnz     SoftICE_detected
- G3 O' D2 t3 U  \8 d
3 n' [+ z* T6 G* B( h- E2 ?_________________________________________________________________________" d" r6 T* f) r. O4 i3 ~
2 q6 o4 q. Q" A" \3 T2 e
Method 07! x; R8 n! U% x* J) D
=========! o1 h7 d" g- s+ ]9 c

( E  h3 K! ~6 o1 U' @Method of detection of the WinICE handler in the int68h (V86)
8 M! }) A, T. n; `3 f
# [: @4 @' g: \5 q- t, e    mov     ah,43h
& |% Y% U5 U6 F3 q5 s9 F    int     68h
' \7 D0 Q8 u% ?$ l, u    cmp     ax,0F386h8 f: H( m( j6 ?1 A# p% G
    jz      SoftICE_Detected
) C  d2 _: W* L: x
! y' \8 M# E: s2 J* @/ I
+ M1 z- ]3 ?! G7 A7 d=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ M; P# F3 G- X! \$ ]' f   app like this:0 T9 ^7 @! n4 ]7 Z
6 V! V3 a; r! J+ s. G' j" ]9 X# y
   BPX exec_int if ax==68
2 X( p; N0 t1 X1 D   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ v. `- }& C3 B- K9 V, a) Y, q% T9 X9 |   located at [ebp+48h] for 32Bit apps)
) i; w: M5 j% M__________________________________________________________________________
4 [1 v& K5 v1 a4 i% ?- E8 |5 _5 B- g# D/ b
- ?4 ~: D1 W1 ?; ^2 T
Method 08) f+ @7 Y! S$ z6 t
=========/ N* A. \: i( [. \$ E- X* f, q

) R5 e/ s1 y" [( M% Z3 j0 L* rIt is not a method of detection of SoftICE but a possibility to crash the
" i& V* r2 t; F9 C, i2 |) |system by intercepting int 01h and int 03h and redirecting them to another4 y# H" S( W% f) m* b8 S1 F
routine.
$ k' D# x% ]8 y: e; k1 CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 l, P" O1 T! a4 X* jto the new routine to execute (hangs computer...)
% h2 H  ]/ I  P/ ?8 x: n$ l, @+ v2 m( V& T7 T# j
    mov     ah, 25h& m1 ]7 V6 V2 O! D  P1 X( d
    mov     al, Int_Number (01h or 03h)
; l3 m' b! d8 z- q# \( u: [. C1 x    mov     dx, offset New_Int_Routine4 ^! ?: @$ o* ~$ s1 m$ e* V
    int     21h* g" F* J6 a# n4 T& y7 Q

& W! ?9 W& r: d# L__________________________________________________________________________6 \* U, l. ]1 n/ ^

% i- b+ z8 }, g+ yMethod 09- V$ F% m( h. O9 N# Q4 n2 l
=========
4 y7 u7 z+ z: I5 @4 M7 }; L' _$ g
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ c3 K' @6 i5 b9 o7 @& |
performed in ring0 (VxD or a ring3 app using the VxdCall)." p. o  }! ?2 {# i6 ]  A6 X% v
The Get_DDB service is used to determine whether or not a VxD is installed
7 X4 d/ I7 ~5 Q" o# ?0 F" X6 @( `for the specified device and returns a Device Description Block (in ecx) for
% N# Z& s! T+ Z+ ^5 A, Lthat device if it is installed.
' |9 z3 L2 j3 K3 s0 J+ k- W+ p  ~. D) n2 T/ a# {( w8 L( A6 e
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( ?1 ]9 I5 |" ~1 x" k
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 q3 e6 g( M1 V6 |, Y7 z, i( d
   VMMCall Get_DDB1 y: f' U) M: d( I
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 z2 s# i$ [7 ^+ o
3 N' L5 `0 V% c8 h, zNote as well that you can easily detect this method with SoftICE:
2 X  n- G$ m. u; ]6 l. z' P; `   bpx Get_DDB if ax==0202 || ax==7a5fh
5 X( X1 {# f! ?9 |/ U* _* A) b1 d* ^0 U! }' M0 v. U
__________________________________________________________________________
3 C) P, i+ ?$ A( @, E7 t7 j
$ J* e8 ~4 A3 L3 P5 IMethod 10! L; H5 I& C' w3 w& S( @
=========, e; {+ w! W1 D, `
* F9 r+ Y% ^* `; y* N
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
7 c; p  s. X6 M6 `% A  SoftICE while the option is enable!!& ^! J* f" A% K8 x$ ^( Z% N/ t) n

& J* C4 ?2 K# }4 `* g! _- FThis trick is very efficient:+ B& f$ X- R' ~3 u
by checking the Debug Registers, you can detect if SoftICE is loaded8 u' v+ ^; w# s8 s( O2 c
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& S- J0 {, G- B8 j$ J& i
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 T$ M: l& D* g* C9 Bvalue (in ring0 only). Values can be manipulated and or changed as well
1 g: j& I1 ]- k+ P5 A/ c- P! r(clearing BPMs for instance)8 {6 l  v, c/ T! {% h

/ c% \( V0 ~# N__________________________________________________________________________
! M: p* h1 s2 p4 X3 v4 t/ m
' i+ _  R# \# t) O4 Z* vMethod 110 V9 H1 H9 b+ m- ~# P0 X
=========7 E1 L/ I" \3 b8 Z' B4 p: w$ X; Z% Z
) E! R4 M6 I0 \% E
This method is most known as 'MeltICE' because it has been freely distributed  Z3 H8 F: v8 E7 D0 u" l! U; X) b
via www.winfiles.com. However it was first used by NuMega people to allow
; x9 T2 m" H! l( E) Y5 R. U/ T6 r: kSymbol Loader to check if SoftICE was active or not (the code is located
4 `& u7 e/ _' \5 T) g9 `6 d" ]7 Qinside nmtrans.dll).
) M5 }" q% K* W9 m3 `5 E- n7 j9 ]! ]6 U2 v
The way it works is very simple:
$ r5 q6 d% W9 sIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; c' z  h# q1 I" wWinNT) with the CreateFileA API.8 [* E6 U3 c* X1 W- {
  Y9 I/ ^& P) P6 B% q
Here is a sample (checking for 'SICE'):; O3 z1 _# h6 E) U+ T9 n

7 q2 g+ P  r% e- r- Z) i- bBOOL IsSoftIce95Loaded()
& e9 s% q+ D5 h, Q+ k{
1 W2 B2 b7 I4 F/ k1 U% s8 p. a$ R   HANDLE hFile;  
$ F) O9 A3 _4 t7 G5 K5 @   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
. ]% F$ W3 y8 X0 G$ |                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 H7 l3 d% z+ O8 I; N                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 Y% K, G5 h3 m   if( hFile != INVALID_HANDLE_VALUE )
* d2 Y" G9 b' [" Y8 _1 q( W9 _   {2 _; T2 u2 F$ J+ R3 g
      CloseHandle(hFile);
" o3 y$ Q. W# L: M8 Y      return TRUE;
  a. i6 q; ]  n% h9 E' d2 T   }
1 ?$ \' j' z4 r   return FALSE;( r- h6 r- A+ j
}. L1 t# Y  o1 a% _* ^" k
3 w3 r$ U' z) @1 r7 `
Although this trick calls the CreateFileA function, don't even expect to be- O$ k7 e; U2 P" L" j# L& M
able to intercept it by installing a IFS hook: it will not work, no way!
2 @1 u7 S# C7 }$ e  W& yIn fact, after the call to CreateFileA it will get through VWIN32 0x001F, E" j0 n" V. \. U
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% `/ z2 L% H$ s+ r3 p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 P2 k7 b5 l  H% ]field.
# q; k. j2 r( TIn fact, its purpose is not to load/unload VxDs but only to send a
! n$ s8 W+ C  r. EW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 q0 ~4 S* y; }! Mto the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ p* w5 [7 U+ |to load/unload a non-dynamically loadable driver such as SoftICE ;-).$ E" {" F9 a+ n; k1 {  r$ f+ d# Q
If the VxD is loaded, it will always clear eax and the Carry flag to allow
+ d% a2 G: B$ @3 l1 eits handle to be opened and then, will be detected.
( t; X& D. w' Q8 @You can check that simply by hooking Winice.exe control proc entry point$ Q1 C6 \& r: \; H) J" j
while running MeltICE.
5 q1 ?* t3 O5 ^! r3 z  b7 e7 Z# g4 X% F6 z" ~' n' r# C. y, u
# G& ?3 |: [) E" P5 j: F
  00401067:  push      00402025    ; \\.\SICE
, L9 X* p: |, o2 T( n  0040106C:  call      CreateFileA
: T) p7 B8 k# N) D! e- j" E9 s  00401071:  cmp       eax,-001
5 ~% M5 S& {* f+ r9 Z: j  00401074:  je        00401091
9 ^- i# m$ x" x4 Z! u# h, I/ ?5 {  Q: D# j

' N! E; |% k. C% VThere could be hundreds of BPX you could use to detect this trick.5 n0 S# c+ L0 Q4 N
-The most classical one is:
% m# [3 a; X7 c/ V5 e8 B  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 t9 P' z2 F4 [; r! R    *(esp-&gt;4+4)=='NTIC'
/ d7 H* P( s. b" B& S
  ]' i! b% ]& Q) ^-The most exotic ones (could be very slooooow :-(
3 E8 _% w$ w9 s6 ]5 ?6 o2 }* E   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 i; m! z! @4 z* R( @     ;will break 3 times :-(
1 M' U6 p% {& l8 V7 P/ R' m# p7 k! Q' n7 Z  c
-or (a bit) faster: 5 m7 d# j0 T9 ~& j
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, F, p& _7 o4 U9 D
5 w5 u8 @) X8 o7 z* d. O  O   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
' Q4 W) D/ t  _     ;will break 3 times :-(0 `% E- @9 J: ^% b* @6 `! {

8 r# b1 p. }; b: o8 Y4 \-Much faster:$ _  S6 v) R9 b+ q2 q
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ {9 p5 c8 Y# M! |3 \

: R- K; Q1 K2 j' L3 DNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 A. U6 Y3 e& pfunction to do the same job:0 K; J$ q* U, g8 o2 h* [) I) B4 ]

2 M7 Z: \- J7 s+ _- J5 E! A  c* \   push    00                        ; OF_READ
1 @6 t" N4 u9 g- U   mov     eax,[00656634]            ; '\\.\SICE',0
2 W" p4 i, G/ o" [' M) ^4 O   push    eax, a7 |2 c1 j% a+ ^. A
   call    KERNEL32!_lopen
6 E3 Q6 n2 ~% D9 u/ J) z   inc     eax
0 ^9 A1 h/ A3 P- F8 l4 w$ u   jnz     00650589                  ; detected+ [( Q8 U8 v  H% X: _
   push    00                        ; OF_READ  n, d! g! t* k. [% A6 }
   mov     eax,[00656638]            ; '\\.\SICE'; z" N+ A7 ~/ Y" E5 a; Q2 I& Z
   push    eax6 b3 Z. ?+ ?5 k7 T  r0 i
   call    KERNEL32!_lopen/ @1 N" e' E" r9 Q9 V: p
   inc     eax' K# i/ R4 c4 G  m% k
   jz      006505ae                  ; not detected
% o/ z/ I$ l% K) ^0 B
6 a( f& Y5 {* V' U7 E4 P1 e$ X9 A* @- B6 W3 _8 @, X  k
__________________________________________________________________________
  G+ e2 P8 v2 L4 i$ B& E- @: a. ^% C  J& F0 z: S
Method 12% q& q; m2 _  k; w& s
=========
1 n& g  w( B! [7 H+ x
2 v" C5 v0 ^! {; K7 P/ V. L, I+ iThis trick is similar to int41h/4fh Debugger installation check (code 05
3 _% l( {+ x, L0 K. F8 M5 u&amp; 06) but very limited because it's only available for Win95/98 (not NT)' w- U6 D1 l& I+ ~$ K9 e
as it uses the VxDCall backdoor. This detection was found in Bleem Demo." t) P. @  O9 a) H/ B  D+ E

9 I9 e2 W3 S$ R4 g! L5 g* F   push  0000004fh         ; function 4fh6 A* I  l1 W- [  j
   push  002a002ah         ; high word specifies which VxD (VWIN32)6 g  I# g) }7 D; J6 n7 K
                           ; low word specifies which service
% u7 h, L! P2 p; A, \( x# ?& e# O3 N$ F                             (VWIN32_Int41Dispatch)2 P5 k) @; n) A0 N$ k6 Q
   call  Kernel32!ORD_001  ; VxdCall. u) o: k' G8 G3 I# H
   cmp   ax, 0f386h        ; magic number returned by system debuggers( S6 Y8 d! s" j; e. o
   jz    SoftICE_detected& }6 d+ N( `9 m( y  m

0 }- J/ E3 Q- BHere again, several ways to detect it:% K# @4 h9 S% c! i% a2 x
  @. c4 t* p! _. ]
    BPINT 41 if ax==4f
0 o3 k. K) U! [( c  g/ U/ Y" E# |! a, W& S$ O
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& |4 V) e: K* I0 @) c

' ?& l/ ^# T; f0 v% @# i. H    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 P3 T- t) H* @- L

! K( k' q( C4 [; E    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. g9 G. Q4 s5 u: K  @- ]: Y1 B, r/ e
__________________________________________________________________________
4 d/ s1 d% G9 `; w3 V0 L! y3 a8 a8 J; c1 s! K" X' D. b" n
Method 13
( _! w, e6 n. `5 W  i$ l  V" W- u=========
# S/ @1 r) q. X+ B8 V
( @. Y% r- _! [! s4 BNot a real method of detection, but a good way to know if SoftICE is# B' }# s) K* P8 O2 f9 c7 a+ |
installed on a computer and to locate its installation directory." t/ x2 r+ Z4 B4 K' v2 v
It is used by few softs which access the following registry keys (usually #2) :
/ Y) x7 y' w" z- S4 l% Z9 I8 ~
4 ^: T3 y# F( Q8 g% t4 h9 H# k-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 ~: G+ \8 j! G- W0 u& x7 \
\Uninstall\SoftICE
; P! A# D5 M$ m5 y& P-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ A# l$ r* R2 p* f-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' x1 K& C+ Q4 I) e$ Z) c3 p
\App Paths\Loader32.Exe
9 J9 l3 x# m5 ^  m* Z4 ~( o- H9 H4 g# i1 O9 O, f

* f# y$ D  }4 W& v0 P/ MNote that some nasty apps could then erase all files from SoftICE directory
) E, U2 a3 c- C- r) e! i: T, U$ w(I faced that once :-(( z2 X  v6 }3 G: m8 H7 E
" w& J, G* Y0 N
Useful breakpoint to detect it:7 Y: H* \- T" G0 w0 U/ \
- K! K: \( ]3 t( o+ H# z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; m, w' }2 y" `
$ J  Q1 o$ T$ i4 n% C# }$ o4 ?- |__________________________________________________________________________
' {: Z5 ^. g; `' v; J4 a6 i4 I$ T0 t4 V

  V6 v* {/ ~. o( z1 ~: T; r& O5 NMethod 14 % X8 d1 p* x# A7 v
=========
' G! N( ]6 @3 L% {' C( ^5 ^9 H6 M; v- E7 b; m, ^0 g2 @" f+ }4 P
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ p0 F! G% f" R  j, d  i0 ?is to determines whether a debugger is running on your system (ring0 only).' e) G3 _6 v* n  f8 [

* h: S( S4 N* c( f9 R" o   VMMCall Test_Debug_Installed" C* A, f1 V' m# @5 f/ t
   je      not_installed
" e3 F, Z- G9 s$ a6 \  W& y0 e7 |* B, }; X* }
This service just checks a flag.
. A4 E1 ^. r  G</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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