About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 ~( O/ w& v3 T7 K% n5 G8 S: I: a+ U
<TBODY>0 j2 F7 K/ X4 [% Q, ]: x5 y: y
<TR>
) ?. o1 K4 q/ _, w<TD><PRE>Method 01 4 ~7 {' a+ b$ m7 f- L; m6 N3 g
=========, `# K; e9 Y, z+ j$ a  U
1 y6 Y9 H- C, J! H! Y
This method of detection of SoftICE (as well as the following one) is" d$ b$ ~4 M3 B( u; s
used by the majority of packers/encryptors found on Internet.
9 \' H' `$ V  F4 t4 w) W, EIt seeks the signature of BoundsChecker in SoftICE
% u1 g5 S  A5 @2 h' M8 z; z" H3 E! c; P; S5 R4 k' ^
    mov     ebp, 04243484Bh        ; 'BCHK'1 [4 _2 H1 o: l  v# {
    mov     ax, 04h
9 W6 x* |. Y; W0 c4 c0 v; E    int     3       ! h9 v' [9 `1 u! y
    cmp     al,4
  v9 k! e9 g1 b/ L    jnz     SoftICE_Detected
$ z& G; ]' r5 C5 x. n4 U* q& D
% \+ T4 k$ Q. n: ]8 S/ K___________________________________________________________________________# D( A) B# `' a# S6 U$ o. j. A
$ I: `3 [; {, ]& d5 |
Method 02
( Q: V$ V7 |5 D* j; W  X* {=========
* J+ T8 _& `) W# e# v% G$ }4 {/ I0 _$ D4 D- F! z: |2 p
Still a method very much used (perhaps the most frequent one).  It is used$ }+ L6 h4 x  s8 d- M1 g+ [# P! u
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( `$ b! b$ T6 ?/ q  Z; n9 aor execute SoftICE commands...
1 u5 k+ _1 [5 t+ [% MIt is also used to crash SoftICE and to force it to execute any commands& Q& n2 k# ^. S3 `
(HBOOT...) :-((  3 y% Y. E- U. _, i/ r) ?6 u
3 d5 x& m( k0 l9 r, |, n; D! i
Here is a quick description:2 S; W9 V* h, S! X, H1 O! j
-AX = 0910h   (Display string in SIce windows)
6 C$ e2 o. W: ^! J! I-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  J. @  L3 i) l4 r$ P1 w
-AX = 0912h   (Get breakpoint infos)! H- J4 \# ]5 k  V% t1 V$ \
-AX = 0913h   (Set Sice breakpoints)
- J' r/ P" b6 D* q: q( q- c-AX = 0914h   (Remove SIce breakoints)) w; T! Y# _6 O. f4 U

0 F/ F3 {( d" W4 v" }+ d- ]8 z: s/ iEach time you'll meet this trick, you'll see:
1 p3 v' E' d8 D" A( T2 z; i: b% i-SI = 4647h4 H6 J$ k, {3 D% {1 M5 G3 S" f
-DI = 4A4Dh! [: h: ~/ b( G) ]  T
Which are the 'magic values' used by SoftIce./ r% T2 U& ?1 X* u) d
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" p/ l# g6 w/ J+ T1 N
! }- o6 Z' m- s" `# I; F! ZHere is one example from the file "Haspinst.exe" which is the dongle HASP  J$ D, }7 b& W2 X" f
Envelope utility use to protect DOS applications:
" X' W( {' Y: W% R9 I) b
1 n" q5 D5 s% k( x, C( C" O, u( ]- _9 U) ]  p$ O' L
4C19:0095   MOV    AX,0911  ; execute command.5 D2 B! x' [4 k: t) L) o
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).! l( j$ Z& j1 f. R1 Z
4C19:009A   MOV    SI,4647  ; 1st magic value.3 J! o( ?3 A7 }( ~/ X9 I
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.% z0 K$ W" M2 _. }' ]
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), f! \* e8 s' W  g' u) n
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% l: {4 u. t$ f
4C19:00A4   INC    CX$ g2 Y; I; ]7 U; F% {; ~
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  o: N2 h! Z$ ~+ G, e3 q, ]4C19:00A8   JB     0095     ; 6 different commands.
% I) N6 T1 F8 A+ {% F0 x3 u4 Q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 d( ?+ J1 a! A1 [
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)) B: m0 B! R; J* H5 V) E4 l8 G

) m+ Z- F) n8 U( TThe program will execute 6 different SIce commands located at ds:dx, which
  O4 \7 v! T* T& H0 ?* I* bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
/ u8 C; n6 q8 {  o
5 h, O. |6 A* Q# k) ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
7 M. }3 @6 O& f___________________________________________________________________________
, y- }% L) b+ t9 H3 f) {2 X8 ?$ E- p& [5 t$ a! L9 W) x

1 D* Q1 B# U5 W/ P6 ?! n( mMethod 03# p! E" ~; _0 E5 F4 t. b
=========
  w+ R) \$ u! A) A$ `, l' s8 G4 p
& N$ E1 V8 J( u, sLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 K& X9 u4 L  ^9 Z; s(API Get entry point)
0 Y; X* _) [9 j  m        
7 }0 N. S* Y- ?" L& `& `/ ?, W9 y7 `6 {) }
    xor     di,di/ Q. o8 g9 y# F2 O
    mov     es,di/ h  h; M- U# v- u% g
    mov     ax, 1684h       2 g. F& G; S; w2 d& {8 k) i3 l
    mov     bx, 0202h       ; VxD ID of winice
