About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 W6 R- D8 ?  }2 }, A<TBODY>6 i6 O" k* ~/ R  I2 w
<TR>
6 c& P5 z3 [  S( \) p; J1 T# J1 }<TD><PRE>Method 01
3 u7 z! m' u3 l! N( ~. Q: k=========
. B; w  C7 l: G* u5 d9 D
4 J  G! ?* q9 c0 a& m. w/ tThis method of detection of SoftICE (as well as the following one) is7 o2 t& h4 T" J' a4 I5 p
used by the majority of packers/encryptors found on Internet.3 p: ^+ ]2 n+ U/ l
It seeks the signature of BoundsChecker in SoftICE3 b( L  W+ r) k

4 c# f/ i, A% Y$ D' q+ ]    mov     ebp, 04243484Bh        ; 'BCHK'
' P% `/ t$ k' i# ?* a8 \8 ^    mov     ax, 04h7 b! |, P! X4 a0 [' g# R! [; N# Z+ I
    int     3       0 q; M" a3 w& u6 C5 \! c6 e! h( K
    cmp     al,41 V9 B4 `) r, J. W: e
    jnz     SoftICE_Detected8 V) X# z- j( n3 _
8 g5 x6 _9 V5 {4 u7 r) ~# I
___________________________________________________________________________6 ?, ~5 a8 ]' L2 D- y
/ I; V3 y7 t$ N( N) |1 |: B
Method 020 K+ i* q  U4 I7 L; v: g6 e* D4 g/ R
=========
6 }( E% N  K+ W; v% I+ C$ e6 E1 \3 ^8 W
Still a method very much used (perhaps the most frequent one).  It is used0 \6 |6 k! E: w. ~# K! J% j' Z& O
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
9 b7 X3 [( T# xor execute SoftICE commands...1 f5 ]5 _0 n7 J0 ^
It is also used to crash SoftICE and to force it to execute any commands
" [6 a+ x# i) S) A, g- r4 I(HBOOT...) :-((  / U4 B) ]0 C5 W+ H/ p5 I/ l3 i  |

6 P, X3 P- [9 [0 H' `$ d$ @, W2 YHere is a quick description:' P, `* c$ \" Y/ ~2 G  v
-AX = 0910h   (Display string in SIce windows)
" f! \: o! _* O) \2 `- x( ~-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* e1 w$ N9 X4 s, l1 O2 H-AX = 0912h   (Get breakpoint infos)
6 X5 E0 T  g" R-AX = 0913h   (Set Sice breakpoints)! c! {# P0 u' O- z0 ^+ ]  `* u
-AX = 0914h   (Remove SIce breakoints)! L+ i/ n8 E  ^" b% C$ L
# b2 X+ ~: ^* d# x0 {
Each time you'll meet this trick, you'll see:
& s% R8 C$ y0 ]$ e$ s& X-SI = 4647h
$ e) L! ^4 e6 ]. p% {' l-DI = 4A4Dh
- s* O' Y2 P& p! ^2 e& AWhich are the 'magic values' used by SoftIce.
/ ~8 ?* f, c* tFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.) R& k( }+ B, O9 I" s4 l) O

) q- A+ ~, Y! BHere is one example from the file "Haspinst.exe" which is the dongle HASP; I7 g% g1 v' b/ N+ X" f0 w8 j
Envelope utility use to protect DOS applications:5 z0 U0 E# ]& s

) E0 v0 C8 X* i/ f5 l  a* Z' k6 \( E9 \4 Z0 Z/ V2 J$ U
4C19:0095   MOV    AX,0911  ; execute command.
1 g6 y$ H# ?- L- e! H* `+ p2 |4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 f- K5 X0 @; b9 Z$ B4C19:009A   MOV    SI,4647  ; 1st magic value./ g& e  f( }) O1 o' b
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.% k- C% U% f( E7 v$ _! K
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 h1 U' [6 F/ X3 ~$ l4 I
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: H/ A8 U) q+ m7 e9 m" }, b
4C19:00A4   INC    CX
3 W% S6 d7 i4 n4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 J, A3 `3 E/ y$ F* Z4C19:00A8   JB     0095     ; 6 different commands." i. b# v' S) @' J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 r5 s- s- p* m" ?8 z- ~
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 V3 p- C: H# A
. R: p: K! ~, {! R! I2 Y
The program will execute 6 different SIce commands located at ds:dx, which9 ^) e" z" |4 h1 r: n+ C
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 q4 ^3 _- L9 F1 M/ Q. z9 E: O
0 O1 x+ ^. _) a1 U4 ?. D9 [
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 e7 ]1 P; J. Y  l% A4 r/ }% W
___________________________________________________________________________
' `- v& E% Y! q/ D& A3 y
; E: K, v1 `! |# x6 V" B; J6 v: m6 ~# Y
" ^; B- w; ]5 aMethod 03# o9 s/ m6 Q9 ]. h0 p& A  ^! U- k
=========# \7 o! `# X5 C, X, z1 W

