About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, ?/ C7 `- s1 n; g<TBODY>: ?! x! J# @! o4 a& j3 W0 L
<TR>
. \- X3 l. g* d. `5 [<TD><PRE>Method 01 " ], w3 |, ^5 }$ ^* s
=========
1 w+ H! A& b- v- a8 a+ n$ m5 {) M
This method of detection of SoftICE (as well as the following one) is
5 v0 `1 \/ x+ i* C% S( D! F# ^used by the majority of packers/encryptors found on Internet.
+ M0 F! D6 x8 ~' J3 E0 ]% CIt seeks the signature of BoundsChecker in SoftICE
3 T% W7 D- Q5 Q' c7 y
! r6 Y; p' a7 l7 X2 D+ \: N    mov     ebp, 04243484Bh        ; 'BCHK'. D/ g* P2 p) j- L! a3 n9 I
    mov     ax, 04h
0 H* r: V0 ?- D$ X; v/ N    int     3      
+ @* U  `& Z+ ^" H% Z2 ~3 }    cmp     al,4% P) K% t6 k7 ~' n. g0 {5 d
    jnz     SoftICE_Detected
" ]  Z9 W$ Q) \) C- J$ E' L$ Y8 s* p1 J+ n+ S
___________________________________________________________________________! T% w0 }! {" L! ?3 G* X
% w8 J" Z8 t4 {( S6 M
Method 02
9 Q  `% V3 Z  x/ x* Q3 d- D5 j2 d=========
3 n( R0 r: Q- }0 p( y' [1 f6 J# c  c+ M, |
Still a method very much used (perhaps the most frequent one).  It is used; R  k2 c2 Y5 g' C2 D
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,' {! g! q  _/ i% j# U1 }+ a
or execute SoftICE commands...
# W" ]  \4 l& J5 z9 iIt is also used to crash SoftICE and to force it to execute any commands
' ^) J5 m/ H. G; R" k& r0 c5 C- B( R(HBOOT...) :-((  % t" Z6 H, d7 Z) U
; r- G1 Z5 U4 A2 }! Q2 ^6 M
Here is a quick description:
6 L' I3 g8 E6 x, ?! F9 P5 S+ u4 M-AX = 0910h   (Display string in SIce windows)( q+ G$ U! y1 T$ V( `
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)$ j8 M' W* Y0 i6 H' f- O
-AX = 0912h   (Get breakpoint infos)
& i" ~; X& l! q4 x- e) G% Q( V-AX = 0913h   (Set Sice breakpoints)
, I# e# G; l0 Y' l$ I. L-AX = 0914h   (Remove SIce breakoints)
* h8 d4 t9 k  d/ Y5 I+ D5 E2 l8 A4 {1 m1 p  y+ C2 Q
Each time you'll meet this trick, you'll see:! }9 N1 l* ~% Q9 a
-SI = 4647h
1 W. J1 U( P8 K-DI = 4A4Dh
5 ~& J& p9 A& P% Q- G2 XWhich are the 'magic values' used by SoftIce.
+ `8 C. q; c+ X: ^7 [7 i- Y* LFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
  c( \: @7 D5 ], \9 Q0 T3 Z
1 I, d! g, K: W- x1 sHere is one example from the file "Haspinst.exe" which is the dongle HASP% h5 Y# s, \" T' b1 b- N  r
Envelope utility use to protect DOS applications:
/ ?0 n) a# R: s
0 X7 G0 R: x1 [0 y8 R: f8 {' @
" y, T* [7 j1 z4 p( S4C19:0095   MOV    AX,0911  ; execute command.
- m5 M" H- U! e4 W: T: z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 N# S3 T$ L1 \, {" J, V3 K' z# g5 w4C19:009A   MOV    SI,4647  ; 1st magic value.! `4 i9 z, Q6 e
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 u: [9 s! p8 d) I7 T* I. ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
; \8 s& |2 ~2 ^4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
% l+ s9 _( Q) c4C19:00A4   INC    CX- S- X+ o9 l: j$ I6 S' J
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 V: }( A. P, u- ?4C19:00A8   JB     0095     ; 6 different commands.5 g. k% Q  M; ^( N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 H8 e: L7 W; t' D4 q. g
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 b9 a+ w& [* I. j$ Q3 y( i4 R& w
, X& ^2 z4 a- ?. Z# B( x8 i
The program will execute 6 different SIce commands located at ds:dx, which
0 S& q+ N8 G2 o3 G) f! k8 pare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 t3 a8 n3 H. q* z% m, @
3 ]! S! L3 h; L& g; Q  m) ^. R
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! |+ F  F  j6 C% x- B8 |' P
___________________________________________________________________________
% x0 P& ~0 v/ I! n8 @: h# J  f; B/ ?; F4 Y
5 k4 w# E/ o% m, f: T7 `8 b* s
Method 03
! D( a  a0 ~6 H=========4 @+ |  Q1 p: b4 \) G) N

