About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
/ _) z9 A/ B( l5 q6 p8 P1 T# R* p<TBODY>9 [1 u) |* s) s1 E4 w
<TR>! U" q  t+ K* G! J
<TD><PRE>Method 01
7 b0 B/ T5 m5 I, b7 |! p4 J=========
0 {, |3 g: A: ^- A+ u" ^& N4 x' B3 ~4 s: C/ C/ l' m; E
This method of detection of SoftICE (as well as the following one) is
) v" _6 P7 S0 K2 Q+ R6 u1 _; }used by the majority of packers/encryptors found on Internet.' m" w1 o7 E! _9 l1 g
It seeks the signature of BoundsChecker in SoftICE& Z/ N' F7 ?, \3 d6 H. E% P
% P' n: a, L9 [# \8 U7 }. B
    mov     ebp, 04243484Bh        ; 'BCHK'
# w; a. y9 i* I/ ]    mov     ax, 04h5 w. N1 w6 p0 [, c/ n9 `" N7 Q
    int     3       5 t: {% M: k" [# l
    cmp     al,4& O0 p( o+ D& ]! L
    jnz     SoftICE_Detected
! _+ w2 x1 a( c9 N6 F/ u+ X+ d, F
& g3 x1 ~9 W% l, ~! ?' [% s___________________________________________________________________________6 M  A9 r/ Q( C. d& K# ^

, c7 p! ], A1 p. c! tMethod 02
4 t1 b- a# N8 x: q5 {! z% ]=========
* v5 M: j2 l$ s" h
2 u$ A. W2 H. ^: w+ oStill a method very much used (perhaps the most frequent one).  It is used9 @% g2 |" A: v$ T/ B; c. V
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 S( x" B: }/ ~5 S& Q# {or execute SoftICE commands...
/ J  ?; N2 Y, Y9 H# G6 @It is also used to crash SoftICE and to force it to execute any commands6 f- J. }0 k7 d7 W* q0 G
(HBOOT...) :-((  
/ `* j- Y) M2 `: N  j
5 `8 p9 ^0 ?, X# o; yHere is a quick description:7 Q) f5 I3 }* y  u' Z/ r
-AX = 0910h   (Display string in SIce windows). O# |, N$ M$ V9 Q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
: j5 F7 t" X% y" S-AX = 0912h   (Get breakpoint infos)
+ @# n- G: a: h- k$ r, c9 x6 }5 j-AX = 0913h   (Set Sice breakpoints)- {1 w& D" S% X0 {, C" q% g" n5 ~
-AX = 0914h   (Remove SIce breakoints)
0 w8 ]2 S2 b- u: n, @- F0 v9 x
Each time you'll meet this trick, you'll see:- ?8 S5 f; m: Z5 S* m% @/ u
-SI = 4647h9 p  c4 S' s, i
-DI = 4A4Dh6 M+ _/ I6 G6 J6 V" Q1 e/ e, n( u
Which are the 'magic values' used by SoftIce.
, }8 K3 T! a0 wFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% w2 f9 I7 q& D4 c3 s7 v6 j6 Z- }) {& E+ r& ~- E. d
Here is one example from the file "Haspinst.exe" which is the dongle HASP
; E) r3 J" R- w3 L6 X& I; W. CEnvelope utility use to protect DOS applications:( Y  S; P0 Z' g9 b
* ~6 g0 e. u, ]
+ s# }% w% G% }! f" v- D8 n
4C19:0095   MOV    AX,0911  ; execute command." x, x" `4 y+ @( r- ^% ?
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# {# T' g: K4 H2 i7 e: V
4C19:009A   MOV    SI,4647  ; 1st magic value.
  I) p  A* B$ A6 D4C19:009D   MOV    DI,4A4D  ; 2nd magic value.' M5 ]/ e  f5 N3 T0 Q' q7 w
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 Q, X2 A9 {6 W0 `8 x' ?: p, g$ m; \
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 R7 a& k! Z6 M/ `  E% K. ^: V4C19:00A4   INC    CX: q% Y! r" F9 ^! L4 r  m" r" H5 c
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, h% Y" U. K. N
4C19:00A8   JB     0095     ; 6 different commands.0 C# g& i8 [- v8 n0 T
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 |# W+ ~" J) D1 \7 Y4 R) ?6 u
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
" _( \2 W( A! @3 y) ]- x1 I/ ]! t0 I, f3 W% J) Q, o, k
The program will execute 6 different SIce commands located at ds:dx, which/ V" m7 d5 n5 A, s& Z9 m% _
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.7 n& x1 V0 U- q2 I: f2 s
5 b  D& W8 ^2 L, x: D! U2 ?
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 b2 y: g  `/ v  v! X
___________________________________________________________________________; `, @, B1 o! W) i4 K

. N! y- }6 @: ]; M  b% I6 s
- o: E+ c( ^) P% lMethod 03
) h" Z8 x' c# B=========
; S" l' I" D. X3 `
& x+ D" s" p3 Z, Q# ULess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 x, R3 M, M. b1 v  D0 [  R, \* ?(API Get entry point)
5 L2 ]/ ]1 a  |9 o" V        
& q3 h  o2 U+ X0 F0 g8 ~$ C  y& i( m0 f
    xor     di,di
1 [# ?6 N& f  `4 [. B    mov     es,di3 X' a$ h% t3 E( }% x* n! M5 j; m
    mov     ax, 1684h       / g. Y" a8 a" F% ~3 L
    mov     bx, 0202h       ; VxD ID of winice
+ q2 V" G6 j: k" p1 x7 b    int     2Fh: {. F- N: j, S  b& U# p% G& ]9 ^9 E2 m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 A, ?) x% j" n: E/ S    add     ax, di, ?% N6 r$ [8 A, J5 K0 B3 i
    test    ax,ax% Y7 S' N% `' c% L$ y
    jnz     SoftICE_Detected
" e  T0 b" H' u
- x2 @* B$ B1 m- \/ y2 C___________________________________________________________________________
) ^0 d: t1 n0 n/ n
. f- z1 [1 H- V; k) i+ i& JMethod 04* B7 [& a$ `- n& J
=========
6 |, `) Z. `; T
' h. \+ U2 c6 ZMethod identical to the preceding one except that it seeks the ID of SoftICE0 G4 B# O. r" D& \) z
GFX VxD.& \  V/ x6 ~6 l. N9 T
) G# w; O. o( n# g/ B- ^
    xor     di,di
( d3 A% O6 B- z; E, S) w3 k    mov     es,di
/ U  q) [! b, w4 B/ o! {9 ^5 X    mov     ax, 1684h      
/ D& Z% |0 @) h3 ^/ @: z- }  N' E    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 q2 W4 C7 _1 P6 s2 V4 D  y0 i9 `
    int     2fh$ o* Q+ t$ d( a9 H# r% m! s, {  u
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) s9 K% J" B) ^, l( E3 H+ B    add     ax, di
% t; H" T3 z) Z- z4 n* @6 ?, y    test    ax,ax) U3 b) q5 Q/ f
    jnz     SoftICE_Detected
) T5 d8 i0 @$ ?
& j7 O) p. c, U9 R" `__________________________________________________________________________
. D, F" ^. Z0 B5 y* x* P3 Y
+ ?& }- Z/ z# S. ?7 O* t+ B: [1 f- _! K) ~
Method 05$ I! C, B" [% x. g
=========
; |1 C9 d2 G. d4 J1 y* `8 v8 o" r5 W: O, v4 f# h/ j
Method seeking the 'magic number' 0F386h returned (in ax) by all system9 l& ^" s! C5 _/ F5 ]
debugger. It calls the int 41h, function 4Fh.
+ {) d+ h4 c  E" z) E& ]There are several alternatives.  
, _% H7 r6 `( q% n% N1 Y5 F2 j! i, z
2 R/ Q. k, i% T/ U- I6 nThe following one is the simplest:
9 i% N3 l& _- O& C$ B
- |, I$ @0 A* b( S# N- Q    mov     ax,4fh) _0 s  q1 L9 H2 _% b. q  y& P
    int     41h
" j; P6 ~6 K! B6 U1 _6 f1 H- F' s    cmp     ax, 0F386
: B, @5 D$ J5 e$ _( ]* w! L    jz      SoftICE_detected/ r) H! S$ _( ]7 C" G  s8 |$ E% C+ v
5 x* K* E% q0 @* s. ~0 \

, Y* a' p, R" ^) b+ R6 O9 C( Q9 q- kNext method as well as the following one are 2 examples from Stone's
* l; B3 n, n" v/ D5 ~"stn-wid.zip" (www.cracking.net):
9 y0 F/ ]# d3 A$ t) I
+ \+ y4 Y0 M) A: N7 x    mov     bx, cs: L1 T' g8 [; I1 V+ W& m8 U# T6 q  J
    lea     dx, int41handler2& {6 S4 J  ?! s/ Y; N/ V
    xchg    dx, es:[41h*4]. z/ ~8 D  d) ~2 N: K+ b
    xchg    bx, es:[41h*4+2]0 r$ I, E, x9 {7 s  W
    mov     ax,4fh
3 P7 }# |. A: A3 r2 l" y    int     41h' @7 x) m5 T( H9 _  Q
    xchg    dx, es:[41h*4]
