找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
: _( x2 q; ]: i/ N/ [<TBODY>
5 d" s# K% h- M; X) f! N9 L<TR>  D) V5 d, C( Z8 c5 b& ~1 e
<TD><PRE>Method 01
) Z( o6 Y! p8 w=========
4 B$ I. o: }* E$ ?8 ~; W3 I& H5 K( E* P% @; R
This method of detection of SoftICE (as well as the following one) is' ^3 ]. j! F) {/ }1 ]  r& E8 t' }
used by the majority of packers/encryptors found on Internet.
& W4 J0 O. z+ U& f( ]' `% mIt seeks the signature of BoundsChecker in SoftICE7 o0 b! A) k( v& x3 B

3 b8 b) Z3 h  T- Y( `    mov     ebp, 04243484Bh        ; 'BCHK'
9 t$ p3 b# Q# X1 @1 b; R; j6 [    mov     ax, 04h
8 b( n$ t/ u) K& a8 ^, K6 h# d    int     3       7 Y' k8 C9 ]* T; b, s$ z7 X% Q$ y9 h
    cmp     al,4
' f' T% _& r9 M1 ^    jnz     SoftICE_Detected! ^3 E! \* \6 M( o9 S: u
+ B1 T& s$ y) W: s6 }0 U
___________________________________________________________________________, @) g  Y" e5 t3 X& F+ M6 h
; c' H' ^- r) ~: t8 `
Method 02
5 m, ^: n* O0 f' q2 i: Q1 V* h=========
: S! L) N: ]. f2 u+ f0 k$ {( C
2 S4 a- W  U0 _  q. `$ qStill a method very much used (perhaps the most frequent one).  It is used. i. Z7 G! Y0 c7 K% f0 a
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,. a' g- U* y# [3 c- C/ i
or execute SoftICE commands...
# V8 g2 Z# P7 S1 \% QIt is also used to crash SoftICE and to force it to execute any commands
# F9 P, h: @% Z. @9 b" A5 W' `(HBOOT...) :-((    R5 G+ D+ @; y+ ?3 L1 ]
' P. |& ]& p5 y" P2 Q
Here is a quick description:" V3 s% s& d8 z! B7 A, M
-AX = 0910h   (Display string in SIce windows)4 \6 {. B  ]; i
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
: w" a6 {7 G9 `4 O-AX = 0912h   (Get breakpoint infos)
) Q) y/ n2 h6 Z' `' g+ r9 O* d-AX = 0913h   (Set Sice breakpoints)
6 J" v* l3 P! O% b, {-AX = 0914h   (Remove SIce breakoints)
# n' W& Y/ g* e1 H2 z+ u9 a; z5 O4 D) Y/ K
5 b3 n7 G. W" D" ~9 E* \5 f8 AEach time you'll meet this trick, you'll see:
" S6 K5 [$ g' v8 y$ Q-SI = 4647h
$ c- k4 }+ Y! ^) C' }+ D7 a, O7 E0 w-DI = 4A4Dh' M2 y) z+ @) C9 [& T2 e
Which are the 'magic values' used by SoftIce.1 g6 P: s; D0 {
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.. f# J; E% _: Q. A/ Q) _

8 K$ ]" |! Q" @# t/ @* hHere is one example from the file "Haspinst.exe" which is the dongle HASP& e! d( {/ ?7 l' b
Envelope utility use to protect DOS applications:2 o( z# j8 I1 `; ?9 U* c( u

% _& R$ _# Y" }6 p% x: R# l# p0 y4 v8 {5 U, j9 a0 V; c$ u' J$ W8 O
4C19:0095   MOV    AX,0911  ; execute command.
+ ]" |, L: t( g6 T5 e6 i4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
) T# a' e; Q  z* }4 q3 B4C19:009A   MOV    SI,4647  ; 1st magic value.) B( j1 w. |) T& _7 D
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 p$ \8 l+ h5 c$ z1 S& T6 J/ _, U8 z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! r% L8 X5 n" H8 Z: K1 R) w# w  h
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- F/ ]- o) ?( q4 J* \/ ]
4C19:00A4   INC    CX. n" S1 K' j, L8 `" T2 }
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ H+ k& b3 [9 F4 p* R
4C19:00A8   JB     0095     ; 6 different commands.
6 V3 c" P8 h+ T- z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 f7 V% }4 H1 H2 Y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! ~' \+ d( U6 ^: L& u/ r

0 F! N8 `5 M+ m4 G% kThe program will execute 6 different SIce commands located at ds:dx, which7 N6 U: ]0 K7 X' @& V3 w" O( b2 R
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# _9 \& k& G  d  z& t0 q' b9 g* T# n& R) T( {, j& \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 W+ b: I8 ^" _% c' B
___________________________________________________________________________
8 I. V0 {3 ?& n# b8 ~
/ b: b2 ~1 Z/ C' Q; v/ }* J" |- {8 R. ^; r' c( ^' u
Method 03
7 z+ ~! S" T9 A- y' }4 X=========6 ?. c" _' r$ c/ ~. b
5 F- i9 C% s1 L$ R) O  z/ N
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
- `* g3 N$ C+ g(API Get entry point)/ P) J8 F4 c) K6 h
        
