About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* g8 P; G9 [. ?6 u, D0 W4 Q/ C
<TBODY>
5 |6 h: i/ z/ `<TR>5 S/ i+ t; k* Z. ^6 l$ O. k
<TD><PRE>Method 01
1 j* E( n, k' R=========6 F6 @6 p6 }9 c6 E/ v9 R

1 {/ @$ N* ]' @. |This method of detection of SoftICE (as well as the following one) is! b5 A$ d$ G  ?' }
used by the majority of packers/encryptors found on Internet.
$ r# ~9 E; P. ]7 o! f/ pIt seeks the signature of BoundsChecker in SoftICE+ B+ C3 Y/ S, L$ ]6 w/ W. O
' Y8 z) h  y' Y
    mov     ebp, 04243484Bh        ; 'BCHK'# i* E- F# D  A: t* s
    mov     ax, 04h
6 o1 S  \; t8 n" q    int     3       9 H! Z2 H& w$ l' n
    cmp     al,4
- E- E( P: g% u( S! M    jnz     SoftICE_Detected5 {0 r* s3 A5 F1 Y% q; u4 g
- G2 z: L+ `+ `3 X
___________________________________________________________________________
( v3 @( z5 l2 J1 ^2 Y! a+ |/ ~8 `
& g1 n) c5 i4 G5 E1 v$ WMethod 02; K4 d( e4 M5 q- X  d
=========
8 N% R, c8 o7 `* L% r
3 v' _9 e( ^% ^+ l# z* u2 E- tStill a method very much used (perhaps the most frequent one).  It is used
# D  ]2 x- M8 [9 z3 g9 e$ ]to get SoftICE 'Back Door commands' which gives infos on Breakpoints,& N7 q1 C2 x" s3 s) t/ _
or execute SoftICE commands...
' z% D9 L& A" s6 r" T8 g* `It is also used to crash SoftICE and to force it to execute any commands8 D, i- j9 W$ I' u4 s
(HBOOT...) :-((  
8 W5 D6 b  ?/ E1 r) N) {* b( F1 x
) ~* M5 X4 q0 c1 A9 Q. G6 HHere is a quick description:) P" X# Z0 I% n$ Y3 ]6 [
-AX = 0910h   (Display string in SIce windows)
$ Z& k% ?0 W& K9 g. _1 X3 k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); W, N6 O: B1 \$ U" M8 W+ v9 J; K
-AX = 0912h   (Get breakpoint infos)
) S6 {; S0 ^" }0 F3 `) V-AX = 0913h   (Set Sice breakpoints)
; Z8 \( }. f; b+ u: G/ c- ~) u-AX = 0914h   (Remove SIce breakoints)
% R; J- [6 O3 n7 I- ?& ~2 U
6 V( G. u3 f7 XEach time you'll meet this trick, you'll see:  O. W0 q. H! W: a
-SI = 4647h* M  T! ^  ^9 @$ \( _8 k  g
-DI = 4A4Dh
/ z: f6 C$ c( e5 i. V: Q( Q" RWhich are the 'magic values' used by SoftIce.
5 m3 ]6 \+ V5 \$ w4 O% NFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 ]3 H$ x! x  o, Z( r3 r( J

0 Q+ q& v8 ?. F- o" FHere is one example from the file "Haspinst.exe" which is the dongle HASP9 u3 ]1 y4 B% K; W0 n
Envelope utility use to protect DOS applications:+ G8 s5 S, N) O, ]
5 ^; a. i" b2 e* H9 N) I8 f
* y% p" D& }% T: N: D2 o. C9 G
4C19:0095   MOV    AX,0911  ; execute command.' K3 l& h" k, O" O
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 y7 e" i7 w+ z  X  Q2 `# y
4C19:009A   MOV    SI,4647  ; 1st magic value.
; c  X3 d# N9 M1 I3 @4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; x  k3 U( {+ \+ D. k$ x" j, R4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)( p' `  o8 t$ p7 V7 ]' l% u3 y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. S$ J- U' T8 Y! S; d% [8 |
4C19:00A4   INC    CX
" Q% W; e* f: F' N1 Z) Q: y! e4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 c* C# f4 a$ o- |
4C19:00A8   JB     0095     ; 6 different commands.
- g3 O9 d. K# A4 ^4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& f, I$ U9 F: o, i/ p$ a6 b6 \+ x
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 t7 x- u8 v# M) t1 W/ H
  E7 `' j' _% q" F7 @The program will execute 6 different SIce commands located at ds:dx, which' q* `  I# j0 `  @( f
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! }. ^. ~" ~; v% C0 a# g
& {' C: I3 P+ t- n' c8 @+ ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ n" N) p6 O! X+ l$ ~* _
___________________________________________________________________________
& w0 b! y$ l. e1 g" e; q. F3 y
  L2 A% g& T/ P) M. x
4 L! t' {/ `5 e" f. [Method 03. X* ]; y) d/ n" \! a4 j
=========$ Q7 P. f0 q# u3 S3 b
$ P  n6 H/ V( h/ i  u: Z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) c# J3 v& N6 J; [+ @9 E+ c0 @; E8 A
(API Get entry point), ~, \4 y/ ?; b" i
        
/ `( J+ \9 L9 ]0 i( O. O; u; e- }5 P0 ~# W- N
    xor     di,di
" {* w. z( V: c  a4 N0 Q; t    mov     es,di) E4 j" I5 z( S! P  o
    mov     ax, 1684h      
5 j& }' |/ a! S6 b" B. n    mov     bx, 0202h       ; VxD ID of winice. `; }+ Z5 M+ g4 N- K7 |
    int     2Fh
. y* O) m) J, e5 b0 H7 M* D7 }    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: Z/ P5 n( G: G" B3 T0 [2 \0 q    add     ax, di5 z1 _  S1 S3 i4 J" q9 i
    test    ax,ax
" Y, d6 w. e- e% k3 p+ u    jnz     SoftICE_Detected; h, R; |, }" M; D2 c1 u# s- L, O/ ^
& {* [' n* K4 Q; U
___________________________________________________________________________; H( T. l& S# }8 {+ I

! Z6 x/ j3 V9 v2 p# NMethod 04
. S0 J- q; U$ V4 W=========
- n( d9 Y. U) R* w+ \" C% i0 \7 K" F0 e+ w. ?
Method identical to the preceding one except that it seeks the ID of SoftICE6 b+ G: h* y$ q' M( B
GFX VxD.
) f# q- Q# {8 v0 W6 r
4 I( y$ C; q6 h    xor     di,di
% V0 Z0 F9 ?1 j4 d3 W9 P" ~    mov     es,di$ {/ \5 C4 ~& m1 F7 V  w3 j+ D
    mov     ax, 1684h       , Q% z4 {+ f* R
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 [% W: J- ~& f/ F2 ^9 L( O    int     2fh* K8 u* _  x# U4 @( [# z6 S( ~
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% U( U; V5 h: v1 b9 Y% v  C
    add     ax, di2 e! ^, V) k/ Q; u3 O- y0 y+ D9 Z4 V
    test    ax,ax9 A4 p* B" ^/ p4 }9 \0 x# p
    jnz     SoftICE_Detected
# ?9 e! g  E7 ?& c1 i# m( P
" u# l- ~/ K" m( l3 T/ u__________________________________________________________________________2 C4 w7 t3 }4 S& R4 f

  x- V+ O) Y. k( X+ j$ |
8 n+ ?$ F  Q1 tMethod 05
8 q6 H% Y' O& h% d=========& p/ }8 {! _3 z, Q  Q+ c! S$ @

9 C2 T( k6 O3 s4 q1 x; ]( r8 A% |Method seeking the 'magic number' 0F386h returned (in ax) by all system
6 q/ q. X# y- k, B* \+ l' rdebugger. It calls the int 41h, function 4Fh.
- P0 O( n5 T+ W7 G$ W) D- }There are several alternatives.  
9 O& m2 Z% B7 L. S: }8 N0 v& U1 q  ^# r% R8 R2 ?* _
The following one is the simplest:
- ~% w! R" C3 U5 q; Z1 N+ ]: m
5 M( C  }+ Q! Q* Z' O    mov     ax,4fh3 v3 o! m, C# S- T, k, V  I
    int     41h
. r: Q, ?; K2 [7 @% @' S    cmp     ax, 0F3868 |  P: t( S1 C+ b: w
    jz      SoftICE_detected  z7 J$ v5 m' V, H2 _; b8 g
* Z/ o- `5 {0 y$ y) z
; _7 A8 X3 D( X  ?/ [
Next method as well as the following one are 2 examples from Stone's
3 \# O3 L8 `7 M& c"stn-wid.zip" (www.cracking.net):
8 W& V, w' h1 o/ s- C+ A: d0 i& d7 _$ m: N# u
    mov     bx, cs
3 {, @5 w' M4 J2 C/ f1 |0 X* D    lea     dx, int41handler2
4 V& N7 R* y! u2 n7 s    xchg    dx, es:[41h*4]
; B. t2 _4 R. p# V    xchg    bx, es:[41h*4+2]
3 j) d, X+ O% j; ~$ ?/ {: b: s    mov     ax,4fh
4 x7 r7 O8 _, S9 \3 l$ }' p8 p    int     41h  X0 G. s7 X9 L1 L$ I' k
    xchg    dx, es:[41h*4]; H! G" r7 h+ H% g3 o5 f9 O  f4 s
    xchg    bx, es:[41h*4+2], ~; a: F) U2 G0 {# y# Z  K
    cmp     ax, 0f386h( p4 d# v% q; \/ x
    jz      SoftICE_detected
# r8 X5 i: q% m$ A) s4 b( ^( v& _; Q2 s3 E. Z  g
int41handler2 PROC: U0 \* B+ r9 `# {' W- \
    iret
1 e) w8 q5 V2 S( l; k' fint41handler2 ENDP
3 \" B2 Y$ a- k: t( n# H& e( M' {
) q+ N* c8 o. M' P2 c& X5 }4 Y* d
_________________________________________________________________________
% f' e" r) h$ h/ M+ ~- z1 h. w3 [5 s+ J( L
" \' W# I) L3 o- X# g) C
Method 06
  M  v# ]) i; H$ w8 \, Y=========& k4 B7 b9 e7 G/ ^& f% T
  k2 o- J4 V) g8 r3 v, J3 ~

' X' a# y& _7 Y( O/ P2nd method similar to the preceding one but more difficult to detect:
* {7 x* N6 N; }: f! V9 V! x& j
, Q! E% |1 @9 U# {6 a* B
9 o! C: G/ L: @  l. A4 j# Gint41handler PROC" \$ ?3 `$ x4 e$ K+ J
    mov     cl,al
; D' m, c% {$ C$ l) @    iret8 {' w/ d- o+ i& \3 V% P
int41handler ENDP
- Q9 T$ `9 B: N; Y5 e" w
3 |4 d( W/ ?* `, |2 C9 @4 z7 A, E) c$ p; k5 O8 P- H
    xor     ax,ax' O' x9 ?9 {) V8 ^- P
    mov     es,ax, }# N# v0 m6 ?, g1 D/ [; w
    mov     bx, cs
* _3 ~4 D: [/ W    lea     dx, int41handler
' w$ E- y9 b: t    xchg    dx, es:[41h*4]0 X4 r4 M* o* k
    xchg    bx, es:[41h*4+2]3 w: Y# Y: A. }* }8 h* c
    in      al, 40h
) R! O5 R3 N5 f- K1 _; J% y    xor     cx,cx- l& @, _& |8 z9 G% ]  N/ X2 _
    int     41h
6 j/ N6 W7 M* k, |) Q2 e2 X$ _5 z    xchg    dx, es:[41h*4]
, n5 n2 v& J, M" n5 k    xchg    bx, es:[41h*4+2]9 ?% V8 N- z0 O9 [; \
    cmp     cl,al/ J# v0 i2 g7 g3 r; a1 Z
    jnz     SoftICE_detected' n1 u1 L& b" _2 R* W* C

9 H! P( r2 Q" Q8 h3 a6 |! M_________________________________________________________________________
- d3 l5 W1 o% N/ ^& \  p
; X0 {: N" U* H3 e  b$ s5 DMethod 077 l/ \# i0 e" o# H
=========/ ~6 a- k( _8 H
) e2 O8 a( P& \, o. r
Method of detection of the WinICE handler in the int68h (V86)+ }  Z& ?9 t$ [; V" f8 B9 j* n
" }$ T' U) l/ j6 a, W" W
    mov     ah,43h
1 @1 H( w: e' M0 }* g    int     68h% r! w7 ~, }  K4 O8 `
    cmp     ax,0F386h$ _3 K( x* M* }/ b
    jz      SoftICE_Detected" ~3 |1 N! p1 j2 }$ I* X6 i

  ?. J7 w7 I2 Z+ T+ j- N" {0 [
) o1 t( `6 I' R) P: X$ C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
* h! Q0 `8 M$ f8 B   app like this:
$ G2 |' ~; z+ Y; p! O8 N
* k6 [- p, W  F. D/ @$ T+ v   BPX exec_int if ax==68
4 B* x4 |! A: p0 m   (function called is located at byte ptr [ebp+1Dh] and client eip is1 w* c! k% H# ~" {* s! h, E
   located at [ebp+48h] for 32Bit apps)3 g( Y6 ?3 \; U- U2 m" ]9 _5 Z
__________________________________________________________________________4 A- _0 V5 U2 s3 Z7 g, q- {
( _0 n" c( l* ^) {# H

0 o4 p- j6 s# d7 c1 }Method 08$ ~% K5 z$ Y) P1 I6 a
=========9 U& x. u6 J) f# ^
* l3 C9 ~# g$ e9 ]
It is not a method of detection of SoftICE but a possibility to crash the' z. m/ Y) x! a' n4 Z$ x' U+ q/ ~
system by intercepting int 01h and int 03h and redirecting them to another) H/ Q$ \# f1 o% m  `; @
routine.
+ b5 V& W  A; eIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 O8 j* f) G" r* Q7 A6 ^
to the new routine to execute (hangs computer...)
# D5 ?8 d( \2 {9 W: S% n. r
3 ^; `- [: u2 l' @    mov     ah, 25h9 r$ {1 A1 m3 e# e8 Q+ }
    mov     al, Int_Number (01h or 03h)
( T4 R2 m3 r) m" o    mov     dx, offset New_Int_Routine! a" Q% ]$ U8 _3 u/ K  q5 B4 p
    int     21h
2 _* b/ Y4 e$ j  M6 f' _+ O% ?
) c9 s; i: |. `5 K& _8 J# h__________________________________________________________________________
. `: S4 J, a4 K7 c4 ]% N3 g5 M; R" i) o0 i/ y
Method 094 \' d3 S. N: k3 o
=========2 j4 s7 w5 b2 y, t/ t

4 L8 R6 S' L, @! E6 cThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ Y" j4 C$ W) W! y; C8 D4 G
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 W& ?+ ]! v  q& C0 Z% WThe Get_DDB service is used to determine whether or not a VxD is installed% o7 i2 j) s% \* M
for the specified device and returns a Device Description Block (in ecx) for2 G; o; j8 _5 J- l( h
that device if it is installed.
! E5 g7 N8 i( c  W1 S
3 p) _4 w: {# A# ]   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& f  r9 r- f0 _, g% @+ ]
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 p; L5 L1 T3 W8 D" Q: f   VMMCall Get_DDB. a4 q$ u9 w! t. W  W6 Y" f
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. v% U$ J# o4 r- v4 s$ o$ |

: J3 [+ S+ W& N: t  @  DNote as well that you can easily detect this method with SoftICE:
/ `* y: b2 S* u8 E- L   bpx Get_DDB if ax==0202 || ax==7a5fh/ J4 w9 v4 R/ h: [" b) [

2 s) ~4 Y; u- P% Q! p4 J5 h% a__________________________________________________________________________3 m: `7 K9 L0 b3 p

. w' n2 |' t" s) j- }Method 10
. n0 C8 J$ ^# v) h+ |=========# `3 p7 y' O$ s) j5 I4 ~
( |. z5 z1 J* A6 Y' W  t
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 u) N* ~2 Q9 u; @8 z9 K3 F5 {7 G  SoftICE while the option is enable!!
9 v/ J) R; I% L9 L
# T  z4 G* H- Z+ q" k! UThis trick is very efficient:
  V/ M5 |" Y0 f  sby checking the Debug Registers, you can detect if SoftICE is loaded
5 u4 `# {& G# J5 m(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. H  h, r  H* u6 ~% ]# c4 Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their1 q, B% y$ }" g" R
value (in ring0 only). Values can be manipulated and or changed as well* e# z: E1 c! F' j
(clearing BPMs for instance)7 t- i$ x) x9 H) R4 \8 u

) X/ O$ X3 S" s0 _  [/ ___________________________________________________________________________* D5 ^# x- b4 M( p
, r+ t4 |; u1 H3 J6 ?
Method 11
+ l! H$ L* _3 [3 X2 N=========1 d4 ~: r& d6 j3 p: a

4 |, a2 m+ m* l0 GThis method is most known as 'MeltICE' because it has been freely distributed$ q3 y9 o& b. _* C
via www.winfiles.com. However it was first used by NuMega people to allow
' c$ m4 y/ M( O- l$ `7 WSymbol Loader to check if SoftICE was active or not (the code is located- r3 U& c! F0 [' N: b. F0 Z  _
inside nmtrans.dll).* I1 x  q3 P' E+ k6 D! R8 f

1 I2 y' v9 a4 E& q. n7 R9 EThe way it works is very simple:
% D  m6 r5 m2 oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for3 h9 W! v0 s$ |* F# [$ R
WinNT) with the CreateFileA API.
3 G4 M: \1 D4 n7 t+ W6 H/ p  |4 ]" y
Here is a sample (checking for 'SICE'):
# ?) T5 V1 V; R; C% _. V' ^
6 x4 p- D6 [. uBOOL IsSoftIce95Loaded()
1 z% [6 k! j3 {/ a$ W{
* w; w$ M! P' k% p" y' W   HANDLE hFile;  
2 I" M. ^4 v3 x) v' `6 I' J   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! z4 w, ^( j9 e                      FILE_SHARE_READ | FILE_SHARE_WRITE,! T' s$ c! G! u( J7 B& a
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& }) V6 k$ T2 d! `  u   if( hFile != INVALID_HANDLE_VALUE ). o( C" h# }: o' ?
   {
' P" t+ N- K% p4 b, p      CloseHandle(hFile);' X6 d6 r% K& Y6 h. i* b, g( H) ]
      return TRUE;
5 Q2 K+ }$ H  A0 J: x   }
- a6 m6 c6 }3 w" a* e3 |* k   return FALSE;4 l, A& X4 n8 e& D
}
/ w& i( {) s" e' k' d1 p; o: d2 h8 h8 B
Although this trick calls the CreateFileA function, don't even expect to be% K0 C6 D, u) O/ }
able to intercept it by installing a IFS hook: it will not work, no way!
3 \. F. E& k5 FIn fact, after the call to CreateFileA it will get through VWIN32 0x001F2 ?/ g) Q3 ]/ j8 @- j! G9 _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* H7 Y  w" W: d3 x; F+ L! f4 t
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 R3 k! U4 z+ J: {# tfield.7 ]& D8 e! Q, h2 Y
In fact, its purpose is not to load/unload VxDs but only to send a
- p8 F4 L5 h" R5 ~9 BW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; X& a8 p) y' O& \( _7 }to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- D# u" g6 E6 M$ g9 @to load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 F: d! r6 D7 I0 NIf the VxD is loaded, it will always clear eax and the Carry flag to allow
- w. H( u; O! v) C. k6 gits handle to be opened and then, will be detected., h( ]+ ~0 k& `4 h4 n
You can check that simply by hooking Winice.exe control proc entry point
( H* f8 `* M4 a( n) jwhile running MeltICE., b5 U/ a% d" Y; b2 u1 M# B" [6 O" [/ \

3 Q) _$ P0 `3 o6 y( m' u: M4 m* T1 A2 c
  00401067:  push      00402025    ; \\.\SICE/ |8 {+ U1 F3 ?2 N: z% i& h6 g1 t. G
  0040106C:  call      CreateFileA
5 m4 L' c$ O' b$ _  00401071:  cmp       eax,-001
$ L* C3 c9 B- ~1 m  00401074:  je        00401091
; H: k; X# e, r2 a1 B& U+ H6 r
+ c* W& y, U& P3 ]2 n7 m$ F
# w4 `& n4 K2 l. x8 y+ KThere could be hundreds of BPX you could use to detect this trick.
; P. p6 e3 q5 C) L" N/ r4 m-The most classical one is:2 C: X: E  x: s3 q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 E4 R( p+ a  B6 l# Y, s- a
    *(esp-&gt;4+4)=='NTIC'
9 f: N% W4 j3 e2 }- [1 s& `7 ]
6 w; z  x* ]3 y-The most exotic ones (could be very slooooow :-(
0 a9 o0 ]5 V. y8 }   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, P  E& T1 B1 T9 E& Y0 i3 E$ Y$ D     ;will break 3 times :-(  H, i  l) w% G: B

$ o4 `. x) ]5 K( G& }. z-or (a bit) faster:
- H- @  w) c' A- h5 ~/ C   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ [1 [$ }; P1 w% G

4 `, m. L6 _- I: q   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  . N- H# p& C$ j& p7 j$ b
     ;will break 3 times :-(
- Z/ @* N) v  |2 S, W0 I) E3 D1 o6 C4 n5 m
-Much faster:% L; B8 ^& b( l  l! v# b
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, A) V6 |& \1 j, i8 W% v& o7 w* e# y7 H" p2 I4 U8 h9 a2 Q
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen, N1 K. b. n: \' M, [/ E$ _7 |
function to do the same job:
$ v* z! Y/ g  t' c( w9 Y3 r6 N8 {/ D' s( P8 R/ l# I/ n
   push    00                        ; OF_READ
, _* V; p/ w8 N8 ?9 u   mov     eax,[00656634]            ; '\\.\SICE',0
/ E$ ^" V/ i! U) D' R   push    eax7 i( B$ Y  s  w8 D) z) v
   call    KERNEL32!_lopen2 y0 l2 E3 Z* S" n8 k
   inc     eax+ c) U' _  \  Y: h
   jnz     00650589                  ; detected' s' }" g3 ~( o5 q8 r/ K
   push    00                        ; OF_READ
* U" l) i2 y( n; d9 ^( {) ^: k$ N" g   mov     eax,[00656638]            ; '\\.\SICE'
6 }) y+ d) {. S/ q5 b" m   push    eax* C4 l3 u5 G/ @" G7 _. T* n( Q: Z
   call    KERNEL32!_lopen
. C- @; f9 ?' X; x  `; M$ |   inc     eax. b5 a* b6 L( B! ]+ f
   jz      006505ae                  ; not detected
9 u0 ]7 w5 r1 K( B7 ^$ j: r3 n
7 p! Q3 R3 z' T% Z2 a
% `6 ~9 z0 V9 C  S, v  }' L4 c- F+ l__________________________________________________________________________/ T1 W+ y* h% Y8 s- u

+ [7 F8 F/ H* h7 wMethod 12
2 r1 @9 t4 q- K5 z7 L=========
4 D& c+ H8 E: X+ T
7 `4 w2 `3 k# P: a9 `( bThis trick is similar to int41h/4fh Debugger installation check (code 05
* d+ K5 U. Y; o# r&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ x+ ~! ?  y9 ]! m2 ~& [/ l2 Pas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
8 k% N5 B) E$ W, ~* L2 w6 u! R2 R2 w* A' ~7 _
   push  0000004fh         ; function 4fh
( p" q! y$ a5 W* s) j' R: }   push  002a002ah         ; high word specifies which VxD (VWIN32)
7 P+ v) [: ~5 S# m+ _6 r  y                           ; low word specifies which service
* L3 v! I. x! \0 g# d  i  A9 e                             (VWIN32_Int41Dispatch)2 K2 A/ Y4 o$ r! L
   call  Kernel32!ORD_001  ; VxdCall
2 B) K5 q/ |+ m+ g- J+ y' o8 J) R% X   cmp   ax, 0f386h        ; magic number returned by system debuggers
% O" Q! w& m6 o8 t. E2 z( N   jz    SoftICE_detected
# P& u0 W" ~3 K  O. R$ j- V6 X
3 T, _1 R7 B( h( KHere again, several ways to detect it:4 y: X5 W* i8 R
: o7 p/ \$ p" X1 E4 n
    BPINT 41 if ax==4f
3 T  ~+ v( d3 _7 p2 K, ]
: U( p6 Z+ o% d+ Y7 G    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: T/ c/ a4 I0 ^6 \; Y. N/ f
5 \/ i. ^' A  c: ~: j2 M$ K    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
% d3 t" d4 y) C# Z0 y! ?- z: ?2 N: b3 u, j* E
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. Z9 e$ L0 C9 |/ z7 p% ~6 h4 Q

& X; i5 I0 f" g4 }  o& w$ I, |__________________________________________________________________________* N! A! _! ^$ M4 l- A
  Q0 w: b( m: M$ `& z- Y- P3 g
Method 13# B! P8 \4 R  m1 V9 T5 y) _& l
=========
4 t$ ?* S  Z; w& [& \  ^; V8 z' c8 c) ?/ }2 o3 n# i% B
Not a real method of detection, but a good way to know if SoftICE is* u) ?( N  O7 @! I: b1 Z) e8 O3 Y/ N$ F
installed on a computer and to locate its installation directory.' t" _. K% B9 f; Y4 a  ?7 ~
It is used by few softs which access the following registry keys (usually #2) :
; \" _5 b4 C' l; _  ~: P' ~/ c5 r3 U& I: H' U: e1 \" r
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ H# `4 q& j6 C& u  ^8 k: W
\Uninstall\SoftICE
3 X+ p' ~7 B7 f-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- X* S. K, a* y+ j: ]' m-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! ]3 `; a7 g$ z) ^* U. b: g, j
\App Paths\Loader32.Exe0 J7 p: k' p) ~6 N/ w- M

- P" f$ |9 Y! s3 R  V
* t3 I' ~! I+ v2 z* `1 }Note that some nasty apps could then erase all files from SoftICE directory% X- ~8 f% U* g
(I faced that once :-(6 X1 r& P# T" J- c, b* r; [, n
1 v; }- H7 H4 ^+ n5 t- T
Useful breakpoint to detect it:
: a! J9 P/ {0 b" r& p
$ s; a; C8 K4 p4 y. a     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': C1 y4 t9 f* W2 w$ C; W

' z( T, c3 i1 |( y5 `  w" ?0 L5 ___________________________________________________________________________
3 T8 V( @& i% G/ Q5 V9 X7 J+ S* w8 e  [7 ?3 z

4 ?: t, x( s3 \Method 14 ! W8 K3 f0 w/ Y! U0 W, Z
=========
4 u( ]5 o! o5 r3 U
) b) y( ?: s1 Q" @A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 @: m' @+ Y2 @4 P5 Y4 g- `
is to determines whether a debugger is running on your system (ring0 only).
0 y  i8 w6 }2 X
8 o, _- j0 v% U. V% @4 f   VMMCall Test_Debug_Installed2 D- ?( w% Y5 k
   je      not_installed
& F9 c4 M# L: U  o( ^7 B4 s% d+ y8 {
* V, s. H( {, a" l, q& nThis service just checks a flag.( K( G) A& J# @; _
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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