About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>7 ^& N0 y5 w1 Z$ V2 I1 @& `; }: p6 @
<TBODY>; i7 D' K# T8 x& P5 |( V! P. A
<TR>5 b, k% x' e, Y& J: D1 O
<TD><PRE>Method 01 2 {; z, d  Z5 f
=========! W# b( M3 Q+ d' B
, _; l4 ~# h3 c" ^
This method of detection of SoftICE (as well as the following one) is4 o7 _6 p  e  Z6 R6 w) @
used by the majority of packers/encryptors found on Internet.
+ E& e; N  y0 `! \6 a: a3 xIt seeks the signature of BoundsChecker in SoftICE3 j1 b6 L" A  ?
" O5 D. \" k2 D8 Z7 t* ~6 a
    mov     ebp, 04243484Bh        ; 'BCHK'
8 H, J' G5 X1 e: j4 e    mov     ax, 04h
7 W7 |& P& j* ]: W  P    int     3      
4 y6 u) x) a$ a. K' V/ o4 K/ s    cmp     al,4
7 f- W9 [4 U( K0 x+ u0 e' x    jnz     SoftICE_Detected( I' a3 |: z* E

# a' {  L5 R( ~) {% [, v* h' N  Y+ ^___________________________________________________________________________
2 A0 ~  d8 C3 T! O# g& T4 ?& h) D4 r( n" {' v5 x7 c- ]
Method 02
' o+ O- g! j3 B& K7 a! H4 z8 ]=========
) D( e" ?4 h5 p4 P( T
8 I) S$ R6 ?( r; d3 \Still a method very much used (perhaps the most frequent one).  It is used% i! Q' g9 ]# T' I, x! t, x
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,# w( T  b' V4 q$ l- _1 ]1 y: n
or execute SoftICE commands...
$ B% U  w  o+ U: n, [It is also used to crash SoftICE and to force it to execute any commands
3 C; @1 {% b2 c0 C(HBOOT...) :-((    Q! C& O# h& O! e' }9 D

( J0 s$ A9 Y8 I$ c# y6 T* v" RHere is a quick description:, T6 K( ]( D. i2 y5 i6 p0 e
-AX = 0910h   (Display string in SIce windows)
7 H& k6 _5 P% r-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( g8 {/ a! ~- k-AX = 0912h   (Get breakpoint infos)* S! u. t0 \4 f% _9 k0 m
-AX = 0913h   (Set Sice breakpoints)2 i8 W) S2 s0 n' |% ]( o
-AX = 0914h   (Remove SIce breakoints)
& }/ r$ r! U; N1 X0 r% p( b9 A1 @' V# @% p# W! V# e
Each time you'll meet this trick, you'll see:0 c' j. T3 [, M1 v$ H1 {
-SI = 4647h
: E  ~( x  Y' e" c2 h( G9 y7 v5 q8 {-DI = 4A4Dh
' {/ N2 v" I- G% hWhich are the 'magic values' used by SoftIce.
4 }% G+ @3 d9 O. z& y7 D# ?& @7 |( tFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 v8 c2 g  b4 t0 r2 `

1 m' x; N# m& g1 r" F9 z# Y% sHere is one example from the file "Haspinst.exe" which is the dongle HASP& v. ~( f, n7 C# l& [5 p% W
Envelope utility use to protect DOS applications:
5 j6 |# R0 T+ c
. Z( ]. h' P( _3 _% f* b  {
) J& w& d5 a0 j" o4C19:0095   MOV    AX,0911  ; execute command.9 N, e1 S9 W( F& \- U$ r! m
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% P' C5 k9 N* u( l  D3 F  H
4C19:009A   MOV    SI,4647  ; 1st magic value.
, g$ D2 W% G4 A8 x, s4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, W; e' T) {/ q  u4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ O4 F% _% ~$ ^" C( k0 y7 c" W4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% p  B. L" e  C' Y( ~# e  ~
4C19:00A4   INC    CX( o* F/ X* U+ d  i8 \/ \- K) s2 m
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
5 ?, c( H8 }* w4C19:00A8   JB     0095     ; 6 different commands.# n. q% X/ d4 y3 b
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. P( a- C) ~( ]+ e4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
* p8 k2 V# d- U" ]. Z! K- ?' y' J' J; C3 z" K  @
The program will execute 6 different SIce commands located at ds:dx, which: y0 k1 D# q7 G9 k2 T2 X
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
/ A% E0 c3 V4 R2 B% |3 i1 O; g+ u7 j4 d  ~
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 _2 u" u$ ]# `3 m
___________________________________________________________________________/ V. X( \( w0 ]" e
8 x( j4 z- J$ x5 C

# i3 x' \! E+ O% RMethod 03
7 i3 e5 b, @8 t; G9 X9 Y=========
, o7 S. o  j: a
' ^  f3 N+ U- I: h7 P* dLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ w' j, t$ q$ {" F) `+ ~/ \
(API Get entry point)+ C6 N+ z/ B' E8 H
        
# U! A7 c) S9 I8 @8 ?4 W5 |3 ^' U0 M
    xor     di,di
6 y3 X; z2 B4 e( @5 _/ b6 X+ }    mov     es,di
4 C; _* F0 `0 p& X$ V- ]    mov     ax, 1684h       + y; v" `" Z* K* l& o' F& S
    mov     bx, 0202h       ; VxD ID of winice
  h5 ?& x) @" C% m$ y    int     2Fh% x- H- b; o. R- ]" T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. k" d1 O! m) @4 }) q- T" ~9 e    add     ax, di
& R8 \( e5 t2 }" u5 w- W    test    ax,ax, P2 h2 ?$ n$ V
    jnz     SoftICE_Detected
0 w  G: ]4 X7 m2 E( Q7 k" q
) b& \8 |2 {9 P8 b# a) p  q___________________________________________________________________________; O; z. I, H' H0 Z$ L
7 c, X4 K0 j+ q
Method 04
6 D0 R) m# h6 R) K0 T3 j=========
7 I: T+ q  a+ Z, Q/ }1 y, p8 B0 b: h1 ]5 z$ a' d6 X: m
Method identical to the preceding one except that it seeks the ID of SoftICE
! d8 L* {9 Z+ t7 V  OGFX VxD.
7 ~+ H9 }3 [% z0 w
1 n1 U# S( ?; t    xor     di,di9 u8 o0 [# E" D8 [% [6 D7 j
    mov     es,di4 @6 }! P8 M  a1 O# @  v
    mov     ax, 1684h      
" D: @* b6 g3 d& S$ w    mov     bx, 7a5Fh       ; VxD ID of SIWVID; r. I% [; w% @, |$ S- T8 D
    int     2fh5 ~9 O/ k8 o+ @+ V( n0 Z3 Q7 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* ]9 i  w8 L0 M/ w+ J    add     ax, di- P: r' S2 z5 x# _
    test    ax,ax9 v5 v# \' P5 ]1 `$ @
    jnz     SoftICE_Detected
# W, e# r0 t1 E4 m) v
7 L9 h3 O* O! k" a, F" ^__________________________________________________________________________
8 R' f/ i, B2 y, i
$ g5 V/ `6 s1 E7 L: C9 O) M5 P9 ?
- D& b# O" c$ s! E" g; sMethod 05( U, s& G: ~. v0 e7 G
=========
5 ]; U3 W) H$ C, `$ k6 B" X* X5 i3 P' Y9 Y
Method seeking the 'magic number' 0F386h returned (in ax) by all system) }! t5 _, I5 ?# J0 V, W8 H
debugger. It calls the int 41h, function 4Fh.% N- D4 L( D2 m4 b$ x# ~6 c- j8 Q
There are several alternatives.  
; F2 K9 M3 d; i! f2 W
7 ?, F2 k) `- x5 yThe following one is the simplest:
7 q8 B+ B1 z$ O. d6 M1 O4 a& W7 q2 l* U% w$ ~
    mov     ax,4fh3 ?" T( ]! _' f
    int     41h
: J. B5 f6 x7 X    cmp     ax, 0F386! i6 B$ V: @+ a& D! h- t; i; K
    jz      SoftICE_detected9 j, I3 R9 _* T, ?5 Q
* F/ A5 v- ?7 M7 p; C  U/ ^- [; z" C
4 ?1 o* |' u9 c# x& Y
Next method as well as the following one are 2 examples from Stone's 8 B( b% I$ G7 R) U
"stn-wid.zip" (www.cracking.net):0 p2 @1 `6 V. ~. ^3 X$ x

" s+ ~1 U! z( |7 y' E; x. s    mov     bx, cs  J& B2 Y  `$ M, s
    lea     dx, int41handler2
* j. ]% F, v% J, K' F: P# j1 _    xchg    dx, es:[41h*4]! w" Z4 Z4 @) e9 y2 ^# W
    xchg    bx, es:[41h*4+2]& n; h7 H! ^- n( f2 R
    mov     ax,4fh
% J/ ~/ f2 H( G. _7 d% g    int     41h) F9 N1 ]  h9 y) v
    xchg    dx, es:[41h*4]
  e) k6 R% K+ O* S: D; }: F' y    xchg    bx, es:[41h*4+2]
0 J; u9 ~! U2 y2 V( J$ c# W    cmp     ax, 0f386h
4 z+ m( g+ O4 I3 g, t/ q( G    jz      SoftICE_detected
* o7 s3 X% Y3 m+ M$ `; J$ t4 N$ s. E2 r  K( w3 S3 M# i
int41handler2 PROC) H# o+ l) Z! X0 o' c+ x& ]
    iret2 _# p7 s' j. P7 ?1 X1 ^4 e; C- X, s
int41handler2 ENDP
( M; N/ e  B- ?/ J, z( x! ]6 k# e3 g

0 I  H  M: a8 H4 E8 W4 ?_________________________________________________________________________
6 i) W8 [0 C+ Z% U- R4 U, E! F( R+ G* D& l! y; V+ `2 O' d

2 t' M5 I8 y* c' J8 c( r3 [6 qMethod 069 \$ n5 S' l/ A2 ^% Z
=========
  w# d7 G7 t% q4 }* {  k+ E# N) U9 P" ^# u2 U9 `% ~

% y: C' k  J% R) k2nd method similar to the preceding one but more difficult to detect:0 G; G7 _' j5 ?9 h$ n4 n, B8 W' m: }

) _3 r) {9 H) J, B  [, _: U9 D
7 W; |7 c: D4 Kint41handler PROC
5 S5 c9 ^4 A3 {) }' d+ _    mov     cl,al! h0 ]+ ~' |6 T
    iret% s. M# Y# ^# p1 h' V
int41handler ENDP
( p5 A' t& h) x( M9 {5 ^; B. |) d. {
- ~) s) K% c" G' G2 C; Y* Y
8 x) Z+ A+ T! c% z) z. }    xor     ax,ax
- G  f: T; L2 E    mov     es,ax" `* \% _. x  O& h* y0 q) Q5 K" ]
    mov     bx, cs* J- _* }! {$ O+ x" a
    lea     dx, int41handler/ |* R. {, V# Q! S
    xchg    dx, es:[41h*4]
5 s- x& R# A4 k" m- A1 f6 E    xchg    bx, es:[41h*4+2]
  {1 ^6 N  L. [( t! U7 O    in      al, 40h, d! e; p5 S4 `+ Z+ {
    xor     cx,cx6 o  ^# A: B5 p0 [9 h, ?
    int     41h! e* [* B( H" c. w, R7 a
    xchg    dx, es:[41h*4]5 L' d9 N1 m* j7 l- B& M2 {- H
    xchg    bx, es:[41h*4+2]% G. p) D0 }% l+ }& T( X" x( O4 b
    cmp     cl,al
) i$ ~5 W" {9 @" \7 F    jnz     SoftICE_detected
, U" c" Y9 y2 H( Q+ ^
3 N; ]  V. O8 }9 H0 j1 v3 T_________________________________________________________________________
( R( T) D& b! C; _( Q* \) J- _  y- }! C; J/ D, N4 U
Method 07
1 h7 v7 a4 b4 D. {7 a6 Z7 b, k/ f! K=========- _' Q4 H! f2 I" Z

, A& C- C) I; ]Method of detection of the WinICE handler in the int68h (V86)5 B- [4 [2 _8 B9 E% T1 Y- t! s
0 U6 ~0 G2 {) j& o; G: p6 g
    mov     ah,43h$ z9 ~9 o0 l  L5 d3 P
    int     68h/ ~# }: D) j7 J% }' e: u* t% V
    cmp     ax,0F386h
6 H! M3 K( ?( U& X    jz      SoftICE_Detected/ v0 o1 X# a. q0 B( J  \
: L/ E% t8 G. K: e3 t/ v9 P" h# d
9 o- Y4 j, |# `! F9 E+ O9 ^& n& U% l
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 n, P8 l: }( a% ]3 `" d   app like this:$ h+ D! B( J6 C% B

# j) t/ A8 d" V4 C' j3 w   BPX exec_int if ax==68- e+ f- S9 q# ?0 Z
   (function called is located at byte ptr [ebp+1Dh] and client eip is% X) ?! J# u5 a( m% x( r
   located at [ebp+48h] for 32Bit apps)
! o: g. @7 I" X: F4 m/ N  Y" {; x/ O__________________________________________________________________________
7 m# U6 @8 {2 @" Q  W8 ?2 t1 W0 z* G
) s4 g' l& i# F, `: \
6 E% U4 V* F- q, _& F7 {1 gMethod 08
  h! |5 }9 L: y=========
8 ~! k5 O) ^% `( Q# f1 a
7 O$ U# y3 ?2 V! B! _' NIt is not a method of detection of SoftICE but a possibility to crash the" l" T8 s2 z" i4 I! {
system by intercepting int 01h and int 03h and redirecting them to another
/ _5 _1 O8 }# I) W  l& q: n+ Kroutine.
: L1 p7 [1 ]7 s6 }' I( n  h8 ~It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 j6 K8 H% e: p* ]- |5 \to the new routine to execute (hangs computer...). ^/ i- r4 r- R3 Q0 L8 G
5 o( @% w5 f' _2 a3 x5 V9 W# d" f
    mov     ah, 25h
% a$ ^+ t2 B4 |  x' n    mov     al, Int_Number (01h or 03h)- q2 j5 d) d' s: b. z; }5 a( ?' H8 A
    mov     dx, offset New_Int_Routine( V# J9 S; u) V" f8 Q1 \. o+ f
    int     21h, d, D3 g& e5 C$ m$ y
6 l9 o( V) |) t$ W' S. p
__________________________________________________________________________
8 @/ g0 ^9 V9 f' I* n; D" L' y) J( c/ H
Method 09
1 X9 S& W3 Z/ ?4 P# u% z: k8 v=========7 S: w8 e5 c6 W. G
; m2 E1 O8 K6 H5 F9 `
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( V: Z1 @; r) s8 b, u8 }+ f6 W5 Y5 K
performed in ring0 (VxD or a ring3 app using the VxdCall).$ m( q  I4 i# W8 n4 s
The Get_DDB service is used to determine whether or not a VxD is installed4 K1 z5 d: F: Z& f, |
for the specified device and returns a Device Description Block (in ecx) for
% y2 m: F. @# f' q: A- ]that device if it is installed.4 N1 i+ r% p) {

8 g8 C% L, x# E( G0 e2 E$ J, s# [   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 m* a$ S) N& A3 M% F$ J! G$ C. h! }
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 d: H3 m; {8 Q* ]3 e! s   VMMCall Get_DDB
6 f  t$ `$ J0 T7 F* e   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 g7 Q5 o  t) j+ q+ G5 }. A/ z( I" ?. ^; h( F! K5 Q& b
Note as well that you can easily detect this method with SoftICE:
5 G; m1 T1 J! d* Q: h, }   bpx Get_DDB if ax==0202 || ax==7a5fh
, p+ T) e2 Z& R& D: N  I; l, h, b! O7 |- g, x% r
__________________________________________________________________________/ I; u7 N1 L9 e9 y0 w( \) I
' h! w" _3 i/ E' f5 j$ @; P9 o
Method 10" C3 _0 L2 Z  K. Q5 h
=========
% L+ X0 o9 O5 R+ u
% K' H/ q/ g; T5 g1 t  V9 u+ V( r$ M=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 X4 P$ X& \+ F8 e  SoftICE while the option is enable!!4 X- G. e. j' _" e5 W7 D
4 y4 T, s* u. [0 t; J- o. p
This trick is very efficient:
. ]; \8 P$ @. R5 g2 I) @; S; S- wby checking the Debug Registers, you can detect if SoftICE is loaded
. `$ ]6 r6 I7 R* L1 \' O(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 S6 u, L5 Z4 {& x3 c1 Q
there are some memory breakpoints set (dr0 to dr3) simply by reading their
/ H. h1 ^9 [% H5 M3 h. \9 Bvalue (in ring0 only). Values can be manipulated and or changed as well. U. Y. `1 h7 Y( U* k) z2 }
(clearing BPMs for instance)% \* h, F! [6 I

, g' c5 B) K; i4 `4 r__________________________________________________________________________# z/ w, i/ y( {& `( j/ c  Z
, v0 L: V3 p6 G0 _  O/ }7 ]+ }
Method 11
6 D# g' \& v/ m# f. ?4 n6 R+ R=========
7 K' ^# B, _* ~4 j! j4 X9 ^4 J0 H9 ]) N7 e3 ~' i  U
This method is most known as 'MeltICE' because it has been freely distributed& X1 E7 ?/ a; w/ P9 _( P4 T
via www.winfiles.com. However it was first used by NuMega people to allow3 {& V$ y6 z6 e" D) {( ^
Symbol Loader to check if SoftICE was active or not (the code is located3 ~! W/ A+ g5 _/ P8 U! k
inside nmtrans.dll).
) A. J; V( `0 s' m! U. E* |5 D2 P8 ]/ Q  R, g% x
The way it works is very simple:( Y" b+ n& D6 |( W
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 A0 _9 c5 @5 M$ ]WinNT) with the CreateFileA API.  H* s% b5 b/ S) @, q) C! o/ @

& X6 I' J. P; X" A  tHere is a sample (checking for 'SICE'):" ~/ U5 U0 z% I8 Y, C8 U

3 O$ l. R/ p1 S9 P( h* d& z" ?; z, BBOOL IsSoftIce95Loaded()- h0 q! q! X6 Z( N4 B
{
# C3 O/ e! v# d# ^9 c   HANDLE hFile;  
; z: i' F- p! F$ j   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: T& _4 p; E/ z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' V; Z0 Q( w4 R; H& o/ w( Y9 ~                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; E. t) k  s& R- k- ~' K. L   if( hFile != INVALID_HANDLE_VALUE )* H# k" S6 ~" c! Z% G5 {- }& \
   {
: P% h3 i! U# |' X5 u" @- t2 z      CloseHandle(hFile);$ @: _9 d4 T- d; S- `+ x
      return TRUE;$ o0 V( S- Q+ v9 h* D
   }
4 {8 x- }7 v: e   return FALSE;
! d% f+ j; P' X. U  ]: `- F  x# T}
# X7 a" N$ h- x$ b* c4 E( {) N8 J) A9 H- G6 d6 F" E
Although this trick calls the CreateFileA function, don't even expect to be: _4 h. C# R9 O8 c
able to intercept it by installing a IFS hook: it will not work, no way!. y9 u% y# O) }  C0 \' H- w) Q9 g
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 {. S' z( F+ q0 i& b- w  ~0 n
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 y& z4 o) T% F- Q9 P* R" h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
6 Q; \' C; U/ Q$ Q2 n1 H8 kfield.
! r; \3 y( @8 U7 @In fact, its purpose is not to load/unload VxDs but only to send a ) S) |; T9 u. K; V
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 U& T4 I. O+ nto the VxD Control_Dispatch proc (how the hell a shareware soft could try
) \& g5 B, \0 V$ U" i8 pto load/unload a non-dynamically loadable driver such as SoftICE ;-).
( I6 x/ z0 I0 yIf the VxD is loaded, it will always clear eax and the Carry flag to allow
+ l! n3 x  Q$ \5 `* b) Dits handle to be opened and then, will be detected.
( W: c  _9 l0 c0 \+ b2 C6 ?You can check that simply by hooking Winice.exe control proc entry point2 L# H+ V2 r/ Z4 T; o: c, Z4 r% i
while running MeltICE.
7 c, ]3 G+ G( {2 X
; _7 }+ H) }8 \8 W
% v% a2 [6 K7 u8 @8 H  00401067:  push      00402025    ; \\.\SICE  R% p8 g! I# e( z+ M
  0040106C:  call      CreateFileA
9 |2 P8 u* P8 u0 r  00401071:  cmp       eax,-001
) `' i% A- c6 U+ {  B  00401074:  je        00401091! u+ ^: s% B! H' j0 V" G2 F
- E/ Y/ T3 b4 H. R* `/ \0 v

0 |6 a  Z+ J, |& I% jThere could be hundreds of BPX you could use to detect this trick.
+ ~( p& o9 u) J+ _7 n! K% {-The most classical one is:3 B0 d$ ]  {5 A# J9 L
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||7 p! K2 X, x( F, _
    *(esp-&gt;4+4)=='NTIC'  E1 V1 q" W* x* C, K- o
7 x. `6 X; ]. j$ t$ j; {6 O
-The most exotic ones (could be very slooooow :-(
. u0 H1 ~/ b$ f; A- O4 ~/ i   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& m2 l5 Z7 `5 n! `     ;will break 3 times :-(# j# e8 m% ?3 o; [

8 b+ |0 `4 J; b-or (a bit) faster:
6 s7 C6 z2 {7 n( U' M. [. R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 Z* o$ P4 K# z2 t* h

7 T4 [" o* m& W. K) [  q" T( I  h   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 A) B2 i* x% C     ;will break 3 times :-(
" u; C- G. r, z/ I8 `3 `1 k
5 T0 N+ ^6 G8 ]-Much faster:
; M) E0 S6 U7 L3 u   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& W: k# y" g8 p% \+ i% w" G9 m
6 `6 I! `8 ~& g$ P5 O! g7 |- O' [: FNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
" s$ ^) A- W7 e( l$ E  wfunction to do the same job:
* w! u' A* _8 ?: Z, C4 c+ c! |. ?5 o" D2 \
   push    00                        ; OF_READ
/ M4 r8 y( E8 c5 P* L   mov     eax,[00656634]            ; '\\.\SICE',0
! T+ l6 L+ _0 z, z: t4 e4 _   push    eax
+ o9 U4 i/ Q8 D" ]# r, \   call    KERNEL32!_lopen
# m/ _0 l- W# v   inc     eax& u7 X  j# Q# q5 d/ C5 t9 i( {# ?
   jnz     00650589                  ; detected
, M' B+ n( w/ F# S7 \. f   push    00                        ; OF_READ
" a" |* p% w! N3 b0 u/ R# B( P: y- ~/ V   mov     eax,[00656638]            ; '\\.\SICE'0 J; z# v% }6 w* [5 c6 E; V
   push    eax" d3 d) ]- m7 Z
   call    KERNEL32!_lopen$ f) D3 s0 i5 h  F, Y
   inc     eax; E* H/ i9 a3 _  j. D1 v
   jz      006505ae                  ; not detected
8 n3 I+ v! Y# o: s( d$ [( W( [- i5 O& `
/ Q( @3 c9 Y; \" M( X, D8 z
1 K+ ^$ F+ E8 s6 z& c6 d__________________________________________________________________________
& R8 C6 `/ D2 z7 B4 J1 }  r: I! p* n& q' j; p* X$ T
Method 12
5 y6 r" V3 a  {% g) P& \  J9 R1 k. k" u=========
- @1 ~7 r2 ]' Z( @& D
5 y1 D% j( c) Y' i- H& o1 D* rThis trick is similar to int41h/4fh Debugger installation check (code 05; R2 O( j9 b* }6 U; E/ j
&amp; 06) but very limited because it's only available for Win95/98 (not NT): L0 Z* T0 A8 W; h4 w3 K4 w
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* W- }! a5 s9 A9 y
( {1 t& M& T8 J4 v  U1 h   push  0000004fh         ; function 4fh
' _8 S8 ]' S+ U, W- K- _& n   push  002a002ah         ; high word specifies which VxD (VWIN32)
# i- _0 A: o0 f9 k2 s                           ; low word specifies which service
8 e- \. d. E3 S; Z2 R# \$ A                             (VWIN32_Int41Dispatch)" g- L5 i, K0 q
   call  Kernel32!ORD_001  ; VxdCall2 J6 k+ J% z* S, I
   cmp   ax, 0f386h        ; magic number returned by system debuggers- B) z4 A% {2 h* C
   jz    SoftICE_detected! Z4 p! }4 C2 Y6 k

/ ~& F& ~4 g2 u' mHere again, several ways to detect it:3 t' E0 n# q/ D( l; F& l
- f/ w$ E) y' Y9 x6 n9 E! n
    BPINT 41 if ax==4f& Z& q7 N+ {8 q3 \  J# M* y

9 {" e5 F$ n$ ]. |* j- X* x    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
# ?& l/ p2 J" F$ R2 s8 Y: X- G# N+ E7 c+ y' w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 C; R5 F* `/ y6 Z% E" s
: Y# r+ Y! t2 E$ [' v" l2 N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ ?; o! z) S" k9 {1 m* F( D) ~* @! f9 Q
) w8 U0 H2 k# ^2 G" G( u# B__________________________________________________________________________
1 V6 c6 k: F2 T: s6 t
0 L4 o, I# m- EMethod 134 K- d0 Z! i/ [( a0 s" u0 H
=========4 G5 s0 T2 j. x5 Q' J
& P$ N2 A4 F; r$ e2 \7 M
Not a real method of detection, but a good way to know if SoftICE is5 Q1 W4 ~/ k8 X8 J
installed on a computer and to locate its installation directory.: u% l0 Y) w' S2 c8 @5 H3 ~9 y
It is used by few softs which access the following registry keys (usually #2) :% d: W6 x6 @9 G% j1 z( _' |

% |# j3 ]/ k$ d2 k-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* `7 F9 ?3 u" e& g\Uninstall\SoftICE" |: ?: Y+ O, y1 k6 i
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ G1 S9 w% R" k7 n3 f8 U-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& O# v0 |/ M( \6 H8 y
\App Paths\Loader32.Exe+ u7 T, \1 c' {
9 Q; Q4 Y9 }. b# J8 E% e

8 d7 A7 h( B* g7 b& w8 XNote that some nasty apps could then erase all files from SoftICE directory
# {2 o2 ?2 n0 o' N(I faced that once :-(
9 S" T3 H2 [; d8 s- ~7 q1 g6 w. k# Y, T5 R# X( w, p" s7 Q
Useful breakpoint to detect it:! @  z: X6 V5 E8 e5 O

- s" T$ x4 W6 O     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'6 T3 @$ l0 E6 {2 E8 R
1 V+ V1 k( P( j
__________________________________________________________________________
& q; C, l7 _: P: E* F& o8 f5 V2 o0 K- w8 N
! h  x/ l/ e% e5 w& w& {9 Z
Method 14 * Q, L. v; e  L$ \6 H3 X
=========
9 H: s  I7 \5 f8 ~  g7 q
" w$ Q. ^2 }* VA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 n3 [4 l# g7 [5 u
is to determines whether a debugger is running on your system (ring0 only).' |6 n/ G, ?7 w+ u5 {
- W2 h2 v+ c1 e6 T* C& F+ I2 R
   VMMCall Test_Debug_Installed
! P  [. Y& y; V! A4 M   je      not_installed+ i0 g  n( ?) a0 V
# l4 g$ Q2 x  u# g- Q- ^
This service just checks a flag." v. o( c1 n. q* B! v1 B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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