About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>1 r' b5 K, `. [; I. t! s
<TBODY>$ b- |) {5 a' ?4 V4 [. e% @7 B, ^
<TR>
; o. c9 I, n6 ]4 @6 |<TD><PRE>Method 01
  q$ q' E6 _( T=========3 X5 ]( @- z5 ~/ ^. H2 `

5 s& _+ x8 {/ \2 [/ d0 gThis method of detection of SoftICE (as well as the following one) is# @; x4 P7 g4 @# e* e" T$ O
used by the majority of packers/encryptors found on Internet.3 p6 K5 x+ B, f  S6 e& W9 G
It seeks the signature of BoundsChecker in SoftICE. y7 |1 b4 F& T8 d) r

, H' ~- p! ?9 L. r2 c+ p' y& `    mov     ebp, 04243484Bh        ; 'BCHK'
6 X. m; R# b$ K1 I  f4 S% ~. k0 Q    mov     ax, 04h  p9 \4 X: D) ]6 D' f
    int     3      
) m3 G2 o1 ^- r# i7 N5 I8 s    cmp     al,48 c! p/ h$ y/ _- |0 m$ b0 y
    jnz     SoftICE_Detected8 s/ N- h% [9 C, \7 V; E' n

/ t8 U8 `; E- w6 p___________________________________________________________________________
4 r# @+ J  y# U
  P* f- o# G% a1 [+ F; yMethod 02
; N! v* _/ Y) Q, y& k% d1 @% F=========: a/ S% b8 T. Z0 S; g

