About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' ~/ D  n! C, J" K$ }4 Q  u
<TBODY>
# F1 m' j/ W$ i; |6 x8 @( r<TR>
. v# K4 L: O6 T6 H0 c0 f; h<TD><PRE>Method 01 & \' w+ {- G, C9 c; v* d! q! \
=========
# p, J( C9 P% F1 `$ u# C" w- |2 `; U
# W0 X+ z1 h0 l) FThis method of detection of SoftICE (as well as the following one) is4 P# C( K& m3 t$ P0 L, z# Z
used by the majority of packers/encryptors found on Internet.' t; a( ?+ q( ~& J6 Y/ i
It seeks the signature of BoundsChecker in SoftICE
0 B5 m4 z# g' ^7 R9 E7 U$ d5 F- d0 a) g
    mov     ebp, 04243484Bh        ; 'BCHK'* m6 V% ~! F/ y7 \' P" b
    mov     ax, 04h
2 L* l* }4 n; Z2 w, w+ U    int     3      
' `6 t( y" L% L, l2 o: V; }0 c    cmp     al,4
' {# v9 @8 E3 ~) O5 V2 W; U    jnz     SoftICE_Detected
0 z$ b% ?; D  u+ o& O( V
  H+ f1 r( R6 ?7 e, M  [1 z$ k___________________________________________________________________________
6 m- M2 c( h3 |0 j
+ t5 `: @! L5 V: zMethod 02( y  B( {' o: U7 `" I8 H3 B0 i
=========
9 O9 R8 |5 e. |) Z1 d
( B1 ?  Z# `+ F6 ZStill a method very much used (perhaps the most frequent one).  It is used
7 Y% @$ d* O" \3 |# @to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
9 Y" r, D- E% y  _" @6 Sor execute SoftICE commands...
# p" N$ `( }7 t& G% b, h( J7 _It is also used to crash SoftICE and to force it to execute any commands$ J5 g3 R! i4 q8 v+ `9 y) X2 k' u7 g
(HBOOT...) :-((  - E  J/ a$ P4 z- h

/ i) Z$ d, K/ v  u& d! vHere is a quick description:
% U: X6 P8 t4 V-AX = 0910h   (Display string in SIce windows)9 d" y; b4 t% w$ d+ W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& h; k( s0 L$ f3 [4 }% T; @7 ]- H% h-AX = 0912h   (Get breakpoint infos)
( K, O! z, C8 n3 F4 U-AX = 0913h   (Set Sice breakpoints)7 ~. [1 F5 _3 Q+ l
-AX = 0914h   (Remove SIce breakoints)! ^2 B! c, X& s( O6 n  W
0 d- v* r9 f8 y$ r0 k* v
Each time you'll meet this trick, you'll see:
9 W8 U  w9 `8 @; ?8 F-SI = 4647h, }3 Z, U1 A6 d
-DI = 4A4Dh% b9 z7 H9 L6 v4 P% `4 k4 ^6 R8 z
Which are the 'magic values' used by SoftIce.9 w! K6 D! m* `# U9 N6 o" `6 L
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% d% X! _7 v! X, s# I
+ N. I. o  H7 `/ `8 K) N1 y
Here is one example from the file "Haspinst.exe" which is the dongle HASP/ v; G5 z1 G5 ]
Envelope utility use to protect DOS applications:0 t0 t# \5 W7 b: Y3 V0 o- E$ _" L

, W: D4 i1 F5 z0 N
, t# O( m. X1 |, ]% u! U8 T4C19:0095   MOV    AX,0911  ; execute command.
6 t8 {  X* s0 I: W) y% a& q  D4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 t5 t6 z0 Y8 p* F( B
4C19:009A   MOV    SI,4647  ; 1st magic value.5 v$ \# c" G: s8 k( G
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 D; R8 J/ T1 ]! H" G) e) K
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& O* P( q# ?7 \0 p9 E4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- h8 v# T# e) _# S- m# a
4C19:00A4   INC    CX
! u. R5 [8 O6 w0 T( @- O4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, _  J9 x. D+ q" M4C19:00A8   JB     0095     ; 6 different commands.
4 t$ r% Y7 ]8 n4 b" j5 e% j4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
1 Z# A! i# X0 }  a' r0 h0 \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 B' U  C! K' X: s! o9 m- o, x+ M% X7 Q5 t
The program will execute 6 different SIce commands located at ds:dx, which
1 N* A% w  V+ y3 ?; J3 }5 Vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# A, b. _4 S. y; z, Z- R7 j: ~- D9 o" n; h: J" y' ?
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ @- J2 m% o' r1 e2 S* x___________________________________________________________________________
7 \! o: ?1 v; v! m2 {: G/ J0 U; f  w, U% R* Z. h7 |2 R
) Q9 n8 A, S6 d. `& U9 o" q
Method 039 X7 o. @5 G8 p  P8 U
=========5 ], b6 t5 w0 v) J; U6 N* `6 f
2 j4 O5 g$ f! w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 N% h1 W2 f* C; ^! o
(API Get entry point)
, c3 B( F! m0 m9 u- Y        5 ]8 q* k  f6 V3 a6 P2 \; \3 q7 a8 T

9 |" L$ Z7 X% d+ V: m; k! r1 ^$ Q    xor     di,di6 i  n) ?) U' m% c
    mov     es,di0 M7 U7 U& P9 Z
    mov     ax, 1684h       . O" n2 Y& y  f& b* ^9 j  _
    mov     bx, 0202h       ; VxD ID of winice4 b6 V! Y* i; O/ h: u
    int     2Fh% S1 \/ q0 ]6 e; P% w$ |1 y" o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 w  v; g/ L8 y7 l    add     ax, di4 k) J8 P' J1 y4 G+ k
    test    ax,ax
6 h- }  c9 K$ g1 ~- C0 u    jnz     SoftICE_Detected0 t7 Y; B# ~# ^/ N+ M" y& ?- Y+ O
2 Q, u6 X" ?+ |* m' P+ h5 |
___________________________________________________________________________
. S. y" q* G, T* R& a* N
) E2 f& r* Z3 Y; P0 M# W# @3 J4 [Method 047 @8 h: {$ Y  o6 k2 S1 ]
=========
2 V' N0 d. Z* g3 s8 r
& A1 h: v" ?8 E5 Q; f3 ~Method identical to the preceding one except that it seeks the ID of SoftICE2 Z; A+ z' |2 L+ ]
GFX VxD.
' V+ w0 I+ }% z0 c" C
/ h5 Q2 {; Z: q+ p: K2 X    xor     di,di
  [$ ~- T6 ^% y" `8 U7 X) n    mov     es,di
8 F, b5 |0 Y9 D8 D1 ~    mov     ax, 1684h      
$ r8 o' w- L% i    mov     bx, 7a5Fh       ; VxD ID of SIWVID: Z, `( |  t+ I3 `; j& l
    int     2fh% B9 R7 q0 I; t# H; x& F
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ j' t/ _2 X; U; q/ ~
    add     ax, di
9 q# M! V. D2 j  O    test    ax,ax' T+ T1 v% Z9 z- I* R. v1 e8 h2 H
    jnz     SoftICE_Detected
" [5 @2 F2 _( R5 @& d+ W; `7 @$ z/ K3 X
__________________________________________________________________________
! s+ z6 g. b/ H8 `! D4 Y& I0 K5 S$ j, p+ l  w

6 T) m$ q/ W1 MMethod 05
) W7 Y+ Q+ H) g" b9 b8 D=========
- y" [1 z$ ?- W. w# q' y  h2 `3 Q2 J+ w4 K, H( Q
Method seeking the 'magic number' 0F386h returned (in ax) by all system
: B: i% `9 I& ddebugger. It calls the int 41h, function 4Fh." y/ `4 ~& [4 u8 W( Y
There are several alternatives.  1 S$ l9 `' ?8 o6 F1 ~
8 d) ]9 H$ h( w- O5 K: |/ Q
The following one is the simplest:
2 a7 t( I% q+ m/ K: l( d# Y+ d. L2 ~, V* D* H8 k5 T# r
    mov     ax,4fh
+ x( t" B8 S& b% c1 R" n    int     41h1 p! {8 f3 L5 F* P. U4 g
    cmp     ax, 0F3868 b4 W& j& M  Q$ l1 ^/ b- ]# G
    jz      SoftICE_detected
0 }) ^* D4 k  B( `" o) V( G( F5 r0 p% u
/ ]. H  r/ r! {7 O8 `$ N
Next method as well as the following one are 2 examples from Stone's / D1 V, |( o( W! B, O7 W
"stn-wid.zip" (www.cracking.net):
- `0 V/ E3 v3 L
. G* p; B" T/ a3 S/ o: B( A    mov     bx, cs- ]6 d- d* ^/ N5 ?, l# d& \
    lea     dx, int41handler2
8 s4 S7 \4 x+ N( q    xchg    dx, es:[41h*4]& q- N- v8 B, \# H
    xchg    bx, es:[41h*4+2]0 P  @/ D- K; [" _! e0 S
    mov     ax,4fh
/ y, i$ h& {  @; i# E) o: o' M8 G    int     41h% l' c8 b, X* B5 x7 Y
    xchg    dx, es:[41h*4]/ k+ b( v, y0 u' ^) M
    xchg    bx, es:[41h*4+2]2 ]* X  H7 ^( H" |
    cmp     ax, 0f386h
6 b, V# t( b0 m" X- r    jz      SoftICE_detected8 P8 m" C1 P  A0 z0 p" h( ~9 q4 d0 U+ F

/ v7 \- Y0 a5 Bint41handler2 PROC
+ O0 B0 @6 i9 q% H7 w0 I    iret
  F: T7 E8 l) W4 bint41handler2 ENDP
* t; j( C$ C1 Y# T9 u/ W# O, @8 K" s3 m: F
( J& x1 L) O; M$ @# Q
_________________________________________________________________________' w4 y3 h  V$ A* k

1 U0 }" {& O7 s" S8 s4 u0 _  u- v7 {1 b$ F) B0 G
Method 064 W; k0 z' u& i+ e
=========
% @3 ^# n9 E: T' }7 s. y
( R+ Q5 T7 z! l7 d
6 y" ?* Y  d2 C/ I2nd method similar to the preceding one but more difficult to detect:
6 Y2 D5 C( d, y3 r; ^! ?0 K' Y3 f" p+ }: p9 h( f0 E  V

9 n0 a4 H3 r0 A+ Hint41handler PROC
3 V% b  `: U: I' S# e$ q2 b4 q& R    mov     cl,al4 V2 p& A" l! w6 k' g# Q4 W* y
    iret
5 B8 z1 J/ I6 K$ T' r9 r$ n2 Jint41handler ENDP
) p6 o, H! o; e
' z/ N8 t) A+ L: `& S% H9 M; a% B" y( [
    xor     ax,ax
* }' u7 n% D/ k/ [1 Q    mov     es,ax) m. s  `! T* Y- g
    mov     bx, cs
' x% F0 o7 }4 W& t7 d' P) }6 _( j    lea     dx, int41handler
2 N* w9 \: a2 W1 w/ Z    xchg    dx, es:[41h*4]
; ?8 g7 D/ Z0 \) x    xchg    bx, es:[41h*4+2]8 f0 l& B7 m) K+ P
    in      al, 40h
1 |. H) d) g, {6 g; b- Z6 ?; v! T    xor     cx,cx
3 o5 T# ~, ^4 M5 [4 z' B    int     41h
: `% V$ P1 ~  B% F+ [    xchg    dx, es:[41h*4]1 v+ w0 ?3 M; ^4 Q1 f
    xchg    bx, es:[41h*4+2]0 G% F, f" f& p5 ~  S
    cmp     cl,al! c  e$ [' t% t
    jnz     SoftICE_detected0 p* B# L! C/ q4 O2 g" f. k/ ~
) g7 ^" ]0 s. N/ L0 ]: |- ~
_________________________________________________________________________( u6 h0 h8 u3 H! W) g- t2 t+ y
" V# C" @$ c+ W& U
Method 07% v" U3 p7 s  Q. F6 Z
=========& R; X& h$ X8 j# t8 A5 F7 @1 g
0 Y- o# l0 @( S0 L1 I
Method of detection of the WinICE handler in the int68h (V86)
" D0 Z; ]6 G0 N
+ \" F" T: P: s( P2 l% b+ k! I7 n    mov     ah,43h$ F! S2 S! |! [6 R( L
    int     68h8 y& D+ g7 R9 G7 |; h
    cmp     ax,0F386h
8 t6 J9 R0 t/ S2 O8 m2 R3 E9 N  _    jz      SoftICE_Detected" ]1 c" J, S+ Q1 p6 l

0 g6 I+ ^) P  S+ d4 B2 ?
% [, |; o: y2 i0 `  x% f' v9 ^9 L. G=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) a6 W+ c. v# P+ o( H/ F   app like this:% r/ \. v1 \5 E( C9 ?
+ _* O1 m  V/ g+ e4 M' @
   BPX exec_int if ax==68
  z" J/ l: n! X3 t- h2 X   (function called is located at byte ptr [ebp+1Dh] and client eip is% k( `8 x  n( [$ q* C  \( z
   located at [ebp+48h] for 32Bit apps)! Y8 j7 R: ?! Q9 g4 I. O% N+ J' B
__________________________________________________________________________2 P# c2 @" k7 k$ v# x

# T3 t! ?8 {4 p0 O
1 [/ L" [0 [0 ^4 Q. HMethod 08
/ J2 {* K; T. M& T: C=========
- q; R9 X* S/ a, m* n
3 j9 r* B3 r! l9 {2 |It is not a method of detection of SoftICE but a possibility to crash the7 V# }/ e& C  h1 C, U2 ^
system by intercepting int 01h and int 03h and redirecting them to another' f4 b8 f' D7 k9 X- y
routine.; H  {+ q1 C! F$ e
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ j6 y8 w! \9 K9 |! }4 L
to the new routine to execute (hangs computer...)* @2 @4 z8 R8 O; x! l
8 [2 t3 C" B+ y1 J) i: W  t
    mov     ah, 25h
; |, ~" ^6 d& k) V7 y; T' f" \    mov     al, Int_Number (01h or 03h)
9 _) S9 H9 x1 |5 m" f+ ^5 ]8 [% R! |! [    mov     dx, offset New_Int_Routine
5 u  V* m& J3 g9 F" ~0 q& `    int     21h7 F. A$ O1 P1 [+ j

& `- r! s7 N, }7 _% b6 R. V$ Y__________________________________________________________________________
, Y0 j: t3 s% m- Q4 H1 F* \5 c" e& Z5 D3 {& d
Method 09$ b& X9 x& e) K' [* d* J: k
=========3 o5 j8 M2 Y" Z7 g. ]% Y. y3 d
! q! u- Q7 R: H2 V8 X# B
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" v% b" V# Y6 s% G8 e
performed in ring0 (VxD or a ring3 app using the VxdCall).4 \9 ]6 i0 R8 l9 ^# i
The Get_DDB service is used to determine whether or not a VxD is installed
2 K. Y$ m: |; P* y/ z2 ofor the specified device and returns a Device Description Block (in ecx) for: P: y& O7 p9 K9 H1 v* m1 X; X
that device if it is installed.( L3 w5 p! A$ H$ A. g* |& c

+ m7 o  \5 N- y5 r   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID0 u" _  C% I3 E- ~" g9 }7 x
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% Q$ ?# c0 _* U# ~( p' R! z   VMMCall Get_DDB/ I9 w8 L" B- X! Z
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 H% ^) [0 s) y
9 K+ L7 O* y% oNote as well that you can easily detect this method with SoftICE:
4 O3 L0 w6 j4 p% B* m7 E& d   bpx Get_DDB if ax==0202 || ax==7a5fh) a4 W7 _# y+ [( ~
: T5 ]8 Z1 r* h6 g& i1 F) z! c$ d
__________________________________________________________________________
6 s% p: X. x. e4 ~  j% U
+ A" x3 h) B( b. [9 NMethod 10
5 k- R  ?3 x$ J) m( Q! s& B=========
( x) Q. Y" v$ o- h8 u8 w/ V0 ~6 L- G: M* p
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- r. V0 Q/ g9 J  SoftICE while the option is enable!!
; _! v0 M4 B6 E2 s& C. r! a( I% g4 O' a9 d% ^
This trick is very efficient:6 g. G8 S! r5 |" L
by checking the Debug Registers, you can detect if SoftICE is loaded; W, v  N6 Z+ h  W# `
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if8 \4 D$ M3 A- S3 |3 ~" ?
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 `5 y, I7 Z  M- S& a
value (in ring0 only). Values can be manipulated and or changed as well
# u  P3 n: K, n" ]3 n  v; M. O(clearing BPMs for instance)
: t" D5 K! w$ z! {& u) y! F
$ U: E  j2 m6 ^0 ^* M- s__________________________________________________________________________& Z& Q3 ^. V3 [3 y  k* e! c

2 m* q% U2 Y5 u2 P* B% oMethod 11( I1 k7 ^3 ^; o: `, U$ D
=========
4 e- ]! s  ^$ {, ~6 B
* f' }& Q& M; c, b8 z6 ?9 dThis method is most known as 'MeltICE' because it has been freely distributed
$ r% y- ?8 C3 \( y5 E$ I* N  ?- T8 Evia www.winfiles.com. However it was first used by NuMega people to allow: M3 i  {5 p4 V; M  ~: y2 X
Symbol Loader to check if SoftICE was active or not (the code is located
: G, G) [3 L# |( q, H) \# Z9 Xinside nmtrans.dll).
: s! w! p4 T0 z6 Y/ o4 q0 p2 B5 B4 V; n# X+ r
The way it works is very simple:& w0 b( t1 D( a" a
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' v8 I' w: C3 g8 D5 h& C5 A  f
WinNT) with the CreateFileA API.
+ m6 ~! Y8 G) b+ B+ [8 [2 v% D
) y# z9 `/ t6 R) {Here is a sample (checking for 'SICE'):
$ _+ I' i3 }, ^; P6 C9 p( h
9 Z% {' R: j  l! FBOOL IsSoftIce95Loaded()
2 ~. G! B2 B7 h; o! Q{
( |1 y& {, X4 j) x   HANDLE hFile;  
& W7 W: @5 |& ?# Y   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 q4 T/ ^- W: v; @                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 u. R! K! N7 q8 b                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 x; n3 a" }* Q  E   if( hFile != INVALID_HANDLE_VALUE )
  b4 t1 E# J6 p   {
/ [* K0 x2 o' Q- [, J! s' [      CloseHandle(hFile);
# {9 r6 d, }( f% F, M$ B      return TRUE;6 F* K& \2 x4 X
   }
- u4 v. h6 H1 k/ \5 Y7 z4 w   return FALSE;9 }) I" ^7 `0 o" H# A; z
}. b3 ~& D1 x: d7 A

7 ^! K. [2 m% g7 I! _; B7 [/ tAlthough this trick calls the CreateFileA function, don't even expect to be
0 R+ `& A/ T$ d* a2 L/ Pable to intercept it by installing a IFS hook: it will not work, no way!
' o" ?1 M% Q- z5 ?# C' GIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
4 g. r6 \/ a5 gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ T( k, C- A' f& _& K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 O$ k  ~& j6 H
field.) w) H8 a) V$ [6 }" A/ k8 R
In fact, its purpose is not to load/unload VxDs but only to send a
& S3 D2 h9 k+ P' L- ~# @+ c+ FW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)) j5 M2 I8 Y! b
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
% W' s- P6 [! I. V: Gto load/unload a non-dynamically loadable driver such as SoftICE ;-)., O( K% m- j: ~
If the VxD is loaded, it will always clear eax and the Carry flag to allow
& y1 K7 H, y, L, ?its handle to be opened and then, will be detected.) T) ?3 }7 ~1 b' `9 `$ `* X$ f
You can check that simply by hooking Winice.exe control proc entry point0 W/ q$ f* n8 l/ `; \
while running MeltICE.
( V3 l/ X7 z- k1 e. F, Q% B( W6 H% n
8 A5 A( G. M% j' g9 L$ k
  00401067:  push      00402025    ; \\.\SICE
; W) G4 k  H! q, A# \9 }& H; }  0040106C:  call      CreateFileA$ B7 H: }" C/ G2 z+ |0 `0 p3 k
  00401071:  cmp       eax,-0016 d( K$ X5 ?$ j  \3 ?$ f1 f# b
  00401074:  je        004010913 V6 n/ \3 L# J+ j) N/ r

, _* {# s0 R' Q6 X/ t9 n8 L
  i/ m$ O7 a* D7 R/ g2 l. y+ MThere could be hundreds of BPX you could use to detect this trick.
% X3 C, K* {0 D* ^7 w* @-The most classical one is:
, M: e# y# ~+ n* w/ f  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( Y2 @( y5 p8 N$ y4 h2 p  U( p
    *(esp-&gt;4+4)=='NTIC', I7 P7 v0 c) a- m- m
/ y( q' E, c2 Q! v7 j2 J0 U
-The most exotic ones (could be very slooooow :-(; a, ^  `: a  G/ z. T* m$ v
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & B- W7 ^0 [) l- s% G
     ;will break 3 times :-(! F6 x' I! l2 P6 M* I) a% Y4 s

/ }+ t+ V. i  k5 ^-or (a bit) faster: " I, ?8 x" b: W2 O4 ~6 t- n
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# F0 d2 p& U) `
0 y, ~; {' Y! w; b$ k   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 N2 z# H- E6 j9 K
     ;will break 3 times :-(
6 c) i, u5 ^; y3 K/ h& C) c8 h8 b
; C5 c4 `  K$ `$ ~/ i-Much faster:
! o6 _2 X0 H- W3 j9 |   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
8 l9 v1 w2 ]( T& A2 F1 D2 }* v7 V+ M/ f! q1 o0 y4 j  x' m) p
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen  z7 o3 O- g# |
function to do the same job:
. }( H* g% ]6 a( h' K9 T% x3 S9 a/ K! W9 _' o1 o2 r& s5 v( }
   push    00                        ; OF_READ
& ?% Z0 a& p2 L4 ?   mov     eax,[00656634]            ; '\\.\SICE',0# M5 U: s  t# U7 z5 {& @
   push    eax
( G) Z( o3 e& f# L! J4 u, z* Q   call    KERNEL32!_lopen
, T: L, x% y7 J% b2 B% D   inc     eax& A! o" K& F# Z$ i! I& L; l
   jnz     00650589                  ; detected8 r+ R3 e( q) }5 r, ~3 G4 W
   push    00                        ; OF_READ7 _& y* [) p2 O$ v
   mov     eax,[00656638]            ; '\\.\SICE'
- Q! R1 L8 U, ^6 O   push    eax
  J" H' z6 G1 s5 j6 W& Y! @   call    KERNEL32!_lopen
; ^, f% D5 n! c8 Q% ]3 m   inc     eax9 y! m; y2 g2 Z$ r
   jz      006505ae                  ; not detected0 u1 s1 m" k. @

- L7 _" M( ]/ n4 h8 l! x3 ?* @! a7 K1 g: y7 P% @0 u6 f
__________________________________________________________________________
5 A% J6 u* O9 d0 {; K; K4 `
, M( T: u: m% b4 O/ ]Method 12
9 J/ c1 x/ A7 @3 w; _( k2 B=========
- W. l1 L0 i4 L0 c, e, l) i2 W5 j0 }- V- u! i
This trick is similar to int41h/4fh Debugger installation check (code 05
$ N% r: Y8 A0 y9 Y& \&amp; 06) but very limited because it's only available for Win95/98 (not NT), [: ?  a  m- @7 c
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.- v4 k1 `' B$ r1 h( R7 [7 D" p, z7 w) m

, R9 N1 x  I$ ^8 Y- F* n+ x& B2 z   push  0000004fh         ; function 4fh# e/ V/ |" `$ u" i
   push  002a002ah         ; high word specifies which VxD (VWIN32)+ Y1 o. ]5 R" {* X
                           ; low word specifies which service
* x- \& Y8 y. R7 ^' t. N7 j  [5 H/ `                             (VWIN32_Int41Dispatch)$ U% u$ G- [# V3 q. v  n% T
   call  Kernel32!ORD_001  ; VxdCall
4 Y2 ?: L% @5 O5 ?$ R& q9 ]$ i0 [   cmp   ax, 0f386h        ; magic number returned by system debuggers1 z; w/ H! Q7 z. k1 z
   jz    SoftICE_detected- M. F: C0 P) g/ |9 V- }3 K

) }2 _& I8 o3 l0 J  G9 \Here again, several ways to detect it:
; v. O1 f$ t3 f
* T9 @* Q& R+ \# D3 K) p2 G    BPINT 41 if ax==4f( H3 r# H" Q5 I9 S' h' Y3 ~

  c; j+ ?- Y. n) |$ r& Q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& B8 G8 t; `) `1 Y- T9 K
$ X# h; U+ E0 |/ g5 v    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! ~7 T9 N1 ]2 a' A) ?* e+ n+ S4 u+ v1 j/ }/ o7 W( ?
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. @  |, L7 ?" `4 N! f
+ p8 ~0 u; B# B7 Q5 i/ e, x__________________________________________________________________________" O* P. g# l; Y  P. g

3 ]! X7 m& @# h) ZMethod 13
5 V* S5 g( e! ~* Q& V+ L/ V4 ]( n/ u=========! s  k8 q( z! f/ P' p
: s* u6 A( O& H* G8 w7 r8 ?+ |3 W
Not a real method of detection, but a good way to know if SoftICE is$ U) w/ l3 I" V9 L
installed on a computer and to locate its installation directory.
* J2 z, |$ E6 Q1 fIt is used by few softs which access the following registry keys (usually #2) :
! [; {# x. k& l5 h" V1 Q8 f; a# m% d$ b% [
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: u% `7 r5 N& R+ @8 g\Uninstall\SoftICE
9 ~/ }4 k, I' `-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& d- B$ v6 |& N, P0 y# H- _-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 t6 E: Q1 Z9 r5 i1 G+ h6 G\App Paths\Loader32.Exe2 \: t/ k  p4 B
( \0 K: _+ E0 [: O- Q

; }+ }3 \2 u! B- m* E( }Note that some nasty apps could then erase all files from SoftICE directory/ O: G. t: \6 p/ q. k, S  l9 U
(I faced that once :-(  w: Z# z& c3 ^( M" Z. f
" ^- h! Y/ T! v6 U1 T9 F( k9 q
Useful breakpoint to detect it:
3 ?: h* }# m6 @9 y
# z4 w1 O# w! A+ c: o     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 y6 x5 \' E1 d8 `: k/ m4 g" Z
4 `7 u8 _+ h: n& |__________________________________________________________________________
6 [- S9 Z" w" G3 v
) Y$ D7 p) U. B; I4 H9 B  ]& v" D0 [% |6 b/ M, n/ f, j- W6 [
Method 14 . @- Y) c8 ~4 \2 f
=========
, e; {& P# H# d8 U( X" s$ V& k' ~& X+ j% k
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* P- b1 E* s1 Lis to determines whether a debugger is running on your system (ring0 only).
( |; ]3 x' _. d. H
/ @: P6 `$ N) `7 G   VMMCall Test_Debug_Installed
2 y" r; E% g  s4 c4 n- t  w   je      not_installed
- b9 g5 \( b; E* n+ k- F6 Q  l0 @. M* ]
This service just checks a flag.
  w' f9 R( G* {5 _  w, A4 I</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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