About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 H' {$ j2 H; ]0 M4 Q7 ]% e
<TBODY>, n) s5 u- K+ Q  C
<TR>+ t1 Y2 ]$ y. l( J- c
<TD><PRE>Method 01
# f2 ~: F: T; U9 V3 g=========+ |$ v6 J- C9 ?8 h2 d- k7 h' m
4 a. M+ x, D0 [, O2 s, G" ~- R
This method of detection of SoftICE (as well as the following one) is
; R, P' \5 W* G. G; Rused by the majority of packers/encryptors found on Internet.
+ d: ], @: i7 R% QIt seeks the signature of BoundsChecker in SoftICE$ s. h' L1 T, _. r, r# l

1 x" Y. l. \9 j8 t5 |    mov     ebp, 04243484Bh        ; 'BCHK'9 r$ V! F5 W9 @( x& r
    mov     ax, 04h
, D2 k2 d4 m/ J! D' r: D    int     3       - T% x% W0 g4 U% x) u
    cmp     al,4" j3 O: ]9 j( w6 q9 g7 @
    jnz     SoftICE_Detected
! n3 N4 X) S5 a8 i: B; n8 z# I; j( K1 N: X4 B* P, R' h
___________________________________________________________________________, W, q# t7 k2 {0 g8 a: p" e  A
5 p$ j$ p3 a. N: M
Method 02+ `8 q) C/ [4 v( q  m1 R* B( }
=========
+ t% E8 |7 h. @
; e/ p+ l! N7 A( oStill a method very much used (perhaps the most frequent one).  It is used1 V* A/ [: w2 f7 Q# s/ |3 |( }
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: f) e# }8 ]* }) ~" E; v& cor execute SoftICE commands...
) T* O8 b  J' i  R( GIt is also used to crash SoftICE and to force it to execute any commands
0 U* ~4 f% ]0 k. O(HBOOT...) :-((  ! _# T" M. Y0 d, r  b( B# K

+ i; i3 L4 i: ]Here is a quick description:
% V; S' a) I) K7 i" b& a9 h2 E) @  q-AX = 0910h   (Display string in SIce windows)/ q8 O1 o0 V& w5 N. i, P
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& R& y6 Z( Y0 A( j9 D3 F* P3 d
-AX = 0912h   (Get breakpoint infos)
, ?+ k6 t+ \4 i9 }2 ], d* n-AX = 0913h   (Set Sice breakpoints)4 H! f3 h8 A+ |& `
-AX = 0914h   (Remove SIce breakoints)
" E) }, e* p  o6 y3 w4 D5 k; r* y( e/ z
Each time you'll meet this trick, you'll see:
! v' r9 _' z. a: y0 ~5 g0 [" m-SI = 4647h
% i, b% M" o, A5 {8 s: d-DI = 4A4Dh, V- e3 _4 U0 Y1 x. G
Which are the 'magic values' used by SoftIce.6 ~7 V3 H, H0 l8 |: S' W* [
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 k5 v! |4 c  U1 O' O+ D0 r( U* @
5 W3 A" l$ P8 C5 _# y! Q. f0 u5 H1 `Here is one example from the file "Haspinst.exe" which is the dongle HASP
  q  e5 N4 ~0 f0 X; `$ u. M7 z0 ]Envelope utility use to protect DOS applications:; H* z( f( N1 Y. ~% U% ~$ T

/ f' y; r2 O# ]4 c: t& l
, j5 F* E; E% z9 k) Y6 Q& F0 q4C19:0095   MOV    AX,0911  ; execute command.0 I7 V  x# z* W: u9 Y4 H1 \
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 z- Z: B4 x3 i4C19:009A   MOV    SI,4647  ; 1st magic value.( h; P: \# y% K
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: U% @) s) o: O0 ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
# H" t" `7 C% m  E5 o4 Z- a4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 ]1 T+ Q. r) W2 Q4C19:00A4   INC    CX
9 `! a( K; ]8 Q" p4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 I- ~6 M+ O7 Z' P3 g$ P4C19:00A8   JB     0095     ; 6 different commands.& o% \" E% V! G/ l8 J$ ]; p1 D
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ s! G8 G! Z# M. d  E) K, ?4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& \: x7 c  Q1 ]/ L3 P3 N) W5 K8 c6 [

' ^* B- f' z, H1 |: p$ E: X- A2 LThe program will execute 6 different SIce commands located at ds:dx, which% R1 _* f( i9 S, n$ H" y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 M6 ~; F; d) B2 a$ p; u" l
6 j  v/ h  u3 ?- F. u! N7 F* K* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.; u' [0 H' p- I4 w+ [/ Y: G3 R
___________________________________________________________________________
( n% t9 V+ ?4 r. Q$ E
! Y! g( o) \3 o/ w+ K
6 g# z8 ^, a7 R; `2 mMethod 03) r& M; E8 J. }  d
=========
# z% Q; w, I  C4 B" N% G
/ B9 N/ O7 F" T, o2 YLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, l) R+ W2 X- n: b3 q6 ?( t/ N
(API Get entry point)  s7 Q! }4 X4 X! z! u; E2 a
        + c  s$ O9 x: Q6 C$ A

