About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>$ U5 ^4 ^6 `" G) A
<TBODY>% V+ \) X+ e# m# E7 p5 f" V
<TR>
; a+ X% q! L" b3 o6 [5 J8 W<TD><PRE>Method 01
/ g# ^3 O+ e- F$ Y=========5 Q; U) G: w/ z$ }
% k1 B- Q  Z# e) m/ b2 f  Q# I) E
This method of detection of SoftICE (as well as the following one) is3 \' y  h: R$ h7 m; x
used by the majority of packers/encryptors found on Internet.
; E& E9 v7 ]" PIt seeks the signature of BoundsChecker in SoftICE
& z7 P$ |. `% x6 i# H
; S7 m6 W: h! p. Z0 ^' L2 m) @; Y6 D    mov     ebp, 04243484Bh        ; 'BCHK'
+ o5 o# L& h( l6 H; W9 o4 v8 I    mov     ax, 04h) `/ @$ Q2 \/ q
    int     3      
, _% r: H+ i, _    cmp     al,4/ K9 [4 K: D) Q( O8 G, B
    jnz     SoftICE_Detected: r% n+ ~# [3 G8 B
& e$ ^9 d0 T% F% p3 L; M' D
___________________________________________________________________________% z. S) ^! m3 y7 ^# r5 g

  X- |" m6 f2 R% I0 C2 bMethod 02+ d+ @1 I& L* i9 E- J# |0 F1 w
=========
% b0 |  ?% [" ?6 X" d$ {$ G6 d$ j# k* V
Still a method very much used (perhaps the most frequent one).  It is used
3 q/ _2 _+ |0 z- U7 @to get SoftICE 'Back Door commands' which gives infos on Breakpoints,, m2 ?" S. \9 e- X
or execute SoftICE commands.../ H* D$ _7 R; |
It is also used to crash SoftICE and to force it to execute any commands
' t9 x9 k1 }* g% R& p/ }3 ?( z5 n(HBOOT...) :-((  # h/ f' ^4 Q" ?9 ?

; t& n" _. W# ]Here is a quick description:
; U. j, K, B; _-AX = 0910h   (Display string in SIce windows)- W* {# D2 N4 A: w
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 D5 d3 o0 n, J: m5 V% s
-AX = 0912h   (Get breakpoint infos). K! M- [* v. a) Y
-AX = 0913h   (Set Sice breakpoints)
' q2 v' l1 w) v6 Y0 _-AX = 0914h   (Remove SIce breakoints)
" _- M% b7 ~' C  o. `
) B8 M# L9 b, {* z0 l, A+ i, mEach time you'll meet this trick, you'll see:
; G# X  P, q0 g-SI = 4647h
- Q; v  R3 d7 E+ r) n: H8 G-DI = 4A4Dh
1 n1 r- S# M% |+ IWhich are the 'magic values' used by SoftIce.% V8 b9 Z6 A0 Z" u/ s) m$ Z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
3 S. S  H& h, ~% O
3 }, s+ S! k: C3 s4 G' n6 aHere is one example from the file "Haspinst.exe" which is the dongle HASP
7 v; b0 v* F7 y: Q: ?Envelope utility use to protect DOS applications:1 R+ S( A6 n) ^

