About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; r$ ]& r# {9 q/ M5 X5 Z
<TBODY>
$ b" G8 N: [9 h! ^3 G% |<TR>- h4 D3 I7 W. _0 Z% B$ j9 _
<TD><PRE>Method 01 1 U. Q2 H% m! s
=========* H4 W9 U2 q$ M" f' a+ k
1 g& @4 P, e7 I1 v; r, [8 T) @( s
This method of detection of SoftICE (as well as the following one) is
% E7 w8 q: O2 I6 L3 u! s, ?used by the majority of packers/encryptors found on Internet.5 Y) P) `  P6 p+ U
It seeks the signature of BoundsChecker in SoftICE4 y5 S+ f# W+ r! M. E5 E

0 K' O* n( M+ Y+ }$ {; o    mov     ebp, 04243484Bh        ; 'BCHK'& x7 ~+ V2 @8 R3 H0 w4 J& b
    mov     ax, 04h
* m% U4 ^7 U9 r# G- O    int     3      
$ @: f  R, `# r7 e2 @' @2 s. l    cmp     al,4
! D) b( A3 C/ E. ~8 x9 N    jnz     SoftICE_Detected
. ]+ E5 }$ g3 y
3 j% k" g4 k4 e: C1 b, _* Y___________________________________________________________________________" q( D$ H7 c6 G7 K

! Q9 B0 D/ K3 N" A% mMethod 02
5 D0 h2 g! O# P) \. h=========
  R& o0 x' ^$ ]/ G5 a9 d/ l- y3 Z9 g8 a
Still a method very much used (perhaps the most frequent one).  It is used
; P6 U0 l* y( [& c' w) jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 G3 [4 l" T: {7 z+ ~- a, P0 X0 w
or execute SoftICE commands...
3 N6 q: b+ o( M, C. W  VIt is also used to crash SoftICE and to force it to execute any commands
4 G  l" Q4 f, z8 e(HBOOT...) :-((  
8 ^  Q* v0 h+ A$ t" |2 K
- w' t- V% d) c$ h; N! CHere is a quick description:
9 C& Q9 a" m7 O9 K, Q) V-AX = 0910h   (Display string in SIce windows)
- g+ O/ I7 g' J5 p% r  D-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)$ H9 C+ P0 s, l
-AX = 0912h   (Get breakpoint infos)
- \, i' b$ q5 R* |7 j6 A-AX = 0913h   (Set Sice breakpoints)+ ^! o) A2 D: Z; y: ]. n' f
-AX = 0914h   (Remove SIce breakoints)* V; Y1 S8 s8 A8 P7 Z4 K8 r

0 }; L% m# D9 X, F  H' F, [% dEach time you'll meet this trick, you'll see:
# x, {1 z, E7 c7 s$ }1 z-SI = 4647h1 G# s% u) A9 g  R
-DI = 4A4Dh& f( N2 Z% E. T: M  N
Which are the 'magic values' used by SoftIce.4 K- Y. v: c* o5 M: h* c2 O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# a% ^  e1 J; f8 ]2 a& j* V' v& M; J! _. U1 k8 d
Here is one example from the file "Haspinst.exe" which is the dongle HASP) h  K/ T9 H; N5 X5 _7 o
Envelope utility use to protect DOS applications:6 n. x/ i, O) o* k+ [: A
7 f' j# q' p" Y/ h  o3 H! w  D' I
' U5 O3 |  c3 j6 A: h, @6 o; m
4C19:0095   MOV    AX,0911  ; execute command./ F% p2 L/ H# P) c
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 \# W' m! k2 i) j( i! S. m
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 A( k$ x6 }! T# ^* j2 `4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: t0 B  C, ?* ]4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
4 ?* b* o7 o% L9 \) D5 U4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
. P/ {$ @( T. ~5 G; z) S4C19:00A4   INC    CX, S* V) ~& X/ z* c
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& P" @0 q$ `4 ~2 z+ a3 X, z4C19:00A8   JB     0095     ; 6 different commands.# S7 n, _' L$ y- p+ ^; G5 J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- x4 S0 M& X: @0 A( m+ A% l9 v
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 g. K3 b% ?1 ]  ~* Y1 L

7 X& p( h7 `6 sThe program will execute 6 different SIce commands located at ds:dx, which
" R  `1 w$ \4 I* Fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT." |; Y0 k' i& t0 V

$ k. d4 V8 c0 s( x- s/ T& {* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 _# k) C) E# X4 R# y" U& f___________________________________________________________________________
' H' G( L) y: b" z9 Q; E& `8 v% }- [: e
! W) m" L2 E* ?$ j3 s
Method 03
5 V8 T7 F% ^; n6 {=========
# o# P7 N0 b. D0 Y6 i* q5 q
( a5 C0 C8 S* ^+ zLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* @6 C0 }8 a+ M0 ]& H; i
(API Get entry point)
3 X9 Q, _% m9 A+ ^        5 C  I" I% d7 P" X4 @# \5 {) Z6 _

  N; |9 _2 N% i# M" M    xor     di,di
3 E2 }5 W6 H3 P/ b    mov     es,di, t4 ^+ b& L7 Z: y
    mov     ax, 1684h       1 ~3 C' X7 @, P! e/ q5 `
    mov     bx, 0202h       ; VxD ID of winice
4 p7 B& a% `9 p$ e+ w$ H7 `    int     2Fh
: s! c) H4 C8 u7 G0 ?% J& P) o    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; N2 M0 W/ n8 J    add     ax, di
( h# n* x1 t/ [( \/ M+ j+ _7 w    test    ax,ax
( p" n, |2 y" |5 _8 I    jnz     SoftICE_Detected* j6 N$ V3 o! [3 U7 |
0 A9 _" S+ d; F$ m$ e+ u
___________________________________________________________________________: j) ^4 m( F! l2 U

4 y& k- w; j! Y% q. JMethod 04. f4 m( }+ u; @% W) D6 B* B
=========- \1 b" f2 G% e& C2 Y$ W9 d

% s+ i) v- _* ?2 DMethod identical to the preceding one except that it seeks the ID of SoftICE6 u2 n. J9 H6 q. D; E8 N/ q
GFX VxD.- C* j* ]; X) d

