About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
6 L' O6 t8 }0 ~* i# s<TBODY>' C. z7 q: t; g) G- U
<TR># T4 p* O" S6 I" e' x. I0 S- I/ H
<TD><PRE>Method 01 $ G  j, M1 J1 r! c$ y7 R+ e) ]8 V
=========' F% h3 o" l4 `6 y

# A% r$ W5 c3 A+ ~/ n7 {2 pThis method of detection of SoftICE (as well as the following one) is/ {1 d, o. S  e. }2 P( }
used by the majority of packers/encryptors found on Internet.
! e/ D. ~( A. {3 D% mIt seeks the signature of BoundsChecker in SoftICE
: {4 i4 ^& L8 m5 U2 X+ Z& q' n2 h7 {
    mov     ebp, 04243484Bh        ; 'BCHK') }3 f6 ?& h3 ~: n+ L- X: N' F
    mov     ax, 04h
* g0 ?, q  J6 Y9 N0 g/ C    int     3       8 R8 h3 g1 d( c
    cmp     al,4
/ `( {! S( n: {    jnz     SoftICE_Detected
8 Y1 ?( V0 D" p- `, o9 \0 K. [
8 E4 D! |0 e8 u# L: n___________________________________________________________________________
) V" @+ B0 x" h  ^, p. C+ |' K  S( o- C: V; _8 D" T
Method 02" P/ x! X" ?7 D: G2 x7 t
=========
8 ?$ p: u, B+ v" D" W, ]& I8 |3 G5 \' R# J( r) e* O$ `5 m
Still a method very much used (perhaps the most frequent one).  It is used
+ D$ R5 C, w5 Fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 K$ ]/ _4 I$ U
or execute SoftICE commands...
) r6 Z2 T6 I: ^3 n# e" U* _8 L& o$ u! rIt is also used to crash SoftICE and to force it to execute any commands
4 x' X9 |# ?, d- D0 {- h1 q# ](HBOOT...) :-((  ) e7 I" t% O% ^
* e) f1 D0 x( ^0 G8 s
Here is a quick description:
6 _% C3 s1 {2 p, J-AX = 0910h   (Display string in SIce windows)
3 a0 G- a5 ~0 Z+ D& ^-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' S4 }0 i# h5 Q+ s6 p* y
-AX = 0912h   (Get breakpoint infos)
! a, p* f" B) z) K0 j5 F% v4 ?" @$ F-AX = 0913h   (Set Sice breakpoints)0 x. \( G9 B  x' C
-AX = 0914h   (Remove SIce breakoints)
. ]1 r1 e( |7 Q/ L+ F9 o4 N6 F$ \1 k
Each time you'll meet this trick, you'll see:
. L6 \$ q/ `* Q9 b-SI = 4647h" h0 `- g% g1 |; l: I6 k/ v
-DI = 4A4Dh
" l3 u) ~) t  D" f% R& J* uWhich are the 'magic values' used by SoftIce.
4 K, D, V. s2 ?- K4 WFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 {) v$ E! j. o# ~7 h$ Q( s1 r7 M  Q' U2 y  w
Here is one example from the file "Haspinst.exe" which is the dongle HASP
' b: j! L# }+ j# T: VEnvelope utility use to protect DOS applications:
( ^1 o& W+ o% E! S' h3 l) G
" ^0 k8 b8 M8 t& ~2 M( H- ~, r5 }2 R3 H% X$ N6 t$ W" y* N- ^
4C19:0095   MOV    AX,0911  ; execute command.
2 {. w" ~( o+ ]! T7 S. F4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 S# B9 B( i, \4C19:009A   MOV    SI,4647  ; 1st magic value.
* x# ^8 E4 Q2 W4 C0 p- Z& }4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 h$ u7 t) M% k% N1 x4 l2 N) H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 `6 Y+ z7 a+ |# o( j. ^+ w& v4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
( w' j+ B- F2 w, y9 T& @4C19:00A4   INC    CX
) Y5 b6 \, s( k4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 ^7 O0 n3 Y3 ^1 N0 [  w, O
4C19:00A8   JB     0095     ; 6 different commands.
, e+ `/ @" A% e3 a4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# U7 n- `! Y3 t  z1 S3 a, P
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 k+ H4 j0 W; ~0 H) ]: t: y; }7 ^: U# x6 R3 ~- @
The program will execute 6 different SIce commands located at ds:dx, which
: D! g6 L0 V$ {; ?: Uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, ?' |9 Y2 `! H9 u2 y  Z
2 {- P9 O- w1 G" r3 u" N* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* i2 y, Q6 ^0 Q. v3 z- j$ W
___________________________________________________________________________) B- B& U/ T- O* v4 g8 Q, P. x
# t  \  W% j  e" T

* p2 Y* b1 H" i" W* X/ ~Method 03
% I3 _! i" ~# Z5 U=========! O! M8 k0 Y' |6 \0 r
# v( e. m* z6 A: b! m
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) |7 v8 _% ?: v
(API Get entry point)
. H# x( s& ^1 ?0 y        
& W& k, ?0 i* f% e5 [/ i
) p! y" A2 Q# D& p. V- f5 y( x    xor     di,di
% r- R0 K  J& P* d9 d8 B/ k    mov     es,di
8 R" [4 v% J: Z& c' U    mov     ax, 1684h      
9 {+ j% D4 N& `( ^. S/ n2 y$ V    mov     bx, 0202h       ; VxD ID of winice" X( t8 S! B, g8 h- L" z
    int     2Fh. a. i) ?1 c. \- E* T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" U5 d3 [* A8 n  n& A    add     ax, di# u$ d9 J- |# t- Y
    test    ax,ax
+ l  x2 O2 b. _% `$ |3 g4 u    jnz     SoftICE_Detected
9 Q8 C! p" q8 o0 i+ B5 C% d3 }9 R( Y1 w; v1 t3 T0 @- Q
___________________________________________________________________________
+ r3 e; }0 a4 l! d) ?" _2 ^, b& a, `  ?3 m) c& m
Method 04
; P9 h# c' X+ r; U$ O=========
8 m0 Y+ ^3 |' M1 }9 g2 H. ^( w) J( C! ?: [& \" A$ e6 [
Method identical to the preceding one except that it seeks the ID of SoftICE
/ q% P: e/ ]5 s, }- E0 ~GFX VxD.) ^% n& E+ p" m6 Y( c$ Y
, O3 b' y: }6 C* [* [. `0 ^* i
    xor     di,di1 r6 _/ k" q4 d
    mov     es,di
