About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ Q! |& x, X) L( ]  L) _: Z
<TBODY>
- `/ v0 n& P" G* e9 c7 m2 l2 \<TR>
! q% D2 G$ e0 J! c" }( t& @3 S<TD><PRE>Method 01
! [7 o% K) a  P9 L' ]# @/ h5 W2 m; m6 a=========, w# F0 R  k3 ]* Y
2 [) Y  g2 M) U; G. U: M5 e
This method of detection of SoftICE (as well as the following one) is5 ^  D9 O/ @* c* K
used by the majority of packers/encryptors found on Internet.3 R# y( v/ d( T
It seeks the signature of BoundsChecker in SoftICE
9 w% _% Z+ R2 {
1 K) D5 H3 @, q    mov     ebp, 04243484Bh        ; 'BCHK'' x6 @' Q! T$ G+ }" p
    mov     ax, 04h+ d" g" a$ x! u! J" d5 B
    int     3       3 e. L# y/ [) N4 M
    cmp     al,4: N( ^" R1 }6 }4 T2 k+ h
    jnz     SoftICE_Detected0 H- W& A5 g, @# Q) b+ V; p

( b" r# @; ~# l/ O& p___________________________________________________________________________
5 Y" H$ t( a+ r# v( \+ a* W
, x& n$ _+ W. F5 Y8 k5 C5 iMethod 02
% {# k& F* S' d=========6 O# _+ P- X3 X4 Y. o' F( J
* R- ?% p: }. ^* H/ |) u) |8 j
Still a method very much used (perhaps the most frequent one).  It is used
3 @' E, H4 m; F6 Mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 z& L" r( e# }) `% t, H
or execute SoftICE commands...% @; w1 ], e, h( l5 |2 |  D5 V
It is also used to crash SoftICE and to force it to execute any commands
- O1 s  D6 e: I. O% j( n(HBOOT...) :-((  8 H* i! [/ o- @

8 o  J# \% N# M5 r, n3 _- T2 x6 tHere is a quick description:
$ W1 a1 W1 V$ N  a( M7 x-AX = 0910h   (Display string in SIce windows)& s6 @: Z0 q4 k. _& q4 I
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)$ l) I/ `, d4 f. l( \5 a9 A/ j
-AX = 0912h   (Get breakpoint infos)3 c: f2 O/ D. Y
-AX = 0913h   (Set Sice breakpoints)# K# f! Z5 X3 W; T
-AX = 0914h   (Remove SIce breakoints)# z9 w/ ~* k+ r/ b( L: L. X

7 C/ U4 h# @) V) P# L7 L- {7 BEach time you'll meet this trick, you'll see:
: {) ~  H9 N! }2 a-SI = 4647h; r2 W$ _& E* J5 z4 A1 S! d+ b
-DI = 4A4Dh+ f4 L" ^& _" b3 V! O* Y
Which are the 'magic values' used by SoftIce.. R8 _) l! |: w1 \9 t1 K1 f
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% T' @' X5 Q* [/ m. ^

; l* u* U) M; j) J& J/ SHere is one example from the file "Haspinst.exe" which is the dongle HASP
  ~. d' G0 T* S, J# U4 yEnvelope utility use to protect DOS applications:, p9 T6 V/ H, h

) U, a- b+ ~0 z3 i8 L
9 J3 f+ h6 |8 g8 @/ j" y" o4C19:0095   MOV    AX,0911  ; execute command.& T2 k8 h8 B. u% z
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 p8 \- q; T1 r7 z: i! K3 L4C19:009A   MOV    SI,4647  ; 1st magic value.
1 T) L' y5 h, G- Q+ z4 E( C+ }: z- |4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 t/ G' R4 l  Z0 o2 `5 |
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 {+ k! E6 X$ D7 s
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute8 O; _( v# o4 [6 Z
4C19:00A4   INC    CX
  m4 M! v. J5 N3 `2 {: S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute) \$ S6 A! l  ~$ @6 L- d
4C19:00A8   JB     0095     ; 6 different commands.
5 _8 R% k/ I; @4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 @- {4 m/ U! t) Z$ l4 p4 ^( \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 r) o5 E* g4 k

1 L9 U/ N, \5 D. b+ NThe program will execute 6 different SIce commands located at ds:dx, which5 w% Z4 [' ]. ]) p" W' t% O8 _' C
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.) R+ A; }2 q- L9 k. ~& L5 z! e
( Q* C  J1 g0 u6 \8 s& |! P
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
4 ?+ m  a) p. Y0 `) l# a___________________________________________________________________________! x8 w; l( B0 c0 r
) n2 K2 b+ {0 \# U2 X- f
6 C2 d' E: a5 t0 T# b6 D
Method 03
0 W& N: e0 ^2 k  Z=========0 l) u% k! c: c: s" g
0 i# u/ I# c, I9 a
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* x+ d. W7 |/ H0 _3 k5 D4 A# Y
(API Get entry point)
9 f, N+ }  J9 ]: G' W  N        
: B+ V/ x( {3 K' j: K9 j$ v" m# F4 `# C! p; z/ q  M. Z
    xor     di,di  E( ~- a( V3 R
    mov     es,di
' |7 d; b* X( }* f9 p) X    mov     ax, 1684h      
. w. G4 `$ a+ a4 q- M* f+ o9 x0 I    mov     bx, 0202h       ; VxD ID of winice
6 [8 }2 _) ?2 c+ A4 N  E0 D    int     2Fh
; l0 \+ t0 j% F% C/ K    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 u9 B) X9 e- q
    add     ax, di
2 g: w, [. n6 j5 h2 W7 e    test    ax,ax! Y5 N+ h( L/ h8 \; a1 Y' G! Z( M
    jnz     SoftICE_Detected1 _/ S/ t$ F  @6 J8 p
/ ?. A2 r' `! t0 P; r' u
___________________________________________________________________________
  H' p6 }4 A: ^1 S- V1 o( f& m" N1 g; o7 N  x6 ]! F4 a/ V# }. b
Method 04
4 H% @( w4 j# G=========( N8 `7 R1 g/ m. ]' Y- d- `

* y5 t7 v. }: KMethod identical to the preceding one except that it seeks the ID of SoftICE6 _9 B5 D. r! E2 J% J/ x9 r
GFX VxD.( n& u/ C8 f' i. G# R9 P* ]5 E" S
9 h) B) a" o* n
    xor     di,di* X) [# |, q9 e4 P1 f; W4 E
    mov     es,di% d7 B+ G$ i6 f. U
    mov     ax, 1684h       ' M1 y$ i  w! S2 e
    mov     bx, 7a5Fh       ; VxD ID of SIWVID' y% M0 `7 l% x: t
    int     2fh  r: V& h( U2 B/ U" f7 p
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. {8 v3 @' f$ V0 b0 F* B, r0 \4 p% G
    add     ax, di9 ~7 K: Y" i2 {, m3 N5 ?" q* w0 V
    test    ax,ax. _. Q3 K2 g, i# ]
    jnz     SoftICE_Detected
0 P8 L! A9 A0 t1 |% e3 E8 U. F
( I, E+ Q. d) `) H! e" ___________________________________________________________________________
, I" }0 _+ T3 Q  W' Z/ q. a' Q0 L5 s2 \4 i3 w
" c1 b0 ~; \7 b; T( E
Method 05# D8 s# u4 x) F: D* x
=========% k! r1 z& i6 E& Y% ^& f
* ^) x$ l* {& n4 m
Method seeking the 'magic number' 0F386h returned (in ax) by all system
# Y8 d' J; q: H/ B! Edebugger. It calls the int 41h, function 4Fh.  q2 Y" ]) h/ i8 U: ^
There are several alternatives.  
# d* w  c5 }! s  ]0 t) b  }1 g& M  g$ B0 \& Y. g
The following one is the simplest:
/ {3 q' b6 [  _1 j. R6 M3 n" q2 U" ?( M/ w9 C6 i, i+ ~
    mov     ax,4fh7 X! ?  p5 q7 e1 g; X5 S9 R
    int     41h
* F( P7 b. Z9 ]. c4 u9 f    cmp     ax, 0F386
3 R6 T. g( u) a; M. D" r    jz      SoftICE_detected
. R8 D6 U2 H/ ]1 I9 R3 P# |/ \) w- o: j. t1 ^4 D! @
0 M9 S3 o, `8 `
Next method as well as the following one are 2 examples from Stone's : j0 l! J* T8 t5 g& U
"stn-wid.zip" (www.cracking.net):
  k5 T+ c) {! x' ?
$ z* U7 L  d& K+ ?) s% U, V6 }    mov     bx, cs
) @; a) [% V  O) \3 I    lea     dx, int41handler2
7 j& L' n5 S9 V: H' i    xchg    dx, es:[41h*4]
% ?  A% H' B( t3 \; ?& s* c" _# X    xchg    bx, es:[41h*4+2]
! _2 S1 @" P! ]) J8 ?    mov     ax,4fh
6 g8 T7 s$ I4 L    int     41h, [# E# Z1 B# |) ^  e3 G, n
    xchg    dx, es:[41h*4]
+ z) m# H4 ~  d5 G2 t3 a    xchg    bx, es:[41h*4+2]6 Q4 a% s( d6 _9 ?3 y% p
    cmp     ax, 0f386h$ W  s/ o, i6 y& Q
    jz      SoftICE_detected
8 c0 _' F( ]6 ^/ k
2 y0 h9 M: W( Q7 U1 y- a: }int41handler2 PROC
- ]4 k. g% {! @0 [1 _. D4 [    iret0 d) X8 p, @+ D7 b' C, R
int41handler2 ENDP( s8 g( t( n. X& |* \' O
! O3 U) m# g7 H3 b+ T

  u6 b3 H. B9 D8 c0 f_________________________________________________________________________
0 |' Z' r3 u# K; r
/ f, N  w$ I- N- [* X/ }; j: g: v) l- t# p
Method 06+ B/ W9 Q; W1 s: o" z7 Z& x; e* F
=========! g1 b0 w6 F, r4 C$ N, r
1 L+ G6 Y* E. }7 D6 n

  ]4 f. B6 x0 s) i8 ^+ W2nd method similar to the preceding one but more difficult to detect:
2 k% T9 j* o: H) a( N7 s: k
5 l% }1 a) N, s1 U& B+ {- \$ v$ J- F) I% L1 n- Q
int41handler PROC
- |: P: b7 ?, O5 ]1 ]8 }/ R  W    mov     cl,al
, n1 t+ O/ B  }  ~5 r1 P    iret8 L* j: {6 a/ D, e; n4 N1 R
int41handler ENDP$ C- t( @, }, ^1 @# C
) S4 @" H0 c9 v$ N  U

. R# o9 k9 \/ u. [    xor     ax,ax$ |2 ^1 ?# u; G' X7 d5 T
    mov     es,ax$ w, `9 b( b# R! l/ U5 z
    mov     bx, cs9 d( w6 k5 d9 l8 u; E
    lea     dx, int41handler" c' ~$ Z: ]# L% \0 g9 o1 T! q
    xchg    dx, es:[41h*4]5 ?& E* y( ?1 v: b
    xchg    bx, es:[41h*4+2]
, h9 x4 t" h3 d( Q  B9 x    in      al, 40h
4 S8 }  R( `1 U# y# {+ e" f    xor     cx,cx4 c$ y. i' _1 _  o
    int     41h+ d7 {( U" C( e% d3 p0 `
    xchg    dx, es:[41h*4]
' {: h( a0 b! `3 }! c    xchg    bx, es:[41h*4+2]
) B( T( [# f! c' X    cmp     cl,al
6 b2 _! }" J( R$ v. y    jnz     SoftICE_detected
( z, A) a; \+ `# |9 G# ?- F( ?9 i7 _" {# ^
_________________________________________________________________________, }# s3 s9 ?- F, v* k- V
+ I, n: I( m; C2 n  R5 I* v
Method 075 X8 e/ w( w- a
=========
" c& X" f, _4 X" n/ J5 l9 ^3 y0 G, Y& C7 `
Method of detection of the WinICE handler in the int68h (V86)- e5 w* \& X! P

- c3 |, b1 {2 [+ o$ c& w! a    mov     ah,43h
$ s: e) N$ ?' ~: H+ U    int     68h
$ l0 [0 m# |- o- ~3 V    cmp     ax,0F386h
/ X" {4 j) {8 u    jz      SoftICE_Detected
4 P4 k( F5 ^" d+ Q
8 [( @* u) S& k. }9 ~8 K( B! f: {9 i; i- a( z- x; }" `# ^  B
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- c/ K1 G; ?& D  x" ]
   app like this:
( m3 B5 u5 N+ Q% Z
& ~) F' z# h& |# L1 k9 x6 u   BPX exec_int if ax==68
6 L1 x' {1 c0 P. L& ?" y   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 w* J% |5 \, Z5 N) r/ k   located at [ebp+48h] for 32Bit apps)! C6 b$ n/ e# n. e/ f
__________________________________________________________________________
7 w/ }  p, p( y' b) E3 f2 `( y7 y
1 w+ t9 S; C" g: Z6 P) q# W, F7 z4 B8 Z
Method 08
9 q( z5 a) U+ j6 ~=========' B; C) B( N0 e! M; i
7 X" u! U0 f7 j7 g7 p- ]$ {
It is not a method of detection of SoftICE but a possibility to crash the0 a' q, x& m1 Z6 {) Q" K' T+ K, S
system by intercepting int 01h and int 03h and redirecting them to another
, S3 Z2 A2 j& r, G* I. e6 U: vroutine.+ A6 q$ J1 i1 H" ]( \  U5 [3 l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ \1 i4 k! u' O. ito the new routine to execute (hangs computer...): h6 S: H. ~0 q. y) ]( G+ I  u

$ d' W2 {# ^8 m0 j0 P- _1 C    mov     ah, 25h
) e0 u  i1 w' R- @5 i5 K' k    mov     al, Int_Number (01h or 03h)5 S; h# q2 F# G* Q2 Z: p+ x3 s
    mov     dx, offset New_Int_Routine/ M+ @& J" c: m" S
    int     21h3 \3 ~' M' R2 s4 J1 P
  o% S! @6 ]* [, O# n7 {6 W
__________________________________________________________________________' F& \6 l. W" k$ T1 O! ~0 N
; E# }% i( i' M$ a# S
Method 094 ^2 N$ ~+ V. _6 \
=========3 {* x% \2 `1 }6 l9 I9 R9 c" [

) Z, k4 x3 g) i1 q% XThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) r1 Q# t' o5 k( k
performed in ring0 (VxD or a ring3 app using the VxdCall).* s  l  P2 W! b$ F) \( l( c9 u: R
The Get_DDB service is used to determine whether or not a VxD is installed
/ M- a2 z0 I) p; ofor the specified device and returns a Device Description Block (in ecx) for
- D- W1 W/ z, q) F0 d7 u4 _4 y& w9 Ythat device if it is installed.
7 L- r9 U' r4 H8 F4 Z' a# e: @. ?8 X9 N4 J- I. a$ E& q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
0 B8 O2 e3 E; O, E   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 S7 ~/ [  T* b1 P5 G* D2 `   VMMCall Get_DDB
: a5 @  d3 s4 l2 u2 [. x8 K0 g   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 e4 J) t* G* G- i, D/ w2 w- y& N- @  d5 I& `" y1 w5 ^8 C
Note as well that you can easily detect this method with SoftICE:( J- o+ j4 O! W- h. C3 [
   bpx Get_DDB if ax==0202 || ax==7a5fh, V- y7 L9 J8 B
1 d; T1 I0 y) ^  Z" ]
__________________________________________________________________________
+ q6 v# i2 N+ W( g9 X1 \% ]
( B+ T/ P6 D8 J, ?6 {6 ~7 R. vMethod 10/ m+ J- W/ I: v
=========
3 E) S2 j, m; S" i' S7 \6 n: o% }- R7 ~! @, z/ Z
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with8 G, m2 x: y3 b, \; z# `: w1 v
  SoftICE while the option is enable!!
3 w' B. a/ i4 P2 Y
% j% B1 L2 @7 [" nThis trick is very efficient:' C1 `- W/ }, j/ l$ i
by checking the Debug Registers, you can detect if SoftICE is loaded
# t, e3 a  [; w% b0 ?(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& [) E) O; Y" e- L. [5 B
there are some memory breakpoints set (dr0 to dr3) simply by reading their( M' [  n) J, M; ^2 V0 t$ E, x" k
value (in ring0 only). Values can be manipulated and or changed as well5 `" y, ]6 }) K6 V& r
(clearing BPMs for instance)4 Q$ x9 |( T& i1 e0 u: ~  \
" q! u+ l; z3 G
__________________________________________________________________________
1 _  y+ K* C' H" B1 E' T$ }
1 @3 V! w% A& o( D3 f) RMethod 11
/ s+ h5 p' \: p/ u/ X=========
' B) u2 X* `' Q6 P, U) F* c; Y  v8 t% [& v2 J  f$ _
This method is most known as 'MeltICE' because it has been freely distributed1 t! C2 _! J7 a% r
via www.winfiles.com. However it was first used by NuMega people to allow
4 B8 z$ ~- v, B* F( V: _Symbol Loader to check if SoftICE was active or not (the code is located- _* j6 R+ z! Y& N; v
inside nmtrans.dll).! |- k4 O5 L/ R% x; K

0 U) e  i4 v; j6 U- WThe way it works is very simple:/ u& r. G1 I9 g& z  Y# {
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: w$ t) [1 S8 {WinNT) with the CreateFileA API.
/ I/ F7 @( m# A2 s' S9 }7 t4 i( H/ h! v2 V! g" }
Here is a sample (checking for 'SICE'):
7 U$ W: L8 L5 b2 O* S: j5 ~4 B$ \5 B4 M+ L0 l4 u
BOOL IsSoftIce95Loaded()
, M* c8 m7 \  B! `7 A' c5 e{
( T9 l) w& J7 ~! z6 H9 [, s6 S   HANDLE hFile;  5 h: W9 K/ _0 q6 q) }# u
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; f2 w$ B' y/ i" n& h; Y
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 Q" K+ H; V- u, O* U8 m                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 ?$ Q1 W& X  [! B6 X( [   if( hFile != INVALID_HANDLE_VALUE )
0 y3 y% c, a: d+ B' B   {
, z0 t. L' v5 O9 w0 b! {) t! N2 W7 ^9 k      CloseHandle(hFile);
$ R7 b2 B0 i# X" e1 T  W      return TRUE;
8 O6 ]5 J4 v+ O5 w% U  Q0 r+ ?; M; q   }4 l: i; X* @' X0 x
   return FALSE;+ W( f+ D3 n/ A* G7 ~
}/ t" c2 g- d5 d/ f
' B' J  t( C8 m8 l$ l2 J
Although this trick calls the CreateFileA function, don't even expect to be
: O' S' d- Y' X& G' Y3 `; Hable to intercept it by installing a IFS hook: it will not work, no way!& u5 d6 W2 i+ s8 Q. i
In fact, after the call to CreateFileA it will get through VWIN32 0x001F6 ?) P; d" G/ q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 {! I4 Q( o# v* l7 p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc' i) s: A9 d# R1 y3 p; r
field.$ `' }$ ^# X5 N; u/ |; `4 Q* `
In fact, its purpose is not to load/unload VxDs but only to send a
0 `% {( D0 s# f3 V& ~; {W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
# ^) p+ m; l( P; A3 J  fto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ n+ C% C, ~4 Y' t) }1 n
to load/unload a non-dynamically loadable driver such as SoftICE ;-).; z  Q: n. a+ F( `1 x5 g4 T
If the VxD is loaded, it will always clear eax and the Carry flag to allow& t* F4 ?7 v" p& A7 g
its handle to be opened and then, will be detected.1 Z' L) |" M9 n- {
You can check that simply by hooking Winice.exe control proc entry point* L) _! F1 w; t+ H3 A
while running MeltICE.+ \" Z/ r  Y( i6 e$ o  I
" l9 q5 k4 K4 m8 I1 j7 C) [
& B- K5 x" i" h7 G1 J0 [" y4 [& P0 U3 g
  00401067:  push      00402025    ; \\.\SICE
" c' M" L% u: d: \5 {: k3 R3 Z  0040106C:  call      CreateFileA
! [. T. O0 j: L9 y; l) l- u! N  00401071:  cmp       eax,-0013 r: w; M- |9 c) K/ T/ |" a( u
  00401074:  je        00401091" S$ Q) [3 K' \1 E

; L$ W! R- a) m5 i7 Z
1 t- Q  `8 B6 p8 T( ^There could be hundreds of BPX you could use to detect this trick.
7 w* a7 t4 l3 F- I0 j6 w( z-The most classical one is:
1 f" r9 w& q' Q% {7 ]  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
8 \$ @' r, \: N/ g: E    *(esp-&gt;4+4)=='NTIC'
, p; ~6 S1 C; a; k
+ }% {8 t* p9 a- l-The most exotic ones (could be very slooooow :-(
! O, V6 W5 }" J3 x9 S$ x9 E   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 D! p* K8 d' u' t' J6 ]     ;will break 3 times :-() S" ~' u9 M1 `/ ]- A* N
! Y2 d) W7 G2 ?" B
-or (a bit) faster: ; |1 i6 w) w2 Y) z8 Z# Q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')+ P# c4 t* H4 T$ y" Q; v% g7 E

& w) W; f" w/ M9 a* ^   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 {$ {2 i; z& O- h6 a8 V     ;will break 3 times :-(, ]  u# u" c& `# I2 V
: c4 s/ K/ H. }" \
-Much faster:$ |$ ^% h/ d0 d  J8 p
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 [: ]" c2 C$ O' X8 B) Y2 B$ W
8 u; {, e' W2 q7 S* J
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen, K- A/ e2 z6 g  D5 t/ x8 D; r( w! b
function to do the same job:4 P+ s3 C' Z4 m1 D/ s

/ c# d8 [0 O# C% g. q. C+ M   push    00                        ; OF_READ) W5 ]4 B1 ~& M  F5 J, M
   mov     eax,[00656634]            ; '\\.\SICE',0% P% u" C- r  S& G& h$ {+ |* M
   push    eax- O$ y, N0 n: v, K* N- p
   call    KERNEL32!_lopen
, ?5 t5 A$ h0 g8 m. G   inc     eax/ U9 S& O4 @; S# W, i( x, b
   jnz     00650589                  ; detected9 I4 n; e! T$ k, {5 @# T
   push    00                        ; OF_READ1 A/ m2 o- }% r9 O1 ]0 p4 h9 j
   mov     eax,[00656638]            ; '\\.\SICE'
2 Y0 L: w% R+ ?0 {6 V/ H( U% H$ J   push    eax
5 L5 W6 x0 h8 ?% p   call    KERNEL32!_lopen1 W  c. L  W4 r0 w: [
   inc     eax; H, J3 _5 \9 b( _/ y* Q6 r
   jz      006505ae                  ; not detected
3 e; d/ A! G9 Q/ A: n+ E' ]1 |0 D  i. f% r6 o/ i3 L

( Z1 Q* g+ V0 r__________________________________________________________________________9 m3 c% X) a4 R, [

3 G, H  y5 G6 x; M! [1 p5 b+ w+ KMethod 12- `$ k: D: G3 n$ O% T$ D
=========; _" w! F5 |7 b: a) Z. ?
: n* c' l7 ~6 t, s& S5 N
This trick is similar to int41h/4fh Debugger installation check (code 05& ?- ~0 s8 y7 r7 h
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% p0 W$ D) b: \* Y/ A: yas it uses the VxDCall backdoor. This detection was found in Bleem Demo.1 D) s, |% W9 e

- w2 x! Y7 j7 U3 g5 R9 Q   push  0000004fh         ; function 4fh
& l& p7 @; o& ^; L" \% u8 M   push  002a002ah         ; high word specifies which VxD (VWIN32)- M' O  b- X$ I# K( Z+ K0 k
                           ; low word specifies which service) G7 m5 m. O* ]) l& X; Y$ Y2 z
                             (VWIN32_Int41Dispatch)
2 F$ N. V/ O$ e, A; r5 F   call  Kernel32!ORD_001  ; VxdCall
- b  {) u/ ^6 a" k   cmp   ax, 0f386h        ; magic number returned by system debuggers" r$ F: D9 Q8 K' v2 }6 ?0 _
   jz    SoftICE_detected
/ ^5 U. j) d/ P7 m: i# N9 b
4 U1 u; j2 ^+ @, n6 I3 p' wHere again, several ways to detect it:+ d% X# ]2 W+ R+ Z  q8 }8 [
  ~1 k9 k3 n4 U- J
    BPINT 41 if ax==4f- c1 j. ^3 b  g* D

! T  @; k0 _9 H( \/ S    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 o, O, ?2 l$ q  E( e9 j0 b4 v& h7 w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A- @; m, y5 q- E  Z* C# ?  g6 K5 y

, W! |3 a5 p% U2 u0 w    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' d7 W- B2 C6 \( x' `3 R8 v' d) L- o  }$ U" C' q/ _6 ?$ t
__________________________________________________________________________
: u" {8 ]/ u3 n
0 C8 i5 ~! R9 u' N- WMethod 13
# g: v6 n) |& a=========
3 M7 W7 q# r- v* z: \
0 P' D  X, `9 R. v% I- Z- GNot a real method of detection, but a good way to know if SoftICE is: K$ {: h0 M$ R5 J
installed on a computer and to locate its installation directory.
+ b6 D: v, w* V! DIt is used by few softs which access the following registry keys (usually #2) :
1 U" }( {  i# ~: n- n) h4 i: m6 n5 Z% F1 T: q' W2 ?
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" z* G% l9 @! B( q' ?
\Uninstall\SoftICE* W  R  B0 A1 D0 }/ O$ ^
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 K8 T" ~( K' x+ n
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 R0 x6 b  r  E6 R+ G2 T% f3 z\App Paths\Loader32.Exe/ z8 V9 e( Z9 B' D' t) N/ _

. V  t, @8 Y( R& T* Y* ^
# U2 u" ]5 _+ c: Z3 dNote that some nasty apps could then erase all files from SoftICE directory
  i# |, F8 J1 u4 r(I faced that once :-(/ B* c' U& y* ]4 s8 d. c
: D4 l* ~5 d7 J% W
Useful breakpoint to detect it:1 p: o' u9 I$ m( A
5 R" Q% b1 ]& X5 ^% a
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; u& \. \0 I+ ~( p9 H
* N7 L( _0 [* ?: m; T) S3 O5 K__________________________________________________________________________
. p( f" I0 V0 G7 a" N
. o' w3 E& Q; p8 Q9 \5 |, ]7 {9 y' j) q
Method 14 . }- m# b  |$ V$ U
=========$ c1 Z& v9 S  F7 i/ S' }

1 u- Y& m1 D5 Y4 s% ?, O3 MA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ }; o/ h% b+ {" s) Ois to determines whether a debugger is running on your system (ring0 only).% Q3 {1 H* Z9 _* ?( t7 u

4 v' ?+ \( s3 f; w0 b4 }, E7 Q   VMMCall Test_Debug_Installed- x4 ?! _0 Q6 L. R9 L5 t* ^2 T. z2 X7 `
   je      not_installed
/ r* F5 a1 L" z# N( k  `  e  v! a" J  B
This service just checks a flag.8 d. t8 h6 l1 Z7 d' Z
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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