About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 j4 N5 _; K. ^5 [" V. X
<TBODY>
0 r, w0 B# J7 W<TR># O8 d$ p/ V# G/ \% B# @
<TD><PRE>Method 01 + @! [6 Y, k' p, `/ a- c
=========6 g  c* R: N' F  m7 N& |

8 H, `' r  }' P: |3 v7 G) ?This method of detection of SoftICE (as well as the following one) is
# a1 V/ N& L* A  n0 S0 i2 F2 Mused by the majority of packers/encryptors found on Internet.- T6 J! h. J; i7 L
It seeks the signature of BoundsChecker in SoftICE; r. J( g5 I2 D% _* ]: _

5 o- O( H, R3 d. t) K  |    mov     ebp, 04243484Bh        ; 'BCHK'( t5 C+ {1 D5 ?9 q& r& p
    mov     ax, 04h
. Z' L. `8 V- j: J1 r% X    int     3       ) R$ X+ l: j' N# A! \# a! P3 ]( Z
    cmp     al,4" u9 N# P2 g# Y/ F
    jnz     SoftICE_Detected
$ c! f7 F+ S5 w: G/ P- G1 D
( F6 V5 x; n. C9 l( ~( r- Q___________________________________________________________________________
* A* a4 P& q$ E& u* s3 ^* T
+ m3 p' E, e' Y+ P, lMethod 02
3 E% a  q$ Z. E1 f* k) j( x=========2 s; S+ ]) s7 H7 p( n
: N, D- l+ y# ^1 T7 [
Still a method very much used (perhaps the most frequent one).  It is used
4 s) D7 d% v; W* ^4 zto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# |  d( }2 R6 l9 u- o! R, Yor execute SoftICE commands...* o- y! D9 E! ?  G2 ?# `
It is also used to crash SoftICE and to force it to execute any commands7 M# n9 W9 D% A7 D
(HBOOT...) :-((  : {9 I. q7 D( ^" ^# O* h3 V

  x) Z5 L/ X* X, NHere is a quick description:# i. |. x- k7 I5 W$ U: N* u0 s
-AX = 0910h   (Display string in SIce windows)
1 e5 o0 [% S, X( _-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. A1 W+ g2 A3 _$ C5 a-AX = 0912h   (Get breakpoint infos)3 I1 S( o" }- ~/ T8 E
-AX = 0913h   (Set Sice breakpoints)
( a! ?% S& b7 E6 c: O-AX = 0914h   (Remove SIce breakoints)% J( A' ]9 i% I/ l3 V/ i' s. K; X  t8 Q

; n7 k& _) ^4 REach time you'll meet this trick, you'll see:4 [1 ^- f" i$ k7 O# j; Q  f7 e" b
-SI = 4647h3 Q- r8 E( h) m1 T* q' h9 g* u$ \
-DI = 4A4Dh
% G" Q- e% S9 V$ C1 S- O% h: s0 FWhich are the 'magic values' used by SoftIce.. w; H" c. G1 J
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" ], L& E7 M% A" g
) S- D' `/ a1 @% v7 O7 Q3 O+ EHere is one example from the file "Haspinst.exe" which is the dongle HASP" Z9 I6 C' V/ a/ p& M
Envelope utility use to protect DOS applications:
  J3 g1 X/ O# j0 Z8 V! x% N# n; |7 b/ O# [# ?" H
% p1 o! `- K# a* j9 h, Y8 G
4C19:0095   MOV    AX,0911  ; execute command.* k8 T* `5 M# X" [9 I3 z% E- e$ {
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).7 X6 S7 K& ~1 A7 r) X( e
4C19:009A   MOV    SI,4647  ; 1st magic value.' \" I& W& g" [4 A  {
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 M( B+ j: d, N8 w0 {- j$ U
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 F' w( ^+ o7 G3 f5 G8 B4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 R5 C  F" _, a' S4C19:00A4   INC    CX0 `! _. I+ F4 e7 l' w3 ~2 A
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! p9 t  O! b9 `3 G, y5 _4C19:00A8   JB     0095     ; 6 different commands.% w  H  R, s/ |' s  _  {7 g+ m
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 h/ g0 d, H7 L+ Y5 u0 a" w4 f
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)1 ?1 g% J2 H/ H7 j+ Z

$ Z& h$ d; _. P0 i# b) WThe program will execute 6 different SIce commands located at ds:dx, which9 b5 x. i' e' m; w. E) |, {! Q
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.8 `5 p' K2 I9 C. Y" `

4 Q+ y3 S( t( U! I0 E* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 |, J$ l9 t7 z3 v5 X: ^___________________________________________________________________________
5 E9 V1 r- M/ L0 X, O! ^; I; J) M
# h1 k5 R! j- e, ?# @# z5 q
Method 03% p' q) a; |: }
=========
$ i; P! Z+ i# a0 z
4 f. K+ o5 H+ g$ @Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ O$ T% J5 U, B7 }4 {- ?
(API Get entry point)
8 E8 p& O( a1 d. E  h' J' \        * }1 |& ^" X  }5 K: {# _9 J

3 o8 t' b" \2 k! J) V3 \3 v1 M    xor     di,di
% f  y8 Q5 A# B$ D3 z! W( U5 }    mov     es,di
: \0 m( A+ @; e2 \4 f+ c# z$ g/ v    mov     ax, 1684h      
* o" N% ^( a& V    mov     bx, 0202h       ; VxD ID of winice( X& P# ~/ x# H. z
    int     2Fh, Y, {& _3 z2 B6 u. h/ b' _! {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  s7 m* K5 E# r3 f# d
    add     ax, di
3 }1 G4 p7 l2 s) U    test    ax,ax& @! p8 B+ W+ s4 R, g; a  q
    jnz     SoftICE_Detected  {5 V8 [! Z* ^# y2 Z) ~4 g# y
' V& l( x! T3 e. Q# `
___________________________________________________________________________
* w0 ^& r% U! ]2 _' ?5 @. h7 j9 }# [: b
Method 04
6 Q) u1 T) s1 g, z, h: T) _7 R=========# p% S8 T9 Y2 J; {
+ v3 s- Z4 U, o; n" W
Method identical to the preceding one except that it seeks the ID of SoftICE+ a- e$ B. Q8 w2 ?
GFX VxD.
  Q% \. V; ]" u) U8 U# h: a8 Z5 Z. V" D4 O
    xor     di,di
5 c1 h+ Z- ]8 O% {* y+ G    mov     es,di
2 t6 ~8 u$ k9 X. u; U    mov     ax, 1684h      
3 P. X: k' o3 @% |9 r; [% \3 F    mov     bx, 7a5Fh       ; VxD ID of SIWVID. w9 \- v$ B3 @0 {3 v
    int     2fh
" s* C" k, u0 z3 Z3 a1 l' X    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 N7 O3 t5 r( r  h$ A& B    add     ax, di% h& O8 q: X. Z
    test    ax,ax
; w; c' D5 x$ R' D# l4 [: e    jnz     SoftICE_Detected
6 ?  e7 a* h: s
3 e2 u! v$ @' H* Y4 u: D__________________________________________________________________________' f5 d- D9 ~* h! n$ r
4 {2 Z. _& T0 M: _' Y

' \9 n: G' r3 f/ s; P" F* @- }Method 057 `& t! u* ]! Q3 N- b  M
=========+ j6 }$ p2 j7 q/ l

# H3 V2 C! @! LMethod seeking the 'magic number' 0F386h returned (in ax) by all system" h4 E+ S& I0 X$ m
debugger. It calls the int 41h, function 4Fh.* s: Z. M( A/ f/ R! b* b
There are several alternatives.  
" D4 M! T8 Z- }+ S/ f% O# Z! d. A0 u% [. @. t; x
The following one is the simplest:. x: P1 w4 O0 E9 B9 @5 F

& F: U7 G) G- {: D    mov     ax,4fh
( k, h. z5 z% s    int     41h  J8 P+ O5 a* T- y3 F, ^. \* Q" \
    cmp     ax, 0F386* b% k  B0 N0 f5 E3 S) _( J# J
    jz      SoftICE_detected
7 H* b, Z7 Q5 [8 w0 p' \
4 F! R6 i# c" z, [- b# Q7 F/ ~  c- f, a8 {, h3 i. V5 _
Next method as well as the following one are 2 examples from Stone's ( c* z# p  B4 Y9 H
"stn-wid.zip" (www.cracking.net):! z* K: C  @! W3 G+ F

) ?6 H1 ?" H$ ~  b& l    mov     bx, cs
4 ~! i! a3 n0 ?; W) x3 u5 v( I    lea     dx, int41handler2( N" V  m- m, z4 \& z+ F
    xchg    dx, es:[41h*4]
9 g. r# I) [& o1 u5 [5 \  m! U    xchg    bx, es:[41h*4+2]
  g( b2 J" F! W8 I    mov     ax,4fh
) H) z9 l$ v# M" t' l    int     41h
, D  m. i+ y( S- q    xchg    dx, es:[41h*4]
. Z. y/ _; S1 z9 O& I! t' H; `& g+ C7 l    xchg    bx, es:[41h*4+2]  |6 _) W: P0 {2 R: i
    cmp     ax, 0f386h2 ]: m: Q- N& s0 h" V2 w3 d
    jz      SoftICE_detected
- [5 N1 h" ~& ]* m# {% A1 g7 q! e' X% q
int41handler2 PROC4 I8 S# c9 K2 M0 _( E
    iret
) V6 W- \) J8 Q! d* m! Gint41handler2 ENDP8 K! n* F1 g5 E0 t0 t) [1 p$ Q

! y# o% F7 x2 P9 ^1 n
7 H- l7 D8 s8 D* [! w_________________________________________________________________________) ]' a  |# \4 }# D( ?

  l+ p2 f# A$ A6 u" ~
* o5 ~3 A" u$ k* B& {Method 06
( R+ d" p! t" |' _=========$ C, m6 ?" Y0 Q2 m) ^0 q& C# H
. P9 p, y. x# [2 F2 [

# j. C9 T: v6 w7 Z1 O2nd method similar to the preceding one but more difficult to detect:# o7 P( \7 z9 {

- l2 S  h8 n2 x1 u0 H+ g
8 k+ n" L9 R9 U2 bint41handler PROC" N  i  J1 C, r& a* g
    mov     cl,al
2 r9 {" B4 `9 \5 {6 z$ V    iret
6 G$ A% J7 ]% k0 O  Lint41handler ENDP+ d1 S7 D! t9 Y0 x* r& }$ s2 S

" \8 G4 O3 s6 \9 O* _
, Z: H$ P& V3 d! u) V, d    xor     ax,ax5 U$ t1 S% m9 v, \) M
    mov     es,ax& l- h4 t: I5 I$ k2 F! F1 X
    mov     bx, cs9 N4 T" l2 k# H$ V6 U2 @& I
    lea     dx, int41handler
" Z) m1 e" f) k# @4 a4 O    xchg    dx, es:[41h*4]% _. S7 c( `+ v* ]0 E. T
    xchg    bx, es:[41h*4+2]
8 K! B) a) m& R- L3 w/ G    in      al, 40h
5 {  e- A$ Y4 U9 K% W    xor     cx,cx0 |. g- `# ]0 W* w  D, j
    int     41h9 h- T2 z) c4 L( D
    xchg    dx, es:[41h*4]$ Y1 ^' W' d, B  l& S; Q# C
    xchg    bx, es:[41h*4+2]6 ~$ W; }. `4 |
    cmp     cl,al
5 {2 o' r% g; d  q+ v' G+ u  P) Z$ h    jnz     SoftICE_detected$ P: e2 e# C2 N- r- L! E, v

$ J& _( K& O' {/ H# D+ k5 l; \_________________________________________________________________________
) R, F4 i1 D7 c+ y3 Q2 U- e: y
- o! l2 Q& \2 bMethod 07
$ p4 |( |7 Z$ E! M& D  b=========
* v1 L( g" _7 w
, M' X, @6 Z2 f  o" [& dMethod of detection of the WinICE handler in the int68h (V86)
8 Z$ e8 @, _9 p4 y2 V8 E& k
0 Q1 k2 w# @: A6 v0 ?8 Q& |    mov     ah,43h7 ]5 r6 @/ u5 H0 t. j
    int     68h0 J+ U4 u1 N/ B2 J
    cmp     ax,0F386h
  C, |2 K* t  G# w    jz      SoftICE_Detected; X" m9 P2 H: d' y/ g
% W1 B! t: C. z) @8 ]4 m4 I
& {! i$ s; Y- m
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' G% w1 y3 @% Y( E6 ?
   app like this:5 L) z( n& I$ @( {- Y9 e7 H' n0 d! K

5 H' x- X; s4 n. ?. _" E6 Z   BPX exec_int if ax==68& i$ ?$ M0 `+ J( |, `! {5 b, ?: Q
   (function called is located at byte ptr [ebp+1Dh] and client eip is# V' ]! t" o- U( F  x
   located at [ebp+48h] for 32Bit apps)0 S5 E4 a& o8 p$ u
__________________________________________________________________________
2 a" a" ?" @0 Z" T0 G
/ Y$ g% P0 @9 S$ J! O& R/ [$ m! \; S3 @4 W
Method 08& ~; y8 S9 m2 `' B" w
=========
9 N, ~* r! q$ l. {; z7 R
+ @, |0 l3 }9 r- MIt is not a method of detection of SoftICE but a possibility to crash the
3 k/ x; F. p! S7 j/ U* g6 T% q0 nsystem by intercepting int 01h and int 03h and redirecting them to another: P2 ?7 M3 L8 o$ L5 S2 k2 N  A
routine.
" d: }# x( q3 V0 {) GIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( z; H) [6 U& W0 S. s1 g& X: w( u
to the new routine to execute (hangs computer...)) C- D! f* j2 ?; Z. Z3 u" F
$ f% U( ?. }, I7 E, [$ ?
    mov     ah, 25h5 L& v: U& v8 e! c1 b% y
    mov     al, Int_Number (01h or 03h), A& z0 v% ^2 W7 t8 k6 I
    mov     dx, offset New_Int_Routine
4 y0 M' Z4 R+ p7 A$ q    int     21h8 l" y5 W1 n, ?1 O7 L" _: I, l( r
. v  I$ e  b' Y* h
__________________________________________________________________________7 ?" E- h8 J8 }1 v
  J, s5 ?% [# k2 G* I
Method 09
, z% `, Z& n5 m4 x=========
0 d: Y( O' k2 K% ?! E' A  q) D8 }8 z) E4 I( U
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% d' I9 {; c% Z5 W. j5 v2 p7 ^
performed in ring0 (VxD or a ring3 app using the VxdCall).6 ]- h, h3 _$ c$ L7 g
The Get_DDB service is used to determine whether or not a VxD is installed
9 w0 J- I3 \) Q! X: v3 u# nfor the specified device and returns a Device Description Block (in ecx) for
: ?6 B( q1 l  M: U% Othat device if it is installed.1 A0 }5 g$ v; W1 ^8 V

7 [" }) m7 H+ e0 a1 k; [   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# b, D9 A8 [. q) m8 E7 _! d   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
8 n! N, j/ v" D# f   VMMCall Get_DDB/ p2 ?; G8 @& v) o9 I
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  k4 G7 i  K2 P8 r- h
( G+ q/ d7 ^: aNote as well that you can easily detect this method with SoftICE:! u0 [9 @3 N/ F5 i
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 j- I6 H  V5 f0 \$ n" J* L1 Q# V/ W* D# ]
__________________________________________________________________________
2 x4 i, P" r. S/ F: D1 t, a* l$ b  d# {  B3 f' U3 h  \0 }
Method 109 r7 G# E0 L' H' V- G" ~( O
=========
' r! z! ?* o$ J8 I' z
2 n2 X: R# M2 O2 I9 U=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with  W& _) l: B7 s0 B
  SoftICE while the option is enable!!8 h1 A7 B4 s  v
  T+ D* g' f% y- N& v( t. G
This trick is very efficient:7 z' r; p) [" b8 P) s) f* S& f
by checking the Debug Registers, you can detect if SoftICE is loaded( m( W1 T' t( {7 F
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, d2 Z5 y8 Z. m' |" Z
there are some memory breakpoints set (dr0 to dr3) simply by reading their" D# \. a6 d) P( g9 Q
value (in ring0 only). Values can be manipulated and or changed as well) F4 s/ W; R$ d7 K* }" P- f
(clearing BPMs for instance)
" i- D! i+ `$ n% ^, k; e, r! }$ H4 ^
& F0 \$ W$ ?3 |* [__________________________________________________________________________9 z- i% m$ O5 d
; L9 z3 o5 x1 U, R. K
Method 11- G% H+ B9 h  y/ b
=========
. |' a- h2 Z3 M' D
/ N8 M" F, D' M5 v: a+ z, _This method is most known as 'MeltICE' because it has been freely distributed& D2 @3 g4 i) C* Y
via www.winfiles.com. However it was first used by NuMega people to allow
! Y  V+ A: A! r; ?- ?$ `1 f4 sSymbol Loader to check if SoftICE was active or not (the code is located
2 j& D, j- B8 Qinside nmtrans.dll).
! f: s- k: x" y  h2 R  E2 N4 c
9 I* f5 t& U! D' u1 bThe way it works is very simple:" G# Q2 Y  I3 Y1 F5 _4 z
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ d( b; j% g( b  G5 m+ K7 G+ n: y
WinNT) with the CreateFileA API.
! C8 Q- W7 u( B; c! D9 ?- J5 ^+ W$ f* @' E: p8 b' X
Here is a sample (checking for 'SICE'):+ v3 P0 f" y8 d4 x

2 Y- y4 B! L% p, D) p: n+ S) mBOOL IsSoftIce95Loaded()
% U6 }7 y$ j  T0 N0 I* B{3 E0 T9 b7 S  `/ Y
   HANDLE hFile;  
8 T( |# F. I' _$ p4 |) g   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ w$ T3 y0 n3 q9 H- W5 N
                      FILE_SHARE_READ | FILE_SHARE_WRITE,4 a- M6 N3 o, B' Z, Z3 d0 h, [: {
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 T2 c6 s& C+ i. {  d2 G
   if( hFile != INVALID_HANDLE_VALUE )
4 j1 {" T+ u+ e3 z! f8 ^   {2 f: T1 M7 k) M$ a0 Y
      CloseHandle(hFile);- a! L# V6 ~9 K& P" l5 i  g
      return TRUE;
! k2 W/ o4 r: n$ B( D& O' q0 ~! M   }, ]( a& S8 H: O+ P5 x
   return FALSE;
5 b$ j8 o6 B; e- D}" ~( s& n2 S6 c  C

3 X1 p; z9 D/ s$ Z2 iAlthough this trick calls the CreateFileA function, don't even expect to be
  n$ I, k% n2 |4 ^/ hable to intercept it by installing a IFS hook: it will not work, no way!
+ H/ q, e/ D/ V4 q4 J# i1 O: n" J6 QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F/ G$ ^0 M2 o3 {5 s, w# q& ~
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
9 q9 \7 Y* N& {  t* X7 oand then browse the DDB list until it find the VxD and its DDB_Control_Proc9 Q& v$ ^& f2 f9 t) _& U1 o
field.
+ H: `( q) H; r; f3 UIn fact, its purpose is not to load/unload VxDs but only to send a
% h: c- g  Q: M. y3 LW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 [. w" L9 L* q" U8 J3 [2 S  r
to the VxD Control_Dispatch proc (how the hell a shareware soft could try% N" A' J" ~2 [7 D
to load/unload a non-dynamically loadable driver such as SoftICE ;-).* p2 E& @6 n! E& x
If the VxD is loaded, it will always clear eax and the Carry flag to allow7 U4 s8 F, ^0 d/ ]$ }' U5 Z2 y
its handle to be opened and then, will be detected.
" M# M/ E. e- P& \) `# V% g4 MYou can check that simply by hooking Winice.exe control proc entry point3 p# w" D4 C) G/ f# B
while running MeltICE.
$ x! d: ?  k- S* Y' b, m; u7 u( _$ T, s
- N- d# ^; R7 Y5 i5 S8 u
  00401067:  push      00402025    ; \\.\SICE8 ?$ s1 L; Q  B* e0 r3 E3 G" j
  0040106C:  call      CreateFileA
6 |; I6 R1 q9 t  00401071:  cmp       eax,-001
3 t$ N$ f* h- P% j/ i  00401074:  je        00401091
0 [1 L* I( Y+ r: J
1 ^4 Y" z: ~( A) f" q( P8 @4 H$ \7 I& E, y4 K) z
There could be hundreds of BPX you could use to detect this trick.) ~/ Z- e$ H; Q3 D
-The most classical one is:0 X! ^' }7 c" u8 O
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" }) y1 Z! f* a5 I) s6 b    *(esp-&gt;4+4)=='NTIC'
) c. b: s, I# @; F6 t( g6 g1 V/ w# S9 O  ?. H3 O. @6 |
-The most exotic ones (could be very slooooow :-(* v7 P% o- M4 V
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' {1 S! ~$ Z- |; f
     ;will break 3 times :-(. f8 ~8 z) O" |1 F! [

1 R1 s+ C4 o; I. m-or (a bit) faster: : {, E  R0 O0 K1 e# h" Z/ ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- \7 q/ l: C7 t5 t- _. a
- l( j# y6 k9 p- g% h0 u
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
; O& e) S: R0 r2 E/ Q     ;will break 3 times :-($ E! Q1 ~, S4 h9 d6 f
! d4 {: N3 u( b. a0 [7 W6 \( J
-Much faster:
) x9 [/ I6 I* b& m; @- D/ r' T6 }   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
) M% j% N* A3 n) B# M( c. s( v  @' ~8 A' G# N- L: K
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen, L/ x" N" k! B& O
function to do the same job:
. y1 ^% R% a! k) ~$ b
; x* U; q# |3 N; Q' s, O   push    00                        ; OF_READ+ M6 P. K0 f( e
   mov     eax,[00656634]            ; '\\.\SICE',0: I/ t! V$ V- S% |& p5 {0 [. F
   push    eax- |5 N" Q3 Y* W) M
   call    KERNEL32!_lopen) q0 g$ f  l( }
   inc     eax
# y- ~% z! X, f   jnz     00650589                  ; detected5 x8 f1 v; a  G2 k
   push    00                        ; OF_READ$ n- y5 j' w4 O0 r% y
   mov     eax,[00656638]            ; '\\.\SICE'# b6 w0 x. j1 [  w! D1 S/ e+ x
   push    eax
8 T$ y6 ?) n! i   call    KERNEL32!_lopen1 [3 J; R) ~% h! u! ]) L' \& t$ Y
   inc     eax- v9 q1 T6 Z! M7 I1 c
   jz      006505ae                  ; not detected  {& N1 G8 H, O8 k% k$ ^
+ d5 X* S( H8 p1 Z$ L$ p

  l! d* N! F5 J% I) Y__________________________________________________________________________
" j5 x( t- {/ q% i
/ |- A' F! o4 {8 Q; OMethod 12& k% M, }5 \" T5 ]: U
=========  Y4 r) @& ]) I4 L3 ~
6 {  k: O. H, P* e0 h6 Z1 \7 v3 o5 x
This trick is similar to int41h/4fh Debugger installation check (code 05
' ?( a* q3 k" W, R- ^2 G* I& d+ |4 {&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ E; k; E. M* ~) P2 l2 O
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 [0 l/ S6 X2 U! H  a1 @$ E( A
) H+ m4 b% k5 G% w' M, r8 p
   push  0000004fh         ; function 4fh
. O4 @. P3 ]) E! N; P; e; I   push  002a002ah         ; high word specifies which VxD (VWIN32)4 n7 C3 K- V- F# D0 E) l: ^
                           ; low word specifies which service
, f# D7 P5 X7 {+ o0 ]' ~                             (VWIN32_Int41Dispatch). X  ~. U# _6 D
   call  Kernel32!ORD_001  ; VxdCall4 @8 r$ r. Q8 X7 r
   cmp   ax, 0f386h        ; magic number returned by system debuggers* Z% X& V7 I! X5 t4 x5 H3 h
   jz    SoftICE_detected# f/ n& m$ y7 s+ \
/ x8 {* B2 v8 A# r9 O& Z: a
Here again, several ways to detect it:
8 p8 o# }& s1 G$ y3 h  w) ?7 Q, c
    BPINT 41 if ax==4f+ c; W! L4 {9 e# Q

1 E; Q1 j8 b+ M3 V6 Z' K    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
9 v. d6 ?; @% U
; ]8 @& o( O- m    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 J3 d, c3 N/ b) Y: V/ x

' i8 ], _7 K7 X    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ k" `' q* e% ^& V! C
9 m. G2 W9 X1 z) Q7 s. y__________________________________________________________________________
7 o+ Z& U6 f7 s( J( O0 A& ?- ?* g4 @" `- c3 N- A! I" Z
Method 13+ X$ H# y+ J. s8 k8 |! C4 O
=========
" [4 ~$ h' ~1 {% \+ `
6 I* U; G8 S# H( y1 oNot a real method of detection, but a good way to know if SoftICE is: F7 s* i: T& I4 O5 W  X% Q( O
installed on a computer and to locate its installation directory.
8 B# z9 R4 h$ M( P  KIt is used by few softs which access the following registry keys (usually #2) :  C1 C) q0 n9 p7 f* i

. V: a/ g0 B- H" ?-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' @9 _4 u; {) X4 s" R
\Uninstall\SoftICE; d  l) s  ^) E* e1 J
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE6 T2 ]1 N3 _% N+ n9 L) c7 {6 h  e9 C6 x
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 @" F! k  L$ Y0 o% r: ]: s\App Paths\Loader32.Exe2 s8 H1 J( `: i7 j4 l
. G4 X( m* ~9 i% b, B, B1 A7 h/ |

; h5 I# V, i) g4 gNote that some nasty apps could then erase all files from SoftICE directory
( Z, O1 Z! o; Z) g6 Q* ~(I faced that once :-(3 m" d6 U( j7 ^! Z. Q+ t2 i

. s$ r! }* K- }2 mUseful breakpoint to detect it:  T+ V; }# N$ p0 Q9 a

9 k/ }" l/ ^5 P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
: q' Y7 O9 e  v( R7 ], U
6 m) d& @- R; _$ I5 u* v6 R0 z__________________________________________________________________________
6 a! _) V  ^- B* I0 x; A& ^7 w7 y9 Z
' q* a' @. c, S- f  C6 k: h1 N; A8 E) D( O! E* `0 R2 N
Method 14 6 v$ \* a. R4 N
=========
1 v+ x  d! g- e( x# ^
5 R' J2 N5 \+ J# X+ HA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 o# {/ x* l, E; D: N
is to determines whether a debugger is running on your system (ring0 only).
& D: w- G  u( t9 }' w
+ M) }" r; E0 b/ {/ @. V   VMMCall Test_Debug_Installed4 S- W. g. V3 M. @. l% @0 j; N
   je      not_installed$ C& W; {" p& t4 z# Y

, a9 @6 ^8 Z! g. fThis service just checks a flag.6 R, ?/ J& N1 h8 D. T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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