About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ z: }: ~  t# l# [! A8 q+ A
<TBODY>
& s3 K  U1 L  B" U3 h( i5 F<TR>
% B  h8 B3 s: p7 `# b<TD><PRE>Method 01
  Y/ W8 J* a* R3 I8 E: i5 H& ^=========* w' h$ ?0 P5 p+ j+ F. F4 k6 N
7 n$ ~3 o3 O$ X% w( p# {: n
This method of detection of SoftICE (as well as the following one) is
. ~, r3 i  K$ e8 O( A% mused by the majority of packers/encryptors found on Internet.
) A2 l4 P8 {4 |) B# {, f$ Y$ o+ EIt seeks the signature of BoundsChecker in SoftICE& A9 m* y" i6 C' |

: ]5 f5 T) |9 n    mov     ebp, 04243484Bh        ; 'BCHK'
. L1 P+ C- e, q# c5 [. t: g    mov     ax, 04h
6 D7 D3 |. N( Q3 q+ [    int     3      
8 O, t; ~7 j2 ?( c* X2 o9 v; d    cmp     al,4
" k$ [) H0 {" D8 x3 C    jnz     SoftICE_Detected
1 g! |7 u; i% W3 W' P5 K# }$ M9 [" |; K  {% T5 r
___________________________________________________________________________9 G- b  J. b3 N. [/ x) ]" ^0 i* M

; }- F9 P3 f5 h  GMethod 02, X; l2 y% ]5 x) o
=========
8 \8 M/ o2 S8 v/ ^0 a- j
5 o* K4 r- t6 w. g/ ?; p& E" O9 JStill a method very much used (perhaps the most frequent one).  It is used: s% M- ?2 X, r7 p( ^
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ R! @: ~. l. _3 y7 t/ Q
or execute SoftICE commands...
5 G! w( @- S" k; gIt is also used to crash SoftICE and to force it to execute any commands
1 x0 ~/ z% j1 r9 m1 l1 \- [(HBOOT...) :-((  * R1 I+ x: [/ {) g+ Q

: T$ ^/ p7 f7 S- {& VHere is a quick description:/ Y! E) I- w" @7 c1 l
-AX = 0910h   (Display string in SIce windows)
( [8 A9 v/ \9 d9 f! s-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! s4 e4 S; P/ p# n-AX = 0912h   (Get breakpoint infos)# q3 h: ~7 K* x* E( b7 G' L
-AX = 0913h   (Set Sice breakpoints)4 p% T  }4 {$ M' s
-AX = 0914h   (Remove SIce breakoints)3 G8 p) c. e5 `( p' E  @
3 b( Q/ k) E7 j* \
Each time you'll meet this trick, you'll see:2 n+ M( y4 G0 h5 b, K
-SI = 4647h
+ ~1 R1 t( b+ o" H4 O7 Q-DI = 4A4Dh
1 h" H5 C7 d. EWhich are the 'magic values' used by SoftIce.
9 l  t! p& c- M4 T# e9 L+ rFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.: r, {0 g% L* Q9 [1 B/ k3 `

6 F* f# s9 U& u! v! M8 ^Here is one example from the file "Haspinst.exe" which is the dongle HASP
& H8 F6 _0 P( D8 g( k6 LEnvelope utility use to protect DOS applications:" b2 R" g( r0 o3 \8 d  F1 v

/ K( ]$ b1 |6 f- J* z4 R; c9 p8 c% ~, g  e* w* |
4C19:0095   MOV    AX,0911  ; execute command.# X3 n+ f9 z' K+ O4 y& \
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 ^# C* `% E6 K6 H! |5 ]2 a  X+ `4 F
4C19:009A   MOV    SI,4647  ; 1st magic value.
& a$ s) v7 x5 k2 e3 ~/ g4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& e8 ~# L. v" S% I: z4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
$ L; h) J  J- b/ B2 X' [5 E4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% J! i1 N2 a) m0 }7 X5 P
4C19:00A4   INC    CX
  |( F* o8 s' q+ q) F# L# Q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- Q. ~+ x, `% ?6 t/ y
4C19:00A8   JB     0095     ; 6 different commands.4 H: f$ O- r/ `( H! d
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.+ y$ V5 {/ n5 ^0 U& p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), Q! g8 Q- l- a5 v% i% p9 `

+ e9 ?) A2 ^5 U' O  v/ UThe program will execute 6 different SIce commands located at ds:dx, which5 N3 f- j2 W. T+ i0 s( @: X* d8 Z  P
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- m2 A, [# n. G8 Y2 _8 _( K( s8 A
+ W) d8 @8 L9 h1 N! _; a: P6 Z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* m( W0 @5 {5 L3 J___________________________________________________________________________5 i) }4 _" X2 o3 r) L) m

2 d: _4 v: w& n, t2 M
9 [% n  [; g/ X. e! @Method 03
3 W+ ]  m! x; Q" B7 \=========
$ s0 N( a) ]1 v4 ^$ R: k8 Z7 j' b+ x0 S9 j6 N5 _0 X$ W0 R5 V9 W- I
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) H+ I2 L5 h) z7 L2 ]" T7 ^6 [& I
(API Get entry point)
  w; S1 D! W- \6 [        " u5 n7 H5 z( S" f! u1 W
+ _% H1 U4 k* M
    xor     di,di
8 _& y- c+ b/ G! z% E' P    mov     es,di
0 X- Q- M+ {7 r0 G3 W# {    mov     ax, 1684h      
* c. ]* N( `3 L/ y: x( z7 D7 W8 D    mov     bx, 0202h       ; VxD ID of winice( \' f" G- x' t! v. k- s7 g
    int     2Fh
! T4 G' t4 w. q5 v' V: h    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* v8 C; K5 ~) k4 k    add     ax, di0 T* w1 t6 g: x4 ?
    test    ax,ax
2 k, g9 f3 s- z    jnz     SoftICE_Detected
! p! A6 H, v) W5 `: e. g5 `, }9 D) T$ E1 Q9 R( m
___________________________________________________________________________) p% K9 Y# ^! F

, ?( g% T; J0 l7 S7 y! ~Method 04
  b/ \2 {# ]1 P* f8 q! ~0 F=========* c2 m( N8 s9 [( o; d4 I

0 ?' ~+ e& r, X  l' aMethod identical to the preceding one except that it seeks the ID of SoftICE+ H9 I1 ~; C+ U: _
GFX VxD.
) ~7 W% k7 ^* Y
. {3 f4 Q$ J) Z" c) N  ~    xor     di,di& y9 f% m! X$ F
    mov     es,di; G' b' p; I4 m, W% W
    mov     ax, 1684h      
" U& I2 ^# J: h/ r; ^' A$ [7 D    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. Q7 Y- b' _- u1 @/ c% ^2 r    int     2fh! c5 j' t/ d1 f
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# q  ~  H9 G% E" F
    add     ax, di
" q2 ?% `, F6 w3 o/ p8 e' t    test    ax,ax: _6 _3 j" ?% i8 p
    jnz     SoftICE_Detected
, b$ `, w! n# e  T6 p1 e* w7 E, C
. ?' B  P; O9 t__________________________________________________________________________$ V9 N3 I; U0 S/ W. c3 J$ L9 [

6 H( V" j* [+ d
9 D3 \) c3 V( w5 bMethod 05
- [. n4 a0 |9 W6 |6 @=========6 M5 R; j1 z# ]1 m8 D' V3 z( ^
/ i- Q* w( ?9 X7 b: D- I
Method seeking the 'magic number' 0F386h returned (in ax) by all system8 U7 K! i0 M  j+ g
debugger. It calls the int 41h, function 4Fh./ P& L% M  N6 b  K4 |' b
There are several alternatives.  
0 T" v* A! h5 N/ x* ^9 C" I. S/ a9 T6 F9 i* I# M- _9 m
The following one is the simplest:! N) P) |9 h$ T
* z1 l  d( u6 d; q
    mov     ax,4fh, O( Y, C4 g/ _
    int     41h
( V  J7 L  @3 _( a2 F# [2 q+ \    cmp     ax, 0F386- |) q; f$ n$ e7 l  J" R
    jz      SoftICE_detected; e1 b+ O3 S$ S( s
0 N2 `  ~4 T5 Y5 r

4 H+ P, X  P- q/ KNext method as well as the following one are 2 examples from Stone's & c% x. y" t& B4 Q) x+ a* K
"stn-wid.zip" (www.cracking.net):' ]2 N4 ^) W: F* c- x

# m* F* ~- I9 o9 N  O    mov     bx, cs3 r; I, R6 K. d; O  d
    lea     dx, int41handler2& u5 T& t1 ]; n, n. u4 r$ x) Y
    xchg    dx, es:[41h*4]
3 h! S" r- H) z$ b5 M+ r8 s    xchg    bx, es:[41h*4+2]3 e' a3 S1 j0 O3 _" [- t
    mov     ax,4fh9 Q9 i  m& ~: C
    int     41h. z% ~) R! R3 D8 g; S& Z. W
    xchg    dx, es:[41h*4]0 e* K; ]+ J7 ]3 G; `4 f6 ^
    xchg    bx, es:[41h*4+2]
6 j1 m+ w8 @9 v2 U4 |! [5 M    cmp     ax, 0f386h( O1 t) F6 N: J1 W4 d5 ?
    jz      SoftICE_detected2 V0 ~7 w! s$ G" y
! J. V+ ^& k9 a
int41handler2 PROC
& n) R* E  c2 p% ]    iret' _: g, ]' d  c" i4 M0 b- a
int41handler2 ENDP
8 I! B8 i! [$ A3 U0 p- m+ H% Z* D0 ^: U4 Q" n
) p) k( Z9 F4 l, D0 M. p9 S5 R& s
_________________________________________________________________________5 N; H4 N  d0 E) i% x  u$ O
; P0 O3 K& m$ Y9 M# \) c6 e
, }6 Q* W4 f9 o$ [  {! P: ?5 U6 }2 f
Method 06. L2 }3 H8 o) A0 H+ h- w
=========7 t2 e$ c0 Y/ x$ q; w8 m4 b1 H! t
4 I" m1 s4 L. K% S3 [) U/ O
( ]+ Y/ k: J! o* u; E4 |3 }
2nd method similar to the preceding one but more difficult to detect:
2 O9 L6 [* A' B1 F4 t& J5 ]7 e# @( T# \. Q2 ?- z. f+ z
2 t8 i% L6 X  w; {+ T8 P; G2 U
int41handler PROC. Q+ p) t/ [% B$ S9 `2 \
    mov     cl,al* J6 P4 U# A3 _/ Q* p
    iret
