About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* e2 K4 P0 |  \  e0 G7 j
<TBODY>8 c  {8 v$ Y6 w( q; I" C
<TR>
0 [/ A8 }+ ]; o, ~<TD><PRE>Method 01 : R3 }# p  L* l9 B. o
=========
, n# g; c* u) o: T  t6 Z# |; I/ ]4 N* o/ Y( E3 C  g; ^7 Q
This method of detection of SoftICE (as well as the following one) is+ Q' {5 |' A# X" p1 m. ?
used by the majority of packers/encryptors found on Internet." O, i6 A: j  ]
It seeks the signature of BoundsChecker in SoftICE
' k8 F6 d1 a; O. b7 ]& q" a# k" H* k' F% a( Q/ Q5 U2 R
    mov     ebp, 04243484Bh        ; 'BCHK'' I! U( I0 `$ s' Q
    mov     ax, 04h
& p# u$ Q9 j7 h/ R; K. N( V    int     3      
9 r8 B( G  ]7 @- e* g# I+ F0 n, |    cmp     al,4
/ l6 Z. t! x, S/ o    jnz     SoftICE_Detected
8 A! t4 W! P. \  N3 _/ d
  e3 H; A  W8 o% e; B. D___________________________________________________________________________+ k9 Y) t/ \$ x

! |+ d+ H# |, G2 f" y9 v3 JMethod 02
  H9 q! N; Z4 p; I=========
$ U3 |. U' R& {1 E/ p$ {* I0 K5 D4 J9 _7 D$ X
Still a method very much used (perhaps the most frequent one).  It is used
/ i7 v8 Y# |# K! K9 b+ [7 @to get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 P; R  f4 S2 M) j( ?  @
or execute SoftICE commands...% L6 S0 p6 `9 C' @+ z- @$ Y
It is also used to crash SoftICE and to force it to execute any commands
3 I2 u5 E1 S9 V  m2 |(HBOOT...) :-((  * R3 }6 |6 \8 h! S9 |4 z" N

# j! x+ J) o! @6 \+ ZHere is a quick description:; {. c8 J1 K+ z# h; y
-AX = 0910h   (Display string in SIce windows)
" L9 Y% h, |) S  t  W+ G3 `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  `& j6 N  G9 k& L" Q9 E1 h( v
-AX = 0912h   (Get breakpoint infos)8 u) M+ R9 W6 ^* ]; M  r7 `2 V
-AX = 0913h   (Set Sice breakpoints)
6 e: ~: m. ]3 b3 K- ]-AX = 0914h   (Remove SIce breakoints)9 P7 z, w  u' |* \3 T% O

- f# P' R; o% x% j  j7 @" mEach time you'll meet this trick, you'll see:" b, J* W" y  A* b1 u, _; o
-SI = 4647h& n* F  `4 W6 E' B1 S( s
-DI = 4A4Dh: b4 r% @% F3 Z+ J$ V9 \0 U/ U. w
Which are the 'magic values' used by SoftIce.) @6 U$ P7 E9 }3 P6 Y8 z# g+ W
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! E0 X; `% E3 s* K+ R3 x" c; J2 Y2 q8 E& e
Here is one example from the file "Haspinst.exe" which is the dongle HASP
; D1 n8 {3 Q$ z* b( h/ z( tEnvelope utility use to protect DOS applications:
$ o. F6 C4 ^) J+ B, J0 x- |. x- Q- p: v2 h+ J
! V" v/ q3 u, n: d. L
4C19:0095   MOV    AX,0911  ; execute command./ ]1 \* j) G" N- U6 O8 Q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 I  x2 i! X( _
4C19:009A   MOV    SI,4647  ; 1st magic value.! Z, N( M; ~3 z% j5 i
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. ~" K, u  W# p5 a4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 n  ]- I( B/ ]6 p# U
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
3 w& n! S1 i: K4 F4C19:00A4   INC    CX* Z3 v6 \7 Y4 t) }8 a+ q
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ X, p( c! {1 z; f- k+ j% X
4C19:00A8   JB     0095     ; 6 different commands.
- N0 k+ K; ]2 D# I1 s& A4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) b9 m+ p" A6 n) u" j  b
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" @4 c* g! K4 W/ b5 b/ W! a6 V

: U, g! c* d! F5 z# \2 g1 XThe program will execute 6 different SIce commands located at ds:dx, which
! }5 G$ X( R% ]9 A4 P- Ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.' S  e! D7 [/ [

