About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>1 ~# f) l, d1 x" ?) }: S
<TBODY>
; O% W$ d9 z& S) L6 t3 j6 r<TR>
9 I( m' q. s3 y0 ]7 q5 W) ?<TD><PRE>Method 01 ( }; w! ^! B3 g* |1 I6 b/ K1 Y
=========
  r; K8 P' J1 n9 @+ u- l/ x& U
/ d. e9 C- S1 B( W3 h: C8 EThis method of detection of SoftICE (as well as the following one) is
2 o* X6 E$ K8 h% Z4 O: p- lused by the majority of packers/encryptors found on Internet.5 R  A9 {/ s9 T+ F! `, o4 e% Z* P
It seeks the signature of BoundsChecker in SoftICE6 i6 @/ p/ v$ R+ i( }

" n% f; \) d; H; f" _( H0 b    mov     ebp, 04243484Bh        ; 'BCHK'& J5 V8 B! ]3 t" n* p
    mov     ax, 04h
* V% j5 k+ u( r  _    int     3       5 S; Y# I3 O8 y2 U3 p6 v" R
    cmp     al,4: y# X6 D. _' R" K; q
    jnz     SoftICE_Detected' F2 C- P$ |/ m# w$ K8 w. C

) Y8 |/ M' {/ Y___________________________________________________________________________0 C* N/ B6 ~8 u! M

& b" G# V$ u, NMethod 02) |5 L) z. l6 F8 p* _/ Q* d
=========
7 t% P% @: @0 K* f
- N: C$ j  r0 ^0 Y7 ?( [Still a method very much used (perhaps the most frequent one).  It is used+ E! b/ \- u$ ^+ ~" Z- D( o, {5 M! i
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 @% T6 u6 K, ror execute SoftICE commands...7 g5 h$ p9 Q1 m' d4 H
It is also used to crash SoftICE and to force it to execute any commands
, k. H$ C( K+ w( ]1 J" ](HBOOT...) :-((  
5 m8 }5 J4 T; K& h! L, [: `
4 C- L- Y; G: a; zHere is a quick description:$ F9 }5 r/ U) I
-AX = 0910h   (Display string in SIce windows)
" i, s- I# j$ x6 s/ Q. B9 q9 I, d-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  w3 ^) K7 c- M; Z7 i  I
-AX = 0912h   (Get breakpoint infos)
9 O, S" X% U' G' f-AX = 0913h   (Set Sice breakpoints)- K) T& Q) |2 ~
-AX = 0914h   (Remove SIce breakoints)( j9 y2 u) L, o1 u
( C* l6 e3 t) p
Each time you'll meet this trick, you'll see:# p) Y' q5 k" v' B1 T- }0 V
-SI = 4647h
& V, _3 H3 _# e5 V& @1 N-DI = 4A4Dh
- l* o& T, T0 O" ?Which are the 'magic values' used by SoftIce.5 W1 x, D9 |# I$ q
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 u) W, F5 C( l* X  N
9 _! l$ g$ S5 z; l' |
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, |9 D( c4 Y9 o. `3 ~; OEnvelope utility use to protect DOS applications:
3 F5 F1 K% h5 n- w* d% {8 d9 F$ H* Q$ Y$ X+ x& P1 S; O: D. e

3 D+ e' _6 o1 n% M( g2 ~" N4C19:0095   MOV    AX,0911  ; execute command.
( a6 E+ i7 M1 b9 {  O4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).& m& |; o' R1 {+ C
4C19:009A   MOV    SI,4647  ; 1st magic value.# S0 q+ m/ Y3 R5 ?
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  _, t4 }; M* |3 V& t: m: [0 m- J) C4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 l/ {8 ^; e3 `" q* e4 i( \0 G* {
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) z5 {2 R! L( o3 E, `8 P
4C19:00A4   INC    CX
3 M; F' f- l' w+ C# x4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 F! _. P- _7 f& ~" I4 R8 _4C19:00A8   JB     0095     ; 6 different commands.
. a' o) M! {4 G7 r9 _- U$ p" o4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 D7 o$ d' B) \& [  A$ p4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, e1 K8 R; D6 d9 `- n+ A  Y3 R! e8 y5 s/ F% p8 A
The program will execute 6 different SIce commands located at ds:dx, which
$ P8 k8 @6 g3 Sare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 n" Z3 Z5 [( h" i- h

, L8 s) Y. j* B  V" Q4 {* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ r" J+ n# G: V5 h; u( _3 Z___________________________________________________________________________
' [1 p6 a8 d0 O) I* k
* G( E- r% }" O/ |* g# {2 {# d, N. @$ j/ Q
Method 03
- ]( @9 ~- G! H# r=========
0 N4 R3 Q; `" t0 k+ v4 t
4 ~1 |9 R6 S2 N+ |) H6 HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ u. j2 |) g$ d& `' j; V
(API Get entry point)
& \8 _8 p4 p$ k! D- |! W) u        ' x9 }4 G* {0 P8 T5 X! \. f
  Y# R, @% |1 Y/ g. Q' L
    xor     di,di
" Z+ |( Y5 y. ]    mov     es,di
/ R% b0 a- f' d+ ?2 L    mov     ax, 1684h      
6 J+ \$ ~" e+ `& i4 `9 ]    mov     bx, 0202h       ; VxD ID of winice
( z$ @8 V$ {* ~( K9 y' n7 a: J    int     2Fh
/ R# u/ `$ M/ w+ l    mov     ax, es          ; ES:DI -&gt; VxD API entry point. s, u0 f( `0 m) L( T( R% v
    add     ax, di: f0 y2 k, e# t! D5 b! @
    test    ax,ax
7 M% Z0 X( b7 H    jnz     SoftICE_Detected
5 N  K4 ]; z& E9 J9 @' x  P# j5 b: o# Q1 j
___________________________________________________________________________1 }9 ?, w7 W/ D: ?

& h6 B7 F) z! WMethod 04
% a9 ?: N, G$ b& L9 y=========% a1 q6 E$ F2 `
" C. w$ z: ~4 s; s3 z1 ]$ n
Method identical to the preceding one except that it seeks the ID of SoftICE6 s. V6 s! q6 q
GFX VxD.
! b% x! q0 |, M9 x" c  T, t4 C! z& g* Y
    xor     di,di: w# }# m1 Q* H* v4 {/ S
    mov     es,di
+ n' D$ m) v" y7 F2 ^( O    mov     ax, 1684h       2 l  f3 ~, ~2 |, Y) O8 J
    mov     bx, 7a5Fh       ; VxD ID of SIWVID" b: x7 k; X/ h# c) Z+ D
    int     2fh/ ^, u$ o/ z5 X( h- W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 F1 V! K- M: z2 s/ j
    add     ax, di' f# V$ T3 u: p+ f& x
    test    ax,ax
" h( L- z( q7 x) w* N    jnz     SoftICE_Detected' q0 u3 C1 d' _

" `1 ]; m+ o4 O! |__________________________________________________________________________1 n. |) g, f8 g4 x' J) z5 [