$ `8 O: p- x8 b7 g    xor     di,di4 H5 W. e: Q# B
    mov     es,di
9 S: ?5 |* h8 c) ^    mov     ax, 1684h      
: g2 H2 V8 P  k: I( a    mov     bx, 7a5Fh       ; VxD ID of SIWVID% v9 [+ E" ~* T( k9 ~2 ~% U" p# }
    int     2fh
4 ~/ N7 J3 ^; n1 J    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ M1 x6 @3 V9 k6 {- K" g. D" i    add     ax, di
/ t' ?) _6 h7 B- G* E: K    test    ax,ax
  w1 A; x0 a( c. B: I    jnz     SoftICE_Detected, b) V& o$ i! m; ]: O
5 m: R0 Y+ P0 |3 t% t1 j
__________________________________________________________________________& H$ ]$ K# b) J

1 X7 }& o! l% q7 D( n; y% P1 {5 s: ~7 g* Y! Y8 M
Method 05* T% l! r8 s+ ~* G8 m4 B$ z7 L  t
=========
: E' J$ d; S( k9 D4 _% U; ?
2 L  J7 u+ Z4 B6 f! [Method seeking the 'magic number' 0F386h returned (in ax) by all system
4 ~6 W+ P' E7 O& I- X5 |. @debugger. It calls the int 41h, function 4Fh.
7 i6 [; t, _+ l- F( \There are several alternatives.  2 R7 }2 h4 u: m
6 r" u- @0 ~, K; l
The following one is the simplest:$ i/ q$ @2 F9 c
" G8 N, _3 \" w* x" e! L% t7 U. S! ^
    mov     ax,4fh
4 i1 c, G9 W* ?! e/ t; |    int     41h
$ \  a9 Z5 ^% y$ n    cmp     ax, 0F386% r7 W$ k1 S' S+ Y+ x# k
    jz      SoftICE_detected
' J/ T5 N4 I1 n( N9 S' {' @( Y. O, N" T) w

9 n  K) ?  ^0 i! K& u4 JNext method as well as the following one are 2 examples from Stone's
0 Q) {+ F- L' M4 N- D+ _1 o"stn-wid.zip" (www.cracking.net):
, O' `8 Z2 X7 y. D7 m. \2 [, g+ u1 v* h, M3 z; Z  i1 i# u
    mov     bx, cs: y+ a+ a& S5 w! ]% G% U! P! q
    lea     dx, int41handler2
