About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ p5 F- C6 p0 K) _/ c<TBODY>
( W" C) v2 s- s7 n( F% J( b( E<TR>
1 @; d- r1 M. l! h9 N<TD><PRE>Method 01
5 M( J& [# W, L9 o; j8 u% P; |$ P=========7 B% J% G% g( z  T: t, E/ l1 e

3 p5 R9 \+ r2 Z4 p/ \& dThis method of detection of SoftICE (as well as the following one) is
7 O$ s3 |% k; l" n8 m. k  Fused by the majority of packers/encryptors found on Internet.
2 n# r- i8 K/ F1 S6 [# PIt seeks the signature of BoundsChecker in SoftICE
7 c; s) s' q  f' m# c" B: \. s
. x- ]; n  N& @' j6 N    mov     ebp, 04243484Bh        ; 'BCHK'0 g' F3 A: _# i7 l% D) M/ ~- e& `
    mov     ax, 04h  X2 Z( H+ w; v) S5 ?4 `
    int     3      
4 h( J# R% k4 f- Y    cmp     al,4* H6 n# J+ |2 I( z2 D$ b& G0 n
    jnz     SoftICE_Detected
* J( y7 _, \8 k/ V* \6 Z7 d
8 |0 Y% w' y3 K1 G% W) u( w+ x___________________________________________________________________________3 n" E$ @: J. I5 L9 s
; Q$ j4 H7 n+ m9 F' O" S, i
Method 021 f' x+ Y; w% \+ q
=========" S7 ?9 L6 B8 V: z: y/ \

# q) I6 G7 O: D& h2 v) @% KStill a method very much used (perhaps the most frequent one).  It is used
& [9 g/ ]/ }( E" I/ i+ ^# p+ k$ W7 Lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 e, n* e) Z& M
or execute SoftICE commands...* e$ C1 c2 a& Q+ N: i
It is also used to crash SoftICE and to force it to execute any commands
/ C3 l3 N. {4 a  ~( J0 G1 w& V(HBOOT...) :-((  
7 d3 x1 J% E2 l2 a) R& S" W3 C3 o' Y$ r" i# `; c, ~7 e
Here is a quick description:
, j* k- B$ p) F-AX = 0910h   (Display string in SIce windows)
% T# ~; a. s, x-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ N; A" }0 x) R9 D& P3 |: u2 D-AX = 0912h   (Get breakpoint infos)% u' H: Q9 M9 L: t
-AX = 0913h   (Set Sice breakpoints)
4 @# [6 g9 B, N$ n# I- u-AX = 0914h   (Remove SIce breakoints)# W+ U7 G  m$ z! B0 R

8 a# B$ `# i$ u5 E& [5 h& @Each time you'll meet this trick, you'll see:3 r" |) w0 `4 @0 [  ~4 n. r/ a4 }! Q/ ~9 b
-SI = 4647h
' f' G9 x& V, Q9 B4 H-DI = 4A4Dh
( x, [+ B7 M, z- v' q  qWhich are the 'magic values' used by SoftIce.$ a, T0 m* x8 J( R. E3 |* n, m, O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 w$ V/ a: R6 I" d
- e; E6 |* l7 M' S
Here is one example from the file "Haspinst.exe" which is the dongle HASP
3 G2 f7 O) R5 L& EEnvelope utility use to protect DOS applications:; E6 ]7 A. ^  m, j+ s8 G

