About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' [8 [- C+ j7 m7 E3 l6 \
<TBODY>" e( `" p5 s( \% y8 u
<TR>
0 J! C! x2 T4 ?$ l<TD><PRE>Method 01
  E3 }, ?" m6 D# v! A- N" g3 Q6 w=========' _' s: a3 F1 f1 Y7 I$ `( x0 T; g
2 P( L  o5 m: _7 \/ \# C( Q
This method of detection of SoftICE (as well as the following one) is
) N6 C  k# E) A/ I* iused by the majority of packers/encryptors found on Internet.
* W. U+ C1 e' e# A% D1 EIt seeks the signature of BoundsChecker in SoftICE" q) m6 h* ]9 @$ E. K$ q

  U# z2 ^) X; C    mov     ebp, 04243484Bh        ; 'BCHK'
2 m9 Z/ A+ M) R    mov     ax, 04h% T1 k9 C0 N; N5 E# b; v# }5 a
    int     3       2 L- k% S2 t  t  B
    cmp     al,4
5 o8 ]3 e9 \' y& w% w4 g. N    jnz     SoftICE_Detected6 |9 D6 L! d$ t; V. |

9 ^1 V) v: Z$ l) N___________________________________________________________________________8 G; w0 c4 s" a  `+ R5 [+ A" y
1 i  E8 w( c2 g: I/ [' \% J+ L5 g4 D; s
Method 02
2 P, y5 Q8 c2 E=========. K- a: O0 s1 |" O4 S5 v

- F5 m8 }( \+ r' s' ~Still a method very much used (perhaps the most frequent one).  It is used% B* z2 h9 y4 J( M+ z2 X4 ~
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 U$ C' y3 R8 V' z4 For execute SoftICE commands...
$ U* e) g- w) Y+ `$ yIt is also used to crash SoftICE and to force it to execute any commands6 v0 \/ T* b5 o+ I" T5 J, H
(HBOOT...) :-((  
( \" S/ g9 b& O) c0 q" s! Y3 Z# M  C; J7 F+ ]
Here is a quick description:
, V. f/ Z& R) E, ^7 m-AX = 0910h   (Display string in SIce windows)
; u+ ?2 T! B+ [7 \) @3 d1 S* O4 e-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) R- K/ B( {; {
-AX = 0912h   (Get breakpoint infos)
1 _( {+ r/ ~1 W' T5 s9 P-AX = 0913h   (Set Sice breakpoints)
# y6 n$ q! N' i% M; p# m, k! g-AX = 0914h   (Remove SIce breakoints)
% Z. x0 d! n  o' r3 @3 K& \% I1 N1 p6 y$ G5 h  l6 Q. `* N% h
Each time you'll meet this trick, you'll see:, c5 S; ?+ X7 W9 \: b$ ]( T7 W
-SI = 4647h
/ J. t" B& u" f, Z5 p/ s-DI = 4A4Dh5 D* V8 ?1 o  R) v1 M) o# i3 X
Which are the 'magic values' used by SoftIce.
$ W& A# e" J3 G6 g3 [0 c& MFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: y& E0 t; B) K% }: ?2 t9 u2 ]0 I2 a# d
Here is one example from the file "Haspinst.exe" which is the dongle HASP* {, F9 z0 ^- a' i
Envelope utility use to protect DOS applications:/ K! f% t; {: P

# V. v) K) F- g% r. G: V$ b8 ?# `0 X) R4 k0 X7 o, g  Q
4C19:0095   MOV    AX,0911  ; execute command.$ M/ j4 M: J: Z* P
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: `) l# B- K+ U9 A4 Y
4C19:009A   MOV    SI,4647  ; 1st magic value.
2 J& e8 b' m. O3 b2 D% Y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 ~, y" j  [/ w! Y; s& N
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 M- l; `8 `9 J+ D, s: e4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ V+ O# _  |; [1 d: ~! I
4C19:00A4   INC    CX
. A6 @; Q  z- Q$ m5 [  u4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, b" O( H4 `! P) t7 w. Y! O4C19:00A8   JB     0095     ; 6 different commands.
9 ^- v7 l( ^" R" D! b4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 ~5 y: C1 v5 G: S4 }4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# h# T7 t8 |8 h1 F! N7 U

4 c  I: I- u* EThe program will execute 6 different SIce commands located at ds:dx, which
1 v3 m/ |0 a2 M6 Y  F4 B: Rare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 j+ r+ y8 q5 Q5 }; A9 g
  |$ V" ^1 h/ B* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 Q$ m, @2 ~: n
