About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
- ^4 H: d7 d$ Z' I" X6 c<TBODY>
0 U+ M. j8 k" l& D1 x! `, [1 H<TR>
' O/ e! h8 x6 @, i$ F  `  Y<TD><PRE>Method 01
) r9 [" X) E" W) a% S  `=========
8 j8 P4 U2 o: V! n( v
) t! k, i  D  W% Q8 q# ~This method of detection of SoftICE (as well as the following one) is9 G/ q4 ]- [0 t  [
used by the majority of packers/encryptors found on Internet.9 c, P! f# W) X" [' s$ h6 ^& C5 J. K  r
It seeks the signature of BoundsChecker in SoftICE- b; L, E1 R# p, T5 \0 a" C

% I4 a6 j$ W. R" a2 O' H( r    mov     ebp, 04243484Bh        ; 'BCHK'* w. D7 o3 ~' j5 h1 u# Z
    mov     ax, 04h# G3 @3 C% |4 {) \
    int     3       " l# C2 Z/ S& Q! |
    cmp     al,4+ R1 N- c4 p/ R7 i2 v
    jnz     SoftICE_Detected
4 l! w+ R4 E+ Y4 [: P( ^, l* x# J" P1 ]: S) t
___________________________________________________________________________
: L4 |4 a* s# y% p$ x
4 r% f- m; f% AMethod 02( b" h/ p( Z. F. R# g+ ?; J/ ?
=========
8 F5 r. X* ~4 r  y/ D
1 K: r2 u) C' {Still a method very much used (perhaps the most frequent one).  It is used
& ~( K9 G! n1 a6 y6 _to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) F' E4 t% b( `/ a) F1 e/ por execute SoftICE commands...- o' _  U2 v; _4 j5 r
It is also used to crash SoftICE and to force it to execute any commands) ]' G) x8 f8 c0 U6 V$ k) u  h& \
(HBOOT...) :-((  ! t9 d- E+ n0 |! @+ ]

