About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' ^0 Z' i. v* G3 Z7 |
<TBODY>
. z# k5 |  o  I/ U6 L<TR>( `) a* l1 @2 v/ T; h- O
<TD><PRE>Method 01
; `2 Z4 i0 N$ u/ [% n8 j% U=========% s# r+ g( s( q, i

- e' m$ b6 g2 v: r7 E* g5 {This method of detection of SoftICE (as well as the following one) is
8 |# ]( F* I2 ~used by the majority of packers/encryptors found on Internet.
0 Q; U& ~3 y5 N6 K, R2 sIt seeks the signature of BoundsChecker in SoftICE
; J+ e/ e( S2 M! |
$ W; W0 |" W+ Q( v/ Y    mov     ebp, 04243484Bh        ; 'BCHK'
% e9 X4 X5 @4 x4 p% m& j  y9 z* B    mov     ax, 04h
) k" N5 {, f: u" x( f% \8 L    int     3      
# j# x% |$ J6 v    cmp     al,4" d0 A: O5 N# o) ]& k
    jnz     SoftICE_Detected
3 f: E( V) X2 q7 P. _) c7 P' K
5 N5 n6 ~) \/ c# D___________________________________________________________________________4 V6 |2 V! c+ d) O
: A8 ?! a$ ^9 P  w$ w' m
Method 021 W7 L  U5 l8 s9 J5 w: _
=========: j, @6 \5 e9 M6 W( o5 T

- h4 r, m4 B, E1 W  xStill a method very much used (perhaps the most frequent one).  It is used
9 j6 R: \2 M- E1 l. uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,. i- r1 b8 n& j
or execute SoftICE commands...
5 f* q% i  F% s" U* F( B7 ~" v7 \It is also used to crash SoftICE and to force it to execute any commands) n$ L* f; J! q/ ?* M
(HBOOT...) :-((  
8 ?* f7 \3 U" S+ q# Z3 F
3 ~3 K* ^! `+ Q, y3 vHere is a quick description:3 E& s) b4 x& l/ l4 _% `
-AX = 0910h   (Display string in SIce windows). i0 i6 h' y; l, P- F4 P" t# h& w
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 ]  M, M* h' f8 s) R2 h-AX = 0912h   (Get breakpoint infos), p! W8 V7 t6 t
-AX = 0913h   (Set Sice breakpoints)
! A, ~5 X. H5 a-AX = 0914h   (Remove SIce breakoints); W, ]! J" q. g/ }9 Y: z( t! P2 [

8 @+ {6 ?0 t  M+ V- ~3 q) uEach time you'll meet this trick, you'll see:* T+ a$ ]; D- t) n8 Y1 Z& C
-SI = 4647h
! ]' f2 H8 J5 m  g. e2 A- N-DI = 4A4Dh
4 C; J2 F$ a; A6 b" OWhich are the 'magic values' used by SoftIce.% }8 g0 ]+ n! v; v) i* W' O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 A" v) f/ `' ^
" S# f) }* U4 z; @$ ]Here is one example from the file "Haspinst.exe" which is the dongle HASP  D0 j/ U8 q& v
Envelope utility use to protect DOS applications:# t% ^: q& i  N* Y; q

