About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>! n; k! ?+ r# ~2 j
<TBODY>
8 v$ D3 |1 k1 P2 J3 d, R<TR>
4 Z8 e" Z* S' _6 \# U<TD><PRE>Method 01
3 i3 P4 h) |; q=========! L" g2 t# ~! o  A; O- F
6 ?& m  M' g) @3 {& ?1 C
This method of detection of SoftICE (as well as the following one) is
$ @$ f5 i3 T+ u( O1 N. G6 ~* S% Pused by the majority of packers/encryptors found on Internet.2 a% c1 x2 \: W
It seeks the signature of BoundsChecker in SoftICE
6 G- Z5 X% f3 {2 E) K
; @" v  q7 C6 o1 t. q    mov     ebp, 04243484Bh        ; 'BCHK'+ [" C; [5 @+ Q6 F9 O, d$ ~# E  I
    mov     ax, 04h
- y4 O% \  S+ A" T    int     3       * r! m0 R6 }! [) j& p
    cmp     al,4- _! r, p: h  g/ x
    jnz     SoftICE_Detected
7 q! q' L: k5 ~8 @. ?+ s$ D& Y5 c# B, G" l' {4 C, l, @+ Z
___________________________________________________________________________7 [  L8 z, o2 p$ y6 Z

4 h6 B7 C0 J) G1 WMethod 02
0 L9 p4 n- }. `) t  i; T9 d=========
" W0 b3 S9 i( A! n- e) C
  x3 F2 J' r( j* {Still a method very much used (perhaps the most frequent one).  It is used* o9 u# V) a7 C& ?9 P: c: |
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
' Y3 }% K: m* W& P7 Kor execute SoftICE commands...
0 J* o4 E: s! R2 z9 f5 c1 e$ x, v  ]It is also used to crash SoftICE and to force it to execute any commands
8 K: x! h& Y6 G) X# ?( V(HBOOT...) :-((  
4 I: ]+ q. M* B$ S& u/ R' f6 K0 [1 O& y5 J" R0 a
Here is a quick description:
/ d; d6 X$ R6 R9 `-AX = 0910h   (Display string in SIce windows)
, |) Q- P# ^' d-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 L5 W3 p, S# R  F- S: k1 G-AX = 0912h   (Get breakpoint infos)# @- Q: s7 s9 K% c
-AX = 0913h   (Set Sice breakpoints)
: D# X  Q1 [7 ^' c2 _-AX = 0914h   (Remove SIce breakoints)
  i) w) T2 }1 e% z5 D/ w8 e8 T, t
