About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
! n5 l" A2 S9 W5 z<TBODY>
, S  J! k2 R! y<TR>: E+ z+ `( G8 y; Q6 ]' e
<TD><PRE>Method 01 - R* }8 N% m# C1 k" J$ F0 E4 }
=========" e& t' d4 Y8 V$ c, \7 c

% c! m$ [# J$ C5 {: LThis method of detection of SoftICE (as well as the following one) is
/ I. L: X( d* Q7 zused by the majority of packers/encryptors found on Internet.1 g# i. F3 ?0 c: E7 D1 s  q) j
It seeks the signature of BoundsChecker in SoftICE
  e5 g" o7 s. u9 {- w/ W1 u9 N' s3 B5 d$ {9 k
    mov     ebp, 04243484Bh        ; 'BCHK'
- C- y! o) @( M) M# R    mov     ax, 04h0 [' z  w( F( l4 g+ K* [- C
    int     3      
) [* x, p# [( l: [) r1 L! W    cmp     al,4# K% `8 n* x) s7 s7 O
    jnz     SoftICE_Detected
! w% j9 ], l1 z. E
/ T6 u& V. ?3 p+ `$ N___________________________________________________________________________
! [2 A4 T+ E  M8 a5 B/ C  q, B+ m6 {/ f9 y2 h+ D
Method 021 j4 N8 [* A. _/ z5 Z' `" |
=========, S7 e& ^4 [2 t! L- R

! \; c! P, V5 }+ C& PStill a method very much used (perhaps the most frequent one).  It is used* I/ |+ n$ s: o- j% z7 f9 L
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 A  Q6 |$ K( w. x
or execute SoftICE commands...
- O+ u& c# @: c& k. eIt is also used to crash SoftICE and to force it to execute any commands- ~1 u' r% |3 e4 `  l' N! Y: ~
(HBOOT...) :-((  1 ^2 q6 F- A, Y' H0 K
* q# f4 V7 {+ C
Here is a quick description:4 E, \* p+ ?$ m( w0 o  V# h& o# d( D
-AX = 0910h   (Display string in SIce windows)
' [, v4 K3 ^2 K7 ?-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" _  ]6 \* Y, Q& m0 d4 z
-AX = 0912h   (Get breakpoint infos)
, d; B' D! m5 e-AX = 0913h   (Set Sice breakpoints)' I9 J* r) J+ B2 @6 }* b
-AX = 0914h   (Remove SIce breakoints). L9 G7 n7 h5 J: V+ f: u

2 \  K" T9 \) N; j) v9 BEach time you'll meet this trick, you'll see:
5 A5 r: D" \; f-SI = 4647h  W. K( b4 @* a
-DI = 4A4Dh  |: F! d/ c3 I1 H1 _7 j
Which are the 'magic values' used by SoftIce.& B1 O& U2 D4 A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% |8 A8 k9 ~- t# v# f. h$ Q, U
* f6 i8 [9 [: u- `+ l9 W9 LHere is one example from the file "Haspinst.exe" which is the dongle HASP& x! y' y$ F: K1 g
Envelope utility use to protect DOS applications:# H) Z! Y9 z6 C' X: h7 |
$ B7 Z+ W% k- L; }1 r3 b4 T

5 F, z7 R7 F1 y9 w) b/ @: m4C19:0095   MOV    AX,0911  ; execute command.
8 |1 ^) [: I- g% q" Z- `/ u4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 z- B5 u3 s# {9 q4C19:009A   MOV    SI,4647  ; 1st magic value.
& W6 E1 E" I1 n( u/ k8 o$ j% }4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
% Y& O# d" ^$ `( Y% g4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 Q/ Z1 r* W1 g0 e' A- u! @8 ^) u6 J4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 U" j( n4 o- w, v4 z# S
4C19:00A4   INC    CX7 K) n, c5 E3 J2 T  n. R$ B
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
7 Q- e2 |2 u0 m. w+ }$ d6 M& l- M4C19:00A8   JB     0095     ; 6 different commands.
/ n# P5 V' e- q, m4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% g0 u0 c" c( r# h: s; D6 \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)) @' O- J" Q3 p6 V* C; ^" d) S% r
5 B: a* }9 ]# ~) @
The program will execute 6 different SIce commands located at ds:dx, which
; b5 _0 U/ `7 j+ A! w0 aare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ N; c! w; Y2 }8 p1 U  P1 S$ @4 l) l2 ^/ b- |$ n
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
7 |  T/ w8 z! L# K1 `___________________________________________________________________________" M8 E% Q" U4 }( k
/ v7 g5 p! L; `* v& ?0 A) L8 f& D: T

$ I9 e. R3 k3 y) c$ VMethod 03; l( C$ h, W: b) P2 V
=========. s/ @( w2 F1 b" @

4 `7 }  o* N( Q+ D9 GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' P7 K4 t+ R9 @(API Get entry point)4 e& R( }1 n8 h
        5 e$ q4 F' [) H6 C) I

# U* y# W) [6 j2 N9 P/ d    xor     di,di
7 a; |  p( u- X6 W- v5 t9 `9 X    mov     es,di
- k- G7 h, T) X3 y8 G" v9 f$ T    mov     ax, 1684h       7 g' S0 y2 N2 H4 ~8 M. X
    mov     bx, 0202h       ; VxD ID of winice) l0 X5 a# N* ^/ q
    int     2Fh' Z4 e2 _. Q  Z% }* `) W8 t+ Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ N7 v. h" s" t+ T: v1 @% N
    add     ax, di1 C- V/ r5 [" j
    test    ax,ax
7 v" O. g/ q0 K$ p    jnz     SoftICE_Detected. w6 R; {8 a0 l0 B# L, }

( R6 q$ `/ k( [( m7 [8 j___________________________________________________________________________
3 k+ S9 D& Q/ J6 s9 X4 ~( Q: h* Z1 j" o4 c5 K" `2 o
Method 04& X; `0 ~2 O7 `. ^# y, t
=========
% h+ e- ?; F/ y/ _- w
; T4 B; U3 y1 L: ~) x( l, UMethod identical to the preceding one except that it seeks the ID of SoftICE! A5 A' g( Z. q$ B2 e9 [. f
GFX VxD.* w* Q+ Q6 r* Y0 b% r

; B* c9 `1 H9 V    xor     di,di
# _" B! S) L* ^# Q    mov     es,di
% e3 Y* t: Z" ~* ~5 j' t    mov     ax, 1684h      
3 {: a& w  Q% {) z- c    mov     bx, 7a5Fh       ; VxD ID of SIWVID" [8 D. {! A: ~$ A3 k! z
    int     2fh, E8 ~, B6 h1 u0 L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ Q* J4 q* o2 k; O# y: A; o
    add     ax, di8 p# e4 B/ r: S  \3 N& y9 ~- U
    test    ax,ax
* k7 x# Y: a, ~    jnz     SoftICE_Detected2 ?: k& G% \# x4 b0 S$ q
0 G5 N: r. o2 {9 P
__________________________________________________________________________/ {- _# U3 i' _) {# b' b+ z

3 l+ H3 E3 d7 D- K7 Z
* h$ s( [% g1 Q9 ]9 oMethod 05
" H; M+ C& U4 G, k! z=========
+ k4 {1 y1 W8 n4 `8 v9 e8 ?7 j  W4 [% }0 G2 c0 b. [& V+ x/ W( W. R+ U
Method seeking the 'magic number' 0F386h returned (in ax) by all system
0 {4 Z: u0 |. F5 t) W3 gdebugger. It calls the int 41h, function 4Fh.$ z0 R; _2 p9 @$ q4 ~9 K1 l4 \7 J
There are several alternatives.  : _9 {$ n* v1 u

3 J9 j, S. Z% DThe following one is the simplest:
) X. \, c( S" y! a3 Z! E6 }/ y" w1 y0 m& m+ x
    mov     ax,4fh0 S' ]* C. {6 P1 _" b: q- c. h. A' c
    int     41h- A* b/ S! ^8 s" i- _7 _
    cmp     ax, 0F3866 q" x8 g6 r# ^6 m0 @0 B) T
    jz      SoftICE_detected! `+ ^) K  \! @3 X) G; N+ R! l5 m

" t7 X% f% i% p3 A! c6 y# A4 \9 \8 g2 X7 t! P+ W6 m! Q
Next method as well as the following one are 2 examples from Stone's
" N) W) n# ], @8 L5 [2 u4 c"stn-wid.zip" (www.cracking.net):
' t$ P4 O5 t3 F+ P
. v4 j# v) _& u5 X/ W+ ]! K    mov     bx, cs6 M9 N/ x4 p, ^" u7 f
    lea     dx, int41handler25 Y- G  G- P/ @: T; ^! C
    xchg    dx, es:[41h*4]) v' P, p3 f" g
    xchg    bx, es:[41h*4+2]
3 B" R5 p1 W4 t, Q; h% w9 H, }    mov     ax,4fh) D) `$ x5 c9 X6 P$ x
    int     41h
9 r* y8 q. J2 [    xchg    dx, es:[41h*4]. r. p* r) x6 Q9 z7 m
    xchg    bx, es:[41h*4+2]& F4 p& K6 ~7 v6 \& b1 P
    cmp     ax, 0f386h& f: A! Z# d: g4 |+ q
    jz      SoftICE_detected# _+ P2 h! W2 z+ l! u

8 {/ \/ W' n, S' m8 P* p" [' K& M4 Tint41handler2 PROC
! \3 k! G. f; I" Z( A' I- u$ Q  m& a    iret! Y6 l# f" y; s6 Q+ Q. U
int41handler2 ENDP
. f! G0 a5 O8 i8 X  M
7 [7 i0 C2 @# |7 i
" ?9 H2 j1 p1 ^7 Z7 x1 O0 E_________________________________________________________________________
# u+ _  I. h" Y: E4 J
: L! X4 ~) c" s' k" R7 U; H/ Y
$ a% S* k, R2 o7 i- T% s5 v2 tMethod 06: Q( z9 o) P2 S( n& a# C
=========
: K* v* c) A/ x0 F+ K7 A7 {
& q5 i  C/ m* [8 g% T% _9 s+ ~# b% g0 n$ R( ?" M
2nd method similar to the preceding one but more difficult to detect:
3 q0 B; h6 S! p6 m* O. E+ T0 u- Y& \" U4 U2 s. E& m
* Q- G* h; P- G8 h: n' w
int41handler PROC
6 |/ Y; v. K6 ?7 ^5 _+ A    mov     cl,al
& G2 z$ v9 E! l/ \    iret
; H1 P' F2 b( S# ?" Yint41handler ENDP
& L* C' X4 u% m% {* l
: g3 V  [) x3 N$ O: N* ]) d0 {/ t$ V, D4 G8 L# H' `
    xor     ax,ax
% g- i. s& q# Q+ H    mov     es,ax. u/ m6 f- @* }5 a3 x# `) ^& L
    mov     bx, cs
, J; B# p% z) t( |    lea     dx, int41handler$ ?( p2 _! g& O5 n2 L
    xchg    dx, es:[41h*4]$ r/ b( u6 P# h
    xchg    bx, es:[41h*4+2]7 H. `8 z2 z/ H: F; c# }' n6 L! }5 z
    in      al, 40h& }0 F, P& a+ S! f" ^
    xor     cx,cx
  D/ }: S2 D: S7 v6 n" Z    int     41h
: w, A+ t! n. m$ w& [    xchg    dx, es:[41h*4]
. A" [$ p2 `5 t* X    xchg    bx, es:[41h*4+2]
5 z% j7 b: W  j& b$ ?    cmp     cl,al# u' H/ q# {6 G3 p' @  Q* r
    jnz     SoftICE_detected
1 o" y& I6 j' H7 W. Q' h2 C7 x; [
_________________________________________________________________________
9 Z! J; t3 M- v' y0 j& f2 n  e/ ~( Z/ z  ]4 j3 _! ^. H
Method 07
0 F* N# Y- E& z4 p, L  b' y=========
  q7 h5 ~9 @5 u* D* s! o  f8 u, n  t4 c( x2 S3 _
Method of detection of the WinICE handler in the int68h (V86)
- S" }1 r2 Z! Q3 J
. W. I. Q9 Z: O4 c' g9 U4 S    mov     ah,43h% ?/ y4 Q; U, \4 o' A+ G) z
    int     68h
' r- a9 f/ ]9 y9 q+ W: ^    cmp     ax,0F386h3 b9 H; U9 L3 L3 \; N9 Q
    jz      SoftICE_Detected' h4 f* u; R7 t3 U$ S1 b$ i

" V3 o  |1 c6 u5 L% K. c4 m8 s, o: s! k4 Z; ^$ Q3 }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: t/ T) g# O" M   app like this:4 z0 e" _( S! M) X) g% ]5 b

* v) o4 h( k4 k; z- X' G   BPX exec_int if ax==682 x4 v2 @9 t$ F3 {$ X9 }" p
   (function called is located at byte ptr [ebp+1Dh] and client eip is
- ~2 v$ N6 e; m4 B2 k4 b! i7 K2 R   located at [ebp+48h] for 32Bit apps)
! O- x- x. m  Y, h$ A__________________________________________________________________________
% v+ h0 B* d! k; i4 Q
& e5 z: [1 r" W$ A4 @) @/ ~6 O" m6 g( w3 f( f1 f0 d6 T  s8 K8 [5 q
Method 08
* ~. X6 D, W! ?7 l1 r9 `' w=========6 V: t2 I! `" [

6 L+ `, d0 V4 E0 kIt is not a method of detection of SoftICE but a possibility to crash the9 q. I: G9 I+ J. I+ p& N
system by intercepting int 01h and int 03h and redirecting them to another6 |' G5 q! A& I: p* w
routine.
& I9 }0 t# Y# u/ n2 o0 S5 [' oIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" m3 H/ M) N7 Q9 t! ?to the new routine to execute (hangs computer...)
8 X5 l% j7 b) \5 b+ v* N0 A7 J
# [. R% Q8 i& p% T0 E    mov     ah, 25h
+ ^3 T! V6 h9 R    mov     al, Int_Number (01h or 03h)* u  P6 n& t1 D' l
    mov     dx, offset New_Int_Routine" v' R5 D; x- W7 M: z7 d; W+ x
    int     21h
7 L! \% f& J1 m& J* ~& `
/ m! q  ]5 \( ~1 O__________________________________________________________________________
* I0 m# X: X' S; v: W, W# y# D, R) r" |+ x* D# x
Method 09$ o3 X- M* j: ^+ u% k
=========
- z$ E: ]" B! x+ l+ r% ^0 e' x7 O* G3 J0 R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* t! I, ]" L2 j; ]5 M
performed in ring0 (VxD or a ring3 app using the VxdCall).
' p! K  t! P4 e0 w( _' x6 v; xThe Get_DDB service is used to determine whether or not a VxD is installed
/ V* w) k( A6 t% I: v/ ofor the specified device and returns a Device Description Block (in ecx) for1 |7 n2 I/ _. E
that device if it is installed.
. B6 @; ~8 ]9 g6 I7 P0 X" i7 T# {% K5 S5 i6 @' D
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* ?/ u' |2 c4 @6 v: ]( [& g
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 _$ D7 f' u0 k1 K  F  n8 }6 F$ S   VMMCall Get_DDB$ D4 ?: o" K1 y6 e2 P6 V
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 _) m1 w2 o; r& Z+ z4 O; ?6 b( y3 T: m7 j
Note as well that you can easily detect this method with SoftICE:
) [1 }5 W1 w+ d! t% w   bpx Get_DDB if ax==0202 || ax==7a5fh9 S, M1 O1 E; t- Z! I
% s9 ^; Y; D, S
__________________________________________________________________________
5 g( q9 W1 h. m1 D! e! `
5 j" R: R% B; B9 B3 oMethod 10+ W3 e1 V$ ~/ Y2 i* u6 t% m
=========# `/ h& A2 \( x) q. |9 u

6 v$ u4 r& K# W5 f1 _2 q=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ X' O0 [8 b$ l' q" u7 a) S- L  SoftICE while the option is enable!!
! m/ \1 {: D; _" f/ Z, O6 T* m( T4 {) z- W/ i1 a' @' V! W
This trick is very efficient:
" _9 v9 s. u! f5 Sby checking the Debug Registers, you can detect if SoftICE is loaded
7 r3 x& p6 i2 F0 i! j8 F; M7 L(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if1 {% Q% P, J0 Y8 a. P5 o
there are some memory breakpoints set (dr0 to dr3) simply by reading their
7 g/ [* o# s- {9 jvalue (in ring0 only). Values can be manipulated and or changed as well
6 P  Z' F. C# H4 g3 u1 m/ u- K(clearing BPMs for instance)) a/ g% G$ Z9 S: N9 x3 K0 t2 H( C

4 ^! Y) s0 a  W; k6 s__________________________________________________________________________" L  h: N0 Z) f$ [7 r. c% i, Q& \- ^
  d* Y0 b; O, a9 q
Method 11
6 Y( W7 m1 V; g=========
* H% Q: e) ]" e2 V  \# _; j
& {" u% f  E7 X" o5 sThis method is most known as 'MeltICE' because it has been freely distributed
: P3 w& v- Y: b8 R# jvia www.winfiles.com. However it was first used by NuMega people to allow
- {% c7 S# ~7 b$ F& g/ rSymbol Loader to check if SoftICE was active or not (the code is located6 }4 }; u5 I3 F. {) m
inside nmtrans.dll).* V3 u, B0 k6 _$ Q: J0 e
& O* E2 B) x- k& f9 X& D/ ]) V
The way it works is very simple:5 ]  b" F# V  _. T2 }8 ^
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  \0 E! L# `9 }2 x6 ]& U& t
WinNT) with the CreateFileA API.- C4 P3 M; |9 x$ L: I2 V! k

& o( ~- t5 L, W- X# |9 FHere is a sample (checking for 'SICE'):
7 Y; z& ^) z% Y0 P
3 D2 S9 a# l7 B/ r( i1 mBOOL IsSoftIce95Loaded()" i( k; k& S) @! r( f
{* G# K6 a# j. m% S
   HANDLE hFile;  
. C! i( o" K% m* z  {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 u% z0 `' S) {) P7 G$ t                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ \# M2 g3 @2 a7 Q! T4 _$ d* o
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 @( ~5 e6 a' O9 L5 e
   if( hFile != INVALID_HANDLE_VALUE )' X0 e; ?  l0 n; O9 D5 t
   {
, u6 O1 k# P! A7 s9 s& q$ X      CloseHandle(hFile);
: ^9 q' e( L, B/ ]6 o2 O      return TRUE;
6 f  `* P0 }% h7 K5 y( i( E   }
6 E0 d: J# y* j   return FALSE;9 W: Y0 M4 d7 N" j" ?
}1 o) O5 A! [1 i" [. Q
: x1 J/ e& J& H9 `, d
Although this trick calls the CreateFileA function, don't even expect to be& M- k( v! s# ]
able to intercept it by installing a IFS hook: it will not work, no way!
# D" Y. T& Q3 X4 U1 IIn fact, after the call to CreateFileA it will get through VWIN32 0x001F: z  [5 O7 l9 f5 o# ~6 E. l3 Y) C
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- M& P2 j, t7 ?) x( _9 b3 Qand then browse the DDB list until it find the VxD and its DDB_Control_Proc9 f2 }; ?/ `0 z2 ^
field.- ^' Q/ u  M2 Z: ~+ S/ ?! H
In fact, its purpose is not to load/unload VxDs but only to send a % K, ^, l6 V* k+ ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)4 O7 l% q* m4 n. ]6 I  V3 @/ G0 ]
to the VxD Control_Dispatch proc (how the hell a shareware soft could try/ J/ J- x6 M/ g1 V
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
2 J7 \1 q+ R8 n1 x& l; oIf the VxD is loaded, it will always clear eax and the Carry flag to allow
) z4 D/ t4 s8 c- Xits handle to be opened and then, will be detected.
8 B; S9 t8 i* E$ @! ?You can check that simply by hooking Winice.exe control proc entry point
3 l% Q' k: g8 P. K. z4 \: A1 e/ Rwhile running MeltICE.
# Z6 N& [5 e; o) A" L% \4 s* V5 j( ^) |7 p6 [* w# r
! y% R# F9 Y9 I1 t- Q
  00401067:  push      00402025    ; \\.\SICE
9 c, `5 G; c, I# i/ @% |  0040106C:  call      CreateFileA, c' H& h! E" k- v
  00401071:  cmp       eax,-001
4 b; @' _/ q: e# W& |) C  00401074:  je        00401091: `6 d  s: e/ p$ ~7 Y5 c- z

( ]; k9 [  m1 p
. h4 p# v6 e! r' V9 @; X  uThere could be hundreds of BPX you could use to detect this trick.
/ g% T; I# u9 V/ s0 A0 q  P2 J-The most classical one is:6 `- J; k( ]3 _8 [1 X  R
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- d9 L( j' R/ o- P% q    *(esp-&gt;4+4)=='NTIC'
2 t& L+ }" v5 M8 m. E
: @' h9 i/ |: p  f# t! G-The most exotic ones (could be very slooooow :-(5 X( J3 ^" ~2 @9 O1 l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 k# }$ i, m+ ?' z$ H5 @  |5 j     ;will break 3 times :-(6 D7 \6 h- d8 d5 J$ ]& S

2 f2 i+ W. Z+ Q# T0 L-or (a bit) faster:
! j) e1 q& W% Z- A+ X   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' s) ^2 z& P7 I& f( g

: p" r; r& f; r   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 }- J+ H4 j, a+ s* b  A  F
     ;will break 3 times :-(1 J7 Y2 ^* V6 K4 a# c, t8 U9 k

5 v. |% ~, k0 B+ `+ B$ g3 S- T2 ?-Much faster:2 n; }9 [$ f$ c) m
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 \/ d  c  \/ @& X

# H1 h1 B! z5 H) e) [# {  RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% {, G4 T# E1 `0 P/ I: O2 ^" [
function to do the same job:
2 G$ Q, r& `* K. H
1 l0 ~% j/ B+ k8 o2 h8 c; O   push    00                        ; OF_READ6 |# Y' w/ i; k1 ^
   mov     eax,[00656634]            ; '\\.\SICE',0
5 H0 i6 e- o4 K; l2 O+ R   push    eax  J# \6 v7 X6 a
   call    KERNEL32!_lopen: W! c+ k3 a  o9 R
   inc     eax8 h3 g* ^2 [2 w
   jnz     00650589                  ; detected0 d9 h( R" C; i  x4 O
   push    00                        ; OF_READ
; T) n' m# _3 I+ h& l   mov     eax,[00656638]            ; '\\.\SICE'+ k' {( D4 ^- V& i0 Q1 J
   push    eax
$ N- Y5 c# o( F$ f+ z4 d* N7 `   call    KERNEL32!_lopen
3 L+ K9 a/ `3 E0 o* e   inc     eax
4 a9 \2 ~; b( r5 H. j. a4 q; o; U   jz      006505ae                  ; not detected1 S3 T: \& ^3 w6 ?0 p! b! c
& v4 c& x+ i0 F$ ^# g

4 i' F( T: X4 Z' e: t__________________________________________________________________________% ]1 n/ I; a1 {' ?, V: K

; H3 `4 X! x, FMethod 12& y$ ~% e  K$ L- s" w8 m
=========" u) G2 v' q/ h$ i

. c6 P7 Z* w7 t1 w, nThis trick is similar to int41h/4fh Debugger installation check (code 05+ N5 y3 i* b3 }+ z6 R) m
&amp; 06) but very limited because it's only available for Win95/98 (not NT)0 h' g( g$ x1 a' x" `5 X* O
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.8 P! y; E; r' J* F7 q# k

1 u0 l/ p# m! ?; a! r2 b; i; h   push  0000004fh         ; function 4fh3 ?$ @6 \& n" b# G* W! P
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 l$ ?" b8 d+ f' |
                           ; low word specifies which service
( e: J  v. i' R8 x. B1 h* ]: {                             (VWIN32_Int41Dispatch)
9 D  A5 y/ x; k8 f: l. h8 f   call  Kernel32!ORD_001  ; VxdCall
% V7 Q4 q4 _! Y! @) S   cmp   ax, 0f386h        ; magic number returned by system debuggers* u$ E( n' _1 ]9 e, B$ O" U" P" G
   jz    SoftICE_detected" K( @5 h7 f* D+ W

* @+ f0 ^+ h. w  q' M2 J1 ?% \Here again, several ways to detect it:( H5 u7 `! F$ b% O1 ]4 U2 ~

, l! P5 ^5 a$ \    BPINT 41 if ax==4f
$ ~+ X  w# C7 @/ b* n8 ~" C: x
; w& J0 a- T: C    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! q% a! e' w  T8 X+ v; e5 A$ B* O! ~0 r6 Z, h2 y/ |2 g% |( Q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 X" W1 K+ g# _" D# |. E4 r0 U2 ~. W! P/ K1 d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 O7 {; p/ |5 t
( b! g6 Z+ l) p3 t. b
__________________________________________________________________________
8 ?4 A1 M3 ~1 M6 t8 g* ~
) Q/ w& C, h' y" HMethod 13- A, ?5 h1 V3 s& n4 O7 O/ [
=========
- c4 q; D" _% A8 `. p8 r  V: l. s6 x* }) N3 A
Not a real method of detection, but a good way to know if SoftICE is
: B" V" [. J$ {( x8 a; `installed on a computer and to locate its installation directory.) J5 ~: [+ @6 c& C8 p
It is used by few softs which access the following registry keys (usually #2) :
4 S) [5 Y8 L( s+ p
, V; B, e# F# }; m( g2 z-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 B  F, T* {' f# B6 D  }$ M\Uninstall\SoftICE# |, b8 W3 n/ O; u6 J; @7 j
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& |6 B1 G1 L1 y8 @-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 O. o! J8 c2 ^5 I* P. x1 G
\App Paths\Loader32.Exe
# U4 n" _6 n5 C! j  T  ?) r$ v# B! W3 W/ f
7 F; U4 S! c( K
Note that some nasty apps could then erase all files from SoftICE directory& n3 L, @1 h& j6 O7 W, _( g
(I faced that once :-(5 u& G9 w% ^- f8 Z8 ~0 \& V: a! I

/ q9 o  i0 ]# `Useful breakpoint to detect it:
& U$ T, m4 h' B& {: D% u8 K
/ c0 e' ~* D$ n2 `     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
: s2 y/ \) G1 l. P0 d$ w' I9 Q* o( y, @+ y: z% w' V; Z. u+ O
__________________________________________________________________________
, r& ]% F6 L( V" I' q$ i. B8 l# ^6 }/ ^4 O2 y* I; \# U% q9 i9 c: b

9 b* @2 k) o/ p0 KMethod 14 ; L$ k* ~: W4 J& P
=========. B2 R1 l/ N! \. J4 h
" o& M# R; Q. y6 D: k) `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
1 m! M. k5 }1 `$ A/ i7 E1 |3 Cis to determines whether a debugger is running on your system (ring0 only).& G* |- F, [' S
8 O$ w0 t. s7 W, r) b2 ?
   VMMCall Test_Debug_Installed
. T" t+ E' e" Q4 z  M) H   je      not_installed
- _* R: k2 q. P
- v3 E( E! {7 T1 ~This service just checks a flag.
3 w2 E! W3 V8 F% T3 t6 z: ?' t1 i</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|鲁ICP备19052200号-1

在本版发帖
关注公众号
QQ客服返回顶部