" Z& F% Y8 `( b4 ~7 d  y, x    xchg    dx, es:[41h*4]
6 O6 b0 ]) B% d( F4 F6 P    xchg    bx, es:[41h*4+2]7 \. O* j' f2 ?  G5 A. a: ?
    mov     ax,4fh
0 a' u  J# x, k. q6 p/ C    int     41h
& g( o: R; q& F2 `7 z/ _" Q. _    xchg    dx, es:[41h*4]
- o4 t: G: K7 a  R    xchg    bx, es:[41h*4+2]) V5 e9 G* G' |! o, h% K
    cmp     ax, 0f386h
( V. c1 \( C2 u4 K+ s3 Q, C) ~" K    jz      SoftICE_detected
" ]& c: D; }0 h% q& v* {. ?. S" ]+ s& s
int41handler2 PROC
$ M5 E) `% e  w! l! v7 e    iret
2 L" @7 b# m+ rint41handler2 ENDP
6 O) t5 E$ [$ {; k, h" {7 O1 O8 H9 y; T3 P) b7 |
4 R" ^/ N7 s' V8 p$ z+ {
_________________________________________________________________________
; A  O( H0 Q1 J* ~" S3 M- a2 f: G! A" @- J

: J0 C# i/ {- q  O/ SMethod 06
( f1 B0 ~0 N; z# e+ n=========
$ p; i# |& _( q+ J4 c+ d. _9 E2 x7 U( _% V$ N; W
8 a- H* X4 c+ L5 [6 j0 z/ }
2nd method similar to the preceding one but more difficult to detect:
, }6 f! `0 Z) s% j2 e0 u, l3 P+ ~) D% X+ i) s, H* b

0 n3 w7 \1 x& [8 Kint41handler PROC
& ^5 V* |1 H. @6 z; ]9 \    mov     cl,al# S. F5 K. Z$ H  @) x
    iret
8 |. o; C( S1 _% {/ S, ?1 z$ Rint41handler ENDP
8 r9 N* C6 y& H. t5 P; e1 l* m0 Y' {% t( ]0 o/ d
8 ]- D7 M/ C* ^# A* h5 n
    xor     ax,ax
* ~3 F1 j/ U8 R* ^' z    mov     es,ax$ k5 ]6 ?' `. A1 Z) G" U$ l# k5 {
    mov     bx, cs7 S% F3 G. O  }4 G. i/ d! Q
    lea     dx, int41handler$ _+ h  ^1 m  m& a5 d  Z% l1 m
    xchg    dx, es:[41h*4]* Y! @' R* g& n' }, A
    xchg    bx, es:[41h*4+2]
+ I! w& f$ d' e2 B' d' W. N    in      al, 40h
: j& i3 \& U) O8 G# ~4 G    xor     cx,cx+ L6 ]2 O: h1 i/ W, m
    int     41h
* V, W4 P) D! A7 P0 R    xchg    dx, es:[41h*4]7 a; R1 a' I, q" Q0 b, s
    xchg    bx, es:[41h*4+2]
) b& D' ~0 ^: T$ D6 A# d    cmp     cl,al
/ U$ H2 Y; z8 E4 P0 F/ p7 X    jnz     SoftICE_detected
5 h% o+ H; o: a$ @$ i# G+ |( t! \" ?0 [4 b% b4 x
_________________________________________________________________________
' p/ y) K" I) m9 M* S) `/ v; X8 @6 x  W, D: r- q3 z; Z
Method 07
, f' V# B! K: |, _=========
2 Q. ?, r. S8 y& z( T0 d& E5 d
9 x- G& y) N1 Y' [2 j- kMethod of detection of the WinICE handler in the int68h (V86)
' W+ X4 g  H& t+ \' a
) h5 Z9 R6 h8 L- y    mov     ah,43h8 ~- T( w& O, x  H2 k! y3 ]
    int     68h: @9 P7 _3 f& ]* B8 g
    cmp     ax,0F386h
