About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 T9 r. {% @& I' [0 w3 c$ c<TBODY>- q. P; F$ V9 b/ N: A$ W- `
<TR>
- b# S  q  X! d  m) Z& W" t<TD><PRE>Method 01 % V6 |. O) v/ B- s
=========
, D; c2 C% m. h+ L1 d6 A0 f7 U* K- F& Y0 h
This method of detection of SoftICE (as well as the following one) is: j9 u& S7 Y' M% X) x+ g8 D/ `
used by the majority of packers/encryptors found on Internet.6 r- e$ f3 v8 O& B9 {
It seeks the signature of BoundsChecker in SoftICE
& H, p! Z& x  c7 F1 G
8 a) A  g* d/ \8 m    mov     ebp, 04243484Bh        ; 'BCHK'9 ~# W# ~* C  ~$ f
    mov     ax, 04h
& f' h: P* ]/ p5 e  x+ X* d    int     3       # f6 |& @. W5 O5 Y: C0 Z% z$ H5 `, ?# q
    cmp     al,4
. {) G# f- p& s" b7 g3 K" V" V    jnz     SoftICE_Detected3 K; x: n2 c8 F- {
* Q  @% ?+ D, t& I; G
___________________________________________________________________________
6 z& C. `+ G: H+ O0 C# Y1 L, U% b0 J0 o
Method 02+ X# Q+ `( A6 x
=========
# N& Q( h* j# I& E3 N/ v# |/ [$ o) C7 |0 t9 s# c
Still a method very much used (perhaps the most frequent one).  It is used* R& o( v4 q) p$ ^
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,- c9 h1 \; {+ ?, d$ D
or execute SoftICE commands...+ K! e6 e! d: x* L1 t
It is also used to crash SoftICE and to force it to execute any commands
: Z" ?+ j1 D4 l9 f, M# h7 [(HBOOT...) :-((  - |; ^5 O, k, e  V2 q3 q

; Q( R7 X$ R0 o6 N) x3 ^( B2 yHere is a quick description:: N& U9 q( n7 T3 A
-AX = 0910h   (Display string in SIce windows). g& D6 {/ q; k& q* D* e* L7 n' \
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# F  N( o4 P1 O* ^& o-AX = 0912h   (Get breakpoint infos)/ ?9 l% S2 [5 \! [$ I
-AX = 0913h   (Set Sice breakpoints)
' u$ _2 Y) M; B* v/ a-AX = 0914h   (Remove SIce breakoints)( c: I6 o- r4 G' H
2 ~1 W5 u* Z  T2 [2 U: l$ P
Each time you'll meet this trick, you'll see:) }  s% T/ ~% A" o6 }: J
-SI = 4647h' p$ }0 \* \) Q% p. w: y
-DI = 4A4Dh
5 n5 Q5 i% j$ S  bWhich are the 'magic values' used by SoftIce.# ?3 r  O0 ]# i3 T3 W  I$ b: q
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# M4 |5 H/ T7 X) E7 }  T+ k( @+ c! s
$ |- e5 M# j6 M- h2 E
Here is one example from the file "Haspinst.exe" which is the dongle HASP
! Y2 w" ]( p* }; d5 B) ]8 fEnvelope utility use to protect DOS applications:
# b9 G: a8 `( |
1 D- M: _5 _$ l  |& R# {$ \3 e
4C19:0095   MOV    AX,0911  ; execute command.$ R8 s' |, s0 Z" e2 P$ ?0 F
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) c1 X: ^/ u2 C/ S
4C19:009A   MOV    SI,4647  ; 1st magic value.7 @7 G! b$ y2 r7 R$ S% f; f
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
7 z' n3 Z2 g6 s/ m8 v5 @4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% s! p- l9 I7 b: h- o, F4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 c* o" u* z5 K0 N4 m. b6 T  `
4C19:00A4   INC    CX
) q, C- k2 ?, s4 |' ]/ R4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! M5 k  s" N% k
4C19:00A8   JB     0095     ; 6 different commands.
6 y- ^- i$ j+ P4 C/ _* Y  |# y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 H& W7 \7 g, n& O+ O) x
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ W# R$ h( k8 @; w5 y9 ~
9 J/ X* N/ o- _; p7 Y
The program will execute 6 different SIce commands located at ds:dx, which8 e; |% u, J5 Q) Y8 {5 Z& K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 ^' X. C* h' \' l- L2 q
; N3 [! r$ i% J* j- l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
! E; F) ~" ~# i; _5 G& u) K9 R___________________________________________________________________________0 ?0 B4 H8 Q' U/ B
( x/ b) M" q1 [# b  Q6 h+ V7 q+ B
6 A" m# v; Q( v; J, d# R
Method 03
- a/ Q+ R" g0 W* m) s1 t7 `5 u=========2 |% [% j' p( s! `: t

0 s: L8 n9 t7 G7 E7 HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! x  P, Y$ r: v9 q- O
(API Get entry point)
/ p. y4 |# S* d5 Z$ y        , W, r% |; ^) c
  r7 }: q! r: D" b' t
    xor     di,di! E" E' Q  Q* @6 z7 R3 A$ s: r2 ~
    mov     es,di3 ^- f" T5 N7 `* ^) H! x, u
    mov     ax, 1684h       0 i) H, }1 \5 I7 `
    mov     bx, 0202h       ; VxD ID of winice6 f3 ^; O  u7 g+ m9 B3 |
    int     2Fh
3 m7 a: S; R; Y4 @( G! n    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% {2 F! D0 `: @- L( i    add     ax, di
; R4 R% _& V/ }; [/ b    test    ax,ax
- |( L* `$ A* f* q& ^    jnz     SoftICE_Detected
& U" \4 S6 Q: b4 J- v/ X9 B* k8 C6 G$ E
___________________________________________________________________________
$ T7 Y2 B% F+ Q! l1 W. W" a8 W& V' N' j+ Z% Y
Method 04
; W' z/ R& A5 X8 f=========& K* w+ o1 a& r( \( A
0 y1 b  L2 C5 a) ~3 U: s( {8 |
Method identical to the preceding one except that it seeks the ID of SoftICE
3 W6 l* n5 R. ]GFX VxD.
& u2 _3 G6 J+ }  W/ R8 S' m. [8 p
7 Y. m4 W& a' {" K/ u    xor     di,di. Z$ I$ [% o# |4 u0 g1 u" ]  H
    mov     es,di, z" ~; A) \/ V; C1 ^$ |# X
    mov     ax, 1684h       $ J/ A+ w$ z+ y! ~: |% e
    mov     bx, 7a5Fh       ; VxD ID of SIWVID  b! x0 |; o7 U) f- h/ @! m  X
    int     2fh9 [- C( S: _0 Z  J' k  K0 O
    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 g5 T; [! T( D9 S
    add     ax, di  l5 l8 W0 K$ d6 ~, X8 q! F
    test    ax,ax8 @* B+ y, P  ^3 {+ G' s
    jnz     SoftICE_Detected# k0 E8 U/ i0 Y: P
! @+ f) V/ K9 l# C1 c: X5 \! |
__________________________________________________________________________
/ B- l' V. o% P& ~$ Z- g
% a4 i6 T/ `7 y' U! s
9 o. c) H4 G$ l. c& A% fMethod 05; B) J# h3 A4 ~
=========1 R6 @* ?) ^4 h7 }
* ~/ V) b! u6 C0 t: n
Method seeking the 'magic number' 0F386h returned (in ax) by all system
: g' {! I8 r* L# L5 ^: g3 K# ~+ _debugger. It calls the int 41h, function 4Fh.3 A% O6 m2 M1 B8 ?) d; ]5 h
There are several alternatives.  & e4 L9 T4 h- r0 m. H  D0 C