/ v" Y# L. K* d0 v0 `
/ r* q+ }( r6 f- I3 |. B9 mMethod 050 b, @. g  @& J! W/ Z4 J1 b
=========% r8 `& U; n6 P2 @
/ t) |1 D  w: `
Method seeking the 'magic number' 0F386h returned (in ax) by all system
6 T5 I+ h( q6 Sdebugger. It calls the int 41h, function 4Fh.$ W9 Q2 D( y! r5 _& L! \6 T
There are several alternatives.  + @! y: r- y7 y4 [6 r

4 h" c  S2 i/ T( o) w' w  IThe following one is the simplest:
" \, q) d" @2 m  x( q7 l
0 {' x6 ~7 `8 W# H1 k7 }    mov     ax,4fh
. F0 S* ~9 K* e# A+ z' A    int     41h% q$ Y: T: s! r  q. P5 v
    cmp     ax, 0F386
: t! L5 x3 |1 i; U* R6 ?    jz      SoftICE_detected
( h* _5 L" l  R8 l0 S8 m) r* ^% J( t3 H  P: t: L

. p7 N' b7 p" lNext method as well as the following one are 2 examples from Stone's
- ^+ C$ x) N7 _"stn-wid.zip" (www.cracking.net):" C1 J0 `% x- c& K' _/ X( k8 U

+ P  J' u" C8 Y    mov     bx, cs
! u8 z) \) n. c    lea     dx, int41handler2
, }+ S) W1 F7 w7 o4 p; E    xchg    dx, es:[41h*4]
6 W; E  Q' ~3 l" B* J    xchg    bx, es:[41h*4+2]
; U& D" f3 Y9 ~    mov     ax,4fh
8 S/ M1 U5 m: @  T0 U    int     41h
% a) F  |  |4 X" T: a' e3 R1 E- C    xchg    dx, es:[41h*4]
) i; Q/ H3 h) I- U/ T6 Z8 K! u+ l! E5 u    xchg    bx, es:[41h*4+2]
: J. F0 L! g1 D- q" q! W4 c6 e# {    cmp     ax, 0f386h: J8 B" @5 ?5 ]3 b
    jz      SoftICE_detected
