About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" B8 g$ a' h6 I% Q<TBODY>; O5 ^  {  P% p+ p3 b0 E4 H+ ~: ^% p
<TR>- W" o8 F: L' S' p% a
<TD><PRE>Method 01
! j  {% _# D( r* q=========0 L/ @3 w* }, L% _; b2 Y6 \

2 P) T( \3 {4 u9 e* cThis method of detection of SoftICE (as well as the following one) is
( E* F7 x6 g* B5 @% o' m7 Mused by the majority of packers/encryptors found on Internet.& N% f+ S; t! k( k9 }' a
It seeks the signature of BoundsChecker in SoftICE
) R% n' k% {1 j* t: C. R/ G4 L2 I
# T* s- G; `; D- N    mov     ebp, 04243484Bh        ; 'BCHK'# S4 E) k) B* ^. @/ n+ t( Z5 }
    mov     ax, 04h
8 F/ a' }/ j5 k: u, p' }2 ]    int     3       ; H# D; I  e& P
    cmp     al,4
) V. [7 [7 A( d* c  m" W7 l- v    jnz     SoftICE_Detected/ K0 Y( c! l6 S! s" F0 R" @  |

1 `2 i) V/ S1 z7 b___________________________________________________________________________
% r* c8 j/ \/ a7 z! ^3 M* ?7 C  a1 W8 }8 c8 C; k: j2 t! E/ t' Z
Method 022 `/ h* j1 S8 i
=========' n, U' p5 D* H3 \" G, Z) n

+ k% |2 |2 S. \. ]- fStill a method very much used (perhaps the most frequent one).  It is used7 R' n" r/ _( b  Z+ W9 S
to get SoftICE 'Back Door commands' which gives infos on Breakpoints," O0 d3 S7 w9 ?7 N
or execute SoftICE commands...
& V) c/ \6 q0 C& F/ Q5 n/ m& ]( NIt is also used to crash SoftICE and to force it to execute any commands
4 ]* q" n# M7 v4 N(HBOOT...) :-((  
( ~) u/ {# b; F2 J1 g5 `, T3 I% J2 j7 Z! Z
Here is a quick description:
/ |4 e% n% Q8 h; m  s; b2 ~& K8 P  v-AX = 0910h   (Display string in SIce windows)& k( M9 S( C+ r1 f$ m, u) z
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 x7 O* h; Z+ |4 ~5 N5 L& t( j! N/ U-AX = 0912h   (Get breakpoint infos)0 Z5 ]% j" \1 T: T, ~( f
-AX = 0913h   (Set Sice breakpoints)& T' g2 w9 P& W" O) k! A5 d
-AX = 0914h   (Remove SIce breakoints)
1 P& e$ o) G5 ^3 o
1 `) Q7 S% [  D! @: M: i" w  H9 IEach time you'll meet this trick, you'll see:4 J: r- D9 _7 d) t8 S  Y: z! u
-SI = 4647h7 J1 }5 B5 ~/ _/ {. m3 a
-DI = 4A4Dh
, q" m) T- \! ?% r% _# WWhich are the 'magic values' used by SoftIce.- W# B  \- O& O; N/ u: `
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 b" R( a3 x0 m" d% I

$ o! n2 o! k- V6 E' ]7 T, D2 DHere is one example from the file "Haspinst.exe" which is the dongle HASP
" {& h2 h9 A$ c  ~- n1 pEnvelope utility use to protect DOS applications:8 p; t9 U: G$ m* ~  C5 V
3 b2 _$ b2 a5 K& {  V6 j9 y# ]

$ `% z0 N2 [, N3 ]5 b/ f4C19:0095   MOV    AX,0911  ; execute command.% W3 E2 V5 t/ j. T. }7 @, `
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
& r- _2 K# C! B+ J' V- B$ q: i4C19:009A   MOV    SI,4647  ; 1st magic value.
/ ]+ }% ?8 J5 R# y/ j8 F4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. V& @3 `/ h0 U4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)$ _. ]" D  O& X" x  Y- t  q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
6 l# B, ?( Q. A  F& Z6 X4C19:00A4   INC    CX
7 E8 }1 l- n1 a/ R+ y4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' E$ a1 J- L4 L* b. z5 r2 y( a
4C19:00A8   JB     0095     ; 6 different commands.7 H3 ?& A% q" T
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
2 G2 s$ _% W4 j) D, I: s2 L2 b( ?4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 `. C2 k# b" Q2 y7 q' _' s+ k' x
The program will execute 6 different SIce commands located at ds:dx, which
0 Y8 c  w# T- P$ {6 i4 [9 Qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
5 |0 p* K' L8 j" q! N6 U; W
$ n0 n$ e# t7 o0 r0 |5 w, W* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.7 [7 e8 j% V& p. p
___________________________________________________________________________
, [5 B6 `+ E0 {$ ^0 `* J, ^: h. Q, L8 j
  r& ~. H( H3 ]- f( g( J# X* m1 C
Method 03
4 X: F* w. X2 |=========
0 c* [' n) p9 C6 C6 A) b. j
2 G% Z8 q9 n. O: C7 JLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h- a! ^  d( R; y& `) f
(API Get entry point)
9 W: K. U. O) i: a        6 q3 C. I% y" L9 F, x5 }

