About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 B" z" [6 \6 ^( g
<TBODY>
# E8 ^, L/ x  x9 y<TR>9 h6 H/ z$ \* Y
<TD><PRE>Method 01 9 e  e3 |6 p9 h0 n
=========( w( t9 ?& m! n- o: {3 c
1 c, U4 X* ]2 l% p
This method of detection of SoftICE (as well as the following one) is. s& L* s3 o7 g8 K* o  D
used by the majority of packers/encryptors found on Internet." ]- C- I4 I) w3 F1 k5 f) U
It seeks the signature of BoundsChecker in SoftICE6 N: x6 l. z2 D7 ~7 J- h. R
5 ]4 D2 |' p3 @9 S
    mov     ebp, 04243484Bh        ; 'BCHK'
2 B* q+ ~# M& i* j/ V    mov     ax, 04h
7 W1 A5 ]. p7 {/ O6 V2 v    int     3       - N3 d* T" a4 ~; ?# _6 f/ j
    cmp     al,4
- n( M# u5 m( U8 u    jnz     SoftICE_Detected
0 |1 R0 g1 L$ Q, M1 }
; |5 T0 l0 Y6 p5 i/ T___________________________________________________________________________2 D9 V/ Y! P$ U2 j& j4 K2 U9 h' _

+ R  j' Y$ m! V0 I+ O# x3 t: HMethod 02- {4 c( o) q- ]2 @' I
=========4 \% d+ v0 D& L1 t- X+ Y. u

: y5 V# f+ d1 TStill a method very much used (perhaps the most frequent one).  It is used
9 m& V4 e6 R, x$ Y8 R( lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,% b6 M+ w( z# }% G
or execute SoftICE commands...
" {3 ~6 r8 s# x( kIt is also used to crash SoftICE and to force it to execute any commands% z5 V' I& L1 _9 P% X+ s
(HBOOT...) :-((  8 k* h2 @# s8 k2 ~. D

  U( Z3 A' e4 J; B; s/ nHere is a quick description:
* X" v. }  t" A9 a7 j/ `-AX = 0910h   (Display string in SIce windows)& O: n0 e' [- C0 I% o+ N; f
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 z; J6 i4 J% B. V7 d0 |-AX = 0912h   (Get breakpoint infos)
7 u% l7 E+ B$ q$ _; V5 f-AX = 0913h   (Set Sice breakpoints)  U4 v* y$ x. }+ B# l9 ]
-AX = 0914h   (Remove SIce breakoints)% b- L5 o' e/ Q8 N8 P+ T/ v

5 q% k5 y& |  f  o6 n, q7 ?Each time you'll meet this trick, you'll see:
! {1 y" p4 }* i8 y3 V, M2 }-SI = 4647h! a, Z! S( i: C1 C
-DI = 4A4Dh
7 `! i, g. n# W  t$ I, TWhich are the 'magic values' used by SoftIce.. N  E+ w$ f, X) A+ ?1 R4 g1 l6 v; ]
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 F' s0 c- @% D3 B" I

" _' k! U3 ^" ^Here is one example from the file "Haspinst.exe" which is the dongle HASP' ?6 z" Y3 d$ b
Envelope utility use to protect DOS applications:
6 U; ^- _9 {% H. @+ k& }  h# E' l  u- Z! O. F- F

2 P4 k* f! ]. i+ ?, @! S6 N4C19:0095   MOV    AX,0911  ; execute command.
) s1 x( n( t1 t) `4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
& o! h* O3 s0 }+ v+ d$ d4C19:009A   MOV    SI,4647  ; 1st magic value.
: t. G  g5 _" _- I4C19:009D   MOV    DI,4A4D  ; 2nd magic value.+ [2 |: f2 }: i  d/ s& p
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 P) L$ R$ X6 z# ]8 g: S+ g4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- f2 }# Q; K: g# W- W
4C19:00A4   INC    CX0 D7 n9 n2 y/ V4 M
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; c* |: O# r( f; D
4C19:00A8   JB     0095     ; 6 different commands.
7 |' e$ v, N( W" r4C19:00AA   JMP    0002     ; Bad_Guy jmp back." n8 d' k; [: J6 p' F* E+ Y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% F) b& G, R% x1 }& a6 ?+ p
6 c8 h& T' o2 o' \/ @4 a
The program will execute 6 different SIce commands located at ds:dx, which
) E/ }; S6 M; p: l1 x5 d( Yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& K/ I$ S6 ]! p% J
' s* I) r4 h7 {. J4 |3 o0 I* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
) A  _$ s2 c% _' F" a5 ]( O" e___________________________________________________________________________+ m; I# x$ M  S+ c1 h: {. g/ r8 G- @

! x# v- W5 x5 y$ \" J9 y& {* d: s: Y) q9 ?
Method 03
& v" t4 W3 w' ]=========
- C  T3 ]; D1 Y% ]
; y0 A- _" z/ R( N* Z; v. X0 RLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; Z! K. e% y( B5 d# M( K(API Get entry point)
' S- Y1 W" Y) r/ `; r5 }, c        / U0 i4 y7 s' ]
" P4 l+ v) L3 s/ F+ [+ D
    xor     di,di
! m+ I$ X/ p! s, U; l1 _- G    mov     es,di$ h5 J% h& q% x8 x
    mov     ax, 1684h      
% M) J2 i  G( O* Z- k- Q% ]    mov     bx, 0202h       ; VxD ID of winice# L) l8 A) h" b! x/ C( F
    int     2Fh
! M1 @0 j6 i" H7 U7 D  o+ ]+ i    mov     ax, es          ; ES:DI -&gt; VxD API entry point" |1 `7 \9 L9 I  R7 {" u9 A9 Z
    add     ax, di& \0 X( `- L+ j# G# P" U
    test    ax,ax
, b' j# c1 q. k( K! k' \    jnz     SoftICE_Detected0 e" G2 `4 k1 O5 T- V4 _7 A7 r
$ E/ e1 z+ }0 r1 A, n$ k
___________________________________________________________________________
  ^7 i7 L$ D4 |% G
8 X! S; D; T, |0 s# J7 x1 pMethod 04) H4 l5 {5 R, v
=========
) w# e+ m% h/ M7 s5 }, X, a' }
" o1 `) @& K! K2 T$ aMethod identical to the preceding one except that it seeks the ID of SoftICE" ^7 W! H% O! T' q( x
GFX VxD.& w1 P' J& Y8 U# p
  H1 z4 ]: i) W$ ?
    xor     di,di$ a/ B; N) p( d/ e8 c! v5 [
    mov     es,di
% A1 q& z9 o* x' w) b    mov     ax, 1684h      
  V. Z1 x9 f: L& v5 E6 a) Z    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ q4 {9 b8 b" I0 n: p2 A
    int     2fh
) q& N  x7 q5 t$ l    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  p8 i9 G3 S" o! \% T  }    add     ax, di6 {& @/ b" Z2 M* t
    test    ax,ax5 F7 y( d+ @& p5 ^
    jnz     SoftICE_Detected
- J2 D* X  w. b5 b& l+ ]: y5 w- S+ T/ u! Q
__________________________________________________________________________
& M- {$ a4 m# o, V& R6 K, c6 L0 Y9 ]# c9 a5 X  F$ s7 x

) z' G* _/ C8 o) i8 E3 Q& `Method 05$ |: E2 H1 u3 ^& @
=========* n- u' S2 Z2 [3 _5 a

& i# l4 Q5 f8 u8 L& i2 ?, K1 [Method seeking the 'magic number' 0F386h returned (in ax) by all system0 M. a7 ?9 w' y+ t
debugger. It calls the int 41h, function 4Fh.) x! U5 w* ^) O! e+ q
There are several alternatives.  
% Y5 X2 l" v+ }* j  ]: `# J- t7 }1 N6 v8 H* }2 O& C6 t7 g
The following one is the simplest:
8 q7 C1 n- ?, D1 }
( C: P/ j! U9 B    mov     ax,4fh+ }3 m$ P0 e  U0 @' l- b
    int     41h
