About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
- j5 a: [# A- Z% {4 ?: ?' _# ^: I( ?<TBODY>+ F, W4 Z8 A: c) P
<TR>
& b0 C* E+ F' |6 V( g- f<TD><PRE>Method 01 8 Y+ X. l( \4 _; Z0 ~
=========  g- L9 ~) ?" I% d6 b& c
* v* \( W. a+ [" Q
This method of detection of SoftICE (as well as the following one) is
6 V% G/ }% ?$ ^9 N4 y2 r( zused by the majority of packers/encryptors found on Internet.
' }4 g7 N( d# ]: HIt seeks the signature of BoundsChecker in SoftICE
6 S' H; {# X# s/ G, L) n' \, {; ~: S1 r6 O- K% v& h% J" s' E
    mov     ebp, 04243484Bh        ; 'BCHK'
* r) @3 f* D: @, F" B: S; e    mov     ax, 04h
5 {) ]9 ~& I2 {2 F4 y# B- L    int     3      
. |. H) D& R' f1 N* w8 f2 ?9 e" Q    cmp     al,4$ w; u+ s% W) r6 K- h* Q  S
    jnz     SoftICE_Detected
) N4 R/ `( z) E0 A- D  {$ @$ i) y' V. P
___________________________________________________________________________
- D4 a* E/ Z! V6 E
. z5 ], O1 q6 K0 P) s- CMethod 021 H7 T1 Y, L- m; Z. p
=========  V! B: [7 l- M

/ e% x1 P: V* D" j+ b: E) pStill a method very much used (perhaps the most frequent one).  It is used* z; O# s' f# r6 @) l0 r6 B
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 i  p' a$ J) r
or execute SoftICE commands...
3 A7 ~: Z: ?/ v( w5 G. I' \  QIt is also used to crash SoftICE and to force it to execute any commands
; l6 w/ B$ G# U8 W1 e  w* ~(HBOOT...) :-((  
. U# ]! i# z4 q: T2 w" E9 A. P# A# m1 z' x8 ~/ x. y
Here is a quick description:
, w6 Y4 W0 b$ h4 }-AX = 0910h   (Display string in SIce windows)
% m; I; j4 `9 i) ]-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
$ v  N2 E9 z$ l# w-AX = 0912h   (Get breakpoint infos)1 s, V) t/ K9 w" G% E6 p  Q+ q, X
-AX = 0913h   (Set Sice breakpoints)$ i4 d" g4 |$ `. f; e- t
-AX = 0914h   (Remove SIce breakoints); W3 {. I9 r( S& ]

# F, l" I) n' ~# ]8 u1 H/ z9 hEach time you'll meet this trick, you'll see:
' C6 w5 ^$ e' Q. o3 H-SI = 4647h
* r+ Q+ Z# C/ n! D" `5 }* K& N7 O, r-DI = 4A4Dh
# a0 }, a3 u6 w% D5 ?& UWhich are the 'magic values' used by SoftIce.7 M: K) x; _5 f/ K/ K
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 ]3 X9 R; V) E: n
( `) u, `/ ~' h4 n5 `
Here is one example from the file "Haspinst.exe" which is the dongle HASP
3 A% z* a0 H  C% ?Envelope utility use to protect DOS applications:
; T' Z0 i3 f( B! l5 P2 X5 m* A2 I1 U1 @$ ^; X. b

- m. R  E- I: v' L. I, |0 f4C19:0095   MOV    AX,0911  ; execute command.; U! F" f. A* D" p
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. ?0 ?% t' v* {0 m: k
4C19:009A   MOV    SI,4647  ; 1st magic value.
' h: J) B5 g( J0 O4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! f9 T  \5 [. O- G7 q. j8 Z& l
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' K" d4 f) K- {8 D; r
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
( j; ~) Z( N* C% S. d$ S4C19:00A4   INC    CX
* [7 a/ B* {  p3 ]  y3 g. }: Q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
5 Q  D3 c; V% h" J4C19:00A8   JB     0095     ; 6 different commands.) d: u* D1 ?" G+ n  b+ q, o8 {: F
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% c# @) e# }  h: h* b' f! p4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 m6 {0 @, q- ?2 |2 [6 V$ M5 b7 R4 @$ l5 d+ l8 q3 }1 {& L
The program will execute 6 different SIce commands located at ds:dx, which. p& S" X/ ?. y/ C  F
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ o1 G( j, o+ d# ~6 k8 D) }2 F$ z% O% B/ y. C! @0 Z& \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ t% L8 ^/ R) k
___________________________________________________________________________
/ A/ D+ \/ ?: x* V5 |+ U/ B) X% F

9 V$ v7 ~, J# |8 v4 ^# ~Method 03
( \% ]6 Z5 E; v/ F$ E8 V2 Z=========
- T: {$ q& r! u7 m; k( J
3 o+ y/ P4 e+ M% N- y2 H! W. y4 ^Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' y. k( \  _0 G% M: F; y(API Get entry point)2 n7 Y) s: _" d
        ! P$ N& B9 t: H" K. @

. u) P) x* V* {! x    xor     di,di
6 o+ J! S* V: H- m2 g7 {1 {    mov     es,di
; L. A. y; |; I. I# g+ Z    mov     ax, 1684h       6 V% g3 M7 o  B  k* i% p. x0 j
    mov     bx, 0202h       ; VxD ID of winice
* n5 ]# @  W, F! }# P0 n    int     2Fh
4 h' G& H' o! V3 \% a1 b    mov     ax, es          ; ES:DI -&gt; VxD API entry point( H2 M3 x  M! i. d
    add     ax, di
4 F% G& O8 w2 A' v# h4 @8 [* g    test    ax,ax
- ]- h/ d2 B+ _  u    jnz     SoftICE_Detected
( j8 v' F- V( }; x5 C  b) ?6 i
; g7 r$ @" Y: l' d1 S4 O5 {# o. T$ }! h___________________________________________________________________________+ i8 W+ \9 @6 F, [+ ?' o* y7 H$ [5 x

: O4 w: V- ^, b' U8 xMethod 04
; c- [- X. w/ `7 T=========
. q9 `* Z8 I5 c6 n5 V* e0 B3 I$ F) M3 P. x9 K
Method identical to the preceding one except that it seeks the ID of SoftICE
# y9 }4 V% H+ O8 |GFX VxD.1 T& d8 j6 b: |

$ _8 y# ]( I* x6 N) Y    xor     di,di
# h8 T; `/ Q9 _$ s) {# P    mov     es,di
- {; c* v7 e; m3 e) A. r: X    mov     ax, 1684h      
! z0 z8 }- T, H7 y9 f, k0 V9 \2 w    mov     bx, 7a5Fh       ; VxD ID of SIWVID
- Z2 v) [  a4 r5 I9 f    int     2fh
. Y8 w3 `+ A, S" r$ ]. n% n' n    mov     ax, es          ; ES:DI -&gt; VxD API entry point& c. q; d1 l$ W1 [" x" ?6 ^! S& P
    add     ax, di
- h7 B$ S4 Y' s7 i. x    test    ax,ax" i5 p! L/ P% e/ M0 p9 j$ m% d
    jnz     SoftICE_Detected  H+ t5 |5 _# p* u3 v' P7 \; U
8 @  ?: o3 w; c: H4 z
__________________________________________________________________________
. a! P. N+ {3 O4 K0 l( v$ W. S7 F2 J
2 l" F5 D* b# k" o
Method 05
9 A2 z# D7 a6 _, o2 ]1 [9 C=========3 \) E0 @8 ^+ ~
0 J* @+ P1 u- F7 Y, k( e6 J
Method seeking the 'magic number' 0F386h returned (in ax) by all system
; {9 m7 O9 Y0 idebugger. It calls the int 41h, function 4Fh.
% ~* T; P$ n9 B( Q: V$ BThere are several alternatives.  * t, o7 h4 C" p+ ]1 T4 {

: ~3 z2 a+ {% c$ R$ _# l7 c1 P1 GThe following one is the simplest:( d  F! m. _; Q

3 f! K* t# {0 Y    mov     ax,4fh
' G+ P# m" z) G1 @    int     41h
3 ~! W6 X  r3 j* c7 Q    cmp     ax, 0F3868 [! W% Y  y2 J# {7 @* V0 T8 Q
    jz      SoftICE_detected7 T8 q4 f9 A6 r" L3 z& C8 t; v" }

3 v2 }( f6 B3 b% u
1 u6 ?5 F  n! r1 [Next method as well as the following one are 2 examples from Stone's , ?7 s% x: W6 d* S  N
"stn-wid.zip" (www.cracking.net):
' n5 G! E% |3 r+ k' c! c8 g1 H0 A
7 X) x7 [& G$ g6 c    mov     bx, cs6 ]- `! ?- I) p# ~
    lea     dx, int41handler2  {& U! _3 Q/ E  ]$ {4 m3 [# c3 {
    xchg    dx, es:[41h*4]7 e9 k% _6 ?5 d9 U- `5 O' _
    xchg    bx, es:[41h*4+2]  u) d9 a& B' X8 \
    mov     ax,4fh( B/ j( d4 a% r& m
    int     41h
' |! x! G+ e) v6 k. D- P    xchg    dx, es:[41h*4]
9 Z' r; H- ^% k: f! a( h    xchg    bx, es:[41h*4+2]
# `+ m8 {2 T, |5 Z    cmp     ax, 0f386h
: p4 ~$ ~3 z8 H+ k7 ~/ Y    jz      SoftICE_detected
0 a4 E  \  x  a. \- ?. T. |) W6 L" F+ j, Q3 E
int41handler2 PROC9 c- m4 U& v# l0 Q5 I
    iret. v0 w4 L! C/ {/ g+ o5 `
int41handler2 ENDP, A' q* S' B% i1 ]4 }

3 Y9 e+ \7 }$ M3 _& q: m
& e' x0 F+ b0 D9 M2 e2 z2 d_________________________________________________________________________2 J3 T( _. [' [9 z3 p) }& c

, t% H& X+ k/ u: d# ]5 `  o$ _( m2 d# ~9 l7 A
Method 06( a  _2 q3 y, g) _4 F% I
=========
1 g8 o: I+ ^, O! V) w, |+ m1 ]8 x* U  N

. o! M# o6 {+ d' Z7 M; x7 ?: k2nd method similar to the preceding one but more difficult to detect:6 Q) Z  M! \. |/ g/ ^* c5 ?) U

  T1 [/ w8 ^7 G, C# g% }
, D0 q$ I5 ]  `% o5 u* U( I. tint41handler PROC
! d' j" T! ]3 I* q4 E6 J- E2 w: N% Z* r    mov     cl,al
9 }* c& i, }( a7 s* |$ T    iret
% x! v: x/ N* I$ {int41handler ENDP
7 }( _/ t, |+ I5 @3 D9 q4 e4 a
( ^" Z; T# O# Z! e$ F, v; w" Y# K/ C1 S! P) Z# \
    xor     ax,ax
6 N/ m1 N5 y6 `6 j# p    mov     es,ax! T8 N" \& Z6 y
    mov     bx, cs4 P! m' \3 x2 S3 Z6 T( q
    lea     dx, int41handler
( L/ I% m7 T- a7 p0 ^7 T    xchg    dx, es:[41h*4]
. Z2 b: o2 w3 }, y& [$ H8 c, I+ @( h    xchg    bx, es:[41h*4+2]& W9 X$ U& c4 J% ?2 {
    in      al, 40h
2 `* g) O/ w4 R$ W    xor     cx,cx
5 n& ]( c2 m5 ?& i, Q    int     41h
, `: [6 j! B& x; A$ z; q' v. n0 e    xchg    dx, es:[41h*4]  [; m# P7 b7 a; ^
    xchg    bx, es:[41h*4+2]
5 K7 b( }) ]4 ?: q3 Y0 b" O    cmp     cl,al
+ J0 |- H: ~" O! O$ x    jnz     SoftICE_detected
; i$ ^/ w1 s4 ~4 Y+ t* m0 t  k* J* W5 ^. V' t: G% {$ w
_________________________________________________________________________
. a2 I/ @# y  n
6 m1 B/ Y3 Z( Q  pMethod 07
" W# S( j# D$ h# E; s! `=========
3 X# r. y: b/ M* e- c7 x+ H
3 H$ ?- K; p9 ]& ~$ `: D3 aMethod of detection of the WinICE handler in the int68h (V86)
9 W& n% B$ H8 \: Q" z. J0 m# s% \5 D& D5 c5 w! O
    mov     ah,43h0 k" q( X& G8 K  Z, a
    int     68h
% N2 A/ M$ R5 T; \  F4 o5 P4 n6 b    cmp     ax,0F386h& M6 ~. i' p9 ]* l% {: |' U6 J
    jz      SoftICE_Detected" C+ d! A, ^5 k" {' `1 O4 `0 T

: d8 U: x$ x. Y$ k  l% t; m7 }0 q
& U, z! k2 P/ ~- i=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ }' d% s: O4 x9 |. O
   app like this:
, A8 ]1 V2 H2 z  S  @4 u& T4 _+ e9 e9 b8 Y7 A; N* E2 l
   BPX exec_int if ax==68
+ F2 f; i3 G& p# N# E) S! s   (function called is located at byte ptr [ebp+1Dh] and client eip is
) A9 h% G$ B6 n$ K   located at [ebp+48h] for 32Bit apps)- u/ a1 p" S. O$ W6 H5 w
__________________________________________________________________________) ^+ h7 W/ Y; Y2 ^  c3 v5 \" x1 E

* K/ y7 h  g: g! K! R
: _/ ~: `9 d; rMethod 086 w6 Y2 T  i8 k7 O) D$ Y
=========
6 P4 y$ L" ]2 A, X% K8 G9 K4 Z' Q) K/ q+ }1 _8 Y" u
It is not a method of detection of SoftICE but a possibility to crash the0 K- x' b. T2 ~% n1 b
system by intercepting int 01h and int 03h and redirecting them to another" {3 X  E/ R' i0 W" {
routine.
) D2 n- _7 T( |$ ]It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% x, l9 ?/ `  @9 e4 I; Ato the new routine to execute (hangs computer...)2 t$ q$ g5 B' ^* @

& e9 O9 q0 J. ?, ]" `5 E    mov     ah, 25h
4 d, f  ^/ s0 T) v4 c! y    mov     al, Int_Number (01h or 03h)
* G! m6 X* h; H7 c+ K' N& \" u    mov     dx, offset New_Int_Routine6 u! Q, ~/ Z7 W& g. K- [0 j. k
    int     21h
* i2 B, T, l, X+ ~2 |* S
' A3 |1 w/ J/ |7 ^) O9 i__________________________________________________________________________" o4 E$ S6 p9 K4 s
' [# @+ ~0 y0 ?7 b
Method 09
& y% z9 U, \: k+ a+ {+ l=========
5 N. d6 p1 C! n2 L0 ]+ T
* G5 q3 S! T6 ], y- ~& R$ d; v  WThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* j, K& z! U+ {* M* Iperformed in ring0 (VxD or a ring3 app using the VxdCall).) p, d2 }, r, X
The Get_DDB service is used to determine whether or not a VxD is installed
# c& A9 v; M7 f% q  E9 ~" cfor the specified device and returns a Device Description Block (in ecx) for
" B1 u! f. C, Q5 t; i3 Hthat device if it is installed." [4 |0 n. a6 z4 Y7 n
: J) C/ P% d, w# L8 H
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID  x- F* ^: o% K8 s
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)( l. J8 _3 n0 [2 o/ N
   VMMCall Get_DDB5 w9 X/ m% f$ X; b6 M- D0 d+ Q) E
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' v. b8 ?1 i) q. x" U9 A3 g# g, W1 c# O) [
; L! R- P, T. v: m& C* @3 X2 YNote as well that you can easily detect this method with SoftICE:
# V: d* G8 L6 X' s; J2 g3 x( W   bpx Get_DDB if ax==0202 || ax==7a5fh* k# e1 `& ~, M: `' ]

4 N4 G: z' S% T- c+ C+ M/ }& a5 l__________________________________________________________________________
, M6 p6 q! \" u( \% N
6 V: w5 |; Y1 w7 w9 |4 k" `6 t  HMethod 10% n" H7 \4 u6 Y3 ~
=========
2 k. h9 f/ S( p
1 d& V9 v1 A7 v! d=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) t6 \" ^. V; L* \  SoftICE while the option is enable!!
0 m* o  F# W1 Z
2 M5 k  x, o+ E. i; [This trick is very efficient:5 e$ x& x) k0 Y
by checking the Debug Registers, you can detect if SoftICE is loaded. T2 T: \1 H: ^% R' g5 p8 [
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 i; E! H) h0 I( Q/ w2 B* l( a
there are some memory breakpoints set (dr0 to dr3) simply by reading their' K: U! v8 d/ ?/ i- h7 ]1 F6 |
value (in ring0 only). Values can be manipulated and or changed as well
7 q4 m) l, [3 u. U3 D(clearing BPMs for instance)
9 ~$ R8 O0 y. R. n9 E( d& V& k0 x/ O4 p( w
__________________________________________________________________________, j; c7 e. C  i6 n. L  H
. M0 j* N/ v# n6 h
Method 11, U$ `1 C6 u+ o8 V+ d3 M
=========
# q' H# J: b% c; ?) J' c/ v: j6 l# X2 n  ], w7 a- V; k8 B
This method is most known as 'MeltICE' because it has been freely distributed: E% i' g  O1 m0 O: Q
via www.winfiles.com. However it was first used by NuMega people to allow
# X  y5 ~5 {- R9 \Symbol Loader to check if SoftICE was active or not (the code is located
( X! E1 _4 Q7 w* iinside nmtrans.dll).' X9 }8 u& c, ?

4 Q9 z$ x% R+ x- O. [The way it works is very simple:4 M& f/ v. l  E/ g8 H( M
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
8 B9 V+ m, e8 |WinNT) with the CreateFileA API.
. g# ~+ S* P3 H; \7 M; A  ~. L& ~
5 i. O/ n% N, t# |, ]; E  sHere is a sample (checking for 'SICE'):
3 ]5 g6 e  J$ J! H/ s) M1 l. ~" x5 `5 d$ D6 j
BOOL IsSoftIce95Loaded(), s8 F4 M: x8 N! C
{; ?8 ^+ F, y0 h. v3 b
   HANDLE hFile;  6 e& w( }4 U0 w/ q$ x% y) U
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% a' T! F" A$ D# j. p
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' k4 a: t# p! U& R; w" _                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 v" ^- T% s/ i: D' t   if( hFile != INVALID_HANDLE_VALUE )  ^# k) i% x: J7 f3 o
   {
8 Y. _& U$ U8 \7 K* u/ f) u      CloseHandle(hFile);4 x9 R# u" P5 J8 {* o
      return TRUE;0 ~! U- f' M- {0 ~) O
   }
" w2 m" I# T/ b- g8 b   return FALSE;2 M5 Z9 K: a7 r- z! x$ k
}# R: \* @( f' O: ^) i
7 R  w5 [) W- T' t0 K) e; `
Although this trick calls the CreateFileA function, don't even expect to be8 {6 r% R& G( T& Y8 Z8 D
able to intercept it by installing a IFS hook: it will not work, no way!4 C8 x+ O9 A% E- Z+ k# z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F) b# G" O- \9 S- l' H8 w8 P2 `
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)  l) x) L) L6 x' _$ J" F4 h$ c
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 P- j3 A2 z4 G8 o0 D" J$ n
field.
! X$ w4 E4 K" O3 b5 A. r1 JIn fact, its purpose is not to load/unload VxDs but only to send a
- F9 q) v. p( N" }1 Q5 _7 AW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* N( @& D8 I# h2 ?; j; j# L
to the VxD Control_Dispatch proc (how the hell a shareware soft could try& U! |! ~3 {. m1 I- d, G
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ L/ m4 q$ W3 {# l* RIf the VxD is loaded, it will always clear eax and the Carry flag to allow
- Y2 l6 b4 R. \' E9 Hits handle to be opened and then, will be detected.0 d$ b3 F; ?8 w3 ~" n- V
You can check that simply by hooking Winice.exe control proc entry point
# C) X( J' ^6 X0 {5 P% Qwhile running MeltICE.
( t4 C. A2 P5 @' c2 C$ U, q. W: {6 q& }* K) j) k& F+ Y/ ^
) B2 i3 K" f0 }7 W
  00401067:  push      00402025    ; \\.\SICE2 b! V% u7 U5 C$ V4 r% a
  0040106C:  call      CreateFileA' s7 u$ z+ A0 ^5 e: |+ g. m4 q9 L
  00401071:  cmp       eax,-0013 j5 g+ {0 h# f! k$ R
  00401074:  je        00401091
1 X( {& B, Q! b' }" \7 E4 @& `: u
! ~$ _+ T" f' @- o; k# P" ]  O' b/ b9 j# V1 K0 Z$ f: S
There could be hundreds of BPX you could use to detect this trick.
/ e; n" o2 o% x( E# r( M/ h9 t-The most classical one is:7 z- V# K1 i& Q- \0 L
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||# u# N7 p  `& R2 W
    *(esp-&gt;4+4)=='NTIC'
( N( t6 a& H* Q1 I/ T- J1 m8 i9 i# Y  N6 t) ]5 e# d7 |( M
-The most exotic ones (could be very slooooow :-(( w: U. z& G( X9 ~
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 r# L  i! C) w$ z     ;will break 3 times :-(2 i  S6 o; b# `' j

  ~4 X% v# `/ Q; h-or (a bit) faster:   [* U, ^4 L: x) ~
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 m2 Q# u8 x- ^
1 T! V9 y0 B2 }) q+ C9 ?$ D   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'    N: E) A4 M. z$ r! b. C
     ;will break 3 times :-(
1 G* e- s1 a; p+ {, B, l: h4 r6 a2 Q- `( c) \/ M
-Much faster:0 Q* h* |  y' m9 m3 |' ^
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' l5 [" A0 q- B8 x- S# X' C! W& f$ [# J2 h* O
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# E4 Q7 p2 C  M) M+ r/ r' F
function to do the same job:
+ [: M4 p3 m2 F; f, H1 s, ~" r0 L* r( n
   push    00                        ; OF_READ
3 ]6 D* j, l7 X3 A$ w) X% ^- ^   mov     eax,[00656634]            ; '\\.\SICE',0
. ~* q/ h& l8 {3 z   push    eax
9 P2 l& Y7 q6 _' a+ t   call    KERNEL32!_lopen8 D1 B  K- x2 X4 b- ]) f
   inc     eax
% m3 e" t# B' j/ O2 Y   jnz     00650589                  ; detected
$ `: H# k/ O0 \4 }3 C   push    00                        ; OF_READ
# @' V" O8 U" U2 o* A$ z   mov     eax,[00656638]            ; '\\.\SICE'- S& i( j6 |9 X, s
   push    eax
! P4 [$ I; q+ c+ Y1 Q7 j+ c" ^0 Z   call    KERNEL32!_lopen
/ w# L+ m$ T- j3 Q. |+ [/ L   inc     eax: f* T- E  J1 b2 m# I
   jz      006505ae                  ; not detected
& }! {+ K. ~" ^2 H/ t+ O, h% U* u& ~) t, _; D% R, k* E8 H% L% z& D
4 A8 S7 X: y% R& k9 W. A2 H
__________________________________________________________________________
0 c( p7 O, N1 l/ `+ P  _2 J
( f+ E7 [  z7 u6 w  d% s9 |  @  QMethod 12
( X# q  k& }! w; _; m9 K' d0 ~=========
: s* G& i' G0 M
' _  H  t* n: F3 M" J) @0 CThis trick is similar to int41h/4fh Debugger installation check (code 05
! u. T, R* \& O4 V1 m&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 S) ]* I( S' Q: Z  }/ Q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.) S' |) d. z& X( B* U# x9 Q! \, ~6 S2 w
1 `+ e. l: u: N- H4 X
   push  0000004fh         ; function 4fh. r* ~# M! m/ m
   push  002a002ah         ; high word specifies which VxD (VWIN32)3 T& \& O+ b- C3 D
                           ; low word specifies which service
. v2 G# @# d8 y7 b. g                             (VWIN32_Int41Dispatch)/ z4 M6 Z7 G7 |
   call  Kernel32!ORD_001  ; VxdCall
  }9 q3 [! l$ H: `- D   cmp   ax, 0f386h        ; magic number returned by system debuggers3 r# n3 _6 V. M2 n- C
   jz    SoftICE_detected8 q5 O* a% ]* ~# X( m
, h' ~- q+ T& g# @* v; m
Here again, several ways to detect it:" F: _0 |4 f, |2 N$ P  [
+ X6 @4 m" C8 W2 {
    BPINT 41 if ax==4f
. ]; ?" S! P: f8 w
6 @6 a: @3 X  ?! F: f+ l6 N; C    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ C0 [* z! v0 k% W

! X6 ^+ L$ ^+ z7 H  q! h3 J- a0 }    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" ?4 H$ e7 Q; n5 v; Y

6 r* Z2 d2 J$ B$ E6 m3 ?6 {6 o, i    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! }& e3 V2 J5 Q2 P1 }
6 R9 d$ h: D3 |1 X: R& N6 W
__________________________________________________________________________9 D  h2 f; H' @0 W! K4 \) E) B/ I

, a  [) Y7 R1 ~3 d3 |9 ]Method 13
' _# r% B0 _. `( r1 Q=========
& z: O4 S  z* x9 `1 R) d' O
7 v! ~% ?' r8 i$ q0 E, lNot a real method of detection, but a good way to know if SoftICE is
. ^0 n  r  u4 l$ {  {installed on a computer and to locate its installation directory.% T. t7 ~/ w2 Q! D# l- l9 A5 [' j% M5 r
It is used by few softs which access the following registry keys (usually #2) :* w: F% \+ w8 V' G5 f( `

, z( i+ r% N# u0 w6 @-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 v/ p8 ?6 Y$ c3 C4 m
\Uninstall\SoftICE3 J8 m' u9 a! }9 u
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' ?7 r0 M6 t; i/ s-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 h3 u! v. w4 w1 b; V; X& |\App Paths\Loader32.Exe8 k7 o3 l, Y! ]  o4 [" B

0 F' p4 H) T' n' R$ L" i% ]  D6 t* X3 I  y2 m
Note that some nasty apps could then erase all files from SoftICE directory! K% t4 F! I& x
(I faced that once :-(
- R2 {+ x0 |! N  f
* |& X# Z" i" f* c; zUseful breakpoint to detect it:
: T, I  f0 }7 y8 P* _6 P4 r" h! q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 s1 O5 |# `" w+ R+ f4 c' f5 D( d$ G# o
__________________________________________________________________________
# e2 l+ @  |0 \- u5 Q( v# K" f* @& {# o; X+ w

1 j  S9 X# t) q: h- xMethod 14
  Z4 q. p1 W  D4 f, {=========
& u% j/ ]8 J5 @6 i% @3 K- T# z; \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) F, N  B7 R+ b& Yis to determines whether a debugger is running on your system (ring0 only).4 E$ W0 G6 Y) q- X) O( H

9 {( d% i3 l- M$ m9 M5 O   VMMCall Test_Debug_Installed% }, `6 z2 v! C% u4 C0 g1 Q
   je      not_installed
3 \3 u5 e& N4 }- k' j' r# s; e3 R9 b0 ^0 S; |
This service just checks a flag.
3 E( E) b: ]: K7 r</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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