; \- U0 i- r0 e' W6 c8 L$ `    int     2Fh  n6 N' @# c; w. T- a( ?7 J/ e( y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ m* O1 [9 l$ t8 S( a# J$ k
    add     ax, di
; L9 g  _% V2 J) m    test    ax,ax
" ~# G9 h7 z/ g$ Z# G    jnz     SoftICE_Detected. v& g9 R: ]" L1 K

6 \: U8 R/ b. O___________________________________________________________________________
$ b2 Y2 I3 h/ D" [" O
) m) R; z7 {8 D  ?1 jMethod 04
& v3 z% i- ^7 K* O0 w=========9 \: N5 _. E6 K: j1 t( ?9 I1 Z

7 H0 ^$ }9 S6 q+ u$ kMethod identical to the preceding one except that it seeks the ID of SoftICE& i+ Q+ c; n3 a  N2 Z' }
GFX VxD." D4 ^- x' \& y& s2 S2 j

' O7 i6 t8 K1 {! x    xor     di,di% _7 p4 r) c% R" Y
    mov     es,di, \% s8 r( K1 T
    mov     ax, 1684h      
/ A2 ]) @0 [  J- e0 P4 ?7 {    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 r* {  \* n% l0 R: {3 l9 y    int     2fh
; ]8 j2 O# E2 ^/ O    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 h; f( S8 M0 M8 W0 G
    add     ax, di/ \; P; ^) I7 V; b3 V) ^* Z
    test    ax,ax- O- {2 Z5 n: z
    jnz     SoftICE_Detected
5 ]6 v7 V: S6 h1 h# @, W4 ^& w) {; v, r: Y1 ?
__________________________________________________________________________/ r( i# K: I2 f+ ?3 }, `! J

1 D/ X1 p+ w. f0 x; N1 J. i$ K4 B$ M
4 Y8 @# i: A; J3 [& k5 e& h9 Y% lMethod 05
* T7 G, D& I$ B6 T! Z& v=========2 e% W6 I2 m: B) _

8 D( l1 L2 ~) e0 l5 _Method seeking the 'magic number' 0F386h returned (in ax) by all system
0 _+ c1 G( \6 _# C* N( Wdebugger. It calls the int 41h, function 4Fh., E6 L+ U# e, `# D7 f- u; o8 T
There are several alternatives.  
; Y, J8 m1 t1 H. {
8 H/ Q/ i2 V" t$ X) k8 h; ~The following one is the simplest:9 E& L" d" l' D& Y0 c

* s! j! Q. p+ F    mov     ax,4fh  @7 Z- u: h* G7 ~% c: _
    int     41h0 h  T5 M* A9 c( o% x
    cmp     ax, 0F386
' W* |/ g9 `- P/ L5 K+ F& ^, v9 ]    jz      SoftICE_detected
4 C8 W( |2 z7 N# O7 u2 t& K
0 n0 O7 \' `5 k$ r8 N& Q. p: v2 z8 J' Z# o) C% ?0 G( F' O% v
Next method as well as the following one are 2 examples from Stone's
& D% z, [! g( o7 o" V0 W"stn-wid.zip" (www.cracking.net):
1 x# R5 b- w$ O' P2 q) i. f
# p* o% g6 U: t" I. }- s8 u    mov     bx, cs* Y5 s# g0 \+ R5 p% `6 m7 |6 a5 U
    lea     dx, int41handler28 Y; O( k, U8 ~' m0 ]7 J
    xchg    dx, es:[41h*4]
$ \1 R& y, Y8 s    xchg    bx, es:[41h*4+2]
8 ]2 V, r! b" O& _4 A* D8 F    mov     ax,4fh
2 O* i/ S0 f& L! e* c    int     41h! m2 D1 ~2 F% X, ]
    xchg    dx, es:[41h*4]
. o$ C$ b  S9 o! V9 R1 |4 [  m    xchg    bx, es:[41h*4+2]
) M( G- i  x3 l; I    cmp     ax, 0f386h& S- ^! J; Y7 ]3 R& N/ M& H* J) N
    jz      SoftICE_detected
& O! r- T" E7 h4 x( n: l9 D0 S
9 G4 j; }0 ^, Q* F$ }, l. }2 N2 {% Bint41handler2 PROC8 Y& |7 B+ e& G
    iret
" f+ @9 t$ ?5 o# W, @" Sint41handler2 ENDP0 q' n4 P" C0 {6 y& ~3 |) b

* c9 t' b3 X5 F' J  _. S1 T3 T( S/ l8 a; T- f& m
_________________________________________________________________________
; e$ ~* ^" s- T9 b6 T* g6 ~( f! l. k, q

; H* P, |/ C- L. uMethod 06
7 ?0 Z$ i, K6 d4 a. r9 W, c=========
4 u0 x$ t+ u4 |5 Q" {
& v. d* M% f* _& T3 R0 u4 W8 e* ^) v2 z3 d3 |7 x  ~  w
2nd method similar to the preceding one but more difficult to detect:: f) L# ^3 x& r" |

" A1 d' l2 L( p2 f5 Z( d: A6 q; @' a* X$ t
int41handler PROC; m8 Q; I( S0 p- ~2 B
    mov     cl,al5 `/ d& Y$ [, ^) w; i  H
    iret
% ~& l, Y, R' |% Dint41handler ENDP" k) V# {! x! N' d5 ]2 P, q" ]
# P+ `. B$ q3 \- U, c
: m" J4 D3 N2 w$ L6 V7 r. U3 O) Q
    xor     ax,ax* h6 O7 T) A% A+ j
    mov     es,ax
8 G# C( J6 U( O6 T5 ~6 c/ e    mov     bx, cs4 m0 d2 J- x7 H, g; |, E, w# P: G
    lea     dx, int41handler8 m, p7 Y4 _9 P
    xchg    dx, es:[41h*4]
4 f" }% \' N6 M) z    xchg    bx, es:[41h*4+2]  o1 g+ h0 \8 O$ s' F0 L5 U
    in      al, 40h$ I) Q4 ~- k2 J' [. Q6 |
    xor     cx,cx* A; U8 e, \; w8 e7 }1 t
    int     41h% j6 Q& s  y1 }7 a/ P
    xchg    dx, es:[41h*4]4 ^  b( q: x4 G4 a( [: N* a8 @
    xchg    bx, es:[41h*4+2]; }% ]+ Q) C: L* _1 V
    cmp     cl,al
