About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
2 L) ?  z- i% F# M4 F<TBODY>
/ x! \+ i4 ]: l+ l0 l% V+ s<TR>. w8 t! F/ r0 L! I" w8 n
<TD><PRE>Method 01 5 n. _  E, p: H+ i8 q! s
=========
3 L) g5 S1 f* w& n! Z* w4 Z1 |. X% P+ o6 Q! f' w4 E5 Q3 H
This method of detection of SoftICE (as well as the following one) is* H5 T' }* F+ |1 l( `& X+ [) F
used by the majority of packers/encryptors found on Internet.
- W' T* `! W& Y6 @* r4 S  `4 uIt seeks the signature of BoundsChecker in SoftICE
; F8 j8 L/ R% Y; S8 w! v
! D) {* W0 {2 C& p& F5 u1 J    mov     ebp, 04243484Bh        ; 'BCHK'9 L2 M4 {! t) W; J! e' s
    mov     ax, 04h
# I/ i# h9 f" N7 |/ H9 x2 b+ B    int     3      
2 r% F, ~7 s! b) y8 J    cmp     al,4! Y, Q/ ^. e1 a- E
    jnz     SoftICE_Detected
: p7 J! i$ s9 G6 s5 F4 ]. W% ]$ d# S, V  j. b7 Q3 f" @
___________________________________________________________________________
2 j9 L0 v$ a: b9 y' z; A/ B! X8 w" v
Method 026 l2 d3 P, |1 d
=========
- h5 c; ?" w$ x& Y) o5 M3 E# X1 C+ W" ~4 a" B) ]* ~3 S
Still a method very much used (perhaps the most frequent one).  It is used. }. n) O) _5 y' l1 L" m6 Q; F) \
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; w9 _1 a1 m4 w
or execute SoftICE commands...5 L' k- w7 r1 g2 o, q
It is also used to crash SoftICE and to force it to execute any commands/ a! l2 D9 W/ s* R; a* l/ {
(HBOOT...) :-((  1 @8 F% ^1 l+ H  i* n% g0 b
% A: r6 e" D/ @* u8 s$ b5 g
Here is a quick description:  K  }5 [# p- v. x: ]6 ]2 m$ F
-AX = 0910h   (Display string in SIce windows); }7 T# N4 X) u+ j4 t' s
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 X/ ?* M2 s! A1 p, n4 ]-AX = 0912h   (Get breakpoint infos)2 @5 X/ w' q1 T8 G) N9 d$ `
-AX = 0913h   (Set Sice breakpoints); k) H# @% g( U! v, I3 ?
-AX = 0914h   (Remove SIce breakoints)+ Q# D8 }% u5 o9 e2 c
; z+ ?& F4 c, {( `* V0 e
Each time you'll meet this trick, you'll see:# ?) b- ?' l- x
-SI = 4647h
- o/ r3 j  a6 P& @: _5 h-DI = 4A4Dh- Z% P% D( X+ e; _3 \) J  U' u3 ^
Which are the 'magic values' used by SoftIce.
3 ?  |' r& @& U6 x- ~" aFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% w! x: n8 e. C

; j0 @! F6 n  {  r3 i1 }Here is one example from the file "Haspinst.exe" which is the dongle HASP' b7 O5 w* O3 {* K7 D/ P3 c
Envelope utility use to protect DOS applications:
& G/ _, T- H8 d; X" H
" x) f% o: A) O  G2 @5 z
5 i8 @; c5 E2 ], \6 {3 g' O& T4C19:0095   MOV    AX,0911  ; execute command.
9 n; m2 Z& q! P( Y6 q& h; _$ ?/ I: o4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- l. N& k1 U' n# H/ v
4C19:009A   MOV    SI,4647  ; 1st magic value.
. I% j/ n1 U" {, \4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
) r8 G5 D% i6 t: ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
) L9 h, y. d/ Z) |% n* Y9 }/ b- y) @4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute; K" }) C# @  E+ H
4C19:00A4   INC    CX
& q/ _# ?! O' T# Z" E, j4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 C8 y& x" z9 _* f6 d  M; {4C19:00A8   JB     0095     ; 6 different commands.
) G' e% S9 O) O  L4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 ^1 y) O* y/ R/ Z
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), [8 E1 Y4 J0 T4 C
5 L6 @+ h7 O3 D. K  g9 L+ W, X' W
The program will execute 6 different SIce commands located at ds:dx, which
+ U* L" ^$ g& qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 v1 `5 |) y. a; f
( J0 }" v/ I( J1 d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 ~9 G2 d2 N2 j* E& n. s1 ~
___________________________________________________________________________
& f. w2 r% I2 n" V! U# S( Q4 g" x! Y5 w
  e: w4 p4 [* o: ]( S4 N
Method 039 e3 g8 ]2 p" V3 O" @) o, E4 F
=========) h: K3 H. S+ M. e% {7 r6 P8 E
) k/ H+ g2 ?2 ^8 x# n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: M9 F$ W5 C3 Z( j9 Y0 G5 ^  u
(API Get entry point)/ \! y; P1 D( [6 E4 P
        ( M7 `/ X/ }3 J8 `. E! G  j
3 K  L# D. P: J
    xor     di,di9 a8 f+ @* A9 z: L( V" P
    mov     es,di; @0 |) K/ A& {: \. `5 p: c( o% m  e
    mov     ax, 1684h      
8 D( o) P* h. e0 p    mov     bx, 0202h       ; VxD ID of winice
. u- F" [! g" @. k4 N# w+ m; M    int     2Fh
, r: o% _& u! ?9 q% u. R" u    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 c$ G7 }+ c# |! o; S2 X; j: \
    add     ax, di9 {3 E2 S" S* i3 T5 M
    test    ax,ax3 V* j( ]" b* ?' n/ h) u
    jnz     SoftICE_Detected
7 ?- {/ ^8 q3 c( h3 T( f! h
8 c# c9 y1 V0 X$ Q: h) A- e8 c5 L___________________________________________________________________________
# Z* m7 k" L( [* K" v4 J& @  G
* @2 d3 d6 U! h- R* F& Q1 NMethod 04
, g9 o! n, P' t7 T$ X( F=========
5 J8 e3 [3 ]+ ?, Q
$ ~1 r+ N! G5 _: PMethod identical to the preceding one except that it seeks the ID of SoftICE
% ?5 u  @0 l# I' o# u+ h2 AGFX VxD.
* [/ ^* h- ^% J$ _; P2 @
0 s  a! `% z% S! Z+ p* B    xor     di,di
6 z6 P7 Z8 y, Q9 w! d    mov     es,di* p" M  r0 Y' `5 o' Y, F
    mov     ax, 1684h      
8 K  T+ d+ T, E+ g  c$ }0 k    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 p7 [0 o( |  P    int     2fh
& B+ g) a1 \( M' M    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 z- @. v% o. f  g* r# }* S    add     ax, di# X+ D7 {, F! C( ?+ y! ^2 C2 |+ G0 [4 P
    test    ax,ax
- r8 P: C, ]$ K( E; b    jnz     SoftICE_Detected
4 L( j2 P" G- i- e0 R$ p; V
% _$ p3 z. U. ]! Q- R__________________________________________________________________________
+ r8 f5 B+ q. L! g- T! n2 m) h4 q: g* K- W- G$ b: m

: h$ c( \( u! q) z. n0 M6 A/ r* ^Method 05- N8 H1 ]% m4 _$ x
=========; ~3 e4 z. Q& O3 n! L1 v% r/ S
' h& r' P0 }% I" }
Method seeking the 'magic number' 0F386h returned (in ax) by all system) v' n/ F; C0 [' l$ X! {9 `, f
debugger. It calls the int 41h, function 4Fh.
: U; K2 f8 @! T1 k8 f6 jThere are several alternatives.  ! ~: b; ]$ m' I8 l3 ^) h* \
' [0 x3 y; R9 H3 i; [* u
The following one is the simplest:; S% n- [# m6 E+ @
- c( C2 v  C) w: O* S
    mov     ax,4fh
1 o1 ]& [, w, t1 X9 N: s% T( K    int     41h
. H0 Q" M" r* S( s9 K    cmp     ax, 0F386  w3 P9 D* |. i: S5 q& s3 V
    jz      SoftICE_detected! e  l3 E2 L. s' w/ c% J

9 k" e( G. i( C% r* H) u# a
* b" G: W( ~. F& ~Next method as well as the following one are 2 examples from Stone's 1 ?, B8 }& ?! g
"stn-wid.zip" (www.cracking.net):. X* ^& y  }7 `* ]0 P% {4 K  ]

! U  B  {5 @$ \$ K    mov     bx, cs9 n; s* x( A' ~( R8 B
    lea     dx, int41handler2
- p" G. e: Y- Y3 j! t1 [4 a    xchg    dx, es:[41h*4]
0 H3 c4 v7 G( Y. x& J    xchg    bx, es:[41h*4+2]
0 g& |4 d9 \( c% Q: Z  J' \    mov     ax,4fh
% |' h' p2 \; N( Q- n7 u    int     41h5 I6 z1 `1 ^! \  r% A9 ^; f6 q
    xchg    dx, es:[41h*4]
- S  z* P* B$ d5 N* m9 J    xchg    bx, es:[41h*4+2]
- T$ l( ~, [/ a' S, p6 K    cmp     ax, 0f386h- {4 b) s( S9 j# S/ ]3 l+ {
    jz      SoftICE_detected
& R$ V5 V6 u# E2 M) w7 U8 ~
* ~6 s4 N, V& \" oint41handler2 PROC
5 z3 C( ^& G6 S  p4 d    iret
1 t4 t* s- A. C0 Vint41handler2 ENDP, N" D* y% v* D
) r: G0 f+ C7 x- E4 Y9 _

- v* G6 P0 v) {8 z4 ^. s_________________________________________________________________________
" A9 `, @- ?# ~+ b# T+ u) E
- ]0 \) g3 \. S  e
$ b3 S4 g4 w' _! O) v8 l: f2 kMethod 06% E! U1 Y6 E' ~8 n- G
=========
3 w3 \7 y  q- |; h7 V
- q* W5 g7 A) p7 {7 ?& ^" Z- @) l+ P; d: H4 _5 R  y: I
2nd method similar to the preceding one but more difficult to detect:( O! d2 @: {4 L/ g' X* t5 a
0 _; Y1 P) Y6 D" _& V; N: s
8 y% K: u/ k$ R, d! L3 k
int41handler PROC
) }' j  u: r3 O    mov     cl,al
' u# ?' W5 Z6 U& J1 @    iret
: ~) V) w: o9 @2 Q% Mint41handler ENDP! Q' X) O' n! n, A: T9 Z& x# m

( r, M* I2 f+ a0 _& s
# ^/ J6 j) W7 U7 \    xor     ax,ax2 N. X( z4 [. d8 M0 `7 d
    mov     es,ax
5 D* U, h2 N4 n  N' R    mov     bx, cs
0 ?) m) F& B. V5 o$ \) U+ A    lea     dx, int41handler! ?: d$ J3 ]: ^8 X+ Q5 l
    xchg    dx, es:[41h*4]- Z  y$ ?) _- d+ Y5 J; q
    xchg    bx, es:[41h*4+2]: `! u; T) R3 P& s
    in      al, 40h
# i: x. h# s0 S    xor     cx,cx
6 \% n  Z& B6 w; B1 V    int     41h
0 i3 c' T2 |* }1 D: J' f    xchg    dx, es:[41h*4]+ M5 I3 ]$ i) R4 B3 ~9 `/ z) I
    xchg    bx, es:[41h*4+2]( X5 r0 J* i. a% C) ^/ d+ ~
    cmp     cl,al
