About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( x! P6 d, g& }9 D7 U<TBODY>3 Y% h( z! ~! s. m
<TR>
" ]( h) c7 k( O, t. l8 z4 t; A" t4 P<TD><PRE>Method 01 * n' L; G2 ^$ Z5 o5 L& M0 D
=========
; [  Q% ^+ r; j9 C6 O4 N+ V& _( d4 D% p
This method of detection of SoftICE (as well as the following one) is
6 g; s2 a' }2 Iused by the majority of packers/encryptors found on Internet.
) m- Y6 Y7 e2 v" N' ]It seeks the signature of BoundsChecker in SoftICE, q) E1 s" j: ~$ i! I" H
8 l; @  Z- w2 B6 Q
    mov     ebp, 04243484Bh        ; 'BCHK'
4 V* D, u/ M8 s5 P; o- \7 h5 w. i    mov     ax, 04h, j) q. T  [8 h$ v* \# c# z
    int     3      
# M' A0 G) C  k    cmp     al,41 D) p; P( q6 w0 D# J/ H
    jnz     SoftICE_Detected/ ]: @# u' Q& j
2 {0 ]4 x2 t+ \& [8 n
___________________________________________________________________________2 I% m% p! L/ K( O) @

, L+ O$ i" l" G% \& iMethod 02
0 X/ ]+ M7 B5 |=========
7 o6 @+ F  O  z; f: v3 T  L8 s
Still a method very much used (perhaps the most frequent one).  It is used
/ S. R; l2 q$ T) M$ V. H, |to get SoftICE 'Back Door commands' which gives infos on Breakpoints,- T: z# o5 c! ]4 ~
or execute SoftICE commands...
; l9 |8 ^9 |0 X6 m8 u, kIt is also used to crash SoftICE and to force it to execute any commands. m* g. U6 g; A+ g' \. h  ^
(HBOOT...) :-((  3 y5 s5 K- B3 P, R) _2 A% i! q0 m
! C7 L7 A9 e0 ?" q( C* c
Here is a quick description:
# q  Z) ?$ Z+ d0 B+ ^-AX = 0910h   (Display string in SIce windows)
, ]+ _+ f7 I1 l# M' P" T-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- x" s' k1 _; L" z1 w
-AX = 0912h   (Get breakpoint infos). X  K' O! p% H9 f) O% H  [: k3 q
-AX = 0913h   (Set Sice breakpoints)" P2 q& Q; J) n) v
-AX = 0914h   (Remove SIce breakoints)4 b1 J& D% `' M# G( v
& u" u% Q8 L! @; t. p; d" P+ Z
Each time you'll meet this trick, you'll see:
. t. Z/ F1 M. |-SI = 4647h
( H6 w' E# b/ W; o/ j9 N, S% s-DI = 4A4Dh; ]0 ]5 |' w. I6 Z4 D% L3 x$ e* l3 H) c
Which are the 'magic values' used by SoftIce.
* E1 O4 z1 \/ b% q" ^& ]For more informations, see "Ralf Brown Interrupt list" chapter int 03h.$ G' b4 B1 N! Y5 t

9 T/ q; Y$ B- k9 NHere is one example from the file "Haspinst.exe" which is the dongle HASP
  w' e! c; ~% TEnvelope utility use to protect DOS applications:3 L9 f9 a: H, j; G

" z) q. {  f" ~% @+ B* ~8 L0 V5 u# w0 M  t# V! ^
4C19:0095   MOV    AX,0911  ; execute command.+ T! Y3 L6 U& t$ v
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
% M1 D! j4 `' \( U! N4C19:009A   MOV    SI,4647  ; 1st magic value., B- F9 S" ?9 @& m0 b+ Z$ r; b
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
7 n# H# ~. w' B  }& A! R' |4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)/ U/ M% a/ l1 S- z, K
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
. Z9 K7 H9 I' u3 \* ?$ X4C19:00A4   INC    CX* r. z1 s) s/ L9 h$ {( q
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 I$ j2 B6 `7 ^# K, A
4C19:00A8   JB     0095     ; 6 different commands., t" y, {3 x5 x# x/ D
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- V' H4 g$ ~; I' g; Q5 F2 J
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 O, G: j# `7 X9 w4 l8 ?9 h
% O1 K% y+ y6 q& i; VThe program will execute 6 different SIce commands located at ds:dx, which7 Q) v% w0 u) b& K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ y, D7 j9 ^2 k: D& \" e" g2 U! |. g7 `* {' H4 {
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 o4 F( f) B; l9 x
___________________________________________________________________________6 g( I) @, c0 D
6 s! A# I6 h0 G) P

' p. r3 q& H. Q/ l0 ZMethod 03
/ u) [2 L8 J, C2 C=========  _2 \- N0 g8 ^# Q9 e* f. w
7 c: s6 I  x3 {, Q/ b3 \1 d2 s1 Q! u
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 m0 p2 ^  Y% a$ D* [(API Get entry point)8 c9 I; j; e( Z/ O, F+ a1 t* {
        
! O, K( v0 M0 M! N; e) j/ _+ m0 E+ F/ w0 f$ h: m# q
    xor     di,di) X+ @" `0 G- z7 `, {+ T
    mov     es,di
! {& C" n) |4 z4 T3 ^    mov     ax, 1684h      
. E/ W; I8 X9 `; q    mov     bx, 0202h       ; VxD ID of winice/ \/ w  ~# l. H7 u" H
    int     2Fh
