找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
: e" [  v0 d4 y5 `' M6 s; j<TBODY>+ M: \+ Q# e# o% v
<TR>3 r0 u1 E* n4 i, b0 H* x8 F
<TD><PRE>Method 01 , \: b! r' l3 }/ }2 d
=========
& g, `( H; _  F8 J! y
4 k. s7 z2 m, N9 f6 e1 ~% i0 _  HThis method of detection of SoftICE (as well as the following one) is8 b2 D+ t% r! k0 X! _( H2 m, z/ f% Z
used by the majority of packers/encryptors found on Internet.
* m8 G5 I- I! i3 g( NIt seeks the signature of BoundsChecker in SoftICE5 h/ k' C: c+ S" v, U. P$ ~

3 d* ~% \8 c8 {( h/ w* r    mov     ebp, 04243484Bh        ; 'BCHK'* v* q# X+ T' D" ?% H; Y7 x
    mov     ax, 04h
' |: A* J6 t4 k6 P    int     3       " F, N% ?* n% b1 T
    cmp     al,4
) F# B" }+ d- T7 E8 D8 L4 B    jnz     SoftICE_Detected( \8 [" ]& ~6 [8 h, ~/ Q
' q; N$ I9 k; W' G. y$ b" I
___________________________________________________________________________+ v! Q! S/ d) F+ q! r: W

9 o. |# C& ]0 z6 A7 bMethod 02* b0 I; y1 f* R6 j3 Q1 Y1 L
=========
) ^7 ]  ]8 z3 c: {" r9 @# U+ x" U; i$ ?2 x
Still a method very much used (perhaps the most frequent one).  It is used
- d* z. Y) s( j, bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ t9 W0 N: x. D5 h$ u; m, |
or execute SoftICE commands...7 D& K) {0 c$ ]' I* C
It is also used to crash SoftICE and to force it to execute any commands. f) b! @2 g; m; L3 ~
(HBOOT...) :-((  
& f. W6 T9 Q. z% P6 R. ^
& N+ j  D+ d  SHere is a quick description:
+ i/ B/ x$ e3 l6 F! L7 L* i' ^$ n4 j-AX = 0910h   (Display string in SIce windows)8 P" d4 W4 O% `7 \. L' d
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): ^6 S7 h. j4 B4 [8 @& k
-AX = 0912h   (Get breakpoint infos)7 i5 c: R  K$ N- d$ G( q# [9 g- I- x% R
-AX = 0913h   (Set Sice breakpoints)
9 c1 |; [! A1 D! {( J-AX = 0914h   (Remove SIce breakoints)
& u9 O* |" \5 y" V) n
0 g$ z; U) K, e1 eEach time you'll meet this trick, you'll see:
7 l: O/ ]" L& }$ U-SI = 4647h
2 a8 V; o- e! s. _0 {- v-DI = 4A4Dh  p, u" G5 Q' A9 [+ Q& \* ?
Which are the 'magic values' used by SoftIce.
: m! F( l) V8 [( |" o7 hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 s( ^9 K0 e* j& v- J9 k
$ f! i8 \! s: O1 E$ Z6 GHere is one example from the file "Haspinst.exe" which is the dongle HASP
7 h" i9 e9 B  Y0 a4 u$ X* c3 }8 W1 uEnvelope utility use to protect DOS applications:8 m7 M5 i. V- j/ F% {

& @: H% Z* [2 H4 e1 ?, m: j6 `0 U; }  T  W! {
4C19:0095   MOV    AX,0911  ; execute command., D- _! I% d& N" ]
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* b# I/ A4 E, @3 ]" U& _4C19:009A   MOV    SI,4647  ; 1st magic value.0 Q& i1 z( p+ r% ^3 G5 t
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.2 K3 A9 d- [+ b3 S3 I- P% d
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 X4 t; G, C/ |4 r7 ?" h4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 _" P$ P" C0 ^- ?) @, M4C19:00A4   INC    CX5 ^  X% L7 O9 H  V+ G. ~. J& ?5 s
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute3 i* k# F5 s4 A6 B
4C19:00A8   JB     0095     ; 6 different commands.  i+ d. T4 j+ L  a* M
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 Y0 O' b0 N( ^& j# _4 p! b
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), K3 |) O. b' R2 k4 k
# [$ p9 T- L' j  a" F" v
The program will execute 6 different SIce commands located at ds:dx, which
. [: U( X: K0 z- Jare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 X$ p% v: `" ~+ q7 Q: n+ y7 e

  M$ s- c: s) f* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." a" ?* O4 e/ }! A8 \0 F$ }1 ~5 D
___________________________________________________________________________
5 ~" W/ j6 g4 q, h0 A8 _( V8 a8 w  Y4 @' [1 ?8 y0 p$ X

& M7 E0 G/ R7 K% l4 B$ }, SMethod 03
  ?3 i; I9 K/ c1 |6 F7 D3 e=========, C9 U- |2 r6 {  \

1 ]; t) ]. f# U" nLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
! `8 n# X" ]5 L- C) [. I* e(API Get entry point)8 F3 x; j2 o- C/ e+ b7 L
        
/ L5 @, E- V& \+ }* ?! d6 L( c! C' Y) P; q$ [- [: p. t. T, ~
    xor     di,di' u3 J& P/ |6 W; t
    mov     es,di
3 @7 q" O. K' v* l) `% p    mov     ax, 1684h         b9 z$ k7 q; K% C8 e
    mov     bx, 0202h       ; VxD ID of winice# l' s" @. w/ ]8 X& u* I5 j
    int     2Fh
