找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, K- h# |9 k# a. M" P/ u! B) |* }<TBODY>
5 D6 V, R( Y, v# V* L<TR>8 |( ~1 n! ?- P+ q3 u# X4 Y( C6 N
<TD><PRE>Method 01 6 D5 r  V2 o9 F! |6 R0 ]$ i
=========6 A6 i8 `$ e; D, ^

4 F( R! N% l% p% T" v" lThis method of detection of SoftICE (as well as the following one) is
* R1 C' U. Q7 _# s3 U, H# rused by the majority of packers/encryptors found on Internet.% s% C% J' C) r8 @
It seeks the signature of BoundsChecker in SoftICE
  {( y' s/ W4 ^+ K
4 x" n. ?$ H0 c: b8 [0 s- Z  r    mov     ebp, 04243484Bh        ; 'BCHK'
  N; m. K& G- m9 o# d2 w. I    mov     ax, 04h
$ v3 ^5 H. O& {/ _! C    int     3      
5 X( M# A' }4 T    cmp     al,4/ k4 ?/ X( L% [9 y* N& P
    jnz     SoftICE_Detected
. ]3 P5 e" J0 A% F+ p, h$ Y7 k9 l! H1 C+ v" C/ |
___________________________________________________________________________
; s% }, t; a8 Q2 @8 a1 n7 v1 x4 w: i& [0 U/ G6 Q
Method 02
& c- d+ o  z& n. z: y=========! G6 K' ?* `" e