$ l+ L: V2 T/ n& l$ {% _$ l+ g9 I) P- ^: W7 {
int41handler2 PROC4 M" q" f' u1 r1 u2 ~( l7 t& ]* u
    iret9 T& C- w/ K9 B) Q8 C  I
int41handler2 ENDP
& }4 d6 S. @7 G% n# u7 }( G
" _- K! H0 Y; G/ k  c2 v" Q' l$ ~
' v+ y9 r" ~9 n- W_________________________________________________________________________
" v! S2 Y7 R1 U: x: F3 U
) }6 k, V' X& [7 ?% m' W+ W" B4 h  R! E
Method 06
% _- F4 L( T# k1 y* A6 D& \=========
6 C, k( w4 y4 T
  e1 A1 t! H7 R7 S+ K/ z3 p) n1 |' l' T
2nd method similar to the preceding one but more difficult to detect:
" D- p0 y( x5 Q+ P" n/ @' ]6 X
1 e* |2 W. v$ L; D7 e8 m( z* p: X3 S+ y( S, C( ^  M( s
int41handler PROC' e* S! B! `  J: ]- r
    mov     cl,al
7 c8 r% t0 F" ]+ I/ Y- h9 b    iret7 X/ z$ i* X+ P5 j- S% u
int41handler ENDP9 @/ @2 u7 d" {8 ]

# O8 k! M' M9 q5 i3 g3 F$ m& T
    xor     ax,ax
7 R5 ]0 A$ a' B, m+ N; _' d  z' h    mov     es,ax
5 ^) y# \8 U  |7 j# a% E    mov     bx, cs: ]* G- x# ^* H6 p& b
    lea     dx, int41handler, c- @0 |% H3 z2 H  y5 _
    xchg    dx, es:[41h*4]
/ s  ~, T% g1 X  J    xchg    bx, es:[41h*4+2]0 F* Q1 f8 D* L" K- C
    in      al, 40h
9 N7 {* L: L8 `  J( n    xor     cx,cx$ U8 t) ?$ m0 @; Y5 i1 j) a
    int     41h" T' c$ T! \" @
    xchg    dx, es:[41h*4]. n2 F) p( g* g
    xchg    bx, es:[41h*4+2]- w. _2 ^* B, I; I/ b
    cmp     cl,al
: D& Q" \1 a: g% y8 i. n    jnz     SoftICE_detected# `0 g. V# `6 B+ P8 J

) g( Q$ \( V' G( J_________________________________________________________________________
# [* D: _, Q& ~+ E* V. V
% P$ c/ }+ M2 @4 P9 @0 D+ \Method 07, ?- r  [. G4 p  P* S, b" x
=========
3 E$ B( e! l  g) p5 `7 x" B7 z
2 l* c  C+ L! a. r. ^1 d) ?" ~# ~5 ^Method of detection of the WinICE handler in the int68h (V86)" f  X) `5 n$ j& _+ o

7 p9 v7 ?; k1 C% G$ _    mov     ah,43h
0 t8 v. N4 |3 `* w    int     68h) e1 d' W; X$ E, S# O
    cmp     ax,0F386h
3 h7 }' p  ?1 N9 I# Q) a    jz      SoftICE_Detected
% L5 s7 i" ]: t% q0 f* _# r7 |& x0 _
. u+ R  w# b& c
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: C2 A) }, `+ n* F3 D   app like this:6 \) S9 f  V2 v
  Z+ g# U! t3 _' ?$ X" ]( {. z2 |, B
   BPX exec_int if ax==682 Y. U. Z" _' C7 y: M( ?
   (function called is located at byte ptr [ebp+1Dh] and client eip is2 ^- d$ j# F2 E3 A
   located at [ebp+48h] for 32Bit apps)
/ [' w) @/ n" J0 H__________________________________________________________________________
! w4 ?' w$ a' @4 T
! J+ t' }8 X5 }5 L7 a2 q) |# q! R. c( B$ X& M! ]' w2 x+ F& b
Method 087 [4 x+ ~: T) _$ g2 {
=========' D( q0 s7 e' t; k

& S+ W6 |7 X$ gIt is not a method of detection of SoftICE but a possibility to crash the0 o) k! \$ L( I
system by intercepting int 01h and int 03h and redirecting them to another
! d4 p! z  d& a  N3 ]routine.
0 Q+ I6 G+ V' }8 z5 B  d9 v, sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, Z, d/ y% ^  @6 C" z$ u* \8 \to the new routine to execute (hangs computer...)2 ~/ h% d  ^" T0 ^

# L' Z9 F; n( {    mov     ah, 25h
3 Z, q# i3 m% B7 Y" I    mov     al, Int_Number (01h or 03h)+ ?- s- I; k7 B) F( d
    mov     dx, offset New_Int_Routine
' j1 O8 o3 l7 z! x    int     21h
- }- b5 t5 M- B3 k% C
2 x6 ^0 S' v' H! K__________________________________________________________________________
- M/ h1 s" m, n/ s
" U# A% n6 J* eMethod 09, H% K# I! B, v1 x
=========
* N- ^4 a% j  Z+ L8 i- W5 T+ P3 G0 L' M0 [
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# J7 _9 C  A3 z* kperformed in ring0 (VxD or a ring3 app using the VxdCall).
: ]- r) |0 X9 ]( n* O! X1 cThe Get_DDB service is used to determine whether or not a VxD is installed
0 v7 _" ~7 g5 k5 O3 S2 ifor the specified device and returns a Device Description Block (in ecx) for  W4 c5 s+ q4 U4 y
that device if it is installed.
% F9 S+ C( ?' _% V, b! k( |
+ b  I. f3 O, i) @9 C   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: s3 S# z/ w# S' t2 c* M: c: Q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 O3 y* s9 D* c: V& L/ ^0 U! i
   VMMCall Get_DDB2 j. X" j5 H3 g$ `; Z4 P1 S$ a
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed, Y0 w& J7 S1 w$ M: q5 N
! L1 e7 S/ _, J0 O3 M  g  B$ O
Note as well that you can easily detect this method with SoftICE:7 M5 m, K7 H& g9 d5 Z7 T& ], O; B
   bpx Get_DDB if ax==0202 || ax==7a5fh
! F) f' I/ [" h1 C) b' ~, I8 M0 m" T) K! @3 w6 Z
__________________________________________________________________________
* ^0 ]" |2 o2 h- J( n
5 d  J) v$ g) F. G+ v! lMethod 10
. _9 V. v; ^( i* k3 }7 |' N# ?=========4 B: I7 Y6 f4 [' z) f
( }' _# [. j" t1 A% |( P, r
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- B# \* V, y6 C1 T: I2 B# W/ f
  SoftICE while the option is enable!!
