About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 h. v& R- g3 B* K
<TBODY>2 m2 B3 a' q2 Y/ q% h/ N
<TR>
3 i1 J9 {7 h- U6 ]4 J2 j% N/ K<TD><PRE>Method 01 4 a9 R3 o: {; _
=========# r9 c' F" A; K% @9 M7 ?5 M

& f/ g4 r8 K$ y( x1 y/ JThis method of detection of SoftICE (as well as the following one) is
: r: q& s3 E: }used by the majority of packers/encryptors found on Internet.
$ `3 U$ j6 |' d# }  w) t. ]It seeks the signature of BoundsChecker in SoftICE7 `) V2 @, f4 {: K

" b" B1 W$ x6 L7 m    mov     ebp, 04243484Bh        ; 'BCHK'# i8 a! d% U' \2 u
    mov     ax, 04h6 D% B; I6 t+ j+ m4 t- u4 o0 {
    int     3      
! }; c. I7 L& y# M) Z7 n    cmp     al,4
4 D3 `+ ?$ X+ r( z    jnz     SoftICE_Detected! ?0 ]% u+ `3 D8 t# Z/ p8 E
- z& q5 Q8 E, K0 n7 b- S
___________________________________________________________________________
2 `# P9 c7 b% [1 Y$ R) N1 w' z
% f6 r! r% [* L  p* _) T. nMethod 02- _5 Z' f/ x$ h: {3 P" n8 a' N
=========
. \* d: ^, x1 |8 u( z8 o5 v. j9 f; N
Still a method very much used (perhaps the most frequent one).  It is used- K. G& ~" T' b7 h) }* T" b
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 _4 E5 u1 }, |8 r: U/ ?& J
or execute SoftICE commands...5 Q+ z7 A& F, x+ S% V+ i
It is also used to crash SoftICE and to force it to execute any commands
4 }, q$ E2 V* S$ M! w; d5 G(HBOOT...) :-((  5 O9 b" z2 F7 N. R

4 R5 H- K! T$ L& Z  YHere is a quick description:
" p! P( S+ m* E1 d- d# n-AX = 0910h   (Display string in SIce windows)
; g0 b: S) |% \) D) `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& O3 S% t5 W: i& h$ R# X, b
-AX = 0912h   (Get breakpoint infos)' A. j- b, H; j. }( M$ R
-AX = 0913h   (Set Sice breakpoints)% ?" r! G) k4 a6 \, t
-AX = 0914h   (Remove SIce breakoints)
8 T2 g. \  ]5 S& s1 h, P! {8 v+ _6 _
Each time you'll meet this trick, you'll see:! V) Z; r6 l7 b3 A. h7 v( s* ]3 D
-SI = 4647h
; [4 m$ j2 T* L* Q: u  u-DI = 4A4Dh* ?# A% I* r; @3 P) Q/ ~2 L
Which are the 'magic values' used by SoftIce.
; Y% [: w) u5 ~; t6 [0 |For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 u8 ^; ^+ v& ?0 ^! l& E7 @
) U7 A/ C4 y3 j+ F7 f: P, ~$ h
Here is one example from the file "Haspinst.exe" which is the dongle HASP* _0 J+ C; ]) l4 x! m
Envelope utility use to protect DOS applications:, D% n3 I; K, O1 i* A4 }' B
$ G5 @7 x* |4 I6 p, ^* j" r+ m/ F

