About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ Q3 |2 S: P! C  L! h# y
<TBODY>: k) a& F) ?  e* S4 X" ?3 L
<TR>/ n0 ?" l) y" w0 S& \0 c
<TD><PRE>Method 01
) f' @4 A# X: n, K8 d8 z$ M( D: k=========
/ F( U/ U1 M; Y# @' y  ]. e% ?9 x5 r/ S" s0 y6 i
This method of detection of SoftICE (as well as the following one) is  Y8 K7 ^0 L0 J
used by the majority of packers/encryptors found on Internet.
" `1 ?% f6 [9 w. G% {  \It seeks the signature of BoundsChecker in SoftICE% T% n) I7 x% u  w  E4 f$ U* E
2 A: o2 a' Y4 W1 e6 _
    mov     ebp, 04243484Bh        ; 'BCHK'
7 X- Z) B/ X1 K5 j    mov     ax, 04h
1 U! x! L( }1 e6 |8 y    int     3         E6 X/ s+ H2 S/ @
    cmp     al,4, M' e5 N+ r* F) p1 X8 p4 y
    jnz     SoftICE_Detected
6 o+ j% E9 p" V, a; N* n0 j) ]  S9 q3 f  v, A
___________________________________________________________________________2 b, ~( s5 a: ^  A

0 C9 z) T0 a0 O! V7 R2 b% s8 O" y, ~Method 02
  W1 I, W9 M$ _% y# e  A8 @=========" ^) K+ x7 n/ N( C) U8 t

