About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ e+ D. _1 U/ b
<TBODY>. N: ?5 F  T4 K3 j6 o5 I
<TR>
4 X" S* `0 U/ v7 l% U% b4 D! j4 F2 v<TD><PRE>Method 01 9 _) V+ m4 S- `$ X8 s0 s6 m
=========2 A: F6 H. N* r( b( J$ M

5 q+ {" Y# e9 Y6 L7 x) i) GThis method of detection of SoftICE (as well as the following one) is
, {. x" H- n9 v* _. Yused by the majority of packers/encryptors found on Internet.
- U& k7 h5 c" aIt seeks the signature of BoundsChecker in SoftICE( W7 U+ T! n. n- W; s* z6 K

- z1 I2 m4 ?" \' |    mov     ebp, 04243484Bh        ; 'BCHK'* i" ]  F, Q( V% l
    mov     ax, 04h
* s3 G3 J6 s" w) m6 L) K: y    int     3      
- w8 @: L9 l; Z    cmp     al,4" J7 m- X  e+ \$ D2 k4 k! G6 r% B
    jnz     SoftICE_Detected9 r$ j4 U& W: Q

9 a, P9 @6 g+ U___________________________________________________________________________
" l$ S  M! ?0 |- Q5 L9 p1 m, g4 c. a/ v( v6 V
Method 02
: k+ q+ i1 T8 I) A* f=========
# y1 P. _! n) k% e2 y- B% t  k7 ~6 F6 C/ W2 B# |
Still a method very much used (perhaps the most frequent one).  It is used
. @! E6 p: _- D' N" R& Lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 B. [+ o; o# J2 S4 O$ h, D' M& jor execute SoftICE commands...8 d, q" R/ P  G6 u7 o
It is also used to crash SoftICE and to force it to execute any commands# l% P- o, P5 \5 D$ O1 U3 S
(HBOOT...) :-((  
( E4 u$ N, C8 {2 _& n  _% j, m/ C( j$ W* O
Here is a quick description:' n7 f" [* A3 ~
-AX = 0910h   (Display string in SIce windows)$ |; z0 @( B+ i! J! u9 L9 l
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 `4 a$ M) u6 P, E4 b& N$ o* ?, |
-AX = 0912h   (Get breakpoint infos)0 N2 D+ r0 g' W( A; u/ M% R& {
-AX = 0913h   (Set Sice breakpoints)# _% P6 e5 [0 H4 i( p  `  w
-AX = 0914h   (Remove SIce breakoints)9 E1 t9 }7 o, W8 k! g- @! b3 N

) X1 c7 |$ |& _5 DEach time you'll meet this trick, you'll see:% F, |' B: _/ j) l& Q
-SI = 4647h9 X& ?+ L3 z7 F: V. A9 \
-DI = 4A4Dh" d- c& `6 q  i
Which are the 'magic values' used by SoftIce.1 k3 t2 ~/ X. R" \
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% C3 l9 ?: E5 h1 r8 l% l: Z. K: p! G, T0 b' L8 j
Here is one example from the file "Haspinst.exe" which is the dongle HASP3 `8 K8 i  R9 g, c+ J" ?. W
Envelope utility use to protect DOS applications:' m/ i& ~6 d$ b% r6 h3 i

' O; x0 R+ @( R; B" u7 Z1 ^# \2 T+ o' e/ Q* t1 W; N
4C19:0095   MOV    AX,0911  ; execute command.3 s# Z0 X9 |2 ^* e9 I, K; D+ @" \6 f
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
9 }. [6 q7 U0 p$ }: t9 w* a4C19:009A   MOV    SI,4647  ; 1st magic value.0 b& |& I* E3 O2 H  Z
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 `' s/ p; @/ n5 A# Q$ Z' x+ ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ m/ n4 x5 j, v' E1 h: _6 M4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# |9 X% @/ J# T5 b
4C19:00A4   INC    CX+ ^; J/ v& Y1 {2 Z1 v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 q' ?+ n; M) k/ }( u/ U4C19:00A8   JB     0095     ; 6 different commands.9 S! Q$ f( b/ A- I6 ]& E
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
+ a1 t- p" q' U2 }4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& ~' m8 x/ S! ^1 a9 p5 b) g) ]0 W

8 X4 p7 L+ n" M. A% jThe program will execute 6 different SIce commands located at ds:dx, which
6 a3 x7 z9 }3 n8 o3 t) e. F( b* {& \# Qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 z! Y, c' M0 r. u- w+ `) M* p
" d0 b0 x- i+ ]/ `1 o6 c9 r* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 o2 A: x, n+ J. d) K% ?& I* {/ I___________________________________________________________________________
, U* f  _1 h/ P$ Z3 G/ L1 o: g( l0 u- M0 p

$ J: q. A0 I9 p: W7 \$ rMethod 03  y" r) j0 w, b% F
=========
) B& C$ m" a4 k/ J# |
9 {. b* l! _2 t1 wLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ h$ v4 M& E" K" D3 o. _
(API Get entry point), ^" x5 u6 l  C2 c9 K. R" F/ m
        
/ N4 I+ o9 Z) V5 |& D* j
+ Q& l- L1 w' g% f$ B    xor     di,di
4 h' ~6 o$ {  g8 O$ A: H    mov     es,di
; n8 e" s' V# o# L" i( l4 U9 u    mov     ax, 1684h      
8 A' b: Y8 m8 @    mov     bx, 0202h       ; VxD ID of winice: @! J( P: h! f: }0 g! ^# V- `
    int     2Fh
2 S" k" _) N  F    mov     ax, es          ; ES:DI -&gt; VxD API entry point! m8 t% Y" U2 W: i1 y) |; _
    add     ax, di
# ~6 Q9 s/ o" _( T/ N/ r; i1 Z    test    ax,ax' r' V# S9 x  A  v/ w% D9 ^
    jnz     SoftICE_Detected
& ?& n( W; y6 E% d! k
: M; i+ }* w' |" }0 z6 t- b. P___________________________________________________________________________
: I, v/ m& Z. i% |7 P3 V) K9 b* q
; O* d/ H1 n7 r- k& n* cMethod 04
" }7 g' i9 t7 E0 Y' @" ~  r=========
9 I. [9 L3 H+ ~0 b0 ~/ d' V
  v" }+ a! ~6 ?0 a7 x: _Method identical to the preceding one except that it seeks the ID of SoftICE. b% y+ ]! W3 a9 e) \0 i$ `
GFX VxD.
, x1 m0 z* F# {5 T$ f! b+ D; R
/ V/ {- u; m$ A$ S, ~9 j! c    xor     di,di
7 m: \. f; k$ S* F  d+ Q5 F7 t1 w    mov     es,di
" k* m2 o( g, u+ x5 z$ u    mov     ax, 1684h       $ J( p% k3 \6 C0 j# W& t
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 k2 S) K& W* R# Z7 q. o    int     2fh4 ^3 B; {: g1 T# x# s
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* W8 _' H9 `# q& S
    add     ax, di
7 U7 T% h  A0 M' }* E4 A" o( i0 X; N, T    test    ax,ax% U% l: e' p- J
    jnz     SoftICE_Detected5 S. G! j4 |* K4 N

4 B0 O" D- ~5 E- [__________________________________________________________________________
4 _" J6 c: p. }( v8 w3 ?
- k* @: H9 I" m/ S, `+ S5 i2 n+ t  e' ~( N( h+ P
Method 05
2 A/ \  I& ~; m=========3 D2 x. q0 {  X# h0 L
  ^/ \$ F5 `" t6 j
Method seeking the 'magic number' 0F386h returned (in ax) by all system
6 R+ c) _& f7 ddebugger. It calls the int 41h, function 4Fh.
2 N) P9 m- F9 t0 Z1 b( cThere are several alternatives.  
' v5 I( ^3 W- E7 Y; d5 z7 p5 R
; M* Y% }8 ~: b$ I- }, b; S" `The following one is the simplest:
3 R9 s% w0 E' O8 T, T8 @8 T4 ?5 d+ h* d: x( l" \' Y
    mov     ax,4fh
& m" z7 R$ _& J    int     41h
6 F! v# }) {! @+ m8 Y6 {    cmp     ax, 0F3863 \9 ^( W3 T4 |( F8 ~/ _  \
    jz      SoftICE_detected- y7 I: Q+ R) y; Q1 _5 @

, {- [3 C/ _, Q9 J2 ~3 a; M0 Z4 o1 r; q
Next method as well as the following one are 2 examples from Stone's
$ ?8 Z( x/ F0 v+ Y1 G, Z% {  @) C"stn-wid.zip" (www.cracking.net):. `" B9 l% t' N8 j) k3 {

* G* l5 S' k  X6 {  ]6 |    mov     bx, cs; ]& i  I, H% f" u
    lea     dx, int41handler2
- ?& w( j6 R6 l* l2 h) t+ W    xchg    dx, es:[41h*4]  k/ M1 p$ m' C2 \# `
    xchg    bx, es:[41h*4+2]
2 \, ?7 _1 a1 F: G# k2 w; l0 y    mov     ax,4fh4 [) N# r7 v0 Q  ~' ^3 X0 H
    int     41h) j) w( D! t) f
    xchg    dx, es:[41h*4]
' L8 Q3 s% W! ~( U7 J$ h: c    xchg    bx, es:[41h*4+2]( O3 S/ h- q0 v8 y
    cmp     ax, 0f386h
, j2 J3 }& N3 {, G$ n9 ]    jz      SoftICE_detected
; _, Z* R9 I' G! M# g% R! x: L- g3 T& H1 T' s5 Y- W( x
int41handler2 PROC
, r( M  g7 V( q: j" \7 V    iret
0 v0 A/ V% U7 R2 O2 iint41handler2 ENDP
7 m0 ]8 d( \( [+ T$ ?$ r, i: A/ L0 t8 x# |  e  ?- }

( T( U: ?; J) Y% b6 w, }2 A1 _: a0 ]_________________________________________________________________________
. j4 p/ w6 B) C8 A/ l" ]! [6 t0 ?# D* d$ p  L4 s3 A
- R# E8 @* F; G
Method 06
9 T9 f( v: n% M2 d7 g8 K6 x8 w* Y7 O=========
. {5 W/ C* T/ l! h5 C" s' H
' k$ q; u: H: C+ f/ C! q
4 k, m- n# g% m( k2nd method similar to the preceding one but more difficult to detect:& H. }5 Q+ u, ^4 ~4 i- r
8 y) s9 J) ?; l% b( O
/ t( Y' B' j3 V, s3 S$ t! C+ W$ f
int41handler PROC) B! [% W6 p+ G# W/ p; `
    mov     cl,al
8 W4 Y& F2 T6 e, m7 T    iret; _4 c4 x: r$ X% r# N- ?
int41handler ENDP
' F  @3 x+ Y; H' ~5 G$ x. Y8 i4 W$ K; E7 J: w) F0 C, Q: f: s
2 u6 H" ?3 s) a
    xor     ax,ax
  b$ ?  W4 F! ^' @4 v! Q    mov     es,ax3 E  B0 x" D. u; ?8 R5 }  S% M
    mov     bx, cs
" V/ W. X) R/ C: |1 o    lea     dx, int41handler* `' G& _/ x1 u1 t3 Y
    xchg    dx, es:[41h*4]
7 r! S1 B) P5 k' E1 ]    xchg    bx, es:[41h*4+2]' d$ J  Q4 k5 }3 h0 N, V1 Y, D- k
    in      al, 40h
: Q) _. p5 J5 H9 h    xor     cx,cx% M( _/ Z9 {* w+ {
    int     41h
# T" I1 b0 Z  g" e    xchg    dx, es:[41h*4]8 ~. M( L5 e- B9 ?
    xchg    bx, es:[41h*4+2]
& G% a1 J- r9 c9 m    cmp     cl,al
, i* `* c* o0 E& b" i    jnz     SoftICE_detected
. k$ I: R% O0 y$ T
- c+ d% ]4 `9 X_________________________________________________________________________  ^( P/ ?: i' a5 z- Y& J# v; W
, H& Q2 v: f, m
Method 07
" Z7 G, a6 B$ P+ V4 r2 Y=========
8 y" M; A- f) Y1 i  f3 s
5 ~1 L1 b& I) i2 |5 dMethod of detection of the WinICE handler in the int68h (V86)  i$ r, [  G& I  R( v

9 Q* E+ F7 w5 Z/ e5 s! u    mov     ah,43h
' H/ T; b4 O5 W3 {; d. y5 Q8 ]    int     68h4 ~' }4 I; {. o0 k0 |. P& ]. `# F
    cmp     ax,0F386h
- y% V0 d# J% z5 E    jz      SoftICE_Detected
9 }; z8 |5 E1 a5 T  K2 u- S1 }4 \% b8 f1 X

; J" }. g9 T( J# P$ C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 `5 d9 w- W3 n
   app like this:, `" S+ X3 d- |1 t

( C  R2 d% |0 K& T+ O- ~7 C2 p   BPX exec_int if ax==68
3 G! T0 ~  U/ j, }3 ?+ A1 @+ G   (function called is located at byte ptr [ebp+1Dh] and client eip is1 @1 G- w* X9 R/ d, q
   located at [ebp+48h] for 32Bit apps)
  y& M5 x, q6 j  x* G& r" z__________________________________________________________________________
/ {2 g0 d. j7 F$ d4 Y" }/ y- ~0 {% v  _* r, u
, l( i' t3 J- A4 N% ~; o
Method 08
! q* u+ L. \0 x: J8 |=========, g; u9 x6 U( T5 j

+ f+ x6 {1 c4 B' o/ J' eIt is not a method of detection of SoftICE but a possibility to crash the
. h' I7 T8 i& K6 p0 |8 l, gsystem by intercepting int 01h and int 03h and redirecting them to another
2 h) J+ k1 l( }& R, R* y. o8 z5 kroutine.4 Q8 y+ k) w8 O: P; C7 B0 S
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
9 |+ U  J% n1 }+ T  u0 ito the new routine to execute (hangs computer...). n6 ]( X) k! q
1 b( A, G4 M6 \2 z9 U! J
    mov     ah, 25h
6 c3 L6 ?2 ?* ~$ s- v    mov     al, Int_Number (01h or 03h)$ F4 `  r  c  L, S- O
    mov     dx, offset New_Int_Routine
- L  @5 \8 ]1 O1 V% J( L    int     21h
0 |4 {; q! W% `" b& S
. z# t- B) K* H__________________________________________________________________________
+ @; w  D; j1 V: |& R9 ]; m# [5 y* ~9 _; L# U6 i
Method 09+ x" Z% \) k2 n
=========
" C3 J5 K+ C& j) b* L/ P
# v$ M, T& f/ w) U* GThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 ?4 f- R" K7 W2 ^; }2 S
performed in ring0 (VxD or a ring3 app using the VxdCall).
" q: b+ `; o$ G1 i- GThe Get_DDB service is used to determine whether or not a VxD is installed
% S* U  F6 h6 U$ @  afor the specified device and returns a Device Description Block (in ecx) for9 {  m' u) s# ?7 R3 D) P) w0 R
that device if it is installed.
8 B/ i) X( ], \% l$ r$ {
# }3 Y* H* j! N' U5 @. E   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 a5 R9 J6 J  M; G; {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 h# C( _" o; C3 Q. F" ?   VMMCall Get_DDB
) A  ^4 o( L5 S: S4 V9 K% I( d* B   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 a, s0 v: d! c+ O6 _$ B4 A
. t/ y! y4 `# a9 z0 P; \: e
Note as well that you can easily detect this method with SoftICE:
7 |0 C* V* w9 y2 R   bpx Get_DDB if ax==0202 || ax==7a5fh
7 m4 w/ j8 V0 Q. k6 d. o) G
% o1 [; ]4 h0 ^" N* n$ f  [  k__________________________________________________________________________
, O7 N5 R* s% Z4 i# D" |+ r% \  O9 R9 C" d1 c5 z' F9 Y' f6 k
Method 10
1 C5 d" \, s4 e3 _9 b1 E: N=========) |/ m+ J' V0 O4 G3 b. D1 Z& w
% h. b: m" b2 e2 D, c/ t/ ?
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! g; x  k$ j1 q8 h7 t
  SoftICE while the option is enable!!" \: b: T5 j8 }# K
" m1 }7 P$ n3 s. T
This trick is very efficient:
6 ]  f0 w& _  a& Oby checking the Debug Registers, you can detect if SoftICE is loaded$ V- B* {! [2 {9 [
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if- y% H2 ~$ f6 |% }. X# N( a
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 R  Q7 J+ Y" y1 Z* d& e
value (in ring0 only). Values can be manipulated and or changed as well# \0 C& N8 x! w2 E: r% L
(clearing BPMs for instance)
0 M3 [! L- {/ E) E' _
8 @' ]- j: {2 |# q__________________________________________________________________________2 I8 u  o) @" Y1 m4 r) K

; Q- y& M2 u# D$ s4 HMethod 11- X0 s) `, I# |% Q3 L1 I0 g
=========
# h' }  I( ~5 ^" ~1 j) [; f' w5 T& Z( t7 O' f& s! \
This method is most known as 'MeltICE' because it has been freely distributed$ l- Z; ~6 k. _; a
via www.winfiles.com. However it was first used by NuMega people to allow
& d) t5 B  @' b- K% ?Symbol Loader to check if SoftICE was active or not (the code is located( M8 W5 ?  D- v+ K2 H
inside nmtrans.dll).8 E6 h+ R9 ^: N+ d2 `
& K3 k. g- Y% r4 V) Z
The way it works is very simple:4 M0 ]& I0 O8 `/ M! Y$ O, |& p+ j
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for, [. l7 a1 y0 u& s/ ^1 n5 p) a/ u
WinNT) with the CreateFileA API.3 q$ n8 d' L+ o# E

) w+ r0 N2 \( A1 EHere is a sample (checking for 'SICE'):5 z! o. O% {! K) j0 S% W( }# X/ p

0 p1 [* z1 p8 ^/ l, r" mBOOL IsSoftIce95Loaded()
# h  A8 K& m/ r, _) u" F{
) i$ T( o+ g  z0 f0 G3 ~* I: t! a7 q   HANDLE hFile;  
, _' _" _* v) k# ~8 `1 e   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ k* b1 d' b7 c8 t9 }4 l                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 O9 a, x4 z) |% }9 q% z                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' N* S# C' @2 e- d4 {   if( hFile != INVALID_HANDLE_VALUE )
  p4 P: k8 K/ d* k$ z   {
# ^0 \" @6 c. _/ s( n. ~& T9 N      CloseHandle(hFile);! ]. p" Y: n1 g) ^
      return TRUE;1 N- o# c3 v: `6 b) t) `
   }
% x% k: m  h$ {: n( j1 n0 d$ x- [   return FALSE;
. m! E" K7 G. l& d6 n. u: U}0 x3 {9 G8 F0 J0 `$ }$ V8 W- C
9 n; {" U) [3 N# O' O
Although this trick calls the CreateFileA function, don't even expect to be
( N0 x7 c5 s- @" ^0 y2 }6 a$ X4 I7 cable to intercept it by installing a IFS hook: it will not work, no way!7 s4 D5 z- z! g9 q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, @  J+ Q  U) r6 A- |# B4 y
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 W' q+ Z0 R* Q9 D
and then browse the DDB list until it find the VxD and its DDB_Control_Proc  S+ F$ w$ ^3 ?- ^0 y& A+ x/ U6 j' N
field.
2 V, V( C" N' r3 X/ g. CIn fact, its purpose is not to load/unload VxDs but only to send a   K. R+ ~1 @7 S1 t4 {% h4 g+ V) @
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' D( @% I/ \% C6 \: p. L: {* {
to the VxD Control_Dispatch proc (how the hell a shareware soft could try! Q% e, W6 T8 E+ |; h$ o
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
* h/ T$ z& [0 \) ~# ]If the VxD is loaded, it will always clear eax and the Carry flag to allow
) {  y. u7 ~; E! ]) y8 @) Vits handle to be opened and then, will be detected.! h2 J+ _6 a/ I  m0 X/ k3 N' K# \
You can check that simply by hooking Winice.exe control proc entry point3 A5 G2 g# w' C& ^7 S
while running MeltICE.
8 x8 D) x- ?4 m+ l$ @- B) a& \5 R" e' X0 ?- o, `: y5 F& t

) A$ V  q- H  G" \5 f  00401067:  push      00402025    ; \\.\SICE
4 ]! d7 H+ u% k# H  0040106C:  call      CreateFileA! ^7 [; ]6 e; _! h9 n% y# u
  00401071:  cmp       eax,-001! f" y  ]% c% ?
  00401074:  je        004010916 I! i% _1 e4 v2 z" X/ r' @! Z

. k# D! R% \8 H* g$ f8 W
1 d, o4 s$ Y* D& _There could be hundreds of BPX you could use to detect this trick.& P# r  L1 r& d
-The most classical one is:
# K) D! E* |9 ^( s  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% _7 }; Q+ Y2 _7 g
    *(esp-&gt;4+4)=='NTIC'- L( ?6 ^' v& _; P3 c6 h

7 G+ P, B7 K* D-The most exotic ones (could be very slooooow :-(
5 T4 g4 K; x, C   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / o; l# S6 r* @  }# Q, F1 U
     ;will break 3 times :-(: k# Y0 Q8 e. w4 j, O

/ F+ M, O; m: t4 T5 [, l4 _-or (a bit) faster:
+ \/ U3 L9 v% h0 x   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), T- U/ Z" V8 V2 x# F% \
) K4 V( y5 R! l
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 {( z) }5 x+ P
     ;will break 3 times :-(- c) U9 }' [! K0 Z# }

' m' \0 g$ `7 n2 {: D* `-Much faster:
; T. Q: J% Y: [+ L7 y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
" I% C7 b& C; g* h3 U9 K2 B% }  q# r: X1 b4 u+ G+ w$ a1 B( N
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
5 N" j/ Q8 o# j& Afunction to do the same job:8 w& a, l* ?" g5 T- E$ i
  j  ]# x' \& p9 d6 ?6 [; x
   push    00                        ; OF_READ
; ]/ J3 W$ u9 Y) L9 ^3 a   mov     eax,[00656634]            ; '\\.\SICE',0
$ X* @3 M1 Y$ K) }' h. |   push    eax9 F5 P  j, V9 S; {( U; z; p+ U
   call    KERNEL32!_lopen1 N' G, h1 h; a
   inc     eax
3 A' I. s+ u  m  `5 g' Y6 f! G/ z9 }. G   jnz     00650589                  ; detected
  W' C8 w+ z& {3 c/ j9 r- i   push    00                        ; OF_READ
1 B- M8 V* s3 j" X' ]   mov     eax,[00656638]            ; '\\.\SICE'
' C" v: d& M( c& }1 u   push    eax( ^! P1 l! f- }% ?9 ?5 E6 c
   call    KERNEL32!_lopen
: g+ b0 A" E+ U# Y+ e" S   inc     eax
% k% u5 I7 q- h2 n0 D   jz      006505ae                  ; not detected4 b: E& r8 p! O  b- ]
; N- M3 D8 Y3 \# ^& R$ V* s

4 r6 m: e- d1 S( q__________________________________________________________________________" x7 |2 q7 v8 n- W  D

7 U  I  [' f. TMethod 12$ d# C1 w+ s/ F# I
=========
4 Q2 O0 U/ U9 R; P; R8 A& @7 ^# y
! u3 m5 I: I; `3 w5 w% tThis trick is similar to int41h/4fh Debugger installation check (code 052 F; X4 ^7 v- C
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
8 `+ a1 Q/ w' I) F6 `8 ?as it uses the VxDCall backdoor. This detection was found in Bleem Demo.  k* _: G  o9 P; H* b8 x

1 h1 Y0 L: {6 E; R3 y( |   push  0000004fh         ; function 4fh4 ?7 A: {8 `0 n4 {$ e# H' i3 z
   push  002a002ah         ; high word specifies which VxD (VWIN32): ?! B! l" x9 ^' w3 @4 u* t
                           ; low word specifies which service* A# L1 I2 ]$ R+ W+ ~. L
                             (VWIN32_Int41Dispatch)
) h( S4 m) [6 |+ _0 j8 J9 _   call  Kernel32!ORD_001  ; VxdCall
% o! U) y6 {. O/ u2 w6 b6 a$ w   cmp   ax, 0f386h        ; magic number returned by system debuggers! z8 S6 |9 Z0 `1 s
   jz    SoftICE_detected7 E9 i: M" \- ]8 b) u/ h
- [, A3 j1 ?6 Q8 w
Here again, several ways to detect it:
* ?- A* h' c' V( ?/ `1 ^5 D% n& [1 l* T) [; h7 ]- i
    BPINT 41 if ax==4f  a# E8 h+ j9 @1 v  w& B% k

, v3 ~$ |8 S0 ?    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 Z% i. f) c% }3 p+ ^' d+ ?
# P' b- B1 |3 n
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( q( g# M9 A6 d7 F/ U0 H  k
; z2 h0 n! F2 _- V% l' s
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. W3 n4 \' H" d# L& Z5 ]* V# p
5 R9 Z+ @) a* n* e* t9 j; k' k$ h
__________________________________________________________________________
+ m, b! m8 K% l" t+ ^( k' K$ y  D  Z- g6 s/ j
Method 13
% |9 g: o! K# s$ C4 |1 j  ]=========
2 N* H$ L  m, Y$ A8 P; H. t
# P0 e5 J5 F* p; D( a3 H  B. RNot a real method of detection, but a good way to know if SoftICE is
6 }  m+ v6 v1 o1 E) r+ \) {installed on a computer and to locate its installation directory.
% w% y& a: [, I$ ^- h) nIt is used by few softs which access the following registry keys (usually #2) :; Q5 G' k+ Q( e' v% a4 E8 {) m7 [
3 b! s' y1 E3 B! ]3 ^. V/ q# {! s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' O: S5 R6 H5 K+ M' z\Uninstall\SoftICE4 d! L6 G: h) n% W  X  y9 N
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- O" _1 y1 Y& f5 c( s* T-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ q  m  K& J# X2 Z5 _- Y, S9 }\App Paths\Loader32.Exe
5 R. A" Q1 q. j0 }5 [5 i& r9 A/ H8 K% w- C* E4 Q, ]/ u+ j# j

& z. J2 S- [# _: F1 B; r" q) SNote that some nasty apps could then erase all files from SoftICE directory
& _4 _' g  a  X# A(I faced that once :-(3 j: z4 `: ~+ A' }8 b4 X
* C# v; c  U. w6 R- Q* X
Useful breakpoint to detect it:( }, F1 k+ M2 k8 i% R
! n1 e2 E* }$ v6 o- \
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 G. Q# ?$ r+ X: |/ a

4 F. I5 s2 {/ D8 v- W0 p1 Y" X4 L__________________________________________________________________________6 X5 Z& P" K- F( ^% a  Y7 @- [
  M3 h4 n5 a* B' [0 L+ B7 m' r
4 r+ i& @( K* v  q! Z8 i
Method 14 + u# W4 _8 c" V4 m4 i% l3 t
=========3 f" q$ y5 f  [0 A: Z3 u. b7 M7 G% m

2 [' v+ [1 I' V4 G2 P' E1 [0 WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. G( O* Y# S, l1 U) N# U; p4 Ois to determines whether a debugger is running on your system (ring0 only).
+ w' M8 b; |; u, b/ F) u1 w$ i  V4 N1 ~# T( H- P
   VMMCall Test_Debug_Installed
/ v, {* P5 Y) `% K$ l   je      not_installed
- l3 j8 @8 V  P1 u2 j  Y2 y3 r( m( d$ k! Y3 U
This service just checks a flag.) k' u9 u+ }: x4 L
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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