& B; L9 i  X- c1 q& t; Q8 }    xchg    bx, es:[41h*4+2]
" o" ~  r0 x9 @! x' W) G' H    cmp     ax, 0f386h& o! ]% S. z9 \
    jz      SoftICE_detected
# b) l8 j% W- @/ R% \: X* g
" [  p. o0 W' c# ]) G9 z% Mint41handler2 PROC/ D: `5 e  O; b# p0 q( h5 m, I
    iret
, D, a) X5 O6 E7 \7 tint41handler2 ENDP- y/ x  Q0 u: H4 ]/ f9 {: c! E
2 B- l" i/ i3 z

2 s% @( J" o: q_________________________________________________________________________3 ~6 ~6 I9 j8 E1 b

5 G- L; |) o0 r1 J
0 N' Q- e+ w0 I4 C0 [) q) B6 M* UMethod 06& Y. g% j3 b+ [$ Y$ Z9 o  [
=========
0 s: h- S5 B  Z9 \# O
+ f0 l  ~! e0 b1 B) Z7 r& ~7 ?; j8 M
7 U7 C+ ]" ?% X! w6 K2nd method similar to the preceding one but more difficult to detect:' e" U& \9 H3 w% B% [
0 _5 Q7 X& x! s- o0 i% i
0 o0 H0 ^- M% U  @$ u5 _) l
int41handler PROC% \5 k+ a) i, m/ m  z- h& C
    mov     cl,al