1 o& c: ^/ Z% P2 O    xor     di,di7 y7 ]# G9 I5 Q( V! B1 K" j
    mov     es,di
! w# K! x! ]" \6 W    mov     ax, 1684h      
  ^5 a! c$ O/ N# p8 s$ N    mov     bx, 0202h       ; VxD ID of winice* Z8 x" B3 ~; o2 O
    int     2Fh$ H, V( {/ G7 C' e
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- N1 j8 x& j7 j% [( R- g" Q
    add     ax, di3 C' h5 U& F$ a" a" b" e
    test    ax,ax& J) ?5 P, ^- H/ w; Z" r
    jnz     SoftICE_Detected4 n  T% f0 ^9 t  V2 }; A
) g$ v1 o' \. _" j1 @  y9 D2 ?
___________________________________________________________________________7 o- v6 r4 f) N# u) ^4 U
/ n( `- U4 @7 c: ~! j
Method 04
% S) [$ o! M$ c=========
: t) _+ }# a! L0 k  h0 V+ a! @: O2 I2 x3 U
Method identical to the preceding one except that it seeks the ID of SoftICE8 a6 ~2 M: s: J1 B0 N
GFX VxD.: T; ^3 H  i. _  L3 u* ?) p4 E
6 @% h/ P% E% ]1 ~( D) e
    xor     di,di/ `: V4 Q# [- t2 ?$ `! \
    mov     es,di, R& Y! y' G$ j/ m6 q+ M, X
    mov     ax, 1684h      
7 {! E' o/ W! n, R9 Q    mov     bx, 7a5Fh       ; VxD ID of SIWVID6 N  b% d8 I' }) I1 {3 j) m  U
    int     2fh
) n/ M9 d+ A  R' b4 J9 e    mov     ax, es          ; ES:DI -&gt; VxD API entry point! t$ P6 A- _+ r1 @  t" p8 u
    add     ax, di
