About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 `3 K+ v/ {6 X3 S$ Y9 S<TBODY>
8 \; \* V! x* l* B1 A- Z$ \" Q<TR>& [# @+ V" K3 K8 Q) T1 F( v. W
<TD><PRE>Method 01 * p+ x3 m$ ?& @
=========% \' k  W+ s4 m  t: K, ~. W
$ w' d; L. Z0 T
This method of detection of SoftICE (as well as the following one) is
9 x9 k$ q0 o7 Cused by the majority of packers/encryptors found on Internet.5 F/ K" s' K. \
It seeks the signature of BoundsChecker in SoftICE& O( T" ]1 I2 j; s( K: j0 L* h9 @
6 b9 Z0 u) ^+ k3 K' S
    mov     ebp, 04243484Bh        ; 'BCHK'7 m# _0 _  g3 x
    mov     ax, 04h0 f1 Q8 g2 v: M6 T/ o
    int     3      
9 x( E6 J2 _+ M9 k8 ?    cmp     al,4; Y& }8 f+ b7 ?
    jnz     SoftICE_Detected' V6 I; v1 Q$ I4 E( t  z' h. p1 n

5 l; B& E) j, N6 k% d* e___________________________________________________________________________
/ ^; ~. C" o( I  N. y+ b8 P2 \
6 K) z% Q: K9 v; @- T2 K, @Method 02
, @# a/ [1 }0 N=========
6 g/ ^& n0 r- l0 T" }/ Q' d. `" P5 {0 U' k# d: L
Still a method very much used (perhaps the most frequent one).  It is used/ k& j% k# [* e9 ~1 @5 t
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 A  [+ k. r$ V8 Sor execute SoftICE commands...# l: J% F! m2 @% p/ E( W. Z
It is also used to crash SoftICE and to force it to execute any commands, g  T$ \/ h. @4 }* J
(HBOOT...) :-((  
) b5 ^& ^3 s6 ^6 f3 |! k: o7 p' C/ Y: ^' ^
Here is a quick description:
- A8 H: M+ L$ U4 {' O- i5 y-AX = 0910h   (Display string in SIce windows), G  l& K+ R; ^; E5 Y0 ^
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
3 t4 z. e7 y8 \* u-AX = 0912h   (Get breakpoint infos)
; C) e$ J  ?8 T% e! i+ S' a! o-AX = 0913h   (Set Sice breakpoints)
% b" K$ O! L: R6 V! e-AX = 0914h   (Remove SIce breakoints)
, H# G, N4 f: ]/ V$ T9 U$ d, R* T
( o' v' g  o3 P1 o* s1 MEach time you'll meet this trick, you'll see:1 @! o8 z/ y! r& D8 W6 M
-SI = 4647h' [7 e2 ?& ?7 S' s' h; r% h; ], H
-DI = 4A4Dh
5 G5 U+ M) L8 z1 V" F7 xWhich are the 'magic values' used by SoftIce.3 d* t) H  D9 Y+ A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.) Z$ p4 J' ?8 \, |

* ?$ j1 H; O5 ]: D1 S3 e) w5 IHere is one example from the file "Haspinst.exe" which is the dongle HASP# u' _  v$ x1 L/ x+ c3 f8 z
Envelope utility use to protect DOS applications:% L$ C8 _/ ^4 v

