About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
5 z! ^0 a9 A: s1 o. y<TBODY>
7 D- u3 |& Z3 V- G7 c<TR>/ }+ s7 ~: M. h( [$ C* B% f3 g' O
<TD><PRE>Method 01 " r( Q- V  o; {1 R  H2 v
=========. g5 T7 f, r+ c2 |0 G. ^- ~/ Y8 @
  S- }$ Y" ?5 h& L
This method of detection of SoftICE (as well as the following one) is
* W9 N0 ?" d& D, F/ \# Xused by the majority of packers/encryptors found on Internet.+ w" v/ M9 R& ~$ [/ ~" d2 T% B, R
It seeks the signature of BoundsChecker in SoftICE
, d4 e% I7 y- ?. p: s9 b# z/ {2 e5 ^8 L+ D% i, y8 b% f
    mov     ebp, 04243484Bh        ; 'BCHK'
, v' q) v( k: r    mov     ax, 04h' G+ m4 g) l6 T9 [
    int     3      
$ p  s" s5 ~! M( s! o8 M1 a    cmp     al,4
$ ]/ c  W. m- Z, b    jnz     SoftICE_Detected
4 f% m& F* M  G$ d& k! O: e$ E/ @' @5 C* f4 y! T$ d; P
___________________________________________________________________________: [5 S3 i  D4 |; \" @  I2 j$ ?/ A0 D
& R! x+ T* {# [9 Z# F
Method 02
  {, k6 L# s! d=========+ E9 r% j; _$ O8 A; w# i" j

& d/ J9 B3 a! v* ]Still a method very much used (perhaps the most frequent one).  It is used8 O9 f* P/ R/ G# a
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 b0 L1 _" U- y  o. U
or execute SoftICE commands...
" _2 ^! ]1 \6 p+ ]% s* G; h/ yIt is also used to crash SoftICE and to force it to execute any commands% S8 J3 B) _& c/ W1 s* k
(HBOOT...) :-((  
& Z8 s: c% ~4 G( u9 B- \
: ^" Y( E  t2 u- o$ kHere is a quick description:
9 d1 b7 r& ]4 ?" i, Y& m7 k8 _-AX = 0910h   (Display string in SIce windows)8 [8 [. J5 Z& T3 x$ M
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 A; o" ~0 ^/ m; l! m5 X-AX = 0912h   (Get breakpoint infos)
, P& e3 A# m1 J( c" W# j+ D-AX = 0913h   (Set Sice breakpoints)
( b( U* Q& X9 C2 A* ^-AX = 0914h   (Remove SIce breakoints)- d+ X" W: H& |5 S; o: \( ^# \
4 C) N" M# W1 G6 `) e3 W
Each time you'll meet this trick, you'll see:
/ K9 M1 r- g6 Y! j7 B) _7 s% E-SI = 4647h
! ~, q8 N- P$ s-DI = 4A4Dh
' H  B  H/ c; |3 p4 CWhich are the 'magic values' used by SoftIce.
" p; g" F7 C: P4 j; ]For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ _8 r( V5 @, W$ @0 Z0 N1 o. O- L" {/ ]1 a
Here is one example from the file "Haspinst.exe" which is the dongle HASP
# p; j8 w) ?) h9 lEnvelope utility use to protect DOS applications:
7 \' j: k" R0 O% C3 V& L2 a+ z1 g8 H( f) L/ u

! @2 v8 s  r8 M9 s: _4C19:0095   MOV    AX,0911  ; execute command.' q9 [5 S, w9 A# v
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! S! d2 k1 h9 T* M) N4C19:009A   MOV    SI,4647  ; 1st magic value.' E. c/ }% U# X1 c7 J4 X$ O. H2 z
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
/ ^5 K) ~# a- }4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ ^" P: M5 A1 o4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 j6 m' R2 [% e
4C19:00A4   INC    CX
4 w) U" [. g1 g9 y; H* e( N0 L4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute) a( X8 J" Z9 m; U! @0 o( E
4C19:00A8   JB     0095     ; 6 different commands.
4 d8 R. u( K8 ]" Q# s4C19:00AA   JMP    0002     ; Bad_Guy jmp back.. f  S" l1 |( Y( c3 p6 ^
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( z* V8 a$ s7 x1 g; r. ~2 ?* x, r. }( `2 L9 Q( v+ R  U! F; B
The program will execute 6 different SIce commands located at ds:dx, which8 H5 U6 w0 Z3 s/ M& L) o
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ _. x: e/ W2 B2 n8 @
" i+ a* f/ I$ g; i: X) Z  o% H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ u$ Z2 o- u! P, P
___________________________________________________________________________
! p. O2 E& G+ P. ~" p9 D9 L! u& {  l2 g1 l  q
' [) R+ K' n1 X2 j
Method 03
0 D+ y9 h0 s) J=========- \7 b! L8 z) V5 E1 l/ L/ H9 S

# |1 K4 ^" j' `2 j' g  I' l/ ^Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
1 W8 z* p+ Z* a1 C. ?(API Get entry point)
1 h2 _& }4 |( l# ]  k  [        
$ ?. d3 h' ^% c& ]
# b8 D$ V5 S) R6 V1 v$ N% n    xor     di,di* r9 @. p3 V+ @+ M, z# p
    mov     es,di
$ P6 Y9 b/ r9 P3 ]+ X' q    mov     ax, 1684h       % T# i9 D% G( S4 J: A. d9 L2 [. C
    mov     bx, 0202h       ; VxD ID of winice
0 A5 d8 e' x7 s1 Q! \* _    int     2Fh, |0 t: X, P9 V4 {! H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( @( Z! a, D3 C" Z    add     ax, di
2 G/ I0 ]; ]$ p& B' Z    test    ax,ax
& l" ?( o9 p+ O# n, I" R    jnz     SoftICE_Detected
) z" w* L' S! b: ~) p. V, x5 D, ]  l) O- W% J/ z- C$ t
___________________________________________________________________________  k# r: g( S, V3 H: K
' |9 d- m$ R, G. D; L: k9 T
Method 04: ]. c+ P! ^4 B
=========
# E* |+ U+ q  A+ G! W" e  R3 i
8 d0 F6 I. C! g9 j! ^Method identical to the preceding one except that it seeks the ID of SoftICE
9 J) n, t, p3 O. Z1 zGFX VxD.9 h) H0 n  V, _" C; S2 G2 B