0 ?& T& h5 h) I) u" `6 f! O. |4 J3 E3 J
This trick is very efficient:
& O* g7 C6 N- @- C* Mby checking the Debug Registers, you can detect if SoftICE is loaded4 B- N4 W) U+ {$ @- p5 K
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 E& i3 G) E  A; E' u
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" I5 F3 ?1 E. s+ s# Lvalue (in ring0 only). Values can be manipulated and or changed as well; W2 i4 R/ j1 r' W  Y5 C% A
(clearing BPMs for instance)& V) y9 [2 d' O0 |

/ t* _1 p  Y2 [( s& V( G__________________________________________________________________________- `( E+ B/ w* z% c
2 f9 P- T0 B% `, x  J7 i7 u
Method 11% V! J# w! |7 B' }3 [
=========4 h3 r1 I/ p5 t1 I2 t8 |# u, j
. \7 t, a  @' `) \
This method is most known as 'MeltICE' because it has been freely distributed
  K! h& e1 I- n7 @via www.winfiles.com. However it was first used by NuMega people to allow; G; ^3 |. g* s' `
Symbol Loader to check if SoftICE was active or not (the code is located
6 b. a% ?2 X( h% Oinside nmtrans.dll).7 G6 e" K9 s% D6 D

0 c9 o) w# [& i% S% U; h3 XThe way it works is very simple:
9 O* @# v6 T4 L7 ]9 AIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 W+ F7 a0 l, m$ F0 O, V
WinNT) with the CreateFileA API.7 V, `4 X& x! D0 \4 F% _& s
# k& @: [! S6 S0 U
Here is a sample (checking for 'SICE'):/ q: P' _) e) y; ]3 A
: u5 ]+ `. g6 H6 I
BOOL IsSoftIce95Loaded()) b- G0 g5 u0 Q% F
{2 I$ z. N8 ]  P+ p. f
   HANDLE hFile;  
, o5 W6 W8 B* ?+ X2 B; \: N   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& K1 P4 X( d& M& j% Z( V                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! X4 B3 m; a0 }# V" X                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ t. P+ X- z* T3 T6 q1 p  ^   if( hFile != INVALID_HANDLE_VALUE )
6 i& L: _1 w9 u2 `  x1 M+ Y   {" m1 p1 [1 c5 X& ]+ m
      CloseHandle(hFile);( S8 q/ B1 x# r. ?4 t5 z
      return TRUE;
) ~! K. p, f$ `" p   }0 {0 W; L2 l; |7 S/ M
   return FALSE;; {% Z3 E2 g: Y* f! \% W- @
}
' M6 Y, H+ p( [) C  b8 c  z8 `2 ~0 _' b3 @& o
Although this trick calls the CreateFileA function, don't even expect to be
: K' w2 M8 x% nable to intercept it by installing a IFS hook: it will not work, no way!5 I- p7 Z3 I( K+ H, n
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, F2 p  A* h9 O* A8 r
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ r: ?9 p+ R! N9 O5 d  U
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ `& G: }% n. S4 q9 l' N7 E# Y5 X
field., L2 x. e# X0 \( `$ o# {# q
In fact, its purpose is not to load/unload VxDs but only to send a
3 [$ x& O+ ]+ I, e- x. YW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), c! I& H3 J+ J4 ?3 x3 E1 W4 _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try1 {1 i* A3 E  t# `) B: i
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
  a; t7 J% d+ F) H0 DIf the VxD is loaded, it will always clear eax and the Carry flag to allow: B7 s1 f' t' Q/ ^7 G+ D; J
its handle to be opened and then, will be detected.
% i+ q4 z! U- T2 sYou can check that simply by hooking Winice.exe control proc entry point
* h1 ?! S, Z) |' D% o# M* p4 s0 s5 Wwhile running MeltICE.3 @- a+ D8 \+ q- N6 A) a. l8 j

4 @7 K; t' y# G6 B; q1 ~1 _3 x- y$ h. ^4 V- {: k& o5 A
  00401067:  push      00402025    ; \\.\SICE
! z  t9 f2 h5 `  0040106C:  call      CreateFileA) z" V0 K( ^% b% ~& @& q
  00401071:  cmp       eax,-001" N9 B! t7 i3 O7 F. d) \; D
  00401074:  je        00401091! ~% S; e- R$ g& A0 T- F5 y

: T. L! u( z8 w- n- q1 X/ Z7 H! t0 o9 v- @/ [% Y' S3 M
There could be hundreds of BPX you could use to detect this trick.
* Q/ |1 S5 Q+ Q-The most classical one is:* w5 A& v; L9 M1 f
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% w' w8 ]% M; H    *(esp-&gt;4+4)=='NTIC'6 z$ i& I4 r9 G3 m) T4 y, a+ y0 h

. G- n( P; U) V# {' a! N3 j-The most exotic ones (could be very slooooow :-(
" P# r+ P+ `# W% b3 H7 w   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + H4 L! _! N! h7 ^$ `9 b
     ;will break 3 times :-(
) _* x: j: f* N$ F
1 p, d; Q" ?* r3 D) E( v-or (a bit) faster:
0 Y9 f- \+ Z" `- A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- c+ L- U# z- k( m7 c' z

" i! j" u+ n6 O8 H! z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  6 p+ U" G1 L0 Z7 \( X4 p2 l
     ;will break 3 times :-(! l' j  j  {  a

* M) d# q3 q* j: }1 I; R! L-Much faster:
$ ?  U  H: ?; V/ T: t7 c. L  [   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ C, b8 S8 b, s" [- Y% |- X: ~7 T0 P. J
) f; K; t" L  v6 t% h4 YNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 u) o/ ~  l+ H- Q# Afunction to do the same job:
5 R  c) R- |6 a; p  }7 [( O, F  I  F9 B; B
   push    00                        ; OF_READ
0 ?! s0 G$ v; [$ N; x% F   mov     eax,[00656634]            ; '\\.\SICE',0! O+ y$ D/ A% E+ r
   push    eax
+ U# w4 r0 t! C4 n5 `2 M   call    KERNEL32!_lopen0 K( s* G5 `, r; L. {
   inc     eax
1 K/ Z! g  S9 q: ]   jnz     00650589                  ; detected
; }) m3 [. a) v. r; r5 X   push    00                        ; OF_READ- o8 ?3 K: E0 {7 A& \0 L  z
   mov     eax,[00656638]            ; '\\.\SICE'- q9 C. K  y8 `" a4 V
   push    eax9 W0 ^- C% b3 F+ M5 p
   call    KERNEL32!_lopen
' h) {6 h- B8 I3 _6 t9 q: ]   inc     eax& R" L) P7 N, O  C
   jz      006505ae                  ; not detected
$ R2 K0 w3 A; |8 f' S, n% X* A2 u+ B* m9 X! D# ^

# C3 a0 e# m* [7 X- O1 G! q__________________________________________________________________________
7 k, v  I$ X2 p! g6 y/ _7 R# a: N- w& t" a9 R, o4 }1 ^# d
Method 12$ W+ R- S. Y( ?+ b! p/ G
=========
7 y- I" s% ~( ?; p* b0 v; v9 T; y( Q" _* j- ]/ C# |; \& T% q: H
This trick is similar to int41h/4fh Debugger installation check (code 05
8 h1 M( `+ W3 w; o' |/ {! s&amp; 06) but very limited because it's only available for Win95/98 (not NT)  b; B! v% e. Y! N$ E  N  }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" D4 i' \" z0 p5 H% D* @- d/ i' e2 y, g" K" G; ^1 [7 D  T
   push  0000004fh         ; function 4fh
