找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' W/ M4 T" W( J" U" f6 J: m
<TBODY>
# h/ W# e  {: V" q! ^<TR>, E5 Q: B- R% i7 m3 a  y
<TD><PRE>Method 01 / c. J6 u5 L! W3 ?3 k3 J$ I3 Q
=========% @  M& O# v2 }: n
; Q& m3 E. V$ n9 x" a/ g' D9 p
This method of detection of SoftICE (as well as the following one) is! r. s  m; O5 H9 i9 \% Q- u
used by the majority of packers/encryptors found on Internet.  }8 u+ A1 b2 m" H0 ^
It seeks the signature of BoundsChecker in SoftICE. E7 H( W+ G( D( s* r  K
% A  H2 M( [8 E3 Z8 H
    mov     ebp, 04243484Bh        ; 'BCHK'5 K9 Q/ a! C) E
    mov     ax, 04h! s2 K  d& ~& b: F. d& e
    int     3       ) _' S: b. ]1 X
    cmp     al,43 O; V; K! }1 D, F3 I" ~4 a4 E
    jnz     SoftICE_Detected2 N5 n- g6 y% ]& P' Y

9 c9 [. f) u0 c1 q6 R___________________________________________________________________________
$ V3 G3 X( L/ Q( q$ r
3 m  D0 u% e" ^  V) u7 @3 g6 AMethod 02
% F* I7 N  J% c  a) Z0 y. s=========2 b! l+ s, K$ C- X1 O/ x

2 r+ V) p) u( G' K) NStill a method very much used (perhaps the most frequent one).  It is used% |* b0 y) ?1 @- J
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,) [7 W8 n# {# |: S* h6 K
or execute SoftICE commands...
8 ]" K% \0 p0 yIt is also used to crash SoftICE and to force it to execute any commands
/ V8 @. P, Z3 b# x2 I" ]5 \(HBOOT...) :-((  
6 g( ^+ H8 C# F7 m) b& o. U% p: Y5 D2 ^0 M" O/ g
Here is a quick description:
; E3 W7 K7 ]0 a' B& z( [-AX = 0910h   (Display string in SIce windows)% O8 k# p- Q5 G9 F
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% H1 f" w  W- |
-AX = 0912h   (Get breakpoint infos)
+ p3 h7 v* l$ z3 }-AX = 0913h   (Set Sice breakpoints)
7 k7 @" O# w6 t& @- z-AX = 0914h   (Remove SIce breakoints)3 p5 u4 L: V9 ]% `' p& `) n

* w. s- K* p1 \( ~, QEach time you'll meet this trick, you'll see:
5 l0 ~9 f7 }8 `-SI = 4647h* E8 L& ~. C/ g. X
-DI = 4A4Dh. A4 ~: m* k7 p# u0 ^3 h
Which are the 'magic values' used by SoftIce.9 |, `% @# i7 k" Y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.) I/ X8 x; Z4 d( o
. F9 h. f6 f. |; y
Here is one example from the file "Haspinst.exe" which is the dongle HASP
1 \% Z# L( r- Z5 {Envelope utility use to protect DOS applications:
1 Q# z6 C3 C( |; j3 @0 @3 D3 {: N* p) C( b
, [6 |; t4 O8 |& }9 G% [7 G! g+ h) F; V
4C19:0095   MOV    AX,0911  ; execute command.
% w- _' Q" C& Y/ ~6 T0 @& z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 k% p( e* f3 I( Q1 g& ]; l7 P* S/ L
4C19:009A   MOV    SI,4647  ; 1st magic value.  S$ o" ^6 l: b5 l6 l
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  @- m, w' i: ?2 g4 V4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
( ~8 G* x! |6 Z8 @7 R1 s. ^/ }5 T4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
6 P0 n1 s- v% `  ~4 V4C19:00A4   INC    CX
# I, A' I' [9 d" I5 a: F4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 H# Q: j5 w5 Q( V  [2 o+ f4C19:00A8   JB     0095     ; 6 different commands.! c, V# x/ m" d; E" o& }  V* f1 t
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 Y, I7 K2 J: M6 E
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), O3 ~! X( ^/ A+ \% n  g( f
2 q, F/ \' y) x+ A- `5 K+ c* z* b
The program will execute 6 different SIce commands located at ds:dx, which: z) J# v* }+ A- f# m2 |6 k
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 R2 S" m" H; P& E0 H% V