. ]& }& N1 y% n, ^! l' z. i0 M+ l' _- r( F
4C19:0095   MOV    AX,0911  ; execute command.& D- p4 a" n8 ~5 \% e7 b0 {) G& `
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; d& P/ t3 J3 L, e* l
4C19:009A   MOV    SI,4647  ; 1st magic value.4 U0 a# Y( N4 E) U
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.+ d2 \" @* `/ {
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' h& H+ q# p, A% ~2 i& X' l4 c
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* g- A; n* o7 H% @2 s4C19:00A4   INC    CX* u; t1 \* x/ ]( U0 i! [7 O
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! `0 d. W. S! e+ w% {
4C19:00A8   JB     0095     ; 6 different commands.1 h) S' c! G: t
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 u! d. q( V; |* w" p4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 Y5 T) {  p4 {8 l

% z6 U9 |9 m9 U7 D: c: gThe program will execute 6 different SIce commands located at ds:dx, which' D; n6 G& y/ D) N, ]
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 p0 D" ^! e0 o; u( y, f4 \" n1 J& D4 s. F
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  X, ?5 v6 x  Q4 K9 S# [3 b___________________________________________________________________________6 {2 s7 g/ N' p- F5 F5 n

* o7 b: U4 W' w$ M$ ~5 U2 S6 Y% Z+ h8 D6 b9 l
Method 03/ |' l: @9 G8 _7 }% N  K+ S# T
=========$ b4 a. D9 c- k3 E: [/ T% S1 [* ^6 f

; q3 D- G% x5 j. LLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 k8 t* K& P; j: Q4 x
(API Get entry point)
" Y  O5 K: s& ~% Z6 m/ p7 m/ ^        5 t+ A0 a& W- d: a
% ~. Q2 T6 m2 [# f
    xor     di,di* Y! a3 o/ g; w6 G, M! W& E
    mov     es,di
) z4 Y! U- O: F    mov     ax, 1684h       & _+ m  |2 K% A
    mov     bx, 0202h       ; VxD ID of winice, V8 r1 K. I7 y& c
    int     2Fh+ S! T: p3 E% [5 v$ d2 o0 N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 U4 h* S- E: r  M' K  H2 x3 ~
    add     ax, di. }; [, ]' x6 w! O" {+ c( `
    test    ax,ax7 |, E3 g, w- I
    jnz     SoftICE_Detected4 L/ U! ~1 r. `  S0 ]3 M/ S
& E) R: o- I8 G. O) ?5 k6 f8 R7 r
___________________________________________________________________________
: c4 w* U8 J6 p5 X+ L* f' ?: s* q" O
- ?8 N0 ~  R4 f( F( f! T' ~5 B3 S3 `Method 04* j4 f( U" B/ ?: M5 ]& n$ Y6 S* q
=========* L$ g5 x) r; W3 }2 h

, c6 H/ R" R% D) k9 u9 N9 DMethod identical to the preceding one except that it seeks the ID of SoftICE
3 q* i8 n, y( i0 L8 N: X% c: i6 CGFX VxD.% Y7 z, s% a+ m3 J! o  F
7 n& y' o5 @) |7 o5 P$ y
    xor     di,di
9 M7 d8 y5 D, O$ F& E    mov     es,di3 L* H7 `0 \% S: g$ Y3 i0 U( G. Z
    mov     ax, 1684h      
8 E. o8 M4 w/ X6 w4 {    mov     bx, 7a5Fh       ; VxD ID of SIWVID. y. M8 n8 ?1 d! a! ~) c
    int     2fh5 B; D" k+ I+ A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 C0 [" S3 _! {0 u
    add     ax, di
9 I# S1 q0 s9 h. b( D7 I5 A6 m; K    test    ax,ax. h! G$ ^2 C  d/ C
    jnz     SoftICE_Detected
# {/ p( ]5 e& k
" }+ P5 o; o9 x9 h% Y2 Z& V+ L' T__________________________________________________________________________
- Y1 K- k0 u& w% V$ `5 ]- K$ S* J
2 m: h9 G. A: \2 f, C, a# r) d4 e2 D" P" @8 C; _: ?% w# I
Method 05( o1 w5 n$ z+ }. v0 l% H2 H, c- |9 S
=========. F0 Y% |8 W/ y
0 f$ b& h' q- H! W, f& w9 s
Method seeking the 'magic number' 0F386h returned (in ax) by all system
! q7 W6 _- R2 u( I! tdebugger. It calls the int 41h, function 4Fh.' `' i3 z& a# u' I# C
There are several alternatives.  4 M4 E' p5 E7 x  f) j) n1 [/ x

( T& i) ?, w2 n0 G; j! c4 b6 v) ]3 z. [The following one is the simplest:
0 F( [$ c! N" M5 i8 Y
# Q9 Q& \% q3 h4 ?6 W    mov     ax,4fh" S8 h- @, j, [2 h$ U1 V7 C1 s
    int     41h" [! C) S# O6 x5 L) q+ f. l
    cmp     ax, 0F386
% Y' S$ x' Q; V6 L$ i/ Q    jz      SoftICE_detected
( B+ x) E( f; `1 h7 ?1 d. W
4 ?- ~- g0 s- f4 C' c8 m
( [5 v: r* i- pNext method as well as the following one are 2 examples from Stone's 1 r$ E7 {* U: k# _$ k2 `
"stn-wid.zip" (www.cracking.net):2 U0 I* r* q3 h1 ~6 Z) r; |) p+ U

) w& ^* l6 x6 S$ f" X1 Q& _    mov     bx, cs
3 c9 S$ e$ }) }6 G( h    lea     dx, int41handler2
4 }! h6 R, ~; t  C    xchg    dx, es:[41h*4]( q- Y6 W/ O1 \2 D1 U* t9 p- ]
    xchg    bx, es:[41h*4+2]& A8 L. g" ]+ }$ X7 ~; u# m! W+ c
    mov     ax,4fh
