About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 S5 F* `& `9 [6 d( ^3 t6 ~
<TBODY>
% U% j' ?6 f; E  S<TR>* V( |, m+ x0 |5 T
<TD><PRE>Method 01 7 a: u( t1 F' E- J
=========# `/ h9 B* k  w6 p3 g! N# [6 `

: A$ S3 f/ j+ j3 Y8 iThis method of detection of SoftICE (as well as the following one) is
0 P8 J2 s  {: aused by the majority of packers/encryptors found on Internet.
' E4 A* r. [4 ~0 X/ qIt seeks the signature of BoundsChecker in SoftICE' Y! z2 Q! t( K" C
, Q1 [- `, i3 X. L, `
    mov     ebp, 04243484Bh        ; 'BCHK'/ Y" M6 v- _5 l4 E7 I' y* N
    mov     ax, 04h
9 r& K5 m% r' `  P    int     3      
: L6 \7 H, g" Z' t9 _    cmp     al,4
0 p' ~4 C- y6 ?( I: r4 _& ?    jnz     SoftICE_Detected
  q$ k9 p' `6 I3 i7 F( K
6 M- [  A! a. [8 }+ Q* K___________________________________________________________________________
7 T9 G9 @8 X  |6 Y
( a1 y" e/ p" nMethod 02
0 ~8 n" e3 L& X0 a' `6 p9 ]! t=========8 i* h3 {' Z/ n9 _6 V- C3 q4 Q8 i
& k# C' [  p3 M
Still a method very much used (perhaps the most frequent one).  It is used
; J! N/ k8 F; U5 ?6 [' _9 Fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% u6 `2 p- I3 z$ [; f3 Z' M8 U: Gor execute SoftICE commands...& W+ J  V8 L: x
It is also used to crash SoftICE and to force it to execute any commands
& g% G/ v: V  z; Q/ }(HBOOT...) :-((  
- m& L- G& Q/ v+ Y
0 q% s  Q3 c: S$ ?" YHere is a quick description:
- y! _) H3 @) D+ d1 o8 |3 T! p-AX = 0910h   (Display string in SIce windows)
2 v, F, D* o/ ^* y8 e! e) i! ^-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& u7 r# L* q3 |8 K9 z: k-AX = 0912h   (Get breakpoint infos)
3 K, N5 |0 O2 H5 Z-AX = 0913h   (Set Sice breakpoints)0 k$ I2 b) z# G- ~- c* g6 I* w
-AX = 0914h   (Remove SIce breakoints)& l! g9 a8 g* }; Q* ]

6 W& x3 |+ `1 @2 ?Each time you'll meet this trick, you'll see:. @' K! X0 i/ q8 W
-SI = 4647h% p( U$ B2 o% L& s9 P8 I9 I. a
-DI = 4A4Dh: z2 b$ V) l; W
Which are the 'magic values' used by SoftIce.: P2 f* ]; B6 ]
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 D2 T, V* j9 v

( N- d9 k. A  {5 [, iHere is one example from the file "Haspinst.exe" which is the dongle HASP  c2 P" @% A0 H: Y
Envelope utility use to protect DOS applications:
; U& F9 V' \: j  g3 ~) x6 Y+ q( b8 q8 n2 z" `5 S' b1 |' e/ B6 U/ y
  o( z2 l9 d1 z# k( l+ ?& K
4C19:0095   MOV    AX,0911  ; execute command.
! w/ d; I( |6 K4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 R, g% [- d7 y0 d: c! ?4C19:009A   MOV    SI,4647  ; 1st magic value.* M: T) {7 {7 {
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 n8 T5 P  E( l( ?& C4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
$ c6 R% P( \; D4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ X' @; t8 r! z7 m2 E( G5 d
4C19:00A4   INC    CX
" @# h7 W5 f3 W) Z7 S8 W4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; {$ u+ U- q! [% _4 b' n- p
4C19:00A8   JB     0095     ; 6 different commands., C3 x# f) [( }' V# i+ k4 N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' ~7 y8 T6 Q3 I. A0 L
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 q& u" w& U# h0 d& J5 ]8 A9 C" ]2 T" `! E+ c6 ]  B
The program will execute 6 different SIce commands located at ds:dx, which
# I1 ~% z' l' `* xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ ~5 ?; G4 N5 X

6 M  U# i% Q: e1 ]' d3 L* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 U6 W+ U1 J; B* @
___________________________________________________________________________7 ~0 ~7 K& u) u, `

, j0 }, O5 e7 W: E3 m3 ~. f1 r- [' x  e
Method 03
+ k- @4 J" S' F- G% V=========/ T$ I  Y- y* p3 O/ w, c' J1 [1 n
/ t3 F* c& i  ^) j
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h9 e7 d9 C+ ]- R  b
(API Get entry point)2 _) Q+ U+ X5 f7 g+ v: v
        5 E. V* ^2 j* C

3 R# e' C7 v& ]    xor     di,di! b4 B" _- A$ h9 D! P+ h
    mov     es,di
% V  E) P: C1 E+ [( A0 J+ c2 U    mov     ax, 1684h      
& h- B4 A7 b7 y: O; E8 n6 F7 [; U    mov     bx, 0202h       ; VxD ID of winice  h  a2 ~1 K% w6 z* ^- x
    int     2Fh+ ~" w8 h5 m' U! Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ j1 L9 D9 F" c! b9 L$ g
    add     ax, di
# k2 v% k" r2 R. c& R) \% \    test    ax,ax
+ K- y8 Z9 _$ w! V% S& p    jnz     SoftICE_Detected' ], c# e' b0 R- F. c

  W7 M- S& K2 u+ P7 A) \4 {___________________________________________________________________________
2 W2 {/ G, o6 N9 T+ r7 i) l  {; D6 v; S8 N  k* k# d
Method 04
) g% j5 ~- q+ ?! @" i" M=========1 S* C' h/ s6 _! G+ m- p: n

4 z5 E* D% p( @+ K: f# t% Z% vMethod identical to the preceding one except that it seeks the ID of SoftICE
8 _( f( |6 {0 c$ D" jGFX VxD.
% z) U( F& ~  l4 o8 @; H9 w. b8 x' r3 L- A8 b7 J
    xor     di,di  E; i4 b: E" M+ b; m( k
    mov     es,di! ]" ]& A4 f$ M' k7 [1 f# s( L
    mov     ax, 1684h       3 l' ?" n5 q  X! `# w/ U
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 S# E3 u5 U4 w0 [" d    int     2fh8 K! |) r3 _2 d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* c0 P) I1 p1 A6 d3 Z    add     ax, di
( Q% n- y; ~9 W; V# l    test    ax,ax) j6 B# G, C  S
    jnz     SoftICE_Detected
! c' ]$ Y2 W4 P2 @  g) r& @5 C2 I: S" \* X3 p. b; x
__________________________________________________________________________
/ `0 V! x! F- m. ^0 Y1 s2 R# z/ z4 {: E
& B% R2 u$ p$ y* [  E. x  C" ~
Method 05/ x; F: t8 e, ~: }# U
=========
2 y" ]( Z5 [/ P! B7 Z& i) B. a6 Y* J; [1 ?
Method seeking the 'magic number' 0F386h returned (in ax) by all system+ \! N, f  m. {& X: N
debugger. It calls the int 41h, function 4Fh.
: C; M4 d. V$ pThere are several alternatives.  
! m( l: R5 q9 d  }0 R( ~+ I8 Q  T) o: \
The following one is the simplest:
% Z' S8 ]! z: T! P2 P8 F
7 t& W) o. H2 c) c$ i    mov     ax,4fh1 ?9 j$ ?7 C$ r2 x" S) r  H4 M- M
    int     41h' w* n9 Y: W. f6 ]
    cmp     ax, 0F3869 G- O$ g4 L' g( C& x6 _
    jz      SoftICE_detected+ C; x2 ~& k7 c& \; B
* o& F! a( E  w- R3 G) x

" P: @3 t4 ^! ^Next method as well as the following one are 2 examples from Stone's
7 ~; N% \* ?8 x* t# J4 U"stn-wid.zip" (www.cracking.net):
! U7 b5 _0 v! E3 N& A$ C" _$ T3 t8 y& |0 f; k9 k0 h$ K# g8 v
    mov     bx, cs
) r: g; o6 {0 w    lea     dx, int41handler2
+ A! v' h+ t/ N4 j. v. t; K    xchg    dx, es:[41h*4]+ I! I5 G6 `7 T" p6 u" ?8 M* U
    xchg    bx, es:[41h*4+2]
$ n/ a) U' n) m2 ^- O    mov     ax,4fh0 q# [, R) M" m/ C
    int     41h
" v8 \9 d' i% m- k: }; \5 `    xchg    dx, es:[41h*4]. z. }& G+ f9 h) \1 F
    xchg    bx, es:[41h*4+2]$ B9 U% Y3 f5 w* @
    cmp     ax, 0f386h  c/ u6 D3 K7 W6 K
    jz      SoftICE_detected, }6 h; I. e" U" G6 d* a  H
8 {) W$ l& f2 K( l" E, R
int41handler2 PROC9 g' o6 n3 M9 s8 q. x1 n2 t  P
    iret% w3 T/ n* Z7 \3 ^+ N- W
int41handler2 ENDP# I+ K) W: F9 a) E& U
2 w" R; u0 w7 G# h3 O
( t) M  @; f$ z/ [) _
_________________________________________________________________________: Y/ T" A& L( v  V$ d, e$ t( d

/ s3 Y# I% N6 q8 y- D+ n: h6 O2 u" n. l% s! V5 t2 {
Method 06  O0 p0 l6 W, [: ^
=========
  a( E2 ~6 V$ }& F$ J$ {; ~: a  A  h/ O' H( o! G
- C2 o( I- u" u; ]; V0 Z
2nd method similar to the preceding one but more difficult to detect:
% \! R, t. S" k0 B$ b4 s- y& Q8 v; X' `. o+ q$ n  r. [

2 s6 U# t7 k, \+ _' xint41handler PROC8 z2 n$ F. f5 J1 X8 b4 Y
    mov     cl,al
- u& v, G  v/ B    iret
; U4 M% h1 A% k, b, Z: [" Cint41handler ENDP
9 {$ q5 w. l0 H6 r" Z% k& N
/ j& ]; p; B' R% i& ?$ s* `, T3 X( W  {
    xor     ax,ax' D' D4 @- G1 z) ]/ D3 m/ I1 o
    mov     es,ax
2 z* ]/ h: f: ?( E- {; Z& H    mov     bx, cs
- s% k% {; l9 f3 S  A" w) I5 U# F! g    lea     dx, int41handler- F5 _9 Z0 C' V6 q
    xchg    dx, es:[41h*4]
. g9 F/ F. l2 C8 J    xchg    bx, es:[41h*4+2]
7 z" U( f$ {" K  |% t0 r    in      al, 40h
5 B4 M! b" n1 O8 Y    xor     cx,cx0 t1 S5 t* a6 L8 o3 D0 x" A1 c
    int     41h* W5 D1 P2 X5 H) }0 s+ h' ^
    xchg    dx, es:[41h*4]" b  @* L) j4 [# F! U" c2 ]1 J1 J2 d
    xchg    bx, es:[41h*4+2]
2 [$ r5 d4 D. k; m    cmp     cl,al% h. c1 P! P  E2 p: i; t' ]3 N
    jnz     SoftICE_detected
! K7 i1 ?  ~8 C& J! n+ f( v, \& g/ e' C3 \# }  p
_________________________________________________________________________
5 q7 m: Z# v& m8 e2 |/ A- |6 W. }. y- ^7 k' Y" B
Method 07
, m( P; F, @% Q5 N# r=========
/ e7 c3 J3 R+ f: M1 a, @# m7 V  u8 }; P* y6 Y: B9 ]( k
Method of detection of the WinICE handler in the int68h (V86)
+ o& s" c, {$ I, y$ T1 R+ H1 d: H1 ^: w$ V
    mov     ah,43h! ?& T( Q0 X2 Q6 I# @
    int     68h
: {& M) M; o) o0 |7 F- W# X    cmp     ax,0F386h
$ B2 k  l0 d( `$ |9 t9 l8 h3 s0 q1 L    jz      SoftICE_Detected
0 S. `; E, d- i: @) I6 Q( q$ I: W; i9 s8 O) d6 W

1 r- e6 Y; E4 J5 s) J- e5 T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit0 D6 F4 N1 r  i5 V. Y( k* |4 C
   app like this:: w7 V. {' I/ R

+ D; i- \8 c, b5 W/ }: {   BPX exec_int if ax==68
7 z9 ~( J' A2 E0 t- s   (function called is located at byte ptr [ebp+1Dh] and client eip is
; I+ I6 E# @6 K2 d. n   located at [ebp+48h] for 32Bit apps)7 h1 k) q" ~+ f' M9 [
__________________________________________________________________________% t7 g: Z5 i- `2 [6 Q/ G% w) ]; T

6 W7 S3 c& P0 q8 O% |
* t6 f* H6 ~! Q; |1 D* h3 tMethod 08# F9 h9 }& x9 b: t/ E5 E
=========% ^5 r4 I  _8 `  b8 g5 X5 W1 }
; v( O  h# J1 M* v
It is not a method of detection of SoftICE but a possibility to crash the5 c+ K  D" V& }2 d+ {" ?) _5 ~
system by intercepting int 01h and int 03h and redirecting them to another
9 O: c) V: \7 H5 proutine.
! m7 @* J# @* t  @4 q7 @# x  gIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ ^, W8 Q7 @3 P! J
to the new routine to execute (hangs computer...)
6 P; d8 S$ {8 s$ E( b4 q0 k. [! Q1 ~( S: K* e8 y) y. n4 h
    mov     ah, 25h- o* J3 E. _6 n7 L
    mov     al, Int_Number (01h or 03h)
- R+ w/ A% v* w/ X    mov     dx, offset New_Int_Routine1 A1 {9 a2 W/ }  A) P1 u, ?* y
    int     21h
& t2 F% u+ m# Q: w$ X7 }% V( `0 P2 ]; q" b# Y/ w% r- P9 C# F! @  r
__________________________________________________________________________  u: K$ f% U4 |) V9 \' v
4 Y( c5 y/ C) U/ j& X6 i# P2 l$ Z
Method 09
& b2 L' w  |* F1 V+ X=========. H! [/ I, Q' T2 I2 S

; b! v# j; e0 `( Z8 l1 CThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ A( H+ [" t; N. i4 `performed in ring0 (VxD or a ring3 app using the VxdCall).
6 H. e* e& [/ q1 _1 W. g3 GThe Get_DDB service is used to determine whether or not a VxD is installed! I% S! v4 @. w: h: P
for the specified device and returns a Device Description Block (in ecx) for- u3 |" ^& d, J& m% Q
that device if it is installed.
5 m) Z6 ~. v( A) J& R
8 b3 E& }1 `9 r; {4 T. K   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
0 Y) g1 V- n: b   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 ^( T6 F8 R  Y3 O6 k5 c/ E
   VMMCall Get_DDB0 S2 Y* W. p% A4 M
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 [, \/ U: z- R& |: u
! w; U* V+ y8 K! }, Y1 X8 oNote as well that you can easily detect this method with SoftICE:
1 N# \0 Y  D8 V$ Z% d/ s& c2 f0 p1 Z) ^   bpx Get_DDB if ax==0202 || ax==7a5fh
% \# Z! j7 o' F5 p4 D, _. k- [3 @% X3 V  F6 `
__________________________________________________________________________8 R4 M  n( K* y: T

) l: F4 s$ w! x8 gMethod 10
/ B+ w5 o' a+ ]=========
( L9 N' j- Y- T  L0 L. ~# i/ d* H% J7 F) Q2 A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with' A' N4 a0 j6 q0 N* {$ z
  SoftICE while the option is enable!!
* E  x6 ?: L1 T8 O2 Z3 b" o& D# z: J
This trick is very efficient:& Q/ X, E7 _6 q, R
by checking the Debug Registers, you can detect if SoftICE is loaded
: V/ r2 B# E8 p2 q* @(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
! g" a8 |. j8 Kthere are some memory breakpoints set (dr0 to dr3) simply by reading their
; W% F+ `9 S( W. {value (in ring0 only). Values can be manipulated and or changed as well( f& h9 r* m+ s! ^( k8 f: T
(clearing BPMs for instance)
5 v  a+ x8 l- D
3 [2 }- O% ~/ H6 y3 {/ p7 I6 z__________________________________________________________________________
4 g& e8 V, E9 o3 ]( |5 K. w1 K4 K+ }0 N. S# z+ H
Method 11  r" A* y3 T" v8 A% r# H. n
=========
8 g) F8 c0 l3 T: A, Y& d
+ h5 U: d5 y# N7 c3 I2 ^This method is most known as 'MeltICE' because it has been freely distributed
$ G0 {7 u, ~# n( dvia www.winfiles.com. However it was first used by NuMega people to allow4 W9 }) t: A2 _: B/ G5 b6 X
Symbol Loader to check if SoftICE was active or not (the code is located
+ P/ p2 |% b* L( ^5 jinside nmtrans.dll).: J2 G3 Y' g/ i9 C8 V

& a( l+ b- W7 V' R0 T5 OThe way it works is very simple:% H8 z8 T1 m7 d: M
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) q+ G1 _4 E# ]; o0 F! GWinNT) with the CreateFileA API.
/ ]& _1 I. g$ \( u7 K; Q
6 d& ~5 Z( M' z! }5 t4 p! EHere is a sample (checking for 'SICE'):
, O3 S" w2 P4 f" L# \
, q  C' Y, O. f- }BOOL IsSoftIce95Loaded()- s( K( e& k  J
{4 G, v- b  i$ S, ^" Z$ g" `
   HANDLE hFile;  
; b6 _$ g0 l, m, O   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. Q$ w+ B5 o5 |" x( o5 V
                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 b' b/ a9 i9 ?' v
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' h. n+ M. Z, G
   if( hFile != INVALID_HANDLE_VALUE )
2 c6 v6 U0 ?9 s; Q! _   {% R5 v5 ]1 B- W2 A6 a8 s5 E
      CloseHandle(hFile);
& e1 E4 S; E0 C& e4 q; X/ K3 U) k      return TRUE;
0 O5 J9 F6 o, ]$ j" V2 N+ `   }
9 D. I( o' n' L+ z: ^, ?# B   return FALSE;
3 k  D. g, I/ z: \8 Y}( Y& w& Z$ w/ \7 Y

7 v0 s( j# t* n9 GAlthough this trick calls the CreateFileA function, don't even expect to be" `" L/ |) O7 _$ W% C: ^$ s
able to intercept it by installing a IFS hook: it will not work, no way!4 L, I3 j9 c% W2 x3 Q2 e2 }
In fact, after the call to CreateFileA it will get through VWIN32 0x001F" ?% x9 P2 m! [9 m! O
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% v* _1 s# Z( e" g' a8 K, q0 N
and then browse the DDB list until it find the VxD and its DDB_Control_Proc- X8 E0 s- U3 t, v) P0 P
field.% i; ~: q$ x" y7 z
In fact, its purpose is not to load/unload VxDs but only to send a 6 V, q3 j' Y" I( a9 V, m7 ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ ^6 q( A+ }1 l; ?
to the VxD Control_Dispatch proc (how the hell a shareware soft could try: m, n" l4 _) n0 g2 U+ C  j
to load/unload a non-dynamically loadable driver such as SoftICE ;-).+ U/ ?, K% P! `7 A. L5 o
If the VxD is loaded, it will always clear eax and the Carry flag to allow' \3 H4 e/ e9 e* C6 @
its handle to be opened and then, will be detected.7 \; g- H4 N* Y6 Y
You can check that simply by hooking Winice.exe control proc entry point7 F- q" q* Z9 R. |2 j
while running MeltICE.
( W( v8 K: s) }1 t( i
8 p+ d5 C. X' e; n3 n; J( ~: U( T& `, X6 C) J& ~4 R+ r
  00401067:  push      00402025    ; \\.\SICE
7 e4 ^8 S; _) u  0040106C:  call      CreateFileA1 Q( H; F# g+ Z4 [
  00401071:  cmp       eax,-001& U7 b1 G4 j; G- w3 W
  00401074:  je        00401091
& v+ D% v/ `9 U6 `) x/ h8 E  R; R4 t! k& c( E' Y$ c  @

7 A1 g  k1 C: U. J0 n* @/ W; g3 VThere could be hundreds of BPX you could use to detect this trick.2 n! l' T* G( v) P( ^# f& F; D: O
-The most classical one is:* B$ r* y* j+ f7 v( [! h* ^$ h: I5 S
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ P, [* D& f8 r
    *(esp-&gt;4+4)=='NTIC'! O+ f! e& \! u% I' h
/ K0 c% j" x) I
-The most exotic ones (could be very slooooow :-($ a8 J4 P  s. g8 D
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 u" e1 ~  c: T5 |  e/ h, K: |% f
     ;will break 3 times :-(
( p& ~5 |. I# p1 ]5 R% I
& Y5 }, Z! ^- a8 E0 X9 ?-or (a bit) faster:
5 r& r$ r9 z: M   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')7 w* n: P9 t3 `" F" ?1 {
0 G+ G( {2 p7 p
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 `) K, v$ Z/ M
     ;will break 3 times :-(, U% `0 \) k. p$ D6 [* l7 F6 ?- i

- [+ h; S9 ?# U3 j- o" @) f) O-Much faster:
- l( n& u( W9 L+ N2 z+ c   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; `8 U# r+ A: |# a5 F+ W

0 q& O6 @9 q6 @  mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ E" P, v, H3 ?: Xfunction to do the same job:
% t. g& Z* R* m  W8 z' e
! U. R( \6 _$ X1 w   push    00                        ; OF_READ
% ^+ @8 ]4 v' n1 c   mov     eax,[00656634]            ; '\\.\SICE',0
, S+ S1 C) |9 T3 N3 I2 O+ L! ~   push    eax6 V/ A9 d  C. ^8 r1 D( y
   call    KERNEL32!_lopen; l) D' c& r2 D4 a- K$ Q0 s
   inc     eax( i/ v2 a9 [% D: Z+ g" P1 @7 U
   jnz     00650589                  ; detected9 y9 M/ m7 i- d9 _$ j( S% _
   push    00                        ; OF_READ5 `8 ?: ^. c8 R* I
   mov     eax,[00656638]            ; '\\.\SICE'( d# K' `3 a  [! u+ R2 ]
   push    eax* O  H4 ~6 |& g/ O+ p
   call    KERNEL32!_lopen
' E$ B  k: z! |0 l$ |   inc     eax
/ K2 e% r9 L: l# S: `- k   jz      006505ae                  ; not detected) E% p' F* q* V

  U/ Q" |9 d8 X
7 _3 M* Z" L' j" b__________________________________________________________________________
  h: H/ N2 k3 U, Q7 p3 g" L- J3 Y& y% c0 M) F  F9 `+ E5 \- p& r* T
Method 12
! A8 u. v4 t. H" x( P/ G' \=========
1 y! B6 _. {+ m$ c5 ^) O  p
( T' w4 P9 u" I; G8 x# YThis trick is similar to int41h/4fh Debugger installation check (code 05
' o- r- G* v+ t% D5 u&amp; 06) but very limited because it's only available for Win95/98 (not NT)! l  H9 v7 a$ u% w7 y- X& |5 |
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.0 F3 o6 H" U4 _* v4 F
1 q% U2 j/ w, B# F+ P
   push  0000004fh         ; function 4fh
5 [; r9 n! m* f1 _   push  002a002ah         ; high word specifies which VxD (VWIN32)
( t7 M' f% `+ {                           ; low word specifies which service' @5 t; m5 F" V: B3 I9 D3 i/ A
                             (VWIN32_Int41Dispatch)
5 F+ O/ z1 Q5 Q2 M  l   call  Kernel32!ORD_001  ; VxdCall
& H- K: \5 W$ M; s   cmp   ax, 0f386h        ; magic number returned by system debuggers  y! Y- s* y7 p3 D
   jz    SoftICE_detected. z5 z( g5 h  w% k& C9 f
' V: P" p: l, V+ k
Here again, several ways to detect it:
  ?/ J" ~. |: c$ M$ f2 a1 X/ J  ^& {0 z. b2 c
    BPINT 41 if ax==4f8 M0 k" J& G* }6 {2 t

5 d; w/ U0 e' u    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 Q; }, p- P7 A% W: `& X  h1 Z- F7 j2 n/ C) V# t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* f4 i; V. u0 u, F. q
( z% X: a7 I! n- T! i" C! v) Y0 ^* v
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
5 ~' ^% J) J( r) _8 m
: |- I4 A. D# j  b) ], S& W) ]__________________________________________________________________________
  r& y& J! N6 O9 T* ^3 @" z9 \5 E( f8 V' y1 u3 ^
Method 131 n$ \* v6 F4 h6 u  s  \5 Z
=========
" ~9 {# q8 G( T
3 N3 o1 j% Y. F* RNot a real method of detection, but a good way to know if SoftICE is+ W7 f' }: ~6 X+ h; K
installed on a computer and to locate its installation directory.
! v5 d% N$ ^. J" Q6 {It is used by few softs which access the following registry keys (usually #2) :& O7 ]; L/ Z8 |0 k6 y4 N" S2 e4 y

6 `/ v& K: @% W  v, Y- S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( e# U1 [8 Z3 d! K3 _
\Uninstall\SoftICE
9 v2 B, V4 i! B1 i- D3 e-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE6 y! p6 f5 s* W6 W5 Y( m3 g! W
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' i# m, d' j1 S! x' j8 A
\App Paths\Loader32.Exe7 r9 L. z9 D& x4 O

  h; v- c  X5 _- u0 q5 Q0 B& l/ j/ S) `$ B) ^4 q
Note that some nasty apps could then erase all files from SoftICE directory
% f% B) \" _6 P- O(I faced that once :-($ W2 Z- j' Y/ ?) t8 u& L6 q  J
2 \( P+ Q+ ^" r* z/ \0 Z
Useful breakpoint to detect it:
; y  r% {  X& m( }
! H3 y/ U+ A, d3 V* m     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& J- Z' O$ B* i3 r. {. H( m
7 T8 ~' H( y3 o& @! V
__________________________________________________________________________
! m8 d3 j4 v3 P: a5 v% [& g% _* U. A/ R: \

4 O% f4 @3 j% \8 J9 yMethod 14
$ x0 m9 k# w, o" b=========- k/ E8 ]7 x9 T# m- n. `6 j! ^

) p3 F) v1 @3 hA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 T/ E: T' h( p! N$ a
is to determines whether a debugger is running on your system (ring0 only).
, q: X7 y/ G( {; a0 \7 I6 O, T: a; D( U- ^, a
   VMMCall Test_Debug_Installed' ^" i6 s; V6 u: b1 S
   je      not_installed
5 n$ N% L' d' R2 b; o+ j) `5 D; [* [& |3 a  o& N5 l
This service just checks a flag.
  I: e) {! {- `</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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