About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 f: a. a$ p% b. @  ^<TBODY>* ~2 E8 G9 p( E& F: ~! T
<TR>/ \5 ^) `- A1 s7 d% r  P
<TD><PRE>Method 01
5 n! z' @% u  p9 g9 K4 p1 N=========& q% V. E9 w  r$ e: G* {
/ B2 [, P, m0 X! |4 Z1 j+ \2 g
This method of detection of SoftICE (as well as the following one) is8 X) }2 |; g& H6 g0 j' z
used by the majority of packers/encryptors found on Internet.+ E0 m6 j( @# ~0 x6 A0 q* [5 s
It seeks the signature of BoundsChecker in SoftICE
/ k% p& X5 h& Z3 B0 F
( \6 R3 o0 p! N  T" Q4 ^    mov     ebp, 04243484Bh        ; 'BCHK'7 c; O. A; D& L  \
    mov     ax, 04h
" [9 v1 I+ G5 r7 x( S6 j2 Q' ?/ O/ ]# i    int     3      
& \* t" r% z9 H7 F& |    cmp     al,4% v; J/ v' B& A( `) }
    jnz     SoftICE_Detected
# o6 R) r# `. m7 u- N: ~; x; ~# K' x' U
___________________________________________________________________________( E6 Z+ m- d. ~; F# N- z/ h3 `+ d% @4 Y
+ ^/ h6 M9 l8 `; p3 q- k( k
Method 02
7 I/ \- u: `8 S( |; J=========5 u& L9 d  l6 ]0 x  k

$ F, r1 [! W6 x, A; q. }Still a method very much used (perhaps the most frequent one).  It is used
1 E7 H$ Z; m' b0 ^3 {/ J2 o5 d5 {to get SoftICE 'Back Door commands' which gives infos on Breakpoints,# D  P. f/ Q" M8 i/ H
or execute SoftICE commands...
' t2 F8 m' f  V- `8 VIt is also used to crash SoftICE and to force it to execute any commands
6 B. c5 J0 q2 V, O) {; c: l6 F(HBOOT...) :-((  ! Y5 o4 T& J$ z& y

# c# z# E8 |2 t9 u7 y& nHere is a quick description:
# P. L3 O8 ^1 K-AX = 0910h   (Display string in SIce windows)3 z8 H" ~8 e, \& y1 {4 U" B4 G
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& f5 E. M7 [- d/ z1 y7 t" x-AX = 0912h   (Get breakpoint infos)
" ~" f" P0 k+ Y- |-AX = 0913h   (Set Sice breakpoints)3 z& ~+ K: \- ]' k$ ]- D: F
-AX = 0914h   (Remove SIce breakoints)9 T% E# j9 r% i& {; {

& R  p2 q4 i$ [) k/ N* ]# g# pEach time you'll meet this trick, you'll see:
$ R5 F6 E$ L' {3 i3 X-SI = 4647h4 ^8 S# D2 W# a4 q7 R( ?
-DI = 4A4Dh
/ J2 k' E8 K: ^1 I  ~Which are the 'magic values' used by SoftIce.
! V* p1 C3 ]* }, b2 O9 |For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 U7 z( J- `# E- `1 G9 i

- t* Y4 x4 k  p! H& BHere is one example from the file "Haspinst.exe" which is the dongle HASP/ q" D5 p, U# E$ b3 R8 h
Envelope utility use to protect DOS applications:
; x# s4 C/ m; h6 x& j' v
8 E3 Z7 {+ T, I! y+ m2 J- E4 \
  p9 ^2 X7 V2 n1 d; P% |4C19:0095   MOV    AX,0911  ; execute command.) D4 h: ?) q& o6 X4 |: I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 E3 j  y, C# `5 o+ W( x4C19:009A   MOV    SI,4647  ; 1st magic value.7 _: W& t9 K6 a& Z3 d
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( l# F7 {$ z( N, r5 n4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
; E/ O2 i* f5 w" x# }% U4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute2 u0 C( i, f% w7 m  v7 U
4C19:00A4   INC    CX
/ ?( {; K, q6 {' E/ ?* ^4 w  l4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
/ e+ ]7 ]  Y  Z/ {: u' K4C19:00A8   JB     0095     ; 6 different commands.- J; _' }  ?/ i- B, f5 w" U; `
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  a7 Y4 ]% H5 S1 [( Y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# S6 t6 V: V/ ~. d+ V0 I' b) f* l8 `8 @- @. V5 }. b+ c
The program will execute 6 different SIce commands located at ds:dx, which
  b8 ]  ?( C8 D4 N* Y* Yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 N% C5 y9 g4 ^; H! f  w+ ]
) q7 d( C4 Y2 s* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 }) h+ [% N% R" v- k  O
___________________________________________________________________________$ h+ W/ I+ g; [1 n  z5 ?+ r# a

9 e' @: n" j- ?5 o- D. }
! z' X) \& i& nMethod 03
* o/ `% m" ^5 z" R=========' b  f$ J( h* `2 q5 C
& U7 H/ ]5 A" U, R# I
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 z$ H! K2 ]' y1 E' t& m# g
(API Get entry point)2 b; N: |# O! H" p; U
        