1 H  o& u2 _" z3 n9 C( e0 v9 |9 N7 w5 A6 K2 S) c1 I; S9 S
4C19:0095   MOV    AX,0911  ; execute command.. g! z$ x( |9 i0 U2 K6 Q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
( D% M  [) n- @4 c8 [4C19:009A   MOV    SI,4647  ; 1st magic value.- t# F! T8 ]0 @. L( i* p* N: f
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
1 d$ A- Y" o: V* N' M4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
4 n+ A2 a1 o. U6 V/ b- L2 v4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 }; b6 _# p! E/ _# c1 V
4C19:00A4   INC    CX
4 f1 u- b' ]4 V  J9 R4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
7 b! @  u; O6 h' g  S4C19:00A8   JB     0095     ; 6 different commands.
& t- X! p3 T/ e4 e$ c6 E4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 r. b: K7 G% j8 \  a( S/ R) [4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 m% k7 s4 C$ J8 u
' s; Z% P/ q; K4 P  l* z& \
The program will execute 6 different SIce commands located at ds:dx, which
5 x" X. X5 p* E% Mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.; e- O7 q' p" b
) J/ l: l- G+ o& E  p8 @$ L
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* [1 v. E% f, y" H: |' }
___________________________________________________________________________
8 ^6 \4 o% e! N0 O4 k" H  {$ B' }1 ]. ?, E/ o
3 H9 u+ W) _% B$ r- C8 Q' M
Method 03+ h" B" V4 Z8 f* n4 L
=========4 ?. V5 `5 l  z# N1 {7 ^5 ?& {

/ {7 ]3 `1 {* Z: D2 MLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; N, E' q7 v: O  F(API Get entry point)* s3 ]3 z$ N$ p9 n
        ' t$ @9 Y% X" m- M3 p
5 Q" A# |4 [4 b  y# n
    xor     di,di
* q8 @1 Q: C# b    mov     es,di1 ?, P+ z# I% X
    mov     ax, 1684h       + ]' e; j* W! q" |7 h
    mov     bx, 0202h       ; VxD ID of winice7 W6 T$ H1 |! ]' b
    int     2Fh' I0 g8 p% A) B. O" U- L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: h+ f4 c4 |: W/ R    add     ax, di
! c# \" m% V( r    test    ax,ax# z5 Z# U3 w5 n; j6 z$ t( W
    jnz     SoftICE_Detected0 ]0 D! a) }5 L, F& m+ e
7 A' Q" n2 D. T, m
___________________________________________________________________________4 I+ ~* D! @9 ]' S  f0 \1 Y

