About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>/ J2 Q# d; w* z
<TBODY>; ~& e) a  \9 g# [! c/ [( @
<TR>
1 d( k7 \8 J: y1 h. x. L; p2 @<TD><PRE>Method 01 0 b( i9 h1 ^  v
=========
8 `3 ]2 `0 \5 y+ c* L( f5 K) j$ G9 z. C
This method of detection of SoftICE (as well as the following one) is3 I* K  y0 {( y: b( B
used by the majority of packers/encryptors found on Internet.
2 [/ @' [. z8 G$ q5 z' E; bIt seeks the signature of BoundsChecker in SoftICE
& E) D7 Y% M1 S! N4 g
0 m" e; V% |1 r    mov     ebp, 04243484Bh        ; 'BCHK'
4 G( r  B" E1 x/ u% g* c4 h    mov     ax, 04h
( o; ?! m; w2 M/ Z% ^    int     3       6 j4 u$ F; p0 W4 c- ?
    cmp     al,4* A- S4 f$ a8 ^. }0 W' `8 U" C
    jnz     SoftICE_Detected
6 o$ v3 O6 A8 k8 L& p
- x8 A* N# K: }8 z' Q3 F/ S8 n___________________________________________________________________________
' l; l% K4 S$ ~1 m) y' K: U( Z/ k9 i+ W, G
Method 02: w. g7 l6 X* u/ v6 i( `
=========
' T6 u% n0 Y/ B) ]5 n0 i
% o. H+ v! h& F# S! C4 c) }Still a method very much used (perhaps the most frequent one).  It is used5 }" i# \% ]( U; s5 V2 P
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 ~! n( j8 L$ r  V7 P, aor execute SoftICE commands...
1 C. _7 ]' B* A# x6 \: hIt is also used to crash SoftICE and to force it to execute any commands8 c9 l2 w. \- Z7 ~
(HBOOT...) :-((  5 }" n& i) G. }+ G- Q
0 j) r5 T6 H6 \8 Y
Here is a quick description:
8 r: H  k1 m6 p9 A1 F8 Z5 U* Y# ?-AX = 0910h   (Display string in SIce windows)
) P# @. e# Z* V-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): N) k/ J8 \& }. I' o
-AX = 0912h   (Get breakpoint infos)5 E- r% Z# |0 F; j
-AX = 0913h   (Set Sice breakpoints)
: O4 _8 S9 U0 m2 \8 {-AX = 0914h   (Remove SIce breakoints): b3 ?" [  Q) ]; l6 I& w

- J+ d0 ?7 F7 FEach time you'll meet this trick, you'll see:
( }: G: @( r4 m- d; l( e-SI = 4647h: s; C0 P' j- c0 F
-DI = 4A4Dh
# ~1 L3 ^$ m# s2 H8 j5 ~# qWhich are the 'magic values' used by SoftIce.
  K2 z  U1 j5 x6 [: FFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: f6 p* L+ k! k$ M: M( W
* T/ V# G, ~; X+ }* EHere is one example from the file "Haspinst.exe" which is the dongle HASP8 W8 f; {" ~; O; f8 f, D/ F6 R6 J- Y% }" |
Envelope utility use to protect DOS applications:
5 j6 D% u/ g' Y4 }1 l" J( {( M( H) [
. n% ]# F- u3 C
4C19:0095   MOV    AX,0911  ; execute command.
" S* }! m' Z( P4 [4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 [) a) V' {' D4C19:009A   MOV    SI,4647  ; 1st magic value.$ o1 H* k) P# H. h5 w
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 D) T$ z! h3 _" `! a8 b! n8 G4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' n- [% y1 P# Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ r  L3 P, b& A" P- c# ?/ q6 d
4C19:00A4   INC    CX  {& \8 `" `! ~8 j5 X0 o0 q+ \0 v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 z9 ^! ?& |: v8 ~* p  L4C19:00A8   JB     0095     ; 6 different commands.# n3 e- }  P) ]8 b5 A4 p# M
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  Z( b! t6 ?& E4 K6 {! G
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)) r: _7 P8 e8 H6 O+ T* F' }3 d6 [! V
& b1 a6 `/ _; Z  U- A) ~
The program will execute 6 different SIce commands located at ds:dx, which
$ Q' Z8 @3 e5 y9 e8 {, Kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ i7 ]; `0 Q$ Y: e; p
% Q+ D( z7 j- B$ {9 e" x* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.4 x" `8 F5 ]; s: {2 K+ {4 b
___________________________________________________________________________" m, c+ p* f0 ]" P: V, Z# ~3 Q1 W

! ?- I# E: P; U* O0 I' @" V7 Z
2 X; C8 q3 Q! F) z8 o0 u0 DMethod 03  L& O1 t2 q6 p: h1 s+ B* y1 d
=========
' g" x; [. ]  {% i0 f6 f/ n5 P3 h) [5 a1 |
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" d( J+ J. b1 Z# N  `
(API Get entry point)
: O# t1 p7 g! m5 E* f: X7 F, U        
; F" l' b! ~1 m2 t) S
$ h& e" R, E, R5 S. K4 p) N8 `    xor     di,di. ]+ G. `: D8 Q" I0 D, T& H6 y& x
    mov     es,di! n5 |! K- t# }( ^# R
    mov     ax, 1684h       0 h; H" v4 n/ y. A) a8 m
    mov     bx, 0202h       ; VxD ID of winice4 u6 R6 V9 V; w% G
    int     2Fh$ |$ {" t& C/ i  F, [4 _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 g9 r" g0 s9 f* K3 Y
    add     ax, di: o) m5 _) e: Y# [# g
    test    ax,ax$ Z! b2 t9 p- k  P8 }
    jnz     SoftICE_Detected0 O2 L! U# m; a1 p8 Q0 ^2 X4 m6 u

: K* @# _: `. Y" K___________________________________________________________________________! t! ^' x0 p) }1 m9 n( S8 n* `
9 I8 G; \, o- ]
Method 04
; s: W% i4 u9 R. C  g=========( `( Q: |- d/ w8 I# M& l

- N2 V0 @0 J2 H4 V9 H/ I6 a8 yMethod identical to the preceding one except that it seeks the ID of SoftICE
9 T# v/ n# Y, m5 V" L' r- x, u/ V4 HGFX VxD.6 |  Y5 `+ P1 z5 h5 M

9 c  [3 R( W0 y    xor     di,di4 f( U$ Y& f' C. b/ x
    mov     es,di
0 ]. j6 i3 B% K* P    mov     ax, 1684h       ! c! c) {8 d" _' Q, H0 ?
    mov     bx, 7a5Fh       ; VxD ID of SIWVID' U* t6 q4 `9 R" y- B8 U
    int     2fh- O& l% c7 o, G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 L' \- m8 f9 u8 T7 Q3 i    add     ax, di7 C* C8 @" w3 S
    test    ax,ax
9 }0 n# E5 {) f8 I. M, M    jnz     SoftICE_Detected5 Q0 Q$ t* _7 j5 E

* r; e1 x. J. a1 _6 q0 u__________________________________________________________________________
% ~9 c# {3 p3 s5 b1 M: |3 p( X2 {1 H4 \3 |  p" {5 o# j
, ?5 W& {$ G& Y3 `9 J4 x/ n& R
Method 059 W$ q; z1 E% j5 R2 s
=========0 w/ a" ?1 _6 |; v) y5 n0 v% m8 z  q* O
& s# y' a" [, ^3 x1 [
Method seeking the 'magic number' 0F386h returned (in ax) by all system
8 Q6 m8 t+ x+ O" b$ ^' |debugger. It calls the int 41h, function 4Fh.
0 X+ J# i; i% }: a1 OThere are several alternatives.  
2 S, U! ~( \, |: X$ a, h9 e. L* A9 }1 R/ U4 E
The following one is the simplest:, k' e! C5 Y5 W7 c
+ j& @/ [7 j4 N9 N: T  n8 Q0 l
    mov     ax,4fh* m6 A! Q1 G1 Y3 T+ f( A5 K8 |
    int     41h
7 S% C9 @3 s0 I+ n/ c. Y    cmp     ax, 0F386. b$ N1 [& z" I9 }
    jz      SoftICE_detected
9 t1 P0 f* d8 U* [, L( ?! F" N# t3 ?; H/ E$ P: r
6 }8 S* V$ J5 _: j; i
Next method as well as the following one are 2 examples from Stone's
8 b( a3 }. t% M5 A/ {"stn-wid.zip" (www.cracking.net):7 i3 P, ~. Q) O) r$ ^0 Y$ E. v+ l
- B: _3 b2 h. L: {2 T, j: y
    mov     bx, cs
, X. ^) p2 o, J3 s4 J    lea     dx, int41handler2
# `' ?2 x1 D/ s! Y8 E2 y    xchg    dx, es:[41h*4]
% T( Z1 Y* n& i4 z    xchg    bx, es:[41h*4+2]
  r( q- d. P& E5 v+ S    mov     ax,4fh& c0 c1 _7 A0 X  Y! J6 S, q
    int     41h4 q5 B8 g: J5 E" Q& n# i
    xchg    dx, es:[41h*4]/ m1 p4 {# p1 @4 W' E
    xchg    bx, es:[41h*4+2]( k1 A  u& B- v6 R6 P
    cmp     ax, 0f386h; C: |' E& }- n, M2 g* e- p
    jz      SoftICE_detected
! a% F) o' @, n: y! |% z0 k) Q& ]% P; i! A* J  C+ J
int41handler2 PROC: h: t5 T8 n* l; i& U9 l5 f
    iret6 ~2 F( d- ?( [8 f' A
int41handler2 ENDP
! p- M% J, U/ O+ R* E# n, {5 e. Y. z* g( ^1 a' {
" r$ t" [9 ]8 C1 z! u. k
_________________________________________________________________________- x+ @; i( ]: w! q5 d

) b. u" G& h  M$ w7 t8 B
0 Z; v/ s! l% h2 Y% VMethod 067 L" d: j, e" v) s9 y
=========- Q" w) V' h; u$ q
0 h; ~- d4 s7 E! {
  Q( K' Y9 y: [* |: H
2nd method similar to the preceding one but more difficult to detect:: Y* p! x+ F# `; \9 Y

% ^) z+ j" ?- w) Z9 ?- o
2 I+ c$ E/ e" S) O  ^6 Mint41handler PROC
1 X6 ^  h4 X9 d$ ^5 _9 h+ z+ y' Q    mov     cl,al
& [3 k( Q7 w  `, v! h* I8 u    iret
9 h# w) r$ e. I: fint41handler ENDP
' ?$ n, p1 n8 y/ G+ S0 o- M! p; p( j# ^8 w: g: a0 f
/ `% R% i- w# y, ^8 w; P  l
    xor     ax,ax
: _; P$ x  @# ]2 U4 R& Y    mov     es,ax
, @" `) E3 `- b( X- C, S+ X. ~    mov     bx, cs4 x+ T. K( S/ W" H6 z
    lea     dx, int41handler
$ Y8 \+ t& @3 N3 m: C5 i# Y5 G    xchg    dx, es:[41h*4]
2 z9 B$ Q! S/ k' s0 K+ x4 a    xchg    bx, es:[41h*4+2]5 V  c1 W+ z# G0 T% X1 ]
    in      al, 40h  a  L  K2 n! t7 ]
    xor     cx,cx# f  o/ O+ b& k, u5 ]: E
    int     41h. J- \* _$ g1 [  x; W7 M7 q
    xchg    dx, es:[41h*4]
! z6 y5 k: Q5 t) i    xchg    bx, es:[41h*4+2]
9 a( E$ X5 _; o( ~  m    cmp     cl,al$ C6 P4 o: E% N" t/ t3 H' E& e
    jnz     SoftICE_detected, ^( S8 o9 f  V/ `

. h, [$ B' i! i' h4 ?# |4 n, u_________________________________________________________________________1 y9 W6 x5 a  `2 R$ U3 X" A) o0 l

9 M" C" N& Q; _' r% aMethod 076 K! W6 G6 ^/ P  [
=========8 k* ^( T, I% t, k8 I8 a9 n

& p) E" E- S0 V! lMethod of detection of the WinICE handler in the int68h (V86), M' _) F" s: o( {/ G- W1 |
" I: |2 V$ G: F3 e9 p  Q
    mov     ah,43h3 K# H* V5 p4 N0 v
    int     68h" Y% O1 H" E! i# [
    cmp     ax,0F386h) o9 F& r! R5 f2 r
    jz      SoftICE_Detected
0 a8 j' }5 R9 `9 K* J' q4 N8 Z/ a) d, ~% M& u- A
$ ]1 S5 Y; w, P$ d
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, a' V! }, `& U9 G5 d% O7 t
   app like this:
8 c3 M" J5 n+ \( \- r8 Q, o/ ]2 L2 z/ u5 K. y
   BPX exec_int if ax==68
6 F- v7 C9 ~8 ~- W8 m3 H+ ^& V! t3 h   (function called is located at byte ptr [ebp+1Dh] and client eip is" T3 k, l" r5 u7 c1 v
   located at [ebp+48h] for 32Bit apps)
2 G: k! S) Z7 f4 ]# a# E__________________________________________________________________________% g( q1 Q; @" I: |0 N. f- e5 n: n

% r8 V1 f% l0 |) H  ~
& ]$ s6 ?% `6 |, r+ xMethod 08) _# a- _0 @) L# y
=========5 E; ^& q' Z) S- \0 r6 k
( z8 {" ~; \* H: C/ h  |) P
It is not a method of detection of SoftICE but a possibility to crash the
/ T* Z) a5 n# g. Q$ Q3 d2 O# O3 G$ hsystem by intercepting int 01h and int 03h and redirecting them to another
2 M7 _( Z, D$ V6 r* zroutine.( H, s& E- f) L$ l# W& ~  V4 Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points0 i9 n7 r/ @$ C
to the new routine to execute (hangs computer...)
5 v- s% {7 ]3 F6 ]+ Q
2 ?! T/ A7 u; b: K    mov     ah, 25h
! P" S8 s3 y( @5 _% d7 f8 E0 ]% u    mov     al, Int_Number (01h or 03h)
- c" I" Y4 W' q9 I: L    mov     dx, offset New_Int_Routine
- Z9 U1 c( ]$ }5 X8 I( S    int     21h) Q% b& ?1 B$ @$ k6 _- A7 u

, J& k+ U  P5 _4 O& V! l2 @/ u__________________________________________________________________________* H) }3 t0 p1 y( w3 j
2 |: t0 a- l/ x& E1 F
Method 09
8 A3 [  P+ R5 C2 X* W5 g=========
& s( y1 `9 }6 X/ @. i
! v  O/ I6 z3 t/ sThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 W) x9 _, F& t5 G! b
performed in ring0 (VxD or a ring3 app using the VxdCall).
! N) v8 [3 p1 wThe Get_DDB service is used to determine whether or not a VxD is installed
% k. |& T, O& a% P. k3 x& p  Rfor the specified device and returns a Device Description Block (in ecx) for* ?: k7 P5 p( v$ l
that device if it is installed.3 v9 X5 }9 Q" P) ]7 L
, w' X% G+ f# r9 Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 D8 n! ^$ S8 b% ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 x  W7 z; l! g3 m1 P   VMMCall Get_DDB
' Q7 E( J( \( a   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 y* u7 y+ M  y. r, [
- e4 d8 `2 r- Y* u0 i8 M. ~
Note as well that you can easily detect this method with SoftICE:* V, y! p& [" B# H8 g
   bpx Get_DDB if ax==0202 || ax==7a5fh
' u5 A# h0 U+ g  @* \, a+ A3 T( L
9 e  w6 J5 E* _. r__________________________________________________________________________
" M- Z  H; ^* [5 L8 i1 b  d8 j+ X( f
Method 10
* l% k* i( t7 h=========7 E, M' ~) Z. ?" l- K5 Y" l* X/ Z

/ `* `5 ^; d- ~* @=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 u( g9 j4 d' Z: b$ K  SoftICE while the option is enable!!
  i& @  s0 k; F& r$ j; Z% _: |! }
+ ]5 J) D/ Q3 |' [This trick is very efficient:
( P% |& a( K# J, q9 cby checking the Debug Registers, you can detect if SoftICE is loaded
4 `- B/ S( T: c9 n(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" Z- s" ]& f# n( H! w: H' Pthere are some memory breakpoints set (dr0 to dr3) simply by reading their
$ n! Z. W. G. N8 p4 bvalue (in ring0 only). Values can be manipulated and or changed as well5 S- v3 E4 g. Q
(clearing BPMs for instance)/ q$ M6 F) B3 k

& c5 ]# |% n3 I9 ?) |. i1 H__________________________________________________________________________( v( ~  {4 C+ V& f

* _5 @$ W+ g% y5 HMethod 117 |  B- E' k: L, ^" G
=========4 A+ P/ A& L) ~' W
3 J2 T! S+ V3 y+ N( V, A$ s5 n: e
This method is most known as 'MeltICE' because it has been freely distributed5 u' B) U6 F9 W8 g. _; Z; S# ]
via www.winfiles.com. However it was first used by NuMega people to allow
) [$ Q1 v5 c" q* x2 R; p+ WSymbol Loader to check if SoftICE was active or not (the code is located
$ O1 S! m6 q8 Oinside nmtrans.dll).
+ i( t- G0 m8 D1 n! i, t9 b  R" E0 e. ?0 B4 Z! p7 }
The way it works is very simple:" F. e8 {" n2 _+ ]4 E& y+ j' ?
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# ?7 p% v4 L) s' x1 [
WinNT) with the CreateFileA API." V3 {) Y3 m* ?

8 i$ F/ W* F6 l5 a  R' ?0 UHere is a sample (checking for 'SICE'):
, g! U( I. c1 w( |7 d% `$ S
# t7 f) q% u% y6 y! C. A/ FBOOL IsSoftIce95Loaded()
9 V& L# y" g6 m2 N{
' h% z6 r1 H) v# S7 n: Y, ]   HANDLE hFile;  , W3 K1 C( O" k3 B
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,, I3 K% ?* G9 ~3 n
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. p" f4 b& v7 i1 u; T, W* T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: C% O. V% X7 y. Y4 `. [1 t   if( hFile != INVALID_HANDLE_VALUE )5 v% q- a! x0 d  n' Z
   {
2 y# I! L( C2 H# W      CloseHandle(hFile);
( e6 ]) }2 C" ?      return TRUE;
5 {( U- n, K+ {* ~9 O   }$ ^8 j' _: w2 M- s& s3 x% }9 I
   return FALSE;
1 q+ l" g, }9 p0 L6 U+ U}
& e8 ^& W: {1 q$ [
' `( {. n) H$ h0 A6 F/ ^8 oAlthough this trick calls the CreateFileA function, don't even expect to be; K: L0 O4 T  y
able to intercept it by installing a IFS hook: it will not work, no way!" u1 T4 |& L9 g9 K; }; {$ \# G- F* h
In fact, after the call to CreateFileA it will get through VWIN32 0x001F- f: W8 g/ b' X- t5 W9 m
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& x( @/ W; P- K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" o; a2 j9 O% V. T7 M( rfield.) x# t8 a; h6 ?5 S  s0 Y
In fact, its purpose is not to load/unload VxDs but only to send a
$ I, v1 e' Z9 w7 nW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* [7 @* K1 l4 p. B' `to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ E* l, d! N' F
to load/unload a non-dynamically loadable driver such as SoftICE ;-).# _! i9 X5 k9 ^9 Z& @4 s  N8 X) j
If the VxD is loaded, it will always clear eax and the Carry flag to allow2 ]3 e( F6 Q  r6 z( E7 ~1 l3 B/ R
its handle to be opened and then, will be detected.
" J. g: {! y+ h+ ^- FYou can check that simply by hooking Winice.exe control proc entry point
' Q( i# S: g8 v3 j3 C6 m& |  jwhile running MeltICE.1 B, o! |+ a1 |: c' ~6 R% y
. w/ O% a7 K0 D' p! r

2 L: v3 |, E$ c6 C% ?9 q' @0 E: }  00401067:  push      00402025    ; \\.\SICE
% @, T6 t- _8 n3 \* |  0040106C:  call      CreateFileA
6 M7 h6 l3 X+ Q1 H* u6 O: k  00401071:  cmp       eax,-0013 R2 g9 Z& Y% I2 ^% e/ G) V
  00401074:  je        00401091- r7 k9 W. @7 p) |, h; w3 l" i4 D

- N( p% W+ ~, z/ k) ^+ D9 W/ c  b. e! C: O  c
There could be hundreds of BPX you could use to detect this trick.
8 P, A8 w% H0 [, D( C% B-The most classical one is:
& l# x1 l* L6 N) j3 I  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" D4 Z* O; N4 y7 E4 ?8 t
    *(esp-&gt;4+4)=='NTIC'
3 L, x  Q$ ~; Z4 ~  T6 H0 h9 M4 x$ U. p# V5 [  f# G* [
-The most exotic ones (could be very slooooow :-(
5 Y; X  J) H' f$ E: p8 |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / P; f  ?0 x8 Q
     ;will break 3 times :-(
" T6 f( ~  R) u5 _- U1 _: C* @8 X$ b% K+ P( q: F
-or (a bit) faster: 3 `6 @/ x$ F2 l
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
% ^0 g/ q& \* A0 ^5 q
+ f- p* |1 G1 d7 ~   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- C) K6 Y. E% D( Y     ;will break 3 times :-(
1 @7 v9 Y) q7 q+ Y1 j- m
, |+ {- ]2 }8 x) K1 s$ F7 R) M2 K-Much faster:& {$ N3 X% x+ r, V  u5 d- j$ U
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 w( r9 ^6 n5 ~0 q' I8 e$ n

' Q3 `( @: O/ E: S" z( t8 X3 |Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
, ?8 @" E. N. Dfunction to do the same job:* L2 }$ I8 q  W5 u5 Y' r" D
( r8 W) P8 i4 n; y! L3 _
   push    00                        ; OF_READ. H% K- K2 [) j  P/ }
   mov     eax,[00656634]            ; '\\.\SICE',07 \* D. z3 C0 S
   push    eax
3 S* U) I8 v4 u1 Y4 m1 U! P   call    KERNEL32!_lopen( U1 b- v! Y4 W7 @' B' _1 S
   inc     eax
6 C0 d0 _0 ]1 z6 P5 u9 {9 J' s   jnz     00650589                  ; detected8 S# Y: z. N6 {) ]9 S+ w7 n
   push    00                        ; OF_READ
- f. t) i: \! |4 g1 A" g: u   mov     eax,[00656638]            ; '\\.\SICE'9 F9 i! H: @+ s3 w9 l9 s0 C7 |" m
   push    eax8 K! w2 B! V7 J
   call    KERNEL32!_lopen
( q% p& |7 }. q! _   inc     eax
" u  V) i5 u1 ~& [/ X/ p   jz      006505ae                  ; not detected
4 _9 h5 T8 _: h, F$ D& y, n6 N
( w7 r" U/ r, s
+ I5 S# t& k2 r) \__________________________________________________________________________
& J: b) @" D, X; k; L% q* E! \  X# Z* o/ z
Method 12! b. F& X# H* o8 W( T) A
=========& e/ H, F( `. ~
# H5 o5 s( ?' y1 U9 R9 b, M
This trick is similar to int41h/4fh Debugger installation check (code 05
3 u/ U/ c6 x& W* T9 u, ~6 H&amp; 06) but very limited because it's only available for Win95/98 (not NT)' ?: U& |- w" L, F. k% g- T
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; v; U. n% q0 y1 V$ S
5 ?1 b8 E2 C. U& Z7 G   push  0000004fh         ; function 4fh/ A+ [- _- g  p% \1 O& C
   push  002a002ah         ; high word specifies which VxD (VWIN32)! G4 E4 w( y( k6 }9 \& q
                           ; low word specifies which service
4 e' y& ?5 l; k4 j% m                             (VWIN32_Int41Dispatch)) ?2 p8 ]- q1 ]4 k4 V
   call  Kernel32!ORD_001  ; VxdCall
. f: |  v# _" u, }5 o9 y( _   cmp   ax, 0f386h        ; magic number returned by system debuggers0 Q+ n4 C8 K# q7 f  h- V. ^
   jz    SoftICE_detected
) o+ w+ U$ B4 ]. [! l# b$ H6 \
8 a* D$ O+ {1 ^Here again, several ways to detect it:4 G) h. g- ^% B
6 n5 E( V7 O9 U& ?
    BPINT 41 if ax==4f2 @( p6 ]4 c% @" ]7 r
) Z- c. }5 T* J/ [- S' C* R
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 V' }  }) I: R, M" |2 ]8 q
) j! U) Y4 j4 v% H2 ^: K    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 }# Y. |$ g2 j! Q3 I# Z; S+ S
' h. N1 b" b  ~; x2 \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 f% M0 H( [/ P$ q" G8 s

( o( Y3 U# M1 J) X__________________________________________________________________________4 z4 i6 _+ ^# J% v

7 P4 i0 t1 ?+ u; DMethod 13
* X1 K  b; T6 Y& t: ^=========
1 M7 G$ Y. @% n5 w  _& Q2 y( C* C! J2 a( p2 w  x8 I9 c
Not a real method of detection, but a good way to know if SoftICE is
- |& ^, @8 t, O1 n+ Pinstalled on a computer and to locate its installation directory.! u) d  X& F7 o! q5 ?2 x
It is used by few softs which access the following registry keys (usually #2) :* `# I' O1 D; y0 t' K9 G

$ }" Z2 E& c1 w* e8 g-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! }" Y5 e$ ~, _, Y\Uninstall\SoftICE
, z2 F7 `: U# \; M+ q+ n7 ~3 e* @-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# i, l) _) Z1 w# d  m
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% G6 t2 W) Y, @7 S% i
\App Paths\Loader32.Exe6 [. D& D' {0 ?6 s

6 t9 @3 u! k; ~. N  W9 a! e! \# J; u0 o9 t% S0 @  G0 g# }. J5 i
Note that some nasty apps could then erase all files from SoftICE directory+ w+ Q+ a3 |" X7 p0 p3 H
(I faced that once :-(3 j- V& a, r, g% [6 S. {! L
0 R3 W8 h/ f9 M) Y+ `# V/ t
Useful breakpoint to detect it:
9 ^9 ]% I, T+ N+ M6 r! M8 z6 Q) {( G( j* x2 q6 r
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', H' ?! \7 Z4 `$ A

& R+ N  l, S5 @, w$ n__________________________________________________________________________  Q" c5 |* o+ p# c& K, T
1 ^- L+ }: ^5 M. d3 z& M
7 y1 H+ J% J9 v6 c8 I2 r
Method 14
  Y3 N" N' q9 ]  [1 y8 M' y$ w=========
1 V: D, X7 I! r* }
% {4 f) g1 Z) R9 T6 G, _A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
- v$ m8 R) f) W, N0 q$ y- p/ fis to determines whether a debugger is running on your system (ring0 only).
( R& `* E& y$ ?2 S6 w) }5 |
! r; B# o$ A, A8 O- N3 i   VMMCall Test_Debug_Installed3 L$ m% g; y1 J2 Y' v; F
   je      not_installed
; _% m& X3 [2 w- B' @2 ^1 H
. F* G8 ]) }0 CThis service just checks a flag.
$ m0 k6 x/ ]# l$ X- N</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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