About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* k/ t1 ^- V' ]8 Q+ [& F
<TBODY>- }0 o8 U4 c- D  ?! l: o
<TR>5 F* i  M7 e4 T# i) Z1 [
<TD><PRE>Method 01
- Z8 F) g7 ]: J=========
( t8 Q4 K9 f  c; Z  X( Z: R
) D3 p7 X# O2 E: [) W! }; m: gThis method of detection of SoftICE (as well as the following one) is4 j& F1 I) H% s6 t+ ^$ E  t% z& \# c
used by the majority of packers/encryptors found on Internet.
* J7 P7 l# |/ b3 D; ]9 C+ j0 e( TIt seeks the signature of BoundsChecker in SoftICE' N3 w, y  G( c2 f
9 g. Z# ]& G1 _) L7 c$ i/ C
    mov     ebp, 04243484Bh        ; 'BCHK'
  `9 v* d  o( L0 z+ |2 R+ v: f    mov     ax, 04h- P% U7 R. k# n+ G2 r7 a; k. o
    int     3      
0 p: X$ c; |3 ]- G: K7 I" [* a1 G1 e    cmp     al,4
. R5 x$ x! ]7 A: S    jnz     SoftICE_Detected6 T4 U4 ]& T% `, C
' {; B8 N: W8 m: j) s
___________________________________________________________________________
8 U8 K* d) ]1 e4 r! p& ~& g) x, t3 _, f8 Z
Method 02, R4 O: s) {5 |' z! }
=========9 i: k4 Y! P6 j  G! k, F8 a
; g  H& Z6 d  n( ?
Still a method very much used (perhaps the most frequent one).  It is used. `; m, j( }( A, y7 G( {& f% I
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,: R: ^/ M# h+ d1 ?! }1 f4 `& A0 t
or execute SoftICE commands...
& o- o9 v5 N! c  a- X+ Y4 e3 bIt is also used to crash SoftICE and to force it to execute any commands
* A0 X( q1 I9 z0 ^2 H+ S" _(HBOOT...) :-((  
1 ]& ?% M' [2 [) G3 X) s2 F" U6 \4 W' d  w
Here is a quick description:
+ I, b9 P) `4 ~* x+ u-AX = 0910h   (Display string in SIce windows)8 w, g' g! A% |- P: W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 i2 p- a2 E# L- G-AX = 0912h   (Get breakpoint infos)
6 R0 L& K- g% f5 G* G3 J, f4 a-AX = 0913h   (Set Sice breakpoints)
4 c* C7 {5 B0 d$ k" A1 `" L/ Z-AX = 0914h   (Remove SIce breakoints)9 D2 C* d% ~3 N5 N& L5 [9 y

, z( n/ @3 E1 B& Q5 |6 E9 u; tEach time you'll meet this trick, you'll see:9 L2 Z( m+ `1 Y  e
-SI = 4647h
) o) l& C; f9 h9 X# W9 e+ O-DI = 4A4Dh
6 [4 u( B4 u! N0 L: S  C7 n! Z! t! lWhich are the 'magic values' used by SoftIce.
; N! z* N9 K: b/ }  o4 c, }. l( OFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.! o% G8 {. ]" ^, M- ^4 F. ?
! f8 z+ L" C1 Y! G- b
Here is one example from the file "Haspinst.exe" which is the dongle HASP% Q$ z- w4 n4 [" e7 \. l( q' ?
Envelope utility use to protect DOS applications:
( H; Z% e/ _  K7 q8 Q( W
7 W/ w1 ~( ^+ |1 l! y. u
8 r7 x" e5 {7 e: H, i& h# b( W4C19:0095   MOV    AX,0911  ; execute command.
/ \+ D$ U3 y4 z- e' w+ }, y. v4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; J2 V: ^; b1 @+ U
4C19:009A   MOV    SI,4647  ; 1st magic value.+ f9 A+ w. F  A7 d9 F5 A5 j
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.% ]- L) r$ V( K. d
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: l2 I5 A5 }. d' B0 ^7 y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
8 T* [5 H5 |, m5 F4C19:00A4   INC    CX
; r/ k! L  @# K+ V% b4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 h" x. ]; f/ |. @
4C19:00A8   JB     0095     ; 6 different commands.
9 J3 @, I8 P; [" Z( Z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 L& ^5 j7 S7 R+ w$ a% i% C$ I
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 O8 N& J: k: |. N

% e/ i+ ~# ^9 G' U: w- l% n+ X5 |The program will execute 6 different SIce commands located at ds:dx, which) Q. J8 E  }5 o2 _. H9 X6 d
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 O0 I! q3 \. r$ C5 @1 p
/ F5 c& m& D/ B% k" U6 P" p3 ]
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* B, Y1 ^  ]! N3 I1 X7 X3 z- m: y___________________________________________________________________________
4 _; J1 ~4 F2 u' o" u  \3 y3 Z5 g- W  [; b
% A; g2 J4 k3 N1 d( M$ S
Method 03
. ?. A* s+ M( @9 P3 g5 C=========
. j' }) ?( ~6 g* b' D5 s$ v4 H6 q0 R2 E4 o4 [# Y
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 B4 V( a8 U: S$ H* Z' e
(API Get entry point)
# }" E8 [5 z3 t+ z1 k8 q  p        % X. o# T# a: F: d* V: }% {) Z
4 d3 u4 Y+ i6 d8 m. X
    xor     di,di
: x# l3 d' M5 s: _8 H    mov     es,di
" C; E% }, V: N, H    mov     ax, 1684h       4 n- r+ T' ]; _1 t( H7 T
    mov     bx, 0202h       ; VxD ID of winice+ P( K% v. w1 R" b
    int     2Fh
8 }9 [3 u4 E4 T* Q$ {8 J7 o    mov     ax, es          ; ES:DI -&gt; VxD API entry point; x5 P2 n# o; s; k. e- {
    add     ax, di
0 i0 R8 O) l, o3 r    test    ax,ax
/ Z" k) ~. V( O6 t    jnz     SoftICE_Detected' i9 c+ c" w& S5 _0 l# v+ N
* `3 F* i8 V$ Q0 d% J+ \0 L
___________________________________________________________________________
, h1 v  l$ ^9 @0 H* a; j3 L
. ^5 e$ |' I9 [# jMethod 04
0 V  F# A' i; u" x) \# O: x( W  E5 G! a=========
5 I% g- Q5 T* l( H$ P* r+ }
$ |3 d) [0 l5 g4 L" D$ FMethod identical to the preceding one except that it seeks the ID of SoftICE7 I2 k  y+ V- j1 v: a: \. Y7 X
GFX VxD.3 m/ U, a9 X2 ~/ J1 U

# Y  R+ R) S( E, h" d: C5 ^    xor     di,di
# j, M. O" \! M- w. r0 a+ _0 N$ ?0 }    mov     es,di. w3 P) l! V/ N# R& x/ u
    mov     ax, 1684h       $ c% z/ ^! Q( r: x  q- F
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
' H8 b  v" ]0 `* u8 g  H2 u    int     2fh, {: p6 G, r; b" w1 n5 H% w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# R9 Q* D- w8 E
    add     ax, di
( y( O+ c9 B/ I% C( t8 k    test    ax,ax
5 b6 M: e' n' E: R# B$ v    jnz     SoftICE_Detected# a- x, i* i3 i5 z% i9 Y& T
; x" B& z  a5 L' R- K
__________________________________________________________________________# {6 Y) {- [9 B

% a  `* L0 ^8 g4 ~$ S
+ G3 t5 S4 l4 d. @/ uMethod 05
2 V! h. P4 s  K2 w2 i4 g- `& `& g=========
9 O4 x0 G6 ]' M- m! p% f$ u4 U: l" ]" K. |
Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 g0 f. n: L5 {- U" C' {2 sdebugger. It calls the int 41h, function 4Fh.
5 @' D8 b$ \1 x/ e6 SThere are several alternatives.  
+ |- V% Q4 u7 ^) U6 M! U7 R' q) z( R
5 G) Z$ X6 L; m$ YThe following one is the simplest:
0 X# r& i7 b0 ^# f4 v& x9 S; N2 d  _- L7 w6 h6 A7 H, M
    mov     ax,4fh: b4 m  W: O# t1 o+ @1 O, ?4 d$ _
    int     41h
6 M' q5 ?8 H0 q2 `0 Q+ H    cmp     ax, 0F386
; E" J( \1 |3 Q6 r- Q    jz      SoftICE_detected
) }+ h# \3 v" U/ h: u. ]& I  [1 W) f5 t8 y
: c8 a/ \! ^% Q& k1 y0 k
Next method as well as the following one are 2 examples from Stone's
( ]# v& X# H7 {; Z2 Z"stn-wid.zip" (www.cracking.net):
) \+ X* d1 K$ z- o
1 K" W# I: U7 h$ s1 h    mov     bx, cs
- Z: \$ b7 a5 X! @, D  r, Q2 T    lea     dx, int41handler26 O0 I9 S0 {$ }6 |% x
    xchg    dx, es:[41h*4]4 v" x" R$ K5 g9 Q2 o
    xchg    bx, es:[41h*4+2]9 x0 J+ M/ A: |( b6 [
    mov     ax,4fh
9 m% R3 ]1 }1 m" N' ~- I1 c& x    int     41h# A  h/ b/ o1 w4 v! U
    xchg    dx, es:[41h*4]+ Q. v+ g' Z" `7 x! V+ {$ G
    xchg    bx, es:[41h*4+2]8 i. Y0 M( m' b- J
    cmp     ax, 0f386h
1 v% e; C0 ]+ ~- v7 f: B    jz      SoftICE_detected" `! o) G3 D: }! A4 k  c

* |0 a7 K. C! R' _& P9 C/ o! Bint41handler2 PROC
! X# }% N6 m$ [( m8 ~    iret
/ o8 ]5 ^" f; l/ e" i4 m' h- Yint41handler2 ENDP
( \: r# Q1 z5 W
4 C$ t* w5 Z' ]8 T+ p: J% k9 I- z; C9 ]9 o
_________________________________________________________________________
; z' v9 d2 \: X  c0 F; P+ Q4 A. n5 d7 e& |5 d, {5 {7 S1 M
4 ^4 Z9 Y7 @, k5 T
Method 06% |% n6 Q% ^4 z8 r# V! u8 y6 g
=========3 v8 Q4 v; [! s% A' n( A" t* Z
) ?& r% R1 V2 r; u$ y" v3 R. u

3 A) R1 M4 V, }% m+ s- D5 `$ r2nd method similar to the preceding one but more difficult to detect:
* t( E0 `& t& y& I0 ~9 @3 _4 {/ r& t( f! Y6 v/ I4 o* J# Q% [

9 C6 D4 y; |& D$ v! B6 \% ?! pint41handler PROC
- x6 @7 k. R3 p/ d; P8 k' p    mov     cl,al
' K5 F, g  Q. s0 h& X5 @+ a    iret
. Z# H: X) j# D$ D8 G9 `; vint41handler ENDP) Z1 q9 Y5 c6 P* U# }7 y
( N1 q0 k; J* m& F. `

- H: X+ x% s7 @) J. s& n    xor     ax,ax
$ V. u4 @; }3 O/ A& }    mov     es,ax8 a/ S3 S) ]! a3 d
    mov     bx, cs5 _8 m& N. y, O0 N) d
    lea     dx, int41handler
1 E/ [* O4 \, J6 Q9 z, W" `1 x    xchg    dx, es:[41h*4]
8 b0 P# ?, x1 Z8 Z: ~    xchg    bx, es:[41h*4+2]
* P+ E/ B2 \5 _4 C7 ^0 u    in      al, 40h1 ?: X) O9 C) z2 J
    xor     cx,cx, s% m/ P: K6 h9 o& D" v$ W
    int     41h1 y  w1 w" }- U- H. t6 j6 q/ x
    xchg    dx, es:[41h*4]
% E( D/ o, M7 `* P( W1 _" m# J0 W    xchg    bx, es:[41h*4+2]
8 g7 _0 d6 ~- A8 K& y    cmp     cl,al3 I) ~  \. o% v4 `. B
    jnz     SoftICE_detected
) h7 Z' I+ @7 S( L
! `& i* T% z/ o1 {: F_________________________________________________________________________# \5 J. y' W2 V2 |" p% k

! e% w/ j% T/ FMethod 07" s9 u7 j9 B) M0 c- o
=========: s$ V0 {: W' U0 O" f1 @& I+ C
; k+ q/ c6 c/ _0 u& P
Method of detection of the WinICE handler in the int68h (V86); f2 B8 P* o7 u6 u. F. l% _! g% B
3 L; q9 h5 h  i4 o/ K% x
    mov     ah,43h1 }" @0 b5 y$ v6 x' v; e! N
    int     68h7 q5 }7 d5 U9 A/ c# P9 y
    cmp     ax,0F386h
2 T1 A- V3 }$ S2 N3 M4 V' f    jz      SoftICE_Detected
4 o  v% u' N$ W! J& @+ R( H$ G
6 `1 p* C6 z6 s! x6 p0 S* v4 q$ {
& H2 l, j" Y* W$ j=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# V, s$ x9 K8 J0 A1 d" j% j   app like this:9 l( E: ]. X- _) c

1 j" ~/ i6 N9 S   BPX exec_int if ax==680 x) \8 j3 {, V8 X: c
   (function called is located at byte ptr [ebp+1Dh] and client eip is; _# g( x) O& K2 e  ]" J
   located at [ebp+48h] for 32Bit apps)8 ]/ l3 e: O; V: b* s# z: N4 a
__________________________________________________________________________5 f2 ~( ]) l: l0 H
# U, t  o+ u  K- c1 E! `2 {
4 n- w$ }/ i8 C2 W& `6 S5 a& K: J% V
Method 08
. Y* l: Z$ G) p% p=========
* q* X2 o2 P% Y
, U/ T5 r3 [! _! V) uIt is not a method of detection of SoftICE but a possibility to crash the
  Y; j3 w7 w* K/ D, d9 s8 K4 Y' J2 usystem by intercepting int 01h and int 03h and redirecting them to another# C9 @' A( G6 _% n& x
routine.
, m( O: O' J1 T0 e1 fIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 t/ K2 i$ V* E8 L5 a  W1 p
to the new routine to execute (hangs computer...)
* D8 L, p% u( \7 n" v" {2 R4 o+ X! j0 W5 X
    mov     ah, 25h
: A( P2 V: i% U0 Z" u, J" g    mov     al, Int_Number (01h or 03h)! t  a  |% Q1 E' l: K
    mov     dx, offset New_Int_Routine
, a  i+ U7 c, r+ y) T    int     21h
8 \2 W# [* q% F0 d9 V0 S+ D. j# e* K& v. N
__________________________________________________________________________
3 X! d' }, |3 l& ?
2 L0 `# ]3 ^3 ?9 _Method 09/ c8 e' l3 B1 f/ g$ Q, v
=========6 k/ f/ N1 T: B7 @
$ {  b8 a4 y- d0 S3 X6 A( @$ k7 {
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 L( M! O  H; \+ a4 C) yperformed in ring0 (VxD or a ring3 app using the VxdCall).
  r7 V. ]. f9 G8 eThe Get_DDB service is used to determine whether or not a VxD is installed
+ x! A7 |0 H1 Dfor the specified device and returns a Device Description Block (in ecx) for* |; C& B  S  r& }, P
that device if it is installed.
4 s6 u8 a& c1 H, u) F* O$ u; }9 `( w* k1 L1 ^  g
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 i# x- A9 W7 X( p. z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 i; Z2 ?. G, g% L2 k9 Y   VMMCall Get_DDB
) D) a' }" [5 x& Z. O# ~   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed, F% r) o- g, p' [& v: S; z! \7 q6 y
5 z' D; j2 q2 I& e. i% Z  l: s
Note as well that you can easily detect this method with SoftICE:
0 A7 O, S5 M0 ~; u" d   bpx Get_DDB if ax==0202 || ax==7a5fh8 I$ J# L+ l2 p5 i* u. ?" T# k% S

" @/ I2 [% P7 I, i__________________________________________________________________________  u% H3 b6 D. D9 z( l; \4 P
+ M6 l4 s$ A+ r8 @; [  A5 q4 t
Method 10
1 z) U7 W7 s# O$ K, _; x=========7 U; n) U' v5 I! w

  ?3 ?' J6 j: {& V9 H=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ S( `4 k1 f2 W- f
  SoftICE while the option is enable!!