* q2 r. J  J8 Z- v. X- HStill a method very much used (perhaps the most frequent one).  It is used! B. F1 Q$ G) ~$ I& o4 o
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
- v( W8 I' a9 m0 {  r8 }or execute SoftICE commands...
& A# {: j: [3 v' XIt is also used to crash SoftICE and to force it to execute any commands: K! a- M* H9 i! j3 U
(HBOOT...) :-((  
1 j5 H5 U7 s+ z7 `# f! ~& ^! x6 |6 h$ k# t9 f
Here is a quick description:9 ?+ D$ d0 }0 N/ y; u
-AX = 0910h   (Display string in SIce windows)
: D: ?4 z9 R' R3 u# l-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- \$ Z' [' ?7 m
-AX = 0912h   (Get breakpoint infos)5 j: A( b; |: A% n! I. \6 m
-AX = 0913h   (Set Sice breakpoints)+ ~( ?! I1 G. Y
-AX = 0914h   (Remove SIce breakoints)# H2 E( p; k1 R
- K+ k4 K2 i7 f9 c# \2 E9 P1 q
Each time you'll meet this trick, you'll see:
3 n7 v) H( T" L" f' B* [* t) ^: a; N-SI = 4647h/ s- P+ u+ E( n4 R
-DI = 4A4Dh
' I: C; d. m: @Which are the 'magic values' used by SoftIce.8 x! c" h4 K& Y+ K) h1 e( r8 J+ X
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 E) \8 N- g9 N7 s+ N4 ~5 K; s

  K+ |/ b3 M8 f# AHere is one example from the file "Haspinst.exe" which is the dongle HASP
) v& P) O2 e4 |9 y# r& P/ jEnvelope utility use to protect DOS applications:5 n  U) m& u' n5 `! T

  v* V. }$ P& n( R% L$ @/ n. x) k9 H8 M- z2 G% b4 f" c
4C19:0095   MOV    AX,0911  ; execute command., @& ~5 e' U. A' u) Q/ H  T
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).1 \! i! q( c& u: @# K
4C19:009A   MOV    SI,4647  ; 1st magic value.
( J/ I0 `# a( }7 `5 _7 q% v4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ r3 g3 R+ {) _  M( W8 E4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)/ W( `8 ?& v5 |8 ?% {/ n
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
( ~5 m# a5 l$ r7 q9 f% C0 \4C19:00A4   INC    CX$ h% [8 o3 C( M4 Z0 ]+ V
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  H( x4 k5 D8 v0 @  l2 _4C19:00A8   JB     0095     ; 6 different commands./ N  C7 \, h0 |0 O3 }5 p
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 X+ s7 I* D8 L% J
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 l! a, m5 |$ g9 C3 l9 G
4 o& Z! C. I2 T4 m7 i/ f% X
The program will execute 6 different SIce commands located at ds:dx, which
& T0 r8 ~) y- N( q  C) d: ~0 Ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.* p' f+ j: @8 m( m* \/ w" C0 q

- Y  n- Y9 ~; c1 z' h1 ?" x* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
( o8 K# k" X# h, c" |4 ~6 w___________________________________________________________________________; z% {6 g! [% L/ X  j
6 w. w- W# I) a, v* N; e; l4 Y4 a

9 q( {: }: c% e) Y9 ^$ A2 fMethod 03
  v* a7 t. O) @9 {, \( B=========( M& O3 [! X6 p' d, o" W" g% C

$ m$ g! Y5 i! G: ?* Z6 _Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 i3 y9 n/ _" d! K1 q(API Get entry point)) j$ d1 q$ v- L5 Z- A/ L: E
        # C  K& x9 A5 j; |. s; j: B
1 ?: g5 n) u0 Y9 c8 G0 E
    xor     di,di
- A. j% e! N5 Z/ v- a* T9 H. f8 N1 k    mov     es,di
1 C, L' i- j' e9 \1 |" U    mov     ax, 1684h       . [4 e) b8 s2 ]/ D' m* g* s
    mov     bx, 0202h       ; VxD ID of winice2 }/ g. q/ b+ ]9 Y7 u( \; b7 I
    int     2Fh; H) i* R1 r: d+ w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 O- @, d$ p. Y% @8 p7 t    add     ax, di
  \9 q, `1 B' I& n' x( I6 }. ]    test    ax,ax
4 l& x' A1 [/ ~/ M- [; t7 s    jnz     SoftICE_Detected
$ c& h' P& Z/ e$ y4 g! l
/ z5 y  z7 @, `0 B9 v( o, o___________________________________________________________________________
& h; K* e: F4 ^, x+ u( N
9 y5 ~" f! c+ g1 KMethod 04- v% N; e5 @$ e' w$ P
=========
) Y8 x: {( M9 {) c
& v; h+ X( }  m, \0 B, P8 t% IMethod identical to the preceding one except that it seeks the ID of SoftICE& B. W9 x0 p) X+ E- p+ R
GFX VxD.
" b/ ?) N, `" _8 U* h4 M1 M/ I* O- S' B0 \% [, _+ W2 \
    xor     di,di- O' i9 u4 r9 M
    mov     es,di2 m! V4 @6 y  i  V9 w. @: x
    mov     ax, 1684h       - U' `: X8 i% z  K/ h' z1 J
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 b3 z9 j1 q6 E6 K5 L+ J    int     2fh7 F+ z5 Y2 m+ Z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 G! T6 ~* t( W; [; g9 l7 Z5 \
    add     ax, di$ H7 |2 A: T! l! `* I
    test    ax,ax
( j1 Y' x8 b- `/ f$ X    jnz     SoftICE_Detected
( g5 V% E5 D6 k' [$ H$ e8 G* o  E5 Y8 s; k- B* Y( m. ~
__________________________________________________________________________6 C+ J: t/ M' d3 J( @' c
5 Y; [7 ]+ h, ?: T8 ~! A" m

, {5 K$ F! `8 b0 a8 iMethod 05( r+ t  J% ^& l. u" M
=========& t: h/ b; T! I  g) A0 W8 Y8 `

) o5 w& P# ~' o, RMethod seeking the 'magic number' 0F386h returned (in ax) by all system! P) d: }9 k( ^3 D. P
debugger. It calls the int 41h, function 4Fh.  l: ^) P5 I+ Q( I& Y6 E
There are several alternatives.  
( D4 Q5 y" P6 o; z
! R) m2 R) d* {The following one is the simplest:
3 w4 Y! v3 k, m& ]2 X3 D" u) l4 q" \* `" f3 {: }% ?
    mov     ax,4fh& `5 G# X9 N1 T; S3 f+ T/ Q6 X
    int     41h
1 C' o7 i  ~# z0 T9 [3 E    cmp     ax, 0F386! L7 s$ R8 J! A( f: `" G* W+ R
    jz      SoftICE_detected
  {3 e5 v) R8 j& v! H& T& g$ j& ]  R) S: i4 Q" a# x

% b. g$ b2 M- `/ P7 _5 V- ^  kNext method as well as the following one are 2 examples from Stone's   H3 i3 v: z" R& ]* n# R( y% G( t9 d( w
"stn-wid.zip" (www.cracking.net):
0 A0 p! i6 {4 G% J: f' o" z, o' J. `6 `, R
    mov     bx, cs; w3 r, u$ F! b# v+ K( X% z' a
    lea     dx, int41handler2, ]9 w  N# k5 s( i! k# d' p) g' Q4 N& V
    xchg    dx, es:[41h*4]
3 a+ @3 s5 y9 B0 `; {5 ?    xchg    bx, es:[41h*4+2]2 ~% I  @) q) X& h( _! O
    mov     ax,4fh
- z- l5 i) _  u4 c1 o    int     41h
# v  f8 c% V8 A    xchg    dx, es:[41h*4]
* E/ a! d9 o6 N: a$ `7 R  n    xchg    bx, es:[41h*4+2]" ~% t2 k; M/ B. s5 }, c
    cmp     ax, 0f386h
8 N$ r  q$ X* j  l    jz      SoftICE_detected
* I1 z3 w  n+ O, \* ]
# Q  ~" _4 Y5 h4 e6 Oint41handler2 PROC
; y! R  c! T3 H, M6 M5 Y    iret
. ?9 i' o% P: O5 O* j8 \/ [+ x5 eint41handler2 ENDP
9 x/ Z! w" h+ M8 ~7 v6 t, a1 d
( F: d3 K1 V2 G$ C& V* f% i: ^+ M' t- T9 [- }7 _
_________________________________________________________________________/ {( S" |( H/ p$ I) I* R- P
3 n2 u3 f) F, ^3 S+ K" [' V6 p
# G% V7 H. Q8 L: G
Method 06' ~$ d5 W3 \7 i+ q3 I% F
=========0 k( F8 M5 L; H/ a; D6 I- `( T- F( }
% v1 T! s4 X7 I& @3 w* [
  K# U+ r$ K( e& `
2nd method similar to the preceding one but more difficult to detect:4 H; a( v& c, A/ J  K- @2 j
2 d) ^6 u* r( ~3 q" y+ ]

" w& _) ^! ]: }; u. j4 U, ~. |* }int41handler PROC% [% T" q3 D' ^8 `; K$ Q. `; X1 c
    mov     cl,al+ q' L- h& a  ~$ [# X2 D2 F& y' H# X
    iret5 ?  P) _# z( A& v" ?
int41handler ENDP
' k; u  P2 y+ g0 Z$ |* ?. A+ O6 n% r% p
% F' ^9 Z$ \. V, Z0 L1 W
    xor     ax,ax
+ [) [7 d( ^- N+ \    mov     es,ax
. w9 @: y' i, d! D& C: F    mov     bx, cs+ g; l" w- P# b, u2 m
    lea     dx, int41handler3 I) o8 B: m2 a7 ?2 }; y9 F+ o
    xchg    dx, es:[41h*4]  M  ^- _2 m+ B4 o- z* A. T
    xchg    bx, es:[41h*4+2]
2 C9 d7 {3 f& {* a    in      al, 40h
+ ]' n8 z2 h" [+ s: T# r    xor     cx,cx
. y0 `2 w& ^; g9 P    int     41h
/ i( I4 A7 i/ n0 l1 |3 B    xchg    dx, es:[41h*4]
& v; `2 |9 H' V) \    xchg    bx, es:[41h*4+2]
# ]$ T7 Y' r( h    cmp     cl,al
* }. B) p' u1 O0 m  ?2 O7 f' `    jnz     SoftICE_detected3 l, \) {- Q! f/ E. m
/ @1 r. z9 d" Q- `3 L4 G8 r( y
_________________________________________________________________________0 I7 I. }; Z6 A! x% j- F

6 Z' e$ I: o8 O  J/ |6 `' lMethod 07; Z7 r. Z  X6 v1 ^/ N# K4 N0 P
=========
* J1 \5 o" Q- q' R9 H1 ?, n+ B) I
Method of detection of the WinICE handler in the int68h (V86)
* L; B- j# m& o- T* ^- y
% E$ @6 r( d5 `  K* N    mov     ah,43h
! a2 |+ s3 D% F7 a4 {; z    int     68h* y+ c; J9 V/ V8 P- [
    cmp     ax,0F386h
' g2 g" \4 w/ o4 g    jz      SoftICE_Detected
' o3 ~6 F5 @" p( C( E, N. a  q- \3 M* t4 H7 t

" E% C0 a3 u. I4 u8 Q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" u* [7 s4 i5 A; u" S/ }4 U& V( G   app like this:
! ^. A, P& S/ E! t. E
$ h6 E- {3 o8 _9 \+ _- N. }   BPX exec_int if ax==68
- Z! i3 e# C! N: L! x   (function called is located at byte ptr [ebp+1Dh] and client eip is
) w" Y% A( Z" g2 n   located at [ebp+48h] for 32Bit apps)
" M: G3 [  [7 R1 A__________________________________________________________________________2 @1 r7 {8 C/ w3 u8 a
& I  Y& m$ p6 S5 r
3 q! A) D+ n) l& a, p9 F
Method 087 _% ^6 L9 \1 K; s$ w! q* i
=========
. ]# f/ A. Z& X: q7 v7 z8 ^  N7 [; P4 `2 r
It is not a method of detection of SoftICE but a possibility to crash the9 n$ `/ }: p2 |
system by intercepting int 01h and int 03h and redirecting them to another
5 |4 x; g2 C8 }' p. @& m; T$ x& ^) `routine.3 c2 {# x" |" R/ p8 z$ V- f3 s
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 `4 e0 b) V& K1 @, o1 w, e, Cto the new routine to execute (hangs computer...)! V0 U8 {. |7 D9 H% ~
# ~4 ~, b# \4 _, m2 R! @: Q
    mov     ah, 25h& H7 e! n/ r- k& U& X9 j" {
    mov     al, Int_Number (01h or 03h)
  k& `6 D1 ~. U4 a$ v3 \* W: w    mov     dx, offset New_Int_Routine4 I6 P: T" }6 K$ t- S6 h7 y
    int     21h# l  ?# O1 h. z! z

) x/ n) s5 q4 U__________________________________________________________________________
: N5 F' a) O4 _5 a- B% v; S8 S0 D5 w4 l7 d
Method 09
6 V9 v  h" m# e4 R5 C/ Z=========
; [/ Q( C# O2 M& j6 O! a, a" s. q+ o5 h0 J: Q2 q' e
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! O/ \/ N4 H7 N# y/ f# A% _' }performed in ring0 (VxD or a ring3 app using the VxdCall).. u6 J" Z5 _& ?: d& ?7 V* G
The Get_DDB service is used to determine whether or not a VxD is installed
0 n6 Y5 j( k3 E( Sfor the specified device and returns a Device Description Block (in ecx) for% }6 I. Z/ i; a5 M6 |8 t5 c
that device if it is installed., M, F/ k& \( ?* w6 g2 ?

5 Y$ a# v+ r. l9 L4 U1 ?  r   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& |" N2 G1 m7 ?4 F   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)# m% N. M" [! O9 X5 {
   VMMCall Get_DDB
9 E0 r5 q8 e5 ]+ q8 [# N: n. x   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 r  ^' O: h4 c" b( B: _# A# E+ R& n
Note as well that you can easily detect this method with SoftICE:0 F/ K+ v9 v) S- q) s6 s' i2 ?
   bpx Get_DDB if ax==0202 || ax==7a5fh9 u/ t3 e0 o; m+ W( y  R- ~
: K, e+ W, h1 B7 q* D2 S2 d/ B
__________________________________________________________________________- m0 Q9 _& V' g0 }1 z7 \' n! X
( c+ F4 m. F6 h, J
Method 10" S+ W1 p5 ^, g4 n* I, ]
=========/ A( H. l- P8 x: I# [; V

  Y: b5 J' [: V1 [3 a" w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ @4 ~" Q: E- F4 z9 ^5 R) ^
  SoftICE while the option is enable!!) ^) x+ E% N) C% \) x
6 J8 F! [8 f" M8 l) o4 a( ]
This trick is very efficient:6 n" ?: O$ ]+ |6 ^- [
by checking the Debug Registers, you can detect if SoftICE is loaded/ X7 @/ [& N6 E  v
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% k( w1 u2 c) ?7 M8 }there are some memory breakpoints set (dr0 to dr3) simply by reading their# |5 q3 x+ V* l) B8 K
value (in ring0 only). Values can be manipulated and or changed as well3 _5 W8 @6 X/ X3 v
(clearing BPMs for instance): }$ C$ x0 a1 T5 _

1 A+ ?( r# }% z, c. o7 L__________________________________________________________________________! k% @7 r8 Q, ^3 S0 S/ p; T

. `8 n6 Y; w2 h+ p9 t" oMethod 11
) ~" {! v% X0 X& s+ e) C=========
" u/ ^% B, H2 G
6 W! U* Y  u5 k) O/ uThis method is most known as 'MeltICE' because it has been freely distributed
: y0 Y$ l9 f- l& G3 k. }via www.winfiles.com. However it was first used by NuMega people to allow
4 t5 f5 @$ [# C3 }8 eSymbol Loader to check if SoftICE was active or not (the code is located* r. T8 s- I8 t% \! c. s* F
inside nmtrans.dll).
/ ]" Z3 _8 W) Z' J  V* o1 S! y5 O4 Y
The way it works is very simple:/ W0 t7 F* g. u
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% u. F% Q% ^! |4 q* {  s. }WinNT) with the CreateFileA API.3 Z! }7 y+ E$ S7 w. S0 S5 S$ N

5 A  [% z3 N( K8 r* }& gHere is a sample (checking for 'SICE'):5 R! I6 V  `( j; S1 e" |; C
) w7 h* l. R5 ^& h" ]
BOOL IsSoftIce95Loaded()
* a, L2 k% K3 R3 S, P+ X% H+ n{! L) D, S. d9 c- S4 S
   HANDLE hFile;  
4 k9 u8 z9 g4 F5 ~8 @   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 u$ X  k4 |2 L  w* e
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& \  A: v  R! g4 v                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);: _+ [4 g5 N# Z6 w
   if( hFile != INVALID_HANDLE_VALUE )+ _5 y3 u4 W* E3 z# |3 s: b. K, i
   {  D. r3 ?3 R9 Y/ X" P- {# O8 E
      CloseHandle(hFile);: K2 H' c8 T1 D2 n: J
      return TRUE;7 h$ d5 V, D6 R3 T" X& T2 v  P; r
   }
2 l, n: _& Q; M: e   return FALSE;
) z, Z# [7 k/ A6 @! U! T}+ E$ X' ]  j% o/ y8 I3 X$ d$ [4 m1 \
  w$ g2 ]" {; d3 f
Although this trick calls the CreateFileA function, don't even expect to be
; E, s" Y& c! t  O5 v0 Cable to intercept it by installing a IFS hook: it will not work, no way!+ J% g+ ?0 T% ]( `
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
& I1 |" m1 c8 X- R8 X  {service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, v( x0 R: |+ yand then browse the DDB list until it find the VxD and its DDB_Control_Proc" E& F: |* W: M( K' y
field.
1 A/ M2 P$ A3 f7 \" |- zIn fact, its purpose is not to load/unload VxDs but only to send a - F8 ^  k" |9 w2 V
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 h2 x' [4 h; k6 ]# Z0 o2 h9 Xto the VxD Control_Dispatch proc (how the hell a shareware soft could try# y! l  I# {8 K9 _2 r  \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).  R' H6 a* N/ H# D3 d8 u( e
If the VxD is loaded, it will always clear eax and the Carry flag to allow/ v  f+ S  j2 B" E7 I1 S
its handle to be opened and then, will be detected.' p4 ^) X2 t8 s
You can check that simply by hooking Winice.exe control proc entry point6 e- k7 n! X: o/ i1 J: H9 O
while running MeltICE.+ i+ h! X+ U, `' R
/ W, j+ p5 u8 H3 f: t7 s

; Q  M+ J. `: M5 H  00401067:  push      00402025    ; \\.\SICE& d- {# e+ d5 j
  0040106C:  call      CreateFileA
  |: _2 ?5 O: n. U6 V, F  00401071:  cmp       eax,-0018 A8 e; c& _# M4 V. [& @
  00401074:  je        00401091
2 X9 m; V6 P( u6 f1 @1 `* |( |$ p! B* D* b7 S2 [! h: z

) c% Q' O3 e- c* [- l# wThere could be hundreds of BPX you could use to detect this trick.& M7 w9 a9 l' z7 J
-The most classical one is:
# B: }3 N) \: @$ j) X. |5 x0 a  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||, u4 i! K  J! m
    *(esp-&gt;4+4)=='NTIC'' y9 R4 {# u  w" D# j
7 \5 N9 O2 s/ N
-The most exotic ones (could be very slooooow :-(
/ h6 [7 \2 C. E7 f* n$ e   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; E( }" a& |5 n/ O5 F' l
     ;will break 3 times :-(  F: T8 o; D( G. B

/ L4 g$ \* H* s9 L/ K' K% V: W- h! e-or (a bit) faster:
) [1 b6 g+ ?+ y! U* b$ v* N  _   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( z* w5 }2 ]' ?) ^( u
" _% @  T9 A7 x* D
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 a7 E/ U6 {0 ~2 e4 W: i2 X" H     ;will break 3 times :-(% T2 \1 A# O7 [+ V, W& `

. n" N! m. `2 ], \5 h' u; _-Much faster:
9 R9 |' u) P0 A   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; U$ W' P  R* B  d# f5 W. p1 _, B2 D' S( q) L, W2 ^
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 K- y& J% M+ x" P/ yfunction to do the same job:! l7 d; b5 S+ l' T4 o0 [# k
6 b- p1 H9 ]' l; S& A" F
   push    00                        ; OF_READ3 H% g; ]+ `( g9 X' I2 n
   mov     eax,[00656634]            ; '\\.\SICE',0
" H2 u# Q+ k1 O! f   push    eax) {3 ?' s" r2 J4 S4 m# S
   call    KERNEL32!_lopen
! k6 s  T/ ?& Y! F/ s8 }4 D   inc     eax
1 k$ v, H  D5 q- ?" ~6 i8 M2 P   jnz     00650589                  ; detected9 D: m* s2 F/ [  B" |: B+ g1 `
   push    00                        ; OF_READ4 n7 B/ d; x$ R7 E0 l
   mov     eax,[00656638]            ; '\\.\SICE'4 G" o+ d. K# |3 M8 O# w' a+ j% Q, X
   push    eax
. ^( D5 U2 o$ m   call    KERNEL32!_lopen) z; W! [3 ]9 ]0 L
   inc     eax- z( w8 V5 L9 Y$ I6 h
   jz      006505ae                  ; not detected
$ i6 x& ]% h; k. ~' e, Z, I. c" C/ `1 x& y0 J0 Z

, f) p/ f9 \( y# H& \( h0 `__________________________________________________________________________/ g+ \, u  }% `7 ^! S

/ \1 f3 w% |9 I! F- W  CMethod 12
& }& f' w3 P  M% r* ^: {" e( v: ^7 u=========7 z2 ?& o$ v  Q9 k) L  u8 H" h
# @8 B. H+ c; W; f0 T/ \+ u
This trick is similar to int41h/4fh Debugger installation check (code 05% \8 x& T" W8 W- o4 Y9 T
&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 x, e( H0 I% X  S/ J* C* R- ^
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
% P! ~9 W, W: v5 P# C2 X1 p' p; _8 |
   push  0000004fh         ; function 4fh
3 W8 y+ V. r; J$ m   push  002a002ah         ; high word specifies which VxD (VWIN32)+ e5 r* a/ O) o4 W# _- {
                           ; low word specifies which service# W% t9 A8 b, }" ]! e- V
                             (VWIN32_Int41Dispatch)
# w+ x" Z2 X9 d   call  Kernel32!ORD_001  ; VxdCall
9 C9 D7 V$ d* i- w- t/ d   cmp   ax, 0f386h        ; magic number returned by system debuggers
& x0 X  J$ D. \! }0 N7 ^2 W   jz    SoftICE_detected8 K9 o; p: n3 W+ K  ?$ @

4 b4 Q4 p7 L% x$ ^4 p: S2 `Here again, several ways to detect it:
% ^! {, z7 w1 d' j2 m1 ?" E1 y) y/ _) N% U
    BPINT 41 if ax==4f/ @% U- V/ B4 |# c( S
# g' R. C2 s2 V
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 a8 j+ j( R5 f% a
. x1 s/ s0 n7 W( A$ ?    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
) W8 k4 u) y' T9 K; T
* T" ^' p( |  x" ~2 ]9 i    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!8 N/ a/ g3 Q+ O5 R4 q
$ S- w/ H# z6 s8 _* |3 U6 |3 g
__________________________________________________________________________
( Z% t! T0 J0 z/ `% r# y& W$ m& G$ x0 n
Method 137 j4 `" Q# x1 W" H1 A% E
=========" {' y% ^- ?5 e8 W8 D

) a" D5 D6 }$ g2 J! hNot a real method of detection, but a good way to know if SoftICE is1 h) V9 q* `' a6 ^8 b
installed on a computer and to locate its installation directory.
; R9 j0 k! R* U/ ?/ z( ~: t8 ~8 g* JIt is used by few softs which access the following registry keys (usually #2) :
' s* K# Q, F! O
  G" ]. u( ?: ]6 g* n. x" r-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  |, _; {% G3 T7 |% `% l9 W\Uninstall\SoftICE, |# e. r; t# Z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! `+ m) L# |/ P' L" u* Q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# K# d6 x$ I/ q& q/ S) e8 Y
\App Paths\Loader32.Exe
; g) g& w& H- [; o
8 f. B+ I  [( d7 P; }# j5 J' o  Y8 t) O; Z1 T4 N4 d2 o
Note that some nasty apps could then erase all files from SoftICE directory$ h: z( K4 J+ E/ ?
(I faced that once :-(
/ |" h$ X, f# w( i+ F$ z& a
) G. Z. |( Q8 O! \) SUseful breakpoint to detect it:3 C  ]! P& r- ^) ]/ Q

! F! G: w4 J# N! v     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  K" T$ T* A% D! ?6 |& ]

: r. Z. e# K& V: g) j0 B/ c__________________________________________________________________________5 |) a' z1 m8 H) x5 Q6 d
  e* ^) K0 Y" D% G/ C( K

' y( @4 G) {$ t4 ~* Y% XMethod 14 : Y2 M, [* P/ Q/ b& l- X- H2 o2 ]
=========3 L0 D5 X& H5 B# J" g

7 h1 l, D, l0 B' H3 y1 wA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ R, w& _  S6 J9 }6 I
is to determines whether a debugger is running on your system (ring0 only).
: G+ ?! F6 }0 k( E' P( ^" m
6 R4 i+ L; V& I8 m   VMMCall Test_Debug_Installed
, P. r1 t; C/ j& l+ H5 _   je      not_installed
6 i' `, T. L" M9 q
, e+ i5 R2 y5 H: _" y- {6 ], ZThis service just checks a flag.
& I) S, l* _1 p8 o</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-17 17:28

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表