About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ T" t% `: v, |<TBODY>2 B4 i6 h  l7 o) u
<TR>: Z/ y0 l" L) [2 |
<TD><PRE>Method 01 & U0 r* g' W% e
=========
: V; a2 ^8 p6 ~! m' o# O
+ M8 a4 c5 M" S# wThis method of detection of SoftICE (as well as the following one) is
% e$ _4 z  W0 n# M2 \, F. }% Aused by the majority of packers/encryptors found on Internet.
# B/ U" r* _$ D2 g' a+ p: IIt seeks the signature of BoundsChecker in SoftICE& |/ T& d% a% r& a4 h

- w5 `4 R6 H+ o+ s2 N0 I    mov     ebp, 04243484Bh        ; 'BCHK'+ ^8 P: v. |6 ?5 N4 @( k
    mov     ax, 04h* j& s6 V; |: H. _; j
    int     3      
* P' h* Q- Z: H( B1 q7 }    cmp     al,4
, Q$ y  d- n' @4 m3 W  @0 P    jnz     SoftICE_Detected
6 n% i. C* c: x$ E. O: v  b4 u: E1 a( a' f
___________________________________________________________________________
7 W/ S: a+ R' N6 J% g) C* S* I1 J+ f1 o( T. O# G+ _
Method 02
& [9 S# Y. @2 O9 j  U=========- }7 B/ B/ O( M

0 L; T! H3 U; Z* ?1 e) sStill a method very much used (perhaps the most frequent one).  It is used
5 L- t# a' F+ J3 }to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 j6 P! t! r8 w* g1 W
or execute SoftICE commands...1 J" t; i2 [+ s1 Y
It is also used to crash SoftICE and to force it to execute any commands4 t) E! x4 g6 b  @! u$ B2 O
(HBOOT...) :-((  & q8 p! h8 E9 ]; t

9 Y, u2 D  |* J) {Here is a quick description:
6 i. g/ N' Q! Q! N8 G7 Z2 B-AX = 0910h   (Display string in SIce windows)9 Y7 A3 ~6 g- M
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 }( @3 V% q* E3 W( C$ M
-AX = 0912h   (Get breakpoint infos)2 P# h6 |- j& w& m) v% B# D3 k) L* L
-AX = 0913h   (Set Sice breakpoints)
6 w$ j) W/ r" G) w-AX = 0914h   (Remove SIce breakoints)
+ D. I( ]4 Z0 n9 p" R. a* u) ?& S" J& @, i* y, ^  e2 O( z7 ~
Each time you'll meet this trick, you'll see:8 L& ]. O; N% f3 O+ @
-SI = 4647h
) ^4 V  [* X: f" C-DI = 4A4Dh5 `9 G' W, E: N& e& _: V: ~3 J
Which are the 'magic values' used by SoftIce.
! M$ o! q- J' j: U3 A1 ~+ F9 m& fFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.. z3 f9 j/ q5 w  G
7 @7 z4 \8 @! m% q2 M# M
Here is one example from the file "Haspinst.exe" which is the dongle HASP
2 ]5 }  `( n7 [8 b+ T9 SEnvelope utility use to protect DOS applications:
+ v" b5 w/ f$ `. A  o$ A* J+ A7 p9 r) l  H+ J$ T7 @
7 T  r, Q! q5 _- c. I9 B. y, T# D
4C19:0095   MOV    AX,0911  ; execute command.( ?$ I% g% ?2 H: {
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 s% u6 u3 `4 _& o4C19:009A   MOV    SI,4647  ; 1st magic value.
/ ~$ k* x0 V" A* p4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 W) K7 s" D( f# ~
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! J) x6 E2 [  \/ y# n9 M4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- w+ S* u* q  ^' T" Z
4C19:00A4   INC    CX
7 H* L* X" b. z3 X4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( ]- X$ z+ ~* U8 g
4C19:00A8   JB     0095     ; 6 different commands.
& }0 L: \! C. p, _& }) [; V4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ f( m1 P3 M( x2 v4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; Z9 F& c( X7 K, G+ i: y$ Z& V5 e/ s5 P2 S% I
The program will execute 6 different SIce commands located at ds:dx, which
8 v% Z2 {; |- B' Uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( P6 S3 b; N9 w& I' Q5 \/ A4 n+ P- l; U, j
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ C7 u* O6 A: f: J8 v2 C
___________________________________________________________________________
' t3 Q: u& U& l% H
; \" A8 g1 `! W. c% g. c  C7 d! V* @* n' c( t" j7 F6 i" j& R& o
Method 037 M% N5 H' }, p% K: A8 @1 n
=========
; j1 ~5 m+ p( r, P2 ~1 _, s9 E# ]: U  y
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 |3 H8 i2 M9 z& V( X1 |* a
(API Get entry point)) W4 `, ]1 ?7 H! G! t, w0 G& X( E) j; s
        6 c0 d4 r" |3 j) `! P) p
3 t. ~9 G/ S  j  k0 h4 `
    xor     di,di
# S) {  m5 u, o, a+ r% B$ a( f    mov     es,di
, z9 b& w9 x3 \5 W- j5 f    mov     ax, 1684h      
# x" g9 U5 p' {/ M3 V8 k' r( L    mov     bx, 0202h       ; VxD ID of winice, L/ Q8 `1 W% Y4 ?0 j* C
    int     2Fh
+ l1 I% j$ \2 J0 W# \+ c    mov     ax, es          ; ES:DI -&gt; VxD API entry point* o2 [# n3 s8 [8 ?7 x) V3 [# w; M
    add     ax, di9 x7 K) l9 \  x4 S+ D# X; }4 |$ ?: v
    test    ax,ax9 D4 G! d) P% ]4 I/ _
    jnz     SoftICE_Detected