9 w* f3 m& T, p) }1 r2 Z" e- aMethod 04( e$ q: U* n: t/ W. m
=========4 S- X' N3 i. x5 D' i3 G
$ v2 F- ?9 E0 D. l+ I/ s
Method identical to the preceding one except that it seeks the ID of SoftICE
' Z  m  U( n; JGFX VxD.
& Q( R: ~9 E  y# X7 L( R) r! n, s1 A- }9 Y4 u
    xor     di,di
) `* @& i! n+ [    mov     es,di
- D, N, W3 r' l" l2 Q5 o    mov     ax, 1684h      
' \3 M: c* Z3 U    mov     bx, 7a5Fh       ; VxD ID of SIWVID% Z5 A5 e$ Z( n/ i8 P) h
    int     2fh
  T9 ]. F* [' X* X- T/ [# M! i( C8 ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- f" ?: L9 S* {1 }    add     ax, di
2 J  g0 y6 v; N' i# Y: ~( u; m' r    test    ax,ax
2 I5 y% e: C* ], l$ x    jnz     SoftICE_Detected! k  \1 a8 H; d$ K8 s- O3 B

" `6 F7 i7 F' }__________________________________________________________________________
; s. {( j) a1 y# z0 d5 L1 E. t! Q4 @
: A$ T; {% y6 ?3 ~. Y
Method 05
/ g9 p6 S+ `6 v9 j7 |=========
1 ^$ O% ^8 a2 {2 B# Z
8 z. a. f! p1 {" o# WMethod seeking the 'magic number' 0F386h returned (in ax) by all system
! b/ I$ c' }3 e+ e8 Mdebugger. It calls the int 41h, function 4Fh.9 s" w7 J" Y9 K, Q4 Y. v, E
There are several alternatives.  
, w* C5 x3 M% ~+ t
$ @9 }4 L( |6 I+ Y5 @9 k% |The following one is the simplest:
: {. }5 u" ], m" e! e, e2 l# [5 A8 e6 d! ]& }1 T
    mov     ax,4fh
0 R' r2 o5 G- C. T    int     41h
1 L* W- a5 p" d2 Q, V    cmp     ax, 0F386
) Q- _4 N; G4 z- e" k. ~    jz      SoftICE_detected( d9 w" T+ I3 _% w

! `. w% C$ `6 y, ]
3 |, r9 B/ K4 n$ J3 uNext method as well as the following one are 2 examples from Stone's / X$ D7 P& Y9 R! S% G; N5 }
"stn-wid.zip" (www.cracking.net):
3 I- K5 w+ w" |8 T! f$ b; R' u5 |! q
& K$ C0 F" L% ~. O9 N    mov     bx, cs+ K! V  D6 M# x2 X6 }4 g/ ~
    lea     dx, int41handler2
& |9 ]/ d( e9 B5 j9 H    xchg    dx, es:[41h*4]5 _% A) j0 J3 T* u  p1 ?% }- h
    xchg    bx, es:[41h*4+2]
& L1 T3 T; _/ `3 J$ o' F$ M9 \4 O    mov     ax,4fh
/ U& I5 `; B! ]; z0 e5 M6 O: ^- Z    int     41h6 c5 I8 Y6 K" ?2 Z# z
    xchg    dx, es:[41h*4]& J) l- H/ y. P6 v, d& m; p) A, w$ r
    xchg    bx, es:[41h*4+2], b% }4 u; J  e6 Q" U% X- I
    cmp     ax, 0f386h. d) p0 p7 C0 \# U; J& B
    jz      SoftICE_detected& o7 v) V/ S/ _1 t. U

) P, B3 F; y: o1 f! H  ~5 sint41handler2 PROC7 ]0 ]3 [- w) t  B
    iret, J) t; ^) _' q5 @; v4 f5 l
int41handler2 ENDP) m1 ]5 C0 K# _. u9 H

1 y& G: U  \. [. b
) K. Y+ L5 y' a1 g# U& t_________________________________________________________________________
% y+ P5 t& v% u1 j. L1 z/ I4 b# U3 R3 U& y2 `& a
+ z9 P% A! B( X' w+ w  R
Method 063 I5 |8 {% ~& ]- X( Q' q* k4 p0 P
=========
3 s8 G! y$ @1 q  g/ {$ j& l) v
+ h  s4 F" O/ F3 h; j
8 Z/ Z! i/ Z: o2 n6 x0 c7 ^; ?2nd method similar to the preceding one but more difficult to detect:$ f- j, n0 t: R3 ?7 b

5 K1 n' u; ]% O2 V6 F8 K) ?0 g) l2 A, `
int41handler PROC
; n! J$ m! A3 a    mov     cl,al% L4 z+ j4 V8 U/ l) n. B7 Q
    iret/ P4 E1 Q3 Y8 {; [5 `; b
int41handler ENDP
6 F; ?+ N$ r. I! k7 v0 Y  W  f: p" S0 o  ?
" s* k4 r- U# r) a7 x
    xor     ax,ax
$ u4 {( [. ^3 d  i! w4 L4 i+ W    mov     es,ax
' @3 a  M5 X1 Y4 S: v* r    mov     bx, cs
" Q# t1 O1 a+ j' {  o. K    lea     dx, int41handler
- @" K, s1 j/ M3 H2 M    xchg    dx, es:[41h*4]
/ n& B2 z2 v( I, m    xchg    bx, es:[41h*4+2], }( C8 \+ G! P2 X5 @5 M
    in      al, 40h
2 q1 y9 ^! s/ c! [! W  j    xor     cx,cx- y* p. q; \! l
    int     41h( M2 j  d! @( I' `+ ]) y
    xchg    dx, es:[41h*4]
' X0 X" F3 m! ]    xchg    bx, es:[41h*4+2]
1 H2 }: l% D  H9 C    cmp     cl,al0 N4 o, G$ ~0 J: \. x3 O
    jnz     SoftICE_detected
5 h5 \* `3 h% Z4 @! C/ J8 ~
8 \! b" I+ ~/ R. \" N8 @1 Q) y+ B- P_________________________________________________________________________
7 @, `$ L- ]/ H
. c* K7 a5 n* s* w1 X, y* t/ {Method 07
3 O* T! t' z) [( u=========$ k& F* r7 x& ^  L

: S+ c- r; E1 [/ c" g: {, r$ WMethod of detection of the WinICE handler in the int68h (V86)( V) k* @/ O* f3 {% W

  u$ I4 ~' D. }8 X8 _    mov     ah,43h# J- g7 u* m' H% M( `2 J+ A6 C
    int     68h
3 i7 B: N; l! ~" g    cmp     ax,0F386h
) n+ }) r; l9 S% O8 u& H    jz      SoftICE_Detected' _' i" A( n% P/ L6 f* e

& y- v# p5 R8 |* a8 q1 c- ^- x5 P
) B7 V4 v% {: O8 C. M) S, i1 l=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# Q, O7 R( q/ k- I$ H/ C   app like this:
  V" d. o, `/ _$ U& k$ i! u
% j8 t9 A% O  r5 \, C% ~; c' M   BPX exec_int if ax==68
+ K3 j3 n+ F1 h; e   (function called is located at byte ptr [ebp+1Dh] and client eip is2 i/ x, G. _7 o$ v3 [3 d" o
   located at [ebp+48h] for 32Bit apps)
" u- O+ y% L$ ], w__________________________________________________________________________: z' I1 @7 l  k. r# b
: `( T/ z9 U4 |

# _$ H& @1 [2 W, v, F7 o. m) cMethod 08
. T) l& [! J9 L9 q& w/ t& F+ w. j=========7 }! f2 ^$ @) W9 e$ ?1 `* H+ p

; U1 {0 w* f4 N# m% z, |It is not a method of detection of SoftICE but a possibility to crash the
, z+ D. M& P' A5 i0 o  ]system by intercepting int 01h and int 03h and redirecting them to another9 ^9 B* h  `' f  U! g2 ]2 r
routine.* ^" i; E6 H+ v" W3 c7 `1 j5 {
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ c" ~5 p: g( j% b% Y
to the new routine to execute (hangs computer...)( G  a) e8 ^2 j# y* @: S$ U
1 L1 @8 a1 U( K4 U5 d
    mov     ah, 25h
0 x9 o) u3 ]: [9 n# b4 j4 ^: e    mov     al, Int_Number (01h or 03h)4 s6 @0 O/ B: i
    mov     dx, offset New_Int_Routine; n. @5 e) J, Y4 X9 K, N
    int     21h
! e) p2 _" k2 k+ H7 `
' P, z8 Q& s" B4 o* u( U. ~__________________________________________________________________________' |  {; w# F$ z: y4 F( V2 p

' c) R- m$ S# e0 H3 [Method 09: ]9 q. U9 _3 z! m4 c: ?% X
=========1 a( I# i$ _) t6 Q7 n4 Q) w

- Q; H  W  |" ~This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% {5 G4 K- l* G& f, t
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 J- |+ F9 Z- ^/ ~8 AThe Get_DDB service is used to determine whether or not a VxD is installed* {1 A- N  G( v( Z6 Y
for the specified device and returns a Device Description Block (in ecx) for7 ^$ p2 a, b. q# V+ H, n! `; k& h+ ?
that device if it is installed.% J6 _4 b" N/ ~0 [- e7 d0 ~+ V8 T
6 s4 s  N! ~" ^  P6 f( I, X+ U
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! W" L6 l/ A5 z7 Y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* J/ p$ b+ }" ?/ T" t' l* V& T0 n
   VMMCall Get_DDB! `2 T" Q, y4 p' d6 C
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
4 w$ n4 H6 I2 ~% L( y9 D9 ~( i! e) s) h8 L) v, \5 t
Note as well that you can easily detect this method with SoftICE:
8 _+ Q5 K- X* }7 ~% C4 `0 h   bpx Get_DDB if ax==0202 || ax==7a5fh
; K/ W+ u' w  i8 N" Q: _# f9 ]) m9 R* |
__________________________________________________________________________! k; M8 z8 V# a$ R; q
$ T8 p/ G; g1 l& T& A4 U, D4 c# k, }
Method 10" u1 k$ F$ k# [+ }/ y# m6 e4 |
=========, P0 j, t3 ]$ i* ^
+ g8 n. \7 C8 o) T( x( b
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with8 P/ l! S5 {% T  f0 [' s* |
  SoftICE while the option is enable!!8 g6 _' \0 J; B
% {  S% Y0 E$ p* b9 f9 v
This trick is very efficient:
6 J/ J; L# B2 n7 h/ L; s  x3 P6 eby checking the Debug Registers, you can detect if SoftICE is loaded$ r8 g& l  P3 y/ [- p9 @: t
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 j% q+ [, h: _: O. Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their1 w1 |6 ^# X2 \* v. L9 p* T; O+ e+ O$ q7 m
value (in ring0 only). Values can be manipulated and or changed as well) H) M) U' G; n$ t
(clearing BPMs for instance)% x( ^6 N4 R2 _/ h9 Y. Q1 f2 y' W

. M' Y" O  o, l6 K% P: m__________________________________________________________________________$ [1 ]: g) E2 u9 m
" r9 D) [: A- Y& g1 {" I
Method 11& O2 r: Y- }2 k& H, o
=========
' n, ~3 [# k" w8 o( v3 ~' r* D3 X8 K) k8 i
This method is most known as 'MeltICE' because it has been freely distributed
9 {: E6 S, v9 Rvia www.winfiles.com. However it was first used by NuMega people to allow* H  A) o6 X- V3 @3 |. _' O* |* H
Symbol Loader to check if SoftICE was active or not (the code is located
2 W3 U6 {& s7 J6 t. x1 L9 ainside nmtrans.dll).2 E5 f9 W. _! r) c% f: Q
8 S& a6 A. @8 o  r
The way it works is very simple:
1 {  _3 Q) p9 S3 j( QIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" O" e3 y( \% C7 F6 j1 U
WinNT) with the CreateFileA API.( n. o) `! K" G( J
2 K, b# i2 r9 d; J" e
Here is a sample (checking for 'SICE'):) V+ q5 }  Y* ]6 I
3 ?- _1 B- ^1 @- W% h
BOOL IsSoftIce95Loaded()4 e0 e* O' r/ l! `  t5 j, t4 z1 b
{
6 q; @& \$ `( H+ C$ {' G1 q% c  A   HANDLE hFile;  
0 a/ p2 _; `: w& F+ t4 A' _   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 T4 ~! d" m- L5 Z! w( b
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  V# t8 u& w$ M0 F3 W" }# U                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& K, F, ]! C5 S7 t7 C/ ~0 s" u! s
   if( hFile != INVALID_HANDLE_VALUE )
: j3 A8 K/ f7 x, \   {
: D+ C. k: I% i$ m' B0 R7 O1 f/ \9 a      CloseHandle(hFile);* O" ]: f: c) F/ @; \2 S9 B3 {3 A+ G
      return TRUE;: C" J2 {$ [! f; o; A: ?
   }; A) q% M% w2 i4 w$ W
   return FALSE;2 N* z9 F4 s4 P+ t" h+ G1 {& E& i
}
4 F0 O5 }, F+ r4 L# \- u0 m
' K; v- U. u  R2 h0 u, K, c0 qAlthough this trick calls the CreateFileA function, don't even expect to be
% h0 O9 S. G5 j7 xable to intercept it by installing a IFS hook: it will not work, no way!
( @0 T  w6 \# W6 S3 S  r( {; N5 }- [In fact, after the call to CreateFileA it will get through VWIN32 0x001F
1 H! j* p, R# N. r! b# Gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 c' ?1 W) T& t3 S
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 ?" T- ?% O# {3 Q0 Z8 Pfield.; z; `( z1 Y/ y1 ]
In fact, its purpose is not to load/unload VxDs but only to send a ( d: f5 m2 t' B" z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' j1 p% K5 {- u5 x, C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; H; a1 \  \. d( _to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& a& Y( x9 {7 b( BIf the VxD is loaded, it will always clear eax and the Carry flag to allow
8 h$ j& D! N- K6 X8 B2 G/ pits handle to be opened and then, will be detected.
! G7 i; C) ?  P$ J' `' VYou can check that simply by hooking Winice.exe control proc entry point
4 \( O2 N* Y! M/ Cwhile running MeltICE.* a# y+ z2 }. K6 v
/ s  p' G6 w1 x2 w, w

& B4 h5 h/ ]7 O2 ]* ]0 O  00401067:  push      00402025    ; \\.\SICE- g8 C8 g. j( A- ?% Y/ g7 p7 V
  0040106C:  call      CreateFileA
. ?- t" A1 B9 c& t) L& i  r; z  00401071:  cmp       eax,-001: L5 _8 A; _0 L* {" d  U) e
  00401074:  je        00401091, L  Q5 j2 i) k; S1 d' q9 U
& N8 o. W9 e* g( }4 J  r: H
) x' x: L! P4 a; Q6 F
There could be hundreds of BPX you could use to detect this trick.: n/ E) Z: M6 g: z  z
-The most classical one is:
* g7 }$ B* B" o  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: i+ [1 o2 G7 x* Q/ K/ d
    *(esp-&gt;4+4)=='NTIC'
. H, ~8 b* m8 i# o4 b" w' ]6 }( H5 S4 K. B
-The most exotic ones (could be very slooooow :-(
. w* k# _' f) |$ E" R( V7 F: p   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 f+ O  Y1 @3 H: H/ o: ]& R. I6 ?
     ;will break 3 times :-(
1 y: \2 n9 s! W/ {
! q5 q/ v4 r! E) @- K: w6 A-or (a bit) faster:
" U8 k. ?) ?( l3 T   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')5 j3 u% n% o. r8 p3 c! i  I

' ?: e; z' X4 i  K7 p1 _! o9 R   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- e$ E, }& B2 X" B     ;will break 3 times :-(9 {9 R# M4 S0 r) _2 X# o9 o" j
! u" P8 g$ p* f5 }) T) d$ D
-Much faster:
, W6 M6 a3 }9 Q, d. K3 W   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', _  p' X9 k, `- m: U

  l: K: s, P- }" N2 RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ [2 g8 K6 k% d* Afunction to do the same job:0 R; K$ D& n9 I/ o5 w# U5 |
+ A: v+ m- p9 ]5 d: s
   push    00                        ; OF_READ
3 O1 q$ |* k; n9 o   mov     eax,[00656634]            ; '\\.\SICE',0
: W4 K2 r5 i6 U0 g2 A   push    eax# T! ]$ @! c9 `: o
   call    KERNEL32!_lopen+ h" o4 p2 _9 j* C( I' D5 h
   inc     eax
/ y- x/ ^/ r1 T4 K   jnz     00650589                  ; detected
. K+ Z, u3 R3 Z0 K) y   push    00                        ; OF_READ/ U$ k  v' m; i( t, {3 \" l  }
   mov     eax,[00656638]            ; '\\.\SICE'
7 ^2 G3 v9 g0 q6 I2 K   push    eax  [! B3 i/ O  e8 n, L
   call    KERNEL32!_lopen& b5 T" U7 t+ {
   inc     eax' E$ O; l# P* ^7 `) ?' x! ]. K5 T1 |
   jz      006505ae                  ; not detected& F; @, K% r/ S

' q9 L4 Q. P9 X) F8 ]* V' d' w# S& j8 ]
__________________________________________________________________________; y1 {' P2 R% L' N7 M
* ^4 Y  V( y% _$ ^
Method 12: V- L9 Z; i: B* ?+ `
=========
- L1 a: n$ o" g) W' }- i/ c9 ?) x5 r: A- z
This trick is similar to int41h/4fh Debugger installation check (code 05
' S6 O$ H) o) Z4 s&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 d# H3 U$ O( {2 e7 r# M0 ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.; A$ ]+ Q  c- B+ b% C7 x
( e; {: [7 p; I" w; n0 G
   push  0000004fh         ; function 4fh. f0 s0 w" J4 G
   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 g: ?. M* L6 @* H                           ; low word specifies which service' ~8 h' r1 N: t* G
                             (VWIN32_Int41Dispatch)
. R: e, q8 E) l# h+ S   call  Kernel32!ORD_001  ; VxdCall
3 Y& S5 j$ t" ?. M0 N   cmp   ax, 0f386h        ; magic number returned by system debuggers1 O' x+ }9 N7 f8 z0 G, ]. @) X
   jz    SoftICE_detected* y8 i% }* s* R3 _2 m
" A* j  ^& ~: q8 a7 r
Here again, several ways to detect it:
; b' Y. _; }* s, C: K. U! f; C# u/ L1 M# Z
    BPINT 41 if ax==4f# y' Q: I4 Y( i4 S7 m

; P4 d8 e8 L! T7 I1 ~! v    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- L. h& d1 n  o$ ?9 Q6 z+ {
! }- ~) o6 V6 ~
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ {& V. b6 L( {7 f& }$ X6 s+ d* v. e" ^( G& f7 X5 T: V
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% P+ f, g& g& u- M
1 A2 r% E' C# U$ ?, c  ~; ^__________________________________________________________________________
; i3 b5 Y; t. x
8 S( l1 W, q+ M1 {# LMethod 13
, e9 l5 q! {+ u7 Q- q  h3 i=========
; `* \$ @, j9 A5 L3 i
# d, Z: M. T( ^! ]Not a real method of detection, but a good way to know if SoftICE is
# h2 T% Q9 n: finstalled on a computer and to locate its installation directory.* X+ ?1 [7 R; T
It is used by few softs which access the following registry keys (usually #2) :5 I$ @0 C2 J. b" s: N" m1 E9 }
( n% C# l' D3 Y- C/ W, l- i
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 x1 b# K2 N; W8 E\Uninstall\SoftICE
. ^! g( |/ t, ?+ f+ I; S. k6 Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* `5 z  `4 w# h( O6 t2 _-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* ^  o6 S, W4 [8 C0 }$ W
\App Paths\Loader32.Exe/ V* [3 a9 J1 u3 ]0 k7 ]

, R' v0 j9 k1 N) e. z6 b' J% U4 d, g% k
Note that some nasty apps could then erase all files from SoftICE directory
+ c- q5 u/ O2 l; p; e, ^(I faced that once :-(
2 d7 R$ s4 e) N# f/ M! g. G8 K0 l9 n( u. n* V1 w( c0 T' _. g* l# b
Useful breakpoint to detect it:
- e7 o5 _' F) B8 d
$ }5 u: z. x6 R# L; A0 r2 i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
: ]0 R- \! o4 t0 \# F( r3 q! j
$ v! Z7 ~4 S* x) Q. r" A, F__________________________________________________________________________9 k7 E: U) a1 q8 ~! o8 M7 Y

0 S1 U0 _3 ?4 I& s$ j* H
( M8 R/ n( M9 c1 M/ XMethod 14
, [! G) Q  K  ?' g7 f6 x=========
; U# ^! ?9 P5 H# p4 S7 w& Y! k. I' x! T4 U
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 m8 z4 W/ C- E1 t+ mis to determines whether a debugger is running on your system (ring0 only).) s# j" x! `0 X" }4 h1 e
$ u5 m4 _; W  X
   VMMCall Test_Debug_Installed4 a3 n) t8 ~' I  Z5 i6 w
   je      not_installed2 _* K. A1 @. {# k7 L- D$ v

( c4 y8 U3 `1 l+ @. d) b6 }This service just checks a flag.9 s1 {; Y1 K% b
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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