5 l, m! _6 w; X* S7 ~9 k6 d( a/ l  J
1 c5 c% Q% _" F- P    xor     di,di
& u3 t# I. {* H; i2 Z    mov     es,di) M, I& K  L& l4 z8 ^1 E9 X
    mov     ax, 1684h      
! J" V) t' H4 F5 P$ S' R    mov     bx, 0202h       ; VxD ID of winice( h7 U" ]! W* t4 l5 b
    int     2Fh* k' I& q) `# C8 P, q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- M9 C5 s: ~: m4 [, L. e9 L% q    add     ax, di. H- l7 @2 a+ Y/ Y
    test    ax,ax+ k. g/ ]( a" I. n' E# }5 n% ^
    jnz     SoftICE_Detected
+ h. Y5 g0 |% p: C6 g. [0 G3 S& \  {0 |: }5 f6 l5 ?5 _$ R
___________________________________________________________________________3 l$ i7 P4 N8 |+ ^& w

4 \1 w. B" Y7 o0 {, q; pMethod 04+ \/ b) V: i+ i$ u2 {- W
=========* b1 p0 I" @: z" h) s6 a& k
0 H( w) w! s- ~
Method identical to the preceding one except that it seeks the ID of SoftICE
9 L  u# V* a& t( E3 G' |- xGFX VxD.' E* I) D) B  X- `. l" u0 C0 |2 I

1 ~' ~3 Q+ Z) O+ _0 n    xor     di,di# g/ B8 V( L% A
    mov     es,di; e& D$ ?! q- A- Z0 `" ~
    mov     ax, 1684h      
& D' c2 r  F6 Y1 G2 N% l    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 Y4 F8 h7 N( t6 T7 |    int     2fh) T5 H# ]2 I3 s9 z' m& y" N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 Y( i+ ?2 K% o) L, F    add     ax, di
4 a) y) l; Q# d    test    ax,ax
+ w* U$ n# y) c9 |    jnz     SoftICE_Detected: I# s6 X% Y- S: ?9 U6 ^. b+ k

* }2 a- U) N1 e* A0 A__________________________________________________________________________
3 b7 q  A; V4 l, s& @& e
' i5 `: ]) B; U0 ]- @. f
; b4 z0 |6 _: S* TMethod 05
. i# o; Q- N0 M/ M. V1 g  b6 j( D=========1 t3 s" q6 T8 C0 z& [2 S) q

