About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, e. H: a4 `8 h<TBODY>
) u4 W4 V% t2 Q  u% x) Q1 L% a# }<TR>: w5 O/ \! |6 V, N
<TD><PRE>Method 01
# N9 \/ c3 j- R=========  t" G* D0 J" ~+ n
8 \! S5 T  X3 V& b6 E( ]" S: ?
This method of detection of SoftICE (as well as the following one) is
% s, {* T" A# M6 u! Eused by the majority of packers/encryptors found on Internet.
! {. }: y: |- r" W$ h9 n, |% s/ r/ dIt seeks the signature of BoundsChecker in SoftICE; g# s0 w5 @3 a/ ~

. n+ Z+ M3 \5 _0 L- y! d    mov     ebp, 04243484Bh        ; 'BCHK'
: }, T7 t& ~5 ]- s    mov     ax, 04h
+ m' E2 h- y& p    int     3      
: H7 L8 b, c6 o* A$ A- O( L$ P    cmp     al,4) A1 h; n8 N( R3 o1 E" E
    jnz     SoftICE_Detected
" Y7 ], H. u/ q8 g' e0 ~3 a' L. l+ E% K
5 Y2 D# Y6 C. p( l( P3 z; V___________________________________________________________________________
: D( z$ ^& I6 f5 o& T, R5 n) f
4 R6 V+ R2 D4 \2 M+ W' {Method 029 A, ]8 ^/ s- i
=========
2 C; ^9 c: Z, _" R
  n8 \* q7 |5 C% U: `/ j8 U( `, UStill a method very much used (perhaps the most frequent one).  It is used
1 T" g3 w6 v8 y/ L; i* E' Rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,% s' W5 H! c, C4 H  ^; z( `
or execute SoftICE commands...
' j2 j- D1 f/ @5 |It is also used to crash SoftICE and to force it to execute any commands
: k4 R3 t. ], S, w- F7 j1 o(HBOOT...) :-((  
! y  Y9 P4 X7 e6 I3 i! `8 B8 |  M; u& z
Here is a quick description:* b: v3 R- e! M
-AX = 0910h   (Display string in SIce windows): i* K" g3 j# R$ l& U
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
% t# E) U/ e; z( V" K+ V- n-AX = 0912h   (Get breakpoint infos)0 l" R2 F7 Y5 x$ x
-AX = 0913h   (Set Sice breakpoints)8 I2 Y# c. y2 r) u! G) z5 T
-AX = 0914h   (Remove SIce breakoints): M7 M; n9 X2 @/ W# T- v

( \. u. t7 a' R0 W9 F" AEach time you'll meet this trick, you'll see:
1 O* W7 R" o7 z8 J-SI = 4647h
/ m6 n' E& h0 b4 \. o-DI = 4A4Dh) h1 C) W4 |1 H) K. ?
Which are the 'magic values' used by SoftIce.! f- I7 J4 M8 B$ b. G
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
. s: ]! V* A4 m; M
/ J  _6 p/ j# s. X6 ^! W( S9 YHere is one example from the file "Haspinst.exe" which is the dongle HASP
& V4 ~0 j  d( e0 d* l+ B7 lEnvelope utility use to protect DOS applications:
0 b% _6 ~8 _! I( r5 N- r, o1 W8 r( w  a7 T7 U

  j5 ]& R3 M+ }/ n, ?1 \4C19:0095   MOV    AX,0911  ; execute command.
2 W& c7 o4 `# q3 P  F6 b6 x& f4 X4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% t) K  E6 R* Z7 k; v
4C19:009A   MOV    SI,4647  ; 1st magic value.
, c. R+ J* N. ]4C19:009D   MOV    DI,4A4D  ; 2nd magic value.( k/ ~3 U! z% x, }: U9 e/ `& H8 ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- Z9 K9 w2 \/ r
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 h* c' x9 H5 F* Z4C19:00A4   INC    CX
- H3 N. Q5 r  U) Q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ L; e6 P, C% {3 ?+ y6 F
4C19:00A8   JB     0095     ; 6 different commands.3 Q# S. l$ o6 M  Z1 h, ]3 V- P
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% O8 F. P5 R/ w, S4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 J6 g, D# Y' s( z, ?1 `1 s- C

3 e& B% P0 r; t+ R0 N6 J, vThe program will execute 6 different SIce commands located at ds:dx, which. K" O  U4 L. t
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
; _. y& M0 A) a1 h- @+ c
  U/ \# x$ ?2 T* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- Q& e% ~# H3 {- x: }