- W) R7 x4 n0 m/ P; x# E2 Q4 m" I/ v3 _$ w9 h$ q( i3 X
4C19:0095   MOV    AX,0911  ; execute command.
5 G; t, r; X! ~4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
; u8 a# S$ }4 S. @! d* k4C19:009A   MOV    SI,4647  ; 1st magic value.
. P' j3 k. H' t  T1 T! m4C19:009D   MOV    DI,4A4D  ; 2nd magic value.2 [- ^" ^+ M% G5 A7 n
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& E7 e2 J9 N, d; Q4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, m2 b# m3 s% G& k8 l4C19:00A4   INC    CX
( Q2 m1 j, h( n. u! B4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! u: a6 Y4 k5 d
4C19:00A8   JB     0095     ; 6 different commands.
+ V+ k4 d& o' N6 f' F9 I1 C4C19:00AA   JMP    0002     ; Bad_Guy jmp back.. A: f' _+ D9 R* S# O* Q
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 x/ ^. Z4 |% R3 U) ?2 ~+ |' R- ]% d9 R( X
The program will execute 6 different SIce commands located at ds:dx, which
& D8 {6 d3 j" g6 M' [are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* w. z: u7 q! p3 z" a+ m: ?) l1 B# S
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: y& Q1 z, _- i  P+ ?___________________________________________________________________________, r0 \6 V$ Q0 U9 A
+ X2 t* p% G& B8 E' {! Q4 ?+ q  G

: ]& U# G! g% s+ kMethod 03; n& m; r+ D* |3 k& L3 P
=========! J9 I4 s/ H  {5 W

8 g% I3 H0 M" W( M: J8 bLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  U8 R& J1 @* V/ w
(API Get entry point)
, m8 ?* S( m" \7 `0 g. i' p+ r' V        2 f# u3 C9 L. v+ |  h- y4 G" {

3 x7 j. E7 B; \) j. I    xor     di,di
# E) h/ k' Q! v- d    mov     es,di
2 t9 G: ]! Z5 C+ Z: W    mov     ax, 1684h      
9 Q9 x2 W* ^, M% o# b1 Z  c    mov     bx, 0202h       ; VxD ID of winice
! R! u% T8 }9 [; b  g3 B3 E    int     2Fh, o+ z/ l; ]$ [( w& m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: m1 B) J/ ~3 F/ U8 I  }. S$ `) K    add     ax, di
/ {- N$ T( N' i% v+ W* o7 e2 C    test    ax,ax
9 X. ?: s, k* p  ~4 M    jnz     SoftICE_Detected
) j. p4 \1 C1 Y
6 l8 \# j5 d$ v% Y$ a  W___________________________________________________________________________
# r% ~3 x* ]9 G! f3 o* V6 m
) k! n- o& ^  s6 P9 x% t8 v& vMethod 048 k# M  A; {2 }5 a8 @2 D
=========
  v# z2 z! D$ ~( s3 t& T7 e5 m
- S, E) O) O1 _5 `5 b* Z4 F2 cMethod identical to the preceding one except that it seeks the ID of SoftICE; ^/ J% p7 w' l
GFX VxD.7 q7 d# P" E' z7 J  ^; q" s1 ~8 e

- a  y/ Y' v; ]) L3 O4 d    xor     di,di
5 Q1 X6 t) j8 K# A  w    mov     es,di
) U' ]% N* [+ x& n- ?5 n    mov     ax, 1684h       # r5 }2 B( T6 w& W- D* n3 r9 Y. n
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 `, S. F  L2 Z, Z, h    int     2fh6 e& S6 P; O" g& B
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 E$ S& S! x5 O: M' a2 |3 o( K( v
    add     ax, di
1 |/ o. c! }, m6 |0 t$ `    test    ax,ax4 K" r; n  v0 f& L
    jnz     SoftICE_Detected8 q( m0 C3 f, D# S

% Q; o# y! |. t__________________________________________________________________________
! N4 v3 @) _# h
! q; h, J+ B" Y2 M8 \2 l4 A6 S, N) m& T! B: r9 j$ q; y
Method 05
' j+ }  V3 W  d. u* }+ Q% l# {( [=========
& \+ S9 I- h) V# d7 `$ T4 z7 c$ S7 V; I3 r% r/ y( r$ m
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- n' x- C; j" Y, rdebugger. It calls the int 41h, function 4Fh.2 c- N7 [" j. L  B9 g
There are several alternatives.  / d) ^5 ?  ?5 Q! p# q
1 w( U+ I3 U: i' B; m% e
The following one is the simplest:# [* I' o. ]- s' m+ J# H
8 d. [8 [; [9 F, ?, E9 y2 N
    mov     ax,4fh! M" x8 ?( ]4 r
    int     41h. a5 \2 f2 \) v( p
    cmp     ax, 0F386( `2 L7 G+ G" a7 u
    jz      SoftICE_detected1 |: `9 c( l- r/ n* k% s
6 w# H, `- F, f& t+ [
1 O/ p+ N& v7 `4 _* R
Next method as well as the following one are 2 examples from Stone's ! p+ k3 o' _- t, {) D
"stn-wid.zip" (www.cracking.net):# j, V* f5 d* `$ k
5 Y, _7 X" A- l; j
    mov     bx, cs
: _4 ~+ Q' t# \7 @: n: t) \    lea     dx, int41handler2
7 }3 y5 W1 w9 R0 b4 I- c" b6 Z    xchg    dx, es:[41h*4]
' s; i) z  V  `8 i6 P& E    xchg    bx, es:[41h*4+2]
$ |$ I) C- M& u8 \    mov     ax,4fh
( K% \! F! P- O4 e( g& u- D& K' X% f    int     41h9 N) n" B8 }+ k) ^4 l4 X! C
    xchg    dx, es:[41h*4]
/ b- Q# v4 c+ J% v9 `4 ?    xchg    bx, es:[41h*4+2]
$ c+ R8 f: ^. ^/ b    cmp     ax, 0f386h4 l- V: |4 P, K
    jz      SoftICE_detected
  l! t- ]" `( o3 E% o3 o7 X/ g' O- a0 X/ N: Q( q+ y4 {0 F  D1 B
int41handler2 PROC
" }+ b+ g3 E; N- z. X1 e; u: [    iret
/ I) Y2 I! Z; f- |int41handler2 ENDP
3 u6 h" z, z6 |) D- g: A
/ Y2 J& e  Y0 H% l  r+ m+ o- X( N4 t5 g9 P
_________________________________________________________________________
1 B4 A+ V- N* t2 y) S
* q! r9 g. v/ S7 M8 A
( G3 h6 }* Q" L" d( W" w. J4 wMethod 06
" T( `* F% m4 s5 E) X=========
) A+ \- E, k6 H. {( H+ Q$ B' ?
* w  m3 Y5 m) h0 Y( @  v" z8 E" y1 H& Q0 S/ W) V8 N& U) j
2nd method similar to the preceding one but more difficult to detect:% ?& _! {: O8 J0 U5 [3 P& E( X

% V* v( p+ B+ y1 H, M, E; l5 R8 H1 ~. ~
int41handler PROC
8 l- H' e; {8 U5 s    mov     cl,al
* F) ]' M( B3 i; ?    iret
- I3 x& D$ [( Z, q+ I6 Xint41handler ENDP9 n7 b2 m# ?$ v* l9 L" r0 c$ \
, z; m# p# U2 Z' O+ n$ a, }
. ?8 J8 x  u1 e, m! m5 p( W
    xor     ax,ax7 C, h, R* E! g- [8 R+ m
    mov     es,ax, ], E( H9 h/ Y1 k% E- t
    mov     bx, cs0 q. E6 g  z% t5 O
    lea     dx, int41handler
" M/ S( e8 ~  Q' v    xchg    dx, es:[41h*4]
  f/ Y" b( Y  m) ?! [' W    xchg    bx, es:[41h*4+2]
9 Z% @0 l# m( P# e1 h2 U    in      al, 40h( m; A* p- ?; p+ V+ G+ @( F& V2 V
    xor     cx,cx
* B; Y2 v6 u( i: \. |0 r    int     41h
" X: s+ `' B" }/ o5 {    xchg    dx, es:[41h*4]( M. @) l+ S9 k! r8 O; L
    xchg    bx, es:[41h*4+2]
/ u: |) E. U0 a* S    cmp     cl,al
5 d) f$ R: T8 @. }$ @$ ]1 A1 Z" {) \    jnz     SoftICE_detected
) U& }$ M; R2 T, J, l  j: L$ p3 q3 q5 V2 D
_________________________________________________________________________
' n' S, g, S4 ?1 x% b% \& x
0 c/ R; S7 F2 a, C4 K9 AMethod 07- ~3 \1 }# _; I  U  D( a
=========7 h1 E/ g2 K6 d+ [9 M$ d
1 G/ `, G! U( a/ R" e' \" L. q
Method of detection of the WinICE handler in the int68h (V86)
. x' ~. F. Q# s$ R% D3 I) o# H3 k- Z- [2 ]  n5 ~
    mov     ah,43h
9 K8 G9 b) y3 U0 u) r    int     68h$ a6 C4 v/ c" {% |: g* ]# P5 c9 A
    cmp     ax,0F386h
; ?' v) _7 M& i" _% s* O    jz      SoftICE_Detected5 Z& x) N4 F3 W
) w+ U+ J1 Y# E5 U1 i. |; L
( q9 }4 m) C3 {' u( `/ q5 N1 m9 L
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 {$ |. W9 b9 j3 T6 r. K6 q2 c
   app like this:( n: e: Q+ z8 I6 o% P- V0 a

" z# c6 d! Q9 x# g0 c9 U   BPX exec_int if ax==68; W' i) W! v, h" u$ W7 F
   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 ^' e7 B& _1 @4 _. h   located at [ebp+48h] for 32Bit apps)
# O+ p* e9 l# w. \. f: F# L# t' A/ O__________________________________________________________________________
- ~. F* N* V1 R! E! x" Q+ K! y4 z6 s- w" a6 L% i% y2 x

" e! I( |) w3 u7 M$ fMethod 08
0 W7 M7 U( J# C- \  O=========
5 I3 H: v  C$ s- y+ p$ Y; _& j7 h6 ]8 S* U2 X7 Q
It is not a method of detection of SoftICE but a possibility to crash the
6 L: n( X7 O) B; ^0 C6 L$ c* P/ M; lsystem by intercepting int 01h and int 03h and redirecting them to another
( z# l/ E% _) a8 {. Eroutine.4 I7 V9 L6 q( o, M3 Q' Q) \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( j" d" o( \/ Z2 i: `4 g7 X; t+ B
to the new routine to execute (hangs computer...)
+ U# E3 t5 p4 d9 K
) W/ N* x0 m5 g% c    mov     ah, 25h+ O& t- J9 [' y8 I/ v+ N
    mov     al, Int_Number (01h or 03h)7 |( a% @& {0 ]* Y3 f! ]) L
    mov     dx, offset New_Int_Routine
- e8 z- a3 _% c8 p$ G# \7 O    int     21h5 \/ n. R7 y' G' a( ^. N, u
5 V+ a) v' K8 j. f2 z( \; b" c
__________________________________________________________________________( z: G! K/ y" |! N+ f
6 x1 m8 _. x4 H; h0 T, P% f
Method 09: T& M% B2 |& A4 p7 g
=========
* U; c; T" `  K( U: G3 n0 e5 m. d; f- ]( P) D
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 \. T% x. {6 J; o$ Tperformed in ring0 (VxD or a ring3 app using the VxdCall).
. V0 X1 U# l$ L8 ~5 J/ ~; aThe Get_DDB service is used to determine whether or not a VxD is installed) N: r" s+ j: V% k0 F7 C, Y% `
for the specified device and returns a Device Description Block (in ecx) for
6 ~4 w. A' k/ M: D5 }' m8 ethat device if it is installed.% G- j$ ^+ i; r

4 _8 w& o$ E# C   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: V- @+ u: W4 k  i6 n   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 v0 r7 A, ~6 n& f4 j/ g   VMMCall Get_DDB
+ g) u; V5 H: G2 }; i" Z! ~  y4 M   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* C) R) z4 G$ Y* u9 R' `
" S, {# n: z2 [2 n9 ^0 z, S7 {, C* kNote as well that you can easily detect this method with SoftICE:
0 T- f" H/ M9 h/ U9 }3 X   bpx Get_DDB if ax==0202 || ax==7a5fh
! I' B4 M) P5 ~( M0 Q# g
, L1 [& b- B, t$ ]8 D__________________________________________________________________________
* e, R. ^! R0 G4 ]0 _; [3 W! Q" Q% ^( w' N
Method 10
8 N& M) y. @* c0 e2 l) B* q=========
4 U+ U' a: n! |6 \" |& [. r1 d
1 r2 g. P" E) X. P/ D0 d=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. P, V6 w# G2 E. L3 ~* N/ n5 s' I  SoftICE while the option is enable!!/ `' j! k/ F- f4 z% P

' ]8 u& F7 P7 K( Q' q7 vThis trick is very efficient:4 o8 w% j/ H2 r1 V
by checking the Debug Registers, you can detect if SoftICE is loaded
' O0 e8 {& u' T, E* ^. P3 @. L- }(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% d, |0 z' `. `there are some memory breakpoints set (dr0 to dr3) simply by reading their$ t' h8 N6 a. V/ k4 I# l
value (in ring0 only). Values can be manipulated and or changed as well
/ g9 h" O7 K% s2 a/ [7 r  v: @8 [: Z% i(clearing BPMs for instance)! A$ x1 k4 X5 }1 G

, L5 B: I! u4 X__________________________________________________________________________' P8 G5 ^( q, X, ~
3 |# @" O4 f; }" M
Method 11
" H& \% b! V7 a) t=========
  t1 {, `% U2 H4 q5 i# o& E, A* Z! l& r5 Y4 j6 |' b
This method is most known as 'MeltICE' because it has been freely distributed, \! G+ t1 V" r- t6 H* {- N
via www.winfiles.com. However it was first used by NuMega people to allow+ _( M* O" N# S& p7 O. y3 o$ N
Symbol Loader to check if SoftICE was active or not (the code is located
  a1 V0 O  ]4 d; t! linside nmtrans.dll).
% x( c# x, G; Q; o4 T
. W5 H% O5 M" \) M3 qThe way it works is very simple:
% i! ^. s7 f5 e$ tIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 F# ~% C/ e2 K5 o9 \7 z# i( {/ |WinNT) with the CreateFileA API.
4 H. u4 f* K% j$ V* X- X" e+ T* T, m; V2 P0 z8 @  ?8 ^8 ~
Here is a sample (checking for 'SICE'):
+ N  g. U6 g7 S! ?7 r2 T3 }8 a7 A1 X% z) S3 ]
BOOL IsSoftIce95Loaded()  b6 L7 M; r& Z
{6 G/ W+ j0 E: P$ {  D
   HANDLE hFile;  
: C# o! n9 C4 x2 R   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
8 V0 E# u! l% r# P, }. O1 p  s                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 o; G$ O8 S8 q' g4 V" L8 H  H                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ e4 E0 t! f' l
   if( hFile != INVALID_HANDLE_VALUE )
  W# b9 G/ s1 `2 ^' E   {
, E1 l, d- ^1 L6 w1 \      CloseHandle(hFile);
% j  `6 c  N& w/ ?2 ]! r# A      return TRUE;  N3 L2 V  U) p' H! w" V& r. M
   }
% K) m+ _9 J: V( x, T   return FALSE;
1 D* f! D) E6 w; x6 d- i}+ i# ?* _9 q" i" G4 r# h

$ b5 E1 }5 M9 H  n) HAlthough this trick calls the CreateFileA function, don't even expect to be8 e. L2 P/ K6 H5 [
able to intercept it by installing a IFS hook: it will not work, no way!1 A; D# d  d3 Y4 o" i$ S0 @; E
In fact, after the call to CreateFileA it will get through VWIN32 0x001F- R3 f$ Q' r; c- S) N' x% m2 e
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" \) Q/ `( }& z  Zand then browse the DDB list until it find the VxD and its DDB_Control_Proc9 v# |/ d0 O' _% G: a
field.
% U1 ^, }; D$ I3 K- QIn fact, its purpose is not to load/unload VxDs but only to send a 3 X/ r$ D/ ^3 C) E8 c
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)4 y0 Z0 A! e* j' {$ C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try6 r3 v1 r; k1 h/ j
to load/unload a non-dynamically loadable driver such as SoftICE ;-).0 s( L0 q. `: r
If the VxD is loaded, it will always clear eax and the Carry flag to allow( z: M8 z7 G% }6 [# X
its handle to be opened and then, will be detected.' i. h* i- D7 H9 e1 _/ N5 O8 i3 \
You can check that simply by hooking Winice.exe control proc entry point
7 P% D: R6 `) K2 _2 d/ {  j# ^$ Cwhile running MeltICE.; ?* K) ~0 e) l8 {
1 R7 u0 m' r( V( M1 J# s' f

# {! t! Z+ p/ M1 u1 \# q" r  00401067:  push      00402025    ; \\.\SICE
: j) V' o* r$ P0 R, x9 x  0040106C:  call      CreateFileA
9 b) B, B! ?4 y# G, |7 q# m  00401071:  cmp       eax,-001
; J: K$ K6 k; k0 g1 q) Q# m: d6 n! z  00401074:  je        00401091
4 Y: L/ T% p7 k4 L) x, L/ t7 R8 d! P/ r% c  \