7 T/ G9 L! u8 k0 [1 w/ m( TMethod seeking the 'magic number' 0F386h returned (in ax) by all system) D% Q" F8 b: J; j1 O# r
debugger. It calls the int 41h, function 4Fh.& q  s+ s+ w- |! h# {4 e
There are several alternatives.  $ O9 [. G* d) [+ D

1 K4 E0 o/ ^  c- G+ d* QThe following one is the simplest:+ P9 s3 x& m7 o# f

! ?$ F/ ~# t5 z: `. f. k* ?- ~    mov     ax,4fh
6 _- m4 x& i4 Z# M    int     41h& s# L; V; L2 C3 c$ H' R
    cmp     ax, 0F386/ ], t( c2 B. w6 K% W
    jz      SoftICE_detected/ o9 l& X; y5 R- p

6 a2 M6 z) S& l5 h
0 `$ v; c; ?9 v+ T8 D  J& Q5 PNext method as well as the following one are 2 examples from Stone's 5 s$ [' c. b1 ]0 M$ n
"stn-wid.zip" (www.cracking.net):
( G( t, h% o# i( k: S
8 |8 v% u1 K$ v& i    mov     bx, cs
5 G+ A, I5 u4 H    lea     dx, int41handler2% a  [4 V* N# [5 @* H4 n+ }
    xchg    dx, es:[41h*4]  _4 `5 a/ M: {, p' `! r
    xchg    bx, es:[41h*4+2]
* p3 y& r$ L2 t# ?    mov     ax,4fh
: d# L6 f& P8 {+ e% b7 M    int     41h" a+ K8 U. Z# k! ^
    xchg    dx, es:[41h*4]& ]( P* `- w8 p: o
    xchg    bx, es:[41h*4+2]) g, i0 c' n$ z# W/ H
    cmp     ax, 0f386h" G6 {7 d' Z1 I: W* N% |) D: n+ w
    jz      SoftICE_detected$ h: K" Z2 _* _9 h3 u# I1 B
6 U: G* x% @1 b5 @
int41handler2 PROC& _' I  ?- G  T; ?7 x0 R6 h5 ~9 d
    iret
6 ]3 q6 F$ w% c5 P/ R& h1 @int41handler2 ENDP6 ^  M# ]! `5 i

0 ]6 P2 _3 f2 x9 D! I1 d! h+ o
_________________________________________________________________________4 M3 q- P, W5 A9 a

2 [: ^6 ^3 k; {# n# _6 i. M) `' J& i: O* ]  J. s, s
Method 06
8 w0 x- L. a6 P) ?2 J=========
3 V2 B  D/ }, v3 e! V! W: w  ^& H9 A: Q( H' ?9 {8 n
( H7 U# K) p# `9 s4 g5 b* Y! u
2nd method similar to the preceding one but more difficult to detect:+ N) b( u6 G: U" f- F
, e: l: z4 S& i) Q7 [6 g; ]

" t+ z  K; h' a' K# X! |int41handler PROC
: a' U1 B8 e7 I( S    mov     cl,al5 t  g4 u/ t4 f* b3 `  {8 j
    iret* ?  F5 L) i1 ~5 d# s$ V. l5 w
int41handler ENDP  n3 W4 d$ [7 i, q1 J* N

& z0 J. h; f, x; ?0 q) j' |! N8 P. c/ Q: u
    xor     ax,ax- x3 b4 e9 Z0 ]6 j$ c; t7 X9 X' Y
    mov     es,ax' c/ W  L0 U% O  z5 s2 I0 D: d
    mov     bx, cs' O. Q9 T' m$ ?* L
    lea     dx, int41handler2 i  U! j% \5 t* x- k
    xchg    dx, es:[41h*4]  t( U! Q8 G+ w% E& \  H8 a5 j
    xchg    bx, es:[41h*4+2]
' s) q. A6 ]8 t( C' ^6 M( Y    in      al, 40h
" e. E6 Y' F+ N    xor     cx,cx$ p9 G, O: f  q+ E% y
    int     41h, {$ W6 ]9 X5 b$ F# G- v' v
    xchg    dx, es:[41h*4]8 B  x- R4 h) }* f' b( m, V7 S
    xchg    bx, es:[41h*4+2]8 M8 _* o+ H! _2 |7 R
    cmp     cl,al
8 e# u' f7 [. a4 Z9 j. f    jnz     SoftICE_detected
* n$ O1 c) D4 b% q  z8 P7 e3 V0 t! a2 m- }
_________________________________________________________________________3 P2 Y3 Z5 G. K8 P) C