- I  T" E# {  m& i5 dLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) ?# T3 G4 b+ _" r, ~
(API Get entry point)
  H6 x. j! N' c3 |' O  ]* f; J; o! T) I* H5 [          y) _: X( e6 O5 Q! y3 E% h
7 X( Q7 X, m5 y  X
    xor     di,di
+ M) g: U2 }& \* b    mov     es,di
  g/ R5 \2 ^& l    mov     ax, 1684h       " ?- w3 |; A4 N+ ^% K
    mov     bx, 0202h       ; VxD ID of winice; j% E; q9 ?" B4 z5 F3 V
    int     2Fh
( L5 [5 p/ Z, t0 P& [# R! v    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 Q0 |. t) o* F    add     ax, di, F7 ^9 u9 ?) r2 S1 e8 h" H
    test    ax,ax
2 h/ Z- ^3 p1 G+ c    jnz     SoftICE_Detected) T- {6 j6 L7 j/ M% [" X" N
: x7 S; N- _2 q
___________________________________________________________________________( V6 N# ?2 o, c9 e0 M
  y7 S  x' C5 p8 B. @9 ]
Method 04; f" P, O1 O) h0 X0 y" k
=========
6 i" R  L! o- p' \) A, r- g
, d" j7 g3 m/ z& O; GMethod identical to the preceding one except that it seeks the ID of SoftICE
. L" q4 A% L( JGFX VxD.! m$ ]/ W7 m& j  y2 U

! C) n( e% C5 s, W0 U7 H% F    xor     di,di" ^4 ^' d, K. F- y
    mov     es,di* M# ]4 |9 @, M. w, v- V& d
    mov     ax, 1684h       " O' A# [4 _- K2 J2 c
    mov     bx, 7a5Fh       ; VxD ID of SIWVID4 M  D7 T' `, ?3 X7 a: j! u
    int     2fh
% R- p8 y7 p+ ?4 u! U7 F    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( F' M0 ~( }! b% Q6 f2 f& N# l# Y9 K* s    add     ax, di# T6 Q0 F0 V* B/ N4 ^; m! Z3 s
    test    ax,ax
9 F" y0 m0 h$ @    jnz     SoftICE_Detected
* a7 z/ y; }, n3 @$ H3 {) L) v
' o3 x. Z6 i7 O% D: Y4 o2 y__________________________________________________________________________
/ J# O. k3 @4 o8 K
( d  _3 a& O" E# ^+ S& z
1 o7 a% r3 U) j9 `. l* JMethod 05
) F+ ?, U* Z" B. F8 E=========
. J6 a) `4 Z' z7 p0 U" y+ M% P/ h" @* R9 g# M" Q
Method seeking the 'magic number' 0F386h returned (in ax) by all system
0 L# r" |* m9 S1 k8 ydebugger. It calls the int 41h, function 4Fh.
/ g) ~6 |2 B  e( CThere are several alternatives.  / d$ ^+ ]# p5 H& V9 V2 t+ c, v
' ~" K" h* U3 r, l
The following one is the simplest:+ _7 d2 }+ {( b, f6 G

: a) a) t$ i/ ?0 S$ m    mov     ax,4fh# f" Q" d. ~; S& l3 D* v9 u
    int     41h4 ~1 l) y6 `" \& q0 \- |
    cmp     ax, 0F386
) y" t1 y6 P. U2 p  l8 G' L, _    jz      SoftICE_detected2 U- q/ Q6 Y" `* w. v, o
. Q! J7 b$ ~+ T6 F% A; D

/ e$ ]/ k' F/ S9 m; ]& r% D; D7 mNext method as well as the following one are 2 examples from Stone's
  X/ g7 R$ Z8 s) h6 y"stn-wid.zip" (www.cracking.net):
