About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
/ ^/ I# o( O7 N  ^6 C! a<TBODY>! j9 \3 C# G4 {0 ]9 u
<TR>
( u% @" X8 I! T9 C( R' {& d+ a" F<TD><PRE>Method 01
6 s+ V1 [# g. n& G' ~: p=========
3 `& P6 D  h% G) F
# [: T  w1 M% ?& x/ ?! }This method of detection of SoftICE (as well as the following one) is% M( t. P$ |& v$ M6 [3 R
used by the majority of packers/encryptors found on Internet.# p: T0 x+ H# H
It seeks the signature of BoundsChecker in SoftICE
5 w' g1 W5 k( ~/ z- Q5 a
* D1 x* H# J: \    mov     ebp, 04243484Bh        ; 'BCHK'# S  a+ s" e' P1 U! p  {
    mov     ax, 04h
; p' h" [- p' Q, H1 k    int     3      
% R, j  `( `) s    cmp     al,4
; m, @5 m2 a+ p* \1 r    jnz     SoftICE_Detected
, I  x. n4 S( Q0 y* ^8 [; z5 H
& H2 a- _9 a) j5 H& N___________________________________________________________________________/ {- ]% n" ^( I( f3 E/ z( i8 `
# h& ~& F: k9 k! q8 v
Method 02
1 N8 L& s7 v; B  L=========& @6 ~8 j7 M5 y$ f4 a5 h
4 K0 j9 E3 n" j' u# m
Still a method very much used (perhaps the most frequent one).  It is used
$ H8 g5 _* G* ?9 sto get SoftICE 'Back Door commands' which gives infos on Breakpoints,! Y- I; ~) ~8 H
or execute SoftICE commands...
7 a! v# }7 _% t. U* hIt is also used to crash SoftICE and to force it to execute any commands2 f7 m$ t2 @; n) X
(HBOOT...) :-((  
! V3 X' \, p) t0 H, |5 U6 L, b( D
- ?# _! P4 c: NHere is a quick description:4 q  d  d- \- C4 P
-AX = 0910h   (Display string in SIce windows)
) k- T& _- @4 U0 U: O& W-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)5 S; \1 h# q2 o8 z' `, f/ C5 u
-AX = 0912h   (Get breakpoint infos): e5 U5 E( Q, L
-AX = 0913h   (Set Sice breakpoints)/ i! h9 n4 h4 L) p, d2 K' U
-AX = 0914h   (Remove SIce breakoints)
+ @6 N; Z" S8 e' x! {
" x9 x6 h9 O2 N: U0 y: h/ ?Each time you'll meet this trick, you'll see:
% F/ t- p2 T' ]4 x; k-SI = 4647h" m- |) G- D2 I7 A7 Z
-DI = 4A4Dh5 D# e: R. p& H2 U* h+ b% ]
Which are the 'magic values' used by SoftIce.2 j3 K7 j( D  _6 b4 t
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ t& C/ X3 O# ~. L, Z6 r
# |0 i* o5 V  O2 i$ `, E2 o& QHere is one example from the file "Haspinst.exe" which is the dongle HASP2 u# {+ Z( Q+ }! N4 K
Envelope utility use to protect DOS applications:9 F) R0 ~; o! C
: k, L/ _8 F( n
1 n8 R/ |8 j  z: s1 N& @- `% N) Q
4C19:0095   MOV    AX,0911  ; execute command.
( G0 j+ e% P; {2 _2 N. J' C: j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) H* K! y" o  s
4C19:009A   MOV    SI,4647  ; 1st magic value.
" U- K0 L! z  G7 f4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) k5 ~4 r2 V% }* k3 x& \, F( _0 Y) t2 q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 W5 h8 ?/ x: B3 u. M+ L2 G9 _
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ U: U* z# L! r! m2 J3 e4C19:00A4   INC    CX
% N" r3 b7 f9 W9 ?6 h# ^( Y4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  v; S' m- S; N& F4C19:00A8   JB     0095     ; 6 different commands.
1 Y! U3 Q2 J" F7 Z  @  {8 Y7 F4 C; N4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  L4 P2 O% @' J3 d9 ~8 J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( C0 M+ F! c. f* E) Q3 `+ {4 u$ K0 @  E9 r
The program will execute 6 different SIce commands located at ds:dx, which5 q2 B, {/ z1 _; ]( U
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) Q5 u2 G. ~& Z) C3 k" d0 n* ^
( m9 V. L& C+ l# w- k* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 z) l+ D& m9 J: l3 K4 Z3 {: s___________________________________________________________________________
) [7 B, V) V3 v: |, I' E4 f" a( @) O4 v
8 w& v) H$ P/ c& v/ W
Method 03
% B9 d8 H9 f- C4 l=========
5 b. S8 i! ?& L; [' i: ^' `0 q% u* Y& U
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 v' }, T- m: a, v(API Get entry point)$ w& l( l7 Q  w
        
2 |( I6 n4 ]  L( {! |1 Z
% W& Q! {/ B" n' {% }1 [+ v    xor     di,di
  u1 G% g1 U+ f: Y$ V! s    mov     es,di
) j8 t9 t" b, b8 P* o" q: f    mov     ax, 1684h       + H4 W% w9 \) q8 X' h
    mov     bx, 0202h       ; VxD ID of winice
1 a1 _; k+ ?! ^" `8 D& }9 X    int     2Fh. r5 G7 s" T0 ?8 h: A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 f4 J% n* J* D5 ^% T
    add     ax, di) r: x9 W, S% M. J6 c
    test    ax,ax
; L3 q( `6 y5 s    jnz     SoftICE_Detected
+ k5 j! ?) S- J5 W. T+ C( Z8 x. k0 o$ Y9 q9 |/ b9 b* j
___________________________________________________________________________8 B7 \" i- Q; R  `0 K2 E+ J2 [/ v

7 p( q$ \% C' i  H* R2 HMethod 04# N; `& m2 k8 t3 \6 d7 j, ]
=========0 Z) ~  y! N6 [( O( K+ @
. S* {; w( \- |9 o) L; [+ M; Y6 o
Method identical to the preceding one except that it seeks the ID of SoftICE) k) d7 o1 {: Q  T6 z5 v5 q8 H7 k  Q
GFX VxD.* x; B  \7 T1 D& G( ]/ D) r

8 t2 `/ d# w; m9 D/ F6 s  r    xor     di,di
, }% ^9 ]0 g+ N& `    mov     es,di( a& X. I/ g! T/ C  N4 x$ m1 A# ^2 {
    mov     ax, 1684h       4 {* @* h4 k1 k2 E3 r6 p, J9 l  K
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) q8 O6 W( H0 a) U3 a5 A    int     2fh) `& p/ j" b) v' t$ x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) w/ Q) {: p8 n! d8 X  m
    add     ax, di; d' U* Q- Z! M% t8 k; `6 K
    test    ax,ax+ I. k# h8 x# }) ~# U: E. s
    jnz     SoftICE_Detected
( ]0 g* u0 _- D' u$ z9 V
. s' q4 n4 ]; U6 @1 z0 b: |__________________________________________________________________________2 L. o, Z  V( y* x4 n1 ?3 b' K9 Q2 z

; s* h7 Z$ U/ C" _: B0 f
& H" ~4 Q# b* |2 T# ~, mMethod 051 A4 J$ T. n- D3 p
=========
5 \( L& ?& Z1 B& r
2 I) ]/ f' D/ uMethod seeking the 'magic number' 0F386h returned (in ax) by all system$ R. f! p1 k' C5 \) J5 P
debugger. It calls the int 41h, function 4Fh.6 Y+ A- Q$ q9 s, c& v; P% k: \
There are several alternatives.  
' y' B/ K: N/ c5 n' @* Y* r/ ?. E: O
The following one is the simplest:; H3 a/ @& K) g- v

. C1 C  G# f3 y7 C    mov     ax,4fh
* G2 x) O: V; M+ R4 ^5 D    int     41h
% x% L* p6 A: U% Y% n    cmp     ax, 0F386
3 a# @# F5 ], K" d$ V+ y' d    jz      SoftICE_detected6 ]# g6 {! V2 f- L" S( |! j
4 z' m7 j- d/ s6 s) [  W' r
% M/ Q! _' C2 e9 q
Next method as well as the following one are 2 examples from Stone's + M; r1 f& A+ y# H
"stn-wid.zip" (www.cracking.net):
$ c6 H& \8 x$ b. ]+ l3 P/ M& ?
( I  K' M- O7 c) `. @  \    mov     bx, cs
1 I. G3 J( b1 Y" B, V% Z8 |9 \, j    lea     dx, int41handler2
' \1 e; Z6 @# H9 p, L4 i7 ^5 U, F    xchg    dx, es:[41h*4]  u" k  C+ ~: Z. k3 U' z8 E
    xchg    bx, es:[41h*4+2]
5 G$ P1 P0 W! ]) Y7 d# a    mov     ax,4fh- A( l% j- r- m) E- ~
    int     41h
! X! f( P1 y. e9 N    xchg    dx, es:[41h*4]9 u, a0 S) b( t& ~& y/ J" r5 J
    xchg    bx, es:[41h*4+2]6 t) T/ Z; P1 [; j. |$ g
    cmp     ax, 0f386h
1 o" l3 ~! Q, O& g, d    jz      SoftICE_detected+ l  A6 Q% @: X/ {
( ]" _, _+ E7 q3 H" _8 r
int41handler2 PROC( M  O8 S8 u1 w- u9 [  E
    iret) Z+ U. Z& f' \! J+ y* |1 t! ]- X
int41handler2 ENDP+ U0 }9 N( z' ^+ I' z7 ~
& H- [+ J$ M& x( ~3 Z) `  y$ K
7 R0 F1 y. O- }7 G% V  M
_________________________________________________________________________+ V6 W' w- r) ^& G% y$ N
' G) f0 \9 f$ @8 J. L( ^5 Q4 D

: C6 R1 D$ e4 z3 K  e) D5 lMethod 06, R$ a$ g% K; q" `& p) c& h
=========3 v! v2 c3 \1 j7 H! V, h1 @' _

! L  {! w! N+ `+ m9 O7 z' _1 {1 I* R& j3 E  `5 c! `  T( l, `. J% H
2nd method similar to the preceding one but more difficult to detect:
! o% E/ y; V  W2 l3 v, f. |5 h! q+ ~2 b5 H

- K/ a8 a! M' n5 a1 m% jint41handler PROC
" O3 [" p5 v5 n  J    mov     cl,al
& V$ b' Y. H# r, ^5 H8 B    iret: f# S, N0 g% r* B* L* d1 C
int41handler ENDP3 F; p1 A; u& V$ [7 \: Q& W

9 H5 b# }  K) R1 K6 ]; b% z/ M3 R" C; s
    xor     ax,ax
( K( D5 V9 j* D! `# _    mov     es,ax3 ?1 D/ |/ D$ s9 u; n. T
    mov     bx, cs2 G' g: q: V# D: Y
    lea     dx, int41handler
) c3 K3 E' u) u+ e- |/ p2 e, m) e) P    xchg    dx, es:[41h*4]
# u5 j: U6 v  W: P5 ^    xchg    bx, es:[41h*4+2]
4 w. ?7 G. p0 J( C: @    in      al, 40h
$ h& a+ }0 q7 Q9 I2 \    xor     cx,cx3 Z) ^7 d0 U! [1 S5 i. e
    int     41h+ D9 P. M& W! [
    xchg    dx, es:[41h*4]8 l; ]0 w# p/ b
    xchg    bx, es:[41h*4+2]3 |8 w. E) @3 b! x9 i- d
    cmp     cl,al
2 n6 A* I3 t: r+ H9 ^8 `7 O    jnz     SoftICE_detected
& b( E/ P+ f3 \6 o$ @# |$ Y3 M: x; M/ c# t0 w4 z3 B
_________________________________________________________________________
; ?  N8 g- |: s  R3 o, q/ w; {/ `5 `9 \+ U- g9 q+ R+ a" B
Method 07- j# ?( Q- I3 J' D+ v4 l9 D" w4 s7 x; |
=========3 ]. E" t, G8 U$ @6 r+ x. d
# X: d" l  U3 w: Z+ S3 F* `! C2 L
Method of detection of the WinICE handler in the int68h (V86)
5 }( K; g5 R# G( u6 Y
" f: N: Q. B% P2 K3 Y! H  j* ?    mov     ah,43h8 e! J- z% {, ~* ?" ?
    int     68h
% h, Z% \9 r' F# s6 z6 }) G    cmp     ax,0F386h
9 n* ]' J* R# M7 ~% C6 S$ O    jz      SoftICE_Detected7 d2 E5 h/ ^$ N8 j0 q( Z2 c
1 e+ v4 ^. @5 R" Z+ n+ J

  ~1 n9 Q% o3 }' H' q6 r=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 K8 q  s8 `3 a8 _1 B5 E   app like this:
2 g' ~; L0 Z2 T  r- F8 F
/ j2 n! e9 G# h   BPX exec_int if ax==68
1 m+ Q3 O2 e9 G" i. d   (function called is located at byte ptr [ebp+1Dh] and client eip is; y) r& k& H6 Q  n
   located at [ebp+48h] for 32Bit apps): A# Q' T( {+ k9 n/ n5 z
__________________________________________________________________________
" `/ G5 h+ t! i  D& H$ \) ^' T. |5 B' O* K6 c, |! D0 V7 y
9 ?! h4 s; z  R& W; U1 F
Method 08+ u# n4 d- |8 ?
=========9 H' g3 U2 i' Z/ p8 p/ m1 L& M& p
" s+ R+ B# Y" P9 v* w0 c6 k# `
It is not a method of detection of SoftICE but a possibility to crash the* @! T9 D* Q0 @* G
system by intercepting int 01h and int 03h and redirecting them to another, h3 K& s9 s$ P; x8 T# F
routine.2 D$ a* T* ~/ Y7 w: @3 y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  i' a0 [2 k* R; v, t6 Eto the new routine to execute (hangs computer...)
0 }9 O8 t, ]! o
' l' [0 {+ ]; b* J- R( l( p* C    mov     ah, 25h
/ ]* }+ x* R* y% o  E" g    mov     al, Int_Number (01h or 03h)
! l9 o4 g- r4 f& f/ w( z" p: d    mov     dx, offset New_Int_Routine2 E- k0 ~. n3 S$ |
    int     21h) X2 L, ~, t- n- p4 n8 H; G
' a$ \4 ?) s: a2 ?+ K5 x) a# M/ {' ]
__________________________________________________________________________& f+ Y: F/ h% r5 K2 E. ]
# V2 h9 L5 c$ F7 A
Method 099 A7 W7 l" ~# i4 e: @
=========
6 U$ O# p" i0 q& U# e* V3 G  l! Z3 `0 z0 l
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 @; d5 h3 i3 [
performed in ring0 (VxD or a ring3 app using the VxdCall).6 o' x4 w, w; k8 {$ A
The Get_DDB service is used to determine whether or not a VxD is installed
; J2 p5 t, i6 Q- F7 Kfor the specified device and returns a Device Description Block (in ecx) for
9 V+ D/ S- }6 m8 P' ]  Zthat device if it is installed.
$ U1 k; i# T" A4 n0 G% c
; S. A- F, X# S2 S   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 J! w' A  b- i% |   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% H# }7 s$ h: ^
   VMMCall Get_DDB# x( m" r" ?6 D& U5 c
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; d9 |7 y' x# T6 C1 _9 i3 V+ w
. d' k& ]$ y+ D$ \) S- D; M/ DNote as well that you can easily detect this method with SoftICE:
8 G( V7 q2 W# A/ D( ]   bpx Get_DDB if ax==0202 || ax==7a5fh7 E0 j, `; l( k6 {4 M- c" I" G
1 M7 h# t" u' F6 Q
__________________________________________________________________________& ]" h2 E$ q7 p  Y4 Z( S8 w

0 P( x7 |/ ^' S( X5 x& ZMethod 10
# i$ A) S1 B% i( k4 {3 q=========
8 g" o, p. p3 F3 t8 [  E" z" H
0 I. B& L& r; p- H* e4 n=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" r) |7 T: p( g  SoftICE while the option is enable!!
- J( C' c1 D  J% o7 P7 [$ R& Y6 E2 r$ `
This trick is very efficient:8 O, x2 B7 L) `% g% ?& N
by checking the Debug Registers, you can detect if SoftICE is loaded
- U8 I$ @/ l; }$ z3 o(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& X9 y$ t: `' `: {there are some memory breakpoints set (dr0 to dr3) simply by reading their
- J2 N6 F6 ~3 P! I4 |; P$ W1 hvalue (in ring0 only). Values can be manipulated and or changed as well9 x. l/ Z# V) i! h
(clearing BPMs for instance)/ P# T5 f: l: x8 K
- C4 j0 I- P* y% ^6 p/ p# e
__________________________________________________________________________
' D$ [6 t/ Z: t; W' `3 B. i) }" P6 w7 i+ ~8 J3 N7 ]- y0 g1 D
Method 110 k2 |. |+ ?4 v% X$ |4 X' L4 `8 n8 n
=========/ ^6 Y5 o0 d8 G. `9 C/ X

5 t( Y' z5 ]8 V/ P% a. {! ~, U3 d2 t# cThis method is most known as 'MeltICE' because it has been freely distributed
9 V, u- K9 z, {* v  Qvia www.winfiles.com. However it was first used by NuMega people to allow9 w1 ]- W6 W* V0 _2 t
Symbol Loader to check if SoftICE was active or not (the code is located
$ X3 U2 n& _1 }% D& @5 D- ?inside nmtrans.dll).
$ d/ a) V! V" d! t/ g, P* [6 \3 J. h5 y4 Z# T& U+ p
The way it works is very simple:  ~) P  B: W% d" _4 q* s! }8 B
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# ?" L% s* Z# o9 P* X
WinNT) with the CreateFileA API.+ T2 g4 [" M& ^# S; M* L) S. _
# f3 v. i4 c; I3 k
Here is a sample (checking for 'SICE'):" ^- o2 t7 h9 c4 A, V

7 h5 `" ~  M) V% t  ^BOOL IsSoftIce95Loaded()' [5 e6 G" x" D" m5 [
{
9 W4 ?1 c( i$ d, E' I   HANDLE hFile;  
4 g) t' I$ D- T' @9 i5 |% E9 B   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 c* l' Q) b6 I/ v4 u
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
; Y9 `+ Q2 a) z9 z- D                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 ]3 K2 _& d" x   if( hFile != INVALID_HANDLE_VALUE )  E! N3 t3 G+ g$ @! E( B+ v
   {
2 d3 h. H$ g& |      CloseHandle(hFile);
1 w: r9 z. b, f7 b5 u. B, X      return TRUE;' k6 t% t  V: a( s7 }) i
   }+ a' A: U% O. L( f+ F+ A+ t
   return FALSE;
9 n" X) c4 H" @+ V: Y& t. c% W}
& g+ s2 n* \8 Q, a7 x: H9 b4 ?5 f
' g- H$ E5 A. aAlthough this trick calls the CreateFileA function, don't even expect to be+ H7 ^( O: h7 H6 C
able to intercept it by installing a IFS hook: it will not work, no way!
: R9 a/ \" M$ w( |: TIn fact, after the call to CreateFileA it will get through VWIN32 0x001F* B8 b; }1 i  o! a, }
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# ^0 G& z) x3 Y1 u/ _  h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 x$ V$ }& h/ q8 j: O2 I; {6 d
field.
. t; g. V1 u0 I( \In fact, its purpose is not to load/unload VxDs but only to send a * [0 n2 e' X  Q/ ?3 T7 V+ A* v
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- |# B$ @! C( j$ a# |to the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 v& k/ d3 ?$ h8 q; T. [$ j) Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).5 R# z* P* o8 _
If the VxD is loaded, it will always clear eax and the Carry flag to allow8 A* X9 U# S6 b2 n9 X8 D  ]
its handle to be opened and then, will be detected.
/ F9 \& J0 G4 U4 l  u" \% \You can check that simply by hooking Winice.exe control proc entry point; b, |" g! y# }. D7 x) N! u
while running MeltICE.
8 j. ~3 o% D( k0 B3 m" n* }$ C7 f( k' e# [' N. @
: U: k4 s/ `0 T' G
  00401067:  push      00402025    ; \\.\SICE3 _" z2 U- R  e
  0040106C:  call      CreateFileA, ?. Z+ V8 k- m  k$ m6 Q
  00401071:  cmp       eax,-001* J9 Q: |3 Z6 a4 A
  00401074:  je        00401091
1 t2 Z9 i+ s; `
7 P& ^/ u; x0 @$ t8 ?' c, x( u/ ?% r  w- _, k1 J) p* O8 d+ E
There could be hundreds of BPX you could use to detect this trick.
3 O1 }, \" c6 r& O9 K8 S# s-The most classical one is:2 a$ D  p% V% e
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' n. a3 `* l4 p& A# M$ @
    *(esp-&gt;4+4)=='NTIC'
0 l8 ^! b: D6 ]5 D
* e. r. ~4 c( \: d3 M-The most exotic ones (could be very slooooow :-(1 \6 e$ _. s! ~0 |4 L- I
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
# j, q+ s% W/ R& D; I/ h2 k, s     ;will break 3 times :-(2 C% m! E2 |, E' v+ @% D/ h
- `7 J3 j" `- p" S' u+ R
-or (a bit) faster:
1 U# [6 l- Q# m7 l   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ `4 [1 H& I( O' f' d; o1 R
4 z* E4 T# a3 g   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: j, {& _! M) a. ]9 j6 G5 g- A) o     ;will break 3 times :-(
+ \8 n" D3 D6 |+ B! d  Y* g3 B7 R: i+ }) m9 _9 w7 V5 ]
-Much faster:
( e3 c5 q6 I' R6 }$ K! e; G" M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 b( m9 Y  a: s; i, W9 D2 p3 T0 m! q8 M! w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen' o; E6 {" d& @- a; v. I
function to do the same job:* w7 D2 n4 a) ~

$ q. q- X+ _. h+ J7 P6 w8 c   push    00                        ; OF_READ
5 H2 Z+ P9 \% A; f  B" \   mov     eax,[00656634]            ; '\\.\SICE',0; T* y! W: k4 P4 ], a5 T% i; J1 ?6 n
   push    eax
+ P! Q& b/ Q- c. F% A+ ~   call    KERNEL32!_lopen
, }8 l% l. d& |. {3 u9 }   inc     eax% {  t! a% {/ u; X$ i7 I3 S
   jnz     00650589                  ; detected9 }; F* L1 H) q8 U; _4 V" h3 x# o
   push    00                        ; OF_READ( E0 S0 M( ^, E9 f8 U/ G6 |
   mov     eax,[00656638]            ; '\\.\SICE'
' C7 _7 h7 F9 k: U- U) x" g5 _   push    eax) b  B8 t5 z! e: `
   call    KERNEL32!_lopen
' w! L* v+ J* h% D; s' I- B   inc     eax* s4 i/ G0 S8 `+ [
   jz      006505ae                  ; not detected
, c7 p' r  J, W( i- K: p" v2 J- Q- ]7 S8 V# @+ X
# A3 \' M, q1 H  R
__________________________________________________________________________
" F/ s; G$ L  j! m1 S6 s2 a. n5 I7 N* t7 w( Z# ]( `
Method 12+ _0 I8 f) B6 p- T# _
=========) \0 D+ y* l4 w9 J
  r6 Q2 d2 y2 ?/ u( e  W
This trick is similar to int41h/4fh Debugger installation check (code 05
7 J0 _: x) B9 D  ?&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; q8 N- ]* j) D7 J) [. h5 i- jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 }: d% L0 O) E6 U2 {7 k( D% U3 F
1 J, Y& z' l/ ~9 C; i7 o! J& f4 J   push  0000004fh         ; function 4fh
7 _* O: X9 j4 {; \+ H   push  002a002ah         ; high word specifies which VxD (VWIN32)
  i! g& q( p5 Z, N                           ; low word specifies which service
7 K+ J9 D! S% d9 R& ]3 J+ {                             (VWIN32_Int41Dispatch)" ]3 Y& _2 e8 h- x
   call  Kernel32!ORD_001  ; VxdCall
* ~( v: g1 Q* F3 }   cmp   ax, 0f386h        ; magic number returned by system debuggers
4 W% T' J. U( @* ?4 q3 w   jz    SoftICE_detected
& t  y- S- C9 z0 H6 O2 I2 O7 L& j3 ~) U0 y8 |$ v8 c2 D* Z) p5 ^; O& q
Here again, several ways to detect it:
) b$ x" {3 w2 s: f$ u! O' y4 d  E4 g5 v( U$ I! M' f* h
    BPINT 41 if ax==4f
& u1 [1 r! ~1 O: [' J4 m9 ~
9 G9 R2 U: F. Y; A! a: l. u    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 f6 J# H7 y7 L+ ^& A' O; l  g( R9 ]& [) a
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
" f" a$ D0 }! e8 f- }
8 ?, p& U- u3 A, n6 I! E- c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% x$ g! F$ g; x4 D8 [' k- T# I
( I2 w# J: ]+ O7 x' Q* J8 }
__________________________________________________________________________+ B& S) y3 o! i6 w

: l, O' {7 X- I, H+ ^" u( r5 FMethod 13) i, _/ ?$ n$ @: T% I5 a  [; g2 r7 \
=========
  d$ k2 F6 [, S+ t4 ~7 J; e0 B% C1 u" ]7 C3 U- e( J- _$ [0 W
Not a real method of detection, but a good way to know if SoftICE is
" \' [5 U6 Q: D$ w" U0 Hinstalled on a computer and to locate its installation directory.8 @4 O4 D/ k' a+ {) @/ |
It is used by few softs which access the following registry keys (usually #2) :  M8 J, l( n, L" E4 C: m4 d+ G- G

- E! N) L  X* G) ~-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: f6 _: ^3 g2 V0 j4 |, E& n\Uninstall\SoftICE. d( r2 D+ J" H( Z4 E6 Y: p' [9 K
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& V. V2 u1 [  f* ^/ h) Z# O" y7 m# \% ^3 K-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, W* O3 J9 F2 D5 y  a' M\App Paths\Loader32.Exe0 ?: N) |# j1 i+ P; n% U: x* x

5 F1 {6 Q9 X" V# j/ P
( Z/ E) S: d- S, UNote that some nasty apps could then erase all files from SoftICE directory9 a( }! Z$ R1 e, m2 n' O' T2 N6 R
(I faced that once :-(
& V; Z( r: C6 `: r4 [4 I! {5 q# u7 U
Useful breakpoint to detect it:* Q! |( T0 J5 F! |0 F, w- _
) C# `5 |6 L9 g
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ U, g* e; P* F5 L* g
$ m  V# ]0 F% ]0 B. S__________________________________________________________________________: Q  r7 y8 g* M8 p

, K  Q: Y) @0 O3 B5 ?1 L: _. _0 I# c5 R! Y
Method 14
8 @' D3 K" T! S, U- p& D=========4 O3 `' i7 ]0 T! V% C' Y
6 \, z) }3 [" ]& [9 W- W0 U
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ a; R1 _( a& I' T( V- Z5 j
is to determines whether a debugger is running on your system (ring0 only).
! \2 Z1 X3 x0 \  r' {4 L
+ L9 I" a6 ^8 S0 o8 A6 F   VMMCall Test_Debug_Installed% F  o3 Z! C9 _- w* L3 R6 ~
   je      not_installed% U$ x8 ^  n7 c: v
0 y+ S' u& H! q1 C6 }. B6 F( F5 E# A
This service just checks a flag.2 ^1 `3 h6 Z# O# {, U" y; E8 s
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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