! F0 c2 S2 X% i. \+ v    xor     di,di
+ ^  H  K' k( i0 s9 O& S    mov     es,di
) n2 Z) [+ K5 U. ~    mov     ax, 1684h       . `( q8 j. E* d/ S
    mov     bx, 7a5Fh       ; VxD ID of SIWVID- D  F, W7 g. u0 s
    int     2fh
' D7 z3 |. A1 v6 \* D7 A; ^, N    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ U4 \9 p! Q! _7 G: A3 D    add     ax, di
$ w, v* J' O/ f) K6 m    test    ax,ax" ^% ~1 m' f3 C3 U( u
    jnz     SoftICE_Detected
$ w# Z" [: |4 }" b6 {. ?9 {  |/ E9 V3 ]9 _6 i* F& Y
__________________________________________________________________________
! X- j3 q1 i! y. n4 p1 ]1 @: @  c0 u
, _2 w% s/ M$ q, V1 ]( r* A  u
Method 05
5 c4 E6 b0 x/ b2 [=========
) I% }+ m: U/ @: F9 R0 @+ s( E
# U; D6 m' P3 l  y% yMethod seeking the 'magic number' 0F386h returned (in ax) by all system: a' O! C# t0 N3 G
debugger. It calls the int 41h, function 4Fh.
3 `! |/ m$ M, M& p# kThere are several alternatives.  
& S: @* H* ^  Z' R' _) F) }' e" N9 q9 }' O! w' p6 {& F
The following one is the simplest:3 B: Y' e$ w% k, z2 s+ H4 R; R1 w
2 \) |. h* g. i" ?6 S$ I
    mov     ax,4fh# F$ l; t) P: b4 x& L
    int     41h8 ~  W+ _2 P! t0 q9 g
    cmp     ax, 0F3864 L9 V# L( T( A
    jz      SoftICE_detected9 d" P0 L6 k- R5 l( _8 u: B