! u: c" w$ Y+ O3 pint41handler ENDP
) m( I0 K0 J5 _3 Z* K2 D; U! F8 N! k2 s/ x+ _; A

8 l, f8 O2 m% U    xor     ax,ax7 K( U4 @3 z$ q
    mov     es,ax/ N' t' Q/ M7 y; P. f* R: u
    mov     bx, cs
4 }( A; b8 a( M    lea     dx, int41handler0 W2 z6 Z" E5 Q( S; w! X4 i
    xchg    dx, es:[41h*4]  d& k6 C/ l! r8 M6 J
    xchg    bx, es:[41h*4+2]
" o5 T* e1 x8 ]$ b' J/ E; n    in      al, 40h
+ e; |! f' U# K9 j& {1 w    xor     cx,cx
1 z  i! E$ j2 o0 [    int     41h
) M9 s4 `; e* E2 f( Y    xchg    dx, es:[41h*4]5 f5 `0 G9 p. [( i" }
    xchg    bx, es:[41h*4+2]
, O, `. U( \) E) c9 A) X- K    cmp     cl,al
) n# E2 P% G0 N% A7 p4 }    jnz     SoftICE_detected
) Q. T4 R6 u" K. p- Q! N0 h: k; `0 ^* N# {2 v
_________________________________________________________________________& ]8 O* `$ s8 J2 e5 n( W: ~% C/ d6 g% \

1 I) d5 F$ X' S) q" |0 w$ GMethod 07" q& E$ m( G+ F$ H, B$ E
=========
/ b0 G$ `- m1 _( j7 r7 L0 y- Y2 H/ |! o- L1 m$ u6 I
Method of detection of the WinICE handler in the int68h (V86)
. K. K( a2 K( `. j. C9 a! L6 @4 o1 y  h+ N6 l/ z
    mov     ah,43h4 N& |' Y: v4 V8 l5 F7 a
    int     68h
5 |+ w" B7 |" L' w% [    cmp     ax,0F386h
8 }2 R2 \0 x! ?( z8 v    jz      SoftICE_Detected
* R: c- }- P9 `; ^/ j* O9 U! `3 [, h" k8 E6 F

( ^( p# d2 I3 g3 O, V* T' f9 Y' N2 H=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 }8 Y1 e* Z" F   app like this:
! L3 H; r# U) B, `
) Q" V$ T. b7 H# {7 [; c3 I   BPX exec_int if ax==68  C8 J* {3 U  f/ _8 J" o
   (function called is located at byte ptr [ebp+1Dh] and client eip is
4 |- r' h. g1 ~6 J* P* J   located at [ebp+48h] for 32Bit apps)- ^# f# o+ I7 e/ N" h
__________________________________________________________________________
3 m" b+ l1 r% U7 r& z* V
0 }5 C  D1 Y( n" E9 v6 M" U
) U. ^) m) w( B% hMethod 08
# M+ f8 e, c& B, D: P=========1 l5 F, z, K& c- M" C1 H2 C' ?
4 x3 c4 a6 x) i. e/ Z% J7 c6 S. Y
It is not a method of detection of SoftICE but a possibility to crash the
/ ]) z0 R% `! w/ o- G5 l- Zsystem by intercepting int 01h and int 03h and redirecting them to another
$ ~# d& K3 b7 N+ o& uroutine.. i  U) f5 q# O5 l+ m7 R" e. P
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- |5 D% H- e. O# b+ e& nto the new routine to execute (hangs computer...), n: Y/ f' C; j" L$ M

: O/ `! y% `! R9 E6 A    mov     ah, 25h
* @0 d, ^- y% M% S    mov     al, Int_Number (01h or 03h)7 D+ d7 U6 R2 M! c
    mov     dx, offset New_Int_Routine
4 V; t) K, N  k# {    int     21h
  U; h5 Z$ a- ], z. F, D% w$ j. A' b3 Z$ U) D0 I6 E" J$ ]4 ^
__________________________________________________________________________
2 Z+ \8 X$ g& [9 d: y
+ S8 F3 n1 ~0 u/ F' \" X: l6 c2 e' B! u( KMethod 09
$ s- @  n5 S6 Z. u5 X5 q' h=========5 {  X9 i6 {* V. m
+ V$ k- P+ i0 o' a# n$ G/ B0 n
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ r0 |( S$ y  ~+ d8 M
performed in ring0 (VxD or a ring3 app using the VxdCall).
) f' e+ ^. A" gThe Get_DDB service is used to determine whether or not a VxD is installed
  |% a; l1 v. }5 r, M7 |for the specified device and returns a Device Description Block (in ecx) for8 R3 `+ c0 c! ?. Q0 r6 }; `
that device if it is installed.
, M8 y7 h2 @$ k$ V8 N! W/ L, [9 j7 d1 U- ]6 b2 n
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& P1 j+ Q4 K5 l7 C! h
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)7 `: h2 }  ^" p) z& J: T. \: G
   VMMCall Get_DDB" K. \8 J1 |5 ]; x
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. O) T5 b# `& r/ I0 ^' j# w% @' k
Note as well that you can easily detect this method with SoftICE:* o, Z4 P4 z% j" w: {% f
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 ^: Q. k/ R$ ?. X8 ]1 d! I$ {1 H8 i' b4 r2 l: U) E
__________________________________________________________________________
5 E( A3 x0 t, i( |: f; d) Z! p3 B
, i1 `9 U3 i' C4 F3 H0 w. N9 G) d3 |Method 10
% W1 t; k7 [* s/ `% @9 i=========  ]8 H# D2 i3 [5 w# ^" R

5 ?* T8 @. I# z6 w7 h: F2 _6 s; Z4 n=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' ]) C& q7 J! T5 ^6 R& o# A" v8 e  SoftICE while the option is enable!!
+ X; A; x; d, D  q5 G
/ I* j, J6 ?9 ]7 y  k, ^1 DThis trick is very efficient:
- z) C" b& |1 N& N% cby checking the Debug Registers, you can detect if SoftICE is loaded; S; d- t! o4 N
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ v6 D7 \* C% P5 Fthere are some memory breakpoints set (dr0 to dr3) simply by reading their
; O% J5 P  Q& K6 T6 G; N- v- D; Lvalue (in ring0 only). Values can be manipulated and or changed as well
  W' K, ^; J" M( K& u8 e+ ?' p! v(clearing BPMs for instance)- Z# n9 E" N% h& m3 U; l

