About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" T3 w; N7 s/ f) V8 r
<TBODY>
9 x4 _; ?: }2 T, o<TR>) e; q" y5 S' G+ @- M; v
<TD><PRE>Method 01
; ]2 Q: i) E6 K! w: v. {3 a=========( d, [$ I5 @  ^2 [% r  B

2 g. B& I7 m! d3 v9 BThis method of detection of SoftICE (as well as the following one) is2 W5 s- W& \# j! Y
used by the majority of packers/encryptors found on Internet.* Z' e' s: l! o: `. t( y1 m6 s. Q
It seeks the signature of BoundsChecker in SoftICE' T* g( j3 o6 k, }$ d5 k; e
# t, A7 B% i% X# S0 }" k* f& H) W
    mov     ebp, 04243484Bh        ; 'BCHK'
# s" u! E: A3 N# V    mov     ax, 04h
, n7 {) X; z$ r1 B0 B    int     3      
% \! ^2 G+ [- o    cmp     al,4
& b- g7 H( u* k; c    jnz     SoftICE_Detected) e% |4 I  K* z7 t1 b7 T7 ^! Y

( _8 F8 @& J! o___________________________________________________________________________# j0 s4 Y0 Y" }& U; ?% B+ V

+ v" [9 \7 j* b% r7 XMethod 02! ?* T9 d; I5 A5 s+ z4 R: ^# I
=========
, w: e, x* [' q$ K- z4 v0 h% ~+ J2 d% I: @$ o6 z
Still a method very much used (perhaps the most frequent one).  It is used
- }, A* k% K  c5 E& Uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
  T8 {. w* b. Kor execute SoftICE commands...
' U' d& b) f+ r( W, N+ K, c8 F9 RIt is also used to crash SoftICE and to force it to execute any commands
7 c+ n2 R, P( q0 A6 w8 z(HBOOT...) :-((  / f* S- I1 T' C% Z
. M8 s1 r6 @% f1 i: T# l
Here is a quick description:% p% w4 q4 y- n( d( Y
-AX = 0910h   (Display string in SIce windows), z% u. h5 t/ c; j& \
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. c) o8 y* \8 {- M+ e8 o-AX = 0912h   (Get breakpoint infos). b3 D2 F- H/ m+ r7 H
-AX = 0913h   (Set Sice breakpoints)! {) e: Q& e0 g: B
-AX = 0914h   (Remove SIce breakoints)  J2 I% L+ d$ b) ~% L' F! q
! X: c8 n3 {3 A( ?3 N. D0 C  n+ v# p
Each time you'll meet this trick, you'll see:
0 Y0 }$ K. u$ S" n& F-SI = 4647h
6 N  `0 S. [3 j/ K! U-DI = 4A4Dh
+ o" P" Z. {3 K& j- z; fWhich are the 'magic values' used by SoftIce.
4 _, _0 A* v& |7 d) n3 JFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ d0 r" Q! e  N5 c; e9 o* U) H( Y
$ ]& P; C- ], T! h: V, i
Here is one example from the file "Haspinst.exe" which is the dongle HASP
6 [7 v+ O7 p# N+ G3 aEnvelope utility use to protect DOS applications:
7 P1 S& ?) I4 |6 F8 O4 ~4 O' q- o9 T( X/ G( l- v, Z* E3 p3 O* v

: h! y+ H" h+ d6 P4 |6 Y4C19:0095   MOV    AX,0911  ; execute command.
- v- E8 V* v6 x/ z( K5 D4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
9 Q9 ]' p0 w1 [2 \4C19:009A   MOV    SI,4647  ; 1st magic value.4 J% G2 D, F5 S- w. e% v
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& Z7 f0 H1 e; p) @) V4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 T9 v4 e; }5 A1 n
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. T* L/ O+ i3 W" ^  p
4C19:00A4   INC    CX
/ |0 i# f( @& x) j4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 u* q" |* c. F6 L. [& H4C19:00A8   JB     0095     ; 6 different commands.0 S1 ~( }8 b. p' ^; B
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
5 Q& V% y& e, ]: h4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 z' x* ^: W0 q9 G0 G$ [( l" A: }$ W# t6 J+ u% j' i4 T8 B5 V& ~
The program will execute 6 different SIce commands located at ds:dx, which
- I, [* ]' ]# \; N" ?. ~1 dare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' @! e* U3 h7 k+ s* p. ?  B/ h) V& a+ n9 _- [
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 u% |$ ?7 S+ X  ^
___________________________________________________________________________) N# G4 f% L  [, M2 ?