/ K* s5 \& Z; c0 E/ q1 j
6 x6 U7 J. q6 i- E- I! O$ M  }8 bThis trick is very efficient:
+ }; R8 {/ |! a# V6 Sby checking the Debug Registers, you can detect if SoftICE is loaded4 k/ C3 R# [# z, c+ z$ E
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# T5 X/ R5 N2 t; w: M6 J' c" Mthere are some memory breakpoints set (dr0 to dr3) simply by reading their/ h) |* W6 r6 f2 b6 `/ y6 @. N( l* i
value (in ring0 only). Values can be manipulated and or changed as well2 p, h% B. I* T+ U
(clearing BPMs for instance)
2 e. i* g2 I5 p7 T" Y* N; ?( O7 H6 |+ T$ E
__________________________________________________________________________  }; J; P. o3 U0 K( @7 R, b  W

* t/ H) m: ^; G* P6 h' b1 ~Method 11
, f0 E2 U& U3 m7 E=========
. M2 `) q4 _7 J
! a; j  _6 X& QThis method is most known as 'MeltICE' because it has been freely distributed
4 Y# {! X" V' \) \) r; `- K7 k" uvia www.winfiles.com. However it was first used by NuMega people to allow
; a; w) M: ^+ d3 I' [% ?6 i4 TSymbol Loader to check if SoftICE was active or not (the code is located. L+ j( [$ t& x3 C
inside nmtrans.dll).
: z0 C. t( w! I; w
, T5 C$ }3 k- r5 z' ]2 IThe way it works is very simple:( T; _- b  g) m: z4 H  ]  a6 a
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) Y1 e4 _% A, v" ?6 |  [. [
WinNT) with the CreateFileA API.7 d& |4 m% u. R- \( O

3 ~) J0 q: l5 B0 T4 M8 z  {Here is a sample (checking for 'SICE'):. w: `8 \8 z: ]

* V/ D4 e+ `# MBOOL IsSoftIce95Loaded()# }! T& h/ X* Y9 a. |" [
{
9 O- }9 D- f/ p( g, s( q. H   HANDLE hFile;  % T- T% U. l6 `4 ~+ U) Y4 |' d9 {
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) f5 H) C) G3 I7 N8 I$ G, ^! J                      FILE_SHARE_READ | FILE_SHARE_WRITE," y" |+ @2 Q0 Z3 a
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# P" Q' |; e3 O8 S& {   if( hFile != INVALID_HANDLE_VALUE )- i8 \* h  l) K% A0 G
   {0 P( h( A$ U0 s* R
      CloseHandle(hFile);
/ ^. ^; I" {! v# Z$ X      return TRUE;. n" i% C/ C/ @/ A) K2 d) j
   }
1 ^# _& w9 z& g/ x9 _( u   return FALSE;/ l& U/ {  l' M& h+ L9 f6 O
}7 S0 b$ n' N5 o0 @
& k0 S4 _: |5 e3 T+ w
Although this trick calls the CreateFileA function, don't even expect to be
4 C4 }, y  _' X1 |( U% f- y' ]able to intercept it by installing a IFS hook: it will not work, no way!/ Y8 P: E; Y: p( |# l7 P
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
; W# k& j% y; }4 I. Dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); l7 }9 q$ i  [' ?  I- J/ ~
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 u- `. l9 L* e. ]" V% V: z; Nfield.* u3 D" U* N2 J0 j$ F
In fact, its purpose is not to load/unload VxDs but only to send a : u9 [- x$ s3 E2 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  X5 U& T7 E3 S4 x
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
  y3 @5 |0 |8 _7 jto load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 J/ S2 I8 a4 ~! fIf the VxD is loaded, it will always clear eax and the Carry flag to allow
! f+ O' U. x7 Z% P8 K+ g9 qits handle to be opened and then, will be detected.
# J8 e3 Q" E( HYou can check that simply by hooking Winice.exe control proc entry point. N# F- L1 A/ c7 a
while running MeltICE.
" {) N4 G% b. r3 Z% `( @
. D  ^  D2 V% s- d/ E+ X3 e3 }! C7 E! B' V6 C3 Q' T7 s
  00401067:  push      00402025    ; \\.\SICE
5 @2 ?4 H! A9 h' \  0040106C:  call      CreateFileA
& A5 Z* m/ p4 T- q, m- ]) d, ]  00401071:  cmp       eax,-001
0 {% A) P7 s; }5 c  00401074:  je        00401091
0 n% \. _6 O" D; h& |# `! x6 Z0 m) E  K+ r  ~' Y' D

