About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 p7 J- W  B4 @0 z6 e+ f
<TBODY>4 G  `+ O  v& x( B& X4 i9 ?
<TR>
. }7 Q$ y, i( z" L& e! D' I# t<TD><PRE>Method 01
. i, a8 l( b5 E* p' [5 j=========2 D/ X& M& P& {: |

8 U8 @! z7 _$ FThis method of detection of SoftICE (as well as the following one) is
7 t% |: o. }6 ^% H& Aused by the majority of packers/encryptors found on Internet.$ B% b8 [* g% B8 U7 `
It seeks the signature of BoundsChecker in SoftICE
* k: M* y+ A2 |  q9 @* x! T, b; R% K1 X+ J( I, I, o
    mov     ebp, 04243484Bh        ; 'BCHK'4 ~6 z  F1 h! ^
    mov     ax, 04h
! b$ d% w# J  z+ B# g; J6 w    int     3      
2 v5 F- Z- H: c' h" |    cmp     al,4
: e; |  U5 k5 t. ~4 y, p  j1 o    jnz     SoftICE_Detected7 m& Y' B0 E0 M5 \
( C! m) D6 ]+ ]) C
___________________________________________________________________________
8 G! o: t. x8 j5 Z+ i' t9 y7 n/ L% X
Method 02
/ f3 ~) K3 T9 A' x) X6 r=========
- {7 ]0 K) V5 @3 Y0 d7 x& `$ t- V, e% N/ E9 i' e5 q0 Z, w
Still a method very much used (perhaps the most frequent one).  It is used
; L& E( x8 J# m7 w1 M& v, mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 b. N" l6 k. X/ d- x" ~or execute SoftICE commands...+ s4 |; t. U  b( I/ I# }
It is also used to crash SoftICE and to force it to execute any commands1 D' y8 y5 J' N, g+ I
(HBOOT...) :-((  + _/ m: v: w0 [' n2 ?$ `
6 {$ A6 }" {  W# |0 w* c+ u# k. _0 U
Here is a quick description:
) L8 n9 X6 p1 H" O( T, ]-AX = 0910h   (Display string in SIce windows)
2 @" P' R2 c( ]! P- x( h-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( U& s) V' B8 i/ I3 t  K0 s/ n( c, {, R
-AX = 0912h   (Get breakpoint infos)
% L# G2 F3 q+ R5 u6 t- |-AX = 0913h   (Set Sice breakpoints)
3 ], K" B; v# ]3 M- t-AX = 0914h   (Remove SIce breakoints)
1 `5 P8 p/ A$ k! f7 W& A# ~' A# }
1 x6 h" S% i( h  K, M/ x. C3 pEach time you'll meet this trick, you'll see:% ~- y% m5 H9 U$ x" G
-SI = 4647h) n5 Q- \8 \7 b1 v
-DI = 4A4Dh* f! K* K; q. O4 V
Which are the 'magic values' used by SoftIce.! z1 j& c3 J8 g, _+ V2 R
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 \1 a2 q  c$ K* k
' j  S& e* ]6 Z/ P# O% Z" E
Here is one example from the file "Haspinst.exe" which is the dongle HASP
1 d  u2 R: b& J: _Envelope utility use to protect DOS applications:' |! V, C4 Q. c1 j+ x

) I6 k4 E6 K( b# B2 ~# a0 a0 T& v6 v3 l: q
4C19:0095   MOV    AX,0911  ; execute command.! M' b2 Q7 }) U( Q9 L
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 w' q( M% O9 |! @) y4C19:009A   MOV    SI,4647  ; 1st magic value.' I5 `6 Q+ q7 P  J# M( _
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 s; X$ M" y  K. _2 c
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  Z! H; L. A  I  Z) C( T# {# ]
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. h, h3 z4 y; |6 l# l" o
4C19:00A4   INC    CX: }. j& P2 C0 n
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( b, M5 z' a* T% M7 f' k( q( C
4C19:00A8   JB     0095     ; 6 different commands.
" w6 q5 o: E7 v4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 ]  e6 A" R4 i. g8 S# R) \
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: ?+ C2 h! v5 ~/ ]: m; ^$ g# S
The program will execute 6 different SIce commands located at ds:dx, which) k! f3 K7 N+ i/ y) ]* z" D3 k5 `
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ a  O. L6 `  A6 |. k: H0 {! B' q

1 A% z2 h( V: Q+ E* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
) T8 w0 [) j: _+ A___________________________________________________________________________" y- ^) {+ g1 C, y5 p# e' ~- V

: i$ _4 i  k9 B( d8 B; g- _, q& M2 m+ O7 m
Method 03
2 M' N6 H/ e2 t5 y  g* [# F* Z=========
7 s. V5 t. o7 C; m( \! z! U) @
) z% x9 B1 x6 `' c# C) l  kLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ i8 F% y9 x  R4 X  C( e+ f* r(API Get entry point)
1 W. o' D) w# A7 ?2 S4 z, Q6 l        
6 `3 b% `7 O& m) G& e) N/ I8 @3 C: ^: l- X( y- u
    xor     di,di+ [. p3 _: w( }4 C$ L
    mov     es,di- H4 P, z8 B0 P, g4 \% P' d, {0 [
    mov     ax, 1684h       8 y  u2 o5 [- ~3 x
    mov     bx, 0202h       ; VxD ID of winice' T$ O+ _1 r0 y
    int     2Fh( Y' I, o3 H& p. P1 O% Q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 T2 v7 x! J/ a
    add     ax, di
: T& d& K7 a& o! ~, C+ w    test    ax,ax9 i% |/ }! U! s! y" @
    jnz     SoftICE_Detected2 ^: B5 e6 J+ v0 _2 o& G( F0 M6 T
7 {5 {. F1 [9 T6 B
___________________________________________________________________________
  ]+ D7 d- X0 l( q7 ^, c
1 J& _! J8 p9 G* v1 \Method 04$ p9 w/ ~) a/ E, c/ b
=========
+ f! Q4 y( a! I. R4 J5 @& s: }
; v2 l4 U7 t, YMethod identical to the preceding one except that it seeks the ID of SoftICE
8 |. ^2 Q% n) l  h; v2 }GFX VxD.
2 a2 _& y$ N* e/ f$ t- ~. E- ^, o, g1 \! n1 t6 w
    xor     di,di
0 F$ c# |" f; J0 d4 s$ u) J1 L% I! g    mov     es,di
  C; p) f: W) q" a4 P# e! p    mov     ax, 1684h       ) B- ~/ {9 N! y/ b# I- m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% o; Y* e5 w/ x) R( K  `    int     2fh9 I. s6 F3 `# z9 P: k+ [, ~8 D
    mov     ax, es          ; ES:DI -&gt; VxD API entry point& u! x$ i; K: @# g5 U* c
    add     ax, di9 C7 B* c0 d7 |
    test    ax,ax
' o$ w. M' h4 ~& e& i) T    jnz     SoftICE_Detected
5 e: K* C: R' G! Z  m: y
  P% ?- @' b: n0 U( K. q__________________________________________________________________________
% J- x/ c* |8 ?3 S9 f9 A
# K' P9 B9 ^. b* F
8 G$ G7 ?& o; R8 V  EMethod 05
7 `) N+ Q( {8 q  }) Q=========
, c: n3 B4 t! H! s9 v4 \2 H; O) F# C8 w7 V/ Z5 {
Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 c) m& o1 }0 k% q. L. q) l  Xdebugger. It calls the int 41h, function 4Fh.
" I6 }/ y5 x+ Z. q5 O  p$ `5 iThere are several alternatives.  
; _4 Q: w7 p( l5 J# O$ s, g2 t8 I  @/ I( _
The following one is the simplest:
; d6 h. g4 \5 G) O  _+ `( ]9 |9 @9 ^: D' y1 Q
    mov     ax,4fh  a+ p- L" o( O. |7 [
    int     41h2 T" j5 `* Z, j9 d! S2 P9 o& Q* }) t
    cmp     ax, 0F386
