About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 j" w3 h0 a! y  I& E3 u<TBODY>( i' g- E# q* Z; i" a2 d4 d
<TR>' e+ b; G" Q. t1 x
<TD><PRE>Method 01 8 r* U, C, p; T* s1 l% l
=========
# E. F$ C( Q9 J- o1 ~
) `8 L4 i! V5 IThis method of detection of SoftICE (as well as the following one) is# f2 N  I0 ^" H0 m
used by the majority of packers/encryptors found on Internet.8 P: b, z" K( n/ V- E
It seeks the signature of BoundsChecker in SoftICE# O. |/ t7 x; w' }1 j1 N8 S, c

( |: S8 {! M% ?% o+ E    mov     ebp, 04243484Bh        ; 'BCHK', u8 B; U3 I$ G
    mov     ax, 04h
# p, |( i( W) g5 I3 L    int     3      
7 h5 n3 r2 a4 F! n  O, k    cmp     al,4# ~$ V% y! e, _1 @
    jnz     SoftICE_Detected
' `3 `4 q7 V% ]( O) v0 T7 @2 H; \4 d4 N9 K& A. V( a
___________________________________________________________________________6 t' B2 X; e* B  n9 }: x6 `$ p. d
' M, u# V4 H3 M: C2 B+ e( J; B) P
Method 02
, _+ O# D" X1 u=========
" W" n- v4 N- L! `2 x) q& A, o7 C- s6 B% M4 D3 n& S
Still a method very much used (perhaps the most frequent one).  It is used
# o, \* `2 B* y3 S* k/ M0 M# sto get SoftICE 'Back Door commands' which gives infos on Breakpoints,) P$ y8 O% o5 B: Z% x- F
or execute SoftICE commands...: }- M0 p: Y2 k0 n
It is also used to crash SoftICE and to force it to execute any commands
2 s. t2 ?# s% \(HBOOT...) :-((  
2 ]# B: z1 N8 J% @5 Q* q9 B% Q' p3 s4 ~: y
Here is a quick description:
' x/ r, Z) ~& K: ^8 n! ~" Y. T) J-AX = 0910h   (Display string in SIce windows)- [. S- v  O' v1 n
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
: T, }5 s: o+ F  A8 w-AX = 0912h   (Get breakpoint infos)
6 L# O7 Q8 ?2 r+ I3 M) _/ p1 V-AX = 0913h   (Set Sice breakpoints)
7 n" b6 v0 _& q7 z( Y-AX = 0914h   (Remove SIce breakoints)
% x! J5 c. `( V& v7 i1 @, j! `
1 t) o* Z, }9 b+ Z; y2 NEach time you'll meet this trick, you'll see:
$ G% \6 ^% X# S6 V3 D-SI = 4647h
7 t% M! b6 O2 f  z-DI = 4A4Dh
) s7 S* u1 T/ ~, p7 B, W  iWhich are the 'magic values' used by SoftIce., I. D  R0 I; J- W/ n4 {
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- O7 E5 P: Z3 I6 W; ]* y- n" \$ y- H
Here is one example from the file "Haspinst.exe" which is the dongle HASP  n. J( W( q7 C$ W2 x
Envelope utility use to protect DOS applications:
& {3 ^/ b4 k1 y* t
: v0 M4 W4 z' h: y- M$ q4 B# L' E* c( ~1 \4 O! }$ |4 M
4C19:0095   MOV    AX,0911  ; execute command.
6 o; ^/ U6 x3 B" _. ]* ~( g/ k4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* ~+ ]4 o' P$ m4 L, u8 @, K0 t
4C19:009A   MOV    SI,4647  ; 1st magic value.+ u; f6 V! w! X; D5 J" {4 s" S$ Y( g
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- u: i9 R& E4 S
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ B" y, T7 @/ A* W' c1 q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, P% d" w% H6 O0 K4C19:00A4   INC    CX- R. V& o' D9 j+ B' ?& B* y" O9 S  b
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 z1 @) e, D% Z( F, A
4C19:00A8   JB     0095     ; 6 different commands.1 A6 g2 r9 Q. g0 j0 e1 H
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: Q  w/ a2 b8 ?
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)- M9 F2 ^  {5 N$ B+ R$ F; V: Q

0 x( b7 G3 W. ?+ H  N7 D- h# Q9 @The program will execute 6 different SIce commands located at ds:dx, which3 C3 {! B7 ^: A
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.0 q# v6 d- I/ t5 V6 i% |) @* i7 m; u
7 Y4 R8 o2 U, N6 m2 Y3 P* ~
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  a' ^$ ~. t  X! E$ E$ k
___________________________________________________________________________0 l2 m' g2 @7 L' `  r

# d7 x2 S7 Q; N# ^$ G2 f+ ?6 a0 @! H
% m7 {$ v" v/ Z; dMethod 030 H+ D6 H# }% N$ t9 e2 s
=========' \0 L8 D0 u% [, l3 N. T
* O& D  v8 ^* C3 H" L
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& B1 _1 Z# {9 K! I4 b6 K- y(API Get entry point)$ M! @" w; m  p3 B$ {
        
; M1 e' [& n4 g4 A2 a0 S
5 ?  \7 a2 z; c. }; T    xor     di,di9 l7 _, K) b/ |$ f- j
    mov     es,di
' ^4 V5 z4 T7 Z    mov     ax, 1684h       9 B, k3 P3 W3 K6 m+ q6 w
    mov     bx, 0202h       ; VxD ID of winice) P+ M2 o& ?5 g5 {
    int     2Fh; r' c. S0 l+ U8 V, H1 B
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  q' S% e6 T! F  @    add     ax, di% |; f9 A) g* s
    test    ax,ax
5 w# P9 P! o+ g    jnz     SoftICE_Detected( D5 P9 W/ I+ G8 b
% Y, l% C$ ?- k% u4 A. s
___________________________________________________________________________8 G/ }: }- a  F. g* ~

# e- s4 d& E( tMethod 046 A9 o, P0 O# `, e+ ]( @
=========7 ]2 w! v, F0 k5 I. A5 e

+ z, ~6 b! [- J/ o, O7 fMethod identical to the preceding one except that it seeks the ID of SoftICE
$ U! P. i, j# R  v1 l5 y/ oGFX VxD.& N4 L" L9 g0 \( X, i% v& u9 u* A

8 Z& w2 |8 m0 a% z    xor     di,di
! s) T# {% K3 v7 b# ?' J- R    mov     es,di0 }% T0 P, R, Z8 z& T3 ^) V! P# H  m
    mov     ax, 1684h       1 {9 k% B2 [" U# j5 G, g
    mov     bx, 7a5Fh       ; VxD ID of SIWVID# U& X9 g( a" f5 p8 n
    int     2fh' p- L$ z' ~3 e4 L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: z6 K" ?; Q) B! h9 Y- T# ~' q( T
    add     ax, di0 I- T! K4 |1 }8 |$ @
    test    ax,ax
( P0 `$ Y$ U% Z* Z' V    jnz     SoftICE_Detected
1 m5 {' e% a# O4 }8 Z% n5 J) n* L9 [
' m# z) A, l' V, S7 G" r__________________________________________________________________________
! Y5 ?% `/ y9 O. ]
/ k, }+ O# b0 o* j% ~# f
3 }- c& X" v+ D7 DMethod 059 B# ~2 ~. B' O9 E$ P. r
=========
% D4 e6 s: l7 f+ W5 w
+ R( l- \! U/ Q! oMethod seeking the 'magic number' 0F386h returned (in ax) by all system
, H0 y2 z& B  V& C/ J3 t! k5 c. {6 I, sdebugger. It calls the int 41h, function 4Fh.
  V  R* O* h7 ?There are several alternatives.  4 e" Z; W& `# m9 e
7 j" I# R9 r  \) j. G
The following one is the simplest:( ]$ F9 x2 t) R! d% M* ~  e% X
" O8 e7 s2 g! O4 ]
    mov     ax,4fh5 ?% y, S% B/ K4 S; w
    int     41h
6 C8 s: @+ }6 O  e9 h, L    cmp     ax, 0F386
- j$ _& m5 o* ~' T: i/ `: o9 M# _    jz      SoftICE_detected
9 C9 @- s$ b6 b: j5 k, N: g  [9 @9 i) @% t% O4 C; {

& p  t& J1 q) B$ h' HNext method as well as the following one are 2 examples from Stone's ; L5 o- K" A, z1 |
"stn-wid.zip" (www.cracking.net):
# w1 \: Z2 t' F+ l. a/ ]
! S: O1 |4 d0 Z# H9 _    mov     bx, cs
- g1 ~) O6 c, J4 C3 V    lea     dx, int41handler2
( y2 V; [1 t9 V& k% B% `6 V$ n    xchg    dx, es:[41h*4]  q0 {) X0 F, l" X8 a$ h. G
    xchg    bx, es:[41h*4+2]
( b$ I4 h" U3 C  N    mov     ax,4fh! t- l# T' c8 g$ e3 \" B
    int     41h
  {" [! L- u' v9 w    xchg    dx, es:[41h*4]  z. S- x7 R1 f& m) P; E1 v
    xchg    bx, es:[41h*4+2]
# A' d- \) i+ L# r    cmp     ax, 0f386h3 }( L, @8 {0 V6 J* n% _
    jz      SoftICE_detected' u  c8 |8 A3 V: c& u* ?5 `

& t$ @: ^6 r' I9 C+ H3 t, aint41handler2 PROC$ J* y. n' {) f6 c
    iret3 u. P2 \; M* e' t/ M, D5 p
int41handler2 ENDP/ x* f- |6 N0 A4 u4 L6 H! O

) f) Z7 |) n4 @! e5 V! _: i. i* G5 G. F
2 T6 W8 Q4 B; H_________________________________________________________________________
( v  h, a' C5 D. q
1 X1 X4 w8 O9 Z( N: x, _* x0 X3 G0 g% L1 T
Method 06# n7 R0 n8 i: O5 H: U0 H
=========
: r; |2 j8 Z7 _& t$ Z$ \7 H8 N0 w" q+ U, L. v

" @2 J+ v, Z+ V/ @- h2 X5 g2nd method similar to the preceding one but more difficult to detect:
! Z! f+ o& O5 u; t0 [- Q
( C& \, ?6 U$ o/ d* f5 P+ v. u& f& G2 V- E  m3 t# B
int41handler PROC
2 T' ^' N  i& M& |    mov     cl,al
* W( l+ W7 J  [    iret
1 S# _8 y$ u: v8 ]& C6 r2 V! ~int41handler ENDP
3 d8 i6 V3 s# F4 v! F( V) G# Y# O$ p3 a
8 y4 G# [5 O, z' a( Z
    xor     ax,ax4 Q' x7 }6 G/ A5 M# s
    mov     es,ax
( U: O8 r2 R% y& q0 F0 @& \    mov     bx, cs: P: z$ @7 ?  v; y7 s: e
    lea     dx, int41handler
$ o2 Q2 Y; E* t/ H1 |" K3 f    xchg    dx, es:[41h*4]
1 }, x" N% E+ n  o    xchg    bx, es:[41h*4+2]
( ]2 P" y- _; @0 N/ A1 ?7 s    in      al, 40h/ q  k  K" G# I4 d
    xor     cx,cx
* w. V0 g1 c7 Q7 k    int     41h; ~2 G7 l  c9 M1 }$ K3 b& G2 D6 @
    xchg    dx, es:[41h*4]
5 G: Z8 E% [4 L, j/ R0 @    xchg    bx, es:[41h*4+2]3 v2 r( O  X/ _; Q
    cmp     cl,al' ~2 R5 C; Q: Q9 i) e6 h% I
    jnz     SoftICE_detected
2 V  I0 K9 B; J! @6 g7 N# d; t- F* z4 O: m  ?
_________________________________________________________________________  a/ }& X2 V# N; ]: s5 a
  [# [+ |  T8 g; ?( c4 w3 \
Method 07
* p/ B. J6 |2 x% E+ o9 U# k, @=========
) T; Q4 N% i* W$ |5 K, h- _; K$ r$ M7 j5 S4 r. |# q: a, W( i
Method of detection of the WinICE handler in the int68h (V86)4 a" F4 J5 b( Y

) [2 e* B+ F0 J* l5 h    mov     ah,43h
$ h/ f8 t7 l, ]6 h    int     68h
0 M- P# S0 L6 E' c) ~    cmp     ax,0F386h: `% F- L8 X/ G$ ^# l* s
    jz      SoftICE_Detected2 ?) N+ N: A! O# O) n
) d( W' l6 W5 h2 B& p. i4 w

# _8 U3 E4 G; ~, S+ p& f) u  I1 G=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: x7 D3 Y% z2 V: a8 Z3 y$ T
   app like this:& F5 ^) H3 z3 T- s
( X6 m6 ?1 j1 q4 w( C# o. @. E  z4 c
   BPX exec_int if ax==68# P4 i+ r4 `1 i2 R9 U* T
   (function called is located at byte ptr [ebp+1Dh] and client eip is
( L5 T  ]( y$ n2 w   located at [ebp+48h] for 32Bit apps)
, ?( c( c$ z: s- ?  |__________________________________________________________________________
# S3 L- ^! w6 s( b9 L; R* [( A* [3 E+ U# q, I! P2 f1 ~

7 m+ C+ J) C& S1 X1 X. A  \6 rMethod 08+ C; q9 A9 D3 `! e1 E+ L0 C
=========
: l5 e; ~' J! [0 M$ P0 s: n/ p! C2 @- }9 w9 Q! z. N5 n
It is not a method of detection of SoftICE but a possibility to crash the4 k& v; N7 v/ m# ?
system by intercepting int 01h and int 03h and redirecting them to another
# ?" S5 _4 O" j% Jroutine.6 N5 c/ u, e+ b3 W) x5 w7 T
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& x& h# _+ Q7 u1 {5 B5 d0 J
to the new routine to execute (hangs computer...)
% u3 b7 R8 ~' @( f7 x, s7 Q# M* n; F
7 V9 m  n2 Q/ s( E    mov     ah, 25h% g  A# v0 j: b  E% ^9 D# l4 a
    mov     al, Int_Number (01h or 03h)
" x2 E9 ^9 X9 {! N    mov     dx, offset New_Int_Routine" s  U8 H6 K9 O, X) c# Z8 ~1 T3 ?" S
    int     21h
1 f& d$ t# Y9 w: @; X) p+ s+ y: |, t7 [8 \) T
__________________________________________________________________________
! p: s( L( W) A. W! ?# _6 M: o/ _8 j8 D2 z$ b5 v4 v2 l0 Z
Method 09! X. h$ I1 P! R
=========+ q  A$ x7 g0 y/ U

9 Z7 p* v; n9 G) Y2 F; qThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
2 X4 r2 Y4 G* X* g8 l" q2 lperformed in ring0 (VxD or a ring3 app using the VxdCall).
. {. h0 d' o6 fThe Get_DDB service is used to determine whether or not a VxD is installed% X' ~; D, Q" ]9 m) i: h& z
for the specified device and returns a Device Description Block (in ecx) for2 v' X6 p( U% ^/ v( \5 O# L$ m! ~4 }
that device if it is installed.1 g- D" R; o( \* O0 D! P+ E- M
$ \5 w1 G5 c: H* Y! J; b  f% }# Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
+ x8 |. x3 |3 _4 }7 ?   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). m4 R+ l1 z) |* |2 {- j" _( X8 m! p- q
   VMMCall Get_DDB
6 c3 E9 I3 J! @% `6 }& ~0 O$ ~   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( }0 K2 i: B+ Q* y

* W- j0 F% q: V' F) N5 ~& k" iNote as well that you can easily detect this method with SoftICE:
7 ]+ c6 z* K) d   bpx Get_DDB if ax==0202 || ax==7a5fh
# u0 K, f  s* \- n1 R8 X' L: c( j5 L7 u
__________________________________________________________________________! V# U4 Y: t$ N/ m, Q

/ d5 x# }# g9 D$ o, x/ `Method 10/ N6 Q) p( f: _' `
=========) G  @7 Q! m$ K7 k% p; }

( S  G# F- x2 ~, _; j! t=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) O9 k- [4 \- t6 w3 K  SoftICE while the option is enable!!7 \6 s* R6 z2 C  ?9 i

: O- c! ~& R/ R5 F5 k; LThis trick is very efficient:  I( y- [3 B& K) D* e4 q; K/ |
by checking the Debug Registers, you can detect if SoftICE is loaded
! L* E! i( i0 C; u- v$ @2 C0 q6 ?(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. e6 ], _3 o* H5 I
there are some memory breakpoints set (dr0 to dr3) simply by reading their# _- ~- ^8 j$ ^# R
value (in ring0 only). Values can be manipulated and or changed as well
- Z; a8 M6 Y' J+ j4 e. Z9 r/ G(clearing BPMs for instance)
/ y( S) C! ]" x" J2 E' u/ o1 p
: i, v4 H. h0 R5 u3 `1 }__________________________________________________________________________
7 ?( O8 l5 Z+ q% ^; H6 J& N% [# T. p1 x0 n/ T
Method 113 t: A& R  q0 d& D( @0 C3 S) n
=========
* ]  G3 }4 Y" Q5 J4 j) y8 q& k. o( f3 B. |+ P* Q2 d- B6 K
This method is most known as 'MeltICE' because it has been freely distributed
' w- D' t/ k; z4 O8 d3 Avia www.winfiles.com. However it was first used by NuMega people to allow5 T3 Y' u: [3 }% V( \  c3 G
Symbol Loader to check if SoftICE was active or not (the code is located
; u# @* ~' R- P  R1 m: sinside nmtrans.dll).
. b* w/ h1 r% Z9 H) {& A
0 @: m' s1 O- F5 H9 T0 \The way it works is very simple:
* F) y, |3 @# m6 d0 E) bIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ q! v+ a8 k. N" D8 O) }: C% bWinNT) with the CreateFileA API.3 L' F" `. B0 V' l) P: S9 O7 ?

  Y) t3 O# y2 h  D/ x. cHere is a sample (checking for 'SICE'):
& {$ A! Q5 G5 N
5 m6 u) e  t8 O* xBOOL IsSoftIce95Loaded()
5 y; @# Q2 l. B+ T{1 z& `1 k7 b) [9 W5 L, L
   HANDLE hFile;  
4 F  x9 {5 r7 d0 M   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
, f9 d) Z6 w2 ]; i4 W. q                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 ^! @1 ]3 o" J3 w+ `9 X/ a
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& u$ Y( h, O: ~! a* Z   if( hFile != INVALID_HANDLE_VALUE )
* r2 r( ?% c+ D7 @   {8 o, c% v% g2 k, b
      CloseHandle(hFile);
1 Z8 b' g' T0 Y      return TRUE;
, |( Z: u2 F" M: Y$ i9 ^, u3 N( P   }
2 T* e0 i) \3 }8 |) J0 c   return FALSE;9 O. s6 L' x( n$ L
}% v7 P8 P3 j9 n4 ?; N

, a# |2 B* `% C! e* O' EAlthough this trick calls the CreateFileA function, don't even expect to be
; }! o8 M' a1 S7 wable to intercept it by installing a IFS hook: it will not work, no way!
4 v: u$ f( |; zIn fact, after the call to CreateFileA it will get through VWIN32 0x001F( G0 g1 x, Z3 a" m( \& {# H
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% @# H& H6 T0 Z. a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc  E& J% V% ?& K. m) R$ J, ]
field.
4 O. M# t: d" ?! w1 XIn fact, its purpose is not to load/unload VxDs but only to send a ' S; w5 W" `: r- n3 N" d+ w/ d
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 D7 F0 T+ |0 L7 U- y1 h
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
8 ]5 @) x2 E$ P1 @to load/unload a non-dynamically loadable driver such as SoftICE ;-).; A  \0 D, ]: o9 z
If the VxD is loaded, it will always clear eax and the Carry flag to allow& [" F( t. q7 A# o$ U
its handle to be opened and then, will be detected.
% a& l( r1 l, h/ h4 L; }0 HYou can check that simply by hooking Winice.exe control proc entry point. T+ H0 T% D3 n; J* z
while running MeltICE./ t* Q$ s0 _3 B. R# z6 w
5 c# ]- O  `8 W# L1 L7 @

4 l  x& q; m/ d, T2 c* S1 M  00401067:  push      00402025    ; \\.\SICE, r, ?2 E0 ?) w* l0 `/ S& i: [$ v7 R
  0040106C:  call      CreateFileA
% W9 m0 z: W( i' U" M  00401071:  cmp       eax,-001
2 {, _: z1 x& [  00401074:  je        004010915 L4 ^4 T! r+ W' B; a( N& j

. d- r" ~0 B# F# A( A7 f6 x/ z& y5 h# S. z8 K
There could be hundreds of BPX you could use to detect this trick.
# i7 [& z  h1 S0 `* ^-The most classical one is:
& B+ Z+ V& {/ a& A, c5 h  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 c4 ~! W5 x3 w: c: o    *(esp-&gt;4+4)=='NTIC'
  U- E7 Q0 r% D' _9 Z+ K( u2 y0 B8 }  h7 g# Z
-The most exotic ones (could be very slooooow :-(
( P. [6 _) Q3 c2 Z   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , l/ U5 P" r; j+ y. P; U7 f* F
     ;will break 3 times :-(
4 E' d# j2 b, W& C3 @6 j" [* p. {" w, `, }3 ?$ r6 e# |
-or (a bit) faster:
5 x, d' `+ P( p, s   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 r+ |) Y& `) s' [
1 o: c  w1 D  p. t" \
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
+ h/ _0 c5 E8 T     ;will break 3 times :-(
7 [' x/ _% }8 Z8 E5 q) y1 N
" z5 D, s* [) h-Much faster:
& O5 \3 Y/ J+ y/ i4 o% t( s3 _   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# e# d: ?1 L( O# m9 `  W5 e2 e; m
# ?  o% y( \2 ?8 f- b0 GNote also that some programs (like AZPR3.00) use de old 16-bit _lopen( t0 d. U) g" v6 s
function to do the same job:( u/ y9 a  z6 B" B* n

3 k; O, F8 l' C+ k3 z5 O& H   push    00                        ; OF_READ
6 m2 \# R  H) d* X; w9 {" R/ T   mov     eax,[00656634]            ; '\\.\SICE',0
+ C- A+ F, ~& ^  g/ b* E' ^; A; {   push    eax* M( V, Q+ c  R  p) t& e$ m
   call    KERNEL32!_lopen
3 \; n9 c! I* Q; N: e   inc     eax+ K% ^4 K0 k% R, o$ }0 H  V
   jnz     00650589                  ; detected
- c8 [4 [- i5 A3 K! J   push    00                        ; OF_READ* J! s. S# X5 S1 h3 y
   mov     eax,[00656638]            ; '\\.\SICE'" j& F+ T( X: x7 s2 `. T  X& V5 ?2 M
   push    eax! H& Q& h6 k' x5 ~; H% \
   call    KERNEL32!_lopen4 }3 V& g9 z& J6 j
   inc     eax" V2 y4 ~, J7 t, s4 j1 [
   jz      006505ae                  ; not detected# w' ?% @) f1 N4 u9 G5 C7 G
/ [, q% k1 g% ?& ^- }
7 L5 F4 q2 B8 J1 K
__________________________________________________________________________" i4 \3 I; }! K' ?9 C( F

7 c6 @/ _, }8 w  p3 vMethod 12
5 j4 Y# J& ^  B7 L=========1 M) P+ ]: _8 m; v2 N! l3 n

# V" B% K) a8 u% N, }" DThis trick is similar to int41h/4fh Debugger installation check (code 05; J" \! Y% N0 O
&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 a6 e! b' R$ w6 ~& G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo., q, a/ _2 b6 o8 C
' Z" b& L' c$ i
   push  0000004fh         ; function 4fh( Q' p: n9 G- i9 w
   push  002a002ah         ; high word specifies which VxD (VWIN32)& J3 E3 T% p% C: |
                           ; low word specifies which service% u# y- B' B( P) u' m" k4 C
                             (VWIN32_Int41Dispatch)
% R& D+ Z" Z. i) n3 A5 |! F0 e   call  Kernel32!ORD_001  ; VxdCall
, V8 ~8 H7 r. J   cmp   ax, 0f386h        ; magic number returned by system debuggers$ X$ S: l5 y# k1 R
   jz    SoftICE_detected  q/ Z# D# m  n7 J& q4 w; r
" K" _0 e7 Z+ o6 p/ @8 B/ l+ f7 d
Here again, several ways to detect it:0 P2 c$ d6 G: L& H3 Z2 T

& ^9 S5 U5 H. g: R8 W    BPINT 41 if ax==4f
3 a/ p1 I1 C, p5 I# ^6 }+ [: D5 @& v8 w, x. X
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one: z9 F3 o+ B* _9 X- T+ F# @
' e: a# V1 Z7 x; w7 g  W' W: w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ w. [0 c; O: i
; ^. x3 T( g  S  T    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: ^1 z% h; w5 e. {. c' i7 e

8 \9 `7 R# `  A; }6 ]" b) S) r; d* B__________________________________________________________________________& v5 A, e  _: \
5 V9 E* P- j5 [6 U" M2 }! W2 K
Method 13* s% B( O& k6 m$ r3 U& R, i; I
=========. G0 M; ~/ E9 }) u# q  k7 I
# v+ J( w9 G3 @) D# a  R
Not a real method of detection, but a good way to know if SoftICE is
0 S; q; J) N9 H/ M- Einstalled on a computer and to locate its installation directory.; o8 h' g$ w9 X
It is used by few softs which access the following registry keys (usually #2) :2 u0 w2 ]6 y; I; j; D

# Q. P5 H1 U, i1 a-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 R% Q5 y5 r  d4 S$ `( V- d\Uninstall\SoftICE
. R) s$ W1 v. t% P  @" X-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. B+ g0 H7 k: l2 a" J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ a0 o* R, ]0 _( h( R
\App Paths\Loader32.Exe4 [$ v9 a2 _' L: z' o

; s* G' {4 d1 y9 b* ^
, y5 `/ q. G# U/ R5 o: MNote that some nasty apps could then erase all files from SoftICE directory
" F. C: ^# d. U* ?) z/ y* q. b(I faced that once :-(: X" l4 F: X7 s# P+ X4 m4 J7 E1 Q0 `
4 r' h9 o' V- \
Useful breakpoint to detect it:
5 o6 G+ n% `  l. b' z7 d; V  p* h4 E+ u% y. _# G
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" l* k6 ^7 t3 A% t7 u
. P8 g5 X& i2 a  o- m- `__________________________________________________________________________
7 c  Z. I7 y. }$ {( m) D+ j% r& S  A$ t2 a0 g' D8 V& L
6 J- c' j; g: p; S- }
Method 14 % o" L  x! H4 F! y
=========3 C0 B4 P- g5 j. T/ y% u4 I
5 _7 d/ i! k$ @) \$ J  r# s1 z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 B$ G4 V+ e+ v# e8 Z
is to determines whether a debugger is running on your system (ring0 only).' [: Q8 C/ n2 p+ {- r, b) q

: F" S" G6 ]; P3 p8 {& R$ V- P   VMMCall Test_Debug_Installed" w$ f2 [7 _- u* f. i7 }4 B" \
   je      not_installed- N! Z6 O5 c1 t* ?* d! e
0 D# E( z. j" o  ^0 n2 T
This service just checks a flag.
  \( [' j8 V8 k, Q8 b2 U3 G</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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