About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
5 L/ g2 _2 l: ?/ L5 m* f% z<TBODY>" I! Y# M/ a5 ?( {4 ]3 P
<TR>+ ?/ I8 K* D7 H+ A8 l
<TD><PRE>Method 01
- k1 e  b: r$ |3 O=========& z1 N3 k* W8 g0 o+ k

% F  ?* t* Q( B  `7 s* EThis method of detection of SoftICE (as well as the following one) is; k: w; S" `9 R5 b( W& w
used by the majority of packers/encryptors found on Internet.
  x2 v6 V- @) M7 q' M, j1 IIt seeks the signature of BoundsChecker in SoftICE
/ E- v! ?2 m+ g7 T$ E, f7 a! ~: Q! G5 R! b8 u  E: [: {
    mov     ebp, 04243484Bh        ; 'BCHK'/ M* x% l6 q. v, l( [7 W& K9 U
    mov     ax, 04h0 s* y( i% w8 l
    int     3       # @* C7 M- ?8 A& }' Z1 @1 e
    cmp     al,4
& \- I3 |& |" D5 D# U    jnz     SoftICE_Detected+ L* p9 A( c5 Y7 }

( e/ \$ N. W- |: S6 n. v% q% p3 V* n___________________________________________________________________________
5 E/ U3 s2 N" z1 m* T0 L5 V6 Q# u* L# x- D; D4 {1 q0 C
Method 02
0 i+ }$ \/ D: b* O=========
* o; Y- M$ z( b
( W( y" j# |# v8 r" hStill a method very much used (perhaps the most frequent one).  It is used
. a% S! l2 V7 b8 X1 ^9 dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# B) \) m' R# h/ T% q/ f  M( |3 aor execute SoftICE commands...
1 Y6 d9 _8 [/ e' T5 qIt is also used to crash SoftICE and to force it to execute any commands7 I! W) q* q' i
(HBOOT...) :-((  - U7 @4 D  e$ {0 g

- T, K5 J' ]' m* ?! P2 [2 K/ WHere is a quick description:8 Q! ~$ @/ R' K" T  ~
-AX = 0910h   (Display string in SIce windows)
; E4 y9 a5 x, C0 ]; O: K' S-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  ]5 g$ S- K/ z' s
-AX = 0912h   (Get breakpoint infos)
) {1 h) h0 q4 g; D-AX = 0913h   (Set Sice breakpoints)
. y5 W% K* f; [; c; D1 V( J-AX = 0914h   (Remove SIce breakoints)3 I0 Q* n/ x$ z6 z+ u" F: w/ q
' w" _: Y3 i) K9 i( q/ s4 f+ C
Each time you'll meet this trick, you'll see:
8 H0 T( }, z/ m-SI = 4647h
9 A6 c3 Q5 u: `; F4 ]/ t! E-DI = 4A4Dh5 [- J) Y* t' @7 n' n
Which are the 'magic values' used by SoftIce.
8 Z! n9 [, p  c9 T4 Q7 {1 H! a' J3 @For more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 O& r4 F% n" K# g
7 J5 q# n" L& k1 r
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, D7 W5 ]* a# X& M6 }Envelope utility use to protect DOS applications:
1 h7 Y+ V. M: `$ {; a  f. d* t2 `3 i6 Y: g1 G
7 L' Q0 U: @9 L2 s; a% e% h8 R% F
4C19:0095   MOV    AX,0911  ; execute command.
1 ?& |( `2 Z- f# R4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 I$ W! x% ^& L) g
4C19:009A   MOV    SI,4647  ; 1st magic value.
; V6 }9 ?: I% M& U% |4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 }! Q5 u6 _1 n
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 I+ i& L" R. W) r% O4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# ?  S) p. H' @$ q  c5 K8 j
4C19:00A4   INC    CX8 S) O- P6 Y" C" M
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 P  V- e5 d/ }: Q8 T, z4C19:00A8   JB     0095     ; 6 different commands.6 i0 L. m/ b( W& Q
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: \" s. F5 B6 L( R1 Y" s
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 i" v+ S7 O5 }; W( J" E" g6 b

7 M5 @& k$ h3 ]2 ?7 e8 ?The program will execute 6 different SIce commands located at ds:dx, which
. ?* R& _/ {  V. ]9 Kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.+ M& A) Z. Z: O) ?* r& X

  `' r  B  m5 ~) w* }* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& m+ }$ h; p9 m( C4 \( I( ^8 E" a( X
___________________________________________________________________________
/ R% o3 _3 g; |1 r" ?( v  U/ ?: n. f
! X5 F$ x' r! `4 b3 U9 l. `
Method 03
8 M( Z0 s! W( v7 {=========5 T2 z! Q8 Y* |% F2 a

/ t$ h% s% J9 mLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 D$ R( |  l+ y+ n! }
(API Get entry point)
( o# T6 I, _: G& I1 I) ?" q        
( M  X& v6 h/ _' g/ H9 Q: F& s7 D9 ]" I
    xor     di,di: P, P/ |0 N# e. A/ _. P
    mov     es,di
* ~$ \0 {7 ^$ F& K8 x- [1 l7 V    mov     ax, 1684h       1 w, _0 Q& X) G/ J/ n7 k0 T: n2 V
    mov     bx, 0202h       ; VxD ID of winice
3 A7 E7 _3 {( {* D$ |# c    int     2Fh1 z4 J) V- r, x2 c- K$ {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  S; P! u% G8 U    add     ax, di
, V9 Y: t: J9 B- `  A! s8 a' S1 q    test    ax,ax
% e7 ~. ]; @. j& Y+ `    jnz     SoftICE_Detected
1 {- T0 x6 P; L( }
: r0 S4 t6 b8 Y, B___________________________________________________________________________
) i- d" u* j% o) H) E& r# l5 A
) [* n; I2 ~6 f7 M4 `Method 04
3 Y) |, f. F% V7 e' Z2 V4 T7 B=========
' y5 M! r) X0 Z+ b! `/ r4 U9 b2 K! l# O
Method identical to the preceding one except that it seeks the ID of SoftICE/ ^- R/ x1 b2 d) f% A5 H
GFX VxD.+ U8 N  \- J! w
1 j0 ~5 L/ B4 ?1 |6 c
    xor     di,di! G; Y( V0 j5 E% I  i; b
    mov     es,di
8 d9 \4 j/ v6 Q    mov     ax, 1684h       ; G. N2 P& w2 Z) f8 D; ~
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* ?  J* I8 \: L    int     2fh
3 O4 F2 z+ U" K; ~+ t# h) L    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ ~1 C3 A; k' T8 R6 l# s, d    add     ax, di# _6 g, z0 `; U, R! y
    test    ax,ax: j; H7 l1 w6 B& n5 A' Y& |- V
    jnz     SoftICE_Detected
% N! H3 c6 g" \. Y5 D7 _. R* ?& r' l+ {* X, p* F+ `
__________________________________________________________________________
$ `" i  w" {% N- ?# O5 c9 Q$ C5 g4 T" g* Z- i" L

% [* I3 A* K1 ?/ f0 PMethod 056 B% K* u1 K: l  l7 b+ Q
=========. b% o: W: {" U9 g2 M4 ^. A" @
+ G  j# c/ \% f5 _( S% g; z; _
Method seeking the 'magic number' 0F386h returned (in ax) by all system9 C' E4 y/ w: _0 G7 Q
debugger. It calls the int 41h, function 4Fh.
7 Y% h+ |3 i2 T( n5 ?  wThere are several alternatives.  
+ c2 u/ ~4 w; m" h6 F
' c0 {! R* x  m! O9 ^The following one is the simplest:+ s+ n5 W, Z3 `& S" \
7 A7 V/ z6 T: K$ z+ A# T
    mov     ax,4fh5 L! E: ^6 C$ d, H: n/ O& m+ a
    int     41h; c. C% e. }3 U$ `
    cmp     ax, 0F386; r/ O! W: K  G) Q
    jz      SoftICE_detected3 R) _8 }2 g0 h. C( t
# m0 ~8 I0 `% f& k7 K+ z
* e, o6 ?, d1 K7 L; k: W: v* M/ l
Next method as well as the following one are 2 examples from Stone's . r: V  J8 M7 \3 Q3 ^+ V" e. S& O5 o' i
"stn-wid.zip" (www.cracking.net):
5 a& b' L5 t" J$ J; r. z& ]* r3 b0 |' G
    mov     bx, cs/ X+ f' \6 P; K6 Q3 \* J& i$ s. I
    lea     dx, int41handler27 [& y& o, H9 E8 i4 I( _, Q9 q
    xchg    dx, es:[41h*4]
; s2 j$ W: ]3 j1 V* q% }    xchg    bx, es:[41h*4+2]
) S! c$ m# l1 h, ~! ~7 Q) z    mov     ax,4fh
' \- R5 z/ p9 ^: B0 J    int     41h! d9 R: d- E/ z2 H; ?9 q% z
    xchg    dx, es:[41h*4]
& M! k4 \7 h/ O4 Q. Z    xchg    bx, es:[41h*4+2]
: i0 C! s  c* Q3 |3 D& y  w' _. R    cmp     ax, 0f386h/ u0 _& n* i0 B0 s6 g. b
    jz      SoftICE_detected7 e. d, k# p; x" N+ a& W
7 G# h6 y. `/ F8 Z/ G: f
int41handler2 PROC
6 r1 }0 Y$ V* r( L# ^: n    iret
  P2 N' \; x- c% o7 b+ eint41handler2 ENDP+ i; Q$ e' y. y/ S( M8 q
9 d+ \9 k8 U, `+ ^* _

. Q- r0 m+ X1 J# x- n5 O5 h% J_________________________________________________________________________! l  i$ t3 ]. z7 x: u
" q8 K8 r, Z' g/ S! E" g
& N) Y9 e9 @+ B) X1 |# u
Method 06
+ |! X6 i9 G: Z4 `  T2 @=========
3 h) o7 P- y( r4 j5 g# \! N  N4 Q9 K9 M
& z) r# S, ?! D6 U& {3 ^0 P
2nd method similar to the preceding one but more difficult to detect:: Z3 `% I  Y4 c& z7 i1 l! k' R8 G

/ b. [% F' g; F' Q  b2 ^$ s; a# P
int41handler PROC, {2 t7 i8 ^, v: ~+ `
    mov     cl,al; c, z# d1 U6 ?1 F0 u$ j' X
    iret
; k) g0 Y3 h* F& G) ~4 h0 [int41handler ENDP) f6 g! }- S4 E+ r0 H! n1 C

' U9 R9 `+ N# \, a. V/ T, J
" {% C) m) `8 ]0 D, b    xor     ax,ax
! Z7 f0 `% G; ?8 s* f4 z    mov     es,ax
; ^2 r: T3 _( y3 U    mov     bx, cs6 x/ m8 R8 Z  F  Z( ~
    lea     dx, int41handler8 a# ^# O/ H: u! x- b* w( u1 _
    xchg    dx, es:[41h*4]
) A  X  x3 c$ w  c    xchg    bx, es:[41h*4+2]
/ ?4 r6 i$ [3 B3 a8 w    in      al, 40h
7 u& \! b! R% t" H" h" ^, F( s6 ^: L    xor     cx,cx0 x) V' s9 D* _- E( i
    int     41h1 t7 w/ v5 b6 |# _& o
    xchg    dx, es:[41h*4]4 s- \, e7 C4 _  p+ C! v
    xchg    bx, es:[41h*4+2]
9 M3 V9 d* U% w' K" c* o, N    cmp     cl,al
. y6 M4 J4 g/ z8 U$ i8 e1 i    jnz     SoftICE_detected( w. F- ?5 e3 y/ f( a+ N) G- ~
' f$ ]) Z# b* F0 a( }
_________________________________________________________________________
$ J/ f/ ~2 _6 ~
( O. I1 w* h# C  z" ^; L. c3 U: zMethod 07
5 |) R8 W  f4 h/ e: O; h=========* m( {: d, [) g9 i" l

  t/ U1 B/ @8 p% `5 yMethod of detection of the WinICE handler in the int68h (V86)% D% F( p/ B+ _* n/ L6 j3 s

, }! F7 H5 @  I    mov     ah,43h8 w2 h% K( y$ a1 G/ ?6 k
    int     68h
9 Q! ~( E; h  k    cmp     ax,0F386h
5 t0 a1 ^. L" ?2 C9 G/ ^; ~" O    jz      SoftICE_Detected
% \. f" B7 Z1 J
7 T5 Q3 z. w, G1 D
6 S. D) n/ p' m* C. e) _4 x=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( X5 }# n! e4 a& f   app like this:" j* f+ t3 \4 o: [) H/ W. ^1 a5 \
, n: d% z/ U: ^2 w% i) @- [1 U
   BPX exec_int if ax==68
3 Y0 Y. R$ r' C- S3 [8 k0 b2 o8 t3 H   (function called is located at byte ptr [ebp+1Dh] and client eip is* I4 K' S5 f3 f3 I# e- K
   located at [ebp+48h] for 32Bit apps)# t7 a" F2 [1 J+ l& R" \/ ]+ x3 L
__________________________________________________________________________
* A- m* z3 B! V0 T2 D/ v6 }1 m2 b4 b) O' ]

