About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& H5 b7 A6 C% B. C% ?. \/ c<TBODY>
! S& L+ r9 x5 s* w9 x% W' x% u<TR>$ g% z, R7 T( A1 u6 V: }
<TD><PRE>Method 01
+ D8 O: K: N5 T  z1 J* h* B. m=========# w- M8 |/ q7 [' c- V
% H7 ?' S2 \+ ?  q, b
This method of detection of SoftICE (as well as the following one) is
+ A6 d; c4 Z0 ?+ K9 B: v+ dused by the majority of packers/encryptors found on Internet./ E+ M" j/ _' Y% q! X
It seeks the signature of BoundsChecker in SoftICE, L" I2 @1 S( E3 J' B5 d3 Y: k
8 q( z8 q0 Y# ?) [2 B6 F
    mov     ebp, 04243484Bh        ; 'BCHK'+ G7 X6 s! h, K6 a, s* B
    mov     ax, 04h% T- g" c. |: d7 b, R! ~7 o% e
    int     3       - T% p0 D9 l* j/ }8 ?9 t7 L
    cmp     al,4
1 V5 d. d' D+ o- W3 R    jnz     SoftICE_Detected' V' X# U" w- Q) ]& ?

$ }& I' i5 J; R___________________________________________________________________________, z! Q& c, t; B( V
; z4 ?8 b0 |0 e- ^' u
Method 02; b5 r% }* ]! W! ?. p7 F% `
=========  r/ o$ O! t4 Q" W
( j2 x* X7 B$ O( g/ x
Still a method very much used (perhaps the most frequent one).  It is used1 g+ Q' q8 M& f
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
9 s$ Y# X7 @; f9 l9 K( zor execute SoftICE commands...
7 W8 X% E9 {  @# ^: S9 TIt is also used to crash SoftICE and to force it to execute any commands4 a9 C; z5 \* z* _4 C8 A
(HBOOT...) :-((  
% h5 o. R) C0 Y/ Q; f$ q! {2 [6 p2 f5 ^. \
Here is a quick description:
/ N- a0 K0 ?0 }! A- R+ Z-AX = 0910h   (Display string in SIce windows)
( [9 x$ X9 O( O7 \: @4 R0 y-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)$ c% e6 _" m7 c, T1 h
-AX = 0912h   (Get breakpoint infos)' U9 {3 e0 }6 \0 L4 A* w- z
-AX = 0913h   (Set Sice breakpoints)( |3 N7 _* m7 c1 |- \
-AX = 0914h   (Remove SIce breakoints)+ y; `' A+ o- F6 x: X1 q
; {! r/ I, d, S/ H3 c
Each time you'll meet this trick, you'll see:/ A# K6 }# o. `, e
-SI = 4647h
8 w  `5 H% K0 k4 r. L-DI = 4A4Dh
5 G3 b( H3 }' n* o) H- ZWhich are the 'magic values' used by SoftIce.
- P4 A  K. |0 d/ `! X- t8 uFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
6 W3 j% K8 y( E( X7 u
9 c) [4 p/ U- [% GHere is one example from the file "Haspinst.exe" which is the dongle HASP
7 P9 p0 Y; F8 T1 e0 W6 k7 T2 s& dEnvelope utility use to protect DOS applications:
0 v( |" C9 D  ~6 D1 D5 ?& D
4 Z7 f" ]1 H3 W( e/ F( G: ?
* W5 P( F6 V. H2 Q! o, f4C19:0095   MOV    AX,0911  ; execute command.. ^+ F* \" u$ H8 {, V
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 }4 H0 T5 q% D  E! r5 R4C19:009A   MOV    SI,4647  ; 1st magic value.
. O" Q7 c# ?, t9 a& }" ]) h4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 r( u4 H5 x) f7 P: v* m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 W  k" h- ?, a" n( B1 s% v; y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ _" X+ ^7 G  R. S" q4 J
4C19:00A4   INC    CX
8 ?  x4 I, t& e/ x5 c4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 `0 u- w8 H' c8 j2 O, x
4C19:00A8   JB     0095     ; 6 different commands." R# H$ n' L5 A/ @8 J! P
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.( p* s. C- N( D$ V/ b5 d
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 {( o9 T) d2 H+ }3 H  S
, x7 A  h4 r* Z" u& x; r
The program will execute 6 different SIce commands located at ds:dx, which
# F5 t5 T) ?' t7 j, H" y, eare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.) y8 ~& v" `; g+ J- s

' q! o4 S0 j: t% Q* \* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 P! O5 I4 G' D0 {+ j+ d. \
___________________________________________________________________________
3 m5 d0 Y: _* B  c' I: A
5 D5 U* Y, ]# s% \. i' K) y! s$ d) G( V7 X4 Z
Method 034 {( c) V3 U0 e% d7 B
=========% a8 m! {; U5 U  t. O1 {* }
/ t! g( |  I( @1 V
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. g( M1 B% J: I- Y& Q: \0 S+ f+ `
(API Get entry point)$ P6 i" e/ ^; r4 H
        ) [. G$ v. b4 \" q

1 p" n) Q2 V+ \2 o7 W& V/ P    xor     di,di
( Q3 h' ]0 @$ K8 h    mov     es,di$ N+ i$ o  L$ \5 \1 H* }
    mov     ax, 1684h       2 P- }8 _7 i- f" Z5 l6 {
    mov     bx, 0202h       ; VxD ID of winice' m( a; _2 }6 f( K
    int     2Fh5 ^5 h/ O7 M& ]- A+ P. [0 P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- J7 u- R$ }% ]$ }  B
    add     ax, di4 m' Z; |$ e0 d1 G
    test    ax,ax
& @" S' o8 {  o- c% t3 L! k    jnz     SoftICE_Detected
; I. j7 Z3 Y, O) S9 {0 a5 A3 L  t& h; z3 j
___________________________________________________________________________2 Y! e% U  i" U/ S

$ S+ B8 }7 w; I! {Method 04$ d- U& l5 x) J5 c$ A
=========. |; Z) l  M. T& {% N& P

2 ~, e( _8 ?9 H$ P+ GMethod identical to the preceding one except that it seeks the ID of SoftICE3 P1 f4 h9 m( F$ C# y8 h
GFX VxD.% d6 U: ]+ }- v1 A

+ j7 y8 f, ^# w5 d    xor     di,di/ J9 R9 X! Z$ E6 W- D7 y2 ?/ `& N, C
    mov     es,di& K8 O2 v& C% P
    mov     ax, 1684h      
9 g0 v, s0 K4 c    mov     bx, 7a5Fh       ; VxD ID of SIWVID- G( \  `6 e% Y4 E! i# l7 o6 d
    int     2fh0 v- w# f+ `: D3 ]+ H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 z' {/ I; w% ~& C7 t$ g
    add     ax, di
& ^9 [% U1 m& n( }  d' A    test    ax,ax
* V; @; B( W1 g- K    jnz     SoftICE_Detected
4 X( _2 h; U1 v: H" v- Y5 S1 v
4 ]; _$ _5 W, ?# ?__________________________________________________________________________
- o- _+ y4 A( Q3 h5 G6 T& X# x, E6 `0 O
! ^& B1 D  O- ]+ O0 X: t
Method 05
# r6 j/ s7 ?1 Y% U1 `2 h=========
' ~6 B$ e  Q' S- [% y$ f
: O" D$ {7 \. h7 M( dMethod seeking the 'magic number' 0F386h returned (in ax) by all system* {9 S6 O" b+ r8 g8 g1 ?
debugger. It calls the int 41h, function 4Fh.
$ L( Q; {" P9 ?$ qThere are several alternatives.  
2 D" k% s4 |; V4 U) U: I; O
5 a( c: T2 {( z1 K/ ?The following one is the simplest:7 D6 l# l$ T5 W1 e) W
, R3 O7 _; v& I: r
    mov     ax,4fh7 r# m2 l% z- w+ o) B
    int     41h
2 Q- J: ^2 ^: B$ Y6 \3 ~: G/ O    cmp     ax, 0F3868 f+ o" |3 P9 [
    jz      SoftICE_detected4 U7 j( S# ^  I  `9 p- Y5 S

$ a& Z0 `6 ]# t# q6 P5 s) Q8 k# j0 B% v* I7 ]$ @- n
Next method as well as the following one are 2 examples from Stone's
4 D5 ?  o, l; }; m& i6 K& G: _"stn-wid.zip" (www.cracking.net):
5 h- G6 A, e+ K* }& Z& Z+ g( p( K/ Y( \% ~/ n
    mov     bx, cs/ ~5 ]7 ?- U. B, H, z
    lea     dx, int41handler2% K  R0 ^  R& B0 I$ u
    xchg    dx, es:[41h*4]
% ]7 Z* x7 J/ ^& B    xchg    bx, es:[41h*4+2]
- Z3 B* r  Y% [; ^    mov     ax,4fh
% p6 W2 P  X( |  Q" R# H$ F4 y* V    int     41h4 |/ s0 r; t) o" ]5 F. Z! [3 T
    xchg    dx, es:[41h*4]
  d2 e8 Y& q6 n* Y$ B0 k3 `# J7 k    xchg    bx, es:[41h*4+2]
; Y( o7 p! Z& o    cmp     ax, 0f386h
0 V8 r: e; j( E    jz      SoftICE_detected
- ^5 p+ T( O- p- x3 n
) \3 s2 \# R) jint41handler2 PROC' @! s8 ~) x% ^& s7 Z
    iret
: w) j1 L5 R; m2 G# Xint41handler2 ENDP2 }6 D4 J, J: ^

. L. x* C6 d) x1 N5 b% ?5 B# X' d* O$ x5 N
_________________________________________________________________________5 ~4 a2 p1 e5 O" u  n1 ?
; `& N# l$ H; N  i3 u" K% C
& M8 b7 f- A7 {9 p- T' |! R9 m. [
Method 06
/ n+ t' t3 `4 P=========
  C) q3 C7 z/ G! Z- B* ~( i4 [% d+ e& b3 u# [
4 a) L& G: d1 e
2nd method similar to the preceding one but more difficult to detect:8 I. F: Z! w3 C4 i
4 n% p# F( R$ }! q) a& ~# E, f
- d1 E; D, b1 N( M+ A+ n( }
int41handler PROC
, ^; z6 Y" k! U' U4 ~# X6 _8 O9 T* h    mov     cl,al
5 l. b  z' G6 T: x    iret
/ ]& f) Q9 z% o7 ?int41handler ENDP
) @- C, @. K) \2 r' p  M  `: G' }2 r, X% l$ E# L
0 J; X- n  H' K8 y3 G
    xor     ax,ax4 |5 t3 ?; c! r
    mov     es,ax
9 b6 y' _4 a; E0 Z! V- _    mov     bx, cs- E4 N& G+ S1 N) @. L# ^% w
    lea     dx, int41handler
. s$ U4 I% Q2 m* \2 g( T    xchg    dx, es:[41h*4]4 k8 a* z; a2 l! X/ K# S1 Z1 D
    xchg    bx, es:[41h*4+2]- u: g$ W2 r* e) o/ W$ m+ c
    in      al, 40h
# U  D: V$ K- l3 M) ?; N6 N    xor     cx,cx1 g; g  w/ k4 ?/ h. T
    int     41h
6 v* k) g! S) B4 G. `2 @% x    xchg    dx, es:[41h*4]* y3 k6 I2 I/ J
    xchg    bx, es:[41h*4+2]9 N" B  _% l5 w' t4 L7 S9 }
    cmp     cl,al
/ m) ~0 [4 N0 v! j    jnz     SoftICE_detected
# @9 |8 Q2 F8 t' k! m8 B2 e7 J
; _1 g1 h/ e  q- g5 Q1 y! I_________________________________________________________________________1 C6 T5 I0 i/ n
/ l3 y1 K! K/ k( s/ w3 u
Method 07; |) c! o; m- o- ?" k
=========
8 u$ `+ y/ J3 C; O( j( h
, I( S, z. ?& H+ O8 EMethod of detection of the WinICE handler in the int68h (V86)5 L! _3 D7 |9 B8 P) k! S
( Z. a+ l7 t5 F$ x  l$ }+ G
    mov     ah,43h
, ]' k2 \! L/ D% H    int     68h/ e" g6 A# q* w$ \" A4 v8 S
    cmp     ax,0F386h
. `* `) }8 a/ L- _9 Z1 b+ p    jz      SoftICE_Detected0 z" R4 b4 d. @( H" ]+ W

- P1 d; P* `" D, v4 G! e) q- a( X+ h3 t' d9 W% n0 i7 k/ q9 v
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 t- z4 a% ~' H' j   app like this:
2 q' T4 g* |; X. \+ i# M  Y
& H# ^: g! I, J* e$ L2 ], K   BPX exec_int if ax==68
3 Q2 D' P) N0 {: ?   (function called is located at byte ptr [ebp+1Dh] and client eip is2 G" w$ w5 Q7 v. a2 E# Y, ]& f# @7 y
   located at [ebp+48h] for 32Bit apps)
% C3 P/ X% ]2 D/ n__________________________________________________________________________
$ d4 u4 Y9 D/ I; l3 m! W5 X) g7 J' S& I+ t1 K1 Y- z* f/ P; W- k  w6 D

  k1 H6 n+ I/ n4 XMethod 08
4 U, S* [8 Y) f3 T& Z, [. e=========- y* E9 Z* k$ {! O; d
4 p/ a& w3 K( o# X
It is not a method of detection of SoftICE but a possibility to crash the, }0 K/ q3 C( E4 c
system by intercepting int 01h and int 03h and redirecting them to another1 P" t4 o' @9 W# P  J+ p9 h
routine.
' ?* G2 H8 T9 X6 t+ rIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
9 E6 k! `) u6 ^5 m) X) o% {to the new routine to execute (hangs computer...)
  J# I. `( p3 f% A4 g; s
1 x( k; s) m- C$ t, n    mov     ah, 25h
9 \9 i8 T( o. m5 L* i' |    mov     al, Int_Number (01h or 03h)9 D( \4 {, f# l. Z0 I  C
    mov     dx, offset New_Int_Routine* S; A' t$ D3 o4 x; E* C' m) N" D2 B
    int     21h8 F# C8 j5 e  Z$ y
* q8 `9 K3 M' k  O1 O0 @" T
__________________________________________________________________________
7 h; S  e5 \2 ^! `
1 ~: l1 K( x+ F0 HMethod 09
* e4 t! O! L) Q- j& g, k. A=========% t- |5 l/ ?3 s$ I

1 ?: ?: h9 r/ ]' I5 O0 oThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 g' n& {; V) {5 w' Z: gperformed in ring0 (VxD or a ring3 app using the VxdCall).
: t' o4 ], r; T1 d" yThe Get_DDB service is used to determine whether or not a VxD is installed  J2 @! @$ h! B; X/ u/ B
for the specified device and returns a Device Description Block (in ecx) for
: `0 o2 |# T  L& h: Y3 \+ G, v% nthat device if it is installed.
9 @5 J* R' _" f3 `/ p: [* i" r1 v+ I) O2 j
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ }, q5 W# H, L   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 w. ~6 Z) Y( }9 [! }
   VMMCall Get_DDB
$ F) e8 ^2 L0 Q: J   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( ?2 K' r# a& K3 [- N! T. b4 i. B1 d8 x3 v2 Y
Note as well that you can easily detect this method with SoftICE:
" ^! q  R- u9 v! a( H   bpx Get_DDB if ax==0202 || ax==7a5fh
0 d9 S6 i# J8 L
6 u$ u' b. S1 m! ~4 n* n8 m* j. ~__________________________________________________________________________) {, X& s# g0 u1 r- E* K& o! e8 W
! R4 b; B4 \$ U6 r  Z
Method 105 f) Z3 a7 P- u( V# G0 j+ E; o
=========6 r0 j  u9 Y. y, m5 g" G

, \$ ~$ g) D  A$ S! H0 A=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* G9 R+ j- g6 P8 {4 t; \  SoftICE while the option is enable!!5 n3 ~: T; h5 y$ E- `

. ^1 c0 k: n! T/ B% BThis trick is very efficient:
" O' h  f/ k7 o9 h) ^by checking the Debug Registers, you can detect if SoftICE is loaded
5 q  j! i( _2 ~, k(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 E" d2 }7 D9 ^. e: X
there are some memory breakpoints set (dr0 to dr3) simply by reading their
6 d, ]% Y, @. P/ }$ ~2 \' Svalue (in ring0 only). Values can be manipulated and or changed as well
( ^1 N' R. X7 \(clearing BPMs for instance)2 _. X$ P/ l) b; V8 d& R- j( o: @
9 A  n9 l  K/ @7 b) w) V+ `
__________________________________________________________________________
( z' ~" ]# E: v' M( W8 r+ ]0 u1 A  G8 Z/ a; z
Method 11
) Y; V8 R' s- ]( v9 V: c. h=========
# L% y7 A' s' y/ F" F6 m6 Y: I. ], D
This method is most known as 'MeltICE' because it has been freely distributed
: H% m6 X8 c% G$ o! h  V0 }via www.winfiles.com. However it was first used by NuMega people to allow
+ @- {" p1 N8 b) \- e3 JSymbol Loader to check if SoftICE was active or not (the code is located+ r; t( f. d& G3 n. M6 b! |
inside nmtrans.dll).6 S: M% n& }' R9 D9 F
5 @% B; k+ H( ^3 J3 |: B+ f/ D5 _/ E
The way it works is very simple:
5 p& Y6 b% W7 p& LIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; O  l- |! N! T( r" d
WinNT) with the CreateFileA API.0 I+ P9 D1 [* n( x4 W9 |# k

8 G: H1 C. C8 v5 h8 k8 e& WHere is a sample (checking for 'SICE'):
* W; m" [% z4 ?" b# q1 _* g0 k" H( n+ ?, ]/ k  W2 u6 H
BOOL IsSoftIce95Loaded()( y* ]. h+ T& O& k0 }2 I
{6 m+ \3 G  I: Z; e5 ^2 p% w; Y
   HANDLE hFile;  
9 K% n4 S0 e# k# a  V* W; W   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
. n- P, B/ k! y+ i  L                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' B5 t  E7 b& Z9 S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);8 `, C$ H3 @2 b; ^3 ^
   if( hFile != INVALID_HANDLE_VALUE )
$ W  S  _2 o2 C6 ~8 S' T   {. ]8 \$ s  N6 v
      CloseHandle(hFile);
  b7 ]; U0 d" Q5 k7 b: ]8 F- O+ P- I: d& v      return TRUE;5 x6 _2 ]0 T2 U1 i, `' R, ~
   }
5 k6 K6 t" G& q6 W% I% {" z% }  s0 K   return FALSE;
3 d2 ^+ C5 |4 h* V/ F  n$ ?* t}
+ E8 @. }  V, m; |# U. I) c& M" r2 v9 t7 d' c4 f- u( |
Although this trick calls the CreateFileA function, don't even expect to be
9 d; O2 q. `' `, G; r7 gable to intercept it by installing a IFS hook: it will not work, no way!
, R- X: l/ F& P! V& wIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 X$ d- s# X+ r/ W' ~
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
4 A* j: Q$ G0 G, {7 \3 _, s- |% Land then browse the DDB list until it find the VxD and its DDB_Control_Proc9 L+ _4 S: f& x
field.
, ^0 S7 {8 _7 F4 w& V: @8 zIn fact, its purpose is not to load/unload VxDs but only to send a
3 a1 K1 R) ^8 r6 ]W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% f! `$ X) o, P9 {0 z( t* ]to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" N- a  `! U% o  e4 o5 ]to load/unload a non-dynamically loadable driver such as SoftICE ;-).; e- V+ w+ q7 |5 e# [
If the VxD is loaded, it will always clear eax and the Carry flag to allow1 M7 v8 {4 c) i9 ^% a3 r
its handle to be opened and then, will be detected.: ^: q$ ~$ p4 }4 H4 E! |( ?  j
You can check that simply by hooking Winice.exe control proc entry point- Y* W" j6 y2 \/ y: U$ O
while running MeltICE.
# e0 S* g  z9 x, s# V. @( m8 M$ C2 f% g, \8 b$ @) ?, @5 E; n8 U  r

8 `- S/ [' o& N' T9 d6 X4 V* @8 ~4 g  00401067:  push      00402025    ; \\.\SICE
9 d9 g% [5 T8 u; M$ z. q  0040106C:  call      CreateFileA" [4 U/ t7 e( F* ^
  00401071:  cmp       eax,-0014 J& n- i4 [5 J- W
  00401074:  je        004010912 z4 u( D! r8 }0 v8 U' w
! h& v( J" u% U  ^) r

3 y2 r" y6 G) x. Q% b- kThere could be hundreds of BPX you could use to detect this trick.
* D5 H6 L' g4 b' I8 j( |9 r-The most classical one is:
' J! ~6 O$ x  S: K  T* Y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ E+ {+ h$ B- e4 ]; h" L& Q$ `    *(esp-&gt;4+4)=='NTIC'  k5 }. G9 X0 a, V3 ^# m4 e# E& M

& |& G' T% W, T4 l( W-The most exotic ones (could be very slooooow :-(
! F3 Q- \' x6 Y# P7 q# I# a   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 f) u% n( R! P' y7 i/ s     ;will break 3 times :-(. M% I% G6 G$ y# x6 U
, G! r. ?& z9 W5 S9 H) @4 ~! x9 e
-or (a bit) faster:
/ |- X3 U2 }' d( o' P% f% n! I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) r/ Y5 i; O" n* z# I2 E9 o4 y6 _0 l+ A
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- A4 f0 |' q1 i     ;will break 3 times :-(
: d9 B9 ?6 Y, k9 u( \2 f* h5 ?' a7 _5 H! p3 u6 P
-Much faster:, c" R0 l. o8 h. P  H2 Y  M# C  o
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
: j  E2 w. W  n7 m7 X4 G& v  ]
# ~9 O! x3 u7 k/ D; t5 B8 ANote also that some programs (like AZPR3.00) use de old 16-bit _lopen
' e  X. N& Z2 t! z# ~. D3 _function to do the same job:' U: s- R0 z& J3 [- F

, f5 C& q7 Y% G% u5 g+ H: k   push    00                        ; OF_READ" @2 V6 I" X7 V8 p' X
   mov     eax,[00656634]            ; '\\.\SICE',0
+ v2 Q2 E/ q% U, |/ o$ j   push    eax
7 E* V: N0 [. x* u' ~   call    KERNEL32!_lopen
) Q& B+ \/ J! ~+ d   inc     eax5 L5 V! v( A; I3 x
   jnz     00650589                  ; detected
1 v& {, W/ `$ g2 f" v+ I   push    00                        ; OF_READ! v& @  I% Y+ m) j# e' `9 E
   mov     eax,[00656638]            ; '\\.\SICE'
6 g& `" Y7 R8 W2 x; {   push    eax
- k+ y4 k# a# _$ `   call    KERNEL32!_lopen% k# I1 D7 Y& g6 C4 m+ I! H1 a
   inc     eax
7 R, w4 V, o! b; l7 F) j3 C   jz      006505ae                  ; not detected! V# D; Y0 b- B1 p. `& w6 a" ?
5 w( E- u1 q) R% r

3 r8 N' `$ o/ K- A5 H__________________________________________________________________________
/ Y2 V* n; e5 R* N% M
' h& y, I- z$ R$ L1 h' s: PMethod 120 ~9 D6 H" {$ o( c4 e3 L, {
=========
# D$ m* X$ {1 s- X9 G: U' S+ @( P+ P' N- Z* [9 Z, J
This trick is similar to int41h/4fh Debugger installation check (code 05
2 x$ n7 w1 v# B6 U' a&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 I3 H& M8 W* e4 q& ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 U1 n& k, G0 l0 k5 Z' Z5 v9 ~
" C1 P! f" u4 e; ~
   push  0000004fh         ; function 4fh
' m5 i# c+ ?2 ?: h1 R$ }& z   push  002a002ah         ; high word specifies which VxD (VWIN32)3 z$ T, @+ v5 a# [( z' Z5 E- e
                           ; low word specifies which service
- B9 ]0 y0 E) N/ J                             (VWIN32_Int41Dispatch)
3 ?! y8 B9 G1 R8 h. c& `3 L   call  Kernel32!ORD_001  ; VxdCall
7 ?& R! N( ]) \& U! t4 S5 D   cmp   ax, 0f386h        ; magic number returned by system debuggers
7 k7 y1 P8 T, \- ?   jz    SoftICE_detected1 A" g7 X6 Y. |1 B" y
' b$ Q. n+ d- v" a. T$ w1 P
Here again, several ways to detect it:. x. U! Q# m7 s
0 y& t2 v3 M2 x) d* |  I9 D% \1 D
    BPINT 41 if ax==4f! w; l  q- ^5 U) N% `. e) ~# s