___________________________________________________________________________
7 X# ~; ^' \0 |( ^: @; j5 w3 A6 O7 l3 A: d. t: G
/ ~* h6 G/ ]5 q; j) h2 B7 X
Method 03
! C4 v- }5 ]; Y3 {' i=========& e4 O6 y+ G# X% _- ?( }( F4 Q' U
, E$ Z8 C% K6 z- @4 U) K3 S8 o
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, s+ I  `: R& _- e5 L(API Get entry point)
9 {7 R: Y4 a& T# s        & T, O+ i3 O, S
; y1 |0 b- U) Q  F; K
    xor     di,di
6 w8 p2 ?5 J3 f- E2 ~/ I. a    mov     es,di# m1 B  K; \( ]8 U
    mov     ax, 1684h      
$ Y5 K; k1 @/ B$ L: |/ L7 W    mov     bx, 0202h       ; VxD ID of winice, t1 d3 B' U! o# }- |9 H% y
    int     2Fh5 [$ A; Y5 q9 J9 b, z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 P3 _+ E. W7 g  J    add     ax, di6 j' T" j+ W4 |6 {3 v
    test    ax,ax! V% r" {( p1 @1 x  Z8 Z$ C( ~
    jnz     SoftICE_Detected
7 E' A: r% N, Z& Z9 q6 m. u2 i0 i- [# s# P. O+ i5 i
___________________________________________________________________________
5 b1 ]+ u- N& n9 t* B# ?! ~4 A7 ^+ g$ S& Z3 @
Method 04
# u3 B1 L& d4 V- `2 P* J% P3 @5 S& K9 B=========" O. z3 w" X. k8 d1 r% u" p

4 w( ^; L6 W( }/ _Method identical to the preceding one except that it seeks the ID of SoftICE) f4 T, _* V' }" d4 z0 X; P
GFX VxD.% j4 c6 c! }0 c

8 s% @2 \/ D$ s$ H    xor     di,di
, N; d/ I/ Z2 {$ R) x- w' m    mov     es,di
. C8 c. X& r+ F. E7 q* I    mov     ax, 1684h       3 l  A5 E" z/ S& u/ j2 k4 z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID, N1 B6 O8 s' `& H  k9 Y" X
    int     2fh8 Q: P: `3 ~! e/ ]' @( I
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ ~3 |0 U3 I% M" Y* P: y
    add     ax, di
( h, P7 T5 a2 {4 E6 g+ p  f    test    ax,ax0 E. ~: E6 y3 r
    jnz     SoftICE_Detected7 D: ]# @' z" w, b

* O$ V7 J/ w- \: l! l; g__________________________________________________________________________
+ q; [+ ]' |: l3 ~. Y8 y& ~2 `- D; Z2 `9 O5 A  u: f# V: V/ }" G# p3 O
* z$ ?# H  k8 l( \
Method 05) D- J' R1 d* I' T" o5 ~
=========- H7 r" [. B! D2 H( H1 U9 A0 l% @
' T, ?" A" w- @5 C" X$ i3 B
Method seeking the 'magic number' 0F386h returned (in ax) by all system
) J: w! d- `% K2 Pdebugger. It calls the int 41h, function 4Fh.+ S0 J. U: |) m, P. C/ P6 x, x$ V: o
There are several alternatives.  
1 e7 E- o0 t/ ]' h9 D
; z, N- p# V/ N2 {  qThe following one is the simplest:+ u2 |/ U* C* X) e6 N" D7 j; p