; o& h6 ?/ Z- ]Still a method very much used (perhaps the most frequent one).  It is used  x: G% d. ~2 m. c5 U4 h4 w& h
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, h& Z& r7 a6 g* X4 Vor execute SoftICE commands...- a6 Y2 f/ f1 _
It is also used to crash SoftICE and to force it to execute any commands, S' I5 x3 g) S- a- j
(HBOOT...) :-((  
6 b( w5 a8 ?/ I+ t; G& n
& J* e/ ^7 j- y8 B' t) _7 hHere is a quick description:
6 Q# N/ o) {( U0 m/ E- C/ l-AX = 0910h   (Display string in SIce windows)  `' D& ^5 t+ c& J$ n. w
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)2 X# `* \6 n+ l. [$ k" U
-AX = 0912h   (Get breakpoint infos)2 s# `( C1 e4 c0 H8 `* t# q* L
-AX = 0913h   (Set Sice breakpoints)
- c6 X. V+ X7 F8 g5 G8 G. R/ y0 \-AX = 0914h   (Remove SIce breakoints)8 w+ s' U6 U8 @1 O% }
- F  d7 s3 b  S. ]+ E% _
Each time you'll meet this trick, you'll see:/ L. S& j" C! N8 q. ?' a) R; u) @( E3 [
-SI = 4647h0 B3 {. S. m$ B  G" \/ v
-DI = 4A4Dh
: I0 U# y6 I( m7 P9 }Which are the 'magic values' used by SoftIce.8 `/ y2 A7 d) G& N& K) L1 V; [
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
' Y  p5 ?$ I& t% m
( B7 }9 A, j1 vHere is one example from the file "Haspinst.exe" which is the dongle HASP
; O) J9 J6 A( R) {! V% K. S7 MEnvelope utility use to protect DOS applications:
0 K' @$ D/ {7 Q# ?' H. W6 W: d: i% L+ K) \
( \$ [; X: }0 [0 v) I/ Q6 \0 M
4C19:0095   MOV    AX,0911  ; execute command.
+ i% A, n) A9 _$ A4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 R  L# P* {; m0 m0 s9 b$ S4C19:009A   MOV    SI,4647  ; 1st magic value.
+ c2 W) G8 w* @' B! i8 t4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
7 E; [9 M+ E( a8 z, ~4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) ?  e. B. c) }3 P
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  ]6 V/ W4 o* x
4C19:00A4   INC    CX
$ y/ a' v# A% S0 ?4 Q: y, x4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 h. o9 T+ }( k  P
4C19:00A8   JB     0095     ; 6 different commands.
8 Z; E2 i( G  w. G; ?4C19:00AA   JMP    0002     ; Bad_Guy jmp back.+ M- K$ M, s8 S+ A2 _
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 M9 D( o3 i6 N! `8 o( C$ j7 R: t# L7 v% }% B- {
The program will execute 6 different SIce commands located at ds:dx, which
# i! i3 r9 N4 K* ~$ z/ j5 a- yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 e  {/ M# Y3 b- k& T5 J) ~3 K% p8 e% p$ e% k) l
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# s7 C$ W6 A( d) R0 U
___________________________________________________________________________& m) b+ l' ^* _! W

& q6 D, ~/ q$ [- S3 F6 _0 ~9 [
! h: L/ N) F( J1 ~- w$ nMethod 03
6 v/ d* {7 g! E& f=========5 m. M+ w' k) G- u
( ]5 p; |6 V0 H0 [
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
" N$ V! k4 O! l/ \) E  J* D, k7 S# i(API Get entry point)
4 N# i/ _/ G! d* Q9 @  [* u        * }' q  {' A; c* S
1 M# B1 P" H! }) o5 g1 V% T, m
    xor     di,di
2 ~( @2 n3 X  ^: M7 E2 a+ u) q7 m    mov     es,di! @) e, m9 N. I+ y- m3 ]
    mov     ax, 1684h      
5 j; I+ f" h; h) {    mov     bx, 0202h       ; VxD ID of winice* z3 @  k. X( w5 D
    int     2Fh
! s. L8 S. k9 k4 h0 X/ b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# y0 i/ d: s; g! s) i    add     ax, di1 u4 O2 |' D/ Q: L! b# M
    test    ax,ax5 W# f+ W7 x1 x
    jnz     SoftICE_Detected
# G1 i+ u. ~( B8 `* V) e7 M7 z, F% D  M
___________________________________________________________________________& x+ J- ]4 V- Y! F/ p) y9 n) I
) {6 `* m' d. t
Method 043 _8 d4 a2 ?6 f& G/ P: T
=========
  |) }; j; l) [, P" `7 u" U8 n! e2 c  }0 U/ R# N
Method identical to the preceding one except that it seeks the ID of SoftICE
5 o1 C: k6 k# }8 K; aGFX VxD.
$ p1 ?* T: g! B! s5 q* I" W7 a9 r7 p. [: Y' Z' U$ Z0 Z6 S. c
    xor     di,di; @$ x8 K- G+ d8 s' m& r$ y
    mov     es,di
3 g9 _) }0 i. x% x( ~; `    mov     ax, 1684h      
  w) q6 _( c2 q, _    mov     bx, 7a5Fh       ; VxD ID of SIWVID
& k! o$ c6 v, H! k1 Q    int     2fh
$ t9 V, E2 A, G- x) d% ~, @7 t' O    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 J9 }: E9 U5 _( @2 P' h$ B
    add     ax, di, ~: z6 g* Y; Z: H7 c
    test    ax,ax' \/ K  {: }8 i. k) s  c. N6 y, I: y
    jnz     SoftICE_Detected
: j$ p5 o3 d4 c) j4 \$ N
6 ?- u4 |/ r3 w  p! _  O' g- B__________________________________________________________________________" G- ]2 f! j: |7 O, u8 C
0 n$ f  t2 A7 f" G* B

0 a  [/ A! V% d* F4 yMethod 059 Q4 I/ d1 D( ]4 X1 x* b% V
=========
/ V9 V( i2 {0 s# E# s
; q8 I9 e8 Z' ?3 I3 ~Method seeking the 'magic number' 0F386h returned (in ax) by all system/ B6 V% o' j" H( E5 H' y
debugger. It calls the int 41h, function 4Fh.
( \3 w# r8 s9 u+ o+ h7 `  hThere are several alternatives.  . i. v- l6 S' s/ S5 G
+ f: G6 r$ _- G0 v  J% r
The following one is the simplest:$ G5 P+ B. @7 V- R- R! {# f

$ e: G# v( k# T1 I, x: E    mov     ax,4fh
3 O; j. b1 c- G) \: H    int     41h% V" A  Q. b7 e, p
    cmp     ax, 0F386
* H  f! d- C* w" c+ }    jz      SoftICE_detected3 {! v. H) ~7 ^3 q" y
. g' c3 F4 @4 p5 w/ c

6 i  [2 O$ @2 u! O+ A' S2 ZNext method as well as the following one are 2 examples from Stone's 5 _: H' [4 d. m6 b$ `5 Q' ]
"stn-wid.zip" (www.cracking.net):" f' B# g; r5 M

6 o3 y9 I/ Y. N; l8 q$ V    mov     bx, cs
; L+ q1 t/ t( `$ D( Q  h3 t2 h    lea     dx, int41handler2
6 [" d7 k6 [& i/ i6 x, |" M, y    xchg    dx, es:[41h*4]6 A) z2 H7 n% U. U# N
    xchg    bx, es:[41h*4+2]
0 W$ F+ q) c8 k$ J1 N    mov     ax,4fh" S  e! K; C5 {& A' Z* @9 X
    int     41h  i; V( Q) J2 k: Q# K
    xchg    dx, es:[41h*4]
! S; v* ]6 x" D    xchg    bx, es:[41h*4+2]
4 `5 w+ _2 T  R1 l9 C    cmp     ax, 0f386h3 k6 w, e9 s2 q7 i; B
    jz      SoftICE_detected
! c5 G4 M- a: \& C# v5 X
. {7 T/ {/ W7 X- {' Hint41handler2 PROC& h$ S3 B& m( P" A  `9 H* ?- Z. J2 i  }2 f
    iret
6 c9 [7 V8 }. o* }/ F' ?0 I2 xint41handler2 ENDP
: d. [; s8 ?9 Q- L1 l7 i( l8 R9 w/ @6 Q# c6 d! T+ ~% B4 O8 m3 Y; N

5 ^/ D( R& w  I" D$ E' {2 |" e_________________________________________________________________________
5 g; F+ U" F- i) v0 {
  y+ Y9 Z* G6 x
9 A" s8 i+ u& e" @: WMethod 069 x7 p/ Z& k; Z9 q
=========
! }6 M; h2 v* L' k0 m; B( v' N8 j4 X& c, M9 |5 ?. O! j

$ p( D* U1 N* v( O: n2nd method similar to the preceding one but more difficult to detect:
" A5 G" Y7 V. h; ?7 d$ M" u% G* Q7 S+ m

  E4 |( r  B8 H0 Qint41handler PROC
3 f7 y$ O8 x. ~$ s( ?    mov     cl,al
2 _$ X* h" }0 Q6 ~, Y    iret
6 `6 z: z& S2 o+ \) k) a2 aint41handler ENDP: F3 p+ X3 Q) w; `
: j) _9 Q( \$ E6 M
  d5 u8 Y* b6 f6 Z* A  b  [7 G0 m; w
    xor     ax,ax9 |# P( T. P" I+ d7 H$ h
    mov     es,ax7 }6 j% O% s; o* w6 x
    mov     bx, cs
. K: Y9 [3 F, N# e4 w2 B% A    lea     dx, int41handler" a& b1 n2 _  X; D0 ^
    xchg    dx, es:[41h*4]
! m- w9 g4 O8 M" _! ]& l    xchg    bx, es:[41h*4+2]% N: ]3 D2 r7 @. |9 F9 @4 ?
    in      al, 40h
3 c% K. s3 F4 B% M    xor     cx,cx
6 D' I* J! m" \4 _& ?3 ~) t* I& i: `    int     41h
/ X, c& P# l# Q3 X& B    xchg    dx, es:[41h*4]& {) l6 d6 ^2 G/ V1 k( D
    xchg    bx, es:[41h*4+2]8 Y: `$ a+ V: v: h, r# _
    cmp     cl,al( X% O+ k; t# \; r9 ?
    jnz     SoftICE_detected1 D$ s" B5 l, t5 `! l# n. X' z5 N
  J( C. X( r/ l3 g
_________________________________________________________________________# H' t$ L% \8 S8 B# M

. G) p$ V/ X/ n. r$ dMethod 07" C( \$ J8 N5 d3 f9 e3 ]* w
=========7 H$ D" e0 a- t) }- N! Q; Z
3 c( ]0 c* v7 u' R
Method of detection of the WinICE handler in the int68h (V86)
7 F8 L: y! v) ~! ?& G1 e$ m6 B& Z% ?2 e) X- b& Y3 l" x3 I
    mov     ah,43h
% b- X! ~4 [! D& U' d. Z    int     68h
3 t, y( f  l3 X; e4 Z2 ]7 w/ @    cmp     ax,0F386h; V+ y3 A; y  X! O" s
    jz      SoftICE_Detected
( M7 ^$ ~; A: q3 b5 W7 \, m+ Z, u& l) l9 _% t; o

! m( F; Q3 i& U3 C/ N6 ]- w' T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. s/ ?: o3 d, @) m4 O   app like this:
9 O9 m' d0 z" f0 H2 y5 d3 _* ]
: J( g& X* L% C, c& ~   BPX exec_int if ax==684 s7 g/ e1 W8 D! t) F  x
   (function called is located at byte ptr [ebp+1Dh] and client eip is4 ^& S4 v$ j0 P+ L7 @) q) I
   located at [ebp+48h] for 32Bit apps)
5 H& q8 @' s) U$ `% X# l, {- O__________________________________________________________________________
1 e" a% _7 h) k$ @' h
+ B9 a: N' N7 A- @* ?2 R) O
% i% D1 H. Q. s% m9 z8 v; IMethod 08, X# ?+ k$ k  e: _
=========
! Q# f) M4 j: w* W% d7 \& O! _( E6 W% o5 g' D! y
It is not a method of detection of SoftICE but a possibility to crash the
  M' V; S/ m! G2 wsystem by intercepting int 01h and int 03h and redirecting them to another
  ~6 k4 I' `, `) s0 \routine.
' b3 Y! J; X9 A. q! d9 HIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
9 }; Q! l6 t, y' y4 A& L. [0 Bto the new routine to execute (hangs computer...)1 l. h$ l( H9 y' W5 z

' ~) j" n' v" E6 H+ o4 k    mov     ah, 25h4 Z/ x* J% ^7 \/ g" E8 z( m' H% e) ~
    mov     al, Int_Number (01h or 03h)7 J4 d4 [4 z6 m& x2 Z) ~( u0 q2 U
    mov     dx, offset New_Int_Routine; K+ P( P  v# g; o' m; m. s
    int     21h$ Z1 g# l& H7 w

% ~) X- |, N$ ^! t__________________________________________________________________________" x' K# B) D' m0 D3 e
# s# j* y: f, f% u" c  h, Q) [
Method 09
' ?$ Q; R- I; C* R) D" N0 p=========
+ N& w" D& A& j
8 j' d' b0 Q+ ?# }This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) x; c1 \1 p( R: a+ x) C  s
performed in ring0 (VxD or a ring3 app using the VxdCall).
5 J  G7 a* x7 Q* hThe Get_DDB service is used to determine whether or not a VxD is installed6 Z- s  F5 R* ^) w0 O3 f* J
for the specified device and returns a Device Description Block (in ecx) for
/ s! N2 J  H. V0 _5 `. M9 _that device if it is installed.
0 f" B  E7 K% Z4 g- {  I2 V  [/ s3 V' F7 M) A6 b: @
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 G6 x2 O, I0 S
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 n1 T$ t! N5 k" |6 J5 O
   VMMCall Get_DDB# o$ S- X% D7 u0 A5 ?( q3 h
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 a5 x, }' L. C7 N- N: m

3 `4 g- n) |# L/ pNote as well that you can easily detect this method with SoftICE:
2 f0 J5 l5 D) M7 z/ L9 K   bpx Get_DDB if ax==0202 || ax==7a5fh
4 ^* k- Z. y: t5 P: H9 \$ `, V& r2 r! l% i: @5 w2 w" I
__________________________________________________________________________; G: I* b9 J. R7 o: F6 B
# j# _0 E7 o2 p2 x5 V, ?+ R
Method 10! f/ n9 ~& n, E- Q* o# v0 S$ n
=========( f2 L% Q; c) E7 V3 u$ q& Z* h0 J
7 {, S" z3 P$ M
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' b6 t3 Q( y, S, _  SoftICE while the option is enable!!" A! X6 ]( }. w$ r$ b6 x
/ J3 K5 z6 P: T) S  ~
This trick is very efficient:+ k+ S" `4 e! A. R7 [, N: \
by checking the Debug Registers, you can detect if SoftICE is loaded5 O9 J9 R9 q4 p/ t
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; z& X/ _. ~6 p! b+ i0 f& z
there are some memory breakpoints set (dr0 to dr3) simply by reading their% A3 Q% t# @# r; |
value (in ring0 only). Values can be manipulated and or changed as well
1 q9 {% {( g% V" P- W: s/ \(clearing BPMs for instance)
& g$ J% G3 D; O
% N9 H# ~* {8 t) f2 U__________________________________________________________________________* }2 C4 B; s# O9 _, Y7 l

' v8 S: d& D. M$ C7 ZMethod 11* k) e% a8 V) z7 U" [- Z
=========
& P( U7 J& n$ w1 w
! V& s- V0 X4 Q- b1 P0 S& @9 [This method is most known as 'MeltICE' because it has been freely distributed
1 b* s7 J" y. kvia www.winfiles.com. However it was first used by NuMega people to allow
2 J( ^7 E- o3 F! ?& o, OSymbol Loader to check if SoftICE was active or not (the code is located
- [4 k9 Y3 H5 U* t9 |5 J; i7 N/ ninside nmtrans.dll).
. R& q" s* l3 p) F& k7 s& T) G
9 \4 q7 D) `. ]  F7 j3 [The way it works is very simple:
- ]: A5 v6 R7 W3 F+ A5 h) b8 ^It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for0 U  Y/ \. E7 v
WinNT) with the CreateFileA API.
! Y& P# P3 v  K1 k
3 N- X. o9 y2 CHere is a sample (checking for 'SICE'):
, E6 V. T% K3 u6 k6 O3 ^4 e1 c4 s& n/ O( t
BOOL IsSoftIce95Loaded()4 S5 S6 U! G3 x/ E( A$ U
{
  r6 x  q! |# Y3 Y- j   HANDLE hFile;  
  I6 \6 H6 U7 ~% T3 `+ m   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 E1 d9 ]) Y, ]9 H8 t% b8 z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ o8 f$ l. W- \
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  l; H- I9 d1 o
   if( hFile != INVALID_HANDLE_VALUE )" W0 X& k" ?4 ?# B! f
   {' k  p! V- Q) V
      CloseHandle(hFile);
/ Q# R# W* R% W2 C! }$ C8 P8 g      return TRUE;
  Y. D4 l: e! Y5 ?   }
* L6 v1 T* X/ ]) s0 p: z   return FALSE;
6 F! |$ [6 d9 h2 M}
4 n6 k; r2 o! @  J7 N7 o4 S
, G& |/ Q$ W) e/ vAlthough this trick calls the CreateFileA function, don't even expect to be/ T# P) H/ e2 G. Q+ i& N, b
able to intercept it by installing a IFS hook: it will not work, no way!
7 z* w' _0 s; K+ @: XIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ C2 L4 P/ B$ iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) r5 S% p5 C# b  L, q- S1 R% Band then browse the DDB list until it find the VxD and its DDB_Control_Proc% J' Q! n# a4 D/ J8 l( L# P8 K. z
field., |" Y2 `2 l4 u$ W
In fact, its purpose is not to load/unload VxDs but only to send a + `4 g  w' z% t% o/ @1 g+ _
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- H: O1 J0 Y9 s9 u2 y) }4 }. nto the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 g7 f8 k* P$ E- D  a3 @4 ito load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 D$ J& n( m( w% G+ iIf the VxD is loaded, it will always clear eax and the Carry flag to allow  e# ^# s/ H: o- W7 m
its handle to be opened and then, will be detected.% o/ L+ P7 ~3 j! a
You can check that simply by hooking Winice.exe control proc entry point' i9 a* l; ?/ _
while running MeltICE.5 f3 T8 [% q! c" j5 s
2 W& D1 ]$ C, J7 ]

9 H$ H. ^; O5 N' k/ Z: U6 E  00401067:  push      00402025    ; \\.\SICE
, m) G" v; z) h+ o6 [& F4 p1 b" A# A5 o  0040106C:  call      CreateFileA
: X" p/ V3 l- _5 F" x& m0 T3 R' u  00401071:  cmp       eax,-001
# Q( z2 K  O& u- D' {: Q1 k  00401074:  je        00401091
( S, D( o8 w, Z2 _8 m. H3 l! X  l8 N1 K* s
! F# h$ }1 g% f- j! B* c  G! U
There could be hundreds of BPX you could use to detect this trick.
% b  S8 I  @) ~1 B5 U-The most classical one is:
( H. M: u  \. O# D: G7 H& B  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 X. v1 E9 ?* m- x
    *(esp-&gt;4+4)=='NTIC'
$ U9 N. N& C/ R9 y! m8 f; s# g" Y! r4 W( v* V6 @6 ~
-The most exotic ones (could be very slooooow :-() R, f# s* k8 [* N6 Y* m7 x- ]
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
7 h9 X4 a& u! _& B  o& V8 |     ;will break 3 times :-(
* f  B2 W4 x/ W0 C8 f8 v& D$ T5 o% [
! b' }- Q; y& J: |" {-or (a bit) faster: , K2 H& P( v3 Q& u
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  y, m" }& d( }& b5 n3 ]
6 k4 H1 _4 D0 G8 O: `& }! |0 o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'    Z! Z* I/ ^( g
     ;will break 3 times :-(' L3 o/ W/ ^% S, v4 d2 \$ C

/ q& `& `. ]! U3 S# r-Much faster:
2 Q" g8 `1 i. h3 z4 I2 c   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, ^8 }4 G; H. T( {% m. Y# }/ ~6 Y- L9 `! w7 f2 z9 b6 P4 Z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ O. N/ d( ~: m4 N( s5 Z8 I" h0 Wfunction to do the same job:
! ^/ ]2 E* n5 l( Y9 u6 N  m8 a9 p2 z
   push    00                        ; OF_READ( x' U. y) x' g, Y: }" v0 ?. C
   mov     eax,[00656634]            ; '\\.\SICE',0
1 f0 b+ ~+ s5 c1 \, I( |6 Z   push    eax  i) m% D8 h& L. u) [
   call    KERNEL32!_lopen
3 Y  }7 V8 M0 j" t2 m: c$ |   inc     eax1 ?. l- J6 \/ j  `7 Q# I. z
   jnz     00650589                  ; detected
4 r! U( ~8 D- d% C. \1 L   push    00                        ; OF_READ: Y! y8 z! t5 y: w
   mov     eax,[00656638]            ; '\\.\SICE'
6 r' y2 a! V/ k: R   push    eax+ H& u& i) n; P. [$ K
   call    KERNEL32!_lopen
& H# _& c, e' t+ X5 L0 N   inc     eax
, z5 C' K3 R, s5 \, i   jz      006505ae                  ; not detected$ V1 L& |& l! E% ^) h

  `$ [/ P# p! O- Z1 S' W  z. h+ l2 [
__________________________________________________________________________6 J2 i' \7 P# A, w6 S9 I( e) B

* n/ r9 ^- j- XMethod 12
3 M6 t: v  J2 z3 Q: S6 C/ i+ J" Q7 O=========
# A% ?: M% t/ x1 M
$ H. v& d) K. n' RThis trick is similar to int41h/4fh Debugger installation check (code 05
6 z8 f4 {6 I/ e1 \6 C  H&amp; 06) but very limited because it's only available for Win95/98 (not NT)
3 F8 m. `( S2 A" ~6 jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 P2 U" P4 s3 R5 W3 c
6 A6 t5 H5 ^4 b# C& j   push  0000004fh         ; function 4fh* |& y3 `. o/ I5 P: h9 z6 C5 ~5 V, X
   push  002a002ah         ; high word specifies which VxD (VWIN32)5 j% r3 B0 p# N6 w6 S( k' v$ v
                           ; low word specifies which service
9 g( Z8 H4 ?( _                             (VWIN32_Int41Dispatch)
) B, w* _) f  I0 R. n: y0 r   call  Kernel32!ORD_001  ; VxdCall4 Q) E2 _; P0 b; @# y) v
   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 [' ?$ N: I: q* O4 C8 x   jz    SoftICE_detected
, @6 C" R7 l1 v6 s. ~7 o0 {2 [. j5 E1 }+ q# C8 I* f' t
Here again, several ways to detect it:% J( z6 a5 W! Y3 H" m. Y! v
" j6 S( \2 ~& j
    BPINT 41 if ax==4f" H# T9 z, ^1 J

5 x& S# C3 `( C' w/ z; c* `    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 l9 C; l, D) [- D9 n+ Q2 i

* T2 L. r) r  V9 C! q1 w' R1 `+ E    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 r: _7 t; N) |. O9 d3 o
% x% W8 N) m: ]    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
8 t, \5 y7 {5 F0 s2 \2 a. G3 a3 A0 J9 Q2 ?8 w1 Y
__________________________________________________________________________; |% s# v5 Q3 y9 S2 D

# q, t8 q0 D, _. i. m/ lMethod 13
* S  ]) [' P" W6 G* l=========
0 K8 v3 t) E6 E' D: q9 y" [; _! I. ~1 ]3 [1 \
Not a real method of detection, but a good way to know if SoftICE is
# O, e  a# q- j8 u- r/ V, c0 ~installed on a computer and to locate its installation directory.
) Q" j$ b! H8 z. VIt is used by few softs which access the following registry keys (usually #2) :
8 O7 Q' Z2 D! M  j- N0 a. E7 N! ^; m: M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- C/ O0 ?. G& A( g5 H7 A+ N8 y\Uninstall\SoftICE
* ~* R- J$ R4 o' K  ?' E5 X! ~-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE! I! K" h* ~- T: D
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& W" o1 ]' m0 I, F2 O) B
\App Paths\Loader32.Exe( ~( G& @/ P7 a' Q6 h# B4 x) s$ U
" `" z( g2 }& l3 l! S/ j
5 Z" _0 W( o. A: N4 j  {
Note that some nasty apps could then erase all files from SoftICE directory7 J) o6 B/ h/ {, l7 ~8 R; ~  k, ?. c
(I faced that once :-(
" E$ C* P: m3 Y9 n7 B: x) o
# E4 Z. t; K* M, |Useful breakpoint to detect it:
8 n4 |1 b0 U" c1 Q6 w0 j! P9 g7 y% @* i9 E; O* S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& G, w+ {  C+ I

4 B& ?# u6 K  n$ r__________________________________________________________________________, T# \& @+ I! r0 d; W3 J# z
9 l0 f7 a! D/ l# p, K. N4 T7 p

4 T) F6 O5 t* R3 D0 b5 p) h9 S; _Method 14 ! Q) M0 M* F9 ]2 A% o6 W2 b
=========
8 N; [# c/ V" a& _7 ~6 `* {$ V0 I$ e+ c
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* C: a' P' ^6 |# E) V
is to determines whether a debugger is running on your system (ring0 only).
6 V7 ^' M- U$ U  t9 N* d; W  [
# E* D- B5 ^$ K; M! T( O8 f% c   VMMCall Test_Debug_Installed
  |" i# d- e% D- }, v. h% u, s   je      not_installed& ?9 K8 Z& u" R, `& M3 ]

$ m; l7 Y- g# e. V9 U  z, jThis service just checks a flag.) j5 N/ s' D0 ^
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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