7 t* o! }9 K( c! C. oStill a method very much used (perhaps the most frequent one).  It is used
. e. g6 `2 j7 f0 D. h- d. U( R" ^* yto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 k0 ~/ j. y; t( g& S) l# aor execute SoftICE commands...
$ @8 G( Z8 P! ]! ^' p( p& P" KIt is also used to crash SoftICE and to force it to execute any commands, j% h; W6 S8 J; c5 g6 L
(HBOOT...) :-((  
4 B* n, f+ g+ B  e5 N% N/ X; E: _% ~" w! C. k! }
Here is a quick description:2 B- c( G" v* V5 q: V" ~
-AX = 0910h   (Display string in SIce windows)
+ X  z' L/ _4 b$ b-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 A# L9 ~. \) F# v8 c9 i-AX = 0912h   (Get breakpoint infos)
" X' X, g' I' W1 k) _* d-AX = 0913h   (Set Sice breakpoints)
+ Y' L( T- h4 o% Y-AX = 0914h   (Remove SIce breakoints)
' o8 L0 {/ u; C, S( H
# C, C* x* x$ _7 z& IEach time you'll meet this trick, you'll see:$ |, L" B4 B  z) [- y' `: g
-SI = 4647h0 J9 t9 a# V: q! q( f6 k
-DI = 4A4Dh
% W" g. m" }+ F, w+ W4 i2 T4 l. M; ^Which are the 'magic values' used by SoftIce.
& z5 l9 C4 i0 T3 k" kFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
4 ~" h9 x* i! M7 e
' W  a7 k. H3 ?3 hHere is one example from the file "Haspinst.exe" which is the dongle HASP1 ?" m" U4 U! X/ [) X- O8 ?0 s* S. l) {
Envelope utility use to protect DOS applications:
+ z  o+ R; ~" M& s" b3 n7 D) Y3 D, }; J  g" u# h
& X; ~. ]( r, ~- [  r4 h& m0 B
4C19:0095   MOV    AX,0911  ; execute command.
4 ^( G. q% R- P! D& H3 {4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ N9 a0 K2 K4 V8 C4C19:009A   MOV    SI,4647  ; 1st magic value.
% Z+ B( I, G4 d' D) d2 s% K9 A4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- d% ]. f0 ]* P+ a: f4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ ^# n$ i6 e: c- w0 y7 Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 Y( L7 F* U  D( @! z$ N! V
4C19:00A4   INC    CX' [3 H0 x" K! K0 p- Q, E; \- ?
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
/ k6 Y: Z- A! V7 R3 L4C19:00A8   JB     0095     ; 6 different commands.
2 Z" `6 n  R1 v8 O! e" V* T( Z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
# t5 |8 r6 I2 D4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: L- [/ |* b* t  s% G, E5 V0 j" N( J; `/ A, J; q, |
The program will execute 6 different SIce commands located at ds:dx, which
5 s! t1 w3 h& Mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ \8 U" R# u8 t4 T; D  M
6 H, I7 o2 c; T9 J0 G& D7 f1 o
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
" c5 B8 i9 K( ?% f7 s) m. W___________________________________________________________________________
; D5 S$ E- O4 f9 \* H! h( l7 F: ~! H: a7 P/ X2 R

8 O5 y9 k3 k3 [Method 03
0 w; n) \$ E' V4 C+ p0 |. ~7 D=========
' Y9 J+ [7 w' k$ ]
; c% g! x) X" n; l/ _3 J* j$ ~4 SLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, u" y1 Z- P# {) T
(API Get entry point)' F; d& S: |1 R& Q
        
3 z4 b! e1 w3 k- v" \; R' e2 L3 R( S3 d2 t; [
    xor     di,di
  k5 q4 f- w! {' W) p- b$ `    mov     es,di) w$ e3 P% B+ t2 l
    mov     ax, 1684h      
0 U, |1 h4 r/ S/ D3 H) l    mov     bx, 0202h       ; VxD ID of winice
1 O* l8 A# E: q9 v7 _* Z    int     2Fh
& @* [8 u* f# t" Z& L; ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 e. Z- |4 i. F+ K+ M( v- K
    add     ax, di
- c7 _/ b% i1 a3 I2 o    test    ax,ax
* p7 Z4 t+ s, S" z, P    jnz     SoftICE_Detected# e4 x* _; j* E  y
+ o+ O" M0 U! |0 w4 i# Q) ~, a  }
___________________________________________________________________________9 g' _. V. `; {; B: L2 W

: e7 R# T) H# D6 D6 I9 N0 qMethod 04( \4 e3 L) F5 i
=========0 x9 p$ o5 \( N% |4 H( B% y
* V; o" ]  q1 Y) B- Z0 I
Method identical to the preceding one except that it seeks the ID of SoftICE! w  ]! j. y7 t7 b% D6 Y2 t1 V) l2 g5 ~
GFX VxD.4 Y& n! O2 x5 N, f

. ?8 E$ d* ~# i! A* y    xor     di,di8 c) s3 {3 f5 |% m: a
    mov     es,di
% I8 c4 h+ ?8 B6 T! t- u3 s" n* a    mov     ax, 1684h       5 ]1 W; p5 C9 }8 x, ?& Q% p3 r+ ]
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
9 J9 [5 g0 [7 D* p) z+ @' D    int     2fh
" D+ k& r# g( w% B7 |    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: S% v) {4 B/ d+ b. H    add     ax, di
4 H) x) g0 y- F: S! K    test    ax,ax
8 T4 L. R! w+ _' ~    jnz     SoftICE_Detected8 f$ U: ]% i+ q" h. W" }  |( j) `
' J# K4 t+ u' K* [! p8 l
__________________________________________________________________________
2 G) ]+ i1 _- Y9 b( O6 U
5 ]1 T! P" M% h+ c! |8 i0 f( i1 X; _( u; S$ I; Q6 B
Method 05
5 a+ B) A1 S0 R2 h) w=========0 t$ G! p- I7 h! D  s

3 W0 j7 P/ j( E( L- J7 Q) tMethod seeking the 'magic number' 0F386h returned (in ax) by all system
0 B5 _% I% n: j' m' udebugger. It calls the int 41h, function 4Fh.
. J4 u0 P: M. R1 VThere are several alternatives.  
$ p5 J8 k0 Q: R- p: ~
5 p: _. N0 p4 j0 \$ u/ C6 NThe following one is the simplest:
. H% G% E: S7 [8 o4 i
0 c$ b. o& r+ a, o5 ?: Q, d    mov     ax,4fh
; n/ H6 ~3 B$ F# V) F0 ]1 }5 Z4 v    int     41h
6 U7 j8 A% T6 H5 a: F    cmp     ax, 0F386
( N* D8 a7 [+ ?3 C  I& z. ]    jz      SoftICE_detected$ Y# a9 d' l) p" ^/ f

3 f7 K0 R3 H: @* c, p4 ?& Q
9 @7 p' C% Q+ N$ h1 YNext method as well as the following one are 2 examples from Stone's
8 w- ]8 r, Z# ^: L3 z2 f# Q9 k# a"stn-wid.zip" (www.cracking.net):- K5 N  N; x6 r

$ Y7 f0 U  Q% B1 g) @# S; O7 b2 N7 U    mov     bx, cs
" v2 R' G7 F' a; r1 A, x! ?    lea     dx, int41handler2
8 O  Y$ W- }! G. x5 \    xchg    dx, es:[41h*4]
1 \& i3 I7 S- _( \* A' F    xchg    bx, es:[41h*4+2]
5 n) |- t5 b$ o1 p- \' I6 c7 J$ m    mov     ax,4fh
/ K. V$ ]2 ^! W: `( b9 v    int     41h, g7 ?! z* D/ ^8 X3 a
    xchg    dx, es:[41h*4]
1 B( ?0 G, k! c& J. Q) s. \    xchg    bx, es:[41h*4+2]# d/ j6 v1 p4 z: C; E, _
    cmp     ax, 0f386h
- D: v9 i( Y8 L+ `+ I* O1 M    jz      SoftICE_detected
, g5 c4 }1 I  t5 k3 f3 z8 A) N$ h# J9 g/ _+ t
int41handler2 PROC( u- b' O7 V" O& J. P
    iret. z: I# ~9 ]- s! `. [, ]5 ^" J
int41handler2 ENDP) l8 ]. i3 t$ L% i
3 u. ^% r5 I- F4 q. F

