About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 K" W, k+ `4 `. y
<TBODY>! j& H/ q, i% c& i
<TR>
, b. j- L4 a$ v  F, U3 A* h9 I<TD><PRE>Method 01 + _* @' U- v- i6 H! {4 l
=========
7 f: T, Q" B4 y* _8 |+ y" a% m; _% T; o: B" o- x) }: Q2 S
This method of detection of SoftICE (as well as the following one) is0 g" \& _9 h5 d( ~' o! E
used by the majority of packers/encryptors found on Internet.
$ s& Z& b- g( Y: {4 A8 aIt seeks the signature of BoundsChecker in SoftICE/ K) z. O+ j& C* D' {! G- D" T- ]

( p5 k0 Z8 C5 j$ t    mov     ebp, 04243484Bh        ; 'BCHK'
+ x( A7 Y) D; v    mov     ax, 04h( @# _/ O: P5 n7 W; Y0 H
    int     3      
6 z9 u1 _2 M3 V  f4 s" ?* l' W    cmp     al,4' K; }$ s! e* I
    jnz     SoftICE_Detected' @$ B3 y& v: S

5 Y4 `$ e4 O) }2 b* B! p5 O% s___________________________________________________________________________
0 ]- P! s: g' H+ T- L1 X( B$ y& c4 f0 C0 ~3 g; J; h
Method 02' N) V/ @+ D& }3 A: `
=========+ i( T4 j1 B5 a
3 z0 [. k8 U8 H  e+ V4 I
Still a method very much used (perhaps the most frequent one).  It is used
9 a; W  V4 H* F- Q, v' l1 `to get SoftICE 'Back Door commands' which gives infos on Breakpoints,' w3 A1 Y1 E' c$ l) S% _" m6 v" Z
or execute SoftICE commands...2 `6 Q: C, W2 N2 X7 [, ?
It is also used to crash SoftICE and to force it to execute any commands
7 a& y4 y  l/ V(HBOOT...) :-((  
. o# C, R( ]$ n( @: o( o5 q! Z6 b7 ]* Z& Y$ V6 w
Here is a quick description:
1 {& @( j8 O1 e" q9 N2 u( C-AX = 0910h   (Display string in SIce windows)
3 Y% N& l. x) R$ C' X( {1 L$ o-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)6 W: q+ Y% @1 _3 b, Y+ u" Z# _/ t! U
-AX = 0912h   (Get breakpoint infos)
. a( K- s2 V& W: F8 ?- H-AX = 0913h   (Set Sice breakpoints)
  F1 P0 b7 i8 K" p-AX = 0914h   (Remove SIce breakoints)! Q" q! }$ {. H& r+ a

! P* ^0 p6 m* P5 yEach time you'll meet this trick, you'll see:
8 z, q  F. ~$ L" A-SI = 4647h$ i# u9 j  E  L9 _; x5 ]1 m- l% H
-DI = 4A4Dh
( n* d4 ?1 v7 W. k% }  S( N4 XWhich are the 'magic values' used by SoftIce.
. b2 ^% a* v$ OFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.* K+ t8 K9 ?6 F1 \
5 r1 {" R( c+ {% \7 I0 C1 b' k% p
Here is one example from the file "Haspinst.exe" which is the dongle HASP
* R4 ?- I7 Z! {4 ?: {! B+ R  K6 n, b# iEnvelope utility use to protect DOS applications:
, }8 @4 }' `) t+ Y* v
& {6 v1 N' t, Q, n; B
- R3 p) h; d, i, n7 c5 _4C19:0095   MOV    AX,0911  ; execute command.
3 o! x: T, A) x4 f3 N7 i6 F4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: x) e" I: l4 L& A8 \; J  w' H6 n" }4C19:009A   MOV    SI,4647  ; 1st magic value.
+ ~2 _5 W$ Z& f  g0 D- R1 c1 C+ I4 ]4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 @" y* q; o) h! [& ?4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
; ?, t& \/ A! }0 n% Q4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 j" `" _  V' @( i3 n
4C19:00A4   INC    CX
. p/ a8 j. ^6 b7 M4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  H& ^2 Q( S. u' f- O; P4 B( k4C19:00A8   JB     0095     ; 6 different commands.2 [) w1 f: P% }0 m4 D6 \
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! T$ w# i5 f& b4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 l3 d+ A$ `" `4 F9 g
2 A% j" e) U" [: PThe program will execute 6 different SIce commands located at ds:dx, which  r$ Y! d0 U% T
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ h; W: c' \# v% u) r& u# T: e

9 C8 ^/ |( [$ q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 P+ _0 H# k8 S' w' d2 S___________________________________________________________________________
& X" X: p* H- c
. o& l: h! [% `  n1 o$ u1 `+ T( P, N& D8 ]+ ^! r  I1 s. O
Method 03
& ?5 X+ H4 b; M# Y=========
  D$ ~6 Y  H! ?1 |/ V
: F5 g6 s# P" `) V) i6 B2 g/ o* ~Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' i$ I& m9 U; J* x8 ~
(API Get entry point)* @7 N9 {* v- y: z
        
; Z, B0 F3 K, o. ^* _/ ?& e7 K0 o. y9 V
    xor     di,di) p/ l, t! B8 ?' Q
    mov     es,di
- U- t; I4 \- m2 d4 z+ F    mov     ax, 1684h       $ t- n2 |" s8 I7 }" @
    mov     bx, 0202h       ; VxD ID of winice
- B0 `4 T" c+ i' q+ ?    int     2Fh* U6 S( ~' j$ [. k  t1 ~2 k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 O$ `( ~6 m8 X! M& P% V
    add     ax, di
" q& q& S& T9 d: |3 e7 `    test    ax,ax9 S$ e- A, Q" b" _. x$ y4 o
    jnz     SoftICE_Detected
4 |, ~: }: j( I8 w; n
# y7 Z, P/ S& c0 w___________________________________________________________________________
% i* O; P7 i7 V0 v/ Q* U
' b! k; y3 ~; @: _. ^, w$ e. l! ?Method 04
2 w6 ?: X! N1 Y1 e=========0 Z; P% D' X* s8 z4 a9 `$ {+ ?; U
) s. s9 H4 ?6 _/ n# r& I
Method identical to the preceding one except that it seeks the ID of SoftICE1 R# l: h  R6 X8 L2 x" ^" Y, W
GFX VxD.7 F: }5 l: P8 ]7 p  U

( f( s. e5 P6 O; H* H4 X    xor     di,di7 n3 q' Y3 B2 K  M1 ~0 s* b' l
    mov     es,di! t8 p  y* a/ Z9 K. N3 u% j
    mov     ax, 1684h      
1 k' x# e+ a, @0 ?& e5 m" q3 e    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) t9 ?" ]4 R$ v9 D" d) {0 y    int     2fh
" Q" P5 k% J* G% H+ r    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; L; ]8 j' ]7 X+ C    add     ax, di: B" }: {- J8 @9 ], g2 K
    test    ax,ax% Z( k$ T( T/ f
    jnz     SoftICE_Detected
0 h; A$ v  D6 N7 S" V0 `
; b+ N: M. R# N' y) ~8 v__________________________________________________________________________
( B9 }6 d, T, Z. N1 G8 `& v
5 v7 t- f( ]7 x* o! C# C- }% C* C
9 O: C% v2 p* }. y; CMethod 055 f9 R/ q* w. a/ D! _+ t4 S
=========
7 ^$ V4 P& ]2 h4 N& t# C% u2 s: W' ^! Q% ?( C& I6 `( v
Method seeking the 'magic number' 0F386h returned (in ax) by all system
4 s$ t  z: G2 T# Y0 ?9 Zdebugger. It calls the int 41h, function 4Fh.; ^' K# x7 j' Z; m0 {: Z
There are several alternatives.  9 D! m0 `8 H1 u0 g' z8 x

3 |  i; K9 e! u6 Z3 L$ ~The following one is the simplest:
1 o6 n8 w; _# V6 v
4 y: M+ ]0 x( \8 f3 m6 a! j1 s    mov     ax,4fh
, Q& W6 P8 S1 X4 U. p6 e- \- S& ?' C    int     41h+ Q. O7 y" e/ u
    cmp     ax, 0F386: e' w2 @4 E* D0 X( M$ O$ ^. u) C( h
    jz      SoftICE_detected. G1 z$ X0 b, z- l& z% o
% I1 t! D( {/ i2 D. a  b

4 Y) v9 d! v0 H& o' ~Next method as well as the following one are 2 examples from Stone's ; k# ]" R: R$ B3 m. ]& P
"stn-wid.zip" (www.cracking.net):
; O+ A4 s& P2 X0 |9 X
3 N: c) O: B% M3 i) O    mov     bx, cs
( {* L& p( y4 k# T3 a  f" s0 p: Z    lea     dx, int41handler24 [' x9 e3 D' i+ u% f/ u
    xchg    dx, es:[41h*4]3 o+ x* s" C$ v' a
    xchg    bx, es:[41h*4+2]
  N5 T* `  S5 w! a, v9 C: Q    mov     ax,4fh
  W. |$ y7 F/ ]/ b% L) _    int     41h1 G+ D. s5 g2 `
    xchg    dx, es:[41h*4]
) N+ K# Q8 L9 I+ a6 y; D) |    xchg    bx, es:[41h*4+2]
7 }; {: P* u8 t# O9 `& ]/ Y9 f( y    cmp     ax, 0f386h
8 ^% P: ~! ]5 n) g! k8 f) Y    jz      SoftICE_detected
4 D5 K1 o' N3 o6 E7 R4 V4 ]; l
int41handler2 PROC2 R+ B6 h4 s  [/ M+ g
    iret2 V, s3 n9 z; z
int41handler2 ENDP
' `, f3 D& i# R* `3 f& O5 p
, `9 R6 t0 j2 B# c3 P2 u0 m* [; M3 d" i) g' E; I( h
_________________________________________________________________________
" d( [5 ?0 m: k6 Q! z: \
  e$ ?$ r/ w6 U3 r& R) Q, q9 n3 V- H
! Q5 E) H6 U' ?. q9 QMethod 06
, X9 B3 p. T* K  M3 J=========
* w; u( |- F& H
* M* a7 T, D, m, |. o9 S1 |1 @. ]7 ?, H: y& {3 P2 p# P
2nd method similar to the preceding one but more difficult to detect:+ r3 W4 r7 Z* t. B9 g; N  G4 ?" p/ v

  A! A' ~- G* o7 n8 |' c
0 k( D% z) i: D  Kint41handler PROC
' {/ U; @/ t) Q6 J3 P    mov     cl,al
: F8 m( k$ J0 C  \8 G- L4 i    iret
# L5 T' ~  t( b6 m6 J& vint41handler ENDP
2 b" _% L) a/ t* \& o9 X% [  G' u. h2 V1 t& z* N( b2 r

: ?& N, n* e6 K9 _1 x, B; Y    xor     ax,ax
$ A* x5 o; Z( K3 B6 Z    mov     es,ax$ L6 T- V; v$ m# Q! N# j. c: t2 ~& ~
    mov     bx, cs
" y, d+ X) ]- J$ b! n' G# N    lea     dx, int41handler: \: p  Y- ~$ [1 i
    xchg    dx, es:[41h*4]
8 _* a) u: y5 V% Q) R    xchg    bx, es:[41h*4+2]2 L. Z/ Q9 I/ F8 W8 m
    in      al, 40h+ b* Z, q. `6 w# a5 I
    xor     cx,cx( E+ X3 q- Z1 W  c: S0 |
    int     41h4 ]  |; B6 ?) |: W* M; S, Y
    xchg    dx, es:[41h*4]! @3 ^- [: a0 I) g
    xchg    bx, es:[41h*4+2]
& c$ O: P% s* [" M+ D1 Q2 @    cmp     cl,al# i) o" E) Z# ], v
    jnz     SoftICE_detected5 I8 X  k4 }% r- Z+ B) j
