About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
6 a, s- C# F8 a, ]<TBODY>
' ^8 @9 Q/ u2 L+ W  L<TR>& V- X! ?1 d- _* D
<TD><PRE>Method 01
( N8 X+ m3 ]! @! _=========
6 R/ W% J3 C' Q/ T$ f$ n- Z0 i+ a- [  h2 g; n
This method of detection of SoftICE (as well as the following one) is  l! n7 x; D' h, C% d
used by the majority of packers/encryptors found on Internet.$ Q# ^  C0 _6 F* S
It seeks the signature of BoundsChecker in SoftICE
" p- ~4 U) I, {7 G8 a) S: o- M4 S
$ S2 D! ]& f( R" Q    mov     ebp, 04243484Bh        ; 'BCHK'
  O: z: X+ {. W$ h% V) _    mov     ax, 04h; I' V' T4 S4 e; r! S5 U+ ]
    int     3      
- a0 J8 c5 {4 [$ A; b    cmp     al,4
- |( `, c. b1 t0 P/ F    jnz     SoftICE_Detected
0 P! S9 G2 r' i1 L) r0 J
8 j" y2 I) _8 l8 \___________________________________________________________________________/ b7 `, g9 W/ c; T

+ Q: d, T& I$ t* u! ?/ q; QMethod 022 G/ f% e' ~2 E# b' q7 j
=========
; D$ y. t; _" k( |/ v' r6 @0 X, d% z5 |+ b& ^0 ?+ z
Still a method very much used (perhaps the most frequent one).  It is used
+ {5 `0 _, r- |3 j' g4 D' h% m6 Kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 w, k' @  @/ U) w# Y. f
or execute SoftICE commands...; a, j: e% q, ~' V% ^* {! T3 H
It is also used to crash SoftICE and to force it to execute any commands" [- s+ z, E3 s3 I
(HBOOT...) :-((  + i( F5 c& f) J$ b) D. h. M! N

. u! _: z) a8 X! d, m# O  a7 OHere is a quick description:; f) J# J: F7 v4 w
-AX = 0910h   (Display string in SIce windows)
* t& ?! z4 z; F) o/ S6 Q) H. T-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 F0 }' m8 z$ [' o1 L-AX = 0912h   (Get breakpoint infos)$ c7 y6 B! r5 ?  F8 z
-AX = 0913h   (Set Sice breakpoints)
2 i4 {" ~7 A! ^) G+ c9 _( ^( k) I-AX = 0914h   (Remove SIce breakoints)
0 H( `) R( y. |7 f8 ~$ ~
& {6 F. ?$ r+ ~" OEach time you'll meet this trick, you'll see:
- R7 I3 o$ Y* C/ l9 A-SI = 4647h
$ @8 A; A" Z' G-DI = 4A4Dh/ e' V* |4 ]- Y
Which are the 'magic values' used by SoftIce.
/ X! i6 v0 G8 b2 z, W+ D* gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! V3 H5 Q2 d% h3 q2 Z# K8 Q: ]2 I2 m- k/ U
Here is one example from the file "Haspinst.exe" which is the dongle HASP4 ?8 e* e: A0 F" j* J  G4 a2 Z1 n
Envelope utility use to protect DOS applications:
6 }& f- V/ k1 Y# C# A* P# W
9 S* P- \8 G$ O5 l) P  A7 E3 t" G% N# v" P: ~3 h# @4 d& J3 V  B" Q
4C19:0095   MOV    AX,0911  ; execute command.9 T% ~) f8 S  k0 i- k. L
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
; L  R4 {/ P8 v* Z4C19:009A   MOV    SI,4647  ; 1st magic value.; B" A3 N+ _4 f0 ?: b" i# m' q1 x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ l1 l; d5 k2 e" |4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 t) n3 M. a# ?8 T! o0 b
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute5 W1 k$ g% ]2 l. J; h* _
4C19:00A4   INC    CX- c; `, r! Q! |6 {& h7 \
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' f" E' f1 i7 J+ \
4C19:00A8   JB     0095     ; 6 different commands.; K0 k' t- `- }# N2 p  c
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
1 ~+ l7 A* P# G4 B8 f2 L/ P4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
  k* Z! N9 c5 o/ j
' O9 x- b2 z' zThe program will execute 6 different SIce commands located at ds:dx, which
( U( W) c5 i" H! D1 e4 O5 a1 Lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 B) V2 b; e6 e8 Q
3 R, g) v4 m+ w3 O& k6 _6 ~  [
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# c" s% b& N4 N- J
___________________________________________________________________________
5 q2 o+ M4 \7 r$ J+ n8 P: i
+ C/ w* t  p9 h! f6 ]* E9 f  E5 s6 J. @% O- Z5 `& Q9 Q# k( S2 Y
Method 03& a& z7 \4 v3 K$ E: [7 X
=========
: t: u  f+ ?8 w2 v' m! Y. Z7 v# R2 c$ O! {' s
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* i% Q( R0 J9 F8 f. V) Z
(API Get entry point)
7 X# k- [  N4 a( O        - t4 C- b% \* p7 M4 D# K% ^

0 e9 O5 _# H- U7 U+ e+ d    xor     di,di
6 W5 O6 N) {; p( w6 u2 \( o$ e+ e    mov     es,di
! G1 K) {, g; p    mov     ax, 1684h       8 g9 p/ B/ G9 X: K0 n( |, U
    mov     bx, 0202h       ; VxD ID of winice$ c* ?( O( s6 c3 Z2 ~" o
    int     2Fh: ^6 B1 F1 x% M3 B8 P' d$ L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 a! }/ y; h0 ^" ?( s) G- a* N
    add     ax, di$ s; l: z' w) W3 M6 F
    test    ax,ax
9 t5 Q6 Z" \2 c3 u8 S- e    jnz     SoftICE_Detected
) z6 e  r  `# i) h, s9 B
  t1 |/ L7 g/ ?6 H___________________________________________________________________________
/ P: w8 i/ ]$ V/ \5 d; ^! O/ a' e- J# T5 q, S) S& O6 ?
Method 04
1 K2 m$ f) w. U; K- p% J. M=========" `' J7 e0 |) ]

