About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& H/ U$ \3 {- h, [# L7 ^# }<TBODY>
) B5 ?2 {- d' V. N/ G+ M5 f<TR>( `2 W) D* Q# T7 Y- z
<TD><PRE>Method 01
6 _/ H' M) h) K; {: a: v$ G. l=========
( a" O' `5 f9 L8 b" A* P+ P8 a- J+ T/ W4 j" @9 n
This method of detection of SoftICE (as well as the following one) is
" h- v+ F' Y2 n) h2 o8 h) I4 Rused by the majority of packers/encryptors found on Internet.
1 g  Q  H) l( V2 B6 `) Q( `! SIt seeks the signature of BoundsChecker in SoftICE- z& i8 X2 u; V, o* k. [

# U7 ?  V* A5 R4 E' A    mov     ebp, 04243484Bh        ; 'BCHK'' m3 W. `* g0 x; d6 T0 x% g
    mov     ax, 04h
4 ~- h3 X6 ?  j4 F    int     3       " G. z0 o# d8 v/ w( h# k
    cmp     al,46 Q+ j' s, `0 G
    jnz     SoftICE_Detected
! S0 w5 `! q3 j: n* T  L, Z" }* T# d# C6 a
___________________________________________________________________________) @+ p$ Q! z+ i! Q* @/ {0 s

3 n2 U( F7 j8 t, UMethod 02
7 {. Y) Z% P5 u. l=========9 n& [* d( i" L* p. p) r, s

: d; L; o$ q2 h" f2 OStill a method very much used (perhaps the most frequent one).  It is used' r4 [* g" b' E9 I
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# v. ^8 {# S5 x( }- o1 Q8 f1 @( por execute SoftICE commands...: K$ G8 q( K% O
It is also used to crash SoftICE and to force it to execute any commands
5 v3 W7 C' G# m- M(HBOOT...) :-((  9 R1 Y- c. U0 ]- W# b) K! i
5 Z% J) Y; Z  g5 \9 T
Here is a quick description:$ R" R2 F' X5 @9 g0 G; _& \
-AX = 0910h   (Display string in SIce windows)
# h# B: f6 e( C# V- h/ E-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 Q- e$ n" b1 Y; e# T) O
-AX = 0912h   (Get breakpoint infos)9 Y5 Z) W% F  m6 X! |" m9 ~
-AX = 0913h   (Set Sice breakpoints)
+ g. c4 P2 \( X# x; r& k! f-AX = 0914h   (Remove SIce breakoints)) j  I9 b/ S% y- A

/ b4 o+ I: r3 O0 e# }% gEach time you'll meet this trick, you'll see:
. ]3 K& f5 Q! _: h. b-SI = 4647h
$ p3 |, k8 `3 {2 @-DI = 4A4Dh
7 t5 L: P0 h+ n4 n$ K& G% vWhich are the 'magic values' used by SoftIce.8 ~$ @  W9 u! r% C% f  p( K: l
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.( L' F+ Y! O7 z  N  T# f

8 X2 H/ `3 a& [, tHere is one example from the file "Haspinst.exe" which is the dongle HASP0 e0 s$ O/ c* J" Z  F
Envelope utility use to protect DOS applications:
  L9 @7 \; |9 l4 E% T
) B/ q6 A; v# [: }) |& c7 w* R" x* x) p! w: C
4C19:0095   MOV    AX,0911  ; execute command.$ E9 U! O1 e) R' u
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).3 W! @, e% g4 e) O- U
4C19:009A   MOV    SI,4647  ; 1st magic value.
  O9 Q$ g+ g/ L5 V4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 t& b/ ]6 j$ |3 |. ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*). @  L+ g8 S$ f5 B3 m. M+ M+ P
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- B4 \: O+ {: e' {5 M$ B
4C19:00A4   INC    CX' H; U& D/ I1 E( N2 f
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& N8 \- A0 d2 _- b: \4C19:00A8   JB     0095     ; 6 different commands./ P$ r1 G! E. R& n: T+ a, E; h" E
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# u* Z# D( y* p9 n0 ]6 S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 B( M+ R; f0 t
2 j9 ~4 @# R8 X+ I+ R2 g. n
The program will execute 6 different SIce commands located at ds:dx, which
: [- X8 i# b# ^$ M9 z. K/ I$ ^are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 e' I: u0 {7 G4 P* A

7 J9 q; }6 O3 x! z& U7 H+ q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 @+ A) H5 R: ]! Z. l% G
___________________________________________________________________________
" f% Z7 A- |; I: J- B" |$ t! l3 \3 q3 ~# s

: n. W2 q$ p2 x$ n6 K  \! K7 `" WMethod 03
% R, x( Z; L) ?+ t2 e=========
+ }4 l* l# m$ [1 R# V5 p$ G' ~5 |0 m7 T, f4 n; p
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) `+ Q/ b* _8 c
(API Get entry point)
( @: P2 S% B- i        : l9 Y: t( d4 o" c5 ~* z9 U! ?

, J4 S% m& I# J- d2 ?    xor     di,di& D/ c2 ^- O! A  |! W. C
    mov     es,di+ ^! h: h9 p. W
    mov     ax, 1684h       / _9 ~# E' H  q5 o
    mov     bx, 0202h       ; VxD ID of winice
+ c, Y; E1 e/ Z' a( N2 k4 }% A$ V% R    int     2Fh
: ]3 j# X9 v8 w9 {5 v! G    mov     ax, es          ; ES:DI -&gt; VxD API entry point; |7 f3 W# y! [/ x! J8 T: T
    add     ax, di2 E4 J* {2 m; w0 A3 j# L3 K
    test    ax,ax
$ t/ a" R; Z8 w& [! a7 u    jnz     SoftICE_Detected
6 f& l0 j* ?$ Y; b; h. C
; g6 U3 w- i4 R  p( s___________________________________________________________________________
+ B6 k$ e" |) Q+ B
; g& S8 k& d' t, V; F% {1 ^9 g  ?Method 044 F; U7 n$ W% m9 I
=========
+ U* L/ M, ]0 k9 u/ H6 ~
/ q5 L% p8 I; l- sMethod identical to the preceding one except that it seeks the ID of SoftICE" F, N' ~9 m: J% N* G3 C
GFX VxD.
: v+ q9 M  S; V6 L4 G/ e' S; r6 b: ~; s7 R
    xor     di,di
% V$ d( }4 H) a4 `9 [0 G    mov     es,di
/ s2 w0 y# u' Z; b. b, q8 D    mov     ax, 1684h      
: b7 b, r( z; l    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. q( _6 t( z0 \) y    int     2fh
5 |. L3 y$ B2 \: {    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# ?* @8 A& U3 Q, z1 H8 w8 B    add     ax, di
! w5 k# L% P# i& |' B# Q    test    ax,ax
0 A$ ^* b, n3 I  D$ \4 c3 b9 X    jnz     SoftICE_Detected
. |; J* {2 r3 x: z) ]9 Z) j9 B* @; [2 c+ \! n( `
__________________________________________________________________________
9 Y8 U& N0 z( Y; n. J/ J* ^/ ~6 Q$ y( x4 y, ^7 @
9 O$ B- e: [& {0 z, _9 D9 K
Method 05, f& T# R/ O( f
=========
3 r2 `- _( Q( e8 c
) G& w( l, X9 B! g( t+ i& c6 uMethod seeking the 'magic number' 0F386h returned (in ax) by all system3 T. U7 M9 H" {" o
debugger. It calls the int 41h, function 4Fh.9 U4 J7 k- m# O: g
There are several alternatives.  2 _' M9 Y( v% W

( p' J2 K( z! n- z6 r* oThe following one is the simplest:3 w7 W  @5 S9 w6 ~: e7 Y
3 C2 B( v  l: \6 ]7 z# H
    mov     ax,4fh
1 x% u, {# q5 K/ w* ]    int     41h
' ^' P. q# M6 [/ C+ w    cmp     ax, 0F386! W# o7 r( ^5 l! r
    jz      SoftICE_detected( M$ T* K: s1 w% N& \

9 P: m1 \8 q2 W" {" v. l3 }, H6 M1 Z% s, x) K# d9 t! R3 x
Next method as well as the following one are 2 examples from Stone's % U2 Y9 v* P$ H  ~/ h+ [
"stn-wid.zip" (www.cracking.net):9 s0 s1 {$ R; e1 t

  [3 y+ |+ X  X+ k3 K" C# ]    mov     bx, cs: \' w- h- E4 I) u* W; A. b
    lea     dx, int41handler2+ w# P) ^1 a+ S5 R8 O
    xchg    dx, es:[41h*4]  K' M! @2 B2 k7 z+ U1 o1 e
    xchg    bx, es:[41h*4+2]3 p% X: t1 s1 f
    mov     ax,4fh5 M  t* p' G& t- c  o0 v7 P" w
    int     41h6 c# w( d  _% M  h  X# `* d4 b
    xchg    dx, es:[41h*4]
# I- X7 X* m# v    xchg    bx, es:[41h*4+2]1 A1 n1 @/ B) C) U" ~! ~
    cmp     ax, 0f386h( Q7 w3 ?, m5 P6 E9 Y6 N; [
    jz      SoftICE_detected4 p# ^+ O* ^4 h
0 W4 c$ F# i6 U; q# p
int41handler2 PROC8 }& f- t& U# I5 Z5 v% D% g
    iret/ y; i0 X1 q6 m9 }( c/ y* o
int41handler2 ENDP
6 V9 ^- Q  [0 h: u
1 y; i( z7 p# a3 V- s. B2 ~* k( H, _8 w' L, N
_________________________________________________________________________% m! U7 Q! \6 ?. J. A
" l( C% j4 O0 `$ a9 H

4 t9 w6 E9 x( S) U5 e; MMethod 06
9 U4 B& q* T) u; J) k) ]2 H2 c! p=========
, u2 z7 y, x0 W$ x/ K6 e0 [2 d$ y' s, ^" z5 p, L/ _$ C4 n& B4 f

' Z) n$ t" Y5 w8 U2nd method similar to the preceding one but more difficult to detect:
3 d2 r' S9 F) d3 M/ |+ ?* S+ ?( T- b" r1 `7 A2 J2 @
9 a6 [+ ^' a5 O5 e# c+ s
int41handler PROC
$ P: a4 R1 b% x& o    mov     cl,al) h6 F& G, n6 _& f* }$ M
    iret! X$ G: [. z& F/ J* [' Y% `: h
int41handler ENDP
7 ?1 _* K% @' o1 L. X
& ~9 W0 G, n7 T. a5 E1 s
# y9 V4 @1 }$ @: R    xor     ax,ax/ G3 S2 Y9 [$ R: K" z
    mov     es,ax
' [, t& D: x: n8 E    mov     bx, cs
, g! i. J) H7 h6 R1 Z7 m. Y    lea     dx, int41handler& W; o& h5 j. j% ~
    xchg    dx, es:[41h*4]) l6 n$ z$ Y% y2 m7 y1 z2 T
    xchg    bx, es:[41h*4+2]
& P5 I8 ]- r2 K& v, x    in      al, 40h2 b2 Q9 Z2 j* G
    xor     cx,cx! G2 B7 h0 L. f) s* q4 X: X
    int     41h7 f8 L- ~# I$ `% K& k
    xchg    dx, es:[41h*4]
0 J- Z4 ~- a6 J$ {6 P2 A    xchg    bx, es:[41h*4+2]
+ G# k2 ^6 _# H  |& r    cmp     cl,al
9 C! u9 Q7 l) [) f% ^% @    jnz     SoftICE_detected
) |( I; V& T* \' F; w
# z4 E0 d. D1 }* y_________________________________________________________________________+ K$ E2 q0 b7 ]
" V( y' \( i/ A/ w" ]
Method 07: E/ C: Q2 X1 d& I6 n( t
=========% n$ n! r2 [: ]) r  i  k5 G- h
% H( h# G$ Y( {7 U4 K
Method of detection of the WinICE handler in the int68h (V86)1 N! R, g) U6 F4 B: c  \# @. A

) a' c$ o% n8 c/ a+ T! D: p& M    mov     ah,43h
% v9 O+ i" ^# d( X% Z5 N3 T    int     68h3 H: l) ^) `) k
    cmp     ax,0F386h
# P* j- y( ~3 h( ]5 B. M    jz      SoftICE_Detected
3 Y) c& W; f4 f- b3 T  n+ z; c( r! R5 W# p+ k2 C& c
# F; v9 s4 _" ^2 A2 N9 e: D) ~( }( a
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 }) T# {" l) X9 s3 @   app like this:
- M# j# g, F* J; Q* ^/ l' b0 Y7 R+ F: c+ ]2 [2 _+ g- i
   BPX exec_int if ax==68: M# l# U. j2 M" F/ A; r  L
   (function called is located at byte ptr [ebp+1Dh] and client eip is/ Q+ w5 _) G% }$ B
   located at [ebp+48h] for 32Bit apps)5 s  y1 t7 l- r9 k0 ^
__________________________________________________________________________+ t/ @; I' r. _9 ]# N. |

! A& [( }* R7 O0 u
7 K! s0 s# T- m/ I3 v# TMethod 08: n0 D" h% M" Z0 H2 X
=========
: ?  j# j. K/ d& @
. U4 \& t( x* s! |' [' y' H9 hIt is not a method of detection of SoftICE but a possibility to crash the; G  p* H2 @% K0 Y$ {0 g
system by intercepting int 01h and int 03h and redirecting them to another
: ~0 c! U) e" F/ {# i0 broutine.
: ?1 N- S$ p. W5 VIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" R) ~+ l; T" @; Lto the new routine to execute (hangs computer...)
  |& o1 i, b: c7 b2 W5 l( M0 l7 ]) b6 K7 J( M
    mov     ah, 25h
! _# z8 s: y* l" q" U    mov     al, Int_Number (01h or 03h)& L# O; D- J1 v! E, T
    mov     dx, offset New_Int_Routine, X0 Z" A* {/ |' ?/ n$ F
    int     21h3 h  [8 d8 l/ N4 s/ N  @) [
2 i. K" }9 k; t. _' ]6 {; r
__________________________________________________________________________
8 ~& V5 m0 ?$ o) ^5 W" D" ~1 O# ~( @
Method 09
6 p- Q8 b% r" @( L=========
, U5 _" r% H  Z# {* v/ Q) Q# T5 t0 W
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( M( ?6 x2 @- h* J; e. q6 \
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 u2 f2 y9 A, ~8 }$ }% CThe Get_DDB service is used to determine whether or not a VxD is installed
! M0 v9 F, l5 Y* efor the specified device and returns a Device Description Block (in ecx) for6 ^8 J. J- D% ]3 ~4 E2 `
that device if it is installed., ~" t9 `- c1 Y3 e8 _
! I9 j5 V/ h) f2 ]5 P9 T
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! b5 E" o. ^% n7 b; G" F
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
7 I. d# [! P/ R   VMMCall Get_DDB; B( ~+ x; G% B$ c# k
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 J8 M8 [/ H3 _$ k+ J! u# @- k/ z. T0 D2 d$ ^
Note as well that you can easily detect this method with SoftICE:5 M  S( _2 H" u7 }9 i3 B9 U/ T
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 K" q, E3 c, B0 H
/ c5 a; R  ?# N3 B  {5 Z' k__________________________________________________________________________! |( |) ]$ u5 l8 [8 z& s4 o. D

$ J0 u2 }- Y0 ^- M9 cMethod 10  V0 R) y3 B; {
=========
* N& s8 M& S/ |# l1 r- g2 W
( }# I( B" N3 w( M=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 Y- r( h, x3 L  SoftICE while the option is enable!!
, t) \. N4 X0 `0 `, k1 v: M$ i7 r5 k. h( S" Z2 P
This trick is very efficient:
  k- {& Z% h9 s0 \* G1 {1 Uby checking the Debug Registers, you can detect if SoftICE is loaded
8 z; G" Q# k1 C9 s(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
0 }2 V! s0 N" k! wthere are some memory breakpoints set (dr0 to dr3) simply by reading their; k% }( }" W2 p4 E. L1 S1 C
value (in ring0 only). Values can be manipulated and or changed as well
4 t0 |, z. O4 s. I) \3 J6 J# q(clearing BPMs for instance)+ z" @4 T! \; n" w8 _. N" j$ R' j, N
- }4 \$ L4 g" E( l' j/ b6 i
__________________________________________________________________________
/ j# ?  `2 L4 k) f/ N( L% h6 m! a( T: [
Method 11
; n% M$ c$ r) ?- [  f; F7 I" {=========: u% L* j# x) A8 C& \/ E& N1 G

+ `3 r: Q" _0 B* K  x3 ]' YThis method is most known as 'MeltICE' because it has been freely distributed
% f8 [* @3 U* M0 t3 rvia www.winfiles.com. However it was first used by NuMega people to allow
* @: ?, @) T. T1 r+ y8 iSymbol Loader to check if SoftICE was active or not (the code is located! U/ g; M* K: m" A; d8 @' c- s
inside nmtrans.dll).' y# d" ~  k# h/ B

3 r* B# X; D' \7 VThe way it works is very simple:
" ?. `2 B0 B' u1 Q# K5 `3 K9 VIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; S% c  C1 @1 i+ w6 A6 d. ?9 S7 Z
WinNT) with the CreateFileA API.
2 M# j  r# Y" W7 b  O% C+ w; m" f2 d* u4 ?; A$ j9 q# n6 Q+ E# J
Here is a sample (checking for 'SICE'):
% c; L0 R1 t* x* u8 `
2 m3 b5 q5 W  k8 [+ Y  H9 JBOOL IsSoftIce95Loaded()/ R" n  B: _) o) ?8 H# t1 w( v
{
: h& s1 d  Y" q+ I$ \& _: L7 v9 n+ F   HANDLE hFile;  
; D2 x( i* v8 G   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 ~& F, H: v0 Q) Z, z1 I' S                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  w( s6 e& l& V3 F: \; h  Y, S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) p4 h/ b6 Q( m' d1 l3 J   if( hFile != INVALID_HANDLE_VALUE )
/ g! G1 b! {* \( ^$ L   {$ O) e  ^9 w& v5 R$ Y6 W
      CloseHandle(hFile);$ Q7 ^7 f1 d+ d9 M, F
      return TRUE;
5 D, l$ J) D- ^& G. L   }+ ^; }0 E0 Q) p' P' C
   return FALSE;
4 P6 c' D! W) T- L}
( e% q* f$ J  V  a% }8 E  S' M# N5 }- ~! E- @
Although this trick calls the CreateFileA function, don't even expect to be
1 v- {0 H2 m5 g; u2 Lable to intercept it by installing a IFS hook: it will not work, no way!. C  ~3 w  l3 Y1 `6 O( ?5 j- J$ S  s0 c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
$ r% V: q: g/ U! }service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 I& s) g" r. W1 R3 Z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc" P% u, l& g! A2 x& m5 S
field.' G3 C; W! ]8 U: ~1 V, n  [9 J4 o
In fact, its purpose is not to load/unload VxDs but only to send a ) u4 r+ W0 F- O7 p9 i
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
2 Q' K1 @6 H$ ~* Z  qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 H2 Z. [, N3 o+ C2 ~to load/unload a non-dynamically loadable driver such as SoftICE ;-).& M" v1 b3 ~( w4 \8 w- Z9 @' ?
If the VxD is loaded, it will always clear eax and the Carry flag to allow6 b# E  d% @9 z, N
its handle to be opened and then, will be detected." B" L" r4 |  R' S. u; `
You can check that simply by hooking Winice.exe control proc entry point
4 e3 k: K) q) w* d* |2 E+ }6 @while running MeltICE.
. b% H5 O4 i% K; }. F1 z4 O0 L% M* |* s# {
; ]$ A" Y. B' _2 G
  00401067:  push      00402025    ; \\.\SICE
