About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% t+ W, |; Z0 Q+ T/ t* m/ P% B<TBODY>2 N9 a: J9 `  T7 v* u- l0 N9 u$ d, f
<TR>: c; T; A; [/ Z: H6 b
<TD><PRE>Method 01 ; T$ S+ F$ a, O0 w. U6 [4 N
=========# [7 S9 y; p6 [0 f6 B! k, H
0 x7 b2 N, A' |$ J3 N. J$ v. j9 r
This method of detection of SoftICE (as well as the following one) is' F, o. p# _, I' R& q
used by the majority of packers/encryptors found on Internet.
, l+ N$ q: R: y: F9 fIt seeks the signature of BoundsChecker in SoftICE
2 L& {& n# n; M* H3 x; p" U9 L0 a* g+ w7 }
    mov     ebp, 04243484Bh        ; 'BCHK'2 M, G2 ?( o* ?% e4 I& {$ m$ i
    mov     ax, 04h3 Y7 e! Y0 m5 Y. g8 ^
    int     3       6 d; \% }- z( _3 O( E
    cmp     al,42 w; z3 d- B0 t! {8 E
    jnz     SoftICE_Detected# q$ {! ^4 d; y8 a* f/ E

7 B+ g$ D* c" U* \( w___________________________________________________________________________
* u3 V- e6 N: l, m
$ l" i. r5 g* h) gMethod 02; V7 Q4 t+ a) y2 K3 v: w
=========  z1 s( T' k- W1 p9 G1 ^
8 |# t! _4 K4 J1 A0 V  Y
Still a method very much used (perhaps the most frequent one).  It is used' E6 j0 S8 j3 o% T" d' V' m
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 F9 z( I+ u+ K2 L: C/ u5 k8 k7 f
or execute SoftICE commands...
/ `3 Y8 x$ A$ Z+ `It is also used to crash SoftICE and to force it to execute any commands! ^; K0 K( @( S7 R
(HBOOT...) :-((  ; Z* x9 b$ o3 N

/ J, R! w! M. CHere is a quick description:
" H  [  S1 y6 t0 \* d8 d! @, B-AX = 0910h   (Display string in SIce windows)
, x% b! @) Q- H-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% U( r' _% `& v7 ?7 X
-AX = 0912h   (Get breakpoint infos)0 @1 c; b* P+ @: l) t
-AX = 0913h   (Set Sice breakpoints)
  z! Q7 ~1 c- ]) ~- z& _+ F-AX = 0914h   (Remove SIce breakoints)3 G0 k; k4 u7 P  I, Y

0 B5 c  \# E: {. d( L6 H+ UEach time you'll meet this trick, you'll see:& m" f  V7 s' w$ g1 Y7 @- ?0 c$ J
-SI = 4647h
3 {: e- L2 g% X) @-DI = 4A4Dh+ D& D5 n2 ^) O. L# t
Which are the 'magic values' used by SoftIce.
5 v( ^" _9 S5 ]! m3 wFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.  Z1 k3 ]' e! m$ J* _8 u1 E; q

/ _! f8 n. L# H  I% b, p! MHere is one example from the file "Haspinst.exe" which is the dongle HASP
* b& y$ H. @0 v0 HEnvelope utility use to protect DOS applications:  Z3 H$ X3 e. V
) f4 }# f* f2 L) b

