About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; Y7 {0 O# x4 ]2 a/ y3 Q- K* |: r
<TBODY>
, u9 J, e$ A6 h/ P* a# ?<TR>
& x& L4 [( t- n7 e4 O) r<TD><PRE>Method 01 : y' F# g$ A) W. a
=========
" U! d2 ~" m  }) O$ |* Y3 G; I: M
This method of detection of SoftICE (as well as the following one) is6 W2 r4 p  E. W; j
used by the majority of packers/encryptors found on Internet.* Y) ~/ l% w- J! e) @3 `2 G! H
It seeks the signature of BoundsChecker in SoftICE5 y" j  |% L- q# E2 M: P& C
: f  p! T. W% k' ^2 {
    mov     ebp, 04243484Bh        ; 'BCHK'
9 K! S9 m; N3 p+ f1 ^# X5 E    mov     ax, 04h0 x2 |# m/ Y" H% x* @$ S2 [0 J
    int     3       4 T, H+ b" T6 Z/ h
    cmp     al,4, X# L- d* P& t% o
    jnz     SoftICE_Detected
* @; S% t5 y9 \1 h' v3 q) z
. e  K/ g, l+ C___________________________________________________________________________
  s! B2 P1 s+ L2 }5 P! R* i$ i9 Q3 m$ `% {8 U3 o$ @) g
Method 02
+ J* C1 H0 M* L5 u7 d, O=========( V% ^7 U+ i; ?- [  J
9 k* |/ ~2 U5 K: k# ]: n. k5 r
Still a method very much used (perhaps the most frequent one).  It is used& c6 ?! z6 o2 d7 |- I, p, b1 n
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 E) g/ S. {5 H6 L5 ?
or execute SoftICE commands...
& F$ {. M! e2 v$ Y) rIt is also used to crash SoftICE and to force it to execute any commands
' [, r( v+ d3 q5 |& b(HBOOT...) :-((  
* P2 L) T* o8 w# }
) o6 r. I* e9 ^Here is a quick description:. A3 B4 S& A/ U) i/ B
-AX = 0910h   (Display string in SIce windows), K$ S+ o& f/ u7 `
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! N, S7 n7 o3 C/ w
-AX = 0912h   (Get breakpoint infos)
- Q# D- y3 r$ Z) B$ S-AX = 0913h   (Set Sice breakpoints)
0 }6 p8 |+ ]% W+ M0 D% [-AX = 0914h   (Remove SIce breakoints)
& C! P4 o" Y+ z2 X# k
0 W3 {+ u' }' U# GEach time you'll meet this trick, you'll see:
& p- g  \; R$ T6 o-SI = 4647h
7 a8 t5 ~/ ~# Q; ?+ W5 `/ h-DI = 4A4Dh
9 ~; ]1 ]3 Y' s0 y6 uWhich are the 'magic values' used by SoftIce.
9 c& m# d$ X( q: s/ \6 oFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 [0 P$ R6 u. p5 O* A/ Z