' c7 w/ L3 g" s& Y3 H  0040106C:  call      CreateFileA% n# q: s. A% r9 j/ z: a
  00401071:  cmp       eax,-001% e; d6 y. N9 C- M( V, m8 u
  00401074:  je        00401091% C0 K/ ?" m, ?9 R8 j# o0 `
* A# a% m. B4 {$ i

' Q+ G- w) q* ^" |- IThere could be hundreds of BPX you could use to detect this trick.
8 A- ?, ^. v( ~+ S-The most classical one is:
; l# G* m9 s6 x  e4 ~  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||8 h+ r+ Y+ A/ z8 E
    *(esp-&gt;4+4)=='NTIC'
/ J2 R. s! e$ z3 H6 J
* y0 |( R" p2 ?5 F% _( s0 w-The most exotic ones (could be very slooooow :-(/ B. X  a* W$ x1 C1 w5 ^9 a/ z: h
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  7 N2 k- n5 t2 u& m
     ;will break 3 times :-(+ U3 a- M0 D- C) S: }$ s

/ ~7 ^4 c+ M6 m# a1 M; a-or (a bit) faster:
$ D0 {2 k* W0 [) ?7 D0 o; l9 e' k   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
% z; `  A) u% {& r1 S. W. u) G0 f5 f9 G. |7 k
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& F2 ?+ @$ C) H2 c1 Y. N5 k     ;will break 3 times :-(
' O- n/ E: A3 |% g' R- x  B! ^  {8 P
-Much faster:
7 g7 }% U. Z" }5 {' W# z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# w) q: q$ O6 [6 w0 g" a% V1 {
6 Z; D5 A# R# mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 v' b5 C) D& t' m8 I, t- mfunction to do the same job:
% |4 w! S4 G+ V* k: v; u* x" @& F. t
   push    00                        ; OF_READ
  Z$ H3 D% f# s6 n/ P   mov     eax,[00656634]            ; '\\.\SICE',0
% c1 o, w* {, C2 G3 ?! N2 j   push    eax6 g7 ^  ?* m# @( [. w1 @2 A% e
   call    KERNEL32!_lopen
: q, G& z+ X- _' F& d5 N   inc     eax
) t, B1 l' }; e, ?) V/ {: E* ?9 {, e   jnz     00650589                  ; detected/ b* G) [' c* R" D. @& }
   push    00                        ; OF_READ
7 h  z# r. a6 b9 `$ c6 D   mov     eax,[00656638]            ; '\\.\SICE'
. ]! z. l" U, G* W- r# o   push    eax0 l1 `+ [* k- L; \; G$ n. m
   call    KERNEL32!_lopen
. X- X* X5 p' W) ^2 [. u, E   inc     eax
8 L! _3 \1 w6 B) c# c   jz      006505ae                  ; not detected; B) F3 c0 U6 @7 h' p- n0 T0 T
- V' g( Q2 E. z

9 X: }' a* ~' i5 C% t. ?5 [__________________________________________________________________________
& X' E& `: s4 b6 i0 s6 [
8 x% \) T2 [% S( x' L6 H9 G" HMethod 12
( v- M! U1 I) P0 U4 ^2 t/ e, ?=========
  e& O' ?; g+ i8 |8 e5 l
' k( u. i4 `6 H0 AThis trick is similar to int41h/4fh Debugger installation check (code 05
" X( C. w4 r6 S: n& q$ E; w& Z&amp; 06) but very limited because it's only available for Win95/98 (not NT)- G% {+ K# L/ a) t, D
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  {3 D) f& D1 p/ p, I
+ |. E/ O" ?! L4 v   push  0000004fh         ; function 4fh$ i! S- z5 p+ f" e) B
   push  002a002ah         ; high word specifies which VxD (VWIN32)
" p' X$ c- B/ z6 n9 E' D. R. d2 d                           ; low word specifies which service% ^) h% r- ^: o
                             (VWIN32_Int41Dispatch)5 a& P4 Z$ d+ \2 T8 ~
   call  Kernel32!ORD_001  ; VxdCall0 b1 m+ Y, x. f
   cmp   ax, 0f386h        ; magic number returned by system debuggers
# D0 V7 X1 \9 `, A   jz    SoftICE_detected
- v8 L8 P3 _4 |$ R* R3 v  _4 K/ A
Here again, several ways to detect it:
, E  O$ g; d6 v" }" M  `# g
* S0 h4 q# y5 u6 H% a; G! g" i+ M    BPINT 41 if ax==4f
# Y$ l9 n& f/ T, _8 K
0 j  _4 C5 e5 }/ d- t$ l% `    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 u( ^/ o. m9 J; j& g

9 g' e4 j; k3 ~& \) _    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A6 |8 g1 W. u3 x5 p- p, z( O
: J4 _- q% j0 m3 C/ ~
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' @# w( f& e! r0 a6 ^% R3 S- l' Q# d* L; n
__________________________________________________________________________$ C+ s3 q5 G1 O7 _
6 M0 L% I3 K( }  [$ _; }
Method 13+ s% a1 Q1 K/ O8 _! r5 |
=========! f/ V0 u1 b, S% j7 n6 z  _/ m
! M2 f* o* f, i! F' f1 G
Not a real method of detection, but a good way to know if SoftICE is
& X5 h3 L. k8 m, x  Z4 t) }/ n) Hinstalled on a computer and to locate its installation directory.
8 w# C5 S# I2 ?! yIt is used by few softs which access the following registry keys (usually #2) :
1 L' K; r/ n; B2 e, G9 t7 h2 G: U6 n: k1 {! `
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& B. _' n" s/ q6 v0 ?) j* }
\Uninstall\SoftICE
, r  j& v9 `* n. q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE' a. g1 M3 V9 r3 s- t. l- |8 d. p  c
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* p' ]4 \: c( Y: i. s\App Paths\Loader32.Exe7 q2 ~9 `& t8 z, B
. Z5 d7 v; g; {. C
) e( p7 \8 R7 d8 }7 {
Note that some nasty apps could then erase all files from SoftICE directory7 i" y. |% H& k( n' S- @% L
(I faced that once :-(
* g6 b% k) a, o$ C: h  O" e+ d$ v2 c' ?. U
Useful breakpoint to detect it:2 z: j6 ]5 {* O! g
( L; ]( M( [! f# q+ w3 e
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 `* l* Y* w/ Q  [6 M- a
" P7 ]3 x% x: C& ]1 Y4 A, T- k2 d__________________________________________________________________________
' R9 n: b. i: K& O- D  l1 W. Z( N$ N7 ]% x1 T
4 ^7 D6 ^4 n/ g* m( ^/ u
Method 14 # i5 `& d$ E& w
=========4 H9 `+ F7 o0 C1 E. C- L. Y

# m1 F+ i' i3 X5 ?: X& G1 M) vA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) s* c2 E0 G& j: }
is to determines whether a debugger is running on your system (ring0 only).$ j3 _& ?# m; F) u1 i5 S% \

  {9 C0 ^3 Z. \% c   VMMCall Test_Debug_Installed
4 q% A- d( K% b! x- D   je      not_installed
% d  d2 J0 p$ g( F0 f
' i$ d4 A4 c3 G; U/ n/ Y0 n9 Z3 w5 ?This service just checks a flag.
  m: s' R2 ~3 r8 o8 ^( b0 d5 T</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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