About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>$ \" E8 n* J0 J. f; d
<TBODY>8 e3 X( |, s  N9 R6 A* j
<TR>
% @  h: k* `+ G, R# i<TD><PRE>Method 01
6 w: H2 u4 r! c) J1 t=========
- U- k) d% ]8 f* N! F" P: t
0 |4 u, c. U8 c9 Z3 M+ m& v" b9 QThis method of detection of SoftICE (as well as the following one) is
9 G9 N3 X) e9 G; p1 U! pused by the majority of packers/encryptors found on Internet.! V+ C; E4 f0 @
It seeks the signature of BoundsChecker in SoftICE4 _- b2 i- O) i( F" J

" g7 p6 @( ^1 r4 ^: t) H5 i    mov     ebp, 04243484Bh        ; 'BCHK'
# F! ]) I" k4 ~4 r' g" r    mov     ax, 04h2 q/ a5 q1 _! k8 l# T1 J0 z+ m
    int     3       + n/ j3 O" I  U9 m" P
    cmp     al,4$ K! c2 _  s! Q
    jnz     SoftICE_Detected+ C7 ^6 T( u% m0 c

" E1 |9 x* X0 }# M8 X___________________________________________________________________________3 r2 \# y+ |! \& T, u5 t9 d; m! H
2 e6 _: m$ H! l; V# X
Method 023 K3 j" q- O# o6 m8 [8 J
=========& C' _6 ~, r$ }6 k2 m
# T  P  m# t; |+ _
Still a method very much used (perhaps the most frequent one).  It is used
6 h- N  w: `8 Q: v' m, V$ w. I, bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,& L/ C: _" h$ H
or execute SoftICE commands...
4 {9 ^) ^! Z  v5 U! Z  B  a8 NIt is also used to crash SoftICE and to force it to execute any commands% _, R- ^0 D  ~2 n; E
(HBOOT...) :-((  $ k* s' v* [4 r2 `" b( O

* {' q( r0 G! C* YHere is a quick description:
! U1 P% e! Q* ~& G  E; m8 D-AX = 0910h   (Display string in SIce windows). \9 k! a# {, C% j: ]
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)2 c: Q- y0 {  n8 z5 T
-AX = 0912h   (Get breakpoint infos)
3 x+ ?6 i* W6 q; p. U% R5 v-AX = 0913h   (Set Sice breakpoints)
) i; N+ f, W, l-AX = 0914h   (Remove SIce breakoints)$ S& o4 l' ^8 i1 c2 f# J

$ }  o8 h$ L% t! M1 s, Q3 @: T  mEach time you'll meet this trick, you'll see:
. W. q. v2 f( l" i0 D-SI = 4647h
' v4 b+ s+ F9 z' W6 s$ L3 C) I8 C-DI = 4A4Dh2 ~6 A$ L* i, |( }6 w3 B5 n0 O$ N
Which are the 'magic values' used by SoftIce.
2 p5 |5 m3 k$ O8 W! z3 m. iFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.; @1 _/ J) T8 W0 \8 x0 m( @
& `0 A# G- \" A: [
Here is one example from the file "Haspinst.exe" which is the dongle HASP) M9 ~2 p/ c: F8 P/ d( V7 H
Envelope utility use to protect DOS applications:* k% G, `7 F. V  {& O8 u
- q0 f. V1 S) [$ W, |6 r
1 w* T3 }& _& r  t- L7 b2 X
4C19:0095   MOV    AX,0911  ; execute command.
$ s% M2 X3 M& y8 b: M9 t4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- I: r/ Y/ E0 B+ X5 B- Y1 s% }! _) Z4C19:009A   MOV    SI,4647  ; 1st magic value.
) _& V# ?: o2 @  r5 {. I' {, G4 ^4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; Q4 |& I1 o5 ?# e, Q; F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% a7 a1 S- c, I3 L& i9 e
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 W7 {8 W7 ^) R! M: _3 y9 q0 t
4C19:00A4   INC    CX3 ]8 D; c) U8 L$ ~% Y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 i9 x' H  R  U3 U/ {4C19:00A8   JB     0095     ; 6 different commands.
+ n: y; [$ U+ B0 ]( ^: p4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; P& w4 U( s' d" R  N1 K  p4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& g: t; `$ I7 R3 m

# v; c3 n% t; DThe program will execute 6 different SIce commands located at ds:dx, which. _- M/ z. V8 H1 x: n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 j0 s- \' {$ y  u" ]+ Q, _( v7 {$ |2 t5 C) m/ \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& l3 m& t! _5 o, ^7 q___________________________________________________________________________
% C5 E+ @0 U8 r$ f# \1 J7 c  U
* W1 M7 ~& g2 J4 c; K) |, M: n, c0 ^) G8 s: v0 C# h
Method 03
2 i5 f* T% b/ E! D=========
5 }9 h6 a* n* P, N: ^
: j6 w$ w9 Q. g. a  H/ ELess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( S# e2 u+ k/ {% F" a8 {(API Get entry point)
+ y' Z# {& W, r& b5 |7 u        
( c6 t  z: M; L$ v0 j2 g, e, k' N3 V, w0 v7 E, P. b
    xor     di,di. ^( l( h$ C/ L9 I0 \! ?- ?( o7 C
    mov     es,di
. E/ Z: g6 h8 \! m    mov     ax, 1684h       9 d( p5 O1 v  ]/ B3 I0 _2 X- y8 p
    mov     bx, 0202h       ; VxD ID of winice& T- b) v( A' h
    int     2Fh
2 n4 o) e6 a& k, \* V4 b2 Z6 N    mov     ax, es          ; ES:DI -&gt; VxD API entry point) a( X- v8 j2 C' Z) A
    add     ax, di
# d0 B8 I( s. M- H$ J    test    ax,ax
3 B% U* i% f  |8 \0 p3 p7 @    jnz     SoftICE_Detected
7 G4 m3 G' N5 u+ O  C9 M( n7 G! C) k+ s9 _/ Y& G
___________________________________________________________________________
1 m& r2 h9 w6 w' w: w: ]" _( y- x6 b  B: K+ j) Q
Method 04* Y% [' a+ w  x! O9 }9 s" c" `
=========: @6 u" D( V0 k( O

0 s% n- b- t" _Method identical to the preceding one except that it seeks the ID of SoftICE
! w' y/ Y6 m: a3 L& j: x* s- N8 ^GFX VxD.
5 k# T+ r0 i# H9 }/ [, D& B* w( c7 o; n4 E3 B
    xor     di,di
* H0 e6 `! }7 G5 C# {; k( E9 E    mov     es,di5 X) t9 P* A* v7 N* d' n
    mov     ax, 1684h      
: ~3 U4 W" Z1 D7 `2 L- i$ m    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 ^) t1 ^: M( M' R  Z9 {$ V& m# U    int     2fh7 i% g6 j6 w1 q9 m5 w4 W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! r1 c  X! r6 ~: J* [- ~    add     ax, di! t9 r& e" \4 S- M6 H1 ]2 @
    test    ax,ax
3 N  H. g: G7 ?7 M, W, Q4 f5 U* [    jnz     SoftICE_Detected
* W# c- e) C: ~& u" `' K5 m5 N' o, t7 H/ V* x% t) L: i5 ~$ u2 \4 l
__________________________________________________________________________/ Y8 r2 D% a" w9 z; [# `' Z8 Z) v

( I# c" k; J( ?: O. e0 T: u4 F' y  j) q  P6 g0 P
Method 05
; p$ Q! U' U6 I. Z" j6 Z=========
; y5 e9 _  x( N7 J% s9 K
* K4 \4 z5 t) A( c/ q$ PMethod seeking the 'magic number' 0F386h returned (in ax) by all system  U  l( q/ ]8 U
debugger. It calls the int 41h, function 4Fh.
+ Z0 j1 B: C1 X7 L: R; H# l6 s: NThere are several alternatives.  : h" N( T0 Q9 x8 S
7 t9 R: n! C" Y+ O, X1 ?
The following one is the simplest:
& W1 r9 P9 |0 l
0 H3 F; l) T/ P3 w+ [    mov     ax,4fh
, ?& ?8 g( v! P, S6 s0 }) j    int     41h
( Y1 Q9 E1 k/ S/ a    cmp     ax, 0F386
% h. X; n0 H  T6 D7 j4 b/ ]/ w    jz      SoftICE_detected: q6 F6 q( k4 g' N

% U3 K3 h3 Z/ F6 Q9 X7 P/ c) I# V' s0 \; ]& x3 {% b
Next method as well as the following one are 2 examples from Stone's
5 [2 O- H0 \+ ^9 Y8 }% k* B, q"stn-wid.zip" (www.cracking.net):
$ }& z+ R, z8 B7 K! D. [9 H7 a0 G3 w; h& ^
    mov     bx, cs5 I" d) q/ s* t! ]- S: U! L
    lea     dx, int41handler2& e1 M; h( a; \" I) G* s4 J( Y
    xchg    dx, es:[41h*4]
2 J) r' ^" b( `9 u( p( n0 t  Z    xchg    bx, es:[41h*4+2]
, _1 @/ ?' @, o! ]* U" K1 I    mov     ax,4fh
3 r8 X  x" _# j* N; O) a6 R" z& i7 m    int     41h
/ n( F1 l) U0 p7 @# n    xchg    dx, es:[41h*4]2 y9 g4 ]; K, U" `; g5 E
    xchg    bx, es:[41h*4+2]# e9 C, n2 T% h2 w$ B4 m# C0 `
    cmp     ax, 0f386h+ L' Y! p2 W7 U0 y* y
    jz      SoftICE_detected
6 l! e* J  X' a3 D, O! v6 {
% k+ E8 g+ r3 W, ?  a  ]- sint41handler2 PROC6 a1 g& ]4 S) K& ^( L) ?4 x
    iret
) v/ {! f) v; P5 h/ hint41handler2 ENDP+ c6 _! N; o+ v6 ]8 Q: c
- g# r( j. r9 @6 f
4 E0 u2 ]9 ]( _  B# H
_________________________________________________________________________1 L3 G, u  _' q- M

+ u) z1 C" F3 i6 v+ z# r# i( ?' t- B  R6 S5 R$ t
Method 06; Y, \; L; k) J* s9 L6 T7 b
=========' }! x: n+ B3 ?/ ^
8 q+ V' ^1 E, i# t+ e