* j5 o7 K9 O. V( K% |) d3 d* T    cmp     ax, 0F386
0 K" _  s4 T& I7 {2 S% P9 U    jz      SoftICE_detected) \+ Q6 M. \/ g& T2 C

* g; G+ K5 n5 T% C' w! G$ h/ |& I4 y/ h! Z
Next method as well as the following one are 2 examples from Stone's
, U; y6 ]7 R: _! H; U" @7 h% b"stn-wid.zip" (www.cracking.net):6 D  `& f3 q/ H

- ~# h( ]7 l3 n/ Z, c    mov     bx, cs8 U* d! e$ T$ c
    lea     dx, int41handler2: B: @+ n& E" O6 A  Z+ t
    xchg    dx, es:[41h*4]' T* c0 g6 Q! `( V, P
    xchg    bx, es:[41h*4+2]
7 J! M' s. @3 R5 s    mov     ax,4fh
1 Y( W! A2 M) V: o+ @3 i! ^/ o    int     41h
5 I( ~  G$ g* u8 P0 D1 w& ^    xchg    dx, es:[41h*4]$ u4 X3 Q2 X. p$ e' B/ W
    xchg    bx, es:[41h*4+2]9 v" @9 b9 ^6 k0 F, V8 q
    cmp     ax, 0f386h% @5 `' @& X7 }  H+ S. ~
    jz      SoftICE_detected9 q0 Y6 o6 M' z, S

5 j& K8 @( x/ R8 z- i+ _4 ^" Sint41handler2 PROC5 x) [& K2 w$ f' [! G+ B3 [! _
    iret
% ~- M" [3 o; {, f& _  ?int41handler2 ENDP& ?% `4 _9 S0 Z5 o' K" Q, i
+ G  O% H6 A/ j' x* I( k/ s
+ ?! P. J6 N" R9 P
_________________________________________________________________________
/ F/ s: o2 C4 _- c% N2 C7 y- W6 [# R

' q; @+ }9 }- O# L: [3 EMethod 06# D3 @7 Q/ w( u) q. M( R4 q
=========
$ k! B4 U3 F8 j5 u9 u
/ i0 B( i5 ?3 N: u. i8 [! x: v' _# L2 ]0 ~4 s' E  b$ R7 z
2nd method similar to the preceding one but more difficult to detect:% q$ c4 l, N) V0 a0 ]% V
: l" f1 C+ O) C- y! H- {
/ S# R6 V- d1 z( B3 O5 J
int41handler PROC
3 g- W2 W; H  p4 ^$ ?    mov     cl,al
; ~5 z8 S9 N4 k4 i. P: [0 [    iret5 u/ ^( I0 G& n8 }5 a/ U) m' C
int41handler ENDP4 h" ?- k1 j+ Q  x) g

" k/ w4 a" S- c: R9 ^6 L4 t2 n! J3 @! t' @5 T% Z: B
    xor     ax,ax
: [0 z8 g5 @5 r4 M+ ]! H    mov     es,ax
" p% c$ w) [6 ?; J, [# J* M    mov     bx, cs
8 b" m- Q7 a. \! g" u    lea     dx, int41handler
0 B0 f$ `9 F2 g: F    xchg    dx, es:[41h*4]
5 v) D' [  m" v" S* t    xchg    bx, es:[41h*4+2]
7 n9 o2 |4 R  \: U    in      al, 40h: ^* E  p+ M+ J( Q, B
    xor     cx,cx
8 f( S3 {  C# R$ |4 e) N! E% D( G9 ~    int     41h0 C9 q9 w, M; R% Z# {- z1 ?
    xchg    dx, es:[41h*4]7 ]) m( r$ i: L3 h, Q) G
    xchg    bx, es:[41h*4+2]
7 E& @5 m6 M- O% ~% x    cmp     cl,al
+ I+ j! Q) B+ l% C/ s    jnz     SoftICE_detected
7 Q+ B- `$ u! F# G. O+ ^$ [0 D0 ]; q4 |/ L+ h# e- @
_________________________________________________________________________
% W) R: z  E* v- l% d$ I9 @& V$ d
$ t4 z. U7 N" e2 FMethod 07' t. m# }: E6 }0 Y8 q5 x
=========. X) U1 |  v/ ~
* k  U, @; h, m: }
Method of detection of the WinICE handler in the int68h (V86)
7 I, q6 E, @& ^1 k0 o! \0 I! Y- p7 i$ [7 P  t
    mov     ah,43h
+ {( ?' K  l! H* R; }2 m7 F    int     68h
2 r6 e: m1 t6 D( E4 p7 r* z    cmp     ax,0F386h- D+ z6 N* |$ u/ B. N
    jz      SoftICE_Detected1 ?6 y9 `( M) m
1 E8 b* P( u% e. {

; Q. x" ]$ p# `1 q  g1 e, S  D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, }' v" M3 @- O5 `, y" F0 m
   app like this:1 c4 u0 w$ @, ]$ P

/ b% {  N6 U! E$ @! H4 B& B6 s2 Y   BPX exec_int if ax==68
+ C0 W7 o1 B5 a- [8 U6 @5 j- |   (function called is located at byte ptr [ebp+1Dh] and client eip is
. L# T' j' ]/ B9 c) n/ {6 |   located at [ebp+48h] for 32Bit apps)
# X* [3 |' h& `3 A* w__________________________________________________________________________+ m. u2 z8 D& E9 G& }3 n1 j
8 ^4 f( n2 D* Z

2 O. {0 x# t' X1 o0 uMethod 08) P  b: y2 p; F
=========: G. S& L  V. p( u8 i5 C: Q2 S
6 i) K4 t( I7 X9 n" G/ J  _9 _
It is not a method of detection of SoftICE but a possibility to crash the
( q, N! r5 S  N% Y- K) R7 qsystem by intercepting int 01h and int 03h and redirecting them to another7 X9 j2 i4 D0 }9 ?
routine.7 C( Y% b+ D* Z
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 ]* H" K9 j5 k+ s! yto the new routine to execute (hangs computer...)
: q* }6 t# W2 m  q2 i: I
9 S4 B/ s% p5 d0 V    mov     ah, 25h$ Q5 P- n# [% D5 [
    mov     al, Int_Number (01h or 03h)
! L. _7 ?3 V' o& x$ m) r/ c! V% i    mov     dx, offset New_Int_Routine  c* M4 ~1 @: x
    int     21h
' A) x/ V# T8 d7 U$ g2 ^% m7 g# k
__________________________________________________________________________
, N! z5 P( I) v$ _6 B, f
" X# U2 W& [4 m* pMethod 09. y9 U4 q6 G- Q. q
=========* V# {5 O! p* Q6 k3 F! o3 C# H

4 z: e9 t* }( G+ K# mThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" Z( H8 n# z( @2 k3 J1 qperformed in ring0 (VxD or a ring3 app using the VxdCall).* {7 I  {/ V6 r  E# }8 [* f3 y
The Get_DDB service is used to determine whether or not a VxD is installed- B) j: a& l! o, a
for the specified device and returns a Device Description Block (in ecx) for
- {, l) u; e7 I, ^4 j: wthat device if it is installed.
5 n  n* g- q" K$ G$ ^2 ?) c0 t6 z( B3 k8 V' [3 d) W
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID0 c; f. q2 `$ ?4 s$ j/ n! R
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 Y, B/ m& ?1 Q5 ^* k
   VMMCall Get_DDB
% ]9 s; M. K3 b' k# z; F   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
% L: ?2 ~( \( Z7 g, u2 r$ p! I9 K: z2 B1 i: V: E: t
Note as well that you can easily detect this method with SoftICE:7 o8 m6 ]/ Z1 M3 `+ c* f: ^4 B
   bpx Get_DDB if ax==0202 || ax==7a5fh( [" E! }  e8 n$ X  `5 ^# u
: i/ g; G3 \  {6 N5 S
__________________________________________________________________________3 X/ f; k! _% V- ~# g6 H

& m9 t0 T. y. kMethod 10
8 A3 \1 m5 x  G& z; [) r* }4 G8 [=========
( L6 [5 ]% S) B/ T7 _/ q/ G& I( e% v
3 N- U" {& Y+ {0 m=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
( m, Q/ H" w7 m  SoftICE while the option is enable!!
2 y- P! A' C! ?0 F
  a2 h$ G4 ^! @: j( bThis trick is very efficient:
! a+ l" K7 B- Cby checking the Debug Registers, you can detect if SoftICE is loaded
3 l- ]  M! J* {6 T! l/ s( p(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
! h: |7 k) u1 ~there are some memory breakpoints set (dr0 to dr3) simply by reading their8 J/ ^8 e7 T6 m
value (in ring0 only). Values can be manipulated and or changed as well9 W4 J7 m3 `: A: o$ u/ i
(clearing BPMs for instance)3 e% c/ K. Q2 v: N; I
" }8 k6 a- Z0 D; a, e' S, P& p$ M
__________________________________________________________________________5 U: i" K2 J6 H/ d; {

3 J/ t% ~, t! g0 Q6 ]! _Method 11
+ Y: R! n4 @7 l=========" q8 U% E# \2 |* `! D
2 a4 [+ g: O1 u, k! _' n0 D7 u! c
This method is most known as 'MeltICE' because it has been freely distributed
; Z# Q* [% d, x9 \4 @  V& D# yvia www.winfiles.com. However it was first used by NuMega people to allow/ j+ N1 D; I  p7 t7 P; w5 V
Symbol Loader to check if SoftICE was active or not (the code is located
' Q& H) Q* M/ @5 t& l9 e/ D1 H+ Oinside nmtrans.dll)./ k$ v. P8 F  G7 |3 C7 J
, T9 w: }  W  e3 W$ M
The way it works is very simple:
/ q2 s2 k" {' _& Y$ OIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' c* c. G6 o) g. N
WinNT) with the CreateFileA API.; H/ j0 Z4 u) Q5 d& R
" `' q. ]# l" _* T! m2 c9 U+ B& H
Here is a sample (checking for 'SICE'):
6 ^' p% i. e% `: C
1 |  F* a" k# Z0 }. R3 v1 DBOOL IsSoftIce95Loaded()
% u" z& J) t0 e! A{
- k# W5 y1 m: _6 T( h6 K" G   HANDLE hFile;  
8 u; G. y5 F' ^  K% Q2 Q  t8 u6 W, r1 L   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 Y0 n4 p* f! R; B
                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 |. A, T/ L( k  |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' B7 {2 S' i! o9 G. a/ b, H, H   if( hFile != INVALID_HANDLE_VALUE )
# `, ?- |& v2 y* \6 E! i   {2 N2 A1 U  `: w# S' i* U2 p
      CloseHandle(hFile);- A7 ^2 _, q  n% f8 H
      return TRUE;7 g" _  s$ M/ i% N8 o7 }+ ]8 n
   }1 b5 B) f! P" I. \/ J9 ^" i& J( _
   return FALSE;
- v. @5 \! `! d( L8 N}& \  p, D. H) {* f: {6 T

+ R2 g# D  a7 {Although this trick calls the CreateFileA function, don't even expect to be) w3 R% i: q- G8 ^, |2 w, V
able to intercept it by installing a IFS hook: it will not work, no way!; x% l# k7 P+ A
In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 |( [! B: Q& b& R, v# W- u+ Y% f
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). }% f# G3 n+ ?* E
and then browse the DDB list until it find the VxD and its DDB_Control_Proc% \$ f$ {1 L; T  L$ x* H
field.# {, u8 Y4 H# T$ T
In fact, its purpose is not to load/unload VxDs but only to send a
( t$ f$ Z4 s) n, S) u/ rW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( }5 R0 O/ q: \- Bto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ G0 I! z0 H0 ?& g# ?0 x- U
to load/unload a non-dynamically loadable driver such as SoftICE ;-).7 j8 a! W6 i. u% K8 _6 ?8 z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
( x; j' ~6 D0 D8 ~' sits handle to be opened and then, will be detected.
  W) C+ ]: ]7 X* C* ?, ]& xYou can check that simply by hooking Winice.exe control proc entry point1 L% X" l" Q: _# z/ z# T1 V
while running MeltICE.
+ ^+ ^: J3 q; c& z0 I( G
! j& ]4 b& @7 w$ S" N( p9 P/ w* q/ O1 L9 x$ d8 P0 c
  00401067:  push      00402025    ; \\.\SICE1 Y2 `! ]2 [& X
  0040106C:  call      CreateFileA
1 r4 e/ x! w- W8 S9 n  00401071:  cmp       eax,-001
! Q  Y/ v+ I- h- L  00401074:  je        00401091
$ x  p& T1 I6 i' f1 T1 I+ z# N& E8 f, Q6 d. c6 M& h

4 r! `& o0 b$ ^1 r1 Q3 JThere could be hundreds of BPX you could use to detect this trick.- Z3 i7 G& C' C
-The most classical one is:
5 z0 r. l! L2 h+ d  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 {4 O( q! l& M- Y" x8 ]    *(esp-&gt;4+4)=='NTIC'
* R% Y+ F  c+ [" D! n) S1 l
* A" s8 t) D0 W. h! T-The most exotic ones (could be very slooooow :-(6 y- a  s4 V7 Z8 O( C4 a' Q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
8 q4 ~1 `# k' B     ;will break 3 times :-(3 e# ?! Z# _' h( s
2 i! E4 ^7 x- i. A
-or (a bit) faster:
, s( T6 j  ^. W0 q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ u9 C6 a# M7 `) D. v" l- m
) x$ {- B. T( T/ }   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! o+ V' Q* K" C% c' W
     ;will break 3 times :-(" f* H7 k% ]. E% y1 d; [

) e7 k+ r! W$ T: R9 W-Much faster:
- L  s9 R7 R$ B  I  [9 b2 c   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 H! H7 V' w% n/ O  w; t- |

. T" c# h5 f1 M$ O- tNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% x6 B) d9 N" O: |
function to do the same job:8 Q& `8 i, U4 O* r: Q6 E
% e9 h/ f1 _7 e4 Y* N0 i
   push    00                        ; OF_READ
2 k7 `7 B& V  s   mov     eax,[00656634]            ; '\\.\SICE',0+ y# E9 ]" w. c. @, k5 _2 e
   push    eax1 G+ }# x/ |4 {8 T& Q* v+ C
   call    KERNEL32!_lopen
. ^1 S, C+ |- k  k, K+ k1 E) R   inc     eax
4 {4 L8 X  U& Y2 {! o   jnz     00650589                  ; detected7 S; V& E3 e& t- p$ S
   push    00                        ; OF_READ' f1 F; Y# B) b, V( z7 W6 D
   mov     eax,[00656638]            ; '\\.\SICE'1 t, _3 g5 `- A* ?+ W
   push    eax6 g0 k7 _( N' Y# U( r; V
   call    KERNEL32!_lopen
6 G$ o1 T; Y7 V: q( H& U5 D- q' U" U   inc     eax0 o# H: s( i) f9 @1 f$ }: g- z
   jz      006505ae                  ; not detected
5 t5 |9 W% L+ F2 h
! I5 k: p) a) ~( ~* N) b: L) J2 H
1 `1 ]+ ^$ T* y2 o3 l  S" F__________________________________________________________________________2 t! C8 M4 e: }  I9 G4 z) X

" E0 p- i1 H  W$ Z2 WMethod 12, x1 ~1 K# _8 H! z; I
=========5 \& F- N( y1 y2 e1 Q% Q8 R& @
. g! `$ \+ b7 `* p
This trick is similar to int41h/4fh Debugger installation check (code 056 d4 w" \/ W# @7 y% [- e# N, |
&amp; 06) but very limited because it's only available for Win95/98 (not NT). E0 z! U# E0 }$ p- s% ?( x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.( b7 W  W" f; o& Z3 v% v! a! ^

! y8 j1 [0 i' x1 L2 z$ ~- u   push  0000004fh         ; function 4fh
; [/ v" i( r) @- s   push  002a002ah         ; high word specifies which VxD (VWIN32)5 w" _% g! T/ l& x3 y8 _5 n
                           ; low word specifies which service
. A4 H! x& D3 p4 e+ F; J                             (VWIN32_Int41Dispatch)% M$ G' ]+ E  h- Z. ?
   call  Kernel32!ORD_001  ; VxdCall# b: ]! _7 L! q+ a( a
   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 k4 q1 ]' P1 z: o6 w, v   jz    SoftICE_detected* o1 h7 r" n5 O; w$ `$ r' ?; c

! B! @( K0 I; k, V. y5 {; \3 BHere again, several ways to detect it:  l( I& t: h2 O  P

; B1 c  ]; |3 d' T; l+ K    BPINT 41 if ax==4f9 N! Q' A9 F% y# G. x# L) A
; L: {" W6 s3 h3 I3 L4 e
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 j- H, E' K+ I- c! [- B! }4 d; U1 n  {; X4 S
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! R; b1 k1 W) {& o, a; y; c/ y! _5 A4 c0 x9 u
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 ?& Y  R; y1 ^, R3 V* y) G- r1 o# s, C% H0 \, Y3 I* U
__________________________________________________________________________
7 S& Z8 s2 A1 T) F
+ C- V. x' ~+ ^Method 13- N, J+ i: I; h6 Z9 p8 N) X
=========
( @0 U* N/ K& l! ~: `. @. S0 J) ]7 r5 C: k" I/ r
Not a real method of detection, but a good way to know if SoftICE is& f/ y! {4 w4 G
installed on a computer and to locate its installation directory." U" s9 }: E; X2 }& w; I: T
It is used by few softs which access the following registry keys (usually #2) :
4 Y) g+ ^% \9 R0 ]' v  K6 _  V8 [( }5 x: h9 g; ]
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" p* e' _! m) P! s, o# `: _\Uninstall\SoftICE3 w2 s' Z/ s) Z+ H
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, ~% E5 q+ {3 K# @" y5 V* z  U
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, X. B- r' K; J\App Paths\Loader32.Exe
6 t# g0 m6 Q: X' z1 w" D, ?6 O$ l9 [; L! Z5 D6 \- X1 k  g

! C1 X8 C( [3 A; b2 v, }! u( }' ~Note that some nasty apps could then erase all files from SoftICE directory
: _& [/ {' [5 l/ ^) Z. e- J" d" }# v(I faced that once :-(
& o2 E$ R" ~) ~  s
& ]% |( F% E+ r1 S1 lUseful breakpoint to detect it:2 u5 X2 Y3 i, ~. S5 O/ T) m

* C2 }4 |! }  S# B- @& Y/ P' Y     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 R; j, f4 M" Y: T8 k% U2 Z) e& N: Y" N0 Z* ?) W  @+ V
__________________________________________________________________________, @7 b+ k: }( l8 `6 [5 H& `

% m$ T$ w. R2 f7 b: j8 K6 c) C: i" ]" ]. ]# X, L$ C" Q3 w
Method 14
) E* [; M; [# ^; N' G& O' n=========; G5 T' I, \, G# M" k

5 E" G/ o) W3 d, ]0 Q$ i3 yA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% Q' O. m& E- ?2 \' Y$ e' |
is to determines whether a debugger is running on your system (ring0 only).
; K" J) S/ g( f) N1 w, D7 o0 ^" ~3 J* D: J8 J: w
   VMMCall Test_Debug_Installed
0 y9 N/ J) O  P: D- P( \   je      not_installed# v* b1 [* v; u6 {( p9 j
1 T" k, r- B/ Q  @7 Q9 ^+ }) v
This service just checks a flag.+ s+ |$ h# b- Y  n; }# x
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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