- ]! X3 V8 _. b/ I. H& c    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. D  U1 v. |" ]. a2 p1 ~2 K2 W' R    add     ax, di
1 {. C7 M% U/ f5 n4 \    test    ax,ax
6 d% b3 w1 z# r+ \1 }4 A: [    jnz     SoftICE_Detected' B5 w: R3 o' j, E! q

, p4 ^- ?) C1 A( z' r___________________________________________________________________________( Z. C0 E5 E+ k! b1 p4 c( J& d

7 m: i: B0 k5 h% d" hMethod 04' H0 ?9 W) t* B' w$ ~4 s# N
=========' q0 X' x, d% U- C
( e' ^' i- y* t8 L" ?
Method identical to the preceding one except that it seeks the ID of SoftICE
. h+ r  z; i0 a- l3 @! y5 Q  h- O" @GFX VxD.3 p5 s% q6 Q) A. m' s) e% p
# A+ o2 f+ X  g
    xor     di,di
* K0 k( t) }( t2 R5 c& _: a  n0 K/ A    mov     es,di2 N( V, i) ?+ J+ V% A+ |
    mov     ax, 1684h      
: N8 E( W7 Z! T& ?7 \2 I/ |    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 Q8 T8 z* h1 U/ m0 [
    int     2fh
# Z! q+ k& E7 G2 x* F9 \0 n, P    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# I/ R' v8 g) r; U# \  {    add     ax, di
4 R, [& j. C+ S    test    ax,ax
- e4 A( @4 @$ n  `% x* J. e3 x2 M    jnz     SoftICE_Detected
( f5 l* D. l+ g) @
' Y; v) o2 g9 |  J" K) K4 i6 V__________________________________________________________________________7 X& I& y0 E7 M1 x# p/ Y
9 ^( O( F2 W; X  Y
9 N( |2 Y9 ?; W2 C8 |1 q0 p& K
Method 050 R: M, `" E1 _- y2 Q, K% z
=========* ~6 J: _" i. S0 P6 J/ r; }3 [  }
5 M4 a- h& l. D
Method seeking the 'magic number' 0F386h returned (in ax) by all system
  c  b) W/ Y/ m5 g" w, {  l: F2 Qdebugger. It calls the int 41h, function 4Fh.
- G. C+ ^% O3 N! f! Y% Q$ p9 vThere are several alternatives.  8 w6 ]0 {/ Y( ?& J. @0 D* D

* _. W2 d" ^, r# C: ?7 TThe following one is the simplest:' s" y- I+ ?3 c) J3 i: W# I: X* m
: v) ^; m" b! U+ U  k' C) p; c# Y6 Q
    mov     ax,4fh9 i- a# ^- S5 f3 n1 E
    int     41h
4 ?' {3 n  U! T- y, F    cmp     ax, 0F386* R( E7 W* s/ F9 v4 {( j7 H
    jz      SoftICE_detected: C  C6 z0 ?+ g- {- Q

2 A4 I5 k$ |) w
! O- ]7 ]& e6 y- q  \& _Next method as well as the following one are 2 examples from Stone's ! {5 A$ M& k, p& i
"stn-wid.zip" (www.cracking.net):+ G# Y6 t, B; F7 U( j: y- g

6 @' T) s2 h  n: f, N7 h    mov     bx, cs3 ^( @, Z1 Z/ Q0 {
    lea     dx, int41handler2
2 P  D2 ^$ H$ m    xchg    dx, es:[41h*4]
' M9 _: b0 ?! E6 Q    xchg    bx, es:[41h*4+2]
: n) N+ [' u4 J8 r6 W0 J! ?    mov     ax,4fh* T) d8 m. e' Z! Z7 o
    int     41h/ L& U( @5 {1 n' V0 C! i
    xchg    dx, es:[41h*4]- m7 }# X; N2 k% _6 i) W
    xchg    bx, es:[41h*4+2]
/ n) [, ?/ q& v8 }; X- Y. [$ [3 B    cmp     ax, 0f386h
2 U  A* d4 G6 H9 w( }    jz      SoftICE_detected
- c- O7 Z0 @5 U# E4 H  P. d7 G3 l) y+ i( I
int41handler2 PROC, \6 z0 ?, S2 v$ }3 U
    iret: r: z, w# h4 D* W& C" y4 j
int41handler2 ENDP
" C) G5 M% Y6 k4 H3 Q5 R1 x; U% P8 _! w% f' J( s) S, L1 d; x: d

% H& y4 F$ u; x7 H& E_________________________________________________________________________
8 y2 V5 o# G1 M9 O+ O1 ]* Y; K; y/ U" j: _2 h

8 J4 l4 z* F$ s  S5 GMethod 06
; E3 h/ n' M% _+ ?* X: X=========5 C" }5 R7 s2 S9 ?( Q( A+ D. W/ _

( n4 w2 c6 t$ ~
" m3 D) p% Q6 N% D9 Q& l1 M: g# a2nd method similar to the preceding one but more difficult to detect:
$ q. E2 [2 d2 b
2 T+ R4 z3 |" f" s
+ C) Z2 F. w3 S$ W- jint41handler PROC
2 I' Z7 N( r- m8 t1 W    mov     cl,al' q3 V9 {& b$ s1 J
    iret+ t3 W+ `7 O% s1 `$ Q- C6 e4 v. j
int41handler ENDP" `$ P* V0 d3 l2 X; w( ^- v

4 J3 X1 [! v- C% K% F1 i& `; S7 h% I# Q$ [; g* A1 ^
    xor     ax,ax2 r) D/ O7 s2 {& N7 [# b
    mov     es,ax
+ a- e2 H& ^! A4 p5 q    mov     bx, cs
8 O8 [" ~) `9 }# B! V' I6 }7 C    lea     dx, int41handler2 A. M+ r1 {/ k) ?. @1 V1 s
    xchg    dx, es:[41h*4]
$ v6 f( T2 k) v1 ?) F) R1 v    xchg    bx, es:[41h*4+2]" i6 ^) I+ U& \5 i& e
    in      al, 40h
+ ?+ h4 m' F; k1 _' {: C* F    xor     cx,cx
, o4 o" A& D5 `    int     41h
6 B, p! Z8 }$ U4 T5 x7 a: C8 {    xchg    dx, es:[41h*4]& ]+ R- E! |8 n" n& n' X
    xchg    bx, es:[41h*4+2]
, H2 y$ l/ H; ], r    cmp     cl,al; ~6 Q' H3 N) B- X& ^8 W. w
    jnz     SoftICE_detected
* H. c  I7 f+ A* q: u- |' \: p# o  a8 v: k
_________________________________________________________________________
& S' F) T8 f, G, E5 j
3 }2 w' B1 N! ?Method 07
. V" x" w0 q* D! s/ Q=========- ]3 r9 q3 m  C3 s7 M- G4 O% K& B; t
0 l1 }+ }3 c3 {
Method of detection of the WinICE handler in the int68h (V86)/ o. `8 o& p9 Y5 s  |

0 b0 S0 k2 P. W+ U) W' Y  d: b    mov     ah,43h
( ^/ o! g$ D3 _& a: d# z: b3 u    int     68h
! Q! p! c6 ^( j    cmp     ax,0F386h
2 ~# p! P, l; M    jz      SoftICE_Detected
* h- {0 O0 w. a) W; L. A8 C/ A; e3 I  c2 R$ S+ Y

) J9 L) R; w1 k9 A/ ^) c4 C: P% y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 t3 k/ I' y* `+ Y! _9 E
   app like this:
1 e0 a% o! L( M' W8 b# b; _2 d1 p- J7 L8 q2 U" y
   BPX exec_int if ax==68' A$ j+ y! n* e+ ^# A: v9 \: M
   (function called is located at byte ptr [ebp+1Dh] and client eip is
! I8 h+ [! h) @; @   located at [ebp+48h] for 32Bit apps)
9 W& t6 Q* c8 F" e3 B__________________________________________________________________________
: y+ K: f& t2 o7 f8 n$ |1 Y$ {8 F" J' Q

) j' c8 G; \" k* }+ y/ K* xMethod 082 i, Q  L  g) d9 p
=========" C1 j1 s5 K$ l, ^. H0 K
  w2 V4 ^2 w2 D; Y+ ?) F
It is not a method of detection of SoftICE but a possibility to crash the
+ D- ]( H& |5 D$ \) Dsystem by intercepting int 01h and int 03h and redirecting them to another% U( m" p' f* h  d4 G$ @& r
routine.
7 R8 h* q  _* d4 X! n" i8 ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points  r- q. G! T2 S/ \) A
to the new routine to execute (hangs computer...)
) p: \! O; b0 j3 g1 ], u; w2 d& ]- }+ A, h' v9 u$ C3 ]3 x; ]$ T+ A
    mov     ah, 25h& L% o6 @; c! @9 D
    mov     al, Int_Number (01h or 03h)