5 t" a, d; `% f5 ]
_________________________________________________________________________6 f" I% S8 o3 o7 T  w
, h( l8 Q  ?, _, ?9 c
Method 07
$ B. j) F& L# G=========
  l$ M; n/ ^" m7 G) v- g  c0 N7 h" w; S, g
Method of detection of the WinICE handler in the int68h (V86)1 u* d; E* M/ u0 P8 W# ~4 |
1 @# j4 e8 Y: P$ B
    mov     ah,43h! z; C  T- Q% _/ x* x
    int     68h0 d; B: m( f# b* u1 u
    cmp     ax,0F386h, B' X0 g- k- y, D  l- _' \* y
    jz      SoftICE_Detected
+ `3 W8 i8 a. N- l# K6 f+ f$ y/ G8 J" X. C9 j" k: m- C9 ^
7 o: z$ P. D4 ~2 v. a7 O  c
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ P$ E4 x8 L6 ?$ U" u* S
   app like this:/ J& X5 n1 l$ t% G
9 `% D/ |! m) w9 Q6 |2 P6 j+ k
   BPX exec_int if ax==681 b; G4 q) [  L% W* X: u5 {3 J
   (function called is located at byte ptr [ebp+1Dh] and client eip is8 ?4 u2 ^  x7 y' g, {
   located at [ebp+48h] for 32Bit apps)
" e8 b4 D9 v# j5 t- Q4 g__________________________________________________________________________
1 r1 {% d. P  N3 R! R) n( _! F) W3 }* d7 G. t: V6 k6 ?

) N1 ?; B9 t- d' M3 A! T- ^+ `Method 08
' ]) b" X3 M* w0 H1 w=========
0 J6 P: H+ b  t" j. x9 B* ?  m' `! b
3 g6 W  a" `7 f, [, W: {8 p8 x2 \7 Z/ Y# dIt is not a method of detection of SoftICE but a possibility to crash the
* B* a! W0 Z. n& gsystem by intercepting int 01h and int 03h and redirecting them to another
/ c; y- M3 b) [7 groutine.8 B) G+ s& q6 X4 |% s3 z
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; t$ k% w. M( l9 M& M, C2 dto the new routine to execute (hangs computer...)
9 ~. q: ], \' {; h, }" w! h- Q! O# D) S: ~4 v1 Z5 F' I
    mov     ah, 25h; ]2 `+ f; ]5 A& [
    mov     al, Int_Number (01h or 03h)
0 I1 @/ j6 r# x& q! Q: W    mov     dx, offset New_Int_Routine" H4 V; k- f4 F8 Q2 B5 O) ]0 M
    int     21h% E8 Z+ y; Y* [5 G7 A: C' h
4 m+ d2 h( {; E( {$ {+ V* d
__________________________________________________________________________) p" S8 `) o7 p& j5 z+ x# ]
' @1 Y& ?0 j2 u$ V' a2 [/ v) e
Method 09
  \0 s* C: r) L! t3 U=========
