About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>0 \3 d9 @, w* x5 z/ k3 X0 t
<TBODY>0 Y0 B. U/ @  V! F+ a/ |
<TR>
. r, \; E- }, ?4 G<TD><PRE>Method 01
! S. y1 F. g9 X- N- z  L  s" k=========* [/ i5 ]* k1 b. {* o

! V  V3 ~7 W/ N% i7 t  k. }This method of detection of SoftICE (as well as the following one) is5 A& B, j; g3 M' j
used by the majority of packers/encryptors found on Internet.
( W8 x4 p9 |3 f  X% X4 u' _- ~It seeks the signature of BoundsChecker in SoftICE
0 g, }  v2 p9 @# g) ^; U8 y: ^$ G: F! W! F, [& `. O  L
    mov     ebp, 04243484Bh        ; 'BCHK'! D. [1 T: @: @+ @3 ~9 Y1 ^' s
    mov     ax, 04h* I+ j6 o4 R+ D/ |: L
    int     3      
9 o2 ^3 n% f/ z) ?4 B0 E* y0 X* R    cmp     al,4" G2 j/ H* [- }1 ?5 ?
    jnz     SoftICE_Detected" c& _% _  W: O+ h$ N

  B( e# \* X2 t; r9 l___________________________________________________________________________8 k% T( u; L  a

0 Z  R7 T+ }7 @; q% {- CMethod 02
( ?" ~* I& V# I) ]7 H/ R=========
$ Z1 U% v+ B/ B8 j+ s$ R: S( i7 `7 ]9 k0 \7 O
Still a method very much used (perhaps the most frequent one).  It is used
0 q0 E6 q% J& F  m# A7 L- C$ U* o4 q; fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! B% \1 f$ d) Jor execute SoftICE commands...
$ W- a( |/ S' `% O- F2 lIt is also used to crash SoftICE and to force it to execute any commands
% n- m. h2 F1 o(HBOOT...) :-((  * N& l2 {* G3 P; e1 X! ~! i% y! |
1 k4 |) {& Y( V0 Q  y% }' ~
Here is a quick description:
' u3 h, W$ b! x( _; v- m; |-AX = 0910h   (Display string in SIce windows)* H7 k+ J3 o# o( x; R- E/ \7 _( s! @
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- ?+ _0 @' P" e" j% E; p) ?-AX = 0912h   (Get breakpoint infos)
( C! j9 a; F3 {# {# @" W7 h-AX = 0913h   (Set Sice breakpoints)
1 Y8 d, H  ]4 K' P$ s( H-AX = 0914h   (Remove SIce breakoints); z  @: `% G: Y) f! m7 U& K) \
) x; {9 f% [" L3 e, N; P; q
Each time you'll meet this trick, you'll see:! G. j% n0 ?$ f1 f/ b
-SI = 4647h8 e, H+ Y( m+ J6 g& y; s# R4 D8 {
-DI = 4A4Dh
  M- h* V% n" ?% n* C! xWhich are the 'magic values' used by SoftIce.8 K# D8 Z& [0 s4 D" l7 R
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 o, |- v/ O, b# `" x5 f' I
9 s5 a$ N" R( D/ x) v5 f$ }
Here is one example from the file "Haspinst.exe" which is the dongle HASP' H( d! C2 N- l- ~) I  K6 D
Envelope utility use to protect DOS applications:
9 x" S8 B1 t  |; ]/ H1 T
0 h* v3 Q+ {. x. D
, g# ^; t0 G% b. [4C19:0095   MOV    AX,0911  ; execute command./ M7 w: D, i. _' {( J3 h/ t$ w8 l
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).3 A, v! Q5 `! n& g
4C19:009A   MOV    SI,4647  ; 1st magic value.
) i( u% E% v  }( q4 c2 w. W4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ C; W: c2 x* d
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 L3 ~$ V7 J7 w/ f1 X( z: x
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% |+ ]/ Q. z7 Q9 q4 K/ J3 h8 \
4C19:00A4   INC    CX
; E% }( M/ L: F7 j( H: H# s4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, A3 @* g( v6 P+ ]3 t
4C19:00A8   JB     0095     ; 6 different commands.
3 R; ^1 p* r3 n2 Q8 K4 A+ S4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 R  ^, Y: s2 j3 Y' h
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. O) [( z4 F9 n' N1 M
  V0 q  Y$ P# T1 f+ v! F0 `  GThe program will execute 6 different SIce commands located at ds:dx, which7 r" \# r, [: f& e" o* x
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# [1 o8 }* F$ A  Y& O3 P
8 o( n6 G% U" p$ T/ ]8 D7 B2 d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ G: W7 J/ P; |4 T. p; F( d( v* i. i
___________________________________________________________________________9 I' }0 q: [6 W2 ]7 ]
1 `' A$ {5 Z/ ?* ~5 \

3 i% _* v/ N1 S  V6 eMethod 036 j* u% K, u- P
=========" A  b. ^" @! I/ R$ U  R' I# [; r
) I6 |$ B2 f0 ]
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 l* P+ x8 u/ N6 S(API Get entry point)
( ~& U. O5 \1 f" |        
. T3 ]; F3 c/ ^
9 ]5 ~2 X# i/ Q4 w  k    xor     di,di/ {& u' h% B6 @! M# I% N
    mov     es,di
( o5 P) Q1 m+ O$ `+ }! y+ y% {    mov     ax, 1684h       % E- Z, P0 o! D1 r- L# E
    mov     bx, 0202h       ; VxD ID of winice  W( @- [) ^5 C
    int     2Fh
$ O( ^8 v4 T: u3 r; }! O    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; L. ?8 d4 y* j( z6 U' E    add     ax, di
: s. X' F, Y) H    test    ax,ax& a( k% Q4 k4 B4 L
    jnz     SoftICE_Detected6 R. u7 J9 K( ^% }4 q

7 L$ v2 f! }' z' t% S9 K4 [___________________________________________________________________________( O* E6 x0 r0 W  t* s9 g" g
* f) m, c. Q+ C$ R
Method 041 c& ?% b! `4 y4 c& \6 ~' N! y
=========+ a- C; R: T3 H3 }# P0 F

; |% Z  f; D: i  `2 h* o% GMethod identical to the preceding one except that it seeks the ID of SoftICE
% y# w% ]$ T5 F2 `. vGFX VxD.. U( E. M' Z" H: {
1 e1 Y0 |+ \0 K, V+ @7 \! a
    xor     di,di/ i% v* X. f4 ~: y
    mov     es,di- P' P6 L# J  h: M; ]" D* Z
    mov     ax, 1684h      
  l" {$ D: _4 Z! ]" w  D, [! Q8 ^    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 t0 ]/ y8 Z& t& w% u; n  V
    int     2fh
+ _3 M, M. L/ W, j    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 ~) g# Y6 X* F  K' U( h
    add     ax, di8 L5 s/ H5 W2 b" m: e
    test    ax,ax
+ r2 W3 A3 i5 W8 i- p1 @6 P" F    jnz     SoftICE_Detected( U; c( p( Y& h* S- s4 W
1 h8 O' [! ], B/ ?
__________________________________________________________________________7 C0 f1 @  k& |6 E3 Q+ n% K$ f

+ S7 M+ m+ w, K
: w5 l8 \' c  ^' ]$ B. I+ Y+ I1 WMethod 05
, u$ [0 r  k4 C* \6 e7 m=========* N: a5 k0 _. W8 D

. \) n4 T: a  U( H$ F0 SMethod seeking the 'magic number' 0F386h returned (in ax) by all system
* q0 i( z! z1 N; Jdebugger. It calls the int 41h, function 4Fh.
1 T; l* B: w$ ]6 ~8 SThere are several alternatives.  + e! b- ^5 ?' c  u+ N# J+ ~
8 d. Y/ F+ p* A
The following one is the simplest:
, h$ |* b7 T9 \1 Q  t2 D* J8 E% V. U
: b3 O& \) Y/ D1 j/ J+ f    mov     ax,4fh
6 J: B) P1 p& D5 h0 d" }% D3 S    int     41h2 N- T0 h8 g& @
    cmp     ax, 0F386+ [* Q6 l5 ~' t: B
    jz      SoftICE_detected# _7 i9 o. ^4 s6 [1 k: H

! q: b! S+ F. {" S- E
- n* H: w! _2 S2 z" i7 {Next method as well as the following one are 2 examples from Stone's / l3 o2 n/ t! A1 ]
"stn-wid.zip" (www.cracking.net):
$ z$ W& W6 e- [# w7 Z7 r1 U% m* i$ N' B' `  D* A( E
    mov     bx, cs
4 `" @. W: b3 Q4 ]- t/ I1 E    lea     dx, int41handler2
* u, N( X/ s4 r- Y) H    xchg    dx, es:[41h*4]
7 o' b& }# ?$ U1 X7 t, G# V* P( s7 U+ C    xchg    bx, es:[41h*4+2]; X# t1 h; G4 \* \+ ?6 M
    mov     ax,4fh5 E' D, d9 P6 w- @
    int     41h) N- @& s2 b% n' W7 ~) A
    xchg    dx, es:[41h*4]% q/ x' z- ]6 ^# e  y' X
    xchg    bx, es:[41h*4+2]* t% O9 r7 F( [* g% \! ]
    cmp     ax, 0f386h/ a3 a  A% X4 f: ?4 t
    jz      SoftICE_detected, \$ s; B1 Q( K; K+ H9 d; a/ \
8 |. ~/ H1 e: H7 d
int41handler2 PROC
9 f8 w* q5 F! A- R, l7 N) I    iret0 @% d' W3 m3 b8 N6 {
int41handler2 ENDP6 m1 |2 R) C8 ]; Y0 r- I7 x
2 Z, y& K1 }- f; ?

  o& f0 w; P/ a4 N# |, [$ N' `_________________________________________________________________________8 C: y. \+ D% F# [
  ~, I$ O8 L2 B( B. ~) E
* i1 r9 J, n4 ?
Method 066 a% O; W; d, d# s, x6 L7 A; U2 e
=========
: \* n, K& j' u; U' x
( Z7 K: L, `1 Q, ^
1 t& ^+ p1 v! k* A& k. S2nd method similar to the preceding one but more difficult to detect:6 ?9 q" Z* D5 [
  K% L+ J) N  w
$ y5 D1 l' s4 c2 q
int41handler PROC
+ w+ c8 Z. f# O" z0 q' [    mov     cl,al
# C- I$ ]% B" k( e1 V    iret% N% M$ G/ ?: v
int41handler ENDP! W3 }1 ~0 R; d& C% e/ L2 R3 l
. M7 }; `; i2 K3 v  h1 g8 X

- ~6 Z( [& ]2 W4 ^. }    xor     ax,ax
8 X# q# P+ V) e2 s5 N    mov     es,ax0 }  r' j0 t# {
    mov     bx, cs
3 ?2 z' Y5 D, P6 ^9 A9 W0 B* i. h    lea     dx, int41handler0 @+ Z. A  |" a/ z
    xchg    dx, es:[41h*4]
2 h8 r" T' A( K$ u/ K    xchg    bx, es:[41h*4+2]
1 s; C* x8 U& D    in      al, 40h
+ ^/ m# H: l7 V    xor     cx,cx
; R; P; D7 O- V0 _, Z, g    int     41h( }* t, _+ \' T" K
    xchg    dx, es:[41h*4]
" F* q' u, G2 o" b( i    xchg    bx, es:[41h*4+2]
% V) A7 T/ L$ [/ `, C  a  u    cmp     cl,al' c5 T  I6 y9 U' x) t: b
    jnz     SoftICE_detected/ s+ q0 ~  H1 Q& P
# d( V8 e: I) Q  P7 J7 G! `6 i2 M
_________________________________________________________________________
' T$ H. x2 P* S  t# s# d/ j6 o: J% p1 K$ j+ O" A5 ]' t$ ]
Method 07: ?* m0 R; ^' I, z% x: N3 d+ |: Z
=========
2 Z  W/ @& i+ q. H4 i' s5 r8 ~1 C& F
Method of detection of the WinICE handler in the int68h (V86)
, H8 y8 {% Q) U
2 n) B2 ?0 @7 \; E( g$ \1 _    mov     ah,43h8 Y9 f* \% i/ ?2 v( ^/ E. u, `
    int     68h/ T4 G. l. ~0 i
    cmp     ax,0F386h
% I* R, V) m1 }3 Q; ~* s( \    jz      SoftICE_Detected# d8 Z( d8 C. `* O+ V$ D

, k5 d$ I4 j7 t7 c# a* w& }1 f/ A0 z% y/ c% x
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ O( p% k2 d8 B' r& y' r
   app like this:$ _. R. K$ x' g' ?

" G# Q1 ?- I/ x   BPX exec_int if ax==68# i+ R+ p0 ^1 U* H! e) d' f+ P
   (function called is located at byte ptr [ebp+1Dh] and client eip is
# X* `/ L( C3 r   located at [ebp+48h] for 32Bit apps)8 |) j- G8 e# k
__________________________________________________________________________0 B+ S6 @) p, L+ b

1 x8 V0 y2 D, m! {- b& O5 Y; n2 n+ {% v/ f( g+ F0 k
Method 08
2 R4 Q0 w8 u. e9 i=========/ u) w4 S' ?* ~8 b! t% W# q

7 U* A. Z5 D3 G2 y! |9 ^9 {It is not a method of detection of SoftICE but a possibility to crash the( ?6 r. {5 W7 |6 B, R
system by intercepting int 01h and int 03h and redirecting them to another
. e6 Z7 y: d% Z+ {routine.% l+ X; C" F, e4 x
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points" j' r. W) U" d
to the new routine to execute (hangs computer...)
9 }6 p( Q7 P/ `' A6 w# ~7 T1 w0 \0 I: E* x' C5 ~# T3 G
    mov     ah, 25h
) K8 _: H! f+ _    mov     al, Int_Number (01h or 03h)7 D0 }. W1 @- _" E8 a
    mov     dx, offset New_Int_Routine- r! m! w9 V$ b  ~$ s. n
    int     21h
' G. A% N3 F+ C, l
6 q! o) `6 a& B# \% a* e" n# R__________________________________________________________________________
( Q6 H. S4 t9 m1 p8 W: E/ e7 y* v$ w+ `, V* q# k; z
Method 09
9 g) @7 G& v' @=========. D. e$ E2 ^/ f( j# W5 k
% X& z' J6 ^' }; K1 h/ L
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only' H3 W8 Q$ [: E9 D) ]5 W
performed in ring0 (VxD or a ring3 app using the VxdCall).
4 W  s1 r0 {$ t1 j; MThe Get_DDB service is used to determine whether or not a VxD is installed# f  d* b" Q/ T$ p# v+ n' V* M. @
for the specified device and returns a Device Description Block (in ecx) for  |9 J" C" ?7 w. J+ M4 \1 {
that device if it is installed.
% P' o3 j* B  \& O0 g' W* c& p. U6 A& ^$ P$ b/ P( a$ U8 u
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 ]$ u0 h0 G" n: k
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)! w' C* e1 V8 @& o/ X6 r& W+ D
   VMMCall Get_DDB
" {; r! ^* ]9 T3 Q6 F! n' I9 z  L   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 H: o7 ^. _. f4 a$ ?7 m* \( R& u0 F2 Z
4 ~+ s( b/ f5 J2 B3 DNote as well that you can easily detect this method with SoftICE:
$ P) }. w, {% M" U8 Y   bpx Get_DDB if ax==0202 || ax==7a5fh
- ?6 {) C1 f+ g0 P$ q( C% u
! U7 D/ g% _0 M__________________________________________________________________________* Q9 A8 {  W1 x4 y$ u

8 b' h" _9 s" A) K4 z& A( ~Method 10# Q; J$ \  I2 B* ~. `( k- \$ g. Q
=========, v8 J1 y" Y1 D+ a8 E2 k

1 p8 T9 A( C/ K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 L5 w  ~. y) y' ?  SoftICE while the option is enable!!
3 t% m$ \! h4 r# V1 j" t2 d
4 Z$ f0 ?; H. I& O' _* i! [: L* xThis trick is very efficient:* T6 \: [- U0 H' B0 q$ a
by checking the Debug Registers, you can detect if SoftICE is loaded9 Q- X5 M+ v8 L/ b( d
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% z* ?5 V  I0 W9 z5 u: Lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
# w' x" v9 M% ?# V& ^value (in ring0 only). Values can be manipulated and or changed as well
, x8 R! k+ u  P# X+ d! B* m; J% E(clearing BPMs for instance)
' N+ k& p4 U) g+ m
1 }* J8 E$ y9 z. w* D__________________________________________________________________________3 y/ h! Y& w: s6 e4 _

1 K4 m/ ~/ O( D1 MMethod 11! r0 H5 _6 y; E: x) S
=========+ b2 V! }# n, S# F! G

7 C& u4 H; v) X$ O2 R5 ~This method is most known as 'MeltICE' because it has been freely distributed4 F0 s- K0 a( |0 Y. M
via www.winfiles.com. However it was first used by NuMega people to allow
! d  M& _# }/ xSymbol Loader to check if SoftICE was active or not (the code is located
! i, y; b3 C; g/ M# j9 Vinside nmtrans.dll).
- a2 M8 l3 H/ c5 O& h% P  i0 r7 m$ M; y0 |* e, m2 g# L
The way it works is very simple:
5 i3 A# e2 m: e( K% p: fIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ m% F, [, P2 [* [, }4 P
WinNT) with the CreateFileA API.
7 v4 x! f& y$ F0 L6 m2 |/ X3 T# M" j* Y. ~- b
Here is a sample (checking for 'SICE'):# y$ ]6 E) A; n1 p

" A" L" a! m" _/ l1 z1 ]7 K7 CBOOL IsSoftIce95Loaded()
" W0 h" p& e, M( E. l$ H; x# u{
/ q- \* ^) S: [+ s' x3 v( ^   HANDLE hFile;  
4 E7 j0 m, e, z8 N" V: P) y; p   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 w: e& y5 n, p+ r) g
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- ~8 b) `/ a1 @- O: N                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 V% [5 X* v8 Y2 c
   if( hFile != INVALID_HANDLE_VALUE )
( c3 O) @# t  E( W$ A1 G7 X   {$ j# |5 E+ j9 E3 ^
      CloseHandle(hFile);, r5 `* J- t" R: c  s+ P6 e
      return TRUE;
9 c% r' W1 B* u, r   }
6 @- N5 p! o# D) A   return FALSE;
6 O$ ~8 e) f. D! M/ y}
$ l3 J: Z7 {) J) B/ ~; p( k1 |8 R+ b* t9 ]
Although this trick calls the CreateFileA function, don't even expect to be  _0 r4 B) o( O: @) @8 V3 e0 r; D- ]3 k
able to intercept it by installing a IFS hook: it will not work, no way!: m, h) q' {: v+ g4 x0 ]7 K. R
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
3 _- A& q1 Q8 Iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) i% {, B- o6 N4 X, `
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ t/ s* v/ _, w# M3 n: m) x
field.
6 ]) [' O2 O0 k* C7 Y: A0 Y3 QIn fact, its purpose is not to load/unload VxDs but only to send a / l, Q8 L+ y* d" H8 y* a. ?' Q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( O2 t' j# N6 G
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 f+ H$ ?7 y+ Q/ s- G: X, |to load/unload a non-dynamically loadable driver such as SoftICE ;-).
% j7 u1 r" B- V3 l  G2 gIf the VxD is loaded, it will always clear eax and the Carry flag to allow
) d1 _8 x* n6 \  T6 i$ r) `its handle to be opened and then, will be detected.
0 A4 l* n) K. fYou can check that simply by hooking Winice.exe control proc entry point  j  R9 k) i5 i. E; o3 Y
while running MeltICE.2 h3 Z& u" j+ p4 q' ?* a9 V! Z

8 Y+ }) @5 C6 |0 R6 f* |+ h8 V5 T+ p+ P7 T# A9 }' P* s
  00401067:  push      00402025    ; \\.\SICE
* [" b' M% o! Y: G- |9 I. x  0040106C:  call      CreateFileA6 b7 v, A9 Y3 C9 s; U# ?
  00401071:  cmp       eax,-001
/ ?5 L0 x* i" y9 b* A4 v  00401074:  je        00401091
+ e( I+ R2 z1 A+ X7 s, H5 H
# a% x* c- k3 y- d& u$ p6 W, o! @& ]. `* Q, D+ e" K% e; _
There could be hundreds of BPX you could use to detect this trick.7 b  U4 @0 ?& a6 k
-The most classical one is:
( r' B5 n' K1 p8 |6 p0 \  W: v2 `0 [  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% j  D/ @) v+ ^, e- t: f" n    *(esp-&gt;4+4)=='NTIC'4 V) l$ m- o, Y

; A1 g2 @0 Q8 G5 ^' S-The most exotic ones (could be very slooooow :-() P) \) U7 A$ g2 {: G; C# C& _
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
' o7 u  [/ p6 c# l3 s; c. s" x6 @     ;will break 3 times :-(" ?& `- I* \5 Z8 S4 P4 \

, K' P  Y6 n/ I# b3 Y-or (a bit) faster: + N5 R7 E# a4 e1 \  B$ C3 A2 ]7 N0 h
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 k' R. o; w2 x  J2 N7 v  e4 a2 u( j9 a
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: N/ |) h4 @6 R# `! t     ;will break 3 times :-($ b' \  D: X" u# A8 A5 ]

& H. y- Q/ X; n, _, T' \% d-Much faster:
  K' A. j! f2 J# C   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& W) w: n3 H6 V7 z3 B: N! P/ E  \% N& C$ z% I1 P4 D! i! A7 r
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen- d( a# n/ ?3 g5 l' [4 B
function to do the same job:
- l3 j' b" g% Q+ H" b! a  s. {' w' F' ]; t6 f  G! y
   push    00                        ; OF_READ
& M7 r0 J- m; ?2 T8 J' B, U( I+ u4 u   mov     eax,[00656634]            ; '\\.\SICE',0
" |( V# R, p: v. p; l   push    eax2 s+ ?) C( K" S2 F9 i6 V' L$ O0 F
   call    KERNEL32!_lopen$ v  ~7 ^- |& Y% Q# k
   inc     eax
8 m( B% j1 h( A0 v4 k   jnz     00650589                  ; detected
+ W3 u0 T( `1 M   push    00                        ; OF_READ
# t0 h0 x# e8 S% j% o   mov     eax,[00656638]            ; '\\.\SICE'
2 Z3 A7 x' ^0 L+ S6 G   push    eax2 Z. r  b, {- T( j5 ?
   call    KERNEL32!_lopen7 e- w) C" {; K' c( t( k
   inc     eax
) u; l& p. \6 E5 Q   jz      006505ae                  ; not detected
1 ~" I+ j+ T5 U& K/ Q2 Z, [4 C. i/ t  m

  Y. i  E5 C; l; s, {; w3 N" [9 t__________________________________________________________________________
, W1 V% N; C- f# N( r  Z/ G, t
Method 12
5 u5 F* D  }- C1 _/ O=========
+ `. o) f: q  t& C7 ]: K4 [% [$ |' x1 S6 y: ~
This trick is similar to int41h/4fh Debugger installation check (code 05" ~) q: E0 g1 W) x# q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& a9 j  v6 U8 h# s1 h: Tas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
8 E, I5 D4 V+ w' b8 X3 t& F9 V/ C& @1 N( q0 `# z
   push  0000004fh         ; function 4fh/ C- N; L4 `4 _/ {: \
   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ k8 a( s+ I. s! U: p                           ; low word specifies which service
& P) M# k- n! R2 v- ~                             (VWIN32_Int41Dispatch)' S/ B; I) J5 D3 S5 q1 {) {& k
   call  Kernel32!ORD_001  ; VxdCall  K1 r3 w" E0 V' i) D4 @  K
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 Y8 L: o2 i! R$ m
   jz    SoftICE_detected
- s$ ^/ i. K  P- o; d9 J0 x  a* s* T
Here again, several ways to detect it:
4 @8 ~5 Q8 E! U. w. Z+ u- T0 A7 s1 M! W1 a3 e# w
    BPINT 41 if ax==4f
8 O% t0 z4 y& a: k" N& }% x% k0 U5 l% |
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
/ M4 O5 `7 k0 P4 ^6 H* K
6 N& }- }7 B. b, Z) S    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: {5 k! D) U9 D. J! S; D' S

5 P2 I  h6 ~0 O* }4 G    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& Y" [) D- }/ k0 _' `; f% M9 M

( T2 l3 g! W" j+ p- X  C5 c__________________________________________________________________________0 n5 H  S3 ^1 ~) y6 K
, T9 e' z" n7 G; }/ _
Method 13
3 \8 Y; D' d) c7 }% P& q=========! E% M+ r3 b3 y/ b. Q7 m) l" e

  M: L* P; @( O$ q9 ?9 @Not a real method of detection, but a good way to know if SoftICE is  T  y, g/ P8 i  L3 U
installed on a computer and to locate its installation directory.3 Z' w% g; h7 t% ^; A" q" G
It is used by few softs which access the following registry keys (usually #2) :4 J9 R7 t; Z2 Z/ m- b
- ]( _$ ?7 ]$ ^$ Y
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 r- l. ?$ Z7 j7 `' l\Uninstall\SoftICE6 A9 Y- e5 g) a. m) N+ F
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( @& `0 n0 Z" v5 Q; v5 i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( @; y" U) `6 e; u9 B. G1 x; b\App Paths\Loader32.Exe
7 l& i( G: m8 r% r9 f& Z( R1 B; a  u) \1 |

8 G! C1 ]5 R+ z% N. J* b7 C- SNote that some nasty apps could then erase all files from SoftICE directory
$ [# K2 v, I0 \6 p9 j: `7 L3 G. V(I faced that once :-(  x; o5 m. g8 |0 T
$ z! d/ N$ G, O$ {  h
Useful breakpoint to detect it:, h; _$ S6 X& Y' {. B2 G

6 t* C9 {1 C) T- Z  d     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 R/ y+ `2 X1 Q* C

( A; D: }  \$ m2 {& w# J__________________________________________________________________________
; }, B5 i; B: n: B3 a9 F1 Q3 Q9 i7 M% ~) F
) k4 d1 Y- A4 X: G* V
Method 14 4 M- v6 r- G& W! j
=========/ [( \& H7 @$ p  _% v/ Y
' n) Q5 ]) d0 b1 F& o9 t  y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
" G6 V  E' y8 U# n$ {is to determines whether a debugger is running on your system (ring0 only).
" _7 Q9 G3 a& r; X+ m; C; }) M( `" G) t/ e: y
   VMMCall Test_Debug_Installed
  b5 B2 i" h1 R   je      not_installed
. T: f5 l7 Y. V( h
/ @, r) |2 r. |  B% gThis service just checks a flag.
( u" `& K* l* v! ^9 Q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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