___________________________________________________________________________* n  W% m- ~  G. L8 ~. w

% M. v) a( s4 I' r5 w' e3 W! `" H+ ~9 K
Method 03
, N- Q5 q! Q* i, ^' z, ?! q7 y=========
! x; T% N1 |( V5 @/ D
: \; u. S# k2 N6 h. i' M5 z/ GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( V2 y1 Y# J) x5 G% l! A0 s(API Get entry point)
) W" E5 P3 {& @( g) [        ( U' z! n5 d8 q$ {
7 z+ S* K" _5 D& S& z8 p1 |# i9 d: H
    xor     di,di
5 W! T* L  A* K2 j    mov     es,di; G+ B: h. L$ q& Z7 `3 R+ k* j
    mov     ax, 1684h      
! M& M2 G- W9 N: a    mov     bx, 0202h       ; VxD ID of winice6 v* {5 F( }% k& h4 n
    int     2Fh
* m2 O( M9 Z( y0 Y* ^2 e! H2 q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- {# r+ U* m+ a5 N+ ?5 a    add     ax, di
1 {! e6 p( l9 A# Y0 i9 g    test    ax,ax% s* s  ]! l: ?0 ?3 j( v
    jnz     SoftICE_Detected. p' Y* `; ~$ r8 B8 p, W; H( c8 s
" a$ A, ]% x* _; F$ l; v
___________________________________________________________________________
* u5 w/ n# X4 _+ {, w! c4 t. U; H% ]1 Q! ]
Method 042 N% w* X, Q1 D& K+ H
=========
$ X8 D5 R9 Z3 K3 C9 |
; f6 Z+ s" r5 y, w" pMethod identical to the preceding one except that it seeks the ID of SoftICE
- [! G+ M" J% J+ \GFX VxD.
* [9 @# ~9 q" y4 u7 j
: s: N: ]) i5 P" m+ [3 w) a    xor     di,di
1 L9 l- Q5 j4 |6 e) N* @! }+ e    mov     es,di
& d4 V8 F/ }/ P/ I    mov     ax, 1684h       ' \2 _9 C4 ^; W  p- w
    mov     bx, 7a5Fh       ; VxD ID of SIWVID6 g7 C% {- e1 q. n' z4 b
    int     2fh
" D' }5 P6 T# I; H, x8 r  y    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 p" T  c" }( f3 O5 h3 m1 s    add     ax, di* \' r7 v; F1 }, B3 S/ {
    test    ax,ax
, R) h2 V, d3 L* F8 |( G7 ~    jnz     SoftICE_Detected5 H1 y; l! h9 m9 q9 e5 I

  @( Z  s: D  H7 o" ]__________________________________________________________________________
: W- S' d0 M0 `) b2 H
/ a) F. l7 C5 f/ I- V- Y6 H$ J- s* c* \- S* l
Method 05
, c# S/ T+ t- Z$ @=========
, C) c& a) ]3 E. O& k8 e, o! x
1 ^1 ~( T# ?: s# j1 `8 L/ SMethod seeking the 'magic number' 0F386h returned (in ax) by all system/ J  c( k6 @0 k) ?( l
debugger. It calls the int 41h, function 4Fh.( H+ B' U# u+ W& ]
There are several alternatives.  8 M7 U+ {$ D! |) {9 R, X

7 c$ l: \( u! S5 i9 e. _0 QThe following one is the simplest:6 p2 e- |" F5 X
" m; o6 L. p) @1 T% y, z3 H- X
    mov     ax,4fh4 b4 b" f$ ^+ t
    int     41h
6 U# Z0 I0 Z: Y7 s) U    cmp     ax, 0F3861 F: X$ x# E- K% \
    jz      SoftICE_detected
( X: o2 G5 [' I" U+ E+ ^$ _, [1 X2 Q) l, G$ K$ ~% P

6 R. f/ u7 `6 p& t3 h# INext method as well as the following one are 2 examples from Stone's - e4 q: P; T# d8 k9 o& J# G
"stn-wid.zip" (www.cracking.net):4 j/ j) p! f$ m+ J3 a
" G$ `4 T% g! Y* Z, o, o# y0 ~
    mov     bx, cs
9 \# T9 ^; A% Q" l    lea     dx, int41handler2
) u; s2 }* V( o' @8 {4 E- ^7 [" c    xchg    dx, es:[41h*4]& o  z+ X! o( p
    xchg    bx, es:[41h*4+2]  c& p( X% l* i5 U
    mov     ax,4fh
& b% W$ o8 J2 y7 ^    int     41h
1 o' K# N; {1 K1 d    xchg    dx, es:[41h*4]
' R/ j1 l, p) s- J, k6 E    xchg    bx, es:[41h*4+2]
5 S# c) C$ u: b    cmp     ax, 0f386h8 ]& H0 b% \5 e* W9 p% g- d
    jz      SoftICE_detected
$ _) _! \9 i/ v. C) i' c; D8 o" \" N. l
int41handler2 PROC8 k/ Y1 j" M5 R  p# Y! q! v; `5 x7 A
    iret  _! D* m2 k2 Y7 @7 e; f+ K8 T
int41handler2 ENDP
0 V% X1 Y) {  G
8 X( w5 D  y( a) Y0 S, O% R/ W' U6 D* d% t2 ?" D* ]4 Z: y
_________________________________________________________________________
8 d4 y5 X7 Q9 d. u- s9 k4 E# O, U# ?4 n8 |' v& |

7 l& r, n4 c, L% W+ t, b& UMethod 06
: u6 V- F/ {1 Z=========
# \0 @- `3 y: ?' _. F
- {% g* I. y! N+ y3 e+ d1 `$ Q. a, j5 V
) e! p: z+ B" p' Z2nd method similar to the preceding one but more difficult to detect:% b6 u' C0 H+ t9 V
8 R) Y- w( Q4 g9 f- p$ y

. N8 [! S) R! E  v2 Lint41handler PROC
/ N9 q: w: N- H( c    mov     cl,al2 [2 g8 B$ B  P
    iret, d/ c: J3 x, d6 W2 ]5 c3 ~
int41handler ENDP
9 C, i* ^/ Z* P& f9 J) o, c' e( u
: E, X3 R5 r0 ]' Z7 p3 S4 D. x4 z; l( D2 m
    xor     ax,ax8 D% l. n  B. k  W7 a0 A; m' {+ [
    mov     es,ax
6 }" T8 z$ y9 [4 \$ i0 a% b0 j2 S    mov     bx, cs
- y  _  K3 i7 f& I/ g' ^2 v9 b    lea     dx, int41handler1 Q  Y" x* g- S' a3 @
    xchg    dx, es:[41h*4]: {! d  V; ~% |$ e) o2 e
    xchg    bx, es:[41h*4+2]  h+ ^* @* a; G5 }% ?
    in      al, 40h7 C- b! J# @7 B1 U; P/ b4 n$ |. `8 s
    xor     cx,cx3 b7 j% x6 P4 c( O' @3 P
    int     41h% }. ]4 X4 E- Q+ K( o5 d6 [$ I
    xchg    dx, es:[41h*4]
- e# [  p! ]- A  K& B6 [    xchg    bx, es:[41h*4+2]
6 @% A* B3 K  Y) i    cmp     cl,al
8 q5 Q) U+ B+ {, F- y% f' \* B9 {    jnz     SoftICE_detected
2 i, N4 @( z) f6 s& }0 O$ Y! K3 @& L* u+ n
_________________________________________________________________________
: {2 n" A6 [7 R2 l8 c  S" A" i8 X# B' e9 t* x/ h0 A* ^5 B
Method 07; m6 Z# x2 G0 V2 i* b3 ]
=========( D6 l+ x9 f) N2 s8 p* o6 q

/ P. |' e% d- @6 a+ Q# i( SMethod of detection of the WinICE handler in the int68h (V86)
. J& U+ n# Y# {' K! a
* Z% T# s. `- e! [$ [: L  d7 J    mov     ah,43h  S2 `; \- r4 L% l" @" u
    int     68h
! M& C4 d6 J+ K! C+ Q/ _    cmp     ax,0F386h4 Z5 y+ l% |6 t1 Q
    jz      SoftICE_Detected
& o( g6 l* Z" i, I: R# L. c; U% F5 i4 C3 ^6 i

- c, W, {! M3 g; e! _9 b=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 N! z5 J4 V/ x5 I   app like this:
9 G2 U$ W% `, u$ \( g/ V2 N+ t2 l/ U2 N* L1 k; y
   BPX exec_int if ax==68
  t3 d. b  f- H) e! t- X  |   (function called is located at byte ptr [ebp+1Dh] and client eip is0 U- C: ~9 i+ |" s/ G) I4 I, I
   located at [ebp+48h] for 32Bit apps)& v& L* q5 T) y) U  K1 o/ n
__________________________________________________________________________
- p8 S0 u4 c7 ?& O6 U8 S' Z; c6 Z( k5 ]- _' ^& V

, q8 y6 _* e7 r1 k' U. G# L- xMethod 08$ J7 b# g1 W8 x$ {2 O1 B9 S# E
=========
) r9 Y$ p" Q( j; U9 i0 n+ q( N3 \  A* h6 s7 v" c
It is not a method of detection of SoftICE but a possibility to crash the* [1 F, [0 ^, L
system by intercepting int 01h and int 03h and redirecting them to another: C) a6 L  @' u, B
routine.* m' ?# g7 [; X  C# X* [
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points" z1 y8 q5 d" U3 S, e! |
to the new routine to execute (hangs computer...)( z3 X( H7 ?$ L
; `6 q  k. B' W3 i9 r& u
    mov     ah, 25h) G5 e( O& `' k' v+ }' m
    mov     al, Int_Number (01h or 03h)
+ I, u+ n) T! ~! {    mov     dx, offset New_Int_Routine5 ~2 y7 c' F4 _; ^
    int     21h
5 F* y3 u& B/ W, P9 i* Q9 ]6 o
, e2 V' K4 K6 g9 B& l__________________________________________________________________________* z, q. [4 ]3 H+ V+ D0 r9 m

* U& f' h! i# d( rMethod 09
+ r( q" `4 D: l, z( j$ f=========
5 A% T9 p8 S+ E, N2 S1 @5 D
* D8 U( D8 |- X6 F) E% q! A* Z7 ]) wThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* g$ b1 H; d& S: kperformed in ring0 (VxD or a ring3 app using the VxdCall).
7 t% K, ]5 N: U4 b( eThe Get_DDB service is used to determine whether or not a VxD is installed
7 r/ Z' Z( P9 v* X* W* A2 U7 r1 K( Nfor the specified device and returns a Device Description Block (in ecx) for
' S. H8 f. y: q4 G) I* v& Zthat device if it is installed.
  S# \7 }0 H) ^# ?: M
/ Q# i$ D+ O8 ^' ?7 Y  R$ [5 B. T- W   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID' I3 `( b1 h# W" A
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 k: ~$ B  @, P8 z2 E
   VMMCall Get_DDB
0 q7 }+ U! n) S! _# ?7 t  L. }5 e! w   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* I. N; b, W+ e2 s. l6 z- n' _+ s. _) f0 z+ \7 p* S, o; [
Note as well that you can easily detect this method with SoftICE:
0 w% @, L+ l1 l   bpx Get_DDB if ax==0202 || ax==7a5fh; X% W5 j  A' h) q

7 x! A# K' ]/ m+ q  n* j7 t- B__________________________________________________________________________- d+ s# j: `  L, c  ~. h

6 w1 w; }& [! a6 ~( vMethod 10( K+ C) @- z5 `' M( B( K
=========' D2 {$ W" F1 t" {
" m8 H" l. l* b5 g, J7 \
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
, U3 m: a+ c5 _# Y  SoftICE while the option is enable!!
) o: J9 }" S% H/ T& B! t0 `  z# S
This trick is very efficient:
" O' G) X# A  `+ f* B( cby checking the Debug Registers, you can detect if SoftICE is loaded9 l2 Z$ |; x( ?- U1 H
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: U' k0 h: O* X# ?  p% V5 pthere are some memory breakpoints set (dr0 to dr3) simply by reading their2 b; E# P+ f+ i, w8 ?# m0 b. {( O
value (in ring0 only). Values can be manipulated and or changed as well( u( F% t8 t# l& g) U
(clearing BPMs for instance)
2 W" n% y+ r4 F8 h9 o% H  v4 l
. i$ @0 V# e, H4 Q" E( t__________________________________________________________________________
' w% y" f7 ~4 {3 o3 `4 ~
4 Z; V4 m' R1 X* N/ H1 ^Method 113 g0 s2 l8 X8 ~  K" ?4 B$ s
=========
' ~% I6 n9 `" e# o( O6 f& H+ v; G" s9 F2 ~, M
This method is most known as 'MeltICE' because it has been freely distributed6 x0 D! l4 `" X6 e8 V5 ]+ v) y4 r
via www.winfiles.com. However it was first used by NuMega people to allow, _4 E; L7 h1 h
Symbol Loader to check if SoftICE was active or not (the code is located2 ~1 {7 W6 u' A& [& U  B2 g
inside nmtrans.dll).
/ ]# N0 ?4 U* s: L+ E" V4 d; B
) K. t: ^; A  O4 v7 ~The way it works is very simple:
& o- S: \6 n5 F8 S/ kIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for$ i& h0 o- x& P1 T
WinNT) with the CreateFileA API./ ]& z1 S3 z# p. s
  b' o6 \. @; `
Here is a sample (checking for 'SICE'):
. h( ]3 j2 r8 E5 {
6 d" y: D8 Q2 m$ s3 x. d" y' OBOOL IsSoftIce95Loaded()
5 D( ]- h- T9 h. e  N{. O) u7 H) H! q% n8 Q* |% S
   HANDLE hFile;  6 b- `5 C1 n9 e6 V, n" J. e0 b  S/ g
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( G4 D# P6 o- B* b; U) M                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 t5 c6 y3 d( B0 b" j- h8 H                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( c: F* l2 O8 A8 P) z   if( hFile != INVALID_HANDLE_VALUE )
* [0 {/ x1 h2 _9 X   {6 V$ s+ U: [+ o- e6 d8 p+ ^% u* q
      CloseHandle(hFile);+ W  g- P% h5 P$ R% c; a
      return TRUE;
3 q. h* k  U8 M6 k5 i$ A   }
8 x" n2 o+ f. a! ~7 N1 A" E) r$ q4 t   return FALSE;
, c; Z, N+ K1 {}
1 F$ Y5 z3 C* S( W
! b9 O/ C% z7 V* H- cAlthough this trick calls the CreateFileA function, don't even expect to be
  ~" c, o+ d7 m6 nable to intercept it by installing a IFS hook: it will not work, no way!. V: l  d: _3 R. V( n9 |
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
6 h, ?, `+ J3 D6 i' i; d0 |service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 I2 [* R4 V7 R! ^8 }
and then browse the DDB list until it find the VxD and its DDB_Control_Proc7 d' `0 s4 H$ M5 l" M
field." Y8 c* x2 H& e# ~2 n8 Q( [
In fact, its purpose is not to load/unload VxDs but only to send a - \; w# n7 M! a
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 ^: v: ~& w" a1 f) y
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) ?, D2 v+ Q4 s* Yto load/unload a non-dynamically loadable driver such as SoftICE ;-).( w& u. f) d, I/ W1 F
If the VxD is loaded, it will always clear eax and the Carry flag to allow
' O% C9 w4 I2 }2 _6 Vits handle to be opened and then, will be detected.& l* O! G; X5 B7 ^6 j
You can check that simply by hooking Winice.exe control proc entry point- Y0 K' U, b9 S
while running MeltICE.8 ~8 R  o% ]  k6 y$ w5 f$ |
+ ?9 d/ f6 Z/ ]3 m" [
! V/ I- \- W4 Q2 ?% D% C1 L
  00401067:  push      00402025    ; \\.\SICE2 [4 @/ z, l# D
  0040106C:  call      CreateFileA: F% `! a" R. W
  00401071:  cmp       eax,-001
" }0 a! |5 v: U4 r$ y  00401074:  je        00401091
& ?* b- G3 a9 E9 H, Y% e0 G! F
0 z  f; G& B9 u4 k# Q- i
5 }1 |% h; b+ b1 gThere could be hundreds of BPX you could use to detect this trick.
$ d" ^% [2 i) j-The most classical one is:
2 W8 P' `3 R1 |8 |  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% i* R! b- Y* S$ c% N" Z9 V* C
    *(esp-&gt;4+4)=='NTIC'/ t: l4 Q5 x7 S- w! m' w7 v

) X" K( x8 D5 v$ G+ j& D-The most exotic ones (could be very slooooow :-(
9 q5 ?+ W/ S- {( K! e* w   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 W. {) e5 y/ S# e! @     ;will break 3 times :-(5 A0 Z  Y* F, T( P' I
; N3 s: l1 E3 |2 O
-or (a bit) faster:
$ E* y- b: e$ e8 f6 n4 p- h   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' U; H1 `2 o4 s! H9 u' @: D
' ~; D! W. {) Z( Q0 P
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : P1 H5 A9 M% J' t6 h! O
     ;will break 3 times :-(% a( T" ?. o5 w2 d' N+ W8 ?) r
" E8 m, f% H/ l* g
-Much faster:8 h# _2 d  [9 `4 f$ D* h% @
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 B  H  U5 e1 b! s
9 W" Z( Z0 \+ [: {8 }& n
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% o; t* v0 g% S4 ^
function to do the same job:
; p  b' O4 O/ p3 Q- ~( g2 G0 W1 \/ A2 h4 @; u- q' ?
   push    00                        ; OF_READ9 F: q. z5 q3 b  ]: g
   mov     eax,[00656634]            ; '\\.\SICE',0
4 c; B: h" S8 t; T' C8 {   push    eax
- p+ F) @, N: a+ r# j" B   call    KERNEL32!_lopen( N& M8 |+ f3 j3 A
   inc     eax
. d& L  q* }! X! i   jnz     00650589                  ; detected
! a) k) g2 x% k; N   push    00                        ; OF_READ% C: ~+ X. ?; y" [  `
   mov     eax,[00656638]            ; '\\.\SICE'
4 R; g0 L: W/ |, i8 q# r% e   push    eax; O' }3 S& G* c
   call    KERNEL32!_lopen  I2 U' C$ q) Q$ C
   inc     eax
6 `. e7 I: G: ~& `+ J   jz      006505ae                  ; not detected
# |( A. d, C+ {
. g# `. D% c2 E% x; X1 D( G9 K
0 ^+ y" Z% e* i, l8 H: t/ x, d0 V__________________________________________________________________________6 b! F2 H# o, Q4 W

1 {$ M! n% s$ T' L& N. |Method 12
0 h& l6 w: W; H0 P) T: p=========7 v$ T* S( s& w  F8 `5 L/ f
2 Z6 O( u& b0 Z# W9 m7 I
This trick is similar to int41h/4fh Debugger installation check (code 05
, ~& r. T7 P. ~8 c1 `. T$ @9 U&amp; 06) but very limited because it's only available for Win95/98 (not NT), y8 q. z( s8 F9 l2 [5 N- R
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 W- @, q: H, y% k
4 w" k* f+ n' F
   push  0000004fh         ; function 4fh
* O% l) A! b8 k- J   push  002a002ah         ; high word specifies which VxD (VWIN32)' h& @* l. O# o  C. j! S
                           ; low word specifies which service# ~2 q! v; v% h2 Z8 ~0 E
                             (VWIN32_Int41Dispatch)# Y1 Y( j3 Y2 F* V$ V
   call  Kernel32!ORD_001  ; VxdCall" n, ~4 w1 V5 @/ `: h9 I
   cmp   ax, 0f386h        ; magic number returned by system debuggers' }0 p+ u: C& K. ~+ @. I
   jz    SoftICE_detected
6 r: b* [) g" w* ?0 O! c' L) Y0 }6 A: ?5 x3 b( E, F
Here again, several ways to detect it:
- y$ ~1 z6 U' W3 M' l! _5 S' ?! [+ Y+ Y1 o+ P9 T
    BPINT 41 if ax==4f7 B6 h7 S5 @' s: f2 @

2 c. p8 Z, b- q; F1 U; ?- o    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 {$ J3 M( I* o$ g+ \3 \% Q! g8 s
9 _) Z( x3 z9 r7 w    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 @& M: b7 g) ^5 k5 ?5 w1 F

2 V& v1 }9 B- G, u    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, p; d2 U4 W: z& }% {; i
/ n9 w+ w" }: [; n: |; M
__________________________________________________________________________
  w. |* F4 z; S! [6 ]! j9 V) b/ a) ?1 ?: [; [
Method 137 E6 O' |" l( n7 f9 c
=========) W; y# j0 H1 b& V9 L: [  e

/ K0 f7 ?; {3 n" f/ JNot a real method of detection, but a good way to know if SoftICE is
. R( y9 w: ^% x5 O8 F. uinstalled on a computer and to locate its installation directory.
  Y3 L1 j% w* C' ?1 v& bIt is used by few softs which access the following registry keys (usually #2) :. U2 c* x: M; O- R) K/ U. b
; [$ Q( q/ u' S6 U% n+ n1 t, l
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 J! [5 h$ N0 l! \7 H
\Uninstall\SoftICE! V  M+ [4 \: G/ E9 z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% {; b" L; Z0 _" Y; u( w-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  \1 o3 D# A; r- `
\App Paths\Loader32.Exe
' r5 s. s4 C- l! l% {) w/ T% F- O
2 H6 j8 \- H1 x, I" d
# o/ H9 n' m& V! _% r5 a2 @Note that some nasty apps could then erase all files from SoftICE directory2 a- }# y& u3 L1 _
(I faced that once :-(* S* L! f9 d. a
2 s( X' V  L7 {& B/ R* B
Useful breakpoint to detect it:
& k5 J' F8 N: K- i2 v
: {+ u* g0 k# K4 @     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 X1 @3 P. [' V3 a

0 t* [2 J* X% ?2 X1 w8 [__________________________________________________________________________% D' |; C- l5 f! J

6 [1 n8 J3 p% [! ?
& ^; Q# d( N7 j) h; U  d) b4 `Method 14 9 `  ^  f+ C% M6 l+ b) V
=========; ?8 d7 r4 r' C2 @7 y5 ~

7 M3 u3 f4 `+ f3 XA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 N& o4 ]  Z5 M5 [5 q0 j
is to determines whether a debugger is running on your system (ring0 only).
- i0 W( K$ ]) ?$ C0 ~3 |' Q+ O
! P+ \2 F7 M5 j   VMMCall Test_Debug_Installed7 e8 M7 q3 u# K; C/ `; U, d* M
   je      not_installed
. P5 g7 L2 ^8 L# B3 a6 }: S
% ?% V& f8 i- cThis service just checks a flag.' B- I! r# ^0 P/ L. v! i8 O
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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