0 W# `+ [1 {8 R. b# `- _    mov     ax,4fh0 h$ ^' t! W' P- u2 S- b
    int     41h
  M* O1 P3 V/ d* p    cmp     ax, 0F3865 i! w/ [. p% h- A- w7 b$ m2 x
    jz      SoftICE_detected- R, W: N6 y+ C) R9 K% v  i  u

% V1 k  T# T/ j$ X% E) k* K: D/ J, s& c; f7 L* A- y
Next method as well as the following one are 2 examples from Stone's
# D, z4 ^" O. T& s6 q6 {' I; Q"stn-wid.zip" (www.cracking.net):' J8 M- }, S' f; ^; X
8 k0 u% W" s; f! d) }" h8 h
    mov     bx, cs7 [9 d( X0 [3 ?  n( q* K- r
    lea     dx, int41handler2! \9 c/ b3 z. B  @; `' X6 B
    xchg    dx, es:[41h*4]3 f0 A# ^6 ~0 j# H
    xchg    bx, es:[41h*4+2]8 M" c4 ^% [4 f& J
    mov     ax,4fh
3 ~" b/ {* X; x    int     41h
" y- y, i+ d% z: ^: ?; {7 x    xchg    dx, es:[41h*4]
' J- v+ r7 m, i  A( ~4 ]    xchg    bx, es:[41h*4+2]
3 I8 i# k# I! D1 e' \; n, j2 W    cmp     ax, 0f386h
; p! I* I0 o4 h' i5 o    jz      SoftICE_detected
& y" t; L' w! ^3 K0 Y; `; N0 R% g; c) o4 ~6 w
int41handler2 PROC7 q+ Z6 H7 g) q
    iret  f# }' [  ]7 c6 F4 I3 u) u. n; i
int41handler2 ENDP; T) B# Q* A2 a3 v$ F8 d% Z

  B& X8 g& r* u3 `& ?% Y# t
! M9 K$ e/ ^+ P+ I' e* k_________________________________________________________________________" ], g; ^3 M' ]: ^6 a

  R0 d; D+ w! Z% f/ `) A% g! _2 j. g$ o" G
Method 06% Y9 n7 m% l% U* i& I' M/ P
=========
3 z) U6 n. w4 ]* [0 Q# E# Q
8 \4 E% H% u2 S5 A! X% Z" X4 E0 F0 J% h3 c1 C# X9 _3 {
2nd method similar to the preceding one but more difficult to detect:7 [+ U; k4 S( i1 h+ `; j# a
# C3 d7 l6 Y/ T( o) Q
. x" P' C3 f+ O
int41handler PROC& i. v! i" t" T% l8 U) A+ w3 u$ m" |
    mov     cl,al
$ h2 s$ Z5 V; l( W" ^% P+ r6 ]    iret
0 a  b$ F& I; r- Iint41handler ENDP) E$ _. _/ z+ g$ a  J9 c
: q/ `8 i! k! l& C8 y) t5 ]

& y( r3 o: X7 ?0 h- r8 \) z! r    xor     ax,ax
) I& Q7 r. D; Y* o6 e9 r    mov     es,ax5 Q& u, p4 r% |2 v
    mov     bx, cs: K  x* D2 a; b# {+ v
    lea     dx, int41handler
7 A6 N6 v, e/ `& [3 I    xchg    dx, es:[41h*4]1 X$ h3 R& d- s" c
    xchg    bx, es:[41h*4+2], e" G2 b5 N: i7 q8 R
    in      al, 40h, u$ W, y7 W5 L% _( d" E9 t+ }& l, D
    xor     cx,cx( Q1 l$ E6 @  Y" w$ U% X
    int     41h
5 l0 C# w' Y" E+ d- X( G1 o2 l    xchg    dx, es:[41h*4]8 S8 N# p) \6 r$ B6 i9 C
    xchg    bx, es:[41h*4+2]
1 y" g$ q$ j& Z* M) h, Q( `0 D4 d    cmp     cl,al# D" E* A/ o0 h
    jnz     SoftICE_detected