' s9 f4 ]) z  q! U
2 |7 \& U; ?/ R- i* G    mov     bx, cs# \& l  R7 i% P6 u8 b
    lea     dx, int41handler2
) G% M- `' W$ v. b) L# f" `4 ]    xchg    dx, es:[41h*4]
/ i+ p# J6 G  u. p    xchg    bx, es:[41h*4+2]0 Z$ b) E2 f, C% C( O: t+ m. f
    mov     ax,4fh
0 s# q; h4 ], [2 I' h0 V( w, M    int     41h% s$ t; |* @5 c  L# v" @# M4 Z  U
    xchg    dx, es:[41h*4]
! F( g& \' R+ S" N    xchg    bx, es:[41h*4+2]
! r; L/ d1 ]/ x    cmp     ax, 0f386h1 U% v5 w9 r+ v" B. R) H+ C
    jz      SoftICE_detected( c  B2 X! `1 t7 D3 Z) j& m

* P) x' {) b- |0 J6 @$ [int41handler2 PROC
0 z  n5 Z+ g, n4 Y) h, h0 h1 N    iret+ F* [% a  ~; R( f9 H; o4 i8 t
int41handler2 ENDP" z% l) r! Z  q8 y+ ]0 ]: R

5 t! N; p# [3 ^: L% ~; a
3 @4 Z  F4 n6 m, y* a- U_________________________________________________________________________
0 P1 H( }' L. W6 A2 r: D* y) ?2 j' f0 W# }- r; P. n+ U2 k' X

! R& J; i2 y6 y. M1 I: sMethod 06
% g$ k, S4 c( D=========
5 R6 h* b6 {2 @, Q2 b4 @" ~$ Z5 z! I+ X. O
9 G/ c$ @( s! [- H9 x
2nd method similar to the preceding one but more difficult to detect:2 ?, n1 k, Y8 x4 N* j

& k( D4 Z. o; Z8 `+ q+ ~' t- l' U6 c: f# A' R
int41handler PROC
/ _( D6 c1 H& M3 i( }    mov     cl,al; T9 T: i6 B2 n: u4 ^, J' J
    iret
' \# X7 C  G6 f) n" m: z8 v1 zint41handler ENDP/ X) [( j1 h9 ?+ a& n4 i
& |: {& G" [/ d, |
( i  ?2 J' ]! v' ~6 F
    xor     ax,ax
& @6 }$ T6 x3 E% j1 _$ R    mov     es,ax' U6 B2 F7 D, |. |6 v* K
    mov     bx, cs
; W% [( ~5 j- [8 n9 E5 b* X* L    lea     dx, int41handler! J! i1 Q) B, j" ~1 t
    xchg    dx, es:[41h*4]
  k/ k# o: Y1 q" I7 M1 }1 [2 V    xchg    bx, es:[41h*4+2]& S5 j8 r8 j6 o" @) w
    in      al, 40h, l! g* U* S7 p
    xor     cx,cx6 N! t" U1 R6 n8 x5 i# a1 U2 |
    int     41h, U5 v; R9 [4 v& h' F4 ^+ b
    xchg    dx, es:[41h*4]
( t) c/ F, F% v) i0 h, Y( O    xchg    bx, es:[41h*4+2]9 h% s1 f, @  |  N5 w* g
    cmp     cl,al! y& w* U: p( n- d, `
    jnz     SoftICE_detected
# G0 ]9 S1 ]% r& Q
( l/ v7 a2 @, |  c" ~) i2 w1 v/ R* A_________________________________________________________________________$ t- I2 O/ Y* @, h

) x1 l- X  B! o/ z  z) `" U2 KMethod 07! c+ D. j0 F1 ]# ^9 `1 K) \
=========
3 v# u2 Y4 b/ m, V* ^" Z; N
- i) x& L/ g8 L0 rMethod of detection of the WinICE handler in the int68h (V86)
, q6 c% \) R! l, J' f
9 j  o1 I* M% t& v  D1 i    mov     ah,43h/ U; N$ i' x4 k) W
    int     68h
+ v2 s. Z% C6 ^# g6 b, Y, l    cmp     ax,0F386h1 p3 t& X% q# R5 T/ P" M! _, t
    jz      SoftICE_Detected: x) Q7 `9 Z7 h) }

$ s  D4 S' L; R: h8 \) I/ j$ K( Z4 m. B2 I
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" n4 K" ?* ]* X5 c) e   app like this:2 y4 A! l' y- r7 r, {/ B. [5 Z
6 ?3 S) f0 ^3 Z3 c
   BPX exec_int if ax==68& S/ H3 u8 a+ M
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ q, J+ N: p. ^   located at [ebp+48h] for 32Bit apps)* p6 d0 H! P/ ]( {# h6 ]
__________________________________________________________________________9 `3 ~" p! u( }/ E

* c$ I4 S2 H" v( S) G- U' H1 n% u$ R1 c3 ]. q" H& t  @
Method 08
) Z8 U5 S' [7 s: g8 Q. `& C1 {! k+ n=========
* u9 E; f( n# P" F6 `
, ?9 t# Z6 e- A' ?7 E, y3 w* o' NIt is not a method of detection of SoftICE but a possibility to crash the) f$ S: I8 B6 e6 M2 {3 w
system by intercepting int 01h and int 03h and redirecting them to another
6 V2 t8 U; r( ]0 j  k/ qroutine.
6 W+ C3 T* g. S9 W/ }+ @! X7 u2 ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 t$ S6 a5 }* D8 D
to the new routine to execute (hangs computer...)
1 A+ ?; Q& Y) S+ u9 y2 P
& r+ m  `7 B  T- a7 h    mov     ah, 25h  D; M" G* Z: Z1 \9 t7 o! f
    mov     al, Int_Number (01h or 03h)
, q) X' H. G4 j, Q. d) C+ S    mov     dx, offset New_Int_Routine: b+ C& Y& D# ]5 Z
    int     21h
1 M& G  I, |0 j, }& A$ a0 @/ y  _' g+ }* I- w. l
__________________________________________________________________________; N  G. c' F* b" u* \6 {
% f8 M9 }* M: w
Method 09
: B- ^' a4 [2 a$ x, @" D# l& w=========7 S) w; T. a; p1 {( x. Z% K

% ^% w6 q2 Q( N( f3 lThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) u0 a) `9 S1 v, f. T
performed in ring0 (VxD or a ring3 app using the VxdCall).
# x6 P3 n( T% E* o& j( z# X6 y# c6 G7 fThe Get_DDB service is used to determine whether or not a VxD is installed2 q* c2 }" G7 F) o( F& `
for the specified device and returns a Device Description Block (in ecx) for
1 z  t3 h' c8 p; w* G5 T4 Wthat device if it is installed.6 S. s- m2 N, m3 c+ v
' v$ M  l2 Q4 s% B7 x' [( Z6 N& j
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; p6 w' r5 q, C" `2 }! k5 z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). b1 z% J  S. b, X7 ~# E
   VMMCall Get_DDB7 K2 r7 K$ N0 F5 O5 O) J2 h
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( s, D( ?* d# ^: }) J. d! l- u3 [" I; }7 z8 s
Note as well that you can easily detect this method with SoftICE:
6 y& E/ G& T  u' t. W' E% u   bpx Get_DDB if ax==0202 || ax==7a5fh
( Z9 H- Y: u/ X
' u: T; v5 L! ~- T* U__________________________________________________________________________: d% Z0 k$ B1 b5 k2 D' r

! {& K2 G3 G/ X. {" s- C/ x" hMethod 10: {3 z0 h( Y! }) M5 m: h! O
=========( @: g3 Q& D% C( f2 ?0 z$ J

- I. s/ g# r( m8 T7 s=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with  `9 o: j/ B8 }5 j; w
  SoftICE while the option is enable!!
5 q' W3 |4 \2 i; E1 G0 g+ v
$ N, G7 p% F( ^$ L# w8 k: HThis trick is very efficient:6 y9 D! N) {8 v' P
by checking the Debug Registers, you can detect if SoftICE is loaded7 _2 ?  r& N8 J; ~5 ^6 E4 L2 p
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& G. H* R/ r6 g) L+ M2 O7 jthere are some memory breakpoints set (dr0 to dr3) simply by reading their
5 |# C- j' H1 A# G  Tvalue (in ring0 only). Values can be manipulated and or changed as well
3 @) y/ u4 i8 z2 y$ G/ i+ E(clearing BPMs for instance)5 S1 d$ R( S* v9 j
, C+ p9 c% k, @
__________________________________________________________________________6 I; x7 d. y1 ]0 c; }7 y+ O8 Q3 w
/ ]! g( s% y  Y; h  T" |
Method 11
/ ~1 T8 @# n1 s=========
& }) j/ K) s$ A; f* V" c) x+ R2 X3 F; P$ U% E/ E; K' \& f
This method is most known as 'MeltICE' because it has been freely distributed$ @/ c7 a; F' ^* F4 g/ {2 q
via www.winfiles.com. However it was first used by NuMega people to allow  W" y& S% M2 S. B, @8 h
Symbol Loader to check if SoftICE was active or not (the code is located
$ c, v: u% o. _- }, K+ Sinside nmtrans.dll).
' t6 N) c& R- \5 U$ o/ t
3 J+ U! o; C" FThe way it works is very simple:
6 t6 e; V$ o0 f/ h( RIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' I# K. d# s  ^5 d
WinNT) with the CreateFileA API.
/ y/ L# W# M3 S& w- w) x
6 l& ?" z' ~7 _2 n9 LHere is a sample (checking for 'SICE'):+ t2 B" l6 \7 S

0 ]7 L! c$ ^+ J5 a* e2 a8 i2 g+ lBOOL IsSoftIce95Loaded()9 x% h0 ^# K9 T8 F: @; |( x
{
/ G. ?. j% o7 s8 Y* J. C   HANDLE hFile;  8 _: ?1 j$ M7 g5 U1 u
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,5 M4 e8 o% t% l4 z! {
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: M! Z# B1 W8 d* P                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 Q+ U! J' _/ I   if( hFile != INVALID_HANDLE_VALUE )$ z1 s1 Q& r! R9 t6 o9 U8 }8 |
   {
: C7 i; ]. l0 r      CloseHandle(hFile);
9 k/ w, I3 P7 V( w- \- `* I# A% \      return TRUE;3 a! R& P: F; c. y. {. G- m' e
   }
( u1 R# d! J! q% s   return FALSE;1 J& O' s  [" N1 q: V
}
, X# }) P( g$ G( S
$ Z! g4 C+ U: d7 V. JAlthough this trick calls the CreateFileA function, don't even expect to be
3 U2 r" P$ K: a* G+ S+ |, kable to intercept it by installing a IFS hook: it will not work, no way!4 ]6 G2 q. J$ J; w
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
5 [# e+ I" s3 ~0 yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) J" m  r# _) c8 X5 h/ Mand then browse the DDB list until it find the VxD and its DDB_Control_Proc/ R/ K9 p: R/ u: B& ^4 d8 ]2 m
field.
; i" e4 a- W, g: Y: ^In fact, its purpose is not to load/unload VxDs but only to send a 0 i. F4 k0 r" U! M2 W9 t8 ^* k4 \
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 t- c+ D1 r' h; {to the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ K# G) m! p( N% _" {/ hto load/unload a non-dynamically loadable driver such as SoftICE ;-).- \+ A; z, B: ?# N& E/ ?: v
If the VxD is loaded, it will always clear eax and the Carry flag to allow: B+ a& \! j' [
its handle to be opened and then, will be detected.9 ~. l2 |$ D: A0 u! E
You can check that simply by hooking Winice.exe control proc entry point
" R9 D4 y) z8 Y  u) x2 `while running MeltICE.
8 W6 [1 i2 V- m4 H+ B- P
" a: ~( J6 g& ~4 x" n8 s6 L  ?% b* ~( G! H( O* R6 \. D
  00401067:  push      00402025    ; \\.\SICE
% y/ S6 c1 z: X$ a& j4 H" M- |( @  0040106C:  call      CreateFileA
" Y& i  ~9 \. [, o5 K( Y3 V5 b# P  00401071:  cmp       eax,-001
7 c% e! A* X' z3 ?; o( m' A7 b  00401074:  je        00401091
9 Y% r, r* w" {! {! X0 ~7 `- J
) i6 g/ [1 y* b9 e! A& n
3 ^7 _% a+ Y# f4 p# AThere could be hundreds of BPX you could use to detect this trick.% {# J" J' B% @' S! E8 D! j
-The most classical one is:9 e. n3 `! E& F' Z7 }$ q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 O1 e# x+ B4 H: z8 Y# N) k( L, E    *(esp-&gt;4+4)=='NTIC'
" x* w' ?/ R+ W. o& g2 \. p5 w! ?4 a5 e
-The most exotic ones (could be very slooooow :-(8 B7 I' S4 w6 ^, W: S1 D4 k  d
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
0 S/ r' g; f# ^. Z' p* }+ l     ;will break 3 times :-(  l$ N% v0 j5 V1 E
; |) a% D/ t* P
-or (a bit) faster: ! Y- V+ z0 [) n& E: F
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
! ]1 y+ t4 t% Z* @# e% u3 E! s: s( n* I  j
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  . i3 \3 m- J; k
     ;will break 3 times :-(& l) S1 @3 @( G5 X2 ~" V, D
. w7 \( {" d, i# A- K9 d8 W
-Much faster:; p8 b- k* B7 m' m% |; E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; ~- R- k5 D' S6 D& m
0 o: l5 h0 }2 Z* _) t/ q
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% S4 a5 i( j0 [9 A8 V, d- J0 a+ U% e/ _
function to do the same job:/ U3 K5 h* R+ x7 d" M
5 `9 j9 {8 e; u7 n6 A
   push    00                        ; OF_READ
3 j- Z/ M" A6 b4 z' H. a& h! x2 m7 K   mov     eax,[00656634]            ; '\\.\SICE',0
4 @% B. U' S: F! _   push    eax
/ z5 c3 I4 n' ]; ~8 l0 q& H   call    KERNEL32!_lopen2 [5 X; U0 A& r6 m
   inc     eax9 }! q2 m& o+ F9 `
   jnz     00650589                  ; detected* m! G8 {5 H# h
   push    00                        ; OF_READ- @4 S# ~% ?1 |6 V  H. P
   mov     eax,[00656638]            ; '\\.\SICE') |; H9 J5 f# ]9 _" B
   push    eax% Y, @+ i1 g( Z* i) P
   call    KERNEL32!_lopen
: Z1 N/ _. _% `7 I- b& A   inc     eax
, W# I( ^2 H/ z  G   jz      006505ae                  ; not detected8 a9 c8 c; p- T, e5 w

+ r' d" b4 ]9 ^
0 p2 H" r+ J9 }+ Z" Q8 N, o% z* y__________________________________________________________________________
6 B3 U; P7 W- l! C& ^$ Q- _% m  z$ ?. w+ U
Method 12  K* `, @6 Q: ~) _3 T
=========7 @; r- S0 C: y$ Z! s
$ a$ i! Y9 ~6 `, d* T- E
This trick is similar to int41h/4fh Debugger installation check (code 05
" U* D! P7 y# S, r/ c& E, f2 K&amp; 06) but very limited because it's only available for Win95/98 (not NT)) e2 G) p. d( u4 U& x$ x) q$ {! m
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: o. R  a5 z( _* j) K8 Z  N- E# [" R8 Y' A" F
   push  0000004fh         ; function 4fh" ~; e8 s; E- b" }  Q1 ?
   push  002a002ah         ; high word specifies which VxD (VWIN32)& V* G- t6 H# ]% L: e
                           ; low word specifies which service7 k3 u4 F/ E2 s! G
                             (VWIN32_Int41Dispatch)
9 o) F! q0 W# ?4 J   call  Kernel32!ORD_001  ; VxdCall
; ^6 ~6 u) J/ x/ f5 ?! {7 \   cmp   ax, 0f386h        ; magic number returned by system debuggers6 c7 q* q7 \  Q2 F# u9 s, M; I
   jz    SoftICE_detected% Z5 F. |, K! R7 j5 h1 n+ v
+ N" V, ^4 N+ @+ @+ B
Here again, several ways to detect it:
+ N) @# R# G2 {2 C2 f8 x5 t# }$ h/ V  @# s/ U' F
    BPINT 41 if ax==4f
' G) m, s& w. @0 Q" @* _6 b
& C: a' N$ S+ N' \; k% I    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 ?5 a" T. J# a
) Q) ^0 T1 o0 @    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' T, S+ e5 L& ?2 |
- Z9 A' _2 K# g9 z' K/ o    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 Q0 v  T& v' s- \

" Q( V  B! t2 w+ j__________________________________________________________________________
3 d; z5 W, a6 |( |2 T% i% C/ ]5 m8 H' f2 x( k
Method 13
2 Z% O3 S/ n7 @=========
/ A/ T( x8 t( _5 |, [/ {
, r' \& Z1 R* v! t% p0 C7 z& hNot a real method of detection, but a good way to know if SoftICE is# d# O7 m8 `! M; A/ b; a& F
installed on a computer and to locate its installation directory.3 Q0 [- q# u  x: H6 R" v' b* B+ m
It is used by few softs which access the following registry keys (usually #2) :
) }7 m5 r% X9 b) x0 d4 [' F6 D! Y! B, r% E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& A" i8 ^. E0 a2 w
\Uninstall\SoftICE
9 n% K5 F% Z( z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
8 z# H7 Z0 ?! ?5 j) J) v  ?& m-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 `4 @- \) H4 `
\App Paths\Loader32.Exe  ~5 `( J3 C2 M; s) O
, Z% x( H# |- ^' S! d2 \$ n& O  l4 m

8 q# ?8 z9 m7 B% Y0 tNote that some nasty apps could then erase all files from SoftICE directory
! N8 J! s5 I8 T& o3 Z  c+ }(I faced that once :-(
  j& @+ g& l& M* c0 }: N% {  A/ J: R  _0 I% i
Useful breakpoint to detect it:& O7 O" r1 M# S' _! G
& J$ ~# y) @3 {( J* d1 U2 F+ O
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': |; W* T, r' |) M( Y
' }# {  l* O  {( q$ E9 @" R% z
__________________________________________________________________________  {- |0 ], i0 X- C: m# w  l/ z
) t( `$ ?1 q9 H% D

: G7 S) ~3 m+ t, R" @2 Z+ k0 Z' FMethod 14
; r" D: O8 _* [=========
% ~! S/ m/ e) J6 W0 z! C
9 Y3 B% z2 o. K! ZA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 v: F( V& L/ [( ~8 Lis to determines whether a debugger is running on your system (ring0 only).3 H% p" {. I* A' }% i1 W  o" N) N# P
/ t/ t+ S0 h2 s4 g- Q
   VMMCall Test_Debug_Installed
# l9 `0 n8 H+ a   je      not_installed/ t+ v+ y7 j& X9 D5 g# ?  q" r( O3 i
- L5 _( k  k" F" }
This service just checks a flag.
  d" A& h7 L8 D+ h</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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