, y) Q! U+ P2 y! J9 O6 C8 o# }# D" f3 k* ]    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 h" V# x! C" P1 ]& C    add     ax, di
* c3 l, u2 o! E( t. L3 f: C    test    ax,ax) G  w) b' ?) _
    jnz     SoftICE_Detected
: J+ X/ A  r3 Q! N" \# l2 B2 r# v$ N0 g
___________________________________________________________________________! h( U/ U- L/ u' g7 d
6 P8 j2 |) t5 }' q
Method 04
3 t% V7 B6 \0 F5 ?& m4 F1 a% y! ?# Y, X=========7 C, W( R* d% m

- x7 D6 ?- P+ z5 {0 h8 v: NMethod identical to the preceding one except that it seeks the ID of SoftICE
0 j4 U9 M+ I# C% m" E* vGFX VxD.; ]; V7 E% k# ^) k
/ f: h" ]" |$ g
    xor     di,di
9 D( J+ ], b* P2 F5 @    mov     es,di1 U& `+ E; {" j5 G- v4 W
    mov     ax, 1684h      
0 M' o" @; I6 p; x    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 H2 z7 x! A6 \- d) q+ ]1 U8 c    int     2fh* v9 s% X, C$ d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 v5 I, L6 g7 f    add     ax, di; n0 X3 G, R7 x" F' @' W  ]
    test    ax,ax* O0 r: X+ M; U* i
    jnz     SoftICE_Detected5 `3 x2 t' t6 x# u& c0 ^5 R

7 G  M9 Q* Q2 \) c__________________________________________________________________________
. E+ ^2 i& ?3 k; u( L/ Y( a* P1 n$ u
$ K( d2 f+ L+ V) a# l
Method 05
  E5 T! C$ U) N% N9 L" E=========7 {; s. S8 A5 y1 ^( j" P& t

2 H6 {, v, N" U) {1 x, CMethod seeking the 'magic number' 0F386h returned (in ax) by all system
1 ?( s& r( ?4 B8 E! rdebugger. It calls the int 41h, function 4Fh.
- n& }1 t6 K6 n  K) dThere are several alternatives.  ' T$ F* A4 h4 S1 m2 M5 M% B. y
, @+ `6 h9 w5 v# w7 z3 B* J0 Y
The following one is the simplest:
5 v+ K5 F( g' I7 r& G' u$ F& f5 [  ]
    mov     ax,4fh
5 P0 Z  D) n; {! X0 z. t    int     41h* {6 \8 o5 R# I% m' }0 E  I
    cmp     ax, 0F386, k* h2 B! _4 R. j: m5 m8 n* j
    jz      SoftICE_detected
; {8 n4 y2 K0 _# }  x; r3 u; R8 X& ]3 W% |2 J8 W5 ?* B+ t4 k6 v

3 K1 f; G! [& s1 ~3 KNext method as well as the following one are 2 examples from Stone's 6 Q2 v" v) Z/ m  M8 H4 y; w! ^% k
"stn-wid.zip" (www.cracking.net):
# {9 C- _+ J! Q% Z, v9 \2 E4 N: {" a, p) R+ e+ U4 z. C
    mov     bx, cs
  ]( `4 X1 C7 b, @5 V4 s8 b2 Z! @- `    lea     dx, int41handler2! v1 p  }! W- }; H8 u  T) u
    xchg    dx, es:[41h*4]6 w" J6 j+ P& [% M  m/ b1 Q
    xchg    bx, es:[41h*4+2]
& R' ~9 ^3 T7 W' X8 q9 T& U+ J0 ~    mov     ax,4fh
: D1 v/ c+ w- U# i: u) i    int     41h
4 a, V: r. C# u& @) G    xchg    dx, es:[41h*4]
" m/ R/ o1 G" X' p  U* m    xchg    bx, es:[41h*4+2]& S* [$ @+ u$ G9 C+ x2 V- X
    cmp     ax, 0f386h2 R& N# q! j6 R  C, p; X% R' f
    jz      SoftICE_detected
9 q" \6 ^2 `: ?4 d" |/ B% ]$ L7 I8 E( K( v$ w' V
int41handler2 PROC
+ m/ A& f% n; v; V8 m; p    iret
- q5 K9 b# Q2 x3 u5 V& Y& rint41handler2 ENDP0 R6 y/ Y! P' f6 @, @2 \- }
9 X9 o7 O3 r2 r6 q( X- r  A

$ k5 o& a; Q; I% _  a, @. V_________________________________________________________________________8 d3 T5 e- ~( K" Z3 C: I: S4 G

; n! d7 ?2 P' l7 I' X
  A* B6 l- }" qMethod 067 j- Y6 ^+ ?, ~, z& u0 o
=========
/ w1 t! b; m4 T. v9 F9 V3 r7 X" `2 t! n
7 t  s+ g" g. o& [8 K, k
2nd method similar to the preceding one but more difficult to detect:
/ ^* _% U& N) P  A1 S, Q$ i6 Z. h& W+ s: X3 k3 f( J
+ [! ^2 b# {; q) \0 Y: k+ R
int41handler PROC
* |( k; ^: r3 D1 j8 m1 h    mov     cl,al
8 C+ u' x; O2 m) e    iret
  Z- e# k; I6 w' b) \$ Vint41handler ENDP
% X2 V% }0 t  I, U/ j5 \3 X) u( U: s" ]& Q6 Y
+ P+ {4 f2 k9 X0 v
    xor     ax,ax+ ]! `& I  S; X
    mov     es,ax
# C; @. A; @* z, ?    mov     bx, cs
5 t$ K( p2 q2 ^* X. M    lea     dx, int41handler
1 ?5 V7 N3 x) _3 Q* H    xchg    dx, es:[41h*4]
2 ^* D  M' d4 K) }" C5 @+ y    xchg    bx, es:[41h*4+2]
- O& r8 q* g& t7 E6 v, C7 b; y    in      al, 40h2 u( S. y/ j& @  r
    xor     cx,cx# a* P" H! O, e7 ]7 B8 R# I
    int     41h; ]+ h/ f- [( j5 O5 L
    xchg    dx, es:[41h*4]
5 q* T* T) i; o    xchg    bx, es:[41h*4+2]2 k+ _2 `" n! s* V" S- n- D) d
    cmp     cl,al
$ x- B+ O0 U) ~, R% \) z' ~    jnz     SoftICE_detected/ v$ i3 P2 M- X" i. ~& C) n
# b+ W/ P. L7 Z3 r- x
_________________________________________________________________________' q+ Q3 {# i' J* e; q# P

1 F/ e, ^5 q  [Method 07
/ h! Q# k8 \& a9 D# ^+ W=========
. G3 w! k. l9 Q0 ^5 H9 [8 v. i: n6 i7 c  o% G
Method of detection of the WinICE handler in the int68h (V86)5 v# L8 [5 X! `8 f; _

* e: A! \4 b' k    mov     ah,43h6 U, M% W* |! X1 [
    int     68h: \( l, M% w, u3 G
    cmp     ax,0F386h* Z& m+ I. h! ^! m, e; ^7 z' u+ U
    jz      SoftICE_Detected
! E- R! O/ }% y8 Y1 o; O
# [& ^  z7 A' L; q* Z/ Y6 S3 d5 r( Y  {# ^
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ f. w' x5 r6 f
   app like this:# \- F! L1 _- V; ~' i
8 M% e$ t! n0 u- i+ H* H! K: ~
   BPX exec_int if ax==68+ ^) N! z. Y5 H# ]4 a; S
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 Y& k. Y3 c4 ]' @   located at [ebp+48h] for 32Bit apps)
- o. o# ?2 n& s; c  t& `__________________________________________________________________________+ O  R. c: o) I) b0 Q* N8 T- Q
) B& e% ~( P7 [

" Z6 u) f" H; |" O, I4 PMethod 08
/ s2 d4 b) B1 V! G  r=========
8 H/ s2 X3 l' l* K# G/ f9 k  t5 k/ {) z: l2 ?  X9 B0 I
It is not a method of detection of SoftICE but a possibility to crash the* q5 ~# Z. \. H4 Q* @# l
system by intercepting int 01h and int 03h and redirecting them to another3 U4 l0 w& D9 |+ H4 S- E
routine.
% F, O( k5 V4 g0 mIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; Y1 m* N* G  _6 Hto the new routine to execute (hangs computer...)5 y, X0 T/ O8 c

/ P" V3 |; ~4 K$ J    mov     ah, 25h5 E9 |4 r% G. a3 S) n
    mov     al, Int_Number (01h or 03h)- h1 m9 g0 w9 l# e! ]* e9 }
    mov     dx, offset New_Int_Routine, f! C* s* u% l! H+ z
    int     21h& ]; r  X  \+ ^) e! `

. t) s7 I- G% v$ L& \__________________________________________________________________________
' C+ d0 T' n" ]5 D+ B5 p3 R% v. N$ G: p% p2 H
Method 09, H" T+ u! u5 L. n* F. X- f
=========
( I; }  d! {  i  Z" j2 F1 M  X8 n* y+ ^/ M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* W8 r1 h9 I$ ]5 u2 Bperformed in ring0 (VxD or a ring3 app using the VxdCall).
! Q( `! ]$ L9 B8 N% jThe Get_DDB service is used to determine whether or not a VxD is installed
: ^4 A* Y# M; k* d1 tfor the specified device and returns a Device Description Block (in ecx) for& _+ Z, y8 W' C  S9 I. h4 d+ X" m
that device if it is installed.
1 o5 Y# l! L, ]: p: [( o# M! h: C* U2 C; ~
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! k1 c0 n1 |* q; f   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 |( m- {) K! ~2 P/ y   VMMCall Get_DDB4 X6 v- o: J: P" U
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: J' `' u' N- {; e! o
" f) Y& x) A$ s
Note as well that you can easily detect this method with SoftICE:
2 n  L+ U+ p  P; L& ~) e  G) \   bpx Get_DDB if ax==0202 || ax==7a5fh
# O4 b9 L0 t; p6 a" _0 s- B( C+ u" S* ^8 s. `2 H% J
__________________________________________________________________________
- L) I2 d; Q5 K4 [: f' |' n0 @# l" w- q% W/ B9 c. e
Method 10$ \- Y9 A5 v4 U$ n$ S  o3 `! F; ~
=========
) V6 I9 ]* z& ~& E  [! J" r9 _2 Z% ~. l: b/ o8 t/ {1 ^  E% Y
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 j; u9 N  _2 C8 Y5 u$ o$ i  SoftICE while the option is enable!!
! N# T7 I  k5 |: f: l/ i& N
+ B; t5 [# p- v2 g7 y# R" vThis trick is very efficient:9 m0 ^4 d* A/ N; ^
by checking the Debug Registers, you can detect if SoftICE is loaded
9 E6 T9 T$ K) w- h. \5 S( c) ~" U(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ b) I; R2 e( H2 g+ u0 f0 }there are some memory breakpoints set (dr0 to dr3) simply by reading their
, M' v) X% z: I# G. P; T% Dvalue (in ring0 only). Values can be manipulated and or changed as well
7 t9 o5 \( h5 N4 w7 o& F(clearing BPMs for instance)
! Z) Q; Z* J% L
# \; V5 }4 {2 P3 I5 T7 L0 X__________________________________________________________________________
0 L- \% j; g: x6 D+ T& r
+ ?  v4 [: L: P6 o/ S7 DMethod 11
/ }2 H( N2 D0 L& C0 Q5 K=========( z6 E: J2 E3 T+ k- ^# D
: e! a: j# k  ~5 R9 u' {; j
This method is most known as 'MeltICE' because it has been freely distributed% r$ a+ [7 \; l. n1 H
via www.winfiles.com. However it was first used by NuMega people to allow
4 N/ z8 l9 a* U6 {; v( QSymbol Loader to check if SoftICE was active or not (the code is located
, P# i! k" I2 O3 ^8 Qinside nmtrans.dll).
* l1 y, J1 f- h! m& r8 H' z! S
& v; `0 o. Q  C: n$ eThe way it works is very simple:
  r/ |$ G+ |* O% n9 b: i$ NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) |1 V( t0 v7 e2 A- oWinNT) with the CreateFileA API.