: ^3 w8 E& @) L! f* \" y: l. L) g# G( L6 k6 j
_________________________________________________________________________. y" X) b, _8 ~- [! i$ Q7 g
; Y! s# E) V, {6 W+ @4 F
Method 07
$ B& i# i" g( J7 z' Z1 E=========
$ }! N3 S' ^) q/ ?( o! d
/ O( J( X0 O$ Z+ V2 a  O5 YMethod of detection of the WinICE handler in the int68h (V86)
: j; F7 A9 f! i. I( |5 V
. r) V7 p) _7 N- F    mov     ah,43h
$ Z& O0 O8 \4 W7 B$ P    int     68h
/ N' q% h1 M0 U$ o) a- ]* f9 A    cmp     ax,0F386h
9 `6 _" |% r/ i4 r$ T- a  ~    jz      SoftICE_Detected
& R% }9 p& v; L9 H& X* u, I! j
. N0 H+ \6 m( T6 l
" o& A+ q/ r* N, A, D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 m  @7 ?' e; V: ~) l+ n& M/ k6 E   app like this:8 Z8 Q1 ^5 A$ K
& _2 S. a' y" o5 T1 C% h& P
   BPX exec_int if ax==68
  e" p6 \, \+ i0 {& G   (function called is located at byte ptr [ebp+1Dh] and client eip is+ N- A! F6 \4 h: l7 b2 c5 h: d
   located at [ebp+48h] for 32Bit apps)
' `' b  e5 E- ^$ t6 z__________________________________________________________________________* t# c9 V3 e: V) U
6 f& L& W& k$ b" ~. H
! \# Y; m# ~* x
Method 08
: E; u1 _$ ]3 `8 L=========# ^9 d" S1 q# u0 u6 I; w5 }. K) x" p* F

; o) n# n' [! |3 [" H8 U2 ?+ i: f3 rIt is not a method of detection of SoftICE but a possibility to crash the. W% o! r- O5 G" y; d7 O0 s
system by intercepting int 01h and int 03h and redirecting them to another  `: ]( H. h- T; J) l+ ~1 h
routine.& L8 Z( d2 d6 ?$ t0 s& f
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ J3 ^& |  Y! P; i$ }to the new routine to execute (hangs computer...); p' G; D, a& d% K/ Y7 Z# `/ ]' o: X

9 j" S  i0 R/ w8 s; h    mov     ah, 25h
! J5 |: c2 A; V9 n1 B" a9 Q5 l    mov     al, Int_Number (01h or 03h)- H4 w( ]& r( Q6 Q& ?
    mov     dx, offset New_Int_Routine& N  ^2 R- q! A: V
    int     21h( O: z: b7 j' {! C- ]$ @+ z' U
) A1 ^: O8 y5 @1 T) M7 M) U
__________________________________________________________________________
& q; y& ~% r2 }9 E  q
* `; Q* o- P& T5 XMethod 09
* [4 v) N: \( ], d5 \=========
& u" \# P+ [4 B0 h7 \+ m
' P( O# f; q7 g0 Z$ Y" z) A3 eThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
2 j5 k* {* B7 O! i! s4 @performed in ring0 (VxD or a ring3 app using the VxdCall)./ _/ y6 z% H3 ~
The Get_DDB service is used to determine whether or not a VxD is installed! o; n1 }# x2 R; S# |- C
for the specified device and returns a Device Description Block (in ecx) for
6 Q5 |0 Q" O% ]that device if it is installed.7 Y  d0 g; `' z* D* Z