Each time you'll meet this trick, you'll see:1 ^$ F6 a1 q8 ?* K1 F* g) g# |; ~
-SI = 4647h+ C+ V  N! u. Q: B% ~2 }% d
-DI = 4A4Dh
% ?# s8 Z5 v( n) C* v+ \Which are the 'magic values' used by SoftIce.) P, p+ R( c: T/ S
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: k; F+ i+ b3 S. G8 v9 |* f3 t
- P4 [. T7 P  V: B3 d8 mHere is one example from the file "Haspinst.exe" which is the dongle HASP
! ]. z: p( z$ j! b$ VEnvelope utility use to protect DOS applications:
+ s" X0 F  `; e
0 S8 E: ?! U! b, a6 Z9 u
6 f) k8 o& k# I" W  Q% a" q4C19:0095   MOV    AX,0911  ; execute command.' c. |: `+ D+ D1 f: L* }0 o
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. f: X; u2 Y; E8 f4 I- L, N% a4C19:009A   MOV    SI,4647  ; 1st magic value./ w2 I) @6 a  m  [0 m$ Y: I
4C19:009D   MOV    DI,4A4D  ; 2nd magic value., @) }( w4 @2 S8 p. E
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 J5 b3 J* W: N0 {5 a* z! b
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! V& C5 N+ }4 E' I2 q0 P4C19:00A4   INC    CX
! R2 [1 m4 a' |4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( j0 }. h' a% C/ e0 \) X
4C19:00A8   JB     0095     ; 6 different commands.
( p8 Z* l( g+ {, T. K, z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
2 J. S& R) m5 q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, n" B7 e6 A1 i
6 D, `" t9 D+ v; ?9 _1 Y9 DThe program will execute 6 different SIce commands located at ds:dx, which$ Y. B0 Y8 t/ B  F+ {3 `# q
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. v3 l- E9 B' k; j* U' G9 d) P; y
* g  E& v- m6 x8 N5 r
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 Z# t! P- V& `: |+ G9 D0 e: e
___________________________________________________________________________
/ j. U9 A8 I) [7 Z: H& F
4 w1 G5 w( d/ u( [6 w& [6 z: T* Y  w8 |  S' F
Method 037 P4 e: q9 T5 b( S
=========- b$ I1 Q, _" }$ N7 H; p/ D, I

6 E7 x/ S7 R) sLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 u1 V7 y+ ~7 V) J
(API Get entry point)
$ ^+ c2 @. P' G6 H, R: M2 c' X$ C        ; _6 R* Z4 y0 B+ B7 R
/ D3 S( E9 }* i! }4 ]
    xor     di,di
$ f5 \2 M6 s, p3 w    mov     es,di
; z$ ^0 `: b8 Z- ]- M# D1 D7 i) `    mov     ax, 1684h      
0 T% S& `9 L3 U2 `! ?    mov     bx, 0202h       ; VxD ID of winice7 ^  {( f: n' r
    int     2Fh  B/ C/ g0 E5 R1 x* X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- V, O, p9 |4 w7 Y/ E' U    add     ax, di
5 F+ g6 }# y! U* f& U    test    ax,ax
" k9 X$ U8 X4 @- |8 K, j, h- ]    jnz     SoftICE_Detected
& ^" c$ ?' s6 n5 n0 i& K" v# a1 T0 p6 u6 G9 \7 \
___________________________________________________________________________7 z* Y# n# m* ]

0 t  b7 M" j) g. |' r5 k$ |Method 04
0 s; s- K+ x& \4 [7 C=========! Y4 P! a4 d7 J/ y
- W( V2 M4 ]% h1 k, N
Method identical to the preceding one except that it seeks the ID of SoftICE
, p) X  K8 t/ w1 Y8 kGFX VxD.
2 s# L7 N9 h6 n3 E1 }" _1 c. E' a; t( d. w) f
    xor     di,di; x- R  e! C$ Y: o% N$ z
    mov     es,di; H( U4 f' K, B5 ^
    mov     ax, 1684h       , B' x2 h3 m- ?9 T, s6 ~1 m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 b( p& Z$ A, D    int     2fh
! T7 ?0 i) z* u" k, h    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 H$ v0 h( p" {; X, q$ @5 j    add     ax, di
  X- N4 [0 P; z6 J, C. H; Q- `6 T    test    ax,ax
& t1 U6 @: G2 H. ~  {) j    jnz     SoftICE_Detected' P& C% G9 y' A6 Y8 m

9 h& D6 L- `' J" @5 G7 d% a__________________________________________________________________________
! N  O, X* \8 K0 X: b; N
. y0 [! h7 o, S4 K
7 _8 S( f1 A/ B# J) u; O1 VMethod 05
. v/ ~7 }" y9 y, [7 @( A& t=========6 {& R# Q# I7 u) b1 X- G
8 v* m2 ]6 o4 m: _
Method seeking the 'magic number' 0F386h returned (in ax) by all system& |: c- R: v. I9 K2 t2 y9 M
debugger. It calls the int 41h, function 4Fh.
; S5 j: T! [& L3 A( qThere are several alternatives.  
! [% i7 `; k, Z) g" `
! D" a  Z& J* V1 S+ j( y$ a% T5 tThe following one is the simplest:
* ?! \, }9 j7 B+ V; }4 _; Z+ A, f: M7 ~: r9 v
    mov     ax,4fh
$ G, l, c0 O6 h" H$ ~/ J+ ^2 Y7 ^! R    int     41h
3 A- F  L6 K) z# `1 h    cmp     ax, 0F386
: N  f* k" z" J$ |) E    jz      SoftICE_detected+ h3 p& f: ^% z, }# H% G$ y5 F$ V% l& Z
; J/ H8 `& I* P4 x( g3 Z3 i

* b7 Q" _8 E( k2 mNext method as well as the following one are 2 examples from Stone's ) N. O& z, h2 P% m
"stn-wid.zip" (www.cracking.net):/ Z3 s# y- E! \4 s/ J. i
% C$ _; v! Y* R2 F- p
    mov     bx, cs0 w& F' \  j% w% D: }
    lea     dx, int41handler26 M2 R- D% p3 w4 D6 J9 e+ Z" E
    xchg    dx, es:[41h*4]0 g; M  r5 r" ^+ P. a0 k
    xchg    bx, es:[41h*4+2]
6 c) l# L6 G1 P' a    mov     ax,4fh
) G1 ~0 a( h  j" u- T9 V7 i    int     41h' G7 ^, e* w0 H
    xchg    dx, es:[41h*4]
, R! x( D, w" W; v; O    xchg    bx, es:[41h*4+2]
0 a; H8 E* ]2 ^    cmp     ax, 0f386h
; _- X/ F% Q. r% D7 a2 m    jz      SoftICE_detected
; Q, T! V4 w; V. e1 L& i
  L  W: t3 q' n, pint41handler2 PROC$ i4 R( M) `- g  I$ ?* m
    iret
4 p+ L* i! t& G, T( U1 ^- rint41handler2 ENDP' Y( w( N9 l" ?2 m
# _( Q5 w6 O# [9 F

7 B+ l: E9 T3 N0 _9 {_________________________________________________________________________6 h" P: e: j1 D' K! C5 t/ J

' c" [- I$ @. n4 P/ }" Y) Y: D9 u" W1 r
Method 06
7 P5 K/ g& N# i" A8 {$ L7 ?! h=========) H' I, u$ E7 G8 y) Y5 o
# P. X6 n. y3 z; b* u
4 a$ V. p- I7 [, k- j
2nd method similar to the preceding one but more difficult to detect:3 a0 I% `) p" r! h) Q* ^

& @5 Q) H8 O$ L# v% q3 `9 B3 Z! b
$ V4 Q! S3 g& ~; n6 f" |- Oint41handler PROC: g9 ]  k, t5 ^, @
    mov     cl,al6 ]0 i7 w# [$ ]5 s( g5 n0 l/ r3 v
    iret6 s9 W& C& A* ^" f
int41handler ENDP
8 t% ?; ~) C$ ^+ Q0 P. B6 ]: ?
. i7 e( H/ `1 w3 C
& z# p0 O' t4 L, c7 B    xor     ax,ax, r) A& }5 C: u, `1 }. ~# H
    mov     es,ax
1 v: v* q9 S" E    mov     bx, cs
' u: B2 e/ a+ X) a5 C& d0 v    lea     dx, int41handler! E% _( P3 R5 W
    xchg    dx, es:[41h*4]
  w1 g8 n9 {! [) p" \# n    xchg    bx, es:[41h*4+2]
7 Q! d# x5 E2 K& _; V: o$ j9 d    in      al, 40h& u) e; R/ N* c1 t5 K) P! N, D
    xor     cx,cx" y% g0 T8 V5 X# |& L) C, b
    int     41h5 G8 E0 O! O, N$ _# X( |$ s, C& k# H# `
    xchg    dx, es:[41h*4]
6 R! F1 P6 |' [    xchg    bx, es:[41h*4+2], F1 i: A* H3 j
    cmp     cl,al+ N( k3 ]; D% m/ |' O* g% J" r
    jnz     SoftICE_detected. P7 n- v8 W' C  n6 Q; a4 V
8 u  M- {  o2 \6 T" s
_________________________________________________________________________7 g& ]( o$ `0 _6 u

0 m1 ^( T! b) P0 C! I, j# x1 Q7 X/ WMethod 07
/ D+ }) }4 [! `=========: L1 k5 L$ h) L3 `8 j

! H7 \# j6 N/ \1 W- ~Method of detection of the WinICE handler in the int68h (V86)6 _' \% L) y) G) ^; X% `' @
! Z2 W/ X* H8 N" f0 p7 S( s" |  c& r1 t
    mov     ah,43h6 y8 w+ d' D  k9 H. ^: ^: O
    int     68h
+ _8 C1 h% c& _5 B" J    cmp     ax,0F386h+ H! z* `3 u& X0 r1 x8 {
    jz      SoftICE_Detected
; s' M# E% A/ R& o) A: Q) X: s/ u6 _& M% a" K

5 j6 t' C4 C# r0 b7 N* j8 J; G( l=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# Y' O1 D2 J$ ^* O9 t3 M   app like this:
( w1 V0 w0 U. O7 y5 |' O. o) p2 J: ?5 i2 g' h6 L! i7 t  q5 B8 m
   BPX exec_int if ax==68# ]( j! H. H4 l( _6 x8 H0 z
   (function called is located at byte ptr [ebp+1Dh] and client eip is3 q9 c5 L: k3 ^1 ~
   located at [ebp+48h] for 32Bit apps)1 D8 [) Y% ^! S& m0 D
__________________________________________________________________________
1 N0 Q2 N7 R2 U
" x! R) F" ]8 |% @- L) T
2 a; ^7 F2 _/ uMethod 088 s! X& R* W& ]7 r; t1 f( S
=========
' [; Q7 I5 t% B! W1 t
6 ?  u8 n) Z4 O7 R  `. Y! aIt is not a method of detection of SoftICE but a possibility to crash the* b$ l/ j9 k& W4 c+ F. s# Z5 T5 p
system by intercepting int 01h and int 03h and redirecting them to another5 D) b6 l( _# A' `0 P6 Y- J
routine.
0 i* s0 f8 R+ J9 c( i# NIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( M: v/ c/ ~- O
to the new routine to execute (hangs computer...)
! P5 \& y  q+ d0 Q5 A6 @/ D7 O+ n# n, ~: b$ B6 P0 a, y
    mov     ah, 25h
9 Q: i' \6 {- T    mov     al, Int_Number (01h or 03h)$ K+ i# b5 X, v; u2 [
    mov     dx, offset New_Int_Routine
; S; N% l* v0 o* W0 g$ b    int     21h
9 p. f3 C% p; v; _- E
1 v" C# Z$ I. ^$ r1 H2 R4 V3 `__________________________________________________________________________  K1 x% m: f4 p$ j- C+ @, N4 C

) r3 q- h+ s+ W/ D- F1 @+ hMethod 09
) g/ B+ ?# z: V% z=========% {; x* X% ?2 g1 [# Z; E

$ C% ]; \) d; p" h# kThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% c% f9 K4 m* Q) ?) U  ~1 O: @performed in ring0 (VxD or a ring3 app using the VxdCall).' }% T5 N  L+ G, K
The Get_DDB service is used to determine whether or not a VxD is installed
! r* S2 Q# C4 e0 Y# w* ]) J! Hfor the specified device and returns a Device Description Block (in ecx) for
0 G; U9 x) Y7 b4 }( b$ C" ^that device if it is installed.
8 J, l; n' f. D6 Z# E
  z  [2 `& G. ^8 N   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. [9 a, d7 A1 t2 ~6 @/ b
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" `3 M0 {/ C, H& @. d0 |2 Y
   VMMCall Get_DDB3 W7 C; H+ \" Y# g5 Y9 v, n
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 U  d5 p' T, M$ M) _' V  X1 z/ d. l1 @- [5 u* w2 P8 B
Note as well that you can easily detect this method with SoftICE:
" o* c' K( \: Y* [$ O   bpx Get_DDB if ax==0202 || ax==7a5fh
) J3 {6 y+ r' u
8 T3 q) f* W: {* L6 ^5 G__________________________________________________________________________! \+ H4 p- B: b0 x( f+ ]( _
6 y) P4 [; ^( T' i7 ^2 Q- @
Method 10
, ?" q  M+ S5 T) o+ p7 s=========
7 b9 z0 V% L0 y. s: L* P. E$ S/ P8 Q6 M9 A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 s* n5 K! k, Y$ o+ c/ {) u" v7 T
  SoftICE while the option is enable!!+ |1 [; v* N+ @- U

/ s: n; W4 i( l' ^7 r' ]0 LThis trick is very efficient:  K; P4 `; p2 R
by checking the Debug Registers, you can detect if SoftICE is loaded! G, b: V0 q5 C% E* ^
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& g. a3 i! X+ H
there are some memory breakpoints set (dr0 to dr3) simply by reading their! I% q3 F. J( X1 M, f9 z1 S
value (in ring0 only). Values can be manipulated and or changed as well( A+ M9 \* O: p. F" A8 f. g
(clearing BPMs for instance)# g( s: k3 f, c' f, F

6 a6 M, v4 u' `: f/ l& }2 s__________________________________________________________________________) L! Y3 p/ X- [3 F- ^) [0 x

2 P, p1 G8 s- O/ M4 XMethod 117 f; B' q; h1 f
=========
" l: a( H3 x) [8 C, E" k( h6 d4 K' q9 y" g+ `
This method is most known as 'MeltICE' because it has been freely distributed
; R8 g  D4 H! Vvia www.winfiles.com. However it was first used by NuMega people to allow  I8 |7 Z( B! }- U
Symbol Loader to check if SoftICE was active or not (the code is located- ^! n  W" V' |! ^- w$ D
inside nmtrans.dll).
8 ^+ _0 v( F$ p" D  Z4 V8 u. A* v2 o9 |. Q/ l4 o
The way it works is very simple:
! a* \8 q! a' V7 Y( bIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 U+ e) T+ d1 K" g0 P4 b
WinNT) with the CreateFileA API.
: G' L3 b# I# d! q0 @" N+ i! g7 {0 M
Here is a sample (checking for 'SICE'):' O- {" G2 \) O6 C+ f7 B

" ~7 |  a7 g5 Q# IBOOL IsSoftIce95Loaded()
+ Q/ c) ~! |! Z7 D{
; y  }) T8 i7 g0 a   HANDLE hFile;  
) i: a) l4 @6 @, I5 S$ J/ @+ ?   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* c6 E$ r8 r. ?
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) l) q& A5 m5 K- M; i
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);6 B4 y& ^7 c' z
   if( hFile != INVALID_HANDLE_VALUE )