& M! Z6 D% o: b2 Z( o  W2 t. ?There could be hundreds of BPX you could use to detect this trick.9 `' k' B; P( q  ]$ S) T
-The most classical one is:
/ S/ f' u* n7 ^' C  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" j. x  u' J6 E% T8 J* {) r' Y5 Y
    *(esp-&gt;4+4)=='NTIC'" w8 t2 T7 I  F

( N0 i  A8 x2 R* s6 l7 F/ Z-The most exotic ones (could be very slooooow :-(3 D0 ?' h; E* H$ M
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & V  {* i6 T$ @# Q
     ;will break 3 times :-($ r0 [2 z; P! _

& _5 Y! `! v) O' y0 |8 i-or (a bit) faster:
, D3 u9 L8 P, r2 O   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')1 R  r- u0 W6 X

( J2 X& J! d) _4 _. z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 K( }2 L6 E$ A' @6 R     ;will break 3 times :-(  r5 f# N4 |* M, A

" [3 d4 O' `/ C  n-Much faster:
4 w5 l2 [# U7 V) u+ b   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'/ `( N: ]  a9 a# n8 F* G
+ ?' A, ?; v7 S8 J% }5 A
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 \& b8 M! j- t* ^function to do the same job:
) l6 p$ ~- j3 q+ a2 B! E4 B" c3 c
* g* {, K4 l: N" Z) Z( X   push    00                        ; OF_READ# w) D3 @: u0 i
   mov     eax,[00656634]            ; '\\.\SICE',00 s; J9 F- g( l! R4 ~- C
   push    eax
" ?$ X  c0 R  A. U! K4 ]   call    KERNEL32!_lopen$ e' Q2 X) H' B/ d8 ]
   inc     eax
/ B: I" H9 R& Q   jnz     00650589                  ; detected- W9 k6 K% i/ e. ~- c
   push    00                        ; OF_READ* W2 W- J; i# W. z
   mov     eax,[00656638]            ; '\\.\SICE'
2 F; F) ^/ @2 C* t9 T1 |% X  z3 h+ m- M   push    eax* r9 l1 O# R/ R/ Q  \
   call    KERNEL32!_lopen
7 v" l9 ^5 t" D7 S4 l   inc     eax% F2 L: p* r, z) N! U! @
   jz      006505ae                  ; not detected
