About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 V" j# Y- \$ q' t4 N! H- p
<TBODY>
) O0 V7 y, {9 B0 u<TR>0 X  N+ ~  ?! n4 t. W; W, x; P
<TD><PRE>Method 01 ! n$ Z- B. @1 L: q
=========- i& i" y( `/ W# v% |4 V

; ^+ h2 Q0 h  \  B: R- p5 FThis method of detection of SoftICE (as well as the following one) is; a( m& n' `3 [# T
used by the majority of packers/encryptors found on Internet.! D+ M0 Q: i5 l" y" z+ ^4 x
It seeks the signature of BoundsChecker in SoftICE1 S: {7 k$ f- L! E

% h  H$ {" G! u5 Q+ P4 B" b( V    mov     ebp, 04243484Bh        ; 'BCHK'0 a6 k$ E& i4 F3 `  N; x. M5 \
    mov     ax, 04h
! W9 t& R7 Z! \% Y    int     3      
7 w( x6 b* B! n% g/ j1 I; u    cmp     al,4
: Y. w9 F+ r, S3 B    jnz     SoftICE_Detected, _& W4 H5 O# t' }6 r. y
5 S  H. f5 u/ o) j
___________________________________________________________________________) b, F* u0 s+ N0 m

0 ]6 @$ \" m# A! MMethod 02' f* V+ P9 W- }0 [: E  Q
=========
1 x0 d$ `5 J0 K/ @0 J3 B
5 u5 k- u4 Q8 [( EStill a method very much used (perhaps the most frequent one).  It is used
% S9 f* `" H, G6 r+ \3 r* fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,# _/ g5 u3 _* v# b* c  t; s; V6 _1 l
or execute SoftICE commands...# x& q: K# K$ M9 Z  C+ f7 X
It is also used to crash SoftICE and to force it to execute any commands) v5 X# Y7 T0 v. d
(HBOOT...) :-((  % c7 x/ J- ], X3 M' u, }3 G# n3 L
; `3 C( S! F8 C; N$ |% |- `
Here is a quick description:8 `) `, n4 Z6 n; T' W
-AX = 0910h   (Display string in SIce windows)- @1 ^4 k) D. i0 U& I) D
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 |( {( v& b# r7 E% i8 A  h-AX = 0912h   (Get breakpoint infos)
0 K3 F% l- r7 c& \-AX = 0913h   (Set Sice breakpoints)
0 Z6 P" e' K5 @) k1 x-AX = 0914h   (Remove SIce breakoints)  V2 W4 m3 X  j. i: ~

. Y# n/ M" ?: y: n& VEach time you'll meet this trick, you'll see:
& d7 ^7 B3 \3 v$ U) }! \: C-SI = 4647h
' a' f# F% H( F5 M-DI = 4A4Dh
5 ~3 ^2 s# ^9 P9 S+ E) NWhich are the 'magic values' used by SoftIce.
! {4 u! F! ?" I4 q9 c. t# sFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.* a" n. k0 w! P8 J
2 x3 {, S0 }- f* @' \/ W
Here is one example from the file "Haspinst.exe" which is the dongle HASP
9 e. \) e" _' n6 z1 V" Q  a6 H: iEnvelope utility use to protect DOS applications:
5 v  H$ x$ s* G( ]0 i
3 ~" d1 i' w& V9 R$ [$ V7 l4 r2 ~2 p" \( O+ k
4C19:0095   MOV    AX,0911  ; execute command.
# B; \( v5 q& L& s4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. y+ C0 k: L: p0 Z0 O+ [7 v; ~
4C19:009A   MOV    SI,4647  ; 1st magic value.
4 u. J& J# a1 B( G, c( @4 C7 K8 ]) R8 m4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- Z  E0 M( n; B+ m# ~4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% h" w* ?* Q- N" c  K) n4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" n7 v. L; P- @4 P  [  h5 r4C19:00A4   INC    CX
' \) L9 Q7 Y$ L8 [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( b+ ~: @" }. b7 g6 I$ ^4C19:00A8   JB     0095     ; 6 different commands.
* m" D6 U. z% y0 _+ P! D* ?2 x/ C4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% f5 N8 V% _: j7 D0 K. @# b' P% h
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ ]: I8 h/ X. }5 Z5 }' C" D: i: K7 S
8 L0 n/ f' e( G( Y; t! S, \& {
The program will execute 6 different SIce commands located at ds:dx, which4 D! e: Q5 H5 y! v
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 q' X; }5 D" @# [3 }/ z) q9 v8 o; R3 r/ x
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 C* ]8 [1 R$ ~5 K4 u4 `" i0 n& H9 p___________________________________________________________________________: ^0 J( V0 `7 L* A+ r/ p" U/ S. x
9 T- J' c  _7 E0 `5 u3 S: s# p, R4 Z

+ n# r8 ]. V( P. cMethod 03: @+ @- E* |7 n) d+ g9 P+ b7 Z
=========' V5 `6 |* L4 D8 @/ l5 O8 C

3 P% l) ]$ ~; v3 f. p9 o( S9 uLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 i& E; k, u0 N1 L4 }0 l4 T(API Get entry point)# P* z" M. e9 C% k) W) y1 {
        - n5 [, k1 `; a4 \+ q! k# R# H

+ K4 H. f7 A  s+ \6 ]3 Q3 S    xor     di,di- R3 r9 {# s3 I+ X3 o9 g9 j
    mov     es,di2 L2 {" P2 e% h' L8 w! U8 S: `
    mov     ax, 1684h         A4 W" ~9 k7 G& H  U6 L, u, d4 H
    mov     bx, 0202h       ; VxD ID of winice
: c+ `( B) e& A) }9 d    int     2Fh1 G5 s% t/ ~4 C! X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* D: J* |9 T- ~1 [% z/ s    add     ax, di
4 G1 Y$ B1 g# y    test    ax,ax
, z) g; \% ^) G5 b/ e    jnz     SoftICE_Detected0 l, D2 \, j0 b3 D

' ]' x( q' C7 Z6 h5 Z___________________________________________________________________________
" T2 v- w1 J: D9 G' a& c" X5 l1 l. B# u- ?6 a+ H
Method 04, u8 _% z0 I( Y1 c  o$ e% D
=========
0 J+ t* W! f- j  e- O# D" }( z  h1 b: P8 P4 A+ t3 f6 _
Method identical to the preceding one except that it seeks the ID of SoftICE( i4 d# L1 U' S- i' o
GFX VxD.
7 e) D$ L7 |# B0 U3 R' w
9 b5 ~4 D* f! {  a6 F: c, e. i+ ^    xor     di,di0 C' _- X0 z9 ?7 e) p6 l8 u4 n3 I
    mov     es,di- Y' N9 p2 ]4 y) Q3 Z2 B9 C
    mov     ax, 1684h       % _5 ?2 D3 D3 M- v7 q% \6 t+ z) j% a
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 }& ]+ m+ p9 \  u3 u! v0 n    int     2fh* h' E* x: o9 p4 b) R; P. b) w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" V, l9 U9 Q% _+ @" ~% k3 E    add     ax, di) g; N& @) L2 _. a; `0 `( B
    test    ax,ax& P) {+ d5 T* G+ }$ t
    jnz     SoftICE_Detected
2 L) j! T. P/ K: g; _  V5 M1 o) r" V* b  U
__________________________________________________________________________: O8 }8 g0 s( l( L4 T: i) @

$ T+ e+ p9 i) K$ f+ o3 h
4 N9 F$ ^9 m& p& c9 r; |7 t1 @' y* QMethod 05: k) O# V7 [3 K! _( }! w. g( C; N
=========8 \- }1 ^$ B" K/ B2 x8 |
# e0 e* `. V3 K* E/ N6 p) u
Method seeking the 'magic number' 0F386h returned (in ax) by all system7 k7 C# M( T# F( \6 L9 t
debugger. It calls the int 41h, function 4Fh.: e! ~; t6 d' T3 n& b: L
There are several alternatives.  
. R. x7 ^9 ~9 |2 j& w
: C, _. Q* }' l0 ~$ v; h- z. mThe following one is the simplest:
% J7 i7 M# P- q( E/ z0 ?* q) [1 ?9 l; b& ]* y
    mov     ax,4fh
3 Y2 T1 ~. Z6 ~8 L+ d    int     41h
' x( A, j2 o. {2 z9 l    cmp     ax, 0F386
6 c1 V4 g& {7 i* d* p4 p    jz      SoftICE_detected+ z2 N; ~% z8 P
( C) u5 O, G  Y6 v  i2 t; h/ o; B
; O5 `( z8 ]. S
Next method as well as the following one are 2 examples from Stone's , G- `& v, B+ ]+ v
"stn-wid.zip" (www.cracking.net):& i& }! k7 v/ W* x' f) X: |- D

6 q" q+ \" `+ _7 \/ i# A4 [5 C! H/ A    mov     bx, cs
" A0 {4 w+ |8 Q. [% f1 y3 Y* @    lea     dx, int41handler2
. W5 L- _0 @% S/ O1 H# u3 C3 q    xchg    dx, es:[41h*4]# t7 n; d, A5 [. K5 q" O
    xchg    bx, es:[41h*4+2]
5 v) ^0 ?& R% y, }( E3 R    mov     ax,4fh
" O+ d9 T9 D; k* O* D* o" E, ]  p    int     41h
7 }% F  L& Y; R* W5 ~' j    xchg    dx, es:[41h*4]1 J3 U* \. K' R/ q+ _5 h
    xchg    bx, es:[41h*4+2]