! `# V' K* c7 i( t% @" W: v+ K   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- H% \- Q# y3 \4 b  r   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% k3 Q+ [+ x6 {8 p1 V, Z3 W9 h- C   VMMCall Get_DDB9 D7 ]+ j( h0 ?' U! k0 b
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! v& k- G: ]4 w0 k
; i( g/ g4 s; P4 HNote as well that you can easily detect this method with SoftICE:
& Y- `2 G9 X1 j" ?" g- t: u   bpx Get_DDB if ax==0202 || ax==7a5fh8 h) J! L  P: {; x8 F7 b( ^

0 N2 `2 \- @; ^! c' a9 k__________________________________________________________________________" m1 Y4 R$ e& P0 k$ j$ d

/ L$ n% I. \0 p, |Method 108 d3 M! @4 K! }' O/ c0 i# ]
=========9 S) \9 k! U' |+ t8 U* t
# I4 b( a* S: B7 d8 ~
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: B4 x+ p& q9 M5 E  V
  SoftICE while the option is enable!!
4 s/ \: o/ ~  u$ }" |$ E; O# ]) ~& K
0 L/ p, S0 w( {This trick is very efficient:+ m& N$ \, w4 a; ~6 I9 K; U
by checking the Debug Registers, you can detect if SoftICE is loaded. Q8 e2 ?1 g& u# ^
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& d) U; B/ u6 q0 E4 B: a' Bthere are some memory breakpoints set (dr0 to dr3) simply by reading their
  ~) }! V0 m6 y6 G* zvalue (in ring0 only). Values can be manipulated and or changed as well
' Z, G- d9 ^! \$ n0 y) o0 T(clearing BPMs for instance)! X9 [3 x% ]5 Z/ a9 D1 Q
1 k  R5 A' v, k' O+ H. I; t
__________________________________________________________________________
9 K- t  d" @& v# V0 ^
5 C& S) d8 I7 Z: l* L. T* CMethod 113 c/ [; z4 s, G) _  ^' ~4 i
=========
+ [4 [7 X1 Y) k) F! r9 x, I: a% l+ Q5 {( r, n
This method is most known as 'MeltICE' because it has been freely distributed
2 V0 B3 F, q3 [* T! N3 J% W: Cvia www.winfiles.com. However it was first used by NuMega people to allow
4 [/ f2 ?* G* r7 J- nSymbol Loader to check if SoftICE was active or not (the code is located$ Q# t/ B+ k8 t
inside nmtrans.dll).
3 |1 i( w! |( i, c2 |
! n! h  l7 C, c  xThe way it works is very simple:
+ p5 S1 U3 i4 o  q3 E0 a- t8 }It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for, U' x$ p# Y  ]# j
WinNT) with the CreateFileA API.( G5 m8 X+ t2 [4 L  t& k
& r& V0 T1 s% p8 @) u2 R
Here is a sample (checking for 'SICE'):
7 U' j/ d8 b0 Z. `) T- f
7 y! w- J/ `; j, C5 jBOOL IsSoftIce95Loaded()6 s) `$ p! t: `6 m
{
+ H- ]5 w( B" l' x, M; j# S. G   HANDLE hFile;  7 t! k3 J- Z1 l
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 @& O1 _6 ]2 p4 L4 s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) q8 u0 k; g3 y% l                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 t  u2 w) p/ U3 d& g% V5 D
   if( hFile != INVALID_HANDLE_VALUE )
% k9 m/ x8 H7 W0 Z/ \% h3 G. l8 U   {
: P0 D( \8 ?( Q0 E6 f      CloseHandle(hFile);
- m: R, x' {& K9 Y      return TRUE;' ~' L- D1 U+ ?
   }# e! B2 u' T: H9 X( f& o) u9 Y8 J1 f
   return FALSE;
7 K$ R, h% D5 A  c8 Z}
/ X4 M! W' M* v3 P2 t
1 e! ~  Q  R! n) K! n$ V, O/ S- tAlthough this trick calls the CreateFileA function, don't even expect to be" s6 q- `  b) v/ n) ^9 C+ a/ L
able to intercept it by installing a IFS hook: it will not work, no way!
! C* t8 H8 m& QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
! Q0 C7 C& l. h5 j% Bservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" c; _. d+ H% K2 \' ~+ F' u2 ?. J& I
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
1 I8 \* m& U; ]  u; [% F$ nfield.
0 h/ X4 W% J. p5 RIn fact, its purpose is not to load/unload VxDs but only to send a 6 y# F" i( F1 h* C* K
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)4 Y$ G5 r. z. _+ i0 L+ j: z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ x4 V# ?. [4 Z$ ~) @8 |+ Xto load/unload a non-dynamically loadable driver such as SoftICE ;-)./ d+ S- ?% F4 ]9 w) x
If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 t3 L6 m# _# V. Bits handle to be opened and then, will be detected.
3 B& s8 P3 M6 J4 y* F1 _' VYou can check that simply by hooking Winice.exe control proc entry point
/ N5 a  ?; S* M7 J; U  S8 ~, Gwhile running MeltICE.
* \$ e+ u. Q6 y0 }% F8 ]8 m3 _% ?
" ], `4 d$ ?* ^6 K5 J
, n$ e4 l2 i# o: B* g  00401067:  push      00402025    ; \\.\SICE: E, [" \) b  L" d8 x3 H
  0040106C:  call      CreateFileA