( y2 a" k8 t( T3 d( Z% T4 N   {
% Q6 ~  B' X/ x+ a      CloseHandle(hFile);4 C, N+ ~5 B' V& w
      return TRUE;
/ H1 X8 F1 P, f' E   }6 a0 o4 t2 B! ^' l
   return FALSE;
7 P4 e0 `( I( Q0 n8 z( z}
1 a4 P1 p' M# v) [$ I4 i* Q: F1 V& e7 V. E& o
Although this trick calls the CreateFileA function, don't even expect to be
8 m/ J% t4 i7 O( J+ y* ~able to intercept it by installing a IFS hook: it will not work, no way!
8 U2 i( }% k8 [, BIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
) ]) ^- M9 L2 C, gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 ~- d7 u4 t& @. u5 o
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
* ~0 E& s( U% U6 X# N1 mfield.
+ D, r" R% ?9 h  y. \2 o, kIn fact, its purpose is not to load/unload VxDs but only to send a 4 T1 c9 g; I- S  X8 I" X
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' a0 x2 v0 C7 l/ Y: y- ^0 y  m
to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ c; {2 v0 L5 }# V3 n. {7 N# K
to load/unload a non-dynamically loadable driver such as SoftICE ;-).5 D5 d% @9 Z. g; ?
If the VxD is loaded, it will always clear eax and the Carry flag to allow* w( n4 Q7 t3 r" C
its handle to be opened and then, will be detected.! c& ]$ _8 r+ l/ ^% E
You can check that simply by hooking Winice.exe control proc entry point3 D8 U. Q  p: T' Y: B8 Q
while running MeltICE.$ U1 k: _( \/ U( m- C9 x
" F" X; v. w/ }# r6 Y

/ k$ a& u5 P+ G1 N" d  00401067:  push      00402025    ; \\.\SICE, {  Y* t( j; ^7 k
  0040106C:  call      CreateFileA
) x3 r. [& m8 g6 _5 `6 }  00401071:  cmp       eax,-001
7 _% f8 f+ y8 P6 ~3 Z3 S  00401074:  je        00401091
, F( ~$ o- n4 D; r* L
" c' v0 ^' _+ p" ?, S) K
( c: m- H# d3 IThere could be hundreds of BPX you could use to detect this trick.
6 C1 U! z( c  U! B-The most classical one is:- S) x& E' B& `
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; Z) k  l# r) i
    *(esp-&gt;4+4)=='NTIC'- f; S2 b1 w) w