" G8 H3 F- d2 @* d__________________________________________________________________________
1 {5 J; d/ K' F4 M" y
  z+ \9 S' H2 }8 H& VMethod 11
& b5 v; Y7 t/ O8 D* C6 E=========+ S* [: O& L6 m

/ Z) C8 @- T! a& Y, O' G( J; XThis method is most known as 'MeltICE' because it has been freely distributed
' R" W0 E# |5 C+ M3 pvia www.winfiles.com. However it was first used by NuMega people to allow. Q7 ]' J' f/ z; x& l+ Y. O
Symbol Loader to check if SoftICE was active or not (the code is located
3 S/ L1 a8 t. b% }4 minside nmtrans.dll).* d3 h! d! O% C& N4 K
9 n8 F. B8 v0 [- v4 b/ U& J: N
The way it works is very simple:! g( n& q' C7 q" x( E% z, d* X
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 v' ~; n( q9 y9 r( {' Z/ f  L" u0 G
WinNT) with the CreateFileA API.- s6 k! g+ J) R# S1 F" g

% `9 [& X8 Z. h, L2 e6 E% tHere is a sample (checking for 'SICE'):
0 ~& S- s5 w; X& r% z! m7 Y# H7 A7 C  P% |9 @+ G/ {
BOOL IsSoftIce95Loaded()( V, H3 O5 b' M$ W
{
! g. v5 e+ m/ Z+ X: N/ L# R   HANDLE hFile;  
: b9 d3 D8 u+ l   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,2 X9 x0 i- {. w  W( }# A3 F
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
, g8 e* I7 V! P' e: w) X. b; G                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( W8 ?0 o6 W6 Y$ W/ X  m# H+ Y   if( hFile != INVALID_HANDLE_VALUE )
. M2 d3 _9 K, L5 B/ Q) S2 {  w) x/ h   {# ^& W$ r2 B2 Y# k- m7 ]
      CloseHandle(hFile);
; Z( ^0 n) ~! Z1 c; h: j/ n$ H      return TRUE;0 R: q) |; A2 c% y
   }
) F0 X8 o' ]. ^* s7 c$ `   return FALSE;7 P5 Y8 x' E4 D$ |' y8 E' n
}
4 \1 h6 R! e% M# J4 x5 x# \$ |, L4 p: C; }* m  S
Although this trick calls the CreateFileA function, don't even expect to be
% [/ w/ N& H! k$ F" r. Mable to intercept it by installing a IFS hook: it will not work, no way!' h8 H0 R' M! `
In fact, after the call to CreateFileA it will get through VWIN32 0x001F  V7 J7 _$ @; a: P9 t& u# O
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 a1 p  p0 b% M7 F
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 q- g/ g' |1 U1 Gfield.
/ l, ^0 R8 s$ OIn fact, its purpose is not to load/unload VxDs but only to send a 2 B; C7 X# V/ P; V$ y+ s
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)4 `1 A0 Z5 N% ?, L
to the VxD Control_Dispatch proc (how the hell a shareware soft could try1 L; ^+ H" |0 r1 T5 h
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
* i' R" u: D5 I8 T: D1 `If the VxD is loaded, it will always clear eax and the Carry flag to allow( m$ R1 f# T5 u9 o
its handle to be opened and then, will be detected.) i0 n7 d+ }  w
You can check that simply by hooking Winice.exe control proc entry point/ [( i$ L! C: O) g: |9 @
while running MeltICE.
  P3 N9 H' N3 V
! ?6 W& Z& F# G0 A  j) Z; q0 s. U
  00401067:  push      00402025    ; \\.\SICE" j( s7 G) n' B& n) d0 s
  0040106C:  call      CreateFileA
- U1 v; u& i  G. }/ E* _  00401071:  cmp       eax,-001, I- _- j2 A5 b, n
  00401074:  je        00401091
