About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
2 ]! h  Z+ z. _: w$ y<TBODY>
9 [: t9 o! E$ V8 l5 ?  n<TR>
, C/ f" a% C) L$ d6 ^, N) P+ d: m<TD><PRE>Method 01
. X1 }) C! C$ h! ~: ~- q=========
+ w) a7 S5 v9 }, I! o8 f# y
  z* M" Q/ u# \+ q/ J8 y+ I4 e' S$ O( _This method of detection of SoftICE (as well as the following one) is4 ^2 Q! S. A. }
used by the majority of packers/encryptors found on Internet.. c% Y+ O# U' i; S3 C
It seeks the signature of BoundsChecker in SoftICE
5 c' j4 f$ F, M) y7 p5 E: c8 [" ]) i
    mov     ebp, 04243484Bh        ; 'BCHK'* N0 k+ \3 t/ C
    mov     ax, 04h
! s% Z2 H( {: n( Q    int     3      
2 {: x2 c% h- q5 [2 j) Z# i: s    cmp     al,4' C3 b2 ~$ e: s2 P
    jnz     SoftICE_Detected: h% n  K7 d5 i1 b; i
+ Z6 K4 W$ X% g1 y
___________________________________________________________________________
. ~, a! g9 ?* h2 x  M
  B6 m& ^5 E" _, w" }Method 022 ]+ O+ g* f) K- Q) b3 p
=========7 ^$ r  I. O6 J7 ~2 S3 s