# m2 s) Y9 g6 ^( @; D* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.6 U2 }. n/ u' J; v
___________________________________________________________________________
. r1 G4 k) d( ^' O
1 D6 r6 g- L3 A3 T. D! [. v* y/ A; w- L
* Y: W% N) b3 d* m- BMethod 03
7 W/ X! q2 V  ]2 e: f# M=========, ^( ]0 S) F( U4 f; V8 e# @1 w+ W

9 P" s- H; B5 T7 A# LLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h$ p7 F3 G: I/ F3 V
(API Get entry point)' Z( _0 d/ F8 a2 k
        6 ?3 n9 ?* Q* T. a
6 V* X7 a$ x9 P7 v
    xor     di,di
; t2 q. Q9 [. e+ H    mov     es,di
1 j9 {/ f! x+ j0 t; B" }0 V- [# B    mov     ax, 1684h      
7 K! _. w7 M/ S& j6 k3 ~    mov     bx, 0202h       ; VxD ID of winice
; b/ ?' B0 I; n) c# x    int     2Fh1 c! e& p. z6 s% w% e8 h9 p% H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, C2 a9 Q8 X: y# m    add     ax, di
/ E1 o0 n  z) K, o' X, J2 p. I1 k. p    test    ax,ax
# o  x; ^& O& |8 @% |, b    jnz     SoftICE_Detected2 z* ~! u  ]+ G6 O) G, I

) v5 i  g1 R- V, u; y___________________________________________________________________________$ S8 B& t% ]8 y! i9 k# X+ ]

2 V$ T' F, `4 O5 m$ A' s* aMethod 04
0 X) _" F7 h; F1 E( d# O3 o# H  H=========
  k; W2 d1 ?+ T( }
" g* v. ~& ~3 y( P5 h1 ], u8 {5 JMethod identical to the preceding one except that it seeks the ID of SoftICE, S' @5 {, |( X9 X# I. @' T
GFX VxD.
6 L: }9 [' T# e" G* h( p5 {- _9 `3 i1 Q8 P( Q0 c- \
    xor     di,di
, D( Z- U  t9 z    mov     es,di  ^( U0 ]1 a8 z0 d$ u
    mov     ax, 1684h       , w8 j, r8 A1 h! F6 l
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( q/ f0 V) f: k+ s7 n    int     2fh
5 l/ I  x! W/ N* s& x5 I    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# O) s) \" B5 b    add     ax, di* {9 ]7 F: g3 D% h' R9 C
    test    ax,ax! H- T+ K- }! ?+ }3 {# t- F/ \
    jnz     SoftICE_Detected
2 d  t' {6 @+ ^/ C- b
1 a/ e" i" n0 Y+ ___________________________________________________________________________
' M) d9 a+ a- k; [# Y, ~% s. i, |% N1 e6 d3 ?
/ b9 B2 n* S1 }& H
Method 05
* N8 `# a3 [1 C5 k% r=========6 e. F: g( Y" e4 M" J8 W8 O+ c( R+ R
+ S( ~$ K7 h& S6 \
Method seeking the 'magic number' 0F386h returned (in ax) by all system( d% e; e' Y- Z( a0 _5 n3 J. s
debugger. It calls the int 41h, function 4Fh.; `" x" G! R6 s* o$ g7 a2 \2 R2 J& ?
There are several alternatives.  
$ W# U( u+ e9 z; c3 G3 z8 o8 z2 {; o5 r9 D9 ^
The following one is the simplest:6 K1 t$ x! c# f. N% }
. _# n) Q' _% m# n
    mov     ax,4fh