6 Q/ J1 T$ R8 M$ s* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' M7 k9 j  S+ `8 z& z4 r' n___________________________________________________________________________; z  |  k3 ]; o2 R& m. W
: H% W* O: N$ H/ b$ j
6 A/ V  K9 h% Z& M0 {
Method 03
$ B! b3 c7 @) v3 p& p; l. z( q5 f=========2 T& J. n# g2 Z! ]' _: z- E/ X. i5 T

$ S" A& w+ p3 h1 B) BLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h# o4 `0 n; q9 f0 C  T- J4 w; ^
(API Get entry point)' M+ a' x) _9 g$ j* \
        
$ T. y; ~- H+ r2 e
1 ~8 h- m) t4 C7 f$ [) d- i    xor     di,di
( D: a3 U) W) n$ B- k0 b$ N    mov     es,di
7 V  X3 h; Q9 _2 Y2 S5 v+ r" o    mov     ax, 1684h      
8 k- V+ L) y7 Y! ?) s" S7 n* d    mov     bx, 0202h       ; VxD ID of winice9 g4 _2 Y: j3 U( C% f+ m* o
    int     2Fh
7 t, B0 h; g6 u$ g; g" N. O# H    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 p- {, A6 ~' \- U. a  o
    add     ax, di
1 f5 s& g8 K; A& p5 i* Y    test    ax,ax
) n% |6 f  n6 p( c# x    jnz     SoftICE_Detected6 `: s9 f) z7 T" S
0 _8 c5 O7 _& @/ m
___________________________________________________________________________- C4 \4 \* U7 ^5 K8 d

+ j7 p7 X* |0 B  p2 TMethod 04. `& {8 o% R* ]$ a) \7 j% \
=========6 @! t$ V' O: c! s; F2 w4 j* x

* {" @, {1 W& R: Z) a7 M8 A0 uMethod identical to the preceding one except that it seeks the ID of SoftICE! C! I/ m/ M# t% {0 z
GFX VxD.
- P3 O- @9 @6 A; x" N! ]
- ^6 c% A4 H6 {: D  o1 @8 [    xor     di,di1 U9 L) e5 c) L3 M" P9 r
    mov     es,di+ P' n* p6 z6 b+ x+ C
    mov     ax, 1684h       . D! K, Y/ d( ^; T& Y
    mov     bx, 7a5Fh       ; VxD ID of SIWVID3 F: {7 V: v2 w
    int     2fh
) m- r1 v& J; Q/ O  b0 r3 v    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% D8 T7 r& p9 _4 y7 T    add     ax, di/ h, t; ^9 D: U
    test    ax,ax
( l: Y9 t% `$ }' }5 V    jnz     SoftICE_Detected) Z% S" p2 [+ Y  a- ^5 S: v* l
0 y9 w3 q" m# b) D( I
__________________________________________________________________________
1 b9 h( m; [2 H2 [* Z" {$ M
, Z" H0 e" ~7 f8 F
7 V: C0 d9 u' [7 r7 B8 z1 MMethod 05
5 B5 x& P# M4 M9 A; W5 h7 E& ]' j# d=========
) e, w4 a8 h: d# k( ?! K- v! f
1 T  ?* `# k# a4 S3 VMethod seeking the 'magic number' 0F386h returned (in ax) by all system7 w1 R3 O+ c/ ~
debugger. It calls the int 41h, function 4Fh.7 N, _7 @. I3 W% b1 {' z: E
There are several alternatives.  8 S% ]6 T4 _; o. h* p+ C4 H6 z

6 ?+ F4 R! I' I1 tThe following one is the simplest:7 d/ |) `% P; i9 S

8 `- G; V1 g4 A& Y    mov     ax,4fh
% m5 U  O, |4 t( i4 I% q  C* x    int     41h1 Z8 M7 n' M& _& ?0 a
    cmp     ax, 0F386
+ Z9 z! r+ w7 F- }% R! n    jz      SoftICE_detected
3 `$ M( T) B7 D# Z3 a7 y# z5 y* p( L4 s# x
' o3 R* L" L0 Z1 j6 S/ z4 p- W
Next method as well as the following one are 2 examples from Stone's 7 x  m4 V+ l* h7 z
"stn-wid.zip" (www.cracking.net):
2 Z6 l( c8 v) |& N- q1 C4 m- ?8 w2 J- w
    mov     bx, cs
8 R  b. z: ^3 s8 x; g    lea     dx, int41handler2' V3 [( I2 |+ t6 h8 E/ h, z
    xchg    dx, es:[41h*4]
& @) e5 O: O& h' t2 Z+ n    xchg    bx, es:[41h*4+2]
$ E! M3 ^& ~# D3 ^# D    mov     ax,4fh6 [: O$ h  b: l1 A# L- y# D* \  X
    int     41h2 v+ P6 o2 b; e* C
    xchg    dx, es:[41h*4]9 q/ k7 |, c$ X
    xchg    bx, es:[41h*4+2]
' H8 Z/ o8 l' N- l4 w# z6 v    cmp     ax, 0f386h
2 Q+ [  K/ J+ b    jz      SoftICE_detected' p! @9 X5 G4 g! k

' P4 B& w6 Y2 Q2 r, Mint41handler2 PROC
  s2 ~; d* C* {# b# f' q! L9 a    iret( M& i1 N& z- Y3 M
int41handler2 ENDP) N2 r0 p; L3 w" U) e2 a

& \- h% Y, s  J0 y! x
, r5 u' N2 B" z. B0 q0 m_________________________________________________________________________7 T; g! ]9 H" T! B7 {( G' u  v

  r; @* E4 v8 t% Q; d
  s8 n7 c) L. i6 M) C6 O, tMethod 06
