About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  y. r9 B! e6 ^- g; @0 G1 h- a<TBODY>9 k3 `' T& n! H6 {# ~
<TR>$ Z8 i+ r$ R" [
<TD><PRE>Method 01
. z: g9 o+ Z' @0 c$ Y" w$ y=========
8 m2 ?* s( Q! U7 a$ W7 S0 P- I
( u$ M7 B7 C+ A2 YThis method of detection of SoftICE (as well as the following one) is) ?0 G/ i, ]5 A+ f( ~& l/ k
used by the majority of packers/encryptors found on Internet.- }3 P. _+ {4 b
It seeks the signature of BoundsChecker in SoftICE
# ?+ u, e" m0 X& J% G& F4 K
1 s6 U! X/ E* h+ M" e* Z- k3 M3 H    mov     ebp, 04243484Bh        ; 'BCHK'9 v% x; \+ u" Z% p- f
    mov     ax, 04h
% Q& F+ _& f% l, ~$ H    int     3       * K, b. F( q- B3 l3 _( p' c# D' O
    cmp     al,4& q/ q4 H3 b6 d) o" A" F9 o! T9 k& Y
    jnz     SoftICE_Detected5 s  f( c0 n+ }. X
- t2 p. |% X. ]: }, K2 s5 p, d/ |6 p6 L6 k
___________________________________________________________________________( C$ |/ s: O. O

3 G. j3 g7 f6 eMethod 02
+ O9 Q! U' N5 S' N=========" W& G; c) y% U7 E: {

2 x8 X8 a# x8 ?, ]. G+ S$ WStill a method very much used (perhaps the most frequent one).  It is used
( [3 \& K0 k1 Q* uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 `0 Y- E& [! b  a8 o# D& T5 }
or execute SoftICE commands...0 N# N0 ~! ?" N
It is also used to crash SoftICE and to force it to execute any commands3 M4 @7 v6 `* D9 r% x+ q
(HBOOT...) :-((  9 x, z) ?* S3 u: c" \
% g5 r/ K$ \$ b* Z
Here is a quick description:
7 W2 l& H) v/ C& U6 l! J! ^% ~2 u-AX = 0910h   (Display string in SIce windows)
; C4 q# i1 h) J( c2 a-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 c5 x0 a: O; l. ^& Q-AX = 0912h   (Get breakpoint infos)
) |( y4 L2 ^5 `# s-AX = 0913h   (Set Sice breakpoints)6 L1 g) c: \, e: }, W7 [* Y
-AX = 0914h   (Remove SIce breakoints)
) A' I9 u1 l+ k5 F2 Z6 A) a! b( j) T& b6 Q5 \* S8 K
Each time you'll meet this trick, you'll see:
2 l2 M- m6 @: Z% a; }0 u9 q9 n-SI = 4647h9 L" L. Z" Q" h8 |2 T) [
-DI = 4A4Dh0 c* y/ h+ ~2 P
Which are the 'magic values' used by SoftIce.6 r& F3 k$ `/ I  e
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
8 j* P7 w$ A) E* j, Q
* c% K+ G% w- b- z, q0 CHere is one example from the file "Haspinst.exe" which is the dongle HASP( q' N! G8 E8 ?; B
Envelope utility use to protect DOS applications:
, z' p4 l) w' r3 m" i! h4 x+ ]0 \
, s9 D/ v* Z2 N, t- D2 z# |# J3 W) s
4C19:0095   MOV    AX,0911  ; execute command., b, B9 t0 M* G
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ m$ s, D( M0 L% \# y
4C19:009A   MOV    SI,4647  ; 1st magic value.
! D4 B* g, [1 B% X+ T" R4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 m% {5 w6 r% G. C8 W. R4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- H  G6 m' O, H. a* ?0 e
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
' p* e# _+ v% g- a4C19:00A4   INC    CX  j  ^$ p* \; O# x5 x+ ^- z" v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, p* o$ G  }$ A$ w6 Z4C19:00A8   JB     0095     ; 6 different commands.
2 r6 H" F# t' s) U% m4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
6 g  C; w5 T2 W& r* E4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 q$ s8 _# X! U( u7 f- o9 o

2 L  H8 J9 ~4 t0 x9 n6 P4 i/ N. cThe program will execute 6 different SIce commands located at ds:dx, which
& c& y+ l$ J! I9 D- G- ~are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, r# h: ]5 t. E$ c4 o, o6 p5 }# e
$ U  D5 O% y6 ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  d" L) K2 u) g7 O* S$ q0 [& z; h
___________________________________________________________________________  g1 K6 b- n* H8 g
$ b0 q2 i. @6 O/ G. i5 G6 N3 [
. }# s" C, E0 B8 R" N& _- T
Method 03) R6 L2 o  Q4 Y1 Z$ }9 H
=========
3 d) k3 N1 \: n) P; H2 [/ ]) L" S! u7 k$ A
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
% [. W. C; o7 V& j% A(API Get entry point)! z- p: G6 ?* m6 U# g% L
        
4 z7 q; w" ]+ O9 c4 q, k7 ]2 T3 T  T0 ?6 R0 e
    xor     di,di
; @5 B* v8 R8 o8 }  D    mov     es,di
, ^! y9 `+ k4 x% i" }/ m3 m    mov     ax, 1684h      
$ m8 b! ~; H2 m- {8 |6 Z    mov     bx, 0202h       ; VxD ID of winice, U7 b* ~; x: a$ D
    int     2Fh- [/ p/ E. K/ u, A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. ~! }/ d3 Q; i% e5 B
    add     ax, di
8 {+ P& A3 h( E0 u" j    test    ax,ax, f' G! r- W+ r
    jnz     SoftICE_Detected
; `; j9 |& T7 V  n* U: D1 A9 k/ a) P& j9 E
___________________________________________________________________________
# ~$ E7 w7 w) |, R( [. M5 ]. \! w) M+ @% i$ B4 I) G# r. Q) K
Method 048 L1 e8 w9 N4 x8 y/ w7 }5 n
=========2 x) f3 {. k: r

2 \: Z9 j& F6 j& o% a* }) zMethod identical to the preceding one except that it seeks the ID of SoftICE
5 f$ ]1 s9 ?3 Z! P/ l, w( NGFX VxD.
% g- M* U% ^  O: Y% V" @; c: x) M  o8 ]" a+ \
    xor     di,di
& ?! v6 j6 L: \" |( J    mov     es,di
9 M' x2 A) T/ l+ e! [& b  I1 X1 c    mov     ax, 1684h      
$ c+ ^7 @! g- |# U! {5 j1 y% I' P    mov     bx, 7a5Fh       ; VxD ID of SIWVID
/ g8 U! l' M6 h% \    int     2fh3 H" E' N2 k! S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; a' F1 O3 n. _8 ~
    add     ax, di  V& |! |! q, m- R- @
    test    ax,ax
$ ~* h9 Z1 k/ R: Y  q; Z0 W    jnz     SoftICE_Detected
' H9 h8 X! v2 c6 T
8 ^+ J# s% y7 G* [: ~* P" [; ]__________________________________________________________________________5 K7 P# e4 Y: L0 g2 M5 u* i, U- C
" \6 x6 V5 b1 d' v
1 ]- I8 n& s/ C: |. }
Method 05
$ D* t8 [6 y: g! q% R- i1 j=========' I( Q+ @, T, L
! }3 h+ U8 a% H5 Y- U- A
Method seeking the 'magic number' 0F386h returned (in ax) by all system
: t7 R3 N5 H" g4 E: X  sdebugger. It calls the int 41h, function 4Fh.
2 m  f$ m8 m* X3 W' W& P1 AThere are several alternatives.  6 V/ L. v, B* T& ?6 l2 r& {$ y
, g  F. Q/ J& ?/ A
The following one is the simplest:+ ~1 f& u, u5 D: `! `1 u& U0 X
# b0 C  R1 z+ O1 ?% |
    mov     ax,4fh8 l7 K0 u# q& X+ T0 U1 x( N/ M2 W
    int     41h* C: r5 o8 z& C' F" M% P
    cmp     ax, 0F386
- w0 ]% ~6 v3 b    jz      SoftICE_detected
4 v* v, \- V# E& \, ]3 F
; ~  k6 V# r' C7 b5 @% ]7 {: Q1 x1 i8 _2 ^6 Q+ ^
Next method as well as the following one are 2 examples from Stone's % T( ?8 j6 u& q1 r9 N% D7 J
"stn-wid.zip" (www.cracking.net):7 g# W  `1 J3 F3 ]0 m

& t& F4 L, `. Y( w# x. L: ]    mov     bx, cs
9 H  ?& y% d8 R" ?    lea     dx, int41handler29 [8 Q1 |& E, {5 U9 L3 ^
    xchg    dx, es:[41h*4]. l4 G5 B; o) T7 z5 t
    xchg    bx, es:[41h*4+2]2 I& e6 n4 r) z
    mov     ax,4fh) W, W" {: U3 V! r8 U% w+ `5 F
    int     41h
! z# S5 _! a4 [5 _# L    xchg    dx, es:[41h*4]
% g* k, G  A5 I5 s/ h; [  M3 Q* {    xchg    bx, es:[41h*4+2]. k9 e. f% Q; O$ j: F3 Z6 Q
    cmp     ax, 0f386h/ u8 S) X# H2 W2 t  w, l' K
    jz      SoftICE_detected6 {2 J- \. _: Z! o! B/ b
" W5 ^, v/ t2 m2 t) v  Z
int41handler2 PROC
5 x0 D$ G/ k1 u# J, D- J" }' N, O" |    iret3 F( v3 g' G2 N, d2 @! L) _$ W
int41handler2 ENDP% I& ^) J# @- [+ F0 [

& n% ]0 n5 w& {
/ B8 ~8 h/ x. T4 V5 t" X_________________________________________________________________________
6 g! k6 u& ~3 e: I6 v9 N6 R: z) K

% Y9 F6 q+ G9 c$ H1 g7 c3 hMethod 06
* Z: ~: l, W8 B7 Z4 E1 Q* s& O=========
9 K0 K9 a- ^0 n. |  S, K4 Y& _9 a0 I! `% W3 _) G% G9 f, A

' q( U+ {, _5 Z* \) _: d- n2nd method similar to the preceding one but more difficult to detect:
- d  U& a$ \& @( Q- u# R
. C1 j( m  L1 q0 Z
% I7 o; B9 l, R# k$ q7 u( ]+ X2 qint41handler PROC
; O7 y& L1 O3 @6 Q$ B    mov     cl,al5 M. t+ j4 R# \4 f8 p
    iret; E& e' f& A3 F1 V3 ^
int41handler ENDP
( l$ `9 Z4 r& u5 c1 p5 |
! n" `$ k7 M# z( P, G  e! y5 }/ Q$ `0 c, a" a
    xor     ax,ax* Y' \1 m/ T' Q7 M6 A& `( I8 D9 B
    mov     es,ax
2 D9 J: h& k/ j; b- l' S$ p    mov     bx, cs. \8 J+ d  k* X& K4 X5 [! w# b, k
    lea     dx, int41handler
  B3 o0 I; t- X1 L8 T, B% ]# n6 @( H/ S    xchg    dx, es:[41h*4], Y/ w& w& O9 {2 E1 C8 J
    xchg    bx, es:[41h*4+2]4 q8 _/ t  V& S8 u- Y
    in      al, 40h8 z  _2 q% }) H0 c; S) T$ W
    xor     cx,cx
. M& N: {) p. g7 M% \    int     41h
: J4 n! X7 a& G, Q5 v7 h    xchg    dx, es:[41h*4]
, _/ d$ B6 q. `2 x! C: l& I8 V+ N3 N1 w    xchg    bx, es:[41h*4+2]
; I% a' @% h5 B1 J% ^) Q    cmp     cl,al
1 _, n( I$ G5 o% S0 ^    jnz     SoftICE_detected
( Y5 D+ d% Z& M7 N$ n2 a; B" C
& j7 ^# f2 }( u0 J( R_________________________________________________________________________
7 X* u2 z( e0 I; y8 [6 X6 Z
0 i( ]& q9 g1 M+ R$ WMethod 07" H4 D8 L/ Q: m$ Q* e+ P% c
=========/ [6 c% {% q- |2 l. l

' }9 O" V& O! T1 Z6 e# tMethod of detection of the WinICE handler in the int68h (V86)
" _  ^; O$ t& b8 d
9 S' ^4 T- Y  X. H( q- ]9 Y9 h  z    mov     ah,43h  J7 R1 x( D: \( m2 Y
    int     68h
- Y4 k) V, H- _0 I8 J    cmp     ax,0F386h
  f$ N$ `" ?  B1 |! J& [3 K  z/ y    jz      SoftICE_Detected) \7 ~* X3 `- n+ n5 q4 Q

- l% [9 ?( ]; G$ p9 `3 J; I- O
7 L; Q2 Q1 i8 r7 K=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: S0 T% h* W) k+ k3 }. s
   app like this:
6 p+ A# S% X0 @7 J0 ~( W1 K
5 s1 n& j) o/ ]5 b   BPX exec_int if ax==68
8 s' i! f8 s! |8 g( c   (function called is located at byte ptr [ebp+1Dh] and client eip is
: _3 u, c" s7 l% Z& A3 F   located at [ebp+48h] for 32Bit apps)8 N' g7 E# H7 a2 {8 w! J' W7 h$ Z
__________________________________________________________________________
- X: g0 Z+ K# G9 u9 a" `% B  R
& _/ a( ?- J( e" i" h
+ Q. l3 J) I7 {. H- Z' jMethod 08
7 U. r9 L5 q0 x% ]. _=========/ }" q2 K4 A2 E5 l! N: q1 e
. O1 x9 s, [& q- K) [
It is not a method of detection of SoftICE but a possibility to crash the7 K9 K' a4 C, a1 n) e8 S+ ~2 @
system by intercepting int 01h and int 03h and redirecting them to another5 b  i- g5 b7 D& r
routine.( B- q& K4 D- u% Y) ^, y9 m
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 Y9 U( {4 P% g( f
to the new routine to execute (hangs computer...)
+ A0 Z, d4 @8 A* f: s
9 K/ T3 w* g" o1 t" y    mov     ah, 25h
" u* g& v# C  T# z. r    mov     al, Int_Number (01h or 03h)
' d- c/ J3 X' M: S! l  K    mov     dx, offset New_Int_Routine
3 B  e! K% I1 H- o3 D0 g; x/ I    int     21h4 H3 n; L: c8 ]
9 h* c* V; e4 F0 i8 I
__________________________________________________________________________
+ s) R* S$ r. N( U% @8 `2 @" {0 w/ n* B0 J, a6 |8 t# q
Method 09
: T5 ?+ ^0 k' F4 M' W) G" E=========1 e( j/ o# Q7 i$ P- Q
2 G% x$ i; Y6 v: m8 s% y4 M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 `9 T2 X6 {3 R/ g* E( }7 l% f
performed in ring0 (VxD or a ring3 app using the VxdCall).: }) D  G) U; P& J5 T+ G4 d
The Get_DDB service is used to determine whether or not a VxD is installed
$ T/ y" P' Z* l; Lfor the specified device and returns a Device Description Block (in ecx) for
4 b- N. v3 g. v% {4 K2 _+ j! \" jthat device if it is installed.+ M& R+ B) N2 s  {9 i4 h. U! D

+ b$ L0 _) S) ?4 O+ s% P   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; J7 x2 S9 \; `: p/ l   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)7 Z! E1 H+ N; o! S
   VMMCall Get_DDB" n5 n1 T. ?6 B9 H7 i" Y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# x9 P% e+ K2 W' b+ q+ _/ A; v4 g" a" `% a+ E8 {. a" \. o
Note as well that you can easily detect this method with SoftICE:, Q' d0 q% q3 w2 Z
   bpx Get_DDB if ax==0202 || ax==7a5fh
& g- J! v1 Q! l/ L. Q$ v
7 J+ l) `3 w; \$ C$ N__________________________________________________________________________6 [- r% e6 Y5 q% R5 W$ u- \
- y$ F6 T) f4 I. T8 m7 Y
Method 104 ^3 V; z, Z. D1 n3 o) a
=========
1 C- ]0 P( g: n+ l  s' l; j7 J4 t' }" r$ Z9 i1 @1 O8 [- {; ~$ n: |
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 S0 S9 s( c( R5 i( m1 ]  SoftICE while the option is enable!!
2 x/ E6 C" ?; Y3 d6 W6 S9 d* b" k3 P/ D5 H
This trick is very efficient:
3 I6 X" g4 D5 m/ \. k8 G% Q# T0 aby checking the Debug Registers, you can detect if SoftICE is loaded
5 a, c7 p. b5 Q# E7 W(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if  v; f1 X( d% G& x; S- u
there are some memory breakpoints set (dr0 to dr3) simply by reading their: P' l" L6 `: s# B# j0 C
value (in ring0 only). Values can be manipulated and or changed as well
; h. P  Y7 c- G0 r, b2 O; ~! Y/ V7 `' {(clearing BPMs for instance)/ |7 {1 R2 `0 {' o6 i/ V
7 W+ {+ u+ M; Z: e8 \: K- O* b
__________________________________________________________________________
4 m2 M6 i; i6 K5 n- W8 P' k; L; m2 I0 A& O
Method 11, T' |$ s3 t+ q6 ~8 _+ [
=========
9 _; S% t1 ^# g- }: C1 K3 m0 `. Q7 W
This method is most known as 'MeltICE' because it has been freely distributed
' s. e' n+ A$ \via www.winfiles.com. However it was first used by NuMega people to allow
8 a% Q/ s: k7 ~Symbol Loader to check if SoftICE was active or not (the code is located
$ E4 C( r; f% b5 W* ginside nmtrans.dll).
: V) n/ k( A9 v$ e, D, b, d( a* V  ^" l# v6 l) b; i" s9 S
The way it works is very simple:; W$ g3 p  O: B6 a2 [# r5 Y/ Y! _
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- E& |0 y! [% N8 [! @
WinNT) with the CreateFileA API.
' d/ E* S+ l7 n" w7 q
" P' i# e- f1 U1 @7 i: WHere is a sample (checking for 'SICE'):; {) X. x# @* ^; [: f2 T  h" C( X
5 K5 v  B7 b7 J: Y# ~6 r
BOOL IsSoftIce95Loaded()3 z) G: B' ?! c6 Z, e
{8 g, f8 k% D7 B6 [: y
   HANDLE hFile;  
1 n" U' {1 \: v  c: v- Z   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
* @# \6 X# ^; Z2 H/ W0 J' ?3 {                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( j3 @, w( U. E% Q1 B9 B                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 Y# @. W7 `4 q2 K
   if( hFile != INVALID_HANDLE_VALUE )
9 [( }+ v. _( x$ ]( C3 ~1 \   {) |" v3 t2 U, _. G! q, Y
      CloseHandle(hFile);  M+ l1 P3 u# u) j$ y6 E
      return TRUE;7 v  }8 V' O2 H; C' w5 {" M# y+ v
   }
* H5 T2 W( x8 K0 w' G1 v( K   return FALSE;7 }7 n: }( I9 t7 ^2 E
}( e8 Q# J6 n) E; M

& p: w$ Z; f3 U7 S" f% z) i& \Although this trick calls the CreateFileA function, don't even expect to be' A' l1 H& K; r6 P
able to intercept it by installing a IFS hook: it will not work, no way!; z) @% V9 n/ t# Q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F! }8 V* x( X% y+ K+ ^
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ Q2 T7 [4 \7 \- t1 Rand then browse the DDB list until it find the VxD and its DDB_Control_Proc
3 ?# b: b4 m) i/ e! Mfield.
3 U4 M/ E5 G( W* Q& B1 A' PIn fact, its purpose is not to load/unload VxDs but only to send a
% d6 Z& O+ o/ FW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 d. D3 H2 L. Wto the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 M6 o! d6 e% l: Hto load/unload a non-dynamically loadable driver such as SoftICE ;-).
) Z5 L  O% j+ n; G4 hIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 j* ~0 r$ t8 {! j* kits handle to be opened and then, will be detected.! m; E5 T: {1 x2 l. [7 _8 z2 x, c
You can check that simply by hooking Winice.exe control proc entry point
# k+ A# S6 M) m+ pwhile running MeltICE.
( X, J" V7 ]; B) C" g2 m2 ~
9 h+ [7 [+ a3 A, @
: ?' B/ L8 A9 i  ~) x$ L7 u  00401067:  push      00402025    ; \\.\SICE
5 e* d8 d( G+ p5 _4 ]  0040106C:  call      CreateFileA
7 ]7 X/ z2 X5 D* L2 O8 W. c  00401071:  cmp       eax,-001, v- E& C- Q) @, ~/ G& ?  F7 [6 z
  00401074:  je        00401091
$ B9 @0 K) |. E& S1 G; \  Z+ ~  V# Z; L& z0 B3 y$ {

- B! \  X3 a, x$ r' _# dThere could be hundreds of BPX you could use to detect this trick.# d  V8 p  E- K- N# \- b1 x1 a! W
-The most classical one is:
- z3 `: G: }; s7 s6 I  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 v. a* c# U. C8 j    *(esp-&gt;4+4)=='NTIC'
; c2 {% q- x8 b; [5 q( T8 ]3 |& Y) d4 j+ I3 T7 b* @
-The most exotic ones (could be very slooooow :-(
' \0 o) T9 M3 R% o* `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ T; W3 ?5 A6 q& O     ;will break 3 times :-(
( n/ ^: X' e$ [0 ^8 V' U2 N+ g
5 O( f/ H& i3 Z( O. R2 S4 S. l-or (a bit) faster:
- k: L+ q, j6 f: \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 {  |! ~" q4 a, z
. o$ h$ X) J1 J0 ]% ?+ o* q8 b   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 p/ O) i# m% G- x8 |. i     ;will break 3 times :-(3 i1 s0 B" g2 E1 _; W2 w
3 z# |' y( M+ L4 h4 \/ C
-Much faster:/ Q3 ?8 ~" N1 u: I7 D$ [' p! t
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& Z, v( R! h  {# E2 ?# @8 L# a3 h3 J0 G2 @$ O: u% Y8 c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
: ~- k- _3 I6 k5 y+ sfunction to do the same job:7 l# O3 f" r) x- ~

; a' {" x1 ~: K1 r2 M4 y   push    00                        ; OF_READ
; A; K) _$ c7 a- k9 R   mov     eax,[00656634]            ; '\\.\SICE',0& \! p; l' `- Y6 X- x( D: ]
   push    eax
2 C+ T$ M7 G" q6 N/ @& d* f   call    KERNEL32!_lopen0 C6 d) I' L+ [0 f
   inc     eax
8 m8 G' b" a7 s, g, x   jnz     00650589                  ; detected" a! y: f; H$ `1 C! r
   push    00                        ; OF_READ$ L2 M. z2 Z+ T% _7 f7 _
   mov     eax,[00656638]            ; '\\.\SICE'' F( U: R( Z9 |, w
   push    eax) k! v$ I/ J5 n5 i; z2 u7 C0 P
   call    KERNEL32!_lopen1 b/ `  Q5 H$ i( z! N
   inc     eax) Q. y3 z: W/ \9 w
   jz      006505ae                  ; not detected
1 A1 n# I' R% {7 P% w. S4 y7 L8 d; m" K
- v; R+ ?- y& n& j9 N/ j
__________________________________________________________________________
! P- i9 t) U1 y7 s) }+ H2 B" V( b0 H
Method 12
' q" I  {! ^+ i& `& m=========5 @' p! {! u3 E6 c" j  w2 D
" _. `& h; S, a" ~$ P+ n9 \' y
This trick is similar to int41h/4fh Debugger installation check (code 05# a1 }+ b9 A6 j
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' Q/ \8 V5 p$ f5 E+ Ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.6 ?: e! i( P. o6 b

' Q! S" ]: X4 \3 c/ [5 L   push  0000004fh         ; function 4fh
8 Q) {# `; v3 I) o7 I' l) F' S   push  002a002ah         ; high word specifies which VxD (VWIN32)3 ^0 o8 v' R- G5 u
                           ; low word specifies which service/ f) W" F6 h6 T- \& H
                             (VWIN32_Int41Dispatch). {5 M7 G& A8 f; n+ `4 k, L) v
   call  Kernel32!ORD_001  ; VxdCall
# ]$ l# X0 F. \/ w! a   cmp   ax, 0f386h        ; magic number returned by system debuggers, x7 d; {9 i/ H; e" M% G
   jz    SoftICE_detected
& l) r0 i2 k( `. n# Q) j' m' n  r* u/ A) X* {) T0 E. d
Here again, several ways to detect it:
5 e+ Q# @" W1 u: r  \4 S% x2 \) D  G4 S! n5 ~+ R& [
    BPINT 41 if ax==4f6 ]; X% ?# |* d: [
2 |7 a# m- g9 N1 p# A
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
$ g- ?  s  y" |- H! I4 f2 q
, ^# t! }, Y% s    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ P0 t- {6 Z7 M0 W8 M! n! Y
0 X" Q( m( e6 ?% N2 p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 U2 J3 C$ u! ^9 n) r1 N3 [: W
  V  o' B- u# i8 g3 h0 F  [, h
__________________________________________________________________________
9 m" j& _1 i0 n8 ?
: x  x9 p. L' e- q5 zMethod 13& S; o( t! U. f! {3 {
=========" A3 v4 v  z0 S% T  E+ d# i- `

+ F, a$ C: T7 ]' Y9 xNot a real method of detection, but a good way to know if SoftICE is3 i2 R5 |, k5 W  E3 W- _3 H" N, S
installed on a computer and to locate its installation directory.
% O9 @- G! l2 Y6 x% LIt is used by few softs which access the following registry keys (usually #2) :7 L8 e4 D5 K& s$ S: d: A: L* u

" a# R- f6 n$ w-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. j4 S$ [: g1 Q1 y# `; i* i
\Uninstall\SoftICE* M! ?2 E- I8 d+ W7 s6 D
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, s+ _* N& ~' L. |) j1 n-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' S. f& L' y# O* P) r
\App Paths\Loader32.Exe
" L% f/ J$ X/ w  j; _; R
# t3 S' W( k$ n4 |  |0 ~/ J+ f8 d
* D$ h9 `+ l3 g7 o9 P' \* a# XNote that some nasty apps could then erase all files from SoftICE directory
7 E. e9 R! f/ l9 h& N# n(I faced that once :-(
4 P( Z( t6 Q6 q6 S4 y5 f, q& ^8 ?$ _# Q. O- z
Useful breakpoint to detect it:/ _2 u/ L2 e; e/ s
7 _( R1 u# X' w: i. q/ D- e( ?" d
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! p; n3 y6 M& t  H2 F+ E

3 i4 k/ R1 l* B, v: D__________________________________________________________________________! G9 v3 A3 }( \8 H9 E" U
+ \+ Y* P$ x% |

, x0 K( e& B) [: @4 x% T: p* {Method 14
  u: O5 S( A6 J& O- c1 q=========
# c* S2 B+ z: U# Q- d8 V$ a5 ^" ?# X* K9 Y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; \- ~# e' Q2 B4 J  |! @is to determines whether a debugger is running on your system (ring0 only).. o) c( a) y3 |4 w8 x
3 }% ?6 I& x0 I" e8 K* _0 {6 K9 e
   VMMCall Test_Debug_Installed9 c4 j1 G4 q) N& v
   je      not_installed
: h: W% s6 [& z/ J( j  h
4 A7 a! [: \0 O% D9 ~$ u  N, YThis service just checks a flag.
4 v8 Q2 }" O/ z7 l7 Q" O3 r7 r</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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