9 a* n  a# O8 R$ A0 r' W# K$ t    cmp     ax, 0f386h
, {' g- A0 u' p/ |    jz      SoftICE_detected: J8 i/ ~6 V) p( h2 y) V

  u3 I; Y. f& \' r  zint41handler2 PROC3 l# }" a7 f# F$ v5 u
    iret
0 n' b0 b0 J$ `; F& ^: Vint41handler2 ENDP" R& c$ m  {2 M/ O0 K
2 d$ M* Z5 O4 S0 W) a
6 O, _+ Z! f! v% [, N+ h
_________________________________________________________________________
' _4 u6 K; K* R: R- {9 K1 U- b
  c- T; Q# e) F) H! G, M
! K: s9 }1 ^. i& ^0 a- P& [( v& OMethod 06$ X; v8 }' [; i
=========. Z5 T5 ?% |  Z8 a" P2 @, i
9 g3 ]+ _6 a9 I
$ a+ z* Q' u# I% h) m  X9 Z
2nd method similar to the preceding one but more difficult to detect:( T; f3 a$ K  G! ?4 @* }

; \) T* f/ v  q8 B1 G; q2 F$ ]8 T& d3 ~: D
int41handler PROC0 w, W6 y6 E: ]. _3 e$ j' k
    mov     cl,al