2 j- o2 u3 }0 A1 E    mov     dx, offset New_Int_Routine# ?6 c& t1 B, G  p8 \% Y
    int     21h
! `, ~, r( X- S7 h) I. j
9 j; n# I( e# E9 }' m8 c* M9 i1 W__________________________________________________________________________" Y  o" _! ^. f8 Q2 t
$ b0 x4 m! g4 _
Method 09
+ I  W' U1 n7 z8 h* {=========( K, K; d- r, B$ ^
' J, b# F( o8 v6 T7 Z9 j+ V- X
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% G3 t, D" C3 W" m7 n
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 M. p! M" I3 P2 F& q: |The Get_DDB service is used to determine whether or not a VxD is installed
; E1 R$ }; D. B+ ]for the specified device and returns a Device Description Block (in ecx) for4 D1 k% c  @9 z* U$ J
that device if it is installed.; b8 F. B9 N2 ]( t& y

* d4 z: T& x+ D* P   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 v* t4 u, C5 \7 S: z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): q$ w1 L$ F! f$ B
   VMMCall Get_DDB4 U; h4 |* d8 b+ \4 j
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, J4 T5 X8 {+ ?9 m, \
. Q/ c1 D( y, M& q. hNote as well that you can easily detect this method with SoftICE:* s/ H! F: {& ?! W9 Z' u
   bpx Get_DDB if ax==0202 || ax==7a5fh- Z9 R: ~" v! w

" A0 C* b# K4 I! E$ [__________________________________________________________________________8 W& O4 a3 W2 O2 Q% B' Z

6 D( F; S0 x1 _' a/ e  h( hMethod 10
& x# J' G7 o4 d=========; d# u/ L' v1 z+ O
+ H) e& m' U: H: N4 T6 P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# v+ r) [% q" C) d/ |5 F
  SoftICE while the option is enable!!% e& G& q1 B! e
. M; U7 G* r, c
This trick is very efficient:9 `) _# h7 T1 P
by checking the Debug Registers, you can detect if SoftICE is loaded
) |0 v7 [' M* n! F6 x(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 N6 ]0 t$ k2 d9 H9 F9 `% V
there are some memory breakpoints set (dr0 to dr3) simply by reading their
% y# P1 d! U/ {4 ivalue (in ring0 only). Values can be manipulated and or changed as well
, h3 j8 T$ j8 Z5 b(clearing BPMs for instance)
0 U% ^# G3 z: E! ^  D+ l0 C- L
" |* E$ r1 e6 T" N  E2 F, E$ `__________________________________________________________________________; U! G/ I' K" L

5 ~; [8 w6 x+ d& T! L. l  nMethod 11- F  k6 z0 E2 O: @, ~/ }4 Z0 R
=========: B( @4 O9 x& c# X8 [

$ L% g! ^# f- z2 Y- xThis method is most known as 'MeltICE' because it has been freely distributed
' J; }( O7 m$ h0 U1 Rvia www.winfiles.com. However it was first used by NuMega people to allow9 Z' L) Q2 |, P  T" \! ~
Symbol Loader to check if SoftICE was active or not (the code is located
: W" L  U' x6 y- [inside nmtrans.dll)./ A+ p6 A# C9 t! ~6 t
+ i; _( Y" o2 X0 ?2 Q, s, m
The way it works is very simple:
; b2 k/ E1 X* f2 F) I7 y8 IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
8 t1 x' x& W1 z& P& FWinNT) with the CreateFileA API.$ m! ], W8 q7 r* }" t

- ?8 Y/ ~3 x" v% U, GHere is a sample (checking for 'SICE'):3 [: I# ]$ V, e# ?
- |% S% t' C$ v" {/ |' z
BOOL IsSoftIce95Loaded(), x+ t, D- X1 @* j
{6 Y; ^2 R. q, m3 v
   HANDLE hFile;  
4 _) k5 Y# |- I- @$ g   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 Q: U. w# W" ~% ?8 U
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ ^5 Y6 \2 B8 X$ v4 C( |; q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# ?+ e( N7 e' K1 L& ^7 Z4 J   if( hFile != INVALID_HANDLE_VALUE )
/ ]+ M: P4 \3 z+ U0 A4 z! Q- ]- D   {
7 s3 T+ {* l. l  ^      CloseHandle(hFile);
6 `8 e5 n1 @- i4 ~2 @: E      return TRUE;
% H4 ^; H  m' K- `. D   }
5 [7 L- R6 f* J: o* Z4 \" b' y   return FALSE;1 t, C, V4 q0 r& p" N
}
* `+ E- [1 x7 r" U; b0 r' \
/ ^, P; B5 S% y- ~- ]: xAlthough this trick calls the CreateFileA function, don't even expect to be7 c% E+ N. G6 b
able to intercept it by installing a IFS hook: it will not work, no way!
2 W* S6 |0 e$ `1 }3 N: y5 hIn fact, after the call to CreateFileA it will get through VWIN32 0x001F. q; a; D9 W- l+ f" V# K
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ _: S% o) B% Q0 |) h0 c
and then browse the DDB list until it find the VxD and its DDB_Control_Proc7 J1 X4 G# X; p1 G+ _- I& D
field.
) ?2 Y7 T6 i! ?6 G5 WIn fact, its purpose is not to load/unload VxDs but only to send a 6 R& K3 M, F  h+ G+ j7 H( h
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 S: D/ G  K" m  O
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! i. |4 i) J. C' u$ c& i# B- cto load/unload a non-dynamically loadable driver such as SoftICE ;-).% X5 l6 ]; \4 @5 f1 ]  B2 C% z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
8 @' u1 b+ x- p8 @" i( @+ Lits handle to be opened and then, will be detected.
4 i" c9 A, J$ ]5 _& [( y% VYou can check that simply by hooking Winice.exe control proc entry point
5 E; u# C7 o. a+ }9 [while running MeltICE.' q" o! F2 a, R% h3 q8 t: w7 O