& [7 X8 ?  n9 o' T    jnz     SoftICE_detected
( z3 _/ P+ p9 Y
5 j: a) P/ \* z$ p- q9 z- v0 m_________________________________________________________________________  e. v4 {0 j7 [1 b7 q0 r
1 n6 r5 X+ ^1 ?- X+ f' l  e1 h
Method 07
' C# q2 w% H$ _7 w  N=========; \0 {! C" Y, g' h

7 j" o+ g9 M" A( i" pMethod of detection of the WinICE handler in the int68h (V86)
3 f) X7 A- Q; {- j( D, t" v
( a; ], ]  b' n3 e+ r    mov     ah,43h2 W  M: [; ?& @. I$ z, k
    int     68h
7 Z$ _' r" g* @& a    cmp     ax,0F386h
& d7 A/ R6 \4 E0 y; M# m. `    jz      SoftICE_Detected6 [" {8 x- s! M$ f5 H3 S: Q; g# D

+ S" f7 i  A$ X- [2 O! O( Q
& H3 }0 i4 A# J/ x: Y! a=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 Q5 G, ~6 X) ~; X2 ]   app like this:
" L7 d9 b2 q& w/ K8 S' K& @6 B9 ?7 a; }0 y: b
   BPX exec_int if ax==68
* d. l: J* i; L) M   (function called is located at byte ptr [ebp+1Dh] and client eip is' B% a% p+ r  I' l% ~5 A
   located at [ebp+48h] for 32Bit apps)' i; P0 l. B! ^) s
__________________________________________________________________________4 v% `* ]3 g  ~6 B: o3 a! k

$ N: i/ ]. N- _( K9 F1 I8 C; X+ i2 V' x% X
Method 08
8 i, \6 h: ^  h# n; E7 |=========
4 ?2 b. o) S, k0 D. B- K2 F9 W# r3 Y7 j
It is not a method of detection of SoftICE but a possibility to crash the$ \* e$ a0 x- A/ `; G
system by intercepting int 01h and int 03h and redirecting them to another
3 d7 E  S) k9 A. k: D% iroutine.- i1 E, X9 V, P/ J
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: N: Q4 M3 @# u& h0 hto the new routine to execute (hangs computer...)8 R- y! E* L( d
! U- @" e. s" ~5 c7 k% S+ |- M
    mov     ah, 25h6 T  Z; @5 ]1 X4 a% k) p
    mov     al, Int_Number (01h or 03h)# w8 Q  {8 J! u8 }
    mov     dx, offset New_Int_Routine+ c0 d. f) o( a% t! \7 l4 F" ~
    int     21h
* I2 J: t. c6 X+ I4 A7 x# e; I: E: I- q1 M
__________________________________________________________________________! a) c' B2 [$ I( H$ G: j