+ u8 K% @0 W1 Z, K  d    xor     di,di
) r* F+ Q: m) P0 H    mov     es,di  p6 y; L' p+ }7 j/ F) q5 ^
    mov     ax, 1684h      
  ]/ d5 V& k3 E. L    mov     bx, 0202h       ; VxD ID of winice
/ d$ z9 \8 Q- v; Q2 F    int     2Fh
* }$ L7 ~3 e' b1 g7 R% g3 d' Z  C    mov     ax, es          ; ES:DI -&gt; VxD API entry point- P8 \+ ?0 ~% [) U6 M
    add     ax, di/ g  @# `- ]. b, C
    test    ax,ax! L  R; A* Z6 Q$ D2 t/ {
    jnz     SoftICE_Detected- _+ Q0 H' Y5 D6 f2 o

! K2 n3 y9 U& X% `- R1 E___________________________________________________________________________
7 c. ~8 F1 O+ i$ I6 s5 ?2 ~* k3 [5 k3 I8 u+ M
Method 04
5 X" }- Z& k8 S; p4 S! l2 b=========
1 N4 d8 w  Q1 f6 O8 J1 b8 s
! ?, I/ S* |+ D9 l* X( rMethod identical to the preceding one except that it seeks the ID of SoftICE
/ A& Y& N" n$ s: c! OGFX VxD.5 W) i4 U) ^$ ?& g, G" S

4 g& A* Y- t3 n$ l$ a- j) \9 f" S& Q    xor     di,di% B& m6 v8 G1 @4 L; x9 B+ W, M
    mov     es,di1 ?( S+ W9 i- K( g+ R
    mov     ax, 1684h       $ S& P% v" W- x& B4 n5 W- Y
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 j: ]6 |- a  k! v5 x    int     2fh- s, I* A5 `. G) d5 O. M7 |& J% A9 Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- [& k2 Z) f% u8 N1 {5 e. c) b
    add     ax, di3 \+ @/ D( s: n% F, q2 ?( ^
    test    ax,ax
7 p. o! R9 W9 k  m+ A9 x    jnz     SoftICE_Detected0 N: P4 v; g7 |7 [2 n1 ?  M7 k

1 G7 Y" b: c9 y: `2 L__________________________________________________________________________
, I" ~& _) l2 m5 S0 W" ~
- ~- \# S0 b/ i- c. B. _  P
. v3 S" i) ~$ `, _2 ~5 {Method 05
, _, j% R( u5 ^=========
1 H4 F" G/ L* g$ C8 N+ y5 H+ n; v; D8 S: g- a/ b5 D1 s0 I  o4 o
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 \( a; t4 k% C- [8 }% I/ G+ r- ]
debugger. It calls the int 41h, function 4Fh.8 d% e) L1 {: M% x
There are several alternatives.  6 a+ U9 A% I; o- ]' G+ N+ j$ }: Z
, d2 t2 |0 N- E9 [% l4 h
The following one is the simplest:
0 ?9 X9 \2 P( c! V5 T2 A( ?5 V" R+ t+ S1 M4 ~1 R9 Q
    mov     ax,4fh
' ^2 l# U( A2 f/ e: j" L" k    int     41h/ E8 D& m, w1 q3 q+ d1 T7 |
    cmp     ax, 0F386) j- r' @  C3 v, ]* v4 Y6 M; d
    jz      SoftICE_detected3 \* b/ p+ k% ~1 }. Z: X9 H1 ^/ k& z( [

* V6 z$ R5 Q+ R6 |+ U' ^, x
0 a% E  o. H) c' K6 u& ]Next method as well as the following one are 2 examples from Stone's 9 @2 L! Y* k3 r6 Q* u2 b$ a
"stn-wid.zip" (www.cracking.net):
1 H, h1 `' @  I, }; o. G3 }! _% l& ]& g% r# y: L. J1 o- a
    mov     bx, cs9 Z8 v9 R1 Y% o3 a- c/ T
    lea     dx, int41handler2( a/ b+ s7 n( H# e9 h0 `, |
    xchg    dx, es:[41h*4]
* I) Q3 o; n7 M  x( ]  b    xchg    bx, es:[41h*4+2]: h5 A1 S. T% H2 r' B6 F5 ~
    mov     ax,4fh4 T$ I( q- @% ^& [/ X- H
    int     41h
$ b6 q# P3 d: l' K8 X5 K    xchg    dx, es:[41h*4]6 _- }3 j- l. \: t3 c
    xchg    bx, es:[41h*4+2]. `  G# [& n# y5 u
    cmp     ax, 0f386h
+ R1 m! W1 b! D    jz      SoftICE_detected8 U3 {2 p" n' J5 d3 \. z
( ~8 ~6 h+ ^2 H
int41handler2 PROC
0 @% R5 g* Q& l  ?* h    iret# h1 K1 P' ^" Z& f3 v3 X
int41handler2 ENDP
( O* I  f" a) h4 w. W: J* g+ z
8 c( V8 E4 V7 m* g6 _
* p& s$ u5 q  j( z_________________________________________________________________________
* k  S* F' N' ?9 e, X/ F# n
# E6 ]3 n/ B0 {, g! z: d: w6 B6 ^' ?& R% s0 `$ H& W$ n
Method 06
+ N3 g7 R( R. o, ^: h6 ^=========8 y) R1 y2 s+ u3 @7 i' k

" K. X/ p/ X* @0 V( \, E6 o/ p: T) y2 i
2nd method similar to the preceding one but more difficult to detect:* Y3 E3 {/ l) n& B# I
. {( M7 v" S; ]. z  M. `# v# c. C
0 K3 g- O' \4 ^& N
int41handler PROC
. c7 M! _" T. n* v! V: ?# K2 k    mov     cl,al
: G9 F* c/ k& N% Z$ E3 g1 h* T    iret
1 t# a* K+ D( _; I# Dint41handler ENDP% `( }# s. ]; S& P& p/ n) ^
4 ~( A, ~. d/ Y  D
5 S  z7 ~7 ]0 p5 E
    xor     ax,ax
% m8 m6 h4 s" S! ^2 D! g! d    mov     es,ax
) q- o2 |; I4 @) v8 @7 E/ r    mov     bx, cs0 u! S& T( G: Z8 K/ k8 T
    lea     dx, int41handler
3 q3 q" h# r3 R. F' n% p/ {9 p    xchg    dx, es:[41h*4]) M: m( Y3 d: N& M
    xchg    bx, es:[41h*4+2]7 l! h! q' f" }" p) T
    in      al, 40h
8 i& \0 N+ l( p, F. a2 ]    xor     cx,cx% v8 Y; m- S0 b+ G
    int     41h
; M1 W$ _8 z. {2 K, C8 {: M: `    xchg    dx, es:[41h*4]  h  [3 A# b, n; a; ^& g
    xchg    bx, es:[41h*4+2]
6 q$ P7 v+ C1 s( }8 h$ t    cmp     cl,al* b/ O+ j- C3 `2 d% @9 r
    jnz     SoftICE_detected
: T* ^# |. S+ e. }  g8 r8 ^% E. {6 J( @! ?; s' q+ {0 U0 G  b
_________________________________________________________________________
+ K$ L5 q7 v$ k4 d3 u) v
( d  p; n; j, X3 {! B8 |% NMethod 07
, k' W- N9 u' O% s+ c* W' F( E=========
2 [* U* ]" Z# [9 r8 Q/ T% _! B6 ]$ H- o  o8 h+ E- H7 \
Method of detection of the WinICE handler in the int68h (V86)3 s% ^: p( @  l5 l
4 `# U: M! X* Z$ r
    mov     ah,43h
# g; e+ ~3 f  K+ @$ {" ~4 y7 {4 w    int     68h
6 D" Y/ e  i! \: B    cmp     ax,0F386h& S9 M0 G  A+ }0 h8 @/ Z& U) V
    jz      SoftICE_Detected( O/ B: E" V1 F7 O3 i5 ^1 w

- Z+ O/ Y# w. N* ~" K+ G! `( q$ [: c( s5 `
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; A9 P$ j3 t8 T5 H, \
   app like this:; q5 t$ ]& `, ?, c! H- l
! Y2 g8 K0 ?) j0 w6 u2 j2 f
   BPX exec_int if ax==68
3 `5 d* P5 [& p8 T1 C3 F7 t. a* \   (function called is located at byte ptr [ebp+1Dh] and client eip is* _6 G& }) S5 c
   located at [ebp+48h] for 32Bit apps)" A" `1 W* `# A
__________________________________________________________________________: _" a2 O. ^5 G; Z4 Z5 E
! ]  Z; J3 t8 @2 B
/ }- K) _* i. j  Q% v0 O7 n
Method 08% Y% \$ v( |. C1 K/ \- |( S! b- k
=========' g- F. V6 ]9 P, p
0 h9 w$ {" M- `  l4 ~
It is not a method of detection of SoftICE but a possibility to crash the" C  y# U+ a6 V1 ?3 m8 \: w
system by intercepting int 01h and int 03h and redirecting them to another
+ f' T) K( Q1 l7 b; croutine.
$ q- N' ?6 A# ^3 W# CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 P& r% e6 y6 _7 ~5 R; \% ?to the new routine to execute (hangs computer...)
5 S- q) ]" F: q" f
3 t* ~+ R' x3 Y& Y, {4 v2 a    mov     ah, 25h
" ~3 }8 y$ {9 ]$ p, j    mov     al, Int_Number (01h or 03h)" L# J' |. s' K, H
    mov     dx, offset New_Int_Routine
3 g. B! j, e. M. H+ T    int     21h. K8 p3 C7 B( h0 B2 K5 a" t
! z$ s- g" e5 {
__________________________________________________________________________
& ?$ E- ^0 B) V- ]/ Z$ p3 S8 J  \, M5 ?
Method 09
. t) z* L! C' f. c: ?=========' q" o# S0 W: Z" ~+ y6 n! ~4 W
% b/ B9 o6 B3 `! u
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 c9 g4 r& s/ H) ]performed in ring0 (VxD or a ring3 app using the VxdCall).9 Q9 N2 O4 l, H6 A) c& m: r6 l
The Get_DDB service is used to determine whether or not a VxD is installed5 E/ P* x5 ^) H/ v1 o/ m; j6 ~, o8 i
for the specified device and returns a Device Description Block (in ecx) for/ \* _" l! b( \$ A
that device if it is installed.# p& Z9 O1 }) D, M% n

/ b! j8 X$ `& F& J0 C   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) W/ y7 M6 Q' [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 e: i# K6 q' I0 |! s& a* n# t
   VMMCall Get_DDB; D4 b9 N# s9 f9 n5 a7 U
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' N$ e3 `& y+ q+ E( r) Y; B! [( s, X- Z1 E& K  @
Note as well that you can easily detect this method with SoftICE:
4 p1 G  ]7 c  p. W   bpx Get_DDB if ax==0202 || ax==7a5fh% z" u9 O- E4 V6 n3 _

6 W% e: ^  H& |' j# D# E1 b5 L( D! a__________________________________________________________________________
- _" _$ T6 S6 s. n1 p! B- }* F# ]& Q9 y5 b. R& U! J
Method 10
; ?3 D* B& @+ Z- `+ j: [  M7 V2 r/ o=========! P; e' h& v$ U9 t/ x5 E
5 Z: u0 F( w1 ?: f" A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 X- j) D, D8 M" f" S$ h4 ?+ O6 i
  SoftICE while the option is enable!!& [  [6 |* V1 a$ H$ j0 j7 }: D) b
8 N+ m8 t9 ^. t2 X2 F3 z; V, t
This trick is very efficient:
% |0 _3 Z/ h- Uby checking the Debug Registers, you can detect if SoftICE is loaded# X0 V( }  A& |. }7 }
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: v7 S" C) s. b1 |: `there are some memory breakpoints set (dr0 to dr3) simply by reading their3 A9 K1 a: Z& r* }8 G# O
value (in ring0 only). Values can be manipulated and or changed as well5 N5 ~5 ], K8 ^
(clearing BPMs for instance)4 }2 D* ^+ _* L" y# R7 D& v6 i
2 C+ K9 L9 S5 \# b/ Q, q
__________________________________________________________________________0 W5 w" n0 \% x, `- ~! A% ]2 ^8 T

9 \, F/ C: a, U. r6 m) tMethod 11
: V2 ~8 E$ z0 b6 G: g=========$ O. H: U  y: F

3 s7 e/ H% o! `; D3 p$ B7 l) {This method is most known as 'MeltICE' because it has been freely distributed
0 h9 G: k% S5 @- R4 yvia www.winfiles.com. However it was first used by NuMega people to allow
4 z8 z3 K3 j3 q& H3 V# l! A; xSymbol Loader to check if SoftICE was active or not (the code is located
1 M/ l' j+ J; w7 Uinside nmtrans.dll).
+ q8 M; i7 C; O2 s/ {+ @& ]! F9 f, c& S* l
The way it works is very simple:
/ g7 ?- U: U* \. ], O0 Y! H  }8 VIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# E8 C* G7 K# K0 @  l  R* lWinNT) with the CreateFileA API.
, D# ]/ q9 t: e3 Z, A5 h6 i0 e% ]5 y, L9 f
Here is a sample (checking for 'SICE'):! [/ ?0 V! O: w

. U: N' e, ]* rBOOL IsSoftIce95Loaded()0 f1 p8 ?. S! P) P. J6 }
{
: n$ @5 H) ?) ]; q* A+ z; n; f9 O   HANDLE hFile;  4 _; j% o. f) w% K) B9 N
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. @- H  l$ U- D- W- Y! x
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( m. \- f- m' h# A: v                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. Q5 k9 K: v; R# Z" X( V& O; s   if( hFile != INVALID_HANDLE_VALUE )
+ M' \6 Y4 T" l% C4 }- ?, p8 w0 Y" Y   {
0 z$ n2 m; H: [1 X1 g! Y+ M5 c      CloseHandle(hFile);6 v- s) m9 B2 N% L: M4 _8 `. F5 u* F. t
      return TRUE;
4 i1 f' B+ x/ ]   }9 Y5 M% n( S- E2 J
   return FALSE;+ m$ {. V. n7 C1 ?( B+ h/ D
}0 n* n) L8 w7 x$ X1 A" T# |" h% b8 Y
( ~" B" P. ~# B. O' _5 g6 P
Although this trick calls the CreateFileA function, don't even expect to be
+ v( J- i7 o" Wable to intercept it by installing a IFS hook: it will not work, no way!
+ r+ [7 A* t5 VIn fact, after the call to CreateFileA it will get through VWIN32 0x001F4 @! ^0 x' H1 b+ f$ e
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# x, y2 B2 T7 L1 d. ^and then browse the DDB list until it find the VxD and its DDB_Control_Proc/ q+ R; U) R) b! e5 o/ j1 H3 a) P9 i5 r
field.- W& V" n3 O( c, E3 z+ O
In fact, its purpose is not to load/unload VxDs but only to send a 4 ?4 o) N! J2 A- _4 t/ o$ U2 I8 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) e; i9 ]5 b3 }6 I4 \to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 [) C" F8 P$ \! H# W) X6 j
to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 P1 y2 {9 @# O& O
If the VxD is loaded, it will always clear eax and the Carry flag to allow
, A/ |: e/ t2 A- n& {) U! Sits handle to be opened and then, will be detected.6 e+ V% t1 J( k& A
You can check that simply by hooking Winice.exe control proc entry point
8 K' w* p( u: ?* T! }* p3 Ewhile running MeltICE.' q4 @- W2 m& w8 p$ g, J

, i# s( v9 {( c9 a+ Z- p5 v4 m0 C3 t
  00401067:  push      00402025    ; \\.\SICE
& p! q- p( d8 t! M& h' d, m: E% l  0040106C:  call      CreateFileA
' U- K) Y' s, D& L! |  00401071:  cmp       eax,-001# X7 p+ r* v7 h
  00401074:  je        00401091
8 J9 G/ M2 T1 j; f
3 b- Y8 J  k- k4 q' [1 x. \9 c/ ?* r) P" t% a( t$ Y
There could be hundreds of BPX you could use to detect this trick.
6 L1 U+ \" s. j! Y5 x-The most classical one is:
# P4 S. X' ^. Q9 {3 X+ E  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
( D# e5 r, z% c* ~) Y, J    *(esp-&gt;4+4)=='NTIC': ^8 S+ w; O) x7 a9 N. M

9 c9 B9 N, |+ s5 ^4 r- M-The most exotic ones (could be very slooooow :-(
* e2 C" N/ X0 ?1 R! U+ U   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - d( d: t* R: f9 ?$ m
     ;will break 3 times :-(
) U3 x  H  B' l  G6 Y/ A/ H9 e$ K, Z' C6 g1 ~) r; {5 Q- k
-or (a bit) faster:
+ A  X8 m5 C8 J# G& \3 j6 x   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ T" [  q) F% E3 J! V" R5 _3 N# M: ?# O# a* G' l, [
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, H3 k6 D& M5 k8 o9 i     ;will break 3 times :-(
6 x7 i+ C# C* X3 [( O! _* y- w0 E" U9 r/ e8 x" u
-Much faster:
! M: `. ]" {% u8 F   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* r% h5 ^6 v& y/ q+ |0 ~* W
* F- b4 Y& Q) W& V/ TNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 e! z! e) M6 h6 K$ ofunction to do the same job:  K" Q& y  o9 T* E% j

- G% I! T. c4 G% w) x   push    00                        ; OF_READ
) z' s/ y  O0 z! n6 t% s; D   mov     eax,[00656634]            ; '\\.\SICE',0
) Z/ b$ [, C" G+ X& h& M( p9 d   push    eax
( G8 C; I2 r) N1 h7 f, P5 h# ~   call    KERNEL32!_lopen+ _0 T1 l' X" u. H5 q7 j, {
   inc     eax* ~. f, u9 x2 M2 e5 l6 N
   jnz     00650589                  ; detected
0 y/ {& d: Q) g8 q  E; Z   push    00                        ; OF_READ
" W( {& R2 k% X4 {: ]* N$ I   mov     eax,[00656638]            ; '\\.\SICE'5 m/ W. g% I  O: C* H
   push    eax
9 e# F, O* q( c6 v- }   call    KERNEL32!_lopen4 m4 f2 \! r" f+ r7 |" w* w, \
   inc     eax& P  H: _9 h7 i' _9 @) n. }! U% i2 u% i
   jz      006505ae                  ; not detected
  p/ |1 f2 G; c& {% |! w  Z; }) W8 F1 W( i0 L+ t; `
) X  t- B% R2 ~$ K- i) `. S, p" S
__________________________________________________________________________
. d" x( l, H( F  G/ c
' b: F# Q* q! K/ U; ^; f; W) RMethod 12% z" z' K' v4 m
=========0 ^4 v8 S( U$ |: m% w" b) ^/ ^

+ Z$ s! p9 u4 M6 g8 w, _This trick is similar to int41h/4fh Debugger installation check (code 05
8 E9 n1 ?2 i8 d" D( A9 M&amp; 06) but very limited because it's only available for Win95/98 (not NT). K- @4 ?- ^5 a% i+ \" U
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 A" q& }4 V0 u0 g

8 L: `& p2 Q$ S  J, N# o# d' J: `  R6 j   push  0000004fh         ; function 4fh4 H/ u5 l' X7 S, ^; T* q9 Z0 l
   push  002a002ah         ; high word specifies which VxD (VWIN32)
- Z" ^( g2 w' Z, X                           ; low word specifies which service
( @1 K; G4 X: q, i2 }                             (VWIN32_Int41Dispatch)
: j. n* A% F. X% O+ y  v2 G" G, }  f3 I   call  Kernel32!ORD_001  ; VxdCall
& _7 `: G& A3 f! c, p" D   cmp   ax, 0f386h        ; magic number returned by system debuggers/ T" F  F1 A& b0 P, g" l
   jz    SoftICE_detected- A% U8 K1 C- d8 Y9 P' j

3 p& i7 x, r8 L# _/ m1 ^: mHere again, several ways to detect it:/ p9 s3 ]+ \' ^" ?/ ]

, z- h* `8 G& y+ @    BPINT 41 if ax==4f
0 I; D( h, x( s/ t9 }* ~
/ \3 d' e' |2 D& R/ ]    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" K# D; A, ^* x8 @
) Z3 E& r& y$ u
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 \2 S2 Q; Q. h  `2 l8 V. \2 d8 Q8 A  V& x
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' H2 c* _3 ]3 z( D5 u& W

' F1 Z3 K: t) G  S5 l__________________________________________________________________________/ c; E7 s$ N/ B& e, F  x/ ~
! G7 D- B) J! |& i; }
Method 13$ M/ u8 R% v1 E' T, `3 W5 s
=========
! Q# {% b9 _8 Z1 d! L# M
, z1 N8 d5 Y" E) M2 v. G$ q: UNot a real method of detection, but a good way to know if SoftICE is8 x/ X- Y$ n. v9 K. c
installed on a computer and to locate its installation directory.& ?) O" ~  e0 a9 \
It is used by few softs which access the following registry keys (usually #2) :$ u# C3 \) y+ l9 B7 n

0 z8 p& k2 n0 s% F( m2 E-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 T, H$ V3 w1 q$ q- G\Uninstall\SoftICE; D. L1 Z, l8 s& J/ ~1 e
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ \8 _3 Q8 l- e0 f
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- J' R* H1 `( f% W1 t5 M\App Paths\Loader32.Exe3 q. a5 X( W) m

9 I4 t; y% r3 X  F) H# j
4 X- C8 B$ `3 L0 _* aNote that some nasty apps could then erase all files from SoftICE directory
% p8 x8 W9 J( z3 @* e3 Y0 [2 U(I faced that once :-(
3 G- O0 E) m/ }7 v% d3 c
# ^$ k+ f) v1 V7 R3 qUseful breakpoint to detect it:
$ P5 D0 M8 k  u/ k/ Y' q0 U) o( ]. U! g( _
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'# h6 p4 S4 Y: a3 d! \

( i& U0 {, U5 M__________________________________________________________________________
2 D" w0 d; o( @% ~: w3 @  {
" z% I1 U" X+ C! o3 x4 j2 q, |3 T- e! L0 ^
Method 14 / j; L1 ]( C5 V+ S+ E
=========* b3 n) y5 b/ E, }! W" S

. o) w! g7 L. GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
" [0 g3 j: Z6 k2 i& o$ ^% t9 jis to determines whether a debugger is running on your system (ring0 only).
5 e& R: i5 z0 m# x! X
* |. F) N$ m5 {   VMMCall Test_Debug_Installed8 \  o/ `+ u* m) o# @
   je      not_installed5 b1 h4 R0 x' \+ E$ z! p
4 b( i9 n8 T- e# b: C9 z
This service just checks a flag.
7 Z6 k: H3 w8 R# D! f/ ]+ b</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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