About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; V1 R6 z& o. D<TBODY>
- @$ ~7 p; k9 K5 K$ a6 `5 H0 E0 C<TR>" M% z! Z) M. v- T
<TD><PRE>Method 01
" z/ D/ |. w2 A+ w" X% N=========( j: T; Z9 ^4 t9 F4 J
1 w8 C' m' [% K
This method of detection of SoftICE (as well as the following one) is
% d5 g6 E! z+ U/ vused by the majority of packers/encryptors found on Internet.( c4 M+ _8 i& F, P, r/ p
It seeks the signature of BoundsChecker in SoftICE0 X" ?# S* D6 z$ i7 c1 T
$ v$ P; m: n7 m  m, G
    mov     ebp, 04243484Bh        ; 'BCHK'
5 H# R1 o2 G6 f  ~1 F8 a8 [    mov     ax, 04h
; V) m4 I2 ?3 I0 l+ o. Y5 w; Y    int     3       % Q' ]1 F2 G# }. k0 v' p4 b
    cmp     al,4
  p! g. z: t2 y+ @7 \1 L( a% I    jnz     SoftICE_Detected6 F4 }' I4 ?- y; L
0 v' h6 h5 r1 o8 y. R
___________________________________________________________________________
3 Z7 A7 j8 q& Q% s3 Q5 |
6 M9 S% P( d2 n" KMethod 02
+ N2 h. P7 q: w6 L: K9 Z' s8 x  H" Q=========
& _2 G  Z' I0 H$ `! Y! P' S" s: y% c, G* p
Still a method very much used (perhaps the most frequent one).  It is used' l; Q6 E2 a) X. B* R8 ^: l+ {1 ]
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
9 u" d& Y/ {! t1 x* ~/ J) Nor execute SoftICE commands...
/ d4 N& I& Q; Y/ X: pIt is also used to crash SoftICE and to force it to execute any commands
0 r3 x( Y% V8 Q* Z$ h(HBOOT...) :-((  ! o6 Q% Q$ \. I6 g! ~2 M3 C

5 e" v4 }! B/ ]6 ~# nHere is a quick description:$ c+ S+ }' i5 ~7 j7 P- K& ?9 Y
-AX = 0910h   (Display string in SIce windows)- {3 y* C+ |- \) n2 p7 T7 D
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( O3 S7 T1 v3 ^' n9 _0 {-AX = 0912h   (Get breakpoint infos)
$ Y  S7 i/ z6 F5 ]$ i- U-AX = 0913h   (Set Sice breakpoints)
- q! [5 D- K% @* X. M& `-AX = 0914h   (Remove SIce breakoints)& d+ |$ x) {8 a7 ]6 S5 N, j
: t2 V4 _/ I$ e4 h5 I
Each time you'll meet this trick, you'll see:
" B/ Z) t- F( h5 K" A& u3 B-SI = 4647h
2 _! [( c. W6 z3 j9 m% d/ ]7 E+ V-DI = 4A4Dh
4 T+ Z) H+ d1 x& KWhich are the 'magic values' used by SoftIce.' P# Z+ r4 d$ f8 r6 ~) `; \
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
3 l  n8 [8 e1 }3 M3 {* i( h+ v* p$ @4 ]# _5 k5 t% V8 m
Here is one example from the file "Haspinst.exe" which is the dongle HASP
  o( j' |% [( J8 Y) {, }, IEnvelope utility use to protect DOS applications:
. j+ d+ D1 w. E) b& j4 l/ `
4 i3 `% U* J) F! L$ N6 {! Z# j& S0 D! c3 N+ R4 z* D2 S7 C
4C19:0095   MOV    AX,0911  ; execute command.
9 J8 A, }2 v8 ?4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 y6 G) t* w8 T  Q, {4C19:009A   MOV    SI,4647  ; 1st magic value." R" d/ k" F3 Z/ k9 }
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: u" P  N, j4 _2 @! m0 r
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
4 q" K9 l! a; d7 X! b4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 |* D3 l# @  I8 f  X3 ~4C19:00A4   INC    CX
; m- M6 x8 j4 E: j8 P5 Q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 a0 N! l% T3 M; s' h; d4C19:00A8   JB     0095     ; 6 different commands.
# G, X! R9 t9 O9 l4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ e- a! T: [4 T; s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); Z9 y; W( q: i  l+ v: u
8 A5 t7 Y! p% q  |* S
The program will execute 6 different SIce commands located at ds:dx, which: E8 Y( S5 q# T
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 M9 M% J& X: H8 \* a
- F; B* F/ U  ~  R* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; x- i5 A% J& o___________________________________________________________________________
& }7 O8 c1 {* K7 u, K. s6 ?! A3 c) k5 t4 X: A: `

* h/ w7 M  E6 _) Q5 F! eMethod 03
. `4 }' O  L9 k2 ], Y: G9 t=========
' ]" O) N/ C9 F# `8 k, V* g: x
! J: }, H& b4 T7 K; ?# \  WLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 O" E) k( Z, q% M% n" u
(API Get entry point)
2 V7 j2 ]5 K. I& _  e1 E8 S        , |. d- `' G. m
$ t; W; z* a  f/ w
    xor     di,di. q! Y- c: n  X2 \$ C0 s+ `
    mov     es,di
( y  V' K* G) {, t    mov     ax, 1684h      
: G- D: |! s$ Y: H) r5 F+ H. Q! R    mov     bx, 0202h       ; VxD ID of winice
) S* }- c, M4 @/ s2 I: P4 c, t: Z    int     2Fh! S  u2 \0 N0 {$ A' x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% E7 K: C6 U  b$ }9 }    add     ax, di
, l( {/ Y+ T$ W8 w% E/ ~4 I    test    ax,ax
/ o' W1 I4 s$ `9 }% }2 m7 `% i    jnz     SoftICE_Detected4 [. z% }% ^: [' h3 D( o, L
3 V$ X: R7 a& B6 j. @$ q
___________________________________________________________________________' }% m  G' Q: d* y- n
: }" Y  k# e" e+ u+ {/ N5 _7 c) P( ?
Method 04
6 A% a1 C( f) j) l! h=========; @$ A! ^) k' B& q* e
9 H7 s6 y  W/ ~5 x2 ?; R
Method identical to the preceding one except that it seeks the ID of SoftICE
# p3 V5 p. r, i+ SGFX VxD.
" U' [3 g3 o4 z& f! Z$ H- L: \! d9 M* f
    xor     di,di* G4 m' r% ]" f! U4 O
    mov     es,di% L5 u! F1 J$ `: F' G
    mov     ax, 1684h       % Y8 L( S* y$ j, o
    mov     bx, 7a5Fh       ; VxD ID of SIWVID' U( v1 I7 v/ A& n
    int     2fh6 {4 q( U5 X5 h: }: G7 y  u0 I4 a) [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; w5 }/ q6 k% ]/ W
    add     ax, di1 K' u) ~7 `' Q3 s5 X/ C
    test    ax,ax
  z6 S$ w- a. Q; G# I    jnz     SoftICE_Detected
5 G3 o& l; H) H0 l/ z/ o$ B1 y  r+ \& W; U1 l( e2 K! I) Q
__________________________________________________________________________  Y  N6 y" T  m- G# k

& j# C/ Z# H2 p2 V
2 \0 k$ {. \: _, g3 v4 t$ k7 l! EMethod 05
+ e  ^8 L9 V. _+ B. ^=========/ R7 M$ W* |3 o! f0 j& o

7 c0 C$ b4 [0 b" _" D4 a/ jMethod seeking the 'magic number' 0F386h returned (in ax) by all system# F6 G7 o( C+ G# j$ g4 x9 J" X4 ^
debugger. It calls the int 41h, function 4Fh.8 `; q9 e! _5 Z: a  ^" h4 M
There are several alternatives.  " `9 z6 L7 r: B7 m: L
2 C  j) c/ U9 S* \! O8 _
The following one is the simplest:3 S6 ?) H8 m5 G. H/ x  K

) x5 e; ?9 }3 t  R7 ?    mov     ax,4fh0 F: t( f% H' Y( o
    int     41h! `" T. y* }  R# S
    cmp     ax, 0F386
9 @+ A7 ?* z6 t    jz      SoftICE_detected
. x4 B4 C- j4 h
: T2 i0 B% E$ n! A" ]7 T/ g2 ?+ S3 |8 z+ H. D" K: N. e! {
Next method as well as the following one are 2 examples from Stone's
; e- L4 N! m. l) v- P1 w. o"stn-wid.zip" (www.cracking.net):
( I0 T- h0 v7 O  M8 H1 l$ Y4 `1 R1 e1 F# F- E$ M1 y% f% }2 s
    mov     bx, cs
7 g8 S; e' Y5 }( A5 ?    lea     dx, int41handler2. t4 M8 e! r2 ^# E1 s
    xchg    dx, es:[41h*4]9 j: H/ W7 R' M/ P$ J
    xchg    bx, es:[41h*4+2]& n, E; p1 @! z  J8 Y, W
    mov     ax,4fh( a6 E( W$ n0 P3 j
    int     41h( C8 _. P- E2 N
    xchg    dx, es:[41h*4]
1 D& e5 \% k! R    xchg    bx, es:[41h*4+2]
% m% i8 S- S" Q  d9 s5 D2 `. S1 b) [% L    cmp     ax, 0f386h
3 D7 \% K' E# a    jz      SoftICE_detected
, z# h8 e# l$ K5 y
6 T8 o4 ?8 y3 w' t: G* t* `int41handler2 PROC3 u& q( [' O4 r' a
    iret
; l; B( O8 o' a. x  ]6 xint41handler2 ENDP! i0 F5 D) K+ t+ w4 r7 P- o, t) S& W
3 M$ W5 w' x: J( M: d; }
5 F9 ~" w6 d3 {+ g+ b
_________________________________________________________________________1 p' _7 U! f- M7 I4 Y. o  U
+ J# J. A+ ]* L# v' z
8 m; H  e! H" M( H
Method 06/ A4 D8 `3 r3 b: g6 P
=========
0 O% g5 ]* q1 ~' w0 v* b
- E+ f+ Y  l) N- E: Z% U; z* ?. |6 X( Z8 y; O9 r
2nd method similar to the preceding one but more difficult to detect:9 n# N2 K" W  m( q- L/ C! Q  y5 h

* p; k1 i$ U! R$ C9 ]
0 [. m" V- a: S0 X3 Y( Aint41handler PROC$ R. U  H* e9 i" }- Y9 _% o
    mov     cl,al
0 R1 N; a5 K! j! ]7 |    iret* M# o, X" A" Q
int41handler ENDP
" m- t0 |( f; n. k* F4 e) S6 k/ z9 Y
+ j5 h' P& h5 M: i
    xor     ax,ax* D0 `/ l' r- z
    mov     es,ax) ?# H( M, D$ L. o# f' ?# n% B  e
    mov     bx, cs
* d$ g: M% Q" P8 n) l" G  H    lea     dx, int41handler
2 R$ _$ C% \* E9 D: J& N( O7 ?    xchg    dx, es:[41h*4]7 D, W8 [3 G( A! `* F
    xchg    bx, es:[41h*4+2]
1 h! Z% |8 o+ \. u* A    in      al, 40h
/ t8 P, ?6 x. H. ^) z% Y    xor     cx,cx" ^; Y! W- s- @' r2 i: G9 q# h5 p1 x
    int     41h7 |& F4 l0 F7 h! ^1 b* n) d: R; j* D
    xchg    dx, es:[41h*4], M. E+ x. L: N6 G
    xchg    bx, es:[41h*4+2]
( x7 U0 ~2 U9 r8 ?. A    cmp     cl,al
& o6 l/ I+ G, S$ f% _  j    jnz     SoftICE_detected
2 A1 q8 `" E' P! }( o) h% R- m" X; {* L: y: k2 u. G
_________________________________________________________________________
5 T" ~2 B* w% I) ]. @+ g& d* G% w& m
Method 07
& V9 s. W( Z: g9 L9 ?! p=========
3 m5 o+ e& I. Y  t
4 M5 N8 X; `# Y. l- ]Method of detection of the WinICE handler in the int68h (V86); M1 ]7 A. }* ]
4 n& v; y4 ?/ L+ M: h
    mov     ah,43h% E0 G" i3 D' }  J
    int     68h, w4 G& ~" G( F4 I
    cmp     ax,0F386h, ?1 S8 n4 s: n, y# L
    jz      SoftICE_Detected0 D* A1 R) i" d+ M/ |, q. h. O, ~

1 H' a! U" \0 i* u- T: }0 A# W" u
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' _; M8 s1 n9 A, d+ P6 e& _$ V- U3 B
   app like this:
( x/ U8 s. b5 [# |+ ]6 ~! v2 j
8 C. a* g* J  w! K( f9 Z. N; p   BPX exec_int if ax==68- ?2 _& s0 _2 w+ C
   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 }& ^0 J; t& @/ F. v$ p8 e   located at [ebp+48h] for 32Bit apps)
  R  f$ \2 I6 t* h6 q% F* v: ]( M__________________________________________________________________________9 P6 s! v% h' i' k3 D5 Q
# F/ Y' p( x3 O6 x! z9 r+ P
' N* c0 N! o* B6 E8 g
Method 08
2 H6 p1 [9 {: x$ e=========
7 u! V  s/ v3 s# e! ]( U2 n# D: X/ J* e4 y* J
It is not a method of detection of SoftICE but a possibility to crash the; }8 e* d" _- A1 |6 P4 J5 [1 E' T
system by intercepting int 01h and int 03h and redirecting them to another/ I/ {4 c  D1 B! |! F* L
routine.# G' s( y% C$ r3 `
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  u2 A6 R8 E  W: z# Fto the new routine to execute (hangs computer...)7 H4 ]+ h. C- W2 ~. {; f, G

$ ?' l2 i8 o- p# g2 j2 n! [    mov     ah, 25h1 \4 j# H4 ~8 g! l" L/ u
    mov     al, Int_Number (01h or 03h)" x7 v$ \: }+ y( T1 ^' z
    mov     dx, offset New_Int_Routine
. T/ ^5 h: N: S! s- t3 p8 @- {    int     21h+ ?- M* ?: T8 F

: ~( L% J5 m# R- O__________________________________________________________________________
2 V# [% A; a" H! C" u( ~7 z# y
Method 09
! T+ v8 L; t! ?0 l=========
5 R: \9 }% u' R% |8 B5 t
3 F& d! m. k+ X* pThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 M! n5 P, a- Iperformed in ring0 (VxD or a ring3 app using the VxdCall).
! W/ e! e! c8 X  Q" L. Z: `8 R2 BThe Get_DDB service is used to determine whether or not a VxD is installed) p: r) N( p- D, M. C" H3 |
for the specified device and returns a Device Description Block (in ecx) for  L+ Y" |; t/ K2 O& ]" Z* T7 S
that device if it is installed.
5 [6 S4 S4 w! f  ]& Y; I. }0 v/ r8 {$ }! v' T, K) X9 r7 ]
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 F6 }, h+ c# i7 Q) ^' g
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)9 {7 ^0 _1 I  v* z" a: @
   VMMCall Get_DDB/ [/ b& F% v' U6 d* a, R8 H4 d; s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- p* D1 x9 r2 N$ K( W/ c. ]+ _2 [1 A# r3 n6 u+ M6 c
Note as well that you can easily detect this method with SoftICE:3 W1 O& r/ ~& H! O
   bpx Get_DDB if ax==0202 || ax==7a5fh
2 e/ N4 w/ i! q% Q3 u
7 |3 ~# p1 t  v! Y& O$ w. e__________________________________________________________________________: r, n; F+ |% K3 e, H! v
1 L) [; l& P& D. ?& U  S! v
Method 10
: I- s5 t) Q1 r( u% s# {5 {=========6 w9 j2 o0 B. O  P- |: u, b9 U4 ]
2 M; ?" p3 K8 S9 }. [8 i  D3 u/ h  B
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
; O; X4 L3 r7 F8 r: l7 G; X) s  SoftICE while the option is enable!!# a2 f4 n; o/ M  y% T
* V% R7 l  _, r0 f" M1 K5 p
This trick is very efficient:
2 G  G# C& ]6 ~$ t; ^# R$ Fby checking the Debug Registers, you can detect if SoftICE is loaded' Q# p; P- ^5 u0 s) r: w
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 `2 G6 M/ D: C# c2 t' Ithere are some memory breakpoints set (dr0 to dr3) simply by reading their# v+ x+ g& ?- s: D1 N: g/ F  a7 A
value (in ring0 only). Values can be manipulated and or changed as well$ f/ f/ L" b! U! A2 E. c
(clearing BPMs for instance)3 T& u& |% V$ \1 [0 P0 u" G

# p- a0 F) B3 i& d; I8 t__________________________________________________________________________. q9 W- I) s: ], r; _6 B9 n
: C# ~  j  |  R
Method 11' X, X' K$ h6 k9 d6 j
=========+ B, B4 z/ m: M8 f" K" {$ A/ j( R
9 }: ^9 b; k8 i. `7 k  a$ R6 L6 b
This method is most known as 'MeltICE' because it has been freely distributed
  y( m' w. R5 Tvia www.winfiles.com. However it was first used by NuMega people to allow5 V: r" K- T- K6 J7 ?3 V' n3 r
Symbol Loader to check if SoftICE was active or not (the code is located5 [1 E, ~9 s% s. b/ b
inside nmtrans.dll).( ~& l) X9 U* |' y& r0 G6 j4 \

3 M/ @$ G1 F4 s- A6 {. D& b5 W) ~The way it works is very simple:
' t! G- \- m4 \7 }# p& dIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# n! T3 P& y9 H4 o  A8 h9 V* jWinNT) with the CreateFileA API.+ a0 s, g" z( E/ S

" S, f% I, R! Z3 M- AHere is a sample (checking for 'SICE'):6 m7 h: W- {& Q2 y3 y' H

0 H! Z! d' r8 }# Q" m! N8 I& hBOOL IsSoftIce95Loaded()# f) B! c9 f$ a1 ]+ m) [: v
{
) I$ o3 d$ Q0 v7 h3 \' K9 c) a8 `2 T$ n   HANDLE hFile;  3 P/ W4 r" |9 j* v1 A! B: A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' ?# j/ t. X% l7 i0 j- H- Q                      FILE_SHARE_READ | FILE_SHARE_WRITE,- p0 A6 t; d. U$ V7 B
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; w% C3 E2 k$ u* K+ K   if( hFile != INVALID_HANDLE_VALUE )
" X4 ^$ `( u; J, y   {. m, _- U3 Z  I3 q6 F, d
      CloseHandle(hFile);5 i% \8 ~: f% z2 o
      return TRUE;
; F* w9 C1 E& }, |/ `+ S0 Q) _" Z; ]   }$ ], J  h2 I% M+ T& K- v0 c5 h
   return FALSE;5 A5 i4 A" R  C/ S5 S1 j5 v
}
$ ~! r/ N' [9 j) P  q$ D  {2 f" ~& O" D2 q0 g' U
Although this trick calls the CreateFileA function, don't even expect to be, q/ E' u- h9 N* T' _4 Q# }/ y
able to intercept it by installing a IFS hook: it will not work, no way!
8 L8 v6 [2 Y% O6 J* ~9 I0 i# wIn fact, after the call to CreateFileA it will get through VWIN32 0x001F/ @  `. r' e+ b: Z) D
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% J# J1 |2 Z6 J7 L" b. `
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
' O6 k- Q% W' w( Wfield.
4 ?* K  n' i* [7 S5 M/ jIn fact, its purpose is not to load/unload VxDs but only to send a 3 A6 U- v: g! s; [3 \
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
" ]1 \% l% M6 J9 Eto the VxD Control_Dispatch proc (how the hell a shareware soft could try
, t3 ?5 b# O( G8 i+ T& ^to load/unload a non-dynamically loadable driver such as SoftICE ;-).& i! H7 u2 v+ i( N/ n! }
If the VxD is loaded, it will always clear eax and the Carry flag to allow
$ _4 R/ B8 |! y& Jits handle to be opened and then, will be detected.7 b0 R4 c4 u/ _+ h# z6 e
You can check that simply by hooking Winice.exe control proc entry point
" ^& a8 T; W6 Bwhile running MeltICE.5 a( t/ a$ f3 S7 l

* y% |( t0 J2 N" |# ?9 r( \2 c+ W# G3 D6 {) Z; c
  00401067:  push      00402025    ; \\.\SICE/ v+ \) ^4 Z/ x3 L) n% q) F
  0040106C:  call      CreateFileA' a8 H- L: b6 j' G
  00401071:  cmp       eax,-001
3 S& x* e% B6 d4 k7 H, Q  00401074:  je        00401091( }  p& z7 L, Y* B6 E1 K/ t9 P

0 w1 M  u' Q1 Y6 U; S$ K
; l4 y1 Y- B' ]8 v5 m, rThere could be hundreds of BPX you could use to detect this trick., H: z& g+ `% c
-The most classical one is:$ r( @% p: j- M: x+ d
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ f4 K3 i. S0 K3 E3 O2 z8 z  t    *(esp-&gt;4+4)=='NTIC'0 C; }& q+ R9 N, |2 K$ P

+ J: H- t, L7 `, |-The most exotic ones (could be very slooooow :-(1 [2 H; V& Q- y" i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
2 B4 x- u* s7 Z, o/ q) f5 V- @     ;will break 3 times :-(
- D8 ^. ]! l9 I( N$ F- t* Y3 I  G8 H; {! d2 {: N5 o
-or (a bit) faster: 2 h* z' {$ k5 e9 @
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& y! c4 P4 @  Y' b7 a
0 L  _( f5 h  C( g, d  x
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  - O6 G  U8 |7 @6 ]6 A/ D* T
     ;will break 3 times :-(
3 d( j! K- {. r- Z, [! q1 v& \& n. A/ j$ I
-Much faster:! r0 H7 S: t9 {
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ Y3 }9 q* h2 o+ h/ l& l( W/ S. L& B$ C5 I5 ]- ?2 b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen) ^7 ]- A" C2 ^- F6 U
function to do the same job:
+ ~2 P) [- ^" z1 D3 F4 A
1 \  D6 ^' R- p   push    00                        ; OF_READ
5 U, c2 y! H# L# ]6 T' K   mov     eax,[00656634]            ; '\\.\SICE',0
% |1 O. g, Y$ R3 C& L0 U+ i   push    eax
8 f2 K4 ]: U! K- U5 e- j   call    KERNEL32!_lopen
5 q5 N# R; [3 I' r) b: e  Y   inc     eax5 t' ]# S6 U7 R& b
   jnz     00650589                  ; detected
# o, y$ D5 t! Z9 D4 m   push    00                        ; OF_READ
! A8 r0 b) j  d- u   mov     eax,[00656638]            ; '\\.\SICE'$ v5 |7 f- Q9 U4 v7 R+ x
   push    eax+ r' _5 u5 k& b8 H2 s) P
   call    KERNEL32!_lopen
# o& m8 h$ I0 b- {   inc     eax
2 s: [5 Y3 {' L' l. E8 `   jz      006505ae                  ; not detected6 `( ^0 X% \1 Q) r) L
0 @  w; C9 }3 y. G5 |2 f4 w

8 L! ?1 K9 e, e* `4 I* _/ F( B3 ___________________________________________________________________________: d7 c' r. G2 e1 s6 ?

+ }. A( {: o# mMethod 12
) q6 R) ^% e9 Y6 I* H/ @5 p1 d7 ~=========# m0 g# K7 P! t. q
6 z( h7 d! [8 g3 V$ l+ a8 J; ]; p4 C
This trick is similar to int41h/4fh Debugger installation check (code 058 ], v4 e3 h  l, W" U& U
&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ j' |9 v9 Y+ ^9 u) }" l+ M
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* u# b- m2 W* t3 ]) F
! Z8 N# s* y$ i   push  0000004fh         ; function 4fh
7 J0 I2 ~4 n" R# r8 N+ d* n   push  002a002ah         ; high word specifies which VxD (VWIN32)! q5 v9 S' M+ E
                           ; low word specifies which service; c( A! P# f8 D- \
                             (VWIN32_Int41Dispatch)
1 G+ U6 W/ G' }   call  Kernel32!ORD_001  ; VxdCall
) d0 E  N9 W5 I: q0 z2 Q   cmp   ax, 0f386h        ; magic number returned by system debuggers8 O$ T  n! f4 O# o2 q
   jz    SoftICE_detected5 `$ T$ Q: U6 ^7 I; s4 s

/ ?8 v, s. |: ]; a* {1 o4 S9 f& zHere again, several ways to detect it:
5 W4 [$ w: h; C4 I6 S4 t& x* D' n+ A7 H  z9 p
    BPINT 41 if ax==4f
. e3 q/ G6 g9 n$ {% P' p4 T
' G6 B; x+ d% X% D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ M/ [6 a9 d1 I* h5 J& u" v
2 u- s$ X6 U& w$ P. |
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# O0 {4 a; c) Q

; s4 A2 {7 q$ j9 X! F, l# b    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. p" t2 c  Z/ w5 T
& d4 h( b  n  N" R__________________________________________________________________________
5 S1 ~. ?- w. V- F& h. G
1 y3 @. _7 i  c4 Z; r) H! O8 [+ }Method 136 D. F" R' {5 g  t! f, q0 m! y
=========
& f+ L4 c4 P/ o3 f! E2 }! d" ^# w% |* |4 J
Not a real method of detection, but a good way to know if SoftICE is5 I  s$ l+ p: n9 ?; D5 M" n8 T; [
installed on a computer and to locate its installation directory.; w( t3 y  j5 b2 [6 @* ]3 `" @
It is used by few softs which access the following registry keys (usually #2) :: Z& L( A; N" U  W

- P( j3 ~% o0 ~$ {! q" n4 }-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# h. i5 D: ~  p9 s\Uninstall\SoftICE# ?3 `; K' [6 p8 |5 ?
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- P7 w1 e) X, A4 N# E
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 H2 b* {, [/ o/ v
\App Paths\Loader32.Exe* v0 x1 U; O2 L4 Q

: J  y) f7 h' ?6 ^3 A" S) {& d, ]! @0 E9 n7 B
Note that some nasty apps could then erase all files from SoftICE directory- E# V6 a! b# S
(I faced that once :-(# k/ m' N4 E1 T8 P
+ F8 O# ]. |5 w; @0 R% ^
Useful breakpoint to detect it:6 e+ |% _# E6 O7 X- c
- M! \6 Y, _) ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'( y7 q# T: o7 S' B1 Q

$ R& O6 d. Q. o. @% f6 P+ A; x! ^__________________________________________________________________________! |& U. Q! F% B3 S  V$ f4 X: K
1 I2 c9 j, ~* M* ?, N

9 H" x0 c; T+ _3 Z' N4 O! u# bMethod 14
% @' L- o9 H4 V4 a  D, ~4 ~0 H=========
& I: h! e4 {" Q4 W$ q$ K) [# ~# \% i: `+ |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 c' p5 g' f: B/ i( O# U& W- Gis to determines whether a debugger is running on your system (ring0 only).  m4 d$ @5 R, I, o* V

4 z1 ^5 z0 J/ ?9 c   VMMCall Test_Debug_Installed. ?6 @4 a) z3 o: |' ]
   je      not_installed5 @6 k( g7 o8 B# S4 V$ B0 @

, |" B: A* I9 b7 m  K9 iThis service just checks a flag.
( S/ K1 W+ Z( s, n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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