+ R3 |9 i  o4 r( Q$ o7 |2nd method similar to the preceding one but more difficult to detect:4 Z( _% H0 V# A* s4 c7 n
' p' {% X: q2 u, |" `
7 ?! m# a2 t# Y# r  }5 D, \, K
int41handler PROC
' z( L+ c& c; A$ s    mov     cl,al! n  g; {) r  h9 ]2 @: A7 W; f
    iret
6 q& ^3 q$ V, t& hint41handler ENDP7 x% Y' N1 l, w8 C4 e) |
5 J) A9 u. p. \+ _* O8 {, ^& A/ b% ~$ e
2 v8 \) \/ ^2 o
    xor     ax,ax
4 k" [2 j  \1 x; i$ f1 u' a+ W1 A    mov     es,ax
8 p+ `4 ~) B0 [( Q& H$ F/ T5 h    mov     bx, cs
, t) X8 o0 W* ?: P/ F    lea     dx, int41handler
' L9 A! B( ?7 P/ h9 J4 t    xchg    dx, es:[41h*4]' Z1 `9 U( m+ O4 }1 P: @
    xchg    bx, es:[41h*4+2]
: E* Q2 R+ x- e( i  i) n" \    in      al, 40h2 _; }* {$ o* P
    xor     cx,cx
8 S- E" o5 n) m2 F- |5 ~1 d    int     41h
, {: M. a) A+ r  C. v$ Z! r: v    xchg    dx, es:[41h*4]
$ i, K: H3 ^8 q# S2 H    xchg    bx, es:[41h*4+2]
( K- ]# h3 ~+ D8 S    cmp     cl,al! r4 J; v' l7 B/ I2 }
    jnz     SoftICE_detected) @" \3 f2 L6 B& o/ V
# k9 ^6 F8 Q9 o
_________________________________________________________________________
7 |# v! p+ m4 ]- w! |' j8 C! C
; V( N8 X& ~( q  f$ v: oMethod 07' O; T+ S! b3 R- X
=========
# ~( Y* w- i& x
+ p& Q- T8 ~  }2 d( f) c3 HMethod of detection of the WinICE handler in the int68h (V86)
+ S/ a& T  a1 {3 A/ ^' e8 }+ ~% C, K0 Z
    mov     ah,43h: G1 p2 ^$ k! E1 T1 [- j
    int     68h. t5 U/ m$ \* I( b: K
    cmp     ax,0F386h7 j6 j# P' x. T8 m6 l3 b5 X
    jz      SoftICE_Detected- L" o: i: g" n
4 O& ?! |! r1 i% H1 g/ C

$ E+ j: \3 ?3 r/ {3 D$ P=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
$ o6 `7 g8 Q/ x: p   app like this:
" {5 b  _5 h$ w4 G
3 W, N+ F+ z) T   BPX exec_int if ax==689 m  t# ?( h. D* o6 D8 K
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& j7 o  ?, A, y9 T& y( F% Y/ I+ I   located at [ebp+48h] for 32Bit apps)
8 _: r; K$ i. I2 F__________________________________________________________________________
* }/ p/ `2 ]  _4 I$ @' w1 ]8 z$ @
2 |9 L, K# @4 z* I
+ D& T# j9 a/ A" D" P) P# s# h* QMethod 08) I7 p, ~% i' {! o6 Q
=========5 {; a+ H! F6 X9 T

2 M9 e) i$ s' T  KIt is not a method of detection of SoftICE but a possibility to crash the
5 O$ g4 [3 |+ g; S. k# O" Jsystem by intercepting int 01h and int 03h and redirecting them to another
4 Z0 b# u% _+ ?$ j, ~& g3 Qroutine." n9 L# O& @: d& M  _  M0 I6 y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 A3 D6 t; B( h7 b
to the new routine to execute (hangs computer...)
5 ~  h* G7 C4 K4 o/ U' c+ g4 Y5 V2 R( Q+ h
    mov     ah, 25h
! ~% R  W  F, {- w, k6 D, L. s    mov     al, Int_Number (01h or 03h)2 G+ X2 t. m- L9 F: X, J  x
    mov     dx, offset New_Int_Routine( i" ~* V; L! ~' ~* A' _
    int     21h
9 a3 D9 S; G9 Y9 S* J) d- `9 K2 m9 j# g5 H
__________________________________________________________________________
1 {; T0 ~2 f% {
/ S4 |0 Z8 A2 f* ?* f( ^Method 09
/ @% I5 a5 f4 w; r2 V- i=========
0 @: j9 I- s1 N& h2 @( p1 K
" @8 ]' x5 }  I4 j4 B* v: ?. _This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only- J. V' _! a, m* R+ X8 X* {
performed in ring0 (VxD or a ring3 app using the VxdCall).6 k8 [. R8 j0 r# a
The Get_DDB service is used to determine whether or not a VxD is installed
9 T* t5 E, b7 ~4 p) r7 c$ Qfor the specified device and returns a Device Description Block (in ecx) for4 ~2 a( f; ~+ m0 {) q& u
that device if it is installed.
3 c3 r: P- y  r6 p* _7 @9 N# _. p3 q$ n& Q3 p
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 `7 a2 k; Y: @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" ?% T$ L0 J6 `, Q0 I+ R   VMMCall Get_DDB/ |1 U! |$ |# y4 ?- @7 U
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ \2 Z  E' i" c" e" s, z; q1 T6 s3 B$ v  G5 T3 e
Note as well that you can easily detect this method with SoftICE:- D* F0 E# D6 n! U- Y2 J: c. b6 b
   bpx Get_DDB if ax==0202 || ax==7a5fh
1 c0 i: a3 \6 j: C5 s3 L2 t7 e1 q* N& P, k3 k7 U
__________________________________________________________________________8 @/ D) e* A8 `* u' @, h
& ?7 m( T# P% M- h$ j  L, B
Method 10# Q' i+ H: d7 b  b
=========
" c" A' M2 K3 c$ n0 _% M6 v7 o/ ~; c( e. z; a$ C5 b
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ ]% c7 T- P% g7 v& x
  SoftICE while the option is enable!!7 i$ S3 a" P$ r0 p, ~7 x

# P+ I+ u+ W4 z9 `; F; jThis trick is very efficient:
7 _6 z& `2 z% ~- }by checking the Debug Registers, you can detect if SoftICE is loaded
( Y* n. |% }  q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. ^. M+ t% g1 P7 f
there are some memory breakpoints set (dr0 to dr3) simply by reading their
/ I5 W& {8 R& E7 |, Fvalue (in ring0 only). Values can be manipulated and or changed as well- Q% m, D( N0 R9 H
(clearing BPMs for instance)4 e2 Q) k4 f/ D( v0 p

, ^) y" {9 V8 U__________________________________________________________________________
: C$ H& O- t6 X& p+ Z2 @- u* l9 G3 _2 Z9 H4 p3 p! a, X% {
Method 11: g0 |) m3 H( R0 _1 ]
=========
& W' d$ ~" d, S9 U' l. d: ]6 x9 y! P7 Q3 G3 F
This method is most known as 'MeltICE' because it has been freely distributed( G1 t( o& y/ O: R4 i
via www.winfiles.com. However it was first used by NuMega people to allow
. x$ d" x& o+ Z8 U% d% pSymbol Loader to check if SoftICE was active or not (the code is located
4 {9 v7 G0 X  W! Sinside nmtrans.dll).
& ~6 u' l/ F* `/ k/ U. z( \& g1 `% i' z& W1 n9 U8 _7 |
The way it works is very simple:! Q. A' D  S; v7 Z4 ~
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' c/ r$ a( i$ e+ ~  A1 B
WinNT) with the CreateFileA API.
* l% v. J3 g, i; I( [2 I! c
! G! h' i) E; G4 `Here is a sample (checking for 'SICE'):) |9 b+ B! q5 f. ^- G

3 x9 [; {. ~' b4 Z  w2 r  BBOOL IsSoftIce95Loaded()
/ G2 o5 N; E* u: d; w{- F* ]' v/ ~8 h2 g! t: f# a* A
   HANDLE hFile;  
! a* F8 K2 S4 f$ X8 b   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
. ^; H" \+ R! v' U1 K. `2 N5 Z: y                      FILE_SHARE_READ | FILE_SHARE_WRITE,; M+ q5 o: b$ n0 ?# P4 n) X, o( s* @' P
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. {# `3 ~. I) Y( _6 O% l& h( o
   if( hFile != INVALID_HANDLE_VALUE )
0 K! C) V' i0 F( d% Q$ J% Q, S   {
5 i- r" ~) H* V      CloseHandle(hFile);$ i' C- q5 Z& l. S7 b; r
      return TRUE;
! R2 l3 s5 s6 [% ]   }# h5 d: c% ^. r8 j- E8 x/ _! ?. o0 z
   return FALSE;4 I  ]2 K0 Z, A, T: U; ^6 p
}
) z& m; @4 F3 i% @5 o3 D: K6 x) E
Although this trick calls the CreateFileA function, don't even expect to be
! ?" `$ }, q. W; P5 B5 r# Eable to intercept it by installing a IFS hook: it will not work, no way!0 ^% }' W7 w! H# A& t  D
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 q0 K- S0 M2 c6 X, b
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" \/ B% q/ l& T4 a) s
and then browse the DDB list until it find the VxD and its DDB_Control_Proc' |0 J1 e4 x- y6 E: k, s4 {
field.
! f, k7 t* r; R0 j: T* a, KIn fact, its purpose is not to load/unload VxDs but only to send a   U# t: Q! H9 [  L
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 Q6 A) \( M& E6 J+ N$ `2 ?to the VxD Control_Dispatch proc (how the hell a shareware soft could try1 c3 W5 {! q6 |! l1 B; u
to load/unload a non-dynamically loadable driver such as SoftICE ;-).# E% j' r* Y" z4 C. Q
If the VxD is loaded, it will always clear eax and the Carry flag to allow
; f9 x: ]0 Y( R0 {, q$ X7 l( oits handle to be opened and then, will be detected.2 y  I! U% J( W3 ^- H3 Z' x
You can check that simply by hooking Winice.exe control proc entry point4 V4 n, I$ K8 |/ B) N
while running MeltICE.
5 J8 y: J$ z# |) h' ]
6 r3 v$ E* K9 ^4 r8 ]- e8 Q* B% ^6 m3 j. |4 p" p9 ]" c
  00401067:  push      00402025    ; \\.\SICE+ J$ N2 _4 A2 D, w! k7 W9 Y' z0 e. P
  0040106C:  call      CreateFileA
# R& B/ }1 `# G! \9 N  00401071:  cmp       eax,-001
. Z: M3 y1 [/ C. j: E9 @  00401074:  je        00401091* ]" k9 R4 x5 @5 R% h$ u, c

. p; f! T- T) N% j3 B/ R( Q
4 L) M7 t# X8 A$ U6 W. ZThere could be hundreds of BPX you could use to detect this trick.
3 r: m4 o$ ~0 f  F+ p-The most classical one is:
. U8 _$ s' z1 I7 T' |- J  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( z. z( |5 D/ ]0 y' X$ n
    *(esp-&gt;4+4)=='NTIC'
3 J6 U, c! _/ A1 y$ y1 r2 w3 h' R& ]3 }9 {* ]! ?+ U; g4 m
-The most exotic ones (could be very slooooow :-(
+ Y' B1 N: v2 h& _   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " o. C/ h* a, {( I% M0 |0 ~' O) _
     ;will break 3 times :-(! \( x. R) L, p$ t: j. e

" l0 L. U4 w( w& W7 t6 ~% N-or (a bit) faster: 2 B, i. {% C: K: s" E; G
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ y! p$ k8 O$ D; L
1 W1 s6 _3 w: H7 s   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! i0 q8 U1 c3 T: [+ q     ;will break 3 times :-(0 `- {2 M: W6 i- b' A5 V( ]

  t" q- T) Q) ^% y& o-Much faster:5 ~# Z; Y+ p4 m8 Y6 S# P! t  ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
6 j$ ?- K/ ?4 ~/ b/ i# x4 F% T6 y
4 q! G! R' E1 v% ^4 W9 u/ F  YNote also that some programs (like AZPR3.00) use de old 16-bit _lopen9 H, ]: E$ i) Z+ a3 u3 s% {
function to do the same job:
5 w9 `; l% \, b0 O' ~9 o
; Z5 E5 v) ~# |# @   push    00                        ; OF_READ
1 X( h5 C; u$ k   mov     eax,[00656634]            ; '\\.\SICE',05 P( d0 e+ c" P# z( c9 B, ~1 D
   push    eax
, m- l7 x- i6 ?! Y) r3 [% d- a0 _   call    KERNEL32!_lopen
  x% E% S( f2 l- ^3 P  i   inc     eax. W) `( Q5 w3 W9 F2 q
   jnz     00650589                  ; detected
' z" T6 G. o) l$ @& a0 s  H4 I2 m   push    00                        ; OF_READ
2 N1 P+ `: k4 Y3 [% T   mov     eax,[00656638]            ; '\\.\SICE'' Z! \) Z! D- v" j& F& `
   push    eax- l- N; I* K# T1 f7 S- E+ g  T
   call    KERNEL32!_lopen
+ J* F" Z4 V# r& N. x5 w   inc     eax* q: o( d, S  Y9 M
   jz      006505ae                  ; not detected
: Z8 f5 ]$ T1 L) n0 J7 W6 v/ i
/ n- k! P# H' t
$ p1 }. p0 c0 I; ^) Y__________________________________________________________________________3 ?+ M; H! \* r0 h5 f

; d; m7 N$ [# ]  B7 C- F! g2 m/ X( rMethod 12
0 z+ V2 J, r; Q2 e& G, w4 L=========1 r) f" n2 R5 l  Q( ]
- B$ z7 C3 B* K- v  R9 P; w
This trick is similar to int41h/4fh Debugger installation check (code 05
* ]4 a8 ~; N4 L! G&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. m$ o, S: f7 _2 C. G+ G4 S! l% Ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  v6 [1 o6 N/ ^/ C% S' d
% L" r" x& E/ _* q+ B, A3 C   push  0000004fh         ; function 4fh! f& Y- [5 c. A1 \
   push  002a002ah         ; high word specifies which VxD (VWIN32)2 L2 z6 A3 e& a5 X" q% a
                           ; low word specifies which service
% C, f7 N% j  N5 N; N0 g! O  q                             (VWIN32_Int41Dispatch)
! F8 q9 C& [: E7 d/ Z" i" e" O   call  Kernel32!ORD_001  ; VxdCall
5 O5 Z4 P2 N9 [   cmp   ax, 0f386h        ; magic number returned by system debuggers2 I& V! n7 R& a' @8 u4 g! i0 j
   jz    SoftICE_detected0 T8 v, S( O# x& m2 K
4 `- i* w0 T7 v; y2 h8 }0 r+ J5 n
Here again, several ways to detect it:, h; h6 u5 I" s  T
) v' Z9 `  s! W( c% L! |& r
    BPINT 41 if ax==4f3 k1 l: _0 B4 f: u$ ]

2 R$ r0 P; t$ y. ~2 g/ `    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 d3 F* D2 l& H% ~
# `4 P2 U+ I% F
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 _2 [* O) h! c  h4 _
/ S0 g1 P' B# o  d1 {, N$ S    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" R- R+ J$ d7 l5 z+ E' v
! H6 ^1 }  L+ Y# o/ A$ ^$ _. e__________________________________________________________________________
3 U  q8 o" C$ B0 n+ F( D: t$ s; [& A/ X3 x0 z: f0 _7 r, ^3 {
Method 13: {) V% l9 v. q* w: L3 r
=========4 M+ r, N1 H( s2 Q, |
1 y. q2 c+ w9 F+ c
Not a real method of detection, but a good way to know if SoftICE is
. K: P5 d1 W. h( e4 R1 qinstalled on a computer and to locate its installation directory.* j8 P* T1 |6 v6 Y
It is used by few softs which access the following registry keys (usually #2) :
. R! E" D/ l+ b' H; E% v, k$ c1 n' H$ a/ E$ o
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) x. @7 O( l2 E4 t- v2 _5 a( e
\Uninstall\SoftICE. R: k+ `+ H2 W3 _
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ F5 T$ W" ~5 D8 K-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  x1 K' \9 ]6 x& F
\App Paths\Loader32.Exe
7 l6 N: w* V* ]" d5 I3 t8 D  {1 b+ ?- F( ^! u
& o& N8 k+ S" s& p. e7 {; |( u
Note that some nasty apps could then erase all files from SoftICE directory
, T. m3 X  l; K& Q* U3 S(I faced that once :-(9 g9 |/ ?% F% A4 z: e6 k1 Z
8 C3 Y/ |+ _! @( N3 H3 e
Useful breakpoint to detect it:
5 K( B: q6 t# ?
9 @0 Y  V) i' _: B0 s8 k     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'0 z# {0 V; }  m4 |* T2 ~
" n+ p. Z* c7 S6 b" q
__________________________________________________________________________1 U7 {/ \" q9 f4 P' R

% p: z. ^0 x0 M# \' h5 Y0 _1 W: F/ ^4 l
Method 14 % D# R: P# G, y  O: R$ X
=========
4 v$ Q8 k- g9 q1 |: C* n
+ d2 i2 y8 P5 O& cA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* `5 [; P9 \9 Z& _6 K+ lis to determines whether a debugger is running on your system (ring0 only).
& \" S& G) }+ o% ]9 y/ _
- ^3 i1 B+ _$ q: p9 E3 d; @$ R$ c4 L   VMMCall Test_Debug_Installed4 E( z- }5 N/ t& V/ a; v
   je      not_installed
: }4 F" k% C; E) C- D! Q5 H
6 m; A% d: _8 D$ ~3 m, W+ fThis service just checks a flag.
& f7 X5 C  F9 x8 }</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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