* {+ r1 k3 _5 A
1 b* h# d0 Y4 Y- h& WNext method as well as the following one are 2 examples from Stone's 5 f6 K0 K; _! j- |1 h! R% a& y& y
"stn-wid.zip" (www.cracking.net):1 b* \+ I) W) Q" j3 [) \
9 d5 l4 B0 A" P) w' B: ?1 A, V, u$ f3 E
    mov     bx, cs$ F( L; ?; F$ F% i3 v' ?: |
    lea     dx, int41handler2: [, H% B" {+ q& {) U) [
    xchg    dx, es:[41h*4]# _. x8 O8 y; r
    xchg    bx, es:[41h*4+2]4 O( j6 U3 r: ]: f/ a% z% Q
    mov     ax,4fh
" Q( G; x! N5 b2 i    int     41h
! E1 C/ H4 y! n& i1 |    xchg    dx, es:[41h*4]
6 M8 @  |7 G! H" V& D- F    xchg    bx, es:[41h*4+2], q5 |" j0 z& X0 A  i
    cmp     ax, 0f386h
$ f0 E4 \% E" Y1 i( T    jz      SoftICE_detected  b( y0 o" l7 J

7 R+ L* b/ f! gint41handler2 PROC+ X# i( d% \  t' _1 H
    iret: q  |1 A* ~$ ~4 l% V, F
int41handler2 ENDP9 `: T" u4 P$ p5 I' o

9 D# G; ~7 r, y3 L# P+ ~
3 C! Y, E) \) d% b6 ^_________________________________________________________________________
) N) J0 d! Y6 ]& X6 u
: l- W' d# |# p2 \( F& \6 b* k  ?- ^8 M: Y
Method 06
! e6 O& Z/ c1 K$ f( R" i3 K=========
/ G; F" I  x* w' A/ c
: ]( ?7 E9 e* ?% l7 o
! W: p' Y! l& L8 D2nd method similar to the preceding one but more difficult to detect:! w0 ^6 G; R( K: E* u" ~- E
8 d4 M. Q. h9 j& i2 T# d1 S, G

$ M! q3 j4 S, P0 Rint41handler PROC% H6 L2 E/ h0 N/ ]+ b; U6 E) |
    mov     cl,al/ E( G8 {% H' ?2 X; G8 T! J2 C
    iret
) _5 _0 l8 q+ S" hint41handler ENDP0 S& g- }2 A4 V. Y: {
3 ?- s: c! @6 _8 z# M7 A
7 k- u% g; L% a+ V
    xor     ax,ax
1 d, D6 P/ K; f( b5 J9 R9 m  V    mov     es,ax- }( a" |+ b* J; v' L6 ?: @
    mov     bx, cs3 O' L% Z1 z8 C# V
    lea     dx, int41handler* l+ ^! E; _0 }$ |# I" Q
    xchg    dx, es:[41h*4]" M" z/ f* b" w
    xchg    bx, es:[41h*4+2]
/ g* F3 M/ M) O. _7 I5 w9 z    in      al, 40h4 |1 U) Z0 F; G: O3 F
    xor     cx,cx
9 H  p  i7 m' H/ `* `) W    int     41h: s' s7 h0 ^$ x% e1 S/ s+ y% l
    xchg    dx, es:[41h*4]6 m  Q; Q& \; y' {
    xchg    bx, es:[41h*4+2]+ w0 e5 _: g: o! I+ Z( l- b
    cmp     cl,al( O2 `. W- ~9 t7 `$ Z
    jnz     SoftICE_detected
7 U1 y. J* {$ z! a) ]! {. j& X1 }
7 F' I. c. E/ ~: `5 [; O_________________________________________________________________________
" W2 t% x: t% g! m/ G& [
4 Y1 Z0 D$ s7 d( a3 qMethod 07) X3 a' k( R1 @
=========
& |1 D9 e" }3 c& z1 q1 H5 ^
" M4 r% M9 v, A- \% [* cMethod of detection of the WinICE handler in the int68h (V86)
' M% u* x, d8 w
$ {- `& v6 ~% _  U- H9 u    mov     ah,43h( \" t2 d% u& M4 N
    int     68h- g: R1 W0 ]' j* W& A  a
    cmp     ax,0F386h
! p) o2 R& n5 h+ t    jz      SoftICE_Detected& F" {- i$ l1 x/ N/ ]- d- A/ }

9 m% c* K! ]( M4 R7 b2 H; z, D1 q+ p' }/ t% J2 u4 H
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 ^# Y' ~- i, n   app like this:9 B* p* m3 l. T/ U. S0 a# B7 s
' y, n" Y- s) n: R! Z1 L. p( z
   BPX exec_int if ax==68% N% j6 `9 ~0 k1 A) u) I
   (function called is located at byte ptr [ebp+1Dh] and client eip is
. l8 N9 A- ]) q  h   located at [ebp+48h] for 32Bit apps)" z+ z# o5 s/ w! u7 W# b6 \4 T
__________________________________________________________________________
) ~% H* o$ m7 C
7 k; t7 N1 s6 p
/ e, j2 ^1 X" T. X' cMethod 08
( Q: W5 F: a. f" k, d=========
  `5 d: q' P* s! j; X7 B$ S' k( G. U: r9 D
It is not a method of detection of SoftICE but a possibility to crash the
1 }, d5 u$ I( S  F$ Msystem by intercepting int 01h and int 03h and redirecting them to another
5 U- W) c5 C, h( G5 N. iroutine.8 e: `' x# s4 D7 [0 F3 E
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% P% J( L! _" M1 Z8 g
to the new routine to execute (hangs computer...)
0 {! {5 S6 D/ P9 z2 I3 ~
) {" E, O. _( L! Z" z    mov     ah, 25h
/ O* i3 t! Z' p5 u9 k    mov     al, Int_Number (01h or 03h)
4 A$ N" k$ l3 D4 Y6 T6 q/ p    mov     dx, offset New_Int_Routine
+ j2 p! M  r/ Y3 Y4 d! o    int     21h5 ~# N3 Z/ |& X% e( }1 ~* j" k4 z
0 ]- J7 h5 I8 {& X7 y8 `  T
__________________________________________________________________________
* [3 @7 N6 _8 b* G/ l+ S3 `6 C6 S- l) i( `* q/ @. S
Method 09
9 L* F0 j9 u# o; \0 X& q4 S0 X=========4 V. Z5 B/ W8 j% _
3 r$ _4 y$ I( e5 R  ?% i6 M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& W& c7 T- R+ I' ?$ ?performed in ring0 (VxD or a ring3 app using the VxdCall).
6 _7 R! L) C( {) bThe Get_DDB service is used to determine whether or not a VxD is installed
: N& ?- L* G2 n" J/ K4 Z  Ufor the specified device and returns a Device Description Block (in ecx) for1 Y' Z1 e  _* l, E% W' D
that device if it is installed.
/ m* \9 E9 }# [% U3 r' p6 x8 O1 L3 K! V7 L
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID  n8 H' C) a) @9 g6 u& g
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
, A8 J$ Y( k0 G' [8 s. r, h   VMMCall Get_DDB* h8 @/ i2 U; E4 B9 L3 l6 u# M+ G
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& @* f" |$ K  o: }4 w
/ p2 A, S+ t9 ZNote as well that you can easily detect this method with SoftICE:
+ S1 R) R' D0 K% f0 m& R- b+ v! H4 a   bpx Get_DDB if ax==0202 || ax==7a5fh4 Q" B* L# L; @  o$ ?/ c0 H4 {3 d( K
; |3 N: C4 I; T' a
__________________________________________________________________________
) y) ^1 G, V; L2 P$ R% E* t9 d# d3 H; N( R* n8 e% q/ v; G
Method 10: }4 \8 F( K- E* r( _. P
=========
4 k. Q/ V/ {8 `) H/ c# [
' P; U4 g+ M, t1 H! s=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with7 k4 c$ n( {% R; j! n0 @! k
  SoftICE while the option is enable!!- o7 m  G! d, ~0 i

- }' ]4 c* B5 r2 N. ~This trick is very efficient:
2 c6 m: T0 x1 u- @" }, f& c0 hby checking the Debug Registers, you can detect if SoftICE is loaded
" w! C% h6 n' D# i" b% t8 G(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if6 v( Y; }" y" L. @+ h9 ^
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( b3 k; ^5 c! _' b0 hvalue (in ring0 only). Values can be manipulated and or changed as well- U' c! x  f- N4 l
(clearing BPMs for instance)
  S9 W" a) f* y/ @
& B  A, H' z- m! r' l3 e3 D__________________________________________________________________________+ W; D: U8 E6 C3 W' F! a; z5 O

; _4 M" N* L* z2 a) q" `, ]Method 11" R# R2 C( K) f$ y
=========& B' P1 y; q" k# m
+ {8 k* Z% `+ H' \
This method is most known as 'MeltICE' because it has been freely distributed
0 i$ N! ^8 l8 b3 v; [via www.winfiles.com. However it was first used by NuMega people to allow* Z! ]  L3 ~" t$ M) O/ S+ O
Symbol Loader to check if SoftICE was active or not (the code is located! l+ j" i2 s! a0 L) v$ Q
inside nmtrans.dll).
2 t5 P) y! g7 `- v" R7 k4 b. x# a1 j7 {* J0 X, c1 y
The way it works is very simple:
5 z: u, F" e. G( k+ s7 I; _; eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
" c8 `4 X( N, }) x" q) SWinNT) with the CreateFileA API.% M1 g1 B9 }- {* w% K

# m3 [+ m% }, cHere is a sample (checking for 'SICE'):
! R* D1 Q$ Q6 i. ~0 U) l2 e
( l' P1 @% f' i: K; QBOOL IsSoftIce95Loaded(), W- c; l, b# l5 v7 d
{
6 V: B' |7 [# @" n' {; k+ ?   HANDLE hFile;  $ e' O9 V* R+ s8 T
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# c$ F1 a1 h, p& ^7 a/ e
                      FILE_SHARE_READ | FILE_SHARE_WRITE,+ ?# \/ e0 L  y- \) C
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& l; D3 U7 @- g, n5 C, f* K
   if( hFile != INVALID_HANDLE_VALUE )  V! u( O) R4 G7 j
   {
. h6 |" Z8 D) }7 M) P      CloseHandle(hFile);
% {' j. {) k* A4 X! Q7 S) j; p      return TRUE;
( y+ w& i% m& g- m4 \+ X0 Z8 U+ J8 |   }* ~  U+ J; U9 v' T, `% @
   return FALSE;6 Z4 K' R. b+ B# K  I$ p/ c
}
* v7 X! C6 p/ c/ O7 J1 x" s7 L' f" f& g0 H8 R0 i2 `+ g' x
Although this trick calls the CreateFileA function, don't even expect to be
4 E: b% v, Y' v8 k/ mable to intercept it by installing a IFS hook: it will not work, no way!" J( M* Z9 [7 v7 e3 ^+ d# M, h
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; ?6 i: s0 S* j
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 Y" k6 X& g4 ~+ Y' a6 o
and then browse the DDB list until it find the VxD and its DDB_Control_Proc4 r8 I. G" h; _7 t; K! e7 I
field.5 Y' J6 ?& {' e$ a
In fact, its purpose is not to load/unload VxDs but only to send a " C8 e" N4 N% n: m
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 l' R6 V2 S; ~( rto the VxD Control_Dispatch proc (how the hell a shareware soft could try, @, j7 n( w8 S- J( Y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ V( o8 o0 T) i# J1 I! CIf the VxD is loaded, it will always clear eax and the Carry flag to allow3 B3 h5 k7 Q; x1 r3 @
its handle to be opened and then, will be detected.; \: I+ p$ u+ I1 Y6 T2 {" e
You can check that simply by hooking Winice.exe control proc entry point
) O; }; O# W$ c. s' c* cwhile running MeltICE.
  e! S6 T# r! ]6 `" u& ~
0 g+ C' V! i8 a+ E
9 Z! @2 q# Z4 b  00401067:  push      00402025    ; \\.\SICE8 g; u0 B9 Q% z* l$ @
  0040106C:  call      CreateFileA
7 B0 }" d' W! P' U  00401071:  cmp       eax,-001
5 ~6 P' F3 Y9 T/ J  00401074:  je        004010918 x, d; f3 G, |

6 }* E8 O7 n- q1 E. K2 x7 ?. F6 u( Z# w! Y$ B# W6 l7 i# `$ F1 @
There could be hundreds of BPX you could use to detect this trick.5 v0 E8 i2 t1 i/ X0 l3 s3 `' D
-The most classical one is:& f: Y2 E- I% j
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
8 d' G$ k6 k) N; m    *(esp-&gt;4+4)=='NTIC'* h0 O3 \5 w6 A+ ]* j/ \6 z$ @$ l$ v

4 Z8 V9 ]; i' u- v0 z; T! O-The most exotic ones (could be very slooooow :-(
3 V% a+ v# O& w, N+ W0 z   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 i0 K4 N- \( [' n5 y$ x7 D
     ;will break 3 times :-(
  X: X6 q/ W$ ?/ d  l  H8 A; m0 n2 }
-or (a bit) faster: % T# Q5 Z3 u) Q' b, v, j1 a  e
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 R8 L: M+ E: A+ k5 C+ J
3 h: `$ f$ [. U7 v2 b8 ~2 P) [   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 h  I& F: k2 @  t# y  B2 w     ;will break 3 times :-(
8 J, x( I! a2 v# G' u( c8 n+ J% m1 [! d4 X. L0 j# ~" r4 m. W5 \
-Much faster:% g; \6 N) Y, q5 {4 P3 E- k
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ |8 ~7 |9 s: k5 Y6 [( D; i/ B9 n- ?+ l, o) K3 W7 j4 r
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
% j  v9 v8 |3 u7 b+ d$ vfunction to do the same job:
0 q8 F+ f$ q' B5 G8 k' D6 @% N1 t: z; S4 M) e3 v6 L
   push    00                        ; OF_READ
# N5 J% o: Q$ z* e  b- A' Z   mov     eax,[00656634]            ; '\\.\SICE',0- p9 o/ \7 `1 k
   push    eax
7 x3 A; Z; v( M) u   call    KERNEL32!_lopen' }% ?* R/ b& G1 ^: V! P
   inc     eax! p) f) f! H1 k1 a: `: v" c% [. a1 E9 q
   jnz     00650589                  ; detected
) j2 ]9 Q& i9 Y- k   push    00                        ; OF_READ
) @4 c9 G+ Y1 C* J8 W* k* F! m   mov     eax,[00656638]            ; '\\.\SICE'  W; K5 S$ i! S  P; M* n2 D/ `
   push    eax
  T( j& d5 _# F5 Y* Y) D8 L# E1 g   call    KERNEL32!_lopen
3 T* Y9 x& Q% ?# z8 \, k! {   inc     eax
; |" w, a, @* z, j- g' M4 Q/ H   jz      006505ae                  ; not detected
7 J' ]; r5 {- b# U" `3 z" Y' ~* p) Q$ w3 M8 ^; ]
. N# z, R" _; e* @3 {8 r$ d
__________________________________________________________________________* O" z$ A9 S% d

6 @/ ~9 w0 j5 M8 K5 }" QMethod 12
3 u3 F9 n! K/ M9 D7 H=========
0 M9 F7 d$ Q' `5 d  t
; Y4 ]8 y( Q4 r) R( vThis trick is similar to int41h/4fh Debugger installation check (code 05: d. ?6 `! G+ y
&amp; 06) but very limited because it's only available for Win95/98 (not NT). b! {) U$ [1 n" |6 p7 a
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.) F4 i6 C; t" E
6 S5 d( D# _) H  Q  ]: N1 _( v  @- W3 q
   push  0000004fh         ; function 4fh
# @* ]" _! G% J; n6 x$ W   push  002a002ah         ; high word specifies which VxD (VWIN32)
5 d6 r; ]2 S. V: D) c9 l( Q" o; P                           ; low word specifies which service0 ~! Z8 y# K; K: B
                             (VWIN32_Int41Dispatch)2 h7 z1 |! p5 w8 \
   call  Kernel32!ORD_001  ; VxdCall
. A: R& S9 o% H' `   cmp   ax, 0f386h        ; magic number returned by system debuggers5 M' e& B+ ^# J- ]% j& p
   jz    SoftICE_detected$ ^5 H0 e" u# o8 b5 w  |# Q
. z, f! H- c# s0 j# S
Here again, several ways to detect it:; X# c: p# v8 l, W9 l" Y( c

; i: ^; I+ R8 o6 R% ?( j5 G* Z    BPINT 41 if ax==4f, J% c$ L7 x$ e+ _

" D8 f. Z: R: O4 o    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 w0 o6 ]% c" z) Z$ ?7 O; x) y
/ V) U2 B* ~: n6 P# c    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 y1 I) ]1 v) ?, d2 g4 ~

: r& F. Y& _! e    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 Z+ ~( X9 {- E6 a5 [, J- V" a
/ j1 ^6 {8 x- @; R3 D
__________________________________________________________________________& p# C3 _& {* o% K3 }1 }: p, ?0 `+ z

, @; s  Z6 B$ M. g: V" E& lMethod 13, m' t. n* g% D
=========
$ z2 C# U! C5 W( I# u- k$ |$ u# @8 v: i" d' O$ ?& l/ M
Not a real method of detection, but a good way to know if SoftICE is
" K& f) p5 J; }, s& u  N+ Kinstalled on a computer and to locate its installation directory.
; {( a+ a6 x8 V9 _* dIt is used by few softs which access the following registry keys (usually #2) :
6 A* g+ {4 M7 D& x6 z! ]8 ^9 S0 \4 P; G3 K3 W7 \, I  C
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ _2 i; t: O6 Q  ~0 T\Uninstall\SoftICE) U$ t9 L: u+ H; l( p# z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
  j# y; h9 l' r; Z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% M% k5 j$ Y( O2 a" Z# x! G\App Paths\Loader32.Exe1 X/ Y- ~5 ~* i5 }. E
# D0 ~! r1 O, k5 F- i

( W7 J4 _& |, \7 XNote that some nasty apps could then erase all files from SoftICE directory
- c  B' k/ g: h" C(I faced that once :-(
, G# A" R$ A9 [7 o1 }" Y0 s0 F; K* X) r( E* _. H' Y0 J* f
Useful breakpoint to detect it:
  C; d) f$ h" f. v3 H3 I
7 s8 H, G0 T' O5 e     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* |3 J2 j1 p5 i7 u. r" l* ?% a  E
__________________________________________________________________________# R5 q) b8 v! D7 H1 Q- g  ^0 [
2 s/ s) S8 u) L$ [4 ~9 u. ]2 W! A
% T2 }+ C! Z, \
Method 14 5 ]) ]- ^, {: [$ Z: d! C- z; v0 Z& ~
=========# s' m9 A: t7 a/ C$ N& H
; }0 ~# {+ K8 z  B+ k
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* D) J& j( l5 j6 J7 _
is to determines whether a debugger is running on your system (ring0 only).' }  c1 u& [6 H' \$ O5 m
8 x& ?/ ]8 R5 p" C% ]4 A
   VMMCall Test_Debug_Installed
9 h9 x% G! f& n1 E3 ~, g5 U3 R   je      not_installed6 ]/ \* R: W# ^  }

) k3 [: m) J. p6 l2 qThis service just checks a flag.8 o) O1 d# d; O1 B( u
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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