/ U# J) D# @3 t" D& h) R! jMethod 09+ c. b, |% z8 t4 U) X" P: L/ H* ]
=========
7 `  j' T  E: O  s% z& G/ H2 I1 \
+ v" W1 q4 k0 q+ C) X3 FThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 R( O- s) X% q# n( y# Q/ r
performed in ring0 (VxD or a ring3 app using the VxdCall).
% ?  o* q+ k$ i2 g# aThe Get_DDB service is used to determine whether or not a VxD is installed
6 G3 m& ?' ~  S+ {$ Mfor the specified device and returns a Device Description Block (in ecx) for
4 M0 S1 _9 K/ {( ?4 o3 fthat device if it is installed.
+ }' K+ u" `; N; i
; b4 B1 o( Z* U& Y8 V/ t   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 U0 ^: y: v3 ^& k   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
3 ]# s, ^8 W9 i  I! J  F   VMMCall Get_DDB
9 @) b* e( X# T% s* k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 \+ j9 Y. ?* t5 A% ~% s0 \' {, c* q
Note as well that you can easily detect this method with SoftICE:4 \" B5 n* k7 }/ s# w
   bpx Get_DDB if ax==0202 || ax==7a5fh
2 Z& O8 Z2 \! Q4 J5 A  W$ y; a8 r1 R3 F" U$ d8 u# ?8 z% ^" o5 |
__________________________________________________________________________
! d, _+ ?4 t9 C2 f0 u% |6 H8 U+ n, H) c# q2 E8 t5 r9 k
Method 10
' c6 P* k$ {# c- P3 s=========( E0 b+ m9 |. W1 K3 ]2 U