9 h, E# S9 \, B& v+ @% K* }4C19:0095   MOV    AX,0911  ; execute command.% ?& ~5 c9 T6 G! A& z: J6 F
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: L, g, v7 ~! o: h% J2 E+ {
4C19:009A   MOV    SI,4647  ; 1st magic value.
( j3 @6 \( |+ u0 h: X5 `# N4C19:009D   MOV    DI,4A4D  ; 2nd magic value.+ E4 }" y7 h( R
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 Z0 f1 a, d& i2 D- w. n5 z+ k
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" b* _! ?& W; y; e4 A  A8 h" G& ~4C19:00A4   INC    CX$ s$ B9 M, l3 m4 g0 H, g( }5 a
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' l' P" V* q  V8 _( i7 o: m- L
4C19:00A8   JB     0095     ; 6 different commands.4 h2 \5 }5 t  Z( K: `0 F
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: Z6 O8 X7 ?+ I7 q, b8 n4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& |9 O: @8 w1 ~

# S4 J/ k1 h9 R* `& j/ @- z: xThe program will execute 6 different SIce commands located at ds:dx, which* b( @2 Q' D, ~8 o
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT." m3 ]5 G) c7 u( _

/ ?" N1 T1 ]5 q/ W" U* y# T* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.; ?. t) j& {4 {! H
___________________________________________________________________________2 C1 {! Q& S6 d- K
& Y5 F3 H9 @& ^9 i; S6 u
! i& D' l' _% F5 w) r0 d
Method 03: ~: m8 r5 u4 j; Z
=========& d* G& d" I' b: m- X' k

/ b% D. w( ?) ~" BLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: I! `  f$ F4 g- j
(API Get entry point)
! z, A  K; |. |8 k# ~        5 A& ^7 ?1 m% ~+ q

1 W/ `. r' s& }% M6 N    xor     di,di
( M* Y; r6 e% M: l9 I1 _2 Q$ g    mov     es,di
2 P+ o1 p" U1 |4 g+ m    mov     ax, 1684h       & B0 n8 \+ U, O1 m. d
    mov     bx, 0202h       ; VxD ID of winice
3 ^( Q* g  K" X+ k    int     2Fh
6 e8 G3 q* f: Y9 l! R1 H    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ n8 B; V' ^7 U  m    add     ax, di
5 u% r9 M5 b( X  f2 m& ?  j7 e. c    test    ax,ax
8 s6 j  n0 O1 M& t    jnz     SoftICE_Detected# F) l4 J6 }, J" _7 b% m5 E9 U

( t! b% L" v* W+ @+ l  F+ s___________________________________________________________________________3 _6 ]4 v: ~% U. ]* f

3 R9 W9 z) k: w# g2 xMethod 04
/ @/ a7 U" h# z% n, e! D=========' u: `$ _5 X( i: \; ?+ U( i3 k  m
) U& u) X9 z' r% L* f
Method identical to the preceding one except that it seeks the ID of SoftICE* c  D+ r- t8 q
GFX VxD.! V" k; o, V! s& {& B

4 T' v3 C- u. i5 C4 y! ]    xor     di,di8 X! L( w* _/ x
    mov     es,di
6 z) Y1 Y0 t* }" q7 z    mov     ax, 1684h       $ V* A, f4 H# {  p+ I: X9 I- H. J  Z4 Z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 s7 k; Y. n& H- t" J* d4 e    int     2fh# R5 o" x7 h$ N* |) j  b/ g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- U2 w( ?5 H  Z' b
    add     ax, di9 a& V6 F. N( z# h1 V9 a+ F8 s' r) B
    test    ax,ax: R! Q" k9 L5 I: d5 X" i$ B" @
    jnz     SoftICE_Detected: z5 B2 w/ M4 i# K. [2 j( K) Y7 I3 ]

7 f+ ?3 Y; e8 z4 ~5 K$ b% Z__________________________________________________________________________
2 M/ ]  r& R; {/ p$ [, D
) _% y, F# k2 D9 @3 |% w; O" X4 v7 O! U1 x2 w) B% c
Method 05* R8 g/ C" s+ _: H) ]) N% [" V
=========
% B7 A- D* P5 ^/ {1 E& P1 n2 r9 R+ q* L
Method seeking the 'magic number' 0F386h returned (in ax) by all system
' g3 k5 I3 r3 L% Z/ hdebugger. It calls the int 41h, function 4Fh.$ u* K$ e7 d- C# F
There are several alternatives.  0 f4 i+ o: U1 s2 y! m1 u) N
0 g; S( @; \; r# Y# b; Q5 g3 D
The following one is the simplest:
0 G4 e: n5 J6 a$ x* L
; f$ ^4 \5 q# s& u$ o. V    mov     ax,4fh  S, s- E0 f, x, G( ^$ K
    int     41h
2 }1 z5 N  f1 M8 G3 }% Q    cmp     ax, 0F3864 Y5 B& b5 V5 B- s+ K0 q! m  }2 V
    jz      SoftICE_detected6 m$ D5 C0 P0 R/ B$ z6 `# f

- y6 N; {: A# r5 x" O+ m5 U
( M6 F# l0 u3 {Next method as well as the following one are 2 examples from Stone's - `! i/ \8 D% L
"stn-wid.zip" (www.cracking.net):
" u+ ^2 @. Z) n+ H# a. [7 ?  M1 ~4 u1 Y
    mov     bx, cs$ t6 o7 K% N9 h% O
    lea     dx, int41handler26 U' C3 |; y% s' l2 j! o  q
    xchg    dx, es:[41h*4]4 Y/ y  Q1 F! s0 f7 J7 C2 C  c
    xchg    bx, es:[41h*4+2]
) h0 p1 s- s; Y( B4 b    mov     ax,4fh. t1 k" F3 D+ E* o  n+ U; S' X
    int     41h
6 P% [5 j& @5 x) u/ V9 T3 f; g    xchg    dx, es:[41h*4]+ P; ]$ n( P5 I, [/ R: C1 }
    xchg    bx, es:[41h*4+2]
. |. p8 X0 W9 ?) X    cmp     ax, 0f386h* m' O$ y8 r5 {$ W
    jz      SoftICE_detected
