About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 ^+ M* t# t7 i
<TBODY>
, v1 ~( h; \4 e2 {9 C<TR>6 y- q4 u% g8 h( x9 M
<TD><PRE>Method 01
; z  [/ _9 `1 ~: |- c; \=========
# h% p' }/ h7 r7 [% b  C( D) B6 ~: \+ \* z1 W# r. v5 E1 _% G
This method of detection of SoftICE (as well as the following one) is
+ M1 i# ?. C# T9 x% z6 D4 qused by the majority of packers/encryptors found on Internet.
# S- S; ?4 y, f$ k# BIt seeks the signature of BoundsChecker in SoftICE
: V* n1 G- K! Y& z; o4 Y  H# A, X# g; d( ^2 x& Z9 x; v% C
    mov     ebp, 04243484Bh        ; 'BCHK'
" n% i' O3 T! F    mov     ax, 04h
; V3 V7 j0 h, G# [    int     3       & p8 W' \3 ^( R' Y
    cmp     al,4
( f8 a/ n) L0 o! v    jnz     SoftICE_Detected
. z6 ]6 }) \  a+ H! W( t% W7 a! h$ e
___________________________________________________________________________! V! O$ G' v5 Y0 u) a6 D

$ K6 |% F3 `' K; I/ [/ w3 w  E8 n% FMethod 022 k( x. Y+ G$ E7 C8 `6 l, h% I: T
=========
( i! f% b/ v; A- S1 w3 v0 ?& V" O" y* S
Still a method very much used (perhaps the most frequent one).  It is used
0 l+ j; l- ~, l4 r! Pto get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 b6 d, k5 w- M
or execute SoftICE commands...- @! A+ K( h- D  M1 t. D% A
It is also used to crash SoftICE and to force it to execute any commands) Q- v+ E- U0 c2 c$ g/ g: b* W) [
(HBOOT...) :-((  
5 _/ |9 ]" I$ k
. b/ }! K% @' Y  t3 d) b5 p( E0 BHere is a quick description:
) S+ E# y& r' {  W* }- e-AX = 0910h   (Display string in SIce windows)
4 ~& R2 q+ r- k( v  d3 r0 M( h-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)6 N& ]) Y$ ~( J# S
-AX = 0912h   (Get breakpoint infos)
, ^* o2 b) t' b4 E-AX = 0913h   (Set Sice breakpoints)! \: `: O2 `% B; K
-AX = 0914h   (Remove SIce breakoints)
9 x: P' ]# A. `+ |$ R% ]7 Y2 @8 i3 R# T3 U7 Y
Each time you'll meet this trick, you'll see:
5 x8 ?% k' N) A) ^2 R-SI = 4647h
3 r" {8 |% N: I" R9 W( w2 d# n# l-DI = 4A4Dh' f$ c/ E4 e3 X9 N8 U$ l5 C
Which are the 'magic values' used by SoftIce.
! b+ L0 s" E) [; a/ a4 \For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
; j" o  c4 _, F) W. V* n+ h' A. o. g& `8 K( C
Here is one example from the file "Haspinst.exe" which is the dongle HASP
- a7 g$ [6 U% M- i0 ^Envelope utility use to protect DOS applications:
- Q) u" G. ?" e% Y  c
! q& G. y$ i% d% r2 E* a% ]8 J& v& E! q$ U, q0 a
4C19:0095   MOV    AX,0911  ; execute command.
% T5 U, B9 e4 Q6 y" J) T" {4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: J. j) A. Y' ^; I. j
4C19:009A   MOV    SI,4647  ; 1st magic value.! |6 O2 E* {- k  j+ ]' B& m7 N; A
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 Y7 m9 x$ E) W4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& n: |' u  Q+ o: F2 }  C& ?
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( p* |" a. P- q; m$ x) p
4C19:00A4   INC    CX. s. L9 Q' l6 D: u
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 r* y" [: n+ ^' A2 a( L4 w4C19:00A8   JB     0095     ; 6 different commands.
/ J6 ?9 ^, M8 e+ m8 J, y6 L" b, N4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, {, E1 ~0 ~6 x( i0 L! n) R4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 E2 i8 c( ~0 U! H" F. w$ m
* Y# O+ E& Q4 n- {& b3 h! I0 j
The program will execute 6 different SIce commands located at ds:dx, which
: o  A) C4 T& Y# ~+ [are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 t$ b7 T, D# E- C# C1 _7 O! j

& S' e# S0 v, H* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." `! L5 |% L$ V! f1 [  B/ o9 {4 N
___________________________________________________________________________
. B% [$ W: e; \6 p8 R5 Y6 R
2 U- b1 m4 ^' t5 D8 c. {
( M+ ~7 M4 M' Y1 T7 p# UMethod 03
1 r  I, F" Z- c. B6 x# t$ H=========9 w, P/ S3 X8 a& {5 ^" N7 f
. f3 [; i! x( O  V2 Z1 }
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 S% [" F) q7 P% [4 m2 _7 L1 ?(API Get entry point)' ]' [3 p$ u1 ~$ A+ g9 l
        
* u6 _3 i6 F2 r9 c- t- `. Z5 f" G$ q4 M" F/ Y; k. p
    xor     di,di1 b6 h* b  u1 L
    mov     es,di
' `3 E6 B7 g6 W" A, }, c& w    mov     ax, 1684h       1 x' v# T) A2 F: d; c
    mov     bx, 0202h       ; VxD ID of winice
- {  w5 D. w% w    int     2Fh
7 Q, B, m' |7 g! g8 _/ |5 y: P    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! K( M( n7 _8 y5 ]: c: }8 J    add     ax, di. n" N5 l6 n7 n; V
    test    ax,ax
( g7 h7 v3 x( l/ k0 M    jnz     SoftICE_Detected& r  q! r3 v1 J
5 j8 r; c0 ?, ?% }- e
___________________________________________________________________________
* p" ~# m" Q" v, w) k/ `6 t
1 v+ {8 j, h7 n2 W% DMethod 04  U" e+ z- g9 ~& T3 v
=========
* H0 l4 o) j$ \$ Y. |- i3 f# p% n/ G
Method identical to the preceding one except that it seeks the ID of SoftICE1 @. h7 D  I" v2 a4 L% {" l! t/ t" U
GFX VxD.) c& J3 Z: @' N, I
# z) R+ q6 F! r4 @3 s% l$ z
    xor     di,di% x+ i# E; t! F# Q' w
    mov     es,di4 I( g. U( m3 x& p$ P6 R7 C  H
    mov     ax, 1684h      
" O/ _7 f; u, @) z# \4 @. k. f4 |    mov     bx, 7a5Fh       ; VxD ID of SIWVID, `4 X0 x7 s$ x5 y
    int     2fh
$ ^# s2 V8 x2 ?% M    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 z( _$ I8 Z: w7 {3 u, W% a. M    add     ax, di
; G5 X) l3 |2 U1 Z4 D/ S    test    ax,ax+ E0 i/ T* W' H$ B
    jnz     SoftICE_Detected
& S, u! S% |- v5 P( j8 ^
  m/ q# ^$ q/ P! T; Q__________________________________________________________________________
. o1 B/ R4 T* f! t0 O$ x5 z
3 }1 ~1 j& s" b5 R9 H
% Q& P+ q& m5 R  a0 tMethod 05  x9 o- L5 l) i3 R) t+ s
=========
0 z3 @) X) u# X+ e8 }. {! K( O. h
Method seeking the 'magic number' 0F386h returned (in ax) by all system' B1 W0 ]9 j) j& ~1 _. C! l
debugger. It calls the int 41h, function 4Fh.* ]+ H3 y; Z8 R1 b; q
There are several alternatives.  2 T9 v, y4 o! m* _. k5 g2 _% U+ D( I0 m

* N3 \' j9 }" |$ a! b, x4 JThe following one is the simplest:
3 W6 e9 U" G5 g4 J, \: _! @9 V' J
+ Q, T! l7 ^# j, W+ D. `    mov     ax,4fh; g4 g" K& H- R# b# w+ ]
    int     41h
' X2 {0 `# ^" B2 e    cmp     ax, 0F3869 ^' O% |( {) X& z/ |
    jz      SoftICE_detected6 I) ~  M& a! b& W8 X1 b/ e
2 T. |7 t0 f* `) Y8 t. g5 \

. C# c5 L; v* R1 O  m: zNext method as well as the following one are 2 examples from Stone's
9 J  w4 n$ k) O8 i+ w"stn-wid.zip" (www.cracking.net):
6 G& v. W) a5 S  t8 e
. x7 w8 Q0 z7 F    mov     bx, cs
8 m4 B. B. U7 a; o    lea     dx, int41handler2
! x& T" I4 j+ y4 H( e! k8 L    xchg    dx, es:[41h*4]
9 ^# f2 C- m: Z0 p    xchg    bx, es:[41h*4+2]
6 \! v: S0 u* v  Z! W& Q    mov     ax,4fh5 M7 [$ A/ c# a. t+ z8 l
    int     41h
) \. G; f7 N  i6 g    xchg    dx, es:[41h*4]
4 d$ t% G% T- \* ]: k    xchg    bx, es:[41h*4+2]* d1 u+ _% V& t
    cmp     ax, 0f386h; D1 Q9 |) u' S3 Y! g- T
    jz      SoftICE_detected, s: ~; O9 v9 j) \, y
% Z5 g) W8 Q/ F9 y
int41handler2 PROC: X8 s* W" I+ E* I3 z  [  d& Q
    iret8 k0 [' B. j/ {
int41handler2 ENDP
6 j6 \3 W7 I0 d1 Z6 R
7 Y& f2 v  B& e* Q
, v# z6 Y  K+ C5 ~2 z3 R) P0 r_________________________________________________________________________1 w" w* F. c  _/ g0 P

0 d3 y7 G% {6 J' k6 }' }  M9 n0 F1 x6 a/ I: H
Method 06
, o' h( `6 P7 ~% z9 l=========
1 S  Y/ [' H9 @# |9 G% P$ `# M' D; q3 h
0 s* R' ^6 D0 @6 c9 F0 h  N  m4 x3 n; l/ ]6 t
2nd method similar to the preceding one but more difficult to detect:
- n! |3 @+ v5 S0 |/ Z
0 e( W, a, C% J9 t9 [) Z9 n- ]7 }
4 q$ |* N% h- Q/ D% L8 ~  c5 tint41handler PROC
- O/ l  K' x; Y. Z    mov     cl,al. Z. _1 F: X3 p% v$ a! Y' O2 \1 @
    iret2 }4 i9 ^: I7 f, j
int41handler ENDP
3 z  n$ p& M- K+ o
- [; O. o, y+ H! y9 s# W% a: @0 j1 W3 v
    xor     ax,ax
. [1 H" V, f, x; U. P; ~    mov     es,ax
* ^, F& ]9 j/ x$ B* I" }- u    mov     bx, cs
7 `, L) [' D' G, e    lea     dx, int41handler
! d7 L3 }* s) ~    xchg    dx, es:[41h*4]
) L  H5 ^- O: J1 C; c8 p7 r, W; h# A    xchg    bx, es:[41h*4+2]
1 f" t+ J; D2 ?& O6 d5 s0 O    in      al, 40h$ o) c. b1 U/ x4 J
    xor     cx,cx
8 E" p8 ~+ Q/ @- S    int     41h
% C% d: |( d- @; A) N$ Z    xchg    dx, es:[41h*4]
8 K. W2 x  D& o' T' B    xchg    bx, es:[41h*4+2]& x+ ?  O7 I% G9 w! C: H
    cmp     cl,al+ E7 I( W* `- L' S6 a2 Y
    jnz     SoftICE_detected
  _0 l2 a7 X& J
) \( R; U; @. v$ k) e_________________________________________________________________________. G  I8 N, a( S' a0 C; d' {$ F4 v

2 P) _6 ]4 h" g% Y( G( E$ `Method 07
3 A4 Z* a& w- J- B" z% k) W9 }' w8 N, p=========
  |( K* M/ F& k, Y
) T- s* Y; h% h/ M' J5 sMethod of detection of the WinICE handler in the int68h (V86)
& p0 C' e! u, l6 B8 }) a5 R+ {( H  C7 w* z
    mov     ah,43h
) G6 e0 ]% V6 E$ u; v( [" V# x) o    int     68h( v9 ^2 d( j1 ^  r1 z
    cmp     ax,0F386h# B/ l, Q! z. r# @2 N& I5 ?2 a
    jz      SoftICE_Detected7 ~8 s; I" [( @: h# A; i' S* x
( B9 p$ z' Z; W0 D3 j

! N% j- d  [+ L2 |# b/ d=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( ?! b& e* |. k8 ~7 r% D( `5 w, s   app like this:! J$ N* t! D. C& l
1 N5 \& `1 I5 d" ^. Z
   BPX exec_int if ax==68
/ C) d) B. o7 w4 O: o2 f   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 M' Q" a. q8 |' B   located at [ebp+48h] for 32Bit apps)
3 n. R, Z! b$ P* [0 L% [__________________________________________________________________________
6 m, H2 o+ E/ J; P/ u5 [- e8 Q( P' Q  ]9 e1 R; r) I- H% S5 T

) b& S; _( P$ EMethod 08
& e" S) ^9 z% v8 U* Q8 j=========3 W1 l0 g8 b! Z# Z

9 |& X6 x+ |# h2 p9 d* C; ZIt is not a method of detection of SoftICE but a possibility to crash the; f2 g& l, V+ t3 P
system by intercepting int 01h and int 03h and redirecting them to another
+ i% M( W2 C6 O0 F6 s' droutine.
5 g0 v8 J6 n$ RIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 |/ q, D0 d3 g/ x& [% ato the new routine to execute (hangs computer...)
2 X; z+ O" J' Z& M0 D& W
; R) `& H9 }) g& k1 h5 `# Y    mov     ah, 25h
# k9 ?* d4 }4 `    mov     al, Int_Number (01h or 03h): S0 b( z+ K2 ~) p- O9 ?+ |
    mov     dx, offset New_Int_Routine0 A/ `( G- ?" `+ o6 J
    int     21h6 ?3 ?. `: a( P# M6 p5 K

, g  y8 Q- k& I__________________________________________________________________________4 K2 y3 k. o0 P$ v, G+ L' c$ D

/ u! s$ {" m2 k. H2 t0 B, \0 {Method 09
  I$ F5 A, q* ?6 _=========# S! I3 S" P; Z+ y2 y/ L6 o

8 a3 l5 C' A; [This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! J$ _) ]. v* aperformed in ring0 (VxD or a ring3 app using the VxdCall).9 @- s5 A: P; V' v. q9 F
The Get_DDB service is used to determine whether or not a VxD is installed
5 U2 a: l8 g& g* Q. ?5 n3 Ufor the specified device and returns a Device Description Block (in ecx) for8 k* W" ^# W6 J& o! K4 v7 v
that device if it is installed.# g% ~" U3 l, W6 j+ w$ P& n
8 {' c3 Y7 P" R8 W5 U0 a2 J' C) c
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 t8 s9 k8 h2 F7 K
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- F4 Q8 S+ r4 X! ^# \. N
   VMMCall Get_DDB
+ a$ b5 V% ]/ c% o8 L5 x   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% E: R1 |4 ~  k% |% V

6 g2 c. D2 ]2 `, l; t( P  ^Note as well that you can easily detect this method with SoftICE:
; U7 {& Q, E" i4 K/ l! ^   bpx Get_DDB if ax==0202 || ax==7a5fh- d6 d* F4 O( S; p6 H
/ |1 L! ?0 z! q' b( |% @5 Z" c
__________________________________________________________________________$ }5 X% z0 {3 W
! y3 A  A9 M3 ~, u5 W4 Y
Method 10
% S* d- {7 S# s( I3 T+ h  b: O=========- H* k3 r) Q, \% E* D6 i( b

8 l1 v8 K7 k  i# o4 O=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) |$ }1 U1 X7 H5 O1 g
  SoftICE while the option is enable!!
7 c8 N# A- J  f! S: n+ j: G3 }6 e; z& I  [0 J7 P/ k9 H' H- L  h9 X
This trick is very efficient:. w2 V, f/ f3 ^) Q2 r
by checking the Debug Registers, you can detect if SoftICE is loaded* d  m( D# E2 U! `
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  {2 B9 i/ Y6 U+ d2 X5 t, sthere are some memory breakpoints set (dr0 to dr3) simply by reading their) x& t1 _: t' G# f0 Y& T" g% P8 n
value (in ring0 only). Values can be manipulated and or changed as well, e% `7 g  @  X. T7 M8 a
(clearing BPMs for instance)' G+ b7 G" e0 F/ B; l5 [6 |" B

9 J  ~8 w. W/ Q& \; W1 V__________________________________________________________________________
0 P3 s8 F5 a: E) ]$ N. Z2 t4 q) U* }. O6 C: t9 @, O6 P4 m
Method 115 Q+ N: Y  O0 i/ W- m
=========
$ J2 }; m* j" N* U- N8 P: i4 A" S0 g; f6 W2 a
This method is most known as 'MeltICE' because it has been freely distributed' t: U! w. x, Z, E7 a' {; n6 L
via www.winfiles.com. However it was first used by NuMega people to allow$ ~: L& T% f8 N. m" l6 S5 h! ?7 {
Symbol Loader to check if SoftICE was active or not (the code is located
" \! `( F4 C7 A: w1 H; _0 V- I8 minside nmtrans.dll).4 Q" a/ r( }7 f) h" C

% F6 y: z- s! q9 i+ |# i. NThe way it works is very simple:3 }8 h4 R  ^6 j- a$ d+ P$ H: B
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; N4 M6 R/ b9 v9 Z) Q* s6 ^4 B
WinNT) with the CreateFileA API.
  u% h# M; Q% P5 C
- w  Y: ~  T6 X5 S# GHere is a sample (checking for 'SICE'):
9 V4 ]% {+ s# f+ j1 d! t6 L7 k* r# E/ d
BOOL IsSoftIce95Loaded()
/ z; M3 F. O1 X7 O( p{! n+ m9 g4 P' U6 U" [7 r7 W! M
   HANDLE hFile;  2 Y$ u8 e" j& p3 ~  P0 B* B3 k
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) J" X/ k  U, @- S$ [
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  q; l6 k& U1 p                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 ?" B/ V/ E+ a  @   if( hFile != INVALID_HANDLE_VALUE )
. ^0 H: g' \9 ~$ B   {0 J" \' ?. q4 I! n( Q( r
      CloseHandle(hFile);
+ T* [3 W; i3 ^% l2 f, n      return TRUE;4 r4 S9 m/ d' q/ W
   }
+ u3 b: X  n; M/ c4 Y   return FALSE;
7 r! e, H" |* R2 _9 a; P}9 S$ Q4 l! V- B( H& v
1 e( a. @) d$ p; u7 z
Although this trick calls the CreateFileA function, don't even expect to be/ v1 e( A* j, o8 ]3 I
able to intercept it by installing a IFS hook: it will not work, no way!
! S, J2 e# i* d8 lIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
, Z/ @6 D% ^* R, m1 ~+ ~1 x6 y4 pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 d$ G4 }6 o4 f8 F+ H& K8 |0 E
and then browse the DDB list until it find the VxD and its DDB_Control_Proc& t+ R5 ]/ d' }% _
field.7 N; H4 C8 @, {" p2 @& T
In fact, its purpose is not to load/unload VxDs but only to send a ( C( r+ E# g- S! _
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 U1 v8 s/ r4 Ato the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 \8 e6 d' }3 r" o6 J  [to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) B5 z# Z9 {! _  n9 O! |: `If the VxD is loaded, it will always clear eax and the Carry flag to allow' e5 m2 K# S2 ?
its handle to be opened and then, will be detected.5 @) v; g) C! E
You can check that simply by hooking Winice.exe control proc entry point
" ]2 b- L+ y0 {/ ewhile running MeltICE./ Q& ~/ V( k+ |3 Z) m9 ~. p+ t

9 [, i. x' f( W0 K2 _
+ D( }5 m; W5 }1 D( u, s' B3 O  00401067:  push      00402025    ; \\.\SICE
9 _8 f: l7 B3 J) O  0040106C:  call      CreateFileA
& C# O% ]! ]- M) g: G  00401071:  cmp       eax,-001
5 S3 [8 @( B4 o' m* `/ R  00401074:  je        004010915 S* ~- I; c" V# G+ w' V

7 d% @8 K2 g- X' M6 f0 j: F5 h& \: l
There could be hundreds of BPX you could use to detect this trick.
4 t8 O5 d1 b; J9 v2 ?1 \-The most classical one is:& R9 x0 I$ c. z( U5 p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 n0 L; _) `& Y$ B  Y% K5 U    *(esp-&gt;4+4)=='NTIC'  r0 g9 i. t9 u9 K7 }
" v# L" Z! M2 O  s& x# h. v
-The most exotic ones (could be very slooooow :-(
$ i% r: j% x, I+ m  c   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ L  [6 z9 Z2 X9 \: L4 ~# B5 _
     ;will break 3 times :-(
7 A( W* J: x3 r3 L
. l& C* |& Y) F2 P0 k-or (a bit) faster:
' I. A) S6 L4 w; `! d5 I5 P2 I2 j   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
0 l7 z7 S6 Q5 Q$ z8 g, {* P9 v: o3 A
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 y; K: k. y3 ^$ O     ;will break 3 times :-(
* U9 s1 s! a1 a( ~2 @
9 b. ^6 u2 q& z1 D4 a" q7 A' H-Much faster:$ y& W2 K! K* e, O6 T5 n6 r
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ W. F: ~. w. b- O
  H7 p! y8 Q& T( r5 u
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
- G! z" E; _+ b1 v' lfunction to do the same job:% ~: N* Q' I, Z) ]3 ?( k
6 g9 x3 t5 W5 s% I$ H" B  ^% j6 a
   push    00                        ; OF_READ# s" C2 t% s& J* ?1 F: A* s4 j
   mov     eax,[00656634]            ; '\\.\SICE',0
, n% s8 a6 w# A3 q% p; s$ v: y   push    eax9 M7 T3 C# M+ @2 S$ _* F
   call    KERNEL32!_lopen
6 ~& w( p. T2 ^# ]. o% w   inc     eax- C* }( b$ N; _" |, E6 i& l. s8 o
   jnz     00650589                  ; detected
: i3 T% _! }! R2 i: e% E6 A   push    00                        ; OF_READ* e5 s/ o7 @5 g9 ~" b+ e
   mov     eax,[00656638]            ; '\\.\SICE'
* S( t) u; K6 i1 T  k: i8 x. {   push    eax
* C8 j; }( R# O* B" O   call    KERNEL32!_lopen
  m! J6 f4 |$ z* q   inc     eax- ]. Z. O- y* j& g7 P& G
   jz      006505ae                  ; not detected
) r. O' Y7 T1 k% b  o; R0 k  T7 D4 @/ S  ~0 F+ d5 l; c8 `

' c% K& b4 S  k__________________________________________________________________________
6 b9 X' m8 }& u  J0 g; F# Z9 e5 z7 S% a  K. s
Method 12# v' n/ Y% ?: K. ~0 S0 G- m
=========3 P3 `( y% s" N+ }$ Q& ~0 _; V
: m4 z+ M. S; z2 I9 j4 }7 ?3 I
This trick is similar to int41h/4fh Debugger installation check (code 05
  L' {- H) d$ ]/ R( m$ g' Q* T2 Y&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 C3 x) P/ ^  I7 P" [2 ?& p# _" W, k
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 X- u( x; b; F: }# m. ?6 G5 w
# ]. V% `7 I: t$ J# A   push  0000004fh         ; function 4fh, }1 m& d" k+ W2 a9 B7 [2 V) |
   push  002a002ah         ; high word specifies which VxD (VWIN32)
- q/ C( P% l2 ]2 \5 K. ?. C                           ; low word specifies which service
4 j& Y  G, H6 Q- x                             (VWIN32_Int41Dispatch)7 L2 u) V2 `- z- B
   call  Kernel32!ORD_001  ; VxdCall2 k2 u' }" G# A" L5 O
   cmp   ax, 0f386h        ; magic number returned by system debuggers
* v' D8 F' e$ F; g8 [   jz    SoftICE_detected! S7 k4 e: I2 \1 S$ H- ~8 O, i
; j& X% i( j" \" |# z
Here again, several ways to detect it:7 W' u6 X3 C$ j  G+ N& _

0 }( f' V; N6 c* ?& @& {1 \    BPINT 41 if ax==4f' y4 [4 d# r& d! `4 K' U0 H! K

; s7 a' q' g, N5 d    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
( m  n8 z) Y) R
$ A, O. @0 S1 ]; C( }    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! A  b0 x7 k: S: Q* T$ G& X" X$ t+ |% I( `/ Y, a
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 D% s% f1 H  Q' j
/ x1 x  ~. ?9 X9 D/ {; i( o% p$ z
__________________________________________________________________________9 y- u! ~: U+ z( X/ L$ `
  f! p: V& l6 v, j9 q
Method 13
# V" H5 M& y. S+ g% j$ o=========, ]( y6 a- n, L/ X0 s5 {6 y; D" |
2 O) X/ n  p9 H3 m) @
Not a real method of detection, but a good way to know if SoftICE is# E& l. @; q' d
installed on a computer and to locate its installation directory.8 \4 Q, ?$ j+ [$ @9 x
It is used by few softs which access the following registry keys (usually #2) :, n) ~5 [, [9 e! Y2 j) \# r
. |  |- Y# x1 Q3 V
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& Q5 B- T, m; I( K) N4 g
\Uninstall\SoftICE
! O9 B# T! D" u, z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- L: v. t; l0 [+ \
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 E% ?- ~2 P' [! b$ d
\App Paths\Loader32.Exe  r) L" q: D& Z2 {
+ p9 q  _  {: ^, @# F
8 W% `4 g6 V: b5 e+ O
Note that some nasty apps could then erase all files from SoftICE directory2 a. I  |+ V; u/ L6 C2 t/ C9 T
(I faced that once :-(5 t% F% k: a/ t& {" R

' q/ c6 H: A$ ]0 p. g. d' d- w- h7 jUseful breakpoint to detect it:
$ A0 b. ?9 W5 J4 q/ X# ]7 z' P5 C7 H
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) D1 y( b( x3 T( i% H& j) i
0 C1 U3 M' ?5 w/ R- A) g__________________________________________________________________________* {. U" d. o2 F/ z

4 [/ _% `. x/ h' i% t, `- r6 Z- z! j, T5 E' a5 I. T1 f6 }
Method 14 " L+ o" v7 m6 s
=========5 f7 G+ l* y6 R8 m
" ?" g4 y$ }4 t4 q/ S
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 j9 j2 Y: g+ y8 W0 M2 _
is to determines whether a debugger is running on your system (ring0 only).
& u1 G4 O6 t9 D3 D6 e( r% D6 z" Y
9 u+ t! K9 b' V" i5 M0 N   VMMCall Test_Debug_Installed; i- x4 o% x1 q- v: z
   je      not_installed: F: f0 D2 t4 A0 E; F8 y1 S: s( P
; c( I2 g+ M4 |; ^1 l* o; H; d
This service just checks a flag.  U4 Q8 g0 ?3 O1 m/ r* {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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