About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; ]1 q- L# m+ k  v) }; T7 D' n4 I<TBODY>0 X: _  ^+ I( y9 H2 A" o: v
<TR>
% p$ T' n5 k8 w  R9 A<TD><PRE>Method 01
  S+ _" k3 E8 X. P7 S6 ~) K0 D=========, E& u8 C. c: \5 }# j
8 n7 L* ~3 u8 J) Y, H
This method of detection of SoftICE (as well as the following one) is0 D* l8 y' K/ C
used by the majority of packers/encryptors found on Internet.
) @, I1 X$ q" _6 h8 VIt seeks the signature of BoundsChecker in SoftICE
* }$ Y  L, ~  |0 x9 ^  g7 }" B8 Q  q
    mov     ebp, 04243484Bh        ; 'BCHK', B2 |6 K6 D/ @5 S
    mov     ax, 04h/ v- z2 ^6 s. N* B
    int     3      
  [0 Z# Y% D5 ]2 I    cmp     al,4
6 Q- F0 v* \2 B6 X3 E2 a2 C( D- i    jnz     SoftICE_Detected
. u: J7 t# u6 V' a% J) d( \  m2 W$ @( [7 A0 `5 c' ]
___________________________________________________________________________4 K0 G' d# i( n4 W4 x$ X

; D: {" Y* K5 lMethod 02
7 n& e, j# |/ J2 W! w=========
) t- u$ G4 q; c; E% t, E& Q1 R. P' g1 Q. @( R) M
Still a method very much used (perhaps the most frequent one).  It is used  j, c" N( G4 g* _% L! ?* h4 x& F: {
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 _& K3 [! W& `  l/ _or execute SoftICE commands..." i! L1 k% H+ ^- v6 o
It is also used to crash SoftICE and to force it to execute any commands
3 _# y+ L; y3 L; C(HBOOT...) :-((  
$ o$ V4 p) O- T; O& ]" R/ V9 ^/ T* g# ]- [7 G
Here is a quick description:4 g) a. g) k9 I( d4 S$ ^+ S
-AX = 0910h   (Display string in SIce windows)
* S0 A3 w. b+ \& g9 s-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" S; ^' g/ Y8 E# P8 Q# A$ Y0 ~3 U-AX = 0912h   (Get breakpoint infos)
4 m- A. M; o8 B+ Q$ x-AX = 0913h   (Set Sice breakpoints)
* p' c& g3 o5 X, ~/ R+ g  Z1 T& o-AX = 0914h   (Remove SIce breakoints)
8 ?7 L  G# k$ {) a7 y1 B( J3 y. x3 R- s# V: |! _) F
Each time you'll meet this trick, you'll see:
6 U& C  F( R( T; G-SI = 4647h
3 U0 h9 O3 u' ?# @. I-DI = 4A4Dh
, O5 ?5 A1 V% U4 @Which are the 'magic values' used by SoftIce.: E" h9 k' O& Y# q1 k3 R! \: @
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
' B0 C+ d7 H9 z' b$ P9 ~& d/ `' D$ P0 g
Here is one example from the file "Haspinst.exe" which is the dongle HASP
# E4 M" q: C  kEnvelope utility use to protect DOS applications:
9 J' t$ @' P( ~
0 H9 V" f( O8 L8 I! \, j1 e8 e# t) A8 m& X$ C- E
4C19:0095   MOV    AX,0911  ; execute command.
. X5 b0 [4 T; v; j' w+ M" a4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" I4 p' _1 _! S& w4C19:009A   MOV    SI,4647  ; 1st magic value.
1 p$ V1 G  i" B) _' {7 G4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 [. p$ s" A8 m/ d
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
( m5 ~! f. K3 ^4 l1 d- k0 Q; ^4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 X4 c' c* [$ Y) j+ c2 o
4C19:00A4   INC    CX- c' j+ V+ T; ?0 N  U) g3 V% T3 `
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. E0 T* R$ X8 S: M2 Z* F. L- y, Y
4C19:00A8   JB     0095     ; 6 different commands.: l* R6 K" q0 `4 p9 C
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
" Y" ~, @7 V5 P0 `7 K6 U( H4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: V) v7 {& P) D( @' }5 l) q3 h% i. G" F  `9 \. X
The program will execute 6 different SIce commands located at ds:dx, which
: }6 J% M! E$ d- u. v& m) z# aare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.+ F' R( h8 a7 B' r' L8 }

1 v7 Z0 w, N( }: f4 w2 c$ [8 ^1 e* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; \' s+ t6 _. g* s/ b___________________________________________________________________________- j$ [9 ~- I# T/ n: L, Y# s+ v

( W& }7 ~  _) [! Q8 @2 Q% n+ I, K" i3 M; t+ m: C" [9 D
Method 03
" t5 J* g" C. g! Q" g$ o9 f=========' c0 u2 C5 w' [! j8 l3 H% i2 t, y( \
. G+ F- o3 y' k5 N$ E9 e/ ^
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# I1 N0 g& W- J7 N8 e" f; j2 g(API Get entry point), M" a# a6 |5 x1 c
        0 t, M, i3 y: h, a) C
+ n( l1 D1 a7 X; _
    xor     di,di
, B) B1 n% f* F) R; ^3 g' _/ G& `6 f    mov     es,di, k  J0 s- O% y% Z, H  l' w
    mov     ax, 1684h      
. r; e7 |: ?; X: @% g7 G  S5 Y3 }, x    mov     bx, 0202h       ; VxD ID of winice9 V) [: ]2 h. {' t5 \
    int     2Fh7 M& F9 }+ T5 d* L- `6 Y0 j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- O' ~+ h& Y0 j, h  q* a( K    add     ax, di
5 E1 r/ G) h! x: [" t1 o3 \  `# m6 f    test    ax,ax
& h; @6 I3 i& o7 |8 R) [- f' ~! c    jnz     SoftICE_Detected
" T/ K% ?& R% R2 }( Q! [4 G. e( a  s
___________________________________________________________________________
# N6 l7 `+ I; Z* Z. h! k8 M1 F
% w& O9 s( @. y9 ?Method 04, c! C2 P9 Q3 i
=========( n- P) X) \" Q

) Q7 d  G: d2 U0 d6 a" H$ j/ ?Method identical to the preceding one except that it seeks the ID of SoftICE3 G8 e  f* }5 u6 H- x) U
GFX VxD.! V2 U$ R: T$ G
, W0 n9 e# G1 G# k) J- z7 Q$ L
    xor     di,di
8 v2 p& f) U2 [/ m/ ?4 d    mov     es,di
" z# a) P. [+ i    mov     ax, 1684h       ! }* ]7 s, }7 T" e
    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ Q$ U4 g3 ]+ K- G$ M
    int     2fh, Y* v! @0 u+ w% N# {) y1 q. [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% \/ r& |. Y: b6 z
    add     ax, di& l7 ~6 f) D- \6 m" W0 _  m: n
    test    ax,ax+ d% `' E+ F. ^: f* t0 u; t1 p
    jnz     SoftICE_Detected
" ]  W2 N: w" O7 M) T+ i$ F1 R( g$ N& R5 Z; I  A
__________________________________________________________________________
  _6 ~& Q( s9 \1 v( `7 C
" g2 O, l6 \. t
1 R6 W# ^" z; N9 N5 h% YMethod 05
- Y5 g% D* E+ G0 G; h+ A. B0 Z=========
) `  {, X9 _* z$ N" @. _4 Q: o; E8 w0 L' n
Method seeking the 'magic number' 0F386h returned (in ax) by all system
* _) Y  r6 Y, q" F- h: Kdebugger. It calls the int 41h, function 4Fh.
! j: v/ `% t9 [; XThere are several alternatives.  
( d6 T0 r8 X: I' I; M
, d4 z/ |4 |  i1 V' I" }5 ^The following one is the simplest:9 a3 ]: @( c' L- _
% g$ u% |5 P+ a" m* N& Z
    mov     ax,4fh
' e' a* v# d! x6 E    int     41h
) t( ^/ C1 |, z, }1 c" a2 Z) {    cmp     ax, 0F386$ Q) X1 [; R" o7 J
    jz      SoftICE_detected/ L& u; Q+ f2 P, Z
: y% m9 c" Q# O! q
* D5 s& g0 J5 n  ^3 q
Next method as well as the following one are 2 examples from Stone's
! W( p$ x# b7 W"stn-wid.zip" (www.cracking.net):. b0 ?' F. ]" d4 ]! D0 L' s3 @
" T  s- s% q7 W. \% ?  c
    mov     bx, cs
6 E2 }' T1 V) B8 t2 T1 S    lea     dx, int41handler2
3 h' h% [7 o8 L, p4 n0 z    xchg    dx, es:[41h*4]
9 _8 o0 G0 d* o  s2 c/ [% B    xchg    bx, es:[41h*4+2]
9 f6 Y/ ?! P% R( S6 k# Y$ |  o    mov     ax,4fh
& K' N$ n# l! _5 i    int     41h& S$ z8 l% @5 V
    xchg    dx, es:[41h*4]" B6 ~7 B0 b& N$ V9 g
    xchg    bx, es:[41h*4+2]2 G/ C4 _3 r4 d0 p8 G3 k: q, D
    cmp     ax, 0f386h
+ z; e" Q: |9 ]8 i, S    jz      SoftICE_detected4 ~8 p& \! F( W1 o8 M
; s! m, r5 x4 @
int41handler2 PROC
. G" [; B9 K; ^& x, ?    iret# m6 s% D1 x8 U" E0 }  V
int41handler2 ENDP
5 I" T2 J- W% V+ }2 ^& M- F' i! D+ p6 P; n  P
0 w2 E& _! f* J! o! K! `
_________________________________________________________________________: ^8 V9 B# c' e8 d2 `! i4 S; ?

! i! q2 g3 o+ }1 I, b7 ]( i
% b' K( V! n% EMethod 069 E. D3 C, Z) l
=========  [. L: G+ v6 x" H6 S7 k' X3 ^

8 C8 v5 T" ]! g
; X# {" j3 K. q6 @' h# u2nd method similar to the preceding one but more difficult to detect:- H% x3 }4 j% \0 _8 h+ q+ v$ T1 R
) b1 v( [0 U3 C5 Y0 b) }' v
3 b; }. q% C. m5 ]
int41handler PROC+ r+ c9 ^) K; ]# w- ?. _+ {
    mov     cl,al2 Y4 f' U1 }' H7 R% r- y6 l2 k% t
    iret