" h+ K. V/ E4 _  A    iret) X$ c2 Z0 b) T& I
int41handler ENDP0 C7 j6 Y9 b; x4 y
5 F. E  O2 T# j  N5 K
! a9 g- `* M. e
    xor     ax,ax/ v1 z" T+ o+ E, c8 H4 G
    mov     es,ax
4 U7 w! Y) P1 D4 x0 J    mov     bx, cs
) t% ?% e9 I9 E- z, `3 U5 A- X: m    lea     dx, int41handler
" s5 f$ J" f8 p    xchg    dx, es:[41h*4]
: q9 z* V3 R0 s; I' y# f    xchg    bx, es:[41h*4+2]5 W' w3 }; `6 b/ @* S' ]
    in      al, 40h, V! m$ p% `$ P" ~+ ~
    xor     cx,cx. g/ k, {7 F$ X' _) \8 m' s
    int     41h
. s, _( l; `, T, @% Q) S) {. I; X0 K    xchg    dx, es:[41h*4]  }4 o+ k! G  U! q/ L- s7 V1 i
    xchg    bx, es:[41h*4+2]3 |/ a$ e, h4 a- N
    cmp     cl,al
3 L: o* U4 K+ H    jnz     SoftICE_detected
. Q# N1 J! a+ \/ Z+ g' Q- Z; @7 L) u$ Y6 l) G  I% {/ p5 Q5 e
_________________________________________________________________________$ i6 ]6 T4 H/ {: `! A
& Y( L% i3 x0 \1 V6 B! d
Method 07
; L/ i* l& T8 ?( M=========, n- z0 g! }( Y8 F
2 U, b! r* G% A5 B8 B, M
Method of detection of the WinICE handler in the int68h (V86)
$ g/ O% t2 Z. a
7 h1 K! S; p+ W( R8 ~. z1 b    mov     ah,43h
$ E) h& c" J0 _8 }" t3 B. A: N! z    int     68h
" T1 K' c% G* `! T' g    cmp     ax,0F386h  [. X" Q7 Y1 C# |
    jz      SoftICE_Detected
. d# L# @) k/ m6 E- r6 _* X
( f% z# ?0 V3 ?; @& V8 t
8 k  w) V. D3 k* b* e=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& W2 b1 _5 d6 M/ \$ a) Y   app like this:
! I+ w; @/ e/ r4 d4 f# \' v; ~& b% v
   BPX exec_int if ax==68
* z, P5 l) {9 l   (function called is located at byte ptr [ebp+1Dh] and client eip is( Z( w( l' i, h% Q0 v% u
   located at [ebp+48h] for 32Bit apps)" V# R1 S* i$ ?. Y- o$ J
__________________________________________________________________________
2 g# Y0 o& U" T; U0 E, i* l9 p- k+ X

7 k/ f  z8 S+ Y1 \: c( SMethod 081 k3 r; }- e) s8 U
=========6 G- F1 u" S  V: m$ M
# G) K6 y6 b  N  _! D6 [
It is not a method of detection of SoftICE but a possibility to crash the2 `% W; `  o8 @, j
system by intercepting int 01h and int 03h and redirecting them to another
2 e, u8 c, _# G; S( @8 Uroutine.
( t- W0 i0 A0 u3 e: ^9 cIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
9 d0 _1 q6 J- W8 H& H$ a4 T9 tto the new routine to execute (hangs computer...)! n4 }- _" O( N8 c+ P

3 Q1 w" V6 O' X8 ?    mov     ah, 25h
. M. x% @% _3 y& g    mov     al, Int_Number (01h or 03h). E: u; r, W! ]% \
    mov     dx, offset New_Int_Routine6 ?3 X$ [$ a' @. h" u$ w
    int     21h
2 e, A: f- h: D2 i  r  r5 G+ {* e5 ^1 u( P
__________________________________________________________________________% h# f- v4 u9 T8 p: n

2 i; w9 p0 R  G9 E+ u5 b7 t# F  p1 @Method 09
6 Q3 U/ u) I: A6 {) F0 b  b  {=========
) a* W  a5 K. t1 Z4 n, l; j* s* r  H% V( l6 v7 i
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! Q# k5 _3 a6 }) T( _8 v# H9 N7 Y
performed in ring0 (VxD or a ring3 app using the VxdCall).8 k( b5 m- ]8 f2 H
The Get_DDB service is used to determine whether or not a VxD is installed8 ^. H; @* g: F
for the specified device and returns a Device Description Block (in ecx) for
2 ~* V9 Z" ~) q! A5 Rthat device if it is installed.* `+ _$ W3 Q. V7 Q! O

; O$ ]1 @5 q* q% d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ x( d' d' M  \$ @; y, P
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 z. v8 u3 i1 Y/ a, O+ x2 L; \
   VMMCall Get_DDB8 J0 B4 X1 A- U8 C6 ]1 E/ ]- V
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% b8 W+ G7 W3 L8 K+ l- I
# v7 K1 ~- c9 C$ _1 L6 s
Note as well that you can easily detect this method with SoftICE:0 @5 [7 [5 I* c/ I2 b7 ~* G1 V
   bpx Get_DDB if ax==0202 || ax==7a5fh: W  w* w! ^6 @( i9 V# x

- c# M% b7 P# ]+ w" s/ a" S__________________________________________________________________________
$ |/ [3 w% R8 G% o* I6 ]6 p6 B) H! r% `' \
Method 10! F( N- o. s; x' S4 Q. i5 U
=========
: c8 a  B: Q0 C& _
  K: a' Y, m6 j7 n=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
# j$ d1 d" f7 h& P# |3 G  SoftICE while the option is enable!!
. @& o& S- D& K# I/ A# M
: c, C- d& I: N- o* p' \This trick is very efficient:/ p( j( [+ {) d8 }
by checking the Debug Registers, you can detect if SoftICE is loaded" o- D' ~3 z+ I4 [3 Z$ s
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* r9 k6 b9 H9 V5 W
there are some memory breakpoints set (dr0 to dr3) simply by reading their
8 @: F  @* [2 Y" Yvalue (in ring0 only). Values can be manipulated and or changed as well
: ?8 H$ M6 w$ G2 G1 ^1 f2 w(clearing BPMs for instance)# v) n) Q- r8 G. H5 a6 q

* x0 u1 W" R! W5 k* l$ h__________________________________________________________________________9 p1 S3 P4 n7 ^3 T8 ]

6 z9 `7 y. H7 D- y5 @% l0 f3 cMethod 11$ n8 j. d2 b  Y) ]4 G
=========2 P+ T" o2 k6 a# d! z1 [
- f3 b. P0 Z% C' }" u
This method is most known as 'MeltICE' because it has been freely distributed2 C& Q, x, n( }
via www.winfiles.com. However it was first used by NuMega people to allow
( E0 p4 f- _1 k. q8 q' H9 k8 q! PSymbol Loader to check if SoftICE was active or not (the code is located* O7 c7 ~. Z2 o4 u
inside nmtrans.dll).
' G; Z: g# F& v/ _1 ?* B% n2 x" _1 o, ~
The way it works is very simple:
( r8 Y7 [8 v" J, U  O2 TIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 e+ w; G" ]8 @1 s' \  M! bWinNT) with the CreateFileA API.+ ^0 q3 N# |. k8 v  U
% y3 L' {, W; }/ ]8 |6 Q
Here is a sample (checking for 'SICE'):
& f6 {& a& X6 Z- ]8 Q/ l5 ~: W* l. r2 b8 f% ~2 _6 ?6 a' G
BOOL IsSoftIce95Loaded()
6 `5 D+ c% C: ^{4 b8 C, c6 I9 Q9 w* _3 }
   HANDLE hFile;  " F2 W' M- a/ K
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 h- a- T0 G% k
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 u2 Z# w% p: j% `3 Y  [                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 V6 k5 X3 r$ l. \3 V9 a2 n! E   if( hFile != INVALID_HANDLE_VALUE )+ }' T$ W( [9 K) E6 |
   {% A: u; s1 k% ?
      CloseHandle(hFile);
- G. `: i2 S8 I* _4 `- w( m6 @      return TRUE;
) ]7 }8 |# X  S9 h( k   }
6 k! E; |8 B. s2 e6 [   return FALSE;4 h  f/ e0 ]% t# s/ q3 G/ ~/ E
}
, S5 q! u) w. f1 _  Q" Q3 y/ i3 ^9 Z* [, y8 S, Y3 n5 O; U( a' o
Although this trick calls the CreateFileA function, don't even expect to be* c' x* b8 i8 V6 b1 I, [( B
able to intercept it by installing a IFS hook: it will not work, no way!) K; \' S. w& H
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
( x0 Y9 d) {/ I" y+ _# Fservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ M, f$ K3 F( p8 G8 j+ t  T
and then browse the DDB list until it find the VxD and its DDB_Control_Proc* ], x5 B$ Q( |6 p. i& v
field.0 U' c! Q; s2 H& I* l+ _5 J
In fact, its purpose is not to load/unload VxDs but only to send a * m" o& d& \/ ?
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" w9 q) G8 f' l$ U2 V1 i  j& T& n* O
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ V: V/ i) q2 h' ~to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ Z+ m7 }; U3 k9 S, v. GIf the VxD is loaded, it will always clear eax and the Carry flag to allow, E5 C. Z9 i* Z# r5 G9 ]
its handle to be opened and then, will be detected.
9 v: S" F# {7 T8 }4 K) e5 KYou can check that simply by hooking Winice.exe control proc entry point
4 u) Y+ e# N" y* kwhile running MeltICE.2 i2 _7 j, l( l/ I5 L
2 Z# L0 V3 G, n- ~0 e$ B

1 E1 R9 p" v# Y& D+ l3 W  00401067:  push      00402025    ; \\.\SICE3 |; i8 _( L; V; p7 i5 k
  0040106C:  call      CreateFileA& i+ q  p. C+ G8 s
  00401071:  cmp       eax,-001
' B/ b/ W: N' Q$ M2 J& I% j  00401074:  je        00401091; m3 ]& {8 [( w8 u6 k5 X* k

/ K2 m- `# S- H' |5 F* y3 ~/ l% w+ K  V" a4 I1 {  t
There could be hundreds of BPX you could use to detect this trick.
- u' O" q* f, u-The most classical one is:
2 D1 c, P0 a- o/ ^- w% R0 G  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ F( U) e$ f7 `    *(esp-&gt;4+4)=='NTIC'
; Y" C! Y! y4 [( E' L0 p
3 Q, D4 b+ u+ [-The most exotic ones (could be very slooooow :-(
* B" P: K9 F! X, K( z9 ^2 J* W7 T   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 i4 q2 {5 }+ }& V     ;will break 3 times :-(
6 M3 X: ~3 {% s, G! _1 ^9 D; }  P6 }0 C- W! t
-or (a bit) faster:
$ Q* o9 @7 a) R) I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& v  M2 R6 _3 Q! }' l' u5 ?+ u7 D% [- y9 C
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ J/ V+ \6 D. S
     ;will break 3 times :-(9 I4 R% n8 q7 P: z2 r) {
- v" G5 `& n0 K- d; E8 P
-Much faster:
6 k6 {& y+ }( N: H5 R" ]) m   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* h! E# t6 ?* J0 |
. L- z7 `2 U2 Q! aNote also that some programs (like AZPR3.00) use de old 16-bit _lopen3 D; C" O$ f9 F6 Y3 T9 [- ~
function to do the same job:; }! B; w, W7 r5 w  U  [
% T, a1 n# m. U" t! r. n0 D& `
   push    00                        ; OF_READ5 q; s2 w3 S9 H+ g" h
   mov     eax,[00656634]            ; '\\.\SICE',0
9 {4 }# T! p! b  t8 n( g3 Y6 {   push    eax/ e/ N0 X3 P3 @  {; a
   call    KERNEL32!_lopen2 J+ G4 y3 ~8 m% e1 B) @+ Y* M
   inc     eax6 n# P. r; {1 V0 V% v
   jnz     00650589                  ; detected4 _6 m5 c/ d% H1 X+ }% w1 J$ F. W* f/ p
   push    00                        ; OF_READ
. z% y* z) s4 M3 ^1 c   mov     eax,[00656638]            ; '\\.\SICE'7 q8 ?$ }4 e1 W1 L) J
   push    eax
; r7 M; c: ^1 L2 i; A6 M& W) `& `   call    KERNEL32!_lopen
# _2 k9 M2 N8 ^) f   inc     eax( A/ P6 J% s; ~( Q9 B
   jz      006505ae                  ; not detected
% C" v8 y) ^2 x5 N7 @
8 o, R" [! G% _1 p- t6 O  Q* u8 r0 n5 q/ n
__________________________________________________________________________0 ?, R& J, J" h3 U: w9 j8 M4 E

! L) B3 N+ \" K, AMethod 12
7 a7 i/ Q: o3 S% @6 _) N=========
& F$ [2 j. K- q8 F2 [% O8 ~1 h+ D$ \% P% T. W4 J
This trick is similar to int41h/4fh Debugger installation check (code 05
# Y) M. S+ [  \# A: _( K: g; J1 c8 j&amp; 06) but very limited because it's only available for Win95/98 (not NT): G& X! C1 B+ ^4 J* \
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.! x) r0 U: H/ T2 Y& o
. g' H/ i" w4 P3 s2 b
   push  0000004fh         ; function 4fh4 v% k) a2 }6 X9 g
   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 n# X$ I5 ~! [7 T2 o                           ; low word specifies which service