; \. M5 A8 H+ z# F  |5 ^8 A    int     41h) ?$ m* C6 ^* C* B0 U
    cmp     ax, 0F386
6 C" P' ~# B/ I! _4 ]/ ?0 a    jz      SoftICE_detected
8 b' s0 p& r) U0 w3 I; L' L6 I; }

' s/ H  s) P5 w2 _; L+ z/ `Next method as well as the following one are 2 examples from Stone's
5 a3 {4 h6 D0 C, a1 p"stn-wid.zip" (www.cracking.net):
/ Z, g/ f6 ]: E0 ~9 \5 V3 L, {- O* d6 n3 O8 h2 r4 Q
    mov     bx, cs
; v! z1 A/ _* K3 c* y* m    lea     dx, int41handler2- t$ W$ U3 e- N6 n# m8 Y+ J, I
    xchg    dx, es:[41h*4]" q9 I. }' S1 \5 D
    xchg    bx, es:[41h*4+2]5 Y4 N# P" n% H, L6 w9 j
    mov     ax,4fh( {4 v5 ?5 J8 f- S! a: r' _/ n7 j
    int     41h, F3 r' g7 J' g. v$ V1 @
    xchg    dx, es:[41h*4]
" b+ G: B% I+ I" t    xchg    bx, es:[41h*4+2]' c& }( F! \( Q+ M( ~. e4 H/ d: r
    cmp     ax, 0f386h
( I( o% h# o# P  l    jz      SoftICE_detected1 P, N$ M7 K& b

  e6 I. u% k1 |+ E' v4 x, g8 {8 Bint41handler2 PROC% @5 z/ a/ N4 W/ g( C0 q3 c
    iret
) J3 ~% Z3 _) I  p8 d& Xint41handler2 ENDP
$ E* u5 K8 F0 R5 k- W7 c% l' s# ~- x  U$ N+ V! _
9 `' x, n- {: z3 M) \$ M
_________________________________________________________________________
; x$ y# ~8 }( Y
# ^6 u6 m" c# @6 X
5 p# M2 n5 d6 y5 M- WMethod 06
9 Z% L( E/ e* L' K=========, W& d' ^; \3 g  n+ {  R; i1 H

$ t3 H$ `$ V, Z- a/ `$ F3 y0 \- B/ n# G  A; @# e
2nd method similar to the preceding one but more difficult to detect:9 B4 \/ `) V0 Y9 ]- z
8 Y1 K7 V1 `/ U6 s

! Y/ z4 `' {5 Z% Wint41handler PROC
, L; W3 J. o; x- B6 X4 B    mov     cl,al
, \4 m" e0 s1 [8 O7 i) a    iret. ~9 L9 B" y* p- I9 c
int41handler ENDP
" \7 H! E6 q8 y9 }4 H0 x1 I6 M5 ], u. d

. {# d/ s/ E# N6 B7 ~1 p$ b    xor     ax,ax% i$ K% B9 u+ v  \% T8 s1 P
    mov     es,ax
+ R1 w% E3 x" W, R  q: f% g6 k    mov     bx, cs
- O1 ~5 _  `) @, q# [: d# T    lea     dx, int41handler
9 T( s8 `& x! |1 R& ^    xchg    dx, es:[41h*4]
7 e$ X7 B6 k" r- T  @, C" Z    xchg    bx, es:[41h*4+2]
. C) w; a* W7 y3 O' D    in      al, 40h' x% M! }& T4 B+ s  E- |/ c
    xor     cx,cx