2 D" y. ?! S& T7 f    mov     ax, 1684h       ( c; F5 e9 f# h' H; t& W8 j( Q
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 B8 W( s0 T" O, O4 N$ [1 y( x& A    int     2fh
( A! A. ?9 u. T5 Q/ S+ n    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 w, R; e" d% [4 a0 g* @8 ~# j    add     ax, di
2 {( I. _+ [, G8 r+ y3 q& `7 a    test    ax,ax- f- G/ a* A0 @8 G' Q
    jnz     SoftICE_Detected: [! S5 `  E) ~0 K" i1 F( m4 L5 l

" ?0 G5 V1 p: K2 ___________________________________________________________________________
+ t/ L+ s' w5 ?. I4 O8 C
4 d  ^6 m, K. q9 U( J/ r
( _6 p* a( W' u3 R  }Method 05
) A( o9 q  q' s4 }=========: R- V3 p: e  A: n& u  J) k1 o
6 U/ i" l/ k+ P  r5 B
Method seeking the 'magic number' 0F386h returned (in ax) by all system' Y; B) K2 Y( j3 l8 v. L4 P) S
debugger. It calls the int 41h, function 4Fh.& j, ^/ A) D6 _( w, J
There are several alternatives.  
9 u, X1 y1 A& i4 D2 K* A/ u8 F" ?: t' n" n9 y
The following one is the simplest:5 o( ^8 Y  e9 s( S0 y' t! [
+ s2 d$ d+ j: T) _
    mov     ax,4fh$ {9 P1 Z. z% J$ [0 O7 u
    int     41h
- E' I" r) \( l) [9 Q! P; j    cmp     ax, 0F386
& ~1 E% w8 l/ X. d7 t4 R    jz      SoftICE_detected; b# }4 r0 R. P/ X5 f. A! }: ^

* g1 z' p9 o6 A4 k* V7 W
! I4 T* Z: |- QNext method as well as the following one are 2 examples from Stone's   H& C; A  t. @1 h' L6 b
"stn-wid.zip" (www.cracking.net):6 t+ v/ @3 d& u( c3 f) M( u. h; J* v8 n

3 O8 L+ E) w* D- d. x8 x    mov     bx, cs. d8 ?: T4 S0 G" w; Q
    lea     dx, int41handler2
5 n- O1 @: C$ @( i3 x% f    xchg    dx, es:[41h*4]$ ~: ^$ g) {/ F2 w5 J
    xchg    bx, es:[41h*4+2]
# X  F, [* Q% @) |    mov     ax,4fh9 `* ?$ g# L; u* l7 L1 T) z4 _" N
    int     41h
3 d. D2 H+ S/ E3 B# }    xchg    dx, es:[41h*4]- X- u2 s3 j0 g. v9 N4 _' l' K. H
    xchg    bx, es:[41h*4+2]9 _/ w( r! d5 S- S8 [6 Q+ @
    cmp     ax, 0f386h
$ t/ F: J; p5 U; j: B7 [    jz      SoftICE_detected
# x6 j. _: O0 u# W2 S4 c! _1 _! X/ ~# ~1 s: N: t( z
int41handler2 PROC
; w- y( S- g+ i- U* Y+ G    iret
5 b4 A, c2 \. F' ?int41handler2 ENDP
5 }5 K) W# ^# T
( |. Z' _) t$ F2 {, |# E1 H! f4 s# X6 v$ @  ^
_________________________________________________________________________
" f2 k$ L; v' r. m9 u( R+ J2 ^
1 T- }1 b! t8 O# O
8 Q3 A- e- S  \& z0 s% D$ A; z/ vMethod 06  O" e+ T6 L% H" a) J0 X
=========# L, k6 T  h% R
/ t6 Z2 A4 o1 t1 U
3 T! I% a  T5 t/ H0 \4 Y
2nd method similar to the preceding one but more difficult to detect:- O$ U- A* r3 e% b! U4 b

/ g3 F, j' o% a. t1 I! G5 Z( v
) ]5 u4 y4 p, _! r% Mint41handler PROC: V3 p/ V( [6 q! K, U
    mov     cl,al, F4 M4 D* `! }- E5 w, z) @
    iret
, J: R# ?& t, n. N5 w3 v5 P' ]int41handler ENDP/ w3 e/ M& W* g* [9 C
/ y0 l( R1 r0 J. L5 z

2 \! h2 F' ]$ b) E# W    xor     ax,ax2 M& D+ M6 t& X& n7 D3 J
    mov     es,ax
1 c% a- M+ L) ?- O7 Z  z    mov     bx, cs% s' S6 E- u% N
    lea     dx, int41handler2 d/ e) ]8 J  R! y
    xchg    dx, es:[41h*4]
6 I* s) q8 j4 c2 f    xchg    bx, es:[41h*4+2]
+ o$ I: |& x# T, D    in      al, 40h0 W4 ?! c! Z7 e+ k; V! W9 l
    xor     cx,cx
# @" C9 d# A: L, O9 f# D: ?    int     41h
' g( ]" ]- G% s- n) v7 v    xchg    dx, es:[41h*4]
6 C4 H4 s* e- G8 _    xchg    bx, es:[41h*4+2]- y% g! A% R6 |: n
    cmp     cl,al
$ ]6 O: A. x5 l9 J8 G) R' v    jnz     SoftICE_detected4 m  c- M# d' r8 M5 ?" h4 ~$ B$ |4 d" ]

* G  Y5 h7 @' l  V7 q0 ~/ M_________________________________________________________________________9 V8 D8 B7 p5 q8 B# m9 ~

/ r2 Y' \% q( R! {+ g  o( [4 WMethod 07* j. z) h4 ?) w  {' c0 j1 X$ o$ K  `
=========1 Q2 A# ?/ g2 w' }3 f
% o: i7 G$ S, V  \4 k2 Y0 T* W
Method of detection of the WinICE handler in the int68h (V86)4 Z' w5 ~6 e/ u/ L, g4 |; B
$ i( ?9 C, {2 h( E- Z
    mov     ah,43h
7 ~8 M. \9 s  i    int     68h/ A$ I2 c, ?6 n2 @3 @" D
    cmp     ax,0F386h
+ _# N2 v& N; D% w    jz      SoftICE_Detected
$ B. `- H+ l; I7 h, o% s) H
8 Q2 y* X8 y" U4 o5 i7 _; {$ H) A% `* m! n% i8 z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
% d3 {) @7 }' t9 U7 [   app like this:
, y' b  U! M& }4 A" A
: y3 N8 m# G7 J) |/ @! N   BPX exec_int if ax==68
2 V+ ~, h8 U: W. }+ I5 ?' r   (function called is located at byte ptr [ebp+1Dh] and client eip is
# q! ~: d' T( U   located at [ebp+48h] for 32Bit apps)
% e$ w; g" O4 j; {2 a! }/ T__________________________________________________________________________
4 L: t; d0 G( J4 r8 o5 E5 e$ d; Z
% R* T1 A& C( f/ \+ z+ ~" {0 ^3 b3 A$ b, W4 M
Method 08( D# O4 y! @! X- k, H3 t  V% t; V
=========
! x; l; O9 s" s! X) p' Q3 D/ C) s0 r* {0 ^( f9 D, ^: I
It is not a method of detection of SoftICE but a possibility to crash the
* Z/ z) N4 l0 vsystem by intercepting int 01h and int 03h and redirecting them to another
2 r) U, a8 ], I; |- Z) j9 I, f. proutine.* {( @. `/ q% }
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ l4 R$ R# p# s
to the new routine to execute (hangs computer...)
. w- }+ W5 R9 ]! r1 T1 K$ }: z( B# z" G2 H: @& G* H
    mov     ah, 25h
$ M, |: P6 Z8 _; ~+ G    mov     al, Int_Number (01h or 03h)( n5 c; W+ \; c" z" O6 v& Z
    mov     dx, offset New_Int_Routine+ Q5 I. M  V: p3 T% f: s
    int     21h# L9 c" j, X4 {& F6 {' c2 j
' o! [  i# {5 X$ G  f
__________________________________________________________________________
: a* I8 q% I' h1 ~+ [0 Z4 s5 u2 d5 I) \8 x4 n" A5 }$ \: R
Method 09# a1 T" i4 U) t
=========" i- _( d/ s6 f4 I
9 i& H. Z) k( T
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ c/ v- P/ a# N' u# a7 z2 X
performed in ring0 (VxD or a ring3 app using the VxdCall).0 e# S8 T. P  f' R2 @  p6 P3 b! m9 p
The Get_DDB service is used to determine whether or not a VxD is installed
) d  L) X* n4 o8 t* dfor the specified device and returns a Device Description Block (in ecx) for" R. U2 v0 V* g
that device if it is installed.
  d) m, v5 y1 |" p% T' d
% T0 b4 U* ^) n7 ~# @% j   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 O9 m/ f& c2 @
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 R" n( ?' x- h4 L8 [
   VMMCall Get_DDB7 I2 M9 r+ ^& a1 E/ u; w& a
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 L* M+ H5 n: O1 C4 R
- d& l$ N! f3 o( \# o
Note as well that you can easily detect this method with SoftICE:+ X: u$ I9 u6 |8 T, C
   bpx Get_DDB if ax==0202 || ax==7a5fh
; N0 g+ \9 Q' U% K' g( t8 S( B2 s; T: S; b) j! T: U
__________________________________________________________________________9 ]0 h. o+ [5 \$ V" n6 |

  W) t, S5 _; pMethod 10
5 D5 y) v! e. x: v=========) i! r0 B% e! j
1 K6 ~# P: V8 l1 E
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 k* r' g* }7 A% j  o7 }  SoftICE while the option is enable!!
* z# B" U: C; u) [( O" y1 J
3 D1 r* {0 ]  X) c1 R( w6 k1 IThis trick is very efficient:% \' Y; F2 ?3 y+ a2 C# _
by checking the Debug Registers, you can detect if SoftICE is loaded
" j6 m' ^6 C, e, d- N(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, A2 G. V5 _! O# K" b) N  Uthere are some memory breakpoints set (dr0 to dr3) simply by reading their8 z0 _, S) e7 X( E0 Y) `3 H! o: S' \3 ^
value (in ring0 only). Values can be manipulated and or changed as well% _9 D( T' |. O3 C5 H
(clearing BPMs for instance)
/ T8 P4 H- h5 I* a) c" D
) @8 R1 ?" R9 q% J; \__________________________________________________________________________
0 w6 n: l( P5 q5 C4 M- Y" F4 |* M( h. A6 Y  i/ r$ v
Method 11
- X: a9 M( p1 ]3 ]=========. F1 z0 ~' M4 R- R

% D5 S% u% _  v- xThis method is most known as 'MeltICE' because it has been freely distributed" I! u% t* f4 b$ [
via www.winfiles.com. However it was first used by NuMega people to allow. C- F! g! M9 a9 k' N8 w: _2 T
Symbol Loader to check if SoftICE was active or not (the code is located; ?) r4 [& U4 ]/ Z
inside nmtrans.dll).' l- T4 N( l( `% N5 f' U

2 f6 {) l8 F' h2 K  Y& BThe way it works is very simple:6 _  O4 m9 b/ B4 h
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& E: u. w) M' a7 p$ oWinNT) with the CreateFileA API.
1 i9 R0 V  W+ w6 Q0 E( _3 M. R' Q
Here is a sample (checking for 'SICE'):
2 U8 }) e8 C# Y+ m6 n" b% ~7 y/ e: P/ m* C; i- s
BOOL IsSoftIce95Loaded()8 c, ~& S. d! s4 W9 T" G! q
{
0 U2 q( W) ?+ V9 Z: h# _   HANDLE hFile;  ; s. X8 ~+ e+ V# B. y$ a/ Q; D+ E
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# l, O3 N/ ^) [                      FILE_SHARE_READ | FILE_SHARE_WRITE,
2 L6 {- @. k" c0 J( D- n. i                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 o. E: x# \+ D. `8 S0 w# o   if( hFile != INVALID_HANDLE_VALUE )
# O2 I0 S5 a& g8 u/ Z! Q! \. ^/ R" u: E   {# C' K: h2 @9 w# o! o( Y9 ]* t) Y" J
      CloseHandle(hFile);# F8 G2 @5 y! K: b* X6 K/ H% r
      return TRUE;
+ A, x- Y7 h% `3 ^$ G; k   }
! A. W' {8 H/ o, J6 s" k   return FALSE;- V% M( @, Q) m3 ?
}
7 z5 W( b: {4 m
6 I! E5 V  w  {  [- o- A8 U2 ZAlthough this trick calls the CreateFileA function, don't even expect to be
7 l/ E$ `# _9 s( m# E1 nable to intercept it by installing a IFS hook: it will not work, no way!
. N& m, I% s/ e% n& A" ]6 c. OIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
# _  l) d9 u# v5 Wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 E2 }: b4 g3 y- V) f
and then browse the DDB list until it find the VxD and its DDB_Control_Proc  w6 @- |: @9 o0 }; T
field.
: F$ Q( V" j0 N( Q5 _9 j( eIn fact, its purpose is not to load/unload VxDs but only to send a 4 K5 D- I2 S: J! d. H, I3 k
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 @0 u) X0 x5 |! ~+ P. T- c
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) C; Y* d: E! {to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ M& ?+ u% Z  V! V3 t) d* ^If the VxD is loaded, it will always clear eax and the Carry flag to allow
. g! `3 T6 P. f5 A( d1 G9 Qits handle to be opened and then, will be detected.
  l" n! C0 V. E; R. KYou can check that simply by hooking Winice.exe control proc entry point
6 L: z! ^( i# [) p% r3 v: q+ S% p- G. Rwhile running MeltICE.& q! M/ X3 ]) w0 \

/ ]- K7 N4 |5 K
2 d4 y. L0 w4 i, f9 k: M. }  00401067:  push      00402025    ; \\.\SICE
- ?! B' N& F' _9 j- u  0040106C:  call      CreateFileA0 z: X& D) ]6 j0 ]4 w
  00401071:  cmp       eax,-001, @$ M' j8 n, a$ G0 g# |
  00401074:  je        00401091
1 k4 _: P/ Q1 R* ~9 P, T9 {* q6 u# x: m

' j3 a& B% H+ d9 ?" O# |There could be hundreds of BPX you could use to detect this trick.) S5 M3 U2 W( x; t; `/ n: w
-The most classical one is:. S$ R/ @5 k$ T3 c0 W+ Z7 \) R
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% d! L' \: P7 E  @& A  I    *(esp-&gt;4+4)=='NTIC'! j  d3 U- y! C
1 R" ]6 [8 i; k, x0 S; h) z9 B' t; Z
-The most exotic ones (could be very slooooow :-(- r' e7 E& J; |) ]
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 T" ~6 E- K; h! H     ;will break 3 times :-(5 i/ ]" [/ I6 z, J) ]" v9 }7 _

4 p. ?3 A7 d$ |: `+ x-or (a bit) faster: & Q, T9 h0 V' |! w  h# f7 k$ D5 G
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')5 Z% q7 D* D' Q
! ^' ^" r$ f8 w4 x; Z( P. L# x
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : V! u: V7 \# F8 G& j0 o, I
     ;will break 3 times :-(
$ S- D0 q! B  `( w* t/ |0 C, n9 `1 y$ e. G& x
-Much faster:, `: i9 Q3 B' N: ~3 l" @7 Z
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' j" s- l2 }0 C. g" Y& f: e5 D; C
) J( E- r: I! D. f- L9 @0 t. L; S6 RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
% S' n7 ~% Y" X! Tfunction to do the same job:! T# [  e) Q% n# a, A4 I# P

; y' B& u1 o2 c/ c! p( D   push    00                        ; OF_READ# H3 |7 o, ^" x
   mov     eax,[00656634]            ; '\\.\SICE',0+ y+ d& u% S5 O2 Y7 \* q/ c3 A
   push    eax
: }1 k5 \8 j/ P9 o   call    KERNEL32!_lopen& J3 P, y" P' w8 J4 W$ Y
   inc     eax( L$ ~/ `8 x; C! Y: D" H
   jnz     00650589                  ; detected
4 O+ M  _5 h: @4 n6 X& B6 F   push    00                        ; OF_READ
+ x5 Y2 g8 a4 a; V" Y   mov     eax,[00656638]            ; '\\.\SICE'7 z( j/ Y& C7 _; P6 N7 b- _+ K$ [
   push    eax
& C- v. K5 R! l# l+ l) g5 w   call    KERNEL32!_lopen
+ _6 B- K1 E' l9 m9 _8 J   inc     eax
+ g& Y. I3 G( @$ Z% C   jz      006505ae                  ; not detected3 L1 Z% p2 F0 G: ^2 d: W* y3 j/ c

& e5 l, R$ l/ C( k3 Z& O9 t) O: D- c
__________________________________________________________________________, y) w$ i6 h+ ?- w2 t( W
( `% ~; F* e# i" [# E6 t! c3 O
Method 12
5 s9 ~/ z- ]' {' f, R=========
4 D+ H# D% S6 [4 f5 d
' ~6 b4 l6 J" E; lThis trick is similar to int41h/4fh Debugger installation check (code 05
) Q4 e, P1 g' W6 F&amp; 06) but very limited because it's only available for Win95/98 (not NT): v  C3 @5 c, d% ]3 E: L
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 j  L! S  h8 f" B% l+ F5 }
4 V5 ?" f! R3 L/ {; k% `5 t   push  0000004fh         ; function 4fh
! ?$ l  L! F0 q! K   push  002a002ah         ; high word specifies which VxD (VWIN32)% y4 M! y; y4 q4 o4 W+ f
                           ; low word specifies which service' v0 j4 h5 \' K* s9 C
                             (VWIN32_Int41Dispatch)( t- W& h1 j! g+ `
   call  Kernel32!ORD_001  ; VxdCall8 x6 h' m% G9 i7 n; O  i1 R
   cmp   ax, 0f386h        ; magic number returned by system debuggers
' n- {' r7 O( F8 b& t$ x   jz    SoftICE_detected+ w3 o2 T/ V/ x; k6 I' L* @* F

! t2 Z- F0 i4 ~, s/ NHere again, several ways to detect it:
# k/ a- b7 h9 O* ^$ |/ b0 l) A; {" C3 [, ~  D
    BPINT 41 if ax==4f
/ t$ o  a  M* k9 e* B6 ?8 q  I( t; u# c' `/ D' K* V
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 B6 R/ q  D3 {: B
! Y' ~0 b9 U4 i  A3 Q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( q# g$ Z( B) T% i9 _& M
$ p5 [, Z" C/ x& ?4 Y; k
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. x4 _. L) O3 F6 r" @
; Y3 C6 v- }# D' k
__________________________________________________________________________8 G, j" s; v  q5 j8 V$ H3 c
3 X% Z# h* U& `  U: f0 {. ~
Method 13
- L' b* `# l1 |) @) M. H5 Y=========. v; ~3 L$ H/ Y, |0 m9 t
4 {) Y0 H6 V4 ~* s5 F: {$ [
Not a real method of detection, but a good way to know if SoftICE is
8 i+ z, P: I# y. `( M) i. g& Ginstalled on a computer and to locate its installation directory.
2 ^% c+ P2 b8 x- p# h3 S1 F0 }4 A& G. LIt is used by few softs which access the following registry keys (usually #2) :  C# g4 H  r0 I7 u& E

% z- M/ W! ]0 r. X' b) P! G-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  `5 C  {* g3 y4 P) ], o2 z\Uninstall\SoftICE* |+ w2 {+ G& F" P0 W$ K; u+ ^
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, k9 ?, n0 {4 v, o-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( A: r8 W. W  D9 S1 Q\App Paths\Loader32.Exe0 Y7 F: p- [; D! ?2 w) h" D/ w, `
- M. d, v# q. p% [# c3 X# R$ k. {1 T

4 G0 V8 `) G# u  [( Y# QNote that some nasty apps could then erase all files from SoftICE directory, P. f$ s& e7 D2 T0 Z6 p" n
(I faced that once :-(
, u  h! w% @5 m8 V3 ]3 v! f
  ?4 G$ ]. H$ v+ \- Z3 y) l0 OUseful breakpoint to detect it:
% ]+ s% v% T6 r# u& a3 {
1 r) A) d1 R" Q$ X     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'1 c5 V& I' x6 j- c6 H8 m4 i

3 f& a6 }# z( E4 c8 r7 Q8 s__________________________________________________________________________
; u. c1 ]; x) @  u1 }: C4 W/ e& o, H( u9 h0 S
( l( L7 O% _2 @7 ?
Method 14
3 a, ]' ^1 d5 f=========' ~, v. Q/ q5 i# E6 |

; |/ I' D8 f- O/ @& EA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) y- S! {8 P5 {) ~& c$ cis to determines whether a debugger is running on your system (ring0 only).
" l- a- s6 b. c. ]) V
" [- X5 a5 e* w( t" @5 {5 Q5 X   VMMCall Test_Debug_Installed- f2 n  D" v- t' [4 P, a# a
   je      not_installed4 F2 g- @3 ]0 E

5 K+ @/ w( W9 ?1 ^. G5 PThis service just checks a flag." h/ Y6 \1 |( c" E- D
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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