% R' h* Y  V) C                             (VWIN32_Int41Dispatch)% c+ G: Z# f  k- t
   call  Kernel32!ORD_001  ; VxdCall3 z- w+ i) J4 Y2 I) R; k' u
   cmp   ax, 0f386h        ; magic number returned by system debuggers% r- r! x! r- C( L) B
   jz    SoftICE_detected/ S6 c1 x  N7 ?; P6 C

' I0 R9 ]; c) ?' }" |; sHere again, several ways to detect it:
% t/ o6 c$ B: r8 r1 U# w: b$ a% b( q5 ^( S7 y- T5 m
    BPINT 41 if ax==4f% M  E- y# n2 J$ B1 C/ L) j, {

( e1 j2 G% i: H) G9 u" B    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) }; N* S- S8 T; h/ W$ f" ?. Y5 H8 @
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& z9 q/ n- `. m
. R, s" A/ V  u4 `
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, x4 U5 e& e) P9 C
7 G5 t& E# C0 b0 y* E8 {/ b/ n% e
__________________________________________________________________________0 k! {' B0 c$ j2 \* w- R

$ t; z" z/ |6 I+ XMethod 13
* c& w, H5 ~. A7 p! F6 \; G+ Y. q2 g=========7 @- P1 Z* h( O( G% z" d! B
( f% U/ j9 a8 O8 K
Not a real method of detection, but a good way to know if SoftICE is1 E; _1 b/ ^$ h/ l; H. E
installed on a computer and to locate its installation directory.1 J* l9 E  p4 A& k
It is used by few softs which access the following registry keys (usually #2) :# I% W. C) t4 {

; g2 q2 \$ U3 g& Q7 `5 X-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, v; ?9 w) }+ j' n
\Uninstall\SoftICE
7 a% D: k7 Z: R7 k. [$ ~. F-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE: f; W- v- M1 g4 `0 Q" M) z0 |+ z% I
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 K( r: F5 A( n4 K7 a7 T
\App Paths\Loader32.Exe
. f6 ~- Y. T5 ]+ }& L1 n. {; f7 B; h8 H1 |$ t' j3 ?) H
# j+ V  l4 z2 ]6 @- w0 ?/ M
Note that some nasty apps could then erase all files from SoftICE directory' R3 K. h& m) t& ]: z6 a
(I faced that once :-(( Y. R6 u2 E( }7 s% L" z3 s
% w* V! D" c' B* P* J
Useful breakpoint to detect it:; |0 B7 T# @* ]8 m$ E  H2 \% {

$ _8 w3 c; k) f3 Y     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- `$ E9 f3 _$ w  D" n3 B* B
) T4 G' W& g/ X$ ?2 M
__________________________________________________________________________
8 V( g' c& b' J
/ ]$ C  k6 \4 Y5 }! q! `4 U; U" F* Y
Method 14
4 F7 l2 v1 e" Y$ N=========) e) \( Q. @+ @# H2 D- v

4 F0 I" ^+ h. Z8 R( g" N; TA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 W! b5 d1 L; G$ Eis to determines whether a debugger is running on your system (ring0 only).
6 j' M6 Z. P8 [+ l& y2 f( g
: @& N0 N$ H3 @   VMMCall Test_Debug_Installed
! {- y6 D5 j& ?, D( T   je      not_installed
- g; ^$ u( |5 a4 r) \! T1 {# L" a: E; U* F  [
This service just checks a flag.
1 e% L: |! b3 X) A( K$ n7 G</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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