3 O+ D2 p( Y; o6 M' }( {9 ^* vStill a method very much used (perhaps the most frequent one).  It is used+ @5 Y  a" E1 w' K& u; m
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
" A, t& w3 V. _2 E$ }or execute SoftICE commands...
  x6 {( k% b* C& o8 xIt is also used to crash SoftICE and to force it to execute any commands8 W. d4 L! V' r" O- B$ O
(HBOOT...) :-((  1 {$ w0 b  F- s9 a  _+ b) ~
" W  N3 Z0 u$ `" B8 ?: i
Here is a quick description:, ~2 Z! c# ^4 Q; O( Q% i
-AX = 0910h   (Display string in SIce windows)" |  E! ]3 O5 N' @& M# i- P# K
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 C! t1 R& o$ b- c-AX = 0912h   (Get breakpoint infos)
# E5 s- S5 N+ N" s5 s-AX = 0913h   (Set Sice breakpoints)1 g& T4 e- D2 m/ d* r( j# u6 Z
-AX = 0914h   (Remove SIce breakoints)
, r" d. U# s6 B7 d0 y, `! p7 r
' U; O7 g8 ]2 N+ OEach time you'll meet this trick, you'll see:
. ^% w/ M& d: M1 n: v1 |8 s7 c-SI = 4647h8 T7 ^/ R' ^% x7 P. N7 h
-DI = 4A4Dh
' m& y' l! {8 f$ ~- `$ YWhich are the 'magic values' used by SoftIce.
9 r# p) H) [8 c# v9 {For more informations, see "Ralf Brown Interrupt list" chapter int 03h.) f+ }+ J0 g5 h$ n; o
3 u9 b2 H/ P2 Q2 ]4 O
Here is one example from the file "Haspinst.exe" which is the dongle HASP3 p7 \5 Z$ v6 P
Envelope utility use to protect DOS applications:
, L6 C* H* [& N7 c  ?- n3 `5 d; @
% z. K$ b$ q5 Z' \- T, R! x1 d7 t
4C19:0095   MOV    AX,0911  ; execute command.+ K* |/ o9 j" j8 W5 v6 P
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  O( Y  M1 j* Z1 x2 F* F( w1 ]' o4C19:009A   MOV    SI,4647  ; 1st magic value.! V+ l* x% T9 O9 S+ F4 o
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! q6 ]  K9 J8 ?) @6 [4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)$ d  n2 h8 H& p
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 }$ E! x1 R6 c6 M' t7 O: N" R
4C19:00A4   INC    CX
2 u1 J/ I( @9 F, p( S3 H* L4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 m3 {0 h  ^( [
4C19:00A8   JB     0095     ; 6 different commands.% x9 C3 U( n; @3 b  k" @4 f& F5 e
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 e/ t4 d2 U' W4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& f' U; @) B. M8 H% {9 ]
; X( ]2 r& h" [6 P  l( bThe program will execute 6 different SIce commands located at ds:dx, which% x4 h$ E& F" h. F4 Z
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
" N5 O/ E& ~; `. g, p
! p! H) c3 R& J: b6 C* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 G0 g* z5 |# ~5 _
___________________________________________________________________________
! u' L3 X1 [! D3 n: ]4 g) k; @+ ?- ~! f, r( i
7 C: E( n" M3 l4 I) \/ O
Method 038 h  N( Q! p: u) [0 O5 z  K
=========
3 m0 h0 t. G1 E% e( V' d  h
$ `+ S9 x( X0 W$ m& QLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 G0 V7 D6 @9 m1 s  D" T9 B7 H' k(API Get entry point)1 A7 `2 [& I+ \/ l" B# }; D1 }% C5 ?/ K
        
& a* b, M6 c$ ]. {
; _$ o8 u/ A: H9 d    xor     di,di
& G+ V/ w; d+ q    mov     es,di; {# t+ C5 ^' c+ G& X/ J7 `* w
    mov     ax, 1684h       3 x: e5 x+ u; |
    mov     bx, 0202h       ; VxD ID of winice
% C: N& X! z& D8 s+ U  J6 U    int     2Fh, x" s% L! R5 O. s- y+ p
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ L3 s0 |# m7 e: ~. b# Y
    add     ax, di
$ c* S# p2 q- h% ~/ f7 C    test    ax,ax, E" k8 g+ @# p4 I+ X
    jnz     SoftICE_Detected
8 x1 |. a7 b  O- Q5 y- D$ e/ N# h% p) N* O
___________________________________________________________________________
3 l* W$ m$ h4 f) e
# e4 `6 ^; u" J7 |9 aMethod 04
8 |, J! P5 Q. ?=========/ r" ^) D- ~! M+ @9 ?# R  B
/ b$ `7 v. P- M1 n' j* I& ^
Method identical to the preceding one except that it seeks the ID of SoftICE5 r4 |: b8 C& D% N1 m# ?5 y
GFX VxD.# Q" b8 K; C. w9 ?% D' Y  M( d, f
4 T1 m7 {7 K0 |0 e" _! T( ?! v. v
    xor     di,di' T- ~0 r6 L3 }; f) `
    mov     es,di
4 d8 g& Q5 ~1 `5 G* Q$ t    mov     ax, 1684h       ' g( v& Z, L0 Z1 L6 D" q, D1 @
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 S' r. R, G  o" s3 |; N/ h0 g! m    int     2fh
2 u- a) |, }2 r  s- _3 s0 {% Y# Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ K+ B* B& ?7 D    add     ax, di
" i+ l9 V0 N4 S, p( h! L' J0 k    test    ax,ax
/ Y) ^- W! I: V) G    jnz     SoftICE_Detected8 Z) ~7 d3 R) R4 D

/ X9 J7 a- M: A__________________________________________________________________________* D( {  i/ l3 r8 W  F: T
4 f/ ^; M7 M6 E- P) f

; O- s" x: B1 D4 Q# B; cMethod 05! G, r  c) M5 D9 u! a$ }; z- f1 c
=========
$ L, o0 Z1 S4 L/ y3 |- m7 r6 b9 x3 B. w
Method seeking the 'magic number' 0F386h returned (in ax) by all system
' ^1 C+ R0 U1 Y  Vdebugger. It calls the int 41h, function 4Fh.
0 I% E! {6 g; c, K* S1 ~There are several alternatives.  2 _9 D6 ^& A2 c) \4 U1 U; E
% h+ O9 S& |9 i
The following one is the simplest:7 G0 A& w1 ?0 D; J4 w

. d$ a6 `, j" S/ k    mov     ax,4fh$ a# h6 C$ z) |! s% g) S$ a
    int     41h
2 Y. g: _. j! i- J  ]    cmp     ax, 0F386
' ], I( V" I7 j% C. E1 b4 `    jz      SoftICE_detected
7 L% g4 Y" O. n$ K6 B0 b# r: F. q' G  H1 ^3 u$ ?0 x

) o3 s1 k5 g* w+ `8 g) ]. m' i8 qNext method as well as the following one are 2 examples from Stone's
& M; b5 c6 `. s8 j  G4 h1 n. v"stn-wid.zip" (www.cracking.net):
0 c. X- T1 L- }+ o% S% _3 }, |
% X& J1 S* J1 A8 Z    mov     bx, cs
! r8 z& h/ G7 s) f/ ]- f' E    lea     dx, int41handler2
$ W0 }# [' E3 @  R! \    xchg    dx, es:[41h*4]2 X$ I% e6 f6 R+ @1 Y
    xchg    bx, es:[41h*4+2]
. R# T  g0 b2 ]5 x6 B4 m1 u7 i    mov     ax,4fh
) A. @$ A- \& y. I: P+ _    int     41h
; n8 j9 D& N( l2 M$ d    xchg    dx, es:[41h*4]. P- e) C( N! V
    xchg    bx, es:[41h*4+2]
' J* b! e" ?0 }: d. Y    cmp     ax, 0f386h2 g/ Y. P- J* G( q- h. j/ w
    jz      SoftICE_detected
3 [5 }! c8 B9 P, h' W# U, v: _. x* w' }& x
int41handler2 PROC
/ X. I0 s: y5 S    iret2 Y$ i# y9 D! Q2 a5 H3 a. W
int41handler2 ENDP" i" N8 e5 L5 l; t" Y4 c2 n( I

  X; K$ @7 Q7 w4 n( i7 _/ P' p2 x  x+ A
_________________________________________________________________________) {7 ^2 i& f- E- s; E; q8 m

: t- q$ b' J9 |0 A1 L1 W* ?- [' s7 Z. Q' }8 d4 [" B
Method 06
/ Z& [4 c5 f6 t, J# ?+ u- h$ H=========4 [! c5 p* `0 g, S! y; B- D

: [, ~9 C+ j$ A# P# \0 ^' b- Q' X$ D  T$ v& C
2nd method similar to the preceding one but more difficult to detect:
9 G7 w% C' H" N' G. b# z
5 y* c/ e( Q) ~' X7 K$ d! g0 V0 y
) g6 H0 s0 Z5 H4 I2 Z9 ]& b6 nint41handler PROC; I5 f! a( `5 e  k
    mov     cl,al2 T: b6 a% d) }
    iret. t/ n9 K6 C  h7 x. d2 f' o4 b; Q
int41handler ENDP& s4 e+ F2 [2 N" z) Q- [. R& C

3 d2 @, D' c" s8 f* Q8 ^
( e$ F# C# c, D/ b- |    xor     ax,ax
8 V' ^# `/ Q+ w: R) f    mov     es,ax
/ s( ^  T6 a  ?    mov     bx, cs
6 \* S2 C! z6 k% Y4 b; w% A    lea     dx, int41handler- y: R0 |, c1 E  M2 f7 Y0 k- I: J
    xchg    dx, es:[41h*4]
# B, V2 M7 B8 O3 `    xchg    bx, es:[41h*4+2]
" W: Y- a5 H. D7 ]" K& G" u) b  w( G    in      al, 40h
/ H1 u2 L2 b1 |# D1 H4 c/ C8 L    xor     cx,cx9 W6 ]) z+ J/ x! e7 a
    int     41h; }3 S$ g& I; J; s9 L: l0 G
    xchg    dx, es:[41h*4]8 |; p# u8 I3 M
    xchg    bx, es:[41h*4+2]
5 L/ P7 P5 |8 O' ]5 }  V    cmp     cl,al
/ r: H$ M3 Q# Y9 B' A    jnz     SoftICE_detected; P7 }2 x3 g& \- f/ x% C: C
$ c# K6 V) S: ?3 l" O1 S
_________________________________________________________________________
2 w: T9 `- C  S, y
9 z/ B8 X7 G7 N5 W) vMethod 07( }$ p, _+ A$ Y9 l! V3 b, t& p- ?
=========! n. d, I5 }! x* X, M! k0 }% m0 h
* t4 R( F: Q5 i9 r  ]+ u! Y
Method of detection of the WinICE handler in the int68h (V86)
# c, G3 J6 D* g& F2 Y* A! L# O+ Y7 a/ Q' N1 H
    mov     ah,43h. j: F% T. o6 ^* S2 v  f9 U
    int     68h' i; n1 t5 f9 U  P7 c1 o
    cmp     ax,0F386h5 R* Z: A5 D& e6 l6 Q9 b* r
    jz      SoftICE_Detected
% U& ?- s' l2 e/ X2 @  G' c( g3 R* S0 B- q/ Z3 D
" m5 N* @: y1 y- j# ]. @
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ f7 T; U$ c' @+ W% ?. @
   app like this:
( u3 Z& x5 g# ~4 C! p
! V5 u! g) n; s4 ]; F5 p$ O3 C# C7 d   BPX exec_int if ax==68. M# R. C- I" c" Z7 p5 z
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ z0 V3 ]; k% \! I& `   located at [ebp+48h] for 32Bit apps)% z) y0 b# G: s( O1 j
__________________________________________________________________________$ e3 a, p$ F; c  ^; A

& o6 L: M1 X( b# [6 B# R% B, Z8 z  I/ J/ h
Method 088 h( c8 M5 i2 R, Y! S3 O/ k
=========
% h9 Y( k2 n# F7 C! m) Z! O
, |: z- t/ b# a+ C4 Y. o+ WIt is not a method of detection of SoftICE but a possibility to crash the7 L) p: I8 L* d9 n
system by intercepting int 01h and int 03h and redirecting them to another& h$ Q3 z7 W1 L, l4 y
routine.
# Q- k  s- q; K1 k3 ^It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: u2 O+ `6 e" d; w9 B+ j: Vto the new routine to execute (hangs computer...)
1 @4 S6 j& P( a3 {1 _5 d# C5 n& k) ]- t: I
    mov     ah, 25h
+ y" R# m' g+ T9 I% F    mov     al, Int_Number (01h or 03h)! T) d- n8 ~, z1 t% |1 g# A; E
    mov     dx, offset New_Int_Routine
+ z1 X* a4 @9 ~! `0 j    int     21h0 ^8 g. K8 W! p5 i" K' C/ ~# R
! V. ^) b" a% V8 f0 `. {
__________________________________________________________________________: c6 F0 m$ c2 K4 p, R
) n( R+ Z9 t. O/ a$ ?7 t
Method 09! l% j# t" v* q  W
=========- {$ f5 V/ g: y  k- y

4 S& f8 V# M: U! F3 f3 _This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! \8 y' \* V3 s* V) M8 [  }. i% ]performed in ring0 (VxD or a ring3 app using the VxdCall).
7 _8 m4 I( |" X7 s& t3 m/ YThe Get_DDB service is used to determine whether or not a VxD is installed$ n3 M0 Z. s1 M9 O. g# @8 `1 T; r
for the specified device and returns a Device Description Block (in ecx) for0 w7 W$ f# A& ]4 V
that device if it is installed." ^4 f/ n9 ]3 p4 ?. y
8 L8 w7 i) @3 y; g, P
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; }* k( ]$ J- ?+ J) v* @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), `) [) E  ?- B0 O5 K. U
   VMMCall Get_DDB
1 O  J0 v2 d. V: I0 o   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ F% U  R2 C# r7 q0 O$ c: m; i6 }! u7 k# b
Note as well that you can easily detect this method with SoftICE:1 S+ [3 D9 e, Y# t; v: O, J
   bpx Get_DDB if ax==0202 || ax==7a5fh' c5 W$ `5 m7 M$ Y7 B, O
3 F% @6 K5 E3 b2 C* Q
__________________________________________________________________________
( k( v& v% l: [1 h# v! a0 }6 _& N% A+ f3 @0 V  E; Q) B3 a: c
Method 10
+ S+ x- b3 N. X9 ?% X. a+ C3 j( i=========  r% u$ W1 T6 q( a4 l* o+ D6 E+ E4 w

2 T, a6 Z# I% B- ^* ?, e( g2 b=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* m: E4 K: D1 v  SoftICE while the option is enable!!
: R" k* |' y8 h; _  f/ W- \# n: b, |3 g" b. c2 ~/ c8 [6 R
This trick is very efficient:/ _# p6 k0 f: [
by checking the Debug Registers, you can detect if SoftICE is loaded4 J- E1 X/ D# y7 T3 G
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( H8 a/ g2 o5 B$ cthere are some memory breakpoints set (dr0 to dr3) simply by reading their' P/ D. h( K7 _+ c$ _+ E& ?
value (in ring0 only). Values can be manipulated and or changed as well
: @3 b3 C! b/ n6 Y' _: B% ?(clearing BPMs for instance)) G9 U5 S9 c1 {

! K8 D# L5 [7 e# S$ |: J__________________________________________________________________________
: @! \+ n$ A9 b0 w2 E/ l; D8 P
Method 11
7 a5 u' e# J; l! W0 W; O=========
& X' a$ ]( Z, D& @
$ B9 X5 \. R! q) }1 {This method is most known as 'MeltICE' because it has been freely distributed5 Z. t& V+ l. p1 a: s
via www.winfiles.com. However it was first used by NuMega people to allow
* G5 y5 w1 @: j! Z/ r; k1 tSymbol Loader to check if SoftICE was active or not (the code is located9 F/ `7 o9 m5 z4 Z, [
inside nmtrans.dll).  h* B, S& ]3 H" A/ e$ ~# f8 J
# Y* n2 y& O$ S- T: q
The way it works is very simple:
! v$ f: l! Z, L( w: A4 E) s4 NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for& Y- [+ o# a' [* @/ \; L
WinNT) with the CreateFileA API.+ S4 ]' I4 w0 h' r1 ^3 x
+ A" ?% {: G. O6 D9 H9 N: D8 ?
Here is a sample (checking for 'SICE'):+ g8 ~$ n: ^  a5 S$ ~1 v6 c
- f8 N+ }4 Y1 _9 d  d/ ]$ Y" }
BOOL IsSoftIce95Loaded()
/ U# ^( j+ _4 T! ^3 i+ V{
& {, ?6 B! o8 s- _$ h6 Q! x1 _   HANDLE hFile;  
5 o) I2 f: }5 i8 s- O/ n7 J- L, ?   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ c5 c  l7 O  f+ }: E# ~                      FILE_SHARE_READ | FILE_SHARE_WRITE,# D9 f$ F$ t: A2 j1 {. {
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' U7 Z  j6 B5 m/ w; }$ X' ~
   if( hFile != INVALID_HANDLE_VALUE )
- b; `+ X2 _& D/ e  G   {
) v, R8 P* G: C% W& m      CloseHandle(hFile);* J* S  ^( W' s( y& G& a2 X
      return TRUE;5 |3 K$ M& K# w1 @- n
   }! b# e$ {: q- D0 z1 @; A
   return FALSE;4 q6 B8 V) k- l# W; v* U# n
}$ q; _+ Z2 V: B. _

4 t8 I& Z! g4 t' |. rAlthough this trick calls the CreateFileA function, don't even expect to be
: `2 j1 {! _, z+ J! n7 K! jable to intercept it by installing a IFS hook: it will not work, no way!# N' n: U" @- M# E3 {* r
In fact, after the call to CreateFileA it will get through VWIN32 0x001F) t) G# }) `! [3 L, P( V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 p6 f: {" c" z0 P3 {' Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc' X; y5 Z9 }4 g6 K- u- d# ~2 {2 V
field.; ]7 z, l+ b/ @+ F$ U! \; ?
In fact, its purpose is not to load/unload VxDs but only to send a
5 m* T2 g" ^# r2 h2 Y+ FW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
/ Y1 v% ]8 L, qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
& M% v- p; w' ?  T: ]9 [/ Gto load/unload a non-dynamically loadable driver such as SoftICE ;-)./ y$ l) e# _1 Z# A# [7 t* \
If the VxD is loaded, it will always clear eax and the Carry flag to allow
" H$ y* |3 j, }6 |3 w% Dits handle to be opened and then, will be detected.- e; Y7 t8 T& f  M3 l
You can check that simply by hooking Winice.exe control proc entry point' O5 X# F( g/ f8 N/ A
while running MeltICE.
+ V- I, y1 I0 Y6 B" J
# r4 O, k( k" B7 V$ W
6 g2 Q) c0 }5 E7 Y5 J  00401067:  push      00402025    ; \\.\SICE
$ Q: S6 S8 T, G" m6 ~. o, {  0040106C:  call      CreateFileA& [4 a% f; u# T/ s' r3 g
  00401071:  cmp       eax,-001% I; v% w9 n* |+ t% ]% a8 ?  B% Q* {
  00401074:  je        00401091
8 y. C  e: M" C4 p" c3 |3 ^+ ~- h; o  J/ O' S2 \9 z. m

+ Q) t( w$ w- Z- R- Z. w0 OThere could be hundreds of BPX you could use to detect this trick.
7 N) d. T5 s5 h" U6 e, O-The most classical one is:( P; U7 Q" @) |$ N0 U! |3 o0 Q6 a6 W3 h
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* Z9 U, J2 B6 q$ g2 r
    *(esp-&gt;4+4)=='NTIC'
  O3 ^  F& \9 o5 H1 f/ {6 T8 m
9 d1 M. \' g4 p+ ?+ h! `# M-The most exotic ones (could be very slooooow :-(9 b  V/ @! L) }! C
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- R& u) A# i' b1 n9 b     ;will break 3 times :-(! @4 d; q# {8 y7 Q- d* {' a" t6 H- u' r
2 ]: [, u* ^4 K
-or (a bit) faster:
$ S: P! Q& h" {) e" `# h   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 i$ h* `- W6 G; a& L2 n, Y% [
% I  z# e* o9 Z: G   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  2 ^3 B( p& r# Y# K
     ;will break 3 times :-(
+ H, z& {' [8 H
' `5 F0 S; K- T& t9 N8 {  Y% t-Much faster:
8 S8 C$ L5 p) C   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! r* h5 o" {/ O- Q4 x3 ^  ]3 D4 D# H2 L& j" P- c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
; b& W3 y8 K* Z' v6 J! Rfunction to do the same job:$ r5 x* J0 k. k3 I' w
( d( @2 D2 |1 Q4 O( N1 O/ `
   push    00                        ; OF_READ
# B9 Z4 y$ |$ y, O5 \% S# d( N   mov     eax,[00656634]            ; '\\.\SICE',0" T6 q9 D% S7 g. Q
   push    eax1 U8 W9 t) v; F  n4 \' S3 @* A; r# H
   call    KERNEL32!_lopen
  ^! N& j/ T+ X+ k  W; G6 I9 q   inc     eax
: R) _; i  v9 [# [7 r. {   jnz     00650589                  ; detected5 n6 ?. M8 r+ d# f/ I/ X
   push    00                        ; OF_READ
) q- p% z7 L' \; }: z, ]   mov     eax,[00656638]            ; '\\.\SICE'
$ L7 W# ~" e  P1 @4 N3 @6 x   push    eax
' _; R) n4 I& c+ j4 {. G; D' D   call    KERNEL32!_lopen
" q* W2 Z  T8 a3 Y+ s; J   inc     eax2 U# v6 B: H8 p; g! B) S
   jz      006505ae                  ; not detected
! w. S1 o5 F" h6 h, s: {/ U
$ C( B' n5 \' n& a
  I3 [9 A$ {& F, t) ___________________________________________________________________________! i/ W+ r3 `0 p0 E  L0 |$ g

% P) C& _8 [5 F" c! gMethod 12& D! P& I  H: y" g0 z, D9 |/ Y
=========
" p- W2 {6 D6 M' _" L0 v- F( A* o
This trick is similar to int41h/4fh Debugger installation check (code 05. w( f- x) U1 M5 \0 Y
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* Q! |3 @; c8 C  M; A, t# x- B: vas it uses the VxDCall backdoor. This detection was found in Bleem Demo., c( u, O  q( r/ `6 d* d
7 @; i+ I8 m8 U
   push  0000004fh         ; function 4fh
, e  q  p: x2 e   push  002a002ah         ; high word specifies which VxD (VWIN32)4 D8 f8 U# R( s9 V7 `
                           ; low word specifies which service
# n5 k7 s. y* U8 V                             (VWIN32_Int41Dispatch); p% g% J) L' O! G8 P* E
   call  Kernel32!ORD_001  ; VxdCall( R  c+ e7 a* J, |0 i/ Q/ e3 l
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 I1 ]6 {1 h* q* _: V; P   jz    SoftICE_detected
! h6 e. A: C" s$ T7 t3 L0 R0 M
) O; Z+ e' B/ x; Z. a4 K7 MHere again, several ways to detect it:
7 @3 f* C, M4 \! V9 a. B8 J5 Z4 p9 I
    BPINT 41 if ax==4f7 k) S" @& Q6 Y& s

* k8 a/ k* a6 l: H    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 |: o4 u/ V5 q: w
0 X' s5 D1 e* e  r" ~9 ~' H
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 s& }" N0 W4 T$ X: Z  ^- L; y0 @: E5 [) s. j
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' F4 D; b" n& r1 K9 W, T0 g% [: c" |! p2 T. c' Q5 J3 Q
__________________________________________________________________________
8 N+ n+ y' X7 W9 G  y  {5 q" ~
  c, A) V8 \, F% MMethod 136 r" B/ X& p" L' G8 u# ~
=========' f9 m) ?% T( E' R

  c" m$ [7 d0 ~/ @' R6 F% xNot a real method of detection, but a good way to know if SoftICE is0 R9 s6 R0 A# s0 m$ }
installed on a computer and to locate its installation directory.
" O* A' ^- |5 n, z0 ^" q; bIt is used by few softs which access the following registry keys (usually #2) :
# o# k8 K* k3 v8 g7 J6 x- u# m- b- R5 e
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 k2 ?1 i  C  ]. R% z& z& X
\Uninstall\SoftICE6 x% p# m5 u7 a4 I4 {
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! a( a6 K9 T$ B4 }3 S3 _9 U8 H, P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; O& L; b( W  I* S
\App Paths\Loader32.Exe% n- U* Y$ ^8 ]
1 z5 p$ W# m. v, H* ?1 }$ s

) b7 M4 y) ^9 b6 T1 a" S, C3 sNote that some nasty apps could then erase all files from SoftICE directory
& ]1 u5 O/ j4 [. t  I(I faced that once :-(6 t4 c" o8 r* c# h
! l( M, [7 P% L0 {2 p2 _
Useful breakpoint to detect it:& R4 {" y# d3 ]% v6 M9 y
- p- b+ b2 ~" q6 y& [
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 h& e! @  a- r( p
7 a9 Y" C2 r# H* K: ~6 s
__________________________________________________________________________
! T. T- H. `  T. {, J2 P" y- [3 A" c7 S( w7 _7 a4 {5 E% N

9 v) y" ?7 O9 E# G8 ^! Z! l0 S- l; xMethod 14
2 d% G/ D0 F( T7 ?7 F+ F=========
$ }# e0 E' v3 D+ F7 k+ v& i. v  }! o" ^4 e$ y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 V/ Q7 L  R/ q- b4 Wis to determines whether a debugger is running on your system (ring0 only).
! a" n5 I+ @2 v8 ?: h! Z/ w
! M- P% d! [% c1 L7 u" r   VMMCall Test_Debug_Installed; d$ w# M) L# a3 i( E& _9 M4 ~# }
   je      not_installed
5 F4 Y& d  c5 m- I4 v* e( e: ]
, D  X/ f. Q- k. kThis service just checks a flag.' f9 O" b8 }; ^* \2 M! l( V
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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