About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( A) }  g4 ?+ y7 p$ |<TBODY>
( j" _4 n3 r& `% j& h: U% G% Q# f<TR>! S  `2 v+ ^% @% ~
<TD><PRE>Method 01 / E1 F' a5 Z# V) W! `
=========0 H# y1 C* A$ i/ S( M

' q" A/ w! u3 q& p7 P! l% CThis method of detection of SoftICE (as well as the following one) is
( y2 X/ i; G; h# Rused by the majority of packers/encryptors found on Internet.7 T- z( P  B& U
It seeks the signature of BoundsChecker in SoftICE
( U( X  e# n3 r: ]
3 i2 b& w; ?" l8 d% q% L    mov     ebp, 04243484Bh        ; 'BCHK'
1 J( N6 q7 ^  l# \: X    mov     ax, 04h
; E1 \5 L6 n; K, M5 {) U) ^, d    int     3      
: w  i, A2 ]8 o- B6 c5 H    cmp     al,4
5 E; f. p6 K9 j    jnz     SoftICE_Detected( j5 y  i. [; `9 L" H$ b
7 m- ~# q4 p1 K) B
___________________________________________________________________________
3 J5 w6 z6 N6 U" D8 q
2 O# s( N2 Z# `" Y4 ]3 R$ nMethod 023 @/ S! R7 y* D
=========' p7 K+ _% L/ f- P& p3 Z

1 @+ ~! k( [- b& E8 F! NStill a method very much used (perhaps the most frequent one).  It is used
% s; F' ?  a0 d, T0 qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 I) o3 \3 u2 ?- }; e6 dor execute SoftICE commands...
& v0 Z) _5 `+ ^' `It is also used to crash SoftICE and to force it to execute any commands0 Z, @( K" b& x; s; J# x% i6 R$ M/ t
(HBOOT...) :-((  % U9 r& ~5 F  S/ f. c5 j" S" p

- Y# Z* v, r3 `* ~7 cHere is a quick description:' e# Z7 z; i7 j- M
-AX = 0910h   (Display string in SIce windows)( e% W% s8 n/ e
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 H7 o) ?4 o( G0 U3 T
-AX = 0912h   (Get breakpoint infos)# ?; w) t0 b9 i7 J
-AX = 0913h   (Set Sice breakpoints): W* W  j$ C5 t) s
-AX = 0914h   (Remove SIce breakoints)4 C# s6 _& C0 z5 p
8 D, E( y! n" c0 W- |0 H3 [3 `% K
Each time you'll meet this trick, you'll see:0 b9 M! y* K% I0 U0 i* p" C! R
-SI = 4647h2 j& A7 d! C: O( S( N
-DI = 4A4Dh1 o' S& W* O4 c; P! g% ]+ F9 S
Which are the 'magic values' used by SoftIce.
- g, [- x2 P4 ^- D. l( l9 b% YFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! w* M; L: S4 d3 i$ `" M- K0 Z% }% \, o* v
Here is one example from the file "Haspinst.exe" which is the dongle HASP' b  `* A/ }. T: B* W! |. e% e
Envelope utility use to protect DOS applications:& t! `; O9 t$ j1 A* X4 Q

: D/ t+ d7 Q7 R! S! k# o  n' c  [" H4 f# G
4C19:0095   MOV    AX,0911  ; execute command.
  i7 u. Y# x( ~: K, L4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# O+ L' T( y3 ?7 y
4C19:009A   MOV    SI,4647  ; 1st magic value.
* e8 c4 e/ D4 ]5 L9 U4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 E9 z, E% T" `6 N; a% d1 j
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& I# f7 R, {! I& |& p; F; v
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* {2 }* ~% Y# t$ v! V
4C19:00A4   INC    CX
. L! M' Q! N7 d& w5 {4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 l  f& o( k* F4C19:00A8   JB     0095     ; 6 different commands.
, h* e0 x) c5 ~: e4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 l' C9 c% M3 L/ M! S4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' C4 T9 B3 P. I1 K8 h, _, R, K( i" s9 y9 k- i, y8 x5 P
The program will execute 6 different SIce commands located at ds:dx, which
. i9 L- C2 n6 Vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.7 w# B  U. B3 N& v- R. M* I: v8 {

/ J7 I$ s$ @: q& r5 w" L* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 R. V1 ?: M+ \# G
___________________________________________________________________________9 f& o( _; Y$ V+ N9 v. c- g

1 w* w  x; T0 f
* L6 }: D. H4 M# r* v. L: ]! Y" S5 vMethod 03
; R8 q. Q8 _3 e5 }5 M=========. i! `$ M+ E* h/ I0 `- B
' V' J6 f1 `# h. M0 Q% I6 x, F0 N
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# N$ F! a) W4 p( w, R(API Get entry point)- j8 i, J7 Q8 {
        : I; z! o. E; v- R/ X4 B( E3 ^

2 e0 [% T) [; K6 l- V, L5 }    xor     di,di
% ^5 S  W0 F: k4 b8 ]    mov     es,di
# g" l2 i' K  f    mov     ax, 1684h       & ?7 Y( S; `) v1 A
    mov     bx, 0202h       ; VxD ID of winice3 O9 Y2 N( ^' t0 {( s4 A! d9 |
    int     2Fh+ \& L8 a, p; }* p; T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ }( g" s; Y. k3 J6 ]" I% p    add     ax, di
1 h7 ^4 w& }$ A3 @: J  \    test    ax,ax
9 T! m; ~8 U% f    jnz     SoftICE_Detected
) {; }  Q4 g: Y
/ t+ Q( \2 y5 z: G* t% X___________________________________________________________________________1 {& f' Z6 W6 j2 g) N9 L& Q$ L8 @1 I
  k. A4 p5 l4 |0 r' V* M3 e
Method 04
! y' e+ X# ?( m- i=========* W# k, W& p3 V
* U+ ?. b* n2 m, k2 t( ^
Method identical to the preceding one except that it seeks the ID of SoftICE
" @0 U3 j2 K/ n. Q5 ?; A' pGFX VxD.
& R9 N, N; W' o# u, B/ O. F
* L# P4 b2 _1 x; U  i8 F+ ^  M/ ^    xor     di,di6 @2 `; Z: Z# o6 v5 g' h
    mov     es,di
  J- w6 M8 f! H" \$ f$ A7 }& U    mov     ax, 1684h       " Y- Z" F& O, Y) S* _
    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ a. F& H7 U" Q# E
    int     2fh
4 @3 Y- q* e" b1 S    mov     ax, es          ; ES:DI -&gt; VxD API entry point( S& y, c& U3 p) M
    add     ax, di
# Z+ H: u' k7 J+ b! x* H    test    ax,ax! q% E& Y( I; o% ]- s. e" }
    jnz     SoftICE_Detected; S! H8 i- ^3 b# m8 x% Q

) \. t: W$ X: c0 V/ j__________________________________________________________________________. u/ b3 N, y1 P* T
% K: Z) M; w: H0 r! q/ }) I
+ s- _4 b$ }- B8 j! g; c
Method 05
2 q  O9 W" T7 V=========
4 H; N" E/ b% b9 Y1 m
9 j# u$ C; G6 vMethod seeking the 'magic number' 0F386h returned (in ax) by all system
3 s8 d+ n1 T: y6 xdebugger. It calls the int 41h, function 4Fh.) H% k5 y; b7 ^/ G: s: u/ W
There are several alternatives.  , a" B) G+ D2 l% h" g
! m, Y/ _  I: O
The following one is the simplest:
% z' L4 @  ~' e5 B9 x8 j( B+ U- n% P6 i) `7 \" O% l
    mov     ax,4fh
# i, E: y8 \& f8 [" j9 @; ]6 [8 A    int     41h
! [9 E  @9 d/ l    cmp     ax, 0F386$ T+ O# T) ]2 c4 f  z$ j
    jz      SoftICE_detected
& q& ^' k& C& W; Q$ H- L( \8 D( m" |' {
0 W* s0 {4 V* c$ K* @. B9 a& j
Next method as well as the following one are 2 examples from Stone's
2 L, w; C$ W% P"stn-wid.zip" (www.cracking.net):
4 @. d; }7 c/ t0 B0 ?& m: F+ N# p5 z  V; D/ K* U
    mov     bx, cs
( c8 z0 f4 [: ~. r, `    lea     dx, int41handler2- m2 U5 ]5 Q! p; M# t9 c2 O1 U* y
    xchg    dx, es:[41h*4]
( W' M( V7 h0 I* L/ C    xchg    bx, es:[41h*4+2]' Y* L. \% O9 j2 ]
    mov     ax,4fh
. }2 {: m4 _9 e, E    int     41h, a6 y6 }; E: t$ ~7 U
    xchg    dx, es:[41h*4]
0 i, Z6 M8 v9 G7 \" G    xchg    bx, es:[41h*4+2]
/ z1 B, s- p4 ]  U4 j% W    cmp     ax, 0f386h
+ ]. f, E8 B( q9 c1 H/ {    jz      SoftICE_detected% k1 k% z, ?2 u6 R  \5 O# g

' i/ |8 z& |8 ~& i, iint41handler2 PROC
, i/ B6 G: ~7 Z0 X0 l    iret
# v: ]" B6 P$ P+ I3 g( vint41handler2 ENDP6 M4 [- q: y  k& M; K
  G1 w' J6 d( v5 x$ e

" J0 c" {' H+ s& a2 f* G6 b! y6 N_________________________________________________________________________3 T3 |5 D+ [/ K. f8 n" I6 Y
# m! V; l$ ^( T5 p

2 O' V8 r. G  ]& P2 W6 k6 {Method 06
4 f5 d9 [3 i: U3 z=========+ J! s$ O1 j3 q( b9 G, G

1 S- v& `0 \! v! w
' y2 M2 K! s: ?" w% U' `2nd method similar to the preceding one but more difficult to detect:4 M0 [2 p( D  a& T5 }# F$ F: B2 ]
+ \3 p$ P3 r8 I1 f; P1 {
5 F: H  h2 L# [- g
int41handler PROC
' G5 H7 ~7 S+ t' O6 q    mov     cl,al6 }$ ^' f/ Z+ q
    iret' E" Z: i* i0 w. G! b0 O5 j  w+ ]
int41handler ENDP
/ W1 c' b8 m- |; O
' U3 O; h7 t2 U' I+ t- Y( c9 `* ~0 G0 p/ ~3 D
    xor     ax,ax
  R; g# f! r5 R' W    mov     es,ax
: u+ q1 V3 _/ C$ H- k, v    mov     bx, cs: v4 p6 t  P# q: U& U: r" r7 a/ ]
    lea     dx, int41handler, S( p' v7 n: P0 N7 c! D" D) d; Q
    xchg    dx, es:[41h*4]5 m: k  B- F7 N* ~
    xchg    bx, es:[41h*4+2]
7 ]5 z* j9 S2 `5 L  x1 c! i    in      al, 40h
3 U; \- z% h4 w, h( W    xor     cx,cx
3 ]0 v$ l, ]. v+ x- Y! I3 G8 ?    int     41h9 M& R& @( T  E# `) n/ x8 @
    xchg    dx, es:[41h*4]
) ^0 U/ t7 }" m% u$ {6 X! n    xchg    bx, es:[41h*4+2]$ F, M/ u2 m! h7 A- S9 B
    cmp     cl,al
% }/ u* m" P0 N$ i% V    jnz     SoftICE_detected
" p9 t; p2 a5 R5 `) ?* k4 \3 Y# a7 T
/ s+ @+ f0 C% Q" N+ i_________________________________________________________________________3 P' j: o$ i, a8 s/ n2 v; {& u
, j3 H6 W5 a$ W9 y9 M2 b
Method 07
9 {- K' j/ o" l1 i=========3 p4 J9 y. b. D% F) _

7 u3 C- ]9 I( ?" N7 i5 uMethod of detection of the WinICE handler in the int68h (V86)9 U: l  K; O7 I
) {1 `$ ?; g2 N  }. m7 ~' J
    mov     ah,43h
' ^" U# \$ ^2 @* B1 }/ [, J' A- n# k    int     68h
1 L% m7 Z* j( G( b% V1 g6 g    cmp     ax,0F386h) U  n& n3 u* G) C. `( m' N
    jz      SoftICE_Detected
$ B6 h% a; w6 m5 F5 _9 {: E7 @$ Y7 q; c1 t8 w
# c4 t+ O, g! k& ]8 b/ g
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  a% r9 v. b0 ~9 g2 d0 H   app like this:
* l0 A: }; G( p4 N
& ]6 a2 ^1 B3 k7 K  W% }   BPX exec_int if ax==68
  @7 L) u- s6 r9 z; ?. w   (function called is located at byte ptr [ebp+1Dh] and client eip is
* [0 M4 d8 I/ D   located at [ebp+48h] for 32Bit apps)
9 H: z) O; D8 d& x$ I3 }. f__________________________________________________________________________$ O. J, S9 V% A! r' a4 X! Z/ E
' X; V0 G$ T' p. V+ e$ O+ _7 y6 F& O
  l; q  H$ O+ x* i. u
Method 08
5 u" [: e* G; N3 X5 S7 K8 d9 w7 Q  f) n=========
6 v# R' @& u! y2 i, q' }
# y! b/ w" a2 e. Y3 t/ lIt is not a method of detection of SoftICE but a possibility to crash the
5 A: r) I9 r& n: I2 ssystem by intercepting int 01h and int 03h and redirecting them to another
9 r. J/ ~) Q5 c; E+ A( t& Xroutine.. M) Y0 [$ c2 P5 p
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 Y* R* s( w* A- }) zto the new routine to execute (hangs computer...)) X6 e" ^" p+ `& U& h$ s- M
. A- D( m9 z  a9 N; E
    mov     ah, 25h+ T; T# ?, D' I, z, }2 w* k1 ]
    mov     al, Int_Number (01h or 03h)2 d4 P. V/ S' R6 v. H9 k
    mov     dx, offset New_Int_Routine
8 ^0 E% s  ]: e" P: I    int     21h$ c% \; W0 _# q3 Q% F9 g
1 j, z) \- _/ z, O3 F& Z7 I
__________________________________________________________________________
2 X  z! R% [/ i, ?! u: R) X# x/ N" ]( j% ?6 D
Method 09
+ U" ~. v9 R+ j. X9 U=========) U+ j$ R( O+ o8 q) S9 m9 {, U5 C

6 F3 e2 B5 @. ^This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" n. K; y0 n- K6 ~* \8 v, iperformed in ring0 (VxD or a ring3 app using the VxdCall).: p) j$ R: w& o
The Get_DDB service is used to determine whether or not a VxD is installed6 Y: i  J* O! ]" K: ~- K
for the specified device and returns a Device Description Block (in ecx) for+ O" f( Y/ }7 _+ @+ h* d0 ?. c/ {' T
that device if it is installed.5 M9 C* y3 S* t. N1 p( f) f  x. D

* L; ~0 e: x+ _$ f/ T! Y: M   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 I3 K* O+ e- g1 n
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* M7 i* Q3 Y6 `
   VMMCall Get_DDB0 ?" s) i# ]% Z* G  Y" E
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 V% j0 ]) l% U# f% ~, a