/ [/ P: G! ]6 G4 T$ j) cint41handler ENDP
4 @7 o( F6 `/ Q3 l; ~* z, h6 B# A- `8 a( y) Q2 [8 e5 M

% W: b- T9 n, j" F    xor     ax,ax9 X8 ]  q* b: `9 |, o- Z( P  x! F  y
    mov     es,ax
) g* S1 T& \; a1 ?    mov     bx, cs
! L% L( ~7 a/ s7 p( G; h9 p4 Z3 A    lea     dx, int41handler9 f0 h. A6 B* C
    xchg    dx, es:[41h*4]: {1 t( ~. m, }: \: _$ Y2 J
    xchg    bx, es:[41h*4+2]0 k+ K$ D  t& W& K# I' Z
    in      al, 40h, l8 X# Q9 e6 d8 T8 i( Z
    xor     cx,cx" w1 f4 W2 b+ L
    int     41h
" Z0 C3 R: @: y: X    xchg    dx, es:[41h*4]4 d; j) [: j2 Q
    xchg    bx, es:[41h*4+2]0 Z% C" @# z5 \) A! {0 {
    cmp     cl,al& I  v! Z, e" A9 Y# o
    jnz     SoftICE_detected
. U# I- g* K5 I- M8 s5 _' N, V/ w# e
_________________________________________________________________________, t: V2 k- w+ Q

; \- D3 Z! d' b6 ~# g. G3 gMethod 07
# ^) X# s- ~9 z$ K8 M=========0 U& F: O# x; l

# q+ G% ]- Y9 j$ I) q" G. dMethod of detection of the WinICE handler in the int68h (V86)& G) z* ?3 S, q" n+ B

' z4 N2 v; L, V0 ?6 N: u# W/ ^- S/ Y    mov     ah,43h8 K9 a" @1 [+ |9 x! c- C
    int     68h
: ?- R' k- x( w3 h2 C/ D7 B    cmp     ax,0F386h
" b6 A8 F/ k* U  k    jz      SoftICE_Detected
7 z+ E$ b, D6 l/ @/ o+ R' s
! q5 Q! |7 q, q, a, ?9 T- }5 D/ x* T# o! k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 x% t2 I0 c$ S+ v9 w- @% ~6 H
   app like this:+ n! j2 k2 w( _
$ J8 [* {0 J$ J0 I" Y- T
   BPX exec_int if ax==68/ C7 N7 r' {4 R
   (function called is located at byte ptr [ebp+1Dh] and client eip is: r. m( ^6 \% g+ E3 Z/ U
   located at [ebp+48h] for 32Bit apps)
0 P! k0 `1 d7 o& `__________________________________________________________________________8 L/ `+ P  E! E( B9 e5 G

$ O1 L! U/ s  e- N* U+ Y
( @6 k1 c% J) |Method 082 A" k+ r: g. g" a) D1 o; [8 ?
=========4 L9 ^6 w# n. E5 ~6 U7 B
; p. p9 v' H- }4 h9 T  U( j/ D
It is not a method of detection of SoftICE but a possibility to crash the/ W( {, I; S4 \
system by intercepting int 01h and int 03h and redirecting them to another5 m9 x- W3 T4 S* X
routine.
4 h/ \2 ?# o! B2 x, {- ~# [It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 G( P. ~; C* @2 A, B  s/ D
to the new routine to execute (hangs computer...)9 W+ d8 `2 P  v! H

5 v" Z1 ?7 j; c/ J: c9 A; c" L    mov     ah, 25h
& j; z# y- ]% E    mov     al, Int_Number (01h or 03h)
% u4 h( E5 N) |+ m8 m    mov     dx, offset New_Int_Routine1 r' C8 A  r9 t8 D% Z& Z0 s
    int     21h
( }4 j2 D8 v( v: @: \5 Z" \3 j4 P/ e0 l0 P) `9 o8 `
__________________________________________________________________________  D, ^8 N' v' L9 O8 Y6 M

* ?: o  V3 ]( W# A+ kMethod 09
% `; n) Q% d. {2 f* ~  G2 x=========1 m  O7 V2 J6 o1 N  {

0 k% y/ v& u8 ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; u, n$ c: E  s- ^! C6 Operformed in ring0 (VxD or a ring3 app using the VxdCall).
5 M  z& a( o- p; wThe Get_DDB service is used to determine whether or not a VxD is installed9 q# e( g& j6 p
for the specified device and returns a Device Description Block (in ecx) for. Y: W$ ^, X1 `0 Z) V, e- o  m
that device if it is installed./ Z5 k) j- o+ }4 b; c
8 z5 W5 T" t3 J4 }7 s* h
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! Z9 C5 Q  p% W   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 h' H9 e! _) s* `: B  g1 P2 A# m" g
   VMMCall Get_DDB
- f, s, K7 y* s; |+ k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( o! x. N" j+ C( ]8 m- n  N4 d- B3 f! w* V1 ^0 e
Note as well that you can easily detect this method with SoftICE:9 K( k% s# g/ [$ H1 m( e
   bpx Get_DDB if ax==0202 || ax==7a5fh
( J& X( Z( P  e! L; n
7 g  j) ]% P& \5 V# u) z3 z__________________________________________________________________________9 @( `1 _. n" F, \1 [: T6 f% K, N
6 |( p6 w+ X7 A. `  T, O
Method 10
& Q, d2 O2 |0 l* T1 ]$ j8 R=========
: u1 c* N4 H7 w* S! B) P0 r
. p) o) `) J9 Y0 t2 _7 h  L=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 m! U6 S& F6 P5 b9 j8 n8 |  SoftICE while the option is enable!!
; F) j# e8 ?- u: q  Q. Z0 V  ?5 A1 j6 \3 O; F% N8 E
This trick is very efficient:- }& k1 L& i7 a! h8 h
by checking the Debug Registers, you can detect if SoftICE is loaded
0 ]  w/ z2 \* Y; E* u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
; l& ^/ u# B# g1 G7 |0 Xthere are some memory breakpoints set (dr0 to dr3) simply by reading their
- q& L/ E; @) m: ivalue (in ring0 only). Values can be manipulated and or changed as well
3 q* |( T7 c: X: U: X(clearing BPMs for instance)/ [3 D* @" G# ?9 k/ e$ g

( Y5 k! `- A7 ~! M__________________________________________________________________________
8 s0 H4 q$ z, h  [' {/ R# O( `/ n0 v- C/ y
Method 112 a. }& s/ c. Y. P
=========
; h  f! e+ Q( X* p3 Q2 r9 ~+ Y+ J# A  p& ^- i1 ^" K+ m
This method is most known as 'MeltICE' because it has been freely distributed" e3 d: a5 P% @, s1 T
via www.winfiles.com. However it was first used by NuMega people to allow
5 S' e- {& K: g' }: {: D' C0 rSymbol Loader to check if SoftICE was active or not (the code is located# {+ h: D- ]  P# p0 J$ }) {4 o
inside nmtrans.dll).# w+ r! S- g9 X' `) j6 K+ O

( x# o( o4 p9 N- gThe way it works is very simple:
4 y1 t, Y+ o/ EIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) Y/ f  I+ ~: HWinNT) with the CreateFileA API.4 H! a, z; U8 J

3 b8 z" C, r3 pHere is a sample (checking for 'SICE'):
0 B% X1 D1 W# L& F  F$ J  u, e- ?! m3 B3 P5 V  f
BOOL IsSoftIce95Loaded()$ Y/ ^* s3 [/ I* c) y' _0 E# t
{# \5 T5 [/ K6 c" p0 [, O
   HANDLE hFile;  & I( l' N6 |* f# U4 O/ H% S' o
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 a" q5 I# ]$ L1 E9 e                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& k! @/ H0 d3 I( T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& E; O8 j% n; D0 J4 c
   if( hFile != INVALID_HANDLE_VALUE )
8 k6 @; ?/ c9 }   {- f! q: R6 `7 d* q
      CloseHandle(hFile);; p! |5 Y) _9 h. s7 O( e
      return TRUE;, h1 B3 ~; R# D) ]
   }  e+ r" U' x" `/ {
   return FALSE;
3 e/ W5 N8 L7 X0 O- ~+ R" }}
! X+ D: W) y2 U) f) M6 A: L$ I8 p! G$ Q( s; S/ N
Although this trick calls the CreateFileA function, don't even expect to be# W2 c6 k. V0 x; \, `. ]
able to intercept it by installing a IFS hook: it will not work, no way!
8 o  H& ^4 o' @# l2 @. tIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
' W( N; V. C' v' aservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ A& F6 C: Y) ^. b0 N0 pand then browse the DDB list until it find the VxD and its DDB_Control_Proc
  r& I+ L" @* E  Jfield.
; U! e5 b8 {& G5 o' z  Z, r8 @In fact, its purpose is not to load/unload VxDs but only to send a
! f: U& U  }+ a: C7 R. J; DW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ z; u* M9 g0 M! Q; J4 q& n- R" j
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 h- g8 B8 v( N1 T* A3 j; q. Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).
' z* A6 A# w7 a& M, V( [: UIf the VxD is loaded, it will always clear eax and the Carry flag to allow
/ o% T1 v9 n( Tits handle to be opened and then, will be detected.* @; |/ S8 ?( ?9 G1 T. U
You can check that simply by hooking Winice.exe control proc entry point- o5 u8 J" w. E  t: P1 z* {
while running MeltICE.
6 d0 V2 ~/ L1 C) [: u. a- [& Y: E5 N) o1 p5 M

- V' b" o  o/ E& P4 o0 ?( ]  00401067:  push      00402025    ; \\.\SICE" P: p! c* i, l- c% [! K) p  X6 u
  0040106C:  call      CreateFileA
, l' {/ [+ C' H" B; u1 k  00401071:  cmp       eax,-001' w7 F+ K. R7 d8 _$ d
  00401074:  je        00401091
9 q0 d4 a( `$ C' \& i2 ~2 f8 V" n, A5 ?, c$ y* y) O+ m5 ?: n
9 [5 Z6 y" T2 b/ z0 U1 ~9 z
There could be hundreds of BPX you could use to detect this trick.) h0 d8 l0 ?: U  ?
-The most classical one is:
8 U: K0 i  y. j7 v0 N, c' }$ d9 Q  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 n  a) ^9 K& ?: B9 Y  \" w$ n    *(esp-&gt;4+4)=='NTIC'
" \) ^. T! K' Q& ^7 N+ }3 f6 e; K$ k+ C2 h& o# U# v$ J5 F* a+ N
-The most exotic ones (could be very slooooow :-(
, W. G( d1 V& a   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . I  j, r+ s* Q- G$ u
     ;will break 3 times :-(% l5 c/ i. L0 e7 O
# @- P7 f: f* w- n, Z
-or (a bit) faster: 5 q3 {0 I) m! ^5 L4 L9 x
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 q# W% J8 ?5 y5 u7 }6 Y
+ y/ N. m) G4 l" v6 d9 J
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 c/ h4 L  N& h4 Z; P) q1 _     ;will break 3 times :-(
1 T  w/ u- Y. v( I8 k( P* _1 r; v6 @# E$ S' A
-Much faster:2 D( |  G, A1 ~. _. P3 q% w2 C5 Y+ g
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 O( l8 c4 u/ e3 J

6 Z+ }: Q6 v( c0 I3 Q& `Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 m# Q5 F, j% I: _function to do the same job:
2 N( Y' N1 p& _6 L8 O" q/ l3 U0 T6 n$ c
9 ~$ s. z. S! w: ?8 w" d* l   push    00                        ; OF_READ
; I# j/ B9 A3 ?$ R7 I, N5 s: \   mov     eax,[00656634]            ; '\\.\SICE',03 H  K/ e; l8 Q/ z
   push    eax2 a' w" ~% Q, D2 Z) C/ y
   call    KERNEL32!_lopen8 y; k" n# d6 T! A
   inc     eax
" }3 s: `/ F/ C  w4 J4 a   jnz     00650589                  ; detected0 q3 s( U9 ?7 q: o
   push    00                        ; OF_READ
6 n6 m  X1 @8 S   mov     eax,[00656638]            ; '\\.\SICE'
$ O2 d3 u6 `1 I, J5 r9 u5 v3 t   push    eax
* [8 x, u+ }: i& Q" D5 K' x- |& l   call    KERNEL32!_lopen9 {8 m) {/ V( {, B2 O3 g5 T+ {
   inc     eax
  G: x: D* P& ~( s0 w6 J   jz      006505ae                  ; not detected
+ G% m- w" E7 P! c- `" R* M) e  D7 |5 ^4 d; y/ J- i3 J' z

( d% d, `. _* u+ A+ V, l5 m0 j__________________________________________________________________________! G  G: h" C" J1 \8 w7 w
& k# C/ B' t$ i0 L) F2 _6 A% T
Method 12+ U! N5 T7 |  t2 K& l
=========; k% ~3 o8 u/ `: V5 E5 \, j

  U) c- I. K. f6 `0 wThis trick is similar to int41h/4fh Debugger installation check (code 050 I9 k  o4 t6 z+ D. q9 H: s
&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 a; H* l0 r$ F3 Z5 a7 B2 k; b' E
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
' s9 Q+ ~( R1 _* P% L9 Z2 Q+ e  {! `
   push  0000004fh         ; function 4fh
( W9 p, U2 p3 Z' [   push  002a002ah         ; high word specifies which VxD (VWIN32)( F& c" M: m- H0 X' ?# x6 J7 y, n- }
                           ; low word specifies which service4 W8 b( C0 S6 B4 w" h' X
                             (VWIN32_Int41Dispatch)7 j. g; J; C6 {3 h3 P, x7 A
   call  Kernel32!ORD_001  ; VxdCall2 z6 z+ t: H( L; B+ q, N6 [, s
   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ O8 O( Z1 W4 ~   jz    SoftICE_detected
/ G0 m6 K2 |! s' }
# j0 X9 _' ~5 N7 b1 l1 rHere again, several ways to detect it:
! n0 T* `4 M; j
1 B/ d# c' S$ m+ a  Z. L    BPINT 41 if ax==4f* u8 V5 l! l! c, c; l: ^

5 _, ^; I5 o- }4 f6 @0 U    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* Z, m7 \" k; C/ ~/ p; X4 W+ ^: q, x7 d+ ?* t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) N& Z: v7 ?, t$ [/ E2 K4 L; n. l
/ q( n5 [* L3 c$ @, x
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( z* d' w! q+ H- J+ r1 d

! J/ o! L5 D. _8 {__________________________________________________________________________5 @; J9 v# b- I0 o- V' t
' f# c) z* J4 T7 M6 ~% s8 T
Method 13% H8 _0 y- h$ V" b
=========9 H' H# D" X. k! H2 L
/ f/ @' S+ p# T( \/ @1 _
Not a real method of detection, but a good way to know if SoftICE is
7 j. _' e7 v  }: Xinstalled on a computer and to locate its installation directory.
8 \( _. a0 r6 ZIt is used by few softs which access the following registry keys (usually #2) :0 m( R; t0 r3 _% {" y, U, V$ a

2 o* @1 M) B, _-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ h$ q! x% Y+ ~$ S8 N1 m
\Uninstall\SoftICE& `& m* G+ L. Y5 i. a
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& B- J: h" q$ i0 v/ v0 q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) @4 K/ W) b, t8 t  W8 {\App Paths\Loader32.Exe
' _3 P( ^! [: h
' c/ e8 O7 [& K
/ N% d- H/ ~- j9 x2 INote that some nasty apps could then erase all files from SoftICE directory
5 U  v7 W% K2 U(I faced that once :-(
' R- C2 D( `) i. \2 s7 p/ h
% c1 N- \. S$ k, m  @; sUseful breakpoint to detect it:. R( \' A7 p# T$ s

( d& V# C" G) }# \8 X# l2 Z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" L4 G% G3 `$ b5 A1 t( b: h8 W6 F3 b
__________________________________________________________________________
( D6 g- X# R1 U3 {9 `. ?6 \1 L
  K; X; ^. @0 i* e! i7 j& a* N; g
; S% Y3 I) R/ E7 D) [% `2 h6 bMethod 14
9 D$ u( c. n; Y' U=========/ n- e  t" x3 L
& t' D: U8 k- |7 \( B. g
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 B. u# B# c1 }! ?9 j" O0 qis to determines whether a debugger is running on your system (ring0 only).
2 ?5 G- z; [6 O2 G
" L, l" X- {2 p+ s( O' G4 Y   VMMCall Test_Debug_Installed3 S' U. v' E/ U# T7 E
   je      not_installed# e: \- p" ?( i

, T; ]5 P( \& i5 s6 n  \5 i: R7 TThis service just checks a flag.4 N3 e0 r0 K+ }
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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