. X2 I- ?3 p+ d! m2 C* Q    jz      SoftICE_Detected% ~  v' ^- |# t7 \9 n0 `
& @  z' u7 t! w. |& O& x+ Z. G
0 N( G% V& o7 @: n6 l, i  y- a0 L
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit( P/ P  M; P9 p3 _' j/ |; C8 q. c
   app like this:
0 f; W$ b- q- D& n, @9 k
/ s# p$ ?% @- J- \5 {   BPX exec_int if ax==68' @$ B" |8 D" S2 D
   (function called is located at byte ptr [ebp+1Dh] and client eip is
% L/ w0 p! S, T9 |   located at [ebp+48h] for 32Bit apps)
6 X6 n) ?: |" y* \  r0 W) D) `__________________________________________________________________________  y% L6 B  o, e( z/ l1 Y( b2 V

8 m8 ?% Y2 w# |. C, e
' _6 c4 l+ v1 [* mMethod 08
! P% v! ]* C, J0 `0 ?+ Q. x: c=========
$ u7 Z0 Z, d- }+ j! w) p& c* u/ @7 w% E  T6 U
It is not a method of detection of SoftICE but a possibility to crash the
6 ?& `. X- j8 I$ ^system by intercepting int 01h and int 03h and redirecting them to another
. [/ k# v( _% N8 sroutine.
" `' G( x+ @" Y2 yIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' U/ }0 f8 X& N* M* vto the new routine to execute (hangs computer...)
. p4 b" B/ a7 P- i8 h
& f+ \. c  F* o- x+ n. m' f. j5 Z; A    mov     ah, 25h9 S/ S& n9 u$ w9 Y0 q! H
    mov     al, Int_Number (01h or 03h)7 B+ \' U( k5 v
    mov     dx, offset New_Int_Routine# ^" y1 y) K& a
    int     21h
% V- j$ C  B) Z- o, X; I9 z+ P& m
__________________________________________________________________________
- d* i% K" C+ T9 u4 P# M' C+ z
5 u7 A4 T0 S: c) P' R  W& OMethod 094 g! V, K& r  E* I
=========
% Z5 o4 b' F8 y2 w, {; Q8 d$ K7 a/ U, T4 m) L
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 r  }0 V" I, A
performed in ring0 (VxD or a ring3 app using the VxdCall).
; B' ?# b4 w# ?) l% KThe Get_DDB service is used to determine whether or not a VxD is installed
9 H( W6 y' }9 f, e4 U9 O, _for the specified device and returns a Device Description Block (in ecx) for0 l' s0 X: ^# m! R8 ^$ ]
that device if it is installed.( \. A# O- n' {) c/ x; r0 X% W' F- _

6 I8 J! O$ J: e* q* s. y   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID$ ]8 I' t9 c; l+ Q3 q/ I
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 Y- i- i: Y+ E0 i
   VMMCall Get_DDB
+ v( Z  U# m7 H7 n$ {   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 x* \4 L6 B* g- I3 n$ ]& ^( T6 a5 z7 h, {9 x& D
Note as well that you can easily detect this method with SoftICE:
! T; [5 O- n8 d# ~8 r9 q   bpx Get_DDB if ax==0202 || ax==7a5fh
5 U4 }, T% L6 W  [9 Y" Y: i2 S1 @/ S0 L" q/ ]# I
__________________________________________________________________________
) a+ ~6 m, h# K% Q8 q. i% I% s
Method 10: j! q+ A1 R7 C1 K, P
=========
  @9 W+ ?( ^7 p8 g3 g3 r+ p" I4 `5 O+ H* c& ]
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with5 b5 m, H. o; u' E
  SoftICE while the option is enable!!8 o+ q, H3 n2 M8 X; p: F
! Y* Z; X& R; |& E0 q) r  R2 i! b
This trick is very efficient:% L5 Z4 s' \0 ?* T5 U; J3 c! \# \+ l" ~
by checking the Debug Registers, you can detect if SoftICE is loaded3 R% y# |/ u! G; k8 k
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if: ^4 Q+ k, t! s3 M" H. a+ h
there are some memory breakpoints set (dr0 to dr3) simply by reading their
6 c# ?# b& D! c, jvalue (in ring0 only). Values can be manipulated and or changed as well  ?$ O) q0 e, I' Y' ?
(clearing BPMs for instance)
! q+ b' h! w3 Z
2 _% M. h' `1 P__________________________________________________________________________0 p5 _5 W0 s2 u( R
* s+ B7 m' F/ J5 v9 T9 q, m9 _: s
Method 11
) X* d) D* @4 K4 l9 f=========/ [& \7 ?2 v( Y
% o( i) K/ C" U
This method is most known as 'MeltICE' because it has been freely distributed
3 W# n  e8 y7 Hvia www.winfiles.com. However it was first used by NuMega people to allow
1 x) {$ p( @+ ]/ V7 l3 TSymbol Loader to check if SoftICE was active or not (the code is located- o2 F  O. Z8 Y1 p
inside nmtrans.dll).
3 P! C$ L/ c  C/ T& d' f  p4 N( v. i+ O; j  s  {" g9 G. p
The way it works is very simple:
9 V/ t$ Y4 E$ E9 N8 A+ s2 vIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* v) b6 I' A+ g, s2 ZWinNT) with the CreateFileA API.
# l; s! U; m6 v# C2 r0 _6 a! f
% w+ c0 x6 Q9 \: a; a( Z$ ~Here is a sample (checking for 'SICE'):/ d( O# w+ Y, k+ F9 h

4 h! W/ W' N& }3 j2 T" i, m" r  `BOOL IsSoftIce95Loaded()  b3 A/ ?' y, s5 Q. B. l
{
1 A0 ~( y; p9 ^( b1 @   HANDLE hFile;  
8 U& T: H+ K, ]   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# }& V' F' h9 Q5 L9 f: b                      FILE_SHARE_READ | FILE_SHARE_WRITE,
5 q# e. [; z, `, R4 ?. U) _3 d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' ?2 r4 J* L2 e% i: m   if( hFile != INVALID_HANDLE_VALUE )) {6 y! ~1 q; @% Z  @4 f
   {( }% u& ?5 [" G0 G; }4 f3 D; f
      CloseHandle(hFile);$ R& t1 g  O: r
      return TRUE;6 e  ^1 M% a5 ~! z: h2 A: O2 ~
   }2 z& ^  v% {. x/ n' j& v
   return FALSE;; U+ j3 o  q3 y. p
}! S; L7 x4 u! b& o+ o
( G3 P& ?9 I8 Y, g$ R
Although this trick calls the CreateFileA function, don't even expect to be
+ C2 L# g$ n$ g3 Y( b0 K$ {: |6 Cable to intercept it by installing a IFS hook: it will not work, no way!! d2 q, ]' t2 r9 f
In fact, after the call to CreateFileA it will get through VWIN32 0x001F3 E' l; v8 @5 T! Y" Y! O# b
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ V1 b0 z1 K0 f2 A
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( I' m" A6 u( L, {  ~
field.$ I0 e. X- ]  {% m) T+ l, A0 W1 t
In fact, its purpose is not to load/unload VxDs but only to send a
, W3 ]4 c& v2 [$ l& j' R" A2 ?W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 a2 f1 p: y! }: L$ t& ], b6 ^/ xto the VxD Control_Dispatch proc (how the hell a shareware soft could try
, S# A; t4 q0 y% Cto load/unload a non-dynamically loadable driver such as SoftICE ;-)./ z# J, {* q7 ?  X' Q. @
If the VxD is loaded, it will always clear eax and the Carry flag to allow# b: E; K  h3 [1 f
its handle to be opened and then, will be detected.$ ?" C& y" f& i+ K( T2 C; W# f
You can check that simply by hooking Winice.exe control proc entry point) V7 _* K$ ^# D& ?4 k$ j  a; y; R
while running MeltICE.5 ~; E0 b& F. E! a" s

' o& X& s4 Q; x  T9 E3 l" F  u3 V. b  F5 b3 G" Z8 X
  00401067:  push      00402025    ; \\.\SICE. u) F" Y9 ^8 `- }3 ^' H- v
  0040106C:  call      CreateFileA
$ m* }1 w' j6 x7 l9 T  00401071:  cmp       eax,-001
% _& w" ~0 y4 _  00401074:  je        004010913 c" b4 I4 f. X

, \7 ^) E6 _" V) |4 o0 F0 v( \1 p" _& D
There could be hundreds of BPX you could use to detect this trick.
  G8 ?$ A  v3 a0 ~/ ?-The most classical one is:& ?% v+ r0 z2 p% P! O/ _
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" s2 B/ [* A% c+ X( a* c$ [. b    *(esp-&gt;4+4)=='NTIC'2 U' o1 F7 z$ i: Y
: |1 H8 E) f3 `
-The most exotic ones (could be very slooooow :-(
0 P8 i/ x3 J: L! P& J! C   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 [9 g* X, V1 m; T0 ]# K
     ;will break 3 times :-(
6 B! w( q7 G) n" g& `  x) `1 H, k* m5 d# E$ u5 D$ k
-or (a bit) faster: ; v: y5 a6 T+ r5 A$ M# R; ^4 F) Q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')+ m7 v+ S1 R7 s$ f- N- P$ r3 Z8 x

0 o' P  U! |$ [1 z% A  J. j   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 s! l9 @" j9 r. P( d* Q8 @     ;will break 3 times :-(  x7 K% i* }& G2 k

, X+ |: w" R$ @6 o0 {9 l- ^0 A-Much faster:
& H) U6 k! F0 B, M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 r; a5 Q: O) t( W' ^

& Y8 C  J  h2 y2 a6 h6 a, G- TNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
) z. U: \3 A4 s  n8 h: Z: A1 G, efunction to do the same job:
/ |) Q/ W, s4 S# n+ w) V6 c& e' `! ]: w. G( k. d8 H: Y+ Q. ]
   push    00                        ; OF_READ
, [6 g; ]$ @$ G! P9 U3 c' {! a   mov     eax,[00656634]            ; '\\.\SICE',0
: {9 [- @( R2 n) t  U   push    eax' q* f9 v. Q2 X, }1 n( [6 A
   call    KERNEL32!_lopen* T/ k1 E8 }( M- x
   inc     eax
0 f( `# h5 ?1 l  a# H8 l   jnz     00650589                  ; detected
0 p2 R9 C, r6 Q/ |9 i2 i   push    00                        ; OF_READ
5 B! j6 x% ^( v. _   mov     eax,[00656638]            ; '\\.\SICE'# r4 `2 Z% `+ z) L3 m) Y
   push    eax" K) v1 X- X& {* y
   call    KERNEL32!_lopen3 e7 n9 |% X4 G  h  J( R+ T
   inc     eax6 n- s8 h0 c7 {5 V( R
   jz      006505ae                  ; not detected$ q& h1 A7 J9 f- f9 P, m
0 k' A. X( }" ]8 R
7 f1 e/ m, g% x5 @8 C9 C
__________________________________________________________________________5 U# m+ Y2 n$ ?

( H/ O$ T) O0 L5 j3 K. p3 eMethod 12
1 _* t+ c! ~! g=========# O8 I- z; p) b$ O) `4 A
6 b: X: F: S/ ]) R& Z1 ]. W$ u9 v
This trick is similar to int41h/4fh Debugger installation check (code 05
' D9 S, Y& k1 h, p5 Y&amp; 06) but very limited because it's only available for Win95/98 (not NT)6 @# z0 b+ d/ c
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 S9 S) X3 r& R6 @9 Z2 [. E. i
: u' ]+ k4 M: M   push  0000004fh         ; function 4fh
2 k; X- _7 U4 u( A2 J" s   push  002a002ah         ; high word specifies which VxD (VWIN32)
* J" O* a9 F/ M& r) j8 N& V# w2 T                           ; low word specifies which service
- U9 ~' h/ S4 F* E$ N                             (VWIN32_Int41Dispatch)
! T* X8 A& b! Q. `3 A6 o, E) e   call  Kernel32!ORD_001  ; VxdCall# q: f1 y, w$ A: N( U! [* {4 g
   cmp   ax, 0f386h        ; magic number returned by system debuggers
- N; G$ `2 A/ Z* o1 T2 Z   jz    SoftICE_detected
& i& R4 V8 U2 w3 s2 o- Q7 l* Y3 ^. D! N3 n  H1 L* K
Here again, several ways to detect it:
: j/ y2 R4 c/ u7 z! {  C/ S* h' F2 c1 H0 G1 {" L% N
    BPINT 41 if ax==4f) W2 a/ V+ X. f$ ]$ L, y2 ~
+ _, W' v3 L! b/ V
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, N: A  t5 G' m+ v1 F
5 K8 p5 R0 _' U8 G+ x' J
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. ^* P" d- L# C4 V9 z, _
! W0 u7 F, @. a. {, N+ X& b    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: N6 e2 W- e. s+ w! y2 ]2 P7 z
( ]( U5 x7 \1 b" @# @5 B__________________________________________________________________________
; c1 K1 ^) Z( z" u! z& U  @% P6 o
Method 130 k5 B2 A. E" o5 ^& O' X
=========
0 \. v9 ]5 @, V: x( _0 r" U7 d2 f. Y" W0 r3 R+ O, p
Not a real method of detection, but a good way to know if SoftICE is* I1 K' n7 \4 o+ m, F, I1 R) Y5 ]
installed on a computer and to locate its installation directory.
' K, B8 M; C% ?9 m0 A" JIt is used by few softs which access the following registry keys (usually #2) :0 @* M7 t3 e2 i# J

( u( b: Q) S5 `6 f7 y6 I! J. ^-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# q# i# i( A9 Z# X
\Uninstall\SoftICE
  c5 c  G) q- O* b9 t-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE" w) Z/ x8 Y) t; _8 D
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ E: b' K: s# `. O& o
\App Paths\Loader32.Exe' Y6 H1 ~! v! p3 H

8 Y% f7 d" |- `: o. d( C& t" z3 k7 e( W4 `+ E
Note that some nasty apps could then erase all files from SoftICE directory
2 z) Q2 ^5 ~' ]9 C) t% ^1 Q" T* a; K(I faced that once :-(
3 ~4 e" k$ L! N# v) o
/ w/ f5 h% T3 [Useful breakpoint to detect it:, x' g, E* ~/ ?. y' S

# A9 p1 B5 v( ~# Z, B* \     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" ~0 y9 z- r. T3 \+ i7 T* ]  i2 R- u  Y- u
__________________________________________________________________________
9 d" i' T5 G: Z5 G  m3 n+ c
1 {9 o/ D0 C* j# c
8 X! M" |2 ~2 P  BMethod 14 8 u# k7 x" g8 c. O3 V
=========0 \/ T, y( i* H) K5 ~3 g1 E* H# n
, i4 t9 L  M  i3 l* Q2 A% o# n
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ _; x: P4 X/ W4 y" a& Ris to determines whether a debugger is running on your system (ring0 only).
3 g. B' v& U1 k4 K) E' a0 N& f- F, a1 u: q& E
   VMMCall Test_Debug_Installed1 J: X& a4 R4 y* m! _8 p
   je      not_installed) }6 e: U$ y  c. ]( \; a6 k0 ]2 @

7 h; w' G6 b: ~+ N( Q- rThis service just checks a flag.
: ]8 B" ^4 Q# f$ @! j- u7 M</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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