2 n0 N7 A' x( r. q=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- d6 e/ F6 b$ k5 o# z6 M- E- `" `
  SoftICE while the option is enable!!
$ M& F5 |1 x) G6 c* E  H
% d+ k1 f* X3 h* q7 V1 BThis trick is very efficient:
* h6 ?/ q$ G9 Y4 l+ e, j; O, L% qby checking the Debug Registers, you can detect if SoftICE is loaded
0 _3 U. c! p' w: N(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. h9 }& }+ m0 i* U6 d6 q6 k
there are some memory breakpoints set (dr0 to dr3) simply by reading their
- X% }- r7 Y$ a0 ?value (in ring0 only). Values can be manipulated and or changed as well
" R* \4 [$ `+ i( \(clearing BPMs for instance)
1 R5 {5 I" ^" ?! s( S$ V- z
! ^. b5 ~5 ?+ N5 H. n3 y' X__________________________________________________________________________# L. P7 F; }. A: _3 i6 o6 O4 i- R
% O: u4 V5 u" G$ i9 r: L
Method 11# L9 c! Y; T! b( \* F+ J
=========
0 G, G0 f, u. E$ q! B
& i8 \7 j$ U" E% P& mThis method is most known as 'MeltICE' because it has been freely distributed
" s+ n7 ^" H' o& u1 k) Cvia www.winfiles.com. However it was first used by NuMega people to allow( ^- x7 `3 O$ A# W3 O
Symbol Loader to check if SoftICE was active or not (the code is located
$ W( f, o- W, r$ tinside nmtrans.dll).! L: m7 ?: B, x' g5 U
9 d  }; n8 C( u
The way it works is very simple:
; z9 ?9 F2 N9 ]" r7 S* |9 AIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for3 F" }9 q( O; ]& `9 m
WinNT) with the CreateFileA API.
7 m! T8 D! A* Z% z2 C0 E
8 u3 _2 G# i3 v, X* v; h9 D+ fHere is a sample (checking for 'SICE'):# f' v* E1 A: N% Q' O

( @+ {* z* I. j5 }BOOL IsSoftIce95Loaded()- F5 a2 k; t. E/ f. {" K1 X
{/ t2 M  @# a9 G5 Y6 |
   HANDLE hFile;  ; |; D! q; ^* s2 _0 B
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& b4 B% w6 }  c( P& D8 \: p                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 d, K2 t6 t; }4 s9 T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" O3 Y$ N+ g/ u  Y" I: ]( v* w( ]% E' o   if( hFile != INVALID_HANDLE_VALUE )
. X$ h7 }! \/ _1 [$ i, ]   {: M) D+ p- L+ m% S. U9 ?
      CloseHandle(hFile);
8 }( C. B7 U/ `& M      return TRUE;
. h  X/ i7 x2 o7 k& \3 w. M   }# o: ]( b4 i2 \4 ]4 s& u
   return FALSE;6 X+ F2 e3 a- \* G$ \+ T
}$ ]# p; F4 t- V. r7 R  j' A7 O
2 l$ J! Q+ b$ {( D+ Z+ E! b
Although this trick calls the CreateFileA function, don't even expect to be8 S' e- }, U. z, U: O% j8 j. x2 ^
able to intercept it by installing a IFS hook: it will not work, no way!5 @3 b& P3 {0 z; P
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
/ O! C4 o1 ?& D: jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- F; M! v# D* X4 x2 L% Z, ]- P5 M
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
) V; W6 G+ N4 rfield.+ T; }) W% T* Y, k' P
In fact, its purpose is not to load/unload VxDs but only to send a
5 o! {/ g* ?$ _" OW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 m! n: a+ G! [. U( w$ H
to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 i9 h# n/ Y3 {; c, T: U( \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).0 F- Y# J- c: w9 W- Q- I, J
If the VxD is loaded, it will always clear eax and the Carry flag to allow( m2 @' s1 g8 n2 G8 J4 H; n- p" ~
its handle to be opened and then, will be detected.
% n1 u3 C: a9 Z2 K6 |2 Y4 xYou can check that simply by hooking Winice.exe control proc entry point) V; t  w! t0 W- j
while running MeltICE.+ j% V+ X! ^7 l' u* \: O5 f0 X

) ~$ S7 C! G) d, L2 ?9 ~2 n( v5 a2 Z! J$ T* l: `4 l8 q( L7 D# G
  00401067:  push      00402025    ; \\.\SICE. b; t7 D% e: i. s8 `2 B1 s- C& Q* X
  0040106C:  call      CreateFileA
+ f9 }) {. e0 ?/ l. n1 w  00401071:  cmp       eax,-001* [4 k0 x+ {% M4 [1 M7 z. a2 E
  00401074:  je        00401091
) i" l. Y0 X' ?  ?5 I! v+ }: p0 a* h" S  ]
' D( t+ i" F* {2 G1 P! H
There could be hundreds of BPX you could use to detect this trick.  E2 M/ F* z8 h/ Z
-The most classical one is:
9 t0 g; E/ ~9 z$ `" H1 e/ y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 X( w6 F! S8 ?# Q; w' x1 z
    *(esp-&gt;4+4)=='NTIC': |) ^+ i' e  }' L" a
7 k4 C* _0 K: c9 ~
-The most exotic ones (could be very slooooow :-(
' [- r: Z7 t' ]' b2 ?1 y0 ]4 J) g9 ^   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( |# s0 h3 I# O# @7 M& x: n1 K     ;will break 3 times :-(
3 q. d3 r/ E+ D4 u5 S4 I+ b" H! a8 I5 h8 k+ l
-or (a bit) faster: 3 p, w- C# f- e
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): U7 p7 Q7 X4 c# Z, c
3 U% P) x* a7 c1 @6 v3 n* X
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
; @: Y+ L' \* M  T1 [. m* R     ;will break 3 times :-(
; N  |' n/ M' b7 d5 w5 z0 R% C. {
* y( X$ F) [" D3 v6 c-Much faster:( I; l) ~# Q/ _- T
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# t% ]8 b5 o6 ?6 B5 c
4 B- w6 |) z0 [3 L: wNote also that some programs (like AZPR3.00) use de old 16-bit _lopen  T. U, l) Z! D6 b  x0 Z( N3 B8 `; x
function to do the same job:
; O! D9 e) \/ Q  a- q+ a$ P% ~0 {  x7 @( a' A. p9 x9 N& n  E- v
   push    00                        ; OF_READ0 [  r% z3 b" Q  {' q" H
   mov     eax,[00656634]            ; '\\.\SICE',0
3 f: k. C. v, q& g- A$ x   push    eax
& U$ e. X0 Y& }" k* q   call    KERNEL32!_lopen9 N" Q% Q1 z6 M
   inc     eax4 X0 D# b+ F4 d. J  E
   jnz     00650589                  ; detected  Y* A2 J, N. j+ E5 h% D& W+ E" F
   push    00                        ; OF_READ3 j& m0 E/ f6 A* @" z
   mov     eax,[00656638]            ; '\\.\SICE'0 h. |5 J( D' R, d
   push    eax
8 _+ _* h' `" _! J3 Y, n! {   call    KERNEL32!_lopen0 _& X( x; l9 E  _2 d
   inc     eax
  o% ?& A1 A3 U+ ^1 T/ f3 s8 t& ^7 A   jz      006505ae                  ; not detected5 w0 d* A1 T) s$ y, ^. ]2 ^

0 l- ?& q' h  q7 e1 h
  `( R# C8 L. @4 |" O' k__________________________________________________________________________  ~% Z2 W0 D4 V
7 l  g, ^" h- w8 n( E# t0 ^2 G8 i+ y. x
Method 129 m& s4 y! p- f' A9 [5 C- u+ |
=========2 `) \3 i9 |' r# o& P
/ S& \  c1 B# A) R8 B/ p3 I
This trick is similar to int41h/4fh Debugger installation check (code 05
8 C2 F+ B  k2 y' u7 g9 v&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ P) y' ^8 U  O
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.# |8 J* o$ m+ O. L; o* x' ^5 ]6 [; `
- g- c6 }% s7 E9 }  m; N$ {* Q/ ?5 J
   push  0000004fh         ; function 4fh& i% {0 z7 Y1 l% t/ T) {$ W& g+ n
   push  002a002ah         ; high word specifies which VxD (VWIN32)5 p# t+ q# M' r1 o4 R
                           ; low word specifies which service6 l" S2 h3 H4 n7 v" O' ]3 i' N
                             (VWIN32_Int41Dispatch)
! x# x6 B6 S! r   call  Kernel32!ORD_001  ; VxdCall8 @3 h2 C# c4 h1 n' {+ ?
   cmp   ax, 0f386h        ; magic number returned by system debuggers
) e8 t- C3 p1 }   jz    SoftICE_detected
. o; k* U' Q& b
' h9 R7 _/ S6 P  }( t6 |Here again, several ways to detect it:
+ m0 K4 C+ r7 ?- p# t- H+ [' W% b0 }8 c* ~% X& C
    BPINT 41 if ax==4f