5 @0 E' y0 D# d8 Q3 C=========3 y6 I2 u$ H3 L2 d- i

$ z  ^+ Y' F+ g: G
& E' r" D+ S2 }+ a, Y- u2nd method similar to the preceding one but more difficult to detect:
: U% _7 y9 e  E# Z& r1 W! M% G+ e( y
$ n5 J  ]0 i5 T/ f3 `
! k% K: h) b: s6 V/ e8 _int41handler PROC
) j9 J" a  Z7 c* W3 l    mov     cl,al( |# [  S! j& [( L
    iret
1 n7 M( E! m+ H1 H* h( Wint41handler ENDP
* L" F$ l/ D. f6 h& h; C& i
3 f. K9 ?$ [" p6 K# L& A8 R0 }, @1 d
    xor     ax,ax3 j* Q- |( i( j5 w1 b! L, O8 l& z9 e
    mov     es,ax8 P$ h0 M3 d# P5 ~2 ]; P
    mov     bx, cs
8 Q' v* o$ E, e$ p# W/ a" Q    lea     dx, int41handler! A: I( J+ ~/ [* D5 K! W
    xchg    dx, es:[41h*4]
3 D9 C4 p6 u* \+ N& O. _    xchg    bx, es:[41h*4+2]
) [# y3 K! V; o' w6 U) f* h+ q    in      al, 40h
  V  M$ h% K+ r    xor     cx,cx9 G6 \$ j& P* Z- {: n: F9 |
    int     41h
! T. ~. X8 d6 [! c: \4 I4 F    xchg    dx, es:[41h*4]' f0 I- N$ C& i% A
    xchg    bx, es:[41h*4+2]
2 k- [9 w) \! g9 J( P    cmp     cl,al$ g7 Y0 ~9 x$ z
    jnz     SoftICE_detected; r4 H. `8 ?8 C0 A* n* m