& ]+ y6 r. p3 `4 x" l    int     41h4 J1 J, D1 y* a  d/ H
    xchg    dx, es:[41h*4]& j' w; t. T+ L) i; w: W
    xchg    bx, es:[41h*4+2]
. y, u1 _) T# m  }0 E    cmp     cl,al1 o& B+ i; O- t! k0 W/ ~
    jnz     SoftICE_detected. T  [4 G4 _/ P. p

4 d" `8 x# ^1 ~) x: T' H_________________________________________________________________________
: A  m- L& p1 o. S
: M' K4 ^6 E% q9 O1 }! M' U) dMethod 07
3 M9 I$ `3 b$ m1 ]3 [6 N=========
1 l! Y- G% |+ d- Z7 N
+ |7 V+ h7 G; A, S) z# b( k" tMethod of detection of the WinICE handler in the int68h (V86)0 [- d# N& W- r8 E1 r
6 }* A5 \' d3 H# @
    mov     ah,43h" B/ Z; K1 N# w# L# H' W0 s+ P' [
    int     68h0 D! t" L" L$ o: ]
    cmp     ax,0F386h2 H5 b2 X% ^0 |
    jz      SoftICE_Detected
6 j$ V0 h8 h3 W3 e+ E" X; R6 q% A
# c: |9 a, R# y4 ?: |5 n" b
9 ]" K9 m  I% E=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
, G# E! B8 p4 r7 p4 r4 Q9 z   app like this:) g$ ?* L, u" M  |# n8 B7 @

+ a8 M3 E( a0 R0 r) Q# M   BPX exec_int if ax==68# O  m* }: w8 i; i3 I, x
   (function called is located at byte ptr [ebp+1Dh] and client eip is
* a. v7 u; P0 J% p   located at [ebp+48h] for 32Bit apps), O4 b5 x  i7 G( e' {
__________________________________________________________________________9 r7 Z* o, U/ n( o5 O9 J

# W; }6 W' p4 Y) N
# G: E# [) E! B2 lMethod 08
0 Q2 [' U& t& q& f; e% d# X- J=========9 F' `! y% y2 I0 v# H- J