# q( J6 y4 g; L( K& r& H" dHere is a quick description:
( v6 K% I2 h$ `, d( R  A% z' R-AX = 0910h   (Display string in SIce windows)) Z. c% R2 j. r
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& \9 e- X$ w+ n' T! `" m. t& Y6 l-AX = 0912h   (Get breakpoint infos)  E* b2 W% ^6 \7 a; u+ d! g
-AX = 0913h   (Set Sice breakpoints)
, r+ v( y2 ]8 e5 ^-AX = 0914h   (Remove SIce breakoints)
0 T" \1 O7 W0 d" g9 E& g) k$ |
) ^% s2 S5 j6 W9 i" rEach time you'll meet this trick, you'll see:) G. y* w: [7 P6 O
-SI = 4647h
$ }( U/ B9 x, R  G# B-DI = 4A4Dh) ?, j, y' b& }
Which are the 'magic values' used by SoftIce.
2 E( ^+ r/ E) q2 H( I/ H: KFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
+ r& p3 U' X+ c0 x1 ~+ t9 \
( i; x9 F$ `+ a% F  J+ x& ?( o* THere is one example from the file "Haspinst.exe" which is the dongle HASP/ I, `3 F5 g3 f+ K4 @9 Y8 r
Envelope utility use to protect DOS applications:
* b; o$ H9 u# ^, D( S4 E
! n& _5 _, Y. j' w1 r# @0 _  N6 h& z/ t
, M! q& M3 g/ C+ C; w4C19:0095   MOV    AX,0911  ; execute command.
; _. ]7 Y( w  y3 L$ s2 e7 G4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 @( `  M0 E* v+ t# h
4C19:009A   MOV    SI,4647  ; 1st magic value." ^" P: N6 ?: l% m
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 Q) D, g( t. T! c# e
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ u" B9 Z+ t5 S  z4 L- }- k: m4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute; G. f/ N6 \3 a2 G0 T" a' U, M3 X
4C19:00A4   INC    CX6 r& y# Z0 |1 i! q4 W5 r1 f. y# J3 @
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' {2 I+ O0 s& I
4C19:00A8   JB     0095     ; 6 different commands.% N$ L4 k, w: B
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 h' p9 c  H, g4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 \. k/ ?) i9 ~& ~
" F( [0 X! U+ i0 W2 ?. }$ m
The program will execute 6 different SIce commands located at ds:dx, which9 M4 E6 h4 t$ d) a
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- h) j0 s" j! r, H; E. s# R% `5 [# b/ g
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ m. k, Z* J7 d___________________________________________________________________________" J5 W6 O; b  x9 l; ^5 q- T

/ r2 i' k% E2 U! D) u3 L! i5 D# S1 f# a# d1 L$ X% N
Method 031 K& l/ u  h* C& h- }
=========
0 |/ `2 f: B3 b2 s2 h; y: @8 q! A# {8 j: j# O  A
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) d. [0 K- g- ]$ [$ z
(API Get entry point): c5 t$ A7 B9 _9 p
        
# k$ V9 T9 B6 M; b; K, ^" x' e1 i, j. v
    xor     di,di! b5 L& \! g/ ~; `! f0 F
    mov     es,di  O7 |  z! ?0 w4 v- X, O, i
    mov     ax, 1684h       # S. |9 l3 Q1 ^- s, Y
    mov     bx, 0202h       ; VxD ID of winice7 W3 ?/ K* |* t! ~8 L
    int     2Fh  C4 k! ~- A$ @; j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* K7 X9 ~0 @" t  k, U$ e. m' A9 Z3 h$ Y
    add     ax, di. V( z9 X6 R( ?. F4 a* j
    test    ax,ax
5 @0 _' k0 c( V0 C! K# l6 [    jnz     SoftICE_Detected
. [" A; \8 c  o! C) K$ l, A0 _, l  d+ \; |' n/ R% q2 D
___________________________________________________________________________
. m* ]% f* B; A6 }3 J) M" i% c& S
' K3 D( F, P4 N! c4 E' o- R. ~Method 04
! j/ ?- t& q# j; d: \=========  U1 U2 F; Q! p6 i
$ I9 D; F0 K, p% `6 Q' z; H
Method identical to the preceding one except that it seeks the ID of SoftICE% ], ~5 B2 V# v8 X
GFX VxD./ q$ m+ |6 @( J6 K) ?! G

- o: ^8 o+ J3 x  u    xor     di,di' E! |7 R, ?: i* x+ Q( t- M8 g
    mov     es,di6 S7 i7 \  Z3 ]
    mov     ax, 1684h       5 U7 Z  w! {# Q+ e7 a
    mov     bx, 7a5Fh       ; VxD ID of SIWVID; b( {: \/ F4 t+ \: q& X7 R
    int     2fh$ ]$ Z4 ~) K. Z# H! T$ l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 z% W! E8 h% T" d* Q1 y
    add     ax, di/ Q* Y' E8 q4 t
    test    ax,ax. S- W9 i" @4 n5 o5 j
    jnz     SoftICE_Detected
) w. I1 i4 J1 Y7 t: Z: i, Q: K+ ^' e/ g: O1 [+ [- R$ C, \- F- B% j
__________________________________________________________________________& D7 q/ C5 ?) [# g3 ~& N

- O  f4 N- v6 r3 p  f/ S4 l* A  ?/ d5 o1 e' V% ?( b! u& {7 t/ p8 l8 I
Method 05
% E" I5 d: n5 I1 L9 @=========
7 x( I( s7 }* c5 @' r/ h
( h  i) x$ W5 `9 R: j' R4 c. K# h+ QMethod seeking the 'magic number' 0F386h returned (in ax) by all system4 B5 c: R! l- V* c; K' k; _
debugger. It calls the int 41h, function 4Fh.
$ K. y' {) ^' N% j4 [' ]There are several alternatives.  5 I' M1 i/ A$ b' j# [9 s7 d; m

! c% Z( Y7 t# |" z  hThe following one is the simplest:
: Q; ]% O. X5 x# H" O5 i( t. e' d1 x2 M$ L- V) |
    mov     ax,4fh
4 Y6 [/ K! L+ ?& F" O    int     41h
0 Q8 ?, @, J" X* k    cmp     ax, 0F386
( @' U  w$ T5 J; W: I+ B0 U+ T    jz      SoftICE_detected
$ x/ V* p! c( ^) a1 Q8 L, B, Q7 }; G7 L

! D6 ~8 n1 w( PNext method as well as the following one are 2 examples from Stone's # S0 Z3 T2 F# [
"stn-wid.zip" (www.cracking.net):
, C& T% Z/ h7 j9 M* W+ ^. {
( X8 P5 N0 i6 S6 {    mov     bx, cs* t1 g! z" q: U
    lea     dx, int41handler2
2 J% S, |. g& W* }    xchg    dx, es:[41h*4]8 ~2 g1 P; Z" z
    xchg    bx, es:[41h*4+2]0 K6 g: O, D6 ~, `2 F6 g
    mov     ax,4fh  ^' H" N4 B& g5 w$ l5 k
    int     41h
0 D$ m8 Q4 y8 ?( F! T6 Y- ~    xchg    dx, es:[41h*4]2 i; G4 [/ E; F5 u3 z
    xchg    bx, es:[41h*4+2]
) S4 Q/ d' ]2 h* K    cmp     ax, 0f386h- F  m* S$ c$ p; l
    jz      SoftICE_detected
( @" y8 w3 a, @$ I2 S! w- q- b) H  |
int41handler2 PROC3 x8 s# g+ D, Z- T/ b' X/ X; N; t$ F
    iret
' b4 q: v- q0 U* Gint41handler2 ENDP
0 }' j0 y7 U9 O7 m6 K  n
! W9 g% ?; \; q/ o) n4 C' z
+ Q8 H" |1 L  j$ K_________________________________________________________________________( {" r" ]6 w5 L+ i
) j5 ^. i' x, h! N& O2 q

0 M: y, k6 |% ^4 hMethod 06- J- E3 `4 D, c+ K  f, e
=========
' L8 F5 ?3 ~# F$ N. t! e. ^. `
/ {: T) i1 \. Z+ ~0 x* Q2 e' y3 a6 a. K
2nd method similar to the preceding one but more difficult to detect:
4 M7 I+ p/ V( R# L
- D8 X- S2 b; K9 A  u9 X% \8 j0 p2 g% ^; a* {. c' s7 Z2 n& x0 }2 L
int41handler PROC; d5 `- o" M( t0 h* ?
    mov     cl,al
1 m6 X+ h$ U. b9 Z+ [0 A9 k    iret
4 u) y& q1 f+ i" Zint41handler ENDP
, {/ G$ o* K; y! ^# Z
& U0 Y) ^( w! a9 M! [9 W2 w" ~9 v; T$ ]- o  p3 G  _
    xor     ax,ax
! B9 L  z: {" N    mov     es,ax
& R( T, W! V1 ?1 c    mov     bx, cs' P% h# t; Y, ^: u* Z, c* T6 }
    lea     dx, int41handler- Y! F7 a8 f7 h2 C( l- K
    xchg    dx, es:[41h*4]: E5 x$ f% h' B8 z
    xchg    bx, es:[41h*4+2]
' ~% o4 M$ c2 ?% S# U( q2 Q    in      al, 40h( x% j  w( M& S1 ^% T
    xor     cx,cx% Q$ i9 L2 z6 Y2 [4 s; B
    int     41h
  U+ ?2 @. l2 W9 ?0 o    xchg    dx, es:[41h*4]
' E3 w. b5 r9 F. j    xchg    bx, es:[41h*4+2]
- `* |; Q+ L8 Z  o. X    cmp     cl,al; f- p' n. ~8 N) }/ W( w6 p3 P
    jnz     SoftICE_detected
# m8 x8 v5 B. d1 H8 P: @, k* F( s3 ~7 e. C* [# ^( a. g. W) u
_________________________________________________________________________
9 Z% e- T6 T4 k9 d/ Q  M' E3 L9 _' _% b+ ?, q
Method 07
# `& Y: l, `+ u+ ^: ]% X4 Z5 K=========
( ]% E9 M9 x4 m1 i2 z$ V2 r7 Z9 r6 t7 [7 |9 v- ^! g# U+ m
Method of detection of the WinICE handler in the int68h (V86)8 t* G$ Z6 X) O

' j  s$ r0 T2 |0 i    mov     ah,43h
+ B. ^1 ?' X- t9 ^+ L6 G7 Y    int     68h2 W  Z" S" t) L: Q" u$ n' |
    cmp     ax,0F386h
! W7 m+ M) [% z6 ^    jz      SoftICE_Detected
, m$ v; E2 h% n3 x
/ C; ~9 i0 g4 W4 Q9 e2 m; G- W- B5 l2 x8 G8 C, ~* D
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& \& n' K  `) y9 T. X4 [( v( E4 c
   app like this:9 j& D- [* ^/ l; R/ c

8 U  U; J; K* g' \, R   BPX exec_int if ax==68! y& S- a: {( `% y) E1 V4 p
   (function called is located at byte ptr [ebp+1Dh] and client eip is9 Y0 {$ v7 X2 O3 d$ \
   located at [ebp+48h] for 32Bit apps)
$ Z% E3 x2 g" h4 c' f__________________________________________________________________________* E. N, c, I  s, a9 U  J0 n$ G' ~

. d# C3 h) h- i9 x+ o
8 j- P* u( g- v0 g4 Z6 cMethod 08
2 Y  P2 j0 `6 K=========
' n- v5 r& o4 j* q# R9 \1 E4 W/ |+ {& \+ J3 T
It is not a method of detection of SoftICE but a possibility to crash the
4 r: @( R$ S  b3 T. k( ~: K( ~1 Zsystem by intercepting int 01h and int 03h and redirecting them to another
" Z+ i9 K( s: a4 V0 d- proutine.! n: D& o6 p, k: K
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ O: m) ^) C  y3 Q: n2 ?
to the new routine to execute (hangs computer...)2 M+ c2 S. x8 ?* ~, p
% Y9 P9 g( a3 _  a/ B* ]& b
    mov     ah, 25h; _9 V0 d% T$ H1 w6 y
    mov     al, Int_Number (01h or 03h)% d5 x5 d7 |5 s5 z; f
    mov     dx, offset New_Int_Routine
8 M: T% f1 N  L  j3 h" ]    int     21h! Y5 E7 e/ O( F  N! G+ W! ?
, A! k8 i2 g0 N: P1 D2 B) m
__________________________________________________________________________
% [4 f* Q4 Y$ a5 v# V6 c8 s& j
" L8 B1 }( ?( ZMethod 09
. a8 @1 b8 w+ p8 p' {=========5 U2 T% _6 ^" F
1 k' k0 F3 q* I: r1 M1 P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; Y" ~& P4 S* sperformed in ring0 (VxD or a ring3 app using the VxdCall).
6 o  P2 P  f3 Q0 DThe Get_DDB service is used to determine whether or not a VxD is installed
( {8 ?& ]) S! \8 w, N7 \for the specified device and returns a Device Description Block (in ecx) for% u6 N+ R; |) v% q/ Z
that device if it is installed.. M/ S$ d8 x6 @9 F

; g1 A3 L% w( |   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 s# a9 {2 [: \  K1 h
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ P- j3 y3 H: T- E: c' E8 y
   VMMCall Get_DDB
2 X# o2 S, ~+ l1 A( L3 G$ `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# m$ N0 S9 |: Z1 U
8 n- Z( N' X/ y, d$ j% M4 Z; [! wNote as well that you can easily detect this method with SoftICE:
, ]. \+ u4 H  ^1 W& H! y   bpx Get_DDB if ax==0202 || ax==7a5fh% m, B7 v  W( R4 \' c! e, H6 h

$ f$ d) ^  w7 G- I( T7 q/ V: m+ C__________________________________________________________________________1 ^# W# U% E) H; ^; h- w# m
4 X3 w- o2 m% ^+ m6 u, X8 {& V
Method 10
. y5 {4 A  F" d3 W' ]0 X% j0 X=========
! R, _9 T# `. a9 K
9 ^% h6 P# n' P# T( P. E=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 }1 N, G% D) ?( }/ G! P4 {$ f
  SoftICE while the option is enable!!
- z  U7 Q- Q: J7 \, X  w4 _" {/ j6 R' q( m: W  C; J# J
This trick is very efficient:6 T1 m% c  E4 j  x7 N
by checking the Debug Registers, you can detect if SoftICE is loaded  ~1 D' h+ |5 E% g- T
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 ]4 G3 L) R! ?2 {  F$ R: K! x4 R8 n4 e
there are some memory breakpoints set (dr0 to dr3) simply by reading their
! g6 E; j) }$ O/ G' Y' nvalue (in ring0 only). Values can be manipulated and or changed as well1 [  j3 J6 _& q
(clearing BPMs for instance)
: Z* Z, b1 I- P, W+ s) ^! ]& F1 u5 E4 o/ s
__________________________________________________________________________
8 {  s' H% H' G# a/ L
( h$ ~5 j3 T& MMethod 11
" I- l0 z7 V- n" R! l& ~0 V+ G=========" H$ j; }  v# M4 y

1 d7 D' E, j5 s$ ~This method is most known as 'MeltICE' because it has been freely distributed
5 w$ H/ {) \" |via www.winfiles.com. However it was first used by NuMega people to allow
: P; S2 m" l) i4 ~; tSymbol Loader to check if SoftICE was active or not (the code is located
, r  X7 E1 {* l5 h1 T3 binside nmtrans.dll).
. L1 E  N& P+ M; B, V7 r" f) S7 d8 i, M5 d
The way it works is very simple:0 P% |4 Y3 M& i$ l: Z
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 @3 t/ G1 I6 V& d  RWinNT) with the CreateFileA API.$ F# {' U$ [. B# I8 W

/ k# d) r! j- v7 m- cHere is a sample (checking for 'SICE'):
1 j0 B. b: p5 N0 v1 o: a4 S5 u, h2 h, V$ J( M
BOOL IsSoftIce95Loaded()
7 {0 N, U8 {& F3 N{- t7 O  r/ j. u" l$ n' s
   HANDLE hFile;  " U9 k, _9 R# F2 l4 [  _2 O
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 `4 b9 M8 F, y                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 t( n5 o( C1 M7 j. `% ?" g
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. v  P: K  \- @- k
   if( hFile != INVALID_HANDLE_VALUE )5 F. l% m/ D1 ^1 g7 ~
   {
8 `1 y7 z6 {! c      CloseHandle(hFile);
3 E% Z- d; Y6 Q' }8 e0 h0 V% @      return TRUE;
; j" j/ R. Q) m- q& O. y) ~( ~   }% L- e" o: f- _5 R, k! Q: h
   return FALSE;
3 Q4 W# t* A. q}5 |# l% r* L! g+ F
: @- V/ n$ y! x. u/ W
Although this trick calls the CreateFileA function, don't even expect to be
  t# k8 C1 M- w2 O4 N0 cable to intercept it by installing a IFS hook: it will not work, no way!
1 k/ e" v. }! r  _9 f) P3 ]; eIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 p* `5 W( T, s" D) u) a0 O& ~service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 u9 a* x2 R9 w0 X* nand then browse the DDB list until it find the VxD and its DDB_Control_Proc
) P; r1 i* A0 W* T; hfield.; u4 V7 q; q# }' O$ Q5 j7 R! k
In fact, its purpose is not to load/unload VxDs but only to send a
' c6 j* \7 k0 _, |. uW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. m% Y  {4 \9 A6 gto the VxD Control_Dispatch proc (how the hell a shareware soft could try5 N7 r. R1 `4 k# G" E+ C) J+ F5 |& m
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) ^, m9 f. m) B" n8 c' j/ gIf the VxD is loaded, it will always clear eax and the Carry flag to allow. l# _3 R9 B* ^) }) h( H
its handle to be opened and then, will be detected.' R" A0 D/ ^/ c) J
You can check that simply by hooking Winice.exe control proc entry point! |0 {  x9 b/ t3 N" H# b5 N
while running MeltICE.
1 \  y+ H% z0 n- j# t+ a  ~* O# @% J' X" e* N0 {

, @. f3 R& T. g' B4 X  00401067:  push      00402025    ; \\.\SICE+ ?. ?2 l3 N6 F# m; X
  0040106C:  call      CreateFileA5 |4 l; o0 F9 k" h
  00401071:  cmp       eax,-0011 k- S+ M( x% r* r8 U+ K" n
  00401074:  je        00401091
+ n) u1 _- \: n. ~+ z! w! \; _4 V+ X

0 d" W, M* h  S, \There could be hundreds of BPX you could use to detect this trick.' y0 V. `1 ^$ g& u
-The most classical one is:- r& z( A+ u4 U
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 S$ J& a% ]7 b; W: Z3 [2 J    *(esp-&gt;4+4)=='NTIC'
! U; e4 V/ c! u: X9 R5 _2 H2 s$ b9 ~
-The most exotic ones (could be very slooooow :-(
8 \/ d: O# z+ M; ?   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ n4 h0 f+ n1 K1 P
     ;will break 3 times :-(( S8 h4 }- ]3 F9 A

, B& U" ~" x" J& Z-or (a bit) faster: * I, E: v# {, F
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) U# W% n- K0 o! I' ^$ Y6 o. S. P) R; M$ `  m
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 ^* e. y0 D7 |' s& H! J) V# [
     ;will break 3 times :-(% h6 Z9 d/ h* i; z" e8 V$ M

/ v/ u" x0 [0 T7 A$ ]-Much faster:
& o3 c: [, g% j) r   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 z& g9 {0 h; @3 n- g- g

. @7 B3 O. K3 HNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
  E# q' {2 z: O. [9 j5 a7 Tfunction to do the same job:
5 ]% y  G  {1 D$ F" c7 i
. I' R) H) E. a3 {$ N( M+ H! j   push    00                        ; OF_READ3 N$ O/ A4 w1 ]3 d2 x9 `1 i" Z2 C
   mov     eax,[00656634]            ; '\\.\SICE',0
* B7 u! Z5 ~0 [8 t  z1 h: i0 |   push    eax: p9 P9 c& O. d% r8 O. W
   call    KERNEL32!_lopen
1 q" Z4 ^8 V" C% S) N4 n   inc     eax
: z. q/ L# c: G) H   jnz     00650589                  ; detected1 \- Y1 O+ S6 z. p" g- h- y
   push    00                        ; OF_READ
& E) ~1 r# }  x7 W2 t' k   mov     eax,[00656638]            ; '\\.\SICE'4 n/ \  {: J+ `7 A
   push    eax
4 W, t& u* ?. ?   call    KERNEL32!_lopen  O9 i! \' C9 y5 @- d; e
   inc     eax
) o; A1 }$ H+ y. [. m8 L   jz      006505ae                  ; not detected$ C0 y$ m% V4 M1 I) b
+ d$ W" |' L0 Q5 U7 |

9 w4 I4 Q; k0 `__________________________________________________________________________+ E' S( ?. Z# l: w! k

% l$ y2 c9 P! d8 ~2 O& _8 uMethod 12
" s5 ^; l- I2 o+ ?$ V8 K& @8 v=========( Y+ \4 D/ n4 r

! O4 u& ]% ~8 y2 Q8 A3 UThis trick is similar to int41h/4fh Debugger installation check (code 05. I# L5 L# {9 ]1 }# M7 R
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
9 [1 x  |5 k* d) B( Z6 _/ uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 W. k% I- n2 F2 r" ]1 }" L% o( j
% d. a( z0 u6 |! |  u# u- L; }   push  0000004fh         ; function 4fh
( Q! {' o, x$ ]/ K   push  002a002ah         ; high word specifies which VxD (VWIN32)! m% O$ m$ U2 l6 s3 ~0 j% L0 Y% ?
                           ; low word specifies which service
4 P9 ]; ^1 e& m7 g4 O9 J- o3 x                             (VWIN32_Int41Dispatch)
* \4 i% J5 Y- a2 R& s/ g   call  Kernel32!ORD_001  ; VxdCall" `/ b+ l- b" p( H
   cmp   ax, 0f386h        ; magic number returned by system debuggers1 s1 l; g5 b; N- ?! L& Q0 \
   jz    SoftICE_detected
" Y2 H6 r# Q7 c, {+ c7 s3 ?: r8 J3 O) T/ ]9 r' I" _5 h1 ^
Here again, several ways to detect it:" y% r& T. I! ?) h, N. s/ R
$ h2 `1 N! x& y+ B) N
    BPINT 41 if ax==4f
( v# |2 O6 A  r" f. k
9 H* U# o, g* e/ g( d# n" W    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ T/ M/ s# M' o, Q
/ c% \$ R( m* V" w$ ?
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ r  H* M. e9 S7 f$ }8 _

# B8 j+ z: [! \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& s( @4 m( A( W& V/ s* c

) c/ q% G% i. Q5 U- X; P__________________________________________________________________________
# D- S7 u) J8 r# c: m, E! J9 I" l% Q6 V( G8 D$ U
Method 13$ Z' Q  s0 v3 Q8 Z' [# Q( F
=========
. d! n( @7 |/ n" {- C& C9 o
# v3 r9 P" T# P- ]Not a real method of detection, but a good way to know if SoftICE is
) u- _2 M: j9 O1 E5 W7 dinstalled on a computer and to locate its installation directory./ }/ Q8 M9 B9 I" R8 S
It is used by few softs which access the following registry keys (usually #2) :: A) R. g/ o; P6 k
$ U9 c* I9 j2 x& T# y/ G' M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 [0 B! z# U- D- E
\Uninstall\SoftICE
8 S5 o, Z: V1 O2 H; g-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE5 r- s! o- X0 F7 j0 _# Q7 D
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 |$ T& M  U. l6 i; }
\App Paths\Loader32.Exe, c' y$ Z1 H) }

, ]9 _2 t6 o, v  T! {5 n7 D  p! N/ ]& ^' Q0 j( z/ A
Note that some nasty apps could then erase all files from SoftICE directory
* t; W: @2 ^: J* h8 H(I faced that once :-(
5 s4 V2 |4 _/ Z1 [- u2 f) a$ l# I( T) Z" X6 N2 F: C1 j
Useful breakpoint to detect it:
1 i$ U7 m5 W' O1 a- c! }! ~9 Q' z2 R
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. X( Q5 w1 C7 C8 c0 I% V/ N# z3 G1 j2 @0 s* o5 v9 T9 Y; Z8 Q
__________________________________________________________________________
8 l: f+ k* g6 v8 n4 L3 ?) y2 R6 y
1 Z+ C6 D: V+ O* t/ D+ \7 C0 r: b6 x1 ^1 d- c
Method 14 2 i6 F+ c! i' B2 y: r' s& G, R$ R
=========
( ?5 B) a9 [) f9 Y% z4 c" Q# z3 I
; ^3 f& M  G* S9 p8 w/ eA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! g) d2 v/ m* q, X! mis to determines whether a debugger is running on your system (ring0 only).
, e7 m& B$ ?+ K5 {4 p0 t( p8 T
# s/ i; T/ Q# t5 M: ^9 ?! E8 x   VMMCall Test_Debug_Installed7 o- f# P) i9 p9 M9 [& {; H+ A
   je      not_installed& ~3 m7 Z/ C, f! g' Q' E
( V6 N: l6 d5 ~. l) i" I5 Z7 c
This service just checks a flag.1 N8 Q& \  s( R0 @
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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