About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% o5 Y7 J* t; K; W* ]  y; Y<TBODY>
0 c! Z7 u* @; x5 @/ H+ C<TR>( Z: C$ F2 M4 V& U; w
<TD><PRE>Method 01 ) Q0 j0 ]7 p, O; w8 ~
=========
$ O( z9 L7 H5 B6 q" L1 E0 l$ D" B& r: m  y# y
This method of detection of SoftICE (as well as the following one) is
/ S  _- r4 j( |; s! f! m: T4 qused by the majority of packers/encryptors found on Internet.
* I2 r0 e2 {/ N3 SIt seeks the signature of BoundsChecker in SoftICE
: x4 n4 L# i, \" \0 s& F* n  l- }1 A& z! G' u. F' V
    mov     ebp, 04243484Bh        ; 'BCHK'! c; K  R8 D% y1 i/ b2 Y9 \* m
    mov     ax, 04h9 b2 d( L5 O( \  g4 u0 j" M: L
    int     3       3 r2 u' K" A# t' g& q1 c2 w
    cmp     al,4
3 l' [+ h) T7 q! \9 f1 v, w    jnz     SoftICE_Detected
, P8 T/ K4 |# j: X
' s5 ]# q) x& S# X4 D5 g___________________________________________________________________________
3 k% }9 V+ N7 i1 _$ j2 m( V- i% s' L
# H, l; S8 b  t5 V" cMethod 023 }) b% A( ]8 w
=========
1 {9 f/ |& y5 z
8 X. R5 i; S2 p' w- C5 `! ]  sStill a method very much used (perhaps the most frequent one).  It is used
6 e+ M* {1 y# Q8 n8 m4 a: F: kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,# O6 X" q: \5 X" C$ b+ q4 {
or execute SoftICE commands...' Z) i5 ?/ ~* e# {4 K% Z4 [/ Z8 _% l0 H
It is also used to crash SoftICE and to force it to execute any commands" \7 M% z$ G* y9 d. }
(HBOOT...) :-((  ' a5 H  ]4 M0 l" g" x

- a/ {9 ^: ~; h, Y, G  {Here is a quick description:- l7 V) v5 Y! Z, S& ^, _- k$ c
-AX = 0910h   (Display string in SIce windows)
+ M% y) K& W7 W# w8 h-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)+ g  [# q& m$ m% F4 j" c
-AX = 0912h   (Get breakpoint infos)
# l% ^, I4 R$ a& \' [/ ]-AX = 0913h   (Set Sice breakpoints)
; p5 s, b% v. A2 B2 @4 j3 ~2 [-AX = 0914h   (Remove SIce breakoints)
  y/ T) S, r  `3 ~2 p- Y. T( u6 _3 {+ g8 i7 W1 ~, V& C
Each time you'll meet this trick, you'll see:
6 E8 n& x: c  `6 K1 X- L-SI = 4647h8 G9 R# c' g  s+ x, ]2 ]& ^
-DI = 4A4Dh
/ z5 G$ \, r2 d$ ^- A9 s- EWhich are the 'magic values' used by SoftIce.3 c  T5 t! V* P% W; q: F; ^
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
7 k  w1 ]' {" k) X# m8 B9 a& i5 a% u
Here is one example from the file "Haspinst.exe" which is the dongle HASP* Y, T) o6 ?+ W. r% j: L
Envelope utility use to protect DOS applications:
6 G2 g# }, Y) a" `2 g9 J7 H3 x* i  y' p" y  O, v

) _/ n+ _3 j2 Z: S4C19:0095   MOV    AX,0911  ; execute command.
6 k9 R% B& z' Y; @2 a5 B1 b' Y4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).( @+ ]2 H+ B: \! C4 Z! T
4C19:009A   MOV    SI,4647  ; 1st magic value.
2 I  r% \3 j* F7 [* K2 ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: u8 Y/ B8 n5 b( ~) E& ?, a! \4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" c/ r% @$ ~8 A- W3 x4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 `. w7 T3 z7 y+ K0 ?! _
4C19:00A4   INC    CX7 O2 J3 T, B2 I& I0 r
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! x1 t! \" S% I2 |4 L+ n4C19:00A8   JB     0095     ; 6 different commands.2 T+ E6 `' M& m" P! S
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: F6 `0 B: d: @$ s- ^  ]' P4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ l+ p" d0 y  I: l  X
' K1 K; q  k0 G
The program will execute 6 different SIce commands located at ds:dx, which* W8 G  ~+ a" X, W6 y, k9 Y% n- C
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.1 H5 B7 h/ m4 u

$ |" J+ c* {- i) L* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
" }( ?' D, r" d. e___________________________________________________________________________  Y2 k% j- q  O# s( K
8 S6 q. N: [/ ^

; G) ~) s* |) N0 x3 b$ P, ^7 FMethod 03  g# q! Z2 d" \2 b* X3 r% B
=========# B1 A2 G9 ]- W/ P
4 K$ O, u8 D) O& K+ g5 Y9 G
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
) H( @4 p6 `3 S9 E" b& [4 V) {(API Get entry point)( p; \9 _) }2 r9 k4 y
        
# a* Z  l  C1 {  A+ ]
3 F! [" M8 f9 @7 v* ?0 N    xor     di,di
" ?1 {8 [" V, G2 X    mov     es,di. z* m2 t5 M/ H& @* b/ {- `2 `
    mov     ax, 1684h      
" S% |0 l" F8 }" R) B+ H    mov     bx, 0202h       ; VxD ID of winice6 D9 ^* S( c' l. |2 H) O1 @
    int     2Fh
  y+ ]0 ~3 e2 I( L% Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point( |! r7 t- B- m+ L% z5 T
    add     ax, di6 [* A( O$ {2 O5 I
    test    ax,ax! v; C2 i. i3 D8 y' |; K
    jnz     SoftICE_Detected
) k5 Z+ _; G' u2 C8 `+ z" n; q/ t" _; j* d) {
___________________________________________________________________________( l3 X+ ~' V' X. j1 P
% H) _0 Q$ j9 j
Method 04
! _* r! l$ E" Y7 O; \# K# Z/ J" {=========; k2 P  J6 p' K: B
* h5 P: {  E3 P# b9 S5 f2 X
Method identical to the preceding one except that it seeks the ID of SoftICE! @. E9 U5 |" L4 ~4 f( }
GFX VxD.
9 `$ A# T0 F2 O, V6 |
) y2 n' h7 A" t7 q, V6 J    xor     di,di
2 Y1 V7 o* G0 a1 E7 j    mov     es,di9 D, i1 ^3 N1 \  l
    mov     ax, 1684h       ' e% Q3 V4 c/ A/ Y
    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 c+ h1 \$ t$ |; O9 ?5 \
    int     2fh
" a' _6 U, O+ ^# \* `    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- t2 z3 \( d* o& A# Q* R- F/ U0 j    add     ax, di
# Z9 h2 ?+ l! k+ }6 q  w& I    test    ax,ax
1 H+ v$ O$ B# ]; |& s( H2 p; B" `    jnz     SoftICE_Detected
9 M) E4 z$ F; D: j# O: U% I! R' Y4 o8 \3 L
__________________________________________________________________________
) K: X2 z9 V3 m, Q0 I. c5 B
8 o9 O$ d. |) U6 v" V5 f3 C0 [# P( R4 g0 P
Method 053 B7 Q5 o) w- v2 q
=========/ R5 s  Z$ N9 [$ e5 v1 ?% X( ?9 w, [1 h

& w5 D. o0 H; d6 {1 y: WMethod seeking the 'magic number' 0F386h returned (in ax) by all system
  e3 W, Y( I: u! y8 Qdebugger. It calls the int 41h, function 4Fh.
+ c/ C+ X; O' C* O  l, a4 C6 `$ P. zThere are several alternatives.  
+ f2 u0 Y) C' I- C/ @& ]* K1 ~) @0 Y2 Z  Q
The following one is the simplest:/ P* e: M1 h1 m

  }4 [1 n. k9 t$ w    mov     ax,4fh
! l  K8 W9 M' X; ]7 m9 f; w    int     41h* N; p( ^2 R: a  n  C+ O
    cmp     ax, 0F386
1 J9 ^3 V. q6 S4 P9 t2 W, n    jz      SoftICE_detected/ Z! g! B' M+ V0 A, R

; }& u  a4 C' T! r# F+ H" s1 e( \) D+ i" W" V% p
Next method as well as the following one are 2 examples from Stone's ; P8 G6 `6 M8 w8 r8 V+ b! a
"stn-wid.zip" (www.cracking.net):5 K2 y* t) ?, M, Y7 I! V! n

$ k0 X% k- J" v    mov     bx, cs) H  K0 K% d4 b: _; z
    lea     dx, int41handler2" f" \! J9 Z4 i7 E7 [3 V: p& x
    xchg    dx, es:[41h*4]; l2 t9 Y7 r& E! b: ?# f9 C. S7 D. }
    xchg    bx, es:[41h*4+2]
! P) ?/ ^3 ~( m1 T+ i; h    mov     ax,4fh
/ h7 Y2 }* \1 i* X( A3 G7 m    int     41h
# e+ i# L. r8 _5 R    xchg    dx, es:[41h*4]
9 l2 y) e9 s8 b1 c7 Y/ N) u: ~    xchg    bx, es:[41h*4+2]
, e# i' @0 D; k; Z( ~; i$ ~    cmp     ax, 0f386h, q8 o& K- ^% \  Q1 t
    jz      SoftICE_detected
1 L" t* C6 F0 _6 @
# ]( A& G( l3 ?% J: mint41handler2 PROC
1 w8 t* V% h. h& H& a. |1 Q8 @    iret
$ S( S# O6 W. gint41handler2 ENDP# K' M$ R2 v. j6 n6 y  |) q
. [0 b) U8 p; v) m& k) P  O6 H9 r
9 g3 ^8 a& B3 c# J. [$ Q" e
_________________________________________________________________________9 U9 S( {2 Z- K2 y: Q  I

- I2 Y( M; H  I+ l; \+ U$ b9 i# k3 a6 H
Method 06+ ]! l) s3 S1 A
=========
; C. U+ l" g% J5 D. Q% q" U; m! Y- i' v

) O: }6 L* H$ b, w2nd method similar to the preceding one but more difficult to detect:) R/ n( ~- ]+ q) _8 m8 Z
, |( X& ]4 v% k9 m
. }2 K' z8 b7 O
int41handler PROC7 O, A: e3 ~! @4 u- n0 ^4 m6 K# a
    mov     cl,al8 r% g4 [/ h; y6 a
    iret- g7 J, c( M8 O  ~  n3 j7 B
int41handler ENDP
. L! P4 X) E, R; H+ M
! V: Q- K  S/ ~7 P, v& ]! e- Y; \- b" F  V, Z
    xor     ax,ax
2 h  h' n& [7 d: N# i% a1 k, n    mov     es,ax/ b: n- |1 @. O' a" L
    mov     bx, cs
* N# Z& A: L" c" ~' D; y7 t    lea     dx, int41handler
7 p/ \; z' R$ g6 e5 }. f    xchg    dx, es:[41h*4]" A9 t* h- `; K8 @) \  T% U
    xchg    bx, es:[41h*4+2]) z3 `! K- U& P2 Q2 }
    in      al, 40h
# D( \: _/ m3 J: r. Q( |; n( v* b1 u5 u* ^    xor     cx,cx
( x+ V" Z( _( r/ \    int     41h
, _8 m7 n3 J3 v2 o    xchg    dx, es:[41h*4]' t/ T) I' O2 M' V) Q
    xchg    bx, es:[41h*4+2]
+ ]: c9 y  v: p+ g5 a& s. K, b    cmp     cl,al
) v1 Y" l7 U0 \1 z. J$ z) w  f4 ?    jnz     SoftICE_detected
9 p. w, D9 S! p1 s4 l
3 @& c. z3 n; s' a_________________________________________________________________________
# h0 n5 Z* ?" D7 U! G/ R
+ K( ~5 w' a! X# `7 H: q5 ZMethod 07
1 r: v# N: @) e( C, J=========
& `, M7 ^! w/ ~0 I) x
* d# @+ g* `0 T" G0 v7 HMethod of detection of the WinICE handler in the int68h (V86)
0 j4 [5 J5 {7 d+ s0 f; f: h) |  X& n
    mov     ah,43h, M* n& H! u# c$ B1 \6 `3 g% D: k7 u
    int     68h2 p  r  v' K7 |2 b4 J+ F/ l
    cmp     ax,0F386h6 d0 W6 P- q+ u( q$ }
    jz      SoftICE_Detected& X- C/ G, v2 a% H; o' R9 R
& ]0 F" {" E7 ?& u
3 h- W$ V% G& Q
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ [' k: p+ F  Q6 ?+ l# U8 ?2 V3 E
   app like this:5 J" L0 s% I( U% A4 o+ d4 ]3 @% S
2 C: @* W/ ^% u
   BPX exec_int if ax==684 G) b5 D) k& n! S
   (function called is located at byte ptr [ebp+1Dh] and client eip is
* W/ U$ i& t: Y# Y   located at [ebp+48h] for 32Bit apps)6 @. A! X0 v6 v7 Y. t
__________________________________________________________________________/ w4 z& ]$ v$ s: Z* W9 X* j, P

; ~6 [0 B2 |+ b% H
) k4 i. G# V  F7 l) UMethod 08
5 A1 T0 {; @) w5 d2 i( _=========7 D. M! k2 G( e5 v. A
( j1 D# \5 K) B8 }+ Z
It is not a method of detection of SoftICE but a possibility to crash the8 s2 d- Q1 h9 l$ W+ y2 m
system by intercepting int 01h and int 03h and redirecting them to another0 \0 m: ]9 Z6 H; @
routine./ X1 {9 H4 b5 d& c( h
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* r; P! P. p$ t& k+ _
to the new routine to execute (hangs computer...)
- O  _; k4 E" U, I: a( v
5 r8 N/ d  E& p    mov     ah, 25h
8 i  m5 w' B9 {( v9 V0 X    mov     al, Int_Number (01h or 03h)0 Y" y0 ~; V. [3 `
    mov     dx, offset New_Int_Routine
7 P, W7 v0 \1 a3 j" j, R( X% h    int     21h
! J. X3 m8 P7 x& B* z( W! [2 h+ P8 q
__________________________________________________________________________
2 I$ a" _( L4 Z7 Q( f5 R! E- f- P" g$ d; o; q
Method 09
7 C4 ^3 [5 c: E0 o) _0 i=========
- ~4 K- O* o9 o5 `" e8 z) R5 Z. I( ~7 r
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, ~2 w9 D% g* {) ]! P% O' w4 Cperformed in ring0 (VxD or a ring3 app using the VxdCall).
, }( Y9 l5 x8 b  T7 H- ZThe Get_DDB service is used to determine whether or not a VxD is installed$ M& X: R7 a# }; D6 b
for the specified device and returns a Device Description Block (in ecx) for+ }8 b' B+ ^% C8 N6 X# N( I
that device if it is installed.# I' @# U, s3 u3 H" C1 }/ ]1 J
3 I) K1 S; ]/ v3 {4 H' s. d
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ r: D; ?$ z: B0 n" O
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. ]9 h/ x$ @8 i4 A   VMMCall Get_DDB
" _' x) C( f2 @; U2 F2 N   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed' j9 M% R  `* Z1 R

1 ^! o0 A* W4 }/ N/ p3 h6 j/ n3 dNote as well that you can easily detect this method with SoftICE:1 L1 f1 X- f( V, L
   bpx Get_DDB if ax==0202 || ax==7a5fh
/ X6 b1 y1 R5 w  @7 o, O. H* ?3 P9 M+ \
__________________________________________________________________________. C4 G! @7 Q# p7 a8 n

8 _, i* H. `& ^% ?" f0 [Method 10
9 x" n. K' |. T=========( q: K  n, J1 X. c" V+ U% I( J

% p1 p, y; r$ l. M0 j+ Z=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ e! v: L  x  H2 s0 \5 z0 X  SoftICE while the option is enable!!% [9 ]' m1 A, ^3 O7 j- l

2 k' l# `/ X" }) E0 e+ w8 h, d8 |; \This trick is very efficient:
& p! k; R  f% Y% D7 ~by checking the Debug Registers, you can detect if SoftICE is loaded' V: X% n  W% j6 H! b
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' y5 I7 i& a5 w0 ^- C% `( Z, D- M. a4 M
there are some memory breakpoints set (dr0 to dr3) simply by reading their
. l+ ^" E. y$ f' fvalue (in ring0 only). Values can be manipulated and or changed as well
! K9 H5 g4 \6 K/ t+ H) n(clearing BPMs for instance)
& H3 l$ a7 u& o9 r9 d
; e. x$ m2 @) k5 k0 I__________________________________________________________________________7 @1 j' k% E/ g+ g

. h/ c! Z# L; }$ `* @Method 11
* Q) r6 N6 E5 ?$ |- Y$ n! R, S=========/ }1 Y$ @) s6 V& G7 z$ Q3 U
* G) C. F( ]) S. c
This method is most known as 'MeltICE' because it has been freely distributed1 @; L' ]! m% E% }3 F# \; }9 B
via www.winfiles.com. However it was first used by NuMega people to allow
: [6 E7 ]) [9 D6 fSymbol Loader to check if SoftICE was active or not (the code is located6 R: [% F- C' D
inside nmtrans.dll).
; U; P. F/ K2 R1 }+ u( Z" i/ \# f4 y7 a% u6 ^* v! D$ t
The way it works is very simple:( _5 s6 J7 G( I% ]- ]
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 Q: m+ e) l& L0 ]. x! s9 h
WinNT) with the CreateFileA API.+ J' H5 q$ ~* _5 x$ s0 Z