( p8 K: S9 l" j2 }! v5 g
  ], G* L7 c% Q  O9 d8 @" {$ k/ K
There could be hundreds of BPX you could use to detect this trick.  T1 @+ d, l: }  w0 m* U5 j) [
-The most classical one is:
5 A+ ^" G; d+ J! ~  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||6 C  ]# g! L" C3 s+ |
    *(esp-&gt;4+4)=='NTIC'' @1 S6 ^8 L+ M4 d: @

! m% q3 q. A5 `: p6 a  t-The most exotic ones (could be very slooooow :-(
" l( l( n9 f' s: Q) [. {5 }   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * I* V6 S& s; _
     ;will break 3 times :-(% s5 l0 `6 \0 c' F# a6 g3 y5 ?
5 A# I: Q5 K7 F" A" c2 c9 |
-or (a bit) faster:
3 t' H( A; o4 B$ r+ U; S. o! ]: v   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ @7 U6 t9 _+ i7 l  R4 Q. n
( F' S& W/ ~7 ?  U/ K   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
; _, L: b. B& g# ^$ o7 L9 v     ;will break 3 times :-(# o3 l8 E! Z" R' @! k

# c+ G. s, v3 L& E! h* k-Much faster:
& t5 p) D6 _4 n- N1 _' s9 r   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, L  C3 r' i& Y  M, l3 ^4 K$ [" ~3 ]" M4 b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ ^9 X5 E6 B0 R/ S6 @function to do the same job:
4 @2 P! R' l8 J6 O" A
& E7 Y- @9 p, |# z   push    00                        ; OF_READ
1 r! m' H! ^8 u& b   mov     eax,[00656634]            ; '\\.\SICE',0* s  x3 D3 _# ~3 \
   push    eax3 r& U- J6 y, r( p* _& b: |( w
   call    KERNEL32!_lopen
. N' l" K! Y6 D/ A& G; L; V   inc     eax9 |* ^+ J+ }0 ~# y* y
   jnz     00650589                  ; detected
( a$ V8 L3 ]) _   push    00                        ; OF_READ" M2 g5 R4 T7 L4 |$ d
   mov     eax,[00656638]            ; '\\.\SICE': r; v! o3 |8 E, e1 ]
   push    eax* Y" H% y2 c0 K: @* a& M" K
   call    KERNEL32!_lopen
  |0 y; w8 e3 F9 G   inc     eax6 w1 b6 w* i" ?
   jz      006505ae                  ; not detected+ n( }( K  k+ Z) x9 U  I7 K