! y" v, p4 G% A( Z4 U4C19:0095   MOV    AX,0911  ; execute command.6 g9 A, u+ ?/ o1 z. u9 M8 R
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, ]" h* z' v0 p% G4C19:009A   MOV    SI,4647  ; 1st magic value.
3 L! J- Z& e+ v0 Q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" {$ [( A3 h0 R: Z4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& s6 V1 Q, g8 I# y! e
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, }/ G. D- ?( f4C19:00A4   INC    CX
4 ~) d* n. s: E7 u- c- W4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute4 m% M" P5 ?* D( j$ l  x9 Y0 N) A
4C19:00A8   JB     0095     ; 6 different commands.5 C9 W2 K9 W0 M; b6 v+ W
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: T* U/ W4 M  G! T9 J8 f) W
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% {: o0 {* x0 ^! n" ~+ L6 F6 e% G! T% K- V1 j; t2 x2 }( W( l
The program will execute 6 different SIce commands located at ds:dx, which
3 q5 K$ u* E  b' o! A: qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.# D; B7 `& U$ b: a7 U

1 g+ j: h/ c3 B3 }; Y" l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- j3 O, Q) j0 _0 O, N
___________________________________________________________________________! E2 P" G7 ~2 |- s% j8 b" F- x

, t; k: Q6 s" N0 m% g2 e2 ?& |/ x' y0 U" m
Method 03) I, E9 D4 I* r% D
=========# o6 U3 M8 |, ^5 s
& d7 k% c1 T) Y7 a
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( S* a. t; V/ F' N! D- b
(API Get entry point)
' i. k1 m0 W  `5 K7 E# D        
; B0 D( S0 D( @* _' {3 _
: b3 s7 \$ e( K' M; h+ [    xor     di,di
8 _: s2 T! g3 R) m* a    mov     es,di# p# N4 R, p5 {) ^
    mov     ax, 1684h      
$ ~+ x/ d8 B* x# s1 o    mov     bx, 0202h       ; VxD ID of winice
9 ?, V: |0 u( h* M& L$ @  g2 F# Y    int     2Fh  a% V% ]" D  o* O% J! c6 _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ e- ]3 T* i$ g1 C$ S7 n
    add     ax, di  Y: r) p; L1 |3 y1 ?# _' U
    test    ax,ax3 U2 M" ]2 M; P  @+ R3 j
    jnz     SoftICE_Detected+ k% g% n1 v. x( l7 i

! C, s; m2 I  e' ____________________________________________________________________________
/ G) c$ X0 t) z6 k, H9 q7 h. U
9 U3 V& Y" o5 j7 m- Q/ sMethod 04
& F, l/ o) f* g, H; |; U0 N5 {$ E7 Z0 W=========! [7 P& D+ |2 a7 B2 s& a7 L. \

, W& T' Q/ P3 Y& z7 LMethod identical to the preceding one except that it seeks the ID of SoftICE
. d( p/ L* B9 }. j5 H5 PGFX VxD.* Z* R: Y& A6 `% j8 g3 _5 [

  ^/ R& U" Q2 O" y  |1 ?    xor     di,di3 n& ^' v  U/ x* S9 j
    mov     es,di
3 {& R" l6 n, ?; `    mov     ax, 1684h      
! N  F; }% w  Q& k* U2 d    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ Q* j& B0 G2 y: {* E6 K    int     2fh
4 R# l! o. M4 |0 g& G    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 N' ]6 v, L7 {6 j  G6 l5 v
    add     ax, di
9 K1 z! N' g8 ?2 F  E    test    ax,ax5 K* p1 }  O- j: K& @9 n) U
    jnz     SoftICE_Detected! P* C7 x, t/ @' `7 M

8 O. i3 e* \4 _  p__________________________________________________________________________# V7 f* A% A8 y( m$ d' v9 A
! k, f' Q* C( r% s, d

* |; @5 H# ~3 xMethod 05# d4 Y' X/ n( [$ o: ~
=========
" @7 u8 J: F; z' @# {/ J  \
. n6 d5 {! h& a$ X2 F# {Method seeking the 'magic number' 0F386h returned (in ax) by all system: _$ P$ E) \# b
debugger. It calls the int 41h, function 4Fh.' K( F6 X/ |& k* q
There are several alternatives.  
- V- L% H8 O6 G1 f0 b. j$ U. Y& V5 W, K# w. k2 W; t
The following one is the simplest:
4 t* @$ m" [$ W7 L) o% _
# Q5 S) V5 H+ x1 ]  k5 q    mov     ax,4fh2 r4 A4 |: G, x
    int     41h, }7 h9 ?" R2 C( }
    cmp     ax, 0F3861 n  I# z6 t! Y' @3 q" j$ x
    jz      SoftICE_detected
" }# s* V: S/ z1 X0 |, W# v! t9 ]% {; R( b
+ H# F- B1 S' b9 J4 W( p. \. @9 Q
Next method as well as the following one are 2 examples from Stone's
8 M5 H, S" Z: w/ Q. U7 E1 q( w"stn-wid.zip" (www.cracking.net):) n3 J+ B5 ^4 j( F

  I2 I  Y6 s5 |* ^8 J% c  B% L& |    mov     bx, cs1 |- r8 t4 S5 V' V- X- N, U
    lea     dx, int41handler2( o. o8 g/ G1 M2 f
    xchg    dx, es:[41h*4]: u8 ?4 j  z1 y" x  I
    xchg    bx, es:[41h*4+2]! l3 a# V7 c. g" p  D% u% S
    mov     ax,4fh
' `. o; ^6 X7 V4 N+ ~9 {" d3 l    int     41h9 `0 `0 e3 a  |1 P+ {: u6 x
    xchg    dx, es:[41h*4]
3 N7 \; O* |7 P1 g& Z    xchg    bx, es:[41h*4+2]+ ^* A* G  Y0 K  |
    cmp     ax, 0f386h& ~1 c+ H; Q, L8 ~% }, I
    jz      SoftICE_detected
& ~( }/ E- g( S4 [/ M
" J( K" K9 S  V( ~" Yint41handler2 PROC) y6 D8 D3 z4 K/ u5 c' k
    iret1 O  v" f! ~0 T1 e8 Q
int41handler2 ENDP
! m) z0 v# ^1 C
3 ~; }4 W  r, L7 p; m
, o1 F# `% E  R; Z) {0 }( a+ b- `_________________________________________________________________________& @) K# \" g+ g  q% S' W

! [& A- W) o9 s$ S% j, ]; J5 `' z0 v! W5 L4 w4 d
Method 061 Y$ F7 \& I" l/ P) X# T( L
=========' k! y% N+ q1 r2 @$ N' a9 [

* j  ]6 |/ s5 H) N5 E( G1 D: E% j! G2 M* g9 s. ~' `
2nd method similar to the preceding one but more difficult to detect:
. Z" B( j* u7 X" b% y& @
5 g- v" F: v' |" |
2 j: o8 n. t2 E# Eint41handler PROC4 r" V2 v8 B- e! u0 W
    mov     cl,al
( \$ N2 [8 m5 M2 z. g  |    iret
8 L6 _/ l8 i! {* b& u$ ]int41handler ENDP7 H  ^) ^% X' x% g! s# O
/ m1 m- f/ Y7 M$ y1 R

7 @, L  z7 J5 W, K) j    xor     ax,ax
7 d0 ^- Q4 U& ?) p- g    mov     es,ax
5 \. v1 h6 M+ l    mov     bx, cs
' _  j7 ~) x9 l, Y    lea     dx, int41handler3 J- L+ ]* }& w( }$ u
    xchg    dx, es:[41h*4]
, d; L) w4 M: Q- m4 l$ m    xchg    bx, es:[41h*4+2]# R' }  \4 |. X
    in      al, 40h; v. c( R+ H- X1 e6 e
    xor     cx,cx! {7 l; x' {7 g, b
    int     41h, `6 O$ r2 A& V' p
    xchg    dx, es:[41h*4]
" x& }9 @# |6 i2 n) o% ~    xchg    bx, es:[41h*4+2]
- T) j: }; W" A( h1 Z  k2 z    cmp     cl,al
/ d8 n) q0 a6 n, O# v8 X& G4 ^9 g    jnz     SoftICE_detected
1 |/ A) W5 A; B# J& v3 H/ O3 V1 V; S" |
_________________________________________________________________________
, l# Z4 Y) |0 [+ D( L% X' Y. Q6 O, W- P; |9 Y) I* g2 o6 q
Method 07! F/ v: Q' |0 N8 M4 k0 u) `5 J+ i/ G
=========
2 F2 e0 @0 X1 D+ K5 @9 E* w9 W, x$ _" E, F- U; E! L% }% T$ }
Method of detection of the WinICE handler in the int68h (V86)
# E1 T8 G1 ?. Z- V
3 R; w3 \/ H4 b; b$ Z; j    mov     ah,43h3 D2 u+ k6 y- t+ X3 X
    int     68h+ @! k1 O) v+ p
    cmp     ax,0F386h
. n) a5 [* Q; f* Z* [. O    jz      SoftICE_Detected
( v. J2 p* R/ {! P: m* w7 r) K4 m3 \" [
9 {, P% ~, R" {5 c7 C
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: x! k; |$ M8 y: K+ V5 _- E   app like this:
) _! x( \8 d4 Y
% U. }* j8 r; g. b; @3 |% ^   BPX exec_int if ax==687 m7 L/ J) S/ @. B8 u- o6 v
   (function called is located at byte ptr [ebp+1Dh] and client eip is
  {. }1 @! \8 F/ U5 c   located at [ebp+48h] for 32Bit apps)
3 C9 A3 `$ ^+ Q& d6 ]__________________________________________________________________________# D2 z2 Q7 N  s2 p
# I5 W0 ~4 L! x( e1 c$ b
3 y0 K5 A3 O. i$ [5 T! N4 d
Method 08
5 M* {8 i* P2 @4 q! v; G* x=========7 f4 }( b" ^% l4 }2 b2 b2 T
( y! n5 @6 u: s/ V0 `! [
It is not a method of detection of SoftICE but a possibility to crash the
! i" U! P! p% s- Y: Isystem by intercepting int 01h and int 03h and redirecting them to another
$ q! e! v( h1 Iroutine.
, o8 a. W2 s1 JIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 k3 G- H* R" G! Nto the new routine to execute (hangs computer...)+ k) W% X+ N6 v( M: p8 }

! i; p: k, X# ]! O6 C" F% Q# `    mov     ah, 25h$ p. U) O" U6 V8 K' ]1 e7 F+ \
    mov     al, Int_Number (01h or 03h)9 U9 U  y+ N; i5 D$ [
    mov     dx, offset New_Int_Routine; F& H6 C/ b2 P" ~7 M: e
    int     21h* o6 f, w8 \% g! h' A( r3 x) r9 o

6 j# G, e& {! ^__________________________________________________________________________
! k) v3 u/ ^6 [  X) ^( R% c' e7 W1 a0 k5 C5 f, y  d+ [
Method 09
; S: t4 ?' @2 O2 F# s0 j# k" t) `=========7 b  @% w, h. z- d+ ]+ p
( E( ]4 R& X9 U' v: M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% N0 ?$ w% \( J' s2 R0 Kperformed in ring0 (VxD or a ring3 app using the VxdCall).
. W$ Z* U. T9 C# KThe Get_DDB service is used to determine whether or not a VxD is installed: L  f. A% \& j5 y$ P
for the specified device and returns a Device Description Block (in ecx) for7 V- Q- f" l. e% r5 G) N
that device if it is installed.+ W0 w8 o% e1 |- G6 v1 l

0 l  c/ m& A' T. ~$ [) [+ f   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- l; q% X, a6 `' a0 k: A$ `   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; ]6 R+ L% i' H; C* b: u   VMMCall Get_DDB) P  n' [5 o9 P
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! d% M) ?9 ^: h# ]

" [/ r. o* G6 LNote as well that you can easily detect this method with SoftICE:2 [" }: F0 \# x$ y1 S' w" A
   bpx Get_DDB if ax==0202 || ax==7a5fh
) l" ^# d0 b! D) `  W" }3 F. {$ i( d9 O2 ?4 f! d! N, F
__________________________________________________________________________* B  C6 d- |4 C, \- v) m* }% L8 b
( G; z0 u7 ?+ }0 G' [6 t7 c1 w
Method 10
* s* `& O) V( f8 @=========
4 i. y5 }: v! W: m& j. s  T! T. u2 T. S7 M# F( G! z
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 w! O: n4 A. m. g! |- Q2 n  SoftICE while the option is enable!!' c; Z+ x! e# {6 P, j' X

( `  a0 \5 p7 ^' ~1 FThis trick is very efficient:
  L. q; f! R6 L: z& P6 cby checking the Debug Registers, you can detect if SoftICE is loaded3 t6 I& M8 x. v6 y
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if7 \4 Q1 p7 p& A4 Q1 r
there are some memory breakpoints set (dr0 to dr3) simply by reading their/ H/ D/ H& y1 I- p! w: D
value (in ring0 only). Values can be manipulated and or changed as well6 C# I0 b1 Z! P" m
(clearing BPMs for instance)  s3 n- @9 S: }" n! Z, X* j

; Y2 b. |$ b" r, u& V. X5 ?$ W5 M" `2 d__________________________________________________________________________9 K& T; q$ Y4 s9 W8 d6 k8 @) l% \

- V: L6 J7 x0 y) ^. DMethod 11% Z9 B# M% R  h6 u4 c
=========9 u$ p" b8 k3 r' n: j
- i& ^' K8 r, n0 T6 B. h6 p
This method is most known as 'MeltICE' because it has been freely distributed
; ]; ]% u8 R1 l! v3 a+ ^7 |7 K6 C+ Zvia www.winfiles.com. However it was first used by NuMega people to allow
! w2 g* K/ G: h( o1 E1 MSymbol Loader to check if SoftICE was active or not (the code is located
9 M) y; r  d) ]# Iinside nmtrans.dll).5 R: F7 c4 G1 Z" v" Z; r

) P- j# x' j7 j. w# DThe way it works is very simple:9 W9 V8 X0 F6 c1 [
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% m' J; f  {; P; ]) yWinNT) with the CreateFileA API.
, [) j8 f8 F4 h  Q$ i! I# u& b2 T' D! G! |4 I7 i2 ]* @
Here is a sample (checking for 'SICE'):
' a! N+ n2 U6 E. O) g" ?
$ z0 p5 ~- e3 R& P6 SBOOL IsSoftIce95Loaded()
( }" |* E2 e) I1 }{6 [; ^6 k) h  i
   HANDLE hFile;  
3 O( g9 k2 A$ {' O2 b% B   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 D) V& r  m6 t' S: p                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 X2 N. K, f# ]) c. d
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ j: O, C& }7 o/ b9 a& ?, C   if( hFile != INVALID_HANDLE_VALUE )/ B9 B3 F# D4 R5 e4 [
   {
' K9 j/ _6 V5 u3 X0 w3 q      CloseHandle(hFile);
; C* s& y" `7 l* r) o      return TRUE;  F. @( v: O0 P3 ^  S
   }  ~' k) M2 U4 O4 m; @" |( }
   return FALSE;0 T/ G: w  P/ ^, I
}4 [8 C0 }* I3 `- Z

- {4 C4 R. K3 rAlthough this trick calls the CreateFileA function, don't even expect to be4 d1 m5 R* V& l7 V$ v
able to intercept it by installing a IFS hook: it will not work, no way!
2 k9 U" h2 j$ Z7 m8 v6 BIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
' P; j& r: S  Gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( E& W6 M: e6 A3 Kand then browse the DDB list until it find the VxD and its DDB_Control_Proc) h- K/ Q2 J! }
field.' S! I2 I1 i( Z5 b6 \- y
In fact, its purpose is not to load/unload VxDs but only to send a
0 T/ S1 D4 G9 Z3 y2 |* GW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% c# L8 H" o/ }! Mto the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 U% g0 Q6 ]+ K6 l# B& sto load/unload a non-dynamically loadable driver such as SoftICE ;-).6 F1 V3 g( S. |
If the VxD is loaded, it will always clear eax and the Carry flag to allow4 }  |* k5 Q) d) u
its handle to be opened and then, will be detected.7 X, u/ H8 G7 u0 t, b0 E
You can check that simply by hooking Winice.exe control proc entry point; ^' Z5 o0 F+ l8 y. D
while running MeltICE.9 L, P8 G' i) l4 s- ?& N
5 ?: X0 Y0 K+ v6 P; k; @2 q
) r& t# X- ?* V* S7 x$ y
  00401067:  push      00402025    ; \\.\SICE
; i1 Q: z3 |. F2 f; T  0040106C:  call      CreateFileA& h- O! C  w" @, U2 ?
  00401071:  cmp       eax,-001! ]* }- N& {8 N" w% Y0 [; @  v5 a
  00401074:  je        00401091
4 i5 w2 @8 d' W2 y, p2 ~' }! q
  b7 m- O( D" R3 y8 v9 Q2 F& m$ A4 g, m" L! A
There could be hundreds of BPX you could use to detect this trick.
6 Y  n% r! n4 W! i& h-The most classical one is:8 U' x2 k8 }6 ]. @% A! l
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  }& S- s! R8 ^2 X3 l& K
    *(esp-&gt;4+4)=='NTIC'; n( d/ D. C8 ~/ j

" N9 d3 |8 h* |" E: `" j9 I-The most exotic ones (could be very slooooow :-(- p- e0 G( s$ S3 e, u) J+ U: B
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  q6 k9 x  ]! ^: F6 e: d$ i% m1 b     ;will break 3 times :-(- F% x0 c5 U! `3 |9 T

6 g1 F3 X, s, S/ h-or (a bit) faster:
# V0 h& A/ }  o! [/ @8 _: q) X  C   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 x$ X6 o1 U4 Q$ r. `1 Q( Q$ J4 n
) }9 i4 }* D- x   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& b/ A* {1 T: P     ;will break 3 times :-(( s6 h+ O2 y9 e) }1 X8 K
9 U0 r, `9 _6 c. W7 d
-Much faster:& U& }6 g; N- k" O- n, F- o! U2 v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 [9 |  o4 S0 O0 e. Q5 C# E
3 N2 U; R; D! T; _9 O: n8 h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 W% c! g% x/ L; n/ h0 B
function to do the same job:  ]5 t" [  H; P9 ~( O

  i) B$ |, e- v8 q   push    00                        ; OF_READ4 d4 z) V# p# n
   mov     eax,[00656634]            ; '\\.\SICE',04 F/ [% T1 V2 R9 R0 I+ S/ k+ D
   push    eax
2 p1 o- T% E( [1 J: k# H( o   call    KERNEL32!_lopen/ i3 f! R0 B3 @, H: K( {- ~
   inc     eax- f* E5 D. |9 v8 _/ R
   jnz     00650589                  ; detected5 w+ t2 k* Y5 o2 v8 M5 e
   push    00                        ; OF_READ& D9 O5 @* t. T9 l3 n
   mov     eax,[00656638]            ; '\\.\SICE'
3 n- D8 i* y: \7 A% `2 {   push    eax
' ?4 u: k6 ~. u   call    KERNEL32!_lopen# T6 q# r0 {( i' P
   inc     eax
3 ]) e% v% V/ D% o   jz      006505ae                  ; not detected/ D4 U0 z0 U' ?" E