& o5 N) F( C0 hMethod identical to the preceding one except that it seeks the ID of SoftICE9 e+ ^# w: i% m) w7 S8 I
GFX VxD.
  f9 y% Q4 e5 z0 N
$ t7 u- \3 t" M5 a; K: z! [# w    xor     di,di
5 V2 ?! w2 x( C# j    mov     es,di/ J, T8 m% r; ~* F0 m9 M* W8 n- I
    mov     ax, 1684h      
' a& N9 o" {* ]5 T) U, z. P* }4 U" o% e    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% R1 |4 K2 J4 F2 |6 _    int     2fh
( D+ D; M6 G2 I  r1 [$ ?* ?, b4 i$ E    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; G6 I! I; Y/ {+ v    add     ax, di  a8 r& c1 K! W7 w; \9 n4 x( n5 Q
    test    ax,ax
* X- y+ V* g. z+ C3 E- v    jnz     SoftICE_Detected$ M; Q$ O( k' Q, }

) ]8 c5 p: r2 @" `__________________________________________________________________________
6 g6 S% j# H% C' p9 G1 S, f3 R3 D
. A' c8 y; W/ D& E" f& m4 Q( |+ d' Q( @; @: `
Method 05
  c& r" J3 K/ g=========
6 i; M0 g/ K! G, J! `4 n% @+ U0 ?0 T1 P' o4 p" {) U$ o* _
Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 ?& X: ?; t& P; d. }3 W  ]0 edebugger. It calls the int 41h, function 4Fh.
! {; U; x$ @; y- M" X+ N; R3 b7 `There are several alternatives.  
, L: c; M& l: g! w& S, M
/ A: E. y- A- p6 v: |+ ?. p8 bThe following one is the simplest:
* `/ g: |" y9 c8 i! Y. ~- o
0 d  s- B$ {/ |! L; Y4 p3 W    mov     ax,4fh! t, k- q* o; {3 k. ^
    int     41h
, y9 b. o( Z+ W6 v6 R5 V    cmp     ax, 0F386
6 H4 }' ]9 I# [$ X0 O6 U8 O+ S    jz      SoftICE_detected) s! h6 h7 x2 q9 O
: m+ M8 q: V0 G; V! P% z: x

; b# C4 y  ~4 [Next method as well as the following one are 2 examples from Stone's 4 z! Y: g5 D2 y" V" j- _
"stn-wid.zip" (www.cracking.net):% I2 j% a7 J" `; z0 Y: a
0 `" v# H5 W- q# [
    mov     bx, cs
8 N, C: q8 g1 ?    lea     dx, int41handler2% Y7 Y: c/ h) ?* g& W. G
    xchg    dx, es:[41h*4]
+ \% v( V- I- {6 r2 d1 _    xchg    bx, es:[41h*4+2]
, Z- H1 b7 d4 u! s) ^0 O    mov     ax,4fh
( q2 w. \% R7 B* W    int     41h7 P) T# b3 X- i
    xchg    dx, es:[41h*4]
8 @( f, X! J# o+ Z    xchg    bx, es:[41h*4+2]3 X1 F% q; A& c4 N4 K# D
    cmp     ax, 0f386h7 `4 C# v4 Q1 V% g- i4 J& W- |
    jz      SoftICE_detected, e! g. l, i, A

4 ^( }; U9 d" e) q. @int41handler2 PROC% C7 W3 u; s/ H5 @  a
    iret. R, t' M6 p, g& S4 _  S+ l; J" I
int41handler2 ENDP
, a: T+ A5 ~3 ?3 I! I+ U$ M
! Q- n1 _( T* z: }, n/ [
; n) h" c1 |( ]. G0 c_________________________________________________________________________
! K: }5 {1 O0 o9 y; }+ C
! A$ B7 q. [9 I* O
$ @1 J' {3 F6 A; E# sMethod 060 W9 p6 [  R; N  G
=========
: M' k& G9 F- [+ ~1 ^5 d  ]& E& \7 @5 X% R- I

; l% C$ X; A% E* N. V5 C! M2nd method similar to the preceding one but more difficult to detect:) p7 n8 }3 S0 F) k& d

# d6 ~  B( O& m, G  Y, B5 }, T6 Z2 o3 B# t7 ]6 o2 y" x) T
int41handler PROC
0 X% v' ?) {$ f    mov     cl,al/ f5 `( F0 ], N' ?; z6 o5 G3 y9 N
    iret
" G8 Q2 c# S9 _4 Q" \int41handler ENDP
! ^) A0 {' w9 \. R3 _
! X9 D3 y! e3 X+ V. n/ [% g& s4 V9 t5 p: r/ T
    xor     ax,ax
4 a( J2 x5 Y" e) q    mov     es,ax
: L+ I4 x$ g3 Q5 W) a& I    mov     bx, cs; k3 j8 b0 b8 i7 q
    lea     dx, int41handler
0 j3 _/ t5 S! d1 W' N. [    xchg    dx, es:[41h*4]( m) v8 ]( {# r2 `( x7 j* P' h
    xchg    bx, es:[41h*4+2]4 q7 @+ C. x# f. y/ k3 P
    in      al, 40h8 C6 h2 C  k6 d7 r3 }3 c
    xor     cx,cx
. G% U/ N! i8 w1 s+ M' z0 I    int     41h1 i: I2 A, \2 l5 ]* c
    xchg    dx, es:[41h*4]
, a* {( T! u- F) R6 n    xchg    bx, es:[41h*4+2]: O7 }2 p0 W& A- {  N" B8 P- k6 D
    cmp     cl,al# v4 Q6 F& p) e- m% a8 Y  F- z5 P
    jnz     SoftICE_detected
# t. x9 \) ?" b, D$ b* d- ]0 J0 ^' d! y$ x) _
_________________________________________________________________________
4 I, U9 i- |0 S4 p
/ u4 T1 \9 }3 cMethod 07* C: c" ~5 _; e% m8 F# w0 S  e
=========
/ D/ w9 ?# X+ j' _( c4 V) x
- t, K) G/ W+ \1 ^9 ~) S+ iMethod of detection of the WinICE handler in the int68h (V86)5 D4 O* O  x$ r6 _5 H( ~

8 H4 `* D9 f3 M2 z3 A" ?    mov     ah,43h3 {% Y/ J0 \6 T
    int     68h
! i+ ?: ?2 I% p4 }! z4 E' G+ e    cmp     ax,0F386h; U, g4 t0 X2 Q& ?8 `* X: ]
    jz      SoftICE_Detected# M; p& t: `* K8 i