' H5 y) b; J& R' k9 k- y/ r
-The most exotic ones (could be very slooooow :-(
" \0 Z+ V/ q2 i6 b; q   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
. c" o6 E0 n6 y3 l6 y     ;will break 3 times :-(, X# ~7 i" n. g- |+ j- W: l

! T& e, S+ p5 ^8 Q9 W-or (a bit) faster: * S/ }. u; w% I: t* q5 r5 x
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" R4 C4 r4 L* s$ `8 y- G, o3 K: G

! t+ D  b9 |3 I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 J/ v) T: E0 `; m9 F  F" B% l     ;will break 3 times :-(
5 ~( L5 }7 B( O4 G, W" H/ }- _3 `5 K" ~% d
-Much faster:
; y$ Z* |2 m9 S$ ~; V   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; X; M; u5 v9 K" W5 ?; I+ @' W# g, W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 K1 P5 ]# v. H9 y/ Tfunction to do the same job:
" y" s  ^3 p- v0 T& W7 z% [: b/ @9 P0 k
   push    00                        ; OF_READ1 y0 w4 u5 l( X
   mov     eax,[00656634]            ; '\\.\SICE',0! f- A% r7 F* L9 W* _3 g7 m9 t
   push    eax- C3 B+ R/ m6 f' \0 S, O
   call    KERNEL32!_lopen
! B0 D3 p: e8 V' l* j   inc     eax! R' ^8 i5 R9 Q3 u) h, U" D
   jnz     00650589                  ; detected
0 ^1 z1 Z( ]$ }% D: v! e. T* I   push    00                        ; OF_READ
3 `% U! G1 v. z. q   mov     eax,[00656638]            ; '\\.\SICE'2 c% j: N. c4 I$ E! @6 L
   push    eax
6 {3 q$ k" V7 s/ h) H! _   call    KERNEL32!_lopen
8 x- r+ l! n/ g* e) ?8 ~1 e   inc     eax
% ]/ ~) \. |. d8 `6 R4 z   jz      006505ae                  ; not detected: H$ n& o5 ?, x1 t. m' a6 ~; ]
* w5 W1 [" }% ~

* J  b- O% u" o__________________________________________________________________________- Y3 b( K( \1 J4 K
+ ^0 X' \9 W5 O3 @, q
Method 12- l  }% X: Y8 O! y: n6 d
=========5 ^" t2 P( Q8 n4 @& ]7 l* T