' }" e, j2 @' G, a$ @6 o    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 h+ h! v. a) O) P' M7 |! e) i! V" D9 y# w# w2 i
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 d; v: c. ^3 c( _. j( v5 \+ t( {" y( X! h3 M  f( V* k
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
5 E2 v/ s1 U7 Q( W9 X3 u' @* j$ K/ [! K2 z) x1 L
__________________________________________________________________________" e! R5 V0 B: n& O+ I* ]' T$ u  p0 l
4 J7 D  T% L7 F! W5 u' b2 W/ o0 N
Method 13
! Z$ S! u  i2 I  h* Z$ v& J- a. _=========! e$ L6 D9 c. H. ^1 ]# \

- u& {" l# }1 K7 {4 Q% z# y1 U0 Q5 TNot a real method of detection, but a good way to know if SoftICE is
% d5 D( u/ A$ finstalled on a computer and to locate its installation directory.6 }) G" A  `- ~$ S4 B
It is used by few softs which access the following registry keys (usually #2) :
# f# ~0 l6 l, d% C/ o9 }; }/ H& q' i% s7 h
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' f' f- v# ~5 {3 e+ A* [- U\Uninstall\SoftICE
; i" m; t, I' u0 w-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 w7 G7 y$ O+ ~, }% ?6 q  O7 M8 d+ X-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- p9 e" X4 C" t' S\App Paths\Loader32.Exe
" A* C& I8 K/ [5 v, M0 I9 h4 k6 u! B
, V, B" q( L; J
Note that some nasty apps could then erase all files from SoftICE directory
4 h- n, o3 C& J* q) \' F; t% R# @0 b(I faced that once :-(( h8 r" T+ J. ~7 u& g
- S: J; E# ~+ {3 }/ u
Useful breakpoint to detect it:
+ j: x* K$ F* j+ C8 T) N
* d' b+ G: R" A5 q$ K) r     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 N6 P5 H/ f+ ]; i4 k" `9 g* t: W/ x' C' z0 U/ U1 o7 h
__________________________________________________________________________
. w( B  Z6 k' e; ^; m
! }8 a( c1 Y8 r0 F6 w; q' A/ C$ o5 ~. ^& v7 e# N
Method 14 + ]) c+ y' n# _: z. G1 D
=========1 G8 V3 a  F! `; K7 X
. I# R/ y$ f( J* ^+ f* m
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 i" q: N. l; F- J
is to determines whether a debugger is running on your system (ring0 only).
. c; \  ^7 B, A  E: o  H+ I$ H3 O) @
7 w: z6 c, r$ o3 b   VMMCall Test_Debug_Installed
+ z+ F! V# l/ ^& i% L   je      not_installed
% k3 I) ^. u5 S5 t6 [$ \- m
: c0 `$ |- Z' f, o3 s# iThis service just checks a flag.
+ {& P9 x: C4 u1 Q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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