About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 r+ t1 C6 _6 [9 M) ?<TBODY>
) q6 \( h: S7 b2 B4 K; d) Z<TR>( H( B' v6 w9 e2 W7 Q" n7 X
<TD><PRE>Method 01
: [" }+ t& Q8 ?/ [1 d=========1 }& G. V% C( y

8 \" [0 r0 g6 r4 N4 Y; ?5 e) L+ bThis method of detection of SoftICE (as well as the following one) is+ d% w# C( ?4 L! p# n) X. o0 C5 e
used by the majority of packers/encryptors found on Internet.8 w# V5 U/ V* Q6 m6 k; d
It seeks the signature of BoundsChecker in SoftICE) ~' {# w  c1 K4 t# p* r

6 t" o: O# q, H5 Q. S, }    mov     ebp, 04243484Bh        ; 'BCHK'
" h8 O5 x5 G( U: U# E    mov     ax, 04h
9 Z" X4 y6 |/ v- w2 L  m    int     3       ( w! ]* w$ v* Y2 B4 b- Q1 c
    cmp     al,4
: H, O, ~8 `& H+ v1 H7 h% u    jnz     SoftICE_Detected  H1 K8 D* D9 ~! Z. W$ d0 ^  k

6 a9 p, Z3 X% R  e( n___________________________________________________________________________2 s8 X0 B/ J6 E3 h5 f0 U
* @" z8 Z$ u* b1 ^; p' \! |% G
Method 02! T" z! K: o/ |$ q
=========- I. p( _2 c+ u% \6 ^/ ~- w

: W6 w8 Z) z: Z/ v: j- \. eStill a method very much used (perhaps the most frequent one).  It is used/ N1 W5 b( Y" h  e1 o( S: Z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( x" ?8 m# E2 O- V9 C8 E9 c' ?5 ror execute SoftICE commands...+ h( q: F" ?, A, _& n2 e9 z* Z
It is also used to crash SoftICE and to force it to execute any commands3 q5 M: L% m. I+ l/ t
(HBOOT...) :-((  " @1 J3 I; [7 c, w4 i) J7 L
* B3 H7 D, e+ J+ m" ^  R* h
Here is a quick description:6 e' b; ^( R% N) K! k& p! d( ~' T
-AX = 0910h   (Display string in SIce windows); I  ^: {2 G/ ^$ L$ m# M4 `( v
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); r$ U4 D+ y  J+ r1 f$ O
-AX = 0912h   (Get breakpoint infos)
$ b/ \) v! d) A" s) V-AX = 0913h   (Set Sice breakpoints)
( E/ o+ R; t- i4 |-AX = 0914h   (Remove SIce breakoints)( g- y' I& v# s! _) V
6 h8 b# y$ P/ A
Each time you'll meet this trick, you'll see:+ }6 n: ]3 J7 @7 l: `/ @8 ?. c% b
-SI = 4647h0 y/ j+ t4 @5 F% s4 r' r
-DI = 4A4Dh
: a  s+ y  C% Z1 ^" r8 C4 WWhich are the 'magic values' used by SoftIce.
) \1 S* I/ O9 R' JFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 |- Z, @: x# n& z" N
% x9 P3 ^+ q, }# x4 V- eHere is one example from the file "Haspinst.exe" which is the dongle HASP
8 ]. ?: B& r0 R/ v3 vEnvelope utility use to protect DOS applications:! r) s$ I! u, z/ {: ?
( b5 g0 ~' V  F7 k+ i

$ x9 b$ i9 r+ p, G3 K3 r& i' P6 V( m% a4C19:0095   MOV    AX,0911  ; execute command.+ L+ t5 e4 l5 W6 C, P. u  I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 |( E6 _& O( }4 k6 x4C19:009A   MOV    SI,4647  ; 1st magic value.' I6 Z" m: ~4 J2 B2 t# h
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 {" P" V$ n  O4 U4 ^
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), t, e9 ]: X0 \8 n! S
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# H* q" `2 t) I$ M( _% I
4C19:00A4   INC    CX
( I( Y- @; C, |: U. j4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ y0 h. ~2 e% u+ ^1 \5 h
4C19:00A8   JB     0095     ; 6 different commands.
) o0 K, I" M) |0 s& l. E! Z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
1 |$ `$ T( b! ?1 h! o! y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); m9 h3 O5 k1 d, [" w
5 [8 t2 I+ ]+ i8 g5 b8 `
The program will execute 6 different SIce commands located at ds:dx, which
. H# g9 f5 d! |# u8 T; g' p$ care: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: S" }1 o! w, b3 c+ i: k. U* |
' i; x' c$ A* y- B0 @
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! [7 t; m9 d( ^9 e5 P
___________________________________________________________________________0 \; f( \/ U1 ]; I2 S% ~0 a9 N

( K/ R$ @/ u0 P8 U. ?$ d$ h& y! r- Y8 L# _+ l6 O9 W" J- \
Method 03
$ w  m2 p7 P$ W# Z& z9 \* l) ~; ?8 M=========
9 n2 W  U; u: p4 b0 t5 F% Y$ ]8 z3 f( N& A( `) ~) n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" G4 J  p7 ~9 W: ^# F
(API Get entry point)
7 _2 L2 N4 X! E, v/ {; p1 U        ; S2 c$ P8 W* `& F0 m/ {

9 A5 H! [4 T6 [  _( `: J% G9 d7 R    xor     di,di; s$ O, B6 K. Y9 l
    mov     es,di
' M/ F7 |+ N' S9 L    mov     ax, 1684h       3 R5 r$ M# I+ r6 m# h
    mov     bx, 0202h       ; VxD ID of winice
; E6 r" O# K" ~0 F    int     2Fh! o, N) \7 t# o! z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 x- q3 G/ e. C% g    add     ax, di
; |; a' U; J0 B    test    ax,ax
: |$ u, S8 t. f* D5 P8 Q    jnz     SoftICE_Detected. F; [5 Y) P, O- x; F% u$ t
' y1 k- r7 [0 I  _
___________________________________________________________________________
4 W8 |) `1 l( T/ q0 K5 |. Y- O& X: t) X. w. |6 H* f  i. d
Method 043 X: _2 P+ s9 [1 j( c, T
=========- a8 a- \3 _; j1 S2 K3 V

& W6 I4 j; M" CMethod identical to the preceding one except that it seeks the ID of SoftICE
0 X" q: _1 n- L+ p+ N# _* AGFX VxD.
3 M3 ?( R+ W1 X9 _1 @: h. _3 u4 Q8 c7 x8 C, y6 x# {  }
    xor     di,di
+ [3 D% t! g% R" i1 D% C# b    mov     es,di8 Q1 Z" Q; A% H% h, `# x  z
    mov     ax, 1684h       4 S1 [! y4 K7 G
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 V$ ~9 |) }! x4 A; ?: k# W8 T    int     2fh; I& t5 [  a  s& O+ @: ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 g1 J6 M  g" Y1 _4 k8 g0 x. y    add     ax, di6 i* b1 z! I7 i6 D
    test    ax,ax
3 o5 K/ D6 F$ T) n! I5 W6 h    jnz     SoftICE_Detected8 L! b% \$ M" [0 O
4 \9 U( G. W4 S+ d) r& v
__________________________________________________________________________
" P' Y  b( j/ e/ c5 u1 d: N8 D8 }- c5 m4 A& D. f& U1 ?( w; H

1 @0 L8 j' u9 e7 P; x. lMethod 05
" p, e7 V' q* r# A3 F=========
+ g: o! @: ]! `: v& P4 @4 E3 y- x$ [% F& A9 J- e; `
Method seeking the 'magic number' 0F386h returned (in ax) by all system9 T+ b& ~, i7 @8 H! ~6 S0 }
debugger. It calls the int 41h, function 4Fh.8 o' S# ?2 D& Q) A% A
There are several alternatives.  
1 w" l- c: y0 s6 f. V9 B1 l# \, v6 f8 ~; S0 v
The following one is the simplest:
& \; N! t2 |: R' O& ]. c' D: L
3 W6 |+ u7 N) u/ z5 |* _: M    mov     ax,4fh& p" ]% u( L9 g  ^$ i) g& n
    int     41h1 C$ f$ T4 H" p' Q) X: c0 q2 z
    cmp     ax, 0F386% D  v/ Y. f1 `$ `- O  }
    jz      SoftICE_detected
5 E4 q% s% Q. X+ a- o0 `
. Y5 ~  R7 w- Y- H' p& b: t: {- ]" j, o, x
Next method as well as the following one are 2 examples from Stone's 0 T6 L4 s6 o) Y  m8 M% P" G
"stn-wid.zip" (www.cracking.net):
. |  C5 m4 C6 H& v
% X# a" w) |8 I* k+ H/ D    mov     bx, cs% k2 X3 Q3 v  p; g# s
    lea     dx, int41handler2" h% ~( r: W2 v" p# [$ F+ \
    xchg    dx, es:[41h*4]
. H9 _4 e/ B0 c" b$ _* |6 G$ ^    xchg    bx, es:[41h*4+2]! h" H4 \2 I6 t" E2 @: t
    mov     ax,4fh/ e8 m8 W9 z; s' E9 J
    int     41h/ w) N1 p; i8 Z9 ~4 ~2 ]
    xchg    dx, es:[41h*4]
9 ?& g! P9 g$ b% _0 j5 C- i    xchg    bx, es:[41h*4+2]% m; S, y' U4 ]) g" h! Q4 P
    cmp     ax, 0f386h
3 Q: G) x7 f" x' o8 A$ |    jz      SoftICE_detected) W: G0 e  U( X$ k( U

7 b- N# U8 ^% I1 ^2 k/ tint41handler2 PROC
' ?" r5 ?: ^! b# T+ {    iret
: ~1 V( X! A' a9 p9 r/ K1 w7 jint41handler2 ENDP3 @# |. q+ o) `  r

# ]1 }" _5 U! I+ B5 k2 C
1 ?: t! M2 ~! m: H" __________________________________________________________________________
! l3 i$ b8 ]$ T& s5 c. M: ?7 w. o# _8 X7 `% y! }( U+ k
6 p6 R0 u+ U9 |# P" C  y% M
Method 06& z+ V) g3 V4 V3 p1 {5 z
=========1 [5 D4 \' f8 B5 c; j% V

1 D* q$ c$ t* K. z
/ [, e: H2 w0 E0 ~% @, X! h' e2nd method similar to the preceding one but more difficult to detect:
9 K  e9 \) }+ ]# ~
/ I% {! v* _$ j
  _: v0 g+ R7 ~int41handler PROC
4 r6 e1 r& `: R, ]4 o) R/ c    mov     cl,al# N4 n' E; N  y8 i* R2 i
    iret
, M4 l/ t: M0 k% iint41handler ENDP1 V9 G4 D6 {. p! w

9 ?; b+ V1 e  o4 @) ~# f; W# Z0 j6 g
    xor     ax,ax0 t' g8 S# I! Z
    mov     es,ax( ~: n5 j# K  }
    mov     bx, cs
" Q$ T0 f  e- G+ _- v) `* _' G    lea     dx, int41handler5 k! Q. N7 a% Y# ]. F
    xchg    dx, es:[41h*4]% D, K0 S: M! K& U" T, r8 \
    xchg    bx, es:[41h*4+2]
2 H: ~: ^5 e) j2 i0 I; s' e% W    in      al, 40h
  j# i( ~. W2 O* t2 u$ I    xor     cx,cx/ d& t9 l' U4 z  O( `
    int     41h
: o3 A0 ?' H& y" n    xchg    dx, es:[41h*4]
( U9 w; v. l5 d% I8 j, e  T    xchg    bx, es:[41h*4+2]% l" m1 S8 ~# i9 T
    cmp     cl,al
5 w( d" m5 G& i: u; z; w, a    jnz     SoftICE_detected; [% L- F1 f, ^4 b+ i

$ r3 W* ]  ?. R) R) t  T_________________________________________________________________________' d% H4 @" {0 V. }

3 R: c8 E8 d- C- T2 O" \1 ]Method 07
" J4 u, B3 \0 B/ _=========
8 A  W( E! ~6 ~( N9 b+ R8 L9 F
. s7 h  F( q, e; j1 p4 ]. I9 N1 C9 dMethod of detection of the WinICE handler in the int68h (V86)
! O7 p" _7 \2 i4 M; i2 a; N+ |
( @- y8 R& u0 b) F( `7 K  u    mov     ah,43h  Z1 Z- M( }% ^* [
    int     68h
. D$ ~+ N4 N% e8 b4 K2 h9 u    cmp     ax,0F386h& K3 K6 }, k: E. K  {6 B' _+ Q
    jz      SoftICE_Detected
: h) R) x4 Z) m
- f6 C0 N% W: j; q0 S- P9 {0 Y7 V' e& ]
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- z2 u+ f+ [8 w/ \" ^+ w5 N$ F' b
   app like this:& t- y0 q5 z, Q. i' r' Z, [/ v

  [3 X0 `2 n; |, K   BPX exec_int if ax==68- \4 {$ L$ o- t% ^: o: A3 A/ y& h
   (function called is located at byte ptr [ebp+1Dh] and client eip is! G& S" n% X+ k: w/ S
   located at [ebp+48h] for 32Bit apps)( x4 t2 d) t. d6 y9 w4 J
__________________________________________________________________________
% \5 }5 ?/ b) @5 O7 f/ Y5 \
% ]) }' ?- U, M) ~2 N( k8 w0 Z' j- Y  G6 p& N" E
Method 08
, X0 ~7 r( R% U. r=========
9 q1 u! G* W" ^
' u) b  A* c9 g# j2 ZIt is not a method of detection of SoftICE but a possibility to crash the
4 c3 V2 V* F3 }4 X# t1 m/ lsystem by intercepting int 01h and int 03h and redirecting them to another
* a* b1 {0 p9 X# V; {( Yroutine.
9 r6 A) l* ^& F( t. m# S! cIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
3 }' c! i0 {8 \to the new routine to execute (hangs computer...)2 V% B# G* N& `; V
# k2 v7 X$ g; t3 j" [- `3 ?
    mov     ah, 25h9 J  g7 {; q- J0 X* T
    mov     al, Int_Number (01h or 03h)
$ t, O$ j+ [' t2 m: ]    mov     dx, offset New_Int_Routine
( m3 ?# Q' k5 U" E6 Z    int     21h* ^5 R+ A& I6 L1 [# ]. T

* X" c% U  w# Q* X% B6 L4 O/ Q__________________________________________________________________________
7 g+ k$ Q7 C( x' ?, D7 h  y) b- t1 Q' p* |  H5 N% \* V) R
Method 09- e1 Q. \5 z* |: o
=========
' W. F. b( [! n, n; [
# x/ C8 }; C& \This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 g) ]7 R! s9 A1 ^1 W, ^% m
performed in ring0 (VxD or a ring3 app using the VxdCall).2 T. d- p9 q- Z, W- M  ?. n3 F+ c
The Get_DDB service is used to determine whether or not a VxD is installed
/ E: J8 G  y( ]for the specified device and returns a Device Description Block (in ecx) for8 u5 a9 d$ `; q  D, l3 Q
that device if it is installed.
# w) Q! K% a6 Q4 [
8 b9 J5 ~2 \7 d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( e: \$ y* E* q2 K   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)# f9 [/ I# y. B( g1 x, E2 S
   VMMCall Get_DDB
+ @% w* y+ D! q2 C1 r   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 p+ y$ t" k8 i

8 g0 U6 ]  L) S7 \1 e& A; p) kNote as well that you can easily detect this method with SoftICE:" }2 {1 y0 h* e2 k2 b+ }$ R
   bpx Get_DDB if ax==0202 || ax==7a5fh
2 Y7 R9 N$ e9 b) N" r* P
6 Y8 b) U3 m8 p" N4 q! V3 Q__________________________________________________________________________
0 K- N; g7 z9 j" I' e, c
: J* v) T) M* e( ?5 A. G4 nMethod 10
/ Y3 [1 ]: F& ^8 a5 ^$ x=========5 q. I) P+ l1 q. @0 V! f% x& K1 l
( o6 v) o" m% ]; B4 ^! G
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ s" _; H3 I/ |* L& d- F4 h  SoftICE while the option is enable!!( _4 ]; L% q% e4 \  v  y: t

4 f0 K: l! D+ S0 |% l) K" gThis trick is very efficient:
; |4 T( x+ b& k& S' Fby checking the Debug Registers, you can detect if SoftICE is loaded5 K9 W* v7 ]7 a" ?
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 b2 p' Y, T. T' |6 K2 `9 l2 e" Uthere are some memory breakpoints set (dr0 to dr3) simply by reading their8 y* G9 s. V4 C! [
value (in ring0 only). Values can be manipulated and or changed as well1 @, ^- d; c. g' i  j8 O6 M/ V2 Y; X
(clearing BPMs for instance)+ ~+ W1 O$ k( o! ]. T
7 P6 `( {) a. f/ j# {8 p
__________________________________________________________________________; K$ m% s) p6 D* f  n$ T: b

! T: t$ {6 Q% D7 X1 [  aMethod 111 _+ F$ b8 F; _# @2 }; w( p1 n* l
=========
# a- v* Y& J4 o; z1 w$ w) ]" l( N2 V; h% v2 G3 m1 K
This method is most known as 'MeltICE' because it has been freely distributed: T9 ?" k5 K: W: W$ _. V% h
via www.winfiles.com. However it was first used by NuMega people to allow8 C0 R7 Y) H/ Z( q  J& x
Symbol Loader to check if SoftICE was active or not (the code is located  {9 H* R4 i/ g$ _8 L5 j  Z
inside nmtrans.dll).6 [3 J/ J3 K3 U$ L# b; _9 ]# i
' ^; \: b: l/ n: Q8 V& S
The way it works is very simple:
# r+ b3 X' l' K3 e- oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 F8 n. s5 c. C# TWinNT) with the CreateFileA API.5 k2 O) _% E6 ~- j5 Z7 S$ f- l
0 F2 U0 w9 i7 j/ X) a. A/ }! {, ]
Here is a sample (checking for 'SICE'):9 w* V+ `7 [% W5 J  z

( c6 o* x/ I& V4 |# J  F" ?BOOL IsSoftIce95Loaded(); p1 M5 R# L! r7 t- D
{8 d& \. |9 {0 y/ ?1 S, R. p
   HANDLE hFile;  ( L# f4 _$ H( D
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' T+ E/ ^$ k/ Z* Q  `
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  O% N' z7 z# @, }                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 l& h4 W# o% l: e  J. w   if( hFile != INVALID_HANDLE_VALUE )" x8 [9 ]& M+ r
   {) A) o1 x: {4 n2 V+ l& r% y
      CloseHandle(hFile);
8 g) r5 t* h4 S/ w; `, @      return TRUE;
; |% h( Y' c7 i! g0 M! F1 l   }
& S2 F+ z8 x+ q' l   return FALSE;3 U5 [  j: t/ g
}
$ i0 m, s5 D; Q/ s5 G- A3 X& B2 W  m9 U. [2 d- \4 h- a
Although this trick calls the CreateFileA function, don't even expect to be7 c* D) M! H1 t/ E: {% \/ C
able to intercept it by installing a IFS hook: it will not work, no way!7 i/ s7 l( @7 X6 n* O3 d1 ?
In fact, after the call to CreateFileA it will get through VWIN32 0x001F# Q3 h6 z( i  n6 @$ q* \  [
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
' j4 q+ r+ z# W0 w8 wand then browse the DDB list until it find the VxD and its DDB_Control_Proc
) F9 n' s/ c! f5 w& t+ qfield.
0 L' R0 E, C+ q; S& XIn fact, its purpose is not to load/unload VxDs but only to send a # z) Y1 m! V5 F& s
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)- J4 e, ^  o, s3 r# D3 ^: S7 w
to the VxD Control_Dispatch proc (how the hell a shareware soft could try/ Z5 m1 w+ _/ T( z8 a( B* E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ L! Z! q5 H8 E7 F% HIf the VxD is loaded, it will always clear eax and the Carry flag to allow
7 E0 S9 W0 n$ A% \its handle to be opened and then, will be detected.
+ u7 ~. z1 k% n2 u; u  sYou can check that simply by hooking Winice.exe control proc entry point
9 E3 L8 }) ?4 g; E/ D2 C, M8 j) fwhile running MeltICE.
8 h9 n1 N: Y% J8 M! h. T: b. d# G, C) v

2 P# E1 ^8 E. l, A  00401067:  push      00402025    ; \\.\SICE
) p9 V: I" F# u# _  0040106C:  call      CreateFileA
; c5 J5 M' a; w4 Y7 J, x& m  00401071:  cmp       eax,-001
3 W& m' O7 O* H' E8 G% ~. B  00401074:  je        004010917 l6 B7 W; M# D3 f: s

6 d$ q5 a/ a% C# p9 O) A2 ~  i) b) F& W  @0 a
There could be hundreds of BPX you could use to detect this trick.
( m0 Y, i9 g  D+ O-The most classical one is:
( ^: q/ d. f7 w4 A  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
) Z4 `, c  g; B# _0 G    *(esp-&gt;4+4)=='NTIC'
: o5 z9 Y- ~9 [
) b/ ?# |8 V9 |-The most exotic ones (could be very slooooow :-() V5 q- i5 I1 f9 F3 W
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
7 p4 R+ c2 a  [0 d: v+ O     ;will break 3 times :-(
8 `+ r# N- J0 ?7 S( w! T& B
9 \0 R) T' [9 R* F+ a  Y- K-or (a bit) faster:   {; H1 o& B4 }
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). t) r, @; S" J6 H3 R- `
# `( z9 N( \& ?: U1 W) ]. r
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 c% h1 S' A( V     ;will break 3 times :-(& L9 e0 y8 \8 J5 Y* X2 B
7 ~! g; b- j1 p- b$ e; Y% Y$ B  ]
-Much faster:9 i8 S  m3 a* W/ |
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 l, [; s& ^* k# [0 ]/ @" o' w

9 A  f: q9 U; F' |% o. w" b- ENote also that some programs (like AZPR3.00) use de old 16-bit _lopen
& B/ J6 r* @7 W" n, w8 ufunction to do the same job:
  x# x" Y" @( h4 m1 Q0 y, G9 ]9 }" ]  g0 {
   push    00                        ; OF_READ  H, H1 n- X' r0 N2 _8 I
   mov     eax,[00656634]            ; '\\.\SICE',0
2 v; `8 r/ b" b. o   push    eax
$ x3 c7 _4 f+ K" m4 M   call    KERNEL32!_lopen" x- m) Q) g& S
   inc     eax
, U: V5 H) J! X/ ~2 P   jnz     00650589                  ; detected6 M! V+ Z9 H, v$ F+ r
   push    00                        ; OF_READ
3 I' c- ^2 w5 L   mov     eax,[00656638]            ; '\\.\SICE'
! Y: y, J/ q/ y, \4 K' S5 ^' N5 a   push    eax
& g  o5 A* o7 q+ ?# n) v   call    KERNEL32!_lopen* K! T! ]: f: p# a  G2 |1 M
   inc     eax
6 b/ y6 B8 k- [: o" L   jz      006505ae                  ; not detected
; z$ C8 s8 m1 [; g
5 ]# ]" p. A5 ?( g; c" k
0 ]% [% Z% C# D$ K1 d__________________________________________________________________________
+ A8 n) W$ B. V* K% M) F  g5 w. a; D+ T6 j* d$ q( P: X0 h8 ]
Method 12
/ G8 }! z' F% X" v5 S=========
* a6 s4 ~/ d2 W& z9 B
% B, V# V: b; D: ]& ~$ S5 eThis trick is similar to int41h/4fh Debugger installation check (code 05; g# S( V4 w# O+ i# }) }
&amp; 06) but very limited because it's only available for Win95/98 (not NT)6 x9 E  g2 E, Y4 V
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ p9 F. Z+ F, ^1 t; j6 H
$ P% n! i. I4 f
   push  0000004fh         ; function 4fh
8 O9 P9 L4 n) Y4 v1 O   push  002a002ah         ; high word specifies which VxD (VWIN32)% _* y* u. {) |) m! v0 h7 d& o; Z; \
                           ; low word specifies which service
0 O9 H; p! k$ u( J) _4 ~7 D                             (VWIN32_Int41Dispatch)
6 Q$ G. ]. y8 Q1 g   call  Kernel32!ORD_001  ; VxdCall
1 C+ Q: f( W. q# g$ m3 U* y   cmp   ax, 0f386h        ; magic number returned by system debuggers! N# x+ u5 U" T3 j: X% M, J
   jz    SoftICE_detected+ f2 P' z2 Y% P3 {

7 m, r; J/ `" vHere again, several ways to detect it:
: o! e+ G' K4 `# i9 ]1 }3 p7 W2 [7 P+ I2 g0 D9 K
    BPINT 41 if ax==4f, g# `+ q" c5 A  E8 ?

4 q" U( c/ C, Y8 m    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: T# B+ h$ T! u+ x' g2 z5 N" i. u+ W: r5 k  i
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
  p3 y" m  H/ z( s' r1 p+ ~1 {: Y
. f, l1 p- T; a    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!$ S) x" k$ P0 D% S# w6 F8 O

- t/ N, _* L1 R$ O# h* M& F__________________________________________________________________________
2 `0 H& _$ k2 Q: y. }- K9 C7 p0 Q: z. \0 C% @# P
Method 13
9 Y$ ^0 \5 ^4 e" i  H=========- s9 E+ Q% }2 c$ z3 y
/ R- K; K& k9 T9 ?$ u
Not a real method of detection, but a good way to know if SoftICE is
+ @  s: q$ O. `- K  v5 C+ Sinstalled on a computer and to locate its installation directory.2 b& x$ R+ J. e
It is used by few softs which access the following registry keys (usually #2) :  E9 c0 e5 C5 r- g
* L, c5 L5 R6 |! n+ U
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% d3 r+ K6 s$ M* x+ |$ w\Uninstall\SoftICE2 B! u9 m+ F7 E: P, H/ j" T
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE0 Q. d( a' w( H; w1 g  L/ O& M- F
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& q5 n1 H$ ?5 T7 `$ N\App Paths\Loader32.Exe
8 N. S# V0 Y( u, q5 f* D) k; P
  C5 G- I0 ~4 N  B2 H( {3 F0 G  b9 i! s6 `
Note that some nasty apps could then erase all files from SoftICE directory
# {0 Q  t2 A) n9 D" h4 [(I faced that once :-(( j: W5 [* x" p7 T7 i+ u9 N
  `" T# a& m: ?6 b! w& j
Useful breakpoint to detect it:  I0 x. I/ g' a" p
* Z% [. e; o1 i* R) [( N# e
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'( f- D$ M2 o" j/ A* q! G- R$ ]; A* Q

7 G$ U, J" p1 H2 r3 B4 o! @% p__________________________________________________________________________- q$ e$ o* m) d7 a

+ M$ T* U9 t3 d( D7 }4 O4 ^0 M1 A0 d
Method 14
" T  V  F: ]- x# I2 v& |; p=========$ \7 v3 l! S' h' a$ i( A
+ H5 c- V) _9 v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% i8 }; B% i6 e% f* `6 P
is to determines whether a debugger is running on your system (ring0 only)./ F7 b) D5 b: X  b5 u4 E; S& R

2 Z4 H. B$ u4 l# ^" G' b* w   VMMCall Test_Debug_Installed! h  S- l- D6 e' v9 D8 l$ u4 p
   je      not_installed# U2 f5 N( N) T: Y
/ ^* G) U1 D6 A! h2 w5 x
This service just checks a flag.: Y, O/ x8 Q& X6 X
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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