找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 o  s# h. T' F2 j5 t  w
<TBODY>
1 E/ m. O$ U: k( e* o<TR>
0 X( h+ Q* t8 ^# ~. @9 S. m<TD><PRE>Method 01 4 B' t  Y9 ~7 D; m3 E/ \: q, ?5 x
=========4 M$ i6 r" T3 ^; U1 m* V& E
7 f/ A8 Z; e% ?& U- a
This method of detection of SoftICE (as well as the following one) is7 m- k- Y1 Z  e8 R2 D$ s- h
used by the majority of packers/encryptors found on Internet.
- x& v: G& y: w: p" {2 ]; OIt seeks the signature of BoundsChecker in SoftICE$ u# c  Q& U8 |6 L- }+ {7 m

+ S( ~8 T. @  d7 b5 @    mov     ebp, 04243484Bh        ; 'BCHK'
3 h" c/ ~$ p0 }; c" y    mov     ax, 04h
4 X2 w4 [5 `$ |6 q3 |    int     3      
4 G  G5 J& }% J    cmp     al,4
7 F2 P' m2 V$ E1 T$ F5 ?    jnz     SoftICE_Detected9 @+ H  k9 h5 C% u+ c9 {

$ @" O! t& F) x, |___________________________________________________________________________
8 h& J; o8 o% W/ |# R+ D- ?/ p, Q7 l4 A4 l$ z3 h
Method 02  D' B7 l* C+ U: J5 y$ T
=========
1 _. v8 y1 l3 ?/ Y0 K
/ Z; A$ T0 U+ xStill a method very much used (perhaps the most frequent one).  It is used! c: G; q1 x/ C  y8 Y
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 {( }2 U" B( ~; W: |0 D
or execute SoftICE commands...# M/ k! e( g) J
It is also used to crash SoftICE and to force it to execute any commands2 K) u6 G" I( v1 S: T
(HBOOT...) :-((  
1 f6 |$ L! L6 y' s- [1 n4 `' I) W- X! v% _
Here is a quick description:& j4 {. a* L9 e2 w' s8 }" [# ~
-AX = 0910h   (Display string in SIce windows)
. ^3 N! w) P8 q2 r( O-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)1 d6 X0 g! T) E' l
-AX = 0912h   (Get breakpoint infos)' v+ Z+ L9 ]" a: r( y) Q; C+ p
-AX = 0913h   (Set Sice breakpoints)
8 R* U- r/ h7 m: M, n4 ^-AX = 0914h   (Remove SIce breakoints)# C# j, j! J& `

/ m7 z% j9 x2 U" Z  F8 n+ x0 jEach time you'll meet this trick, you'll see:  W$ _" N' E6 L3 N1 W" D
-SI = 4647h! B  a# g8 o- N7 o3 a1 Z
-DI = 4A4Dh
' x( @$ C) E7 r$ j& C+ ]) t& o  }1 |Which are the 'magic values' used by SoftIce.
, U+ Y$ i( |4 n! C- RFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ [4 W! ^# l: C. j* J( X( t

7 L0 i1 K/ T/ [Here is one example from the file "Haspinst.exe" which is the dongle HASP
9 S1 T9 R3 V5 B' z6 BEnvelope utility use to protect DOS applications:
" g& E) q( R7 @) y% r4 s% C3 ~/ G  v3 P& ~8 f  Y8 s  l
5 t/ G; O6 s- {7 G
4C19:0095   MOV    AX,0911  ; execute command.
' ^" a) F' y% O5 e4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  w# o6 D. ^, n0 q6 ^
4C19:009A   MOV    SI,4647  ; 1st magic value.' A; W1 x; I, k# x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
' u3 d) q/ J( m4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*): H& }- z( x6 _4 D2 C1 H
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
% _- P6 x! J: }, f! m9 A* ?8 R4C19:00A4   INC    CX
9 x8 a2 W3 i3 O/ g* `6 Q( e* K, M9 q1 N2 t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( b2 K/ c, j" a/ K9 R) f4C19:00A8   JB     0095     ; 6 different commands.6 G0 O+ `, L' Z8 }8 c6 Z$ e, W
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' W! f$ [. d( q
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; q" @$ \+ q* [
9 y) o( j0 n$ |9 d' ~$ y# X) R( sThe program will execute 6 different SIce commands located at ds:dx, which
: e/ V# e% s+ q0 _; n1 ]2 L3 ?are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* I$ Y1 k+ w/ p5 k/ R8 |$ a/ i
) Y6 q9 T" N- v# [* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' U! F5 s) A2 d2 U# ?2 t___________________________________________________________________________% k( k# f+ E3 ~) e4 a# p5 \
/ b# k4 a$ ?0 }4 D
/ s$ q( Q4 d- v  K' J  F
Method 03! X, I# E. b5 m
=========/ `4 K. E6 M4 u$ o

% [( }& c; Z2 x3 Y  P- ALess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! S, }; \( M5 f% T/ T) ~
(API Get entry point)+ @1 f( [  p+ Z% ~( c) w
        
. A1 h2 \6 z: P" W/ Z5 t* s: W2 ]2 N  e8 W* J1 e/ M
    xor     di,di0 v9 p. F7 _, P
    mov     es,di
! ^& o& F4 w1 x6 `3 e: s    mov     ax, 1684h       & n' M6 p+ ^- O! R* k
    mov     bx, 0202h       ; VxD ID of winice5 ?) z  j' x2 |. C
    int     2Fh
7 L3 P& o5 u- H- n" V) X    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 b( d9 a( Y2 c    add     ax, di; U3 M$ N8 Q; I( F  q1 s
    test    ax,ax5 G. r/ R; p  o3 g( w& M
    jnz     SoftICE_Detected3 j. d! a8 D, {

5 w! W. R8 z# K___________________________________________________________________________
; C5 u! }% u; M3 f/ h$ z, l
1 y& B4 q( f( _: EMethod 04
; i  W+ W4 ~0 @7 |: E=========
/ k2 _& ?& c# a9 z
, M8 [& q, g) [$ O: `( mMethod identical to the preceding one except that it seeks the ID of SoftICE
; f' ^. q' ~4 l6 OGFX VxD.
4 L7 j& f. c( j) Y
5 c+ q' D: }/ e: `# t- V, u    xor     di,di- W) ^, E  `8 J
    mov     es,di
9 l2 I- u1 h) \( l& T    mov     ax, 1684h      
; V9 f- k5 S; R8 o, G    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ A; D& R# x& a
    int     2fh4 b2 j! @" ?% g0 L5 \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 W! i7 _+ q3 G' O1 ^# \
    add     ax, di
2 f% [, [# D+ p( r, b, p: |    test    ax,ax5 F, {! P6 R4 Z
    jnz     SoftICE_Detected* k. R+ R% i4 m! B
8 s. q; P6 V$ @$ Q" A
__________________________________________________________________________
! B8 K" M: d3 ~& {$ t0 {+ t! T& f
0 T1 {  s" s: k6 x! Y* X6 D9 S7 [4 J! E
Method 05  x, j- \. [0 X$ n" l' Z
=========2 G+ [* D' Q; `
5 @6 ^4 i& {/ [" O# H1 {
Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 o9 r: B) ?  d% Ddebugger. It calls the int 41h, function 4Fh.
" ?$ @7 T1 r2 DThere are several alternatives.  
" C3 K2 X" x' N6 ]  ^: i& u; T! i' J0 e( c1 V: G9 X
The following one is the simplest:
" J, |2 w8 c  @; K7 ?) |7 X; Q5 ^
6 k% f- O  y5 ^, M    mov     ax,4fh
0 ?/ [8 S8 i' v1 V! H/ L0 c- P    int     41h) B! @0 {( V$ C, T1 B
    cmp     ax, 0F386
5 A9 Y6 p$ S0 J2 b  A    jz      SoftICE_detected
- c5 q1 d& l! h" E" N" I
  g( W, p0 h6 }, a! L! w$ C9 k4 }  u
Next method as well as the following one are 2 examples from Stone's
* G) u; |, d. t" |/ N"stn-wid.zip" (www.cracking.net):7 Y8 E( q' k% D! h* e" C( |" }: T+ m
4 U, k# K* d7 a4 t
    mov     bx, cs1 i$ g" T0 s* F8 M! ]- i
    lea     dx, int41handler2. M: b2 f; R- Z
    xchg    dx, es:[41h*4], a( U$ A7 ]+ q' G
    xchg    bx, es:[41h*4+2]4 u  O$ i% K; n6 `5 c2 \% b
    mov     ax,4fh" [. g+ W8 T7 [" \  I+ ?1 m+ S3 [
    int     41h
' R! D" e- f% S5 l    xchg    dx, es:[41h*4], b, e9 y- L8 w2 k! O/ L: P
    xchg    bx, es:[41h*4+2]# d, b( j$ S5 @* ^: ^$ p! o4 h
    cmp     ax, 0f386h
( p0 ~. b, k; u0 n3 @; J' h& r    jz      SoftICE_detected, n2 z$ k$ w' t! F
9 k, C6 A; E1 f& R* W
int41handler2 PROC
/ N0 c8 _! j" b' n" U/ s    iret9 f4 l6 v' k. w5 z
int41handler2 ENDP( [! o6 ^) \9 c) g+ V3 Z" {+ l& p
9 u( ]+ ], J$ r/ i3 |. `

* I8 \+ t. x: r" h. e9 I) r# w( A_________________________________________________________________________' C- z# l. i  t. ?7 ~- W6 C+ ~1 G

1 g% L' d1 ]" x) r& A
; A# |2 _* @$ [3 @8 d) `' S0 PMethod 06* ?, b, D/ n0 s
=========
: V7 k; O9 r4 |6 R1 O& `/ ]2 ]" b2 T! A% [# w* ], t
0 @6 ^& q- Y4 d5 {
2nd method similar to the preceding one but more difficult to detect:+ B; f. P% l) D( e( ]# X" y+ C! u7 P

4 I; U( \+ L, o( \
; Q) ]3 B$ O9 G; {int41handler PROC
3 A' W5 N& v2 |    mov     cl,al5 Y- B6 L- \" a; k6 ]  Z/ z8 Q2 _4 b
    iret/ b6 V/ y- i2 A2 O" O/ |8 ^* {
int41handler ENDP
1 _1 x3 B  o" ~) d2 U, |
* X( T/ {; s' A& s+ P8 W" g; H1 U! q- @- a% i  j% ^, L! j) q
    xor     ax,ax
: n, Y: q! ~) g& D$ I4 X1 X) E    mov     es,ax
% Q  @; ?( x$ n9 E/ C) D    mov     bx, cs4 S/ m) Z7 ]+ D( u; z
    lea     dx, int41handler
" @, F* E' J) x3 ^    xchg    dx, es:[41h*4]# b9 y' ]5 ]0 }& z* p) u+ T! A
    xchg    bx, es:[41h*4+2]' z1 y- G) [! @% ^; w
    in      al, 40h- W# c5 G1 m* @% d2 }
    xor     cx,cx
. c* [  s/ y8 o' \    int     41h
) u6 t! i2 X0 N% V6 v) d+ z    xchg    dx, es:[41h*4]
" T( |! R; }0 A    xchg    bx, es:[41h*4+2]
/ H) |2 ~0 j" w) X+ C& A# i    cmp     cl,al
; G7 d3 M: z# Z* g8 I6 p! j/ x    jnz     SoftICE_detected' y7 G9 v" A# P+ {# Y. s
  _% N6 R  X4 y7 `2 `- {2 {5 x
_________________________________________________________________________% y% A) U7 X! F* B# B3 T/ d: \3 e

' l- k9 N5 s7 e1 O! t9 ~8 EMethod 07' {$ ~9 U- e9 C. ]- a2 G
=========1 p0 q4 _  }/ A5 w
2 z' H5 N/ s. z' q. k. K
Method of detection of the WinICE handler in the int68h (V86)
" Q; u8 W1 ?! o+ x
. u' _  h9 G# ~    mov     ah,43h: K+ X3 y2 ^# k: Q
    int     68h6 C0 A; @: x) T, O
    cmp     ax,0F386h
2 t( X$ B7 H7 A: L2 j+ T1 F    jz      SoftICE_Detected
+ A2 J9 \( H$ k/ f) F: y
4 E) s- ?; f: j# A3 x" Y3 ]
. l0 H4 \# P4 T" Y! f2 Y, ]=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 M+ Z( I8 T3 m/ D   app like this:0 T7 a0 M) ?# _6 }

2 P1 L. ~2 ]4 K. t# h  q   BPX exec_int if ax==68! s! a$ R7 K5 ?. o, X" p6 P+ B
   (function called is located at byte ptr [ebp+1Dh] and client eip is
  P& E9 x5 I& G: `& Z4 w   located at [ebp+48h] for 32Bit apps)
' `( t8 g( k0 H2 f* Q& J5 r$ K__________________________________________________________________________( q  P! e3 ?0 P& @1 a
8 `" M" `( w! n$ m' h4 k% Q( n

2 }: R3 K! i0 _Method 08
+ M8 ]! C0 j0 I; a, y=========
! f2 W2 ]- f# ]: _3 Z7 |3 M* S* F$ g. u! d
It is not a method of detection of SoftICE but a possibility to crash the
3 w2 f1 r/ b) Isystem by intercepting int 01h and int 03h and redirecting them to another5 R9 U4 _) C3 M& s
routine.+ \9 s( V5 E( G( w% i( T1 u9 ]3 O
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 I! W& E) Z/ ~2 q( c: cto the new routine to execute (hangs computer...)
) Y8 R. i1 A9 c, Z# j7 `# @) \$ u" Q/ }! _& O
    mov     ah, 25h
" |$ v7 k( t" K6 Z! }# \4 u    mov     al, Int_Number (01h or 03h)) L$ j5 e& [2 [, p6 t% X
    mov     dx, offset New_Int_Routine
  v/ ^5 x" Y8 c; e2 l7 P' A    int     21h
# t& p: x/ u% U2 z6 z/ r0 Z( l  V7 d2 x5 F% R3 ]1 K! H( p
__________________________________________________________________________8 C. T' ?/ {' b

$ Q1 A3 [* I4 p; L* K6 R* E  |Method 09
* T0 v- F9 j; d' `=========: ?, k5 [3 L, ]5 U0 Q7 B

' S( I2 ^1 Y6 C! oThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) a; N* \9 P/ L; x+ C3 j
performed in ring0 (VxD or a ring3 app using the VxdCall).
2 S! F1 \; ^% e( @3 e. z* ~5 mThe Get_DDB service is used to determine whether or not a VxD is installed
  H: {7 A9 Z( v# o0 Zfor the specified device and returns a Device Description Block (in ecx) for5 X& ~" C- F/ |: R  F
that device if it is installed.
! Y4 v& V' ]1 t; P: T+ q
1 v4 }; G; n9 E# n  E$ _2 S   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 D$ g# P0 V! A6 ?* N+ M
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) P& r. N3 l6 I  r$ K) U$ H6 S. k% P   VMMCall Get_DDB
' U1 C9 o& d* z) E% v* X. w$ A- k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. {6 W/ u; b4 t/ R& }

' J) h* K& h! S5 z: ~) T8 R# CNote as well that you can easily detect this method with SoftICE:- L5 O0 f6 L# h8 [2 @) I/ H8 U+ u
   bpx Get_DDB if ax==0202 || ax==7a5fh! q/ p; B% }+ a0 o8 }6 H  Z5 h

4 E* Y' q" c- a5 `1 F" l5 k__________________________________________________________________________6 B0 H; s% o% d6 U; r% [  h+ C
5 o! q; N  J, e- ~/ z
Method 10
( Q3 e2 q; `6 `3 n! M=========
% l5 s! q7 W/ D8 g3 ?" M5 T# G' d
3 g& o/ w/ D5 A  T% K* }6 |=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- W8 W9 W9 H' `$ ?3 a# }- {  ~
  SoftICE while the option is enable!!4 O  _# ~: |) C
4 p1 l6 j2 F, q% Y& A
This trick is very efficient:
: W: c3 s4 D0 A2 Dby checking the Debug Registers, you can detect if SoftICE is loaded5 R1 C7 t$ E0 e
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if6 B! ~- }- t# e( _
there are some memory breakpoints set (dr0 to dr3) simply by reading their2 O8 |9 t  \" _! l& o
value (in ring0 only). Values can be manipulated and or changed as well1 ^% s  p* h" E" e7 V3 f$ L3 d
(clearing BPMs for instance)
9 q; G$ ^, Y; U7 y2 H
1 j4 Z- ^& U/ O1 t& Y__________________________________________________________________________! j! q" c5 Y6 k$ F
- \" B. t; ~& z' [4 k# @
Method 11
3 _& q  L+ J% Y=========8 Z; l, M! [0 i7 C4 W

% R9 C& I1 {/ W$ U% [# |This method is most known as 'MeltICE' because it has been freely distributed' i+ K3 P6 G, q% I) S! g2 l
via www.winfiles.com. However it was first used by NuMega people to allow  N8 C+ @9 X  b  ^( n
Symbol Loader to check if SoftICE was active or not (the code is located* \. [* z3 c& G- [6 k" r$ Q0 e: \2 S
inside nmtrans.dll).0 ~8 j1 Z, ~7 }$ R2 v
0 I3 d; g! Y! I
The way it works is very simple:
6 c4 h$ V$ B7 TIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 V/ z5 w+ x1 e" d2 hWinNT) with the CreateFileA API.
4 |' `4 J. ?1 D, r, s: y% q  A4 A! Y, c# ?9 Z, a. }
Here is a sample (checking for 'SICE'):
0 w* J  f; N& J! }. x" w. y$ y4 [4 p7 i/ K- M
BOOL IsSoftIce95Loaded()
4 O1 v; k7 H$ H' q{. Z- f! C4 w- H  B( ]' F7 d
   HANDLE hFile;  ( H) {* f5 ~4 O2 c
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" |' [( A. B8 x8 }                      FILE_SHARE_READ | FILE_SHARE_WRITE,% v- U1 l( E" P3 W4 t. ~" C
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* V! N; ~0 a- ~7 b' l' ~) a+ z# R
   if( hFile != INVALID_HANDLE_VALUE )) Z1 X9 s) b& K  k
   {9 p# {% l  g1 p
      CloseHandle(hFile);2 p1 G1 J- H0 |; K: Z# h+ W7 S. U
      return TRUE;' R5 t( [# y+ i
   }' Q, N5 X- B4 ^0 s$ o6 m3 S# R8 S
   return FALSE;
$ S* w1 U) a5 H) J% d}
8 p! L4 S  z' B- A7 X" e; {
9 [# G. U/ k2 r2 P+ q  aAlthough this trick calls the CreateFileA function, don't even expect to be
# l9 `5 u" ?- q4 b' \* q3 wable to intercept it by installing a IFS hook: it will not work, no way!! }( J) {/ [& O' i! v6 \2 D
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
- y& P3 F+ t( x5 yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 \. ]- _* ~( l7 p. sand then browse the DDB list until it find the VxD and its DDB_Control_Proc
& Y! I( K1 Y) g* Yfield.
( |4 u, v8 E. ~5 c. d: oIn fact, its purpose is not to load/unload VxDs but only to send a 9 ?2 O7 U3 h8 |1 i
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 e' \' g. t! R1 I( J; z  T/ u  j% `
to the VxD Control_Dispatch proc (how the hell a shareware soft could try$ H: |2 m9 _7 i  Q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).2 f: h) Q' E* R( {
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 {, V4 q7 j& @6 q( ]
its handle to be opened and then, will be detected.% M0 v; e0 F5 ]/ h; O8 {9 V; z% }8 t
You can check that simply by hooking Winice.exe control proc entry point
9 V$ S$ c* }) c/ Z) uwhile running MeltICE.
$ p1 E. h% d* ~& I! L4 ?9 Y% Y9 L+ I8 K9 }3 K- w7 W( g. X* s

7 t# r" @, w# G; y  00401067:  push      00402025    ; \\.\SICE) L% ]/ C9 l, Z: K. G" l) a4 W
  0040106C:  call      CreateFileA
5 G3 A+ n+ g+ Z# W  e. _+ @  00401071:  cmp       eax,-0013 ^; w- W( b+ G: F
  00401074:  je        004010919 F0 F: s5 f# J! v% x2 r4 V4 m; u

* p/ e& c" N. j" G
7 J, g7 P7 v* u- ~- L$ q1 L$ N: rThere could be hundreds of BPX you could use to detect this trick.- i: X- @8 e6 [& @( o4 n- D8 r. Q
-The most classical one is:1 u5 |, }. ]* X1 o' T
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
0 K8 ?- |; M/ g    *(esp-&gt;4+4)=='NTIC'
9 _9 P5 c3 D" ~! b- o% b2 o/ p+ ]( F  P
-The most exotic ones (could be very slooooow :-(
/ H/ z% i+ O* s* s& q- N9 G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' |9 ^# V7 \4 H2 D! O* R5 e
     ;will break 3 times :-(7 k5 z. ^; w: S. O6 g5 `6 O' x( ]
" v5 ]8 }& R8 `; o0 n8 Z  l8 i3 ^
-or (a bit) faster: 9 q+ l& A+ g& a4 D  `
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 S: L# V! r1 j& T, R# n' T2 Z2 v" z6 u( j" S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  . J0 C$ B9 M$ G- E% F4 v4 z
     ;will break 3 times :-(
1 k( D; _- u( i- ~
. d* K# O/ ?" n6 `-Much faster:" ?) B9 n$ P2 W. J
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# n: {$ N4 D5 b$ ?

7 E4 t- @8 d- b# [3 [( l! |Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
  {2 A$ C9 H$ \9 ~function to do the same job:" H% p  F  A0 D7 ]
& I3 F+ z3 a/ G" J6 h
   push    00                        ; OF_READ
' v8 N' {3 G) f! h" l" v1 j1 t   mov     eax,[00656634]            ; '\\.\SICE',0. ]: g  D) |+ U* \9 ^; H
   push    eax+ U5 v2 n% L1 H/ s3 p8 H
   call    KERNEL32!_lopen; c! p: }' j2 q7 u2 P' u% n
   inc     eax
+ b4 {) L2 C; p( e   jnz     00650589                  ; detected5 T9 T  c5 W4 W
   push    00                        ; OF_READ% K2 o: B. _; |$ ~7 b7 Q
   mov     eax,[00656638]            ; '\\.\SICE'
- V' x3 m4 V$ ]: w) K   push    eax* A% O) O% q2 ^; |( N" c! \) V
   call    KERNEL32!_lopen
/ j8 }( j+ R2 K) c$ K   inc     eax( ~6 t/ W5 Z( l0 y2 z
   jz      006505ae                  ; not detected5 H5 ^% N  s3 D+ ^3 }0 Q

) p- a4 l  e. W6 l0 H/ p' G" Z' p8 f7 l
__________________________________________________________________________. j$ B1 R" i( y
" ^: [0 B% W# ?4 W: T( D/ z/ `% W7 s
Method 122 e; O& A( Z7 ]* |' z$ m0 T; S; ~8 \. o
=========
0 J/ t8 _9 c) }9 D: v6 }5 s5 G! `: a& u3 T" I
This trick is similar to int41h/4fh Debugger installation check (code 05
. f. U$ P0 v/ B: x6 Y&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! B2 B+ u/ L" `; u! v0 ~as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ j5 r  u3 E, o9 W
# V3 K# X: W$ Q  d  K2 C   push  0000004fh         ; function 4fh
" Q2 O! g' C6 {$ p   push  002a002ah         ; high word specifies which VxD (VWIN32): F1 M6 L4 P$ o; C) J
                           ; low word specifies which service, r# [0 Q3 h8 X0 W5 \  D: a
                             (VWIN32_Int41Dispatch)
) z0 n; Q$ l9 o. q! a3 c   call  Kernel32!ORD_001  ; VxdCall  f( v: h" x# A- g: Q7 d* s
   cmp   ax, 0f386h        ; magic number returned by system debuggers
* s, r0 H' d+ `2 w% o5 i/ d! x& P4 Q% A   jz    SoftICE_detected' J- N) r9 y! Q# I* R
$ I4 X; A% P5 S: S- t
Here again, several ways to detect it:
' A& I6 N* _7 ^( b3 f6 _( m1 d- R, l: t- E" L
    BPINT 41 if ax==4f3 s; D1 o4 h' O( @5 q

. _! N+ D7 k8 [0 |' f( S4 |    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 h2 v# p- U4 y
' ~6 [* C6 k! s4 \4 m
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 G' s& [4 b3 k4 x0 j& p6 f; t2 k9 o2 l# c% S
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' u3 c5 z6 e. p

  I) q6 b$ r% @6 D__________________________________________________________________________3 B0 c3 x6 T4 o" Y/ ]- w
; s7 {1 D! g2 ^8 o
Method 13
9 e+ u, v3 x3 C' k$ Z4 l  x=========' C; {) a/ l8 l) r$ P& b
% K/ P+ X, C% H: L: T9 J$ Q
Not a real method of detection, but a good way to know if SoftICE is# t" l4 Y$ Q& e2 L
installed on a computer and to locate its installation directory.
" }! _, ?9 b5 L" c1 c# U/ v. z1 ~It is used by few softs which access the following registry keys (usually #2) :
8 q; k' o. g2 Z- V; y! E+ h9 r0 X: `. Q1 L- x% J' g
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 F2 e) j& b& ?$ n4 L3 W9 I/ F
\Uninstall\SoftICE
) E  C( n4 D. w3 K) G-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* e0 R1 H" `; P. Q7 x+ Q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" g3 t" L3 z, Z# C+ o6 R\App Paths\Loader32.Exe* F) N; t& M9 N

3 b$ C! d7 E0 G! A2 J6 U7 W9 q( \* V/ c8 y& w# \
Note that some nasty apps could then erase all files from SoftICE directory2 C+ O/ y( j" e9 E
(I faced that once :-(8 S, i) r; ?- Q! L0 ]

0 z! ?. V/ q+ A1 C1 O; q7 W8 yUseful breakpoint to detect it:
! \. y7 c# z7 [: f: _) |  ^
1 [3 T+ \8 h& F, G6 L) @, ?+ @* |1 ~     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
% G# `! Y$ @+ S; P: Q( h* J: {3 m7 b7 Z5 \% b
__________________________________________________________________________
9 O1 p, N1 X+ [1 i- r& {6 Y1 M7 E" j4 _8 c) }: r5 e! Q, C

+ _4 |# P) ^. q0 v7 g8 ?8 W" s( [Method 14
9 _" G0 H. e# O, r) f( r=========
+ }1 y3 Q. E# ~" F* c  _+ k! G! K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 h7 k. \, ^' ^1 ~" s: R
is to determines whether a debugger is running on your system (ring0 only).8 K! I* g; X0 D# t0 U

+ H2 w7 X; e( U* @1 o& ?' X   VMMCall Test_Debug_Installed
: R$ F' c5 T% F" Y- M/ Y   je      not_installed2 k5 }* `  Z0 h* H
0 \3 j+ D  q9 k; b0 }6 Q6 m- P
This service just checks a flag.8 V; U  s' C# b$ E4 l
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-4 03:14

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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