% z& s; O1 C0 e' t9 Y( v# R6 E: m. V" e# _
    xor     di,di: L0 W( F% N) r/ _) x+ }$ |
    mov     es,di
& E1 l" b' {$ W9 U  X    mov     ax, 1684h      
* a6 O- r* _3 z2 n4 J    mov     bx, 0202h       ; VxD ID of winice  L* L' F9 ^  ?# }. o* D
    int     2Fh1 t6 S! T" j/ I% B+ _/ |
    mov     ax, es          ; ES:DI -&gt; VxD API entry point& c7 ]$ g6 y) d' `6 Z
    add     ax, di
& W1 o$ o9 j4 E/ L    test    ax,ax
6 k( l9 B$ z7 y, r    jnz     SoftICE_Detected
2 g: _* T3 E; m3 U. f6 S3 ^
1 c; L1 Z9 q. r0 B2 L. W4 \___________________________________________________________________________
$ H* F7 v) m" O5 A1 J2 n
$ b3 f4 i; Y9 z3 r5 V9 uMethod 04
+ D, j" C( {: m! F=========# x- J, N# f. ~7 L7 s2 D6 O
  S3 ^% b+ }" f
Method identical to the preceding one except that it seeks the ID of SoftICE8 a, [  Q. q# }% g! D! H& r% q+ ^0 V! z
GFX VxD.
* R; s; x) c8 o4 k: r# w! l7 }8 M5 Y1 z9 x7 r  J+ Q
    xor     di,di' ]4 M) J7 @( o$ M/ @$ S! C
    mov     es,di4 Q; D$ b/ i6 Z. Q
    mov     ax, 1684h      
" X6 i0 J2 ^& }) ^! Y    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 Z. H7 X! s! ^    int     2fh
$ B: t* q  n) M2 L  T    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 O: M; g1 L4 F    add     ax, di9 @2 {+ p" d: X
    test    ax,ax, ]0 v0 ]: P' }( q* J
    jnz     SoftICE_Detected
1 z6 u' A! `" l. C- Z. A
% X" s6 i4 g) B5 p__________________________________________________________________________6 v: G9 [+ U. j! B( o