; k0 {8 [2 t" c/ A, X) }( k' F3 ^Here is one example from the file "Haspinst.exe" which is the dongle HASP
3 k6 J; v/ y8 N8 Z) nEnvelope utility use to protect DOS applications:
( g& x+ F2 }8 J/ r! W9 H# ^
- y! I" y4 ^; o+ Z! d# v& I
; V* x3 q" k/ K6 ~+ t4C19:0095   MOV    AX,0911  ; execute command.0 }1 Y- ?5 t% |1 R. a9 T, G
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
; K2 J# M% M6 o8 A4C19:009A   MOV    SI,4647  ; 1st magic value.
  e$ o6 K4 U" ?4 B2 P  u% \. w4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& L4 F/ J0 V4 ~8 \; \4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 r6 v% Z1 D2 ~: I- r( p4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute, ^$ A$ b' N3 M
4C19:00A4   INC    CX  Q( I* [+ M$ P! x0 b7 s1 j2 D* e
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, H( o; f/ g3 Q' W) i& g4 n
4C19:00A8   JB     0095     ; 6 different commands.0 b  l. z/ l) u
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. G* g5 I3 p3 d  c/ ?) c2 e4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- @  V' f! m) h6 _+ G
8 U3 W% ?# M& @3 \5 \3 eThe program will execute 6 different SIce commands located at ds:dx, which
5 A  J1 m* M" X3 [7 N$ N% Kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! `' `+ X* ]% `7 W
4 S3 t* C7 P7 q
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ [* N; n7 G7 F___________________________________________________________________________  p7 e5 R% P: o: i
# o' O$ `) a2 a$ |2 q: \7 y

& ?" H% ?7 G- m* NMethod 03
% g& A# d  ]; G, g' p=========
; h# R. n7 A' O" V# g) ~5 _: U+ X* y: y( u6 ~) H3 i
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 ]% ?: w( P/ S4 S. D
(API Get entry point)
0 c6 T9 K) z$ s8 Y- O8 c" \( M        
# U0 X2 f5 P4 b; }/ ^( B: x8 H- ^# @) N/ H" ?
    xor     di,di4 F# ~( P/ d! ]6 \# l/ A
    mov     es,di
# i1 h( E* \; T! z    mov     ax, 1684h      
$ Z. i5 \; U% k; S9 b+ I    mov     bx, 0202h       ; VxD ID of winice
. E9 k& r1 z9 w  z2 }/ }$ D$ D    int     2Fh
. }) m( e  R/ g, }    mov     ax, es          ; ES:DI -&gt; VxD API entry point( [0 i+ a  b, {( A
    add     ax, di  ]: w" a) z1 G. L4 H- C
    test    ax,ax
' F- ]+ }  m4 J    jnz     SoftICE_Detected' J# }1 C4 l( I! Q5 V6 o

' I  m" v1 M" L' l# w& [0 h! U___________________________________________________________________________* c$ N7 `1 \: P# Y2 p

% o. ^# _/ N* W$ s; ~- M' WMethod 04
2 Z5 V* j( z7 ^+ p=========5 J# }' `% ~$ ~1 i! x
$ n" P+ d) d/ `# b+ l* @( l/ w5 x; ^
Method identical to the preceding one except that it seeks the ID of SoftICE" ~0 a, H0 G$ U+ C! g. U& I( i
GFX VxD.
  o( |; G! W3 b  j1 G4 c
7 V8 r4 D; {8 n& U* r5 z    xor     di,di
+ {" s& t' E5 N; G- {    mov     es,di
3 K0 |( d% _3 w" D+ `    mov     ax, 1684h      
/ d8 L% l# H3 k1 i' J; V    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ o" A1 e2 e0 G2 w% s    int     2fh9 P) E& M$ T, ^  d( T2 [  Q; ^1 @! k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' d$ _9 z( R/ {/ y& G
    add     ax, di2 X& p1 _$ T4 A2 `
    test    ax,ax/ `! B- @- m/ o1 g! s9 I
    jnz     SoftICE_Detected8 W1 m, }: e9 l- u3 z* k8 M

9 J! P5 c/ [* d! ]$ j2 D# |__________________________________________________________________________
/ d, I0 w' U6 m5 b/ z; P
3 Z: n1 X' |/ S; k2 i# x
9 w+ T' N# ?% i4 I7 cMethod 055 L1 S1 ?/ o4 c- @
=========
1 _, s) J+ M5 K% I' u
3 ?1 _+ j$ T  B4 C9 GMethod seeking the 'magic number' 0F386h returned (in ax) by all system, l9 W2 \* P# g0 o6 }
debugger. It calls the int 41h, function 4Fh." X  t, |- j. C# ~7 z( F6 j
There are several alternatives.  
, i' k8 y; E+ X) v
  n, S5 [4 Q  F( O' DThe following one is the simplest:
2 p4 O- T8 D4 f$ t
! j4 w- V- O2 b( e    mov     ax,4fh
0 U* e* h2 F1 l; `0 B7 g, W    int     41h
! _/ f0 N2 ^5 H0 O/ ^    cmp     ax, 0F386& g; W/ J( w$ K: v4 P( L1 m( X( p1 W/ G
    jz      SoftICE_detected$ R3 n$ L% @* I6 b" t7 Z* c& d' O9 k) ~. }

3 V3 ?' y. n3 o2 I
3 T, R( F( ^/ A7 `. c  i* R) T, @7 p# uNext method as well as the following one are 2 examples from Stone's
- a# z- T" m( I* L8 X"stn-wid.zip" (www.cracking.net):  l8 [' u2 ?& s

7 N9 b1 R$ ?- o/ D  i2 u# i7 f    mov     bx, cs; o4 }; M- N: G3 A
    lea     dx, int41handler2
" b8 \7 @. ~+ _9 h# L: Y6 c- z    xchg    dx, es:[41h*4]1 G( v: p$ u, d# _0 y
    xchg    bx, es:[41h*4+2]
# r8 A4 ?. c" W: N    mov     ax,4fh
& a  T+ c, M8 W2 t5 X1 j. T4 a# S    int     41h
. {# d5 u+ i6 }* p7 [! H    xchg    dx, es:[41h*4]7 i+ x& _7 R7 ~4 i# ?. d
    xchg    bx, es:[41h*4+2]
3 ?( \7 l# ~) J, Q* z' }  w    cmp     ax, 0f386h
) X6 q2 y+ E2 r2 k. a5 z    jz      SoftICE_detected
) t4 z3 E+ u3 A0 C/ ^
9 D6 D7 Z; {5 W8 _5 }" xint41handler2 PROC$ f; z& T. Q+ _; F, k4 C& M* y! ^% @
    iret! B+ }. K1 O. l, z2 Q  B
int41handler2 ENDP
- v4 K3 h/ M7 W& K) U5 `
1 t  M0 |" l& s% e# K, }, M
2 `+ z  r* M9 d' {_________________________________________________________________________% J2 Y( Z- }/ ?% n7 g

; @* Q: e. d) Y0 d( H7 t
7 t( S1 U3 g0 a5 z" d# C" k) @Method 06  Y" K, }0 {. x: P1 I
=========
! f( Y2 l( W: ]8 I. Y) d
- s' c+ M; x) \; b9 t- v4 D4 A* ]! c2 B( P# H* R3 J4 Q; `
2nd method similar to the preceding one but more difficult to detect:
* y) \# x8 P: p* L" [1 W9 `4 n- i3 C  s, w

0 d% V8 V( U4 o! D  g9 }int41handler PROC6 V) X7 T  k: O% a) j
    mov     cl,al( b; E9 G) E! u2 {# f6 N
    iret
0 w9 I" j* v% _) N+ E7 `+ Pint41handler ENDP
" E+ H2 f' Q- U$ x
( Z* c2 z/ w! ]2 x8 I. i2 d; N4 q8 u) q$ _+ t2 O! o
    xor     ax,ax
( b/ r# n( X# r0 H- w    mov     es,ax
+ M% W% g9 F( h4 x6 d    mov     bx, cs
; j; U1 b7 C% h8 p    lea     dx, int41handler: k) H1 \  n( _, Y8 g0 S
    xchg    dx, es:[41h*4]4 H# ~0 z  p$ R/ v4 r
    xchg    bx, es:[41h*4+2]
/ M% J3 o  V5 `5 }$ p6 u8 n$ ~6 A    in      al, 40h1 l0 O& v1 _0 z) I9 {  ?5 [+ e- t
    xor     cx,cx2 g, b* x' f8 o$ N7 B/ g
    int     41h
6 |) B+ ?$ R  ^    xchg    dx, es:[41h*4]
2 ?' g9 O" R/ I6 y    xchg    bx, es:[41h*4+2]" P( G# w) R  w2 R, U
    cmp     cl,al  @6 o& I% p- Y, y
    jnz     SoftICE_detected) ~- x  U5 O8 b8 F- w7 ]& O/ ~

! g  U8 k& C# L0 O9 S2 Q_________________________________________________________________________
% P8 @/ {8 C% o7 `# ^7 y5 U' e
1 b; \5 V2 j) ~4 ~# e" ^7 @7 _Method 073 g( D& F1 t% u8 \$ W- ^! f4 ^
=========
  n0 W0 l: C# |6 q. o  ^2 i% D2 ]
( C+ A3 h; q/ D# S" {& wMethod of detection of the WinICE handler in the int68h (V86)) Y: D% r  w  W) N( r8 {

3 O; }6 G  o- i1 I* b5 [- }3 s    mov     ah,43h
9 ^$ J5 u" Q/ ~4 W    int     68h# q" F# E4 @( O$ O5 w$ t# z% E9 M
    cmp     ax,0F386h, z3 K% Q9 T! l9 g
    jz      SoftICE_Detected
5 E* h  \, G3 |- V& Z$ m3 @4 b
/ @7 e' K# Y, E! Z. P
7 o; C3 E5 ]) S0 d8 _. A2 [  e) I=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% R  w" j1 F0 k6 F/ C1 C: o
   app like this:
5 M5 A9 B- f! f  R2 U
% e! _# b5 |, s0 F  l   BPX exec_int if ax==68  h$ O. a; L0 B
   (function called is located at byte ptr [ebp+1Dh] and client eip is6 T& P1 o% t- R2 ~# s9 q
   located at [ebp+48h] for 32Bit apps)+ S( i0 l0 u/ X% D, n. Y
__________________________________________________________________________' ?& J5 r" h$ b. h& w  H1 a) B( v

  s5 c) Y- n, ?- ?
5 V8 {3 B" v- ?6 UMethod 08
3 R# |# R+ J% j! N, B& w=========/ e6 i9 A: X( m3 O' l! [& @" e8 L) V+ ?

, `( w" G5 D( c2 s: sIt is not a method of detection of SoftICE but a possibility to crash the
/ g: t) y) t( _: Isystem by intercepting int 01h and int 03h and redirecting them to another
. d; w4 u4 L8 B& \) ~3 _5 Droutine.
4 Q0 ^- ]) {5 Q0 wIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( E! K) }" |, A- a0 _; R9 H
to the new routine to execute (hangs computer...)3 z. h% g0 A7 v: _3 x) \9 W  ~1 A
$ w  i+ {# _1 ], ~  i" b
    mov     ah, 25h: W4 q( _# s; i
    mov     al, Int_Number (01h or 03h)1 b  y# f; r7 _0 x: S3 p
    mov     dx, offset New_Int_Routine% F- B/ c6 `& ?4 s
    int     21h4 n0 V3 A3 M" U' }! F8 O, H6 Q. V) v

  L2 t" V0 `8 E$ q7 a1 `__________________________________________________________________________& q& m" l% @+ r6 H. L

7 W' b- L! X9 d' yMethod 09: t' k$ k# ~& H$ J
=========
8 J& ~7 |; W! L  Q0 p: t
: g4 b. u/ I% u; [9 s7 d  f$ r5 zThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; x5 d& ~" i5 [  i3 A! Mperformed in ring0 (VxD or a ring3 app using the VxdCall).
0 B& h/ {( q! ?$ a* l4 D' L4 XThe Get_DDB service is used to determine whether or not a VxD is installed
1 \' \/ e9 {* m) O$ Q7 {for the specified device and returns a Device Description Block (in ecx) for
, h* _& u0 J* Z! nthat device if it is installed., d- w  Z2 L* H) m# A& a' ?

" E$ `2 F( `9 G0 i9 I+ ^   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ f: P2 Y' X! S* B% v
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
$ _- x& ~- B& ]   VMMCall Get_DDB
& g" |6 u, u) `9 l9 c2 m, T   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! A' {6 A: W0 T
% l2 O, Z+ o$ @  y) j% K9 \Note as well that you can easily detect this method with SoftICE:" o, Z$ T' t3 ~! U
   bpx Get_DDB if ax==0202 || ax==7a5fh
- q' E4 P) y. G# k% y) `3 B  v
3 y4 Y4 y8 z( w# n: B, O; @__________________________________________________________________________
. h( S& B- F& A. C$ ]3 ^" P- V5 L- ]4 W" x3 l" u
Method 10
/ ~' n6 y/ F! U+ p=========! B2 p' ~5 X  _: B8 w) l2 ]

2 S+ k7 ?# G3 ^8 ?2 v+ ^=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* [* F/ i, _% a  SoftICE while the option is enable!!& Q5 P; }( N" U; {1 w% t

9 L0 `' Q) o4 x7 IThis trick is very efficient:. _# R: ~9 Z0 i0 o( Q" `
by checking the Debug Registers, you can detect if SoftICE is loaded4 d# F; e: `0 G: M3 ]+ C4 J" G2 M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" F6 v% Y) r; @* W  lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
( a: e  p; k+ B8 R) \0 [, v& Gvalue (in ring0 only). Values can be manipulated and or changed as well" c8 I' ]5 G8 ]3 Z: t( B+ i
(clearing BPMs for instance)) }0 U0 l3 c7 _) V$ y& Z2 |" q

