About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) @. y) H2 d+ n3 C1 O5 z
<TBODY>% N, G2 }  S  y
<TR>
+ A0 E" S" b& o& @<TD><PRE>Method 01 . d: p' g& e( {, h
=========/ o3 W# v  E2 q' w9 |

# ]" `3 {4 R1 Q9 I) oThis method of detection of SoftICE (as well as the following one) is
/ ]: g$ w- v2 r* X2 ^used by the majority of packers/encryptors found on Internet.
3 H5 g* @0 a# ^7 Z, R* [0 D9 k) |! yIt seeks the signature of BoundsChecker in SoftICE
: h0 _; V) h7 {: C$ O1 H7 x) K
! g. H" U- ]+ J' N/ ~    mov     ebp, 04243484Bh        ; 'BCHK'
! m( f. \/ G3 `, `1 U    mov     ax, 04h
+ `  k# @' q1 p1 A8 B% R/ U    int     3      
5 i0 y" X- Y8 d; R    cmp     al,4% f6 @/ S0 @2 q; ^
    jnz     SoftICE_Detected
6 ?# \8 y5 D- E- A
7 Q; Z4 J- Y+ D! t___________________________________________________________________________
+ o+ A7 e  a2 O0 g8 M$ K, \3 o9 C9 O* }- b1 O+ _
Method 02) ^- q  [3 J) O
=========
1 \' I' h& S0 h$ m; S) Y/ r( R# v
Still a method very much used (perhaps the most frequent one).  It is used; F$ V) j$ U& m: r/ [
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% j) X! F+ }. zor execute SoftICE commands...3 f. Y% L0 b" @: n' e
It is also used to crash SoftICE and to force it to execute any commands1 _, h6 P* L+ F1 W* I4 g6 T0 U& f
(HBOOT...) :-((  
1 r/ h8 X) M% n+ I4 M0 p: \# e9 `$ t; a* t0 n0 x
Here is a quick description:: n8 x+ P% [# l
-AX = 0910h   (Display string in SIce windows)
4 F; r# I1 f- A) F+ `& v6 V-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) B" e1 U$ E+ _$ @-AX = 0912h   (Get breakpoint infos)3 r# ]" ~* q6 b9 W
-AX = 0913h   (Set Sice breakpoints)/ j2 U4 ]! y; N* W; X
-AX = 0914h   (Remove SIce breakoints)- ]* L# D- W3 J9 \9 S
% I6 v3 C, Z0 I
Each time you'll meet this trick, you'll see:: ^  E  _' b' o3 M: l4 r
-SI = 4647h2 M  r# h) D' @2 V. G' r
-DI = 4A4Dh
. [2 f; W+ y; E7 m" LWhich are the 'magic values' used by SoftIce.
. u" b5 i" g9 E( Y2 H& r8 ~For more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 J# r& K( L) V4 x( `+ C
' d6 f$ K$ [6 a# a# X
Here is one example from the file "Haspinst.exe" which is the dongle HASP
! C% k: V% J" Z4 _; FEnvelope utility use to protect DOS applications:
8 B/ }: d- N' P; n) o7 F
7 o! ]* M' m+ ^4 x0 o8 r9 ^$ I
$ Q2 @( x' @) j4 c: }  A4C19:0095   MOV    AX,0911  ; execute command.
2 h1 x" b4 S; s7 M  T3 b0 y0 S4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  [4 o. q8 N; P1 R
4C19:009A   MOV    SI,4647  ; 1st magic value.
9 J; i- |$ G7 _4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 r* i+ o4 W3 g# k( Y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
( l8 A% v/ }1 \; O& a+ v' O4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ T, s" x0 Q; q- }- H0 T) d1 `
4C19:00A4   INC    CX6 P7 a0 L; |( ?* t4 R; q" f+ T5 o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( U$ J. m, _) _) @/ E% I. }  K
4C19:00A8   JB     0095     ; 6 different commands.. H- A% E* m4 h+ D* `  k
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ j0 o: D( K' n& E
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 u( R/ h2 o9 p+ S+ L) {, v" i0 E

1 W# G9 y* ^* D0 n2 ~& T$ i- AThe program will execute 6 different SIce commands located at ds:dx, which
8 `0 q% x# X1 F; }0 mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& r2 v1 a' b! Z3 H
& I1 q- K7 U% D7 z, M6 _. J8 e) R
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ w$ V( }4 \( g
___________________________________________________________________________
3 h1 J( T+ p; F: A% A8 u6 h& [$ g( s$ f4 X* H8 @% M

; T) B# M! j* @3 G; z8 n# |Method 03
3 Y, c  Q4 D7 t1 h, S=========  ^4 r- C+ m3 U0 y$ K
7 c3 g! ~1 x4 y& X
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# x" p* ^' Y/ h% \4 f! a6 s(API Get entry point)
! x4 w% C' ~% B7 S' r        , i, }' F5 ~* a7 B
% O# U. R5 Z6 N- N
    xor     di,di
5 l( a  u. w6 c    mov     es,di' c  Q. S- F- \5 X0 @/ U
    mov     ax, 1684h       9 ~2 X! M; Q3 v$ D! M) W2 U
    mov     bx, 0202h       ; VxD ID of winice
- k& C1 |- K( n; ]1 b' m% R    int     2Fh
: a( r$ b1 i% A$ z% p    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 _( P  l' G" @# w) m8 H$ D4 X* a6 J
    add     ax, di
& F( c9 _# V: i* G% A; m    test    ax,ax4 K, f  k& r  F1 i
    jnz     SoftICE_Detected
  c4 p* b) E$ D5 T, O' U2 h. H3 a& ^% j; e9 S9 r, u; `0 k
___________________________________________________________________________5 G3 y6 T& C! k4 K* G3 L! W" i
2 [6 C7 o5 f4 C
Method 04
) c1 g) @+ h5 b% I0 W8 S# J. R=========
/ \0 z( l9 n6 `7 B( p( P. R6 ]2 h3 ?4 _! |- u9 Q' }" `# L
Method identical to the preceding one except that it seeks the ID of SoftICE
- z6 C2 P% x7 U) ?GFX VxD.
" Z/ }  {( u  i& ~  p' Q6 r) A" D/ f; B9 p
    xor     di,di
6 q( @- y2 `5 {# g- v    mov     es,di9 m; M+ O4 i9 J& E! K% N' D: d
    mov     ax, 1684h       * n  K7 b/ o' T2 Y
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 m' f& Q1 d5 i( T( c6 r5 [! z    int     2fh
# a( I* ~- t* o1 L9 o6 ^3 b! ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point. A2 @. N' u& m& z% M/ l+ t. w
    add     ax, di
6 }3 t. u0 t- ?    test    ax,ax
! k0 j" b, H+ c. O% e) p2 j' a+ t* C; ?    jnz     SoftICE_Detected; M# @2 v1 d( }

9 n3 |! m2 B8 j) I& ]. w! ?__________________________________________________________________________1 C- O2 ]; M% I% w9 ]. W

. x. P  a8 p& u2 y; {: m( J$ }
* T4 _0 [+ }$ H; T7 ]; GMethod 05/ s( y# F5 z; c' D) Y* G- L! g
=========% P) n. @, Z1 v' T) R
) b( {8 @0 u" d3 T0 ^
Method seeking the 'magic number' 0F386h returned (in ax) by all system
9 m4 w! t3 V, X; u0 A( d+ \debugger. It calls the int 41h, function 4Fh.  G! H/ Z8 u! y9 |3 \; `! z# s
There are several alternatives.  
6 J) N3 ~5 B" U$ n  |
1 ?! d- ^3 G# i3 aThe following one is the simplest:
: r7 z& r# B; k, c  ~- ]2 k) r: K  ~( C) f" j7 A  k6 h. K
    mov     ax,4fh0 b: ?6 g1 |' r# I% m1 L6 J# v& _" d
    int     41h4 w& p* ?: T, j' T
    cmp     ax, 0F386
" G1 \8 L2 I+ R2 B2 y' R    jz      SoftICE_detected
- ~; ~, r) E0 Z* @' e- y! A8 H( D7 X  c* n
1 n; |* W6 t$ k# O+ j; \+ E9 B
Next method as well as the following one are 2 examples from Stone's
  }; t) W3 N/ w! k6 v3 d"stn-wid.zip" (www.cracking.net):4 Y4 h" U/ s1 ?4 q
; V2 C) d' J5 g+ n
    mov     bx, cs5 B0 N. \( d+ _: O8 ~1 P8 I5 C, I
    lea     dx, int41handler2
; t/ |5 l- W( ?0 \: q$ M0 K6 `# _    xchg    dx, es:[41h*4]* w: Y9 Y# n5 r/ M( u. U; s
    xchg    bx, es:[41h*4+2]
3 }+ n9 g. F: }3 v. D    mov     ax,4fh
1 d) J. y, P( @( @7 m    int     41h. t1 Z, J. G8 J2 i
    xchg    dx, es:[41h*4]
, }" K" c1 |  p& X0 n    xchg    bx, es:[41h*4+2]3 f' X2 m, v. D0 [  z  ^% L
    cmp     ax, 0f386h& _6 w! U  L( t7 L
    jz      SoftICE_detected6 T; T0 }9 z  Z8 T

* ^# O! p( \+ N+ [int41handler2 PROC" N; k' D4 K( K' ?; \# i- `
    iret
: c5 h3 |+ V# _0 L. kint41handler2 ENDP6 D* i; B& T" S) f% A% |! j" P

# L+ z- \8 Y- h; i  Q
" i1 z7 `  R# Z4 K' ?% C3 ^_________________________________________________________________________: @4 H  u6 J$ ~6 j

) @* Q! L8 V' o5 Z& k* s" k$ v2 c3 y& ], f6 [7 e$ f) _8 v
Method 065 [$ d+ Q% z. ]9 l3 w( q$ j
=========4 b% N" z* X8 t4 I0 I
4 d/ K; S) }7 _! i7 U! Y