6 Z$ G# w' ?" I, U9 B: t% T7 X: q; c/ v; f
Method 05
/ d2 Q4 k2 c/ E& P, I: `=========
" }( ~, e+ B+ O1 _/ x; M) p" F- @/ H' }
Method seeking the 'magic number' 0F386h returned (in ax) by all system: y- {1 M7 H' E6 {4 j
debugger. It calls the int 41h, function 4Fh.
, G5 t: \5 E) p! z6 \9 K6 }4 fThere are several alternatives.  - h1 q% m' {3 I7 {2 S1 @5 A  X
6 t1 z( G) g4 i8 {6 V$ u; e
The following one is the simplest:
5 g5 R. x  T+ ^0 n4 [! J
: z: u4 i4 P" J" c. G    mov     ax,4fh
7 `. [  H$ `( K1 _    int     41h- h& x! s) Z4 T; ^5 ?% p
    cmp     ax, 0F3864 T8 j2 o$ Z, ?4 U. `2 F0 w
    jz      SoftICE_detected
* F% o: u' }* V1 \2 X. G; T/ k3 \1 z* `, p. k& X$ a# K( ^
* _' T3 ~3 E9 i
Next method as well as the following one are 2 examples from Stone's ' T' J, k; \8 g, K* H2 `( P( s3 Y+ V$ \
"stn-wid.zip" (www.cracking.net):
8 s; t4 @9 X5 R2 S+ N
& n; @% S: O2 U4 B    mov     bx, cs
( w2 y; C- o. B2 b  X1 ]1 p    lea     dx, int41handler28 C3 X- l' d+ T
    xchg    dx, es:[41h*4]* K) r# U* [) r& Q
    xchg    bx, es:[41h*4+2]
& b, G2 X4 T* X    mov     ax,4fh
6 |. D! G' x7 Y; @% q  [. w- D    int     41h
. K, f2 H8 j8 @    xchg    dx, es:[41h*4]
" ?, H$ o2 W) N" Z5 E- u  y    xchg    bx, es:[41h*4+2]
# ]. f* h1 V, c' y    cmp     ax, 0f386h' o6 c( S+ {: W. M$ q+ S0 ?. I; x
    jz      SoftICE_detected
2 P; i  |8 W; w
: h& D: }- \. J! _% Q9 r" Bint41handler2 PROC
! Z* `! U5 \* U$ @    iret
$ B6 {( C4 z" v( V9 zint41handler2 ENDP
% z  A7 L+ q1 B+ j9 e( k* O
" r" ?2 G" `7 n" q) ^7 O) H- i; z$ F) o- x# v  l: q6 w
_________________________________________________________________________5 X% O, d, j, ], O% h