7 K3 l* t) [3 ^! T3 e: g" `$ f- A0 X__________________________________________________________________________
# N1 \/ T7 m8 U+ e
! l5 d. W, L  p# N/ o' |Method 11- P. W" z6 j9 T8 H4 p
=========
8 o9 P, e. o# R" E6 U5 h7 V! w" @( D( E9 G6 t3 E! A6 E& L
This method is most known as 'MeltICE' because it has been freely distributed
; r; U# I4 ~+ X8 v5 D3 }via www.winfiles.com. However it was first used by NuMega people to allow
% W, P+ }( s+ E& o2 I- OSymbol Loader to check if SoftICE was active or not (the code is located2 \8 D2 b: m+ M* t% Z; ^. W
inside nmtrans.dll).$ C3 d1 Q" t" e5 u+ E. p. w1 @% V

+ V3 b8 |- o2 \8 v2 y! OThe way it works is very simple:
8 S$ O  k# I# _9 ?4 _( iIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
+ H, D. T- X0 a& L- iWinNT) with the CreateFileA API.8 s& O8 f- W! l  Q+ W# R$ j: Z! x
2 t- c; O0 [% t* `5 }
Here is a sample (checking for 'SICE'):
* Z4 g( {/ D% X2 [% R3 T9 I, K8 {0 w2 b, \/ ^
BOOL IsSoftIce95Loaded()! g9 {* ^! L/ u0 x* @# [
{
4 Y8 W5 W8 P# X* g6 a   HANDLE hFile;  - J/ k, ?0 T8 Z8 h
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 H. t. L  f/ b- u( T3 U4 q0 N                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 V( R  V5 ]# Q  [                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) F# L' F3 R  O: L! z8 x: b
   if( hFile != INVALID_HANDLE_VALUE )
# M+ {0 h) B7 y! ~' Z   {
( f! d% x. @3 n: t4 z      CloseHandle(hFile);
# {2 F1 n* Y9 X5 q; \      return TRUE;0 P: S) C7 {7 e: J' ?
   }; A1 x( A; U2 w# S9 ^
   return FALSE;' j$ c" O- B& _# |+ S: @8 t( s
}; V# f& h" I: H. N5 @/ J8 }
5 S4 t+ t! ?% d3 Z& H! S  }
Although this trick calls the CreateFileA function, don't even expect to be
7 H$ ^. d' d2 Y0 A  o1 z) xable to intercept it by installing a IFS hook: it will not work, no way!
' J0 ?. D- T0 q4 sIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
) L' H7 h8 L" o) ^. f. B, Tservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 o1 s' Z5 s! A8 b# P1 tand then browse the DDB list until it find the VxD and its DDB_Control_Proc% c1 O3 p8 h; [' q- S" a5 p. g
field.
% a1 r0 x$ c  M3 y4 g' f+ bIn fact, its purpose is not to load/unload VxDs but only to send a
3 b0 }$ i& }: F$ d+ a! FW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# Q6 Q& U* v- [& S
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
2 |" g- ?  B  i) Nto load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 M6 U' v3 z) q; ?, Z# XIf the VxD is loaded, it will always clear eax and the Carry flag to allow) E' z' f. N( {/ s& {
its handle to be opened and then, will be detected.
" O5 J$ |* O9 E- ]You can check that simply by hooking Winice.exe control proc entry point( l- K( E4 I; R5 {5 M5 e0 |
while running MeltICE.
3 t8 ?$ j. j- ]. G! w* P  v
  P' u6 k' U6 M! B1 ^9 D
; t0 K( w* L8 y! r0 Z+ S  00401067:  push      00402025    ; \\.\SICE3 y- w2 |. H3 L" L
  0040106C:  call      CreateFileA
7 F% G+ U& Y3 B3 h! l! Y  00401071:  cmp       eax,-001
/ x) v8 ?7 B* G/ x1 E$ }# m' Q, D; |  00401074:  je        00401091# ]8 U# K4 z8 q; h$ W- p

' L3 \0 ]8 e/ N# a- I7 R4 J! \1 }2 H- C) `- ~9 o
There could be hundreds of BPX you could use to detect this trick.
1 ^6 E  v$ V( H8 T-The most classical one is:
% Y1 O, G2 Y" ^# }3 W  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
) [) z4 t; B" |% {" h. d6 f    *(esp-&gt;4+4)=='NTIC'" ?! a7 ~  Q/ m' H# z# Y. I
) {8 G( |' _  }' Q" @* ^" ?
-The most exotic ones (could be very slooooow :-(
3 o8 X6 @7 T; ]% r! l4 b" a/ }   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  2 I& \, F  p' v8 A$ h
     ;will break 3 times :-(+ v/ ^9 H$ @: F1 O( ]- B) E
8 u$ t6 h: g/ J
-or (a bit) faster:
, W" N0 C" P$ k1 r) ]' H9 ^   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# _' x- g% @* n4 T
7 |4 A7 n# T' y+ [   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) U; v* n$ V; l+ f" p
     ;will break 3 times :-(
: B' C" o0 r( }: ]4 G; r. K0 N  a  j- R$ e( |
-Much faster:
) m) u# f. z) H) S1 b   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* ^8 J, ?$ s$ q7 _+ ~8 w
; a" O3 D' M. O' o, ^& I8 c) D/ }1 ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ h: S+ ^' |  K& _# v% _, O; {function to do the same job:, i9 r, v( M5 b  m
3 u/ q$ Z. R* g3 |4 i
   push    00                        ; OF_READ# \" K# e0 |% D7 U" |' J
   mov     eax,[00656634]            ; '\\.\SICE',0