4 Q2 t4 _4 C$ g; q& N2nd method similar to the preceding one but more difficult to detect:
: G1 o  D! a* o# Z/ j8 V/ \  Z. Q5 G  _$ w6 h2 _6 q

" \# ?5 A& @  L) R% aint41handler PROC" k1 s* A. K4 f! G" `6 H, b
    mov     cl,al# N/ M( Q0 P% h3 j" o
    iret* Y' ]/ e; S4 L
int41handler ENDP! [( B2 Y& I7 G; X

( \& `5 X6 i" a$ f( \
! s4 S/ y; F7 `6 ^% v    xor     ax,ax) R: G  M  M) l. _( i3 d
    mov     es,ax1 N% b* b. Q/ s& g0 |
    mov     bx, cs
) j2 C0 [$ I" h) f. q# m    lea     dx, int41handler
' B) L3 U! N) t; _: p$ p1 g    xchg    dx, es:[41h*4]
# h) S% R0 E$ U2 T: s( C3 a, H    xchg    bx, es:[41h*4+2]
* W9 f# m! S$ W    in      al, 40h" C1 s" V- r6 p2 {' O
    xor     cx,cx4 e$ @7 K6 }' \6 D
    int     41h! P; I' I! s& K* [- t* x2 b( |
    xchg    dx, es:[41h*4]$ }( c5 ?; [7 ?/ _+ s- f* F; ]2 o! c, K8 O
    xchg    bx, es:[41h*4+2]/ T7 g2 _! @# ~1 R  C; h. i
    cmp     cl,al
% ^" B  H5 ^4 b9 f1 z    jnz     SoftICE_detected. D* K* }) ~. c0 D) v
$ [* H2 }( T( C. C
_________________________________________________________________________1 |# Z' L* I* ^' R/ l

, x* _1 C# w; R) o8 B' gMethod 074 V$ S) ^2 U+ G. ^4 i. ^
=========+ c. z- p' {9 @& a) p; O1 F

& y3 ~/ S* U- @$ A- EMethod of detection of the WinICE handler in the int68h (V86)
: H  t" V, C* M1 T6 e5 e* f% V* I$ u3 d
3 `0 C2 s. x& F1 f1 p! T: r% e    mov     ah,43h! Y+ z+ f2 @3 d& a$ A
    int     68h
0 X$ |1 G+ j/ w  L) q/ c0 E    cmp     ax,0F386h! }3 W8 R' o3 t& H4 |" s" J
    jz      SoftICE_Detected; u2 q2 I8 C) w9 s) g# k& h4 T( ^

& m/ N. ~5 {/ b5 N. v( l# i- g) |
+ {% R- g0 M: l! {- }. ^=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. c: ]; M! i6 _' j   app like this:' Q" z  Y, m( o) h
  O2 b" s( ?7 p* O
   BPX exec_int if ax==68! j4 n8 T% y1 ?
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 f/ O, M3 n3 h7 k& O% i; {" |   located at [ebp+48h] for 32Bit apps)$ J& u, o' R9 ]( X$ S$ M+ @
__________________________________________________________________________5 r: }" b- C! y7 e6 G1 Q5 y9 M
, t' @* J# d! g
$ E' h- d" _$ m1 {3 ]8 ]8 r
Method 080 y, ?% ]2 V" [# g  N5 S
=========3 D' e. x2 B' F/ T. X

0 A9 \7 N7 `3 u3 T: ~3 g" IIt is not a method of detection of SoftICE but a possibility to crash the
, x( u2 X. O% fsystem by intercepting int 01h and int 03h and redirecting them to another
9 D0 ^6 N! @7 l' [; ^routine.5 ]# v2 P, \, f  L# D5 z
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% R" J4 j* D6 l* ]" h& }to the new routine to execute (hangs computer...)
: L* Q) w5 T8 g6 y& [9 \" ?2 f, m; o9 @6 v4 W% Q  X
    mov     ah, 25h
$ w6 X) A/ n# M: r    mov     al, Int_Number (01h or 03h)
7 ^3 ^4 s, s0 s1 |# _# s, p0 |/ V4 k    mov     dx, offset New_Int_Routine3 G) G% n$ L0 ^3 X- q2 h8 I( t  M
    int     21h
3 J' }' O, M% g4 f* P1 w; K7 L
  z- A* G+ m  e__________________________________________________________________________) e& m! f$ q* G& O3 ]