; r9 s  A( s" u5 U8 ]% n0 s2 u; a# S, c* o7 t- s
Method 06% I" U( }9 C" Y, C
=========% N8 x; A( U" L" w/ {
0 y5 f* K# l+ Q2 R
" S0 R4 W$ v9 x" I% v
2nd method similar to the preceding one but more difficult to detect:
0 [$ Q$ p  }, @7 g  Y- j( x. ^: s5 T, S1 U' n: [0 B  |4 ]5 a
3 c3 m3 C+ W, h0 O% \2 H5 t  Q. B
int41handler PROC
; `# |2 `8 S; N    mov     cl,al5 F% c2 C! e" b! @, G+ S
    iret
: c! d+ H# _$ ?int41handler ENDP; p. Q3 V$ q; o+ K2 N8 g

! l" r) ?3 P6 c8 o$ b
0 G, C" h+ Y# b    xor     ax,ax
3 ?0 h6 x9 x% Q9 ~' M3 @    mov     es,ax
9 a" m: B* Q7 q6 K7 p    mov     bx, cs% I8 w2 |8 V+ g; i) d
    lea     dx, int41handler
& y! V4 s3 P# j- r8 T$ R- a    xchg    dx, es:[41h*4]9 t4 `3 [. E1 I) }- ]
    xchg    bx, es:[41h*4+2]
. q6 h$ u9 e2 i: r, o    in      al, 40h1 I  @) a' }, z4 P: {
    xor     cx,cx
  P8 x# z5 N4 e    int     41h+ W* K. p: `$ o- u* K& r% N; x
    xchg    dx, es:[41h*4]
8 w3 A& `: A8 Y. k    xchg    bx, es:[41h*4+2]% i; l! V$ i7 p# I! Z) W
    cmp     cl,al
& Y* |5 k8 `" J; l3 ^6 f  x" t+ F    jnz     SoftICE_detected
1 h# a4 q% j5 u8 V* [( w. _& Q# n  b, D) {( K3 G! d* x  W
_________________________________________________________________________
' M) m' h" q4 J5 X$ u1 P: a* Y9 l$ k
Method 075 l, n" b4 t' c5 L) A# \
=========
0 ^8 w: M9 a2 F5 u. _, R
8 V! z" o: V6 m% AMethod of detection of the WinICE handler in the int68h (V86)
1 ~3 W4 }& `, X% G( ]/ R1 l, b& r/ _  `
    mov     ah,43h/ X- g+ G. j1 ]& Z# |2 g
    int     68h
% e, O* d0 E. F3 G    cmp     ax,0F386h2 G5 T2 t3 o; M( O8 {0 D1 R
    jz      SoftICE_Detected# }  ^8 t6 l1 P% k, e2 ^

$ Q6 q" ]4 N% k5 e7 D' v+ e+ y5 K1 f8 D$ H! x$ X
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& b& f  Y* _3 W" K# `3 D& s) {   app like this:/ ]! w+ Q; o: [8 i- D: w
4 }) o0 g* j% Z* H& p5 V
   BPX exec_int if ax==68
: G; W; B3 @4 j! m% P, A2 E   (function called is located at byte ptr [ebp+1Dh] and client eip is
* ]! Q. d1 `% }; o3 |1 m; V+ j( k   located at [ebp+48h] for 32Bit apps)9 ]0 d7 h) u; `7 b
__________________________________________________________________________  l1 H3 N$ I. \3 O! @
1 z: z1 g, l  q- e1 y0 w9 o! j

0 D) w% ^4 c, W) ]Method 08
' T% E" C  K" b( ^) o( n1 r=========( U) u) w0 ~- M! m5 z0 v* @
6 A/ J- {' `: X7 W% c9 l
It is not a method of detection of SoftICE but a possibility to crash the7 I4 W, Z; Y- ]$ b
system by intercepting int 01h and int 03h and redirecting them to another1 C# l, d. V1 [- i8 f2 ]$ N% |
routine.; m- E2 `: E' F- c6 e
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points0 p) j# V" O  i' y
to the new routine to execute (hangs computer...)
8 W9 ?7 X+ H# e+ N' N& b" K& @2 a7 X0 @9 v
    mov     ah, 25h
0 k( `9 P) C5 B& [: |    mov     al, Int_Number (01h or 03h)% l1 P; n4 W& _3 j! O' N
    mov     dx, offset New_Int_Routine
7 H  B, _7 f: t1 z: Z+ C3 X+ H! ]    int     21h% L( v1 |9 E: O: Y) w
* H9 n; m1 Q3 e0 w/ U+ c
__________________________________________________________________________( F% ?% `2 g2 z: x
" l+ p5 Y% y5 D( G  u
Method 09, S4 V; j7 d7 `: k" L6 D# M
=========2 i/ c% g9 Z3 p1 ~: |6 H! O
. N" G; o( \- X0 N0 Z
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 S: B5 d  d' c4 [# Aperformed in ring0 (VxD or a ring3 app using the VxdCall).
; v5 l. \+ v- K! K0 ^The Get_DDB service is used to determine whether or not a VxD is installed0 ?! Y: f0 I5 |
for the specified device and returns a Device Description Block (in ecx) for0 B& o  w! ]6 e/ n4 j, _
that device if it is installed." R- R9 I! j3 {2 n
" b  ?+ {2 Q  n0 Q3 a# S$ Y/ U
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 {$ ?. A  O4 L   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& O1 L& R" [, {+ Y9 W% N   VMMCall Get_DDB
8 ?! V, S$ l2 m& ]4 T8 M/ R   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( u$ _" u! S: [) A

$ ]! W* d8 q: O; mNote as well that you can easily detect this method with SoftICE:
  O+ S8 o7 V; N) u7 f" P% {   bpx Get_DDB if ax==0202 || ax==7a5fh/ t7 K/ H% I; ~4 P8 {, Z
