About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># e3 ]; V% Z& \- }( |
<TBODY>6 i. k# Y5 |+ Z4 V0 P
<TR>
7 [2 Z) w: C& g& S1 r<TD><PRE>Method 01 : L3 N2 t7 S  W6 p: S
=========8 l2 B. Z# e% T% k

1 z8 d" O9 t) ]6 iThis method of detection of SoftICE (as well as the following one) is
) F- @% I% ]5 W. h3 g; ?& p! Pused by the majority of packers/encryptors found on Internet.( g" F% ^3 z4 s+ Z9 Q
It seeks the signature of BoundsChecker in SoftICE
+ [  j+ K6 a. q5 B% n
4 v( x) g: [$ _. C) ^6 Q. `    mov     ebp, 04243484Bh        ; 'BCHK'  r# o8 `# L5 Y" i( V
    mov     ax, 04h
/ k; _& e/ ^( n( t+ W; ~    int     3      
' d, N( i% m" H6 K! d/ x  `    cmp     al,4
8 e8 O8 K( c5 E6 z+ d2 ^    jnz     SoftICE_Detected+ \& o7 X3 V- q- q+ W

" ^) O# T- d: M___________________________________________________________________________
% N% o0 B% _2 j2 U! ?; u5 H& \4 \9 U
Method 026 Z' j! f  R# `7 O) o, ?
=========: W- s- W6 w; L, j$ y

$ t; D% @5 S' Y2 P) `Still a method very much used (perhaps the most frequent one).  It is used1 C" N: m% i! G. K4 B0 u
to get SoftICE 'Back Door commands' which gives infos on Breakpoints," Q! ?. m. _! B
or execute SoftICE commands...
) V8 I1 Q. L8 F% ]: J3 m- zIt is also used to crash SoftICE and to force it to execute any commands
; F: _% d% n% v% U& M" f(HBOOT...) :-((  : y0 B- R3 y1 [( }2 J& a
: M8 D& ?5 A; K
Here is a quick description:( u/ H! S2 h/ [1 ]
-AX = 0910h   (Display string in SIce windows)$ A: {2 m9 D' a
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& I; ]' m' V+ C-AX = 0912h   (Get breakpoint infos)
9 u: x' ]# S# `-AX = 0913h   (Set Sice breakpoints)% W/ J4 x& d9 n
-AX = 0914h   (Remove SIce breakoints)  c0 \' z- z4 T- c7 Y* V) g2 @

3 j5 t/ l$ n5 t. p" T! rEach time you'll meet this trick, you'll see:
9 p/ B  X- y6 [' B  ?3 l+ Z/ \-SI = 4647h
  x* f6 w; D8 t, G: ?-DI = 4A4Dh2 g4 P3 [" D! F* T/ L0 a
Which are the 'magic values' used by SoftIce.
# L0 ]1 j+ n4 V! x. iFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, E& `& z* j# K5 j$ A0 l# V0 ?) G$ U. j0 @
Here is one example from the file "Haspinst.exe" which is the dongle HASP( l8 N9 F( O1 q9 u
Envelope utility use to protect DOS applications:
# A1 e* ~! ]+ |/ m+ p' L
! G" H! a+ x) p: x$ I3 \/ [( c0 h3 R  h" @7 f; u+ S4 e
4C19:0095   MOV    AX,0911  ; execute command.
( p  I) c$ o$ U4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# g! g+ z+ K# s  y4 r0 k8 O
4C19:009A   MOV    SI,4647  ; 1st magic value.
, x, P3 m1 J3 P& [7 z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. B" H* G0 ]6 x$ _$ ?* p  Q" N
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 T4 E  ^( \, E: O/ g3 N4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ X* U5 V1 u  i" L/ }/ ~  q. z
4C19:00A4   INC    CX( G1 X, N% _. t+ g9 c
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 k; x- z, Z6 E1 `4C19:00A8   JB     0095     ; 6 different commands.
( I+ o# @4 a5 G2 B" u4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 T7 b' o5 |- c1 _) P" X1 S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 p8 P. Z4 ?( L/ m

$ E& S0 y% f: |6 q* ?+ JThe program will execute 6 different SIce commands located at ds:dx, which: k2 `, A5 X' c
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 z( V% ^( i% I) h

) Q- g6 z1 a5 Q7 I2 I6 [, l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
" i3 w  T4 x  d% p1 j___________________________________________________________________________# e- V+ Y1 u/ h4 X) h

0 u! V$ P- v. W, w+ z/ L) X$ j: ~; C9 B9 J7 v, X  A- t
Method 035 Q) L+ T6 r! N
=========
9 _/ A; R7 I& g/ W6 M% b& I1 e6 V4 C! t# ]
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h& c# u8 }3 E& S
(API Get entry point)5 T( h) u: Y! M) K- |
        : {* `# e. i* a. d$ d; g$ S9 H

. {5 m8 p, Y# a) `+ R; Z: U    xor     di,di
4 K$ ^6 a# `% X$ R+ c, `9 r    mov     es,di
) u5 P: y  n8 ~; i4 ]    mov     ax, 1684h      
% z  b. ^, ^/ z5 L, B& Y" u    mov     bx, 0202h       ; VxD ID of winice1 N* g) ^# b( D8 Q$ \; f  {) r
    int     2Fh
8 c9 }$ G3 x4 v4 I" K( [" z% _    mov     ax, es          ; ES:DI -&gt; VxD API entry point: W3 L9 @, ?' V$ D7 V% S. c
    add     ax, di
% N" o3 ~6 {0 M' n# {    test    ax,ax4 t) n& o6 G  s9 x7 e
    jnz     SoftICE_Detected1 d: q9 w# I  C8 x/ }& ~
- P' ^: w" c/ ]2 _: i
___________________________________________________________________________2 e2 P- Y/ b6 e

1 S8 b9 [6 Y3 N7 Q4 vMethod 04
  p& N( A) g8 Y9 V% u=========
- ^; ]! r7 v5 g5 i: N- j
: A; G& ]# W+ T' QMethod identical to the preceding one except that it seeks the ID of SoftICE. m& ~7 t6 D' ]0 r, R! z
GFX VxD.# H/ ^: @) _7 s
1 p6 e5 t" @; {, \  X0 k
    xor     di,di
5 j7 h- z8 r; {; D7 v6 e  W    mov     es,di
' b0 S4 N) i8 D( X! N    mov     ax, 1684h      
0 x8 C! i- `8 H( t" m: X% r    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 w1 ~: o" p) H6 T3 }4 W    int     2fh
9 E* b% W2 t. }3 ?( p/ P7 u, e3 F    mov     ax, es          ; ES:DI -&gt; VxD API entry point# G' v% f; @! Z/ P
    add     ax, di, p' R/ z, [8 k% {# M
    test    ax,ax% o* S2 o# S; g
    jnz     SoftICE_Detected0 }. R7 z3 t6 j% L
) M2 W0 p+ `- o9 P
__________________________________________________________________________
; G: \( g: X% q  q0 N. }4 P" {- p# C7 K1 I( |  l2 @) e
2 Y3 c! N, }3 o, r" G: `1 O& M
Method 05
1 [1 d5 I# W; R( f, O=========; l  D- a/ E) O+ w

) T  M4 ?! |2 r+ L- F' G: ]3 @2 a# UMethod seeking the 'magic number' 0F386h returned (in ax) by all system6 o( K7 z/ M8 h+ J" f
debugger. It calls the int 41h, function 4Fh.
; n! E" C5 x0 g& j2 p. J2 c/ F( bThere are several alternatives.  
0 [) l. m( H/ F4 Z& s: t  F3 B8 k" G& L0 P4 L6 d$ v0 y
The following one is the simplest:
0 E! ]3 o( n; @. l' S
& b+ L. [) {, c' r, q( S    mov     ax,4fh
6 S8 f3 ~, M& F- ]5 k8 \& m    int     41h+ Y: B7 ?& D* l3 W4 H" d, d' m1 }
    cmp     ax, 0F386+ J: S5 f" d/ ^/ I. ^0 F
    jz      SoftICE_detected
8 a3 E6 m' U5 L6 T) E: c) p+ P5 z4 _6 Q6 H1 p
% \8 n% `! R% {# O1 p
Next method as well as the following one are 2 examples from Stone's / _: b  v9 r' G/ z+ W& r, S
"stn-wid.zip" (www.cracking.net):% S! H) M6 x# g/ O1 [% U* X+ h- D& ~
  j0 Y/ x8 E' L0 V+ \" ~, i
    mov     bx, cs: y4 q0 Y- w8 v4 f9 }/ S
    lea     dx, int41handler25 C3 m- g! V* ^/ ]; a
    xchg    dx, es:[41h*4]' T+ A0 S# X: c3 E9 T
    xchg    bx, es:[41h*4+2]
" J2 N" ?5 s+ A5 Z. G    mov     ax,4fh( X& n# P* s0 a3 l% K% v! j
    int     41h
0 R: B$ @; o0 |: o" c8 U! l    xchg    dx, es:[41h*4]1 i: L3 @/ I1 H2 R0 \) H& v
    xchg    bx, es:[41h*4+2]
- k- u, O! r5 n  }  S, |& i' [5 p    cmp     ax, 0f386h- D: ]* q3 E" z1 q
    jz      SoftICE_detected9 {  v1 _% k* P" v# H. u, F

2 c5 F/ @& C% ?( Q8 Y4 T: k$ vint41handler2 PROC: P4 }, x, d! O1 @7 c
    iret* Z, n! G( T  V* P
int41handler2 ENDP
8 ?: S7 i' R/ M+ s: Y5 w! U2 j
9 _) \- G8 E4 [! {
# \3 t2 k8 j& ]2 i_________________________________________________________________________$ d' \; }2 R( D" x9 B
% m3 ^3 ]4 Z9 p; K: l1 b- d. i; X

/ {5 H/ V$ d0 b& r' n- ], nMethod 06
9 }+ U9 f- r' _. V% Z" l=========
& T2 v( a9 z! {, ?4 W. S# R! @+ Q3 |. ?
! Q0 `; r1 l) [2 t5 i5 j4 Z
2nd method similar to the preceding one but more difficult to detect:
6 H- l$ D  P# T+ _
8 K1 v+ f- [6 r3 j+ P5 Z
; I" u9 U! x( Q7 ?% x) sint41handler PROC! r. y% w* v8 A# D2 M5 u
    mov     cl,al3 G4 K: ?$ Y# d& h0 F2 T& T
    iret- H5 m# O- L/ u4 L! e
int41handler ENDP: k8 y0 A9 r3 ?
; b! d& _. U! M4 k
0 ~  ^1 t. ?7 E, ^+ _
    xor     ax,ax; p3 E. F4 ~/ c4 ]: g; u
    mov     es,ax8 u1 |: n/ f. o1 O- O
    mov     bx, cs
: |) ?4 ~: y1 D3 U    lea     dx, int41handler
; k- w9 i8 x+ g( \    xchg    dx, es:[41h*4]
' {9 [' G9 r$ z- M    xchg    bx, es:[41h*4+2]
( p2 Y# D% M6 {! ?3 p    in      al, 40h
+ i$ a- J+ ^3 d* f3 o+ G1 k    xor     cx,cx3 ^& c/ v# e; o. J( _
    int     41h; T; k( T! X1 t
    xchg    dx, es:[41h*4], `7 y5 H( T& A1 ^2 j+ E' r
    xchg    bx, es:[41h*4+2]; R) W5 Q* R" l% C, z! f
    cmp     cl,al
  Q; ], g+ {. d) A* U% ?    jnz     SoftICE_detected7 f; B1 }0 K7 F9 _. J; a

4 G0 |; q( B, a7 t5 J2 p5 d_________________________________________________________________________
4 m1 o) R- h; |  B6 T7 f, ?" f) k% U1 c
* [/ X. v# b6 c7 q- }Method 07
& G' V: Y: n* O* g0 |=========
6 u( E6 w/ b8 K
8 h6 }7 a% [  z& \8 S& N( I! R' G( DMethod of detection of the WinICE handler in the int68h (V86)( Z/ t+ v: ^) c' D

) I+ b4 ], z, B7 U! g    mov     ah,43h
: _* m5 z! h, R; J    int     68h8 n) d) [  v' i3 ]
    cmp     ax,0F386h+ I* X, c7 [$ t3 R& v/ |  Q$ T
    jz      SoftICE_Detected
0 a$ c$ G& D2 H$ ^" H% k8 `, ?$ k% `8 ?8 D/ J- w: F* t

! Q3 H  I8 e+ c' S# K=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ y0 M# t1 A( N- m' [9 F
   app like this:
; U6 B- Q' `# g, z9 U! i, e5 X$ ~% `# ~  U: n  D- H4 u! w4 e
   BPX exec_int if ax==689 T4 ?0 v3 s: P* `0 s! y
   (function called is located at byte ptr [ebp+1Dh] and client eip is; t2 X. Z5 R/ p# z. V1 \4 c3 R, C. f! ]
   located at [ebp+48h] for 32Bit apps)& Y- V) f6 A3 g  R& C8 j$ j1 {0 Y
__________________________________________________________________________
  l8 g. M& h1 T6 b- t& v4 ?  g6 p& {/ A& i( c- ^

) r$ M' F3 J) T# vMethod 08, Y5 w0 l; ~" i2 m2 [, X
=========
+ P" o$ x4 d( u( H: q( B& g, j  p7 g; H1 i. B/ {2 i8 @) J
It is not a method of detection of SoftICE but a possibility to crash the9 Y- b1 G. G! G& A, M" {! |3 w
system by intercepting int 01h and int 03h and redirecting them to another
2 t/ I# ]3 @1 Croutine.
! x8 [2 t9 f. }8 sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
) }: U7 \9 z# d) G% c+ q- |0 Hto the new routine to execute (hangs computer...)
5 K# w% a, @7 Y
9 m+ Q. d2 d! r1 r- o* D, J5 m5 b3 q    mov     ah, 25h9 `2 _* o4 [) `$ E! n
    mov     al, Int_Number (01h or 03h)
* n4 f! B# g$ n; d/ I2 S) x. @    mov     dx, offset New_Int_Routine( y' z1 l* Y7 c8 U3 N/ j1 ?, D. G- h
    int     21h
# C7 v, A, l$ d  D' _& E
1 l8 F& p: V$ H6 E( H__________________________________________________________________________' m1 D. A! w- g5 Y0 B. x2 n

+ Y' N% q5 w9 r$ ?( B2 l0 wMethod 09
: {2 w" v( P- {$ y/ O- i=========
* }/ I9 v- W: b, s+ t
( w7 S% }. u, E0 s& [2 N' X8 aThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
7 Y( f5 e) u+ X" B9 iperformed in ring0 (VxD or a ring3 app using the VxdCall).0 Z+ `- g. z+ g+ Q
The Get_DDB service is used to determine whether or not a VxD is installed" A* z# w% O8 K2 `- V
for the specified device and returns a Device Description Block (in ecx) for
9 ]- r: l( ^3 ?3 o# u4 nthat device if it is installed.
% W: N" }7 y9 i7 J8 c, b8 A% B
) J* n6 R: v* X. |' j+ O   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# I& E3 M5 S& n* z2 U, F# C& Y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' {+ ^/ R( v" q# U. Z  l' I   VMMCall Get_DDB
( R: \% ~8 E( J6 i   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 U; F4 l4 C4 f, N) K
' b) c5 E  m& O- {7 T/ ?* r6 vNote as well that you can easily detect this method with SoftICE:; f% G% E6 O2 I1 @) V* [$ h/ o
   bpx Get_DDB if ax==0202 || ax==7a5fh3 O% j/ J' a9 K8 O/ A
) J' i  A- e4 s$ B/ x" C0 D/ E: X2 K* d
__________________________________________________________________________
' ^# B1 @- }- x) u- C2 Y* I
5 A) w6 b$ \' h* B0 @Method 10
2 a3 ]/ r+ b+ t- M=========9 \. k4 T8 e6 h' `& \

: Y- P- J* ]. [8 G3 W0 W/ P=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 i- J" r$ J& y; S# ?  SoftICE while the option is enable!!2 I- ?! C/ _7 `* B

0 }1 i8 O/ t+ hThis trick is very efficient:
3 w& s( t  m" J% I; m4 q) Nby checking the Debug Registers, you can detect if SoftICE is loaded
7 C" H7 ~% p. \3 I  ^, Z(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 a: ?) F+ O  D+ Y: l( [0 o4 O
there are some memory breakpoints set (dr0 to dr3) simply by reading their6 H: w1 ~- p5 N' k1 ?/ p2 M
value (in ring0 only). Values can be manipulated and or changed as well4 t" c7 s- A; a# e
(clearing BPMs for instance)+ t0 C2 H! g) n# Z0 v1 I

" u; j$ n6 i# ]__________________________________________________________________________
& g# z& X6 X, x% }  u4 v+ p: \) A5 |" L7 w8 Q3 y
Method 114 h- Z  I( B  J" k3 G
=========2 g' q, g" a8 c0 k5 y* N

9 H8 l: V" I- _! L+ ^This method is most known as 'MeltICE' because it has been freely distributed
7 ^) y( @2 j  B4 B: Vvia www.winfiles.com. However it was first used by NuMega people to allow: K* n) J& I2 c7 u" H) ~
Symbol Loader to check if SoftICE was active or not (the code is located9 R! {+ {9 d1 v: Q$ W
inside nmtrans.dll).
" [2 E' g+ v8 {, e6 x# q2 I+ [6 g, l- T" r& T
The way it works is very simple:
/ S# t" r" t! B6 ?It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
' Q2 h$ L* `% g6 l" B$ ]) pWinNT) with the CreateFileA API.
9 f: j0 ?4 r8 d" v' a+ k0 }* ]1 ]+ U" Z1 t; N
# [' @" m! ?8 y6 `2 c; l! \Here is a sample (checking for 'SICE'):
$ w' _0 s( ~  n) }& l, W, t$ G4 R8 l8 p& C
BOOL IsSoftIce95Loaded()$ N- E3 n8 C- A" ~+ F1 V. T
{
; c% y7 \: W! n& J; {) h   HANDLE hFile;  : K: m" e7 P9 v4 v5 c/ K' G; l" Y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. [3 p% W2 L* C: [' J
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. ~- i. A7 z" A# L                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% `9 U, d: B2 l# X% D
   if( hFile != INVALID_HANDLE_VALUE )
" a3 B! E5 ~' b6 W# V; R   {- f8 F- X1 D0 l- q2 i+ D! g9 l
      CloseHandle(hFile);
. L1 O. o$ I4 f5 ^# n      return TRUE;
: l5 h8 @/ G/ A" T! @3 ]. V* _   }8 I# H" a% L6 Y  k" \4 j) @
   return FALSE;0 I8 R  k/ i% i6 v. d6 D  K  A  T
}
9 z7 r+ g- ]/ x
/ W% M0 e( t1 IAlthough this trick calls the CreateFileA function, don't even expect to be
" x- }$ s  ]& V3 ]& sable to intercept it by installing a IFS hook: it will not work, no way!
; P8 a: Y2 {% kIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
7 m3 d# t( J- Kservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) d. Y9 z+ _& l+ {" C0 S1 l9 r( v! Band then browse the DDB list until it find the VxD and its DDB_Control_Proc+ p4 R5 C, ^; M9 _+ X8 m$ w2 F2 Q
field.
+ y0 g. p, I& T7 g1 h3 J  uIn fact, its purpose is not to load/unload VxDs but only to send a
3 Q8 p: v; \' z9 S" `$ tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 o. M: F! m' ~3 S# t, Y
to the VxD Control_Dispatch proc (how the hell a shareware soft could try3 H8 e' U4 T3 ~1 r5 D. Q7 a
to load/unload a non-dynamically loadable driver such as SoftICE ;-).8 \5 r# T  y: A
If the VxD is loaded, it will always clear eax and the Carry flag to allow
4 A. `/ K6 R( ^5 m' d# ^its handle to be opened and then, will be detected.
. j) O9 K$ H+ D& ~  PYou can check that simply by hooking Winice.exe control proc entry point2 y+ [2 G7 E) \+ i% v: ?
while running MeltICE.
: B  B3 y; l( L$ X
+ e9 F- f* Q: t9 K7 j: T$ `4 M5 n8 ^3 z( Z2 g
  00401067:  push      00402025    ; \\.\SICE: Z3 {# D' Z: m
  0040106C:  call      CreateFileA
) `0 H5 t& S  w/ k7 n. f# w  x8 p  00401071:  cmp       eax,-001
5 r& }/ F- F1 ?. L  00401074:  je        004010918 u; b( E3 \  f% X0 @) p

4 F8 `: s4 v2 m# U
1 _# X6 m, U3 p) W( ~; ^( G- EThere could be hundreds of BPX you could use to detect this trick.
3 {3 n: J6 ]% n+ l' k/ |-The most classical one is:
/ ~# O" j' _  Y+ \" h7 Q8 T9 p  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ g( |% v1 B. F6 z    *(esp-&gt;4+4)=='NTIC'
2 k. O$ u* i* i  z* ~0 ^$ ]8 M9 R( I" @4 q; Z7 @
-The most exotic ones (could be very slooooow :-(
7 b5 T8 Y' W% {) k   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 e5 H+ V- j- L8 U0 W( @: L  y: c; m     ;will break 3 times :-(* D; l! L1 ~+ h4 K9 p

) n: h+ H9 s6 Q, x; q: u* g2 O, A5 T-or (a bit) faster:
. Z0 l) o+ K  B( s" d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
( v0 A$ B& H7 O; S, f$ M: T; X7 k& _+ Y# D* L
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 l/ f6 ], U0 o3 `0 t
     ;will break 3 times :-(- M/ w9 x" W. k1 f' c9 z! x8 t! h
: q$ b8 ]: a  B1 q5 Z
-Much faster:) G0 N- o+ n. p& e
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'* j* P& X, l- K3 A) S; y7 h" u

2 F3 V) G0 _5 {  N! jNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
% [# f2 A1 o& k; P$ e$ Xfunction to do the same job:
9 M! l4 G5 |" y1 ?7 E
  J6 G! D" C- T1 L0 w) P   push    00                        ; OF_READ
: V0 p6 ]6 O- t/ r4 J   mov     eax,[00656634]            ; '\\.\SICE',0
3 M0 m9 e: h" _7 ?   push    eax- M* K" y$ O7 M7 u* M( @+ Y/ k' T5 h
   call    KERNEL32!_lopen2 S/ k( v& y8 r
   inc     eax9 c7 k# B/ A. u& w( g" D2 X
   jnz     00650589                  ; detected" W' s: a; ?% C: X5 m( y
   push    00                        ; OF_READ5 x, l: W+ J8 D
   mov     eax,[00656638]            ; '\\.\SICE'
1 z& f$ h0 k" D- F4 B3 q   push    eax
# B2 U3 E% }8 Q   call    KERNEL32!_lopen1 ]. Q6 F7 B/ u( D  M
   inc     eax* K, y6 _( ^+ o9 v& i& n
   jz      006505ae                  ; not detected
: q$ y0 u6 h) J) ]) i$ h$ Z( J$ Y) t0 m3 S4 A9 Z* O
- a1 t6 y& ]; P2 }% |) I
__________________________________________________________________________9 ~7 i) W. m( Q; }! ]
0 K& j% y- \/ H' F7 }6 r" S1 ^; V
Method 12
; }: r' U7 K+ V; X5 ]$ U" ]4 [=========
% p0 h9 Z5 ~& l, d  D: d% m4 U8 `" H8 K7 W
This trick is similar to int41h/4fh Debugger installation check (code 05: D8 v0 Y; \$ C3 N& k/ I0 E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ ~* k1 a: S" `0 h, q5 V) C0 Las it uses the VxDCall backdoor. This detection was found in Bleem Demo.' p0 X6 Z$ w& w) I) c: L

& O4 a$ S4 k+ @3 C( J* }( e   push  0000004fh         ; function 4fh0 K4 |5 ?( R" _# [
   push  002a002ah         ; high word specifies which VxD (VWIN32); R, [9 M" e, _1 J" H0 y
                           ; low word specifies which service1 h8 X2 }- x& k
                             (VWIN32_Int41Dispatch)
' M  m& I5 ~0 B# _   call  Kernel32!ORD_001  ; VxdCall
8 x. X! h/ [; c. G   cmp   ax, 0f386h        ; magic number returned by system debuggers& @! r/ Q4 W! o
   jz    SoftICE_detected
# f" v: R" Y4 q# \  m+ g2 l% G# t- w" D  E
Here again, several ways to detect it:) D/ h, m: D6 u8 E8 ?

  P: q6 Q! m( o( u    BPINT 41 if ax==4f
: x4 n  S. A' z# _, X3 }
: k* c  v  J9 `8 k3 z4 |$ g+ \    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 k  J/ ]8 J$ J$ Y6 e! T( H9 A- B* Q) `9 X3 |
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A1 x; m; ]& U3 t$ ?
4 L& F# B# E1 \
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 ?: P! f; d" W! ]7 v
$ I$ [) a' h! w  O0 q$ Q2 ]2 S
__________________________________________________________________________
# c9 G* U" ?8 R% H5 Q' J* B2 T
) ~+ c* ?# v' AMethod 13, n' E7 v; f9 E6 X
=========) {8 H7 r! z5 T. i
& ?6 X  s4 n( k2 @! o! T
Not a real method of detection, but a good way to know if SoftICE is6 ^  k, X1 ^7 r: Y5 j* z7 D" N
installed on a computer and to locate its installation directory.9 i7 R& l! T4 e  ^9 r9 I
It is used by few softs which access the following registry keys (usually #2) :) s% o4 F: G$ c$ |) {& d

% ?6 I. `- S3 E8 K# Z3 k-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' @% ?: K, J: U4 |2 k
\Uninstall\SoftICE
2 I1 w- N! A& ~2 o: p5 ]% [6 d-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE/ B& Y: e$ h: n
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: u" M' l( O' ?\App Paths\Loader32.Exe, Z- g% A) J4 o& x
) j3 {1 p# I3 ^
; }" Z) ]! a+ S  W8 O  C
Note that some nasty apps could then erase all files from SoftICE directory# r& _6 P# f/ S- B0 |' m
(I faced that once :-(
" ?% m& a1 {& F
, ]. k% W5 m$ ~- PUseful breakpoint to detect it:# c, q) S! k7 R' }- v
- I$ Y- W: J* b" f2 \( b% V
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ }; U5 c, i5 }4 I0 w* o: H

7 w0 k* K6 `, P# V  R6 Y__________________________________________________________________________+ \9 n+ i8 v' C& H% `7 ?* _0 E" Z

0 O6 t/ k* v0 \% i; L. j
! C4 y- m, F+ B( l- V$ |& zMethod 14
4 C. K  w: H6 Q/ ?; |  D=========1 P4 Y9 L+ C4 E6 R2 R
5 g) s6 b$ W0 B* L
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 U; ^) M( _9 A. \8 ?) Mis to determines whether a debugger is running on your system (ring0 only).
, {7 F  O9 q. O  c6 i" ?1 v2 H) y6 n- |; _& Z& M# R; c5 n$ j
   VMMCall Test_Debug_Installed
1 r* |6 B, i+ P+ @4 w  ?   je      not_installed& w$ \! A1 P6 j4 O6 s
" d( B5 b, X- i& K$ @
This service just checks a flag.& F4 f4 y7 E% A2 N; g
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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