6 V" O9 \& ~, o* Q3 ~- B' V
Method 099 m) _( [: Z! @7 Q$ B8 M; x
=========$ o# h6 B$ X1 i1 ~# J" k1 V
; G, f' @) D% K+ C  [
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) h/ l8 m* k" S3 N: d
performed in ring0 (VxD or a ring3 app using the VxdCall).
$ L; S3 @! T, a. HThe Get_DDB service is used to determine whether or not a VxD is installed
, `% X! E6 p8 v, d7 M  U) a1 p" ifor the specified device and returns a Device Description Block (in ecx) for
, X. U% t8 T$ k7 b" R# n; Ithat device if it is installed.
1 ~" p1 p7 Q* r2 D" {6 B. _9 Y1 y& c# R/ E1 p2 J: \4 ~
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! s7 [  B: q' b9 y$ j5 X   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- G6 C  M; }2 C) i7 |0 n1 f3 r
   VMMCall Get_DDB
6 N9 q4 R% `- [1 D$ `4 [6 \* T0 S/ k0 ^   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* T8 R- H) Z( n+ s. B1 U3 `

) c2 V8 E9 E/ zNote as well that you can easily detect this method with SoftICE:
+ k5 k" w  X% `& J: B   bpx Get_DDB if ax==0202 || ax==7a5fh
" H2 @* O' E7 t$ T5 }
. }4 t5 N+ J7 R+ B/ V9 {# g0 {__________________________________________________________________________% e' E% y* ^  U- o3 G- a) \

" |' C" K9 ^8 ]Method 10
- c% m% g7 O' ^4 \' _$ X& f5 [0 _=========) H5 K4 x# K" V1 h
4 `" c9 {8 Z3 l4 r. d6 I
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with5 @+ _5 \5 G9 {
  SoftICE while the option is enable!!
) d0 N4 R! ^- P5 K3 u9 {# q! q. N# P* |7 j
This trick is very efficient:
3 N2 ^7 P* Q) h6 Z  Hby checking the Debug Registers, you can detect if SoftICE is loaded
+ r4 `3 ~$ o2 H8 L$ _) [(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 n2 H7 P- n. y4 b- l$ h0 K0 lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
, P4 b" F, D1 a) k' v0 N; b8 yvalue (in ring0 only). Values can be manipulated and or changed as well; z1 Z, F3 h, B5 v1 M! _8 ^; n
(clearing BPMs for instance)
, l1 J5 {& x! o; h- b( f! p  G* Q! p  e6 O! i
__________________________________________________________________________! p2 C6 Q2 E0 K  o7 I  G& h9 e
& n3 ~1 N/ m: s$ w4 B
Method 11
# I- U: D( @3 t+ h$ J1 G4 A7 A=========
" F3 U" E; X" Z# Y0 P. u7 C- Q
, n' A2 q) ?& e' k8 @+ }9 e2 vThis method is most known as 'MeltICE' because it has been freely distributed
$ g9 P2 A" g" r" Z) ~, m5 |via www.winfiles.com. However it was first used by NuMega people to allow
, Z  D; {8 W6 I& ]Symbol Loader to check if SoftICE was active or not (the code is located/ G. b3 ~- E7 G  A$ ]5 w
inside nmtrans.dll)." e2 v9 m6 m0 {$ y7 d* {, E0 \2 Q# |

- V& }3 D# [. y& O( z1 |( {  HThe way it works is very simple:( ~7 d, S, l. F* t
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 p* b: ~- z" j' h) d  `
WinNT) with the CreateFileA API.4 N; W$ a6 ^# ]: z- [