& X# N9 f8 m% i$ j% j! N6 p
__________________________________________________________________________
. }6 ~; U: B0 N1 k
. b9 c" ]: }: |  s4 L6 |9 R! VMethod 10
/ \0 ]  F2 u3 V& H& G( m7 @=========
( b# O3 S1 Q- r  a8 q1 B% S1 D6 n; @
4 [- K# Z: ?. }* b3 ~, d3 @& Q& b: W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 u3 G' T  q8 F1 B3 n  SoftICE while the option is enable!!& z" l( M  c: T$ V: X" B. z- ?

: g0 l* Y+ `) p; L% T$ ~2 e) TThis trick is very efficient:. {; ~. Y% |7 j
by checking the Debug Registers, you can detect if SoftICE is loaded: y6 u1 {; `7 \# P& S! i6 ?
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 J, V/ o& }6 p- `( ~
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( s2 @- ^: s; O' P* Y9 `3 vvalue (in ring0 only). Values can be manipulated and or changed as well2 \. P$ I1 C) A: o- o( v/ ~2 g) s3 W
(clearing BPMs for instance)
5 [  a" R2 \% |8 n* P; A$ ?+ }2 d
__________________________________________________________________________
" J' H) D+ q% x& I2 n4 H1 V9 |0 A) [4 v) B( I
Method 11
  g- }" G  e' F/ v$ U=========9 M6 Q' S8 E; w# |3 I" \6 F7 z0 k

% R. K& p. @7 R/ ZThis method is most known as 'MeltICE' because it has been freely distributed
  y3 p' S# A( |4 K' B6 ^4 R/ mvia www.winfiles.com. However it was first used by NuMega people to allow
" E7 [' p* V; `; Y! f0 q4 mSymbol Loader to check if SoftICE was active or not (the code is located9 ~# D& c5 d$ K
inside nmtrans.dll).; N0 v6 c! Q/ |0 M6 R, H- j& J8 F
% b* \( t. i  n% k& F
The way it works is very simple:  N- o0 o" W! h) c8 ]
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
' F2 Z" e. Q& w( S* R# N+ yWinNT) with the CreateFileA API., N; U% @: [$ E$ F7 h# ~/ U/ R

7 J1 T3 y; D' z8 e# A' _' Q0 eHere is a sample (checking for 'SICE'):, T; }; x% P" s0 H) r) h! z  {5 C

) B* c. M3 R! s- ?- F, f2 [: cBOOL IsSoftIce95Loaded(), [5 K8 n. {* p' N! m$ \6 z
{, V0 V4 ^4 l: Y' c
   HANDLE hFile;  6 b. ]- T3 K( V. G) I: t
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 c4 D2 u- E5 E6 F0 _; {: }4 h* m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( r, d* s9 U, E0 Z" V- w4 A                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! G: R1 j/ A- U6 y4 Q   if( hFile != INVALID_HANDLE_VALUE )
, b  u& c7 U0 I   {
$ x* L) x9 F3 q! `5 v+ X      CloseHandle(hFile);) O0 J3 |* _0 ?& q7 {% y# ]) u8 j
      return TRUE;1 s1 o! f2 |" _5 @' w
   }" C" i5 B) C5 `7 h# T+ G4 g# i
   return FALSE;* c( k, p! H9 ]( t; V9 w) I
}
, F  K) _( k  \
; A0 g6 o+ a. x5 iAlthough this trick calls the CreateFileA function, don't even expect to be2 ]! R' T  [0 ~
able to intercept it by installing a IFS hook: it will not work, no way!
; O0 a5 o1 o+ [, w( ^& q/ hIn fact, after the call to CreateFileA it will get through VWIN32 0x001F6 o; n0 z& e+ J: w) a5 x: g- a- v3 D
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). ~) L4 B5 v4 N# R
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ p. ]5 p9 M; z3 y- ufield.
+ ^- j7 |# d9 D2 q! u! vIn fact, its purpose is not to load/unload VxDs but only to send a * S0 W0 C% G' P* m8 G: b) I
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE): A, Z; c& N  u1 q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 t; L6 t$ `0 O% d5 C* j- k0 Wto load/unload a non-dynamically loadable driver such as SoftICE ;-)./ F! d! ~# q9 ^. B, v9 B
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* U# G: t3 S  {# oits handle to be opened and then, will be detected.
; w) z7 ~! d. w1 b7 h3 `! |You can check that simply by hooking Winice.exe control proc entry point
3 i6 O  ?5 L" G$ [- ~# q5 j4 z' dwhile running MeltICE., k( m) o- S9 ?

( v4 p9 N1 m: B) X0 A5 L$ V1 _' Z7 Q. M7 [6 k0 ?2 B
  00401067:  push      00402025    ; \\.\SICE
4 ^, a5 L: ?7 J  q7 \1 Z  0040106C:  call      CreateFileA
) N$ S/ B  {" ~! W( R! v9 h" T3 Q  00401071:  cmp       eax,-001/ {, A2 ^! U% O  i& _! ^
  00401074:  je        00401091. j- i# B" Y% [0 i
0 Z2 S' P4 p9 [9 m% |$ g

" w! Q8 X8 u: U( B1 z7 p4 AThere could be hundreds of BPX you could use to detect this trick.
0 W0 E" K) Y+ \. t/ W; K-The most classical one is:. N' U; |3 f5 J6 d: g
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& {: G% k* M/ M) B    *(esp-&gt;4+4)=='NTIC'; i. F- h! I3 }/ C
) C& e; v9 l+ Z- O2 p2 |. L2 |
-The most exotic ones (could be very slooooow :-(
" j! G9 d0 E6 f& L# r   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 A3 t4 r3 k7 Z, ]
     ;will break 3 times :-(% B( C* t% E% ?) P- i
& e$ X+ F# F+ |8 f* B
-or (a bit) faster: 8 j. m4 H& f* V+ D# C' ?3 |8 l* w; y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 x  ]: z2 q* p9 \

6 N: k/ _8 y, o   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) X: V7 M1 ^1 Q# @% V) H$ v
     ;will break 3 times :-(5 C; Q, ?4 u& v  O1 X5 }
9 _! B: V2 z2 z3 I( p3 u, h6 {7 N8 Y
-Much faster:
7 p4 q+ P2 C$ g9 D) @) ^3 f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
  r3 K/ H; w! z" j+ M9 E* Z
6 H1 N# V8 V- }. u" s( ENote also that some programs (like AZPR3.00) use de old 16-bit _lopen9 o" r) C  v: t4 K- n4 c
function to do the same job:" s# M; d2 H- h: N7 B4 r

* Z# @7 A& w9 Y! T5 b   push    00                        ; OF_READ: B% b- ?: l% H) D0 y4 z
   mov     eax,[00656634]            ; '\\.\SICE',04 b2 @  ]2 _- Z! n! g
   push    eax
" J* P/ p( S' l9 ^: {/ B   call    KERNEL32!_lopen, f, n5 N, H  i8 C
   inc     eax
7 ^! I% E# I6 X+ R+ X1 ~5 X   jnz     00650589                  ; detected
7 b/ }2 h) c5 w: Z   push    00                        ; OF_READ
$ x* w$ F# F# E7 p# x) @" s   mov     eax,[00656638]            ; '\\.\SICE'
' `9 R' Z& b) X, R0 I6 b/ W; J   push    eax% H& j. ]) \/ V. ]( O1 H  h! W, v
   call    KERNEL32!_lopen0 e* X1 o; X( K4 C$ k; l$ D
   inc     eax! W' T% ~  p% o( G4 i% B2 |5 h
   jz      006505ae                  ; not detected
3 N: I. D: Y! Z2 i! ]
+ _. _6 z8 K9 L, D) P5 U
; e* I( ^& l4 \__________________________________________________________________________) k& V( n9 l( y, ]  K0 R3 _
- u: e8 c5 g' X, w& N0 d# V' A
Method 12- N4 t( \% P8 t8 [: T7 B% |# l' E
=========
" c( d+ I0 ^7 t0 Z: p3 n' F* h, U
This trick is similar to int41h/4fh Debugger installation check (code 05
" r- j- g+ }) p2 M) Y&amp; 06) but very limited because it's only available for Win95/98 (not NT)2 e4 p4 ?+ j( K+ M! k( q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 y- b* J+ R+ B! O/ B3 s- ~, j$ G

- q. d- O7 g* u, t/ }- \   push  0000004fh         ; function 4fh
. P) u7 c; j1 ^( T: x7 s! I- o   push  002a002ah         ; high word specifies which VxD (VWIN32)' e! M, e+ D+ ^% ^/ M% ^
                           ; low word specifies which service
1 ^1 b: Q. ~# g3 g( R                             (VWIN32_Int41Dispatch)
/ a5 B8 w- O' M1 a) U0 l1 {   call  Kernel32!ORD_001  ; VxdCall2 e1 z2 `+ a& e% X3 ?( |6 \
   cmp   ax, 0f386h        ; magic number returned by system debuggers
' H3 W- G7 i  m; t   jz    SoftICE_detected- r% i: d- O5 Z, U) ~  C2 G

$ {' Z( V8 h( s2 r' z- C4 z4 GHere again, several ways to detect it:+ z1 @8 x- B3 b% [0 R, l
; j% t1 U7 [( [. ^' u7 R/ @6 \
    BPINT 41 if ax==4f* @" p! i; X* S' J; a* s

+ P* H6 S) Z5 z( O    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 R: k- X+ p- [% |  Y
$ A+ }4 i- F' f" O, [
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' [% S( h& Z( j9 I4 [7 e

  ?' E$ c0 Y& F3 Q. l" ~    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% M  I5 s% ]" c/ H
% `( b; f& E0 [& y' p6 L( G
__________________________________________________________________________
) P% w) I- l1 F9 D( B7 N  K
1 V+ w  |7 r  B2 m" B4 S; n# ZMethod 13- f7 U) Y. K) K2 I# V2 F% N
=========
1 Y; {1 A7 }# g+ P/ U' h" p2 P4 j# F; R" k9 O1 {6 x4 [
Not a real method of detection, but a good way to know if SoftICE is' O' U+ y9 A: ?: z2 Q- `3 k
installed on a computer and to locate its installation directory.8 v( `! r: C& m9 _
It is used by few softs which access the following registry keys (usually #2) :+ w6 Y2 ]' M6 g- V( s9 w/ }8 X# y

% z; m7 A4 a4 }; F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- I6 l, ]0 X0 B& _- I\Uninstall\SoftICE2 \( n. h5 L9 {
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ G. \. Q* ^' i0 n
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* e( q  \4 e) t& @% Q% M
\App Paths\Loader32.Exe
' Y% I! `3 t7 B% G% b) R1 q' [- T, X: [* J1 i

* }6 o# t' `: m% b! {4 qNote that some nasty apps could then erase all files from SoftICE directory) r' E) l. V) M; K4 U0 h6 t
(I faced that once :-(; q! v" D  O5 T
  M. Q% a0 O( \# Q, t2 O
Useful breakpoint to detect it:
8 X1 F& d7 y8 u. @1 m7 m# d; L1 E2 d" z. V5 [
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- L' ^& s2 Y4 M8 L! u) j
. E- q5 L/ c1 [9 J8 U
__________________________________________________________________________
# r$ d4 q& X" K1 W7 @! a6 G6 k5 u: I& g/ l4 G; [" `
0 B# ~5 @' E( V) E+ c$ y
Method 14
2 C( d( x: }4 E=========
" R0 r: G" F' w
, p& i3 `0 W  G( e5 l( j7 zA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 F0 J# W; ^$ }* W8 a3 S; H; `0 N
is to determines whether a debugger is running on your system (ring0 only).
3 ~2 r$ g0 a# c' \+ y: L* }1 v( G" v4 @
   VMMCall Test_Debug_Installed+ v7 C5 X/ S+ i
   je      not_installed  [! G$ ]( o$ H& }
; E8 T5 m+ J. D5 N
This service just checks a flag." x5 r, S, r5 |. v5 n
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-25 06:24

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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