1 }& C) Q3 _1 n# a# G, |7 f/ n" `7 h    int     41h
( R% Q. `, D) ~/ V! L    xchg    dx, es:[41h*4]
8 D3 r3 U$ j) h. Z6 p) L! \/ A( P    xchg    bx, es:[41h*4+2]$ b  l4 A- F4 P; `0 Q
    cmp     ax, 0f386h
- U: `  B/ i# J4 |8 }    jz      SoftICE_detected
# Z" D7 C  M% }3 p* Q6 J% R
. Q. E' e7 c) t) ?6 jint41handler2 PROC: e1 g" U2 ]5 W& ]
    iret$ X1 i; \" J! i" V* Z, O9 t
int41handler2 ENDP
" K# \" \$ F5 Q( v( l9 ?# ]0 D/ a3 T# E2 ~: A
, F* N! F( C+ O/ P0 w( I6 f6 D
_________________________________________________________________________
+ w# U# F, i' a6 a" ^8 R' K7 U4 K- d. i7 a# O% h8 m  p. r
* z5 w) z+ ?( }* E
Method 06, _. y% @# b- m  H
=========
6 G- o  Q! v! D/ f/ H' l9 {, ]5 H( z# S( a
. x, x  T+ s  q5 N( ]
2nd method similar to the preceding one but more difficult to detect:
+ `8 C  x- Z" g- R% \/ G! g% [4 _7 y. R& K$ f
5 @0 c: X, _( p8 h  g5 q* n. z/ }
int41handler PROC
& R$ P1 a0 {- C& A! d    mov     cl,al
/ u, F& y; h+ x! B( M# {) u% e4 n    iret% I; O) g( R+ I2 p4 w. J
int41handler ENDP
2 B2 H4 [% p4 q# u7 q
  ^! l) G7 ~- p3 X" ]
# n7 g( ]  U/ I; W8 A1 P    xor     ax,ax, x( s/ y$ ~" K7 T' F7 y& G
    mov     es,ax9 W' z3 _# Q7 {) V+ M& b# s: J# C
    mov     bx, cs
% _! [1 Q6 U, g( d" W" G    lea     dx, int41handler1 q  e. F+ h8 j9 s0 {& m
    xchg    dx, es:[41h*4]1 v* z& \% d1 Y$ O5 }; Z; B4 T
    xchg    bx, es:[41h*4+2]
# h$ J% Z7 |+ }$ j    in      al, 40h, z( \. w& a/ d, L
    xor     cx,cx
4 n9 B5 z4 l& [# w    int     41h$ O- x+ F& Z2 c: V
    xchg    dx, es:[41h*4]9 \$ ^3 O/ Z0 g9 k
    xchg    bx, es:[41h*4+2]
+ }% _  {5 `; ^- P+ @    cmp     cl,al) ~9 `8 R, q* V! b# h* A! r" ?
    jnz     SoftICE_detected
  o2 _, ~' `( v% L! l8 {
' C% |3 O2 k, d1 V5 N* O_________________________________________________________________________8 \0 _: C; Y3 j- V7 m* t3 S
8 Q& q1 B0 W) D
Method 07
9 s9 A' a) Z5 Y$ y9 X" N9 l/ y=========
/ X! i5 h) O' O) R
" z& q# B& ^! S  j# P: B- }9 wMethod of detection of the WinICE handler in the int68h (V86)
3 [+ P! k8 ]( Z/ K
% l5 v. B. |1 V1 ^0 O5 v    mov     ah,43h
0 d/ j. s3 G& S' M2 [. M    int     68h
, m5 G. J  C5 |    cmp     ax,0F386h3 [1 q0 s5 ]# C  q. U
    jz      SoftICE_Detected
6 \; X  Y# H, C9 V4 f. `; b! H0 V0 ]- p' |( j" g5 q" i" Z+ N
3 ?; T  @# d: M& ]" q% ~3 o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& B, c; {9 A8 c* c' x6 Z, ~
   app like this:& @! T9 l' d6 R: J0 ^
" k3 L1 X7 O: K  ]
   BPX exec_int if ax==687 D/ f. d. c+ P" V" E) m4 r
   (function called is located at byte ptr [ebp+1Dh] and client eip is, G. O: {- ?4 r' G5 K
   located at [ebp+48h] for 32Bit apps)9 w! W3 d( d9 d6 v
__________________________________________________________________________
' A1 \0 r4 j' N$ ~+ a' S# V1 [0 G& i" V% D  Q! {8 H

' n7 N( W8 v% h5 }) p* G+ zMethod 08+ A( ~% G  `0 S3 P/ e
=========
% |- D& O: S. i7 U$ `: p6 ^
7 J; O- D0 l- o- y; ?3 ^It is not a method of detection of SoftICE but a possibility to crash the
1 e. ]/ d0 b; a7 m4 D; Nsystem by intercepting int 01h and int 03h and redirecting them to another
1 e9 G/ {& p8 \0 g) Proutine.
8 f3 v" h' C; `, ~6 `9 K, N) W' GIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% O1 j0 d& H: c! D2 Qto the new routine to execute (hangs computer...)& c8 l1 _7 o6 W% N! O

$ b2 `% E3 ^/ |8 G    mov     ah, 25h8 ], a2 ?6 a. j/ f
    mov     al, Int_Number (01h or 03h)9 p4 r: p; M0 n
    mov     dx, offset New_Int_Routine
% t. i2 A# E: ~% V7 f    int     21h
8 f6 ?0 q, I' k  ?7 o* z
% p/ `3 X/ V* R3 R- z6 k3 L% F7 X0 `__________________________________________________________________________
% @1 Y- E' J# @! J4 N% n7 a
# \! D) J7 v& q1 `3 ~6 QMethod 090 ~8 ?5 _! {9 v: C4 G0 {6 E
=========" f! `7 F/ \, ~% q* r+ X2 ?2 z( Y

  Q+ C4 S+ Y" U% K  G8 v$ O4 yThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 x" t! `0 ?& s$ T# z( V4 X
performed in ring0 (VxD or a ring3 app using the VxdCall).
5 G1 }8 X2 @' D5 J& b' HThe Get_DDB service is used to determine whether or not a VxD is installed: v: @$ k  y( _& D; H) n9 h0 x) y
for the specified device and returns a Device Description Block (in ecx) for
3 W7 U/ a3 V  s& Sthat device if it is installed.! m( z8 M4 z1 [3 i4 `$ H
% U4 l- C5 F4 ?) F. D$ F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) E8 t6 j, s0 O' c( t   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 w! ~/ `: Z4 Z6 K& V5 j   VMMCall Get_DDB2 \3 \2 \7 T$ Y+ A
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" y* N% z- [8 ~$ I# N+ r2 s
  z( V: ?/ b) f9 K+ i! _7 }
Note as well that you can easily detect this method with SoftICE:
+ u2 T* A1 T/ R   bpx Get_DDB if ax==0202 || ax==7a5fh
1 f* V9 O& l% z' x' Z! b- Z; Z- U9 ^/ x
__________________________________________________________________________
6 f3 V, w, c3 E- w6 Z& m; U/ v5 _: f) ~/ A% N) \4 a9 ?: i
Method 10
8 T. R* N& a9 ]$ q: Y% e' a=========
- {: Q, e7 z1 h3 G6 ^  e% J' m" M3 X0 A: m' R' t0 P) A- Q# p
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
! G3 O6 q* r/ W6 D8 w9 z  SoftICE while the option is enable!!
9 ^3 S7 e, _6 \! r. Z) R0 H8 v* d, ]. m& e: w
This trick is very efficient:( U7 Q* e) |) A3 ]# `
by checking the Debug Registers, you can detect if SoftICE is loaded
3 V. \/ v6 ?5 a* d  j3 g; k; d(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, S/ m4 S2 L- C  ?
there are some memory breakpoints set (dr0 to dr3) simply by reading their. T7 d, L3 v. b6 }! O" F
value (in ring0 only). Values can be manipulated and or changed as well
5 M8 f! i" D( y0 o+ ](clearing BPMs for instance)% j( ?! h9 u8 a% e
( k. r9 O2 e! z# Y2 n3 p; R% |! _
__________________________________________________________________________
% E" _( [" i! @1 u: ]
- J6 K1 t" }3 j' n! O+ t4 t) [0 x( MMethod 11
" D# i/ g& b/ m$ C7 p* T4 p  ?$ t=========) l6 t( D- ~$ s3 Y$ ^: a& v
! q3 O9 {' H. D. L1 W5 X" K
This method is most known as 'MeltICE' because it has been freely distributed
( P4 n2 G5 l1 O" j+ L. i$ f  Pvia www.winfiles.com. However it was first used by NuMega people to allow' Z- {# e. f" A5 N, p: s8 a3 Q
Symbol Loader to check if SoftICE was active or not (the code is located
- I+ E3 v% N+ h5 Z. Rinside nmtrans.dll).
& f: A- W! M2 c- o) ?9 r7 o7 S: H- ~; L. R8 w& X
The way it works is very simple:
9 J0 y1 d* o/ b' pIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" ]* o; C) z3 r/ k. K# ?+ V
WinNT) with the CreateFileA API.! M6 X. F8 C7 v0 t: d" C: w
2 P! I5 Q- _2 F& ^# C7 i
Here is a sample (checking for 'SICE'):+ e' E& i. L0 W" e9 e! u: R; M$ k; R6 B3 Y