5 V, N4 a% [# }# I1 [; ^, C( d; Z9 `! Y0 [+ z
__________________________________________________________________________
  d% Y8 }* `, _5 @! k- F- J
' ~& y& Q; H' x3 C* DMethod 12' s4 k' d$ b/ ?% b, {" P, k. d! \
=========
9 l# W& J# Z! G/ t+ W
$ k  H9 U* e6 p6 v5 b3 B2 P) F. _% y  IThis trick is similar to int41h/4fh Debugger installation check (code 053 \; ?! t1 o9 V4 Y' D
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& k+ O( ?, o) n# x: K7 v6 gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 U( @8 d$ ]6 ~. H% J3 O4 J- L9 H- @, x! e# ^9 @
   push  0000004fh         ; function 4fh( }- S$ R8 j7 @! u' h% s$ E
   push  002a002ah         ; high word specifies which VxD (VWIN32)
* Y! J6 D7 p* Y& E: K: P% W                           ; low word specifies which service. J2 x( i2 g+ c
                             (VWIN32_Int41Dispatch), Z3 f7 M' O) J5 W7 ^
   call  Kernel32!ORD_001  ; VxdCall
! c. M% s. |- g7 q" z* l   cmp   ax, 0f386h        ; magic number returned by system debuggers
7 P; f* L9 b+ Y: Y, s( R! D   jz    SoftICE_detected
  P% J7 ~) i, o  Q  r3 c0 v0 j( z5 L3 W: ?! `) P: x/ b
