About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 Q- ?  v" R* F1 x+ _9 I, C<TBODY>" l( m3 |0 Q3 ^& N1 Z# j" F; a: k
<TR>( o& G' Q: \# ]& q7 x' I
<TD><PRE>Method 01
6 B* P+ N( k6 X# z0 u% o4 E=========4 v/ L. s+ f& `! ?

/ S1 t$ v9 G( {+ l8 b' ]1 GThis method of detection of SoftICE (as well as the following one) is/ M% S( T8 o; ?* f& k' X
used by the majority of packers/encryptors found on Internet.
# P( `) `$ k8 M# D) Y% E8 sIt seeks the signature of BoundsChecker in SoftICE
  E$ I; T, i, K# ?  ]- r
8 _7 z& Z' w- o: \% A: {8 H/ E    mov     ebp, 04243484Bh        ; 'BCHK'5 s0 @, F7 i8 i& M, c) p
    mov     ax, 04h3 S, q8 T" g5 x  U- @
    int     3       " ]$ R/ K  }* H+ f5 c: M% D
    cmp     al,4
% ?0 v7 {# ~2 Q6 z* h0 }    jnz     SoftICE_Detected* S# |& Y" Y, g6 O* ]1 v
- }  s3 c. x; Q/ o: k7 k. f
___________________________________________________________________________
! Z6 n! f" a- w4 |! J- \; S) T
  H' j/ D: J; x3 [) xMethod 02
6 W6 o# a  u" y6 |+ l, g! b=========
% b3 H7 u) V& G
3 a2 N/ N$ m! X' y2 [Still a method very much used (perhaps the most frequent one).  It is used0 S+ e3 f; H4 ^* V0 D$ G% N
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,( X1 |3 W/ b" x8 d
or execute SoftICE commands...2 f0 }9 S$ N# t4 c
It is also used to crash SoftICE and to force it to execute any commands
8 G6 x$ g  W+ G: P(HBOOT...) :-((  
7 }! e5 |% @, X1 S0 k0 v' r. R! l5 T1 r4 f& S
Here is a quick description:1 H; G$ i) ~$ C/ Q3 q- k  N4 @6 I
-AX = 0910h   (Display string in SIce windows)
' @% ~' ~4 B% a-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)+ e$ b2 o0 \) S. _1 H/ r( h
-AX = 0912h   (Get breakpoint infos)/ v* E" }3 f( j/ x2 E; \5 Z
-AX = 0913h   (Set Sice breakpoints)% C8 ?. ~5 D5 N9 q0 O
-AX = 0914h   (Remove SIce breakoints)
& [- H4 L- \" n" n. l6 X( `' @
5 l4 Q2 ?8 G+ t# l+ D* hEach time you'll meet this trick, you'll see:- F/ @9 h# c6 l+ L$ j5 j
-SI = 4647h9 y! w5 j4 p" V0 l7 v0 G  S
-DI = 4A4Dh& s4 q. ^' `/ Y* E1 W
Which are the 'magic values' used by SoftIce.
) ?( j" k. h& T  x+ o2 pFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.* v! P, N; D# y4 @1 E. r* `
7 K* X% O4 V# n8 V3 b# _) y
Here is one example from the file "Haspinst.exe" which is the dongle HASP: a4 j2 j4 ]) [  J, M* {# M
Envelope utility use to protect DOS applications:, h7 ^4 g. K) F! m& x$ j  Q
4 Q- m! ~& |; `: X4 y7 B

. c' p  Q/ \* h0 c1 \9 b- D7 q, n# ^4C19:0095   MOV    AX,0911  ; execute command.. l  a: _7 f; @
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 p" R9 V/ Q0 Z0 [+ h& @
4C19:009A   MOV    SI,4647  ; 1st magic value.3 g" O9 g2 r# v7 N: B1 y0 E
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. G. [) Y! b) R, b0 P5 T- \4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)$ N/ W- w- f: _, j
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 Y( h: a+ H9 `4C19:00A4   INC    CX5 j+ c: b- }+ Y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( [- z% @- H: l# D4C19:00A8   JB     0095     ; 6 different commands.' q6 S5 `5 L' x* ]
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  ?7 K+ H) L" \; c& x4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ b8 K* m# Q' P" ^8 e* X) K( b5 `' u; ?$ @, n7 u  E- |. _
The program will execute 6 different SIce commands located at ds:dx, which9 g* ?; Z- ]7 c
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
5 A' H7 O+ E0 W' }) A( H% G4 c: q/ F: g  J: R8 Y
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 Z( ?2 B2 l: ]" q2 ~8 \5 C___________________________________________________________________________
6 C: }" F! C7 `2 S5 h: k! T' e) d: @8 ?8 w
6 F, _; |9 }$ T' V
Method 036 y$ b+ ^% P) w. v: k
=========4 P" f0 e2 i& y/ e
! L0 H9 A! Y# B
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# E4 y: G, h9 {& a4 y1 L: b(API Get entry point)1 g7 G) y4 \/ ]' t! s
        5 n1 @/ [( d, Q0 C$ I% c# j; q0 O

- O( Q! E% }' I    xor     di,di
/ }3 \  ?7 C3 ?4 ~$ Q) P    mov     es,di( P+ }+ I) k. _( ?, F% g, P
    mov     ax, 1684h       ( Q: D. |& S+ S- o; x' t
    mov     bx, 0202h       ; VxD ID of winice" J* h2 ]1 v+ W* ?9 f
    int     2Fh
* f* x4 l# {+ b7 O1 @7 z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. U" s+ T+ {. B4 c/ g    add     ax, di
  a+ I5 H1 m0 ?. U3 f) l    test    ax,ax
' k' x) x7 u" ~: u6 A    jnz     SoftICE_Detected
) `5 A3 |( d, i2 |' r
/ o& i5 k! [# p0 O! O# S. R___________________________________________________________________________
6 s- ^$ }$ r6 P# c. }" O: q8 w$ J8 s1 x( F6 }
Method 04! A. F$ r7 @& `6 W5 m. {  P
=========
6 _! ^) @5 K. Y/ z, l
, j3 J! h- @$ Z) xMethod identical to the preceding one except that it seeks the ID of SoftICE
! g4 F1 q! Y1 c! uGFX VxD.+ z* `! y# D! ?2 O( v, r

1 P! K; }# v" @+ u& B9 p    xor     di,di
8 f2 @, f* b. [2 L" g3 K  a3 M) W/ f' _: f    mov     es,di% V6 M" k0 s, M. ?
    mov     ax, 1684h       6 z( @) {: Y9 O
    mov     bx, 7a5Fh       ; VxD ID of SIWVID. ^1 j. e5 o+ V# G4 k7 x8 K7 u
    int     2fh7 E3 K2 F3 q5 G; ^8 m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( t- ]. N- E2 j& @
    add     ax, di
$ u! q* p/ k) s& K1 s+ f& C- f    test    ax,ax
: Z7 X$ X, b0 W3 W    jnz     SoftICE_Detected
( S$ t: a5 V' V3 a! V9 b4 s+ D' _3 p9 Y. e8 v' K
__________________________________________________________________________
9 B6 S5 A) D  L$ D7 V
* c1 [' \: K# V! I0 P& O( x7 S$ r' q2 ?
Method 05
- n8 j- Y( F0 _& t! Y: i=========5 k: f; F! }, b% d7 d

/ J5 L+ x$ w' I1 P: C+ w& sMethod seeking the 'magic number' 0F386h returned (in ax) by all system" k9 l! s( h4 p- E
debugger. It calls the int 41h, function 4Fh.' S; I+ e& I/ v( }$ p
There are several alternatives.  
2 V) X/ j, _# s5 L; o. B! X$ Z( M& o8 S8 V: O" M
The following one is the simplest:- x2 w) I( _- K5 ]6 W4 |. \

, j3 J! c& L$ u, H& G: M# Q5 N  o    mov     ax,4fh6 w: f" V2 l3 U1 D
    int     41h
( J" P3 p1 T$ @2 A( P    cmp     ax, 0F386
) E4 O: b$ u- ^. E4 M$ t. R    jz      SoftICE_detected
2 `; a# r/ E0 m( z2 \, t
& Y8 [1 q, Z- J% s! ?6 Y/ l* \2 s  {4 ~: C
Next method as well as the following one are 2 examples from Stone's
' ?/ c! ^9 M9 z5 h( ]"stn-wid.zip" (www.cracking.net):: C" B0 e1 H- ]# I

& V& P4 e' r+ g# c+ x, F) s2 W    mov     bx, cs) L2 t1 k, ?+ X4 a) _& u
    lea     dx, int41handler2
, Q) u' p: \' J7 L    xchg    dx, es:[41h*4]- D- [' [, S  s; m! I" ?0 w- L
    xchg    bx, es:[41h*4+2]" l/ |0 l# A( Z. I' h% ^. a
    mov     ax,4fh% l. O8 G$ f. l( O
    int     41h8 X8 \$ e! m2 [, O5 y; O
    xchg    dx, es:[41h*4], C) t2 r  {+ ^7 Z. |  [, B
    xchg    bx, es:[41h*4+2]( E$ l5 H' b5 S4 n8 {! s  L
    cmp     ax, 0f386h9 c- A+ M3 M2 E3 r* u' w
    jz      SoftICE_detected
+ x9 ?4 Q8 N, Q4 B# _( I& [
5 ^$ R, V& X: m8 K/ K% p2 Xint41handler2 PROC- e# W( b8 t: S4 r8 e4 ?" }
    iret
& @& F6 L7 C+ a9 C8 @int41handler2 ENDP
4 n5 S# V: ?6 _5 o/ a; k/ {0 T3 n% @+ g

( y3 ]1 o! i0 s9 \_________________________________________________________________________
1 A* T0 e5 U. D4 `8 M. d- l8 b" Q3 u: h9 x
: F1 k6 C6 k6 C1 g9 m
Method 06
) A% s0 O6 J: v0 C2 m  Z=========
1 p% H: I0 B8 c8 b7 n* D$ E  X
6 X) I" j, T$ C2 m( `( i: e8 i" M* U6 @. R( b
2nd method similar to the preceding one but more difficult to detect:
1 l$ e7 C4 e: L' t/ x4 }) p9 U4 y3 [
% t2 m3 G# i' D( q  }9 M) v" B& L$ \$ l1 o! v+ M9 \
int41handler PROC& X1 g; n# q. r% V  \. O$ n
    mov     cl,al
# F& ?7 x3 L5 T: R5 @    iret* T2 }* d0 O2 k: @! A: ~
int41handler ENDP- J* w9 l. T# L) U2 I" z. A
& {" g! K3 k8 t: [2 \: k+ J  {% ?8 B

) X- c  U3 p3 {! W; e    xor     ax,ax
) t$ j$ ]$ h. P    mov     es,ax6 u1 c, n8 q- l0 r1 X4 a9 N! r
    mov     bx, cs/ i# S8 `  k: ~0 F" U& ~
    lea     dx, int41handler! Z# }/ e" y* @+ f
    xchg    dx, es:[41h*4]( a6 w5 T, e. h0 W3 f* y7 O' ~2 y
    xchg    bx, es:[41h*4+2]
# K0 ~' b+ B3 Q1 Z! @    in      al, 40h" s3 s' r  Z3 O  d( |
    xor     cx,cx: ?1 t1 M# z- i! t/ S8 _
    int     41h
9 D, x& M% S2 h! o, b    xchg    dx, es:[41h*4]! |$ V' A7 E) a, R( V( L
    xchg    bx, es:[41h*4+2]
/ F) Y; W, Y; v* v1 S    cmp     cl,al
; h: ?; @( q9 I/ \: c    jnz     SoftICE_detected
) h3 s/ [0 k, c7 b( g' _; D$ ^6 V2 m$ W, W+ L5 k2 j
_________________________________________________________________________. o8 T; |7 [( |0 Y/ ^

" m5 ]9 i( B5 [$ u. RMethod 07+ }  ?& ~% B3 i
=========
( B4 v" V! h" L4 b0 \! `* f) w' \. V; F6 t/ r
Method of detection of the WinICE handler in the int68h (V86)
# |# P1 u" m0 w4 Z. S. S
2 `. m" c% {) G$ w    mov     ah,43h
5 u$ i4 Z+ t1 L4 v    int     68h, T. E6 N8 T4 x; ?9 T
    cmp     ax,0F386h8 I2 z2 ^9 f5 [" ^, H7 L; S8 U
    jz      SoftICE_Detected, E8 N- B% e; A/ ?3 ?' `5 A6 a, C
* U. `" [! Y5 t2 u! L

" K4 H0 R! Y- f- L: y+ Z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit0 o* P0 b( {3 D6 Z
   app like this:* \! W: G  G7 e9 a6 Q
7 w! [- B1 X- w, P( j7 p$ J8 x  E
   BPX exec_int if ax==68
* e  _5 @6 y; [! _9 u, i" z# ]   (function called is located at byte ptr [ebp+1Dh] and client eip is
; ]5 j% V; ~) A  H   located at [ebp+48h] for 32Bit apps)
8 r% d1 i, d/ R( ?& T7 r__________________________________________________________________________
" U  D8 t* q2 Z& B$ J: L7 {. X- }8 i2 E+ v* Q

) S9 l/ l* d% M9 x, f, GMethod 08
! ?/ _# ~& A" Y=========
6 f6 V( u, s7 o/ \. u  P8 [) o
$ q- E4 t2 U, iIt is not a method of detection of SoftICE but a possibility to crash the6 r7 y4 ]2 c: P. @3 _" ?
system by intercepting int 01h and int 03h and redirecting them to another; [) ^0 R1 e2 c) P' w5 U
routine.
" V' F: M% [) g: a  Z2 i. ]It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
& b9 F% F) a# j# hto the new routine to execute (hangs computer...)
" N8 Y, E) E& l$ y# y- I; V7 E9 y) @0 U7 K4 y- R* Z
    mov     ah, 25h
4 O$ s* O0 W5 t6 |6 g1 _8 g    mov     al, Int_Number (01h or 03h)$ Q, \! Q  i0 ]: @6 F7 Y
    mov     dx, offset New_Int_Routine9 o* i/ ~3 g1 ]3 p; {/ d8 [' n2 n
    int     21h
6 H) `2 S: M4 Y7 c+ s. O8 \5 ]; L
__________________________________________________________________________
1 J6 l  o6 p, B7 x+ y3 d: q6 w9 N2 v  h! k
Method 097 I0 g8 {" i" @. q+ S( t* B+ @
=========& n% h9 U8 x$ }( J  t# q/ z, E
1 s' A" d- ]5 G4 Z8 V2 f
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 \4 \$ R: }. [9 P5 W6 ]4 ~$ q
performed in ring0 (VxD or a ring3 app using the VxdCall).
. b. Q: C% e+ J7 s: M  v+ r) iThe Get_DDB service is used to determine whether or not a VxD is installed4 w" U5 v" z' D1 ?2 l
for the specified device and returns a Device Description Block (in ecx) for
/ F2 m/ o  }4 |  l( Y; R" A( N/ gthat device if it is installed.7 |7 @4 v' v) a8 k7 T* m! C
0 A( g. H# n9 H8 i6 j( |
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% P2 |& M# Q8 t5 }" w$ M1 {. Y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- r1 P3 d: K2 }8 s   VMMCall Get_DDB
+ `& W/ \5 S7 k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 n8 }, W; {6 T$ E& q9 b/ a6 g# H& r+ F, b, {" U
Note as well that you can easily detect this method with SoftICE:
/ J( S8 \& K) F! g! j$ f+ G; l   bpx Get_DDB if ax==0202 || ax==7a5fh
( L$ N" Z: J" Q* K0 ^- }3 s
4 `% s! S- U; G, t" [__________________________________________________________________________
0 Z3 P* |7 y3 y+ E2 m
+ N7 P9 F" {% M; b4 a2 eMethod 10& |( K1 C7 J. a; t9 L3 k
=========
$ P- v6 r  ~# }5 a6 l+ q" {2 s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 w% _$ m9 @# |- X  SoftICE while the option is enable!!
6 J* Q4 v, T9 k) B/ w/ q2 U
6 U  v2 M# h4 u" o/ _1 j; _4 eThis trick is very efficient:
/ O. j6 D2 M0 j# Kby checking the Debug Registers, you can detect if SoftICE is loaded( `1 t, @, Y' j! B
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% N; n5 e7 J, _* c1 dthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 h; A* G: [0 \
value (in ring0 only). Values can be manipulated and or changed as well5 P/ i! S1 n6 X8 F" d& X$ v$ i8 M+ ]
(clearing BPMs for instance); s8 X  F) M' |* w+ o

# p$ O! l% h5 V__________________________________________________________________________
; ^+ G5 n4 Z# k7 F# w- z% J  k/ ]( w0 H$ ~( g7 m8 g
Method 11
  ^* k6 t8 p- X3 I7 g$ m* v/ i* P=========
9 R& j( J9 c& L+ y9 T& o! z- M! [- a, r% z
6 F8 ]/ b* N; }  u# g) Z. D# eThis method is most known as 'MeltICE' because it has been freely distributed/ P& _0 G% H7 O9 G7 R
via www.winfiles.com. However it was first used by NuMega people to allow- U: q  u* N0 `5 o, T' ~  u
Symbol Loader to check if SoftICE was active or not (the code is located
7 D) s7 e" C! y3 j5 h5 \8 v1 {$ {, Ninside nmtrans.dll).
9 @, i* G( {) i* i7 d$ d- f
! a; b9 W: [' m$ y6 [2 sThe way it works is very simple:
. f1 S. w- X# C$ {- o, U. r! B$ X: A8 kIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for$ N6 e5 U3 ~) [6 |% J
WinNT) with the CreateFileA API.7 A; e; J# G/ Z; g- M
5 c# T5 f' _4 l$ M
Here is a sample (checking for 'SICE'):
# y7 g- P% _$ N- G7 D4 {: h' u- A; G  e. j
BOOL IsSoftIce95Loaded(); G1 f$ O2 y0 j, p- b2 o
{' {5 x- |1 Z8 L! ?% d0 C
   HANDLE hFile;  
2 d- j! [' |/ ~% s# `4 [; p   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ Z8 I8 B7 G9 o8 V: t                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 @" D. @3 s8 q& Z# W* l                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  v5 k1 j1 o1 l5 B   if( hFile != INVALID_HANDLE_VALUE )
. i6 i, I* x, h0 q3 u: g. t   {7 `$ ~8 I) b# h: {. _: G: X
      CloseHandle(hFile);
; J6 R7 s8 c7 e/ L; t/ D; d      return TRUE;
' z8 E% O5 ^5 ]; K& T   }
9 a! ]' o9 {2 p- W$ z   return FALSE;
5 S- x; L2 U0 I1 [& z}& b* c* z" {8 L
1 V8 l1 ~- W' y' k% {
Although this trick calls the CreateFileA function, don't even expect to be8 o3 {' G3 l- t5 C6 ^( J' M
able to intercept it by installing a IFS hook: it will not work, no way!6 Z7 E2 F: q' [, ~( l: F
In fact, after the call to CreateFileA it will get through VWIN32 0x001F/ f6 n7 D8 n+ X1 ^9 Y" ?# l/ n
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: ~5 N- h& k6 z$ B; Xand then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 s- B; |0 U; E3 ~& v) {. Y& k9 qfield.1 B9 H' C2 x& U0 R
In fact, its purpose is not to load/unload VxDs but only to send a 8 K2 u! i* d( Y* h  f$ ~5 ^, ~8 I
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 O: ]. \% }7 e) Yto the VxD Control_Dispatch proc (how the hell a shareware soft could try
) Z6 A9 d: a- wto load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 J  m( p( }0 l6 a8 g6 `If the VxD is loaded, it will always clear eax and the Carry flag to allow/ d. J& ]8 W+ a% I
its handle to be opened and then, will be detected.
. j, ^6 u( i1 m) `, BYou can check that simply by hooking Winice.exe control proc entry point( Y) \2 }6 r3 B: |3 @9 {
while running MeltICE.
. P) ?8 L% @7 U4 c
$ ^, ^6 u* ^& C& h0 k( J/ W* a
  00401067:  push      00402025    ; \\.\SICE) Y3 e/ _& a0 O
  0040106C:  call      CreateFileA
; l9 u, y2 N" k2 z  00401071:  cmp       eax,-001
6 |2 p% S2 g$ s& d2 y" x/ }9 _  00401074:  je        00401091* w+ S2 \0 x& I' j- y) {
% D  T% y6 d+ P7 U2 Y# S

4 ~' w8 N+ X' n- n3 `There could be hundreds of BPX you could use to detect this trick.
' ~6 p  C: k, G-The most classical one is:+ o. b  F& Y0 E+ e
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ S  L3 d( Y5 X9 n( Q  F0 r+ n0 j    *(esp-&gt;4+4)=='NTIC'5 N' q' f) M7 a; l/ c+ Q
! p4 W* t* e3 S% U7 H5 J# z
-The most exotic ones (could be very slooooow :-(
# `6 v' P+ R* \1 s$ {$ X- j# @   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% ~$ E" g0 n+ Q; C! ?: U2 s     ;will break 3 times :-(" T( [$ G8 }  [

- T* L* s* u3 G7 h-or (a bit) faster: + `3 w/ p, I) h  @) P% }$ j7 m1 `$ z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 ~# T4 B3 o5 b9 K0 _' {
9 [, s7 j9 W4 l) h   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 Q# ^2 n$ C. f4 s7 z
     ;will break 3 times :-(
# b0 ?: N: R) H; A/ g  f2 e! M& Z- ]  |& ~7 G1 Y, }- D5 P2 f
-Much faster:
1 R) J- P7 j! L, [6 Z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 Z9 K+ F2 S4 |  W  K8 C
5 m3 `. O( t# Y$ x$ U1 vNote also that some programs (like AZPR3.00) use de old 16-bit _lopen, O8 s# Y3 g2 g' O
function to do the same job:
1 v/ F, `& M2 s- ~; Z  P6 A$ C
5 C$ q6 e7 U: s   push    00                        ; OF_READ
6 P: {1 i& H6 ]* o. p   mov     eax,[00656634]            ; '\\.\SICE',0" x  x( ]# L% V  u# ~3 m
   push    eax3 h. o0 I* G' K4 d4 ^
   call    KERNEL32!_lopen  c8 @6 {! }, Y6 h' P) s% ~
   inc     eax
! D  u3 o, D/ d  k5 V' j   jnz     00650589                  ; detected2 C  [0 I8 P' o  b( q  J  [0 g6 [
   push    00                        ; OF_READ7 S0 M6 P7 n% K3 q8 I
   mov     eax,[00656638]            ; '\\.\SICE'
2 t% E& O( K* x# d" U3 A9 I4 D   push    eax. G  Q+ a% A( X1 k8 X
   call    KERNEL32!_lopen
4 S" H* m6 w* x' z8 b   inc     eax' J! y; s5 _. [
   jz      006505ae                  ; not detected' R9 g0 q6 }# ~- ~

3 b' B8 j* j) J' `/ ~
+ L, l$ v9 U% e( K__________________________________________________________________________3 ?' Q/ u, I; R

3 f* ?2 t/ y0 ?  {' jMethod 125 C0 s  m2 o% @( O8 y2 W
=========
- _9 h5 i1 N( M' M0 }
; ?6 y# w; ~) f% d* F& ~2 fThis trick is similar to int41h/4fh Debugger installation check (code 05
$ }, L! X% u; H+ u% }" o&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 c0 t6 ^: W; o3 h) I
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 R, C, E) e% G% C: z( ^0 ^$ e' b$ \: y+ S5 N: ?0 J
   push  0000004fh         ; function 4fh
( D& i+ O  L, v/ S. r   push  002a002ah         ; high word specifies which VxD (VWIN32)3 X  O7 z" q9 b3 B; m$ R0 M
                           ; low word specifies which service
- q% i' C9 V& z9 G$ H; p* t, o/ D                             (VWIN32_Int41Dispatch)
0 `; f* m$ d! V( o& B6 U   call  Kernel32!ORD_001  ; VxdCall# F  D- a$ @( ]: Z$ i, P
   cmp   ax, 0f386h        ; magic number returned by system debuggers% n% I1 E0 F# ]; h6 ^& x& e  h
   jz    SoftICE_detected  a1 T/ u) }/ M1 K) \  l. }( C
: z& u1 j1 E& n9 t5 |
Here again, several ways to detect it:
' {. }& h* I# J/ ]8 H5 l: W# c; G
    BPINT 41 if ax==4f
7 Z  Z0 O* D3 A8 [- o9 ]7 h. D! N3 T
$ P* ]' H& @' _1 N: I0 s  ~    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" v8 M0 t4 S* `. s0 U, E
& O  M* V8 Q4 [( m- ?
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 a9 X& H1 n2 d4 j7 P0 w- B6 W( v# V2 s* s0 A' n4 g9 S
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 h- D3 p7 t! g8 p+ z7 X+ p2 V/ u/ E) S, n, a0 o% @9 C$ a
__________________________________________________________________________% T3 I5 q8 Z- e! F) K; W
3 \9 U' [! V5 p! i( Y$ m6 D4 x$ v) W( z
Method 13  ^: Q0 ]7 M/ F. `( [) v' R  P
=========# F' y1 _) d! m/ P: M1 ~
- z7 I) T# Y, ?! w" F5 e
Not a real method of detection, but a good way to know if SoftICE is  L1 M0 `8 G9 v0 r0 Q) l5 E6 U
installed on a computer and to locate its installation directory.% N- X9 z  [* M6 t- J# K! \* L* @  T
It is used by few softs which access the following registry keys (usually #2) :
) [6 f; {+ K2 D. y  H4 I& p7 Z
$ O. D0 D9 d. c+ e3 T-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 h, u' @3 O# B
\Uninstall\SoftICE* t! x( Y! e( K* I0 k3 n' D" f
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE: f( R1 X) K0 h
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. ^% o0 |, E% E! V5 n3 C
\App Paths\Loader32.Exe
) u" g3 I5 Q0 h& T3 G
$ S* e/ p$ G' `8 a6 h) r# h9 ?) H0 t" N6 o2 U( x7 f5 ~& w
Note that some nasty apps could then erase all files from SoftICE directory9 q! f9 l& g, i
(I faced that once :-(9 e' Q" b# j- O( {" C& w9 O

' ]/ K9 ~0 v2 X8 JUseful breakpoint to detect it:
4 W3 i/ c  B3 s& ^4 i* ?. e- O8 y9 C
# d9 N* U; v1 v+ v     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& I8 m/ ]! r' u
! }# S* u& n& f8 k; T: ]0 Q__________________________________________________________________________, ~. h. j! p' F) ?8 U1 l
8 ]1 @8 z5 i+ b7 u  ]& f# V
! r% {( `1 A0 @: h/ |
Method 14
$ e$ A, u. P3 ]  Q$ @- d=========
0 f; E! w+ Y: s6 C" ?+ O
1 ^5 i  V1 R5 v/ F3 p, gA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 \- K; _! t  N
is to determines whether a debugger is running on your system (ring0 only).3 {5 c! U, J! R1 t4 p0 `
, X6 u6 z" q0 m- X" R- q; _$ _
   VMMCall Test_Debug_Installed
! ?$ H5 m+ e& D- [, `* r   je      not_installed4 s7 X( `9 }/ |- z! \

! t& S& I3 V& V7 vThis service just checks a flag.
& P: U8 q( ^2 g" h8 O& d1 ]( s</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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