, y: E9 m/ ]5 [3 \- m* g, ~& _0 t8 J5 a2 i# g( t9 M- ~/ T* x
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 X1 V* K' e: y* k

9 C' m3 G  h5 _3 A1 _1 y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& T% v+ a* d' ?. I* n
- F& l4 @7 [; C, T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 }( X& t2 w) h% d  A. I
; n3 t7 \1 r# u* b
__________________________________________________________________________1 ?; `3 c1 _3 Q8 Q5 Q$ r

" H; ~7 d7 F6 U; V5 TMethod 13
5 f" x3 D$ B' p0 e) r1 t/ t/ d=========
4 X/ L, N7 L6 N0 b% M9 S
) R, f& d: }' l1 M. ]+ }Not a real method of detection, but a good way to know if SoftICE is
/ t' t; }$ Z/ jinstalled on a computer and to locate its installation directory.
) M7 R, F0 A5 q$ ?  SIt is used by few softs which access the following registry keys (usually #2) :2 Q7 i5 T! O6 z4 O

" }+ K9 m! E& U) ]-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 Q0 A) {& W2 \\Uninstall\SoftICE  |' F. q) @, a0 u3 p1 X% F  C3 S
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
8 @8 h, B" v# b-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 q. m, L# @" I' }2 N
\App Paths\Loader32.Exe
! o% A5 |* [' C; U* \
, z" S4 S1 a+ w3 g% ?0 m! t/ ?
/ E* k* B5 |* M. D  DNote that some nasty apps could then erase all files from SoftICE directory
" W5 t9 V0 N" M4 O7 |/ R, U" ?5 q3 z(I faced that once :-(* n7 Z, P' i4 V! f$ A' c7 O9 F1 w

' _  f; y$ T9 m$ ]1 l8 V% WUseful breakpoint to detect it:1 c3 t. F( U" z9 b) z$ {! R/ i

8 M, v8 K; M. K. P# U2 N8 z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
4 E" f3 j& m- _% }( J4 ~) f$ D- @/ w4 N! B
__________________________________________________________________________
$ B- r) y8 `9 g$ Y/ D0 O+ j$ b# \8 F' I) {  Q# Q; N1 _
. U7 _; t! g6 b7 h; N& D
Method 14
  w  n, z4 ?4 \$ g/ p=========
& u0 }$ K/ `+ ?7 L; B( Q" s. H: x) S4 p
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  o4 \) ]: Q" I" mis to determines whether a debugger is running on your system (ring0 only).
5 P# {4 u/ B. ~4 ?
1 s1 R' K7 q. i: b   VMMCall Test_Debug_Installed, m( H1 ?- k" F; K0 H9 z8 J2 j! E9 f6 s
   je      not_installed0 [. X4 V4 j% f- }
. |3 d6 h( a* g: N! b  I3 D
This service just checks a flag.1 h; ]- {* }6 Q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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