$ m6 c9 I7 V% k! |4 l; SIt is not a method of detection of SoftICE but a possibility to crash the- A1 c6 b$ d5 q% l. Z
system by intercepting int 01h and int 03h and redirecting them to another
8 n2 I0 ^* X0 w8 c- ?6 z* ]9 v! vroutine.& J& X/ t4 L$ N, t4 Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 ~& s! ^- ?! P) bto the new routine to execute (hangs computer...)8 ?( }1 t# y. Z6 b9 E- q

) e6 t& J6 \: z, p* }# @    mov     ah, 25h
! {6 n, O% Y3 p" f$ I$ o( U    mov     al, Int_Number (01h or 03h)
' U. p* s  ^* V0 J  x    mov     dx, offset New_Int_Routine0 O# b0 b" @; a
    int     21h
% E7 U) o* l" m2 J7 K9 @9 _
- }6 }3 s, ~! _  h6 f9 G( W4 V__________________________________________________________________________! E9 g/ j3 f" L( Z( k- |

: G& h  t& t0 A0 {2 Y& aMethod 09
; ]" X$ k0 C" N: @( f=========* Z6 d6 T9 K) {

- b+ D! o4 V& i6 b+ S3 ~This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 O0 D4 S! P5 O) ~* v" d6 qperformed in ring0 (VxD or a ring3 app using the VxdCall).
1 e  I4 _2 ~1 y5 X: @! gThe Get_DDB service is used to determine whether or not a VxD is installed
0 ~+ j3 W( _: C1 U5 \for the specified device and returns a Device Description Block (in ecx) for
9 R- {1 J- P  w2 E' g* Cthat device if it is installed.
; K2 b# e: x; ?6 C* N/ }
/ J* [9 i2 a- b$ x. o; d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) `, l- i& x, d8 q7 L$ w   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
0 g. u9 X( }$ W/ O5 Y   VMMCall Get_DDB1 N2 t+ A3 C' @1 p2 y, w0 D0 c
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* ?6 h9 t2 ~1 w% K2 b( G8 T
' L, ?# V( R) L2 g; L$ H
Note as well that you can easily detect this method with SoftICE:
' W+ Z/ z7 K7 C   bpx Get_DDB if ax==0202 || ax==7a5fh
. T0 S8 U) n7 R3 S* t
" b$ X  X2 \% @$ Y7 J__________________________________________________________________________7 S$ l; S5 f$ o1 q. |9 ^; D( o) n
7 O5 P0 P7 H  d' w  h7 t# v
Method 10
+ G1 D! Y: U' y. K. f8 I8 N1 z=========5 J4 T+ I) x0 U1 @5 i5 e2 D/ o# y7 M( j

  t! e, F' `' P3 t6 D=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) [2 h5 F& i9 t  @( X
  SoftICE while the option is enable!!
; {3 M. Y  [/ i9 O$ M# R8 j- ^; O+ l% r. P3 _9 Q) q6 N
This trick is very efficient:
( S+ r8 d7 ~) M/ ]: H; sby checking the Debug Registers, you can detect if SoftICE is loaded
* i0 [+ |+ w6 }! `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
+ |  s9 K; Q: Kthere are some memory breakpoints set (dr0 to dr3) simply by reading their
; k: Q4 r# ?) a  J4 \" ivalue (in ring0 only). Values can be manipulated and or changed as well3 A1 P5 a7 h! f
(clearing BPMs for instance)
% U! V- E% x. A/ ~) x2 x" i: ?0 _6 K' U# A7 ], w. [% C5 E, g3 O0 d
__________________________________________________________________________
. W& b2 T9 f. J. N& c/ ~9 k! i
% _& y0 [" q9 d' qMethod 11( S1 o2 D1 V) |/ G$ h
=========
' Y" d- z$ ~! `& u
$ Z6 j& W" u! s; V" ~This method is most known as 'MeltICE' because it has been freely distributed
( J! H' p& D# Z" L/ y0 n. Dvia www.winfiles.com. However it was first used by NuMega people to allow+ |1 F, N7 \4 }) D* |5 [
Symbol Loader to check if SoftICE was active or not (the code is located
8 u, K8 a* x; kinside nmtrans.dll).; j$ p! I) ?. ?" V8 {& G2 Y. z
9 \- U* C: y: Y4 \
The way it works is very simple:7 v( x0 S* N6 w% z9 X% i
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! A# w1 X) b8 f' ?) U. WWinNT) with the CreateFileA API.( {# {5 e- n3 M! k. b

- M  M$ R: }6 T% `Here is a sample (checking for 'SICE'):5 Q+ a8 J& I5 \1 V- T+ Q' d. g

( Z3 W# a& _' {3 ]  g$ R: Y. T9 IBOOL IsSoftIce95Loaded()
0 I! l" V/ A" G" e% F: ^{/ y% H' p0 f0 D$ [! e
   HANDLE hFile;  
: D( P8 V5 w/ E4 {1 W" M& w   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& m& ^- p5 R% L! v                      FILE_SHARE_READ | FILE_SHARE_WRITE,( _- T5 e5 I1 b0 h& u
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) w. r% b$ G' b9 H/ u% d( Z
   if( hFile != INVALID_HANDLE_VALUE )
* S/ v1 ~7 y8 e   {) x* c! J8 \% [1 Q& M
      CloseHandle(hFile);
0 V/ V/ y" P( m( a9 Y% l      return TRUE;$ W& l# j0 C- N" W. g2 u" A6 p
   }
1 J% M( S0 w; G7 n- S   return FALSE;
4 j1 l+ J3 Q- N2 b/ d}
5 t/ [0 |$ d. M& T, Y
6 X- r+ E4 E, q, w# m+ HAlthough this trick calls the CreateFileA function, don't even expect to be
7 a4 V7 l% ]4 k2 g  V: ?9 I1 o; Wable to intercept it by installing a IFS hook: it will not work, no way!
0 y/ K0 M" ~+ x0 g- F$ a/ H" I- k/ a( n7 pIn fact, after the call to CreateFileA it will get through VWIN32 0x001F0 F1 E5 @2 a. R3 Z; D: t3 Z! W6 g8 p
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 H) c5 O. \# W" q1 n% `and then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ F- X# b% W: N% Afield.
; x. ]( v, [% wIn fact, its purpose is not to load/unload VxDs but only to send a
' H, m# m3 s3 `# A" ^3 `4 `W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
2 D$ [9 Z. X. S7 K+ P4 g: V1 yto the VxD Control_Dispatch proc (how the hell a shareware soft could try
8 g% }2 o: O& cto load/unload a non-dynamically loadable driver such as SoftICE ;-).; Z/ X- n. E/ V9 c! E) x
If the VxD is loaded, it will always clear eax and the Carry flag to allow$ ^, A% p. A1 c, Q! q
its handle to be opened and then, will be detected.
7 M4 ^& u) L, L: @You can check that simply by hooking Winice.exe control proc entry point
3 j9 k8 M% V  [+ Z8 c5 M9 s% Bwhile running MeltICE.
8 U' _$ l' M) L
9 P) e  u# ?/ I7 @/ ?5 v; t- s5 {
  00401067:  push      00402025    ; \\.\SICE! g( c" Y- w# \4 v2 }# A
  0040106C:  call      CreateFileA' v1 ]% ~$ @' q) V: x' {
  00401071:  cmp       eax,-001$ V8 z0 v% f) _* L, m; l
  00401074:  je        00401091  R5 S6 y# w( F9 s& ~- X5 U, X* l

$ {$ j: J3 ~# ]
% f! _6 b8 I' I% J4 j8 d$ v& JThere could be hundreds of BPX you could use to detect this trick.
. _+ ]4 K- p! @* L3 V! a-The most classical one is:
+ j8 C3 M) F2 P  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
! q1 r/ o. d# S5 s  V5 y. ~6 J    *(esp-&gt;4+4)=='NTIC'
6 V7 _* u" _+ D- a( @& Y% `' f7 n
% Q: d- b, W- Z9 a-The most exotic ones (could be very slooooow :-(
: v2 ^, k4 s+ W8 n& ~   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 r8 q$ _8 M4 @8 W) S     ;will break 3 times :-(2 g: @! s; q7 `7 O- m* r2 c
" A' d  Y1 v6 r9 |
-or (a bit) faster:
2 q$ e/ p4 @2 @; {* H* C, J   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 X  v3 N# }, ^- D% g& R

, A, d/ P; S9 D. r   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 i5 L; d2 c5 F5 g( B8 U     ;will break 3 times :-(
! o5 `5 q8 Q4 v8 C
. n( p5 J% g- `0 Z$ Z-Much faster:
) c, d; A8 X' r- o/ |2 S4 `   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'- d; F3 j( i! L" ]7 e. z
6 Y) X5 Z  g! W8 S' V: p9 _! j6 l
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
- m+ ^! Y8 i1 X9 C5 Yfunction to do the same job:
5 I: a; [3 }4 T+ E8 o; @. R! u4 t3 x: l5 \" g' P9 r: L6 P
   push    00                        ; OF_READ" X9 B9 r! [: H# b4 q/ o
   mov     eax,[00656634]            ; '\\.\SICE',0
& ?, O3 f0 p) C/ ~0 e6 G   push    eax
' i; w  F+ y" M* ?1 e; M' c/ R   call    KERNEL32!_lopen, z* h$ K& j+ z% `
   inc     eax
8 ]6 m/ _. A3 L5 }* \   jnz     00650589                  ; detected0 Y: w$ ^+ N) b$ T% z: M* \
   push    00                        ; OF_READ
' r8 Q4 M) |: b* N: B   mov     eax,[00656638]            ; '\\.\SICE'1 Y; ]. R" @. F5 X: W2 ?
   push    eax
3 |2 Y) y) O9 l( M& L0 y   call    KERNEL32!_lopen1 |2 j9 t" \( E9 T( z7 G" |5 U
   inc     eax* [8 b, B5 z( ~2 g. `  ~$ S  U
   jz      006505ae                  ; not detected& t& x8 G9 y6 |+ |( n/ \
7 N3 n+ x8 K3 ^8 Q

* m3 Z6 L2 J4 D5 M. G3 S__________________________________________________________________________& m7 \4 y& k3 f0 E5 H% G, u

* Q9 V* }& N4 j0 g2 d$ a3 vMethod 123 l, M4 w! [( L5 {. W- _
=========+ M0 k6 n7 H9 n8 {, K

! O2 z9 w! H/ [, Q1 jThis trick is similar to int41h/4fh Debugger installation check (code 05
; A9 z# m' L4 _5 F: H5 d8 T( ?6 N0 m&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ K8 Z/ A# D5 Z# e, eas it uses the VxDCall backdoor. This detection was found in Bleem Demo.) l" {" }: Q3 s3 J  k$ S& J

. g. p$ L- S) d; }, e6 }2 \, {   push  0000004fh         ; function 4fh' P7 ]( N* F) p' K* ?! z4 q" l" W7 \
   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 `# O  Q# a0 h                           ; low word specifies which service; s# p2 ~3 l$ z# {
                             (VWIN32_Int41Dispatch)
9 ~3 v- }* _+ N0 ~8 y   call  Kernel32!ORD_001  ; VxdCall7 A- n* x9 F3 @: u1 l
   cmp   ax, 0f386h        ; magic number returned by system debuggers
# G8 e) }# W+ Z% K( U+ f) H   jz    SoftICE_detected; y8 r. t4 v' H( j* V

7 k4 j" V5 u4 A  o$ R8 rHere again, several ways to detect it:' J3 B8 z( v& c  N. i9 a! p, z

% r+ |; q. w; [! ~1 L    BPINT 41 if ax==4f
5 I, ^3 \- E  w/ ^1 f, X
0 P5 T- f9 [) x9 H' k4 q" P7 P    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
( c7 P1 S/ P" B3 d$ c
2 W5 F  W9 x" k* B/ \    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! z# C: h  m: j. d" \/ ~- C4 F
) N8 d+ N6 E) B" b% `* W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 X$ w7 l& T4 i* r1 r' j- j

' \2 p. @3 Q- H& i/ [! U2 ]__________________________________________________________________________2 W" c0 U2 h5 E7 [

+ Y6 p' c5 |' z$ b4 [Method 136 Q# o) x9 f" I8 O! n
=========
8 H- o5 U( d" k" V
& ~3 t$ v( T3 P& D( SNot a real method of detection, but a good way to know if SoftICE is) I) W& p% D) }( R
installed on a computer and to locate its installation directory.
, w2 q: ^* Z9 Y, a# y" Q$ {It is used by few softs which access the following registry keys (usually #2) :
  Q, J, T' d3 x( B5 f6 n/ e0 {( ?. c2 _) d
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 J, ?7 M7 c3 {\Uninstall\SoftICE
4 P9 t. j5 C' }6 Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
1 f3 j! _$ [; W/ U$ t! s, t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 Q0 Y/ Y& v; z
\App Paths\Loader32.Exe
! e; k0 {& t* u: \) E0 L$ g* ?
0 K$ P2 P, c( H% ^! [  o0 c' Y( l+ o  W, K
Note that some nasty apps could then erase all files from SoftICE directory
. I" s2 v" ^% m0 i6 a0 t(I faced that once :-(
; U6 ^, w1 A7 p3 a" r$ V1 J* U- n" v8 h
Useful breakpoint to detect it:& j  A/ Y& m  }

: J0 n7 F. _2 C: c+ S     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; j% M  r5 i0 |" b) z! D5 e/ k, p" d( J* n4 c0 ~  d$ B# \
__________________________________________________________________________
! P2 [* e5 I8 b' W1 P) C3 Y0 a8 d# h$ P
5 ?$ [9 O1 p: g
Method 14 , @  _3 Y- {0 u& J- |8 g
=========
7 {2 X0 [9 d# j; F) u) u
$ F& v# o  O9 a; _$ u6 M- AA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" R* {/ a, A! S2 K5 s4 S. k
is to determines whether a debugger is running on your system (ring0 only).9 X( j% N2 p1 a. ]
# N9 R4 m3 P: [: E4 k( T
   VMMCall Test_Debug_Installed7 }8 V9 h" X6 y! V8 p8 a( c$ G
   je      not_installed
: W, g6 P# T7 w% k# j/ ]
9 {; V$ W% R" z  s8 k- O7 w! XThis service just checks a flag.& G  C- Y$ k, }2 M2 |- A
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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