* C0 L4 t2 y, f: c. ^  G. b" j" ~6 M
___________________________________________________________________________$ q9 }5 l* K5 @$ h- B
- u1 E$ Q% V" Y. `0 L( R4 N
Method 049 i& \. ~! j# h  O5 i5 j
=========
* r  l! w# z/ V$ ]6 H# T0 x' o
1 e" x. k; g9 l/ X2 k7 ]Method identical to the preceding one except that it seeks the ID of SoftICE0 _% ]' J" R5 z9 d" j! G# B
GFX VxD.
1 R  C6 F) J- S" ]3 h
5 W, G: x1 ]9 \9 z/ C    xor     di,di
- q- ^$ _) b! m! t0 O% n) l4 {    mov     es,di8 V2 |/ ]! C8 f
    mov     ax, 1684h       5 B+ v& y$ V, {$ U, W& `2 u
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( U: i1 Z0 y+ `+ s- |5 A4 L1 p    int     2fh- }! ?- g% X, l* a3 M4 T/ E: n
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) E' N& l7 @& O# u% H9 C    add     ax, di1 R, ]& P2 X4 R
    test    ax,ax
, g/ V1 m  B4 [2 C* [; P    jnz     SoftICE_Detected
, t  T) z; P  o3 s* s. M' u/ H6 E9 J' z2 g% _( @
__________________________________________________________________________8 m. f$ h- q0 k1 f5 w
5 h% B6 q* E( N2 t0 b* k/ i

' V4 y5 P% V( O' sMethod 054 q  ~  t( S! K0 q8 \' H
=========
1 u* t1 E" J  S# P# @; Y5 ~+ x  C1 J/ t* C
Method seeking the 'magic number' 0F386h returned (in ax) by all system2 K. J% e2 g* ~: L5 ^  X+ v" l" l
debugger. It calls the int 41h, function 4Fh.& O% k! _' n4 [% Y, Y2 t  `
There are several alternatives.  $ M. ?5 i% E. _: d' H7 c

4 E4 K; P7 |+ T2 oThe following one is the simplest:" y% l: m2 P& v" l7 n

- B, t2 Q4 g! s3 H    mov     ax,4fh6 Y3 ]8 E$ ^& e( c- |" u
    int     41h4 J9 R+ U* N8 L+ ^/ X  {9 h
    cmp     ax, 0F386' a$ ~! f; T/ l4 V' A4 [
    jz      SoftICE_detected: s9 t( B2 y" W7 _' @) D: d8 b

* j) B) u9 [0 w
" }& t( f6 J# z0 UNext method as well as the following one are 2 examples from Stone's
2 t: N" e3 v0 j3 `" a' R"stn-wid.zip" (www.cracking.net):% @$ u) G1 j9 f+ v
6 `4 k, u1 ^" z: i8 ?9 m
    mov     bx, cs# e, M, V9 E5 S5 S. K4 f
    lea     dx, int41handler2+ J2 h. Y) x* N. D: Z- l
    xchg    dx, es:[41h*4]3 }% s8 D& g, r8 G  ^
    xchg    bx, es:[41h*4+2]
; a7 I! q6 ^; W& r4 `: Z; D  [    mov     ax,4fh- _6 o% z  S5 z$ ~6 y# C- I5 j
    int     41h
) E* h$ O4 h- L; u. |( r    xchg    dx, es:[41h*4]
. h# j, w/ m" S8 K    xchg    bx, es:[41h*4+2]
9 s. W7 v& R& ~5 j9 H    cmp     ax, 0f386h
9 E; X5 t. K" X5 Q/ a    jz      SoftICE_detected
9 R3 z4 ~& L0 C; @0 X4 u) I# F8 [  d( }8 S0 W
int41handler2 PROC% V; {" ~/ v! T  k- K) V
    iret# T% F. }3 [8 a: V+ d; _
int41handler2 ENDP! _7 J5 c* m0 U, G

1 d; _  b5 Z! u' a% W; ^$ l  P! A& X. f* @+ b
_________________________________________________________________________9 `5 |- `- |  P" T1 m- ?1 \
' b: G( ~* i5 s, O: v4 m0 O7 V

) D! W! t  b9 t! k* R( L2 n8 A. AMethod 069 r% i9 o; z6 u
=========
7 g) T% I. ?# J
; }, J6 p9 L' h+ |4 N; {# @" ~* @) z* l+ a5 H9 F( T6 H
2nd method similar to the preceding one but more difficult to detect:" x0 w& U8 R( ^9 G& m5 l

6 J! K/ d' S( x7 N2 G! u$ S) W5 a2 F% t+ X9 @* H+ ~
int41handler PROC: |. k' N; z5 V
    mov     cl,al
8 l! i/ ?/ I. B( D! E2 |! N. f    iret
) h. i) S1 v0 u- _8 S% q) a( h* dint41handler ENDP: U0 u: x' F% D. m

7 k1 ?, {/ f) m4 u& ^& Y; E
. C" N% J$ u, I( n8 G$ Y% W0 [    xor     ax,ax
0 O% f0 }& n3 t5 ^. o- {$ ?% L9 t1 Y    mov     es,ax/ I, D" X# ]# L# }7 D2 [& T# a* e6 F
    mov     bx, cs  U" D8 Y1 ]% ?* ]! C. ]
    lea     dx, int41handler
8 a! w! ?) U3 t; o, s- J5 i" ?    xchg    dx, es:[41h*4]- X6 c% R7 Y4 I6 f
    xchg    bx, es:[41h*4+2]' h9 M  d3 R8 S3 G1 t
    in      al, 40h! C1 g( ~' y8 o) j
    xor     cx,cx
5 k: W# o0 j# Q9 h    int     41h
7 z$ s4 Y) ]% {    xchg    dx, es:[41h*4]- I: h2 u3 p! Q- J# v* r. a) x
    xchg    bx, es:[41h*4+2]
! a1 j, C& _% @, l    cmp     cl,al
$ {, N7 }: s# {7 w    jnz     SoftICE_detected& J2 r% D, K, g( \: Y0 `
- P! L" X( }0 c2 Q% {! M5 a
_________________________________________________________________________4 K6 u: }0 p6 n
7 ?" p7 u: P4 x- p
Method 07% @* O) r3 K. _0 ~% j6 l
=========; a6 \( z  ?, x# y, S/ o

4 X5 w9 y- [+ L9 V; yMethod of detection of the WinICE handler in the int68h (V86)2 ]$ Q* f* L2 d

) b& {" k: h3 u    mov     ah,43h
" W: F. M! `; z/ a7 Z8 h    int     68h4 Y" l3 G" c+ g
    cmp     ax,0F386h# R' L( P! K. a
    jz      SoftICE_Detected8 i% N7 \( e1 p2 `
) ^* E9 P9 G3 H  ~  P5 w

0 C; l6 @' N/ V: a- o( d" b=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) `" s& u0 A  t3 s& G$ x   app like this:
3 X: x" i) F9 `$ a2 O8 h. n0 p, r- U. g9 H! x* D2 |4 T
   BPX exec_int if ax==68
: i, ?& j! X( r2 s' ~. g! {   (function called is located at byte ptr [ebp+1Dh] and client eip is- F, T, ^' ?+ E5 I: g8 |
   located at [ebp+48h] for 32Bit apps)
" p! L- G9 J( f4 I__________________________________________________________________________0 c- [, c" r8 ~# O6 m$ x) k* S7 A
+ G, F5 J- G' S6 }
6 H6 V9 E/ Y( w0 w) G& Q7 [
Method 08# H5 |- v' y/ A, O0 j0 O
=========
* C0 t# K+ p; r7 {, B0 B  L( i: p- w0 v" x% ?* d1 H
It is not a method of detection of SoftICE but a possibility to crash the* T; \8 w$ D/ [! B. D
system by intercepting int 01h and int 03h and redirecting them to another# d5 G7 l4 R+ v3 _. E
routine.' ~: R; X; m8 p/ p8 w1 `
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ m& F; _8 f, [: C
to the new routine to execute (hangs computer...)( |" j4 {5 {* M8 A: |( N: [

: R: s% W/ o( s' s  v# r    mov     ah, 25h
9 w) m' M. E; V# Q5 G$ g: N. h    mov     al, Int_Number (01h or 03h)3 T: B& N% N3 B$ a) {! ^1 M( k
    mov     dx, offset New_Int_Routine, g7 a6 d' n  y7 J
    int     21h
8 F2 B' u( C: m  V0 ~8 F
+ b& K! P/ U0 b; H! S( i__________________________________________________________________________
# Q0 T  N9 |) F+ v9 w: w+ |) \: O2 v9 H: T& A% y! b; f" F" H# p3 o3 k
Method 09) g0 g9 t: q  L0 C# @
=========
- u2 d. f  H# N- O; h+ i$ `+ @( z) K2 V4 P, l( P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& l, ]3 i- r- k( _1 G* H. I/ dperformed in ring0 (VxD or a ring3 app using the VxdCall).# Z# p6 T6 O0 L. k5 c0 S4 W
The Get_DDB service is used to determine whether or not a VxD is installed5 G  Q8 ?' E7 }* h; v! c5 ]
for the specified device and returns a Device Description Block (in ecx) for
2 o2 a+ M8 `4 F& m# @0 ^that device if it is installed./ r& Q! k4 T, Y

) j# K, {* K) X3 V3 D, ^; B5 @% c   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
8 i2 W6 w: N8 [$ R0 N   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& [6 @8 E) }6 B, Q8 I# n5 ?5 s4 s   VMMCall Get_DDB
1 {+ J6 k) k: l. t7 g* I+ j- g! V   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ e% d" r; _) k: R* L% d( C; n& P+ \. M/ k, P8 ^
Note as well that you can easily detect this method with SoftICE:
; y$ j1 G/ P# N; M   bpx Get_DDB if ax==0202 || ax==7a5fh
. d- [" t5 p# P6 X# A8 F) J0 M/ y! v- w$ E( H- C2 O# I  f
__________________________________________________________________________
- ]/ m2 o' Z/ n! q
. B( s! D. \+ [5 [7 D# M& H! u2 ]Method 10
4 p" d* h( T' p  g' q! b% h: @=========
; F8 I5 p1 B8 S9 S. s' E- B( E" b: C% ?0 c
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 K8 M4 t* y; m# l
  SoftICE while the option is enable!!/ f- |8 H0 w. V& ^) O
/ z4 ?0 m. F' q- A8 O* _& }
This trick is very efficient:
4 s) w- v$ H: S- M+ }# ~, fby checking the Debug Registers, you can detect if SoftICE is loaded
. Q# Y$ p8 |; w. u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ ~1 x1 c. u+ [- a7 o' Q8 V# Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their% |; _8 [5 |# H; O6 s  H- u/ R
value (in ring0 only). Values can be manipulated and or changed as well
# q# k# S3 S/ F/ L, @(clearing BPMs for instance)
' t1 [$ N  \; _2 W9 L1 u
9 _. T1 d9 k. j. ^( z__________________________________________________________________________
" @' }4 t( ]; b3 K  b: U4 Q& B3 F& p+ C5 f6 x
Method 11& t. L" r" R( c7 ?, `* Y
=========
9 ]# \, F4 i/ p; _$ I) E, E6 G, v$ E1 P. o
This method is most known as 'MeltICE' because it has been freely distributed
! N. b0 L2 V) E+ e$ N% _via www.winfiles.com. However it was first used by NuMega people to allow
+ j5 d$ L: m& S: U) |! O$ xSymbol Loader to check if SoftICE was active or not (the code is located& j' k: q5 q4 F) ?% C
inside nmtrans.dll).
7 ?' k$ E/ q5 C8 `8 u
  C8 {/ s: j/ v3 R+ L8 aThe way it works is very simple:
+ ]. I$ l4 [3 OIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for. C! T8 M1 ^3 e$ W/ C3 N* J" H* B
WinNT) with the CreateFileA API.
( p6 }, K( t- \! |% a0 G0 H- D5 L- s- \( y, R2 f! U
Here is a sample (checking for 'SICE'):& g; Y/ m, \2 O3 x; m( f

, e2 t# Y: [/ h& Q4 m/ U# S8 q9 X5 J5 TBOOL IsSoftIce95Loaded()* ~1 a+ ~' s( R- s9 E6 F
{
. ^' y- F  }5 z; v; a   HANDLE hFile;  9 X3 ~! P7 H( ~
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ q& d$ L3 E0 Y. i; c6 X                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ B6 P# N/ w/ w8 Y" G  B4 _+ ]. t9 M
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 d5 |6 s* n$ V/ y/ _
   if( hFile != INVALID_HANDLE_VALUE )7 v* l' y/ m& h7 n& j8 y3 M. e! M
   {
  H% z) P+ A& H7 l% }- C  r8 Z/ _2 m      CloseHandle(hFile);: s  ]! r- n8 v) Y" a; H% h' N
      return TRUE;( c4 W3 ~' S. k, _6 \. e
   }
" H: U" \! A( o/ D9 Z4 `   return FALSE;, X7 Q: r- I8 a6 u7 M/ `3 u4 n1 n, w
}/ T4 C3 @- i, F& q

; _* n6 r" L  p" v$ R# H2 b4 X  ?Although this trick calls the CreateFileA function, don't even expect to be
9 F, K6 R; C3 e' h# l5 P" ]able to intercept it by installing a IFS hook: it will not work, no way!
8 p8 w6 t+ Y0 l0 W) @7 ZIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 V- _4 a$ \# ]( X9 o& y
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
1 a9 e! o/ M; K$ N0 j% X8 yand then browse the DDB list until it find the VxD and its DDB_Control_Proc( G9 E! f) Z0 V+ n: o
field.
7 x* L, F* }1 p( r+ a$ H3 {In fact, its purpose is not to load/unload VxDs but only to send a
  T) M( d; T+ z/ B4 Z4 R/ SW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- V! s/ @0 z7 O; Z: l  hto the VxD Control_Dispatch proc (how the hell a shareware soft could try* Q0 l6 o* r! |" C0 G
to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 Q. i1 Z1 ?' A2 Q  i7 F
If the VxD is loaded, it will always clear eax and the Carry flag to allow& e0 b# n% ~2 ]0 a; V
its handle to be opened and then, will be detected.
/ C" E4 @6 a; X) pYou can check that simply by hooking Winice.exe control proc entry point
6 [# n$ n* h# [: S2 N0 I1 twhile running MeltICE.
# O/ _: h2 j! H/ U- A+ p, Z$ e1 a% k* Q4 l
8 k0 m3 F9 l' m: e; J7 ^% [1 ]
  00401067:  push      00402025    ; \\.\SICE
! N: D1 s& H6 R: H" p  0040106C:  call      CreateFileA
% t' u1 S- i  v% ]3 c# ?2 I0 Z  00401071:  cmp       eax,-001
9 R9 [# }: e! N$ z9 F. R  00401074:  je        004010916 q/ L# |8 L/ T' X2 |) {) [
) s0 R5 I  O$ H& S% d. a  `
" E- U1 k. B$ `' e3 J" t1 a
There could be hundreds of BPX you could use to detect this trick.
( F+ X5 ~4 s' F8 H* F-The most classical one is:
0 t+ F3 u  g  _; W9 w9 X  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ w& ~# \# n6 v* d( P1 ^! {9 x2 `1 i
    *(esp-&gt;4+4)=='NTIC'
% ]! B: y/ \+ M5 y
/ x! }5 I3 {9 j-The most exotic ones (could be very slooooow :-(
: c3 B' x, V5 d7 R9 R$ F   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : E) ^: P8 G; h2 E
     ;will break 3 times :-(' m' F8 E! C$ |- s

1 m9 o% A7 S2 ]-or (a bit) faster: ' r0 f: ?' A4 o% a& z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( R5 X, t4 w: s$ J$ i

& V- D' C+ `. X4 w0 e' ?   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 g/ D3 \+ v8 L     ;will break 3 times :-(3 v4 S9 o. Q% S* v5 q6 T* t
: T& q, |. A  f! K
-Much faster:( k1 L- x2 q% S3 Y4 A- r
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. g# s0 k! U- z0 _' m0 u% y

0 g8 Z: b# M" B& S" pNote also that some programs (like AZPR3.00) use de old 16-bit _lopen. W; Z' l  {4 S5 h; \! C
function to do the same job:
6 O, m# T; I: D' |
0 P) e8 [8 e7 S   push    00                        ; OF_READ
' p6 C1 Z3 C) d+ }   mov     eax,[00656634]            ; '\\.\SICE',0* J; r) {5 u! l! Y3 Y1 F3 t+ D
   push    eax6 @) Q% o4 O. k3 ?  P6 D
   call    KERNEL32!_lopen. o* k0 K  o" N2 _, E& X* l
   inc     eax
& B8 ^  I) w6 W# t) d+ X( w" ^9 v   jnz     00650589                  ; detected
- ]% |! e# J# W9 C2 ^0 x! m: c   push    00                        ; OF_READ) E7 B: Z: [/ b$ H6 O9 i
   mov     eax,[00656638]            ; '\\.\SICE'& c' }& L- W. |. u3 K; K. R% _  t
   push    eax
: k8 \9 h# {, w' c$ a7 P   call    KERNEL32!_lopen7 f/ Q- {: K* h6 z" p6 ?% M
   inc     eax  R; w) x3 I/ j& \' {: Z0 i8 T4 q4 `
   jz      006505ae                  ; not detected
4 [$ S" v) _5 N) j5 t0 ^- s: w+ W, y: k$ g) ?9 A  j$ ]- R0 M
0 C) v; S2 d' e  P
__________________________________________________________________________# d- p; R" s) `, H1 m# _4 g0 X) G

3 D/ r4 _. ]8 c. eMethod 12
' @; z* Y! h6 c7 I=========
: j5 A& I/ V' m( f6 ^/ W  `. _) g: Z
This trick is similar to int41h/4fh Debugger installation check (code 05
* r4 x# G$ {0 i( e1 L&amp; 06) but very limited because it's only available for Win95/98 (not NT)% p3 p& U1 G) N- g
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 _4 g2 K/ E. F& p+ D3 I: P  x
   push  0000004fh         ; function 4fh" i/ G8 q" z2 u% ^( ^6 N+ ], ~
   push  002a002ah         ; high word specifies which VxD (VWIN32); d+ D2 Q5 i3 Z, p
                           ; low word specifies which service* u* p) N! F5 v$ k0 \4 w5 N2 z
                             (VWIN32_Int41Dispatch): i# B$ J2 G" V3 n! i
   call  Kernel32!ORD_001  ; VxdCall
& {( X" ]" C( }" Y+ g% |   cmp   ax, 0f386h        ; magic number returned by system debuggers
- f. |+ p$ d" B0 b. H& Q6 m6 S' [1 Y   jz    SoftICE_detected0 t2 ~  G9 H1 A5 ^+ t
  \& O3 Q  w" W; \- [) a
Here again, several ways to detect it:( ~/ u# a0 x! r3 h5 Z7 p
* |; U, d* }2 ?& p) q& ~
    BPINT 41 if ax==4f
) |' u7 {- H( z8 z9 P
& u% x1 s& I! a- O2 L1 K8 N    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 f1 t; l3 `( n+ {% J( n& S
* F$ o% r0 R& t2 t, P; ?    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! N/ B9 O' \* r) V, F

% L" T' B7 O2 w7 l    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 ?4 O  p, Z) d

2 z: z; O4 Z+ V__________________________________________________________________________
7 D8 b# q3 q% a1 ~. i6 c0 `0 V+ u& ?' y7 {4 L8 Y
Method 134 k% I' [. A+ i. w7 ]# g
=========! I' O6 [9 Y( t8 U: m. O8 q

* h# V' k) s1 ?3 pNot a real method of detection, but a good way to know if SoftICE is
3 p% s* V7 T) j5 e8 @4 B  R) h" Pinstalled on a computer and to locate its installation directory.
2 F: W# s% A9 y# K8 x* a2 gIt is used by few softs which access the following registry keys (usually #2) :
7 `' f" O. q9 U# d5 |/ j5 W( u. U  O& x( E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: ?% G+ m1 t' R3 D
\Uninstall\SoftICE
- O& I3 i+ T  t7 Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# a4 p9 o0 c9 L0 @8 _# _7 X-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& X- C0 Y: A. x/ Y, v+ M3 \# }\App Paths\Loader32.Exe
1 R$ A3 ^1 r8 y4 _
- \8 ~) D6 Y9 `) J' O# |, K6 R/ c& \
Note that some nasty apps could then erase all files from SoftICE directory( M; t0 R+ {# p# n9 M( D$ `
(I faced that once :-(  u$ M' I: `8 q/ B8 v8 p
: T+ m2 e, p0 |" ]2 v2 Q. C. w
Useful breakpoint to detect it:
& \) p9 G9 L9 m  ]5 T3 N" p3 B/ `2 [% t) C
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 ?/ \* q4 L0 G0 {6 z* D4 |3 T' b- u: e; ]" \# ?7 W- Z4 X2 y
__________________________________________________________________________2 ?+ }: E' T( t' N

5 `/ d# e0 Y  u; W& ]& K9 F5 \
% V: x% g, p: a& LMethod 14
* m8 p3 d2 H9 E' @) E, k=========
  i3 v8 Y$ b$ e9 w8 O' v6 f. s+ ^6 W, n
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! Y, d  j  c1 Y( u8 w1 {; Bis to determines whether a debugger is running on your system (ring0 only).
4 l0 z6 T% k" P* q% o7 [6 L) f8 `& n- R
   VMMCall Test_Debug_Installed
. p. ^5 n- J8 i3 D   je      not_installed7 u4 h6 j. ]6 T

  y6 @& c9 Q$ X( {) i* UThis service just checks a flag.
8 ~9 E2 N( u+ i' E4 i</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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