3 @3 d: H' m5 _- J- EBOOL IsSoftIce95Loaded()
& o/ {. ^6 v: r5 ]{
( L  o4 C3 n$ K% X" ~  ^   HANDLE hFile;  # j* D$ s5 P, w# e. s
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,6 Z. ?0 Y! F' ?& M( m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,4 y7 a% z3 v# H7 `3 b
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 x8 u  B5 g5 v
   if( hFile != INVALID_HANDLE_VALUE )4 M5 g* ^# p5 L8 J" Q
   {7 j: e' z5 q4 t' F' h* K
      CloseHandle(hFile);1 O5 T# _6 ]) L, k6 N: P/ \6 j
      return TRUE;
! h( c" |7 m2 K# Y5 |* T   }5 B# t! S3 |, \3 m9 e( t3 a3 `! B0 C
   return FALSE;5 Z: y5 G$ A2 Y6 T/ {1 _4 L. m7 G5 [
}4 I% r" Z# y' T, I1 Q- G
: R/ `  I# c: [* T8 a+ q
Although this trick calls the CreateFileA function, don't even expect to be
! o( `( o) g# }5 W( aable to intercept it by installing a IFS hook: it will not work, no way!  _2 a5 D8 l. ^* W0 k! a7 `
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
. i5 g) w) X- K& z0 k4 [2 xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 ], f7 M2 g: e- r2 x) `7 ^2 ?
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ y4 {" q4 b, k/ |2 ffield.3 v8 K6 w0 x% t, q
In fact, its purpose is not to load/unload VxDs but only to send a ( E# L3 l+ j) G7 S4 `% ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 g& ?" f7 u. N) h" j$ hto the VxD Control_Dispatch proc (how the hell a shareware soft could try$ x' v# l+ y) L; r
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ v% G" n# C) |If the VxD is loaded, it will always clear eax and the Carry flag to allow6 i# p9 A( A( |9 J: C6 X
its handle to be opened and then, will be detected.
2 R  V- [' c' z' @! A8 p9 uYou can check that simply by hooking Winice.exe control proc entry point
! Z1 B- @* Y) z7 o* x) bwhile running MeltICE.
5 @8 Z! P- h8 F, Z) b* `2 J/ R1 i6 i0 ~( [8 @7 L+ e
$ a$ I0 r3 F- K7 ~) C; ?: w  R
  00401067:  push      00402025    ; \\.\SICE
  u- s0 i" A- q  0040106C:  call      CreateFileA
8 h$ h. m. K  A- c$ `+ F# ?6 t  00401071:  cmp       eax,-001
+ F& O" n, g5 k0 ?: w, J  00401074:  je        00401091
( Y  h$ ^* |' ?) Q+ _: e8 \
3 C2 v3 @! E7 B- h/ _* r6 A, k% e! _% {4 o4 v
There could be hundreds of BPX you could use to detect this trick.
. V* q% e* p4 h-The most classical one is:
' B" v( e- q, L" t; ~  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* r$ g5 Y  b2 |) w7 ]$ u8 s    *(esp-&gt;4+4)=='NTIC'
# M1 D- U, X2 D$ }
; n, i, p2 `. v, i-The most exotic ones (could be very slooooow :-(
& t; f7 [9 @3 v. O3 j, D# b2 @   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * @8 n/ i: _& Z
     ;will break 3 times :-(
% j+ k  C1 U9 r+ A+ u; w
6 \4 O8 o# m, s, L-or (a bit) faster: ( A4 b0 C  D4 e, A! C) `- N
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), q) v. f* \" j6 ^
$ B' Z2 K" J+ J5 M9 ]6 l% s8 Q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , ]7 f; B8 L( P# D. j$ f/ @4 u( S8 e
     ;will break 3 times :-(
; U" G2 _$ `0 K1 h1 i9 t# Z* a/ L8 x( `: i7 n7 e' h
-Much faster:
* {( [1 ^1 e& t* R5 a   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& {/ V: o7 m2 m8 |0 u1 i
+ x+ ^+ n4 c2 j+ }% J
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
: I1 {5 D  f! Lfunction to do the same job:
, _% b% i0 T& ?* N$ x: q
8 g/ ^+ Q* y6 N- `' U4 a   push    00                        ; OF_READ$ w9 _" B5 |7 \, G, K
   mov     eax,[00656634]            ; '\\.\SICE',0
0 h" m9 o2 Z% i8 P" l4 p4 @9 L# T   push    eax
9 _+ E- v. w" T   call    KERNEL32!_lopen+ D7 P+ |" W! k( F& o
   inc     eax. X  J% |% C, T1 @. {& T
   jnz     00650589                  ; detected* p! c4 e- R4 s9 V. _3 A4 k
   push    00                        ; OF_READ
( }" G& j! d, g7 C8 r# S' Z   mov     eax,[00656638]            ; '\\.\SICE'* B$ q. l+ e/ E9 o0 Y
   push    eax, A/ |& \4 {  @) X, e- Q& ?3 C/ ]
   call    KERNEL32!_lopen  n+ x- L- Q( d1 x
   inc     eax
6 N5 B: {3 L# ?9 ]   jz      006505ae                  ; not detected
( [$ U% G2 b5 T  c, f; `5 a2 g: g
5 o1 u' Q* w$ x) P6 J  @. N+ K, @# F( b8 c# F7 C4 ?9 Y
__________________________________________________________________________
' |6 O4 q; d0 {1 B) v* k  W" G# [- B( C, p/ ~# ~' M
Method 12, Z/ C, U9 S+ j5 S* C& y  E
=========
( U& U+ y) ^* p6 L
0 K! y& ?0 ?3 l5 ~& yThis trick is similar to int41h/4fh Debugger installation check (code 051 @; P' m+ {. w* V* q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)& E  L7 |6 p# d) B4 |( u( N6 a8 o! r
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 T/ [" C+ y2 u- ~5 x
+ O8 N9 p% S/ F' ^" p6 B: ^, X   push  0000004fh         ; function 4fh$ r$ S- l; o$ x+ Z7 R
   push  002a002ah         ; high word specifies which VxD (VWIN32)6 E# j! u6 x( M9 J7 Q
                           ; low word specifies which service$ L# E& \6 B' ?( e- K
                             (VWIN32_Int41Dispatch). ~. {  R1 u" C0 \) H9 T' I
   call  Kernel32!ORD_001  ; VxdCall! Y0 @. Q* I+ n  _4 Y. r  ^1 q) i
   cmp   ax, 0f386h        ; magic number returned by system debuggers) m  `! ~1 x8 k' z( k6 ]
   jz    SoftICE_detected( F! {  F4 l  S! P9 L1 F- b% ?  c
' b' U2 s8 P, S% J- `# D
Here again, several ways to detect it:
5 ^6 c! R3 y4 C& [+ X- @3 T$ c( P* _. r0 X& ]+ C7 g2 D
    BPINT 41 if ax==4f
. y$ t( h7 ?- q
3 f! {8 M# s. n3 Z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 t/ P0 J( D" r
5 |4 \/ y5 F7 h& n    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 j, l% f; z. a; X, m5 d& s
( Y7 u5 e: }* p    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& `/ J0 g5 q0 z+ J0 e+ ^. ~$ H

/ l0 \' E; j( `$ Q" x9 U& v__________________________________________________________________________# @- U( G+ s6 k% E

9 r! G+ {& Y6 CMethod 13
! ]; E9 Y! k$ W. |# d& u3 ?9 m5 F+ f=========5 B, N  Q$ R* `5 R' L2 @/ `" P
/ N7 G0 `& S* j
Not a real method of detection, but a good way to know if SoftICE is
) k$ D# X- I, V: i4 F% Z+ d: Vinstalled on a computer and to locate its installation directory.
0 u' L" \& T3 e2 I' ?' X% R  |1 M5 LIt is used by few softs which access the following registry keys (usually #2) :. D- |$ I, J0 _' g/ a

4 v+ s4 ]  v. K% n( T-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' M3 `) D  k$ e8 e
\Uninstall\SoftICE
: @+ Z  v2 E' ~-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
  f: t, u2 d$ |9 j3 @( ]-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  \4 f, J1 {6 g. J% D0 I& Z\App Paths\Loader32.Exe2 G& Y. ^8 F/ l9 ~, Q3 k
$ f1 y6 t6 Z$ v. v- s5 \

0 P; Q: [4 P+ o/ O  }Note that some nasty apps could then erase all files from SoftICE directory6 L4 x  g/ Q' j* q2 u! @
(I faced that once :-(9 r$ @+ l8 H6 }3 i% ^
4 t& S3 _8 C# p7 B: ~* o
Useful breakpoint to detect it:! G& X2 X. ^9 M1 ~: T* F
, G% H- N# l7 G6 ]' {6 R6 T
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 X6 p7 Q9 G5 ^6 h; ^8 d2 \8 _' X5 w# L  W' F
__________________________________________________________________________
2 J' N8 s! l. L  ~, n0 f9 t# W; y& A4 f% r
% N, y1 U3 U# A# }' X4 I
Method 14
8 t" l5 @6 I1 e# l/ L  D' ?=========
4 k0 O1 G- R/ \
5 c8 A$ P$ U9 tA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
1 ~$ _5 R7 t) o7 r" \is to determines whether a debugger is running on your system (ring0 only).2 M# E6 Q# A9 M
6 @0 E$ j/ u+ x$ i6 G9 D
   VMMCall Test_Debug_Installed
- `0 i2 O$ h- p   je      not_installed5 i' ^/ {# L8 }# ^
; T+ w2 n7 w$ G. F* Z' z5 ]
This service just checks a flag.
/ V9 p, K$ T( V/ A+ w+ _5 R, s</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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