5 O0 O' N; N( B) H# U8 w' dMethod 07" u) ]+ H$ Z3 G0 Q% U) e# s$ m
=========. c+ ]! b0 q$ \% l9 F

& W% `; B) O! ~) @( c8 KMethod of detection of the WinICE handler in the int68h (V86)
- c6 ?- I& s& ?. L% g
6 w- _! [% a! ~1 g; |    mov     ah,43h+ Y. e. Z" j4 Y' l/ I4 b$ j. z# n: ~3 k
    int     68h
2 p6 d; P' A: \' f" U  a  D    cmp     ax,0F386h$ b) O5 n* u+ y7 c$ T7 v7 t
    jz      SoftICE_Detected
+ U; O/ I+ A' h& M; P4 |- ?6 h+ W3 {
' w: i7 e( q9 k
. U) `' {. A# f2 h$ ^/ N6 P=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit0 y6 o: _8 w3 }0 D8 D- U# q' {' `
   app like this:( i' u4 x; L/ q% O  L
$ E% v' L  t. x: @8 L; F
   BPX exec_int if ax==68: i5 r; ~+ }* o
   (function called is located at byte ptr [ebp+1Dh] and client eip is6 j, \! C. g7 k* f7 a) }
   located at [ebp+48h] for 32Bit apps)( T8 F* @: v7 F$ z
__________________________________________________________________________
# ^2 ?0 D: ]( X3 z! ?
7 ?! _, j9 K. U  X
2 I( ^" o* s: G* |' RMethod 08  v( P2 c) ~  W3 S& h: J6 o
=========
1 V! j+ e- g* o  M2 d% T) b. v# w0 c* I5 @0 Y
It is not a method of detection of SoftICE but a possibility to crash the
6 |: S. h9 Y/ W$ msystem by intercepting int 01h and int 03h and redirecting them to another
8 Y/ J: S- R5 Z( \4 w, Proutine.
8 a, F1 V7 s6 d0 NIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' \& T$ y2 ~0 `; |to the new routine to execute (hangs computer...)
2 }; X+ q) Z( K$ ?, [; `5 V7 c0 J
1 [8 W# T9 o& z+ o! ]& X    mov     ah, 25h3 @2 y0 \( [  j4 |9 k
    mov     al, Int_Number (01h or 03h)
8 b$ C" X! l8 B8 N* U* u4 w9 Q    mov     dx, offset New_Int_Routine& f$ |* H1 E0 E; y
    int     21h
0 [+ f" R& K7 {9 W; q( D- O4 A  Z
" j1 @. C" c# c, [; T1 B__________________________________________________________________________
1 E; K# L2 N- A' L/ E- s% z
6 n/ n8 W3 L6 G$ _1 q4 t5 a. g6 LMethod 09; x* f+ s# s5 G% Y
=========
2 M% W  S& w7 \7 B" f" \- i2 v) T, s# f5 a6 _
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& A: a6 ?. p8 T2 A& S, |performed in ring0 (VxD or a ring3 app using the VxdCall).2 V- l2 `" @8 [) W% Z
The Get_DDB service is used to determine whether or not a VxD is installed
5 x0 M3 C$ ]9 ?7 A2 r7 C# ofor the specified device and returns a Device Description Block (in ecx) for
' o% u( l! t7 ?9 j' Ithat device if it is installed.1 k* M4 m' l& I$ Q: a
" z! [2 H, K$ x( _! n' _
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: A0 X/ _% p. z8 y- w5 s# d   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ q) [0 p4 {6 @( G) Y& \2 @
   VMMCall Get_DDB
, k9 B; J+ ?) k& {$ _9 q6 F; _" M' t0 H   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: q& x/ _" w4 U- e* M% m

$ e. `( u6 O/ k6 |& INote as well that you can easily detect this method with SoftICE:
1 n4 V3 F4 A% Y+ S0 H. E7 S3 M* Q   bpx Get_DDB if ax==0202 || ax==7a5fh, c& m! ]0 J$ [* i, B3 z+ d
+ ]4 X+ a( }+ G& ^9 ^
__________________________________________________________________________5 a; c6 {; n, }
) q  T& E0 ]2 @% g
Method 10' ?  l' V2 \8 `! b, h, O" B
=========  P4 i$ c; c+ @2 S' V% w1 i

" U% X5 ?% H9 T3 t( d5 r2 F8 M=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& q" k6 J# N3 R. r5 O8 @: y) |  SoftICE while the option is enable!!4 G# C- W3 N; o4 b

2 `6 T2 I- H  h2 u2 b2 k9 j: m0 NThis trick is very efficient:( e' Y. m+ x2 Z9 v
by checking the Debug Registers, you can detect if SoftICE is loaded
, a9 y' i  i* I' Z( R& B(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( f: m" _2 u# ethere are some memory breakpoints set (dr0 to dr3) simply by reading their
3 j% |5 x( m- {* @value (in ring0 only). Values can be manipulated and or changed as well
7 c7 W! i8 x! Q( T4 B! M1 [: [(clearing BPMs for instance)
' N9 }. o0 D" r2 _" G/ x* A" l6 J: E- c/ G- o
__________________________________________________________________________$ s% N! v4 g8 }/ f& _
7 I( _8 y3 f5 Z& E6 _0 G
Method 11
8 g) l+ O' X  ?3 ^$ q. e  s=========
* s6 x. U4 x$ {7 p& Q& w$ z1 s- X+ g$ y, F7 H
This method is most known as 'MeltICE' because it has been freely distributed
- \# I/ G* V6 T( J; yvia www.winfiles.com. However it was first used by NuMega people to allow0 [( M" Q: z+ D9 r
Symbol Loader to check if SoftICE was active or not (the code is located
# ]# t2 n" [* w& einside nmtrans.dll).
; D8 L) e% f6 A
8 r+ B7 W9 ~# A4 KThe way it works is very simple:
3 R* {/ R  ~0 v3 y/ p: Q9 D, rIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% V* H  w6 }  D7 K
WinNT) with the CreateFileA API.
6 X3 V# X) s/ [  V- p
. X' S7 ~- p) H& ZHere is a sample (checking for 'SICE'):3 Q" Y/ r! T# W

' `) J0 X# P( v/ jBOOL IsSoftIce95Loaded()
% M* o- ]2 M9 O0 G* l) e{) q& M8 n; v8 L# ~
   HANDLE hFile;  