9 H3 _' [" C. a/ s7 B    jz      SoftICE_detected+ C/ n0 b# e, W
: {6 @2 P9 J, }4 e. r( V
* `0 J( E, |# f4 v5 H0 Z% |- h3 J6 e
Next method as well as the following one are 2 examples from Stone's
% I* o8 t5 _, g' S1 Q% r"stn-wid.zip" (www.cracking.net):( J  V: ^8 x4 P9 j) {
, z" k3 j3 h4 J  i" P
    mov     bx, cs# c, I7 J- l2 C4 V; j! S& j8 A- l
    lea     dx, int41handler2* |% G/ a% R; w! W. d* [
    xchg    dx, es:[41h*4]! N# a. i' ?" F, k0 m
    xchg    bx, es:[41h*4+2]' o/ P. E) l, j( G$ n
    mov     ax,4fh
1 Y0 \! U) V$ O3 Q) u. k; @    int     41h7 e- T# }- J* D! R6 B( r
    xchg    dx, es:[41h*4]2 n: M' H' k8 ]. Q2 S2 }  H
    xchg    bx, es:[41h*4+2]7 o" ]0 R% U% X! L* z: R# b- |
    cmp     ax, 0f386h
* n1 v( V, U9 r# J" S! N    jz      SoftICE_detected0 `/ Q* X/ i$ t+ k

* ^& {' t% ^) `int41handler2 PROC
& ~1 E" r1 A& ^9 L$ V    iret
" z3 n% e: i- S9 L, S; L" fint41handler2 ENDP4 ]4 e! W: k# ^! D) }. p" b

# E) _* B% B( E8 M5 ?6 W) B- @3 b, u+ M# [& Y8 Y9 L' i! M
_________________________________________________________________________2 \& l/ K( U( S: K- N

$ J2 @: s2 i6 t8 x" n7 m
8 |' ]8 k! N( ~Method 06, h5 o" U2 J3 G  D7 k$ j# J
=========6 d% y2 [8 v5 `# t, d) k( R
$ L- e1 B8 Z' ~9 g( t& }: u

! H8 {" S, G& n# ^6 |2nd method similar to the preceding one but more difficult to detect:- `& M. {$ @, g
* V9 o1 o8 ?+ N5 K
! ~/ {# U# E3 t
int41handler PROC$ v. z$ z5 K( ^# z/ F7 D" b
    mov     cl,al
& Y- L, h$ `: h+ e# f: d; _8 |! k" j    iret
% _& O# e" I! A" b, hint41handler ENDP0 l! x3 w& R) I+ z) D& u

  C/ m  Z! O3 D0 [8 L8 ?5 }9 y3 E+ {" \+ N: D7 D7 X6 B( c
    xor     ax,ax
2 p1 z9 _. O( x8 S    mov     es,ax4 k7 ^) L2 H" T/ b8 W7 d; s8 X
    mov     bx, cs6 z# O2 H; Z  n0 G4 E1 R9 J; Q, }9 W
    lea     dx, int41handler
) }6 F. t" }# y, c+ v    xchg    dx, es:[41h*4]
( N. [% v' @5 I0 N1 x: y    xchg    bx, es:[41h*4+2]  K" a8 I. A: ^3 y; a0 m6 ^- u
    in      al, 40h7 N9 Z/ I5 G8 @& Y1 m; |
    xor     cx,cx& _# f$ g4 L' W# j7 V5 C8 {
    int     41h
) N% Y1 X' O; `0 T# Y    xchg    dx, es:[41h*4]! r- W, H/ K; t! ^
    xchg    bx, es:[41h*4+2]- B% D2 P, n1 p3 W$ U  v1 @
    cmp     cl,al
8 u6 }. _2 R; a8 E9 C    jnz     SoftICE_detected
# r6 b0 q% u2 l) k7 m4 e( w" A% W2 ]# X3 H3 o8 I( u2 x  B
_________________________________________________________________________
0 n6 V, u+ N- t& Y
  o4 y, a2 {2 p* g: K( LMethod 07
- O$ r- ^  @  Y' K# z=========
' {1 L9 q4 \% [  b" z
- y1 S' o- p" |% R! P. LMethod of detection of the WinICE handler in the int68h (V86)
+ D/ l7 V/ |* M# L  e/ j* {# O9 E- G0 s* h0 \2 D. h9 H
    mov     ah,43h1 j. O( i9 x# |! U" g+ T
    int     68h  k! h; T+ z8 O5 i9 C  R4 H
    cmp     ax,0F386h
' b+ F6 ~: U4 v' T1 K' u/ m4 a    jz      SoftICE_Detected( h  d5 B' z+ M& Y. Q
$ j. i  l7 @, k2 j: X0 H2 c
* D: d" S1 S- M* s' P% p9 {1 H
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 s. S$ t, Y1 _: G. g6 G: z6 I
   app like this:7 ]( t1 L5 q, j' s" F7 e
7 h" ]/ n# u; a4 @; R# h3 ?
   BPX exec_int if ax==68
2 U; t6 p2 _% L- s* X! z   (function called is located at byte ptr [ebp+1Dh] and client eip is4 J! N1 b/ N6 F! Z
   located at [ebp+48h] for 32Bit apps)
& G2 d1 C& ?6 i6 z) W: w) V# s__________________________________________________________________________
6 z6 O3 {, [. Q: @; P) x1 S) X+ P2 `" _# C1 ?

0 b4 e' T/ X" CMethod 08( I- b! h% ]5 B1 n4 J
=========
2 u) [+ G+ H; p6 I: r5 Z6 L0 N5 E* z& X( i
It is not a method of detection of SoftICE but a possibility to crash the
5 {2 o2 y8 O. l0 T5 Q7 U. N5 _system by intercepting int 01h and int 03h and redirecting them to another7 U/ N( T9 v! O& O( D/ K
routine.
  R# `3 d8 X2 NIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" O6 B' R, P9 n- x; Oto the new routine to execute (hangs computer...)
+ e  m1 |4 B7 ^: d; K9 S
3 W. y% \0 E* }4 Q+ M9 `) z' v- ^    mov     ah, 25h: M8 Y" }- h. A# I/ ^# c  ]
    mov     al, Int_Number (01h or 03h)
, W4 m2 J6 u- t    mov     dx, offset New_Int_Routine  H, u& H3 `; {5 I2 Z8 M
    int     21h
6 P6 y0 L  c) i" {( C# M4 |+ a1 @6 L" M+ ?* o
__________________________________________________________________________9 P: B% X! f, B% f! m

. H! h7 _( F/ I4 [Method 09
" T# V3 K6 ]* ]* K% }' G7 U=========8 D9 i# k! V5 y

3 I: R0 H% g. w& ~7 X8 {0 PThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 n1 i7 d+ j% `+ ~
performed in ring0 (VxD or a ring3 app using the VxdCall).
3 Y/ e8 ^3 p& }The Get_DDB service is used to determine whether or not a VxD is installed, H; t' G) y* W1 U* o0 {
for the specified device and returns a Device Description Block (in ecx) for
0 h6 u( t6 h" T5 Z7 Z% Nthat device if it is installed.
1 @; T. b" t& z1 k$ w; [# g
% ]4 u+ Y7 X/ Z' i% i   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 C' p2 C- }* g   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): j5 _: H+ _3 R5 c) B( I
   VMMCall Get_DDB
* Q% q  T0 `' G  q2 W   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 w1 c( A; P: f; Q2 l0 I. S# C0 ?$ n

. Y2 V2 y7 A+ c; n% \( uNote as well that you can easily detect this method with SoftICE:
. Z3 m- x8 |: L4 h8 w3 M' ]9 F- d   bpx Get_DDB if ax==0202 || ax==7a5fh; z4 p  u* J5 k
: ~, t& m; V; z$ ~0 S' M
__________________________________________________________________________2 F# x+ h6 |% t7 V0 c2 ^

& |( ^; Z3 Y0 ]8 C1 k/ `Method 10+ [7 Y4 L- `5 |' j5 h5 T7 R4 p
=========- @+ [$ U$ a/ p; Y

. ^- G2 o% X2 h* a. f9 }- n# l( r=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ C& ?6 a# `" {6 Q0 g2 c
  SoftICE while the option is enable!!" P/ z0 ?) ~0 R5 ^" I4 F# I2 n

3 Q5 E/ k' I7 P  V% aThis trick is very efficient:
- Z: R. J* `. M, Kby checking the Debug Registers, you can detect if SoftICE is loaded
2 l6 s0 \) `" i6 R+ q  B$ k- Y# i(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 r, i7 V( Z0 R3 I
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 g) }( ~: U$ u( Uvalue (in ring0 only). Values can be manipulated and or changed as well- b  C: @- o! t8 ?" Y; G
(clearing BPMs for instance)+ t9 T# h7 c/ i, L: O
0 T/ m$ c1 ^, {  A
__________________________________________________________________________7 N7 {! S3 P* p- U# T0 O
& _0 b( {+ r+ O4 \
Method 11( @$ a9 k$ i' F. }3 Q! S
=========
" c8 B4 r$ C* z; Y; J) T
! W8 ~3 `, ~! x( eThis method is most known as 'MeltICE' because it has been freely distributed- c) ^9 m$ c7 M1 D; l: ?! ?! ^# ?
via www.winfiles.com. However it was first used by NuMega people to allow
- A8 T8 Q" P! mSymbol Loader to check if SoftICE was active or not (the code is located* T( c" i2 H8 Z! K$ X
inside nmtrans.dll).
: `7 f* J( I3 P( M3 ?$ I# S# E$ b+ d* L1 Z
The way it works is very simple:
% i. v" Y1 H) _/ p. U9 E& R2 q& r4 U' KIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 R* S/ |! b. L8 [WinNT) with the CreateFileA API.; M7 o3 a1 E. Q8 q2 ]( `4 {0 d

' K  h1 H" J9 E& w. Q! a- \Here is a sample (checking for 'SICE'):
5 [) `. Y1 ~3 C( H, ]7 [; P( |. D. y( A
BOOL IsSoftIce95Loaded()
2 U: F9 H: F; D{
! V* H* C3 B' u4 C   HANDLE hFile;  
6 i5 @! m* l. ?( I( ]/ l9 h   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,9 `5 @' W$ \: r! l+ e# O
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% V  K: O7 W- V' [                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ t2 w. H; N: S7 T3 E5 x1 U   if( hFile != INVALID_HANDLE_VALUE )
$ p/ T+ w2 S; `9 P8 c$ ]3 `   {
- z- ^8 s" x/ K1 f  S" k4 _! }      CloseHandle(hFile);
" N( o! m8 h8 _9 }; r% H# @* I; P- @      return TRUE;, f7 I2 j1 z1 A* v1 s
   }4 |' o& `( C: U! [  S( T  a1 U
   return FALSE;
& E1 b' z( N" v* g# ^! M; k}9 r/ h5 O3 D% l) ?
+ c3 z! f+ b. b/ ~( \7 t
Although this trick calls the CreateFileA function, don't even expect to be
- b; U8 c6 k* M* vable to intercept it by installing a IFS hook: it will not work, no way!& Q. W5 ]. Z8 Z, J5 \! {1 k
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
  I3 ]/ u' r( l- _( F/ a# qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( P8 o, n3 R1 x, j9 o3 F6 x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 `3 r3 m& ~2 E& s  a
field.* J) y0 I7 |+ k& W
In fact, its purpose is not to load/unload VxDs but only to send a ) \# g! Y) F) V7 u' M
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# {8 f2 b' u6 @& B; E: k7 X
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! f# T7 f4 B. h8 ^; W) u( C+ h% A* yto load/unload a non-dynamically loadable driver such as SoftICE ;-).
; z; g/ o) \+ P! x% t7 rIf the VxD is loaded, it will always clear eax and the Carry flag to allow
  o" s" g" b* G& s- lits handle to be opened and then, will be detected.; v* F7 C7 v0 g' n+ A4 u
You can check that simply by hooking Winice.exe control proc entry point
* z$ y; x/ t4 [% Xwhile running MeltICE.+ H1 Q- g/ X2 _3 q- j( w/ N
6 Z. B6 j. R% G7 g1 w
  z5 I5 e( v: r; P
  00401067:  push      00402025    ; \\.\SICE6 s* i+ O( W- Y8 n1 Y
  0040106C:  call      CreateFileA# Q# A  I5 o: q, J; N7 [
  00401071:  cmp       eax,-001& G7 ]) J! u- X. g
  00401074:  je        004010913 Q& L" f) R+ x
* L6 v8 j+ u! `

- ~* [# L2 m& W; YThere could be hundreds of BPX you could use to detect this trick.$ O! L4 q9 b- s. Q2 m% U$ X
-The most classical one is:
5 ~. ~. B1 q4 X: Q' o  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" t# O7 f: y# W( y& j0 F* J
    *(esp-&gt;4+4)=='NTIC'7 g: ?4 g4 b6 m  e7 q5 f* G, s

5 c4 Y( r$ {3 d4 j2 R3 o-The most exotic ones (could be very slooooow :-(' L8 e5 R7 I, k3 [" ?
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* c- u. [! X! z     ;will break 3 times :-(
* ]$ s; |! }' C8 ?* R* S' m. c% K
4 h8 y& a: F5 E4 q- t! A-or (a bit) faster:
  }  Q! p- r$ w" E% w   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  i  u1 t' J# g$ z
" q8 a; ?5 s8 Q' w! i$ |/ w  t
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) T5 ^% m9 c6 B
     ;will break 3 times :-(
, C& V2 Q; h$ j9 D3 e$ y! K7 k2 B/ q; J0 L$ o
-Much faster:/ k; n! a  ]' N
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' M. a) R5 h. Y$ y- h# E2 l
* A6 s( \0 J+ I
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
0 a; U$ Y% U. afunction to do the same job:  ~. u0 p# [* S& Q1 X. y! f) d8 @

4 N2 @% V, e3 i8 Y0 _6 W/ u: g   push    00                        ; OF_READ
" I% J3 o3 S, a   mov     eax,[00656634]            ; '\\.\SICE',0% x. D: ]) U7 \. v( c! |$ ~
   push    eax  ~+ c( i4 N2 B  j8 @
   call    KERNEL32!_lopen
7 ]# `8 h  s; e! F   inc     eax
1 [( O. G" C: |# T" i/ B   jnz     00650589                  ; detected
. S/ o; H" k2 m  q  }- N0 Q9 I( c   push    00                        ; OF_READ
+ X1 X, S1 d- Q! K# l   mov     eax,[00656638]            ; '\\.\SICE'- u6 n8 g# O2 o
   push    eax
$ M! C2 \' Z  t# v   call    KERNEL32!_lopen) u  S, S, X4 T0 E$ y# L
   inc     eax
  I/ R7 e. Z  m  R$ @2 g   jz      006505ae                  ; not detected' U) {* l9 Y- k8 v

8 C/ ]6 S/ b8 G% M( ?
+ L' N- c+ p. z+ ^1 a, m__________________________________________________________________________9 I- y- w9 @$ ~  g* l# X0 G. Z2 k

* r7 n) t$ c( t( \; B3 wMethod 12
6 o- I: p. F; q$ u" L. c0 [=========! U9 G$ }  o1 ^+ ]. _/ U5 ]
' N( S" N$ r6 }+ t1 X; E
This trick is similar to int41h/4fh Debugger installation check (code 05
: [' I" a. |6 Q7 Y2 l/ d# L8 f&amp; 06) but very limited because it's only available for Win95/98 (not NT)0 m1 M' w- s6 K' e7 ~: ^6 N0 b* ?
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.: z$ M7 j" X! F

  b0 C2 ~" `, H9 `* p   push  0000004fh         ; function 4fh9 h/ r2 M, f4 d( M
   push  002a002ah         ; high word specifies which VxD (VWIN32)
% c; ?5 m' r2 A$ ]6 a" k, t) Z                           ; low word specifies which service+ v( s% h4 x8 U7 C" X/ |
                             (VWIN32_Int41Dispatch)4 ?8 F( U) A5 w1 G( Q
   call  Kernel32!ORD_001  ; VxdCall, C- x" l8 \$ _5 I2 t
   cmp   ax, 0f386h        ; magic number returned by system debuggers- w" k8 C& R3 C+ v
   jz    SoftICE_detected# v0 n8 t: A) N4 D! ^' ?

& y; h1 v% Y+ VHere again, several ways to detect it:' p: y2 d9 E$ h" G/ K
& ?6 A0 |2 D1 p' _
    BPINT 41 if ax==4f
: }2 \* J% A, a% r& M* u" P* y% r; [& N3 \' `2 l
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' P9 ~+ i7 P! }% V% o: f/ b+ ?2 {$ u# K  @7 _+ Q: V
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
% {# J, e- t1 ~  ]2 d! u2 [+ _' u2 D. Y, ^% Y7 v
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  p, A4 h8 p. }$ a1 O/ @4 d6 `* _

5 l6 Q: m0 l$ O, P8 w& Z( V: v__________________________________________________________________________9 o- `: |5 E, C, h1 ^
9 G4 a9 e8 w) q1 W" J% t+ G
Method 13/ }5 ^" Y- |4 _1 `7 A; D: n( m* r
=========
# Y# r4 [: V4 q7 H* @0 t* C0 K6 Z9 d! a6 f* w
Not a real method of detection, but a good way to know if SoftICE is3 l3 r; U  N0 m( [
installed on a computer and to locate its installation directory., _( I4 q! \# y
It is used by few softs which access the following registry keys (usually #2) :5 W" I3 |* ]$ W8 z; e) ^
1 m# O+ R+ H& c
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" X/ Q/ q4 `! d% W\Uninstall\SoftICE
8 R/ _: e& s) f2 `: ?-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
) h  _  }5 H4 L/ S8 N7 i-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 B7 c% O! `" H/ l( x
\App Paths\Loader32.Exe
- N; A% ?6 u5 o- v2 ~& A: G* W$ I3 e% ~3 V  g$ K, t
8 O  Z& r  b9 a' z8 `/ `$ j
Note that some nasty apps could then erase all files from SoftICE directory) G' Y! X9 j1 A4 t* _) ]3 i' v
(I faced that once :-(
* e1 |- ]- {6 Z6 T7 c; l( L" o* P: |0 r: C
Useful breakpoint to detect it:
4 S4 u8 v2 @  `9 [5 R" m. f+ W% O) A+ K- g9 @& M1 \
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 }, Y" v- d  r% b5 e! L

* L  G$ ?* C, [& A+ R__________________________________________________________________________
& c1 U, @' ?8 t3 |; n# Y- [0 Y  x: Z0 Z0 X& J* C& c) w( w
, ~" f! ]6 e( }5 \2 V; D
Method 14 $ i' j8 Z1 e  x- A* V
=========/ H, D; q1 s+ m& N/ U
8 g* T( g+ M+ w! _1 |- z* i
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! G( j% v6 H; J- p9 wis to determines whether a debugger is running on your system (ring0 only).
7 n5 n: Q; Q- c. {( Z5 Q& g- b8 o) W  G
   VMMCall Test_Debug_Installed& P. Q' \2 u. F7 M: o: \3 x
   je      not_installed! v4 v$ ^9 C2 I- O) Q7 p6 Z

* |  v: G9 \) R( u6 O0 EThis service just checks a flag.
; v7 F! |9 A8 |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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