( D" C/ m# G; Q( s! H, UThere could be hundreds of BPX you could use to detect this trick.
  W# _0 s3 W0 y* o-The most classical one is:
0 X. A2 A! ?2 ^- n) |  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
  t. V# H. N7 m9 R# T. G% |1 U0 G    *(esp-&gt;4+4)=='NTIC'( L7 N* W8 Z# C; M$ [+ M+ i8 H
5 D$ D! s7 b2 R& x8 o
-The most exotic ones (could be very slooooow :-(- a8 l9 o: l+ q% i3 e
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, ?3 J) y) u+ k- \- Z9 l     ;will break 3 times :-(6 S4 W" v/ w/ C
* k) U+ `" g; q, u6 w0 W
-or (a bit) faster:
- B. g% g- S+ y/ W! N' l( j5 N8 I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 ]1 t" w, j8 K
, A0 b! N/ e6 H  O  @$ O   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 ^8 U4 r" z( P6 @( V  \     ;will break 3 times :-(
! F' |; W8 n7 L2 T+ j0 B# A* @; D; P/ {  C/ y" v# w
-Much faster:
3 k1 c8 M# `+ h6 m! J$ a   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# f% X3 K( o3 D- y

- y" D  h( e- l; B1 E& g. HNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
7 {, _2 c; p9 S& afunction to do the same job:
/ P4 V  ?! ~& L( g8 w- K+ l5 L8 m: v
   push    00                        ; OF_READ
9 m6 G9 [) O* I& {   mov     eax,[00656634]            ; '\\.\SICE',0% a+ P8 I) C9 {
   push    eax5 r$ a: L, k% W; c
   call    KERNEL32!_lopen- a* t- o  ]' L/ c
   inc     eax% n, e; Y; P7 v7 R0 D' T% M
   jnz     00650589                  ; detected- R/ T9 \7 h- z1 o) u& l
   push    00                        ; OF_READ( k% `. V# h! ^6 O; v( c( n
   mov     eax,[00656638]            ; '\\.\SICE'9 q/ G( X; g7 ?
   push    eax. [' t1 z: o) u! @: y$ O0 K; K
   call    KERNEL32!_lopen
& f( V7 J: }( X' M+ M8 p# y: t% U1 W   inc     eax
* U2 t0 V' G$ H6 q) \   jz      006505ae                  ; not detected
3 e3 S- H: c; q* r" E
7 u) p/ u% M9 ?" G2 q  R: _$ |2 k# d! {9 O2 d, T$ Z$ t# Q
__________________________________________________________________________( J2 x7 r9 ~$ H
/ c0 B  W" C( q: s
Method 121 _) n- L7 n' h: G# A( `& S
=========3 {  B4 i8 o3 ~

6 l+ s+ t$ M  m0 }, }' vThis trick is similar to int41h/4fh Debugger installation check (code 05; e3 m! d& }% a2 x; ]! M
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
7 h: K7 k3 M9 \6 R: aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ M- r: Z; C/ u$ @: q, N* B: c$ d7 |, Y' m! Z& ~' J2 D
   push  0000004fh         ; function 4fh
) j, M% `, D, |   push  002a002ah         ; high word specifies which VxD (VWIN32)8 j; Z6 L0 ~: A7 w, i
                           ; low word specifies which service1 I: E$ a2 n1 ^; r& N: d6 Q( M
                             (VWIN32_Int41Dispatch)! \5 s9 Q3 o2 E7 s# ?
   call  Kernel32!ORD_001  ; VxdCall
2 \/ N; g6 h/ ^3 N( ?   cmp   ax, 0f386h        ; magic number returned by system debuggers
, i) g( _% i6 N+ x  @8 d7 }   jz    SoftICE_detected9 x  y. B4 N+ J3 a" e) J2 Q9 w
  ?, }0 l! U% r( U% a( d
Here again, several ways to detect it:
( M  V( J+ X! `, A5 L4 D( \) q( D
: Z$ ?# k2 ]! a    BPINT 41 if ax==4f3 i& n/ x1 n+ g
9 O( `: h# g& {0 T0 x) e( {8 ?
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- p5 `; Q; c6 _& ]! L$ d

4 w; y: b8 V9 [' }6 U' H    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A1 g5 G& n1 ?" O, M9 J( s5 P# i9 ?1 d

5 I% E2 v; R' f2 a    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 r- K1 N' z, \9 z" R  H& V7 j/ |

) e5 |3 [7 w$ u: ]( J% @, K2 U__________________________________________________________________________
7 q# h; q6 ?& x: K! T' S6 {
( Z8 N" N8 B3 VMethod 13
: W$ t4 @2 Z) e' H, @=========
- E( z' \; v4 b4 K' w4 F! ~
2 l5 B. F5 W$ h7 VNot a real method of detection, but a good way to know if SoftICE is
" ?6 f  r( p& Q: P4 Q8 B& Ginstalled on a computer and to locate its installation directory.+ t* ]0 z$ d- M! K4 p
It is used by few softs which access the following registry keys (usually #2) :
, m& j( s5 D; m  d  K3 |. U6 o+ x8 Z& ?7 H' ~- }6 J" X
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 G& A% n+ R0 f+ Y8 E# a& ^
\Uninstall\SoftICE
# I% r8 q. o1 G# M3 u" ]; {2 S3 Q7 {-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ E6 M3 g, x2 k$ h* t+ }; f% s
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 b4 i( O1 W, M# E\App Paths\Loader32.Exe
9 A% w. B1 B+ C+ y2 o2 u2 a: f6 Y9 k, }% S' s2 C( r6 {

) t' E8 r. |6 {0 RNote that some nasty apps could then erase all files from SoftICE directory7 R4 a% v$ R3 J9 y3 _) O
(I faced that once :-(4 s, |% v/ m3 [6 W
/ C0 q2 s7 ]( f( i% G, C* B
Useful breakpoint to detect it:- y  [# J% N9 ^0 g7 y) a2 _

1 M  _: Y# a  A. s     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 i' c. k: B. f; @

" y4 r: N( i: V__________________________________________________________________________
# h4 S( N# ]5 n: s4 i& d7 C* n( T3 C& ]+ z& Z$ K+ F

8 I" a1 h! v1 ^. C% `' CMethod 14
6 E# h/ M" ~* [/ k=========! m7 k! y7 m' T# ^) [& U

" ~( ~: D  K" H4 k: b& g9 U4 \A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% C# t: P3 E& ois to determines whether a debugger is running on your system (ring0 only).
2 f) v' X! O( F) x7 u* |, x$ F8 t* K/ Y
   VMMCall Test_Debug_Installed
4 f, W/ U8 R9 A  A7 F   je      not_installed
% u+ k# r2 {# a: S+ T5 K! s* b
This service just checks a flag.3 W! S. K6 n% w& d1 T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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