4 r% E% Y  A2 ~5 X_________________________________________________________________________. R$ P- Z7 j. Y6 f- H, W: [! I
9 \6 a* f5 @# k; F9 i5 [
9 j. P! V! w% W& a2 E+ j
Method 06
0 t4 D9 r: F+ Z1 b' }=========
/ t* A$ F( N5 q9 r4 k* i
, S/ U  ~7 R) H% @  z7 M4 `, [0 a, p- D. p$ H1 G! B% N, w
2nd method similar to the preceding one but more difficult to detect:
  O1 J( U4 V6 l  {) H: f7 i
* t5 k1 b. A, P9 L& A
' b" H0 T+ i3 P% c3 e  _' `& fint41handler PROC3 m+ E5 K- y/ ]7 J
    mov     cl,al5 o6 ^) c+ U( J3 ]" z9 n* g
    iret5 t& D6 x  Z" X) n. Q6 y9 Z; k
int41handler ENDP; [' d1 A3 {1 a" [
0 R. R! p. i8 a! V. E- m" r, g

$ V7 D+ A- ]" N( m8 x9 K% o' A    xor     ax,ax1 D; W! e5 n1 P$ m
    mov     es,ax; `& B& j# O$ X' \* v1 g: e; S9 z
    mov     bx, cs
! f8 x+ }$ Z9 ~4 t' r0 z& k. x    lea     dx, int41handler, f) ?/ A. m5 [% H0 ]4 ~: @1 j( I: F) l1 {# g
    xchg    dx, es:[41h*4]
& _% g5 H$ ]: `4 `    xchg    bx, es:[41h*4+2]
- e6 Y1 V) v* [) {8 `; ~    in      al, 40h8 f; `% i2 Z9 J6 |4 e6 r. g& B( a
    xor     cx,cx
9 }0 U+ ^" Z, k+ u; b( }3 g    int     41h, K0 Q& @# T9 N: J
    xchg    dx, es:[41h*4]; c8 _' V" Y$ ^
    xchg    bx, es:[41h*4+2]  m; ]' o( s. @+ ^) ]: x. X
    cmp     cl,al
9 _( E' }- E5 b  T8 j5 O    jnz     SoftICE_detected
* r* X, F' m6 X( I& o/ M
3 L- |( q! j- G_________________________________________________________________________
* z) I% V, L9 R( `  ]0 L+ Q6 G5 V
' P# A! Q$ p7 P/ `/ X3 e0 Q! t+ ^( mMethod 07' q1 @1 v) c! W4 s; u
=========
" t+ J; a$ a  ~  D) r# h' ^. c/ \' n& r4 \2 {6 @: U
Method of detection of the WinICE handler in the int68h (V86): n/ b# r: P: Z8 h  d: U4 c
4 M& p' v4 x* t6 O9 p
    mov     ah,43h