" g. S+ o; |: Q# R4 R    iret
3 o* |% I# W& N) |7 F/ Qint41handler ENDP* i9 p8 r& _9 Y8 b

1 T8 `4 c9 N) `* s) u7 Y# o; s$ [, k* O- P5 f# {9 O8 x
    xor     ax,ax; w6 N: E; D. b* T
    mov     es,ax9 S& K8 {5 O  I8 J
    mov     bx, cs
% S! k  z1 g1 ^    lea     dx, int41handler
  T+ M$ g8 M, ?: s# o9 M) C8 C    xchg    dx, es:[41h*4]
& i  F& V& d/ v; N9 V+ W! }3 M# s    xchg    bx, es:[41h*4+2], \# X& `1 U; K; Y2 B$ E
    in      al, 40h8 y" V& A1 o" Y/ a: B
    xor     cx,cx& K" `& k- p, d: m; s1 z( q
    int     41h9 J6 Z$ d5 ~7 s' c# u. X6 _2 f3 C
    xchg    dx, es:[41h*4]  F% N2 C* j1 [, V$ ~& }" b- S9 t% ^
    xchg    bx, es:[41h*4+2]+ l  X( A5 O, v3 b, {
    cmp     cl,al1 c. }8 w( L& {9 i
    jnz     SoftICE_detected
+ l% n4 h: l1 y; Z
6 ~+ C6 O& O" y7 B) S_________________________________________________________________________* N: x. ^/ f+ C$ f

/ C: Z% L( ^" e2 J. _Method 07& v- `& R# U, W2 [( b* U) R
=========
& X8 u/ O9 m+ h0 e' N$ J. O' F' p3 }" o# Q* c2 F) E( Q2 p8 a
Method of detection of the WinICE handler in the int68h (V86)$ ]( V7 f* |. L% g/ D

) x& f# Z  r- `- B5 ]4 q& A    mov     ah,43h
( l2 ]$ W' }$ R+ b1 Y    int     68h
9 ]: s9 [) s% W, @* u1 z2 A    cmp     ax,0F386h
% l- f; R5 n7 B. |, e* l  `    jz      SoftICE_Detected, }3 }* O$ G: D( t
* f  [" w: e2 I0 C$ e% C

2 r/ Z  A* E8 z0 ]) g1 x3 X4 \/ a=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 N! x$ _3 m" r
   app like this:9 }6 {% x7 y: G2 X, n9 q

9 k) d/ B8 c! }+ B$ \   BPX exec_int if ax==68
- y( w2 Z' V7 m, e" E   (function called is located at byte ptr [ebp+1Dh] and client eip is* k% Y) b1 H" Q9 \" y9 K
   located at [ebp+48h] for 32Bit apps)
6 y4 Z7 M, k' B__________________________________________________________________________
2 j, P5 s0 a( W
/ E! b2 ~) z4 v, \; e- t+ U
' M* {! J; L3 h. D: hMethod 08
' u" n- c& ^9 M. F/ f* B=========9 i( n$ [5 r" o- T
' P+ q4 I* g* W- h
It is not a method of detection of SoftICE but a possibility to crash the8 b* `$ v) C$ g$ c
system by intercepting int 01h and int 03h and redirecting them to another
' F1 T4 I& A: b" r4 y3 iroutine.
: Z# }% p" [8 R6 EIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' ?$ ?4 _! {) n( ~to the new routine to execute (hangs computer...)( B0 Y# }6 A! Z1 R2 L
0 [. n. C) d, Y! @; b( Q- N
    mov     ah, 25h, `2 T& {4 U: Q+ B% Z! c/ N
    mov     al, Int_Number (01h or 03h)- m- g1 x3 P' r4 Y$ O
    mov     dx, offset New_Int_Routine
+ r! Q; G4 X7 K( Y" _    int     21h
( g* t% g+ [. l# ~
2 Y4 y7 i0 ~4 |* a# [__________________________________________________________________________8 O8 k: M" Z# A. S4 X1 Q
4 c2 n" A5 _' t- T5 X; a  A; G
Method 09
( O% o) v4 \$ t. t=========' ]2 U# f" [1 T8 ?5 x& u7 H

/ a4 R. r' C7 ?# T8 c  |4 b' P/ \) mThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! N  g! M4 i; Rperformed in ring0 (VxD or a ring3 app using the VxdCall).
; G9 ~0 D. V4 D2 LThe Get_DDB service is used to determine whether or not a VxD is installed
1 C4 @1 d9 G0 a$ [$ w( Y8 R7 Y- V& R" nfor the specified device and returns a Device Description Block (in ecx) for% |( R4 j( q0 p$ A' x$ S
that device if it is installed.
! n; g/ D- P) S( u# R7 |" r8 x$ C+ b, O( k" Q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; e2 l, a2 q9 {! _! H
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% |8 R$ c* Y, }7 }$ K
   VMMCall Get_DDB" V, c. s9 S0 W( K/ n7 w; p
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( F( `* u3 S6 p( D
2 ~6 k* X. z/ e/ ~) ~1 WNote as well that you can easily detect this method with SoftICE:6 @# g+ \! U9 ]+ [; K1 n
   bpx Get_DDB if ax==0202 || ax==7a5fh
2 S- R! S$ R6 g6 a9 p4 @0 Q3 L) i+ C# q
__________________________________________________________________________' n5 e. ~: u- ?

4 W. K) i+ G* f$ Z* O* ^Method 10
. d$ f7 P# ]7 ~" ?=========
) `. ]0 r7 X0 `9 s
+ f0 ^, a1 }4 D% F=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- d- \" L6 O( P9 b4 @! h1 ]
  SoftICE while the option is enable!!/ {8 u. _) o: S4 s9 l