, q( j! T$ n% I
/ }( B( B& b  S) q7 Q4C19:0095   MOV    AX,0911  ; execute command.4 {" z; L3 K! \
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: t7 S8 N- n7 [# c, Z! h4C19:009A   MOV    SI,4647  ; 1st magic value.4 j% B5 w. b! w& x/ F
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! W7 j# G1 C- m0 |
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 s, i7 N' C$ k9 u
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
9 h( H: a  B2 J6 n7 ~+ p1 L4C19:00A4   INC    CX7 s* Y4 W  X3 _  V. V. ^* R5 Q7 r
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; [$ V- t( B! v/ U+ ]1 e4C19:00A8   JB     0095     ; 6 different commands.
- E2 o0 y) d1 L8 ?2 y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! T/ W! j- `1 ^6 q( }& `) n4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ ^+ k2 F. m& c- Z
, n* f, I$ E- Z' i0 ~9 f! e6 QThe program will execute 6 different SIce commands located at ds:dx, which
/ |8 h+ x8 Y( _& A+ N, xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 Q' ]! ]) V2 N2 s# c% ^+ f

+ \. c$ I6 {( B0 V2 O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., A* C0 @* L$ y0 ]. o9 w) L1 n; H/ t
___________________________________________________________________________6 [3 r1 X% A6 a
5 O7 h1 @* V8 h6 b
4 w' ~: J) s; `6 [+ O
Method 03+ t" G5 O, {$ Y( ^
=========# H( j) Z* A- b; e5 \# y  H7 O

3 C2 U4 }# B1 L; l- e8 S0 c* \# ?Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 C1 f: A* o3 ?& C1 H(API Get entry point)
+ I5 O  }! z" ~  P: A4 X        ) C2 q3 q3 F( @8 e8 R. @& U

& T" ~4 Z! ^1 c" ]5 K    xor     di,di
/ G2 A$ \" q8 e3 e+ L0 n% }    mov     es,di
* x4 c/ T+ h1 p- u9 i2 U; J    mov     ax, 1684h       " f2 }  l5 H" W4 O& X1 `$ Q9 W
    mov     bx, 0202h       ; VxD ID of winice
3 x+ _* m+ P& q1 i8 n) p    int     2Fh
- K  |$ i0 e, @" y    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 h- z1 B  j, c
    add     ax, di
* f% u/ p& A# }& P    test    ax,ax7 }4 S; P4 i0 y$ N. m6 o: j3 B$ U7 t
    jnz     SoftICE_Detected
: C$ r6 N' d$ f2 }: s, O
0 i& U! A4 `" z; ]___________________________________________________________________________% f/ N- b3 [! f6 ^3 ^

! u: ?3 M0 }, x1 q  HMethod 043 ]$ {. ~& w/ H
=========
$ I( U4 ~+ ]" j% Y+ I1 M' Y9 m- r0 I# M/ R, Y
Method identical to the preceding one except that it seeks the ID of SoftICE
& N8 a8 {) I% i3 F3 `GFX VxD.- C2 k7 S% l5 o

/ s8 d1 {) E  s# F; V: p    xor     di,di$ a, i3 ^: o" R7 U( c+ f: r- x
    mov     es,di' [1 y& X3 B3 S7 J
    mov     ax, 1684h      
; g! z, J$ d% m0 ~4 d7 X    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 U; c! f$ q! G( [) `0 \! v
    int     2fh3 I- C, U& ]/ b: O6 }; @
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 X& W$ G( P9 r; R  L6 j, m2 K
    add     ax, di
: r6 k# _( O8 Y. U; w    test    ax,ax% @. o- ]& X, n) j
    jnz     SoftICE_Detected
/ F* t4 Q0 I+ Q4 ?) ?! T
* n; \9 A6 l& H9 B- W% K9 x% O__________________________________________________________________________
! A5 S  S  @1 x6 H
5 b) `9 C4 n) e! r% c1 w
2 r/ f0 p) X/ p! cMethod 05  f+ b) ^( L$ {4 r
=========, K# Z. F3 W; z' t0 x! g) J

4 y8 a$ ~- A! s% F2 t& w5 g$ W5 IMethod seeking the 'magic number' 0F386h returned (in ax) by all system2 }1 Q' s( e( i: n* n
debugger. It calls the int 41h, function 4Fh.4 S5 j; r' [% S# q) \8 p# x* k& y  J
There are several alternatives.  
- R9 A- S6 l' K0 z9 r0 `* H+ B# v/ O' E6 t( ^
The following one is the simplest:0 M2 ~. x. H, U" H; u

* t0 I3 _5 a) Z% P4 r, M3 P! N: L3 O    mov     ax,4fh
5 C4 ]: z! T! P) S9 V% ^    int     41h
# t  W  @6 O- A- j5 U/ p' F1 R    cmp     ax, 0F386* h/ Q$ x  j. e; L9 C1 ~
    jz      SoftICE_detected