, R* B8 Z% z) V4 e, P6 [5 I
6 K, `$ |1 m4 t$ s8 @! }' e, PThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
- d3 W2 o! T) d7 D! [) sperformed in ring0 (VxD or a ring3 app using the VxdCall).
0 _7 V  n/ b5 N. YThe Get_DDB service is used to determine whether or not a VxD is installed4 d' I8 r& p$ g2 L) j
for the specified device and returns a Device Description Block (in ecx) for- C1 T2 c0 c* w7 b
that device if it is installed.
7 @# |" B/ N3 w8 ~* }; s8 v. {/ S' V+ L  l7 y3 V/ ^5 l1 }
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; V" z$ ]8 }  \6 Z# S& v   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( k, `3 N( b0 x9 S+ o   VMMCall Get_DDB
  Y# C% h! d/ y( P$ ~   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* Z) [3 u& _) J, o  ^( X) V7 v9 j5 X6 n- n# E  A6 t0 O
Note as well that you can easily detect this method with SoftICE:
4 B# @$ f+ B6 O   bpx Get_DDB if ax==0202 || ax==7a5fh+ D+ q% S5 J. i

  |# }/ ^- u  {, @__________________________________________________________________________
; m& P% h- z& ~; U/ q
0 E! H, [2 b* @( Q- [: C8 z9 nMethod 10
8 n' X  v/ g) @# x) y2 ]=========  `# W: n; b+ ?  D  F( e

2 a/ k/ B( l5 g2 ~; l=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. M# C5 c6 j* z: \9 }2 ?  SoftICE while the option is enable!!6 ~+ ~- B: x; _' R5 v2 w2 D5 x

9 _# `3 [  Z2 Y  N( DThis trick is very efficient:
' v2 B' M2 J; i9 ~& Nby checking the Debug Registers, you can detect if SoftICE is loaded
0 ^- I7 b8 s* o& c2 ]0 N" q2 @( y(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 w; z0 m6 ~: n# l0 W" ?
there are some memory breakpoints set (dr0 to dr3) simply by reading their, f$ p. L8 U0 k" Y8 i4 P
value (in ring0 only). Values can be manipulated and or changed as well7 z8 g4 S3 E6 M$ q1 Q& [, u1 j% _& o; g
(clearing BPMs for instance)
, ~' ]6 n2 ^' w6 F
1 ^0 L5 v+ j& y+ Q, g8 U1 e__________________________________________________________________________" _. a1 i6 E7 j% C1 o
% b: J: [" J0 [9 F7 F
Method 11. g# y7 A. s. g
=========
/ B$ k' ?/ Y5 x# p2 V& g
7 @# ~- @& Z* M5 [1 u4 B1 gThis method is most known as 'MeltICE' because it has been freely distributed
$ B1 K2 \1 |& J+ Fvia www.winfiles.com. However it was first used by NuMega people to allow
- v& s: M/ }" uSymbol Loader to check if SoftICE was active or not (the code is located1 I# X9 a, {, R, N- h
inside nmtrans.dll)." [  ]- i+ E! d: M. Q( k
$ C  E( U& V+ l
The way it works is very simple:
" z' `% N' {9 `+ N/ \' |It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 ~( O; E/ W  a2 f- g) [2 aWinNT) with the CreateFileA API.6 e& u  |' k4 c( `0 e1 J; P

1 |2 j9 r! T# e6 C8 R, I5 cHere is a sample (checking for 'SICE'):) K8 J: M/ c" q' T7 |$ q6 [

! ]! Q, b6 M8 [1 p4 @0 }BOOL IsSoftIce95Loaded()
* `$ ]3 v/ o& W6 s{
" O: d# G" a" h& g( P; }" o   HANDLE hFile;  & |4 T3 a' B# [9 Y4 @/ B8 V
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. b5 V1 f, f; B
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
5 k0 d8 h% B, S+ I2 l* o                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: H3 x& G7 V" \   if( hFile != INVALID_HANDLE_VALUE )9 i/ e! C' u4 |/ B/ E% t2 j
   {
; ?4 H& [1 R+ v) O+ \( M      CloseHandle(hFile);) D+ a6 b0 r' W! X" Q  k6 S; _& }
      return TRUE;
# E0 p( j- w1 w4 H& U( g- b   }3 B6 w& j% y1 ~& ~8 o1 j2 o% q
   return FALSE;. o0 {% b7 E9 a9 ~( h, b. O4 ~
}
9 M* G( O2 w7 Z( W% h5 b, f$ F5 q" p
Although this trick calls the CreateFileA function, don't even expect to be+ A* r, |. ?6 e6 o- s7 F+ _$ I
able to intercept it by installing a IFS hook: it will not work, no way!
7 v; o4 S0 t! J9 h4 ]0 w1 I" ?' bIn fact, after the call to CreateFileA it will get through VWIN32 0x001F7 X8 L, a/ g9 ~
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, p$ `: L6 K, c2 L; oand then browse the DDB list until it find the VxD and its DDB_Control_Proc* j  ]9 ?# i# C) X; \
field.- u; l0 g. J, @) |' _
In fact, its purpose is not to load/unload VxDs but only to send a
/ z( ^6 H" O) N8 p" K/ k, b& RW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)! h) r) n, B- U: h( B7 J
to the VxD Control_Dispatch proc (how the hell a shareware soft could try$ E% ]$ Z% z. ^, q& y* d
to load/unload a non-dynamically loadable driver such as SoftICE ;-)., v2 H0 j9 e" p' h+ Q. N9 D' {! I' |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
; X7 Y( j5 o+ [: F/ vits handle to be opened and then, will be detected.
: a6 U$ J/ q3 @6 U9 lYou can check that simply by hooking Winice.exe control proc entry point
( ]6 S$ P$ _" z+ H/ t' E) ~while running MeltICE.
6 S* p2 s& `* j  C4 P0 a+ X4 _) @" a1 f; q" x
8 p% K4 u! f% A6 n
  00401067:  push      00402025    ; \\.\SICE, `4 m. S( w! A" X" E" t9 O) u
  0040106C:  call      CreateFileA5 H0 X$ z* }0 E7 a/ l. |/ S
  00401071:  cmp       eax,-001. t, z3 `# G4 m9 h, j8 M  `
  00401074:  je        00401091" y: R) c/ l5 ^/ X% [; D& a8 s

( M1 {- Q, g# v, k  w4 p! x# ?1 @
: o6 B' u8 s% A) G2 WThere could be hundreds of BPX you could use to detect this trick.+ d4 w7 F6 i6 w) n$ s; S
-The most classical one is:
% T: D( J# o- b0 M; G& ?  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 b, e+ [: ?6 t( |. C, ]    *(esp-&gt;4+4)=='NTIC'# b; A# x  x/ D& I; w' N$ W" f

7 H0 n; ~# {( z% m; a: p6 o( I: f-The most exotic ones (could be very slooooow :-(( c, p" w, l0 ~  Z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
: _9 n( @) H) X     ;will break 3 times :-(5 S" o, H: a9 V; ]( P

; h6 {! k$ l. m6 d/ s- ]6 Y: R$ W2 `/ ^-or (a bit) faster: 8 v/ ?$ Y9 ]" n; [0 r1 c
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) X$ s- C2 {; a
, r9 R" z4 H8 S% h* K   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, a& e' x2 k0 K0 i0 x# @' f. N* E     ;will break 3 times :-(0 B5 k+ ]; ]. v! C' `* u6 _( N  ^

! r; `, q3 m; {9 O$ ]+ D$ E, Q-Much faster:3 U8 D3 J9 h& N) ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
2 u1 {* |9 @! R5 c! F- ^( b6 S! t
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen1 [) ~' B: i9 y- j3 A
function to do the same job:
# Q: n9 a# \# Y3 k* E1 M$ d# t* g8 b1 h& @# _7 g6 |
   push    00                        ; OF_READ
4 f5 s" x5 O" R   mov     eax,[00656634]            ; '\\.\SICE',05 i" W6 o: `5 n: S) t
   push    eax
. [8 p) C- t' I" a0 ~/ C   call    KERNEL32!_lopen
7 e7 ~, {8 X0 _9 `- k% B# b  u( Y   inc     eax
+ M: U; |' N; w  ?" c+ n   jnz     00650589                  ; detected- d' H' ]" X( T# p
   push    00                        ; OF_READ
! k2 t& t7 u# ~& h- \) J* l/ S; t9 U   mov     eax,[00656638]            ; '\\.\SICE'9 _( i9 m! e# ?
   push    eax
) H. M  ]! \+ K6 C   call    KERNEL32!_lopen
+ E3 C' @: B' ~6 Z   inc     eax5 H9 f- S+ Y& ~" w4 D; ^; A
   jz      006505ae                  ; not detected2 a8 k+ d! M4 L) v0 C1 B' m
% O3 V1 u' ^2 h5 v: P
6 A8 ~4 Y% S9 L4 R/ a5 j" U
__________________________________________________________________________! }6 s9 Q1 |7 I" j% c
! u; ?, x  [( F- Q: ?3 t' A4 k0 W
Method 12# b# h, @0 m+ O+ s) S. |
=========* s" }  \- Q7 a

) d  r! v2 t* |6 HThis trick is similar to int41h/4fh Debugger installation check (code 05" s  ^6 j3 w& U, }. q# l$ C- x. m
&amp; 06) but very limited because it's only available for Win95/98 (not NT)  K; u- d) ]8 @, s
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" {' _% y# ^; Y# ~! F4 {( K, s7 h9 I6 {& e
   push  0000004fh         ; function 4fh4 `0 X1 o! R- d8 b. Y5 z
   push  002a002ah         ; high word specifies which VxD (VWIN32)
/ f8 q  H" m" `6 ^  p. |4 m# i                           ; low word specifies which service5 ~* u* g* Z% _- h% ?
                             (VWIN32_Int41Dispatch)* Y2 B" f* t  t) a+ K
   call  Kernel32!ORD_001  ; VxdCall: k4 m+ K7 l. |. ^& D
   cmp   ax, 0f386h        ; magic number returned by system debuggers* g% A  c% G+ p; P+ x" x+ m* u
   jz    SoftICE_detected
' q6 y0 n9 X0 m4 u* A
% N* S9 P  P! G% Q- LHere again, several ways to detect it:
" c* C0 |+ Z' Y. s4 J4 ~9 _3 j* K- Z/ g- S/ e$ J6 m
    BPINT 41 if ax==4f/ j" \0 G: m, d+ N9 D5 z6 a
% N& `: q1 s, k& Q: r
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 _0 }" U5 c& [: p. `+ S
& K$ i: |: H0 [7 ^    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 W8 H& f( D6 S6 z( F) Y% {/ h

. @7 T4 n1 d- g' j/ o, V    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!* G2 q6 b6 v% h8 e: {

! M' e1 Y; Q! S) B/ c__________________________________________________________________________9 x0 Y$ Q& r1 n7 z! P

; D6 C6 R! B; t1 n; d5 U( JMethod 136 K1 Y& y& A: x1 X
=========
8 y+ q: Z% U) [9 ~9 ~: q5 l2 o$ U* z  F( h7 R2 ^* O2 G
Not a real method of detection, but a good way to know if SoftICE is
7 \/ O6 a) \: m1 a1 Binstalled on a computer and to locate its installation directory.
/ A" m- o( P) \5 q# [! M: VIt is used by few softs which access the following registry keys (usually #2) :
9 h2 X9 G& b1 n% x5 W3 ~' k2 _9 p8 W3 m
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% W$ k" V5 v% v, m\Uninstall\SoftICE$ ]* V. Q7 r: y7 N) F
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 r+ ~; k9 \, i$ J3 e$ X8 ^$ J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 n3 h3 a) _) d8 a\App Paths\Loader32.Exe" f. B/ l5 y, c) s  j2 H  s6 C
% d3 n/ F& a; ?* \

5 L8 V3 P2 d8 z  R* e/ gNote that some nasty apps could then erase all files from SoftICE directory6 c+ A5 Z6 z3 r$ H' P+ c8 }# n3 k
(I faced that once :-(
3 e& X. R. R/ r/ h: W
8 c6 r! F, X' q4 {Useful breakpoint to detect it:
; _$ D$ K: J% p2 C) m6 C1 V4 P) z* x
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
5 k, ^) V7 q" v7 {3 _+ u  M3 E" T9 c! }% R
__________________________________________________________________________
' n2 U5 J; }  Z# I
+ P8 g6 r) z8 L3 L: g2 V3 C% ^( `4 d! l* g+ O# z
Method 14
* R7 H, Y4 T) n0 \: M=========
. x1 X9 Z0 j3 Z3 ]% z( J- j* @/ v' U& K
8 M/ @  r7 n. }* u! G! Z9 a# E4 SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* U/ m& P+ q9 W! e3 _; tis to determines whether a debugger is running on your system (ring0 only).
! G; h) M. V+ S6 W7 n
+ T$ S7 L9 y% c& y   VMMCall Test_Debug_Installed
) L6 x6 c1 v. X, G0 x. u# C2 ?; F, a   je      not_installed
: J4 ~, v2 ^( s8 O6 [- A5 E" y! z$ q! l/ p) e/ |* d
This service just checks a flag.4 _9 I3 B( l% V: @7 J' F& e
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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