( D9 k3 X5 v' k/ T
# ^% a9 v: C" z  00401067:  push      00402025    ; \\.\SICE( B7 h6 Z9 Q! R) R
  0040106C:  call      CreateFileA! \+ h9 M4 I. r* T; z
  00401071:  cmp       eax,-001" j( i, i$ Q$ c/ P
  00401074:  je        00401091" z* \) `' z/ \  ]

' }, H. \# e& F. h# g, J) A1 n' }8 n1 E. r; c( y5 ]8 t' V5 A
There could be hundreds of BPX you could use to detect this trick.
6 r! V# l7 t' x2 V0 B8 Q$ l% v-The most classical one is:' M5 J9 H' @' Y1 _) R: \
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 n4 E# f: g! W, h4 m* d
    *(esp-&gt;4+4)=='NTIC'* b% a9 o& ^4 @1 a0 F/ C

% e: A: D, V: H' f, d! i-The most exotic ones (could be very slooooow :-(, q3 l# w  E$ x! b  u* c5 f
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! G4 I( n% ^0 T, i     ;will break 3 times :-(
& j' e& P0 Z9 s$ b" `, V. I; T* l5 ~( v$ n" C/ w6 |( r
-or (a bit) faster: 1 h% @; H& C( z; k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 |1 o, [8 T( {
2 _4 X) J' t# W   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
; x9 X& k8 w8 ]8 x, c" b, R4 M  _     ;will break 3 times :-(
; E9 q, D# F2 t& s. P4 U2 A( q! ]3 O- x0 U& s) l) O
-Much faster:3 e3 K4 M; W% R! s$ t
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" S9 Q8 i0 H  Z( X. F
: X) s, p/ X3 k! v; r' l7 v
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 V  x% _! }$ [
function to do the same job:& W  b+ |+ k+ h, c0 L! |9 U( v4 Z

9 i4 a  {' h& v9 |" @  ^2 i   push    00                        ; OF_READ% V0 x5 k8 o! i6 ^* x
   mov     eax,[00656634]            ; '\\.\SICE',0
! L. P  ^  J1 `" @! ?, h3 l( e   push    eax
: v5 B4 q# e) x% r5 T   call    KERNEL32!_lopen0 `9 [8 x8 e2 \. V7 [
   inc     eax$ I% l) E' r5 x
   jnz     00650589                  ; detected
( U$ r- p5 P; A% E, E8 E0 U4 H   push    00                        ; OF_READ) L, e2 u- a2 O* E' R6 a  N" q
   mov     eax,[00656638]            ; '\\.\SICE'8 E+ m! }/ q3 o; T! U& J1 ~$ R$ @
   push    eax! [5 Q9 n" W; Z1 m9 h: E
   call    KERNEL32!_lopen% q- V* U+ U0 O  e+ E% g3 u- w% @
   inc     eax
7 F( l8 |; C$ m$ p   jz      006505ae                  ; not detected; z" R+ _$ @* e: Z6 }

6 `7 h/ t" R' k0 G9 n9 m5 }8 ]$ \& V% s
__________________________________________________________________________6 U( T( u( j7 g2 ?- X7 r

4 L. L7 k  N) o8 R* n$ [Method 12+ i" e, N# a: f4 s$ U
=========
, j$ Q  }( R: a
% {6 F- s, c9 _$ eThis trick is similar to int41h/4fh Debugger installation check (code 056 K) M( s+ G) |% y: k0 H4 _
&amp; 06) but very limited because it's only available for Win95/98 (not NT)) T$ \. n" x3 i1 W; E
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.8 t2 n; L; o' [8 l7 }5 z1 g7 W8 S

! Q4 U! p; ^% R# N   push  0000004fh         ; function 4fh
. j' |+ h: \: x  U   push  002a002ah         ; high word specifies which VxD (VWIN32)* c. G* d9 }! z" R
                           ; low word specifies which service! A: b' B2 S; Z3 B8 i4 u
                             (VWIN32_Int41Dispatch)
* {! _. ~7 q  w; d' D; H   call  Kernel32!ORD_001  ; VxdCall: Q' d- A/ F/ o0 I% h/ V
   cmp   ax, 0f386h        ; magic number returned by system debuggers4 D8 x' y" O3 }. v& G$ r
   jz    SoftICE_detected4 ]& Z. f( t/ _' s3 M0 H/ G" B  @
( y; U: @8 h0 N) s
Here again, several ways to detect it:: Y; V+ V" N3 k4 s
# Z1 w/ Z% R- \% ^. u# }
    BPINT 41 if ax==4f
3 M; L4 Q5 F7 B
  ^# S6 L0 \$ }8 D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one. ?- ?. q2 a& U3 w3 ?: P& k

6 N" w: u& p- k+ Y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 D) i7 X% z) \( L: s( ?0 Y  _0 o5 j! S5 x1 T4 K
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
5 s8 Q! h- n1 o- Z6 x$ J6 \3 w7 z0 _. Q& O5 x$ D
__________________________________________________________________________3 j: F9 \5 j$ f) J5 B
, a) N7 G- D4 h  v3 s8 v4 t
Method 13
: g) M. |4 j& Z. x=========
6 F, B$ M9 j' Q: U4 K8 A" r! F5 F  ]3 m- P
Not a real method of detection, but a good way to know if SoftICE is
  {4 `- R3 {6 g) Dinstalled on a computer and to locate its installation directory.
0 t4 Y0 E) ^( `3 c  {# q- u- PIt is used by few softs which access the following registry keys (usually #2) :
, p$ m' |$ k4 c; J4 E# I. g! u3 W' t+ m0 r* b2 }: c0 Y; j7 _
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' `; n* l% e( U# s" Z\Uninstall\SoftICE
; {6 l- Q( D  ]2 {-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 `, O7 O2 y. R" e
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 V. E9 M- p- K& r+ e0 d
\App Paths\Loader32.Exe
2 c' G2 ^3 V7 r; I# ]8 J( {4 t( p
7 B+ Y& i6 ^5 b" s/ E& e5 \, V) q: c% [% P
Note that some nasty apps could then erase all files from SoftICE directory
( H7 X# h- K) F! D(I faced that once :-(/ s. V8 n6 C2 n& [& G

5 n' @! T! e: v( k: }' @9 |+ }Useful breakpoint to detect it:
  g  B+ A" t- V6 _7 q; L
( E4 Q  ?8 F; q* k7 W5 a/ b     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ C* q& h  B: S& _9 `9 U+ ^# _
0 j7 o9 {$ X! }: V
__________________________________________________________________________, Z- _8 ?- k/ ?' @2 G8 i+ i8 X
) K% |) y  |9 I9 }  @3 d5 S* s

, Y$ x) p$ K. `$ W! ]" `  h$ EMethod 14
0 F3 o& H; B7 ?! J* Y=========) Z* {! x; \$ W1 _; G# ]
% n+ L1 g3 a3 i$ i0 T
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 i6 i, [+ ?2 [2 \
is to determines whether a debugger is running on your system (ring0 only).
/ Q& R: I3 ]; m! l  J- P0 F& X( k2 k2 f4 \; c+ h
   VMMCall Test_Debug_Installed2 L! @. t- e1 n- D: s9 ^9 p
   je      not_installed
* D  I& d4 ~  u' j
- O& x( \' `. ~/ ZThis service just checks a flag.1 D/ H+ x$ z5 V6 G
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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