# d  o: l: ^) o2 z. X( B+ d+ A& H* A  k
7 P5 p/ r. j$ z5 B
/ N! W* ^8 ]# Y( f# F3 |7 \$ {( \Next method as well as the following one are 2 examples from Stone's 7 A2 R$ ]* ]& Z& i# |* X
"stn-wid.zip" (www.cracking.net):5 o) b* V4 s6 h8 s% h5 J

3 d9 y  T* S% T/ M' }    mov     bx, cs9 \' s1 t! p* _4 Y* {% J
    lea     dx, int41handler2
9 K% \; |$ ?6 Q7 P  z    xchg    dx, es:[41h*4]
6 q$ S. {9 }" C4 X8 I    xchg    bx, es:[41h*4+2]8 b3 f# c) g% N$ o
    mov     ax,4fh
: C8 `3 R( `8 F    int     41h$ @) w# X7 v; m9 Z& ]/ P% w8 `
    xchg    dx, es:[41h*4]5 `$ C: |0 ?3 h* L& n! s4 e
    xchg    bx, es:[41h*4+2]9 E8 l* `9 g' \+ {* u# n
    cmp     ax, 0f386h) E7 L/ j# h9 P
    jz      SoftICE_detected
6 j7 h- C0 W0 p- }9 s7 Z5 q$ N& V; B* r( C5 e% H! h; X
int41handler2 PROC+ t  q4 F$ A' i( D5 c5 A
    iret0 z4 G, k1 M/ Z* t) D