0 E7 U! w' D3 \. B   push  002a002ah         ; high word specifies which VxD (VWIN32); M+ b* E% L% D, Z9 _- ?) ^3 Z
                           ; low word specifies which service
! p: N5 X, U. ]) h, Z9 w                             (VWIN32_Int41Dispatch)
0 I/ U2 _; {' _/ I8 g  X   call  Kernel32!ORD_001  ; VxdCall3 g6 |3 ~0 X: A/ Y
   cmp   ax, 0f386h        ; magic number returned by system debuggers1 @# M. Q% |; r
   jz    SoftICE_detected- B4 S9 Y( M$ @9 C% Q5 L. G
* c, O1 D$ g+ ~8 r! l6 F0 r
Here again, several ways to detect it:
6 {% b# y+ [- h: t* A& I( L. D* l& w8 G
    BPINT 41 if ax==4f
! f( t1 q& z: T; Z5 j' j8 z/ O, w3 [4 `% _
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one$ `) r2 x& W: D" t7 n

. c0 Z1 g9 b7 E; p. I    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A% j# t6 e) f* y7 Y3 U: H( x- l
  ~7 U+ Y8 o1 M1 W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 x1 h, _- z+ q- |4 J' y
- J$ l+ |. U* F/ M- X
__________________________________________________________________________
5 L( e) y+ Y( l5 d0 I& Z
" _0 P' B5 W1 a/ P  B. yMethod 13
' s2 L. `, ?) F/ k' e/ y7 t: l=========
! x" ]* |5 \" L! c8 p* w
, D& N6 j* @3 w- t! YNot a real method of detection, but a good way to know if SoftICE is
) t) m2 l8 a+ e, M+ P2 ?installed on a computer and to locate its installation directory.3 d, Y+ f2 D6 U; l* _! g2 R/ ~
It is used by few softs which access the following registry keys (usually #2) :+ M( m, n4 W# s% i
- e% N; x# Y# o4 f
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 g( E& [% A  B; D
\Uninstall\SoftICE
2 j) H+ d  o5 n; c9 i-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 @, j  O" R  y3 S+ ^, F" s
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 V2 {3 M: x$ _, \6 ~# H" G
\App Paths\Loader32.Exe
. C0 f9 Q, |( ]( t  k0 w& i8 {% n' G( b9 p0 d; {
8 d1 c9 p5 L: S8 A* V- O4 x
Note that some nasty apps could then erase all files from SoftICE directory
' E4 ^1 f' r% l. d6 q0 F  ^(I faced that once :-(" s0 s& v* S, R
0 e& F7 p8 {$ r0 w! U
Useful breakpoint to detect it:" y- ], ?% f7 N: K2 _! z
+ ~; Z8 C# E3 {# e& `/ |. ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
4 s. Z5 Y4 q# K; d! c
8 E: [! ~- z" k5 }: ?__________________________________________________________________________
6 c/ c4 o0 C, C) I' l1 o
2 C% G3 [4 T7 V8 A& |5 R; @5 h9 ?% R4 p8 q! c6 N
Method 14
9 U) Y+ d7 a' H1 }3 K=========5 v" q7 }! G& V( p. H

% h) K8 J/ M# C3 R8 O& J3 JA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ \2 I, w/ u. x: k) d' d
is to determines whether a debugger is running on your system (ring0 only).
9 E: _% H, E* ?' k, N
- i! S. X3 y9 S  o/ T) W   VMMCall Test_Debug_Installed# }$ U2 Q* C8 M: o7 U; Y$ V
   je      not_installed: U' b. Y' F* k& k+ z7 b: |/ a

: `0 n$ M4 f% p! ^* p# BThis service just checks a flag.6 J+ f  t! T" T( i( P' B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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