( m2 n! h' }  z' ]This trick is similar to int41h/4fh Debugger installation check (code 05
  t0 l# Q" C& H& Y% y# u, ]&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. z& w. J- U1 J' t4 a/ Uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) j, ^/ a( Z# p7 H: F1 [% l
: ~# K0 ^8 g# {$ K3 H% [   push  0000004fh         ; function 4fh8 R& a5 G6 f0 v6 ?6 U4 w
   push  002a002ah         ; high word specifies which VxD (VWIN32)+ }5 G/ X$ V! p# ?8 X$ j( y9 g4 X9 p
                           ; low word specifies which service
1 f1 D( D. S. W7 x                             (VWIN32_Int41Dispatch)
9 T; w1 l  I. H) `/ c- p: p4 c3 B   call  Kernel32!ORD_001  ; VxdCall+ ?. r2 I9 H/ y- P/ G) p% ?- Q
   cmp   ax, 0f386h        ; magic number returned by system debuggers% y5 M0 o9 _7 G
   jz    SoftICE_detected
+ s7 t' w" H/ b& p0 y  o0 |; P, M3 k' e6 f
Here again, several ways to detect it:) k3 `& f# k: e; k) J4 [

# \9 F7 }* }, g! y# W: m  V2 S3 m    BPINT 41 if ax==4f
7 s6 P! k7 P+ f. C# q
# ~& R1 g5 D! @& w, c    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" I: X5 {1 D$ l* l& s3 o+ L' q2 N2 K& q3 d. ~% A( P
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: \/ X$ Q! q8 u0 l9 n