& l4 }4 z: L2 S# K/ ^% N4 I$ jNote as well that you can easily detect this method with SoftICE:
2 q, D+ V7 s9 k5 g  E# \: S   bpx Get_DDB if ax==0202 || ax==7a5fh
" [4 }8 N$ P/ I0 o
+ n# b0 {) _1 p2 O- ___________________________________________________________________________
+ P* o4 h& B- K" A" x- X* F. W+ g. H/ \5 e* L7 F
Method 10
- J' `5 N& C+ S# N=========4 u' N5 X' L: g( Y
4 u% o& J: T% _" A0 ~
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 x2 B" ~5 k/ ]" H5 k, _! L% e1 T  SoftICE while the option is enable!!0 T6 U" }( c( Z1 S
; M3 }0 l: E3 ?8 u7 `' W
This trick is very efficient:5 t; [* Q7 @+ r; O' i' N! ]
by checking the Debug Registers, you can detect if SoftICE is loaded
6 @" W% R6 e5 [, e; t! W9 G6 N+ b(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if# ?) o7 n9 z* t; e; j( L: B
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 s/ B  u. J0 B* X- Hvalue (in ring0 only). Values can be manipulated and or changed as well
$ b0 R6 a! U7 ^- p(clearing BPMs for instance)  z4 n/ K8 V$ u/ d, H

2 E  N3 t. }  z# J3 D# p+ o__________________________________________________________________________5 P5 W( v" G' m! R

! Q% g4 m6 U  w3 C/ dMethod 11/ O2 A8 `' J4 S
=========3 m8 ?( J- j4 d! D, {# W
8 z+ P8 W- C7 I8 T
This method is most known as 'MeltICE' because it has been freely distributed+ q1 b! T" I# J0 t. V) [% H2 W
via www.winfiles.com. However it was first used by NuMega people to allow
* q+ f7 E8 x. ISymbol Loader to check if SoftICE was active or not (the code is located1 R5 t% T6 @2 B+ J9 w% p
inside nmtrans.dll).
% F% B! T3 ]% @: s3 p3 S' V- \% `* A6 ]
The way it works is very simple:. ]2 f8 p+ N( A! \7 R6 C& m
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for* y/ k5 Y  _% H
WinNT) with the CreateFileA API.
0 d9 Y# P. Y$ x: J- O4 Z. v! n+ G: t" R5 i
Here is a sample (checking for 'SICE'):
: D) |" N% k' D4 M
/ Q( |, o* X* i" j# q6 D% t5 \9 \BOOL IsSoftIce95Loaded()+ ?" @  @) b9 w8 k/ h( V* L
{
( F5 u# p; {( t- [7 ]1 V   HANDLE hFile;  
" p4 D; b2 h2 `   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! t9 [, R* X/ C+ ^5 m                      FILE_SHARE_READ | FILE_SHARE_WRITE,  t1 v! W) ~5 V8 x1 E  a2 c
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ O' ^& N2 N$ \. u8 q
   if( hFile != INVALID_HANDLE_VALUE )) E  L  `' ^% D' O1 d* U. I: F3 i6 l  d
   {
# T9 P7 s1 I" Q      CloseHandle(hFile);
. l( R! @% B. n      return TRUE;- k5 H! w' f7 u/ _4 `
   }) O) t; L0 G% n  [" X( O
   return FALSE;: f: E8 o2 n6 e& w# R& ~! \
}
8 y# o5 s* \6 s6 [) r( }) W4 D+ T* u% Y# ^3 w' h
Although this trick calls the CreateFileA function, don't even expect to be# U6 G+ m8 `3 T- ^6 W: \7 |. ^
able to intercept it by installing a IFS hook: it will not work, no way!: ^/ l8 }8 F/ U* h6 W- f' ]
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 P6 }& y7 E" M9 H- j. x
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); H6 Q7 m" o  D) i
and then browse the DDB list until it find the VxD and its DDB_Control_Proc- f7 U, y/ S, ^. ^8 l, E! [& X1 {! e
field.( b0 F8 n" z$ S/ P
In fact, its purpose is not to load/unload VxDs but only to send a % {# N( f1 h* T5 R' j. N
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* N) Z5 v4 x3 ^6 X- ]" V4 C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try" m. G6 m6 s4 G, L
to load/unload a non-dynamically loadable driver such as SoftICE ;-).; Z. q1 {4 P7 |$ c1 n/ K2 l7 h
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* N: ^7 B  H( C" }* ^- hits handle to be opened and then, will be detected.
0 B; w: f5 Y1 h8 Y+ bYou can check that simply by hooking Winice.exe control proc entry point" ~5 x5 c2 W( N
while running MeltICE.* ]( E6 _9 I* E

6 |5 \9 t* G' t& ~8 A& p8 }/ u$ K, G5 {) X
  00401067:  push      00402025    ; \\.\SICE/ T5 ~( N8 E3 r2 s1 k6 i( W' M
  0040106C:  call      CreateFileA
% c( @5 b$ [( H* W% _9 `( l* L  00401071:  cmp       eax,-001
3 U% v; U: J" ^; l  00401074:  je        00401091
& Z* d7 a" @& t" T9 j' [( U. E$ V' e; E$ j3 q  a3 W+ u4 c

; ^$ D9 }9 o" Y5 l: }! {" yThere could be hundreds of BPX you could use to detect this trick.  {& {6 ^! ~% g; s; E
-The most classical one is:- ]! x0 F! `! c" J
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; g+ j( @2 S7 t! K8 C
    *(esp-&gt;4+4)=='NTIC'- |/ C) K( w& g6 D2 e
4 T4 s: S: u+ q  a$ z
-The most exotic ones (could be very slooooow :-(
/ ^3 E0 u# F8 p1 B( M   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- Q% O' A4 S% `1 P     ;will break 3 times :-(& X/ `& j: _! y' l# h
$ M+ t6 }7 Q- o/ o/ G2 i
-or (a bit) faster: . n/ y. a( P3 V; X9 @
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# |, l* T* @0 ~/ b4 h  _8 j/ s5 C$ Z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  % ]+ K# O- B0 k9 l! D$ r
     ;will break 3 times :-(% Z/ j) `* @$ Q5 C. T: F8 i) J" D
' b: _0 u' d+ X. O% n( e. I6 c
-Much faster:4 E  q. K" s. S9 L! ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. J1 g, m% j. G0 V
& l( Y. j$ J# g; W6 RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
! m" Z. H& a; d. Ofunction to do the same job:& z! O/ X: F+ w( O0 I9 R
+ b& \/ @) W6 n3 E
   push    00                        ; OF_READ
/ Z' n& d8 B" L3 t$ @9 u- S, T   mov     eax,[00656634]            ; '\\.\SICE',0
3 k5 g/ r; T$ T0 c, f. U   push    eax
, b# r/ U; U) B, U( e8 H& J   call    KERNEL32!_lopen! q4 B9 x& g5 B0 O" T6 {
   inc     eax# s; F( V9 [. T) D# k
   jnz     00650589                  ; detected
  b; ~0 M8 n" x   push    00                        ; OF_READ
9 C% h( W3 Y+ @0 q; t: P   mov     eax,[00656638]            ; '\\.\SICE'
8 B9 L6 f' L: n: J: b   push    eax  h7 y8 |) m( |, j
   call    KERNEL32!_lopen3 q/ Y% y; i: A$ U, Z* G1 x' Y
   inc     eax
, B6 y& c8 ]1 m& w- h- ^; h   jz      006505ae                  ; not detected) Z# ?  ?( r( j- n

2 T4 \6 b0 V  g# F/ ~3 h- a  Y1 t1 k
+ F- v: f/ r) C2 ]+ S, n3 E__________________________________________________________________________
* V  J! l7 x. V* u- _8 S. L6 L+ q+ m* D4 r. I+ }+ O  F7 X+ t) N# h' F
Method 12
& b7 p6 H2 t1 z+ r9 A  D=========% i) F- f* s: E! w% w

. }/ @3 G6 q6 I3 ?4 g+ e3 nThis trick is similar to int41h/4fh Debugger installation check (code 05. y/ a$ w# C" d# t, ?0 i
&amp; 06) but very limited because it's only available for Win95/98 (not NT)" P! u( f7 H5 p3 L2 i( }- c
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" _- G' F* z  u3 H
% K7 c  R) b: Z- M   push  0000004fh         ; function 4fh6 X. K; r! R  H
   push  002a002ah         ; high word specifies which VxD (VWIN32)' {7 m; Y3 a' ~  u5 K! j1 X3 ~0 d
                           ; low word specifies which service9 t- Z; B) J" Q% y# Z* K/ k# z2 Z
                             (VWIN32_Int41Dispatch)6 W8 d! S; q' W" B; b
   call  Kernel32!ORD_001  ; VxdCall8 G, m9 P; m9 t* \
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 ]; X  q) _  d6 g0 p" J% @" A
   jz    SoftICE_detected
- H9 q) p' ^6 ?7 U$ I4 n* s2 d
- \, h/ t; E' q- kHere again, several ways to detect it:2 v3 P/ u- J/ e' X% e
, P7 J2 J0 O% i" u3 o" X5 I( v
    BPINT 41 if ax==4f
& T7 ]6 z3 l+ z8 N6 V+ G+ x4 {' ^9 M% b6 Y$ u. C
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 x4 ?, d; _$ T% s+ d6 _
, ~% \5 I& E. u* a" T( |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 }5 [6 ?0 G, ?% n

2 o5 y. W) U/ V9 B    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 U6 I. N% ^: ]  r

% P% N( X2 a8 \4 a1 S__________________________________________________________________________7 h0 [6 T( x; P/ @- m

9 t5 Z# M! H, S7 @Method 13
/ u- L' W# c1 M7 z: k=========1 A# L# B$ x! ]8 r4 }" q- M2 [/ d
8 H2 v$ n9 u/ r+ ~9 F3 {
Not a real method of detection, but a good way to know if SoftICE is
8 \' u) C7 ?' y9 ]5 }' G- tinstalled on a computer and to locate its installation directory.
3 g4 Z) o$ @# @0 f- cIt is used by few softs which access the following registry keys (usually #2) :
+ g9 P; f; H: R. b+ U; E
( P# M$ z. \* w. ^, \-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 F$ G* M* ~/ ]0 @4 E$ |3 D5 ?& \8 h\Uninstall\SoftICE
$ h- f, o* I1 S, S: B$ _  e, Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 N# L6 Z# @- t" H- T$ S9 W
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 z1 M; a+ b, J& B3 H! J  N5 L
\App Paths\Loader32.Exe3 V( H8 C+ V% r* [

- {( L' L, L* D8 T9 q$ V( w4 Z/ ]$ ~" O. [! p7 y3 P
Note that some nasty apps could then erase all files from SoftICE directory
7 C2 J8 ~0 `. U(I faced that once :-(& l5 w% i* d7 r5 |( a5 N  v# C

. i# A2 u" U3 U/ F" E$ z9 MUseful breakpoint to detect it:! E' o, h1 o6 r' I2 u! t

8 |5 ~& I' t/ G- J) n+ S     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 x: j3 `9 Q& `1 l( f
7 H- I  @3 m0 A5 F" h6 e  m% x__________________________________________________________________________0 m3 s: {. D' L
, y) t& h/ a( p4 Q0 Y9 r% O8 ?

3 P; j7 S2 o4 R6 ]) T. B4 _+ @9 D  NMethod 14
, y$ A6 N9 d# }; x) D=========6 M" x* N( Q3 ]6 \9 I% {

; I4 S% x" B. @3 y" Y, U! YA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! e0 V3 z" _! S0 X3 S6 V6 L9 m4 Cis to determines whether a debugger is running on your system (ring0 only).* E6 z+ M' a' z2 W/ u" t

6 m, ^' w  |- c2 v. y& B2 _6 j, W" A   VMMCall Test_Debug_Installed" ]4 V& Q# A1 f3 {
   je      not_installed
+ [5 L, W% _6 C0 I7 F( d, t9 p8 y
" ^$ M# U1 \" G' q' w: ZThis service just checks a flag., Q! m$ n% s* q, V1 _4 Y
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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