int41handler2 ENDP2 i  v* F$ E8 g, u
% ~9 X; }4 o9 V# E7 s6 U
  Y( @  e, G2 R+ P( S% t* K0 C7 P0 i
_________________________________________________________________________
" y8 w1 Z. k& q9 [, N/ u1 [. M/ l2 V! L3 b$ E! w
+ P8 h( t& R7 u# W" V
Method 06
5 f' j* x) c( d0 w+ _, d=========
8 [) [& r- k, H' R/ B" }) @5 ^; \
- e  v- y$ p; O+ N0 \
2nd method similar to the preceding one but more difficult to detect:
4 j- T& i& N+ ~2 A5 O
2 G. t$ Q- X/ N' @3 k. u( u. T7 K. e
int41handler PROC% E" w3 x3 D/ |0 I9 q2 j5 u
    mov     cl,al& h2 Q& `2 d7 }* m0 E9 |: Q
    iret7 F" n: m" M9 f) n* @
int41handler ENDP# B. C, A) O  I4 N+ R+ l- J3 O5 J

" M8 G5 x- `! T' Y9 O: R; I+ S: `
    xor     ax,ax( c. \% O1 \4 F' i9 B
    mov     es,ax/ V" c2 i6 T7 A7 S* y
    mov     bx, cs9 U% ?  [1 l& h) W4 s
    lea     dx, int41handler/ S/ {& e; y' C4 K% _
    xchg    dx, es:[41h*4]
. K! m& e: ]6 f, B5 Q; m- Q% i' ~    xchg    bx, es:[41h*4+2]$ G; {( s1 ^" x0 P
    in      al, 40h
- ^9 g* b) p# F; n% ?+ C    xor     cx,cx1 p9 [+ z# s5 B9 s
    int     41h' U, Y' |4 e! j' F( k! v$ a
    xchg    dx, es:[41h*4]
8 i" H* v% U8 l1 Y) x    xchg    bx, es:[41h*4+2]
1 A8 O" v! }; \. [* o4 s    cmp     cl,al
: {( A2 V2 Q+ }% `$ E/ a. {    jnz     SoftICE_detected# C4 h+ k$ ^4 l" f
5 Y: P/ p  D" K, f2 c, G9 s
_________________________________________________________________________! D0 e$ |, \% K+ i1 F3 t# ]% ?
' n0 e/ l: w/ `% C  r
Method 07; p- A  c- d5 P; S( U# {& I
=========
; j. x" g' ?2 M/ E& l/ H* a% q, w  w( m% c8 Z9 R5 i
Method of detection of the WinICE handler in the int68h (V86)
' u% P. X8 r9 ?# _2 o6 x$ b0 S
) y& L$ x' n- }% P4 ]6 R    mov     ah,43h8 q' `# C1 r6 T7 q$ O3 x
    int     68h
# w0 h0 Q+ T1 e! |/ s    cmp     ax,0F386h# n) n, _( @/ D; u. }+ {
    jz      SoftICE_Detected) h4 n/ B: O6 W  ?" U( X- T

1 p9 j  N0 B6 f; ?0 l
* Q4 J4 O7 Y! J; I3 z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( I1 N4 A" y: t0 L. ?   app like this:
+ L0 u: n8 Y( z7 D
! D/ r: j3 Y* x: T3 l% J) ^- L, v   BPX exec_int if ax==681 t, h! N9 U7 Q$ m0 R3 @
   (function called is located at byte ptr [ebp+1Dh] and client eip is" ^: d; ]6 J, r# C( ~
   located at [ebp+48h] for 32Bit apps); i7 \! |' s2 }8 C7 ^/ K. _6 o
__________________________________________________________________________
. E+ ^- x" k: d* P) p/ I! V
0 m" L9 S; a$ W+ {. G& ?: E% n
8 k  P; I) j# m7 t/ Y, a# ~Method 08
4 T- A  G, w# I8 v0 J4 S8 N' K=========
+ b1 V) z, A# e4 S- b$ s- q+ M4 @4 J: X6 S
It is not a method of detection of SoftICE but a possibility to crash the6 v/ H) |  R2 i- _, V' O/ d  e# g
system by intercepting int 01h and int 03h and redirecting them to another8 k: Q& u- ]2 C* @( F* a- k
routine.9 Z' _( s4 W9 k* N2 b. J
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# i/ U! T: J0 |/ ^+ ~. d6 {
to the new routine to execute (hangs computer...)
4 H- o" P, K( c# ?% D3 J8 n8 a2 V5 W8 J' t- h7 ]
    mov     ah, 25h/ U, l% @/ q, b! `
    mov     al, Int_Number (01h or 03h)1 v+ g* J( u2 _: E" |% `
    mov     dx, offset New_Int_Routine+ n7 x/ [5 [/ K4 h  t/ o& Y
    int     21h$ Z' \0 n+ u% J' s
, Y6 ~, N! I* s  i! r2 v
__________________________________________________________________________4 j* y9 d6 D$ l2 b+ f" {, z9 i
+ H' g- m% i! V! |/ j$ w/ @
Method 09
4 Y+ s7 ~3 q: X* E=========
4 u; W1 T' O" V. B# o2 p& g+ m  `/ M+ m* l: |
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! Y4 Q  H3 p0 U( e7 ^
performed in ring0 (VxD or a ring3 app using the VxdCall).2 j1 ?, N9 N; M" ~) h2 R' }1 x1 l
The Get_DDB service is used to determine whether or not a VxD is installed
& p6 @% T) _! c! c$ Nfor the specified device and returns a Device Description Block (in ecx) for
2 w7 r2 x: A- e, wthat device if it is installed.
+ P4 L+ V. J# n
  A* y+ o/ o6 m& D   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! b" J( q( a" R- |: ?   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); F: k0 w0 U& m3 x2 I1 }* d5 @2 r
   VMMCall Get_DDB
& U6 l( A  P, |$ U7 h, J2 f   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* M$ R% I% \! n& ]' d- Z2 H4 Q6 z- X- t; k# U2 N2 e
Note as well that you can easily detect this method with SoftICE:
; K$ r% w% {- |' c3 }   bpx Get_DDB if ax==0202 || ax==7a5fh
7 g- e2 g# U4 ?& U" ]* D, K! v0 i3 z6 J# H2 j2 l; i8 F- m$ a
__________________________________________________________________________9 {1 Q  p- Q9 ?$ S5 m+ m

; J/ Q: |# }$ N+ @$ D+ S  }Method 104 h6 U: b# }7 P+ _0 |/ b1 D: n) ^
=========6 S5 ?: o7 V) P; H' F0 ?

& i$ t  J# v: y; k; Z=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% K9 ^! b8 H  A+ Y* I7 i  SoftICE while the option is enable!!
* h# v# [2 f8 c0 p0 A$ H. \9 b4 n* m/ h( {% w- ]" b& B1 y7 f
This trick is very efficient:* g0 I& Y) H. O7 m
by checking the Debug Registers, you can detect if SoftICE is loaded
# ^7 X# ^3 C0 k6 _8 w(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ s# L) l; G5 m% ^7 l9 Rthere are some memory breakpoints set (dr0 to dr3) simply by reading their* S0 g* E& v$ Z1 Z
value (in ring0 only). Values can be manipulated and or changed as well6 l) g' M; k* I# q$ I6 c
(clearing BPMs for instance)
$ |) v* ?% \" N# @7 Y+ N
$ o9 M" f3 |0 K* ?# ~__________________________________________________________________________
$ v: y: \( t9 @* V7 N
8 _* Q; D( u' q% W7 xMethod 11
& }9 Q$ f# r& ^=========
' x, z$ h0 p7 H( V" A+ D; v5 B6 X0 ^4 q5 \. u$ E
This method is most known as 'MeltICE' because it has been freely distributed  F  `( R) H) V- W
via www.winfiles.com. However it was first used by NuMega people to allow) i5 _7 ?$ d' o
Symbol Loader to check if SoftICE was active or not (the code is located
/ \6 U/ \2 Y5 G  g/ Sinside nmtrans.dll).4 }  q6 e9 c) D3 F  K
, @5 a1 g; D- G' d* N" t( G+ w
The way it works is very simple:
. m) F! x- `4 J2 {; IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( `+ B+ e2 `9 C! W3 s0 c3 D7 D- YWinNT) with the CreateFileA API.1 O) ]# |1 C/ H3 f: i4 w
$ w: V/ V" z8 _$ w8 S
Here is a sample (checking for 'SICE'):5 \# j; m+ a5 o* @* a! s# f

' A0 N3 n: S' S2 bBOOL IsSoftIce95Loaded()
; s4 g" {. Q3 ~8 o{4 l5 e# J4 y7 X8 Y7 P
   HANDLE hFile;  * H! d. s+ L# u
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# R' ~/ V+ D' [0 j: M  }4 F/ r$ ~                      FILE_SHARE_READ | FILE_SHARE_WRITE,4 X* |4 p* g( p  L  V3 w
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);3 P7 r8 L: E. m9 o( F! h
   if( hFile != INVALID_HANDLE_VALUE )1 W- ]" T* W7 {. V
   {
: i* p4 {. c0 y8 _0 v      CloseHandle(hFile);" P, x: g% C6 t  w8 c
      return TRUE;
, N3 D/ |0 [/ R' G/ x   }+ l* |+ I+ |2 p& n
   return FALSE;
* w1 K+ l  y0 L1 i+ X0 t! P}
( T" ?8 y, [7 t: ~7 }
/ W: u0 z% h4 e% u% _0 f# Q7 `) ?3 _0 JAlthough this trick calls the CreateFileA function, don't even expect to be" z7 ?& U* ~1 d: r5 p
able to intercept it by installing a IFS hook: it will not work, no way!
7 ]" B8 [2 ^2 `In fact, after the call to CreateFileA it will get through VWIN32 0x001F
6 N1 L  r8 d) s. |2 b) L( Mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" G3 I& {1 j( l: A+ }and then browse the DDB list until it find the VxD and its DDB_Control_Proc7 U( }1 d1 ]+ [; E1 a
field.: L: }( R* y: X+ e4 y+ ~2 v6 P
In fact, its purpose is not to load/unload VxDs but only to send a
; I8 l' H5 Z1 zW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: ]% u6 Q5 x( P6 D; f8 nto the VxD Control_Dispatch proc (how the hell a shareware soft could try5 n2 n. `3 j6 s/ f2 Z
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
* k' S: z0 k" f, f2 J! Y/ AIf the VxD is loaded, it will always clear eax and the Carry flag to allow
, Q3 u5 W2 y" _7 k7 Dits handle to be opened and then, will be detected.
3 i8 H) J; Q% U9 Q: ^( ?6 AYou can check that simply by hooking Winice.exe control proc entry point" ?* n; y% X* Z+ {7 a$ l# o2 P( S7 B
while running MeltICE.
6 G( h$ K# B# Q# \8 Q/ \! e- {4 o" y9 m+ L$ W, m

* i4 V. V" B* F9 f+ K  00401067:  push      00402025    ; \\.\SICE/ g% ^. i- h& B
  0040106C:  call      CreateFileA
5 G1 ?8 F9 d3 z# `5 s4 B  00401071:  cmp       eax,-001
7 [! H( r9 h# L# W  R  00401074:  je        004010919 d% c, P# ?5 V1 Z" u# s9 F7 H/ W
, [0 R, s  ?, _3 q% {& z4 _
& f' }( K; M) r5 A. t9 a  u
There could be hundreds of BPX you could use to detect this trick.
" d. ?* J. W( ]7 C* O5 q-The most classical one is:
4 x; H% |; m/ P# w/ m4 j7 _  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; H/ |* o; R# z% i* k    *(esp-&gt;4+4)=='NTIC'8 k; q. s% X8 u4 r

; M2 v  G# `8 [* R5 n-The most exotic ones (could be very slooooow :-(
; ?: J( a5 V- h1 Y' |+ N# a, d  z" ]   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 \- S% d: ]- W2 u/ X( H
     ;will break 3 times :-(
0 c; a2 K4 M# U. u5 H4 U9 y
% p7 a8 j2 p6 L) [-or (a bit) faster:
" b, U8 Z3 L& }( X" R( Z6 I) ?   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 t! W9 J: h$ m

- k) `9 h, A# a   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 F# v/ O* A. |, Q, x6 ~
     ;will break 3 times :-(. Q8 v* T+ r4 B5 D" A' A8 Y' B; y4 [
' n7 T+ R2 z. q% h1 f; M
-Much faster:
1 ]- n, z; J. Y' F% q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" d/ }9 y; T' w9 g% j8 l
8 [2 x7 P+ a! a* z8 H. K6 p
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen; Q. F% A: o( n
function to do the same job:! u6 M- y% b+ N9 q& j
3 N, v% m1 J* W6 t" d5 ~
   push    00                        ; OF_READ( i* M9 u. D2 i" T7 W
   mov     eax,[00656634]            ; '\\.\SICE',0
* I$ g6 n1 h! S   push    eax& E% H/ A0 b1 j6 u8 z8 O
   call    KERNEL32!_lopen
0 b( T# x& p2 |' @   inc     eax( t" o' @, h, L" n+ p7 U0 J$ T
   jnz     00650589                  ; detected
2 l! Q3 M* _& F7 a7 g& B   push    00                        ; OF_READ
. Z  d$ U* S2 z2 x   mov     eax,[00656638]            ; '\\.\SICE'
1 Y$ v2 S" V3 w. t7 I' ?' O   push    eax) O4 P1 X- t* i; J3 q4 L. |
   call    KERNEL32!_lopen
3 o. \5 _3 W, l4 Q   inc     eax7 d* n- z8 z% v+ \) D7 S% e
   jz      006505ae                  ; not detected
/ _! S9 q( K5 g9 K5 {5 @5 ?
2 U6 V' @, P$ @# ]/ I5 b
! V. F6 D; z7 p* m6 A1 t__________________________________________________________________________) V; f, u9 t' s! b) N$ ^8 p

% S" X: I  h% LMethod 12( V" a5 f6 A9 E. F" _6 I) P+ J
=========% E6 m8 p2 Z) A. V' _
% U: \/ T$ B* q* s
This trick is similar to int41h/4fh Debugger installation check (code 05
: D! \8 @" O  R! K  O% }# {&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; n: x5 o2 L$ c. d  m  Q; Jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.4 Q% S3 l4 V% B

* N4 U& \7 o2 ^/ H: W8 g. P   push  0000004fh         ; function 4fh
" Q1 b' @* Z( F8 q2 Q" v7 G9 ?3 I   push  002a002ah         ; high word specifies which VxD (VWIN32)
" t! l5 J8 T6 o                           ; low word specifies which service/ }- Q6 j( _6 C2 w# s# d
                             (VWIN32_Int41Dispatch)
2 V. t1 z" L+ d9 @. J+ e   call  Kernel32!ORD_001  ; VxdCall
3 H( f' Q7 X+ V9 w" O. B   cmp   ax, 0f386h        ; magic number returned by system debuggers" p& i$ Y$ x# n6 ?6 e* @
   jz    SoftICE_detected
" D* F( A4 _! Z( u
% q0 d& I+ e& C7 q2 {- XHere again, several ways to detect it:, s! H: z+ [) N3 ~0 Q. ?
* ?4 h% B+ w3 q3 p: W6 @) q+ s
    BPINT 41 if ax==4f
+ [; ]; A3 X, X7 {
' @4 O: F" v4 i) h) p' s    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one5 Z! P! j- p' O- F

7 x/ |2 s& s" {2 x. ]9 \3 o    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 N( a( L( |. n2 i5 ~
: e8 r1 N) @& \: g+ l7 U. b
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) m! r9 c3 Z% j) j. O6 i0 e, N' w2 j
__________________________________________________________________________
4 ?9 W2 c3 S1 U5 h/ ]9 t" Z5 m
% r  s$ k4 j! N" F) mMethod 13
+ O4 Y% }, |' _( M=========
. Y# L1 J4 z+ f" H. V7 S  G7 P% o3 y, p* T5 ~  @4 u
Not a real method of detection, but a good way to know if SoftICE is
- o5 c2 K6 S8 L3 Winstalled on a computer and to locate its installation directory.
0 M) [* X5 s. x" h; p, A) K; BIt is used by few softs which access the following registry keys (usually #2) :
% o. D- k7 j5 |: Z
% V# D9 E' Z  v' K-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 I1 c! k: r* }\Uninstall\SoftICE- N! k8 y4 b5 E+ |, V0 B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
  a$ @3 Z1 I, I% O/ F-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ w% R/ J5 O7 i' S4 i/ n) k\App Paths\Loader32.Exe  D7 k- F+ B5 _6 L
8 u  K! C3 ~0 \0 Q) R* }8 c4 l

5 T" ~8 n! w1 L6 n  o: K- N* rNote that some nasty apps could then erase all files from SoftICE directory
4 Q. ^! a8 \5 `8 |* j( _* `(I faced that once :-(
1 D! d; Z9 \& u( h' y
* J: I5 u. O8 u' W4 z3 h  ~Useful breakpoint to detect it:: w* d( a2 t9 v( F
" \7 P9 Z6 ]2 |# v% r- B+ r. ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 M: L1 k9 k  F
! @2 O  b- b4 o& P' h7 n__________________________________________________________________________
0 x0 \2 n7 Q9 n$ U+ ^& c5 g' |. E1 d% H" d4 v" r' U: Q7 ^

* e4 m* T& d$ \. C: }% gMethod 14 . B$ [  e" K* {- T, f
=========
' y6 W. K, N8 h  O5 ]1 M( Q, W6 t0 d2 x+ Q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 H4 [' c# _' q* K3 u" e
is to determines whether a debugger is running on your system (ring0 only).
# z, Q4 ~: \9 {% {8 L' K; e( k7 W( L
: |, X+ x* c0 V   VMMCall Test_Debug_Installed
/ P) n) I+ A) P# ]1 R7 q% [; d# O6 Y   je      not_installed9 ~; S% P) t: v% k2 V: x2 ]# B, h5 d

/ `2 O/ h) E; o6 h0 d! HThis service just checks a flag.
  I$ J. [8 B4 N1 w) |' c</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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