" y- F* y3 I' C- _. I* K
" U3 Q6 ~6 }+ X__________________________________________________________________________
+ o1 Z" }9 q5 X- g- Q0 [$ {$ U$ d
Method 12
# _5 k) i: Z. U2 Y. X3 f' v=========3 R2 Z; V4 k) h9 B" X( z; J

, W1 j+ N  n" H& EThis trick is similar to int41h/4fh Debugger installation check (code 055 I, [" \3 o) A6 d
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
6 q8 n( m& j( s8 m7 ^as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 K9 x% q4 N6 I6 Y% x1 l$ }0 V# A. Q! l& s5 b- A
   push  0000004fh         ; function 4fh! Y8 b: o# }. L# O, Q
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 l' z! Y% {) y" Q; e; i( Z2 G
                           ; low word specifies which service) @; \! l2 b4 W& ?5 h/ c- o$ h  o/ p% q
                             (VWIN32_Int41Dispatch)8 w& ?% u! q; L" I. n
   call  Kernel32!ORD_001  ; VxdCall
$ I( K8 d- M6 B' V9 E   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 }4 Z: V- j2 s3 h* E1 ^3 c   jz    SoftICE_detected
& O6 }. Q  E5 W$ d; z% _
8 ^( j( K9 l( ]. m. \1 rHere again, several ways to detect it:
- X$ ^' ~8 Y, v& s, r! I+ p/ O+ m  m2 G
    BPINT 41 if ax==4f
3 ^+ a0 Z0 e2 q# q3 Z  _
1 M; r1 G  C1 i5 t& K$ q/ k    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& R( G" T# V" w; |/ @. {, L
4 v; w% y2 J$ k$ Y5 I
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; n, G* @. q" q

. g8 ?" Z& r% E    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. K7 Z- x8 i) [7 T* ]- E" V3 [
7 I4 c& F& Z3 O
__________________________________________________________________________
. V- r  o) a, U$ `  z- Z4 Z. a
% ^8 G5 e2 |6 sMethod 13# }' C$ ~9 g2 b# ~* g) ^' g
=========
5 X' g. t  r0 X1 X3 C9 s  N
! S: x2 d8 m/ ANot a real method of detection, but a good way to know if SoftICE is
4 ^* g$ X3 ~- y+ l$ [# C' D/ L% g$ |installed on a computer and to locate its installation directory." ~% i# x9 q- h- O3 K9 V( I7 l
It is used by few softs which access the following registry keys (usually #2) :( [! v6 B) z& k3 U: K4 \

( y+ J( h$ g9 ^-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& e4 A: ?/ t+ z& _\Uninstall\SoftICE* w7 j2 R2 B  _& k
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 a7 a- W# Y- ~/ s8 S. R# `3 J1 `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 q7 H1 J) v( P9 N+ D\App Paths\Loader32.Exe
9 T2 Y1 P+ K3 U4 s  @
2 f% D* V  Y  z9 Q" D; [: |- l$ l% |1 k1 Z8 a! G1 q: K
Note that some nasty apps could then erase all files from SoftICE directory$ p7 U% z8 h2 ^8 }
(I faced that once :-(
, z  q6 R- E0 d1 X5 c5 B
" }1 @& q2 X7 N  L: HUseful breakpoint to detect it:2 r/ a& R9 M; q& a+ E, m
- u$ `% B. S1 S( _2 Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'2 q8 V7 m8 e2 A' J* m

! p! ?/ [, l( B3 X0 |* v& r__________________________________________________________________________7 n$ Z4 u1 A( V3 T6 c. b7 J& V! U  o
* k; `$ z+ [' Y3 G
3 C: o: b3 q+ m. f$ H! S
Method 14
) |+ S' `! L8 O=========
5 s1 B1 k( z9 M, F" l, L5 k. N. \3 _$ M' ?9 ^3 t2 d* g
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 r  s  d( K1 M% d( X5 Nis to determines whether a debugger is running on your system (ring0 only).; l. o7 q3 V" \! q4 L) a8 }

& n$ P9 J' S: `   VMMCall Test_Debug_Installed% f9 n$ _$ F0 {+ |5 W0 O7 {
   je      not_installed
- D* u9 q5 K0 e; p
/ k7 m1 c" b0 K0 h- PThis service just checks a flag.0 g' h+ `. L! Z2 e
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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