6 z# D, d! k! _! R3 _6 c* n: L  k% U0 l* B- |# }* d0 ~( G, a; b3 h
1 X* [8 ]2 c& P4 u/ B+ r
__________________________________________________________________________2 B( v, X8 D/ w) R2 X/ \

# o0 o  ~* w4 R( ^# A4 uMethod 12
. J$ B" g4 N1 g5 l! M. Y5 [, K=========
. r0 @: l" n% W$ B: y; E" ]+ i. \. \1 M  |4 W; M8 s! G9 w
This trick is similar to int41h/4fh Debugger installation check (code 05
# j8 S1 n1 d, Y, b4 T&amp; 06) but very limited because it's only available for Win95/98 (not NT)! t, l, M$ F  g, B5 O
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) `; G* c3 N  n% ^: B4 O: b" G& @$ e! ~6 f* |9 Q
   push  0000004fh         ; function 4fh5 C( v- L9 D! {" `- g
   push  002a002ah         ; high word specifies which VxD (VWIN32)4 {+ w4 N' s! p
                           ; low word specifies which service, f8 b6 _: e( K7 f7 H/ c9 j* R8 X4 ?
                             (VWIN32_Int41Dispatch)) C' Y- j% u) Y; e2 c- x7 L' Y
   call  Kernel32!ORD_001  ; VxdCall
) w5 x9 j! l7 u4 O  y   cmp   ax, 0f386h        ; magic number returned by system debuggers
* t: e% F' G! F% i' S! s" H- I4 w   jz    SoftICE_detected
1 L6 n5 x/ Z0 v; t) [9 [) k. ~8 T0 R6 b% m+ Y! }2 y
Here again, several ways to detect it:
% F4 l1 {+ Z! w5 @" Y# \' _" F1 j7 {5 p
1 r$ w0 A' R2 H! W) p- L. y    BPINT 41 if ax==4f
. S5 \/ T& I0 S; ^6 I3 M% V& E/ [7 W* P9 m) ?
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 B! T- w8 E6 |
/ F, {0 t% g0 r    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' Y/ q' [0 ^7 g+ R  n$ S5 x1 P( I$ j0 B8 S* J
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
9 S1 z6 R1 q$ Q6 Z+ r7 ]& N8 L+ y( t7 e4 B2 _+ q2 I
__________________________________________________________________________
$ X2 c- F& H. }) z$ K
* s7 l" `* D0 _8 @- jMethod 13
5 B& }; h+ ~5 H=========6 {5 t2 @3 O1 U/ }% z

. X- M+ I" a. p8 R+ G5 zNot a real method of detection, but a good way to know if SoftICE is
, I4 T. l$ e/ h! D  X, q# cinstalled on a computer and to locate its installation directory.
: V: {+ A  t2 d4 H+ B! U& cIt is used by few softs which access the following registry keys (usually #2) :
- P. ^& \. Y3 B
9 m% _, u! A0 r5 L-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% m; {6 P) ]# i: d% J
\Uninstall\SoftICE
+ B' {$ a  v3 d" j-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  j: o7 M) J. g( h, [" a
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ n7 j) j8 n1 g0 A
\App Paths\Loader32.Exe
$ C5 v' A$ e* Z$ T" V0 R
% V3 c$ }2 [0 \9 \; E. e9 h  O
7 }. T6 X, J: }: pNote that some nasty apps could then erase all files from SoftICE directory, O+ w0 b& a  y( V3 n
(I faced that once :-(0 s! P0 O0 K+ j* `' X1 w. f5 f

; v7 a2 `: c2 a& H1 hUseful breakpoint to detect it:
6 T# O+ b- e# q* |
4 ?# I/ V! C+ O- O  Z' Z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'( Q6 v2 {  a5 B  `) C2 w$ S
2 P) W' R' k& u; A4 x/ g4 t$ G
__________________________________________________________________________% }( c/ M3 V9 r
& \/ H8 n/ j9 e
# W1 [+ L: O) L0 e
Method 14 8 y. p3 I! s: ~: {1 {
=========! R. l( R- u/ T( g. ~
& r7 p$ e* p/ z4 j; B8 h7 K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. `6 I! N0 \! }0 ?' Z2 h, r6 I7 ris to determines whether a debugger is running on your system (ring0 only)., f- x/ T* ]) J& [1 ~

6 ^) r; O6 J0 c   VMMCall Test_Debug_Installed6 l# F9 {5 x4 f# W
   je      not_installed
0 ~2 V9 ^# Q$ J. r7 T1 `" g% e" [4 t/ m' H  N+ h+ ?
This service just checks a flag.
, s" b8 w+ \  A0 p9 u; O5 t</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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