- `0 c* `# l- C3 M$ PMethod 08+ z7 N+ y; Z% Y1 W+ p
=========
7 F7 r5 g7 S  _1 }4 e. }5 p8 I. O  G7 B3 e* W1 m
It is not a method of detection of SoftICE but a possibility to crash the1 R& L& K& C  Y0 ]
system by intercepting int 01h and int 03h and redirecting them to another. g& T5 X7 h6 X# _7 }
routine., u2 H% y- W/ J0 P+ U+ X# F3 l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 H$ E& M7 W4 @8 [9 h
to the new routine to execute (hangs computer...)4 u7 f  w  l3 d0 e4 g
# l3 w! d7 }7 J- x& Z* W0 K
    mov     ah, 25h5 W) h, x3 X$ D
    mov     al, Int_Number (01h or 03h)
  l2 c0 h6 B& r( V    mov     dx, offset New_Int_Routine6 l# _+ f7 B& h  _9 A" K% `
    int     21h
& u0 b! G$ P& v; ^% f- Y8 b! d9 w$ p1 Y3 L
__________________________________________________________________________/ P3 h) O8 r- M' _) |
# L3 n+ c/ D$ U0 `+ L' G/ S
Method 09! r6 O! Y! s( L/ R( f, U
=========' r2 r  N+ U+ q

1 M  J! e4 D# Q" S$ P/ k8 MThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% x. G: C) D/ `& }) a6 H5 W5 I
performed in ring0 (VxD or a ring3 app using the VxdCall).; a3 ^0 {9 y( J9 R% O6 T  g6 z2 h" `
The Get_DDB service is used to determine whether or not a VxD is installed0 \2 S0 z' v& E9 I8 P" U
for the specified device and returns a Device Description Block (in ecx) for  k$ i) a. z0 U% W' v: O4 V+ k
that device if it is installed.
9 C! k. r( E! d0 c4 U, i
* q, L& P. m5 H7 m   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. i" [$ D. F. l9 l' C   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)( x, W. I& z& Z! b; n9 [
   VMMCall Get_DDB; ?, [$ z( x" H7 V/ e% |+ O* y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed- c: h+ [  W* @+ ]; s+ @) }' \2 }3 U
8 N) w" T$ D% E2 a, B) ~
Note as well that you can easily detect this method with SoftICE:3 o5 |7 b: C- {2 ~6 C0 U) u: D" @
   bpx Get_DDB if ax==0202 || ax==7a5fh
; g$ C/ U' a+ V; y, w& [
/ T2 l( }  G% _$ x+ w__________________________________________________________________________; ^+ I; Z6 V& B1 J
$ s0 D' O) [" H0 |9 K
Method 10
9 X! o% N; m% C=========
; l8 j2 v# W9 y  n1 W* Y* p: m) F3 _0 N* x. o# A) ]; E
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with  ]: {* _- b* Y7 P7 J
  SoftICE while the option is enable!!
- N" c5 q: ?0 R9 U8 U! U2 {1 K: R
) F* z. s1 i- j4 [# Y6 KThis trick is very efficient:
6 w, U& D0 W7 d1 m$ v+ dby checking the Debug Registers, you can detect if SoftICE is loaded7 Z, s1 K+ c1 q3 Q/ V. H
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: G/ \# J: G9 W1 uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
1 r) Q5 A( [. d, A* @value (in ring0 only). Values can be manipulated and or changed as well4 i, l, X9 ^" ~, g9 M3 q4 v. J
(clearing BPMs for instance)
2 n/ ^5 B. U- K, X( z2 K* V% x5 ?6 m0 [- b$ }; F0 o9 Y
__________________________________________________________________________
+ [( ?6 z6 Q) l) J" E# K7 L
" O9 a( g: C2 C! [( SMethod 11
  J  M7 ^7 P4 ^  B$ p% k( A3 g=========
+ s8 ~( O0 P* s! c6 O3 S
, N0 @+ K/ ~& }2 nThis method is most known as 'MeltICE' because it has been freely distributed7 N0 C4 b4 C1 g8 U
via www.winfiles.com. However it was first used by NuMega people to allow
$ {+ e& A# f8 B; W; NSymbol Loader to check if SoftICE was active or not (the code is located
8 _2 c5 U; h; G6 V. r2 E0 O) @1 g+ Linside nmtrans.dll).
9 c1 v) _( m& H% @7 t
2 a9 W" _7 G/ BThe way it works is very simple:/ }- S# V4 v- z6 G  n9 p% o
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% \+ D. R8 ~9 j3 UWinNT) with the CreateFileA API.
+ r" o2 k2 U" F4 v, E$ @5 U
0 D8 N- n0 F  A0 S5 FHere is a sample (checking for 'SICE'):& U# H* i& p) l! Z  h! P' `3 O

* S" Q! e3 @" g( {+ j5 R7 n% yBOOL IsSoftIce95Loaded()
# M3 v  {+ J" P" |8 J; |+ c{
! _8 m" c! f1 X8 v2 P8 `; ?   HANDLE hFile;  $ v& ^& M, S" |2 a3 ~8 f8 |5 ?
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: ^- G+ b8 r. K" w2 M5 E6 @                      FILE_SHARE_READ | FILE_SHARE_WRITE,* }( V7 V$ f# x- e3 N9 E; X9 n
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! Y  t& _1 a9 Z5 N4 N, S   if( hFile != INVALID_HANDLE_VALUE )
- x' g1 N, K2 p: }   {
6 `* K, {- C0 m7 S: U8 a$ D6 `      CloseHandle(hFile);8 B2 g' e8 u4 x- Z2 ^
      return TRUE;
4 T' y5 l* T" x* a% K   }
# M  Z. \8 m/ T5 W   return FALSE;4 C+ l8 `7 {( n# D  X
}
1 z' a, ]* A( t$ Y1 d
5 L5 o' F9 L' ~0 L7 [7 TAlthough this trick calls the CreateFileA function, don't even expect to be: u2 M/ I, N+ |6 F2 p6 r5 a0 R
able to intercept it by installing a IFS hook: it will not work, no way!
& K! q" t% P( {# }# ^% SIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
% o7 N- d1 y3 d6 C8 `service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 o& c: g, {. j# x# b" tand then browse the DDB list until it find the VxD and its DDB_Control_Proc( O! u7 p; ^; q4 l6 s6 l. c. H
field.
  i4 P4 E8 L; QIn fact, its purpose is not to load/unload VxDs but only to send a 9 ]* H4 a! q, B5 h& d3 i
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 L! U* X9 E$ t' s# t: `2 u
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
# ~+ l3 Q; y) P' xto load/unload a non-dynamically loadable driver such as SoftICE ;-).8 _- I& k& ~6 e" B
If the VxD is loaded, it will always clear eax and the Carry flag to allow
- I; ?4 ?, J/ }; z3 P& V% |, K6 bits handle to be opened and then, will be detected.
( D+ l8 b2 t  M# ]8 IYou can check that simply by hooking Winice.exe control proc entry point2 T$ a3 n4 u0 U7 ]
while running MeltICE., X% l) o1 V" e& h8 c* [

9 }9 g1 k4 O& r' ]& y
" X& l, |) R  K& a4 t  00401067:  push      00402025    ; \\.\SICE
& L0 V0 ^2 u- R2 B4 V+ y  0040106C:  call      CreateFileA
6 @: n* o+ S2 R' u: H1 S  00401071:  cmp       eax,-001
, c' A: Z% N) B( z4 c0 l$ ^  00401074:  je        00401091
( x! V/ d2 ?* W& ^/ z4 z# S8 X
8 ?: E+ o: b& u& `  J. B! |! m& W- x; {4 t) A( F! I1 o
There could be hundreds of BPX you could use to detect this trick.6 U1 m+ i, T3 z
-The most classical one is:
- |1 a% Q. ~# h& r* c+ c  F  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
  E) ?, i2 w9 U0 s; U$ ~8 {% W    *(esp-&gt;4+4)=='NTIC'- G) M) g' [6 L3 d  V1 {
7 W1 C6 u" Q& I" c* l4 H% b
-The most exotic ones (could be very slooooow :-(
! x! D. o8 Y& ~  K3 B- Q7 S  g   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ h( F" N- d( s' q! P  t0 t     ;will break 3 times :-(
! i; S1 S" E+ c/ Q0 d0 E) s& q3 ]+ a% j0 s
-or (a bit) faster: * D/ O$ U% I) R, |5 z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ w, a7 O* h" x
" E) Y+ Y9 d# E( o! l, a$ [   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  * ]0 ~) C( ?8 n. k3 l
     ;will break 3 times :-(' E$ Z: q9 i* t# f/ X! N) V
' C' ]  ?& M3 r: ?+ z
-Much faster:
3 I1 B- Y3 V, s7 T( [; w2 K' r   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 B$ Q" G# H9 ~, m- k! M
) w; ?% q8 p# p& u
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen' l  M; J  n7 y  \0 T3 B3 p6 h
function to do the same job:
) T! f4 c. a0 }8 i8 F  m$ m
# ^. x+ L. @  f6 M6 l- m   push    00                        ; OF_READ
. o& Q* t& L# n# t0 A" @: F   mov     eax,[00656634]            ; '\\.\SICE',0
% B9 v# R; [: L  ]) @2 L0 K   push    eax
8 P5 v* M1 O9 z0 t/ b; G# E   call    KERNEL32!_lopen
6 v, w+ }4 F6 L3 X. r   inc     eax" H% d0 ~9 p" \2 j3 F& I$ x
   jnz     00650589                  ; detected
: h% L: T- L5 O9 m. y9 S1 ?* ^   push    00                        ; OF_READ
4 Q, U% t) `! `) n   mov     eax,[00656638]            ; '\\.\SICE'
8 Q  _- i7 ?: ?2 R% a7 S' Z. R* U   push    eax* j' W1 z* t8 U& j
   call    KERNEL32!_lopen
! v. j) J% B" b8 |8 h$ N5 n   inc     eax
& R5 d, Y! w( e$ [   jz      006505ae                  ; not detected( F$ H  r3 Z* ^* n/ e
8 W, @- U9 q4 M6 n: P

) q# W9 A% f& Q/ r* g7 R# x__________________________________________________________________________
$ d  @) R. l# T( t7 M9 c5 Q5 B3 G8 a: q$ v- g8 @! Z$ `7 ]
Method 12
  ^% v* b6 z7 K- ^0 M  c. b" |- z# D=========
. \" K7 B; K& h2 O
0 m2 U3 a8 _! y0 l! S5 S& zThis trick is similar to int41h/4fh Debugger installation check (code 05
5 v. {+ n* \+ t3 G- x( w&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ O8 `! n! S, _. ]( T- b& Y# ~as it uses the VxDCall backdoor. This detection was found in Bleem Demo.% V$ z. {; R9 z) q
" i+ T# V4 n; Y  h% d( F2 ]- C
   push  0000004fh         ; function 4fh( L4 s( s  ]# E3 s
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 A) H/ L. t1 m- g& l8 i& w
                           ; low word specifies which service; H7 x7 s  h( ]2 K
                             (VWIN32_Int41Dispatch)$ y9 }" i5 X; {+ p) ?% k% U* y' R8 Z8 E
   call  Kernel32!ORD_001  ; VxdCall4 o! c, A0 x/ E3 Y2 S
   cmp   ax, 0f386h        ; magic number returned by system debuggers) G/ N5 a0 n2 D8 [5 Q9 L
   jz    SoftICE_detected
/ n; t. Z0 {8 E6 h+ o# S+ @- N6 `0 n, p, {: R4 X
Here again, several ways to detect it:( ]6 ~. }2 r" Q1 u4 D

! ~- j0 B7 }! d* ~# T    BPINT 41 if ax==4f
% P1 I+ Z7 c" f6 s/ `1 n( W7 I' f. \9 f  W: ~8 C& e( k
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ d+ P2 S" o& G* C0 b" G

% D5 J) |% j- v2 p    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A% z( L$ Z' K* J' b
* Q& t' ^6 d* z# T: l/ ]
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# N1 z' _% h3 ^/ d* d7 B2 Z6 |
2 G& k. X# d8 K__________________________________________________________________________
$ H* U3 \& D/ O( @: I8 K  J8 H0 a5 i7 `6 _
Method 13/ L% }5 l! {/ ]/ r7 B: S7 s5 E( c
=========
( n" Z7 [" d& c4 v% s; g
4 K# o8 y2 K! p/ b9 BNot a real method of detection, but a good way to know if SoftICE is
  h9 \- l$ M8 N9 \/ U" }installed on a computer and to locate its installation directory.: c: I" i. _$ s
It is used by few softs which access the following registry keys (usually #2) :
$ b6 ?  t" B! y
8 o' z/ Y, t' W: U8 q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ R$ b' j+ s) F1 c9 l1 ?" B\Uninstall\SoftICE
8 Q- \% c* O/ Q7 b- ]-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 ]- \( i+ S# P4 C' ~6 @! u' S
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! o4 e8 ]4 k2 U1 d0 W! p! e\App Paths\Loader32.Exe' K1 O5 z9 r  J2 ^5 U# Z; D, G

7 w- X* C1 k4 [
& Y7 E- I6 T: A. e8 r0 D) tNote that some nasty apps could then erase all files from SoftICE directory
/ o0 M' \7 G% c" n0 i# F0 J(I faced that once :-(
1 Z% C7 e( o( l; p: Z2 n# z% x
$ _" _2 K! A5 u! h3 D8 w% X! XUseful breakpoint to detect it:
$ x/ x$ P* Q: Y: m1 w0 U
5 c/ C* R) t6 ~. N) {" G, U9 W     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'2 W  u% u6 }2 b

* k2 S% B/ P6 U; x5 G__________________________________________________________________________
# Z, _# T2 f9 f& i1 l5 o3 J8 n& l. S' j) P6 S+ V, B
6 }- @: O) Y. G, _" o5 S/ z
Method 14
; P$ g/ L! R0 B* j9 p2 |=========6 Q2 Q- y- c3 E# e5 V4 ^) u
) Y2 L  v* G: I# H  x
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, n3 Z5 j. n1 h* l% m1 R0 M! K; y1 w4 ?2 X
is to determines whether a debugger is running on your system (ring0 only).2 Y4 y  Q- b8 i5 z- d2 E
4 n& }5 G8 L$ r' E1 c: ?5 Z
   VMMCall Test_Debug_Installed
6 P7 F* p/ E1 w   je      not_installed3 r$ ~. E! g4 H# h
* M4 P; C5 A8 c( h* ]
This service just checks a flag.
; ^# H: V9 Y% H& h9 P</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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