找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>4 u5 _' B! p. p5 U2 _
<TBODY>
- r# U/ }1 j9 |" |; P& c<TR>: J; ?& c% _+ d' p* e
<TD><PRE>Method 01
0 f' v( a+ y) y5 T=========" Q  T9 D6 O9 p# L3 @
# U+ c( M1 Q; h' H0 k6 b) d, h
This method of detection of SoftICE (as well as the following one) is
7 o# \- z) j, G3 t4 Iused by the majority of packers/encryptors found on Internet.3 b9 E# n( e; y' Y
It seeks the signature of BoundsChecker in SoftICE( F# d) z+ L) x5 p  F+ s7 p

  v- \; W, }' Q    mov     ebp, 04243484Bh        ; 'BCHK'
9 [4 T( a, M8 U0 s    mov     ax, 04h" r: X9 J3 p$ A$ C: y) d( o
    int     3      
7 {- \0 _7 o# ]% n    cmp     al,4
9 W# G4 [3 q( u6 l; s" I' V    jnz     SoftICE_Detected* X. a6 k7 G7 Q

- e3 `4 ^! Y9 e4 n# G! K7 o0 c2 v___________________________________________________________________________  z4 t: |( M. {7 D7 [0 F& k6 P; Z

; L/ B# a- ~7 B- bMethod 02: x! A/ M, F6 F* p* w6 j  Y0 O
=========
! {8 I1 _4 j, X! B* r6 J1 g
" B, W3 ]5 Y% N0 {6 E& E  fStill a method very much used (perhaps the most frequent one).  It is used+ H) x& r% R6 _: _
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,. N* ]- C; t; `6 b  I( H' f
or execute SoftICE commands...
# V. t" |& B7 Q2 }5 {" {" {It is also used to crash SoftICE and to force it to execute any commands1 b: i7 R& N- r0 p! C. l- C
(HBOOT...) :-((  - p/ |3 {8 c6 T/ k! W6 \% P
, J% P0 H' v/ p+ |
Here is a quick description:
& ?% y! Y3 ^! h4 J* Q/ |; `! z-AX = 0910h   (Display string in SIce windows)- ^+ T1 k0 `0 z* N0 j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
$ b4 d$ `! i: C& m! [& b-AX = 0912h   (Get breakpoint infos)# x0 }  J) y0 g3 @
-AX = 0913h   (Set Sice breakpoints); G7 {' f. F* i# }
-AX = 0914h   (Remove SIce breakoints)
5 A* z. p1 g7 T
/ W" t$ N' A2 I& t2 a. vEach time you'll meet this trick, you'll see:5 ], ]! s5 G0 g/ {# r
-SI = 4647h6 T! o4 C4 Z8 \. d
-DI = 4A4Dh1 P2 Q4 u1 B+ L/ C6 C% r
Which are the 'magic values' used by SoftIce.
6 ~6 Y% X4 ?. K) \For more informations, see "Ralf Brown Interrupt list" chapter int 03h./ P/ @  S% @) ]7 u3 g- K) ^
" W0 X7 }0 S7 ~# R4 C) t1 `
Here is one example from the file "Haspinst.exe" which is the dongle HASP
# H' E, [7 X: ?; ~8 }; [/ EEnvelope utility use to protect DOS applications:# \9 d# ]7 Z2 J: t$ M: K

- Z. R: L4 H# R3 Y! N5 u" Y: l
& x" U+ p; B/ J- S$ S4C19:0095   MOV    AX,0911  ; execute command.5 u5 `0 G: {% y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, U# D4 o4 g5 K: [4C19:009A   MOV    SI,4647  ; 1st magic value.
5 h% f  L5 {0 j6 j. Z% O1 a4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: q9 z  Q4 Z- r
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! }  F: T% u$ s6 ~/ ^, d4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ w5 b  e7 {6 L
4C19:00A4   INC    CX
( v( u" h* B8 v8 S4 W4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 i4 s! ~/ m" K& H* s
4C19:00A8   JB     0095     ; 6 different commands.; F  ?3 i; O1 w+ r! B
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  R& u5 N& G& S5 I* ^, q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, W- r: n7 _3 S, K5 K
# @. q) i& u; Z; S, R  |The program will execute 6 different SIce commands located at ds:dx, which' r* P+ u8 A4 m, G% u
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( ~- g% K# Q* u5 L2 W, O" }# |& A' }. ~! z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 L5 B6 |* o0 e0 m4 _5 k  \___________________________________________________________________________
/ k" j' K8 o# a# ^# ~( _7 X- J
. o* H1 M* p3 b9 m+ e
5 K  D1 o7 K( |8 W& L# U+ z* j9 {Method 03: Q7 Z7 m' I. ~! H( j- G
=========: V" s  s" A* r/ y5 `6 O3 Q

! Y& E5 w3 [! V; ELess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! \" Z  L# {5 z9 K) U
(API Get entry point)
  ^# V% m# A) b$ l; U. I        
+ @* B- q; }% Y8 x  m+ K- W* l7 j- @% m, d# ?9 p
    xor     di,di; k7 ?% W; r( K* c$ i
    mov     es,di! l: C! |+ r* p1 K# Q
    mov     ax, 1684h         p7 q* q& K  Q# ~" C) z% Y
    mov     bx, 0202h       ; VxD ID of winice
) y! U; b* r0 L, ]    int     2Fh
% ]6 G1 W5 N) c' p  x    mov     ax, es          ; ES:DI -&gt; VxD API entry point; f6 V# p# M* p
    add     ax, di1 }9 r% K' B% i" E! D0 i
    test    ax,ax
) a# {! z% A3 k    jnz     SoftICE_Detected
7 `( I" _7 _5 n: d, a( S9 T" B2 X9 A0 x5 g- x- r
___________________________________________________________________________: I* J0 Z0 z: s4 H
. k6 c" i$ n) i
Method 04+ U0 ]3 l2 K4 ]2 b+ G  R: o/ H8 i4 r# R
=========
; w, Y8 t3 l) P( G
) D1 a7 ?$ M! `Method identical to the preceding one except that it seeks the ID of SoftICE! r  M# \. V, y! ]7 v/ u
GFX VxD.
: u, T; J) j9 f- I9 j! k/ _: z, Y. h; Y* v
    xor     di,di
9 K' }, H1 L( O    mov     es,di7 A5 X, U$ E/ i7 P" X- S0 l+ p) U
    mov     ax, 1684h       - ]8 c  L) G, O3 ~
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 |( F9 J5 ~2 E' G: {* Z    int     2fh
* z. j3 x& e9 v0 y6 h    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 s# X7 G1 d$ g
    add     ax, di4 y4 q) X. H9 l/ }2 L. n- f( T
    test    ax,ax8 {8 Z% V  k# ^2 Y% q. |
    jnz     SoftICE_Detected( T7 A1 r" A9 J$ D  {; W: i

* U3 W* [8 a, o# F3 h__________________________________________________________________________
) \0 @2 a" G6 }/ b; _3 ~
" U- s* T$ x* ~! f( \  z6 ^  m6 m# l/ D; M4 r$ t9 [3 _& c
Method 05& b7 _; _8 d! F/ ^8 ?+ k4 P
=========
0 u0 [8 Y$ R; A$ c" q4 I# j3 N5 x8 {, m$ z& q; R5 L- X: I0 O
Method seeking the 'magic number' 0F386h returned (in ax) by all system3 ~) _) o5 |1 t6 N2 z
debugger. It calls the int 41h, function 4Fh., u9 }. s7 a1 ?* D
There are several alternatives.  
. m7 M' M8 u1 [4 A2 w& p& u- M3 T0 p; f9 H: T  D# X$ L8 K) {7 S2 a
The following one is the simplest:
0 i4 N) s/ Z. E; H8 [. ?! G) E1 D% K/ C6 [1 v) M* {& Q
    mov     ax,4fh
% A+ i# k9 O# p) T' [4 e2 a    int     41h
) D6 T0 g0 E- s2 z3 Y( o- z    cmp     ax, 0F3860 t/ V. I5 @* }6 o2 V
    jz      SoftICE_detected
, m/ `/ \1 I2 X; b" l
. P, F: I4 P: ?- z0 J- W0 `0 _" p8 O  i1 o# S
Next method as well as the following one are 2 examples from Stone's
0 B# h/ x- A7 B/ m( d) Z4 Q, U9 w"stn-wid.zip" (www.cracking.net):6 u2 j4 J+ F. ?  g

& H# R" C/ f0 G$ y& A    mov     bx, cs
0 g1 U6 A5 \5 x) x/ P/ X; D" N    lea     dx, int41handler2
& \$ i  ^. k) O6 H' M8 D! l    xchg    dx, es:[41h*4]& |3 l6 l+ P; N4 I) U" D8 U
    xchg    bx, es:[41h*4+2]
6 B' _* f/ Y' w1 |4 o) O    mov     ax,4fh
/ ~& c* K, b2 }" Z! s# w4 I) k    int     41h
& [3 ]. @/ b; P5 z  o5 x/ i4 `$ |    xchg    dx, es:[41h*4]( Q: j/ _2 n' J1 Z
    xchg    bx, es:[41h*4+2]9 a/ Z0 l3 a; @. h
    cmp     ax, 0f386h7 X: @  q5 b6 k+ Q
    jz      SoftICE_detected" J1 Q! O9 }, _% N

% t  \$ e6 Q2 x) r* g4 {  ~int41handler2 PROC
/ n# M( u3 E7 p& O5 v* B6 v5 r8 C    iret2 q$ ]. I9 w1 ~2 f0 ~7 a) o8 F
int41handler2 ENDP
; F+ }' |) x/ y& A) N. k9 `! s- p+ W! F

  V. F7 H+ W( ~4 F_________________________________________________________________________* i4 ?4 I1 E2 _3 M- K2 g) {

) Z& ?/ Y3 c, M/ U+ B
1 |; s. x$ [; U% Q4 d, rMethod 06
& o/ c& R  h: E2 H=========
8 o  L+ a* v" g/ J$ |& s( u$ M+ ^4 I
- j' _( k& W7 q( U# R* P% q) ]- f, O8 g9 W! i) ~
2nd method similar to the preceding one but more difficult to detect:
/ L& Y/ J3 B' R% g
# t1 c+ p( I2 q) j0 E5 C7 v9 P0 K% }  ~# `6 o# @# a, J. D
int41handler PROC
% _0 ~7 @' q* X% R, G! P2 k    mov     cl,al+ l* d- s# O( n
    iret7 S7 `& E7 W9 l3 |
int41handler ENDP
) C% K' H9 K2 ^% B9 ]# v/ u% z% Y# e* Q+ ~

0 [6 H4 ^( |/ N, U    xor     ax,ax3 Q  j, e% b. n4 I
    mov     es,ax
+ _' W" i. m+ x9 @( o    mov     bx, cs
3 _, ?+ W9 V9 b& m' S    lea     dx, int41handler4 I' l1 ^7 Z) S2 J- u' L
    xchg    dx, es:[41h*4]* h# [6 v% x$ T* U
    xchg    bx, es:[41h*4+2]9 N" }' s3 _( Y/ N6 Q4 E$ t
    in      al, 40h
4 a/ i4 Q2 H  Z- x' {    xor     cx,cx" B* |& A3 u. S: |8 L# @
    int     41h
. J0 R4 |  t( P9 y    xchg    dx, es:[41h*4]
" ]. O/ o& U2 T+ p# Y) e    xchg    bx, es:[41h*4+2]& n0 W6 r+ ]  G3 W8 |1 [: {
    cmp     cl,al* k0 X3 k1 D1 a6 r% `. l
    jnz     SoftICE_detected
+ f7 A8 `# }. A+ m* e1 Z; a6 d5 \& ~
_________________________________________________________________________/ s* U: f; z4 }& K1 v- Z2 s

- q& [/ g& a/ o7 y$ sMethod 07" @4 o9 h4 Z/ u) |2 q* _
=========0 M) o- U% a9 C# X( G; B; z) f5 d, O

0 s$ M( B5 r4 _0 {Method of detection of the WinICE handler in the int68h (V86)( u! h( ?: D0 n0 h8 U* N  Y, e: Y
6 J4 b. q0 r  I; a+ Q
    mov     ah,43h
! N+ p. t( m5 N. ~* H' c, `    int     68h& I: B6 y9 K. Q5 w! @/ L
    cmp     ax,0F386h1 h; v) b8 q1 q9 e
    jz      SoftICE_Detected
) I! c0 H5 |; H9 y: ?/ h& u3 E- b+ X9 T3 [+ g+ V; O& P
/ Q% Z& F, A& \& s9 |& b) l+ L
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 n, _9 e2 B- Y. p! U1 ^9 v5 q: W
   app like this:
# X* u+ L2 ~( q6 q6 w: q, D% @& J1 N0 ~: G5 B2 P
   BPX exec_int if ax==68
/ J; S& b5 S% O* \% u: Q6 [   (function called is located at byte ptr [ebp+1Dh] and client eip is( r3 }5 b0 `, z. _( K" g
   located at [ebp+48h] for 32Bit apps)$ X) Q* T3 ?( R! X: m
__________________________________________________________________________1 H  E" i; X# h6 U1 C' F& {
$ h9 I5 f5 N! z, i( w

* u8 s4 p% c& ?, WMethod 08" a3 T. h: \( ^
=========# R9 I3 ]' D8 m: z% e2 x5 M

7 B0 k. P! c' EIt is not a method of detection of SoftICE but a possibility to crash the, X! k0 g( @" _. L, i- G
system by intercepting int 01h and int 03h and redirecting them to another
1 U- Q& U1 e: Z* V6 L, Qroutine.
  ^; e. t! i7 m& h" }7 jIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; V  l8 z, S1 }0 b' `+ n$ y4 O2 [to the new routine to execute (hangs computer...)
/ `% x6 K8 |: H2 j
) v1 T' ]. _: n; D1 w) a; L& n    mov     ah, 25h
/ Z9 V/ H  @/ @7 x% i, ]; O. D  B    mov     al, Int_Number (01h or 03h)4 z% g; F1 U+ [1 A5 _
    mov     dx, offset New_Int_Routine
7 e2 c% M, O: k/ G8 l9 m. l    int     21h
# l, L- V- ^& w) S
7 H& N7 {4 f, O__________________________________________________________________________* S" f7 g( b* R& Z% @1 x' a

# F1 O; h4 f. E- G( o( kMethod 09% {. j5 ~3 w; Q% ?  r! e
=========; V! v$ w9 r; D3 P

  `0 a# t  `$ S2 i# SThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: i, |  K$ b) \; S
performed in ring0 (VxD or a ring3 app using the VxdCall)./ x+ V. u" J. A2 I9 b  N
The Get_DDB service is used to determine whether or not a VxD is installed2 O: M0 y2 p9 y5 H; j% G9 L0 f. U
for the specified device and returns a Device Description Block (in ecx) for! c* i( `: v6 h6 N! V; N+ |5 O
that device if it is installed.# T3 I" _3 ]% H% O

# c8 W0 e) q1 Z' i) v3 ?; r$ p- K   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# B: w6 l- m  q8 l" j# a% [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); r1 Y" E9 N+ `. H% i% v3 A$ E
   VMMCall Get_DDB
+ j3 l* Q  Y8 D4 h   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 ]( n! b' d, \  [. b- R
" x& W. U/ K; {5 t" Z/ W% H: M
Note as well that you can easily detect this method with SoftICE:
5 e4 o. C4 k+ Y8 J# M5 X- \   bpx Get_DDB if ax==0202 || ax==7a5fh% O! U! i1 E6 T3 @8 Q" g9 D0 j

" P) t* j# E3 _9 j: ]__________________________________________________________________________  ~) a0 S+ J% w0 @; p

6 c4 v5 F$ L; K! |2 k6 PMethod 10
! j. F- B  \- i* m4 w- T" ]=========3 x; L& L& \( i: ~9 r
: D3 y+ y0 ~3 t7 g
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' v5 j1 S& f: a+ O% E  SoftICE while the option is enable!!! K, W$ c! x) J5 p2 C# Z: ?
# o) F' }; ]: z' d) C/ s
This trick is very efficient:
/ D1 k+ x- p" ~# ^5 A+ Eby checking the Debug Registers, you can detect if SoftICE is loaded
, d5 k5 g  O! t4 O5 i' k1 Q  o! G(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if: C; _6 c+ _/ ?
there are some memory breakpoints set (dr0 to dr3) simply by reading their2 _( _1 i% Y5 B+ K
value (in ring0 only). Values can be manipulated and or changed as well+ C8 v$ c5 Q2 L% N& ]
(clearing BPMs for instance)) ^- Z1 K7 L( z# O; ^7 [

' G8 K" _( }0 X6 W5 Y5 }3 [; I- ?__________________________________________________________________________
) F6 d0 u) R9 F" `. [, p& C( l$ @- c' W; I) S7 n3 S
Method 11
& t- n, h8 ^- N( y8 i=========, s, Y8 o7 w5 W4 O- H3 H

! n: [, \& L# K) B) EThis method is most known as 'MeltICE' because it has been freely distributed  v# g/ h3 U) Y4 ]9 ~
via www.winfiles.com. However it was first used by NuMega people to allow
' e+ b6 N7 C' aSymbol Loader to check if SoftICE was active or not (the code is located! u) F5 Y/ u% ?/ K6 L1 R4 f
inside nmtrans.dll).- z( p8 S3 }/ V! S
( ?) r- n* q5 g- M. N6 C
The way it works is very simple:
. y$ o, l" _  q# f5 B2 e6 TIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( k# r0 v5 S$ k2 q" g( K4 yWinNT) with the CreateFileA API.' q4 u& r# x' r  B9 Q8 ~* K. Q

' T0 g3 |1 |3 hHere is a sample (checking for 'SICE'):
# x0 V7 ~. Q/ g5 x  W
2 `" b6 S2 @! B% w- XBOOL IsSoftIce95Loaded()
( P! f( P% d7 {{2 {% P2 X& ^8 H2 u: }
   HANDLE hFile;  
2 }* J1 \5 P& ]0 A   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# z3 b$ ~9 [0 S3 D+ H" w) f
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! `- k6 E: l* r! q: o7 s: S/ K                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 A! ^3 b- Q7 a+ X9 |: p' D   if( hFile != INVALID_HANDLE_VALUE )4 M% Y0 O' H/ u4 r( \3 |
   {
- H; o+ r! g( I      CloseHandle(hFile);
$ |/ ]: _; S1 \; p8 x" Y      return TRUE;, f) F- @8 {' d. F* [
   }" w$ j" q+ Y# z6 M; l2 @
   return FALSE;. ~7 @* ?: W% K( X0 ?
}) ~1 f5 k: K2 p8 Y7 }

% a  l& q# s# o/ M. bAlthough this trick calls the CreateFileA function, don't even expect to be0 R% |5 V5 |0 e  N
able to intercept it by installing a IFS hook: it will not work, no way!( N$ y$ ~: q8 U/ E
In fact, after the call to CreateFileA it will get through VWIN32 0x001F4 a0 r0 `; }- ?
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& s% k! g4 ]( M2 s' ?& kand then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ T) o# k5 ?! u6 {) gfield." i% G, _7 k3 B/ u5 j4 N
In fact, its purpose is not to load/unload VxDs but only to send a
% `2 @& O1 w' n& R% aW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 |9 Z, m9 e. }to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ q. ~2 m! F( U$ e5 L
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" i' j- `  G7 J6 P4 lIf the VxD is loaded, it will always clear eax and the Carry flag to allow
0 z* \6 t7 f# n* dits handle to be opened and then, will be detected.
/ I9 U' T1 h7 D3 RYou can check that simply by hooking Winice.exe control proc entry point4 ?% m3 A2 M( P/ @, u- D. `* K: a' _5 ]
while running MeltICE.9 g: Q+ M0 S- B1 t# {/ q- j& H

3 b8 ]5 S$ f7 W7 e. a3 u8 ~7 z" y# W" @6 \. P, H, [! _2 u& ]3 r
  00401067:  push      00402025    ; \\.\SICE
5 F- x2 |. o' R3 ]% _/ }' o7 |0 t3 M8 Q  0040106C:  call      CreateFileA
7 J/ f" e2 `% i$ x  00401071:  cmp       eax,-001& q: P/ Y$ p1 _% l, F3 h4 ~: k
  00401074:  je        004010914 g. T, }. _0 ]; {+ e. a
% O1 |; ?  E  ^3 Q" z6 m

& K( [5 t" i1 l8 ]2 ?/ aThere could be hundreds of BPX you could use to detect this trick.
  Z7 p' U7 R! S$ Q. E! o- E-The most classical one is:
$ i1 N& r" N* _) Q" j5 Y0 f- L  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ _1 g" p& R& l; B6 v* v- [0 t    *(esp-&gt;4+4)=='NTIC'
& v9 l7 k( o  s1 O9 G/ }) O% T" k* @5 r# m
) @3 g3 r* A, d8 D4 f! w- N) |-The most exotic ones (could be very slooooow :-(
' W- t$ d3 J9 v. [9 v7 P+ ?! k   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 r1 H3 z/ J3 i0 q( j' A1 b8 n4 a
     ;will break 3 times :-(
0 R3 N) ?6 U: D+ Z( l
0 y8 \4 F. R) i+ M7 ~7 Z6 T- F-or (a bit) faster:
& `) k) H6 B9 c9 m1 ~   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. D! N6 c/ b5 i% Q/ Z
4 t9 d  j' Z+ D   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 r! l, a) {( ~: a  `8 z: l9 z     ;will break 3 times :-(
" a% A" \/ h" Z9 Z
4 r* ]7 W. T) s-Much faster:
) R+ W7 l: X5 _   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 C' k, K( b! V: I
" \! v4 [! v1 v, N3 d
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ g- [& N/ L$ i2 x- Jfunction to do the same job:
7 q' X! Q7 D2 L  w4 ]! K6 R8 H4 i* S
   push    00                        ; OF_READ- P: K; }; ~8 P$ u
   mov     eax,[00656634]            ; '\\.\SICE',0; i2 R" `$ P* M7 w( V4 t
   push    eax9 B* j3 F5 \/ G3 w* Y7 N! E
   call    KERNEL32!_lopen
/ s/ f! T4 b* J1 ^, t   inc     eax
! L7 a# G+ t( J1 v' N   jnz     00650589                  ; detected
+ v" W7 l" c/ S- c+ A$ i   push    00                        ; OF_READ4 B+ I/ Y2 k4 \0 |" J5 L* P) m
   mov     eax,[00656638]            ; '\\.\SICE': m5 b/ A' j! m4 a6 a: p: M3 J
   push    eax
+ W  n& k$ e# Y% z   call    KERNEL32!_lopen
: J2 }* j4 F* n8 d7 |   inc     eax
4 L1 P1 O7 |: A3 k   jz      006505ae                  ; not detected
- j  {; V& \% p2 L1 i% L
  l# w% {! X: m( c5 B# {7 N/ y: g4 d6 J
__________________________________________________________________________
) O) K, I9 |9 }9 A* \
2 T: J3 \+ @9 WMethod 12
3 M+ U+ `) G& l! y=========  I! q5 z( x: W3 h- W/ |8 S- W

/ k1 ?% z* ^1 U8 EThis trick is similar to int41h/4fh Debugger installation check (code 05
* U; l1 i7 N: I7 e3 v' a&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" |! s8 I( L0 _, o2 mas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) W# M3 l% z; N( z
% v( r/ M5 \7 m, l; u, X5 {   push  0000004fh         ; function 4fh
7 x. |1 \1 f% }' X9 |' {   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 ^9 x* D7 t# e1 x/ x% ~                           ; low word specifies which service
; ?" E- z% J! i! Q% Q+ z. V                             (VWIN32_Int41Dispatch)
$ d$ @4 Z; S5 p. ], j$ B   call  Kernel32!ORD_001  ; VxdCall/ s3 @0 y" C2 R# I* `
   cmp   ax, 0f386h        ; magic number returned by system debuggers
3 A' _/ N6 h% U2 {* R3 \   jz    SoftICE_detected
1 P; o. A- c( y8 q6 l7 R1 ?9 J; ?1 G: H3 }! E! |, W* u
Here again, several ways to detect it:
$ N, M3 O) |* Q6 y! c
6 G! o- r# ~  {% g9 ^    BPINT 41 if ax==4f; l; E% n. v% a8 u

8 a4 i: X- w8 b! l# k& F+ l    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one: M, C0 ]  i& v& ?& o
$ P5 }! L( s7 h4 a! s& B$ g' N7 s
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& l# n, F. l; m+ s2 L0 e' t; m* x6 z4 U# G% i6 F. p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' L& y) O& U3 U4 l/ U

7 e1 [2 l  u3 ?' S9 |  O+ |; Z9 R8 S__________________________________________________________________________0 e2 {& |( g) K$ d

. O7 K9 H3 g' r: X, ?Method 13
) K  j+ k' U6 N7 i' F=========
5 D( J' ]. x9 s% d2 E! t
2 `0 [6 u! r+ s3 VNot a real method of detection, but a good way to know if SoftICE is
1 ]& j) {; u8 u* W6 }& a0 ]installed on a computer and to locate its installation directory.( L0 b% A3 e6 `+ |* H7 Z
It is used by few softs which access the following registry keys (usually #2) :! |" n6 }  w1 ]5 L7 L6 t) F( _
. B2 f7 A2 v! @
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 M3 T4 W4 p6 P) {5 V+ v4 O\Uninstall\SoftICE2 C1 O2 t; ~: q0 G
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, G( u9 X! Z8 |0 j  O; M& n: f
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, C! [; q$ c& k2 \) C2 X\App Paths\Loader32.Exe
; L/ a7 ]. A# L# v% |
& q# z2 S/ l' H) W9 J% m1 R: m" a9 S: t
Note that some nasty apps could then erase all files from SoftICE directory5 e! h  I- r$ a6 U; Y1 E0 h  A: n
(I faced that once :-(
9 M/ R% Y* n9 h! ~
- N- E7 X/ K( d' F- `Useful breakpoint to detect it:. V8 J2 _. u% V& c4 {) @: P( b, ^; q% e
* E2 Z* t1 Z2 r8 s# Y9 c) p; e
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 N5 C0 U5 r  M3 q% }2 u
; p2 Y6 B. `4 E7 e7 i  J
__________________________________________________________________________
8 x. q3 [, d7 T
# D; d  V# L5 M; g0 x
1 k7 |: \8 D! Q9 X6 {4 wMethod 14
9 W; e& @8 }' ]7 s=========' E9 v6 F* x0 X- ]8 Y1 L
3 B+ r$ L4 @3 p0 E9 v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 `- R8 f+ g& L/ W3 x0 |/ F
is to determines whether a debugger is running on your system (ring0 only).
; _# j: m9 h1 M; [+ T/ V( K( ?- [2 _
   VMMCall Test_Debug_Installed( F% A0 Z4 |# W* A5 z: v# q
   je      not_installed$ u7 c! W7 _' c* l) q
( {! G0 Q, W7 k% a; P( X8 m
This service just checks a flag.
, W) C) v- p. b8 s( c, n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-9 20:09

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表