+ W, b0 j: t. @' J    jnz     SoftICE_detected
" L3 e  l' R: m  u# C$ P, T( W* {' g* p1 O" q1 y
_________________________________________________________________________
5 c! F% O% \# E& o  r
  w( J! a& n+ z7 d' e( iMethod 078 t! \/ I% K3 g4 `0 |+ K# |
=========6 r. T  [4 [% S& G) z) V" T9 y5 y- E
. \8 ], ^# _" G  J2 @! [9 @; W
Method of detection of the WinICE handler in the int68h (V86)+ t- I' b. U' G( G2 B

, E2 h6 Y& F9 Q( H- W1 g, U    mov     ah,43h- J. J; _% S! }" ?
    int     68h
! \: a, o  z, E! B/ V! V6 L    cmp     ax,0F386h; h, I) d' h1 O) T0 Z- N' F
    jz      SoftICE_Detected
- ]/ Q$ n5 b+ }% [4 M; t! a5 [) h' z1 h
/ q3 g2 ~6 P5 w- g) {% X  M9 r
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
! t8 e, ]5 L, {0 E   app like this:
* S& R* o1 P3 Z/ ]3 ?4 @3 T
  e( i! G2 q# P9 m* u   BPX exec_int if ax==68  D# m, i& ]' ?7 {4 D+ T! R
   (function called is located at byte ptr [ebp+1Dh] and client eip is
  |5 G" j3 c' O, |, h   located at [ebp+48h] for 32Bit apps): N2 m. [- u5 H! \+ C9 w8 Q+ D# m
__________________________________________________________________________
) s! h' M& A) L$ h% |* R
4 z% P, J0 ]+ H5 m0 o
4 Q4 V/ t4 x2 }  h; R1 xMethod 08: U3 b. d6 e/ o: N+ l0 G1 N) V
=========
' o7 k5 y4 C) z: j8 C, F' }
" N9 V! C$ f0 hIt is not a method of detection of SoftICE but a possibility to crash the, G2 R1 l1 L4 p/ R& v
system by intercepting int 01h and int 03h and redirecting them to another
6 h# f8 W  W- z! T$ Troutine.
) e6 O% ~3 [7 ~It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ a& b9 A$ D" a% U/ wto the new routine to execute (hangs computer...)% ^: V0 q! b0 ~: V2 Y: a

+ Y) y- a( Q7 D! {* W- ^4 ^3 h    mov     ah, 25h: Q# [# _; A3 N+ R7 a
    mov     al, Int_Number (01h or 03h)- ?7 H: [% N& z
    mov     dx, offset New_Int_Routine
( b9 h6 w* \$ M: J    int     21h; {& Z$ e7 p: n

4 Z" F  ^) c) ~& R__________________________________________________________________________3 q% a- i2 L- p, Z" Y7 {! w, ^
6 T( V; V. z) x* ^1 o8 V
Method 099 W* l; h! A1 l, c0 t! L
=========; J! K" N: v2 ^: N
# N( M7 ~% G: W" @1 @
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! p6 y2 Z  n9 b' G7 g* sperformed in ring0 (VxD or a ring3 app using the VxdCall).: Y! ?) |( ^& Z8 p9 b( R
The Get_DDB service is used to determine whether or not a VxD is installed
; W) j5 A, u1 C# r* w& G, Ufor the specified device and returns a Device Description Block (in ecx) for% |2 c" H, j! j! |7 E1 c
that device if it is installed.
/ i% @  M8 y' F3 F/ Y4 z* C1 ?# M1 s! i; G! p' q  X( k
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 [, n' i1 r, Y0 \" c2 N. z6 l1 z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- s3 i9 n9 B6 X- ?) ]1 E2 h. |, T   VMMCall Get_DDB
1 a" D* ]2 D9 C9 f# F   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  Z* o+ ]+ b, z$ Y4 @0 S
9 G- T9 Z! ~& b# g  J
Note as well that you can easily detect this method with SoftICE:
* t$ Q! }6 ]/ ], s% S8 \  m   bpx Get_DDB if ax==0202 || ax==7a5fh" m4 j+ }, ?' v* [
1 g4 }& s" Z! q% M5 D7 R& }
__________________________________________________________________________9 N7 J/ h: ~8 K% ?' r
+ V* `9 C) s7 G4 U
Method 10' p. @& x1 L4 m" ~, n( }" }) n
=========
8 v( t% Q* m9 Z+ }
& x( t. c1 B7 W; G=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 [. T) s' I% A  E  E+ ?  SoftICE while the option is enable!!& N1 U+ }( U, t8 I/ ]/ i; `
8 O7 K0 K0 J' `
This trick is very efficient:
+ r6 j+ E* _) E; g( W! pby checking the Debug Registers, you can detect if SoftICE is loaded; h/ R+ G4 o/ {( q; U7 p1 D4 n
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# z- n, n2 W% A5 T0 hthere are some memory breakpoints set (dr0 to dr3) simply by reading their
- \9 v, x! y; U' Z+ G) ?value (in ring0 only). Values can be manipulated and or changed as well% j+ J$ J2 R8 Q1 S7 W) J$ b' v
(clearing BPMs for instance)
, ?2 }4 m. T& n; F6 W! o2 j
2 y5 s( g$ m' T; J9 N__________________________________________________________________________# O: W( n' M/ ]
. m8 c% u/ J8 t. h
Method 11
' }* {6 R& @- q: e=========% s* t# m1 s6 r8 O
/ W# E5 ]. a# M8 W' B
This method is most known as 'MeltICE' because it has been freely distributed
( q9 ^# l$ T+ A' e9 R8 lvia www.winfiles.com. However it was first used by NuMega people to allow
' G. v' X, \9 R. i- oSymbol Loader to check if SoftICE was active or not (the code is located, L8 u. E! H# O7 d/ a
inside nmtrans.dll).
  o. G- W, P# x% y, j7 {
+ Z! _- J5 `  tThe way it works is very simple:
/ O  d. Z0 v5 o+ {It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% X" T5 M& h0 A0 [& O4 K+ z5 @
WinNT) with the CreateFileA API.( U" p  `% T1 l) O- A2 S3 R8 N, x7 p
( V+ Q! i" {1 k5 Y% G
Here is a sample (checking for 'SICE'):8 B. p$ ~* R* t, k/ O5 I% r
1 w! r5 R9 u. ]$ ], j: E. \; K
BOOL IsSoftIce95Loaded()8 b( J; ~, t1 ?5 w* k  u! r
{
/ W" z0 o) n% A+ M   HANDLE hFile;  
( _. r" ^( B- J   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 M* b9 S& g7 x' ?+ U                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 n% {- j7 _5 O* a6 z, q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& L/ [6 Z6 r3 P. t
   if( hFile != INVALID_HANDLE_VALUE )) B* Z, s+ s# e3 S8 q/ V' S
   {; Z+ L4 ^3 w  ?8 `! ?$ m5 M
      CloseHandle(hFile);2 [% o: }1 k2 {4 g) k9 A# n- l+ z; G
      return TRUE;: Z/ w' V) v7 u
   }
; M5 C% z: E3 \. n& i9 r4 q0 c: ^8 e   return FALSE;' U# `; @/ v! L. z
}
; y$ g; C; r' P8 s, Y8 D, u+ g" ^0 K8 Z6 F5 s
Although this trick calls the CreateFileA function, don't even expect to be- Y) G* e' z' @
able to intercept it by installing a IFS hook: it will not work, no way!1 ]. W% U7 b- B3 M% f: S! A6 O
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
" Q! S2 t; @: H! ?' _& {; _service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- d3 J1 `3 A' J- S6 L5 I
and then browse the DDB list until it find the VxD and its DDB_Control_Proc; B, ?8 w8 Q9 D0 _* |
field.
  Z/ G/ o' ^8 {# T5 H' V4 H( ZIn fact, its purpose is not to load/unload VxDs but only to send a
0 m* Q* \+ \# K. ?' `4 v; W, BW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  t9 v! X5 ]& z4 U$ p8 x
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 c5 D; x- f. @: Jto load/unload a non-dynamically loadable driver such as SoftICE ;-).
4 a1 p0 ^: `3 ~" E% xIf the VxD is loaded, it will always clear eax and the Carry flag to allow
/ K8 e# w; ]% p1 |) Mits handle to be opened and then, will be detected.
- [6 G3 H6 t8 |3 G5 p5 ZYou can check that simply by hooking Winice.exe control proc entry point+ A5 W! A9 L9 M& I0 B
while running MeltICE.
+ L: f. n" E5 [, S5 p
1 V' J0 p  y& R# c7 j" o+ {# I) h
6 V! }: s" B% G0 }1 @; z2 _7 \  00401067:  push      00402025    ; \\.\SICE+ M- R; }% ^4 N; C) u
  0040106C:  call      CreateFileA
6 K! Y5 n( Y" [; k: r  p0 j  00401071:  cmp       eax,-0012 P$ X: K$ q) T* J& A% _% {# `
  00401074:  je        00401091  W4 {, R2 b+ v7 q  C

, \" y9 J3 T  v3 e9 D
1 S" K+ ]; B% P# W8 tThere could be hundreds of BPX you could use to detect this trick.
) D9 ?7 x8 Q; E, o7 f7 q" n-The most classical one is:
' t. v6 a& M4 o# H  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||, O* h3 x! M9 D* ]& }
    *(esp-&gt;4+4)=='NTIC'
  J  H( ?- {( z1 u( y& L3 x3 _' {1 U% u+ S
-The most exotic ones (could be very slooooow :-(" a" \/ `  a& r. l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  1 v- _* A0 h& x: u2 @
     ;will break 3 times :-(( p# P3 ~- H6 w4 Y% ~

& N& b. F& R! a; F-or (a bit) faster:
! e3 }$ W/ Q  d" W$ V! U   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 a4 S( _) x( ?1 ?. y8 x
/ I8 N3 t) h9 Z0 E8 @# i
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 D4 f+ H$ U) }& @     ;will break 3 times :-(
+ c" Q* P4 d% h; G
, F! v: |$ r6 p: j-Much faster:/ v9 g8 D- Z- s" g9 K5 O
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ p8 K8 w$ F; T1 N4 @. T6 W/ H* |: b$ [2 G8 K) u5 w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen1 d# ^3 x2 K! ^6 E) U; R( ^. G% l
function to do the same job:7 d( L1 }3 f, o1 [6 ]! L
) J; i" r1 j: Y% U; r# r
   push    00                        ; OF_READ6 h0 g  k% |$ c5 \9 p. A1 T6 H
   mov     eax,[00656634]            ; '\\.\SICE',0. E0 e$ O" G, t
   push    eax
! N5 N! D% S5 d( Y; C0 F   call    KERNEL32!_lopen
* q2 s2 [$ I+ h4 @5 F   inc     eax
: i1 ^3 Y0 j  v   jnz     00650589                  ; detected
* j5 V; x+ l8 A& b' P; a+ J/ k   push    00                        ; OF_READ  e' Z- T% s+ |- \) q2 S' k7 u. {
   mov     eax,[00656638]            ; '\\.\SICE'. F+ B) z/ m. Q7 |; p! e, J
   push    eax) f/ U0 c$ F  ?1 [  C1 f9 G4 |
   call    KERNEL32!_lopen# R: t% o5 ^  c/ Q, _
   inc     eax7 U+ {/ d2 @, J) D. n
   jz      006505ae                  ; not detected) ?1 A, z. q5 E' r+ e5 U
; K1 p0 D9 l& j( f) f

# e; c. u7 D0 M9 {  h# r  \__________________________________________________________________________  B- Q: K0 q6 R' t0 P5 o
: ?3 j! a# Q! c
Method 12
  k8 P0 Q! z/ S0 F; \! ?1 c9 Z1 W1 g=========
. v- _) I+ V' E. k& I( c
; R9 F/ l* N( L' DThis trick is similar to int41h/4fh Debugger installation check (code 05/ U, a3 r9 y8 o
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% X: }) ^) l( ?& R. k
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 ?9 U4 I6 c; g( ~! N2 q4 w6 e0 T  N  d& f" K5 W
   push  0000004fh         ; function 4fh$ N1 Q2 k/ }+ g% o' g0 m, e
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 V/ r8 I7 l4 z  x  a. W
                           ; low word specifies which service
7 H* A9 `, ]' b: O) y& C                             (VWIN32_Int41Dispatch)
7 g# ^8 o+ O/ n- b1 ?4 n   call  Kernel32!ORD_001  ; VxdCall; Y1 h4 \0 b7 D1 f: ?% J: r& `
   cmp   ax, 0f386h        ; magic number returned by system debuggers3 a2 l& v7 S+ k( Y& y
   jz    SoftICE_detected2 D! m' v5 w* h

2 R) V! s% k3 k' H2 {1 K: v& DHere again, several ways to detect it:
0 t! H( I- n; y% Q% [7 ^+ \# L' x, u4 J
) j0 q) P' B8 _( T. i    BPINT 41 if ax==4f- S1 l2 W: r& a/ G* v8 a) J# e2 ]

1 [; K& m# ^7 M) o    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 V. L1 E4 b1 B; ]; N3 }, q9 P$ N  K8 R( f  ?
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! R: ~; M4 M" F# E- a7 x( V
$ ?8 _( s- j' \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
8 Z5 C# L& e, U8 v/ Q& q+ J8 N1 W" f' z+ W# m/ z6 p
__________________________________________________________________________
7 c$ h3 t0 S0 }2 r& G2 a# P7 h4 l
Method 13" E2 A; Q. c9 C$ k$ f" r# ?1 z& T1 N0 \4 M
=========5 h' \. y! s5 O2 E: L  `

% p0 I' _" K2 r8 c2 V% d  JNot a real method of detection, but a good way to know if SoftICE is
$ i7 M0 Y; e8 v& p7 K; Qinstalled on a computer and to locate its installation directory.. [6 ]; H/ X, _6 ?9 N
It is used by few softs which access the following registry keys (usually #2) :5 a8 c9 a$ o8 U* L) w1 b$ C) b

8 K2 L* R( Z- k, A-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 w' k1 {; b: {. i: g. s7 B& g\Uninstall\SoftICE
* @; t" n- ~8 m0 p& e-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
1 ?/ ?* w* D+ u& C/ ~2 ]-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! q) V$ Q. ^% E/ J. P& K
\App Paths\Loader32.Exe) X2 b- X$ J7 V; b

1 Z& \; f9 |( T: h$ F" i  i5 Q. Y2 e' I0 j5 M1 b$ Q( U
Note that some nasty apps could then erase all files from SoftICE directory
6 k1 v+ x: M, C8 E$ r: u2 P(I faced that once :-(
+ d. U/ ?, J6 Y- |$ K! J  k) `" p0 S
Useful breakpoint to detect it:
4 _2 ~; h1 j7 Q
; x" `3 f+ K/ @# s  z, c  K" C     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) Q/ B9 T6 Z0 M8 [  u3 r4 J3 S% X$ n! T% O) x: ?5 u, b
__________________________________________________________________________& V4 ?8 S8 W! D

6 o8 P5 L0 F. a; }. l* R+ s
& s2 H* M  s/ d( \* {" ~Method 14
) V, z1 u: C: V- t4 h" M=========
9 ~1 ^2 i0 S( W$ I: }$ i- k( I. E, F; C( o7 a, v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% X/ p+ ]2 z  ]7 S/ }is to determines whether a debugger is running on your system (ring0 only).2 y% j1 q) D) `3 W  b1 U/ r
+ B  k0 h! @6 r
   VMMCall Test_Debug_Installed( q0 o# f4 t5 z( [/ p
   je      not_installed' u7 [% X% `: E& F+ R% x
, X5 G- L) G5 E/ H0 t4 D- g
This service just checks a flag.
6 ?- t( ~6 l, a2 n! B) F5 h</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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