. [1 j6 H8 G7 W2 w' l0 Z- A   push    eax
, @: c) W' k0 [: n   call    KERNEL32!_lopen* u9 X7 q. M3 ~" N- l) ~
   inc     eax9 t8 p5 X* ]. B- u2 O! h: w  P1 k
   jnz     00650589                  ; detected3 r! E/ C* @- ~) f( y
   push    00                        ; OF_READ
4 P$ @+ n/ y- Z' y1 z) X   mov     eax,[00656638]            ; '\\.\SICE'
2 G" S2 I& E8 S' K: K   push    eax7 d- Q3 C6 T6 R1 t
   call    KERNEL32!_lopen
) S, M, F" Q, ?, k4 z2 t4 U) |   inc     eax+ H! R7 e* a& A# n, s. j1 o0 k
   jz      006505ae                  ; not detected" ?9 s+ m  {) D& I
1 A. F% D/ l: b9 _" i; k

! b. T* g* c: f) q! u__________________________________________________________________________( f# P/ q( `, b/ X6 N

- r( @" m4 h- R+ C5 LMethod 12( s9 r1 M% W, t% B% {4 g3 _" G
=========
! ]5 j/ D) G9 K0 ~
/ u2 V8 h- h& T' WThis trick is similar to int41h/4fh Debugger installation check (code 05! f2 t8 d  t0 r+ S4 I3 W. }
&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ S: k, L6 A6 b7 U
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.& w6 `. g0 o. x% H: Q7 W' e" B7 i

0 ^+ p$ s" W# Z, A+ \2 c   push  0000004fh         ; function 4fh
! {8 D! S8 B" A. `8 I   push  002a002ah         ; high word specifies which VxD (VWIN32)
% [& M) F4 y: C3 O' `                           ; low word specifies which service  b3 w  |) `) x. G9 L& t3 w
                             (VWIN32_Int41Dispatch)
  Y! J" i1 W. Q   call  Kernel32!ORD_001  ; VxdCall