# x' \: A+ b, u4 X8 S( CLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
" A9 G- N& J' z4 H6 e( h/ K1 H4 v(API Get entry point)6 L2 y* F# Q- v" {- L
        , t2 X; p6 {, `

6 I, A8 e* U& x    xor     di,di( f; I9 R) z8 u$ G; i, o) j
    mov     es,di% S2 V0 J: C  Y/ m3 @
    mov     ax, 1684h       - H9 m; I8 }9 b1 s9 s7 p. e  y8 K
    mov     bx, 0202h       ; VxD ID of winice: Y! U3 q2 f" Z5 j4 f$ i5 J  f3 {' ^
    int     2Fh: B( h; s2 h$ y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 m' W# Q5 j/ @4 M1 c: l. C  m
    add     ax, di
# Z0 ?( f, _5 g$ |+ H, y* x7 M    test    ax,ax, W$ }" B$ b6 S- c! O
    jnz     SoftICE_Detected
+ B0 x% t3 F+ Y" c7 e4 g8 g- ]' r% b- q  l
___________________________________________________________________________7 I- ?% ?$ I( e/ m/ Q

, _" Y2 U5 a9 Q& YMethod 04
* H+ n- r1 K+ @6 g9 X0 g=========) F5 h- H: h7 L  k! x; ]7 o0 `
" u# `: u2 L0 s- }
Method identical to the preceding one except that it seeks the ID of SoftICE
; G: _# m: L% s9 k$ F4 y' vGFX VxD.
2 K: S+ ?: n$ T7 ^5 j: k( d2 ~0 ]+ n8 D5 R' Z
    xor     di,di% W9 q; C: r  H" X8 F& c4 o
    mov     es,di, I3 K2 p/ @, x9 @
    mov     ax, 1684h      
8 ~: j7 J+ }9 L/ j' H. [- S4 n" C    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ L! G# a8 C0 f* W0 h  i
    int     2fh
+ j5 p- d( D6 A( h' ?* ^0 n% j8 F    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, N* b: x: {% C3 b+ Y- |, s    add     ax, di# U. c' N0 d4 g$ ^; U- n
    test    ax,ax
# x+ _6 u2 h; t! v    jnz     SoftICE_Detected
- p% x: h# b$ U8 ^& {' J( S% ~$ O6 z- v  W- |
__________________________________________________________________________7 Y3 [3 w" M4 l' Y9 G6 Y( l8 g: {) C

( v- n/ {1 {& v9 m; o: R! P$ p5 @
' R# ^* j9 {8 KMethod 05: L9 l2 U6 Z8 L# P3 ^3 h8 s3 L
=========" `5 O. T* G1 O7 o

4 X5 g' E' a5 q5 hMethod seeking the 'magic number' 0F386h returned (in ax) by all system
$ A: s0 \; ]* \7 o1 h, ydebugger. It calls the int 41h, function 4Fh.: Z  [1 V: x3 `8 e/ |! z' B
There are several alternatives.  5 ^( X; T) D& [! K" H& p

/ k0 O4 m4 o5 x7 V2 nThe following one is the simplest:: P' q2 R- g& H/ @( ^

+ t3 ?, X8 I2 I$ t6 o1 t  k    mov     ax,4fh9 a! c. R0 x& A" j, G' @
    int     41h
' l7 v$ `+ f" g& H, h    cmp     ax, 0F386
6 u9 K9 F$ p4 y    jz      SoftICE_detected/ j6 k% o0 W& {6 _3 M) t
8 N5 {4 U7 c* W+ n7 T

. h/ q: z0 l! \7 P6 g" sNext method as well as the following one are 2 examples from Stone's - K; h$ o3 F" @7 F# u
"stn-wid.zip" (www.cracking.net):
# L! u- u8 V; n" k* V# M( Q7 e3 y# E6 H
    mov     bx, cs
+ z& c/ k; F+ x0 w    lea     dx, int41handler2# e" o; n- f. x8 _  r" e$ y
    xchg    dx, es:[41h*4]
# e1 N2 [# a# v    xchg    bx, es:[41h*4+2]
4 W" k  b0 c+ J7 h    mov     ax,4fh7 d' L" w0 P6 ^3 `; p
    int     41h1 b0 U' \1 p1 ]- e
    xchg    dx, es:[41h*4]
' J7 ^6 C! f  r    xchg    bx, es:[41h*4+2]
& F' N* k% V: w9 M0 f: S/ @) v    cmp     ax, 0f386h6 ^' i' Y: I# X4 u
    jz      SoftICE_detected
3 _1 n& G6 X  e6 |1 o
6 ?* M9 L  ]- h( |; z6 vint41handler2 PROC: {3 g. E& D; V' p) ~- i
    iret* t( n2 [( Q8 w
int41handler2 ENDP6 o, F5 a# p" i0 x

# X8 v) b0 Y! L+ L/ g7 k5 ~
5 B4 r* |$ y" `3 {& I- L( h_________________________________________________________________________
# |0 e5 l( i1 ?( N, \
- v! _9 Z3 D* R# Y+ X* R/ {( S' Y8 @3 p% }0 Y
Method 061 z6 s: t3 x. k0 N
=========0 }- C3 o+ ~/ g$ W
" L1 Q+ f9 o2 a8 ]( h  J% K
& v! V& Q2 o6 W+ m6 f4 c
2nd method similar to the preceding one but more difficult to detect:
0 j8 V& D/ T( l, E
% m! P$ L8 Q. l$ E+ w
" m$ I4 [. U$ d& R# ^3 aint41handler PROC' \( ~* G0 r; e5 G
    mov     cl,al
9 a2 F' L0 q; t+ [: A  d' h    iret
! O: J7 n; q, L' F* m  x) |( F0 nint41handler ENDP6 M2 O- H* a; w: L( W
1 _' m9 W6 u& w" A. ?1 ]# e, S
+ J8 r6 P; ?3 S0 {+ |& p  l
    xor     ax,ax
) E7 K) F; |/ R3 A7 H    mov     es,ax
) E2 d2 h  J  V! L8 S/ Y3 x; {    mov     bx, cs' O" K8 ?$ }9 `% p* ~( t, _2 E
    lea     dx, int41handler
, t& ~/ c* T- y' v6 A3 o- C    xchg    dx, es:[41h*4]7 \8 o& g4 Q8 @* {& Q% x: Z
    xchg    bx, es:[41h*4+2]
( N* N+ v$ u7 r' r) d    in      al, 40h
7 {' C3 v4 E. e1 _, u: ~    xor     cx,cx
* _+ _  R* g8 w: i    int     41h
1 E; s% e# K  D    xchg    dx, es:[41h*4]
- S: X8 p+ T" G- _2 w0 _8 g$ {    xchg    bx, es:[41h*4+2]
8 @+ M9 }0 H& ?5 w    cmp     cl,al
9 H6 o+ K. p2 j1 |, M9 o5 H$ K    jnz     SoftICE_detected
1 i/ w# s7 Z) Y& [- `
* _4 v8 ~* |3 T5 ?4 S7 J_________________________________________________________________________: t' R  s# e# K- d% f  J

& G! D+ C5 k+ m; P, k% f$ {, n" xMethod 07
1 _% q; ~$ C  f=========1 w/ K& j  z" d9 l4 V/ J

2 i! D3 ]$ m5 Z3 j% B. z$ KMethod of detection of the WinICE handler in the int68h (V86)
8 H3 |4 J$ ?0 K* v% Q' A
, ?, S: t9 c( u    mov     ah,43h
4 K! G* u' U9 V5 m    int     68h
& c- A9 \6 k1 s! g" q& j8 D& D    cmp     ax,0F386h
: }3 D# F  E: h2 C7 T4 H- [% v    jz      SoftICE_Detected# j" _6 Q1 B1 [8 S. y' H6 o

8 u+ a3 y9 R1 Z# z! p- C* {* K7 N% Q" U4 ]3 m& V5 Y
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 W1 L+ ^4 [- k  B3 g" I  _
   app like this:
  r6 h' h. A$ T$ ]' g9 l) C/ Y
- _' x* c$ k$ F$ z1 [' ^   BPX exec_int if ax==68
5 {+ |+ ~- m- {6 |! M1 z   (function called is located at byte ptr [ebp+1Dh] and client eip is
# n. k' y# I- U* k" Z1 P   located at [ebp+48h] for 32Bit apps)& w/ ~+ J0 m* v, I( \  _
__________________________________________________________________________3 E9 I7 k3 `$ m/ ~4 g/ T

0 {; I1 Z- O7 u- e
. q$ o$ t7 Y, D. gMethod 083 i3 z4 E" j- i4 m, S0 R
=========
. ?9 c* J6 K8 X5 }
+ |/ D" T& l6 w' v0 A+ aIt is not a method of detection of SoftICE but a possibility to crash the
# K" K, W: z/ {0 a: O1 Vsystem by intercepting int 01h and int 03h and redirecting them to another
* J  T! W) G0 croutine.
2 s& j* d% _( Q1 ]It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ n! _0 R$ [! X9 ?6 P/ yto the new routine to execute (hangs computer...)) |6 ]& F6 t) t9 \- T. H
) c: v- F( I# n. z
    mov     ah, 25h
0 \( Y$ l0 U+ N    mov     al, Int_Number (01h or 03h)( U! w  j+ C7 M
    mov     dx, offset New_Int_Routine/ B( D& X) z: _/ i' s6 o
    int     21h' d4 h1 `3 R: ]0 M4 o9 L
" J4 ?' S/ D3 W
__________________________________________________________________________( |* u/ v4 T; J1 [- ^3 \1 E

, W- o4 T" A0 v1 l: tMethod 09
! d1 \; o  i! f  _" t) H$ H- f=========" ^% |) z* t% E7 |1 c1 W
- H$ l: @& y8 l! Q* {  d6 X
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: p+ a. D% l, t9 w" S+ g
performed in ring0 (VxD or a ring3 app using the VxdCall)., s# G( P- }) F3 r) w" S% ]5 [, `. ?
The Get_DDB service is used to determine whether or not a VxD is installed
3 U& \0 Z8 B) ?5 I' |' {for the specified device and returns a Device Description Block (in ecx) for
$ v/ G  G) D- h1 e, f, N( i- Jthat device if it is installed.8 R1 v5 D" \, \3 a6 o
2 _) z* _4 b: K$ I7 ^% w* g
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ A; z% `3 K! D3 m) a% Q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# J) f' s' X9 N" U% w   VMMCall Get_DDB8 t1 Q, A: p! l4 g+ E5 q4 s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* j# m: O1 `. _% N' ^8 Q# [9 ]0 q# V% B  y
Note as well that you can easily detect this method with SoftICE:
) n* ^. O. |3 C3 H   bpx Get_DDB if ax==0202 || ax==7a5fh* v1 X# `* p  K: M- D. Q
5 g0 [: H, m" T; |. T
__________________________________________________________________________7 z) @6 X! H4 ~; B

" k6 {! X) V1 Q, W/ u! vMethod 10
2 {  O" U5 [% V; p0 Y8 K8 e=========; Z. k! e5 o1 ^
, i* ]. g7 S+ _) c- s! D
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: ~( Q& [" d3 D! ~  n0 N
  SoftICE while the option is enable!!" H3 U+ y/ R8 u# r9 J

' u% M9 A& k1 C5 V+ t2 f5 ?This trick is very efficient:
6 T  |% V( B1 \* S/ @; k4 xby checking the Debug Registers, you can detect if SoftICE is loaded+ m0 h* H* F! m( s
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ o# _8 b6 I% c! n. S% Pthere are some memory breakpoints set (dr0 to dr3) simply by reading their
& N) m  `0 B3 s" ?value (in ring0 only). Values can be manipulated and or changed as well
% J. g; F: L0 T( X4 W(clearing BPMs for instance)* t0 y' B' d9 u  J2 Z* \5 D
5 m" z" f2 I; s! g
__________________________________________________________________________& a% p- ^4 H: u( A! n. {

$ E/ a/ S( a- k' bMethod 11
" h5 O7 N- u$ k0 Y+ x# J9 f1 b=========
/ [% B0 t" I7 W4 a$ F
& x$ w9 X/ s, u3 [2 S* ?' L& }# bThis method is most known as 'MeltICE' because it has been freely distributed
2 D4 h1 A0 C+ z: F$ o+ yvia www.winfiles.com. However it was first used by NuMega people to allow
0 _% B2 m# y) Q/ m) V( ]: lSymbol Loader to check if SoftICE was active or not (the code is located. u  q- N; {6 @! b7 E
inside nmtrans.dll).
- H. e7 f* s8 E  N! j* B! }
" m+ }* u  D& Q% m( U1 \The way it works is very simple:: m; b% P( p0 _+ J4 Y. e& {
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
  }0 \0 k  O' q) |WinNT) with the CreateFileA API.
: ?9 L; S- v9 c" E0 V# E$ F4 [# d% `8 d# b. o
Here is a sample (checking for 'SICE'):3 ?1 p' Z6 c  w7 X- W- l
* V# l  J3 m. W8 \8 B. Y
BOOL IsSoftIce95Loaded()" [! y  A) o" ^4 N3 d0 e
{" B! G3 Y3 N% M$ }; l: B
   HANDLE hFile;  5 y  [2 M8 V- F6 `0 A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
, @" T2 f* t) D' j! y                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. o; U: N- d- C2 u                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ q! j' i5 J" ^$ o& K! u7 Z
   if( hFile != INVALID_HANDLE_VALUE ), H2 i8 l4 v9 ?
   {5 y  r1 h8 T/ B- O- S8 s; L/ k
      CloseHandle(hFile);0 e) K0 a8 ]/ f  Z
      return TRUE;
" s1 H- S: z" V( L% T   }1 u; ^/ m4 G' d' G
   return FALSE;
6 j7 y5 }2 P: ~3 T- s}" d$ Y* Q8 a4 K
: t1 r! }( j4 Y; h6 @
Although this trick calls the CreateFileA function, don't even expect to be
$ ^& o- G; k* ^' c3 Mable to intercept it by installing a IFS hook: it will not work, no way!
- w' e6 M$ x3 A. v+ WIn fact, after the call to CreateFileA it will get through VWIN32 0x001F* V9 P& ?4 T' a* v. p; b6 P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). v) X  n- }: C4 k0 _# x0 o
and then browse the DDB list until it find the VxD and its DDB_Control_Proc, ^- C( ?6 m0 L% j- @
field.0 h# g: f* R% Z( ]4 V7 b, e$ [
In fact, its purpose is not to load/unload VxDs but only to send a
. Y/ l# c0 p6 g9 M, gW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 t  g5 o+ |" w: V. |" Y' Q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 g9 P4 P7 q. ]$ `to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) N: D6 M/ I& j9 W. EIf the VxD is loaded, it will always clear eax and the Carry flag to allow
' b+ v- m! Z" t* {9 b5 K, Hits handle to be opened and then, will be detected.8 C  y! h  ~8 c% X/ O$ W9 y
You can check that simply by hooking Winice.exe control proc entry point
6 s  c: M( \2 v4 h. [; d4 Rwhile running MeltICE.! [- N+ E7 v! _, _: F. D

8 j# R# P7 T; Z# `$ q3 D( t) ^0 |# P4 L$ R" j; x
  00401067:  push      00402025    ; \\.\SICE4 I* e  A! Z# F; r% b/ D. r
  0040106C:  call      CreateFileA
$ ]- T, l1 o( ~/ h. q  00401071:  cmp       eax,-001
6 z! y3 M1 _1 L& p1 u! `  00401074:  je        00401091( K2 A" o/ \  K6 u. S
" L# B" V2 {3 c" G/ n
/ j0 \$ t( R% w  E4 N) D# j3 E
There could be hundreds of BPX you could use to detect this trick.' ^' ?6 ^8 @! I, Q6 a- Z
-The most classical one is:  G$ J- r* {( T5 C$ y
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 B  a5 ]8 l& D( f3 W: B8 _' R
    *(esp-&gt;4+4)=='NTIC'2 O# K, {, a4 M$ f: Q, @

, }0 B/ Q" @( K! P, ~-The most exotic ones (could be very slooooow :-(6 F, L0 z4 b7 {$ \$ |& n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! C& N) C# e3 g( A% j
     ;will break 3 times :-(( I1 V) W: }. q5 [$ B$ e+ h& s  `3 s
! v: A& Q% D) G, R- }# a- l$ j
-or (a bit) faster: 1 m' h& O, {; m/ O5 f
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- m1 h/ W, e" k# n7 U; U& a8 }, i
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  " u; f1 j1 G( {5 h8 f3 T; l
     ;will break 3 times :-(
8 S5 D; L; H, S% M- F  S
% `7 j, |1 ?% n$ b: g2 }-Much faster:- [& O: F. Q5 j$ Z8 ]
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% l/ R. K9 i* K5 B2 a5 C

& _5 q  f% D) G2 FNote also that some programs (like AZPR3.00) use de old 16-bit _lopen" G2 y( {: a0 d
function to do the same job:# y; m. O2 l7 J$ I4 C9 y' x/ N/ Q

, `* t6 [5 a* t. p9 X+ F   push    00                        ; OF_READ& h/ {0 w/ F. R2 R- `# C2 a
   mov     eax,[00656634]            ; '\\.\SICE',08 r$ |# U7 a, [9 s: L% D4 I" ]
   push    eax' w. f; Y, A+ ?3 t  L
   call    KERNEL32!_lopen
" i5 E$ D. {: G6 m% Z   inc     eax
1 c1 Z/ V# L& r& H$ g$ f0 m4 e   jnz     00650589                  ; detected- A0 T' ~1 e# s. Y( y  `/ w6 B6 w
   push    00                        ; OF_READ
4 k* W7 t. l7 U1 r0 U( J, R' u   mov     eax,[00656638]            ; '\\.\SICE'
) i! `; Y/ G0 |   push    eax
8 V4 q2 z$ {2 |5 \# b$ ~   call    KERNEL32!_lopen5 N6 ?' [& r7 j0 {9 u" r
   inc     eax
2 L5 v* x- S! G2 P8 @2 V   jz      006505ae                  ; not detected( D! E6 q- X! s5 a$ z

) |$ e0 Q- c0 ~& v6 n# q
: D, l5 W" d8 f! @" J5 N2 V__________________________________________________________________________
& ?; o$ q2 x0 O
- |5 P, V9 c5 Y  h9 T! D4 hMethod 12
( j1 ]- q+ M: \- d; m=========8 d* Z9 F, R% Q' |
2 i  c1 n1 f4 U9 P
This trick is similar to int41h/4fh Debugger installation check (code 05
4 J3 p, N& ^- K0 k  u0 X&amp; 06) but very limited because it's only available for Win95/98 (not NT)1 ?5 n1 @8 g  h! w& i0 z2 C
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 L* v" P5 b4 F5 n8 }- S) m; B# C" X: a
   push  0000004fh         ; function 4fh% e# a: M6 [5 I+ @2 E9 m
   push  002a002ah         ; high word specifies which VxD (VWIN32)
. A5 Q) ~$ J" ?                           ; low word specifies which service
' B. Y4 y5 ^  O+ G7 w* n: \: V, R                             (VWIN32_Int41Dispatch)2 f* [0 ~' V+ ~) H4 w* @
   call  Kernel32!ORD_001  ; VxdCall
( A  @5 `; r( Q6 [   cmp   ax, 0f386h        ; magic number returned by system debuggers
8 n2 T; _- H0 q5 y# S   jz    SoftICE_detected. i/ d: Y2 j- C7 R( [# u
# _- V  T/ O, N- S( P
Here again, several ways to detect it:5 U( m# y" M& B
/ C$ y9 q9 v9 L" s( A
    BPINT 41 if ax==4f
' Z$ x9 }6 H/ ^6 x# e
- K. ?8 [" r* h5 }, n. }    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" `) B2 R3 y" t( ~2 D

  m  W' n( _3 J8 G9 F" Y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 S& Z( j3 x0 k; R1 t8 t- \
' l4 y& D; q$ Y1 k- K6 n2 n, y4 e    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) G; \0 {6 v6 T) e" T8 ~7 g$ R

7 k6 n: o, G. h! A9 w, t# o6 n__________________________________________________________________________- {3 B) m1 X/ W; [4 J: R

+ W/ I! |3 d8 P/ h5 |. B$ PMethod 13
! h, L' N5 D+ A/ k=========
7 x, ~  X+ H0 v* h9 B+ ^4 f' l, Z0 C! M
Not a real method of detection, but a good way to know if SoftICE is
# d$ J* A- N0 J0 C- J9 R, {& Vinstalled on a computer and to locate its installation directory.
. f6 j1 m- P" m# C' \( H3 w& Y- o8 zIt is used by few softs which access the following registry keys (usually #2) :& d0 l7 D# _3 c

" D6 D1 s- r6 k8 G-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ b5 Y% i3 y) l1 }! F\Uninstall\SoftICE; J6 m; d/ d; g) [- k
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE/ _" n3 r0 j0 b4 U! S% T
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ t+ D5 o3 Y4 T\App Paths\Loader32.Exe
4 {: P, Y" J8 G9 \; f+ B+ n9 g0 Y, O0 h; N4 V" g8 h; o
. U3 z" R( m' ^9 }5 d+ T; T7 m
Note that some nasty apps could then erase all files from SoftICE directory+ S. c( \- n% @1 N0 u' k
(I faced that once :-(/ `! d2 {( X# a! l* y

5 H& N& ]2 o9 j8 ?& OUseful breakpoint to detect it:
  A7 v$ x6 Z+ J" U; }+ d; V9 D, m  B/ Y$ Z- q$ E6 S. T* S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ U& W' Y! |$ D5 E0 O5 T% |9 [9 u% a9 T' l$ {# N8 `/ N
__________________________________________________________________________6 q, O6 H, o3 h8 u% a; Z
  C2 ^3 W) x0 l) W4 m, x

( [$ K) X: l/ u0 uMethod 14
4 |, ?+ f3 ?. q8 A$ S/ w=========1 O) J$ Q# p; Q- a1 r
9 Y- a, v; c. a2 ~' [9 Q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; F8 t4 k0 w1 }( nis to determines whether a debugger is running on your system (ring0 only).( s  v! Q7 A( H" \" i: H

! t- u& C5 A& Q  m- `   VMMCall Test_Debug_Installed1 |7 r9 K5 }2 }% W
   je      not_installed; B, `) `7 m  u: Y
) t$ W7 X, E) Y/ `
This service just checks a flag.- W& t: X# i4 s- n$ R
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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