2 O0 m& T9 A- G    test    ax,ax6 l% C8 s8 y7 C# V% i
    jnz     SoftICE_Detected( a! A# }% |( f$ h9 ?: u: J  Y
8 Z: R0 |3 V2 `9 a
__________________________________________________________________________5 r/ }  s$ {! R! Y% P

4 s$ d8 Q3 _  Y- q+ @' v& S  ^, M1 \( a5 s0 R  k# Q6 o4 }
Method 05' t: ?: a$ G% A$ a' n
=========" @3 ~: @6 k0 }- h

: \/ x/ P3 t! A2 E2 ^: t: S# f* gMethod seeking the 'magic number' 0F386h returned (in ax) by all system4 A0 H( Y0 s4 S1 e+ ~
debugger. It calls the int 41h, function 4Fh.% d" g9 s3 c; h" a& v3 E: m
There are several alternatives.  
9 O& e$ b9 j# X1 h, }: ]( C$ v! p- Z6 i: u7 ?+ S+ `, x
The following one is the simplest:
9 J8 J/ p# |' f9 i8 J/ t3 g' g, [1 g( d0 V$ u/ U* ^
    mov     ax,4fh
' P9 J# i) V. o, m9 S) S/ M0 _    int     41h
* k- V8 D2 k8 Q, z' j4 d" R    cmp     ax, 0F3862 m6 r, e  Q! e1 b6 ?2 _/ v  ^" E$ ]
    jz      SoftICE_detected. c& E' @2 C& x6 v
: Z) b1 _/ @) [' t' b7 k- |% [) c

* o7 B2 h# y& C2 t: dNext method as well as the following one are 2 examples from Stone's 4 A1 ^* P0 J8 q& _( `8 v
"stn-wid.zip" (www.cracking.net):" r) ?% ?1 _+ X! ]

, N9 J5 u% |# O! P6 Q. Z    mov     bx, cs0 E% H+ Q! l" ^2 r" N+ ?
    lea     dx, int41handler2% K6 v, w, l+ U& z; b3 e0 n
    xchg    dx, es:[41h*4]
) X4 ~+ G% W& ^  s; U    xchg    bx, es:[41h*4+2]# A$ w& B0 Q7 F+ W$ G
    mov     ax,4fh
" w5 u- G, e$ ]( @& I1 w* n' q    int     41h
4 A6 J$ y" ~, Z+ M3 n3 _0 p    xchg    dx, es:[41h*4]
) c& g$ @0 k# D    xchg    bx, es:[41h*4+2]3 E8 |* }4 h7 N  T
    cmp     ax, 0f386h6 D. L/ b3 f2 K% {& C# U$ l) I
    jz      SoftICE_detected
' }' a* e) C, ]2 C5 _
7 |  M# X; p6 I0 Vint41handler2 PROC! l- O5 C# C- x  @
    iret4 R" |( d' ]0 l* b