! w) p4 C$ b% r0 A; h3 ~8 y  T( N% {  00401071:  cmp       eax,-0017 c+ D+ _! c! p
  00401074:  je        00401091$ ~: l/ A+ R; s8 ]9 f
3 o# ?) P7 }" ~9 g4 P; f
' O8 w# N8 {6 {( S
There could be hundreds of BPX you could use to detect this trick.
! b5 z* \; u8 r" K9 a4 g-The most classical one is:
" A, a" R" j6 |; K" b  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" ?# k' |. H. {    *(esp-&gt;4+4)=='NTIC'
/ t! J/ g0 g+ h8 g( R6 Y4 M* k. k0 R' s3 D' j9 L
-The most exotic ones (could be very slooooow :-(
! h7 T9 b  X1 |- R$ \   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% g  I, R, K6 G8 _  a/ N: l     ;will break 3 times :-(
0 v" I/ c+ k$ O* P! Z$ Q- z: R5 c
-or (a bit) faster: % v0 C, ^3 u) }0 z: ^2 _/ ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" \( r9 [% \' B7 M( E- G4 f8 u1 m7 V7 i' b8 T" `
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
) K9 r! i8 I4 Y+ }$ M     ;will break 3 times :-(
& d7 Z8 S' f( d+ P) A  u
5 h* [' Z0 e& J. g/ a-Much faster:1 j3 ^$ n* Q; O- Z" j# H# M
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'+ F0 c# [) V# ]$ o% }* L

$ w# C; |) l$ Z! A" l, ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
- j1 p+ l3 e6 Z/ o$ Q1 wfunction to do the same job:
9 s0 C/ v' K$ b+ k! {0 K/ b& {1 J7 _: y! A3 g) `
   push    00                        ; OF_READ
! ?% n+ d% w( w. i* q2 G/ I   mov     eax,[00656634]            ; '\\.\SICE',0+ O: ^2 X: R: m' O/ `) L: \
   push    eax9 o% g, ?0 ~  p( A6 h
   call    KERNEL32!_lopen7 }" D9 u) n8 r9 Q
   inc     eax
9 j3 Y4 y: C( g   jnz     00650589                  ; detected
' T& L, O6 J- f5 j9 l   push    00                        ; OF_READ
  g- e5 d4 ]- K   mov     eax,[00656638]            ; '\\.\SICE'
# Q  e" Q  ?! x6 \/ c- E   push    eax
# \/ F6 I( I0 _  o5 j; ]" `& D+ i   call    KERNEL32!_lopen
; f; _1 N4 D$ ]- s$ m( T   inc     eax, }9 i/ r4 _3 l, D0 l
   jz      006505ae                  ; not detected0 h( K) q/ ?8 |& Q2 b7 X4 `1 E

7 j0 o+ `- n; F" Z. g4 ^3 l; g! Y5 s% A
__________________________________________________________________________
/ v: _0 E7 c& Q, ]
4 Q% W6 q+ R" `8 b, a, H/ ^Method 12- w" {6 r2 @1 J4 L; }
=========2 c. Y7 N9 |2 F) w