* I  ?: m; r0 G% M+ A6 `   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& G8 f7 _. ]$ h) e7 S, M/ {0 X                      FILE_SHARE_READ | FILE_SHARE_WRITE,
3 L; k: k5 i! N0 Y- B9 V8 r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 X( ?- H& q3 x8 i( L   if( hFile != INVALID_HANDLE_VALUE )% U8 F  {! `0 S* `) z3 O. C
   {4 P( {$ Z$ Y* J) J" M& x1 Y
      CloseHandle(hFile);
) Z% H) `7 R* ~      return TRUE;
! v! b2 N5 J; M; j6 X   }4 w8 r" Z7 ?* C* f/ F# n8 L* {
   return FALSE;% m  [9 Z" n$ j0 r1 L3 t$ p
}. \8 b8 l, z: e# W& E! `3 N; p% O
5 e3 ^0 h9 G) x  X. M4 i
Although this trick calls the CreateFileA function, don't even expect to be
5 f% I' ^& `: n/ e+ X/ Eable to intercept it by installing a IFS hook: it will not work, no way!9 O$ s$ H) A6 }, I2 \$ N
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: x; r, C. s4 [7 o" N6 o! ^
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ L6 H  ^6 m# R0 }2 U5 band then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 m9 p( R8 w! h, g9 v% q2 |field.
( s4 j, S$ [4 w; o7 ~6 M5 PIn fact, its purpose is not to load/unload VxDs but only to send a 1 {$ [/ {* t+ @
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 l( v7 E9 Y4 J' _! Kto the VxD Control_Dispatch proc (how the hell a shareware soft could try. x1 r7 u; C, }% [, ?4 q& i  l
to load/unload a non-dynamically loadable driver such as SoftICE ;-).% m# q; q* ~1 ], F; }: G2 c$ \
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* ]3 V0 N" B( K6 s- u$ Sits handle to be opened and then, will be detected.
) S! t% F0 Q* lYou can check that simply by hooking Winice.exe control proc entry point
. Y  d; J$ d, Q# ]3 _: Nwhile running MeltICE., f) F. @) G: \6 W; O/ h3 w9 k% ~

, E2 i' S$ i! f/ p. K4 U1 `8 n1 J, L  U
  00401067:  push      00402025    ; \\.\SICE
2 N5 K1 `; ]9 }% Q% `! `; t  0040106C:  call      CreateFileA, R' `+ ~4 W0 a# v6 ]! }" p2 m3 _
  00401071:  cmp       eax,-001
$ s+ T8 T  c% H. {9 o  00401074:  je        00401091
& ~9 `0 B: X' y) t" i! d7 e" v1 @  U6 x' e

0 L2 A6 S/ M& ~2 h  T* d( P/ T( rThere could be hundreds of BPX you could use to detect this trick.
) M+ \( d. ]7 e4 i-The most classical one is:
" S7 g0 h- B% v: d  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ K+ t' i$ R+ a4 M& W% }: M
    *(esp-&gt;4+4)=='NTIC'" |; G% Z$ @+ _8 m% Y
2 a# e  |* \0 N  Z
-The most exotic ones (could be very slooooow :-(
" ?, g, b/ |: L, i3 n   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( h: A* Y3 I/ v* G
     ;will break 3 times :-(0 B* T: C% x; \; k4 r

- Q. B7 u" |3 j# W0 S-or (a bit) faster: + ]5 r5 r; }% f! M) n' \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( d7 [; h( O2 O- s
4 U! i5 r6 k  m& A4 L' T3 T
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 g/ i) n# w' A) x! F3 t& n     ;will break 3 times :-(8 w' u9 D! ~, K2 h! [
3 R/ w0 b! U" ?$ G) e; K. d
-Much faster:+ q# w1 ~3 L1 t8 ~4 n# }% ?8 h0 v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, ^; L. N- k% u" U/ c* H; W2 M! H" ~* I- }, W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen+ x8 m+ ~3 _. h! J
function to do the same job:
5 c# A  \/ Q6 c- ]. l
& b3 G3 z+ l* j. {& l# U) F   push    00                        ; OF_READ
  v; {9 e+ `5 X# P' C   mov     eax,[00656634]            ; '\\.\SICE',0
1 o" v0 ^. g: _0 n' N4 e" Z9 n   push    eax
/ |' }: ^8 X) A! U   call    KERNEL32!_lopen
1 E  u+ O2 |5 k, a5 Q: o   inc     eax. w  g* @& Y% G
   jnz     00650589                  ; detected
# v5 }9 J, j5 K* }' L6 H6 e   push    00                        ; OF_READ- g! N! q" Q+ `- l
   mov     eax,[00656638]            ; '\\.\SICE'
9 a+ M! i: Q1 U" s" u) A2 D   push    eax
; G- Y* \2 k% A& a' D% ]: i) n   call    KERNEL32!_lopen
+ H) ?. k& O% a3 O8 E7 E   inc     eax$ q% a9 {6 M" J* x
   jz      006505ae                  ; not detected
- Y$ W4 Q: K( u4 @1 Q1 Q  Z: e% B$ g( H" {  G

' i6 |3 w' d- z( k' J__________________________________________________________________________
9 |1 i6 y$ }) Z/ U, x; L0 T) r  K8 J5 b( F) ?
Method 125 h% C0 ]( F/ W0 L- T8 \
=========" H/ Y) U- P" F& \# G( j2 j# x/ I

- I2 b4 [, Z2 a: A5 w! t" R) qThis trick is similar to int41h/4fh Debugger installation check (code 053 C6 a7 |# n  Q) Y9 F
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ I# h8 }  w9 Tas it uses the VxDCall backdoor. This detection was found in Bleem Demo.& f+ Z5 u; Q# [" r+ S
6 q6 z2 l5 [, n. F
   push  0000004fh         ; function 4fh
+ {7 y0 N% ~2 D4 i   push  002a002ah         ; high word specifies which VxD (VWIN32); g7 Z1 P) E( a  C( l2 |7 l; m
                           ; low word specifies which service
. X9 Y) l, F- v, K                             (VWIN32_Int41Dispatch)
( Z4 e8 g$ ?) n: A) C- Y' }/ W   call  Kernel32!ORD_001  ; VxdCall
# T7 Q- p' L8 f   cmp   ax, 0f386h        ; magic number returned by system debuggers- `3 M5 _- g4 J! f
   jz    SoftICE_detected8 D5 q1 Y1 X! B7 ?
1 m" E# A% y4 C2 w' R1 U: a9 E. V6 r  j
Here again, several ways to detect it:! ?, g# V, d0 x, P( g2 L
8 P, }6 I4 c7 S4 p& v
    BPINT 41 if ax==4f
5 q: n/ Z7 A1 ]: B- ?0 g; I
! t4 `5 F) _& v) I+ |+ g    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 Q! s) E- E2 L& \
% b* m+ M5 t6 S
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 }  b" r) f3 H8 z

0 t# `: A: r; D0 E' N    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* Z9 r5 u/ k& ^" F4 \/ h- q; v- l7 @, v( s" O3 D5 }1 K$ |
__________________________________________________________________________3 i+ Y0 J* c- `) f# y
0 ^$ T! n4 F( }7 R3 e$ b& D
Method 13
+ V9 |# n$ x1 }( J! {# Z=========& r8 h& X$ v3 x- q/ M
; ?7 L4 l! h& M& P3 ?
Not a real method of detection, but a good way to know if SoftICE is: o) f$ H$ z2 f
installed on a computer and to locate its installation directory.9 C4 `& c" f# }0 h, U; M
It is used by few softs which access the following registry keys (usually #2) :( @5 c! }3 p/ c
0 ]4 e  W. K( \2 F* x& Y, x
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ g+ ?0 B- T0 J) n6 K3 \
\Uninstall\SoftICE( \' N9 I  y" b7 b
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 ?& d. T9 K* D
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! K$ G0 g% |7 t1 b( x+ `4 b: K
\App Paths\Loader32.Exe4 H1 o4 F: V5 q# z- ^3 c
7 `) B, H0 a# H* l7 M5 P
7 G/ d! ]8 `/ u
Note that some nasty apps could then erase all files from SoftICE directory  W; Y$ ?9 d! _, C. ?
(I faced that once :-(
8 l; Y( L2 q* T. \/ A5 ]4 c& |( V" _: O% g
Useful breakpoint to detect it:
, N7 |$ w1 A" i! k" P
( A2 h7 k- e; n: b9 @& }     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; y: B+ H6 w. t. c) j3 a5 D

$ R; ^+ `7 H0 W! D__________________________________________________________________________
- {( b6 k6 o8 P: {) Z1 _
. M  F6 @0 h# g8 o% y# N, \+ d  n& q* k
Method 14
: I6 J. Q' [9 [5 B* I0 E9 l=========
+ H  ^$ D# i4 o, }# y: A/ A6 ~' Z7 q8 ^" `3 w
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ w' o, I3 |7 C+ c# a  Ris to determines whether a debugger is running on your system (ring0 only).. F8 B6 {# O! e& b4 M% o  j1 b: l
$ n/ A% G7 H! {: B9 ?) X* L2 U0 M
   VMMCall Test_Debug_Installed
0 G( ~' u/ q+ y: d: ~$ }   je      not_installed' l7 g/ j- Y- i2 U" e

0 n$ G* [% [; i4 Q5 X; EThis service just checks a flag.
2 D) q6 m8 J$ b8 Q) b</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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