# y& j# a, ^- T
_________________________________________________________________________+ P* H. _! v) V& O, l& p: l* w
  q! I' G1 x+ K; _
Method 07
6 V/ r6 v) j0 B! c, X# }=========! @( M: Z' F/ V5 t3 O1 @) H
3 D( u0 }5 Y; v) D& h. [
Method of detection of the WinICE handler in the int68h (V86). h; ~( |' ?& h4 E" l6 M& @
2 f2 k* `, d. }
    mov     ah,43h& K3 o& ^8 T$ C$ Z& o( O
    int     68h. n1 ]9 Z% x- p4 m8 O1 k
    cmp     ax,0F386h6 v; [- n2 y/ g8 C
    jz      SoftICE_Detected, ^7 k# C6 g/ j' T( P% @
6 J  j  e8 k/ Q7 O0 n

% u& g0 s! x. t0 R=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& E' t) i8 W- t/ r: T
   app like this:+ f( J1 p4 a: S* B/ p4 k# n' i
# t% \# v  }' C& _+ o+ P; Z: C
   BPX exec_int if ax==68
* X, W% r8 h; _1 ^4 Y" b   (function called is located at byte ptr [ebp+1Dh] and client eip is
" s, G8 H4 A. G% |( d   located at [ebp+48h] for 32Bit apps)
; ^5 J- L5 D  s+ r& x: O__________________________________________________________________________. Y/ N! X* ?5 z8 u: l+ @; y
4 s0 Y, t3 M: x- r# _
# K7 G. }/ P/ {9 E& o9 J7 G
Method 08
: M$ F. H7 f) {, E$ Z=========
- [4 J8 j( t  V2 n, ]& j
' M# A4 V* x; h/ iIt is not a method of detection of SoftICE but a possibility to crash the: e. S" w+ w- y' a) s8 x  X
system by intercepting int 01h and int 03h and redirecting them to another% v  \9 N7 k) ]& ^7 l0 h
routine.* u/ F$ s4 k+ ^5 ]' Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 u) P+ p6 O3 Y& y5 Oto the new routine to execute (hangs computer...)6 N7 s9 P5 `9 p6 U# P( k& d* o

4 g/ J2 o  k' h, b+ _    mov     ah, 25h+ @4 ]* F8 ~# d: X( `" A
    mov     al, Int_Number (01h or 03h)* M0 C. f8 z5 q; R  A& i# i! q5 U
    mov     dx, offset New_Int_Routine6 V- b0 J, M* v( x& Q5 H6 ^& q
    int     21h
; s. _- s' p5 V9 z. `6 i7 I9 Y% }$ e- B+ o% F6 k. ^# A4 X& w
__________________________________________________________________________
+ U3 X- e- [+ O; G! }* Q/ z$ e
: y7 `7 Z1 X9 r0 p) w% PMethod 09/ Y; b! [8 l2 @* H/ p/ L
=========
2 {( p1 S- W9 M7 D5 c3 [7 t
& L! ?( q/ m, rThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" E3 P, k- l' M* Z2 g# j
performed in ring0 (VxD or a ring3 app using the VxdCall).
" N3 E, r% S0 P! b" i/ g+ H8 B! c% oThe Get_DDB service is used to determine whether or not a VxD is installed
' M$ O. r/ ~4 h0 ofor the specified device and returns a Device Description Block (in ecx) for! \6 h: d3 k5 \
that device if it is installed.
. V/ p: o$ _+ r. I; X7 G. I4 }+ l6 `: @
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 o* r% T' K3 p1 Q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 ?" P) S" e  J9 a' S0 A
   VMMCall Get_DDB
9 V7 e: {1 k# q/ A/ ^- L   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 M! {5 z. D. F* X
8 T0 m/ W. T& \# ^" n
Note as well that you can easily detect this method with SoftICE:8 d' m! I, V2 }
   bpx Get_DDB if ax==0202 || ax==7a5fh
$ F: X) o" I  ~9 k! k& d
$ R- Z/ ^3 ?- S__________________________________________________________________________
( f7 k3 b. p/ ]. [  {4 y# T7 n7 z% U! \
Method 10; ]5 }# t) K; s9 |, I
=========
/ e4 H% |3 p8 O5 v' k0 b: j( N2 K
7 V3 P& S+ ?6 A& [& |=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) N2 j) m- X* l6 W0 A  SoftICE while the option is enable!!
9 g2 h. ?5 I% S5 n1 y! v7 G+ ^' Z4 z$ t) N+ J
This trick is very efficient:
$ C) `( u2 A# \% V; Lby checking the Debug Registers, you can detect if SoftICE is loaded
% X$ e8 z/ p! e* o  @(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' m, X7 M! X2 Y
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" W8 m) Q. v. a, {" Bvalue (in ring0 only). Values can be manipulated and or changed as well7 _; m" c. t' [' ^
(clearing BPMs for instance)
. l1 M( ~. J: e
1 ~8 g' y  G9 @- o: Z* K2 U$ K__________________________________________________________________________( q- @) v# f* y; N% L0 u# [0 r

1 j4 f: X$ G& s! D3 JMethod 115 [8 c" N9 H7 d# [% H
=========& Q# n7 L) @4 y
: d. h% L3 W. K4 U
This method is most known as 'MeltICE' because it has been freely distributed+ P3 i2 K) |; I% p; A
via www.winfiles.com. However it was first used by NuMega people to allow/ b0 {2 Z8 H  e7 |$ p0 u
Symbol Loader to check if SoftICE was active or not (the code is located* F3 E1 _& G- [6 X+ R/ I9 c$ j
inside nmtrans.dll).# O* y# s  N, T4 y- y

, G  G7 {8 L$ V5 V. p! VThe way it works is very simple:! ^6 S/ X+ y5 D- z2 [4 t5 g. D
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
3 Z$ P: g( Q9 ^6 p  A4 _) U0 t- b; KWinNT) with the CreateFileA API.
, }' X' Q9 u3 b( I
, O& Q: p0 B0 G& q! MHere is a sample (checking for 'SICE'):
2 Q2 |5 T. b1 J/ P) i% L- q8 L% Y: V
BOOL IsSoftIce95Loaded()
6 P, \3 q3 b( d2 H' y{! `0 b" Y7 ~# K6 ?% t
   HANDLE hFile;  
) f7 g! ]: m* E' v1 g   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  v8 j* L, B& G; {0 n5 E
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) l" s; d  D* W
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) d% y; t# v8 {  d
   if( hFile != INVALID_HANDLE_VALUE )& }2 A* e* D2 M  S- A
   {
: t; B! b* J8 l( F1 T- c      CloseHandle(hFile);; y  O7 k* {5 W$ s, N
      return TRUE;
& c$ V) B5 o3 D( Z   }
+ q9 V0 H0 b* q7 ]( X! }6 p# e   return FALSE;
! D2 _& n# w5 A0 `) @}
6 r) o% j* h5 Y& N
+ I- U* A. |# O) R& @4 L# ^Although this trick calls the CreateFileA function, don't even expect to be
4 k& h7 M% G8 A2 f, S, {! W+ g- vable to intercept it by installing a IFS hook: it will not work, no way!; @6 ?5 ^# `' O; E' m  W
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 N0 M4 N: P' N/ Aservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ i1 V: x* v1 L
and then browse the DDB list until it find the VxD and its DDB_Control_Proc) K: o" W2 I  \2 h3 h
field.( N5 |5 ~* M+ Y1 F0 f
In fact, its purpose is not to load/unload VxDs but only to send a 3 \8 D  N: a; d! f# m1 `
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' g6 ^! Y# X5 Rto the VxD Control_Dispatch proc (how the hell a shareware soft could try9 G4 X. B( R) E. U, u
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 Y# V/ n2 U! W- UIf the VxD is loaded, it will always clear eax and the Carry flag to allow' b6 ~# H# l! R: C5 T0 q) H
its handle to be opened and then, will be detected.
( E  x$ A$ \3 i; w7 `You can check that simply by hooking Winice.exe control proc entry point
; ~" F% K( G8 X7 J8 ~while running MeltICE.; R. j; }( u5 p$ @. Y- \

1 w- i3 R3 X; Y3 c2 P, U- @, ]3 A
  00401067:  push      00402025    ; \\.\SICE" c' @4 V" M: j
  0040106C:  call      CreateFileA4 O0 [6 d6 c$ T; U: }/ g# d' |
  00401071:  cmp       eax,-001
- [% Z1 v: A8 g9 G$ v$ e  00401074:  je        00401091
; j9 G: @2 w- X' t8 I6 |- p
  P3 ^3 E3 A3 _1 o+ a- z) A, P5 W! _1 p& ~0 L3 c2 p" `$ `% [
There could be hundreds of BPX you could use to detect this trick.0 o' v0 E7 s- C# _8 g% C$ O3 O7 b' o
-The most classical one is:" C' Y% F9 U9 ^7 a
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' L5 p8 M. `# x: \+ z
    *(esp-&gt;4+4)=='NTIC'
, b5 v4 H3 O) H2 N
2 A- w( Q; N: ?7 l1 w" n6 L-The most exotic ones (could be very slooooow :-(
$ U, O9 V# }+ C0 V2 w- ]# H   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 Q7 O( Z% ?* A/ j& x0 T$ l     ;will break 3 times :-() |9 \7 j# X; B$ _  `
/ o3 H, b! i, J; @# X
-or (a bit) faster: 0 Y1 z" Z9 b( G, K: I
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ n7 _+ X* J3 g8 R
# b8 L& ^% Y1 T' n; w7 b   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  * v2 ]2 r% U$ O) M
     ;will break 3 times :-(
0 X. v% E" M3 R# R- i* T
3 G/ K2 w. p: }3 n  K+ s-Much faster:# V( W: J6 A5 \' e
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# r% h: [9 B, p9 m) l) y$ X% ]5 K% _2 s, ~# \$ R
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 U! ^: R  V6 a' xfunction to do the same job:
; v$ r6 r2 L9 P" _$ B/ l8 L$ Q& H  C1 P9 m6 i
   push    00                        ; OF_READ* o9 ]6 x  X* o/ K8 Q+ z1 d
   mov     eax,[00656634]            ; '\\.\SICE',0
9 t$ s- K/ T; T   push    eax
- i* m- j2 W+ Y! Q+ G& |   call    KERNEL32!_lopen! w- a# }4 D% D1 s1 V
   inc     eax9 S0 S% |- H+ m3 d  s" J
   jnz     00650589                  ; detected
3 j3 O5 ^+ ?7 ?% o% T   push    00                        ; OF_READ9 W  k% ?  |3 R% z3 j3 Z, r
   mov     eax,[00656638]            ; '\\.\SICE'# C% E8 B; P' F, C! t' _' K
   push    eax: S$ u3 q/ \0 [; ^6 L* M* R  `- ]: Z
   call    KERNEL32!_lopen2 s8 U8 `8 @  U3 q- F# P
   inc     eax0 z3 P( S+ J: m! u) Z
   jz      006505ae                  ; not detected7 y% U, P6 E0 i; b  u
0 T1 Q3 G' I, j3 d+ L4 ^" N

* H, K1 s2 M' ]  [4 G" ?) ?__________________________________________________________________________
$ }1 D/ J. E! g- d7 a- P9 Z: T& e% K0 j  p
Method 12; o+ r4 \' h) A+ @
=========
, o/ a5 J1 I, I5 J# S$ M" [
: v5 E0 a' {8 ~1 `1 x7 r) x# }; wThis trick is similar to int41h/4fh Debugger installation check (code 05
, n. i9 [# ?2 n&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; Y6 c+ [( ?4 A# Q4 s, C; Mas it uses the VxDCall backdoor. This detection was found in Bleem Demo.  T5 `! o+ v8 G* r/ W

$ |, g2 H  a' `$ R1 B   push  0000004fh         ; function 4fh$ R  N0 g/ ^/ e8 s
   push  002a002ah         ; high word specifies which VxD (VWIN32)
: l! \# m5 z' b0 B                           ; low word specifies which service; g- C. @$ V0 V* t; d+ h8 v
                             (VWIN32_Int41Dispatch)
  \2 C9 o+ `8 u8 g3 G* C   call  Kernel32!ORD_001  ; VxdCall# s  i: p0 p8 P& s8 E
   cmp   ax, 0f386h        ; magic number returned by system debuggers$ e1 _! P( u9 r! E/ v, Y! _
   jz    SoftICE_detected
' D6 K: R9 u* }& [/ R$ P, L, y7 N4 V! h7 M3 |
Here again, several ways to detect it:
3 F% `1 b4 _3 ^& S% q- g) E: G' l' h& [9 X0 I$ T4 v8 T
    BPINT 41 if ax==4f
) |# M9 x+ X$ o8 f% O  h" Q& _
1 {$ Y$ o- K) t  R1 Z4 a6 @' X2 c    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 b' D, X" O4 ^6 c" B( i

# C; L! {) k9 f/ H% S% D% m    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! \' b: C; S) q3 r6 @! e

! x  n- C) a8 z# N1 A2 W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
, y; j2 b( e2 t8 \' |  w* l5 @! o2 v3 C6 r$ \0 ^" p
__________________________________________________________________________
1 `! _5 |6 f* j* P, Q/ U* \0 b" S+ B" F
Method 13
# V/ \1 w9 y4 l/ d=========
  L8 S! Q, F3 L: |
7 s, z* C0 U/ p# ~* j# _Not a real method of detection, but a good way to know if SoftICE is' N4 l$ ]1 d# A
installed on a computer and to locate its installation directory.: E6 v) m! [6 @7 G6 ~* P2 y
It is used by few softs which access the following registry keys (usually #2) :5 `. j) Z: }- M0 _: [  B
( i$ a' F6 S( A0 F" f& A/ [: h% T& q; M" Y
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" Q, ]4 ^# ~4 Y7 V  w( R% ~) j/ w$ K: G9 \
\Uninstall\SoftICE* a# U. j! j! n) Z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( X& {# B6 V, f-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ `& V3 E2 V) ^; e" \, S\App Paths\Loader32.Exe/ c6 ?) O: e' E5 X( V$ Q7 m

! |; |1 C# ?. v% H  G0 x( a/ [
1 e9 z2 |8 P0 d: m6 t& ]Note that some nasty apps could then erase all files from SoftICE directory& S. u& C; J% Y1 r2 O
(I faced that once :-(5 C3 }9 }; u7 g! O9 ?
! Y; L' z. I/ b6 z
Useful breakpoint to detect it:; i5 j; t' J$ k2 X& a  r. x

$ i' _+ S8 p' ~' x+ f     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ t* U6 S( N# w$ r9 V
, r8 w9 r/ u$ F, ^2 n& m4 Y1 B__________________________________________________________________________
3 T' L0 e$ \% E3 f8 A+ @: @8 r1 C1 t& j
6 d8 s" T! B2 ?6 m( h, j
Method 14
7 n% [) K1 U) t" u7 x=========
$ m, }7 P4 u: \- j3 F  W
- J: ?" P  u" ~- o& JA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  [% X) C- L3 p) o( @1 Vis to determines whether a debugger is running on your system (ring0 only).
2 x- n) Q  ^$ y: }/ P6 i3 {. a9 v( c6 H! h6 E9 d/ t
   VMMCall Test_Debug_Installed4 E0 Z5 g: ]4 V  r
   je      not_installed
1 K, j) F. z! F5 o- O  B
& y0 f/ N* l9 G6 S! JThis service just checks a flag.) Q/ U+ T4 [" u  Q4 S" S
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-3-30 17:29

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表