& M8 A5 T6 T+ {  M$ zThis trick is similar to int41h/4fh Debugger installation check (code 05
& [0 ^. m% E4 x0 A4 M2 ^6 V1 v& A; b- K&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( {! ]4 k8 J4 O3 L# Kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) B7 q  R" k/ l. Q6 v: T1 P: Z' t; [' e: u* E  X
   push  0000004fh         ; function 4fh
) x# D1 t0 [) s, Y, i   push  002a002ah         ; high word specifies which VxD (VWIN32)  v# \+ ?2 m( e+ w" X' e. U
                           ; low word specifies which service
: Y$ Y& C5 M+ ]  T! W/ ]9 W! g                             (VWIN32_Int41Dispatch)
- D- [) U% i. ?2 V3 L6 a, s   call  Kernel32!ORD_001  ; VxdCall  e* E9 Q  J) ~
   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ G9 }$ w1 c  H' x   jz    SoftICE_detected9 q& M. e! W' [( i* ^2 a

( y" N! f3 e, x1 g8 ~9 o; mHere again, several ways to detect it:5 b+ @7 p0 H9 I5 Z

; W8 n! r: a* f+ a/ V* U7 e$ _% N    BPINT 41 if ax==4f  X; |& t& e2 Z  V* L+ R8 W; d
- `( @/ F# W7 @
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- e1 u" Q& S! i4 d$ S
; W) b+ Y. I! G  Q* R* ~6 W    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: S3 u" x. Q* b  V$ `6 c; s" q* c7 v$ v; ]. }6 W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  h# |6 v) t1 c# O* i

! m, Q: V5 {' K+ E$ u/ R8 X- I. j& m$ h__________________________________________________________________________
7 Q8 G0 f. |/ b5 l: @* |1 L4 s
3 T) s1 G6 x7 m' v# L  ^( p% @Method 13
  e; k, m" c2 l& f% G8 e: ~=========+ ^) E1 Y* W6 W0 j' U
! d3 o' p; ^6 h: s4 @' O; C1 w
Not a real method of detection, but a good way to know if SoftICE is2 S7 Y" ]3 P8 Z' H& J. A' T
installed on a computer and to locate its installation directory.
+ |. Y$ K- g- J" D6 p1 o: EIt is used by few softs which access the following registry keys (usually #2) :
& ~: j$ l$ a3 \5 t9 u# S" z  ^' U1 n: \+ j1 V  j7 d8 O" ^: R
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% t& N' N$ t! l$ N\Uninstall\SoftICE) G( F# j7 [! J4 o
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. [! i7 R. n, r/ T# ?% i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 e! W; Y% q2 ]; |
\App Paths\Loader32.Exe4 T$ L" C/ u! I3 D

+ A: u. z+ _; \# ]% p2 x$ }  _$ u+ }6 T% ~$ b) g, s
Note that some nasty apps could then erase all files from SoftICE directory9 P3 v3 M3 C& X
(I faced that once :-(
% j, g9 K' _! f2 w( r. m: z/ z8 A9 ^" o, g2 l2 K5 P
Useful breakpoint to detect it:
2 \0 Q5 f- S; q! S; o8 ^, ?( w3 ]; p; w0 W+ x4 K# r
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
- ]7 E5 X" D% Z. M+ W. \2 k9 R  d$ e, R4 v" }
__________________________________________________________________________" i- _2 y2 e4 L4 o+ Q. G

& e3 ?2 ^7 w7 z  f6 u* t" D7 ~! s" [- Y) q5 T. a; @
Method 14
9 n9 d) J& k3 x5 w' m=========) z5 @* U& a$ N9 H3 m* B

# d) Y) Z- g, n: R) [A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: H% d* D) |. A1 R. uis to determines whether a debugger is running on your system (ring0 only).
6 {: c( l" S6 P# h: I
% J: O6 N% F7 }; w9 w% V+ _   VMMCall Test_Debug_Installed
6 e0 W; |7 Z7 U6 K   je      not_installed
) m& z' `: n8 y
6 j8 h( o$ o/ \% q6 X5 UThis service just checks a flag." K% `# m( H9 ^3 I; h
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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