# ?" ?; d( J; _5 O& DThis trick is very efficient:
+ l8 I( g' [+ A! N  y/ q9 kby checking the Debug Registers, you can detect if SoftICE is loaded
& d: w* [9 r3 T(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* Z. E) C5 [# f1 m
there are some memory breakpoints set (dr0 to dr3) simply by reading their
6 `; c4 l2 m& B" [& W+ Yvalue (in ring0 only). Values can be manipulated and or changed as well* z* M3 C/ A7 @( _3 J
(clearing BPMs for instance)6 f8 n7 P/ l& u3 v5 M7 c4 g0 d

: `) B+ m9 \" e/ H) {! q& n__________________________________________________________________________
" Z: s* M7 r( ?/ J+ B/ \
# G: ?0 u2 m7 d/ V6 C+ YMethod 11' c9 G  {6 J3 n9 Z* @' N5 F
=========
/ T! J3 b7 `6 q" i7 [) H/ \  R3 g4 g
! y5 ^+ U% N+ ~: r5 B5 m; ~* [This method is most known as 'MeltICE' because it has been freely distributed$ F( Y$ z- o& |. ~0 ~" F8 w
via www.winfiles.com. However it was first used by NuMega people to allow# u, k1 U) w2 E; `0 }
Symbol Loader to check if SoftICE was active or not (the code is located2 u+ w# h1 d; ~. B) J! i
inside nmtrans.dll).; l/ ~" `! W' p. v
- u" X% O& i6 u5 O0 a+ q' f
The way it works is very simple:# o5 t# ~7 v0 u7 Y% L& r, z
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* x, P# t9 B- ZWinNT) with the CreateFileA API.
' d; \+ C6 g' A. k$ ~; |+ m1 b. H* S+ p# A$ L: S3 C4 U3 F
Here is a sample (checking for 'SICE'):' g6 J) z3 O8 ?! S. i
# H5 [* o0 g; y9 f  ~# \
BOOL IsSoftIce95Loaded()
! @" X" }3 [" q{
8 B! Z) @# V" o  e( R9 n7 T   HANDLE hFile;  
' o6 d! M( s$ l$ Y   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  r( Q8 F, i( ?# @( L
                      FILE_SHARE_READ | FILE_SHARE_WRITE,# d1 i$ g( ]) J
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( ~2 L7 O4 x- l$ B/ E9 v   if( hFile != INVALID_HANDLE_VALUE )
$ @+ K( |1 |! U: G( R   {+ ~7 i. u2 ?0 y- g
      CloseHandle(hFile);+ J" ]$ T  |4 X& g& [6 S7 b; M: B
      return TRUE;9 u& b% N. W4 g; x, u
   }
) ]3 t% Y0 t% W8 J6 l   return FALSE;% G% W% v+ T; {2 z4 J( i
}9 D# r/ I6 Y0 t: }, X2 g

: T; G' X" P* d* T+ c4 K0 t9 gAlthough this trick calls the CreateFileA function, don't even expect to be1 K2 W/ X/ y! `# e/ i& N  Y
able to intercept it by installing a IFS hook: it will not work, no way!
1 G( d* o" _, r' K* s5 IIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
  U" \" ^2 _) W1 g' fservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 r/ j/ y& F  d# w3 r
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
8 ?# y/ K" J* d" G+ F9 q; p! ?: `/ K3 Efield.
& X. ?/ Y" ~0 [' q0 @' dIn fact, its purpose is not to load/unload VxDs but only to send a
% f$ K6 J% ]/ [5 Y( ^' |: qW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); o. Q1 V  z9 P/ r5 G, Q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 x+ D5 M1 m3 ~' C/ m
to load/unload a non-dynamically loadable driver such as SoftICE ;-).0 W* i+ m3 c: j6 n8 r+ C9 q. d% y
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 q" o$ M" M8 w
its handle to be opened and then, will be detected.
+ G; X6 @8 F# [2 k2 S/ \& K% o  y1 D, @You can check that simply by hooking Winice.exe control proc entry point+ H2 l1 X, _. |6 C  D
while running MeltICE.
% C( X% z5 W3 Y/ I) u! _7 g9 }7 F: v, n4 L6 W

' X% e6 t& s" i; U2 V. J9 a  00401067:  push      00402025    ; \\.\SICE0 c) Q6 X! Y( Z# K
  0040106C:  call      CreateFileA
* c; Q2 Y+ {% J. k  00401071:  cmp       eax,-001
) A$ v0 i% x7 v) c3 L1 p  00401074:  je        00401091/ {, [$ ]: e( ]; {8 e
* j: a' b/ S" D

' ^9 S/ a6 k  V+ HThere could be hundreds of BPX you could use to detect this trick.
/ H9 N7 V$ v) h-The most classical one is:8 K7 A- f! J; w. i& Q& l+ i
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ k6 }  i0 U3 S# ?5 S& g# B
    *(esp-&gt;4+4)=='NTIC'
  s' Z8 X* q% P  |: N# X4 J+ e- {3 q3 E, ^8 x6 K1 d
