About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 G( ]* Z8 A+ ^: Q
<TBODY>
  f+ i& u- w9 x<TR>
5 ]3 \2 H1 m! r( n/ q. Z/ g  n<TD><PRE>Method 01 6 {/ [( ~+ b& A8 c5 J
=========4 _6 L( D. R0 f1 V7 R  X0 S

% S& h! U+ o  i- q" h6 TThis method of detection of SoftICE (as well as the following one) is
. H; s0 O! R+ t, F8 }9 ?used by the majority of packers/encryptors found on Internet.5 Q' }9 W% z7 X+ P# p' F
It seeks the signature of BoundsChecker in SoftICE6 A  F2 i$ G: t* e7 n; g) E
2 Y5 W% S" i+ D" N/ ~4 n: Y
    mov     ebp, 04243484Bh        ; 'BCHK'. o9 r( g( j9 p# a0 O$ y
    mov     ax, 04h9 w2 O$ ^" S! _" n8 d
    int     3       2 _; O+ ~: C9 I. E4 U5 H, E; z* j
    cmp     al,4
. z# Z) A, R- t. \' V2 `# x    jnz     SoftICE_Detected
" r7 l0 h3 U! t2 y; v3 U! W: w- Q- y* X' [
___________________________________________________________________________
# \8 Z: C- [6 i$ e- z: D; y- v/ O) V* ?5 i5 \1 |* I
Method 02
7 q- s* S- H1 Y& A=========
% |# p1 T- X: \! M; A; x: c, K* |6 e8 f+ ?* j* t: `& T
Still a method very much used (perhaps the most frequent one).  It is used
) I( D  v$ R& M7 S. jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 x" J% d7 {6 B# x% |: X
or execute SoftICE commands...
- y- _, ~' `) C! b% C6 NIt is also used to crash SoftICE and to force it to execute any commands
% Z5 c4 p( d9 E7 a9 n) a(HBOOT...) :-((  
" X0 t, s8 P3 D* D  V( H/ }
. y8 t7 o' Z; l6 VHere is a quick description:% C" e' e! |( H0 j6 ?; L$ m
-AX = 0910h   (Display string in SIce windows)
1 V0 {/ K, a7 g, c6 _7 X-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 U- b4 I( ]( D5 G1 w9 f$ m7 m+ l-AX = 0912h   (Get breakpoint infos)5 V6 }( a3 L! f) S6 D" B
-AX = 0913h   (Set Sice breakpoints); u& `5 A3 u+ c1 K; n/ F0 a
-AX = 0914h   (Remove SIce breakoints)
) L' T0 t3 U& U& h7 s# ]/ K4 Y1 V3 V" W# p* ?6 x
Each time you'll meet this trick, you'll see:
. a5 \: L1 D: U3 y6 n! e-SI = 4647h
, X" M; j) S  j' Q-DI = 4A4Dh3 m6 Z! K8 n. T
Which are the 'magic values' used by SoftIce.
. X5 F1 E+ h7 X7 b, BFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 W/ K7 H/ ?) K! ~9 i
: w- H! W8 Z5 i! G; S, ?8 _
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" D: T% V, T0 V9 B. XEnvelope utility use to protect DOS applications:
- @0 `6 E! V0 n) u- U$ M& _$ x& q, d: |# V
9 M2 y3 G9 `( Q& n% d- I9 q4 S
4C19:0095   MOV    AX,0911  ; execute command.2 z1 ]; g9 D- B, f  o! P3 R+ A  \& }$ o
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ p; X/ y7 R( T, u" P4C19:009A   MOV    SI,4647  ; 1st magic value.- ?, Z. \5 q& y" k$ R
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- W/ h0 Q! Z! p& Z7 a# l% w( F- u6 I
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 M* Q: w6 f  ], ~! c4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( i& a# r; q% q2 c; T( W4 ~& _
4C19:00A4   INC    CX
9 X( h# z: R0 J& T  D9 b# s8 E4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute0 f+ Y( Y; n) L+ a( |- m
4C19:00A8   JB     0095     ; 6 different commands.
/ N- X0 @3 T( {6 _3 K/ V+ v2 v- y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 c1 Y! Y4 L4 M4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 e! K# i6 K5 L1 G9 l8 w9 q# E2 u9 E0 B4 l/ _0 h; M' u" c) R
The program will execute 6 different SIce commands located at ds:dx, which- {$ j# j" f% X7 m: C( m1 B# |
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' P$ d# G. \* T; j# D5 N' X, b
8 y2 g+ B( C6 M! S2 I3 ~: s* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  H# B7 q2 m- u1 b; p1 ]  F9 [/ y___________________________________________________________________________4 C% ], Y, H5 S
" \. C7 l* I  r- ]* H
. b) }' C4 x. F% z
Method 03
, T' W3 Y+ O, A" o=========' K# X- S0 |) K+ U$ \* N

+ ~/ w. S# m( j! t& P1 T% JLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' C' u* V0 \' w; z3 \$ J( z! O
(API Get entry point)
) L. `' I3 w& W+ ~7 e6 d! d) c        
8 T7 I9 ]$ b: X" b3 c6 J; [; `; f" J! _7 u. E
    xor     di,di" w9 h+ S# ?, E7 N, n( s7 a
    mov     es,di
+ h( J: Q, a3 K7 T    mov     ax, 1684h      
/ Q, }& F  T1 y$ D: o( U* O+ `    mov     bx, 0202h       ; VxD ID of winice0 A4 H6 K5 t# G) D5 k  c- }
    int     2Fh" E: }( i9 m" I9 K( m  n$ n
    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 o( k! P* K( I/ }* U
    add     ax, di
3 P; P8 ]0 Z7 B$ \. J7 g    test    ax,ax) [3 Q7 M) q9 [' ?% l  Y) n3 D1 j
    jnz     SoftICE_Detected
. |- @/ p! p. H' P5 q: ?" R
0 w: p# T3 s% i6 o___________________________________________________________________________. _8 p. J7 S: b6 {1 f
. l& }: c5 ?1 q
Method 04; L$ j+ b" K- Z: B$ Z
=========
, o, U* ~5 J+ `. H+ q
0 f# N; I5 Z" C% e  |Method identical to the preceding one except that it seeks the ID of SoftICE  l2 R& Z0 g, m6 T0 V' x  H" d0 A
GFX VxD.. d! Y8 v5 V6 [. t9 f+ k6 H
% V/ f7 I- J, }8 P
    xor     di,di
6 `! s: T6 ^( H, O+ i! D7 {0 D    mov     es,di
$ p+ [$ v/ p% m3 v    mov     ax, 1684h      
; m4 R! \- p% c) M' G5 P* q* {    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 {) K& |* }# j# [1 Y7 S
    int     2fh1 I4 B7 ~1 {6 b7 n) i! o1 F
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 L. \* S! \0 F4 l% m    add     ax, di
( V( ]* h+ S* p# F& ?. c    test    ax,ax$ p+ E, [# S4 A) n
    jnz     SoftICE_Detected1 I& ^$ @& }& _. B- S( S& ]
+ ~  Y# M, D( c- y4 ~4 s
__________________________________________________________________________
: Q* x" Y3 y# w- Z& k" F4 c0 d5 H8 F1 v" I" B9 s5 B' e7 J9 C

% d/ n4 t2 \9 Q$ nMethod 05
$ k$ g: ~% z/ i2 v* p- M7 d2 Z8 n1 K$ u=========
7 Z- v: m, r! v5 h+ b2 X
0 X: l3 f/ o. q/ NMethod seeking the 'magic number' 0F386h returned (in ax) by all system6 L" i- X% k. _8 j$ ^4 ?* Z; Q
debugger. It calls the int 41h, function 4Fh.3 E* K/ Z, E- u: h4 p  P1 @
There are several alternatives.  
$ a" ~) _+ j0 z! i; O! G5 x3 f- p
The following one is the simplest:- v5 \% r* Z% x; N  \  `3 O

$ l2 ~6 t; i- _' e. Q2 Z4 w# Y7 v    mov     ax,4fh) I/ d& \; W! G+ m
    int     41h5 r( {# b" F  A/ }
    cmp     ax, 0F386: M7 t% i. j  H/ A# M8 B% u. y# D
    jz      SoftICE_detected2 \' E$ @/ R4 {( o! O! C  C

4 l% u  S; r9 p  V9 g* L- M: }* q" h
/ N: {! [3 K0 [+ \% K% BNext method as well as the following one are 2 examples from Stone's ! H/ D, A( R) `+ j- g
"stn-wid.zip" (www.cracking.net):
1 i% Z$ o$ ^1 k! X* m9 Y2 o$ s& g5 J) q7 P  F
    mov     bx, cs
) F. E8 P, o" |' b1 C" z    lea     dx, int41handler21 D4 B$ u- M+ l; q
    xchg    dx, es:[41h*4]: y7 Z% y: Q. p7 |7 C/ n4 G0 O
    xchg    bx, es:[41h*4+2]* y- z5 r9 _6 B6 W
    mov     ax,4fh
1 w+ x& U/ r! x4 b/ T" e2 i# N    int     41h$ h5 V2 r( p  _/ |+ D) T' R5 M
    xchg    dx, es:[41h*4]
' m0 d: \0 v$ d; Q' u& n    xchg    bx, es:[41h*4+2]7 n! }) g8 I; r; c! ]
    cmp     ax, 0f386h9 V: p7 f. I( Z  b. b" t; f. A7 H: d
    jz      SoftICE_detected( @3 X+ X( O3 ~1 W/ M. }1 M  e

- M! p5 R! l- Z0 t& nint41handler2 PROC( J. L  o, Q' O
    iret
8 d( z- `" w6 J2 G2 n& }int41handler2 ENDP
4 N% b. [. x& p5 E6 x6 d  v' c! k+ \3 E; R/ n9 v8 Q
; {- o3 w* v) @) w
_________________________________________________________________________0 ^* x, r$ G7 N

0 ?$ B* ^$ h- j- s6 e& p4 M# ~7 t  k4 a+ Q7 `; `+ w
Method 066 a9 j7 o. n* B
=========9 C6 A2 y7 E: }% \

; O% C% P$ q0 z+ R$ T8 n) y% o
* {0 N' g1 Z0 B2nd method similar to the preceding one but more difficult to detect:& v0 Y# w" A$ N+ k  P" y+ J
5 W5 b' E6 z; |! \& C

2 S1 k$ o5 u* T" S% vint41handler PROC
/ B1 z) k* g3 x: z9 D    mov     cl,al& |6 a& o4 [- d
    iret* m6 |' L7 s; r, S, B/ O" v5 n; n$ a
int41handler ENDP
$ s6 A9 @0 x5 Q. l4 L$ i4 q  M8 j. e6 e! Z' B- a* k+ V6 X
2 n0 U$ W: h/ l: w; X7 x5 O  I) m
    xor     ax,ax  i# b+ t/ J7 s
    mov     es,ax
) K; p+ c% i8 {+ U    mov     bx, cs
: w$ s6 ?2 y6 p% q/ i1 B. T8 ^9 ~    lea     dx, int41handler+ l; g8 j3 c5 p& ?* N
    xchg    dx, es:[41h*4]8 e5 E- h6 {1 O9 k& e2 l* j
    xchg    bx, es:[41h*4+2]
2 y3 T  }: G8 y& ~( k    in      al, 40h5 n- M: \  }$ ]: @' H+ s# p; Y
    xor     cx,cx: b1 s. E& v* U# |
    int     41h3 J4 t- J/ F5 T! o% b, H4 l7 X% M
    xchg    dx, es:[41h*4]) m& J. i* N8 ]1 c
    xchg    bx, es:[41h*4+2]
* w' H6 c8 r' g0 K8 m    cmp     cl,al
. N  y% l2 w+ v% t+ [3 n' B    jnz     SoftICE_detected
; m. n$ Q- T* C3 K
) q( l9 d- p) q; n_________________________________________________________________________
. i5 ^8 P8 D( N% g' _3 v& Q
! O. C3 i/ r; e9 h' z- q% Q- L) FMethod 07+ K+ r* \$ b7 W6 r3 v0 Q4 ^4 e2 M
=========
) l% }( L, ?9 j) x/ f
8 E! C9 A, a* R% h, l) LMethod of detection of the WinICE handler in the int68h (V86)
7 M% q: _* [+ c; f, @
6 v% ?5 Y3 J- \4 o7 K& `: Y5 M    mov     ah,43h
: F: b" Y* X. w" V' `    int     68h
' {. W# E5 W8 \, c# S" Z6 a" e    cmp     ax,0F386h$ \# D3 r- I) Q7 K( f9 `& \
    jz      SoftICE_Detected' L% n* p, ]( \7 U9 ~7 |+ G
) a! F5 r  O9 m0 y: G, S# ?
# `, u: B) f8 ?
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# b: ]' P" p* \, ?# l; I$ y   app like this:
$ V$ `4 |/ H4 K2 U: _
, g9 p: e) c; Q7 r$ p  L5 c   BPX exec_int if ax==68
6 o2 C- t3 g) q8 M0 N2 h: D# d   (function called is located at byte ptr [ebp+1Dh] and client eip is$ q% Q7 y1 ~5 L' o- |+ }
   located at [ebp+48h] for 32Bit apps)' A; _5 a& a% U- F5 q
__________________________________________________________________________- [1 @/ f" T1 x7 Q

2 a/ h+ {( s8 E1 ?5 p1 S0 g- R4 [! D' R- b
Method 08
5 u4 h1 G8 U; I! O' G2 y6 Y=========
/ w) t' @' {8 J4 P* @/ s8 n# k% j0 f5 B' ~, S: I+ R8 A$ h
It is not a method of detection of SoftICE but a possibility to crash the
- {* X; t$ b# i5 o5 W& vsystem by intercepting int 01h and int 03h and redirecting them to another7 Y2 L1 p: h9 d' ?& M' @; W
routine.' ^1 U% n' T: F+ {  y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ U9 b5 p/ S) N1 K% \$ d
to the new routine to execute (hangs computer...)4 }' [% H9 w% C, W
9 I- h3 {" \0 D2 [& }4 P6 e; M
    mov     ah, 25h$ t( `6 u7 @/ H& ^  I: |
    mov     al, Int_Number (01h or 03h)
& E& x) U0 X* W* R% [# F/ \& H3 J    mov     dx, offset New_Int_Routine
- ^. j1 `7 D* g5 J' N    int     21h
. o2 C# I- Y3 L3 X' ?6 k  q5 S3 B! Z% Y
__________________________________________________________________________4 l' G6 Q$ |# q

9 O  x! D& T$ W& c. s1 OMethod 09* Q; A% S/ T9 u6 i
=========
  E1 |3 }5 C, P$ p9 y& T4 w4 r2 T
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& V1 `# v! m  s# E/ {, uperformed in ring0 (VxD or a ring3 app using the VxdCall).% p* U5 J; o4 ~5 T' n$ l
The Get_DDB service is used to determine whether or not a VxD is installed
7 ^9 H# z& C# U/ Z" R0 W% G8 Cfor the specified device and returns a Device Description Block (in ecx) for7 A# k( c& j6 R- c; H8 \+ U
that device if it is installed.0 a0 J! y# q6 h" u1 {) D
; u# q( K/ @7 g9 @& Z9 X* J
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  M4 {, g+ S1 S6 l1 m0 [   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 R) d9 S) j0 b7 {% N* m
   VMMCall Get_DDB
! j8 x. ]6 N$ W$ Q   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 z4 o7 \: z8 j& V. T( U% S; _
* K2 F7 p" j$ h& @) KNote as well that you can easily detect this method with SoftICE:
) O! ~, m; O2 n& A   bpx Get_DDB if ax==0202 || ax==7a5fh0 s. n" X* t/ G* V& m
9 j! z& }, V7 V+ b# b
__________________________________________________________________________# O; E: i' T8 P1 E2 r& D
( I$ Q* }/ I7 _2 F) ]
Method 10
4 m: i/ c. m7 }' a9 a4 `  [2 K=========7 e8 `" y" E6 n! }1 H1 u
) U: Z; e* x/ u* W0 C; I! _: n
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ l: G- _2 j; y- M" z3 s
  SoftICE while the option is enable!!6 O$ `  p" d  j; z- Z  b. N

/ P9 R% Y3 f2 rThis trick is very efficient:/ m; ~& @, n3 w; D/ B7 O3 u/ O
by checking the Debug Registers, you can detect if SoftICE is loaded
$ q+ E' z+ d  g3 i! o) H2 N(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 P, }6 q/ Z$ Z$ J6 P- x& P9 {there are some memory breakpoints set (dr0 to dr3) simply by reading their
  G+ t) f" \& j3 Xvalue (in ring0 only). Values can be manipulated and or changed as well8 @5 N4 D9 d, x& W2 H
(clearing BPMs for instance)
  P( j. T. l5 r/ G" B2 _- y5 e3 X$ l) w7 u
__________________________________________________________________________
$ [8 L; G5 j& O0 W2 [! V8 L
" \5 H! f# g8 @. c3 Q. N- i" p/ gMethod 117 L+ [* o6 ^0 P& e" A+ c
=========
$ B) U% f% K/ V8 J9 r
1 O4 l, h* b2 |) j4 b& ^9 E& cThis method is most known as 'MeltICE' because it has been freely distributed9 x8 v* N  z: q3 X" y5 h" f) ]
via www.winfiles.com. However it was first used by NuMega people to allow
' e, U) G% L9 W6 Q" L) qSymbol Loader to check if SoftICE was active or not (the code is located2 _0 ^, n# _0 \
inside nmtrans.dll).: q* I7 _: w# n

; p9 O2 F. F, q, k! L& x6 D& j" qThe way it works is very simple:; q! l5 L! {6 T6 g0 R) v  n
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) m. w3 p/ x' m' _) s( QWinNT) with the CreateFileA API.
* H! f; B0 p  I1 G+ X
( ^/ F: j5 y: Q1 R3 H: k+ XHere is a sample (checking for 'SICE'):- k% w% F3 x. l' U2 m
% s  Q3 ?! I6 O/ a& `5 c  j1 k/ x" }
BOOL IsSoftIce95Loaded(); O+ S% m- P# [2 `/ i0 o' V+ D5 w
{: I4 ^0 H8 p% y7 X( D. ]. g( @
   HANDLE hFile;  
* d) U# X8 D4 b: A: ^" e8 c   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
3 f' ^7 J3 C* K( B. `                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' ^, A6 i. g# P* L  m                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 y3 p' ^* c; x$ \& h! P, y   if( hFile != INVALID_HANDLE_VALUE )8 n  _' Y( _4 b/ n5 ~& a
   {% E8 G* x  b: O- E7 ]1 y
      CloseHandle(hFile);! I8 y7 V! o) d' ]
      return TRUE;+ r! v2 f* r2 p* j; z, Y
   }$ R! p- K( B/ w1 b9 @' N2 d4 t/ \
   return FALSE;
# L  n  \  S3 c* A9 S3 g5 j}
9 u& M$ S: `6 ]
) a9 j, s; O% hAlthough this trick calls the CreateFileA function, don't even expect to be+ V6 H4 [) R- L" _  U. O
able to intercept it by installing a IFS hook: it will not work, no way!# b; c! S* O/ p) `& }& u& Z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F/ B4 ^: a% v8 c. S; _0 {, q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( u4 x- D- `4 q( a, {and then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 R9 R2 j, A8 R5 {) t3 a2 Lfield.. G* E) N! S) {) Y' @0 V
In fact, its purpose is not to load/unload VxDs but only to send a 1 }% F2 a& c* R0 D$ Q- E# v
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) `+ A# @) Z+ x# `; }to the VxD Control_Dispatch proc (how the hell a shareware soft could try' O1 H' A6 c: e6 B2 n% j
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" G, A7 A8 D1 f# }If the VxD is loaded, it will always clear eax and the Carry flag to allow* @1 M; y* x6 }) k4 y: b
its handle to be opened and then, will be detected.
7 ^: |  h' |$ P" j5 jYou can check that simply by hooking Winice.exe control proc entry point- `& w) N5 ?) C! y
while running MeltICE.7 L& O  ~( X" A) D, M9 b9 ~. X+ @( F

2 U8 I5 m& [+ S5 f7 {3 a5 |9 s, C0 ^
# @% x4 _8 h6 ~8 P0 h2 P0 l$ Y  00401067:  push      00402025    ; \\.\SICE+ L2 i# J& E& A5 |. N9 e% q
  0040106C:  call      CreateFileA
, Y; {, \, F) A% _5 {  00401071:  cmp       eax,-001
5 n1 X; a& A' z! y& V  00401074:  je        00401091& d* I& f/ U: G: J0 x! A3 |

& f/ k9 W/ Q5 \/ n0 u$ }
0 J6 j0 O, @" Z8 hThere could be hundreds of BPX you could use to detect this trick.5 l2 B& q1 G3 V  M+ u# c4 b
-The most classical one is:+ e5 h/ }' h! I2 @* k& C
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( s$ D) p) Z7 F1 M
    *(esp-&gt;4+4)=='NTIC'
- I1 ?* k8 o8 t
" Z' A$ O' Q, @% m. ]! P% T2 k( R-The most exotic ones (could be very slooooow :-(& p" v  c3 @3 J/ D; H! z* F
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ l, `% m. ~/ e; |, t4 L
     ;will break 3 times :-(
& s8 ?/ H/ ~( V6 P3 Z; E, p& E# c' T$ L/ X5 S
-or (a bit) faster:
1 \! H5 m+ }( p5 j5 S; d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
! @# N6 n+ W# Y2 d! B0 M, s9 ~- `/ I0 O1 w# d- t9 a* z5 Q: v) a
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : H( s( o: J- q# H
     ;will break 3 times :-(& q  G  j" y! J5 H  ^" D! R

* w$ c! n6 K, A' Z# \, b5 m-Much faster:# Y# W6 T$ H* w: s$ A/ G" ~6 q4 r& K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'  \0 |7 ?+ a# i) A- B9 o

# D& C$ H( B& p0 a0 w# QNote also that some programs (like AZPR3.00) use de old 16-bit _lopen! X8 f  B( s! f/ i! r5 D2 d
function to do the same job:
) p: v1 @$ D- w4 q5 X
; U8 B% G9 N/ `% c, o   push    00                        ; OF_READ
, e- f* l0 L0 ~   mov     eax,[00656634]            ; '\\.\SICE',0! `" l6 |) h; E
   push    eax  z% L+ M! h% e
   call    KERNEL32!_lopen* k( o7 Z* n) Q: Z3 h
   inc     eax
1 W0 y* O- \! A+ T! U4 A   jnz     00650589                  ; detected
) F$ k" l) V/ \) V3 v# n) ?   push    00                        ; OF_READ
7 s6 r' O; U7 z4 v5 j   mov     eax,[00656638]            ; '\\.\SICE'1 t+ f, S/ u4 C7 {7 U
   push    eax* k- F3 @& u: e+ @
   call    KERNEL32!_lopen7 t0 t6 m, y1 J, ?6 P+ h; I; W
   inc     eax
+ z( B  _: r# K% F5 s2 y   jz      006505ae                  ; not detected) X1 E2 I6 h5 ~+ |! d0 |5 L8 N
" d: m# `  H2 O) e. I& _, O) K
" {0 D% X. P; Z* N( P
__________________________________________________________________________  K' K- b  F- C0 w7 @! N
. y# m5 Z5 J# j0 l  c, ]2 ^" e
Method 12
/ @3 x0 b9 }# P=========" k! X4 o$ k3 t) r% Z; e
  B' F* Y3 U6 `1 O8 q1 c! a% {
This trick is similar to int41h/4fh Debugger installation check (code 052 b! ]) T* h8 q% U+ H- y
&amp; 06) but very limited because it's only available for Win95/98 (not NT): n, ^9 n: k7 B6 ^# @
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.1 C2 w( F1 `. |& L$ \2 W7 k! L
) k; u+ S0 `4 i5 e% c# a
   push  0000004fh         ; function 4fh
% G/ D* D; O+ W8 C   push  002a002ah         ; high word specifies which VxD (VWIN32)
" W/ H+ {+ H$ _) O0 {$ D! r# l4 c                           ; low word specifies which service5 ~; _4 }7 P% d2 ^  e, I' R
                             (VWIN32_Int41Dispatch)
, z0 r7 A* }8 l; @8 k6 @   call  Kernel32!ORD_001  ; VxdCall
( D0 Y7 I; x9 c  d7 ~( w   cmp   ax, 0f386h        ; magic number returned by system debuggers) `2 [0 ]9 g* |0 Q# @. T
   jz    SoftICE_detected0 g0 p) H+ K% R" ^: X% u
. h, x7 J; r- K5 h# H+ V& A
Here again, several ways to detect it:! ~; a1 T8 I4 |
4 b9 F2 y0 Z* G9 J
    BPINT 41 if ax==4f+ m( [6 W8 ^$ C* h, g
& Q9 n+ D+ ~1 ^5 R% n9 U
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& F  `6 c( c) J( [; i
" K4 W3 I3 A: q- Y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
) L+ d$ `" n9 q' d
. W* b1 M! B$ Y( E, g' l. t4 Y    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; R9 P; X8 B, \
; T$ b+ N! y& f: I+ x5 z$ p" A
__________________________________________________________________________9 {* H$ w- J- Y. _: F6 a

- g+ f/ {# b' b" [6 eMethod 13
! K7 q; c! F9 C* q& ~=========
0 a; s7 h% S0 ]/ {9 e; G+ L. L1 i7 ~' K
Not a real method of detection, but a good way to know if SoftICE is; s2 Z2 }0 s% g( k& q4 t0 u# [
installed on a computer and to locate its installation directory.' N) h( {! O' u( i: I* k
It is used by few softs which access the following registry keys (usually #2) :0 P# Y: f2 @. O1 m: y9 Z+ g& g

0 I* |/ d  m, N: v7 G: a: [9 l( C-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  _1 F. v! @0 z$ L\Uninstall\SoftICE9 o% U! U* }, ~
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
/ C6 e5 m8 Y; m+ B' z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 G' a0 @$ y& w3 U
\App Paths\Loader32.Exe
+ n8 u5 o) x; u7 f1 V! b* G3 _) K- o4 `+ @, J5 Z4 `: B+ I1 q
2 m2 n8 Q  O/ |( q' K- ]  `5 u
Note that some nasty apps could then erase all files from SoftICE directory$ h4 e1 k. F1 |2 ?* v# r
(I faced that once :-(
& e- \: k+ ~8 Y9 g1 R# i
: m/ Z3 }8 V9 E( B' j# BUseful breakpoint to detect it:# o% s8 W+ {8 e# H; f3 B. \
+ z: y% a: B4 z2 y6 d. ]9 l; I
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# R! o, S1 ~$ m1 u
3 T% q% p- y# L( R0 G  Z__________________________________________________________________________2 Z" l* z$ @8 L' Z) v

7 l8 h: O6 C- t% Z' M& M/ A3 _; z5 B) R( P5 t
Method 14 ' p8 C" C3 S( P6 H9 e6 V0 A
=========
+ \: [1 r' ~2 ]
3 E  z1 P' r+ c6 b! kA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  v' C  l/ U2 c2 ^3 d/ ^is to determines whether a debugger is running on your system (ring0 only).
( z& h  y( E+ e9 s: {
+ u; [- L" a. n, A- t% E8 N   VMMCall Test_Debug_Installed
, C! Q2 K$ p! C* M9 N9 q   je      not_installed
* q. `; Q6 t& B9 P( Q: B# z9 l9 L* q1 q6 d/ U
This service just checks a flag.! N5 u# S% M' a$ |  b# Y& A
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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