# ]7 Z$ O* J& `$ f" k) THere is a sample (checking for 'SICE'):
0 y. ^, c; A, j# t
5 C: D8 V' T" k$ X7 C0 gBOOL IsSoftIce95Loaded()
3 Y4 E+ z/ L0 I  ]/ y4 f{/ T7 Y( _' M2 W2 i( d1 j0 b
   HANDLE hFile;  6 _5 V. K$ L" u0 w: i
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 m' M6 l9 [- s( \" P* y/ x, E                      FILE_SHARE_READ | FILE_SHARE_WRITE,: A8 v) X* e* L1 n+ a( U0 K# \5 \% i6 Z
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# Y1 i9 @+ t0 T& |   if( hFile != INVALID_HANDLE_VALUE )% G/ d- @0 T* b$ J2 ]
   {* W$ W3 t% v9 }; S+ n; g% @
      CloseHandle(hFile);0 c# f& j& Q( A
      return TRUE;9 f: @& t/ G3 l. p6 R
   }
$ ?/ o; y. _9 K2 @; @   return FALSE;
: D3 R6 j  P7 r' u* i% R6 C}. o8 E7 j5 ]5 u. x. O- V7 d# z
% m- h9 ?, p% z3 P+ [
Although this trick calls the CreateFileA function, don't even expect to be
$ S% c0 J7 c/ w+ A9 g2 }0 ]able to intercept it by installing a IFS hook: it will not work, no way!
# N% z7 U8 K$ yIn fact, after the call to CreateFileA it will get through VWIN32 0x001F* b! W$ H7 A7 q+ U3 L! x4 H$ `8 n4 k
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 t) m7 e9 S# p( k' g' P
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 `5 K# g; G$ p6 Q9 p$ }field.
* Y1 [7 G9 f% j( }4 dIn fact, its purpose is not to load/unload VxDs but only to send a
" K& z8 Q( e3 F2 jW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); D2 e. b; `9 b' ?, ?2 ~
to the VxD Control_Dispatch proc (how the hell a shareware soft could try8 Q/ X5 h) C9 K- B; [
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
- H; F' Y2 D* f6 R6 \  r# P9 rIf the VxD is loaded, it will always clear eax and the Carry flag to allow
! R& A" r  t5 ]9 P4 ]- w( H% _% Zits handle to be opened and then, will be detected.; j2 |. l! V. L- C9 a! P7 H
You can check that simply by hooking Winice.exe control proc entry point9 v( V2 j/ z) b* E
while running MeltICE.
+ y3 I* D8 {: ~. X9 |/ N  o" N+ C" a! Y4 |6 A  M3 |

# l6 \8 {! [& G% e' ^) R. b! t3 P% H  00401067:  push      00402025    ; \\.\SICE& X, m$ ?8 X3 R
  0040106C:  call      CreateFileA
: k- `2 D" }% A+ J  ~  00401071:  cmp       eax,-001
$ G- g" @1 T: ?' E& _3 X4 L0 O5 X  00401074:  je        00401091
5 s  i5 f/ r1 f6 q6 x/ f/ n6 n2 T4 `+ v8 V/ L- G( ~+ j
0 Y! H: s4 p5 c- M1 h. W! [- y; `
There could be hundreds of BPX you could use to detect this trick.) Y8 ~* _" z% }  i! u( C! q
-The most classical one is:
" X6 ^' B! i" I. K2 p  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% |0 D2 q( d$ c* u5 @5 A    *(esp-&gt;4+4)=='NTIC'7 N  A' r1 S: r$ {5 Y

, F- ~) Y  {6 S6 Y+ ^-The most exotic ones (could be very slooooow :-(
; I! ]8 k- A3 p5 g. n+ Y/ w* a   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 M+ m6 p& d! }0 I
     ;will break 3 times :-(/ C  y) E) @" N5 G
* |8 \. e# G/ S( u  `: p- z2 t
-or (a bit) faster:
: P% F- \3 @( S  z( y/ M4 [* g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')5 o( t6 N  |6 b) q! `# H9 N% G
7 T% P6 e9 t% S1 N/ Z* F
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 R) k0 G6 |1 v' y
     ;will break 3 times :-(
$ z4 A5 d! k5 z  O
' M, B- ]" j( N* I; ~$ @-Much faster:
2 `, ^7 ]- G) X9 ?( P- p1 V: p7 {   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& _$ d& m- R. k' d

$ A: z- J9 q# A! ]5 Z% j0 ]( xNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
- _( H  K5 |" \1 K1 U# s/ @1 jfunction to do the same job:9 N+ O7 [& T; e! f

0 z! v6 d( p6 d- q   push    00                        ; OF_READ
- G& d7 v. c4 x$ W   mov     eax,[00656634]            ; '\\.\SICE',0& `0 D: U( r1 V+ w
   push    eax- J+ z5 n# R" x8 a6 v) R
   call    KERNEL32!_lopen1 o# j% J6 a  ]2 R9 i, H0 f9 Q$ X
   inc     eax
6 A6 k" S6 Y+ x   jnz     00650589                  ; detected/ c5 X9 C; h6 x* @: F: c7 ^& G
   push    00                        ; OF_READ( g& Z, [$ D4 |: _4 R! x# S
   mov     eax,[00656638]            ; '\\.\SICE'- }7 \9 O. C) t' A# W# S+ z& b
   push    eax6 E3 }* i: ~8 N# `
   call    KERNEL32!_lopen# {0 u4 N6 S- C. G  Y
   inc     eax
% W9 @0 m6 }/ K5 M   jz      006505ae                  ; not detected
: v* M9 Y. w2 \4 L1 T& D
+ @7 J1 ~$ n& t' h" a" o  Z/ p# c2 _6 Y
__________________________________________________________________________5 g- ~2 K& H% S! m( _2 k, M

' O. J  O/ b3 I: p( F. ^- e* sMethod 12
: p6 {: I$ x4 Y: {$ J=========
1 R4 V4 o" f, U1 `7 W6 n( V6 n6 W
" g& P% f7 B) GThis trick is similar to int41h/4fh Debugger installation check (code 05; ^' L8 T0 `( \3 p, j
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 x6 K9 C! U8 A- ]as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
% j4 [: I: z# {$ U5 k7 k8 r! S
7 t) W' R( ^7 t4 M. }. O' x# w   push  0000004fh         ; function 4fh4 a6 w5 d8 S# l0 k, O/ R- [
   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 `/ h9 P" \, _  \                           ; low word specifies which service
! F% U" H/ g( f- Y6 I9 _                             (VWIN32_Int41Dispatch)
) {# p& c- F2 E" \. |1 `   call  Kernel32!ORD_001  ; VxdCall
% C3 s- q8 j1 V# L6 E% B; I) r   cmp   ax, 0f386h        ; magic number returned by system debuggers" u- O4 d' l- H' a0 T' U
   jz    SoftICE_detected4 @0 I. H5 q5 \3 L: S- I3 E

3 ?2 o$ g, K$ f, X/ C) l# @! nHere again, several ways to detect it:
( B/ C. g8 O: e4 o/ ?8 A' H! D# @/ \, l  l
    BPINT 41 if ax==4f
8 P4 `6 U/ A* A+ a3 A9 k# C6 l0 f! ~: w6 I2 X
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' G3 n5 R) E: }- F% a. c9 R, a! N# B! }# q. e) p8 `; h7 l
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* @, j8 n% B! O  K" `7 d7 e6 b# N! l. F/ y4 X1 m
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
, |0 m7 m' Q$ P* y
8 p- s6 n! ^9 Q/ D__________________________________________________________________________$ z3 j& d* F  i7 {! N0 p- D

. ^- d& c! _6 r" k! k0 xMethod 13
6 S2 `5 }( }1 \0 Y=========
! A- I8 a* T1 p! k3 G! T
6 @, w+ c& A8 ?9 cNot a real method of detection, but a good way to know if SoftICE is
6 O  x# q0 u9 j) m8 [installed on a computer and to locate its installation directory.& t6 i3 {4 m. o1 a2 U' p9 @3 {
It is used by few softs which access the following registry keys (usually #2) :
, a7 D6 H6 w" K$ C/ x# h# S2 y
$ `, d% D9 O* N& m-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; @& l) j4 R4 N$ Z+ D+ V
\Uninstall\SoftICE
. o% w1 Y( n8 X" U-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
; a" E5 ~, ^! M  C% A. U2 S8 ~' F/ r-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 v) k1 E$ O4 L! F3 E% A4 }2 _
\App Paths\Loader32.Exe0 {2 T1 a9 K# V3 `' I1 N
/ f0 Z2 A1 y/ x* h
8 I& e% o: t8 q
Note that some nasty apps could then erase all files from SoftICE directory- [! u  |4 i4 f4 Q" U9 K1 o
(I faced that once :-(
. e3 @9 U6 d6 g
$ y, s! z) |* [: w" {" L3 o* X3 p& g$ sUseful breakpoint to detect it:
9 w* ~  P: ]. j3 D3 S1 T( f2 i5 f% U* b4 E; v
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& m$ H: ]& ^( T) Z- Y- c; i; f' V

/ S5 G2 L! F2 V% o1 _. U__________________________________________________________________________6 W8 u2 l# P/ ~$ t7 c( `; d# `9 d
/ a/ W/ m* {' L2 s9 k9 d

; P6 `$ r2 D* b5 {$ S2 l7 g2 PMethod 14
# r9 U4 K& ~3 k6 }0 J=========9 H  e0 ?0 K9 k, }- O4 c  D
7 H4 Z. j8 j5 X! M* z- ^! e2 M6 A
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 Y' m) J6 I7 Y( r" lis to determines whether a debugger is running on your system (ring0 only).3 Q3 \& X+ f1 ~  p1 ?; Y
9 o6 E+ C5 w* A; Y8 T% ~! }5 G2 n9 y
   VMMCall Test_Debug_Installed6 b5 T; x" u& ?5 N9 }
   je      not_installed' w9 }1 f  ~$ w5 D; ?' Z! b9 l* B

  V( ]" n( u" U1 X' MThis service just checks a flag.
, ~& P. H; }" P5 y2 i, r% m</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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