-The most exotic ones (could be very slooooow :-(0 \; d& e2 U) D8 `* l! O# H5 i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 Y3 _5 V) T; H5 M' E& b$ j( i$ m
     ;will break 3 times :-(* c; n5 w8 g  W) l8 `+ C% |

: J  _* N/ b& P% I$ E-or (a bit) faster: ) U- s% W: F9 j2 N/ G8 w4 J
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 g' b; q' s# N" W3 U. ~( Z

+ F) f' C* W6 b' p* U   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! e. t: t  x- o1 a     ;will break 3 times :-(; L4 A0 o) `  }9 e# C

- Y9 w6 I7 s# e$ c- P. U8 }-Much faster:7 g# ~! ^6 R$ N: M# @6 [6 f
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( K, f  Z, x& ~( F  B

: N9 p- p8 t, H) ~Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
& k# {4 y  v$ q& h# f7 Wfunction to do the same job:
# b2 R: n' y9 `* P7 l  Z$ G1 U; O3 S, Y% a0 P
   push    00                        ; OF_READ' E( _4 M) |2 ~( }+ p5 C! w
   mov     eax,[00656634]            ; '\\.\SICE',00 f% C3 p0 ^! z2 n$ X$ L) a) j
   push    eax
$ t2 s4 S& F0 g- R   call    KERNEL32!_lopen
7 l7 K3 b# l% p1 W) k' D8 g* _   inc     eax' m) J1 [7 J# _
   jnz     00650589                  ; detected
