About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& Q! ?+ B) f) \$ [  h+ w4 _' D
<TBODY>1 U1 j! Y8 @# |: P. U" m
<TR>
" F6 W4 p$ @5 S0 `( |6 a<TD><PRE>Method 01
4 `  J3 ^+ O  \+ z4 F; `3 t=========9 U" s" u  N; D2 Z: ^7 B+ I

* r; [5 ^9 K5 Z1 T/ YThis method of detection of SoftICE (as well as the following one) is
" c' v: S/ M& J# o% w. tused by the majority of packers/encryptors found on Internet." M# ?; H2 i" Z9 }
It seeks the signature of BoundsChecker in SoftICE% m9 I% ~$ U9 b- E( I# Q0 ?. L
- R: _7 c3 }2 q* Q1 E# y9 _$ u
    mov     ebp, 04243484Bh        ; 'BCHK'" m1 l5 n  P, z3 }* V! @& @8 ?" m
    mov     ax, 04h5 x9 K7 @  t/ l" I" L& N
    int     3       / v: u: \6 E; ^. l' A9 j0 _  L
    cmp     al,4
" A9 C( R; Y6 q; |0 B; N    jnz     SoftICE_Detected
1 z5 @* f+ M; |  h2 \7 B# `
, a( o7 G5 p7 |' a- t% Q, g___________________________________________________________________________
8 w# u; N/ \: h/ T# X
! B" ?& N2 G! G, w7 ^- F4 A0 |; ^Method 02
, [; Y5 X9 a) V! h=========  ^; W. E7 A& L6 P! a5 D% D% F3 ]
& s6 a8 t" y8 ?# J/ j
Still a method very much used (perhaps the most frequent one).  It is used
5 j4 v+ f0 q4 m2 ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,' a+ s! v, ~4 s( ^& y- `: L2 b: I" y
or execute SoftICE commands...
1 u8 \: g& v- x! Z% ^1 `It is also used to crash SoftICE and to force it to execute any commands2 l9 I9 O& v) b6 }
(HBOOT...) :-((  9 j# T) {2 Y# B: Z3 x
! M+ Y- @" P8 V
Here is a quick description:: r  `3 H+ M$ t9 O* Q$ r& m6 U
-AX = 0910h   (Display string in SIce windows)1 n7 l! l+ |" X* ?8 c: }& H- ~
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' J( `2 j4 Y* \# x& ]& U7 T
-AX = 0912h   (Get breakpoint infos)
* C$ E. c4 |* C- l* `' l: G-AX = 0913h   (Set Sice breakpoints)
& M- g- [: w5 q$ J-AX = 0914h   (Remove SIce breakoints)4 r  V6 o/ T5 K/ _6 @- a

" S: |0 A; K2 [( j* R2 rEach time you'll meet this trick, you'll see:$ B3 z. e4 p$ i# a
-SI = 4647h
: x8 z6 u8 ^$ p, O-DI = 4A4Dh/ _. e' f; }3 f# v: w/ x
Which are the 'magic values' used by SoftIce.# l' q0 ~. K0 D8 q4 g: ~+ X
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& B' \) @6 G+ h$ m
8 }8 n8 X! g( n8 ?8 n
Here is one example from the file "Haspinst.exe" which is the dongle HASP9 t9 T" A6 z* E" s9 o( v1 b% X
Envelope utility use to protect DOS applications:7 W2 X0 C6 k' w! m; t2 O

0 ~# c/ i/ I  Q$ F6 J, X" p
3 ?; Y# P0 F2 ]5 k* I0 q$ ?/ F( L4C19:0095   MOV    AX,0911  ; execute command.
; U* `# V/ r3 ?5 R  i, C3 O4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 ]4 ?2 _8 d( L8 o8 ]( U' l
4C19:009A   MOV    SI,4647  ; 1st magic value.
2 r  `7 o' W/ ?4 Z* C0 h5 n- ]4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 g' `+ }  w5 S3 s# g" M) P( X4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 y" k7 H# |' U( o- B# X0 r8 }4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
% M0 @+ R" U% q+ ?6 ~1 I/ D: h4C19:00A4   INC    CX
* y5 N0 j1 n% i) u8 i$ r4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 Z7 O0 u$ u" K) @4C19:00A8   JB     0095     ; 6 different commands.0 C6 D0 Z2 O9 c, v. C0 v
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' }) x0 ?# j, n. ]4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( P$ q# }. j  Q+ E4 t- P' M7 n0 ^' M6 e+ C5 t# ~
The program will execute 6 different SIce commands located at ds:dx, which
7 _* d1 R7 {/ S( n" \" x  R$ nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' J, W: ]  [9 W4 V! O6 k
5 v0 |  T8 Q) L- N. T: f: i) @* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ i/ f0 q& V. n3 J$ O! ~: Z7 D/ [
___________________________________________________________________________
* F) H$ O6 r' Y  W7 u/ O* G* h! r! Z- k" k( d) m5 ]* J! S
/ ^, q4 {4 R+ |" V4 H
Method 03
- F: n$ S- a: G  @; P  w=========
9 q/ I+ d9 M4 {( t9 K% M; X7 L
  w: y- o" A9 ?Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. d; m* S, s  I5 O/ l- i
(API Get entry point)8 e$ r2 p" m1 _1 b
        
# X5 b/ Z: P' T3 V  o$ A1 y1 [# l* d, \  ?% `( m
    xor     di,di* E7 f/ m( A$ s4 m0 [
    mov     es,di
( [* Z- E3 v9 p( B" y; X    mov     ax, 1684h       # |! w: r) b+ R' K( N; ]. h
    mov     bx, 0202h       ; VxD ID of winice
/ V/ p$ s4 L5 w2 B1 F. Q: ~    int     2Fh3 A1 t+ r, P& _8 O
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 ]; b6 U9 l( h0 B
    add     ax, di+ G/ n& E' Y; Y+ J0 L
    test    ax,ax
# v- p5 U0 Z" F2 v4 r' q5 y    jnz     SoftICE_Detected
5 N( `+ H3 O# R  D- o
) E# X$ ?: z$ K: N9 ^9 ^___________________________________________________________________________
2 ^1 s: R, C- O' @( M, u% E4 Y8 p1 _- U! y) l8 [4 |" q6 b! c
Method 04
/ X" k; j2 R3 D+ y4 G=========# y6 L, d' N: V

& L( ]9 f+ r- K7 z# [0 sMethod identical to the preceding one except that it seeks the ID of SoftICE
) F' u5 o7 x8 N$ N* QGFX VxD.
" B4 H7 B, Y# g5 w9 p7 P6 q4 l, v' l/ q) Y
    xor     di,di
  @; q/ s9 y' D9 K; ?: D2 U    mov     es,di# F: I+ Y9 }- f9 Y
    mov     ax, 1684h      
5 q: a# R0 l$ {. I( I1 d    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ N  J5 E, a$ K3 |. L
    int     2fh7 ~# N! A  _, d6 r. H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* E& n+ h% b) Y: Z& F: p    add     ax, di
5 r3 z& m% M5 V- l. G+ j    test    ax,ax
9 P% s3 c4 k- z. x2 ]    jnz     SoftICE_Detected
, X( ~6 ^: |- G; I
  P9 G; S& B3 s5 i0 s2 m( t- B5 p__________________________________________________________________________9 b1 g" a# G& I) m
+ S1 ^4 C  l, {# A. {

+ b1 U/ u0 _, v8 L! ]Method 05
+ N: P* s# W' H=========; f) K  ~- ~+ Y' |2 g8 m
% P. z( E- W4 c8 P6 |
Method seeking the 'magic number' 0F386h returned (in ax) by all system
0 W- k" }+ W! ?1 udebugger. It calls the int 41h, function 4Fh.
+ L# |0 j; K! p' S8 ]There are several alternatives.  ' l# J3 i, |" v

5 Z: }4 d) y5 Y" V  U5 w: u2 pThe following one is the simplest:
$ O1 n) M) Q7 l/ K! \, R. p, j
& c3 I* Z* S' ]5 k- D; M    mov     ax,4fh
2 r8 n- A: H' h/ s  x    int     41h7 z, e, P3 f/ I  K
    cmp     ax, 0F386
& i' k2 s& M7 I& Z    jz      SoftICE_detected
* i0 O) \5 _. {! N. L7 y* d) j3 f) e' d, T& t# r2 [

! t+ f$ N$ p0 z) _- d2 ENext method as well as the following one are 2 examples from Stone's 6 ~4 t2 R4 M9 J: t
"stn-wid.zip" (www.cracking.net):
9 d3 A0 t6 r1 g8 {8 c+ `: J2 F7 j- p5 l
    mov     bx, cs: I% n4 ]1 I  ]& b; y' g
    lea     dx, int41handler2, A9 x$ G$ a2 E
    xchg    dx, es:[41h*4]
1 A  m2 v+ d' @" K2 j5 A, G' R    xchg    bx, es:[41h*4+2]
+ _$ W& N& Q- \    mov     ax,4fh4 S. J* b4 N0 z' q# B
    int     41h
3 e5 R& o- J4 B+ f% |+ s$ ~    xchg    dx, es:[41h*4]
! u" ~8 X7 u* g$ Z  R    xchg    bx, es:[41h*4+2]
* o- q6 c: [: A  u    cmp     ax, 0f386h1 L9 _8 T0 Z) s7 |3 r5 j9 {7 i0 W! |
    jz      SoftICE_detected
6 S. W6 Q* t7 S+ m" S  T8 g- @; z) Z/ j7 V$ k1 l
int41handler2 PROC! o" l2 k5 `: R+ t+ Y  x
    iret9 r) n. D9 e+ R
int41handler2 ENDP3 x/ P. n8 h: @* q  L
8 V3 Y. m: p' x4 ?( ^0 m/ l
  N5 `/ i9 ]9 c: p. Y
_________________________________________________________________________  A/ V6 D, U0 V, J

; r; B' ]" W. H( Z0 a9 A$ {; f% v6 r6 H% m# w, g- F5 n5 H; i' Z2 U- Y+ H
Method 060 F0 R0 Q& r8 H9 ?
=========
3 l8 F# N1 `' {6 Y: V
9 E$ v/ z7 u( V' M7 W. i. W7 H& M6 L
2nd method similar to the preceding one but more difficult to detect:) i8 Z( B* b5 F" C+ b' \7 s: z

. I/ s) [* E1 l9 ~2 s3 Z' e6 D) O% c0 Q; L; g
int41handler PROC
/ o: C. g6 @8 g    mov     cl,al
& f# A5 V) R3 Q: |    iret# y; d/ s) M& i* c! F4 r
int41handler ENDP' k) G9 ~! L( c! D7 _

/ T, O7 c  X3 [+ l/ x5 @$ c& Q9 @( w# z
    xor     ax,ax
& i  L+ V3 r- r3 b/ q7 N    mov     es,ax# D3 Y) O) }# Q0 Q
    mov     bx, cs7 Z" T  B/ g3 O4 m
    lea     dx, int41handler7 w8 @: @$ [1 R6 W
    xchg    dx, es:[41h*4]% c8 z$ J" w4 T0 W0 i  s- F
    xchg    bx, es:[41h*4+2]- N- W. t9 o# T6 x
    in      al, 40h, `& d! ~1 [. v( D, H
    xor     cx,cx7 C+ K6 \8 n3 E- c6 G
    int     41h
0 G+ V# f3 Z6 `. H1 O# U    xchg    dx, es:[41h*4]
' F! j) X, g: y' U% x5 s# S    xchg    bx, es:[41h*4+2]
' D7 a% f- C  S  h: e; _    cmp     cl,al
; B) g1 L% ?/ y0 l0 |+ T% }6 }    jnz     SoftICE_detected6 U& c8 ]' K* _1 Q+ [

1 ?: H. v+ J, Z* m/ I& R! S- C9 T_________________________________________________________________________
& V9 N3 k6 W" a" z8 w+ {3 f& R0 a
0 D# i" r* J0 v0 V. z  V/ kMethod 071 r; b* v5 L: A1 W# N! B
=========
+ p0 D5 h" Y9 J. K5 K# c+ V- {4 V, F
Method of detection of the WinICE handler in the int68h (V86)% L7 A; |, D8 x6 R: M9 t
8 U0 U% R5 M: k) [" p
    mov     ah,43h
6 s' P3 ?+ a: `    int     68h
" S: k5 ?3 U$ z" j& E    cmp     ax,0F386h# r7 \0 M$ @- _$ |0 Z% h6 W6 k
    jz      SoftICE_Detected
! S6 p' S$ d: _: O
! w3 O. D" O: ?
* i4 i/ l3 s3 l2 g: R' n9 M" R=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( a; l8 S4 O" ?   app like this:) c; A* l8 [! R2 X) ]9 r: U
' c% q' Q: O7 z7 G5 f2 P" _
   BPX exec_int if ax==68- Q+ A' I" g, Y9 N
   (function called is located at byte ptr [ebp+1Dh] and client eip is
; c$ X. O3 a2 K   located at [ebp+48h] for 32Bit apps)
3 b2 @0 C4 _, G__________________________________________________________________________
1 n1 o$ P) p- [! i' a# f1 k0 `, ]& p* [2 f, \- V# L0 R

$ D1 K0 x- W7 W5 h; F" l; j6 p* nMethod 08. u5 ~0 a1 J: o, x3 T
=========
# H) y8 Y* e6 q! Y& F& }3 i# j4 r9 r
It is not a method of detection of SoftICE but a possibility to crash the
8 X7 X* W% j  A. \0 ]  zsystem by intercepting int 01h and int 03h and redirecting them to another/ z& T3 t3 c% C/ z
routine.
* |0 t! e0 w$ e$ k; @/ I6 d  OIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
& A/ p7 o5 y7 p: s8 Uto the new routine to execute (hangs computer...)$ y$ u) x5 `( F4 d
4 ~2 ^! u- E+ `4 q2 `
    mov     ah, 25h
/ I. z: T: k' X. e1 L# o    mov     al, Int_Number (01h or 03h)
; [5 y9 A# x' {. p1 I( |5 X    mov     dx, offset New_Int_Routine, b/ e' C& l; e+ {6 c8 J
    int     21h
# z7 g- ~) [! f7 U& y0 z# W) D7 g; l  V' ~# U. U
__________________________________________________________________________, r( h; b% s6 q1 @
/ U. \( E9 v  L4 m% P7 ]6 i
Method 09
" G# Y8 w* f4 C=========
' Z5 |( Y! K: \- ?; q0 g7 ^& G" P9 [5 `5 x' I
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
+ ~& Y- H2 l/ I3 j5 qperformed in ring0 (VxD or a ring3 app using the VxdCall).
; q5 B& g% u3 ]& t" oThe Get_DDB service is used to determine whether or not a VxD is installed
3 [% v' C# d1 _( F( [* _( qfor the specified device and returns a Device Description Block (in ecx) for2 K# a5 b' P! N- V7 j* t" D
that device if it is installed.- y5 Q( X9 E2 [  P9 s1 O
  a( t9 q! s1 |3 X1 F8 X4 [4 W
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( a. x# N5 Q$ G+ A' ^" d3 r
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
3 h, m5 v" A+ c   VMMCall Get_DDB8 ^9 v9 {, @4 f% m) Q$ ?
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% r/ o0 r* G: K. v

! ~$ ~$ l7 M# I5 VNote as well that you can easily detect this method with SoftICE:  e! F3 t' {( Z( X
   bpx Get_DDB if ax==0202 || ax==7a5fh
0 _7 W+ Y# Q6 S- _1 V7 y4 ]! F3 z# @1 }: F
__________________________________________________________________________; y* ]$ [" @) [
0 v- p- X& h. U8 p! b/ G0 N! r% G
Method 10. A! s8 G6 `0 U/ M" E" ]
=========, ?( B3 _0 `4 B, [. s
% Z! j3 Q# l, ^& e7 O  L0 o
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
# h1 b* W: f7 J$ Q8 h8 ~  SoftICE while the option is enable!!
) f2 A2 X1 L7 @6 ]# a7 l- F; p# N1 r0 {/ ]( \* U8 l
This trick is very efficient:! a1 y8 L) j' J' g" y) o" k8 }
by checking the Debug Registers, you can detect if SoftICE is loaded. U+ B3 N; p+ q* J2 g' ^( j. f3 S
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% \% \8 n3 I+ `2 l9 M+ g) S# Z) w
there are some memory breakpoints set (dr0 to dr3) simply by reading their
2 x( }  J6 `/ |value (in ring0 only). Values can be manipulated and or changed as well
9 [7 X+ t! q) [4 c( }(clearing BPMs for instance)
, K7 S' L+ F+ ~/ f0 J: G& S1 u6 m( j: G. k, \7 O' q+ q. c
__________________________________________________________________________& z& f# D1 W) n  x
0 j& ]* a' n( i0 d7 U
Method 11
5 U1 k  b: K! u8 m=========2 T2 m" t  v( X

3 S4 D* T5 b* aThis method is most known as 'MeltICE' because it has been freely distributed
. @% T* F6 @! Y$ q8 ]( ^via www.winfiles.com. However it was first used by NuMega people to allow8 k% u% }( i, b' V+ d6 U/ r' G
Symbol Loader to check if SoftICE was active or not (the code is located
# ]# Y$ A3 P+ C7 ainside nmtrans.dll)., [, F$ m' K6 Q6 B5 Z. u' d
* C" q) u: E* g) w, Z8 G- q
The way it works is very simple:% {$ B. v. e+ ]. {0 ]+ G
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 o" A1 M) X+ ]WinNT) with the CreateFileA API.
- F# `6 R; p; y. S$ M
& X6 ~/ U5 Q% U4 u: Q, c) w: _5 FHere is a sample (checking for 'SICE'):: [9 Q; Z: {) |% ]3 R& I

) ?) G& Q$ ?, PBOOL IsSoftIce95Loaded()
/ C/ S9 t: [) w" D{; m; ^7 G+ Y, P' v7 v
   HANDLE hFile;  $ H6 q) G5 U" e- Y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ S, l4 d7 B; h# p! N) s                      FILE_SHARE_READ | FILE_SHARE_WRITE,
3 r; Q3 V" v0 a7 w; q                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: p& R/ t' ~- A& ?   if( hFile != INVALID_HANDLE_VALUE )
% K3 ^4 H- S6 z$ @& A   {3 x* L+ p6 T9 F4 M1 P' ~5 ~
      CloseHandle(hFile);
7 g6 l: f6 g; v) m& B: A6 b      return TRUE;" w+ {. x2 c; P4 e
   }- d8 j: o8 e5 Z  A
   return FALSE;7 Z/ W1 _: Y2 `& c6 j
}2 ^9 }* q; t' }, p; W5 a2 B6 C

; {* p  D/ Y0 pAlthough this trick calls the CreateFileA function, don't even expect to be
+ X6 r/ R) v: n  O8 w; Q& mable to intercept it by installing a IFS hook: it will not work, no way!/ ~: c& V7 v3 X; M& j7 U3 }
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
1 i' L; R& Z6 b0 K" b9 X; `service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ `( K6 U0 p, g
and then browse the DDB list until it find the VxD and its DDB_Control_Proc' u5 q  @) B4 i
field.
) N) E1 M9 a# x! I; P) K( M& P, {In fact, its purpose is not to load/unload VxDs but only to send a
( {; G( p2 R! ]. a% C# ]* Z8 yW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) o; L2 x* z/ `$ `! |to the VxD Control_Dispatch proc (how the hell a shareware soft could try6 J7 R) w; E; ^( F! X1 k- ^/ [. W; \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ l4 A% s0 H3 N5 r, mIf the VxD is loaded, it will always clear eax and the Carry flag to allow) A2 U- a! G# ~
its handle to be opened and then, will be detected.( l2 M* k* _0 z0 T' F+ |1 w
You can check that simply by hooking Winice.exe control proc entry point" s5 {- _6 ~8 o$ E% q
while running MeltICE.+ b  w$ H8 k/ N% v

) d: j$ z9 K+ @; z- R5 I$ ]0 Y' u+ `
  00401067:  push      00402025    ; \\.\SICE
& O/ s" z2 U2 e  0040106C:  call      CreateFileA# ?" a' F8 q6 C* t2 J3 W4 {$ a
  00401071:  cmp       eax,-001
$ B. B" K8 {5 O. G0 V  00401074:  je        00401091
% F. z3 V6 f1 s, X
, E+ T5 r. R1 F9 x: Y# l3 X9 x" h! O4 F3 G
There could be hundreds of BPX you could use to detect this trick.! i7 j* {/ t& s6 S
-The most classical one is:
8 Y. Z, J! A9 M8 g/ z  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, U$ y7 E2 o7 N7 }( ]  S5 [    *(esp-&gt;4+4)=='NTIC'
# E4 H$ y2 j, _1 x2 y
, z4 r  i# F2 p* Q/ }-The most exotic ones (could be very slooooow :-(
1 S9 ?7 C2 ^' ~$ A   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 a2 W+ {1 n! r1 O
     ;will break 3 times :-(' A" Y  r( q9 J4 U5 N0 y- u

7 j' n1 v- R- X2 w! x! ?-or (a bit) faster:
3 s' q, Q  P# }# ~, p   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 L- s+ i7 S% ?7 K( n; F/ C
3 {7 U( R  {- b' h6 ^
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 G1 j3 s4 u5 W# E6 g+ D7 h     ;will break 3 times :-(6 k* C* w. o4 Y4 s2 M/ A* y: Y

, ?$ @; C  F! r$ S7 q2 \-Much faster:: Q1 ]  I. ^% B% R1 V9 i9 a" _# M
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% y4 g7 m( |$ P5 j5 h

) q; y7 o; N/ ^8 B1 D& b. S/ uNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
: ]2 m3 e! y$ T! }2 q  S0 C, ufunction to do the same job:7 W- S9 `! j  [) |/ X
0 G6 ~8 p. ^4 y$ d
   push    00                        ; OF_READ( }8 |7 B/ t. c7 H( j7 M- r; E
   mov     eax,[00656634]            ; '\\.\SICE',0
# R# F( @& K0 {$ I" v   push    eax! j: g2 O9 m$ G5 N
   call    KERNEL32!_lopen0 F; r8 ~6 K; N9 |) B
   inc     eax- X% z, b; b. F3 n- ]
   jnz     00650589                  ; detected9 j5 f, W( Z- V/ B4 k* f  E
   push    00                        ; OF_READ
+ U4 A9 ?6 y8 d+ d   mov     eax,[00656638]            ; '\\.\SICE'
" T6 n" K6 U3 M! J! k   push    eax( L" U: _4 D2 l3 }& k
   call    KERNEL32!_lopen2 i/ `0 w  d3 _: c/ b
   inc     eax  Z% t$ G. I+ H" `) U/ ^
   jz      006505ae                  ; not detected
: P1 c/ v- |% o: B2 E  Q/ q0 i" e! |% J1 y
( X. T& L# m' o8 K' ]
__________________________________________________________________________
) s" G( d2 R9 |. H& O- P- z# a$ M
' O# ]+ y8 e6 l2 y0 a3 ?Method 12
6 K8 C/ p$ A) B/ @=========
* B* R1 A  q5 [/ S4 N) c! |1 Z4 J0 J+ O
This trick is similar to int41h/4fh Debugger installation check (code 05
: a! n" S5 [6 Z  H% a8 p' D&amp; 06) but very limited because it's only available for Win95/98 (not NT)- V2 H+ O( \' m5 ], }8 Y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; e5 U; R/ [, Z2 q
) D' |# R, x; Y0 m5 h   push  0000004fh         ; function 4fh0 v, _! v7 S1 ~2 r
   push  002a002ah         ; high word specifies which VxD (VWIN32): ?/ h0 I7 W( {' W0 g. J/ J& L2 \
                           ; low word specifies which service) v/ b% v0 t$ [4 g/ t
                             (VWIN32_Int41Dispatch)
0 C$ o" _7 t  {3 s   call  Kernel32!ORD_001  ; VxdCall! C. K. K6 `2 _1 D. L$ ~% j
   cmp   ax, 0f386h        ; magic number returned by system debuggers" R# X+ Y& y7 D$ X% p9 C
   jz    SoftICE_detected$ A9 m: z" U& C% w7 G; F/ y, G

! q  o8 `/ z# c4 |Here again, several ways to detect it:
1 {, n- g- Z" |4 Q4 E4 @! B0 n" v: l2 `3 m0 y
    BPINT 41 if ax==4f
& f2 |2 ~4 i, z, L; Q, W) {. \3 e- Z$ |
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 k6 l0 R, I; a& W/ s) G' x6 A6 K

/ L* `0 ~& N; _; Q5 l% u    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 o5 _& |3 A0 _" U9 U) d
% Z. A2 b" p4 v* B! S' T: f1 `- M4 j
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 `" j  W# v$ y5 b/ F
% s  `; Z) H7 U: ]
__________________________________________________________________________
; u. F& C+ G* n1 B# {* r
3 b5 L) l# A/ [) Y- s# ^Method 13. Z; ?+ m/ m! M: R2 A; f0 d
=========
) k' Y5 u1 n9 p
& @7 |+ j0 _( ?: tNot a real method of detection, but a good way to know if SoftICE is0 ?) _! z0 a7 r) W
installed on a computer and to locate its installation directory., y% @$ k" G+ f2 z$ ]+ G1 v; d
It is used by few softs which access the following registry keys (usually #2) :. r/ }0 s& R, Q: v- B8 C
7 B0 t4 H7 W9 @% P
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* T4 n6 @( M$ ]\Uninstall\SoftICE
8 @+ ]( `  l0 I4 h* h-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE! L! X* o- l- ]7 Q  f% L4 R, d3 z
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* R8 h6 U4 y3 z
\App Paths\Loader32.Exe$ d2 v' _2 S5 L7 e, f' y7 m

+ C5 q4 _! k; f1 \; _9 d& @3 k# g2 @$ F
Note that some nasty apps could then erase all files from SoftICE directory; X" i2 \, d6 T4 E! o- {( U' ^( j
(I faced that once :-(: _: U0 e8 |/ c" |% i; ]7 I4 R% C
4 D, v5 ~4 R9 q
Useful breakpoint to detect it:3 Q2 W( W/ ~1 g2 V4 G' R
  ~6 B+ B& i0 _4 {
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'7 z! d0 J/ m) H7 R( z
7 ~7 S3 c# v) ]8 C9 w# f& ?, Z+ c
__________________________________________________________________________) Y( o& J3 p$ a0 G

6 j3 g% j- S+ j" p
4 Z4 [. v+ t) ]. ~' vMethod 14
2 x8 Q! G& N! U$ y  H; d$ I2 V=========% E3 \" t/ l- S: w  B0 x. t

, a( S( a& E& iA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 [# y* T2 K" o( R/ U  w, g4 l
is to determines whether a debugger is running on your system (ring0 only).
% t7 @0 K3 t* n4 u$ S6 r6 j1 A1 J5 |
/ k0 C& m( P6 Y$ l3 k8 p: P   VMMCall Test_Debug_Installed
1 W) e. A+ E. A5 u1 v5 E   je      not_installed
5 b4 q9 S% V6 [' V6 g
: _# G$ N: G, U# v8 eThis service just checks a flag.
: w3 O1 ^) w. k</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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