+ s8 [. K0 V% z* p  T( f
/ y( L/ g$ ]4 s( X) `* ?" x/ o=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" |' {3 b! v$ J/ p$ w
   app like this:
6 g4 t5 o) z' q2 S% K( E+ H
& F3 I! j8 U6 @0 C   BPX exec_int if ax==68
  V  n8 L$ ?- {- \% |$ @   (function called is located at byte ptr [ebp+1Dh] and client eip is" C1 t; j9 s' X& m
   located at [ebp+48h] for 32Bit apps), V+ ^5 M; O8 V- i
__________________________________________________________________________
% |. `. ]* d, A( g% b4 K% V& }# o  q
5 {5 e8 O0 j; `/ y
Method 08' i3 D" q) x7 ?: v0 i3 _( f9 Z
=========
* B' X5 z# f4 ~# `
3 D/ f) o. M- ^2 ?It is not a method of detection of SoftICE but a possibility to crash the
* r! {2 \1 ^3 l5 hsystem by intercepting int 01h and int 03h and redirecting them to another
8 q0 d( M/ }. j5 m' O! q' ^% F& sroutine.
* ^9 q( y! i- o' z1 y6 tIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points" D9 {$ \& C6 t$ p2 O2 P. ~
to the new routine to execute (hangs computer...)) m  c- G5 G2 Z1 M5 @( M0 C! ^/ n
3 M. }0 a$ j0 m2 V8 k, W7 L7 i
    mov     ah, 25h
% G, k# _; h* |: p    mov     al, Int_Number (01h or 03h)
- d2 S  @& F! J6 A/ p    mov     dx, offset New_Int_Routine
* ~* B$ H* E( a7 B! X7 k; h    int     21h% T, s1 s& H% K: m6 \. E( n

6 [# X2 r$ r9 A& s$ I' ~__________________________________________________________________________
9 O5 a7 V& N% _# E- T  D( Q
0 f3 a5 i: b" k6 J5 y& A0 \5 S2 V: IMethod 09
: |% m; s, T2 `4 D8 ]=========
4 d* J7 c- C2 S+ ^1 ?3 I4 f" E# X) e6 c, G
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only2 `4 k8 h2 [- v
performed in ring0 (VxD or a ring3 app using the VxdCall).
5 N/ T4 Y# n5 L2 c  }1 jThe Get_DDB service is used to determine whether or not a VxD is installed
$ }. X( T, x! z- `1 q& F) {for the specified device and returns a Device Description Block (in ecx) for7 p/ Y7 ^' h2 f5 j/ V
that device if it is installed.+ V( d; B5 {$ l- n/ f
; _9 t9 Q$ ], d( q  F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID- a2 J4 }8 j, M! e; h! B; r
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 Q- g9 @+ [7 P6 y6 |$ r
   VMMCall Get_DDB
, O6 x( {& k# D0 ?( |$ P   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. [6 ^  i+ Q6 s! D" z% I2 i8 Q4 @: e* S* e: D; n: n8 H
Note as well that you can easily detect this method with SoftICE:
: R! T7 W) L1 B7 J& h: h% Z   bpx Get_DDB if ax==0202 || ax==7a5fh
0 o* A3 N: ]; k. k, z  `- k6 d4 E7 Y* p+ ?
__________________________________________________________________________6 i+ f; p* h8 ~' X0 ^: d+ A6 D, c# h
2 h5 B# ?3 f! f1 A+ G
Method 10
. m$ s7 ]: Y8 i8 ~2 ~=========
( ~6 {1 |+ |2 P# X2 Z4 a/ \) p5 e
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- {2 Q6 X0 @0 g; ]
  SoftICE while the option is enable!!, l0 O3 ]  [: D8 {# v2 l

- J  Z: G! Q0 t' V& h( o6 kThis trick is very efficient:  n' \6 |1 Q. I# ?( c# M
by checking the Debug Registers, you can detect if SoftICE is loaded0 d6 w/ W) t6 x7 e! x' r1 D4 D
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( `: Q* Y) h- ], p: _
there are some memory breakpoints set (dr0 to dr3) simply by reading their9 I  q3 D; m# K
value (in ring0 only). Values can be manipulated and or changed as well
! U+ {0 S8 s; @(clearing BPMs for instance); f7 _  m9 c5 A

# J! W/ H2 t' w+ O9 _# b& i8 v1 {) |__________________________________________________________________________
3 j6 ^: q2 ~8 N" H) a5 P- }$ c9 g
: U) Y0 [9 A0 d* o: B" c$ E# xMethod 11- O, G6 h5 S* Q" E# |0 ~
=========/ Z% B! w% |. i+ Y- F

9 t2 |4 K+ B% }6 K$ oThis method is most known as 'MeltICE' because it has been freely distributed
( v# L3 b5 n2 L( Q: r7 Z% hvia www.winfiles.com. However it was first used by NuMega people to allow
: \% I/ B% j, r" ^: o0 @: I4 [Symbol Loader to check if SoftICE was active or not (the code is located
3 K" N# \. ?" zinside nmtrans.dll).
% c3 ]4 _0 M! Z+ e7 k4 A0 `- N- D. ]8 Y/ h+ `/ F2 Y" Y* g- o
The way it works is very simple:
- b( Q. }: I$ B2 p& N; \& [/ D6 RIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ F( l# n7 r* X3 CWinNT) with the CreateFileA API.
6 x: p. e  [5 `* a% e  ~6 O9 B
. W5 t! T5 k8 l. b2 VHere is a sample (checking for 'SICE'):3 Z  I9 A! A9 ^' C  ^' r

9 }0 L! M7 f2 S5 T. ^1 rBOOL IsSoftIce95Loaded()
( H% B$ ^5 ]2 V" t, R; f8 J{
) b1 l9 y9 n. I) i6 T   HANDLE hFile;  # A8 y6 |; }, J7 r( Z: r
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 `3 J* p: R5 C  n4 q7 K$ q! _5 C( ?' y4 m                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 `2 d( b8 ]( `6 R* h                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 _8 l, S1 n' Q/ Y5 }
   if( hFile != INVALID_HANDLE_VALUE )
4 T" W) Y  I3 j% W9 [0 x   {7 [9 c7 Y& b- ~. J7 i' [( q5 B
      CloseHandle(hFile);, i5 f: h0 i2 O9 Y
      return TRUE;
+ W  `8 h' P% Q( U   }
) U% k! c- a) ~7 |) w   return FALSE;- Z7 f7 C) L- P+ X2 {' ?* G" j
}
$ ?- S4 x: U8 H; v& }- P3 E; c7 R
Although this trick calls the CreateFileA function, don't even expect to be
( H8 [% |; K. C" Cable to intercept it by installing a IFS hook: it will not work, no way!5 [  {. s8 X$ [+ Y
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
# {+ v' ^6 Z# A" |4 bservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; T' Q! s  N2 }: }0 k7 ~% Nand then browse the DDB list until it find the VxD and its DDB_Control_Proc8 T& G" i' h$ U( A3 r  u) K
field.+ N5 Y1 [! f4 C# K- ^! m9 X. `
In fact, its purpose is not to load/unload VxDs but only to send a 0 h; }) P0 w/ S8 S0 I
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, X* x4 J: @& ~& a4 zto the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 _- ^% i6 M1 R$ \! K, f# Yto load/unload a non-dynamically loadable driver such as SoftICE ;-).
8 @" Z; ?1 b6 @If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 S% d5 J1 e* u0 ?: r9 jits handle to be opened and then, will be detected.
, k( u! u+ _- N. dYou can check that simply by hooking Winice.exe control proc entry point
* g- E( V/ y) o/ [7 U9 X/ \while running MeltICE.
3 F0 B8 N; P) o- f; r5 f3 P
+ }" R3 \# h0 _: [; \
- u3 `; r' J) u$ |' y6 Y  00401067:  push      00402025    ; \\.\SICE% G7 b0 L0 R, P# T
  0040106C:  call      CreateFileA& q0 W" s1 }1 d7 M  }* F8 B
  00401071:  cmp       eax,-001; d! u4 \: ^8 _/ [. P( r
  00401074:  je        00401091& T; O1 y: _+ J8 \$ a
! {( z' G. q0 m) E' Q# a+ G
* w- G$ B" I0 G% x* \
There could be hundreds of BPX you could use to detect this trick.- L" E. z# M- n& d( [
-The most classical one is:
4 e; L7 ]! o' S) L! K  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
# E9 L' u+ B7 S- }( ]: C3 O    *(esp-&gt;4+4)=='NTIC'9 C  \4 T  w7 o/ O! ]1 e
2 i0 S. U9 m  l5 ]: \( o. V; D( |$ O
-The most exotic ones (could be very slooooow :-(
0 _3 J8 y! n1 x9 _, |6 D8 M   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / N' n0 E  I" ^6 C* s# }5 w
     ;will break 3 times :-(, R% E% c, a+ y5 s- m3 V/ @

  X# p! Q1 b5 [4 i" ^1 y5 j-or (a bit) faster:
7 _: t6 B. e2 [  k) t   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 M5 ~- z1 A$ s1 n7 Z+ k) W$ |: @9 N1 p3 L4 P4 }# ?; n! G( R; _
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! _2 Y' P4 A" V7 l, j
     ;will break 3 times :-(
7 H& F/ M) y! w: ]3 o, s* ?/ }
9 x* k( |( S1 q" P6 m9 }! A-Much faster:
) x: J  j: o( r. N4 U8 g   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 u9 t. p* L% l: Z

1 ]# U3 R1 w" t: ~2 ~0 J/ pNote also that some programs (like AZPR3.00) use de old 16-bit _lopen# @2 H: K, ~9 i9 D3 a
function to do the same job:* M' {9 V5 `% T" a' L3 d4 T

1 n! ]' ^: Q. \/ C. D   push    00                        ; OF_READ
+ W: M, q5 o  t" M3 O$ L% a   mov     eax,[00656634]            ; '\\.\SICE',01 j) _% n* L% H  c1 g1 C  @
   push    eax( f' o4 \- }( b# ?
   call    KERNEL32!_lopen( I% G/ r/ n; d. n5 W# n* e! V/ Q
   inc     eax: w7 K4 ?3 G( j
   jnz     00650589                  ; detected
5 z+ l% j) T# x8 [) U& ^5 |   push    00                        ; OF_READ4 d2 W% Z1 u7 V) N# k: ~8 @
   mov     eax,[00656638]            ; '\\.\SICE'; J0 u8 A" \, s' b6 Q2 Y4 m' c
   push    eax3 D& U' x/ ^/ c- ~6 F' ~0 T; q( M3 ]
   call    KERNEL32!_lopen
9 Q, Q/ K1 G9 d7 E/ U7 v2 ?   inc     eax
* U% d, w. J4 \+ ~   jz      006505ae                  ; not detected
" h) V8 s1 E5 n" X* a1 A, s2 H' z7 Q$ y+ b5 O# w" c; N4 o" r: y

% g% ~/ R+ ^9 W! ]/ A, j__________________________________________________________________________$ [/ I6 n2 ]6 `+ X* I  N/ |
1 H. y  U! |7 X
Method 12
1 i+ w& O  _' j) _5 a=========' N: l- @8 v3 M! z' F5 d
- J6 F5 l4 `" e. Y* I2 A
This trick is similar to int41h/4fh Debugger installation check (code 05$ n+ L) \; a5 |: E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)) N" O+ b0 H/ W3 u
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ m/ v% @: Y9 N" I5 Q+ w  j. Q
# c8 q1 s6 [. K  m) y& l* }  L' z& I   push  0000004fh         ; function 4fh4 z2 Z0 J; a, K* U
   push  002a002ah         ; high word specifies which VxD (VWIN32)0 o; K0 d7 C2 B2 G  s5 Q
                           ; low word specifies which service% d0 ^! S# f7 i; d8 ]
                             (VWIN32_Int41Dispatch); P8 F- n# c6 h; O; f$ u" J2 X/ o" t
   call  Kernel32!ORD_001  ; VxdCall
" j0 E" x( P! E# Y# `   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 c& N7 U7 T4 B. Q; ?   jz    SoftICE_detected
/ E0 U; u8 [2 G2 ~- N$ y5 h8 {, Y" l; H4 \1 L8 U
Here again, several ways to detect it:
" {8 l4 I- _$ q/ N- o2 O* H! [5 M4 Q/ L( E1 e7 `" W
    BPINT 41 if ax==4f7 B0 g) r* r  ^" w' j* _2 v

4 [6 j- W+ z; ~+ L    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  a4 r& a- j- c7 E" W6 X2 D) L
7 R+ I+ F# x+ }( q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' S# c+ r( R: l* s8 |! ?5 Z; J1 _  t  |2 A" |$ Y
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) d* N# X7 Z8 e* ?2 E6 L- q* X2 f  u: t5 e; Z1 q4 w- o8 Y( T1 A$ V! M4 t2 ~
__________________________________________________________________________$ X! L/ W5 k" X2 H1 O% c. V

7 l3 J& C" {# B7 dMethod 13  ~4 L$ F$ |' Y) c% ^, v( p6 f) z* J
=========( y/ B% f3 |# _! s1 ?& h
  ^# t. H4 I0 i; a1 r4 |; H
Not a real method of detection, but a good way to know if SoftICE is4 {' e: Z& v* l/ j: {5 H: V
installed on a computer and to locate its installation directory.
  u1 k7 r, t/ T  dIt is used by few softs which access the following registry keys (usually #2) :1 r; i( V! O# _2 H5 y' v9 E; L

0 J- S1 U: `8 g$ x6 `* @% _8 \-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 H0 w* A! a7 ]8 o% K8 @9 M\Uninstall\SoftICE
: m0 ^1 S3 P+ `4 h3 h  A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ x5 [6 Z$ R  ?" D) Q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# A/ A0 E9 V' U) J/ L; ~9 v' Y# ~+ }\App Paths\Loader32.Exe' Z; Z7 o* u( j- i* l/ G

$ ~* g- s: [  {* `* g+ k& ~4 n* }3 K$ v
Note that some nasty apps could then erase all files from SoftICE directory+ L* ^6 Y" W; }7 o, X. p* V8 G
(I faced that once :-(0 e! l' f3 A; r7 M2 b
9 K/ V" k! A0 U- S! ?- E/ q
Useful breakpoint to detect it:8 H( {% i2 L. N

: ~: V1 V5 W4 E0 Y$ E& X     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': d! _% j) ?- ~! \2 D6 [. r; `
) l8 m' N  f% ?
__________________________________________________________________________$ t3 \0 `9 _' P: ?! W7 l) `% |' y; _

) Z" s7 o/ r) ?# T2 ^1 \3 r+ {  Y: P* A& }: F
Method 14
) S7 w* ?0 J' ]& f; s1 R=========
; P1 e' L# k7 J+ G5 n. U( f
5 Z6 ~, q0 V- C* QA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% x. C/ f/ D* r& L1 @0 Nis to determines whether a debugger is running on your system (ring0 only).
8 ^) h( J0 R! l* P
, Z( P9 T1 s0 L4 h" C: K( I# C' X   VMMCall Test_Debug_Installed2 q' [- O9 V4 c+ v$ t! P, ]" _
   je      not_installed
1 V, D7 p# t2 L9 ]5 V, ^5 i/ r7 C6 R
This service just checks a flag.. J* k) j) F& j% b$ Z) ~
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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