- G3 g/ ]$ g5 V1 W9 r' Q( N   push    00                        ; OF_READ4 Z9 t' y. Z' G- I
   mov     eax,[00656638]            ; '\\.\SICE'
; h4 h% A# i8 N) W5 {* x4 B9 R   push    eax
( z$ N! Y& T6 M5 ~   call    KERNEL32!_lopen0 G8 O# x8 l4 l: w: ^8 q
   inc     eax* k9 y3 y1 e2 j; C1 X, t
   jz      006505ae                  ; not detected
; z" C9 ?+ i' Y) Y5 k) K. O, w4 v+ M) r% G* c( L

  h& ?' }' z6 }% C& i__________________________________________________________________________% Q2 w. R7 f9 E* I
9 `9 E% ~/ U- B  P7 c8 x& _
Method 12/ c( m' y# t% T
=========
7 v7 ?& V( u2 F* h8 U4 x% \2 |7 j, K5 E) f5 p' F* F: O
This trick is similar to int41h/4fh Debugger installation check (code 05$ J# ]+ p" }" O& s, d
&amp; 06) but very limited because it's only available for Win95/98 (not NT)) v0 N( N7 w$ D* b
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- @1 H: |( ?' u) y4 n' L! F! s, A( o  S  W( z
   push  0000004fh         ; function 4fh! J0 ]9 i6 `* |( s: D4 q
   push  002a002ah         ; high word specifies which VxD (VWIN32)  ^& A# c- u" O
                           ; low word specifies which service* b2 u* a  A3 c) _  s
                             (VWIN32_Int41Dispatch)1 f5 ?! V1 Q. e8 Y: W3 D6 k. M
   call  Kernel32!ORD_001  ; VxdCall