& Q: k" D' `2 W* H5 `( s6 Q4 m% l8 Y! w& K/ U2 O3 `
int41handler2 PROC  X/ w0 p. V% k1 W& N
    iret
+ d6 ^. c7 S- ^$ L/ xint41handler2 ENDP( t; V6 @6 V9 v
8 T3 [& @( I; M0 v5 q) n& |" K
/ a+ x! Y5 `" o4 s7 h& W* T
_________________________________________________________________________% h+ g/ s/ u. q% ]

% D/ N" k& O& L" S
, g+ d8 S9 F3 a0 P2 X; rMethod 06
) d- i- c0 p0 a4 y/ p8 \5 {; M=========
9 a/ c3 z/ o  s) T: v
+ y& q  @5 G: b" R; }/ @" ]+ q+ _0 k$ L% m: B* [. N# v  }
2nd method similar to the preceding one but more difficult to detect:
8 K. @4 U) F( P+ B
: ~9 n# J3 Y8 M
7 Q) B  R5 c. y( W. _int41handler PROC4 a; ?% L* J0 i3 I( q
    mov     cl,al
4 a6 P0 o4 A+ K6 ^    iret) _6 Y" N/ n! G# |+ b2 I- ?5 J- }
int41handler ENDP
, q; h9 `$ A# c, ^9 ~0 ^4 v& k  ?3 B* K2 D/ D

) z* E  h# T6 I6 Y    xor     ax,ax  M& }. n8 Z9 k+ C4 L* ]2 `1 D  C
    mov     es,ax8 d+ ~+ u$ n# K* {3 f$ H* ]
    mov     bx, cs
; o  Z! G0 z, Y; Q    lea     dx, int41handler
- M- N1 d8 l( y! X    xchg    dx, es:[41h*4]$ m% X# G5 B3 e8 h
    xchg    bx, es:[41h*4+2]
8 i- i+ t& _& X$ N8 o    in      al, 40h
& C; B$ E) }' j8 {0 t    xor     cx,cx1 F$ w4 J& k1 |
    int     41h9 Z4 K6 m2 |9 Y. c2 f! z- x" h) x  |9 C
    xchg    dx, es:[41h*4]! q% t7 R3 F6 K- C0 |& {" o- f
    xchg    bx, es:[41h*4+2]! q( R* S0 i- L( E& x9 ]+ d
    cmp     cl,al
5 o! {$ e6 I" g. D+ M  n    jnz     SoftICE_detected; ~# B$ h3 \- C, n4 B: j1 b+ k

% T5 Y( F$ ~$ T" I% H$ ^9 S: n) w_________________________________________________________________________! L$ @, P( T( ?8 L* p0 ]

) F0 g6 L+ \; u2 |" L- W* w& S  h$ nMethod 07
; b- v# X% L! _( |/ W! Z=========  F- [/ z2 e+ k$ I
5 j) i% m# U& i: j
Method of detection of the WinICE handler in the int68h (V86): y, a7 D2 G9 r7 T! l

) M- M/ r! X! S( @, G6 N" V5 N/ x  f    mov     ah,43h
6 T. d1 R$ P6 z$ N; d5 ^    int     68h
3 {' ?2 Q  K. p3 m    cmp     ax,0F386h! q- K( B; j. }- L5 g. ~9 z: \: K; \
    jz      SoftICE_Detected! Q5 s/ h/ g  Z  O
8 S% z. L+ D7 I& n4 `+ e" Q3 H

5 c2 a7 f8 G1 y; N. `=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- Q6 I2 z! k# U/ o" R( g1 U
   app like this:
4 h  i! _, H+ m2 P" [! b  T  G2 C, x
   BPX exec_int if ax==68/ L0 g# k- _+ N) X; `1 }+ M
   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 f$ s9 _* Y% ]7 i* L; q   located at [ebp+48h] for 32Bit apps)' c0 ]5 c& R/ G' v
__________________________________________________________________________9 n' `- I* K4 ?8 H# f: g& F
6 x+ u  N9 d) o
8 ?+ W3 Z5 o+ J/ @- t: F
Method 08
& W# G9 ?, `% l( B' C=========
8 c& `0 U3 l: w' t# y
9 P6 {: O- g$ e* LIt is not a method of detection of SoftICE but a possibility to crash the  I/ ~1 z1 u7 O5 W+ ]
system by intercepting int 01h and int 03h and redirecting them to another5 B, {( S5 L7 q5 r- M
routine.% u3 T' x4 E" k3 ^% Q* }* I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% w  ]" {  O3 Z5 t" E4 H! p
to the new routine to execute (hangs computer...)' G8 @# ]3 l- C: B/ e! L, L
5 e. N% P+ z" \/ D" ?% O
    mov     ah, 25h
9 A3 B  d) o/ z0 S5 ]    mov     al, Int_Number (01h or 03h): t5 T, e: C% d' u) h
    mov     dx, offset New_Int_Routine
8 R9 e1 g# F1 N& o    int     21h
6 n7 A9 V1 D4 `/ z) n  o' t& k$ s# s4 D" u+ r8 y# d
__________________________________________________________________________: m2 S! {6 l, ~7 O' I
0 A8 N2 i9 u6 a. k& G; P& n0 t
Method 09
% o8 v+ w# Y* o=========; |( J  ?  \' T% D, x

$ O0 o& F) s& L7 UThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! G9 s8 ^" g. T) V0 c
performed in ring0 (VxD or a ring3 app using the VxdCall).5 I  N6 e6 B; ^- M' c
The Get_DDB service is used to determine whether or not a VxD is installed
4 ~: Q* T* p5 q4 x5 e) D. cfor the specified device and returns a Device Description Block (in ecx) for* F, b, Z; r" Y/ N9 X
that device if it is installed.& ]& p: s! |! \7 P: G' q( Q6 J