Here again, several ways to detect it:, z* O' k  N$ y# x' B! o$ h

: q6 ]$ X+ ]* }3 e( d    BPINT 41 if ax==4f
# H$ j7 i# y+ ]- h6 T- N; x; P# M8 d- S
$ D5 V) c. X2 n; c- j    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- o0 d9 J' A5 T, K/ f) o" N/ H
) t# x# s, X: O# E
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
+ L' R& H2 c' k* r% @  S; P
7 F7 \6 |4 e" U/ q+ b    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; n' N6 y) M/ {! `( ?/ L% ^

0 r/ ^7 Q6 D, Y4 o' O7 A5 K__________________________________________________________________________% G$ y5 j, R3 h

0 Q1 k4 t  q" F: gMethod 13! G& c; q; V8 j, F$ {4 t
=========- W: L& I8 A) B' R; R0 G

" ~8 Z  R5 p7 Z2 i* _Not a real method of detection, but a good way to know if SoftICE is. B1 Z7 f. w' t' F! _8 v) f) a
installed on a computer and to locate its installation directory.
+ `( G/ T5 ^# M, f) d5 H) v% ]It is used by few softs which access the following registry keys (usually #2) :
9 L- `" u6 h7 q
3 t/ H/ D7 w) O" ]-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 ~4 Y3 A4 c, z# m
\Uninstall\SoftICE
0 y8 j: I$ t. D/ A1 C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 C$ z' D* E& e! w' e  W' o-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 x* g4 E# b5 z8 o5 B\App Paths\Loader32.Exe
3 ^" e* a. o% Z8 k3 e3 l8 A3 k9 ^% {! Z8 p* I* I7 m