- v# l! O3 J. g8 N   cmp   ax, 0f386h        ; magic number returned by system debuggers
: q5 J6 S, q$ H9 h9 |) g   jz    SoftICE_detected+ d; v/ M% L# ]# }
4 C5 H( a+ q4 k8 C' V0 o
Here again, several ways to detect it:" Q1 Y3 g% Q6 k( }
6 G7 N. a+ I* W" U( L) S3 p
    BPINT 41 if ax==4f" K) a4 r2 l2 {# t

7 A" u1 H% \# k7 q4 J    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" B6 Y) s: D' c" B( z
# \! ^, C/ X6 I; H4 F" ]
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  X  i4 X& r7 y) i$ V
4 i6 K3 p" e! X' f8 h" M3 i/ G+ z3 G
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, J  I9 f0 |: H, S9 Q
3 G; q8 m: E$ h1 K
__________________________________________________________________________" w! P0 ]) a' x3 s
6 j  U. n; A* X" b9 I0 [
Method 13
# V; X# R& n7 \8 {& P; _7 y=========
( ~+ D, ?! A1 X9 L6 `- ~
6 h, v' x4 B$ K! nNot a real method of detection, but a good way to know if SoftICE is+ |( S8 b0 ^5 L# z! r1 U9 m
installed on a computer and to locate its installation directory.+ V6 u: n9 _$ m) Y/ {( e
It is used by few softs which access the following registry keys (usually #2) :
! z4 }2 j! }9 B- M8 t1 [
+ _  p; Y+ M* I$ V-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ F! o) {" q& l+ N7 @( N\Uninstall\SoftICE
: C. i/ }3 f# n-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; w) C9 x0 N4 S+ J6 c
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ R4 \# |) g) T\App Paths\Loader32.Exe
3 ]. j+ l, i  j2 r1 f( R: s5 @( v" y0 C! ]  O  ?
2 u" \' s7 k1 V1 ]
Note that some nasty apps could then erase all files from SoftICE directory, U. y' D+ }# |4 l2 w
(I faced that once :-(
* l; m- s) T, ^- p8 b7 T! s5 Y4 y+ P7 `& E
Useful breakpoint to detect it:
1 k& t9 q$ X8 f, Y% }0 U6 P
& W$ J: j. w. ^( C+ [     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': T; O2 r6 ]: A8 q5 P$ {) I7 H8 T
9 t4 r0 g9 K3 f, C8 T
__________________________________________________________________________! m( N" I3 n  e) _4 _2 U9 ]8 J

1 p7 ~# Z- }7 x! r. w+ _6 q: e2 l% Q- I7 V
Method 14
7 u$ b9 u0 M5 a; {=========
2 y, j( @  v' q& u( p
# i6 m2 d* v- Z4 Y. x8 [8 lA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! u! z3 G1 k% Q% _& b' A  V" lis to determines whether a debugger is running on your system (ring0 only).+ C- g4 N- E4 x) X5 ~

# X- M3 P: r, k4 z8 S! `+ T   VMMCall Test_Debug_Installed. R. x. J9 M! [# j" X) z
   je      not_installed1 D5 N: w2 @! W7 Y8 I2 a8 y

7 b7 f- x6 e" \/ J) |& L' ]This service just checks a flag., k, [4 |! b+ S: l+ v
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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