3 b! i: _# d, \, h7 G3 J9 R- y0 k; M- d
Here is a sample (checking for 'SICE'):
, ~, w! f9 V) v' {7 k( |! n0 A" v4 h
BOOL IsSoftIce95Loaded(): A* l2 Y# Y2 _3 o/ j9 J, F
{8 H3 U* J/ c% V+ i. m% L+ n
   HANDLE hFile;  9 c) p+ V) s% Z6 c% C3 M7 E
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% c3 m$ Q& e! v6 {& q2 D' T                      FILE_SHARE_READ | FILE_SHARE_WRITE," N! R7 ^4 \# Y' a
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( r6 M4 C" ?" Y2 O4 M' E
   if( hFile != INVALID_HANDLE_VALUE )4 ~/ d- z! P/ r2 \
   {
$ W  h" `& Q+ i, w2 F% d      CloseHandle(hFile);
! Q7 f- D$ Q  Z4 x      return TRUE;
, ?0 o' v2 T, _2 }/ z" {$ e4 D   }9 i& g; B1 M2 q+ Z
   return FALSE;" z& D; z6 Q! O' O
}& `3 c  X2 p0 Q  L. l  m* b+ P
0 s$ C- h' |0 @6 a; F9 g, Z
Although this trick calls the CreateFileA function, don't even expect to be
# |$ G) J. e3 v/ X" Jable to intercept it by installing a IFS hook: it will not work, no way!' |+ K% f1 F0 _$ W
In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 B6 I0 {, m) _/ l# n: [! W
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& U. o$ i0 }9 ]% c9 _0 a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 i: }" C( C) q! b, Efield., L; g5 ~8 Y- ]. h- S& |# \
In fact, its purpose is not to load/unload VxDs but only to send a
+ P" c% T, m' V3 S9 OW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' M; o: f# i+ a: P0 e5 _to the VxD Control_Dispatch proc (how the hell a shareware soft could try. G) O8 b. G- m( f* Z4 C1 _
to load/unload a non-dynamically loadable driver such as SoftICE ;-)./ I4 P5 \1 @6 v
If the VxD is loaded, it will always clear eax and the Carry flag to allow
: D2 X4 A+ V3 F" Q: X' a; `its handle to be opened and then, will be detected.
* U! |% n0 ?& s) `7 e. KYou can check that simply by hooking Winice.exe control proc entry point
; j) h6 t' s' l2 {while running MeltICE.
9 E, s! s3 t/ ]& Q$ \8 k% S2 D& q9 P* c! \0 |! a( D8 I# j
, P1 |( u( e7 \8 f. i' |( N8 @% x; T
  00401067:  push      00402025    ; \\.\SICE+ F0 u! G, o+ Z# S
  0040106C:  call      CreateFileA( U9 I+ [; W' f/ J: R( c; P$ o
  00401071:  cmp       eax,-001
3 Y0 H: ^3 ^4 v  00401074:  je        00401091! _4 y# i7 W8 ?5 L/ l4 f

, N. ?; z7 N8 s& h3 @+ j% o  g; C4 {9 ^; N; \
There could be hundreds of BPX you could use to detect this trick.
. b% x; q3 H3 x$ G! ]5 B-The most classical one is:
. G$ ^# f  N; ~% x  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 e5 O4 L! u' A4 p$ p$ E, W
    *(esp-&gt;4+4)=='NTIC') ~) H5 X' J; g) l' O" _
; u0 k5 S1 @8 y: V$ B8 t
-The most exotic ones (could be very slooooow :-(
1 \0 I  s3 I9 F9 b   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    y+ d2 ^, S. W$ ]3 N" _7 @& W
     ;will break 3 times :-(/ r) J/ @+ F* V6 w% u; x
8 `! u6 M6 y2 [8 {% @& m
-or (a bit) faster:
1 \! y3 i" ^& S; _: S; ?3 Z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ o$ h. |$ r; J9 Q: t6 O' i) Q1 M, Q) z; {9 Y* f
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 I- t3 ]0 A' X+ {# n$ J' p# L
     ;will break 3 times :-(  z+ A5 f1 `# A# L5 V
2 y/ N# v, U+ q6 u( {, \7 ^
-Much faster:
# s% E& Z1 |2 V/ q9 o& J7 z  p* t% \   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 z: G2 H, a! t' z- O/ N7 ~/ _8 @- f
) ~0 l2 r% e) e4 G+ ]: _; o. D
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen  S( u# @+ ~% }  g% n, Z
function to do the same job:
4 x( V7 L4 B; p3 E$ l0 Q
0 Z- w( i9 f- _! J/ t/ R8 L   push    00                        ; OF_READ
+ R0 d% f$ G- L) d' ~   mov     eax,[00656634]            ; '\\.\SICE',0
" v' o' I; G5 K& y, K   push    eax
' `* w$ @  F: \2 J4 ~% |, q  o   call    KERNEL32!_lopen
3 k6 ~, @# T' X! J% r1 D   inc     eax, n" H% U! X* @' N
   jnz     00650589                  ; detected4 z' Q/ K  S7 i8 H4 |; J' @1 u+ Y
   push    00                        ; OF_READ
! j1 Z" \9 I, E( x- z4 \( p* o$ O   mov     eax,[00656638]            ; '\\.\SICE': o, k- p: u; c
   push    eax
' T) n7 z7 M0 ?" `" n0 Z% _   call    KERNEL32!_lopen
, u. F9 W5 M3 i4 i0 h; I9 T   inc     eax' v% k/ S7 E& H9 D9 j% N2 ^
   jz      006505ae                  ; not detected
" i1 _$ i7 B( Q4 w& z
; |6 |2 D9 f; K' X4 ~  W# J- Q" k) `/ z
__________________________________________________________________________  @- u) g% n) _5 h: z
+ f; p: ^" Z/ d8 q: k  a
Method 121 C# F2 h' D. J
=========' x' ]. Q) B) m" J8 @0 @/ O
& u4 j* E' d: b& k0 Z# D
This trick is similar to int41h/4fh Debugger installation check (code 05
% p' p( X4 |4 y0 }8 ~6 g&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% S/ U$ y3 \1 v  N/ Pas it uses the VxDCall backdoor. This detection was found in Bleem Demo.. t! y6 D9 x" ^
7 ]! F1 T. |2 q# z6 o- l$ A; p
   push  0000004fh         ; function 4fh4 M3 d. k  U3 X$ a! t5 B6 q
   push  002a002ah         ; high word specifies which VxD (VWIN32)
