About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) I; B% o8 `5 @' r9 N) u
<TBODY>0 B3 k, ]* r8 h# V2 t5 @, f; S
<TR>" a/ n/ Q) ]+ q% w' }0 a
<TD><PRE>Method 01
+ i& o' n- x/ x/ m=========9 f5 w% ], x$ i3 V0 [/ |
, t8 e7 m. S, Q
This method of detection of SoftICE (as well as the following one) is
( Z  H% x. Y3 k4 C6 G. Lused by the majority of packers/encryptors found on Internet.
& ]7 S6 v* S% V8 }: ?! s- KIt seeks the signature of BoundsChecker in SoftICE4 T# h# P+ Z# u7 W% x% g
% i. b" u8 i; [/ S. e
    mov     ebp, 04243484Bh        ; 'BCHK'
) D4 c& ]0 o9 X8 j    mov     ax, 04h# }! `* C9 s* g! G( |4 e
    int     3       6 X( a! b" d; s: l$ I4 ^
    cmp     al,4. R/ v7 `$ ]4 d1 @
    jnz     SoftICE_Detected
! D# @8 }: V8 Z/ l/ ?  O1 h% \# G/ ?$ I9 N* b+ s% \0 K% H
___________________________________________________________________________
: r( K- u( ~2 I' X- A9 ]* v: H! r4 n0 Y7 n$ z+ x' G
Method 02
6 f' l4 b6 m+ {=========) J# A( i, M. `7 v& b3 j4 B

6 n( Q9 b2 p# i: J4 PStill a method very much used (perhaps the most frequent one).  It is used
9 C( I! ^/ K3 `$ l! Fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! A# ]+ u$ K$ }1 {) s' ror execute SoftICE commands...
9 }8 U; x8 J: e( X0 JIt is also used to crash SoftICE and to force it to execute any commands' C1 i2 B) |# L  N) f; j: S
(HBOOT...) :-((  9 ^) B1 j/ {+ k4 y1 U

. k2 \, n" F* e+ A$ g" W& r% j# k9 z8 {Here is a quick description:( a5 U& Z1 U- @
-AX = 0910h   (Display string in SIce windows)
) U9 U1 \( q1 C% t' A! ~! \; h% t-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; m) T( d7 x' D9 b7 c-AX = 0912h   (Get breakpoint infos)9 k; ~9 N  G% a1 W( I
-AX = 0913h   (Set Sice breakpoints)% P9 d' X+ H& k- v  v1 T4 I2 T% q" v: Z
-AX = 0914h   (Remove SIce breakoints). ]' e& T4 P6 k$ E, [" P6 d
5 C; q3 }4 p$ b; H  Y
Each time you'll meet this trick, you'll see:2 W& V7 U  [4 g# C% Z
-SI = 4647h
. u" V5 i/ r( i  ^7 m-DI = 4A4Dh: ]* }4 R( V0 N! t) u
Which are the 'magic values' used by SoftIce.( |6 l6 s+ I& r! y/ u
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
+ c" `- y* d! e3 q% A8 G! I9 q# Q
Here is one example from the file "Haspinst.exe" which is the dongle HASP: d( I) a- R" I# W* B/ f( c" n: {3 N
Envelope utility use to protect DOS applications:9 i0 ^& w0 j0 A! E) _% n
) l; P- Z  g: n" m

* }$ ~& U! E7 h" ?4C19:0095   MOV    AX,0911  ; execute command.
! `- J* U: S% e/ s/ n4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 b# a7 `  B1 z/ S- [: \
4C19:009A   MOV    SI,4647  ; 1st magic value.0 b, [3 M& y6 [: ~1 C! G
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 F6 Q! y5 a  I4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# q. u/ X: o) H& W6 O
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) h3 ~2 G5 M. g4 c2 M
4C19:00A4   INC    CX
) ~' k# P3 H" k9 O( _5 T3 I# A4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, k8 m. c# n/ O' Z" X
4C19:00A8   JB     0095     ; 6 different commands.; H& m5 G& o, t$ @3 \+ t
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." u, M8 H0 Z6 a' q8 F0 r
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), B3 S; S: Q  ^4 y
3 ~5 Y; b  S; c& C( m  x1 @
The program will execute 6 different SIce commands located at ds:dx, which3 f" H! ^! t  x' R6 C+ {* p- ?0 ^
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 R" n- E6 j; j1 Y* H1 V

( ]( }) F+ h1 V& g( O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 M1 Z$ i% |3 P/ e' g___________________________________________________________________________2 i% _: b! l. r9 S

# N4 \! g+ f' Z* n1 l! Q5 ], T0 d! R6 H
Method 03
4 i4 R) o8 c( t2 g, F, Q- X=========
+ {. c1 K& t" p# l% E
, x5 z! D/ [! }! A5 C; SLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( y3 a9 h4 H% J$ P1 V" t5 t(API Get entry point)6 g  x8 B/ w  [' _3 _" ~1 d+ s
        
$ r0 J- X6 Y0 w& c5 W, b3 I# j3 t1 T2 {8 w& a, C4 R# _$ ^
    xor     di,di
9 |( Z9 P4 o/ c' N    mov     es,di" ]% M" K! ]/ o- B: c% V8 ^
    mov     ax, 1684h       ( ?& {" U5 A9 S" {
    mov     bx, 0202h       ; VxD ID of winice- {3 a! T  {8 y
    int     2Fh/ v/ u' j9 Q  f! [4 s: g1 }
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 ~$ E- H& K1 S+ U9 E; @, M
    add     ax, di0 `6 a  Z$ `$ `
    test    ax,ax
3 _, F2 K6 |# {' w  C9 m2 e# f    jnz     SoftICE_Detected
- ]* `" T" i. H1 s; \
  P: o8 q1 ^) U! q# h; Z___________________________________________________________________________
5 \6 f- f! @6 L! [
7 \% b( d% x8 [- y+ oMethod 048 d& ]* I8 |% M& v
=========
$ w2 W5 e+ d5 v0 \) z7 T. _; A/ K* z+ o- w3 R5 l
Method identical to the preceding one except that it seeks the ID of SoftICE4 U: H3 ]5 d( f% u3 u8 F' Y  {4 \
GFX VxD.
- w9 ^* |- q- I5 g; o$ J
; W+ z, W( t. n7 p' ~1 b! {    xor     di,di9 X2 s5 L6 u+ G& q) ^+ r/ D& e4 M
    mov     es,di
9 a% I- X3 }; ?4 V/ W    mov     ax, 1684h       , U, x+ U; Y1 f
    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 ~9 U. b$ L+ B
    int     2fh  V- Y$ N" P8 I- o+ u+ C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point& E. ^9 x0 x( ?9 E
    add     ax, di0 f6 D' X- ]! r4 Z( R+ L( G
    test    ax,ax! B( @2 ~1 b, [) f; b. j) I6 w; {
    jnz     SoftICE_Detected8 W. ]& f6 d- j/ d* b
* P6 ?( E8 i$ a$ |3 {
__________________________________________________________________________
2 j. Z: z  d  |2 o; E' z" _9 e* ]2 W" d* o6 n. ~1 R" m

1 s9 ^% K) m1 C  u0 RMethod 054 y+ m6 n: B, _5 c' s
=========: Z" f6 f9 I$ ?8 e- G  U

' e  t4 W" O$ I/ |7 \1 KMethod seeking the 'magic number' 0F386h returned (in ax) by all system+ p, K5 @4 Y0 j9 A/ [4 P- y( I4 j
debugger. It calls the int 41h, function 4Fh.  T7 b6 I/ e) f' D! X( w: s9 j9 c$ F
There are several alternatives.  : ^+ u  `5 r0 Y2 l

. x- @! y& l, ?% p2 tThe following one is the simplest:
# h) @0 C1 [. t1 ]# p% M! ^2 b; I; [
    mov     ax,4fh
4 n+ x& v9 }: n/ _- O0 p8 R    int     41h
& _4 Z  j( ?, Z" s: A& D    cmp     ax, 0F386* Z1 i5 e# U1 i4 `+ q8 `( B
    jz      SoftICE_detected* g- `; L, g4 s' O1 P$ P
$ X8 c& @& s9 c- ^& s
/ W  |7 N9 r- t
Next method as well as the following one are 2 examples from Stone's ( m! ?4 z3 o3 _4 A, V9 _( {, ~
"stn-wid.zip" (www.cracking.net):
8 q( C1 b5 }+ {3 W6 w, K" t9 A' ^
+ w9 g- a5 B5 U; X( O) @$ I    mov     bx, cs6 g1 @# S3 t2 K( g9 p9 w0 d4 j. i6 h
    lea     dx, int41handler29 o% t' V4 F2 e& n  l) W' J9 U
    xchg    dx, es:[41h*4]! ~" P0 ]& ?. @- p2 W4 T0 E
    xchg    bx, es:[41h*4+2]/ p& D- U6 R. Z1 T
    mov     ax,4fh: s. f4 W+ k+ C# }
    int     41h: Q/ B+ n/ q- ?8 k% `4 e" E
    xchg    dx, es:[41h*4]
7 U4 {% x! ?6 a4 X    xchg    bx, es:[41h*4+2]  ~1 \# [5 @% S, N
    cmp     ax, 0f386h* w! d* O! N" [: \3 o  H
    jz      SoftICE_detected! ~- P( z8 \& r# _1 U# u" i
' b) ^% j- N( Z" ]1 b
int41handler2 PROC
  Q/ N5 a6 A3 v6 f3 |# W    iret
/ }7 ]; q, w8 ?int41handler2 ENDP% B6 ~3 B9 q) N/ q3 s% ?# C  ?

7 e! t  K% E* [0 n2 E3 [/ ^$ v) P4 R" L5 K1 ~! j- x
_________________________________________________________________________
4 b) }+ X( x  T+ J# y0 f. @* A, ~/ e6 z

$ ~- s) h9 t" ^+ |& o3 H" U2 kMethod 06
1 D1 T: Z- p5 P, u=========' [( p4 H0 g; X9 K( f6 W( O% Y/ }
# E& t% v2 x, H
# a) S4 V( q6 b5 @1 L
2nd method similar to the preceding one but more difficult to detect:/ t! F  S' I. `2 [8 Z

: k% d3 E% D7 A
. c5 S" z; Y! q! E# N' @int41handler PROC
4 j3 \: H+ D# `9 f! b* R/ e    mov     cl,al$ b/ ^. L9 ]- y0 R3 K, c; |2 `$ w
    iret
$ v' x- w5 s3 sint41handler ENDP
9 r8 c8 B2 u) |) o
/ e  X! P' ]) B! T. e0 p, |, A6 s: X9 f, m
    xor     ax,ax  E* @# s) e- ?; S
    mov     es,ax$ ^+ O2 o# x# C% w# d  p3 B
    mov     bx, cs
  W  V( g. S  J& X$ D6 r    lea     dx, int41handler
# q4 J# u& ]( }" g/ x' O    xchg    dx, es:[41h*4]
8 ~9 a% j& W1 l6 w4 r) M    xchg    bx, es:[41h*4+2]$ S9 t$ N3 ~) ]  d$ }; V3 F' e
    in      al, 40h4 \+ {( X# s0 a
    xor     cx,cx
/ V# P* {  C/ B$ R" o) R2 t7 t    int     41h  c! ?2 e% r2 q- Y% w
    xchg    dx, es:[41h*4]
  ]' p) ]4 X) y" s    xchg    bx, es:[41h*4+2]* m  J4 a/ \! b$ A
    cmp     cl,al
2 c: W& X) ^3 C6 D    jnz     SoftICE_detected
. w& F" v& X5 D2 k% I
" |9 ]2 V4 w7 B: F- l5 t_________________________________________________________________________
; }5 F( ^; q! R) U9 c6 Y  q1 l
9 J$ q- {4 T' ?" qMethod 071 B- s& g0 [. u  p& `
=========
4 H+ J2 D/ w! f' ?) }. k, F( @# m1 w# ~$ f/ ?$ W
Method of detection of the WinICE handler in the int68h (V86)
& D( B$ [# e: n, S& J8 k% o2 Y" P/ n- u( w7 ]
    mov     ah,43h7 c* V5 k6 v$ i; E, L; w
    int     68h
- B9 k) g1 @6 O0 G( p    cmp     ax,0F386h4 t3 k% l5 L, X- [/ R3 n
    jz      SoftICE_Detected
# M! o) l  V0 k4 n& a% m0 y, u9 _% S; d. d( t

: k/ T7 x  ~1 J9 F1 h=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
' d3 a' G( B9 J, r) \   app like this:
+ f9 V- V- X  X8 s  |0 P: Q5 W: Q6 r( t8 `
   BPX exec_int if ax==68
# _& r# G2 Y2 Z   (function called is located at byte ptr [ebp+1Dh] and client eip is2 Q! v# E0 D9 j; M/ b
   located at [ebp+48h] for 32Bit apps)
7 K4 q9 w1 {0 r) S! ~__________________________________________________________________________- U1 ~$ [: k' Z- u$ \
- l. F! w* R" O7 n

7 r$ j1 s6 s7 p( _/ ?3 f/ F4 \+ hMethod 08; z. C8 `8 O% B1 U9 h2 \" ~
=========
: F1 g* s0 G9 m- X; b9 c9 |) a
$ m! C2 V; J9 \, F6 eIt is not a method of detection of SoftICE but a possibility to crash the% r! z) g: Z, {' F/ Q
system by intercepting int 01h and int 03h and redirecting them to another3 d; i; c' K- O7 {. Y
routine.
# k4 ^  F% U- e% `5 Z4 rIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) c' T4 h5 T5 q7 v
to the new routine to execute (hangs computer...)
! n# Z' ~7 _8 s- f! F6 g: E: y. ^2 g* j% l: P: R2 m6 w
    mov     ah, 25h8 _  M2 }7 m' }6 y
    mov     al, Int_Number (01h or 03h)
: t% }- [" }/ p+ S! j, @    mov     dx, offset New_Int_Routine
0 j! j; l1 F7 E. y+ r* U    int     21h
5 I8 ^) Q' X; o1 T, C  C6 L$ b/ D: W; ~% A1 e- e5 {
__________________________________________________________________________5 S! l% l( k! o2 U- g4 n- ]

/ M1 B% Y7 ~$ V; |Method 09) ?5 `) g  A0 M4 g5 s- K
=========
+ V. v, U: b7 Y1 m- c- J) U, [7 x2 @; E( h3 q% v
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: Z+ B  L) K3 x& R: ?+ i$ p: r
performed in ring0 (VxD or a ring3 app using the VxdCall).
: f2 H! p+ U6 |$ C) {) jThe Get_DDB service is used to determine whether or not a VxD is installed" D4 y$ @; r$ J; C1 l" R1 L! L9 L
for the specified device and returns a Device Description Block (in ecx) for
, a7 N) J# ~2 J; g- Ythat device if it is installed.
; w) a3 M7 L: |3 {1 i& X' ~) _; J# P6 _- Z9 p( I% c7 \
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 ^6 Z' d8 _+ P6 ^, j% n( N
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) T& g% R' w5 k- w' E! N- n   VMMCall Get_DDB! g6 Q' ?. k3 d4 h/ v: N/ l# b
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 W# Q) B, E& d' X) p% }

8 E  N7 ~3 r. n* O5 e1 eNote as well that you can easily detect this method with SoftICE:
) T7 B: o0 r  Z! |7 D   bpx Get_DDB if ax==0202 || ax==7a5fh4 x% e) m+ i2 d" f
+ i: O1 C" c$ l8 @; n& U
__________________________________________________________________________
3 D  Y, E! r+ M" N- r8 T" ]
- Q7 p. R1 Q$ Y/ p: k) MMethod 10# M5 t5 e, p6 z* J! W% `: }+ S
=========
* T0 J1 B  ?% a& n8 P# I  Q  h& w7 Y4 e% p; ?$ X7 B/ \
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) X! }! D1 t+ X- f
  SoftICE while the option is enable!!+ S8 O8 h1 u  Q: O1 Z; i+ O+ N0 S2 }2 \
6 J$ M; o% i5 Z8 c" i
This trick is very efficient:
1 ?' ^/ M0 L' z* J. qby checking the Debug Registers, you can detect if SoftICE is loaded
  b- V8 {# e; v: o(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& Q( I* ]% r7 \: D: |. {
there are some memory breakpoints set (dr0 to dr3) simply by reading their
: @7 K/ z! R; Evalue (in ring0 only). Values can be manipulated and or changed as well  ^& f  `/ M2 k. Y* P& d+ ]
(clearing BPMs for instance)
# |: H+ R. w( I" J+ [' D. s8 P) K  f8 \6 R( D
__________________________________________________________________________
/ S* F1 F+ n$ o! v& Y4 b, ^1 h6 Q# C6 @0 x
Method 117 H& ]$ O$ R- |; a1 @8 x
=========0 y$ g2 o/ h+ v' A* n% q7 N

# `  A( \& [' y: E6 H) ?; G) x' fThis method is most known as 'MeltICE' because it has been freely distributed; g8 E% y: {/ ^* A& d
via www.winfiles.com. However it was first used by NuMega people to allow
2 d# n! a1 Q& {! h% v/ GSymbol Loader to check if SoftICE was active or not (the code is located
- F' f" R, {# V$ }# b7 _inside nmtrans.dll).7 T. s2 O! A. t; y; ~

8 b4 r* j, v( c* K8 z# @The way it works is very simple:
9 y5 J5 w5 B) p7 v9 G7 f! v8 g: ~It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% P/ J& O" V% U8 F( MWinNT) with the CreateFileA API.
1 ~7 r6 A5 a+ |, A1 G8 J7 y  A. G/ B
Here is a sample (checking for 'SICE'):
0 ^+ N$ Z/ T1 n" b
/ a( y& O3 J! W4 T2 _BOOL IsSoftIce95Loaded()
9 v0 |: i( C! E3 T" k0 y{) R4 X2 n, B* Q3 B
   HANDLE hFile;  0 U0 D% E& z# ^8 m
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
3 p8 `2 B# ]: z4 X$ `                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 y: [3 e+ h8 U; e( b1 X# d
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
5 _1 l3 A7 F4 w; t: T+ ~' X" B6 j   if( hFile != INVALID_HANDLE_VALUE )- \/ @3 [* c7 f) U; B7 o& D! N0 T5 w
   {2 N5 b$ Y: ^0 {) d0 d
      CloseHandle(hFile);6 Q, Q* O: b2 a& q
      return TRUE;
* |6 T  A( h( V" }   }3 {. j! e% b% w1 N1 J8 X: s9 v$ U
   return FALSE;
6 {4 m* i8 t. }0 w7 q8 d1 z}% N1 C( }! h3 h1 j& E

' q: P% g2 X& z  j& zAlthough this trick calls the CreateFileA function, don't even expect to be6 }7 a- o1 w1 y0 G$ ^. r* x
able to intercept it by installing a IFS hook: it will not work, no way!
0 L# i3 e5 {, _5 Q# ~: [  aIn fact, after the call to CreateFileA it will get through VWIN32 0x001F" w$ W! x& a# i
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
1 j# s4 W9 I7 Q& Q; A6 d6 land then browse the DDB list until it find the VxD and its DDB_Control_Proc
# t" N- j- B+ V" vfield.
4 P/ t% b6 l6 e8 Y- z0 F8 H4 uIn fact, its purpose is not to load/unload VxDs but only to send a
5 y) |# v0 G4 r. ]  N" D, LW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
& o; f( d& P* D% ^to the VxD Control_Dispatch proc (how the hell a shareware soft could try1 _1 V% C& n! K9 R
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
% U* Z2 W, |  t. W+ A8 `# SIf the VxD is loaded, it will always clear eax and the Carry flag to allow* x7 Q: v$ B, N( |" e7 z
its handle to be opened and then, will be detected.3 f5 K" m/ Y. e
You can check that simply by hooking Winice.exe control proc entry point# U9 p' N  S) a) Z5 x
while running MeltICE.
" c. R. U* k( r( _+ ^
! L8 I4 R  J, h. B# j3 i5 A3 M2 v7 F; @9 s& ~9 K. u+ ~
  00401067:  push      00402025    ; \\.\SICE
* W3 F; v# G+ e  0040106C:  call      CreateFileA2 L) Z% N7 y% x3 c! D) [- w, Z) C$ P
  00401071:  cmp       eax,-001' P; h1 p$ T, R3 b- T
  00401074:  je        00401091
; M8 u' J& g# ~: m4 n( H% z6 r; _- P) k- T

# _# c6 q1 L  h# _& aThere could be hundreds of BPX you could use to detect this trick.) \- O( a2 m5 C  J3 r# H% `3 q
-The most classical one is:
) q+ a! f0 t2 N, y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' \3 y* p2 G* w+ b" |# m
    *(esp-&gt;4+4)=='NTIC'
6 j8 F" u' M; c* H( a6 U4 F: l0 n* M3 N0 l
-The most exotic ones (could be very slooooow :-(8 m6 p" a+ v2 ~' Q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 x) c  N( L" [+ C: v' R0 c
     ;will break 3 times :-(" d4 F+ M% s# _6 _# F/ J+ p
, Y) c7 G) e. z: X! u- c" f" W
-or (a bit) faster:
0 i" g7 q( J# o2 p# W  R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ ~: s' N9 r% {' S* ?) @
6 F! y8 a; m: c' t' p5 H: b   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! y2 @  X& @# R0 }0 g3 Z; s
     ;will break 3 times :-(
" O/ A1 P' P* R% _- ?( s  V) R9 J  t4 w# w9 E- k8 y
-Much faster:
; Y+ N/ ]+ S: b# \8 I2 s  ^   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 ]: I) y% [8 h, G
" |' h7 K# X9 N+ C" e+ X
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% a7 d4 P) o7 D: C3 I
function to do the same job:) Y  o) ~9 \1 p0 S: Y

& M  I" N7 X# i5 |  Y' K   push    00                        ; OF_READ
# n9 l: m3 c1 ^; F   mov     eax,[00656634]            ; '\\.\SICE',0! y* g- K0 q" F1 B# j
   push    eax" P, n1 D# f' Z: N
   call    KERNEL32!_lopen3 S8 _7 a5 z7 N
   inc     eax  d- P% M$ g9 @
   jnz     00650589                  ; detected; ]7 d5 N4 I% ~4 d
   push    00                        ; OF_READ% V& J8 ?9 d. o- a5 t
   mov     eax,[00656638]            ; '\\.\SICE'
" z' I9 `! x9 s+ d( j/ j* X( `) w   push    eax
) V0 ~: ^$ D# y   call    KERNEL32!_lopen
- w% y, I2 n0 z# q1 ^   inc     eax
  a4 F7 Z& h! p, `' p   jz      006505ae                  ; not detected
$ q# o' l( Y! s4 h1 I: [6 V1 P1 A
9 k" h) h: X/ Q0 Y/ x6 ~2 w9 j) C; b
__________________________________________________________________________
$ l7 H3 A) i: m  H6 o2 _
8 F* y+ U+ i) e& q% {  x; jMethod 12
8 i( O: F: Y1 Z. b2 j=========
7 y# m' Z% y. g# a3 X+ V
1 f, W8 S' G. l- T' G5 A! yThis trick is similar to int41h/4fh Debugger installation check (code 05+ Q$ o: _$ _  x3 q1 i7 v" Q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* _5 M- j( j: q% C) {as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& V3 Q' x" H. }# h( u$ S* N; h5 Y  U  i  f) E# K
   push  0000004fh         ; function 4fh+ ]2 A9 Q0 N  u2 ?
   push  002a002ah         ; high word specifies which VxD (VWIN32), ]# _  H& }0 j: A% K+ s$ q8 C
                           ; low word specifies which service) k  a8 K! B4 P- _. c4 n
                             (VWIN32_Int41Dispatch)+ q3 u# R+ g" w- H# z' X
   call  Kernel32!ORD_001  ; VxdCall  `* L% A2 j+ t, r
   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ B7 X' g8 w4 |$ a* i0 p   jz    SoftICE_detected" }4 \& f: K1 N6 e+ ^
! W: x. R) `, V) [) b7 A; ^
Here again, several ways to detect it:
8 D, ?  I& W  M  P
+ _% n$ h9 r8 j/ C& t    BPINT 41 if ax==4f
2 C. P% D3 O/ K, r9 `' a  p) {1 W# m
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" ?; ^2 q9 f. p
4 x8 N( ~' Q( N0 u
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A, n. n( d+ G6 L7 O% f5 {* y

2 e$ ^" }' l7 ^5 q$ W* Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' r" U5 u- p) z5 p3 M: X; N6 p& ?1 X! Q4 j
__________________________________________________________________________
% q" i' c9 q6 U: {: h& B, N+ W- K8 s# |
Method 13
- |2 }# Z+ ^# d6 m=========
! |2 N' ?  q" X% [4 ]5 ?9 d3 j
1 k, `" |' q, X) Z4 uNot a real method of detection, but a good way to know if SoftICE is" }3 O% |4 _. e) O
installed on a computer and to locate its installation directory.& ]8 `0 w# Y3 x0 f2 e
It is used by few softs which access the following registry keys (usually #2) :  ^0 K+ w0 H: _1 e& g; R

4 D( ]1 _  S# D% A& |-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# e2 ?, Y* Z4 F) j\Uninstall\SoftICE
' L4 t; Q* l# E4 E! K3 _6 y" l-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ N9 x. g2 A# ]4 l+ R' l. k
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  v) i3 E* U% N" Y
\App Paths\Loader32.Exe
! B9 r/ }' F3 Q3 D: T, o7 j7 X% u
  g' ^) S! V0 O8 C8 M
/ Y9 Y1 T2 ]" {) ?Note that some nasty apps could then erase all files from SoftICE directory0 C& w, B: D1 ?' F5 M: }9 G% @
(I faced that once :-(% n; j6 e+ x) E" o

9 V  i3 j, q4 sUseful breakpoint to detect it:/ W0 b* X& C' |- I' b3 V: P) O# }7 O: x

* }3 ?& T6 z' Z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; c, }/ e+ _- y
8 N2 q5 [7 L* {! M6 D# @5 d
__________________________________________________________________________
, N  f7 E: a' E2 X4 T3 m) b
- n+ t( k7 ?1 u$ X* N& y! U$ Y" S/ ]% t+ {
Method 14   F5 U5 h6 u; D
=========
7 ]  o6 r. X* J0 A; d( P4 s; {% S; V* |) @, L( q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  _9 Z2 d3 o8 A' V8 Eis to determines whether a debugger is running on your system (ring0 only).9 \& V& k& w: }% M% a( P  q( z7 w

4 j+ o3 ]0 V) N2 V' K5 T* Y   VMMCall Test_Debug_Installed
* s: t( o+ q6 M9 S! h1 k   je      not_installed3 C* S2 ^# A  m% m: s

4 F; p6 @! m4 q  z8 b2 U1 ^This service just checks a flag.
( o- J7 E9 Z( g# W' j</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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