About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 g( S$ g3 a5 o& ?+ g6 H
<TBODY>
; k  q% u: E4 d$ _. h- a$ t<TR>
: d. A  S$ b2 T4 m8 i( A& _3 S1 o9 c<TD><PRE>Method 01
% R7 Q, }  Q- F2 n. a1 f! W7 M=========9 @+ v  K9 g2 a' |* n' s7 m0 p, R

/ o+ E( A, H% {, C( x8 l3 ~This method of detection of SoftICE (as well as the following one) is. E  x# g! W: k& S
used by the majority of packers/encryptors found on Internet.
  V1 C+ _: B( V) ~( i: pIt seeks the signature of BoundsChecker in SoftICE
2 [$ f8 b& A! ?: b6 k( @/ q
  A! F$ m9 p3 @& n5 l    mov     ebp, 04243484Bh        ; 'BCHK'
1 S+ y5 E) I/ G9 C5 W    mov     ax, 04h; ~6 l1 ]# |0 v- Q/ a
    int     3       . J% \- T2 j' k* ]5 H
    cmp     al,4
( [# z( }0 @2 S- L    jnz     SoftICE_Detected4 \9 d) n; r2 R7 b4 ?5 i; v$ [8 o
/ P3 F# g- p' ^$ o# t* c2 t
___________________________________________________________________________
' F" _! O8 [& j& P: u0 a" q8 H" W) H) Q2 m# S
Method 02, _8 h. r4 Y7 ~, P
=========5 n* e$ ~$ R* s+ ?9 M
4 b, Z  k( g# `9 L4 r+ o. Y* S% R; i! C
Still a method very much used (perhaps the most frequent one).  It is used% M6 @( Q$ u( m% o$ z% `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; x& W( i' u+ ]. g3 m
or execute SoftICE commands...
% Q' a& G3 i+ B4 O6 H$ wIt is also used to crash SoftICE and to force it to execute any commands
% @4 {1 i- d* u8 ](HBOOT...) :-((  
( i# ?$ F4 p5 ~( R3 m# j0 ^+ u' E3 w5 _' t. K
Here is a quick description:
& E5 T+ N7 O: N2 T3 e4 @+ M$ y-AX = 0910h   (Display string in SIce windows)& F# N% X# K/ I  P4 G. W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)4 \8 M6 ?/ {: I- J; j
-AX = 0912h   (Get breakpoint infos)
4 c/ |" a4 s9 F  l# a; y: J+ C% `-AX = 0913h   (Set Sice breakpoints)
( F' A; g% [  L9 R-AX = 0914h   (Remove SIce breakoints)+ C, a" D" ?9 G  x! @9 e* C: F
4 h' y9 F5 o/ e5 n% x% s3 {7 E
Each time you'll meet this trick, you'll see:7 S# `* w; g2 O$ C5 b$ u! j
-SI = 4647h
3 z/ l8 Y) ~3 |% O# a-DI = 4A4Dh" _0 n$ ]- ?6 Q& v# g6 w
Which are the 'magic values' used by SoftIce.
" f9 O, D( q: Y* B& |For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& e( u$ c; d8 {+ b4 W6 r4 k3 V8 j% x/ }! |* B; c
Here is one example from the file "Haspinst.exe" which is the dongle HASP
. d+ }7 p$ o/ C) G. W; yEnvelope utility use to protect DOS applications:
  c: ^0 b& T6 f1 f+ X
9 z3 y5 W9 n/ h8 x0 J( ?( B
. d6 e2 c* Z" R8 R: _, k) v* Y% s& }4C19:0095   MOV    AX,0911  ; execute command.' S+ X  C, A+ x5 A6 p( X
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).0 i6 C: P7 u5 v& d7 I
4C19:009A   MOV    SI,4647  ; 1st magic value.
. E1 U# r* w' k8 Y9 E7 X/ }0 ]4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 B  }( x" u" B% M4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" \9 s9 b- l' s/ P! \  y2 c: D% x
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 e2 R* F  N4 F$ m% H4C19:00A4   INC    CX6 P: T( k+ {2 _; @7 G
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 C4 }9 b! a, }4 }$ b
4C19:00A8   JB     0095     ; 6 different commands.1 y/ T+ H5 `$ C9 a; L) ^
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.* ~; g9 w3 z: G6 e; t7 g5 H7 S% g% F
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" l  l  ?! e$ z, q5 d+ j
) c+ M& ~+ N5 `! b  j  o
The program will execute 6 different SIce commands located at ds:dx, which
5 {/ Q; c. O- |( m; Bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.# M7 g/ u6 M0 R& z, c* L3 B

8 u8 D% r3 G7 p, n% {* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
) A$ U: h6 h1 h! h% K8 a___________________________________________________________________________
9 l1 k2 [+ H* P6 [. v# b" u
7 y( I5 p( M& j- h/ b: T7 Q1 ]
  I6 d8 g. U& I" }1 ?* c: v0 DMethod 03
' M3 X* R% q1 p' A- j# L+ X: ?7 X=========
8 [# Z6 z! p/ a! H3 d# h
. _4 z' h4 S# Y. Z9 CLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 S1 K! _, N$ y(API Get entry point)
$ i7 p6 J/ t/ C3 Y        # E6 W$ }1 N* Y( N) \, d  l$ ]# z) d

% T) u# {) z# |8 u    xor     di,di
3 b/ F% _1 Q0 m    mov     es,di
# R, M+ `4 A; s2 v    mov     ax, 1684h      
/ ]4 z& ^1 Q- R% V* l    mov     bx, 0202h       ; VxD ID of winice
' r7 Q3 D# d7 ~! U1 T/ L8 b    int     2Fh
2 n! l6 a% }2 C( r* S& t    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 I2 Z1 W( p6 ]    add     ax, di
) z/ [4 R% t  B    test    ax,ax
5 b* `4 s4 q: Z( w3 w3 I% H    jnz     SoftICE_Detected
( u) q, J$ [+ Z, j8 G. e) z& ~. \0 |# m6 `9 R
___________________________________________________________________________
8 W+ t9 F  p" [" V1 S4 {* y+ c1 {9 I3 p3 A  {5 C' p
Method 04
) W; ?: h+ l/ y+ Z$ o) W9 v9 L=========
& u  X# p; _. g8 Y  y
9 U! A5 V( V7 a  }Method identical to the preceding one except that it seeks the ID of SoftICE% Z4 P( [& _! R
GFX VxD.+ {; L2 }$ j# U, I* P4 z0 g& o( S) z

3 d' P* h8 R/ D! J1 p, S" a- j    xor     di,di
$ Y" k5 n$ v* S6 F    mov     es,di2 f, h7 \0 N  y( G2 l( A$ M5 }
    mov     ax, 1684h      
8 ]& z9 {* m6 f' {) B2 a7 h    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# L0 N+ S( G) p+ l, o* D4 r    int     2fh# b; w% p7 W8 w, |
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. x3 K) \3 W* w0 W3 V
    add     ax, di( h1 w& z, Y( e  a( J8 p
    test    ax,ax1 k& N; S8 c) Q) C2 R3 w! C
    jnz     SoftICE_Detected
# q2 N2 T3 \$ e5 s/ U2 _5 ]* R3 U+ {0 Q; {) b  e
__________________________________________________________________________
$ ^8 I& }; X0 ]/ C+ p: ~. c% f3 c' k8 b$ a7 I3 E
# j# i9 Y% L: O1 X: z  d
Method 05
( Q4 U$ g2 B1 z. T& a=========
4 a  ?6 ?/ e2 Z2 i, }: k$ I% Y' N$ q$ W1 K
Method seeking the 'magic number' 0F386h returned (in ax) by all system! h' w/ j' x( \6 ^( W1 L. Q4 l
debugger. It calls the int 41h, function 4Fh.# u2 l9 R( j% F0 V/ _9 f
There are several alternatives.  
1 }* H3 w3 A( h* J- H$ z1 x& s( o4 S& I0 {: ^( D
The following one is the simplest:
) P9 M8 \  [9 I# ~
9 H: t* z: \8 L; {4 t    mov     ax,4fh+ ?2 _- _% [# j% d
    int     41h) N) E/ v: j  A) ^- ]) c" Z! h
    cmp     ax, 0F386
: h7 T1 K; w6 Z  q7 v    jz      SoftICE_detected* @! y* a8 N, n$ [3 p
* p. ^5 a3 [/ C& T

6 D# S# J5 H, v- X. L; p; ?9 H4 HNext method as well as the following one are 2 examples from Stone's , F; z6 U* w& }& e
"stn-wid.zip" (www.cracking.net):
( W. h6 T! K) b) W/ J/ F$ }
8 v: H. \# G" ?1 L7 t# E    mov     bx, cs
- P3 ?- L* j! J$ G    lea     dx, int41handler22 B6 ?" q4 T0 G# d8 X
    xchg    dx, es:[41h*4]8 }- p6 K  j: S2 c& @+ H+ b
    xchg    bx, es:[41h*4+2]. U  @7 H+ f! n& X
    mov     ax,4fh
# [+ y2 U" C0 m: s; t) H    int     41h) {, x; F! q( F' B$ t6 _
    xchg    dx, es:[41h*4]
1 _7 A7 A5 x4 E% n* t    xchg    bx, es:[41h*4+2]
1 N$ c$ Q; |8 c! p0 Y3 r8 o    cmp     ax, 0f386h
. B" f5 y2 S% w, L6 n    jz      SoftICE_detected
. `8 J, M7 w# ^3 k3 S% S
3 ]  f8 J" S' B1 G# pint41handler2 PROC! b+ {: c' n* z$ b+ [, |: o2 z; {
    iret
* U5 s4 Z/ D) ~: P" Q/ Zint41handler2 ENDP  |: Z2 ~5 W( W0 [9 |& J% w
4 A. v7 ~% Q1 H( U! L
9 F: k% O4 i* t# H$ G6 q
_________________________________________________________________________0 Y9 A% w5 v; U- N2 _, w! `% t/ _

& t9 _9 J+ q0 D+ I: }; r5 ]! `5 r; n- N1 u- d
Method 066 |( L! y6 U5 b! G
=========
# [0 x/ Z/ j2 i1 b" C4 `" e( {1 [2 J/ n" K/ O/ [1 s' O4 W, G3 N

+ ?1 t% }! N% X% z) r8 B3 Z8 I2nd method similar to the preceding one but more difficult to detect:: j- B, M! V; u! j9 Y" _- z1 V3 [

- P, [: b, t3 {1 R9 w
( ^3 L, P5 F, m7 ^, ~$ w" }int41handler PROC+ h2 w+ @2 f! \
    mov     cl,al
) {* J7 V+ i) r; _4 n: H    iret7 K4 j0 @% e4 p, L
int41handler ENDP
+ p. e- o2 A# _  P$ K, I8 u% I5 C6 B& k

) _2 z6 j6 Y* H" C4 n( b4 I. S3 T    xor     ax,ax
: _" a' D2 }! C& G% |4 J2 d* o8 }    mov     es,ax
+ j: f' T. l' S7 T    mov     bx, cs7 e, r4 P" B7 {4 H( K1 t1 d, j
    lea     dx, int41handler5 K5 |' R! S; n) f/ j3 y5 a
    xchg    dx, es:[41h*4]# W# U( e7 v$ P
    xchg    bx, es:[41h*4+2]
0 ?. B2 O: T0 Q1 W/ u4 u% ~    in      al, 40h. ?# t/ b  ~! z$ |9 ~0 W
    xor     cx,cx3 W7 \5 Q! v! Y5 ^; R3 p; {
    int     41h
7 h8 q5 ]; p% q3 ]! ^4 d    xchg    dx, es:[41h*4]$ u% h$ P0 [: h- q0 [& f# |
    xchg    bx, es:[41h*4+2]" I& J5 j6 e# Q- E9 m, j4 \0 i  @$ J
    cmp     cl,al+ X4 M, x$ o3 i+ q% {/ y
    jnz     SoftICE_detected
- r" v' O' `3 b- K! `4 d0 |% T/ ]8 a5 d, ]2 K
_________________________________________________________________________1 j$ a5 j) d+ `: V

: r, I* r! f  E) [9 m4 PMethod 071 f8 l- ]1 N# C% w
=========
5 F8 i  f+ O5 H, t3 E, l/ {  c8 e% d, G& O; I2 N, R- ^
Method of detection of the WinICE handler in the int68h (V86)# Z7 E, F# P# R. P

3 ~! x* |( o' Z6 t    mov     ah,43h# {' v7 I3 Z  A& n
    int     68h4 A) v% ?' A- S* z1 d" v  W
    cmp     ax,0F386h
) d9 l' V9 {+ k5 t; j. `    jz      SoftICE_Detected) T9 P: X0 m0 O7 B, @- ?) Y. E3 c( o
: {: x: t3 w- D% y+ d; g

8 n2 ?* l% W/ {" U0 [=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 R" H& n  n8 J. H2 t% b* t
   app like this:% t: q" i) s# z, i
5 [$ k$ M5 w( S+ z0 {+ ]
   BPX exec_int if ax==684 @( J! q, b+ C) m& M' f5 [# {8 {
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 U% o: z: Z, r, z8 h( e& `   located at [ebp+48h] for 32Bit apps)
+ b* n! c# U1 y& m) H- J__________________________________________________________________________
( j% D* d/ Q  K, Q: C. s4 E' H
9 ]6 w9 U! X" R: U4 ~2 {* O
4 H' M2 B4 f8 U% X$ `0 q2 G+ Z7 }Method 08
& W) v6 A, z. c4 q0 G=========
" L1 a) U  b0 b% S+ \: t+ ^2 Y' i, b4 e0 u3 q
It is not a method of detection of SoftICE but a possibility to crash the
7 Z6 m5 T& Z, l3 @0 ^: c$ rsystem by intercepting int 01h and int 03h and redirecting them to another
8 U" p* T) m) b; h' ?0 |routine.: P- j/ a' [  F5 a4 _
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 M# D0 b7 a0 h/ V8 v2 pto the new routine to execute (hangs computer...)) |9 E. s/ @2 i% o4 N

. r7 l; C/ A& i    mov     ah, 25h' ~, o$ |" j" K  S1 z. ]: a+ Y
    mov     al, Int_Number (01h or 03h): I* C$ b& v" ?# E% J( W
    mov     dx, offset New_Int_Routine
3 X9 V; I# Y4 D# J3 c9 }    int     21h
: l; Z* B. Y* W3 |8 k, g3 k
9 b2 {; x  y$ m* \8 ^__________________________________________________________________________
. I( G! @8 O8 f/ }
0 Y$ {6 ]9 z6 l7 H. NMethod 09
$ K1 I5 q+ Y1 F& |/ f5 ]=========' r6 d% [6 [; {, @" g5 R' X; ~
( m7 v! I# s) ?! y# Y+ X7 L) z; z
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only, c$ H7 ?* e+ q5 n  Z( z
performed in ring0 (VxD or a ring3 app using the VxdCall).$ Y2 Y% f1 v8 u: S2 B" U
The Get_DDB service is used to determine whether or not a VxD is installed, K; d2 |" I$ Y# [
for the specified device and returns a Device Description Block (in ecx) for/ Z( v+ j5 z) R1 G/ O
that device if it is installed.
/ E. z; R, |' t, B2 D* w* K- X3 Z! U8 m
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ I+ h" L6 \6 S! N% o* K   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* z4 t/ x  c, e   VMMCall Get_DDB
+ j; J8 d* l, E7 Q3 z' X   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( [4 Q0 Z9 m' J+ e
( C5 y$ ]4 j6 ^# `1 b, h- KNote as well that you can easily detect this method with SoftICE:1 j/ y! j1 @) S6 S7 n  @+ `1 J6 l4 j
   bpx Get_DDB if ax==0202 || ax==7a5fh' Y4 I0 I% @/ E! U- S% ?: _! g
- Z% b" B/ g/ L' N
__________________________________________________________________________
# M) a7 ]  ^  \6 }9 T
) m4 T) ^3 ~, w  q- TMethod 10% c& ^0 z3 b/ O3 g: a. g
=========
7 ?" `# n" E5 D. [7 ^+ ]
8 @& X8 Z) I: W! _=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, a, Z- c+ W- e- B0 m6 c5 R
  SoftICE while the option is enable!!
; T+ t1 D; A4 Q9 z  z: ~/ l' H& M0 j# e$ A3 J4 ?
This trick is very efficient:
4 k+ K6 W7 N3 B9 e- Zby checking the Debug Registers, you can detect if SoftICE is loaded
) s! d  `5 ?* i: r8 h+ e(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 y! M) G* p# r" h# [" T# ?. d
there are some memory breakpoints set (dr0 to dr3) simply by reading their, J7 M' [) B! S8 x1 |) D
value (in ring0 only). Values can be manipulated and or changed as well7 D' h6 I! T$ a& f2 C' h# B
(clearing BPMs for instance)
  W" f/ z4 c; p6 h) ~9 J' P7 w6 i  v; f( a) V
__________________________________________________________________________
9 v. q3 Y5 H. B  i: ?- l& {
$ L7 B# u9 m2 h& e! G: gMethod 11
" W+ _& s" P- A; J, Z=========6 w5 j6 |. J' W
. g/ v* v- w, r- \2 X5 ^
This method is most known as 'MeltICE' because it has been freely distributed
1 C* |# a" _# D5 u" h3 R, p1 ?* j" pvia www.winfiles.com. However it was first used by NuMega people to allow9 ~) V3 c* h7 t, }! @, P
Symbol Loader to check if SoftICE was active or not (the code is located1 n* s) y1 _% w/ Z  E7 t" o
inside nmtrans.dll).
3 R0 ^8 t# d+ a) H9 J7 h0 g
& P/ [: x# E2 f, o$ A" RThe way it works is very simple:7 k1 k! M: ^" k4 y. c
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) u3 M) ]: i2 z# W% ?WinNT) with the CreateFileA API.
( x7 \2 H4 ~8 S5 D
# g8 v; |" T% w7 h. i6 ]9 oHere is a sample (checking for 'SICE'):
5 ^/ e5 G7 x; t0 f$ F
. C, O; y$ V1 V0 s/ p2 f- q% o. FBOOL IsSoftIce95Loaded()
; j9 k' I1 }( ~5 K{
# h0 `0 ^8 ~: T( m0 d" v* a   HANDLE hFile;  # O! \+ t/ P. {: _$ B
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 T2 u4 i% T, s8 n8 k' f                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 k% d5 z* J2 v- j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 |5 d* u0 e: S/ J2 g8 J; t* }
   if( hFile != INVALID_HANDLE_VALUE )' B4 a0 T* k# h
   {
% E6 K% A/ B# u9 l1 e7 C      CloseHandle(hFile);; t$ n. ?5 j4 |' t% p- w
      return TRUE;% U3 T, Z3 B4 o% B7 T  S
   }1 t! I) X/ x4 \. A$ D- O2 h
   return FALSE;
( z: z. p/ Y  y8 U! Q$ j}' Y( ]; Y2 W, O6 t+ k- m
6 I+ J# u0 P: x" C  M
Although this trick calls the CreateFileA function, don't even expect to be; x& ?6 H3 e- o) p. T
able to intercept it by installing a IFS hook: it will not work, no way!5 z/ h' [* i. }& a
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 E& l8 z3 }5 I; q8 `& w9 P% v
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 p9 j, R: Z6 u* fand then browse the DDB list until it find the VxD and its DDB_Control_Proc
- v  I- a6 R0 ]# ?field./ q/ r+ r/ _, L' W
In fact, its purpose is not to load/unload VxDs but only to send a 0 o4 f: d9 f; `4 r3 C
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% n3 [3 U& d' Fto the VxD Control_Dispatch proc (how the hell a shareware soft could try
" `' X4 `& ^7 U; H2 }% T/ zto load/unload a non-dynamically loadable driver such as SoftICE ;-)., {8 `, }$ G0 @" @& A! g
If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 y4 g0 i' k: _7 i4 ~+ @2 i1 iits handle to be opened and then, will be detected.
3 m' o6 n7 E( U; |* QYou can check that simply by hooking Winice.exe control proc entry point4 o$ ?! ?0 y* R' P9 o  R6 ]
while running MeltICE.
6 G( I/ i0 E3 k5 k0 s  c7 U3 |, K; i' N( h7 ]- ^, A# I6 I

0 C" ?% I* b& N' O7 p  00401067:  push      00402025    ; \\.\SICE
) V3 R$ f, B: V- Z: u  0040106C:  call      CreateFileA$ O7 J8 g1 C' j: Y  m8 ~6 j
  00401071:  cmp       eax,-0011 j8 p# ?1 B# n( K8 s/ z
  00401074:  je        00401091
/ S9 I- R/ Q5 Q+ m
. F6 ?% h+ z# H4 I2 t6 v% i. x% }  \$ Q& Y
There could be hundreds of BPX you could use to detect this trick.
* i$ ^* }5 W* w* P% F-The most classical one is:; d- X4 H" n% ^7 m2 q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% c  c! H6 W: s1 M5 I    *(esp-&gt;4+4)=='NTIC'
( E: S  {$ h( z& F8 J7 v  F, f8 ^, S( w4 J; _7 W
-The most exotic ones (could be very slooooow :-(6 \+ `" C. e; n, p$ y& n/ I
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + O' O0 a# U# i2 W
     ;will break 3 times :-(
0 L* X8 v0 |& e! v5 @$ }% U/ w/ l7 F. H
-or (a bit) faster:
8 q( o( ^- R0 P; d. p   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 |5 ~- ?7 p1 W) c) Q* L3 p4 F' q9 t
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  * R, |7 P- ~8 [6 m  \/ |7 P' C6 @
     ;will break 3 times :-(
- V. o2 A* K/ J8 f: }
/ m! C2 Z. x& ?( e. \-Much faster:
' v7 ]7 [' {5 p9 {- P! y! k- W   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 N& s7 ^8 l+ c  M

. m- W5 P' }  {6 R6 E7 _Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ W; Y, s, y1 l5 a. z/ a3 tfunction to do the same job:% d5 u$ U0 G  j, V( u- U+ B" B7 _, H
7 U% X7 T3 R% v: r" b
   push    00                        ; OF_READ* W6 A8 {& C5 r# \
   mov     eax,[00656634]            ; '\\.\SICE',0
3 G+ a8 s' s$ \4 {   push    eax
* e2 x& r+ e0 M& @1 K/ [/ @0 _   call    KERNEL32!_lopen
0 e# n' r- ^: l! q# ^: }* |   inc     eax
1 Y$ g6 a- S5 W" W  B   jnz     00650589                  ; detected
2 r, j' \4 W+ a. T/ @8 a2 I0 F9 m   push    00                        ; OF_READ
  P7 U6 Y  K3 \6 V   mov     eax,[00656638]            ; '\\.\SICE'
( p: G+ H9 t' q9 @) l8 S  ?. P   push    eax
8 f7 m3 E; x9 y   call    KERNEL32!_lopen
% x+ l( O* \: Z" P, H   inc     eax
! {- l1 g" \; y2 @$ ~   jz      006505ae                  ; not detected9 [1 U- h: V  P( x' D

5 i# I" O( Q& y! w# S3 I* K# K; R7 s5 I5 M% Z- q& E# P2 V
__________________________________________________________________________4 r6 w/ o% e' k1 L9 m# m

9 t% T$ K( Y0 ?7 @/ {: D" ]Method 120 i+ I* h- x7 Q  ?
=========
/ u( K5 U) Q6 q4 K6 l
; F7 L7 I  @+ a* W7 ^This trick is similar to int41h/4fh Debugger installation check (code 05
* m9 L0 q4 w  A&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* @. j5 k) L" H- O( @8 @& has it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 R* B: w$ ]' j# u+ Z: l) l5 O* u# a& M' f( n/ ~1 O0 ?% x1 C9 w
   push  0000004fh         ; function 4fh
' @" O8 q$ B; }; c& Y   push  002a002ah         ; high word specifies which VxD (VWIN32)
& N8 ^8 _9 V) [# a/ F; a                           ; low word specifies which service$ ~, o; R. Z8 x2 u; Y0 G
                             (VWIN32_Int41Dispatch)
& I! A2 E) B" f0 b: N' U5 W   call  Kernel32!ORD_001  ; VxdCall$ f) q) L( j5 t: [  r! h. x
   cmp   ax, 0f386h        ; magic number returned by system debuggers5 A% J1 r5 r( n8 s% S. b  i
   jz    SoftICE_detected
9 c4 D1 a4 [/ q! q3 R6 |! N7 Z
Here again, several ways to detect it:9 J' @. f) ]  L7 y
) i: u3 @# R% K' `- t0 x" L
    BPINT 41 if ax==4f" b' x7 g# s. k% @
- ^% H. [0 H$ E1 Y: Y+ a
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' N" i3 M0 ?* C# _3 _
! F4 R& x8 {  S% q3 o
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ j& c8 n% m5 z/ i
$ ~7 G- S4 b* _+ W; v) c7 D' L3 J. H    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# H& e( n4 P3 m) {+ n0 c' {; R/ L8 U8 c  z3 O
__________________________________________________________________________
9 Y' A) r! M' |; x1 t; h
! T7 W' d' @' m4 ^( eMethod 13
8 {0 b+ T- F1 U* w=========8 D8 v$ f6 h  x% n7 W* X0 V" A/ u

$ b: b0 y7 R  J; x( ~8 |Not a real method of detection, but a good way to know if SoftICE is/ W- B! l+ e" k+ X+ d" K
installed on a computer and to locate its installation directory.
: H/ S2 }) y' O( [# OIt is used by few softs which access the following registry keys (usually #2) :
! a: i( y( `- O1 y/ K% m+ h' Y2 z+ i9 q3 I( _
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& Q+ P: i2 q: n1 }% L\Uninstall\SoftICE, D+ W8 n2 k1 b2 ^
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, k$ |- x% U  y" v
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 `# |/ |: n$ w, T; T
\App Paths\Loader32.Exe
7 @# e/ R  T( T3 o4 X: f
! E$ Z6 s& A4 R# j. O3 w! R2 l; O8 y% e, ~+ V9 k8 C  d
Note that some nasty apps could then erase all files from SoftICE directory
( T6 X6 d2 t8 W+ Q) L(I faced that once :-(8 b% X' I- P5 \
+ r' r7 L) _* V4 w9 O% S  Y
Useful breakpoint to detect it:9 b, |3 F  S( t1 Z

9 P: m) K) z# U2 O# Y2 L( ~  `* Y     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 w0 p& D8 l; X3 K
4 b" {: h6 ~9 p% T" c& c__________________________________________________________________________: [' l- v! ]3 w3 y

  ?8 f& h& _+ Y3 x0 K1 b) Z  U7 G( [2 w+ I+ E  U
Method 14
7 u  e2 q. E3 \( q3 T=========, V) c2 V' x4 ~5 V( g3 _5 ^

# u  n- R8 B" S$ a' P0 K" l; EA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 Y5 ^$ f9 \1 y$ w
is to determines whether a debugger is running on your system (ring0 only).7 W4 {1 c# ~% d* k* b% f# Y
0 Z7 u/ T/ f. r: t7 r
   VMMCall Test_Debug_Installed
; g) t* Z( z8 f9 D* `: {+ M- m   je      not_installed
( Z: A$ s! I5 g# [+ g3 N6 Q8 T) |* u5 C" @. V/ I' I8 z* L
This service just checks a flag.
2 T2 `) j# c/ y- Q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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