6 p  k3 ^7 X. T7 P7 z- o   cmp   ax, 0f386h        ; magic number returned by system debuggers2 k$ |5 N) [% q; g
   jz    SoftICE_detected5 Q% `, @  s0 D6 {
5 c; t6 O0 h2 h; o. F7 m/ w
Here again, several ways to detect it:
. {$ H( P. R1 A2 z
( s( J8 Q) d9 V8 t3 m$ d    BPINT 41 if ax==4f
- v- P  @+ L8 x) b" x: ~
% y' [( b4 P# Y% _1 O/ Y+ a+ x) U    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  {1 J- H: Q  {5 E( s) E9 [" v' H. t* F$ x3 v( Q+ b
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! Q8 F+ R( v* \; _, ]1 Z+ `$ h
3 }5 P0 C9 h+ M: Z! i+ e/ R5 Q+ a    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
8 v2 S$ M. t7 n6 x6 G, e
. O' e& P2 Z! F8 @__________________________________________________________________________
0 Z+ v# Z& A  O: `( I; Q& r$ N* A4 ?2 b! a2 h( ~$ M" [
Method 13
$ ?3 l1 u6 S. c* U  C+ i6 p=========
& H$ v! y" z, |( u- m! q- i! C2 b( K( M7 s* e" Q2 ], K" _
Not a real method of detection, but a good way to know if SoftICE is" t6 r2 ?  ]+ t4 M3 o
installed on a computer and to locate its installation directory.
, j( I8 _& ]* t- D+ o- s# K( ]3 }$ AIt is used by few softs which access the following registry keys (usually #2) :1 C) X( G& w' j3 U8 E9 f: M
9 e3 \% q  b! X) X9 F
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; M$ m4 ^( F" {( r\Uninstall\SoftICE% D. w( B4 `) O3 P, ?
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* \2 ^3 ]! X# P3 q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, n( l8 u8 P3 h. B& ?\App Paths\Loader32.Exe
9 K% B  x+ _$ T4 p- W
  m: o- \" x& T% q! y. W# W2 E* P% \" D2 q! S
Note that some nasty apps could then erase all files from SoftICE directory- {8 z% e* w+ x2 n) j5 d; m. p
(I faced that once :-(( P  N0 w8 E2 `. }! x; N) J9 S

  I, E- Q# c6 I1 J  uUseful breakpoint to detect it:
! m. F* I5 d: f, m& s% n# n! }7 s6 u! _3 e6 g
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
% a* I- c" j. @* Y5 u: O" P  M' E: k8 o' L
__________________________________________________________________________( \3 x* D% W: R) k% n0 `

0 v* |4 f& N+ h4 k1 O8 J5 }% I/ q% q
Method 14
2 \8 s  N. O8 r. \7 l. ]$ E' ^=========
2 M3 q1 Y% ?0 T1 Q0 N5 p9 p; ^
, q. s) k' v+ m8 VA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% ~2 E$ ?4 H5 r0 ~
is to determines whether a debugger is running on your system (ring0 only).
" E  I, M( I& J8 N, i  y- \& h9 n: v1 n) ]
   VMMCall Test_Debug_Installed3 d5 G9 e; G; k. ]# _3 h4 f
   je      not_installed) f% O; Q! }2 n& L, |
" G! h+ {4 X" {' D) W
This service just checks a flag.9 ^. U3 v6 r$ d7 \! H, _( Z, _
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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