找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# C- \- c$ d: [" Z/ x' Z! d6 ^<TBODY>
$ [3 _4 Y3 |3 ~3 H<TR>
7 k  n: _9 D0 U3 O3 m<TD><PRE>Method 01
! C+ k- {+ c0 j' a; z! a" d: E* A6 B=========
6 A0 U( }; D" W1 B. L3 \9 `1 C+ e5 V4 u# M  K! u
This method of detection of SoftICE (as well as the following one) is
! Q2 Z9 I; M4 jused by the majority of packers/encryptors found on Internet.
" ?1 e3 g1 N8 S. f+ L3 `, T2 H6 sIt seeks the signature of BoundsChecker in SoftICE
8 [5 e& |( F3 j' q4 L% F
- k8 j! a3 |$ O* o) W0 B% |. \    mov     ebp, 04243484Bh        ; 'BCHK') f2 w" B, ?, f$ g2 k/ b
    mov     ax, 04h# {4 c8 a7 G) U7 }$ l+ q5 F
    int     3       - V# @7 k7 |2 i9 }
    cmp     al,4
* i& }& J2 n5 d8 \3 \    jnz     SoftICE_Detected
+ {2 N' J) ]" j" j, W* B
. n5 {1 v: h  {___________________________________________________________________________
+ j' G, u% d- f1 s2 C& F% ]! q) p; X6 A
Method 02
4 J- W/ |; O$ U0 D3 ~' i# q9 `7 D=========% @: L9 {' N0 h; ?5 F+ ?
" p: S# a9 N1 U% H3 d, a
Still a method very much used (perhaps the most frequent one).  It is used
0 ]$ U, V9 T& O" _3 E+ }& p; D* qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 z. Z5 C  s. w# j
or execute SoftICE commands...' R5 D# p! I' h  y! @
It is also used to crash SoftICE and to force it to execute any commands, Z* R" g9 s- U$ G4 N
(HBOOT...) :-((  
. q! i- u9 S' B% p& k" l# M7 e; z$ n# |- X" s0 D$ ]0 }: }
Here is a quick description:% o5 {9 D5 j5 E9 d* r+ x& n
-AX = 0910h   (Display string in SIce windows)
1 L; O" k& m/ ]/ h9 C' d. _-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 ?, o( ?  y% O$ @- X) n4 a: t
-AX = 0912h   (Get breakpoint infos)
. K$ g! o5 m  d( y-AX = 0913h   (Set Sice breakpoints)
/ j, h7 b8 J8 g# v9 N% A-AX = 0914h   (Remove SIce breakoints)
) o3 ?1 o9 b! w& \) a& e% o" _
/ Q' x8 v" m8 E- ^) ^4 |) wEach time you'll meet this trick, you'll see:
' }- b' h  i5 U4 Q3 A-SI = 4647h
% k8 ?( ]6 G; S1 p( s-DI = 4A4Dh& K" o9 \/ i" ]7 Q( k; G# F8 o6 q
Which are the 'magic values' used by SoftIce.
) r; D/ H& y) V2 M* Q- K" kFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 |5 X* [- I% X* N8 c
7 K; s! F3 I3 ?0 N8 w
Here is one example from the file "Haspinst.exe" which is the dongle HASP& d7 L) o- o  I( `  P+ I
Envelope utility use to protect DOS applications:# H4 x6 I& l: Z) E' R' k
0 K7 @: |9 e$ p+ \" U
$ N0 K) U6 `4 Y8 \4 C
4C19:0095   MOV    AX,0911  ; execute command.. z6 R( }$ j: s6 s! c# D; G
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) ~6 M+ H% c* D, U( n1 b5 j3 u
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 y8 x* c& s0 Z2 c6 T+ D/ h4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 Z7 S+ c4 {0 b4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: d/ ^0 p' O/ v* ]8 S7 G4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- ?- m# _/ |1 x
4C19:00A4   INC    CX
6 C! T6 C' n  Y" ^6 |4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# D# h4 G1 j3 ]$ }' H3 z
4C19:00A8   JB     0095     ; 6 different commands.1 M: ]& V" I" j  o
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: E/ B( `1 @1 K# ~5 \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# g2 V3 W, J* T! r
* W& a# a! ]7 y9 }. TThe program will execute 6 different SIce commands located at ds:dx, which
' ]" w0 `+ U/ I  y( Eare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! B  _- G4 _/ h- D9 z7 ^

) A% B6 g/ q0 k4 g: X& J* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., W6 z! o5 o6 d
___________________________________________________________________________
- M1 ?1 C8 s3 R$ y6 G0 n* m$ h# m+ E
8 T0 ^5 Y; B' K6 n8 D
Method 03
2 J" g% z- ~5 x$ d! `=========' w' r7 @$ J1 y, d' r0 N1 ~2 W

4 ]6 b4 Q  {# V) N% FLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
1 u4 h% Z$ f" `, j" C+ J" i/ V(API Get entry point)
% t5 \# t& ^7 Y% ~        
7 _2 e6 L" B8 G7 A3 ^0 h! d$ c1 [" x8 U% L
    xor     di,di
1 K- ?1 {; }; ~8 n4 {2 D4 B    mov     es,di
& i6 y) K& y2 j. b* Y2 f/ u' s    mov     ax, 1684h       9 a" d( `4 ^( J0 e8 C4 E
    mov     bx, 0202h       ; VxD ID of winice
. m7 J" d+ E+ K    int     2Fh
' e, M7 k/ A- S4 ^! ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* S# ~- @- s1 \# n    add     ax, di  s5 n- g  E6 ?0 @& _1 e1 X! Y
    test    ax,ax
  P( ?. Z1 P9 g( ?6 \    jnz     SoftICE_Detected
8 r! {7 O1 y1 B5 r8 z  V/ }4 {& z+ G! p& l
___________________________________________________________________________
# ?- ?) Q* `$ O- x0 ^* A, E" k" |% ~. n' L6 N) K$ x
Method 040 }' }; `4 b6 ?& J7 o$ Z  \
=========6 {/ @8 i3 W% B+ |+ ~

, r# O1 ~5 E- N+ nMethod identical to the preceding one except that it seeks the ID of SoftICE
( O2 u# T! U- N9 L& jGFX VxD.- Z' S2 k2 N3 _7 I

  l' k5 A! F/ s+ m; e4 n$ {    xor     di,di
$ H# b$ ]) m( u. P6 x    mov     es,di
( ]3 Y; y0 X4 C# D1 k+ r    mov     ax, 1684h      
6 H8 X. J) @2 T    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. g' m1 v; v* B! ~6 i    int     2fh
9 a) C6 Z. `8 Z$ l4 r" X    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ L" b6 L8 X) T, d
    add     ax, di6 _9 Z/ @  n9 b$ a3 j1 [0 R/ D; `
    test    ax,ax1 s9 Q) U  n' D/ m) f) a
    jnz     SoftICE_Detected
2 D" E' J; i1 r+ o  |3 Y
! b9 h' z" V5 X, \/ l; j__________________________________________________________________________
1 X+ `7 F; b3 b$ f& m7 o  q2 H3 t9 R9 d& ^

; x3 g! t0 E! e1 D" f7 E8 QMethod 05) \4 A' l" _/ X( y
=========. L" }- t2 o7 i1 i5 _0 d9 b

$ B3 K: i0 D" X/ r/ XMethod seeking the 'magic number' 0F386h returned (in ax) by all system
9 z  x/ H9 @( h0 L; \$ cdebugger. It calls the int 41h, function 4Fh.
+ G/ j( {8 y, q  B: _There are several alternatives.  
: {' m9 d. \) _. O, d
8 C- Z" d' E& b# Y, w) iThe following one is the simplest:
9 i) L/ H) }! ]. S9 A2 ^& X4 E$ J* I) `$ t" Y) z! W
    mov     ax,4fh2 w: G( }3 p, {
    int     41h
) {! J1 ^; _& J+ W7 e; q7 l( V. T    cmp     ax, 0F386& O, v/ s8 ^  T" g0 H5 y
    jz      SoftICE_detected
; }2 l2 H( E* h( [9 O! K3 {. ~2 W3 {

" D/ n5 T# [3 l" ?6 U6 YNext method as well as the following one are 2 examples from Stone's & Z( c/ ]: m2 L8 i8 H9 ^
"stn-wid.zip" (www.cracking.net):
- R! f) ~9 }( h! b* E, K
/ d. }0 m! O- {. g    mov     bx, cs
# L% E+ ?2 k' Q1 z1 @: @; S    lea     dx, int41handler24 u# a( _! _( R/ S8 e; e3 J! y
    xchg    dx, es:[41h*4]
, B. `6 J+ r: ^7 B% }" K    xchg    bx, es:[41h*4+2]3 B$ C0 G9 P" \* b3 U
    mov     ax,4fh
- g3 K: z) u$ g- w$ y8 ]7 j    int     41h+ L5 x" r7 U- I% G& Q5 T+ r
    xchg    dx, es:[41h*4]
- U8 v; o  q! W- F: n1 ?& D    xchg    bx, es:[41h*4+2]
( b$ h3 N) c* a+ o  V    cmp     ax, 0f386h! w" O, C. g+ Q" R
    jz      SoftICE_detected" P  B* P% [" ~2 D6 f' S

. T0 P" \7 T% B3 D  G' ^# Fint41handler2 PROC: s- @8 r2 u' H2 p) e& Q
    iret+ x. p& v2 m3 s! d/ s; U
int41handler2 ENDP0 N: x! ]) n" B4 Q+ |
) B( n, D$ {5 V& k
: T" b$ j, ?# \
_________________________________________________________________________( g# t: o7 }+ r7 ?/ S
& d, p4 L  h6 B" A6 b5 {5 B: p

; r& n' Y# Y2 v8 r$ m" jMethod 06/ C: u# [; b* X
=========: R/ G5 L" v; z6 ^8 z8 c+ ]
2 N; n, U5 w- S; q+ r+ _, V

5 W1 m+ K2 R* k2 P& s5 l3 C0 a2nd method similar to the preceding one but more difficult to detect:
/ ^* Z3 B4 f. ?, I/ l7 ?& X- N# i4 ?# u1 U3 v6 f

. I1 K8 G+ K' P2 k# ~2 ~7 j# i/ sint41handler PROC7 ]+ C1 J7 V5 O  G+ m: v
    mov     cl,al) E- R9 Q$ v) N5 r  j8 x
    iret: T; t$ @( Y  b  t& x# g4 E
int41handler ENDP
# N' u$ o5 Y8 [1 a( w3 v
5 t8 A9 ?# t9 L! c% B/ H' _$ R& C4 V. O0 P( d& {9 r
    xor     ax,ax$ N4 H/ G# `5 C- J
    mov     es,ax
$ Q, F$ o* `* E( W    mov     bx, cs5 q/ D1 t2 n1 p0 T; ?
    lea     dx, int41handler& k8 m- ]; p/ O2 f3 E# e3 e
    xchg    dx, es:[41h*4]: g8 K% H4 b5 B0 t
    xchg    bx, es:[41h*4+2]4 |6 I0 z  J9 E1 M3 E
    in      al, 40h
4 ], p3 W) f, B- w$ H+ r    xor     cx,cx
9 i1 B% }) e3 o  @/ G+ m; u/ G    int     41h
4 s4 S7 i1 r; l    xchg    dx, es:[41h*4]
6 T1 J4 y$ ^. Z% C2 s0 U2 w$ l7 J    xchg    bx, es:[41h*4+2]5 D5 k% {1 M9 P, i8 B
    cmp     cl,al
3 ]4 x4 N1 E9 ]3 v. h/ J8 E    jnz     SoftICE_detected2 d% c# u( s5 R- M
& `9 b, O! [; n( [
_________________________________________________________________________; g, Q7 Y; w3 z; z$ w; G

- z$ b' S( `+ p) AMethod 07. ~" e1 I: _9 ]: Y: Y; Y
=========, i: r/ p* G! b. L6 N: L$ l; N
0 P# _0 M- E3 d9 D' v3 T
Method of detection of the WinICE handler in the int68h (V86)
, D, K, s# D' u% P8 |& L
0 V- L! W( Q9 n' V% {- s' B: g    mov     ah,43h: u( k/ @. ^+ R( H" C' ]' b/ N; ~, W$ Q
    int     68h; G; ?9 Y9 d$ C6 O  h5 ^' y" z
    cmp     ax,0F386h  S% T# g. G5 f! ~" ]
    jz      SoftICE_Detected, j. }4 `  t! h0 i9 N) ?

  V# W$ k) `7 c/ M5 x' q, I: D" l: @0 L
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
6 `! U$ m( g* _" a5 A4 A  t" U   app like this:- L& T5 _! l1 K: T9 m3 g& h" \
* H! l0 B' J2 `" K  |4 A
   BPX exec_int if ax==681 _( ]/ }8 ~; F
   (function called is located at byte ptr [ebp+1Dh] and client eip is2 X% ~  c" |" o, X& W, l4 E
   located at [ebp+48h] for 32Bit apps)
, @2 F' p, N+ j; O5 T; r$ p! U$ U__________________________________________________________________________
! M) t- `  a1 w1 E5 `/ W+ G4 i& I' f; f# S" R

2 P. P' b: e6 n$ _' Y0 }# XMethod 089 F$ |" I) I9 _' ^* p( a' n
=========
( V* H# W  F- [0 U
4 q5 B. i( B3 d; ~% R7 {' i! `0 OIt is not a method of detection of SoftICE but a possibility to crash the( N, k3 Y: H* M& _4 N, n
system by intercepting int 01h and int 03h and redirecting them to another" J2 r$ A4 }+ l3 ~
routine.
2 W" A3 h( H5 `  qIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; A$ S5 l$ O" m+ p! g* o0 yto the new routine to execute (hangs computer...)& r4 |: X, ^7 E& J
  ?6 t: G7 O  a2 t
    mov     ah, 25h1 |. i. i7 [' r  h# c! ]
    mov     al, Int_Number (01h or 03h)3 ]8 J" M3 F. Q# [
    mov     dx, offset New_Int_Routine
& a+ b; _" B6 E, j& X& ?5 ?    int     21h
1 U0 l( h0 R* T9 J  G: q0 N4 D% K# u2 z9 [: C+ _+ S
__________________________________________________________________________* Q0 k+ |0 @  i3 u# n0 V( X

: a: f, B0 ~" |  z# }Method 09
7 l7 ]1 a8 o; f$ V+ K, y' `=========) M/ d+ v3 h7 u
6 [+ S% R) E/ G$ ^* I8 }
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ z7 w* z. Y7 N/ k# U1 A/ T$ `performed in ring0 (VxD or a ring3 app using the VxdCall).
: d" T) Z. r' U# qThe Get_DDB service is used to determine whether or not a VxD is installed
8 O6 C  K; [% X4 ?% N! Mfor the specified device and returns a Device Description Block (in ecx) for& f- A% l% U2 B3 V9 z
that device if it is installed.# O+ e5 r8 C6 N+ L2 H
$ g$ M0 U/ t8 [3 N! a
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID, Y2 A9 Q- T$ ?% A# L0 P
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( ?' k+ }% L0 T* ?* x& W   VMMCall Get_DDB
, [% m4 m- I1 w4 q0 X+ l   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 H( h" R$ R2 v7 u- D/ v- \# |2 [4 Y! R$ _
Note as well that you can easily detect this method with SoftICE:
3 d: v  i3 t, l! I4 v6 u; y   bpx Get_DDB if ax==0202 || ax==7a5fh
9 P: R( E$ R6 K2 X, f- c$ M  F6 t$ U3 c
__________________________________________________________________________
7 R8 k( x! U: A$ K! @: Y: j
: }" A$ b: Y2 y, JMethod 10
/ X' u! l# l4 L=========
6 ?& J% j# K/ p4 u$ G9 }  [
5 T4 J  x; B) m$ G& A- \& b$ |% \=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
! R1 z1 W9 F8 ?8 R! n% w  SoftICE while the option is enable!!
( @% ~2 _* b' ]2 ?; x- {: |) i1 s  {
This trick is very efficient:
+ N! R) L& X; \1 |* m) ?by checking the Debug Registers, you can detect if SoftICE is loaded4 i: C9 ]$ Y  K" @7 Z6 u( u- R4 h
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 z' z! x# b: I1 ^5 n- q; t
there are some memory breakpoints set (dr0 to dr3) simply by reading their
* T8 ?. x: L! Q; k: x7 `# Vvalue (in ring0 only). Values can be manipulated and or changed as well, O/ E# g: i/ B
(clearing BPMs for instance)2 P/ X8 x+ w/ z% k
& R/ j) k- K( r1 y$ G
__________________________________________________________________________
' c( b. k0 r/ ?; x3 G
* x+ h* e% m+ N; ^* O2 N/ {Method 11; u: K  J$ @: y: X8 @8 t- f
=========
' z6 `- P) P" \: j$ g# x% p9 r1 k: @7 ]
This method is most known as 'MeltICE' because it has been freely distributed" g8 q$ A* k- ~  F* r5 k  y
via www.winfiles.com. However it was first used by NuMega people to allow
% m; L: {( k1 N& J& n- U4 T; k9 hSymbol Loader to check if SoftICE was active or not (the code is located
) ?( p) r7 e7 n6 h' finside nmtrans.dll).
; }9 P5 s! U& J# b4 T" N* i: @- Z" c( O
The way it works is very simple:
" n4 F9 b9 G6 L2 w8 b% [It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 u8 t' W+ B; `/ [- u) D6 X) xWinNT) with the CreateFileA API.: C9 x) K1 a7 n) \# w
7 e, s, C$ H6 c2 e% u
Here is a sample (checking for 'SICE'):: i: h" U- x& Z8 u8 k5 P
  N) G- `2 o0 }# R2 S
BOOL IsSoftIce95Loaded()5 T% k# ]( k5 L( T% l# q
{: ]5 A9 g! R3 \) Y3 Z7 A2 [2 `
   HANDLE hFile;  
6 z3 K2 X% O' f2 F* U/ c0 O   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' Z1 L4 c7 R% i5 c9 I
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
3 t3 x% a, z) y$ y; z                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 H9 C9 t- _0 r   if( hFile != INVALID_HANDLE_VALUE )
+ v6 J7 b' v8 I1 u5 P- x+ G% x" z   {/ M1 p% B0 F! {# y+ O: q4 D
      CloseHandle(hFile);
0 S, H% N% c- e3 b, f& O7 y0 }: X      return TRUE;
$ h. H" j+ r# H, G( F0 `   }2 |0 S/ e; P, ]5 T
   return FALSE;- y, ]0 _, ?; R+ w& W+ {
}" E  S2 K! `, b; ~$ w- t2 I

! z7 W, B$ g2 F& y, dAlthough this trick calls the CreateFileA function, don't even expect to be
9 {0 s* W. V8 ?# ?0 q- o. e' {# w* Fable to intercept it by installing a IFS hook: it will not work, no way!
( l2 v. t& ^5 K% \2 Q6 V; oIn fact, after the call to CreateFileA it will get through VWIN32 0x001F. ?7 a. I" d" K+ `
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: ^' Z% {" A" K9 H% L, l  }) `! Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc
" {8 I7 v. I/ _6 s$ `$ Dfield.
- Q: X7 D. r5 @# UIn fact, its purpose is not to load/unload VxDs but only to send a 1 ^6 s8 k! d2 |
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" b2 N# u4 h/ ~
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) I# _6 `  f& Oto load/unload a non-dynamically loadable driver such as SoftICE ;-).
) _: W- V3 z% ]6 H- h, wIf the VxD is loaded, it will always clear eax and the Carry flag to allow
- S9 K/ j1 E; Y* F" T) \) U. c2 v9 k& jits handle to be opened and then, will be detected.
0 c1 ?5 b" w6 x5 ]You can check that simply by hooking Winice.exe control proc entry point
/ t2 {. v7 @! d6 n0 D% I! ~1 C# D' Pwhile running MeltICE.$ @, p) T3 w' N- s$ U' X; J. Q5 g+ V) P
6 }% M3 X- C- x- m( E, C

  A6 [- S) Q  U  00401067:  push      00402025    ; \\.\SICE
! k3 o# X. a- ^4 \- y5 |  0040106C:  call      CreateFileA
- j8 h* A7 x0 }! ^) B5 ?, a* E  00401071:  cmp       eax,-001
9 }1 E: }# n2 _* Q  00401074:  je        004010917 V0 J6 @$ c: U5 S; ~$ Z0 w' D9 Z1 L
% m& L$ Q1 ]0 I) Q8 M) m

) {! B  p: D! {! w8 T, d4 V+ oThere could be hundreds of BPX you could use to detect this trick.
" U, j1 V; ~$ G1 e* P8 h" z-The most classical one is:
- t) ?+ E! k- j, c" t8 z7 `  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 [( K. G8 U. }( b9 K8 e    *(esp-&gt;4+4)=='NTIC'2 j! i$ B& P. T, c6 l/ m/ S5 t; S

+ T, b9 U# b/ H2 G-The most exotic ones (could be very slooooow :-(. }: W' |; B! W- `
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
$ v, W  b' I( r     ;will break 3 times :-(1 P' g4 g- G+ q

8 [" V& @/ P# N-or (a bit) faster: * l* j( b/ `' Q5 h4 T
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! M, L. o+ y  J: S1 J6 Z* W
8 q8 a( _- z8 ^: c$ a
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  % r2 Z/ L5 \! w) W6 U. [
     ;will break 3 times :-(
( r! |, @. U* T- f4 V* W! [' r; h  `5 J* ^. \6 }
-Much faster:' v( J& ^  U1 {- k( b
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 r/ W& h0 d7 G, |5 h
  P) J1 K( c: h7 r0 k- b& Y- a' INote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 ]9 |2 E* h8 R+ R
function to do the same job:0 I" f% x9 O( w. |" J' l7 i" X- I

* {8 _  G% a! l6 X7 B2 a. V   push    00                        ; OF_READ
* j& @, @( P( g+ F  g( u+ y9 {* a   mov     eax,[00656634]            ; '\\.\SICE',0
( P- E( X* F% D, t- i  t   push    eax
2 X* K+ M4 O3 A3 M   call    KERNEL32!_lopen
) h4 u" f! _, Z6 s6 n, y9 G   inc     eax6 Y" r8 B: e7 V9 c3 O
   jnz     00650589                  ; detected
3 v6 w4 A9 Z4 @, n/ `( ?   push    00                        ; OF_READ& |: O3 R. S7 ]+ M2 n
   mov     eax,[00656638]            ; '\\.\SICE'
6 T, _- r6 l' x9 ~   push    eax
$ T$ K& |1 q- v   call    KERNEL32!_lopen& a8 R+ O9 Y: c/ d  t! f
   inc     eax
  w& h& d) J0 W: V( w3 U" Y# L5 j' O   jz      006505ae                  ; not detected
, T9 b. P) @7 ~6 m
' f) c! _% s5 @# N3 n5 i! R- H5 F; b7 a/ @9 [% V
__________________________________________________________________________+ p+ Z; ?7 R8 [, f# V$ ]
- D' Q* j0 p9 p: h
Method 129 G; Q6 B+ G7 }0 r' Q
=========0 j, ]# d0 S/ X! k
  `' W! W2 M0 `: A! |! T/ I8 Y
This trick is similar to int41h/4fh Debugger installation check (code 05
8 V- [7 H; P9 u) E5 b&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 w/ I# a; C; J; r7 ~' Y9 s0 T
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, }! T; J0 R9 v3 L5 [$ {( R+ m5 `8 g& a) e6 F( V$ M. x
   push  0000004fh         ; function 4fh
, ?- V/ D" {6 e2 ^   push  002a002ah         ; high word specifies which VxD (VWIN32)
% A* o" N8 k  w0 k3 x! A                           ; low word specifies which service/ M0 F6 c; @* E% A* T9 J, x
                             (VWIN32_Int41Dispatch)& d/ j% x3 d* R% [% e
   call  Kernel32!ORD_001  ; VxdCall
- m' x& W5 w' u   cmp   ax, 0f386h        ; magic number returned by system debuggers
! O" M% O% _1 E* x6 j   jz    SoftICE_detected
" i. t+ }. k- Y& N5 [
" e# f2 j3 j$ H+ L' J4 C3 MHere again, several ways to detect it:/ ?! S. p3 f# Y
' ]1 O) z5 \3 s5 Y7 F* H
    BPINT 41 if ax==4f
! d& m1 H( |4 |# f3 q* q% m; v! j! T" `2 B
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, m% w8 j: `7 J1 E( r: O& F
2 T6 |' O" I# P
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* @5 b; Q1 U1 L& @' `
: I, B; A& y, u+ G$ a
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# W- m6 W2 x5 X; t9 x3 [& @# m9 ~- @. ?. R4 I3 W; G  \. Q
__________________________________________________________________________7 t9 N; U' n7 W: Y* Y1 c& V& I
  w) ~9 @% T# P% v2 a) n: Y
Method 13$ D7 d8 Y8 J4 R! Z% T4 X, [, }
=========
- y* U! f, x$ s# C7 w) R7 @8 a6 f" Z# C6 }2 m0 H8 y2 u
Not a real method of detection, but a good way to know if SoftICE is8 G1 m! \0 U! {4 b
installed on a computer and to locate its installation directory.; s. m& l/ `6 M' x& p/ l
It is used by few softs which access the following registry keys (usually #2) :: l1 f/ L; G+ d9 a: |. C/ L
* N- p9 g! J" W0 c  ]* {, P
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 a: K+ M: ^7 M
\Uninstall\SoftICE$ E! _5 u. t) J. `+ l
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
) g2 F3 m" [4 _5 ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' i2 w; ^+ D! z5 L  M* z. A\App Paths\Loader32.Exe
0 X; G9 Y# l: H0 |& O' l3 b! E
! G" I5 O6 H% a1 p8 j4 k( o* w
+ U" X, @6 h1 e7 w2 d  ]Note that some nasty apps could then erase all files from SoftICE directory" K( V) {3 L2 E( L/ N
(I faced that once :-(: u6 R. ]9 D; s* w* t

$ ?5 ~2 \2 Y, I; n1 c/ oUseful breakpoint to detect it:% Q+ F3 K3 x, h1 R% Z7 s/ ~

/ l4 |, E: f3 D4 H     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ p* ]6 Y8 }6 g* M0 D3 F
% C3 Z* j1 C+ ^6 W: l5 G/ R9 p( P__________________________________________________________________________
; i! {5 }  F" o+ m1 d  `( b1 z$ S  f' G
1 ?* m+ c0 ^" o5 ?; a$ C
Method 14
3 i# k& \& x9 B2 B4 Q=========0 \% ^1 G8 W. c. l- E
+ {, N: p6 ~7 i
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ e1 R" N( I- j- H- ^
is to determines whether a debugger is running on your system (ring0 only).
8 y$ G) B( P, G, n' u! }1 l* L2 J1 w  o* v5 |0 s
   VMMCall Test_Debug_Installed; H$ x4 k5 K; w3 P( G' n0 s
   je      not_installed, [' m; o: D4 U; a  T6 |' B

) W7 B3 h$ y4 y: b+ L4 FThis service just checks a flag., v8 @9 U8 ^9 V8 |( z2 l2 x
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-14 00:57

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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