int41handler2 ENDP: |* ?+ [9 B7 L/ U9 r

% `- e% v% c% ]7 s; j
! N0 D/ a! u6 a( E! w6 s2 m_________________________________________________________________________' P9 L& r, K2 f; H

# a6 q$ ^: E" \1 N" W- j. |
9 Q3 a- y- ]! y* h( a! P9 OMethod 061 Q9 A. t* E6 H5 J' l: y
=========
. D9 z% K! s% c5 @0 W
, }1 b; x! R% a! Y, T7 \$ d/ m, t9 D, Z5 F
2nd method similar to the preceding one but more difficult to detect:- h/ G8 ^5 A. b, l' {
  W9 _+ o& k& \) f/ U' u: e2 n

6 `( F& c, d# T. u+ ~int41handler PROC
3 X3 g, W7 y9 P7 C    mov     cl,al
; U5 q/ w- |1 L7 T8 O- K    iret
7 [* K6 I0 K5 q1 R* a, Qint41handler ENDP
1 \* s8 {5 B' k8 [+ \: t7 X) j( u- u

- C& Y1 z8 D: N! Q" L5 ]' u2 U; {    xor     ax,ax
' y# ?0 B" U* p/ O    mov     es,ax
7 [! d' [; ~+ p  ]" ^: a    mov     bx, cs
; |& C7 m8 V/ K9 {( v- O    lea     dx, int41handler
3 }/ ]5 b  @2 L. j2 Y    xchg    dx, es:[41h*4]
6 k: l* J, `# R; ~    xchg    bx, es:[41h*4+2]
( E' V  h6 P+ |9 C* m! `; g6 R    in      al, 40h  A7 K0 F0 ^/ R: C. i
    xor     cx,cx
; d0 I% `$ d+ Y5 I    int     41h$ c* d. Z( }% h, l9 ?( k; y* g
    xchg    dx, es:[41h*4]
8 b7 e! j/ G, @    xchg    bx, es:[41h*4+2]. k, ?1 m( s. U
    cmp     cl,al; y+ e3 F& {: e  h+ a
    jnz     SoftICE_detected: b. S' {, _! D7 s+ R  [
% R* Y+ |% k$ V( c. f, s4 r
_________________________________________________________________________6 B" r) Z8 Z. l( ]0 |1 n

" n1 T. G- k( HMethod 07
, l# n6 A2 b- E* A- J4 A=========
+ D- k& \' s( f& f+ x( Z& i* }; j, @6 |; R2 a
Method of detection of the WinICE handler in the int68h (V86)
" y8 j* A& E/ g8 F& S( E' g' K
4 {% k( ]' l+ v& q- ^7 D& d' u    mov     ah,43h
  O+ t8 G! I1 f4 f8 c- r    int     68h
0 s3 m9 ?  Y% k' D    cmp     ax,0F386h5 X& R/ U" G9 G9 [
    jz      SoftICE_Detected1 c9 H* N0 y. O, Q3 x

$ S% f; ?  t7 C# ?$ @( [3 D  K) K
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( U& Y9 n/ `2 [* b) `7 {- b   app like this:- z$ e9 ~2 |" B6 T
$ ^- a  S4 q# `/ N
   BPX exec_int if ax==68
' H3 |  x5 x: W- u8 r7 o   (function called is located at byte ptr [ebp+1Dh] and client eip is3 t2 \4 H  _  d6 e/ W, v' R' U) v
   located at [ebp+48h] for 32Bit apps)
( C) ]0 M' E4 y__________________________________________________________________________6 l& s; C5 z, ^+ T, j

/ N# H5 a2 \+ a8 k( a1 O
1 k& h$ F( R' i& T9 aMethod 08# z( G9 g: B" B+ ^  {9 ~, j
=========$ X. {* Q; k- ?5 V1 e; i; k/ E9 j
! c8 k* `& X* W, _) R/ G
It is not a method of detection of SoftICE but a possibility to crash the/ |4 ?% U" l$ P/ P: o; ^9 E: \
system by intercepting int 01h and int 03h and redirecting them to another
7 x* ~/ L, _, e$ v2 H* U8 uroutine./ p3 J* f# H, I, ~3 R; v
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points1 \, A6 J: z% u# N1 n& x, I
to the new routine to execute (hangs computer...)
' I. j5 d8 O- g5 y( R& t8 n% J+ V7 r: x6 f/ P/ d
    mov     ah, 25h
$ O. n, s) P0 d( ?4 I/ E; D2 a; V- ]9 X    mov     al, Int_Number (01h or 03h)% M0 ?& |* T# [1 n% T6 [, `
    mov     dx, offset New_Int_Routine
4 j' n4 Y$ t$ E    int     21h+ {2 o5 D% K. ~; z& }

9 n" w8 J7 B7 Z2 k4 o__________________________________________________________________________
3 j3 R: K' L4 a5 l+ x! t7 D9 Y" e& N4 j) B3 O7 V. @- D- K( f
Method 09/ k3 A, K# b4 o; u* B" K2 y( H
=========- o" p2 @% u( F0 Q, \! M6 {9 ?

) C6 D1 j+ K( N1 ]6 P4 {This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: o" Y+ `. N8 S. Y, |5 M
performed in ring0 (VxD or a ring3 app using the VxdCall).4 A4 n# s# l- \4 l3 R
The Get_DDB service is used to determine whether or not a VxD is installed* o. J  u4 a; W2 Q
for the specified device and returns a Device Description Block (in ecx) for- n- O* k; @7 \9 c1 `4 N
that device if it is installed.
9 p4 B5 }! q7 g. e! P$ [3 Q  D' t0 Y8 p' `" M0 C3 r7 q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% H3 F4 A& Q" q. Z$ B' d4 h' S/ `( n   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; }* j2 P! h1 z" D) D   VMMCall Get_DDB
& s+ r7 z, x) R+ b1 V   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 k/ k% G" q0 w) Z# M* P7 o) V$ P& w, Q- |6 L
Note as well that you can easily detect this method with SoftICE:
" M# f6 _& K' d+ M& t2 }   bpx Get_DDB if ax==0202 || ax==7a5fh: ?3 m$ J5 \2 W' D

  {6 W  j( o. t% w) S__________________________________________________________________________
1 l" P0 ]. f' z; q+ e% C. L6 g" U! K8 o% P: j  F* a3 n  V. O
Method 10
( f  Y& t9 F+ T=========
5 M! z1 U! q( q
% N4 o# t, B+ k# d) w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- {" v( x3 p( c9 E( p% x  SoftICE while the option is enable!!2 f! C6 `% n  P) P* i% y

0 r3 x- ?% d* u" \0 n& w+ Q1 rThis trick is very efficient:
4 f* [8 }  _8 w$ G- J0 o  ]by checking the Debug Registers, you can detect if SoftICE is loaded* M8 b* U% T4 S* j: w* H
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, A" y+ |8 L% D7 _3 J4 kthere are some memory breakpoints set (dr0 to dr3) simply by reading their; p' z; [. q5 I- `5 S  m
value (in ring0 only). Values can be manipulated and or changed as well, L4 ^- E  g; A) |
(clearing BPMs for instance)& e2 ]' M! P# g& {% v
+ ^$ b5 [$ j2 z2 u' m1 d# `
__________________________________________________________________________
7 Y8 A: v9 ?- B) D7 i: J) ?) O+ z+ K: x& k
Method 11+ v& a* |# i$ f* [) V1 [( f
=========
( ?" y7 T, P  k$ \& h
% \- L. C0 F" V  t, GThis method is most known as 'MeltICE' because it has been freely distributed/ {; X2 H9 X& d: J# C* r4 X& f. l
via www.winfiles.com. However it was first used by NuMega people to allow
  F, X( }* T1 e- a% v0 S' QSymbol Loader to check if SoftICE was active or not (the code is located
* x  u0 B8 F/ n$ L5 Winside nmtrans.dll).7 x. C+ T6 J' I- |7 {
6 [$ N, K& E  j. O5 d, y
The way it works is very simple:
5 D+ V. y  U' Q' Q: l0 aIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 U# U4 B; D5 j/ O
WinNT) with the CreateFileA API.% v3 ^4 u' A7 \' n7 f" m; \8 S  A
3 ~6 d9 Z: |2 C4 E
Here is a sample (checking for 'SICE'):
! {; h: B* N5 p9 U) @' n2 J2 S3 u3 I! e$ s/ w
BOOL IsSoftIce95Loaded()) n/ a8 ?6 i! i/ e7 h; d5 [$ j6 d
{
! u5 o! b9 E/ @   HANDLE hFile;  
, T$ y1 }: z& R' {3 M   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,- q! X. L5 x% Z* R
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
3 `$ r; c) b& y; v3 }* p6 U                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ E4 i& L* {5 x8 J   if( hFile != INVALID_HANDLE_VALUE )' `  P1 M4 z  `( F! J3 p
   {
; c5 f$ u+ p4 u' W( q* w      CloseHandle(hFile);/ u$ m/ v: g1 a5 k
      return TRUE;( B2 P/ k% ]# g; d# B
   }6 r: N  ?  J6 Z/ l# Q* C- ~
   return FALSE;+ V% e  ^& J2 {0 w* o3 l( z
}0 t) Z7 h- B2 `% ?0 ~( z

$ E' j: d7 e) l8 O9 a" IAlthough this trick calls the CreateFileA function, don't even expect to be
" n' M+ r6 i) E- T" Oable to intercept it by installing a IFS hook: it will not work, no way!& I$ N& ^( [+ n4 Q% ?0 `! S* E% N5 M
In fact, after the call to CreateFileA it will get through VWIN32 0x001F2 j8 i! N: l- H8 d% A5 n
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 \( m# N! G; Vand then browse the DDB list until it find the VxD and its DDB_Control_Proc2 N  G, f2 a/ Q
field.
" D% T% b6 v( }  n( nIn fact, its purpose is not to load/unload VxDs but only to send a
" n  ?+ u% t- _, b3 |9 h+ f. pW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( Y+ b0 M' L# r: wto the VxD Control_Dispatch proc (how the hell a shareware soft could try
% e9 ^4 a. l: b, |  pto load/unload a non-dynamically loadable driver such as SoftICE ;-).% S5 B& ?: |9 [! i) }
If the VxD is loaded, it will always clear eax and the Carry flag to allow! r2 A& l% S  d. a& `1 [
its handle to be opened and then, will be detected.. t( C6 j1 m5 G+ w* i
You can check that simply by hooking Winice.exe control proc entry point
4 E3 c% k. {3 z( v$ |% ~: n4 Lwhile running MeltICE./ U/ F& O6 L' x  F0 ~4 @
. p9 b0 D; }  a$ l- j! G

8 h% H( b) X' X$ Y" K. x9 w* R  00401067:  push      00402025    ; \\.\SICE0 P5 i4 I: g; L2 f2 n; }$ r4 a
  0040106C:  call      CreateFileA' j, K3 e: m. ]7 ^0 {: t% B
  00401071:  cmp       eax,-001
5 {( x* Z, Z8 g0 C( P& Y1 ^  00401074:  je        00401091. ?: t: F' M9 @

; r4 Q8 B1 B0 V2 U: e# B+ J$ b% m* P# a; }( D: ]& k
There could be hundreds of BPX you could use to detect this trick.: Y% i* e# H, }
-The most classical one is:1 H# `) q; p& R, L, T% U  R
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 f7 Q% a: L0 `' B# s7 B    *(esp-&gt;4+4)=='NTIC', h3 W0 a3 Q. y- M' y: L- t) e. U

1 V. u% S8 E+ p% j2 P# G, ]+ ]-The most exotic ones (could be very slooooow :-(
  }; ^4 ~7 f2 H   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 b" N3 ?4 S" [% a, M/ Q     ;will break 3 times :-(3 R5 |. ^9 j3 c$ k, b6 B$ _; a
6 E* L* [: K1 |' c" o! k% i  U
-or (a bit) faster:
/ ]' E; G: g- j- W# ~8 T' A& a+ W   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ @# _0 `* x' j" q1 o1 ^/ }2 q# h+ [' w; ^- m- V- b
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, s, c, D5 u& q5 {5 V0 m: c0 x     ;will break 3 times :-(
* }, \* f2 d7 Z5 ^6 t! S" [6 K" L6 L# ~# Q3 B
-Much faster:
: W8 f+ C2 S5 H1 Q: J! S0 o. X0 I   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 K( r2 R/ @0 a. R9 c6 \
) t! H, ~' Y9 ^3 e2 |
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 O( O8 g0 o0 B8 yfunction to do the same job:, s  Q# H% w# I& r0 v+ g

& L+ i3 R  b+ f0 z3 O0 k, ?   push    00                        ; OF_READ
  Z5 `, ]9 L, c4 \" V7 U8 C   mov     eax,[00656634]            ; '\\.\SICE',0
: u% u, ~% i1 q0 b/ w  U0 z' }   push    eax7 j6 j- l2 M, b- x( V( y) O
   call    KERNEL32!_lopen
- F9 Z! J$ B, @9 _9 P' d   inc     eax
8 V% q/ |2 f+ S0 _8 Y6 e. N( ?" C   jnz     00650589                  ; detected
0 ~1 K% n+ @# D/ S. Y! r& s. B   push    00                        ; OF_READ/ f! \: L2 O! d. H0 U" k9 J
   mov     eax,[00656638]            ; '\\.\SICE'
  Y: V0 ?  z2 i6 [1 a   push    eax0 X; j* E- J9 ?* s0 s
   call    KERNEL32!_lopen
+ I) t& @4 O1 V5 J" q0 h: S6 N   inc     eax
( J* ^5 V) `+ R8 g* L0 Q3 T   jz      006505ae                  ; not detected
& _0 m7 n" {5 W4 V4 E# w; u  w, A2 E+ F$ w8 |$ \
. N  L2 Q+ O4 S7 e% V
__________________________________________________________________________& Z$ J' g. x2 @
# z, z+ o  Z  ], C, @3 T2 E* P
Method 12( L) w+ O  p( s% x/ ]
=========
% |6 |3 v3 O: R1 }. Y" p. X" L1 V4 O
2 P* h+ ~' t& z6 XThis trick is similar to int41h/4fh Debugger installation check (code 05
- h/ v9 V; L1 s( D&amp; 06) but very limited because it's only available for Win95/98 (not NT)5 A% A3 b1 k- s* g; H
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 d" z# ~0 ?- m  v/ h9 D/ l
1 o7 y+ `3 k- L+ A8 g   push  0000004fh         ; function 4fh
5 K0 Y. `9 J8 q% r. [9 m7 u" Q   push  002a002ah         ; high word specifies which VxD (VWIN32)  W* `1 D" k$ H
                           ; low word specifies which service
+ {7 Q) h# p' _7 \. l) _7 g                             (VWIN32_Int41Dispatch)+ f. X$ }8 h+ ?. v9 C
   call  Kernel32!ORD_001  ; VxdCall# ?) |! B) s' p! S: P8 |3 F5 d
   cmp   ax, 0f386h        ; magic number returned by system debuggers
* T4 E( r0 X3 N, Z* P   jz    SoftICE_detected/ N/ l* U! T' z+ q- P& [4 ^

1 f" E" U! X+ R9 y7 i( GHere again, several ways to detect it:% B! X& g3 Y/ u9 y
2 e& s1 A( [6 N: g! v# h9 `% `
    BPINT 41 if ax==4f- j! x% l/ Z9 `9 a/ T+ o
! P. W; L+ h& Y/ k1 z$ G
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! d" [8 f; i7 G8 U  ?" R
" W7 \+ c2 D- Q- i    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. r- n7 V. A- s( x4 ^/ u( `! C; s5 o
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
6 {  y2 f  V* g; s9 F  ^* E, ?( x7 C2 j  Z. g9 q
__________________________________________________________________________
5 R3 z9 O2 _* r) h0 Q* f2 U$ M2 r" ?3 n! p( ^5 b
Method 13* `2 {2 f1 r% n% _/ E0 r
=========) J4 |5 w! L5 j( f

: w. i2 O0 }% K# T6 tNot a real method of detection, but a good way to know if SoftICE is
. s- z% E1 n- `1 binstalled on a computer and to locate its installation directory.: |' a& r* [$ n8 _: E
It is used by few softs which access the following registry keys (usually #2) :
! s; Q! N# G0 n6 h) K7 j0 ~) s$ K
0 w9 |2 ]5 z. ~. H' @# o-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 j# m7 _9 S3 }! `6 b5 A\Uninstall\SoftICE$ l. k/ \5 t% ~8 f9 o
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE6 \8 ?% o' Q% d; A; b, _4 }. B* e
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 h( a. D7 V: C9 E. R. F, o\App Paths\Loader32.Exe2 L! {/ Z! f4 H# s8 R& p8 f! I

! d9 [. @4 j* J6 G
; X0 x: ?: _) j% n# QNote that some nasty apps could then erase all files from SoftICE directory
* }: f( A+ P+ h/ {(I faced that once :-(1 e& [2 C  m; ^3 A6 ?9 r' ~2 i

* H$ Q. d+ i* @" W4 kUseful breakpoint to detect it:: F; _8 `- t8 a- `* |

) t' ?3 S) X) d' `- h$ Y6 b) i* j     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ Y' Z1 g% I  ?' x% D
3 i: }1 z% a+ X/ E- r  B# P* @$ w
__________________________________________________________________________2 g- N7 U3 i7 e8 ?

  k" a  w7 Q9 d. c" y  ]1 s& R. i2 P1 p3 D! F. G. c4 c
Method 14 ; D0 h+ m+ n& c5 a7 a
=========
, s  e" z  w6 v' ^9 Y- h) Y, P7 Q7 k) j# Y& \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
- m' U8 h# I  S' t" eis to determines whether a debugger is running on your system (ring0 only).( [* g" h* m5 E) |6 [+ [
) Q* U" s4 ^7 r2 Y  o( w# n
   VMMCall Test_Debug_Installed
9 e; ]" X3 h! J+ G& u" [   je      not_installed( a  w$ t6 Z8 W  }/ ~
9 R) X# Q' ~! W; a6 h5 }
This service just checks a flag.% Y8 ~: K$ s/ X
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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