About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 a) B& q6 q& f7 R3 _8 q5 o4 R<TBODY>" g$ _4 `" \* |7 V1 Z8 u# r
<TR>
- c: m6 q9 c; w! l<TD><PRE>Method 01
( Q& G( O1 A8 ?1 s% B, ^4 S0 ~% N=========- o8 o! o: ]  |

5 x3 w8 h, o& h+ u2 _This method of detection of SoftICE (as well as the following one) is5 w) d9 n* Q" _' H" \1 p7 S2 |
used by the majority of packers/encryptors found on Internet.3 Z  r% m  i; H  K
It seeks the signature of BoundsChecker in SoftICE
  R+ I% X' x) X! R
7 }/ ]* q1 m+ J* U9 E    mov     ebp, 04243484Bh        ; 'BCHK'3 v9 a. b/ J& ^* M2 y  ?: Y
    mov     ax, 04h
& o) I* y. _8 _5 u" o    int     3       / F3 p, X1 n2 D( h
    cmp     al,4
/ b' F* @  Q0 K, x9 D    jnz     SoftICE_Detected% t2 q8 v: P+ i4 w
8 _: Q) W2 V( y6 w6 B+ d9 M
___________________________________________________________________________
4 g4 ~# ?( C' @; i; N. m5 ^1 z
4 R. m+ H1 \. \/ Q! a" ]Method 02
+ L5 \$ W: |' C. B1 ^=========+ S; k; J5 J! S: Y* Q5 W1 E  W

3 }! u& I' J/ y& V4 }% TStill a method very much used (perhaps the most frequent one).  It is used
- ]! T/ ]( B. s6 }" Nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 Q# e4 m" q4 |! D3 Cor execute SoftICE commands...7 L, D# q+ o4 O
It is also used to crash SoftICE and to force it to execute any commands4 m8 j& ~2 R% h
(HBOOT...) :-((  
+ B: Q4 s- J0 o9 o+ Q; b0 M2 q/ H2 f) P& D$ r
Here is a quick description:
: {2 c+ F5 U9 c+ x5 K# Q2 x( N% z-AX = 0910h   (Display string in SIce windows)
" h+ \" U0 @4 a0 G& Y' m-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* w; U- f5 S/ b( h9 G-AX = 0912h   (Get breakpoint infos)1 x* u3 }; [- Y3 ^6 d: v7 F& c! J3 {
-AX = 0913h   (Set Sice breakpoints)  S8 I, a7 H; r3 c7 ^( W/ \
-AX = 0914h   (Remove SIce breakoints)$ J% s" F/ j  M- J: H
, v9 Q1 z* n! ~- g
Each time you'll meet this trick, you'll see:8 I+ I! s! H# E/ r8 \1 i
-SI = 4647h
+ G4 o& h, R2 l2 P7 p/ a( P7 `% }-DI = 4A4Dh
6 }; q: C4 c8 f9 ?2 u% CWhich are the 'magic values' used by SoftIce.
; v5 [0 f' U1 ]' xFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
4 m8 ]% h, t: s. t4 Q4 ]7 v; N' a0 G$ `
Here is one example from the file "Haspinst.exe" which is the dongle HASP- u' S' X6 p; \. x
Envelope utility use to protect DOS applications:$ `: N0 \7 k: {! E
( [- L& j1 X0 J7 p9 _3 [
0 p1 A1 G: i3 x2 u
4C19:0095   MOV    AX,0911  ; execute command." ]( U" O, U4 v
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* l, U! b9 o; F/ d. t4 [4C19:009A   MOV    SI,4647  ; 1st magic value.9 i2 L( r% V; `7 c7 l9 ^$ N
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- G$ I8 ?( F7 |5 |9 C1 a7 Q. m2 `, s
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* V% q5 d4 y: \0 L
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. \& W- Y' F+ f" ]9 @
4C19:00A4   INC    CX. u+ M8 Z/ X; Q) Y- k' d% ?& K& h
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute1 D$ L6 r  T* \, r' b2 t
4C19:00A8   JB     0095     ; 6 different commands.3 i6 k, s2 q4 k) H/ @  L! `
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 b  u5 J$ \. i( B# C% G" W
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
1 |2 {/ r2 e. N, K' Z* y7 a  |" A, K0 Z% G! Y
The program will execute 6 different SIce commands located at ds:dx, which# W6 L: f7 ]& o9 q+ H" L
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* n# a( j8 u, S9 X3 ?3 W) ?$ B$ C1 P4 ]) u, f6 j8 h
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., y2 h. ]! E. q$ j2 N) P0 w# H
___________________________________________________________________________9 K/ y; g# E# F! y! K3 o! [
# `: V& {5 G/ k1 U

/ `/ x% e6 i5 pMethod 03$ d: W0 d! ]3 p0 x9 V1 N$ z1 g, b
=========
$ j2 F4 K9 G, k4 G
+ b% U  l% l3 Q7 `( GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
$ b' S/ w& F2 f8 q6 o& |6 `(API Get entry point)$ ~3 f2 b1 m7 Y; w4 \
        # b# `9 r/ G6 y& J) V" S- F
" `: ]* D+ l- |
    xor     di,di+ Y. p6 j. A: o# N$ l- M
    mov     es,di+ \  l* F* A" P$ P$ s% \
    mov     ax, 1684h       0 B5 J$ o: ^% `* {
    mov     bx, 0202h       ; VxD ID of winice
) f% K! {# @* _7 B' q    int     2Fh
5 a% r' w: f* Z' ^3 M    mov     ax, es          ; ES:DI -&gt; VxD API entry point% e2 o9 m+ w( A, p3 S
    add     ax, di3 y" E7 _+ G" a9 o/ Z  z
    test    ax,ax
, A( R% O- r' {3 \7 d    jnz     SoftICE_Detected
) q, I2 i3 _' L  R. g  p0 z. p' X3 t! G: ]/ a, z2 n3 ^5 b3 Z& ~
___________________________________________________________________________
3 W* a% `4 ^7 I: ?. {  T) X3 ^9 `+ _
Method 04
8 y( e0 |0 ]* \! {=========
! r, }8 P2 ~& y/ V: j5 S, N, |0 ?8 z" _" |8 ^
Method identical to the preceding one except that it seeks the ID of SoftICE
# P; h: |7 u, u1 W  bGFX VxD.
. H0 i  y) x( S1 J4 r0 F' }/ U7 W
# W1 u( Y4 w, }; U( ^    xor     di,di
. U5 B- Y7 J& L% u1 z    mov     es,di
$ c! z' ~; p( k9 p* L! X    mov     ax, 1684h       , X5 f6 Z5 w: k. s' B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! Q5 v& g3 D; @3 x5 B    int     2fh2 E% Q, Y/ i* _& x+ P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* V9 l0 P- z! m5 W; M& x
    add     ax, di
8 @% h! `9 X- c, _6 L" R    test    ax,ax
7 `+ @8 F" L' F7 ~5 o% [2 Q    jnz     SoftICE_Detected
1 W# J& J4 P3 W2 C$ {) ^5 E( L/ [/ s/ Q0 {4 M
__________________________________________________________________________
( L% }& p1 _8 q
0 {' i! ~; g; j; ~) c! F; {+ _$ j- Q0 q
Method 05  ?$ e$ Q- g  Z* P1 O
=========
% l% j8 E, {! n9 \: {
, g7 B/ _: Z1 OMethod seeking the 'magic number' 0F386h returned (in ax) by all system
0 ?9 |3 L4 z; B" s& r# m' ^debugger. It calls the int 41h, function 4Fh." m( u" z0 j$ t
There are several alternatives.  3 [4 O8 N6 l3 F7 M9 E: j6 }$ d0 Z

: ^; V0 e* E, ?- L; r6 H. G4 vThe following one is the simplest:8 [! J3 O( @7 w. K: B, N

- K& y2 |+ ]0 V: z; N    mov     ax,4fh
# c$ x( m2 {: g# ?5 Y8 l    int     41h% l7 d) ]( g, B4 D
    cmp     ax, 0F3868 m1 ?- K' v4 u: X
    jz      SoftICE_detected
% K; g3 k1 z' @- h" {0 k8 h, D7 S+ I( B7 S+ a) A- d6 k- ~
5 E9 }% @' A7 m  T) M& r( x
Next method as well as the following one are 2 examples from Stone's
$ S! e4 A# q6 Z3 u"stn-wid.zip" (www.cracking.net):
' S- ]# G) a# A. I% H% q0 s2 _
7 Z" M* Y: U" J  E; T    mov     bx, cs1 c+ X2 y" Q3 Q. r5 k: D( f* N0 u
    lea     dx, int41handler2
$ K  w+ ^( M4 R( b4 E) |    xchg    dx, es:[41h*4]
) j5 f; @$ k9 W9 ]    xchg    bx, es:[41h*4+2]
" v/ U" |* b% e3 l) d7 b7 D    mov     ax,4fh
& \2 E1 q6 U8 v$ N0 w8 q    int     41h
# d- D+ n6 i; R. d' _) i5 ]    xchg    dx, es:[41h*4]
9 b: g3 U6 m  q* O! }* C    xchg    bx, es:[41h*4+2]8 O, q9 o/ B9 _& g. e
    cmp     ax, 0f386h
9 p" J7 F5 }, Z6 e" y* S& n! X    jz      SoftICE_detected+ S+ a; ?8 M# Y8 n" M6 R
# c# ^( Q2 ?/ c  Z+ j, ]
int41handler2 PROC6 S4 F2 Q: e7 j. F' x1 Z9 g5 f
    iret
3 V" b& p/ a, E3 e. `int41handler2 ENDP
. |# T6 c$ _' S* f* [. L& f$ r% e5 F, ?& V$ v/ v

' a% v7 z5 U$ r0 A% y; X_________________________________________________________________________
9 n4 c1 O" t7 f8 h# L; {9 f( B! ?$ x1 n) N7 x1 y/ Q  e. F$ H

  r( ^+ Y: C3 d3 m$ {7 i. HMethod 06
0 {6 y0 R9 f7 \3 }5 C=========$ m0 \6 y; }- l. g

/ |' B, k5 f$ U, ~' ^! M% Z# l$ v- o# L% B. v+ ~5 j% L! D$ d
2nd method similar to the preceding one but more difficult to detect:1 _9 l. }- Q/ X4 b( Y

2 \7 `5 }( z7 ^% L$ L6 o) y- I" g& f7 ~: F9 e( z. @5 P
int41handler PROC
& E4 ^# r& x3 Z    mov     cl,al
+ I/ k$ a) n* Y, F: ~: v& F7 B    iret. C, ]- f8 D( R' H
int41handler ENDP1 L2 }& S$ |' c0 `2 i5 Z3 p' J6 l

3 z# P6 b, f. r/ f! G9 t% @
2 i* W* c, E# L    xor     ax,ax) B( w( e* X7 Z- @! t
    mov     es,ax# y) J: W0 G. p2 B/ ^
    mov     bx, cs! b/ ^/ ]( {3 w$ I+ `% \
    lea     dx, int41handler
7 |1 c, f9 w2 l. N! n4 k! K% |    xchg    dx, es:[41h*4]
% i# n3 g, y- [  n2 M, m    xchg    bx, es:[41h*4+2]1 a& I' ~' f2 p) X
    in      al, 40h' {) a* n7 U+ D; H! p% n% ?
    xor     cx,cx2 q, N! o: [/ ?! y4 O* ?. r" l
    int     41h
1 k  f+ g1 [& ^9 j8 x    xchg    dx, es:[41h*4]4 Q' o# b/ B/ S$ L! J- i; c
    xchg    bx, es:[41h*4+2]
' k: m6 b( R% M+ u2 `4 Y. ?    cmp     cl,al
" l6 X+ J) c: @7 R/ Z& X2 m3 V    jnz     SoftICE_detected
9 ^5 Q7 ~9 ]( ]# F( z
) ^) g* L# J+ ?  _, i& i_________________________________________________________________________
& M; E$ o3 q2 z& o! S0 D/ W- D) h: D4 T7 X
Method 07
: I4 d$ N; X9 Q" D' E=========
6 o( }6 I8 n- ~7 M6 G  n" Q! A$ I1 f
/ O+ s; M6 C2 G) |2 QMethod of detection of the WinICE handler in the int68h (V86)1 K2 c+ A  a, ^$ F2 H
8 f1 p, @9 m* I* b
    mov     ah,43h
6 ~1 p8 ]  F5 m& |9 l    int     68h/ _5 C& h' a5 [" ~; {
    cmp     ax,0F386h5 D  }2 [/ ]& M
    jz      SoftICE_Detected
. B1 y4 `9 |4 s) H* d
( N( r" g7 v. h3 R9 @4 P# |# V1 }9 y: v  X; H2 ^* m* H4 S
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; \# m  g2 s1 p; \, }   app like this:
6 s  i2 n, ~9 _2 _' z
# S7 |+ _8 w; b4 f   BPX exec_int if ax==68
, e! ]3 N" O$ W  i/ n/ h   (function called is located at byte ptr [ebp+1Dh] and client eip is
- V9 C% P8 j) T4 i   located at [ebp+48h] for 32Bit apps)8 S- I& i- b8 D. ^* z9 y% w
__________________________________________________________________________; x* D  M& E2 a/ a. J

1 N- [1 |; f3 `, c; ^& l; H
1 r% h" T4 V3 d# r% }0 @Method 08
  M9 X, d% G! P=========
% f2 T& K! f* P* H: N) s- ~7 b9 ~3 K! J* W- v3 _& I
It is not a method of detection of SoftICE but a possibility to crash the$ r" o* b7 ^/ k1 ]- g6 z! x
system by intercepting int 01h and int 03h and redirecting them to another1 C& P/ ?, Z9 p. E( l' o, e& @
routine.  b- Z3 z/ x- V, @6 M
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; t# Z3 H2 {7 O7 f+ o; Pto the new routine to execute (hangs computer...)
6 _( g: T2 _) f  p( n3 y( J8 v: `) J* W6 N' }& f
    mov     ah, 25h
# k: }+ [# F( r4 L, Z    mov     al, Int_Number (01h or 03h)+ d5 D% ~1 C" a  y2 z7 c$ _, A
    mov     dx, offset New_Int_Routine
/ M" j, S; ?5 P8 g: T    int     21h
+ I9 @" F: n. B, a$ H/ B: X5 k3 h: c7 b& X9 u7 B8 L0 ^% Z+ H
__________________________________________________________________________
  ]8 P: O/ z% ]. U
0 v+ y* h8 B' F* S8 ?2 f3 OMethod 09% `# t8 @" r. W$ [$ A+ Q
=========
; X9 @7 c" p0 G
7 M5 m# x$ N% @This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  y: D- }8 e7 J* f( g
performed in ring0 (VxD or a ring3 app using the VxdCall).
* K3 |; o. T1 EThe Get_DDB service is used to determine whether or not a VxD is installed2 d9 h5 A( z3 h
for the specified device and returns a Device Description Block (in ecx) for' e* |1 [* `* }: v% Y9 H4 C
that device if it is installed.3 O1 v6 w8 C7 s+ N
" q8 Q* \/ y* O1 g7 v
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID, C* ]* C6 d. f% V0 C
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* _! h3 _/ m2 K- c/ w   VMMCall Get_DDB
8 r! ~$ d: R" C; \) ^9 J8 O3 C   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ g% u- W0 v: d; B& z& i- L: w7 l: p3 i5 G7 x9 h: [3 P
Note as well that you can easily detect this method with SoftICE:6 E* z8 d+ W$ w; |* ^! G- ]2 l' K
   bpx Get_DDB if ax==0202 || ax==7a5fh
+ }' Y5 J' J/ o
5 N/ k% E( g8 v8 C9 G__________________________________________________________________________9 I+ h: _  f: j) A6 e  \

" m; ]5 H: l# [" R/ _' o& N$ X" yMethod 10
* d! \2 L$ r0 h4 b/ h  K=========
+ G$ o9 E1 c) x( I( ?- L! I+ [  c4 ^  |- o2 @5 m
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 A; ~( Z7 q" k8 ]/ b
  SoftICE while the option is enable!!
$ d  s) n0 k  v/ S
# ]* J' y( m# fThis trick is very efficient:
/ E; q* {$ E- [& u3 z# a2 I1 v6 ?9 hby checking the Debug Registers, you can detect if SoftICE is loaded) P- d- W7 g4 r" R% Y) w
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" Y9 @5 ^& Y. Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their8 N# s3 x0 B* }5 H0 A
value (in ring0 only). Values can be manipulated and or changed as well
5 t+ v. M) a4 k(clearing BPMs for instance)4 g5 Z4 a- y; h# o6 @, d# F5 T
$ L  a: i6 m; R( y* g/ v- q# @
__________________________________________________________________________  F" \* Q6 G, |+ @2 p  a
8 `( i# J/ s% ]+ Q6 p  G
Method 11
+ L. l/ P& f; }! x  A: J9 j3 A: [=========0 y& p- W4 ^7 k" f8 M

. N5 k$ X3 p+ G' i) n2 Z  N! \This method is most known as 'MeltICE' because it has been freely distributed
$ k1 z7 y( m+ S" Dvia www.winfiles.com. However it was first used by NuMega people to allow# r/ q/ W" t/ s
Symbol Loader to check if SoftICE was active or not (the code is located
$ ~2 W" G" |( A& K6 A% F! `inside nmtrans.dll).
% s5 P0 A9 P, q6 S- {4 g# g7 S( Y6 z' x2 e
The way it works is very simple:& ~5 ?9 Z$ Q1 Q( j6 Y5 v
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 s4 l5 I7 \% M9 HWinNT) with the CreateFileA API.
2 n& E1 e6 H1 ^( z3 Y/ f5 E3 Q+ J3 U$ E" G" p+ F% }$ q" \
Here is a sample (checking for 'SICE'):. o1 Y+ q0 g7 t% U, m

# }# _3 b% [& tBOOL IsSoftIce95Loaded(): F0 i2 r+ y) g. V0 U) x0 ~
{; @% a- I4 M! e- N. f
   HANDLE hFile;  6 e+ W( }0 A. d
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,( a! H- U4 p1 I2 r8 `- ^) Q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
, e; ~/ P8 n/ P8 O$ g7 D                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 C, M, h4 _2 [/ L% E. k1 e   if( hFile != INVALID_HANDLE_VALUE )3 f. F: H. [6 D" b7 i
   {
. f2 F" b2 i  y$ j  F4 s$ w8 y  a9 T      CloseHandle(hFile);0 P" e7 @4 T3 s* F# D
      return TRUE;0 U5 n0 A5 r" F7 P) u2 n
   }. Z. J% [( w5 ?) T# Q% M
   return FALSE;; u- k+ m, }$ X3 [; ]
}
+ L2 C' m2 n' _- w* E6 ?% O- a3 ^0 `  x; e1 g5 H2 P
Although this trick calls the CreateFileA function, don't even expect to be8 y5 K+ ~- w( a" O5 Y
able to intercept it by installing a IFS hook: it will not work, no way!
/ W4 |' s: B+ |6 H' ]In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 j6 O( z# q1 o5 w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 E/ U- }, Q/ ?. m5 _0 B7 N+ t" Z. x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc% Y$ Y6 L+ H2 o8 L
field.8 H: I: O' ~0 A$ A
In fact, its purpose is not to load/unload VxDs but only to send a
# f" ?8 c' }- v% C4 B" v" N1 lW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 `4 g* O, [9 Vto the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 |7 K& I: K+ y2 h$ vto load/unload a non-dynamically loadable driver such as SoftICE ;-).5 g9 C+ }. J8 [( |; ?+ ]6 C1 l
If the VxD is loaded, it will always clear eax and the Carry flag to allow
4 T/ f7 z+ H9 n6 pits handle to be opened and then, will be detected.
% s& m$ c- V! M: I  sYou can check that simply by hooking Winice.exe control proc entry point
2 q0 q/ H6 V6 s; D. uwhile running MeltICE.: y: r# t. a; Y5 l% W$ P

: u2 B- n7 j; C7 D! R
( v, ?- n" S: }5 g, {2 P" y  00401067:  push      00402025    ; \\.\SICE& I' j& ^0 M6 g4 t* Q5 u
  0040106C:  call      CreateFileA
5 j4 @: g! q6 s: x7 s% W! x( {  00401071:  cmp       eax,-001' h$ `: R6 O) [! A9 W2 _' \
  00401074:  je        00401091/ B4 Q$ s' B, T1 o& a# `8 U
8 |( h" J4 q* D% a# v: x
% X+ y) ~! T' v+ h
There could be hundreds of BPX you could use to detect this trick.
: w1 s5 I2 h' j" x! L# }-The most classical one is:( ^# _6 }9 j1 N; z- H! C
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* j4 x6 C! B$ K$ d. S% l
    *(esp-&gt;4+4)=='NTIC'
1 T+ O" K7 s: J% V) G
, B9 J. z7 O+ ^-The most exotic ones (could be very slooooow :-(
) ~% q* S5 {: @/ E/ F4 M8 j9 w8 g   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  1 n, R1 ]% V; ?- [
     ;will break 3 times :-(* F0 d2 l; Z8 t$ g
1 a% {) ~5 V3 p& [) X8 D" f3 n& W- E% S
-or (a bit) faster: + }, a2 o$ ^3 n7 ]" B9 @7 a- v3 e
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- ?- \: V, X7 }- {1 |: Q( n! ^9 t3 \% b9 c9 C
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 X! z8 S( q% q/ C( X5 h( P+ c9 n     ;will break 3 times :-() k/ b; O; u- Q' b& b

: a, S+ W* _# ~$ q  ?: J$ Q-Much faster:" Q0 {! j) C+ Z2 s7 o6 |* W
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" I; [$ W: H- `, d/ m( l

4 B- t5 @) `  i- J+ r/ ]Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ S+ J! G: g% X5 T7 efunction to do the same job:9 i$ M+ P% @! ~" c! K

8 _% p, J/ Q, I# o- o# ^   push    00                        ; OF_READ; a$ i. h/ c  f. d" X
   mov     eax,[00656634]            ; '\\.\SICE',02 P6 o' o0 e7 s4 \
   push    eax. G1 j4 k! Y; {  G9 s; Z' K5 U
   call    KERNEL32!_lopen5 ~8 |5 V: G0 r9 _! n) Z. v/ q
   inc     eax
  q  w- g' r2 x0 ]$ X   jnz     00650589                  ; detected
, _- j1 n$ B2 V: u$ z0 W" B" N   push    00                        ; OF_READ  c' X5 N' B9 i$ k( \+ m$ E4 |4 r
   mov     eax,[00656638]            ; '\\.\SICE'
( d! `( T8 |5 e: ~   push    eax
- D: e2 l8 F) x6 W0 y6 i   call    KERNEL32!_lopen0 C3 j+ F' d8 g( y- z3 l" i
   inc     eax& k: b' w% G5 M! W3 f
   jz      006505ae                  ; not detected- w. ~1 ]) v5 u

* P( j5 `6 m- M1 m. U3 M. h! n9 E) [) X$ }! k; K* O7 [) Z! f
__________________________________________________________________________2 ~9 ^0 |* O5 l9 N
& X2 X. C5 D7 X' `3 u! ]3 e  W
Method 12
8 m! l$ O. ~# B# \4 I6 }=========
& J: F( Y& n& z4 }/ w4 `; f1 u5 }. V4 O1 y
This trick is similar to int41h/4fh Debugger installation check (code 05  d* w% T; B# `
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
# ?0 H/ P, C$ r0 N. U4 Las it uses the VxDCall backdoor. This detection was found in Bleem Demo.
. }: g" h# C4 a# Z  r" D; f/ U+ @4 x7 `% w3 Z. k- B" ^
   push  0000004fh         ; function 4fh7 r- r! i7 a2 q
   push  002a002ah         ; high word specifies which VxD (VWIN32)
5 q0 Z6 r, d. }/ L3 M$ @# P, a! ^                           ; low word specifies which service
. N$ H1 K" m2 E' v                             (VWIN32_Int41Dispatch)
' _0 y1 J4 n% N$ G+ P   call  Kernel32!ORD_001  ; VxdCall( q% v3 B' H7 l, p
   cmp   ax, 0f386h        ; magic number returned by system debuggers9 q6 W( o4 v% Q# |$ v( ~, t7 J
   jz    SoftICE_detected5 Y2 t. A" s7 V! ~' y" W

! B3 ^3 l2 y; h/ H5 F) BHere again, several ways to detect it:7 K( z5 w3 j* c; v. M

. v2 p! `( _. L- G    BPINT 41 if ax==4f
2 p' X7 u' p" @7 w/ ]
8 a2 e$ O" @2 {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( b2 T9 ~" d3 L  H5 U* P: A9 I$ |
! W( S9 H& t1 F$ k. H
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. E1 Z' E8 p5 G5 Z# K) C/ \5 Y

0 }3 ]6 r; v0 u3 ?1 e    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!/ T* D/ Z, }" J7 l( z; {3 n
0 \/ u; a5 a  t9 w6 Q: S- B* w
__________________________________________________________________________3 n0 p0 r+ r' j* I  L

, t) b: h2 V$ d" N7 m$ S; C$ y. }Method 13; K- [( ~9 a# I
=========6 M8 d1 L( A. |3 T3 v
8 C0 Y2 D, W2 E
Not a real method of detection, but a good way to know if SoftICE is
6 D$ }& r8 q8 qinstalled on a computer and to locate its installation directory.- ^) I) o& q& @4 N" L! o  P- t
It is used by few softs which access the following registry keys (usually #2) :( w- o: e( f% r1 O: {

/ z8 X( D' d5 U  E# Y+ X-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 t- Z  Q1 @0 Z3 G( o$ ]8 X
\Uninstall\SoftICE
; h( B+ P# m' G9 f4 m6 `-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( o. t4 X0 }; P$ Z! E- u
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  r  e. K3 D7 Y7 U/ t) o/ Y9 v\App Paths\Loader32.Exe
' p; y* ?& }- U  ^& E+ M2 j! N5 S0 z

0 o8 c; }8 V/ |0 n0 D8 m2 t9 |Note that some nasty apps could then erase all files from SoftICE directory
1 E% F( }( L  @6 m- H( B(I faced that once :-(
4 e; t6 ]. P* H$ T2 X+ s( W# Z1 J4 b( `
Useful breakpoint to detect it:3 d" V9 [8 C" q' N' S

; }$ H) _! t! r6 g! p$ C9 h5 {     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 M1 T; m4 _: r# R# v; }. |0 [
9 _3 i* N# {, D2 i( O
__________________________________________________________________________% I" j: N0 \3 m# }

, n! }. i. U7 p9 ]8 V6 [
3 V3 P, U* B# mMethod 14
* e( Q4 `# G4 d5 k& v2 K. i=========( e& k9 B" D$ U

8 a" K6 ?5 P; z! A9 E% eA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose  E4 _/ |3 M* r4 j2 R( X" {+ S5 |' z( J
is to determines whether a debugger is running on your system (ring0 only).. ~/ [0 E% {5 y/ B

, }4 c! d  s8 x   VMMCall Test_Debug_Installed  ]* g, V; a) \7 A0 A7 n, i& e3 A9 y' O, P
   je      not_installed) T* |2 C! y" g+ v* |

' `) C, \1 u. t3 Z/ u) ?This service just checks a flag.
& c8 }  M7 M  p</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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