About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  e; U+ O  v1 H! B( Q  U* k<TBODY>
; f% k- [+ a0 |; K- _6 B: y<TR>7 v( A+ @  T9 o
<TD><PRE>Method 01 : k  J9 F: R4 L
=========# Z1 q# d9 {  Y3 l* H

: Z! ?- d2 F( a; Q! d( T5 oThis method of detection of SoftICE (as well as the following one) is
1 v' F) u' l! C& H9 i0 N) tused by the majority of packers/encryptors found on Internet.
  T. x( j+ x) q% ]% y' EIt seeks the signature of BoundsChecker in SoftICE
4 d; x- L6 @) E$ q3 b( ~
: y& I+ t4 a3 G2 t+ I    mov     ebp, 04243484Bh        ; 'BCHK'
' h, s& d1 {  S. w9 I' A! J1 a    mov     ax, 04h$ I- m1 w2 H* G5 I
    int     3      
: M. K6 h6 Z" ^1 e$ P    cmp     al,4; r" Z" q" K# g  Y2 N: h, A6 S
    jnz     SoftICE_Detected' m( q5 L! `* C

7 }) f. t1 v! O& S8 F___________________________________________________________________________
* I6 O2 A' }6 `1 B  _% ?! h6 S, [$ p2 E1 r/ b$ ?
Method 02" n1 w  f) m. T, r- }! m
=========/ r6 |; ?6 s7 K$ @  ]8 E  v1 |( G- m
5 z  }/ s" B% W' n( n5 u& U2 W
Still a method very much used (perhaps the most frequent one).  It is used: l9 [: J1 p: ]% H5 b, k. p8 p( e
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
' I7 E6 X' {2 l( w9 X) A( i4 jor execute SoftICE commands...
6 @9 i( A/ x. oIt is also used to crash SoftICE and to force it to execute any commands+ |& |; u# w0 q. J, {9 r2 s
(HBOOT...) :-((  
0 N) A% Z- c. n6 z: R  [
6 x0 J$ x/ z# A. s. |: f2 X; S2 hHere is a quick description:% e4 z9 q' k$ \
-AX = 0910h   (Display string in SIce windows)
! s/ q- D: Y' s; |# f0 ^-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! b! _3 F- ]* K& a  |9 O-AX = 0912h   (Get breakpoint infos)2 B) a- }* y5 V1 ~) `
-AX = 0913h   (Set Sice breakpoints)
+ F6 E* o2 ^4 ]- m- \7 R7 L-AX = 0914h   (Remove SIce breakoints), d- N4 f4 \+ I7 x% K' Y( a( b) U; y
$ I$ V  i) U8 E- x
Each time you'll meet this trick, you'll see:" i7 a% ?1 E9 h0 Z
-SI = 4647h
$ Y. z4 [) W) O- z! S-DI = 4A4Dh
+ f1 R! _6 @$ o- r+ UWhich are the 'magic values' used by SoftIce.
9 X* |8 |$ k/ c& n7 G. WFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, C$ t, M! L- [- @) K
7 ?! k% O! B2 l! u% Q9 k! \Here is one example from the file "Haspinst.exe" which is the dongle HASP
# R* ~& u& e& v) pEnvelope utility use to protect DOS applications:
: L' \$ R' s( h  B( B) R  W, Z- \- b  q) a9 k& ~
% @+ ?# }% R/ |# o! t
4C19:0095   MOV    AX,0911  ; execute command.( d# ^3 c5 h/ D$ x9 j' q8 k
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* y0 C- M. ]( _* ^4 C2 V, U
4C19:009A   MOV    SI,4647  ; 1st magic value.
# L+ m: P4 s% _* G1 @( \' i( T4C19:009D   MOV    DI,4A4D  ; 2nd magic value.# j2 f! z, R' A/ U; u( H2 R4 w6 F
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# d4 V' L8 j7 [$ \8 z
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& V2 K* R  e0 _. _: r" T* X4C19:00A4   INC    CX
5 f, h/ W' h, d% }8 Q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# B- I5 ^& @4 h/ }
4C19:00A8   JB     0095     ; 6 different commands.0 c' C, F+ l% Y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% O' P3 X/ e5 y& @+ x, z4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, l4 l7 E" T( ~* s0 w$ \; ~
5 A- }3 A. i& X0 L5 s1 m3 hThe program will execute 6 different SIce commands located at ds:dx, which
2 u- m. T0 x2 N1 `2 [# Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 r% m: V9 g6 ~4 b* W) p6 D$ B0 D
& y) f0 I# i3 {" F- Q) L$ C# x
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ ~# {& H; L. x  A% e. ~" I+ b___________________________________________________________________________
7 c2 `: P8 t# r6 t7 p2 M
5 E2 X8 L4 d# D
6 Q; y# t1 a9 k- nMethod 03
9 k0 P3 Y. ~# l& Y, Z=========
5 I2 F2 X+ H, g1 k- a* [: {( q1 \9 H/ t2 }
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: c, ~( q" F  E) H. B" _3 J; E(API Get entry point)! Z6 a# I0 H5 I1 a7 i1 X
        9 I+ h5 K( ]1 {! c% {2 J6 i
: y9 g. u* t! V
    xor     di,di
% G+ ?/ d8 j  E1 J    mov     es,di
" p8 K! {& `$ J0 l    mov     ax, 1684h      
" `7 i7 H# y. i) r1 ~$ {    mov     bx, 0202h       ; VxD ID of winice
% p3 I) D' x' w    int     2Fh
: {+ ^  G! y% ?* T( v) Z/ w    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: P% W' ]6 }. A( c0 J' w# {    add     ax, di9 d3 Y. ~, h$ b: n1 i( M
    test    ax,ax
2 w( ?' B: _9 Y8 v    jnz     SoftICE_Detected
! b; ~# f7 G9 m7 ~3 j6 F' T: s7 ~' a3 C* p3 K2 @. g0 O
___________________________________________________________________________
: h/ l8 l6 v' f* I6 a
7 c& G0 Y: I4 z& m! BMethod 04  q9 b- K  L5 c$ K# q% _4 v
=========0 ^% I& w' ]; \
- c) ?1 _4 A: E4 }8 x
Method identical to the preceding one except that it seeks the ID of SoftICE$ i5 ~" c( P5 O. |7 p9 o
GFX VxD.; R' L$ B! b+ ?$ E* r- ~' b
* x7 M( Y  i+ [
    xor     di,di
" z; Z! j5 \$ T: z    mov     es,di
% q5 `6 e$ ]5 o: j- _3 }% H    mov     ax, 1684h      
3 k& f, G! g1 g7 X4 c' q5 X' h3 m- D    mov     bx, 7a5Fh       ; VxD ID of SIWVID3 N9 D' P; V$ y
    int     2fh0 y6 e' v7 [# c$ _; s* E, B$ h4 c4 r. C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ M- p7 D! T# p0 p1 _. L
    add     ax, di
8 {" @; _5 T6 P: n* ]    test    ax,ax+ n5 Y& a! A7 Y8 R. K- R; h. o
    jnz     SoftICE_Detected
% f. N1 f1 T, `' k+ L
' v& c& t" A; u; M__________________________________________________________________________
: m8 _- ^  |* ~. O5 L. l  k% R) u( @! z

, J% O, b( X. h3 ?1 uMethod 05
1 T7 R. @+ g9 j/ q& _=========
/ A8 {4 j* w6 v3 X: B
5 f7 i; M/ E2 y7 \Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 V+ H/ H7 e/ o# G0 j. C" rdebugger. It calls the int 41h, function 4Fh.! `7 n8 s; l4 Y0 p! @
There are several alternatives.  
0 c( X2 N, R" q" D9 A0 d' H+ y& i6 p$ S2 k, ~% @; o$ m
The following one is the simplest:! Z7 c- |! \0 K5 q' P2 B

- v$ s( C( q% L& @    mov     ax,4fh
% g# f. n9 ?9 X+ u+ D6 }0 j  I+ _    int     41h: G% y4 _8 D! P( j! y
    cmp     ax, 0F386& n. |. w9 k$ W# u' @! C
    jz      SoftICE_detected
4 m6 L, j. U: Z, ~( k" e( }+ s7 t. Y& @' F& ]8 H

* a% p; v  B! vNext method as well as the following one are 2 examples from Stone's ( ~! t3 ^- V# ?0 D( a# L
"stn-wid.zip" (www.cracking.net):
: }& C% P/ G: d% Q! [
. {9 v0 H' H! M: ?& }+ T4 L    mov     bx, cs
& |  \% Z5 S  t0 x$ [9 i. d# B, o% G    lea     dx, int41handler2
2 X9 i, |( {+ B% j" j( i3 R7 ?/ J    xchg    dx, es:[41h*4]
! I6 x) D# }, L, t    xchg    bx, es:[41h*4+2]
) a8 c2 {0 N9 g7 g/ N    mov     ax,4fh6 b8 F# z. C7 Q
    int     41h
9 s. n! F" k- d3 c' |$ j! x2 v    xchg    dx, es:[41h*4]- C2 M/ |& U7 \. ~9 z3 D# G6 O+ {1 q
    xchg    bx, es:[41h*4+2]
% C' d7 P3 J/ k2 ^" y! s  }    cmp     ax, 0f386h
# H7 ~  ^% x9 P/ |/ g% Q    jz      SoftICE_detected& J- [/ ?. ~, Q  a
6 @4 O" ~" d1 A/ `) A1 l& \
int41handler2 PROC
4 J5 h* R, H8 n: T  R" s  l    iret
% X* @! \2 O6 e4 I2 `. Fint41handler2 ENDP
5 K2 [# N# H$ o# j1 E- s( U: ~5 G- s& u

9 V$ U3 x' t, h9 E4 X_________________________________________________________________________
% A4 Z6 `/ T0 n, l+ S, _$ q7 ~# x0 t# K6 i

( a$ M$ i3 T: S0 t& t1 z+ LMethod 06
5 h+ G: @8 t8 W=========
% T( ^4 P! }$ _6 o% j/ R9 i: \" l" T0 {: Q! a
  ]9 P4 i8 x4 L
2nd method similar to the preceding one but more difficult to detect:% H/ l5 c0 M  D
- H) C% x/ T8 I% n
0 T" v2 w/ c+ h0 x
int41handler PROC
9 _2 z# \; ]& v2 s    mov     cl,al
7 B- t3 L+ Y0 P+ J7 X, ], O    iret4 W0 U' @$ Z. c8 D' F
int41handler ENDP
& @5 G. W) n# S. E' X8 m0 Z$ H# d9 z" _0 T! |2 ?6 C- X  r2 H
6 H/ }- E3 d- D$ V
    xor     ax,ax0 n) G: \9 ~. _. k) I0 s3 K2 J: M
    mov     es,ax! K6 n- W2 q3 A; j
    mov     bx, cs
; P* O# p/ l+ P! @    lea     dx, int41handler
0 g  c2 G$ e; x+ M# r2 Z    xchg    dx, es:[41h*4], I6 T5 R  W) A9 _, P) y2 E, {5 |! r1 h) j
    xchg    bx, es:[41h*4+2]! z/ g  C9 z+ Q3 V* I4 N
    in      al, 40h
6 J( n! r0 d8 E    xor     cx,cx
) K7 s& {% V) C( ~+ I    int     41h
4 C6 ~2 T% p: ^: J& o8 P0 O' w3 q    xchg    dx, es:[41h*4]
9 a8 d0 C2 f7 t# \* }0 q    xchg    bx, es:[41h*4+2]
4 S) r, q1 j1 P6 h    cmp     cl,al; U  h, ]6 M& ]- s' [9 B
    jnz     SoftICE_detected/ s; [1 U$ k5 S- Q& ^$ P  I

5 d' x# g$ C6 m% I5 _7 w_________________________________________________________________________5 g- S. k, i6 m; E- M& Z
" Q& Q! ]4 F! ]: Z" b
Method 07% C+ e- E- x4 E1 d7 B2 n* p
=========, v8 U' }: d2 b4 ^8 |7 W8 I9 s
2 g/ ~2 J  x/ `. w; P! X
Method of detection of the WinICE handler in the int68h (V86)3 F6 ~2 o4 d. M! O/ g# e
" F9 L! }% `$ _( ^# E8 c# T+ n
    mov     ah,43h
7 @  e3 Y% Y0 x8 d4 j7 t" W    int     68h
& e" J2 \# S% H7 i  o7 j  {    cmp     ax,0F386h
, y6 B" N$ z) V0 {! a: Y    jz      SoftICE_Detected
' p, _: L: _0 v( t) P( C. R& {' k& G1 Z2 H  f9 x
# i6 J  o- m% X0 t, }7 W7 A; M+ V
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 v" `& W4 J* z. [4 C; B. r   app like this:' S7 v. T! k  N& R6 [5 M, m2 E
8 z: r" w) H0 Q
   BPX exec_int if ax==68
7 r2 e3 y1 V% l2 u3 b5 R   (function called is located at byte ptr [ebp+1Dh] and client eip is
* N5 _/ ]5 R5 U# H  I   located at [ebp+48h] for 32Bit apps)
8 z7 E0 x* K" t: W) [, V__________________________________________________________________________
  ^5 i3 h8 F! i. p# o( |
' n3 ]& S! g- v: G& R* ]: G# p6 C7 c  {5 {( [: ], {
Method 08
; l% S5 L; b5 ~, @' p0 x=========% h0 ^8 g4 d1 D# \$ I$ q! M" g
) q" h; Q% u( l' l; v- Q! `# b
It is not a method of detection of SoftICE but a possibility to crash the
: _1 F3 m/ _) X  F( J; A2 Asystem by intercepting int 01h and int 03h and redirecting them to another6 ?' d2 \8 d+ t" m/ b" c
routine.4 G5 l5 ~; f5 ^6 B0 ~* D+ M3 x
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 F* D5 |, F  A. T/ ~to the new routine to execute (hangs computer...)! S1 j+ @2 ]3 I* T6 {: _/ O0 l0 ~
2 i0 }& W; H3 S* M6 I$ a1 h
    mov     ah, 25h
# S/ h1 Y; j& n5 e0 c    mov     al, Int_Number (01h or 03h)3 B: ~# K( D  K& M6 c  @
    mov     dx, offset New_Int_Routine7 f7 M) o  e( J2 z( ~( H0 h
    int     21h- U2 E! d/ y: @( ^* n8 t5 g4 D0 n, q

5 k  j& Y5 ~& D3 P" A  `7 G__________________________________________________________________________* [: H, B1 r- P, k; G
5 ?1 h" G5 j& R6 l
Method 09
2 ?$ L; @  g. I6 b=========) k/ `  m( d, Z2 Y4 a& S
! J* ^4 t! e; C" z  n
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ ?4 y' v/ t( r- J/ {
performed in ring0 (VxD or a ring3 app using the VxdCall).
3 h4 W, c3 Y& U, h3 zThe Get_DDB service is used to determine whether or not a VxD is installed
) G, V8 K( S1 x+ Y& Z1 Wfor the specified device and returns a Device Description Block (in ecx) for+ I: G8 |5 I9 f
that device if it is installed.
7 D* J1 ~5 x1 ?" P
$ R9 Y; V3 m6 g4 h: |) \   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% H( V. u8 ~: M1 z! ?0 ]( V7 @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 D; w0 b$ E8 v( A* t' n   VMMCall Get_DDB
& K) O2 f5 D! T0 l; q   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: w+ d, z* @5 s, a

0 T& m  Q. i0 h9 c- ?9 MNote as well that you can easily detect this method with SoftICE:
1 k6 u; B$ }) ^7 g0 a   bpx Get_DDB if ax==0202 || ax==7a5fh
' d# a' @, Y' D. r& x3 L
! M3 `0 c5 H/ ]" i* `; {4 l3 T3 o__________________________________________________________________________, A; V& M; s7 V# i1 W1 G6 Z& x

$ ~8 S3 p! ]1 c$ M! P. e+ A* KMethod 104 P4 k; u' t5 W8 ?/ P$ F
=========' D' t3 x: w: F0 I/ q& n1 {
8 M* W) R- o1 R
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' ~& \/ Y+ J' U/ g' R9 n  SoftICE while the option is enable!!
% c! m. N  ~& G, O! Y" G+ Y1 |' L( _+ {/ {
This trick is very efficient:( n3 K/ s- @; g. g
by checking the Debug Registers, you can detect if SoftICE is loaded
  A8 O* B: [" ^(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 G' P; ^9 a# Y' R2 a1 Fthere are some memory breakpoints set (dr0 to dr3) simply by reading their8 d1 \1 V8 j) [) b* W
value (in ring0 only). Values can be manipulated and or changed as well9 o, \' K. ]; @5 H) q
(clearing BPMs for instance)+ V! B  Z: L2 ]

! h5 }( z1 r) X0 M/ E. P# q# A" q__________________________________________________________________________
; ?" i/ _# z7 L: D, D6 B
* ^0 M' U1 Q, b  o& u; ]Method 11
$ u2 h' }% a" M' ?=========8 U& Q$ D; V7 o/ W
0 B9 a) L1 @- N: V
This method is most known as 'MeltICE' because it has been freely distributed  R' Q' A9 |) i' m1 }* ?
via www.winfiles.com. However it was first used by NuMega people to allow. {  P+ }+ l9 i# K# f/ U6 G2 U! G
Symbol Loader to check if SoftICE was active or not (the code is located
1 @! F6 b% b" r" |4 M8 vinside nmtrans.dll).
: ~7 ^/ V8 `0 m/ y/ }! }! F( U0 T0 i- P' A! ~. y3 D
The way it works is very simple:  J0 {# i, P1 ~! K, {
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for$ V; C: r. |, K; Q0 E
WinNT) with the CreateFileA API.& j" D/ U6 V" O3 E) \/ n1 p  N2 {: u' u
' n6 f6 d" {$ N+ R, O& c* k
Here is a sample (checking for 'SICE'):2 Z* d, r  \& J. Q& _+ G2 z- p

1 b' p! \. X5 s- ]1 |8 lBOOL IsSoftIce95Loaded()
% s# O/ y& i+ w6 p( |{
: M; ^1 E- S2 v  a& c   HANDLE hFile;  
: f7 x8 I' L5 `% Q! @   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! |+ G2 o1 G8 d% i  W                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& M1 [" x- m' u- Q9 W9 r4 v                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* m' Z7 z% [+ Y
   if( hFile != INVALID_HANDLE_VALUE )
% @" k/ Y* ], z$ w5 J   {
+ u8 d4 |2 J/ l% [$ U/ ~/ u      CloseHandle(hFile);% T, |! B$ W, S5 r# m6 M5 i5 S  w
      return TRUE;% \) d/ M) s# V' |% r* W
   }
" t" B( ~. o5 u6 I  e3 K- U   return FALSE;- k9 }1 _* j% L% Z  J: `
}
; @, l, A! k  J
1 w& Q& m  c8 G; h) _1 q/ KAlthough this trick calls the CreateFileA function, don't even expect to be. i5 ?% p' |. E8 y: u; |, v
able to intercept it by installing a IFS hook: it will not work, no way!
  t5 P9 Z8 g; kIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 [+ w4 Q) }. d. R/ ?% Qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 Q' @5 O. ~$ @
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 v0 ~1 K1 j! y6 P5 ?
field.
2 {. ^% L) j; CIn fact, its purpose is not to load/unload VxDs but only to send a
$ `* @& c4 S" M2 H! g$ z0 }% P9 r$ QW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)! j( M( D* `5 p; j; y2 R( K
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
9 Z  f$ E/ L+ K2 }# ]: Wto load/unload a non-dynamically loadable driver such as SoftICE ;-).0 p) f/ \/ s  O! A4 e0 a7 r
If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 s( {: J) F" t1 t) ^# ]- n' }  Qits handle to be opened and then, will be detected.# N6 f& ]4 V; J' M
You can check that simply by hooking Winice.exe control proc entry point
/ J6 X& W- Z# m- G& d! uwhile running MeltICE.& l: k8 R2 D1 {
( O3 n' C1 R5 }  Q( s
1 Z' m. N0 {; O% c, h  C
  00401067:  push      00402025    ; \\.\SICE- ]3 l: M$ e" B* r0 Z  v' Y# s
  0040106C:  call      CreateFileA! d" |! S  F+ ^( g4 k! r: j
  00401071:  cmp       eax,-001
2 q; j9 {8 o3 `, T( i% ^, b- k7 j  00401074:  je        00401091
" t( V1 ]3 z! ~/ ]9 q6 j3 ]% M9 _' d# b& Q5 V. |; u% s0 ?

* n" z% B% O, w& }) I" q0 ?* m1 JThere could be hundreds of BPX you could use to detect this trick.
, ]% J. i" L# h$ c-The most classical one is:: n( s5 o0 O+ a& g
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 A. M, X1 R4 ?$ m- m
    *(esp-&gt;4+4)=='NTIC'' e/ {' o: {+ M# T
$ _% s3 a8 c# I# f4 }
-The most exotic ones (could be very slooooow :-(
  f, o6 j% L, ]5 F7 w2 ?& {+ h   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + c% d9 M# w  y' u  z
     ;will break 3 times :-(
. ~, v4 _- A0 o5 A/ ]& C
+ [; E/ {1 }+ o* h2 k5 I! E-or (a bit) faster:
" J8 ?/ b. U7 F( J   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')% A3 ~7 h6 H( _7 d) d

# H' |( }3 w- g0 i5 C   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 @& z- i  N: R6 f% _
     ;will break 3 times :-(% @; D5 C) K  ?. U" A. v

  T: f! d2 W9 c: z5 B* X-Much faster:. z) Q  {8 u7 M7 }' E. _9 j
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! Y3 K2 O7 s. e7 v
/ W& Z" Q, l& T) `% }Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. Y$ [  i2 B3 B/ l% D1 qfunction to do the same job:
% S( T" e3 Y% n/ q. l: d- D! ^* j2 F* N, o4 }) z# I# d
   push    00                        ; OF_READ
- v2 f' w6 P3 J! ?$ g   mov     eax,[00656634]            ; '\\.\SICE',0) }6 U2 l% v. ]% d, E; |
   push    eax
: F7 f& n- v" y* K) d0 z0 }" W/ }   call    KERNEL32!_lopen3 B- B- c' [& o: n
   inc     eax
$ D: R9 `0 g8 V& [   jnz     00650589                  ; detected! K. j1 x1 D; _5 E# `7 C2 o
   push    00                        ; OF_READ
) d* {) d) m% P- g' j; K# {% F" |, v   mov     eax,[00656638]            ; '\\.\SICE'
1 A/ v+ o4 n, I' u" p! B   push    eax' S! V/ k/ X& w& B
   call    KERNEL32!_lopen
! p' M) f( Y  _9 b   inc     eax
# H3 w7 A- s0 T( W   jz      006505ae                  ; not detected
8 e- H( n9 n8 N% {/ S  @1 w4 |, h7 x4 c+ V
& j4 t# K" L, z* V
__________________________________________________________________________# K/ t5 h5 O& \& o7 X- |

! B% [8 B# @9 r) q  ]2 _- fMethod 12
1 N9 f0 y/ y: P& q# r/ D9 o" M=========$ P4 _2 V$ n/ _) R: k  _; d0 l4 E

5 ^+ z! e. X: _; I+ s" W3 X0 z% U8 xThis trick is similar to int41h/4fh Debugger installation check (code 05) K: f# [: ?0 W; R
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  G/ C) q8 V( E3 t( G3 bas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ ?) _; O, T5 G. Y  T& Z+ C" j: v/ y# }" K1 \. A
   push  0000004fh         ; function 4fh
1 f& z. \2 ?' t" X, z) o' l7 x   push  002a002ah         ; high word specifies which VxD (VWIN32)  N9 E- k) I! l. W
                           ; low word specifies which service
' p% X- }/ u8 `8 F( H                             (VWIN32_Int41Dispatch)
& `& y5 g2 S$ C' D1 e   call  Kernel32!ORD_001  ; VxdCall
7 [, z. T0 A! R   cmp   ax, 0f386h        ; magic number returned by system debuggers
) i9 v( G5 }4 _  ~% B   jz    SoftICE_detected
- L- z" j2 x7 x6 ~7 ~+ j3 k. t+ ~
0 P+ O6 `  k4 H  E4 o# jHere again, several ways to detect it:
' W* C0 q" c& k. a1 W1 s
; u8 B5 U' ^9 F( e    BPINT 41 if ax==4f7 e; X& l5 I4 t& @

+ s, N) w; z0 z7 ?8 K& n    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* a2 Y2 P- W% k7 M8 W
' Y  W: ]+ O( |9 u' d! O6 J  t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! O: ]$ b1 I, S, n8 n* Q( x, D1 O
9 v7 d& J# K% U! M/ H* d    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% O, Z6 ~0 U& R, O- T
' c* _, L+ n# H
__________________________________________________________________________/ M$ K* q/ S5 {% M& C

  t; o6 D/ P' gMethod 13; B8 k0 d$ A' E- W  D/ w
=========
* x6 a! x5 \0 F) M; f* O0 D9 e
) ?# l# B& f4 t# }- Y3 }Not a real method of detection, but a good way to know if SoftICE is
& a# m3 m3 e5 M' y2 o0 ^& vinstalled on a computer and to locate its installation directory.
5 V/ A# }7 A4 J; b2 o7 kIt is used by few softs which access the following registry keys (usually #2) :1 N$ M( A; _7 l# B7 {3 f0 Y3 u

8 V. H) s# C& J-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  a* n' ~; ?* c' g# B5 r- ^\Uninstall\SoftICE" @" F7 ~% x1 }! K8 b6 c' o
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( M) G. z! T  Z, Q" Q8 T1 q# Z# u
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 l. x0 I6 E  y: n9 o! k) q# U\App Paths\Loader32.Exe) ~' e" d& `4 n" F/ l( h4 n

% }8 z: ?" _( }4 P& b0 S" z9 E' Y  s4 _% n% k; L/ w
Note that some nasty apps could then erase all files from SoftICE directory1 L! E8 e- m! T4 t
(I faced that once :-(
, |+ B9 ]( V% u  T' K: I. n. k& E# ]0 l
Useful breakpoint to detect it:$ }, P3 G' n: v  d! q

, u) f; h3 V3 H6 |, r* S     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% E5 x: N% A! m0 Q, X0 D8 T
" W9 m, O8 q6 x8 [( V& ~
__________________________________________________________________________
  S0 w$ k* B  e) U# E$ k7 `! y
5 X2 m+ L, Q. J/ e* D, P. V( z1 x# C3 [9 w% \+ s8 j" x
Method 14 / A9 n6 @6 Y2 V( k/ D9 C
=========
( X) a# K- e1 l! `
, K8 c6 y5 c! z% {" G4 l4 |A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, a# H7 N8 T6 E$ T
is to determines whether a debugger is running on your system (ring0 only).
: e7 O/ a# C/ k- r$ p+ Z3 Y
0 ]/ H; q" S$ r0 Z   VMMCall Test_Debug_Installed
4 U6 s+ k) i' C  }# ~   je      not_installed
# C* u1 V# S+ `% U) I5 M# N3 n4 _1 U! D! X
This service just checks a flag." E+ |: N$ L: j9 G! M
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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