* M/ x0 t! A& c   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 a3 @6 N4 F1 q5 i+ C   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
0 R% B3 c/ F. n; d$ R   VMMCall Get_DDB
% u6 J9 `4 o: \   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ n! A: w  N$ F) V  h
5 f# _  [2 H5 m2 x  S3 w
Note as well that you can easily detect this method with SoftICE:  `) b) ?7 e$ y' l- |4 M
   bpx Get_DDB if ax==0202 || ax==7a5fh
5 D: ]/ s; k( ?: Y1 {& @  Y
9 m' D/ ~, p1 [$ P" X9 J8 l& S- O__________________________________________________________________________2 i+ o9 I- o. n

( M$ v( u, N  v" E; R! v) hMethod 10
7 i6 N0 Y/ k3 H2 {5 Q' f( k=========8 c$ w8 v9 P8 n( R* E* T2 F0 Q

2 P$ x2 D' ^; I/ R' }, e( E=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 |: B' j+ a6 F% R! `  SoftICE while the option is enable!!; s4 i2 h' g2 {( T8 _0 O7 ?

: {& s) o0 z  r6 XThis trick is very efficient:) Q* c( ~0 E$ p4 h
by checking the Debug Registers, you can detect if SoftICE is loaded
+ j7 J5 _) z+ D) B: |(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% d: B. b. a1 H- Y
there are some memory breakpoints set (dr0 to dr3) simply by reading their( e- r3 N1 ^( L6 D; i% ^
value (in ring0 only). Values can be manipulated and or changed as well
/ ^& e3 c# [+ I4 ]! h, r2 W5 j(clearing BPMs for instance)& G' `, c$ b' o; g- v$ [

! T3 ]9 Z  ]' q1 ?( X2 U5 M4 Y( j: t  {__________________________________________________________________________8 O* H, e3 q0 ?( [* w& p
3 V3 e4 H$ ^- r- s$ o
Method 11
; A1 k: b; y& |, T3 `% _=========
7 G- ^8 B$ D/ V+ {9 o. W8 U( s( F1 K
This method is most known as 'MeltICE' because it has been freely distributed3 [# @$ `$ u2 h% j. e  @- e
via www.winfiles.com. However it was first used by NuMega people to allow. h" d& ~6 p. [) B; p; R
Symbol Loader to check if SoftICE was active or not (the code is located
9 G! e. ^6 w' K1 {- \5 Jinside nmtrans.dll).
+ ^& V( H: S8 L9 r1 U' K4 n4 K5 }: O! i3 N) u3 i6 Y
The way it works is very simple:
# z+ J. P4 D, q$ xIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- _# e1 D& P' w4 qWinNT) with the CreateFileA API.
. }8 f" |/ F* c5 K) v7 f6 b9 Q% Z
Here is a sample (checking for 'SICE'):+ q! v% u) F' Y* Z
( ?  y( p5 a  ?$ f2 I
BOOL IsSoftIce95Loaded()/ h( m4 R: J3 K# C" f+ T
{
1 ^6 j5 H: q1 r5 K! f7 q' D* e( k   HANDLE hFile;  ' A6 A, i2 R- _$ o: k$ D
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
. O$ P3 f/ y1 a/ F( c$ ], k                      FILE_SHARE_READ | FILE_SHARE_WRITE,
+ C6 v$ Q* ?4 J. x; S: F, _/ w( C                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" p- |( n: v( G% K3 r   if( hFile != INVALID_HANDLE_VALUE )+ k: j. u. {6 e! O6 ]# L
   {
% z9 q1 F& t' C# ]; \2 h      CloseHandle(hFile);) Q9 w& @) a% N- v6 n
      return TRUE;
7 \6 q1 y* I* b9 g3 l   }* ^9 F! {+ ~. f) F
   return FALSE;
3 M* _! d7 r6 q  @/ d}
+ G6 r  x, \7 P3 S- @# c  _' M9 x% L4 j% S) n. h% ?
Although this trick calls the CreateFileA function, don't even expect to be
' ]4 A# n- t  E! ?8 n. {3 gable to intercept it by installing a IFS hook: it will not work, no way!
# X8 W/ `- Q$ ^* D4 f  nIn fact, after the call to CreateFileA it will get through VWIN32 0x001F) n( @9 o, \5 f" B% o
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( V% T  y- c" b# @; {! rand then browse the DDB list until it find the VxD and its DDB_Control_Proc
! F4 a7 b+ T) n1 q2 zfield.
& k- a; R% N! e2 k& RIn fact, its purpose is not to load/unload VxDs but only to send a * l) ?9 F5 l$ j8 Z+ N8 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
+ j& W1 X5 g6 Q, G" v8 V9 U+ J8 _to the VxD Control_Dispatch proc (how the hell a shareware soft could try' z( V8 @, B. h9 @+ C4 M& K! A" y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 [0 |+ u# b4 [. i" cIf the VxD is loaded, it will always clear eax and the Carry flag to allow
2 y) ?) y5 C: wits handle to be opened and then, will be detected.0 z9 ^7 O$ g0 V* w5 s' s
You can check that simply by hooking Winice.exe control proc entry point$ W4 l! r* V% f2 h. l/ n
while running MeltICE.3 W9 |& `' k( u8 E
. _2 t/ |3 H$ g- ~3 ]" p' V& U

9 V) W% a% Z, Q" \1 B  00401067:  push      00402025    ; \\.\SICE+ w* s- I" @$ e" E1 ^
  0040106C:  call      CreateFileA. m% R' I3 b- B, X
  00401071:  cmp       eax,-001+ N6 h/ C7 U3 n/ J7 o  X# u
  00401074:  je        00401091, m+ ?' n2 I4 [7 n/ Q8 |

0 ^" A3 U( c) M# C$ p* s6 k. J; ]
% r7 y0 @# O# F0 J0 ?There could be hundreds of BPX you could use to detect this trick.
" v/ d$ ?6 G- K4 g+ l: _-The most classical one is:
2 ]* Y7 Y6 U- p6 h  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||& }* Z* c5 [$ }# Z3 y6 U
    *(esp-&gt;4+4)=='NTIC'
5 T6 ?9 V* [: i' U% V1 T
3 `+ |0 w- p" C$ e7 E-The most exotic ones (could be very slooooow :-(' j3 O7 W5 k" u9 s  x
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& l" x8 j& `$ O# L, C1 c/ n8 t     ;will break 3 times :-(& D( J# B7 b  C9 _4 p
+ W; w. {, X% I
-or (a bit) faster:
9 I( `* Q. E* I8 U. E) \" T7 T   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
% f6 F0 q  O( R( f
2 F6 o4 A8 Q5 I2 B- G   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # \# T* O% Q+ v7 z1 ?
     ;will break 3 times :-(, K1 u  r3 d" M" J

& @( ~0 q1 M) U+ G/ m-Much faster:
8 }5 L* V/ t: h0 W0 [4 Y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ o" E. Z( y; e( b0 t2 N' H$ Q( U$ a2 _' I2 a
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen! l" H0 s3 _, K7 W/ J! R) p
function to do the same job:
: H: X1 V' Q! P1 s
$ @1 s" a- f- R   push    00                        ; OF_READ
' ]3 X3 B, n# @' L% A   mov     eax,[00656634]            ; '\\.\SICE',0, f  q7 I4 B  M5 G- Q% S
   push    eax$ k6 D' I* u. H& U1 x4 e/ d) P
   call    KERNEL32!_lopen
0 _: Q; x1 y: c( f   inc     eax. @/ X5 k  i  C! L. D. P7 p9 g
   jnz     00650589                  ; detected1 x, _, Z5 B; x2 `, g
   push    00                        ; OF_READ
4 B6 z2 L- x$ {9 q; i   mov     eax,[00656638]            ; '\\.\SICE'
5 T' X5 r( d/ s7 f0 f4 I+ s9 c   push    eax
0 O3 I/ x2 @4 L  }; J   call    KERNEL32!_lopen
4 R9 }: T  m. m  u- S   inc     eax
- m$ S8 X" a0 E/ N. ^   jz      006505ae                  ; not detected
6 v. o* q; O( M" l0 t4 J0 b1 Q
5 T: O5 \! I$ d# y, W
" M& N7 L; @; U' m__________________________________________________________________________7 l+ t2 Z4 C8 T; q( h- X* N0 ]

8 R6 V- T1 L# Y  Q/ j7 g6 p. wMethod 12
" r5 j( H* g* ]- P# T2 j=========6 k4 x4 l* l- a' `) ^
1 k9 z  }+ ?1 F+ t: v- Y  \# s
This trick is similar to int41h/4fh Debugger installation check (code 05
5 p9 m! v# s  B- N8 ~- `$ q% g&amp; 06) but very limited because it's only available for Win95/98 (not NT)& u4 y! G  V: k8 |, A3 W) j5 Z( l: R
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 D8 a# o$ i: ~$ T4 _4 e: C
" s) _# T2 z3 C' E
   push  0000004fh         ; function 4fh
# f# Y' j6 M: C+ |9 e   push  002a002ah         ; high word specifies which VxD (VWIN32); ^- u8 v+ w8 P* p  I$ U
                           ; low word specifies which service8 k; J( s; m' ^9 Q: @
                             (VWIN32_Int41Dispatch)
, t* m9 r9 b2 m   call  Kernel32!ORD_001  ; VxdCall3 R! {  ~1 T- o9 ?- U
   cmp   ax, 0f386h        ; magic number returned by system debuggers
  g. C( G1 u% {# H7 `+ K# I   jz    SoftICE_detected
6 M: V+ E: ?, Y; V: k; D7 t3 v) @! k+ v: P: T! g3 a. H& e
Here again, several ways to detect it:
# R! W+ m3 h1 E- b% Z$ F1 \% j. B2 l/ d6 C! B& R8 Y
    BPINT 41 if ax==4f. Y: Z. P* ^8 k( @: h8 Z5 J$ ~: x0 I

3 }+ }; _) _2 x    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
. e' e4 w3 @% n3 k/ c8 w
9 Z$ E! X' e' {9 ^8 Q! f! J- ?6 V    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 G" @; c, B3 }/ f
( l7 @7 K& G) M
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. P4 F9 e3 Q& ~/ S0 U1 n% D
- n5 [2 ~- E5 D9 U3 t; l% C__________________________________________________________________________
  e% H5 U3 `, }9 u) x, [$ J4 O" {$ ^
Method 131 C, b  J% @8 F, i9 \. i, W
=========
. q. m7 X5 T) r4 \" |
. a/ J/ V# l' j+ Y. nNot a real method of detection, but a good way to know if SoftICE is" S4 l& d% O, Y& g1 V  M( y+ t
installed on a computer and to locate its installation directory.
3 q+ @; I7 I$ s. ZIt is used by few softs which access the following registry keys (usually #2) :& p  e% C! R. a' Y) Z

" E  L1 _3 B- U) }-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( N; i  _7 ?2 N$ M, s! z  f\Uninstall\SoftICE( ~4 S4 t+ f- ?* C. O
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; B8 Y: E9 }. }* ^# Q/ D  z$ T9 d/ E
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ @# x0 `( s, i/ u! N
\App Paths\Loader32.Exe
$ b3 _/ T5 E* ^9 i! W5 R/ ?, B* E* c

  t! U; ~+ d6 ^; G/ C6 dNote that some nasty apps could then erase all files from SoftICE directory3 \! S0 H+ f/ N! m2 N. M' }
(I faced that once :-(5 k0 y: |3 |# v; K' P% r$ f
4 q. U; p* s! u. u: o6 [
Useful breakpoint to detect it:4 h9 n5 s$ k3 u1 C+ M: k
+ r3 y  P0 L/ |" W* r
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. j: `2 a  A0 B4 N6 ~

, i: W3 L; C$ e0 ?/ u__________________________________________________________________________
8 c% g" Z! ~* j. J' o2 [1 }! o: x' n  s: |+ _- d

) ?$ H! `. m& H9 yMethod 14 0 C2 x: c- E6 T- w: G4 A
=========
" I# V- s1 S; O- L5 e0 N: b
5 @, W% {. E& J, _& i0 m- qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
7 K/ ]( \. y9 F# ?  z" r/ o8 ], yis to determines whether a debugger is running on your system (ring0 only).! n0 o. ^9 L% y
0 f1 r, ?' S: g/ I" V$ J0 u
   VMMCall Test_Debug_Installed; B# a2 n1 Q8 [0 D  R, v
   je      not_installed3 U+ Q: m5 g0 z! E
( h/ F2 a- B- |+ h( M
This service just checks a flag.1 V+ j  y- ~% U9 |( Y- M
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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