5 B* h# u% M7 o  a- }. x! VNote that some nasty apps could then erase all files from SoftICE directory
- `9 l$ a) q/ z" j3 Z5 W# q8 S' t(I faced that once :-(
" R" k- v0 c, ~8 V, ^
; Q) p2 I: S" M4 Q* ]Useful breakpoint to detect it:
+ v0 M* Y% X$ l! A' e8 g
2 {% b- Z* P' {) E' g- o     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
% q5 \$ n2 W9 o6 X# ?+ o3 r8 E
; L8 I( v6 v2 [2 Z5 a$ L6 D# C6 W__________________________________________________________________________/ z6 y3 I6 ^. R$ M1 F4 p

1 {6 ?0 n: c' w' D8 [8 Z1 h" H4 ^9 b: L+ ?2 }
Method 14
, `6 ?" ]/ r3 m* j9 }- O- V# y=========* S2 ~7 D# ?  B$ Z
. @. w& q* y3 V$ K4 r5 E
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ F9 d. [3 Q- R6 {
is to determines whether a debugger is running on your system (ring0 only).8 f3 d' ^5 v  ?- H6 a- ?9 e

: p5 e/ V( n* l5 J   VMMCall Test_Debug_Installed
2 [2 i6 o9 z+ E$ X   je      not_installed
" d6 d, r+ e" X/ g5 O5 @" b2 u1 J) u
This service just checks a flag., E7 H/ ~& [0 G) j2 H+ D. Z% W
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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