/ z! z7 b  m/ T- i- e' x1 {* Y) J" S0 |- h' x! x
Method 03
" j2 O8 |5 U. k  @- R: M/ M=========
8 ?1 \8 h- j" }. I
% j; H' i5 }8 p7 n. Q# y0 `Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ p, y& x, B5 f+ X7 Z' b. r1 f+ [9 N
(API Get entry point)+ Z5 m; ?$ K# L0 S: s' B
        
& l' `* o/ c/ G$ |! U) {  T. u! C, v2 F
    xor     di,di
6 }8 D3 _; |3 Q0 T    mov     es,di  \' v, X/ ~% t) r! y2 d
    mov     ax, 1684h      
/ ?% q1 V$ _  C  Q0 X+ b6 w" y5 o    mov     bx, 0202h       ; VxD ID of winice* X+ ^5 m3 ?- T4 i1 |; i" N; Z- E3 v
    int     2Fh% t2 K4 y' l' K+ W! D/ I
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# h7 w$ \2 q# m0 y# R7 \: @
    add     ax, di6 L4 O. m# ^3 e+ S, i. _9 K
    test    ax,ax5 H3 Y' Q" k) s1 T# ]
    jnz     SoftICE_Detected  s3 c: S8 }- l- }& a/ U
& b" z& ?; y' \! j) O
___________________________________________________________________________
9 E7 @  V% t) h5 j6 M! Y0 Y% L# P+ ^
! F- f5 Q0 e: X- N' ]Method 044 t6 l/ K9 A" C9 T
=========$ z1 b& ^$ w. t; i
/ f8 Z8 Q$ F% {  U& H, m
Method identical to the preceding one except that it seeks the ID of SoftICE+ y& z7 c  F: |3 I- _0 q- V
GFX VxD.5 ?# s) L& B) C: q% b/ V8 X8 S
! d  l1 p& E5 @) j, t
    xor     di,di
- B8 J& b. c+ e/ {) F    mov     es,di7 K; t6 n- y. R) s5 G* o  y# w
    mov     ax, 1684h       $ a  Y  y8 X4 D3 F$ S
    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 m7 I- \( @) s; \/ h# O& H: R9 Y. }
    int     2fh1 u+ K3 Z  z7 r$ Z+ y& ~; y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; Q7 K$ i# L6 N! q. a& Z3 P
    add     ax, di