/ Q- a2 U/ x4 O* p; f    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 l* v: e# s2 o

; O- u& Z" i1 z+ E__________________________________________________________________________
# I# F$ r$ k/ G& h- {$ ~" T2 E
6 j. b0 V# R6 D. oMethod 13' F& l9 |  m3 D9 M; F2 ^
=========% }/ o' a2 J# D' w/ U8 g2 @

2 B9 N5 V5 v4 hNot a real method of detection, but a good way to know if SoftICE is) j1 c/ F$ @  v
installed on a computer and to locate its installation directory.; o) V4 U- v; Q0 f
It is used by few softs which access the following registry keys (usually #2) :
9 w8 G$ o* h9 G1 O0 [( M% N6 w6 h4 T8 |" ~' Q
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 {( ]. J0 U0 L. W, m\Uninstall\SoftICE1 F4 @) T, x2 W7 @# f- T  s
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. W/ E% H0 r! V: d# x-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 G& i3 v  W6 R\App Paths\Loader32.Exe
# \* D# T: |5 q  D5 z* T: c, q6 K. J) a' i- H
  I5 y# v2 G3 N' ~* ^
Note that some nasty apps could then erase all files from SoftICE directory. s+ a7 K/ J6 I0 W
(I faced that once :-(+ @+ c+ E3 n; d. X8 j  y* ]7 f
8 }; W3 d: T  B  t3 C8 C) N: i" F
Useful breakpoint to detect it:5 E" m( E# m* O
4 b& z. h, j" f) O5 c
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 N9 P5 U0 j3 D' c" r7 y$ t) b+ m' v: `1 M# L
__________________________________________________________________________
, N9 t/ T8 [8 C) r* q
; H# v4 S+ Q9 f7 Q- K* Q8 F! O4 }1 N5 I4 m  N
Method 14 4 T3 ]& l# W1 k& q
=========% l3 M) E3 b& U6 z
4 _9 [* i+ F5 o% {- I
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 ?2 R# a: v4 [; {
is to determines whether a debugger is running on your system (ring0 only).
( z" {- j( H; b, {" p1 L( Q, N/ [# c
   VMMCall Test_Debug_Installed$ {- ?' D' m# S' f$ I4 r
   je      not_installed1 c# H, M4 x  ^( j

& y+ h7 X  Y; `1 f) p8 PThis service just checks a flag.
1 i9 X# j* f' \# P) |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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