找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
1 T; r9 N5 y7 N5 f) f<TBODY>8 L1 D  I4 }5 v: [$ w, O) p2 u
<TR>
  K; r" O: @( C+ N: B: a3 z6 p<TD><PRE>Method 01
' h2 i: \# F; m# d=========
* n0 O% d$ `! P3 ?2 U  R) W3 B6 |0 `$ j: G' |
This method of detection of SoftICE (as well as the following one) is
7 w8 M5 W. Y& pused by the majority of packers/encryptors found on Internet.
3 d( y$ Z! F8 |$ \+ KIt seeks the signature of BoundsChecker in SoftICE
( x# H- z/ ]9 o  v4 {1 d+ L4 u9 h1 j
    mov     ebp, 04243484Bh        ; 'BCHK'
) M2 D9 }5 O1 W) G7 o+ k' P( h    mov     ax, 04h3 z& V3 X1 _; j! U
    int     3      
) y& K6 v. ~! M5 c6 ^# A; W) w    cmp     al,42 E: v( E- d/ l) [! P3 @
    jnz     SoftICE_Detected1 i* C& c; a" q, z) ^1 Y
2 ~, r# a1 Y/ c/ ~
___________________________________________________________________________
9 U* E- i5 z9 G+ g4 @# U# L' P2 P
6 R2 U# T% I7 E" T( ?0 gMethod 02  G5 @$ @- M4 M+ z0 u
=========& a0 k3 |* d( k. J; T% \* i3 V
* N" h: g$ a) g6 z6 b
Still a method very much used (perhaps the most frequent one).  It is used
* J, I1 G( ^% Y* ~# y4 s" \, Dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% e4 j6 r1 j! f  ~or execute SoftICE commands...
/ E; j- H8 ~" u! s; xIt is also used to crash SoftICE and to force it to execute any commands
# v+ H4 C/ s, N) z(HBOOT...) :-((  
) X  k; S% }  C  h( ?& d
1 l, }1 U+ ~" Z/ W* q3 J, cHere is a quick description:. \6 A, ?% z! e; y
-AX = 0910h   (Display string in SIce windows)" q4 _: `1 S2 A, i2 E5 T$ A
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! f& X0 Z/ A: h. F) f! u/ k/ {% h
-AX = 0912h   (Get breakpoint infos)9 w+ u4 T% W* @, v" @6 V
-AX = 0913h   (Set Sice breakpoints)
) g* i0 w5 c% m- B! j+ W-AX = 0914h   (Remove SIce breakoints)
; ?2 \2 X9 U7 i, H: G3 n% j
4 V: L1 i' i: j; n1 N5 lEach time you'll meet this trick, you'll see:
7 A2 {7 h; @* G+ X-SI = 4647h
. p% O  K7 e% A* r-DI = 4A4Dh
$ Y) ]4 u* E* x, W1 u, J; \3 E6 K. fWhich are the 'magic values' used by SoftIce.. V2 J7 K( X9 w5 W
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ X7 l1 h3 d, g
" P9 @7 q; L- H' n( J! MHere is one example from the file "Haspinst.exe" which is the dongle HASP
5 R5 r3 \! z( i  a* m7 p2 S- hEnvelope utility use to protect DOS applications:/ C6 Z# B% w- ]
6 K* o/ j- n) C# [. j, v* T5 Q
5 D& y6 T( ]/ O6 @
4C19:0095   MOV    AX,0911  ; execute command.
; P: c# |: h6 P/ L& n. G4 r' ~4 L4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
% X3 D. V7 }! j: r5 A" K4C19:009A   MOV    SI,4647  ; 1st magic value.5 k. ]; r0 v6 J9 b' i; x- T
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 D: s: V/ q$ ^9 ]. N2 ~( ]7 d0 {4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" D6 P! O3 v+ x. y& A4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ p. ]6 I& Q$ P, Y
4C19:00A4   INC    CX8 |2 Q2 F+ c; _( ]4 `
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: i* ^  M: i; A8 ^
4C19:00A8   JB     0095     ; 6 different commands.0 A2 Y$ J3 T* G& e5 ]
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 r, e+ c5 B8 [8 a9 f4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% o) @9 T+ y( D7 k
  W: c& c6 @& @; \. j, s" x: [% o, z- yThe program will execute 6 different SIce commands located at ds:dx, which- `( ~- M. {" z3 d% }4 @: x
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: W2 `7 o! @. h  Y) T( s" g

0 ]$ v+ x# k, y+ M9 n* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' f; |2 ?2 Z' [! K# {
___________________________________________________________________________" f1 Y) J2 s5 Z' S; e
6 V% r& p! H9 o. C! g

1 s2 M# j4 K) b  Q# d0 a, o2 dMethod 03
% @) X, I, m$ L6 e4 D8 z  f* E=========6 U" t$ e8 k4 x7 W3 B

/ o5 T# U0 h  U& lLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 `6 Z4 U9 m5 Z; G. H  J4 ^7 m
(API Get entry point)
  M+ R" \8 \! f6 Q        ! j! f" k/ S) P8 V. v
$ m8 ?4 d- s) r- T
    xor     di,di
+ u9 p! Z9 Z' m2 _& U    mov     es,di
5 @: H9 W, r- z- @/ b5 S    mov     ax, 1684h       3 y0 S+ _# u' F) E0 r* t1 S
    mov     bx, 0202h       ; VxD ID of winice9 e( |' w3 J% E3 s
    int     2Fh
- z- C' `4 {) I9 w! C/ O    mov     ax, es          ; ES:DI -&gt; VxD API entry point. r" P: P  J0 }+ x2 T
    add     ax, di7 \& M/ ?* r( p( F# w: l9 }
    test    ax,ax; K/ e$ a* @$ C: F% P- Y
    jnz     SoftICE_Detected
+ E, P2 v0 N" Z
. q/ {, M' ^/ \& P( I5 }___________________________________________________________________________% ?0 m) ?  W, i7 T& C8 W

, l/ G) d5 x2 |8 d1 @Method 04" \2 k  O* b6 d( Q/ ?! m
=========
( X8 j: W  |) M) Y2 e0 K4 H
9 E9 B. W% A9 B8 q6 v! wMethod identical to the preceding one except that it seeks the ID of SoftICE1 Q1 Q/ n2 O: q' X1 K  q& U) A
GFX VxD.
; s1 a% S/ M# O- X$ p% M4 Y1 q: ]  _" C0 m1 [; P# }- U
    xor     di,di
: G) P( m! o8 X0 t    mov     es,di! l( Z# B) p4 j, F
    mov     ax, 1684h      
4 n! c$ }3 }: A& X( U/ h    mov     bx, 7a5Fh       ; VxD ID of SIWVID( D4 u% E3 f8 u9 d8 `( R% ~' ?
    int     2fh0 N; f# O) [, [: y+ G6 [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! j  c/ P! u3 O9 P: k: j( I( o# i    add     ax, di
& p, C1 @6 t: z    test    ax,ax/ |; P4 n6 e2 S  r& c. @9 l
    jnz     SoftICE_Detected
" w* _0 z& A- {; g6 i  `* k+ _& [/ k0 J, c( v$ ]0 n
__________________________________________________________________________0 d1 |% X$ K3 V3 L; }; I5 i
' D* h) ?5 |! R$ F/ T6 G; r0 q5 }

, l1 G  n2 ^8 z! ~4 O5 ?# \* pMethod 05
# Z: a7 m% q* q5 \3 q8 u=========
) S: A+ F) T' x) r& V) v! s9 O
8 V  h7 p( c1 Z4 aMethod seeking the 'magic number' 0F386h returned (in ax) by all system( B: I' g1 T+ h# @
debugger. It calls the int 41h, function 4Fh.
; P/ _5 k/ u! F. e8 j5 pThere are several alternatives.  
0 F7 h; s& l7 B3 O5 ~; n3 p  x6 h- P' S  H7 c7 P; V- e/ G. B
The following one is the simplest:/ p4 R( Y( `: ~
3 K6 |7 |% P# L, K% g
    mov     ax,4fh
7 @$ P5 {' V) Z* n" a6 q    int     41h
0 |/ x6 h# x+ |& k    cmp     ax, 0F386# M" Q: |! e( ]5 X3 y+ q* j
    jz      SoftICE_detected
, V3 t4 d  k4 h
! g$ B8 y5 [* o8 t7 D" Z6 j$ [5 h+ X( n6 `9 Q& r0 M3 _" O" z
Next method as well as the following one are 2 examples from Stone's 8 H2 B( ^8 o' K) m: f- T
"stn-wid.zip" (www.cracking.net):
: a, H$ X6 o; U% [4 [: {, k
* v- \: n0 c0 ]$ L    mov     bx, cs
% X4 K1 V: P( T+ g4 t    lea     dx, int41handler2* r$ z/ d; |' U' P" \2 v
    xchg    dx, es:[41h*4]
+ z0 X# q  h4 @6 t! ]    xchg    bx, es:[41h*4+2]
! r) G9 k# N+ I8 G    mov     ax,4fh  b1 m( e: s  }* l" g/ X8 v7 C. f
    int     41h
* O7 j- l% ~( V& J3 B0 f4 C    xchg    dx, es:[41h*4]2 l- s/ C1 C6 {1 [2 A' y
    xchg    bx, es:[41h*4+2]
6 c1 c( a  S, l# Y    cmp     ax, 0f386h  r; c" w1 ^# r  _: u. f
    jz      SoftICE_detected1 K  }! j. f$ P, H

3 U; c. Q0 @' q6 ^3 Z) Aint41handler2 PROC( R7 J7 a0 q, H
    iret
$ x8 C  j% Q/ a6 `int41handler2 ENDP) K+ o6 U( O- v

/ k( Z2 F% Y: v, W9 q% x. C8 ^$ w' Z$ W
_________________________________________________________________________
7 ^+ i, m. t. D; ]; U( N) ~/ ]& q$ G1 K- t: {8 r' F
' v9 W; W' s* I1 \9 X" b, T
Method 06& w! |5 ?& w( t7 k4 V
=========0 Y, {1 F  @0 j% G6 R' x

+ h4 {. w7 T: {( q# n
0 t: x9 A* j& P# ~) d2nd method similar to the preceding one but more difficult to detect:
2 g3 I1 _2 J0 E9 `
5 p9 C8 `! _8 T: R- A1 V* s6 T' {
/ r2 j% M/ W. D% T+ d3 rint41handler PROC5 ~# r$ d1 H) t! ^
    mov     cl,al
+ @2 l* V4 C6 j( v# U0 k/ l# x" L    iret
; X# U( `; C. D3 Gint41handler ENDP
: B+ Y  o2 u2 d- j# \6 u; \  O' K
$ }$ B% x! V! y5 @& ^, w) C$ y: T+ G
    xor     ax,ax
. {* o; {  B! V" S    mov     es,ax
& o5 ?) |8 r; I    mov     bx, cs
7 S7 i+ U/ G& R) {) p6 X+ a    lea     dx, int41handler5 X. F$ B/ D# g* m+ b
    xchg    dx, es:[41h*4]0 H; T# o- ]: d3 J+ y
    xchg    bx, es:[41h*4+2]
6 R) p0 h: o9 r- N$ [. d    in      al, 40h# h' \* D4 z( ^
    xor     cx,cx4 P( i/ W1 C; v
    int     41h$ i0 n# _3 |# {1 |: `$ |5 R* @
    xchg    dx, es:[41h*4]* K2 \. X: `4 Q- r' B
    xchg    bx, es:[41h*4+2]/ b+ P6 |% C) A7 X. E% i
    cmp     cl,al
; q% I2 K( C, V, J# Z    jnz     SoftICE_detected$ A. v+ @0 S5 k* G
: ^% _- e" |* m2 P5 o  Q$ }' z
_________________________________________________________________________
, u/ v4 X7 \+ Q" U' e* J/ ~9 b* d9 |$ [8 l
Method 07
  c9 j0 r% c* a4 s6 W=========! R' w- c4 {4 X( H" ^; `
" p* P5 ~4 J' Y7 O
Method of detection of the WinICE handler in the int68h (V86)+ ^; ?8 [3 A# d7 {' q+ r3 P

: g" @& v: R  b' d2 `    mov     ah,43h: j& G) Z" q* w8 {6 A, G: E
    int     68h+ E: Q1 P& [" _! S
    cmp     ax,0F386h
7 {2 S0 [1 O( Y% ?) C( c    jz      SoftICE_Detected, g+ t5 E# k+ g: l8 D
3 r! t8 x6 E) o4 H7 X

* V1 P3 A! k7 F# z" G6 O6 w- X& ?% j=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 d' i; _9 \0 E! G0 y0 R
   app like this:
& \% N/ s  x# b; {; a$ j
) S! H( M; V% `8 ^0 B* J   BPX exec_int if ax==68
& l& x# \7 E6 n  ]: Y7 G   (function called is located at byte ptr [ebp+1Dh] and client eip is' {% ~! f% a& K+ n9 U
   located at [ebp+48h] for 32Bit apps)6 z  ?, V" k/ {& ?, Y2 d
__________________________________________________________________________' s/ f6 R' @) u5 M/ B% w( D& D1 `7 B

& _0 C# e) s6 Z! C3 a5 O+ ]" q
Method 08
5 e% p4 w' y% a8 Q* v2 R& |8 H" L=========3 k0 Q7 Y: G2 J2 ?7 J) [5 e
+ j: ~- @! B. I; G- U. |9 M$ Z
It is not a method of detection of SoftICE but a possibility to crash the
- V% X6 o+ `% s! q4 Psystem by intercepting int 01h and int 03h and redirecting them to another+ X, K" c% C  F7 J3 \2 p7 l
routine.4 ^" e8 X$ K9 ?6 W" E5 ]: M
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- u; C4 w+ U9 N" Y7 \, W1 e* k$ D2 Zto the new routine to execute (hangs computer...)- D6 y6 }: |; A# t3 l1 X8 p% b

7 U5 k2 [0 q" C: E( ~* r) @2 @    mov     ah, 25h3 h- x1 x- z% ]3 K: n( |
    mov     al, Int_Number (01h or 03h)
/ @& f! ]" c0 o- h    mov     dx, offset New_Int_Routine
/ ?' ]/ d- S* e  z( V    int     21h7 p1 z6 P- h7 e5 Q8 w
7 o. m% q  m9 X( b$ }7 C. d
__________________________________________________________________________
7 [5 q6 H8 R6 J+ J
$ y: h5 V3 o0 P* xMethod 09- d2 U4 x: P$ q
=========
6 Z2 E' ~% M* P; a1 G0 @$ Y5 d+ d; T# b, w3 P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ S% W, D3 L6 n* Q5 Aperformed in ring0 (VxD or a ring3 app using the VxdCall).* D! @3 A" n. h7 H. j, @
The Get_DDB service is used to determine whether or not a VxD is installed+ s' V: z3 k% r
for the specified device and returns a Device Description Block (in ecx) for0 d% e: J1 O& ~: q8 d
that device if it is installed.
3 I- s4 T" |0 d2 [$ ]7 j* K6 x: u; p7 A7 w; G2 d. P9 W0 g# Y
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 W! |* t! y* B, ~" @6 A, [& o
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 J1 `3 ?- h1 H" n   VMMCall Get_DDB
2 M- f9 V3 L- v0 U: f   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 g( D2 h! f# w2 |- r3 L' z" x1 \! Z/ g! K
Note as well that you can easily detect this method with SoftICE:
: i9 a) i/ E# n0 k& o- U5 V* D: R0 N5 G3 M   bpx Get_DDB if ax==0202 || ax==7a5fh! `% `" S6 n+ ~3 x+ P! g8 U

2 e8 R, {! G" w__________________________________________________________________________
7 d, k  e8 C$ M8 S) I1 Z3 s2 a) ~# }1 X8 W0 Q$ I5 S
Method 10: |& o: ]. {& Q3 l( \# P
=========
1 X% s. j1 Q- ~- j/ V# a" i+ v7 y
. X+ l8 }6 ^# ^) ^=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ x4 T% m7 T7 r' w) [& E' \$ j  SoftICE while the option is enable!!
) ]2 a3 P! L- t* u- }# E" S0 Q. ^" A0 b$ ~3 C# S! G) A; T: F+ S
This trick is very efficient:( X+ B$ m; f0 ^7 X) ^
by checking the Debug Registers, you can detect if SoftICE is loaded7 }( h; {% j7 \: p2 \! p# g
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ O- A2 W  P8 W' g) v
there are some memory breakpoints set (dr0 to dr3) simply by reading their
0 d) x0 E' c- L- Ivalue (in ring0 only). Values can be manipulated and or changed as well
4 E7 H. I5 b) Z4 O: Z2 ](clearing BPMs for instance)! L- O$ ^2 u8 M. h! G( e+ d. T4 C
1 J3 P9 p' v2 R# y" Y% ^7 e
__________________________________________________________________________/ [6 X+ L. ], K2 t

- k$ c" m7 ^& ?" b  z* cMethod 11
. J) M% i7 ^+ O/ e! i=========7 n3 Q4 d/ ^  B3 F

" N2 n- y5 k. S" g$ _4 ^8 EThis method is most known as 'MeltICE' because it has been freely distributed
$ D0 `# I6 J" _8 G. f1 Wvia www.winfiles.com. However it was first used by NuMega people to allow+ n! {+ O2 a+ r
Symbol Loader to check if SoftICE was active or not (the code is located
( d" @" ~/ M) D) Rinside nmtrans.dll).( `4 H' b# u3 {; O. ~( g* g; d
2 R: P+ p$ F  H1 u
The way it works is very simple:6 p% m; F% t! P1 D
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 z$ u% J( q3 U& E; _7 I
WinNT) with the CreateFileA API.' p% L" i. r' I4 _) w; ?2 _
. U. n( H, x9 j, F# @
Here is a sample (checking for 'SICE'):& {- ]5 Q# b& u/ U1 q

& d/ _- v- m7 xBOOL IsSoftIce95Loaded()4 X$ N( S) T) {. U
{
" `$ \! t0 _* I, l: i7 l   HANDLE hFile;  
" S1 X& B, H! C( y6 R. z   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: X& M2 s: H4 _) t                      FILE_SHARE_READ | FILE_SHARE_WRITE,+ G' O# Y& X7 b. C# s% |* i
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) b$ A4 H& @( X3 c1 y0 `
   if( hFile != INVALID_HANDLE_VALUE )1 ?  v) o% p4 V+ t, Q
   {
, i% k( j. e" y8 \+ ^. s  {4 i      CloseHandle(hFile);5 U; W7 ~2 |/ d; q& W+ k4 X: s
      return TRUE;
6 C5 ?3 |+ S0 B# H, T- G   }
7 H: R" Y2 ~& u3 ]! Q0 v( y6 Z# F/ k   return FALSE;1 B% C! X  f$ p5 n  ^& `- [, Y
}
6 Z. J9 d4 ]; i$ }/ l2 V
" ]3 x6 p4 l- F( zAlthough this trick calls the CreateFileA function, don't even expect to be
/ V6 y  h7 `1 H4 M0 y- Mable to intercept it by installing a IFS hook: it will not work, no way!) H8 L9 n- _! U1 p- d+ ]0 e
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 ]* X+ n3 l7 D, V% u/ o
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" D% l1 d% t, L3 M, ~$ y; P
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
% A! r: X7 r7 H( c! g7 bfield.5 I, ^5 v8 Y2 z3 ~' s
In fact, its purpose is not to load/unload VxDs but only to send a
9 c( _0 X8 C" j; zW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ @9 ?% C5 C( X( U' d- k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try, _$ g' }& r$ M: \/ r$ |
to load/unload a non-dynamically loadable driver such as SoftICE ;-).+ Y) f) [: l  t
If the VxD is loaded, it will always clear eax and the Carry flag to allow; A3 b" `( f0 [3 T7 E
its handle to be opened and then, will be detected.
4 L7 l0 Z7 q+ `/ B4 JYou can check that simply by hooking Winice.exe control proc entry point/ }% F& P, g, z; A: k+ t- A
while running MeltICE.
7 g8 q' Q/ y' S9 |: b5 X5 m1 ^. X8 Q- b2 u# {2 t. O

( e. Y9 k; M: {, p4 k# \( q  |7 K2 R8 k  00401067:  push      00402025    ; \\.\SICE
( T" q( @6 |% t, F8 a+ u8 f  0040106C:  call      CreateFileA5 t- B8 j8 G' s9 M: \/ D
  00401071:  cmp       eax,-001
6 |! M/ i9 n7 w3 p  00401074:  je        00401091% y- m) `# V7 U) D( q  r: n- b4 C

  A9 c+ g7 K/ e3 D5 I
# o$ p& f* K8 `! W- [: D  y9 i2 F7 {There could be hundreds of BPX you could use to detect this trick.! Q* M2 I4 C1 L1 ?
-The most classical one is:/ I9 b# n1 n* |6 K
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) U' c$ T6 b/ h7 A" W
    *(esp-&gt;4+4)=='NTIC'2 T! R- ]; Y3 \

. }$ N+ |0 y( c# u$ S0 O$ c-The most exotic ones (could be very slooooow :-(
) m# u6 U; y  C5 n/ k- D$ C1 u$ T4 n' i   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ [: q+ T$ [( w" d" U& F3 f+ i- O5 l     ;will break 3 times :-(" {7 W% |/ j( B
0 x$ s: Y% d' o6 q4 g
-or (a bit) faster:
" N9 B9 R7 {: B2 h. g; {   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  l- V' y/ K( \

" R3 ?1 d8 M/ h4 P   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , w2 v) l2 H: N; a
     ;will break 3 times :-(
& x3 ~! x& A- z% Y7 v1 g6 C" {' @) @0 t
-Much faster:# D0 g# }+ q* |+ F9 K7 k* i7 r% I0 x  s
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ c" z2 R3 H# N( t! f) H. q( y; B0 B5 R( I9 l# Y: c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen9 |' H0 [# G( o* F8 U, r
function to do the same job:
* B" d7 L5 O. A6 z7 B' \
, h5 g7 ~% l( R' ^5 A9 }/ Q9 W9 A   push    00                        ; OF_READ
2 d: E, K% R! m4 \8 g   mov     eax,[00656634]            ; '\\.\SICE',01 l- b6 i$ ~& o& T. H9 `7 }
   push    eax8 z3 V) [3 ~+ U" _0 `% W
   call    KERNEL32!_lopen/ I5 e! e: M  k' \4 T
   inc     eax
4 D6 o7 Z: @' m0 `) @1 j) y+ D: c   jnz     00650589                  ; detected$ N; n* }0 U8 i7 y: A
   push    00                        ; OF_READ
5 j2 W' [/ m/ H& n   mov     eax,[00656638]            ; '\\.\SICE'
0 D$ T5 d6 _$ ^) ^6 A   push    eax
. G  z1 j, G; G3 [4 L2 Y   call    KERNEL32!_lopen& Y, q2 C' H: H% ^! x, q4 Y# W
   inc     eax
6 O+ [  e, I' K% m0 r* F   jz      006505ae                  ; not detected
; B, x5 U1 N9 j; E* p# c/ w# R5 \: w+ p; ?

! J/ Q' q. x7 W8 K. [; W__________________________________________________________________________
+ Q/ i! e- l& z8 J+ j; P& M) j* R( I4 Y
Method 121 Z7 S3 m+ h  O5 X
=========
0 X/ h/ g. i) \  k! X. p+ K2 i7 L# S  p- F0 j9 N# ~) t# b5 k8 G" C$ Z4 g
This trick is similar to int41h/4fh Debugger installation check (code 052 I4 {$ Q# E$ Y1 E7 R6 N" X
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" l2 G$ T/ U/ l, n4 |9 cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 _# R9 j2 X9 i& C( M
: d2 c+ l- F9 ], v   push  0000004fh         ; function 4fh
, G- M1 S/ {$ h/ L) G0 O# a   push  002a002ah         ; high word specifies which VxD (VWIN32)9 F7 b7 k! _5 R0 w% r
                           ; low word specifies which service# {; V8 C% i" M# {
                             (VWIN32_Int41Dispatch)
9 J+ z3 F- L# H. X, i   call  Kernel32!ORD_001  ; VxdCall
# D" m, y7 o+ u1 C   cmp   ax, 0f386h        ; magic number returned by system debuggers% P  ?/ U: d1 L3 I" H" n) b+ U# x5 c% S
   jz    SoftICE_detected
: f$ I5 j' ~5 M! E# r
- o! Q, D1 t; G, pHere again, several ways to detect it:
  f& E# \8 [1 F- Q; H- f& P0 O& o
    BPINT 41 if ax==4f" P% f5 C' k+ U5 G

0 S# H: }4 h: R6 L3 ?    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one  ~1 d5 l2 m1 v1 q
6 |: a3 f0 }9 b$ t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' R7 A2 ~* f- l. J. @
$ z. v1 ]* m( t    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 f; v* v1 x" X6 I  t5 o
( S  n  Z* ~3 }- D0 N* Q7 X__________________________________________________________________________. ^9 o  z- j1 n5 P+ A* s9 S$ F
, h% |! y$ n! W4 q
Method 13: e* I  W* B; d0 _' l
=========
; e4 U- M+ ~9 U8 @8 s6 @' P0 t, p  @
Not a real method of detection, but a good way to know if SoftICE is  [" L' t6 N1 n( V9 k
installed on a computer and to locate its installation directory.
7 ~5 q2 L# N6 g  E3 `5 t3 TIt is used by few softs which access the following registry keys (usually #2) :
9 w; S4 i* Z$ K( m7 ]) {
0 t8 F$ Z% Q) v  I-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ t( t6 O, X* s+ X* M
\Uninstall\SoftICE2 p( B( Z% _9 ^( f* C6 R$ Q# D
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 f$ _2 v2 L2 D  ~, \2 O7 [
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 D0 Q0 B2 u8 z7 i
\App Paths\Loader32.Exe/ a1 E  G" }5 X

8 l$ R- G% U( z% X$ ~
, _5 L7 J3 _: y$ S( {* Z/ n5 R. aNote that some nasty apps could then erase all files from SoftICE directory
$ f$ K7 }0 v. H. j4 x(I faced that once :-(
# K4 \4 h' z0 I0 w1 a
. ?1 z# C6 m6 o7 ^6 \Useful breakpoint to detect it:1 ?+ x* o' U  ?' g6 {8 S2 ~
- w& R. m. q6 i" ]% E! O
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
( }" Z1 R, Q$ b* j- @) f+ H
. R/ F+ l) J: K/ q- U: ]3 p__________________________________________________________________________
9 x% ?4 R1 ~5 }6 z$ V8 ?- T/ ?% B) x
6 e" l" Y8 R7 H: q6 Y* _* n: G
Method 14
0 ^: T: b) n! H=========. E& I; a! k, @; d6 t% j

- S% T0 \7 t# {( w$ {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ |9 {( R! Z) ^$ {- sis to determines whether a debugger is running on your system (ring0 only).
8 N% O! J- `3 e" b" B" F0 ^7 E
  F7 f0 Y; l' s- N% d( \   VMMCall Test_Debug_Installed" d2 h; }# i6 z: D6 R+ k2 X, P
   je      not_installed2 Y  J" j( _" `3 r/ s2 H( B

5 D% h& }, |/ H: V( a" Y  C' LThis service just checks a flag.
" d3 p8 d2 g' P2 T: z+ u  n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-6 20:46

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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