* C% n# q/ S; ~  e" x    test    ax,ax
2 m0 I, E' s1 D: e    jnz     SoftICE_Detected
8 O1 ^) n) P# A% a  ^6 K
; h( [: u: B9 y9 K+ m0 ?7 q( ]__________________________________________________________________________% D3 O& m7 Z1 u  w8 n1 z. I# I

* I' T& ^0 l2 V  @, M
2 s# S* [2 e) IMethod 053 b  S9 s) r! H( t4 l" S! m
=========* t& q; \9 Z! W7 ?% _; j1 V9 b

3 O3 q1 t6 L3 ~Method seeking the 'magic number' 0F386h returned (in ax) by all system
" T  o2 M( s: D" ]% k6 xdebugger. It calls the int 41h, function 4Fh.
; }+ ?  s+ y0 ]8 v* Y' bThere are several alternatives.  
! `7 ]8 R' q% W! [3 }" r% T' ?8 V9 c# ]
The following one is the simplest:" u# m( b, S, h. M  L

, L& L" t3 m/ S9 j: _    mov     ax,4fh. [, K; h  P* O. Y
    int     41h, G, S. A, S# U7 ^; _  l
    cmp     ax, 0F386
! w. g# Q6 h0 d" I) g7 X( I1 ]3 J    jz      SoftICE_detected
& ?! V& z$ d! d- y, m
' V8 P7 ?: n5 y$ ]7 F# m5 j( K% l& y1 r, R2 J5 j3 c5 C
Next method as well as the following one are 2 examples from Stone's 7 I8 Z6 y+ ], Q6 g9 b! w7 @
"stn-wid.zip" (www.cracking.net):2 B) H# m$ R; Q2 B( D4 G8 y

0 J2 `: n( U* Y% H9 ^    mov     bx, cs
( H7 V6 W2 {5 v5 V    lea     dx, int41handler2
5 C/ T7 d8 |2 c# L4 t    xchg    dx, es:[41h*4]
0 M7 ^  A4 e3 l9 s( [* |% B( L8 G, |    xchg    bx, es:[41h*4+2]
- V- ?+ o4 \/ W# `2 h! A: a/ ^    mov     ax,4fh
# H2 _* R* a# y( l* `  \    int     41h# A  }& I' o, U% C* N( `1 n8 L
    xchg    dx, es:[41h*4]
. C" ~0 k) v6 z9 f$ |5 R! I) Y    xchg    bx, es:[41h*4+2]) X2 o/ T- e2 x/ z
    cmp     ax, 0f386h4 L+ M7 z3 R/ T7 u4 U, k9 K
    jz      SoftICE_detected( F+ g2 @1 Z  q
5 z5 H, Y6 ?2 `$ f: {* e
int41handler2 PROC
  w7 o5 s1 H! X( g3 h+ {8 o    iret
! j; ~1 O0 n/ {7 i% ?. d& uint41handler2 ENDP
0 H. w' t2 g' ^, N$ {5 h3 z6 M1 A# [/ ?+ J+ \
  z+ K; ~% P' c7 `( u; y; F
_________________________________________________________________________1 K( k3 x1 q% H) J+ o! S# q5 @
) v' ]- _7 U) v: D7 x- [+ {
' k9 g& X9 {, @, V  K4 ^) I4 B# O
Method 06
- L% o+ L2 Y+ L2 w7 v=========
. a: S' a: A5 K% A& C
1 k, L6 {( s0 R4 N# p) X6 O+ [$ X! ?, I9 j
2nd method similar to the preceding one but more difficult to detect:6 v9 L" O& \  K  V* q, W* V! m
( X! F/ _7 m8 [" {3 S0 q7 e0 N0 i: M
" h7 Y$ e# F$ H* r- c. U% h) }
int41handler PROC
9 ?9 L3 H; Z8 x1 ^  s, b    mov     cl,al6 b, |# t5 k+ G5 E1 H
    iret7 B6 D" ]1 x  x# @! X& S
int41handler ENDP
% n% O8 U  e4 T2 W2 N8 K* q/ e* ?" Q. H7 T. [
0 c% c5 a$ c. I8 I% `2 j. x* F
    xor     ax,ax
) d; ^9 X9 U% |; f5 Z, l  f    mov     es,ax
. B- {3 n' v) V, [3 j    mov     bx, cs* o& g3 a: Q, n5 J9 c: ~" f
    lea     dx, int41handler
/ ^% K* C) i0 W, y" m    xchg    dx, es:[41h*4]
) P$ p% c. q7 H8 o# t) ?7 y    xchg    bx, es:[41h*4+2]
$ ^/ f7 ?- X2 Z7 ^    in      al, 40h
! N1 Q0 F2 D: p- a( R. v    xor     cx,cx
: _$ i+ e: o& F0 J    int     41h
8 {) j& l, l5 q8 i* M) }% g2 W3 j/ ]. ?    xchg    dx, es:[41h*4]
# [- a2 Q7 P1 Q. G6 b+ M    xchg    bx, es:[41h*4+2]
8 _; `, R6 s1 D    cmp     cl,al- Y  m7 y6 O1 r% E/ i
    jnz     SoftICE_detected0 B: ~0 B$ Q. e& s7 w6 Y1 _+ {4 b
3 P9 A* l6 ?7 o
_________________________________________________________________________
; |  K* a* G% d' x4 B+ L3 ^. e# I8 k5 s! X( g& y4 s
Method 07
% I4 a5 d) J  B* \9 s8 B=========+ S3 k5 l6 G2 @( z, `  X$ V- H0 ~# W

& N& N9 Q7 r2 C2 V0 ~Method of detection of the WinICE handler in the int68h (V86). Y+ h7 U- p0 X
: L% Q4 i3 @  E6 p! A% c
    mov     ah,43h3 M7 i9 ?, x7 Y
    int     68h
, v6 L8 @, |" }# h( d    cmp     ax,0F386h& j  P# d/ F' F
    jz      SoftICE_Detected( a9 Q6 `( u* s" Q& G

; D+ G/ f5 J2 G/ ?* d* h" f- @  g! K: o0 G' z) G
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit( F- x* W+ x! f; n8 N/ S3 O
   app like this:& V! C1 S, e0 b: t2 B
0 ?' _. Q- {; R1 ?6 Q
   BPX exec_int if ax==680 \# }( S; p% d9 P1 O" G
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& l  Y9 M3 q, g$ {& b: d   located at [ebp+48h] for 32Bit apps)
$ p' o& [9 e: c  I# J* q  p__________________________________________________________________________1 Z1 }4 ?6 y) M% F+ o

2 `) N! G- Y  \* e/ V
( t/ ~' K0 k3 k) OMethod 08
! x: d; m/ i/ n4 j) p3 n! m=========2 M# f9 C' E6 c, k7 {  @

1 n0 O7 u2 `! {1 N, Z" Y5 QIt is not a method of detection of SoftICE but a possibility to crash the& a$ r! N( ~3 r
system by intercepting int 01h and int 03h and redirecting them to another% ]/ k4 X! Z/ b# ]7 a. A, g
routine.
9 P5 O: z% ^: G# x, ~  J8 s! TIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ y& ^0 N& M' n; ?3 T5 A# [to the new routine to execute (hangs computer...)5 [8 |/ |. |) e9 W
5 |9 i* p* X6 V1 ^% \. S$ B% k( x' u
    mov     ah, 25h  m$ P6 k2 ~2 r4 k: d- \3 |; Z
    mov     al, Int_Number (01h or 03h), p6 z2 }$ c0 P# ]* T
    mov     dx, offset New_Int_Routine" j$ h) t# `% a+ z% m
    int     21h
& p" n" ?4 @$ t- `" {% |0 A. M* C' U& X/ ?3 B
__________________________________________________________________________& W8 O+ `: P# _! h
% w- V, p6 {7 P9 {( z5 [# F
Method 09  ?1 Q% ]" m, G3 ^
=========
: C0 C) w+ s4 T
  P6 J/ H: M: U* J* }9 fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 ~* n9 v5 K' wperformed in ring0 (VxD or a ring3 app using the VxdCall).
) S5 @/ B1 X  uThe Get_DDB service is used to determine whether or not a VxD is installed* s3 C# p: d' s) `" ~. A
for the specified device and returns a Device Description Block (in ecx) for) p/ G" F" {: n1 m* }8 E( J; g+ |
that device if it is installed.
+ Q# N( c! b4 \+ t$ k" J% U6 }3 R0 x) s0 V
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! ]) K0 A! c3 w- v
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). g( s+ O$ W* R1 Y
   VMMCall Get_DDB
+ A/ }  v4 v1 [6 P% u   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. y; W$ M1 @4 t2 [8 ]) {
& y, t: b6 M' U( f. SNote as well that you can easily detect this method with SoftICE:$ k! }% Y: |/ D$ `% M' y# a' t8 [7 M
   bpx Get_DDB if ax==0202 || ax==7a5fh6 e/ Y9 T8 I% Z7 `

$ o9 ^3 V- A% ]+ _' g& F9 h__________________________________________________________________________
* U5 ~( U- k9 U7 @/ F
1 V& y3 [6 p) L- Z! H5 LMethod 10
* l8 G% x) s$ G7 P3 f- C=========
6 w) M7 x# G3 O/ E# B" G4 J4 F+ U+ K" D8 Q4 ]& M. m
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" w( ~! Y" Y$ Z# ~  SoftICE while the option is enable!!8 L& U5 _3 j; \
  y1 z) M0 H6 l! T# }
This trick is very efficient:
9 ^9 y0 y& t. J  M) ?  F9 Mby checking the Debug Registers, you can detect if SoftICE is loaded% _2 ~4 ~# t" y, h
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* b2 P4 r1 T& x- [( _" d' j
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 x6 d) n  F+ h+ D+ v
value (in ring0 only). Values can be manipulated and or changed as well, x( c9 W0 v. ~# d3 a8 n5 }
(clearing BPMs for instance)3 e9 Y; K: z0 r7 w* t4 o; o
. F5 m( A! R1 G; E' @3 ]8 E
__________________________________________________________________________
/ q6 H5 h% d5 Z, H/ \8 R
2 R# B) F5 X$ T) vMethod 11
9 P# z# ]- ]5 ~/ a$ H5 `9 A=========
! p0 y' i% s" j4 Z4 V' x8 W3 A& w) }/ x
This method is most known as 'MeltICE' because it has been freely distributed: m, j4 S. w' R1 F
via www.winfiles.com. However it was first used by NuMega people to allow' _$ N" e* q; q1 M, R; L
Symbol Loader to check if SoftICE was active or not (the code is located/ A+ J' ^- }6 s
inside nmtrans.dll).1 |2 o! [+ q, [% o. U' {; u

! S4 n) J, H& s. a( X& XThe way it works is very simple:
( [8 _  K- [- s. \& @5 j% yIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( |/ O  r8 e8 ^0 P4 |1 A$ c) l  ^WinNT) with the CreateFileA API.. u6 Z9 l! w+ z3 U! [
+ B, `2 Y* n# V7 s$ {4 _; R
Here is a sample (checking for 'SICE'):
% n, n! @  k3 k5 _3 U: t  m; u0 b, S* ^' n
BOOL IsSoftIce95Loaded(): s3 k# H  t* |. C0 t& l
{/ c/ R2 v6 u1 `/ p; o+ M
   HANDLE hFile;  7 I2 d. D8 e8 W; [$ b, u
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ e$ k" `' y+ j  x6 \& y& H" E5 ], H  o                      FILE_SHARE_READ | FILE_SHARE_WRITE,; p. Z( Q5 Z# p+ f- }
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, d8 w2 L) L& W# E0 J! w
   if( hFile != INVALID_HANDLE_VALUE )
3 x3 [" r( j5 P& Q, X   {
, T/ U# V/ y6 G* Q3 Y. r$ }: Q! y      CloseHandle(hFile);
# N) ^0 i% y1 d- H      return TRUE;9 y9 @7 Z' ~+ E) n1 X; T
   }$ E- L0 f; K8 g
   return FALSE;
9 t# p* E- b: P: B1 j) X}
) b; z2 {3 }6 J1 w! ?4 ^& }7 }  ?, n. V
Although this trick calls the CreateFileA function, don't even expect to be! g$ ]7 B" |6 _  n& C
able to intercept it by installing a IFS hook: it will not work, no way!2 \0 X# Z6 J, b5 O: U8 b8 s$ F
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ ?+ c- X! ^9 Zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 N/ Y) k$ E- U) k5 _
and then browse the DDB list until it find the VxD and its DDB_Control_Proc: |* U0 [! ^- M6 u/ u1 Z
field.0 X& {2 J; [( v3 \
In fact, its purpose is not to load/unload VxDs but only to send a
. @3 A: `. l& K$ @/ |& oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)0 S0 B0 u- ~6 ]) D
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
  }0 m2 c. k1 j( Sto load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 u6 o: r) q. n9 I' n  M* o' zIf the VxD is loaded, it will always clear eax and the Carry flag to allow4 q. p1 F. x4 q: r. o; D1 N! S
its handle to be opened and then, will be detected.
6 ^8 U) E4 u  q4 yYou can check that simply by hooking Winice.exe control proc entry point
6 f* g; r5 g: O. ]. T- Ywhile running MeltICE./ h& `! v, i* Q; G2 m

7 P1 L0 ]1 J1 W  |/ Z& W" `& |* b) v+ P: S% y: p
  00401067:  push      00402025    ; \\.\SICE0 ^2 y! z9 Q  z2 c
  0040106C:  call      CreateFileA
% V8 L. z2 \% g7 V  00401071:  cmp       eax,-001
/ D2 s/ t' V7 m% M  00401074:  je        004010916 }$ N& F  Z* Y" E/ W6 J. S
! K5 g, }$ L" @. f; D) G4 ]

5 `* e5 j1 u# o3 `* x% \6 X) ]There could be hundreds of BPX you could use to detect this trick.& f8 }9 o( M( O. `' i
-The most classical one is:' |" J9 q2 a& _! z2 M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
: v( ?' B3 ?* F* P    *(esp-&gt;4+4)=='NTIC') u' D: a; N( E6 d! u& a6 j+ Q

+ v+ U9 t9 X9 J+ M) {8 L-The most exotic ones (could be very slooooow :-(" W; s6 N* V7 g' m' u8 Y
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" S8 C' e/ u1 E+ z7 `1 Z6 Y     ;will break 3 times :-(
$ a! \% Z; o3 e4 P5 N+ q( o  w1 H
5 W! z5 c/ v" G4 x3 {" k; V-or (a bit) faster: 0 c7 _9 K* t9 i4 A0 K( j/ ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), b0 l: h- W1 U* E) H4 ?7 @
$ p6 X- p& ]/ w6 T3 u
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 R# ~) j2 i% k2 i4 d/ X     ;will break 3 times :-(# ^, n% `) ?: Q* _
0 n$ b7 F9 N% n, |, T
-Much faster:- P6 B$ B2 w: }; e. J
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 V3 a) X$ x' C! A

. {& ^4 i$ A$ y  SNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
" _% Q, q+ T/ A& s7 c" jfunction to do the same job:5 m0 A! m) W$ P1 Q. l7 ]: o) y

& o/ z/ [, _- Z$ C% G4 A1 R! ?7 ]4 t  {   push    00                        ; OF_READ$ D, C0 d: E0 Y) L. y/ z: r
   mov     eax,[00656634]            ; '\\.\SICE',04 u$ B" j, R  B" q2 L- n% @8 q
   push    eax  U1 ]6 t+ a# h3 G
   call    KERNEL32!_lopen
. |( u: ~$ |7 B; h   inc     eax
3 L5 T! M" }$ S* _" v   jnz     00650589                  ; detected( X. |$ |# G/ Q! o; [
   push    00                        ; OF_READ
! H3 k5 I% @( J. H( y' D7 p   mov     eax,[00656638]            ; '\\.\SICE'$ r, _) ?, V# L/ k' H1 X
   push    eax6 U' A+ V, {0 a
   call    KERNEL32!_lopen: ?) R' F2 k( A* K4 s
   inc     eax  P) e6 j; P6 U
   jz      006505ae                  ; not detected0 A! |8 t; E" d( `7 Z

- `& A8 o6 R. F
" X! u/ Q- @7 Q, Y  R: o__________________________________________________________________________
4 s7 N! U! I: c# c" |) v
+ ^/ k3 e! D  N1 B3 d1 ~" a+ SMethod 12
; H  ^5 n  n( `% u4 x# w6 H=========1 X  {5 d/ \$ T& X, B4 L3 d8 n$ h
; G( Z) [' `" @/ b
This trick is similar to int41h/4fh Debugger installation check (code 05( A5 }5 [$ ?+ \* K6 a+ T
&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ }6 C* c3 `" q& V
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. E* P  B3 J& e+ U

' @  }+ A6 O- `   push  0000004fh         ; function 4fh
- i+ d/ L0 X  k5 L9 ~; y( C: L7 l- E   push  002a002ah         ; high word specifies which VxD (VWIN32)$ O( j: `4 n4 ~& J  O* D  m- k9 I
                           ; low word specifies which service
" W7 `: P8 b5 q2 t& |                             (VWIN32_Int41Dispatch)+ S0 ^" B4 D% v/ g9 N9 ?8 F2 I
   call  Kernel32!ORD_001  ; VxdCall1 g* X6 x2 r7 d, D$ e
   cmp   ax, 0f386h        ; magic number returned by system debuggers
3 C- X( ~+ w6 |4 d; g* b" r4 L   jz    SoftICE_detected6 f4 d3 Q4 `  W% w6 H% E

/ S* Z/ |! j3 o1 B+ ^Here again, several ways to detect it:
( [! J4 f6 `# E+ I$ N0 \. u
! B/ _5 H% N$ s    BPINT 41 if ax==4f/ b( ]7 `, |, ]% ~

4 c5 R9 i3 y8 B+ n/ ~7 M    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one+ o5 b  x9 u! ?5 m

. ~: h- m6 X+ V4 y. y8 [8 `* U    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 `( S3 M- c6 h

1 l! V1 o8 [/ S5 t9 K- |/ S# f    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" |; d- W4 N: }
% \7 @$ b& O0 C7 s__________________________________________________________________________
' M% @- |$ z$ {, E8 B3 |3 U$ A1 L+ W, H; j4 D5 i( h
Method 13) {- I+ N3 N0 R" O
=========( l4 H( z* ?/ ^9 c9 u& p

( C# C! A: x. MNot a real method of detection, but a good way to know if SoftICE is) x3 v" F0 I  M; {
installed on a computer and to locate its installation directory.# |* v4 J: O% u) O" y
It is used by few softs which access the following registry keys (usually #2) :
! ^5 Q6 k. B: V7 w+ n' t7 b* t0 [) Y5 a7 b* O$ x# v
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. T, O/ N0 a1 z- f: n4 ^& K\Uninstall\SoftICE% h9 G4 X4 C. D4 N: ?6 `
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, d0 h; i7 P- |4 [  \8 e
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) E1 V2 [0 ~+ t, M4 W" C
\App Paths\Loader32.Exe  C& P2 f+ G2 S8 _

& m5 c; r: [$ }: \/ ^, n! J
, r2 g. ?( E5 Q7 n; w5 uNote that some nasty apps could then erase all files from SoftICE directory
+ }4 x) h, |7 c4 B; r0 V(I faced that once :-(; o# W% x' [% P" n

2 x. p$ i6 {# a# u3 z* cUseful breakpoint to detect it:
6 ]; O% D% L1 V) w3 [
$ J% Q8 i0 y/ n5 w' Y     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ o1 S: }( h0 X0 `/ z+ p

" |' n" @+ n. z/ c' A__________________________________________________________________________, ~1 |+ g2 `0 N
" T) U/ h0 k6 `

4 _5 Y- W! E0 T5 Q$ s" yMethod 14 6 ~+ d7 G3 e; a0 A% O
=========. M2 \( L1 _4 ]  `
8 D/ a9 P8 m1 R# I- F: I! k
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* t8 X" Q. _% U) e" g2 F% C: I
is to determines whether a debugger is running on your system (ring0 only).
* E' G  H% f. k8 ]* q7 }) u& s% k
   VMMCall Test_Debug_Installed
! I0 G" R0 I- R) ~$ V" L' `   je      not_installed! h( W2 a3 s* c! @

/ f. I# r6 \- @6 G/ n& nThis service just checks a flag.
4 M6 R, N3 i" Y* u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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