# j: C1 B- c. H2 L  sHere is a sample (checking for 'SICE'):
8 I0 h+ G( X4 v# C8 E) p2 `4 X, [' A4 W3 c
BOOL IsSoftIce95Loaded()2 _" K1 {! S9 n' c
{, X7 x( e! j; R3 a/ _" q- V
   HANDLE hFile;  
7 [" N: H) a, I9 g: v0 R& l1 h, s   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 ^9 D3 k% O: \
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! Y$ E; j: x& ]* K7 g( d  v                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ F3 Q0 T- f2 Y* j8 ^/ c1 i   if( hFile != INVALID_HANDLE_VALUE )
$ `, A/ V( W# x: e" S7 W   {
6 f$ ]0 w6 V, a, z( y& V2 z      CloseHandle(hFile);/ Q- _# {$ b. V9 k8 A
      return TRUE;' Q0 @( G' Y. E  q! O( r9 }% m
   }- }0 c& H( A: }
   return FALSE;
# B$ f5 z0 I+ |+ E) N}0 V5 D; Z5 f9 F
/ V! A) H0 j1 B2 J+ F; f
Although this trick calls the CreateFileA function, don't even expect to be
- @& I, f3 d+ H0 P, [- d4 ?able to intercept it by installing a IFS hook: it will not work, no way!# N) \( S- z9 k
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
: r; U4 p$ N* w( ^5 @5 V8 Rservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- w6 ?6 g& Z8 Z1 X* m- |& Rand then browse the DDB list until it find the VxD and its DDB_Control_Proc/ K" K3 U/ |2 t) K! F* A  L& d
field.
# V; t: j( q7 ]2 u; s! Z9 _In fact, its purpose is not to load/unload VxDs but only to send a 4 i" R$ g% j# g$ u2 ]1 N2 Z8 v) p
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)) p1 t/ T$ E0 W) b0 h+ g) ~
to the VxD Control_Dispatch proc (how the hell a shareware soft could try6 s3 ]; _( s$ Q# w" a- c6 ^, a/ m
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 c5 Z# a) ]) |- TIf the VxD is loaded, it will always clear eax and the Carry flag to allow
, ^% @3 t6 k" s; A) @its handle to be opened and then, will be detected.7 _1 g1 l. l& \) k) {
You can check that simply by hooking Winice.exe control proc entry point/ k' f$ G. C  ]- k! R
while running MeltICE.
! S) Z  ?: ^5 q7 C% h! s0 q
5 W% m: x+ Q7 Z0 h
- }& L5 \+ l# W9 V! w# Z' J  00401067:  push      00402025    ; \\.\SICE8 ]  @* T' O; E* l1 t
  0040106C:  call      CreateFileA+ R1 K8 [( _( d
  00401071:  cmp       eax,-0018 h- p; O  Z" S/ T# t. z
  00401074:  je        00401091
" T3 p: }3 H, W8 C9 H) L9 @  P% {% N2 X; n. O
" Q* ~2 k- r' w' B$ \
There could be hundreds of BPX you could use to detect this trick.9 f; C6 M3 ~: N; |0 P
-The most classical one is:
: i; U  X# `1 t. x( W- g  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ I( K6 [+ o3 J    *(esp-&gt;4+4)=='NTIC'
  l" g( J) A; a- ^- ~; N4 }5 a+ c
-The most exotic ones (could be very slooooow :-(4 K3 f3 |+ f- I. T, H* ~
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! c1 a* a+ z7 q  h& N. K     ;will break 3 times :-(
6 H7 ?/ ?% c/ P) ]$ `- Z- V+ P  ^. p; V
-or (a bit) faster:
8 @: ]9 I/ w- R. |   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
5 q3 G7 T3 w$ ]" [; L5 S; F
, E! R( q* T& x0 n* |/ W8 @   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% N. g! c) Z% `  G( b     ;will break 3 times :-($ U1 Q- d; u& s; ?$ M8 x1 X
/ ^9 c2 [7 e* v$ u. D/ }# p5 o
-Much faster:  a! j6 A8 ?# v  h
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 H& I6 [& n5 @
9 b2 h9 m) s; ?0 E
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen/ W& P) z  O7 w/ c  |& |4 M8 t& L4 ^
function to do the same job:
( ]# i! b  r: n& q$ `2 C" Y
% x" \2 n1 c% g$ }   push    00                        ; OF_READ" O1 K# i5 Q  y+ a' J0 z
   mov     eax,[00656634]            ; '\\.\SICE',0: R9 T! I8 M0 H* e  W# }$ R& h
   push    eax
  j, w' H- D3 ]3 f8 p% f   call    KERNEL32!_lopen
6 s: ]8 N& R$ S) d   inc     eax
) p& b" Q; I5 V% u   jnz     00650589                  ; detected% @: w3 [8 ~* H
   push    00                        ; OF_READ3 _2 ^6 }8 c5 `" a5 n
   mov     eax,[00656638]            ; '\\.\SICE'
) D/ k- M! @& [+ k+ \9 d   push    eax
% O1 |3 x& h- X. Q; p$ E( [   call    KERNEL32!_lopen3 ]8 N' S3 [  f# ?& G
   inc     eax
2 k8 \8 A9 l4 S9 w' i! e+ ~   jz      006505ae                  ; not detected
+ ?8 \& x4 k+ z2 T" d6 k" s) U8 E. }( l1 n; N1 o$ T' L; R2 I

) k3 p, [5 p3 W6 S( x0 ?__________________________________________________________________________
$ ~- i7 i: ~% d" V/ r! Q3 p/ F3 m: I0 a
Method 12
; N! X! o! T0 H% W6 I$ V6 F=========8 ]# F+ c: n! q) P. @+ g

9 u; n* w% j+ ?8 FThis trick is similar to int41h/4fh Debugger installation check (code 05
, y5 u7 F9 z8 }6 m&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- Y7 B& C. N; M1 o1 Kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 i  p- N0 G4 J) O5 d# _5 t

4 L) K; x% Q: W/ d$ \- w   push  0000004fh         ; function 4fh
9 E. R7 r( W# S6 d6 q5 H   push  002a002ah         ; high word specifies which VxD (VWIN32)
- o1 w( ?  h- m0 u3 b- ~1 T/ \                           ; low word specifies which service
0 I- k* K7 p) X' C4 d$ r7 J                             (VWIN32_Int41Dispatch)( Z: y" S2 i* M9 W& p3 d
   call  Kernel32!ORD_001  ; VxdCall" o7 W7 K9 D$ _7 b1 D7 Y
   cmp   ax, 0f386h        ; magic number returned by system debuggers/ R6 z* `. t2 h' P7 G5 y
   jz    SoftICE_detected
5 L, d' z2 c8 R; r
0 q0 c+ y0 j! p  U; GHere again, several ways to detect it:
* E, b  B+ |7 u: X3 Y( i
0 M( V1 T; P4 T4 V+ L/ E    BPINT 41 if ax==4f( M8 E7 N8 K, `2 ?, K: b! K# U

7 ]6 r" l; k. [    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 _: e5 _6 o9 o- G
: g9 Y8 b& O( H: c, e. Z- _
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 ^8 ?3 d6 w  y  n2 k" R0 T' m! M) ?3 m* T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  k, g+ A" k! ~8 a( o; N* `
6 E, n  K' M: O& x# L6 \
__________________________________________________________________________9 r  C  j3 v: ]& ]# v* D) l! L+ a1 y

: B- P& d5 O( c; JMethod 139 ]6 ]1 T1 ?$ r- _8 p3 v: u( T8 i
=========
% T# C8 d% n) y8 d4 I% @; I  F# P% v( V# f' ^
Not a real method of detection, but a good way to know if SoftICE is" D* Z- [& |$ D$ _: Z  v+ k% n
installed on a computer and to locate its installation directory.
" h" Q! I. t  y4 b! cIt is used by few softs which access the following registry keys (usually #2) :
. E% O, I; [1 W  z6 \5 Z# k; f( \7 j( @- d% d5 P7 @
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ {2 y* R5 ^1 s, x* p$ z\Uninstall\SoftICE4 x8 P% y; B# z6 `8 q) ^
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 H) a& x; e6 r-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ v7 X& k. Z; C1 s8 j\App Paths\Loader32.Exe
% {8 X& y  c  r# F# Z
/ n- g3 S' Q9 S
+ O% F2 U! d) R' `Note that some nasty apps could then erase all files from SoftICE directory
6 {7 {' T: f- M3 @, Y. Z(I faced that once :-(
" d( R+ W4 k& g/ }' `' N5 r& O; N9 T# G6 R; ]$ f
Useful breakpoint to detect it:1 G) r8 u7 T+ }: f2 x
+ J3 ^/ V- f: V! f- Q0 u0 k
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE') \/ ^; l1 E3 a9 j6 h! K
: ^5 R5 x& Q( a
__________________________________________________________________________
) Y" J' M1 O$ s" ?/ M- V
/ D* n" F0 e2 R( I$ h# s, ^
( @" H1 P+ J' f, W" j9 O& ^7 q/ UMethod 14 : I1 o/ H( Z  j5 a" a7 t
=========
5 {, h: C/ R2 q# M' Z7 a) l/ }; Y9 m( I" d; U( e/ ]. ]
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 a3 o! A$ i0 u" Vis to determines whether a debugger is running on your system (ring0 only).
. l) P# v# e2 @
0 D; F+ ?$ {0 ?" w   VMMCall Test_Debug_Installed
1 _2 X  D: s( ~3 J, K# k+ K   je      not_installed" I; R0 l1 B7 u) D4 A
; T  D+ h$ d) c
This service just checks a flag.1 k) O% |: @6 s* F
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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