$ V; X6 F- T. k$ a$ ]8 O    int     68h  o! r' ?# A; ~
    cmp     ax,0F386h
, ~: J0 k& g% j" K$ X" F    jz      SoftICE_Detected
7 B. m( p% x9 K1 l5 P1 Z
% b: l7 D8 c9 x6 x) L( W
" C6 b3 A# ~5 `! a) j=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' g/ i% x" i+ u3 s
   app like this:2 @! d& i! N, r' n

; C/ l, u0 H! ^$ t: u   BPX exec_int if ax==68& a2 z1 k" @7 f' L- q8 D7 M
   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 ^5 o$ ~3 ^% b/ o* M# V   located at [ebp+48h] for 32Bit apps)
& |2 X' j/ B0 r5 S* f7 L+ f__________________________________________________________________________
6 a3 T" O# r8 d6 E6 T
: k8 o2 ?% o/ u" F8 W; S: L5 c  @+ O1 U- X+ a- A2 s7 d$ i. W
Method 08
" _% Q& W1 x$ w" u/ G/ x=========
1 V- h* H7 I1 {2 w- \% R5 {, u7 r7 g  G4 M
It is not a method of detection of SoftICE but a possibility to crash the! B5 ~7 M2 _; L2 z' C- T- S
system by intercepting int 01h and int 03h and redirecting them to another& t3 Y+ h! G% k. X7 W" ~/ f
routine.
9 t$ A; E! [" V" iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) }" B/ V( I: \: v' h. V, y
to the new routine to execute (hangs computer...)$ _' X% X+ d* t7 l, ~4 k
* _% s' W3 G7 B6 J& k+ Q
    mov     ah, 25h
" m) i$ O+ R/ F1 T    mov     al, Int_Number (01h or 03h)' r! D* e1 K; c1 U2 D5 C: _7 ^) L
    mov     dx, offset New_Int_Routine
8 b$ E" s7 ^* [  A    int     21h
" U5 `9 {8 c% m+ }% }" F5 {, h8 M2 ?% `4 C# \2 W3 l6 ^7 s
__________________________________________________________________________
2 |8 x# {# a2 j9 o( m' n: m
) ]7 b  R# D; B& i3 MMethod 096 O, b& ]' n2 D/ ~
=========
" a/ q0 Z( V# A" Q2 {! Z- `0 i
: ~, n% R; v4 B) A+ ^1 lThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  _4 V. V/ r4 U: p
performed in ring0 (VxD or a ring3 app using the VxdCall).
7 v1 n/ r; u8 i. W& t" cThe Get_DDB service is used to determine whether or not a VxD is installed
8 u9 d# f3 U% {" k$ x$ jfor the specified device and returns a Device Description Block (in ecx) for: B0 W: [9 y! H0 v1 H. _
that device if it is installed.
4 D6 ]0 G6 [! ?3 t" H; j1 D
9 X4 d6 r: u0 j. A   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 P: k3 |6 W9 ^3 D
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 h: s" g' g) d6 s
   VMMCall Get_DDB' G! t  Z9 b! \/ u* f) i. w2 u/ ]
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 B( h. V; j9 v  t

+ d1 f, N% A  Q3 n  BNote as well that you can easily detect this method with SoftICE:2 O  d' _* U% U' e8 r: q
   bpx Get_DDB if ax==0202 || ax==7a5fh
. G) P( c* F2 O! H0 g2 _( Z
: G$ n' T, N2 Y1 |& G3 Q0 O__________________________________________________________________________" ?6 V9 ]8 r$ N
- R- D( f9 O5 o- q9 ?
Method 10& x* b$ s. h( k
=========
6 D* j2 R. i5 ?4 K1 Y" D) s
/ e8 t; Q7 O8 l, p' C3 _" I( o0 X=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with$ W3 {2 W1 k+ i
  SoftICE while the option is enable!!0 R: \4 ~4 l( W, M2 Z

8 v+ d) v' g# s, a9 ~8 PThis trick is very efficient:& f1 S9 C1 i. Y: U; H+ S3 z
by checking the Debug Registers, you can detect if SoftICE is loaded
" y6 I  ]6 P7 n" r% s(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  F* S8 q: U7 Uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
: O; n, n, z7 Z4 }9 |/ jvalue (in ring0 only). Values can be manipulated and or changed as well
7 Q6 Y6 _4 O6 K1 K! U(clearing BPMs for instance)
1 c) q5 h) ~. d2 V$ \. D
. w; ^4 F9 {' ]6 j6 R$ t__________________________________________________________________________
- W1 |' O/ W; q+ t9 H7 A/ v1 V9 t! P$ f9 p" t$ ^; m9 s3 z8 t
Method 11
- f0 n" g% G) a% P& s=========7 E1 k6 a# N& I0 F" W; ]

, Q1 ]) n4 u1 ]This method is most known as 'MeltICE' because it has been freely distributed# C8 h3 K4 K( ]3 T: g
via www.winfiles.com. However it was first used by NuMega people to allow( U+ `& ?+ l9 ?2 f% E3 B- b* D
Symbol Loader to check if SoftICE was active or not (the code is located
* T# l: l/ a" {! I9 s( c7 winside nmtrans.dll).
% y2 I( ~! t, T2 a
5 D" n& ^. W4 R$ [1 E/ c+ wThe way it works is very simple:( j* X+ }8 z( z! l& G
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: r, K5 F& J7 T0 g5 o1 ?
WinNT) with the CreateFileA API.6 R4 l4 v: g, T: ?8 M; f
" H3 M4 G9 L3 e: m! Y* A' S/ s
Here is a sample (checking for 'SICE'):/ A2 w0 E8 c+ M4 O7 u

3 d& ^8 K+ d+ ~BOOL IsSoftIce95Loaded()
/ E8 D' D2 X! d5 s  `- b{/ }: @& U, `) b
   HANDLE hFile;  9 o6 B+ ~1 O3 C  k
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! `7 D5 T0 F: ]                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& A) x3 A0 n3 x, C; y. }                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ^1 _" s# _' D3 E6 q- A3 c   if( hFile != INVALID_HANDLE_VALUE )
, d* o1 f3 ~( k0 q3 j! K; f2 L4 e   {' k; ~1 ]4 c3 w: T& j( Q
      CloseHandle(hFile);. b, v+ u! K  |* {8 g: k
      return TRUE;
6 p1 v6 `- g6 g   }+ e8 I6 B! q3 @
   return FALSE;
2 ^3 @) C! d$ O! @. I}: D, d* W, G5 K

3 V# q" O" p, |. ~$ _8 EAlthough this trick calls the CreateFileA function, don't even expect to be  N/ A9 {$ H% W+ X* f# [
able to intercept it by installing a IFS hook: it will not work, no way!
3 F) F" C0 L2 m. h: X! [# JIn fact, after the call to CreateFileA it will get through VWIN32 0x001F$ r+ f$ W6 a- {! O# Y! c/ v
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& Q' A" E1 n/ n: c0 I, Pand then browse the DDB list until it find the VxD and its DDB_Control_Proc1 w  {0 G7 d( \; n3 `3 @, e+ O
field.
0 c# W4 E' r. B; k' w6 fIn fact, its purpose is not to load/unload VxDs but only to send a # p" B% t6 b9 M4 t3 B. V; k0 H7 X) A
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
$ g: o5 N# U/ A" ]to the VxD Control_Dispatch proc (how the hell a shareware soft could try. [# y% z% W, ~* A1 a+ C! G% Y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).$ `; v6 Y+ |+ n/ l- E4 Z/ s
If the VxD is loaded, it will always clear eax and the Carry flag to allow
$ f+ }9 K# v$ T( L. ]. iits handle to be opened and then, will be detected.+ Y8 |, T# ]/ C$ N$ a
You can check that simply by hooking Winice.exe control proc entry point
4 |. A  }8 T) @& K! N4 K, X, owhile running MeltICE.3 q: W, e. b; _5 R' j% A4 W
' E: z2 G+ X$ E1 p
# L% V" k1 V& s/ @. P% g
  00401067:  push      00402025    ; \\.\SICE! N' u5 I4 y* i# L- \
  0040106C:  call      CreateFileA. ~' l, j6 b. {& g$ G
  00401071:  cmp       eax,-001$ H! Y' A. H% v; V
  00401074:  je        00401091, R- O, I9 v- c1 X5 ]  _" j3 V
) m3 C" V' a* l( V1 C/ q
- ~7 P! q4 Q5 U- T& z2 {$ A! v
There could be hundreds of BPX you could use to detect this trick.! p/ z" X, \7 ?9 y, k/ {% b
-The most classical one is:
& N% z9 Q' n' K# b: }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% m; e; h2 k/ e1 b    *(esp-&gt;4+4)=='NTIC'
' a" e8 X$ d# x& u
( t+ f0 j% z0 k! `) o2 l5 Q$ P-The most exotic ones (could be very slooooow :-(
& m0 ^. R5 [1 }6 @) K   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( m9 @" ~/ J6 U( r4 f+ w$ J$ R# y
     ;will break 3 times :-(
. V; ~; M8 i" I) q. K. x8 k! U: C7 Z
, u4 Z; W' [0 ^/ v- i-or (a bit) faster:
8 D/ y) P9 Y8 k% n, S3 e+ G9 u6 \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), P* b6 h. R4 F, u1 X  Y4 Z

% }# m* w9 Y0 ?* Q. e. g) ^( B! R& Q   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  8 r! d5 ?. \* I7 G- a
     ;will break 3 times :-(# U/ S+ C# B; i  B% ?  u% \
5 B' s& D- l7 q# D( i7 X1 a' R0 p
-Much faster:, m9 ~/ `! ?: B, U" U
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': l8 F8 ~  y% D' [  C# P- Y

8 E- \9 J( f8 a  pNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
: ?: v8 R* }* d8 e( ~" [function to do the same job:
: y, n, L7 f2 k8 x1 a
1 ^% P- y# H4 x0 C! i3 P   push    00                        ; OF_READ# H% {0 S) d# s- [3 e" z
   mov     eax,[00656634]            ; '\\.\SICE',0
4 t' Z0 Z- O' `   push    eax9 F! Z9 [( J/ _, H2 F8 h: e
   call    KERNEL32!_lopen
7 Y9 x* B0 j$ n0 V4 X   inc     eax& u9 t$ I+ O# S" X4 }* ~0 D& W3 Z
   jnz     00650589                  ; detected1 M7 |1 z! i4 D. P
   push    00                        ; OF_READ
4 J8 S# ^6 v/ T, T$ `8 e   mov     eax,[00656638]            ; '\\.\SICE'
2 s$ M7 a/ z# \' E   push    eax# Z3 u! `2 f6 Y; _& Y
   call    KERNEL32!_lopen( B- N( L( F& |' a, o8 j$ h4 s, b$ {
   inc     eax
3 E5 @! A# V  e/ ~1 ]+ G   jz      006505ae                  ; not detected
; t9 Y( @$ i! ]& V0 |
- a2 H9 O% @/ u7 l1 i+ b! _/ m+ ?* w1 f) _! R
__________________________________________________________________________" j! M" V7 g, s3 h8 W
$ O2 E1 C. o! F& w( B5 w6 C
Method 12+ z# T- h* g6 @1 u  k
=========
6 t" B( Z3 K  l2 l9 N4 h+ W9 i8 N+ |- l8 x
This trick is similar to int41h/4fh Debugger installation check (code 05) N: z' @0 ~3 L& m
&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 B% M2 u' _! ?2 R3 P1 Q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.' n( y) p6 B/ X: i; W' e$ _

+ Z$ k/ k* ?) E/ w  ~* \2 n0 P   push  0000004fh         ; function 4fh$ V+ i( L8 e% f$ N  k0 U
   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ M; C/ d- i4 }0 {* ~0 \                           ; low word specifies which service
+ ~3 h6 }# ^/ d9 q                             (VWIN32_Int41Dispatch)- K) j; ?$ z2 C5 |2 d. x
   call  Kernel32!ORD_001  ; VxdCall+ O; z( P! a# g0 E( X+ Y" l# F4 U
   cmp   ax, 0f386h        ; magic number returned by system debuggers* ]$ W* X4 R! h, @" `$ e" E% E
   jz    SoftICE_detected: i) B# c/ C( h( r7 t

" t) C# i# c, {0 B5 o9 GHere again, several ways to detect it:
8 V2 J1 v5 \6 t' p. D- |6 e9 ]4 I: G$ s7 G
    BPINT 41 if ax==4f" C4 \* h2 [' c* Q/ f
( D' v  W9 R. ]* T
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one. G' R( @; i4 g2 L* u, e

. t8 _4 ^' l5 E, ^) L* j& ^    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. D3 b3 `. T0 Q1 J1 f8 f
  g# N3 |) W% L, I. J; W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 f; F' j$ @  @  u$ ~" h
: [$ s7 u+ t* k
__________________________________________________________________________
2 r8 {, i' R* V9 ^7 @' q5 ]$ g
2 F# t& ~: [3 J$ YMethod 13
! ]7 z1 ^! _6 z0 w% h$ t4 y0 Q=========3 c7 C. E) J" ]4 E7 K# n, o8 u
: Y& v+ d) w: c; J) x  w$ s; }
Not a real method of detection, but a good way to know if SoftICE is0 j5 \% n3 r  P4 x3 G
installed on a computer and to locate its installation directory.% ]  }$ s$ c7 ?+ m
It is used by few softs which access the following registry keys (usually #2) :; O7 C$ V+ u+ Y
* Q2 K& b0 m& ~* y$ u
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# l! O* t. a) R2 M- l/ e" R\Uninstall\SoftICE" Q1 Z; n$ }/ D5 _7 \# v
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* u1 J, t3 k" g-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" c6 @* W" y2 e6 M3 _7 `: f$ `\App Paths\Loader32.Exe
: b8 D" u2 p5 g( T* d; F( Z9 k: u7 d' w8 V

) m: N/ v  }( A/ T/ o3 mNote that some nasty apps could then erase all files from SoftICE directory+ ?% r( {( s- w2 A& l8 X
(I faced that once :-(7 C0 s# m9 ?& k+ s& t' W
. C  x9 W8 l, ?8 a& P& f$ ~
Useful breakpoint to detect it:
2 y: r+ R/ s& T3 W) _# @8 S, e+ I% L- Q7 r% c, L& ~3 S% r* Q3 J
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'1 ]/ H4 P. Q' O8 _, j
" w/ s; d1 F0 K1 ]. @( }- z  K$ |& u
__________________________________________________________________________) J' D4 j% B, ~  x

, r* f( ~3 O. e( D7 [
& Z" y, [# T/ H" q: o2 {Method 14 % h3 f3 p. @* }* p. L$ O
=========
" M: m, t( `- K" Y+ L
5 u, |% E3 ^, I9 y0 l6 BA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose. A. O  U4 ]. _% N1 `
is to determines whether a debugger is running on your system (ring0 only).
% A( \; F, R  k  F! N
+ D3 L2 Q  h7 R- V3 V* ^& F   VMMCall Test_Debug_Installed9 M. @% Q% i5 {
   je      not_installed9 |( b( x6 `0 j
3 z: `4 {' ~  x' L8 q5 y2 w+ n, \1 M
This service just checks a flag.
% M+ I2 P% _+ q8 Z6 F+ G</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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