: }7 B0 N5 w; {1 \; ^8 h3 l9 YThe following one is the simplest:
( Z% X! U1 E3 b, z2 l* P; Q
" W% d/ x, w0 ^/ C, h+ @) P    mov     ax,4fh
6 ?8 \8 u1 m+ c( K. F    int     41h1 Y6 j! X" k0 _" Q
    cmp     ax, 0F3864 ^. W, Y3 X# v2 \$ `' g
    jz      SoftICE_detected( m- H' b" x( @  T! h5 J

' v; Q3 j7 l8 R- s/ J
2 N( C  ~: s8 v6 x$ wNext method as well as the following one are 2 examples from Stone's 0 n" U6 B0 m2 A/ n
"stn-wid.zip" (www.cracking.net):
8 M/ U4 z5 S: O2 U2 U) M1 B" |1 U
    mov     bx, cs% J, N2 W) |8 {5 w* n9 r
    lea     dx, int41handler2
" j6 E0 v9 O7 W) U4 O    xchg    dx, es:[41h*4]
2 f; \7 e2 j3 b' L    xchg    bx, es:[41h*4+2]( ]4 t6 s6 {; E( Q; {
    mov     ax,4fh7 z, P. O! C# k' z; j  G
    int     41h
& q2 r! S8 f0 R( W7 J. A$ E    xchg    dx, es:[41h*4]
  b% U7 n* y. y5 I    xchg    bx, es:[41h*4+2]
. _- B: b, d" _+ K- S( M% E    cmp     ax, 0f386h
/ K' j7 ?5 o; [, Z. K* E: `. N    jz      SoftICE_detected: S2 ~( i& {5 M, T

0 D4 d+ L9 D& \  j) k7 kint41handler2 PROC; C! S# K3 T% ^3 S1 K
    iret" d! n4 P+ D$ {' p5 b4 u
int41handler2 ENDP
3 b. ^' B  `6 Q2 F, w! ^5 n* p0 K- p' I
  S6 E% t# P+ H
_________________________________________________________________________% c3 \6 }7 Z& D/ j) s8 P9 k
; J5 Q7 W4 V6 p0 z, ^1 U: n. I

% p. f3 _7 m( V" @3 ^$ g* |( zMethod 06! T. f8 A1 C+ G0 ]( P
=========
$ K2 a0 I7 A5 `/ M( z" T6 ]% `9 ~. a1 h  d1 C9 q

1 w/ f' x1 G2 a) |# L2nd method similar to the preceding one but more difficult to detect:) m1 K; G- }  A+ {: z
% d5 t$ |& l% I! i
% x6 ]' r4 R- q- g+ G0 u; j
int41handler PROC
/ [) x8 c1 C' r0 F6 \7 T    mov     cl,al
( r7 S: `' q9 q$ u( n    iret
$ Q8 D* g  Q8 z& w7 w  lint41handler ENDP$ i5 U, g6 J; I0 z
9 F0 @- t1 z) G- o) G% r

3 o* t3 k/ p1 _, t; i    xor     ax,ax- O# W* c$ E$ k
    mov     es,ax
$ _/ N9 e+ O; q% P    mov     bx, cs' K$ _! ?+ M9 V
    lea     dx, int41handler& u& P5 D9 L; ?/ U2 k
    xchg    dx, es:[41h*4]
9 F# b( ?: [- `1 |. c) p    xchg    bx, es:[41h*4+2]
' [# U# C+ @5 M    in      al, 40h( x- R' a# T! j9 f  y
    xor     cx,cx7 u7 p; e6 j. V! p1 h5 r
    int     41h
. A+ h; Z1 R$ \) {1 Q$ y    xchg    dx, es:[41h*4]
* ^& q$ }, J* m, A7 h    xchg    bx, es:[41h*4+2]. w  o, F6 s6 Q# u! F* T
    cmp     cl,al
; g/ y- i9 a" k. d    jnz     SoftICE_detected
( q  s, V: b+ V" `  J
' V. L2 W) f4 x# __________________________________________________________________________& y- T+ h  s3 ^- {) C7 _

8 Z, j2 Y9 M4 X6 x% X' v$ `+ A: ]& BMethod 07  s) x7 N) j. N( Q7 D& {
=========
# F+ Q4 K5 H1 Y8 |6 z/ L" m; V6 g
: j8 D) f8 u4 [/ s0 W6 N3 ZMethod of detection of the WinICE handler in the int68h (V86)
/ I( ]7 a' U0 H) M) [
4 C" ^( y* x8 s. c' Q# a1 N    mov     ah,43h- d0 K+ r/ ^: C- @0 X' O' x. _; u* \2 y
    int     68h$ b# t; }' I+ J
    cmp     ax,0F386h4 N( k& a5 e  M/ t
    jz      SoftICE_Detected
# F' i1 z% q- l0 I9 u0 x. Y# {
- t: P2 G- m4 |  Q5 o) t/ S+ N" W, x# e9 c/ q' C: n) [5 H/ f+ C
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit6 I$ c& {4 h, m0 B% B
   app like this:
) \& W: T$ P) Z# X, B
% P- f3 ^' T4 c6 x# H' X   BPX exec_int if ax==68$ e+ N( L- U4 F
   (function called is located at byte ptr [ebp+1Dh] and client eip is
; P- S. R8 m9 f# `- Q0 w# o   located at [ebp+48h] for 32Bit apps)3 p. n; u+ t8 O+ @$ W, R1 B3 A! `
__________________________________________________________________________( j& l4 `% R/ e% Q, G0 s1 @

$ [( L2 L$ |2 C: a* ^: c( a: F
) X  X' p% y  a3 E' G+ XMethod 08
7 v: E* j4 `* X- y# c=========8 |* i7 e7 N. }) P: {

0 I$ C/ _/ w7 f, H2 G+ W7 [0 m( dIt is not a method of detection of SoftICE but a possibility to crash the
% P- u2 w+ _; O  P. F9 |$ Qsystem by intercepting int 01h and int 03h and redirecting them to another
, ~6 l: L* A7 l; Xroutine.0 q' m( j6 L3 V- q; y/ a$ i& N
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 x6 G/ M1 c; A# rto the new routine to execute (hangs computer...)
7 a- _: C, b+ ?; r- R) g8 T  e2 r+ m9 d8 @
    mov     ah, 25h
0 N; `5 U5 `% E( K/ N4 R, m    mov     al, Int_Number (01h or 03h)
- Q% K' H  S% n# K" A    mov     dx, offset New_Int_Routine' t# B1 l* e5 S
    int     21h; q0 O8 v# m% S$ |( U) f

8 P) r8 R1 O) I: Y2 r__________________________________________________________________________
+ y4 M5 O# Q, v& }
3 I, z6 h: q( }7 Y; vMethod 09& w/ v  E2 `  g' O0 X
=========
( d8 z; R4 @9 \4 X% s- e+ Y/ g- L( {- z0 G: F* N, i8 w( x4 @
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 H. l' D3 ]% [& l1 o
performed in ring0 (VxD or a ring3 app using the VxdCall).
& ]# q1 J+ H, _; R$ AThe Get_DDB service is used to determine whether or not a VxD is installed
4 @7 j( @- z7 S4 Mfor the specified device and returns a Device Description Block (in ecx) for
1 }( ?1 `- p$ U" i) v( w1 Tthat device if it is installed.6 D# Z; y+ W% b6 a
8 J( \1 r! n- N. h6 V0 {
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 c% I% q) }9 m* w& x4 i
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. @. `: ^* P" M& R3 Q% [+ x- e   VMMCall Get_DDB
0 D! L' h7 i6 l+ b' Q   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 u# B' ]5 l0 @  g% n& o. ?* A# {7 l' g. u
Note as well that you can easily detect this method with SoftICE:
4 E& W2 B+ y3 ^$ D2 ]$ N   bpx Get_DDB if ax==0202 || ax==7a5fh
( U2 K2 d+ j$ i, ~& w5 n3 n, S. K5 f2 u0 O: l1 [" H# a
__________________________________________________________________________
% X7 h  i2 A2 g
" U$ z1 v5 `4 p, A' A9 xMethod 10
. y. L! F" n1 \; w/ q7 M=========
/ r2 s- g: {' ?/ S$ o" d% i( B4 Y: a6 l8 \' c( p
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% y2 i5 ]6 H1 s8 k5 o* i7 q  SoftICE while the option is enable!!4 r+ C) j4 j3 x+ [6 F
0 P5 e. ^* S3 i5 `2 R
This trick is very efficient:
! j& [. o7 O+ Yby checking the Debug Registers, you can detect if SoftICE is loaded
6 h9 i7 ~8 a9 t! P; c0 `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if8 ?  O' X# \* L* c5 T+ D! n! |3 B
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 P$ j: y2 D; n$ _. G
value (in ring0 only). Values can be manipulated and or changed as well
! M5 f8 p' l* l! z(clearing BPMs for instance)% S- I! O8 l# l2 K

* I/ H, H. y5 c$ r# F6 e7 o1 W$ u__________________________________________________________________________
: ^' h/ m/ [4 ^9 c1 E* ]+ d
8 Z! c) b# U  }3 c3 h8 k% Z9 y% wMethod 11
# P1 Z0 j9 _4 O- T/ R=========
; u/ J5 B" R) w6 S7 J! e: q# v: `- V8 D2 N1 q0 L  W, c0 ]! Q
This method is most known as 'MeltICE' because it has been freely distributed1 F+ j8 ~3 s8 Z; B4 _5 ]" n$ M1 M  O
via www.winfiles.com. However it was first used by NuMega people to allow
) @( d% z2 }- @! B  `9 v/ aSymbol Loader to check if SoftICE was active or not (the code is located
, e6 y* h5 K3 I7 w1 F$ B: v2 }: Vinside nmtrans.dll).' Q# Y8 h" ~6 Q8 q8 |$ n
* c/ w( {/ ^3 B: c
The way it works is very simple:
+ y  E1 E5 U# f+ F) \+ K& _: O" OIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 k8 h5 e  O6 b/ Q
WinNT) with the CreateFileA API.' G$ b& E8 t5 E1 G) @" v' R" z

% a- T$ @" m' mHere is a sample (checking for 'SICE'):
% C6 e2 d: b4 p. G7 c3 P$ R3 A" |% d0 U+ A% b& d
BOOL IsSoftIce95Loaded()3 N8 K8 m* e2 D1 e/ a! A, W
{( k0 Q; L$ j) g4 P
   HANDLE hFile;  
& d; J% R3 _  [. K   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
8 W: h) L3 T: `; e; s                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  j! k1 r3 a1 I8 N; K2 u" u. K7 U                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" ?+ P8 t, N0 ]7 H   if( hFile != INVALID_HANDLE_VALUE )9 q( j7 M$ u# J
   {
4 t: w! f) `/ I/ `% M      CloseHandle(hFile);
  e9 [8 d6 b) s      return TRUE;
/ y* a; P$ p" P; t1 M   }  w& {. j* p% _! @) d
   return FALSE;
+ P6 o; O- J7 s+ m1 A: q}9 F- X# P- e* H. m" ~1 N, U+ _
9 z! y0 W& S6 O0 c1 j$ s
Although this trick calls the CreateFileA function, don't even expect to be
7 R+ f) n. _3 x$ S9 z$ Aable to intercept it by installing a IFS hook: it will not work, no way!
, i7 h4 o% U5 s; G9 O% HIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
4 g4 h' I; p- J0 w: J/ ], Sservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
4 D. ]/ j& V: @# x, }4 C/ {and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 _  g3 j4 X3 _* N0 O$ T! }% M
field.
2 d/ s+ {# n3 \# XIn fact, its purpose is not to load/unload VxDs but only to send a ' g; u6 p' o# A  {- q7 k4 E; |9 x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ N* S: C) W; y& _2 M. v
to the VxD Control_Dispatch proc (how the hell a shareware soft could try: o3 U! N% z+ L% _% @; U2 B/ G! R2 M
to load/unload a non-dynamically loadable driver such as SoftICE ;-).3 R, E' o3 M" W& @/ `: _
If the VxD is loaded, it will always clear eax and the Carry flag to allow
" O0 \5 J/ X. Q7 c7 A5 fits handle to be opened and then, will be detected.0 Y- z! O0 W7 Z' N* \7 a; q: Y6 l
You can check that simply by hooking Winice.exe control proc entry point* O8 ~8 B0 c' h  g" L( Z
while running MeltICE.6 r% S7 Y+ o  L, g9 ?% V& W5 K! ]+ O
0 B% e) Q) s8 ^
! X: @( W" i! v4 s- A- h
  00401067:  push      00402025    ; \\.\SICE
! r' A/ r8 t8 x  0040106C:  call      CreateFileA
# j6 G+ G6 ?, {' q5 [  00401071:  cmp       eax,-0019 ~& X- X9 v: l* w: \
  00401074:  je        00401091- c: s+ S( ?4 p9 H' S  u

1 R# K+ s  F9 z# v: g
. l2 m" v0 P- mThere could be hundreds of BPX you could use to detect this trick.$ ^1 U# g/ A7 O( F  U! p1 _
-The most classical one is:
% i' H  \3 T) l" u  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: J' \6 d  n! ?, c; f( e2 z0 v9 w
    *(esp-&gt;4+4)=='NTIC'
3 B" G, M* k9 m, T; e' k, p
, Z- m% ?* X( ?1 g4 j8 U* l- f. w-The most exotic ones (could be very slooooow :-(
% b- u6 z2 e4 z; W' ]  n3 g9 L   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
) @7 t& F7 b# r( M5 Z. r0 _     ;will break 3 times :-(
7 v0 |$ I! H4 z6 ~+ E6 F1 x
+ c" N! C. g- w( j- X/ @-or (a bit) faster: 3 D: C- _" s2 W# d) Y! Q. w, p% }4 p
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. p. C2 R: J* l
0 \" t+ r& j2 A   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 ?, q4 W" J: u+ n
     ;will break 3 times :-(
( o3 F7 Q! P) a
% c3 L2 C3 I# q5 V+ r) T-Much faster:
: W9 {% R& _* l% C' k! ]   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 I: B2 L  h% @$ F
4 D6 L5 N- H: ?7 i4 M
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
! b6 c+ _, x5 r( i6 P2 y: ]3 U5 n/ Z- r5 cfunction to do the same job:' k/ ~) x$ f- Q
8 ~/ [& x& _* u0 n! S! D
   push    00                        ; OF_READ" i' S" R5 I5 o, K9 C$ M
   mov     eax,[00656634]            ; '\\.\SICE',0# j( T) \: `- N
   push    eax
$ |5 \- o3 w/ ^   call    KERNEL32!_lopen7 P6 u9 c3 j4 l
   inc     eax. M' H; ^, B& @
   jnz     00650589                  ; detected
% k$ k3 W" R& f* W0 G; b8 T% X6 F   push    00                        ; OF_READ0 g) J8 n+ L. C: ~6 ^: x
   mov     eax,[00656638]            ; '\\.\SICE'
& C, ]% r, T- H5 ~   push    eax
! c4 S3 R0 x# w4 w/ q6 Q   call    KERNEL32!_lopen! ]/ K% S5 {2 u+ J3 t0 t  _
   inc     eax, ?% T6 z2 A. v4 U( P4 F. e- _$ g
   jz      006505ae                  ; not detected
. |; X4 L$ |# y7 L8 ~1 U' k) W4 F: d0 E8 f

0 \5 m1 c, `% S( E  w( Y8 c. o8 j3 c__________________________________________________________________________
) C  k. A6 D) Q! h% {( t/ x6 m$ S. t  `' ~' E
Method 12
1 Q) y9 ~; U. @  I8 s& M2 K=========( e$ ?3 P! y' u1 D2 O, d7 }& t

% @0 h1 H* V' A( @: `This trick is similar to int41h/4fh Debugger installation check (code 05& j' h6 I4 X3 L  A9 |/ p
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ K4 L% F# Q9 Q8 q- G( \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ a: y) Z, l; J3 C" h
9 r! s9 _% F; [5 N! E
   push  0000004fh         ; function 4fh
% b3 ~/ ^3 j6 }* m3 b5 v   push  002a002ah         ; high word specifies which VxD (VWIN32)
% v- A2 ?7 t; Y# s3 }" S                           ; low word specifies which service. q5 ~8 h9 I: K
                             (VWIN32_Int41Dispatch)
4 d. `3 Y/ i3 D1 z   call  Kernel32!ORD_001  ; VxdCall
8 r4 g5 l: X  s   cmp   ax, 0f386h        ; magic number returned by system debuggers! j1 G5 D% T# D; R
   jz    SoftICE_detected1 `% d% p6 B" Z; r4 b5 k0 L
7 C5 [/ B- T; t- c- a
Here again, several ways to detect it:% i! k9 ~; U* ^$ n
4 A+ C8 @. q* [
    BPINT 41 if ax==4f
* X; a$ I) d. w) ~0 ^" z: n: P
) r5 X0 s7 k; S8 F4 h  y( \    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 X1 j) e+ n; d* _: J; s0 \+ J5 j: R. {# v
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 R# y% V$ V2 Z& F* l/ m
. ^4 X# G5 |' ~0 l/ O# n% W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 p6 h. z0 X. K2 y$ q5 w( Y( |/ Z  q
__________________________________________________________________________
& E' M0 E9 S" E! g& E. ?7 T( w! q6 s0 @" w! `" k- S
Method 13% C; U- p* N$ s+ G+ P6 a
=========
6 c3 F) J+ `! @. Y  G+ q1 V* v6 z5 r% s" Q( h
Not a real method of detection, but a good way to know if SoftICE is
; ?* U4 M5 q) Y# v5 O/ Vinstalled on a computer and to locate its installation directory.* }& J* q, {% `) z  |5 }' k* ^
It is used by few softs which access the following registry keys (usually #2) :
  h' H* |5 }4 H$ h0 \% f$ ?* E$ i  G
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 P0 G7 n) X- ?9 U0 k\Uninstall\SoftICE( \) Q% L$ S/ s$ A- ?- c0 l4 ]  E
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) b! X$ _: B4 [$ w' R3 [
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& Z  c$ R0 ~, \, E5 Y
\App Paths\Loader32.Exe
  I) r) E6 }: o( U5 z1 h- Y; o8 }

' j  u+ W1 g1 ^; u! x. q( E2 KNote that some nasty apps could then erase all files from SoftICE directory
" |$ }5 m% ~) G" |(I faced that once :-(
! b4 t) m8 k2 V) Z, Y( N
7 D8 y9 b& R  rUseful breakpoint to detect it:
$ c: N# B4 R, M5 ^# K, ]
" i) w7 V6 Z1 i, ]$ D) d" P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 @, Z& t3 n) z$ n- s
3 H2 K" ?- X& S0 Y% f__________________________________________________________________________
: ~9 D6 H' B  \( c) \0 x8 p) m) ]9 t$ ~+ |0 |$ N7 C
' j5 d& A5 z' u) x
Method 14
1 `9 K$ R( J7 j; V  L+ n( W=========8 ^! l* r# \; R; f

2 q0 U) S- z0 SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ A% s. a7 Z: J1 b% Z& \9 v
is to determines whether a debugger is running on your system (ring0 only).
5 F$ [/ i7 ~! f" H+ W! Z6 M! A# p1 n; H; O
   VMMCall Test_Debug_Installed6 P  n" u) u: J6 O! ~! H; _
   je      not_installed
) }( m. @2 m6 T, K: r" }5 I( ~4 e* o: i) X. G
This service just checks a flag.
' i6 F! n4 G, ]2 S3 U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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