6 k. }  h+ l" N9 Y                           ; low word specifies which service* p: O8 m0 R& N: p0 |! B
                             (VWIN32_Int41Dispatch)" c9 {9 w+ d) |& l% S+ ^. ?" M
   call  Kernel32!ORD_001  ; VxdCall( r+ ^. @% `; ^
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 \4 X2 I) J4 l: I9 {
   jz    SoftICE_detected  q$ B. ?( X( `( n
' G0 a; A. \+ @8 Y% J& m1 @4 `
Here again, several ways to detect it:' a* a' w0 Z: U* s) x' E
0 E  t( o9 @! t; ?3 e
    BPINT 41 if ax==4f6 B0 I( F9 d( ~: ]5 B3 i* f; j

5 A3 A3 v" v# L. K, d* f: U    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 Q' y) @) T" s( [* ]3 J( ?
) q1 P7 y1 c! [  V6 K" `' _
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 W6 t% o  o, I/ E
. t0 {! ^$ u" k0 L3 b  t0 l, T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# E5 o0 O' f$ w0 z8 J  D
: L7 G  a3 s" n1 v' D5 `__________________________________________________________________________+ O2 U  `- W' I1 L, G
! u: p- {& W( B+ C1 }9 S
Method 13* h6 e4 I3 |, h' `/ \
=========
( C% T9 L! g) ]9 y" `  w4 I1 Q, E# M+ f5 L* d: h* y
Not a real method of detection, but a good way to know if SoftICE is
* E* M; O; Q0 Z* \" ?8 ]* K' einstalled on a computer and to locate its installation directory.1 A$ y. I4 y* a0 o3 m9 v6 i
It is used by few softs which access the following registry keys (usually #2) :6 e9 c' |; w9 a' E) o8 C

, Z, ^, C# P% e+ {2 c-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* r; ^& o* [: l( W. E\Uninstall\SoftICE
5 Y7 Z# o$ }+ T-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
  X" J2 k% ?* L, {1 ^( W3 `) ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( ^% u3 Q5 ^0 y$ n\App Paths\Loader32.Exe
7 d8 d2 D. Z1 y* n2 i) {9 U
: {! p: |7 A: Y7 J9 t: J+ u( \$ h; m# x: b4 f
Note that some nasty apps could then erase all files from SoftICE directory
! p, [7 n" g; ~! \) E$ Y# v1 i(I faced that once :-(
/ }* I+ C3 [" @& \9 `- P& t
6 n+ n$ D. j9 ]3 L( Z9 d! F- KUseful breakpoint to detect it:
6 v( Z; L. W5 {# t% y6 y7 A( y8 X: O, c. n5 e! p9 e" ?3 D3 t5 a
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 `7 y% _4 h5 W! d
. `9 @, T/ R; w' d: ]6 G% t" a__________________________________________________________________________
$ `3 l4 P+ T/ w0 M, C. m2 r; |: i( b" v$ ?) e- O( w
9 e8 j. m! c0 t
Method 14
4 h& ]6 `0 w; S; y* N=========8 n0 X3 ^* ~  s0 h  ?% u: n

  E8 D% W3 X; q6 C0 O0 U* {9 YA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* q# C; C$ l/ B
is to determines whether a debugger is running on your system (ring0 only).
- E: V: u, O1 ^4 ^6 K4 H
; m; \, _4 }3 E! l; U- m   VMMCall Test_Debug_Installed
- i0 M5 \" ]6 m! G   je      not_installed4 z9 Z1 ^/ y# q  }4 Y
7 K3 O" b: m/ d. M1 S6 ?3 L
This service just checks a flag.
# d+ B, L( G& X- D) {3 A</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-16 22:52

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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