About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
- l& L9 P3 R: _: m, G& U& \3 b<TBODY>
. v' H0 `7 b# N( T. \! ^<TR>
/ k8 E0 G3 L6 }) S/ F" D<TD><PRE>Method 01 1 r$ G$ M0 a- K$ I
=========( I" _& k6 M) v+ i, N
4 b6 Y( a7 k" w" r5 a3 S8 d/ l
This method of detection of SoftICE (as well as the following one) is
5 L3 A! R4 ~4 N. \0 n1 `used by the majority of packers/encryptors found on Internet.
$ b1 c1 _; M4 r: G+ }+ D6 v7 ]It seeks the signature of BoundsChecker in SoftICE/ X( d) V/ \0 C

* D  x3 @' d- l    mov     ebp, 04243484Bh        ; 'BCHK'
5 W* z! p. y( t) F  ^+ V' v2 }' Q, J& ]    mov     ax, 04h2 E8 ?6 U% _1 V) {
    int     3       2 L( G3 V& Y# j$ g' _; k6 I8 W1 c% f
    cmp     al,4
' y9 H: t& I; I) p8 G; E; w0 s# E) v    jnz     SoftICE_Detected
6 \( ~+ d- O2 T  h
7 ]- H$ @2 p! [: \5 @___________________________________________________________________________8 V( M6 _4 j# p  \0 m! ~, f& P' ?
2 D+ H& L8 h5 u+ L! Q  `
Method 023 |. N! t' s8 ~$ a2 }$ M, j( Y
=========
. S" g+ J; q: N3 o7 g" b
0 s% O9 e$ c8 \Still a method very much used (perhaps the most frequent one).  It is used
/ M5 b" x* W4 B- t$ z( H! U/ Nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,' N/ S. j  ~  H' N2 B; m- o
or execute SoftICE commands...
' z8 F4 m( ^2 sIt is also used to crash SoftICE and to force it to execute any commands
7 W* ?( ?0 D  N: `/ r  @(HBOOT...) :-((  
2 u* X1 ?$ O: ^& O$ w3 I' C  U# f3 E6 L% j8 S: @
Here is a quick description:
& ~4 Y5 n1 T6 R2 M0 v0 Q& {6 K-AX = 0910h   (Display string in SIce windows)
" ~8 I3 \9 x8 n" C' l# l1 q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). f3 x* }& m  D& S. z/ U8 v: Q0 K
-AX = 0912h   (Get breakpoint infos)
1 S: c/ H6 D( k/ e6 l; S2 w-AX = 0913h   (Set Sice breakpoints)
# N4 n9 y; P8 N( e* H-AX = 0914h   (Remove SIce breakoints)' W$ X; j: P' l  i+ |* A! Q0 A

/ k3 |/ h. A* M# |4 ^) L' UEach time you'll meet this trick, you'll see:
' D9 u  ~4 J% e% o7 p% l2 e-SI = 4647h1 Z/ y, p" w# v% h7 Q% B. @. ~, w1 v
-DI = 4A4Dh
+ S1 {8 |3 H* s5 vWhich are the 'magic values' used by SoftIce.3 A5 \% V( E( y. E9 z: W, c
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% h7 i  F( A, Q5 V' ~! ]1 v4 b( ?& K2 M
Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 U1 j  P% B) K* {Envelope utility use to protect DOS applications:
! ~, g- o  q  F' W
2 @  ?6 Y6 c1 O# x: ~9 D# U6 m! f' a8 ?  b& _5 V7 M
4C19:0095   MOV    AX,0911  ; execute command.
, X5 O. m, @# w/ w# s, _1 R, r9 u4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., P0 H4 @9 u6 o" P0 m
4C19:009A   MOV    SI,4647  ; 1st magic value.! M: Y+ r, x2 F+ f9 u+ }
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.' I, X; h: |0 O
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 Z0 U' c& d/ A
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  j# r4 K9 Q, S, Q' q' O* Q
4C19:00A4   INC    CX
) {& Q: |! O6 z+ Z2 @( F" h: f5 X4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) {7 O: N( H4 ]( F1 X4C19:00A8   JB     0095     ; 6 different commands.1 Y8 ?) X9 G' t
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  y3 c# j$ ^& X+ Z# U
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& P6 \' j2 y0 f$ |9 L

" _/ l, k1 ]; I/ |2 L; z" \& rThe program will execute 6 different SIce commands located at ds:dx, which
, Z: B- w* `% y  f9 I6 o( ?% T1 X5 Eare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
. u# v0 i4 B: }- j& b) i2 c! l; N9 ^% T; @
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
) O2 }: A" P, W6 J4 e2 l6 H6 E___________________________________________________________________________
* k5 M! t2 \3 F" \4 S% X8 F0 O# Q8 S2 j- J
- T$ x: p/ y4 B# z' b
Method 037 u9 e3 G+ ~  O3 B! J3 H
=========
7 {  z4 o  z# X2 X
$ v4 Q. q+ b% |# z  xLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& P6 f6 z% l' u6 U: ^( A5 H(API Get entry point)
8 m  v  m, h/ x# y3 q        + V6 ~7 y  n8 x( Q7 |3 K  s5 m

- L' u9 p, t) W' f, x% F    xor     di,di
0 T; N2 |+ }+ v% @/ g. M! x1 U    mov     es,di
# A5 r9 {9 o4 G6 t" k6 h- l/ M, p1 o    mov     ax, 1684h       : ]" e8 A! A8 q- ~' s% w' Q
    mov     bx, 0202h       ; VxD ID of winice7 P" P5 \- Y) ?
    int     2Fh8 G- M; P4 U4 ], R9 V
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( }, U2 B( X: d    add     ax, di, Y+ K% ]$ p/ ^4 u3 ?
    test    ax,ax7 j$ k' {, T" d) v; J* A7 \. B
    jnz     SoftICE_Detected
/ w1 U% l8 O+ g4 i' g
& ]% m% i3 o( l8 W/ ?4 `  n- A, B___________________________________________________________________________
( K5 Y2 e; `, J5 y- }6 q" {
5 |$ X8 ~2 a9 SMethod 04' I1 M9 O" _  H
=========+ ^% r9 I7 p# ?

0 F+ p, q6 S8 F  PMethod identical to the preceding one except that it seeks the ID of SoftICE
% @0 \3 o; T! H: n8 ]GFX VxD.
. @  ~; o/ E: i: S8 N( h! p
( U6 q0 F3 H9 L! r$ r5 H    xor     di,di  ~4 \$ j# J2 `' \$ R% J! B4 C; V1 I/ R
    mov     es,di# D6 g, a' q% H
    mov     ax, 1684h      
- D, Z) l+ M+ h5 r9 r  J    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 a/ q& `+ y, g# F4 A6 o5 y+ |- Z    int     2fh/ v/ o, _4 g0 e* L( U% i
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 E6 p( s3 r2 A6 t/ L; |
    add     ax, di
: W! i2 `! p$ }( i    test    ax,ax+ ~+ _; X/ ?+ q/ n1 M, |
    jnz     SoftICE_Detected
$ T& j, {0 G# j& g+ r0 b$ D& N
7 K3 u  h3 A6 K6 Y' s, U3 ~__________________________________________________________________________
; j; M7 v6 M8 q  y. G# J
" a4 F0 F- S2 e, F  Z& A- r" }! Z! ]
Method 05: h+ }+ B$ s# e& `3 z
=========
' a: w3 n# b/ P
  S* W; p" H. O  ]% bMethod seeking the 'magic number' 0F386h returned (in ax) by all system; A, M2 d# l1 o* o
debugger. It calls the int 41h, function 4Fh.; y( V6 m! |7 N8 S& ~$ S- b
There are several alternatives.  9 b# A) S9 X# V
/ m1 @1 A4 W7 W
The following one is the simplest:' m# F3 E  h5 m) t8 n( g4 y7 C( X4 M# r

/ i! \, U+ U+ J: e7 c3 Q: I    mov     ax,4fh
' Y0 E! _! @! ?+ H- B$ t; p    int     41h
8 k0 f" K# E! Y) b    cmp     ax, 0F386
8 l, s4 Y& ?$ q+ C: ?    jz      SoftICE_detected
$ T" r4 [& C$ }- L! o. Y% y2 I! {+ G' T6 @, y1 I5 ~

2 }7 p' s' L5 f; wNext method as well as the following one are 2 examples from Stone's * |$ u# r1 T) `8 n( V
"stn-wid.zip" (www.cracking.net):
- v6 a- g* w9 y( `3 b( c7 p9 B4 h4 W0 [: r
    mov     bx, cs
  M; R  r5 }0 D, X% a1 Y    lea     dx, int41handler2" a6 {( K% |+ T7 l0 A) r
    xchg    dx, es:[41h*4]# u3 T# f) B8 X' T/ W3 ~, n
    xchg    bx, es:[41h*4+2]2 ?+ `/ I* I1 F, g8 ]- h$ ]" X
    mov     ax,4fh8 X1 @, M& m+ T* J6 j, r0 y0 p! F% ~
    int     41h/ @- o8 d: L0 x) x* t0 w. l
    xchg    dx, es:[41h*4]" v& O: t+ E0 m6 Z$ J
    xchg    bx, es:[41h*4+2]9 }! N' P& {; e, {+ z4 ^
    cmp     ax, 0f386h+ B: F: @* k( h
    jz      SoftICE_detected
8 k% L5 K# k* C% y& n- ^4 i# e  A9 V. A! n* R% G* l6 C
int41handler2 PROC
- w+ O8 b4 q) m    iret
& g+ M& t" [+ Vint41handler2 ENDP
/ v! N7 X3 g# V, V0 j& o  A
' g% W8 ?9 {, y/ @( G7 i( Y3 J. x1 l3 Y4 q7 ~. h/ @, C% h
_________________________________________________________________________
; A4 g8 v- s7 W5 Q, d5 D
, h2 ^( d  X0 h$ p$ w; Z/ {2 n. k
# u' Q* c) l* i4 Z, _Method 06% O) h* Z) T: J0 h8 r
=========( P& ?& y) Z; Y

: x  Y% J" ?6 y/ I, {) U  X0 H
5 n% z0 a% s( L1 a) `, @' f% V. |+ J2nd method similar to the preceding one but more difficult to detect:
0 I5 P3 k' V! Y3 C" ~
4 ~" c4 |( z! k. K3 w8 l2 s, \9 t5 f, c
int41handler PROC( }0 a. O9 z: C5 |0 `( r# a
    mov     cl,al5 z# ]7 z) O( p" E
    iret
. j7 Q* s3 m* B+ t  E5 V- {: `int41handler ENDP
( @7 f  D& @7 x: b4 m( M3 u! h7 K" Q1 u) f
8 t6 ^# D" v& J+ }. g- v
    xor     ax,ax( O# y: O# }/ g- H
    mov     es,ax
6 Y6 y/ `+ ~' J. ^; Z) M    mov     bx, cs7 \0 f( Y0 s( G: {% v
    lea     dx, int41handler' f* O8 c& |! S. |4 [$ l4 j$ T( s8 d
    xchg    dx, es:[41h*4]
# y# I" N3 W2 H5 w" j2 s0 [    xchg    bx, es:[41h*4+2]- J, f# W0 [7 V
    in      al, 40h
. F. k9 Q4 K7 k$ C7 V* [    xor     cx,cx
' M0 j2 g& A& n& x' |    int     41h
- k! u" {3 V0 R1 F  Q3 k& F6 a  H; d    xchg    dx, es:[41h*4]
* S; j# e0 v( v; }( C7 D    xchg    bx, es:[41h*4+2]9 @" L' g6 x! \% d4 e6 Q* I9 y
    cmp     cl,al( f5 ^( B( N# k2 R
    jnz     SoftICE_detected3 h  ^- o* u# J

, s. B- J2 ]7 i& i_________________________________________________________________________, V: p2 I/ r. t0 ^- v6 B6 Y
7 v& I1 K' }0 `( D! t: D
Method 074 ~# r; Z; q8 Q0 O
=========
/ A8 R0 P2 T) L2 r. \6 @$ N# j' F/ [0 R9 U7 u! r. F& C
Method of detection of the WinICE handler in the int68h (V86)
9 \' R( I4 l# d6 V. X- O
) q8 K2 T* {' Y5 C& k0 ^' f; K! K% V    mov     ah,43h) I4 h* ~( S6 J+ O
    int     68h
# r9 ~3 ?" r2 m    cmp     ax,0F386h. |" B1 U! S1 n5 ~
    jz      SoftICE_Detected
0 y% s- Q* Q4 H" y, V9 I  y$ [0 g% k5 L! |
* n, Q1 \4 P! Y4 F
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. o/ b( c2 [6 s- y" t) v4 U   app like this:
! |& p- I5 z& U) D& z4 t0 n- l0 G& \3 o# D0 v. m" T
   BPX exec_int if ax==68
' c, ~3 d8 C! e! T   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 ], y7 W% H( U3 g6 S! `, _   located at [ebp+48h] for 32Bit apps)5 W# P% u6 B" v/ ~: ^/ R* H
__________________________________________________________________________
: F4 s* m1 g/ s) n0 f
- l/ u" e% \6 A! J4 }. S5 g! Y# C! r" Q  v
Method 084 ?' ?( C1 z8 C& j5 ^. k
=========) P) [4 R9 i4 |& D
- ?+ j8 s/ O4 B  @5 B
It is not a method of detection of SoftICE but a possibility to crash the
7 l8 f: j0 b- \) Zsystem by intercepting int 01h and int 03h and redirecting them to another2 |' B4 L+ D7 ?3 n' A! ^; R3 `
routine.1 u' B# k( V  f9 _! [
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; M3 o3 [8 c5 x- ^2 ?) Jto the new routine to execute (hangs computer...)
0 j  f2 B7 e" A6 N# \4 c' a  a# C
4 f! ~7 t8 h: D8 `' H4 l$ D    mov     ah, 25h" ]. a2 _' P8 N: h
    mov     al, Int_Number (01h or 03h)
$ Y' F5 X# x9 k' J5 ^, q    mov     dx, offset New_Int_Routine) F) @5 ~; I* _0 b, V
    int     21h
0 f* F; l$ y. U. {+ N7 J) B5 R6 E# h# J9 T0 R/ m
__________________________________________________________________________
6 P. L: n- w" O, e( Q! x6 Y/ r! A3 C% j
Method 09# G/ p/ Y7 W; v
=========
+ x8 {9 [3 X( i8 n) P3 H, J. V, ]/ t( j% K+ R& E- v
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 d$ }6 n' [( p) p  D
performed in ring0 (VxD or a ring3 app using the VxdCall).- T, ~9 q5 D2 P" |/ {: V& f
The Get_DDB service is used to determine whether or not a VxD is installed3 M; y7 v* W2 B$ @( I  y7 O
for the specified device and returns a Device Description Block (in ecx) for: {; z, T* i% t+ ]3 `3 e; d
that device if it is installed.* ]  c) B  k; W/ e' j6 f+ o% S2 j

# t  k- [  L1 H) `% s% B+ d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ l  |6 B) I! b3 A2 F7 x% }# r   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* N5 T! T6 _$ d
   VMMCall Get_DDB7 n: }! W% a, ^/ M. ]* U9 |* F! ^: o
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ H6 Y+ y! N- q* Z! V/ _
5 _1 y5 x% i8 |' b5 \5 w1 n
Note as well that you can easily detect this method with SoftICE:. d2 L, L; D% k# }$ Q/ y
   bpx Get_DDB if ax==0202 || ax==7a5fh
) r- i, W0 f* y7 a$ \, R; r  h, C, Q1 }  L3 x& M
__________________________________________________________________________
' Q! i+ _! i6 {2 Q: f: V( k
8 j9 f! G6 z: l! s0 B# }" PMethod 100 B* B! ]9 h$ x  _& o" W
=========
; e, R& [6 v8 h; v2 m( R; M/ i( Z: q. g% T
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 c' R% W# Z  e, U
  SoftICE while the option is enable!!5 j. ~4 @) ]$ m# ]( P
* [& N7 j1 S, G% R
This trick is very efficient:9 L/ y7 V8 E+ c# ?
by checking the Debug Registers, you can detect if SoftICE is loaded( f4 p; j7 q; k' M! G$ F7 p  X
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if: I+ V, E" p; \* q
there are some memory breakpoints set (dr0 to dr3) simply by reading their
/ E% e6 @# _( H0 `value (in ring0 only). Values can be manipulated and or changed as well
) @$ H" q- Y) v! E(clearing BPMs for instance)/ S0 F. p3 b; P$ Q9 ~

8 g8 J+ h4 h6 w* Y! n% \% N) J' Y8 l__________________________________________________________________________7 Z- T2 }& }& l, P

9 b6 G; Z5 Z, b' h- r1 Q( Z9 |Method 11
; p. y& j% h+ ?( d=========
4 v; o. [  o$ T" h$ D( l
; f9 \* R% z# e9 B9 V( tThis method is most known as 'MeltICE' because it has been freely distributed
) E' H3 z7 h% O1 ?* xvia www.winfiles.com. However it was first used by NuMega people to allow
3 c5 t/ z: d" XSymbol Loader to check if SoftICE was active or not (the code is located
* ^9 s8 [" _' |2 m& F5 P/ Xinside nmtrans.dll).1 g, F5 l& ?( E# J% m$ b# f

+ }. K( R1 D' vThe way it works is very simple:
. X* N% ?9 Q( jIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
1 a. v3 o/ W+ B  ]WinNT) with the CreateFileA API.+ \: V  P6 v/ d( T* o
& H7 n  W5 [5 \
Here is a sample (checking for 'SICE'):
* k9 Y1 }+ [0 e# C1 x
2 y8 L8 i. D3 U( X$ W  Y& X9 I( SBOOL IsSoftIce95Loaded()7 X) L9 ?5 E5 @% T
{6 t) q6 l8 K) R5 j2 f( S
   HANDLE hFile;  
& f; G8 c* x0 l9 ^6 f   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,6 J: l" g- s9 t+ _" e5 |
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 t  D2 s; u  z; r% a$ I                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
, R. X4 I* k2 G& d' T0 N   if( hFile != INVALID_HANDLE_VALUE )) E4 ?# M# `$ s9 b, s9 Y0 X
   {
4 B$ z3 f) ?6 `1 L1 |      CloseHandle(hFile);2 Q- g/ ]# p0 k6 l& [4 z
      return TRUE;1 Q, z. k- _/ `8 j  F% `
   }
8 a1 J- o  D. ]1 W+ |   return FALSE;( x* E. v! P# D$ @4 ^& [
}; X6 N2 ]% s* _7 G$ }* L

$ r2 Y7 y. U8 u) w$ BAlthough this trick calls the CreateFileA function, don't even expect to be, x2 A' R$ s. D; z" t
able to intercept it by installing a IFS hook: it will not work, no way!
3 a. l! m% y' U% g1 _2 nIn fact, after the call to CreateFileA it will get through VWIN32 0x001F# |4 ^" d+ M, g% W  Z. P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 m0 U% c& Y0 land then browse the DDB list until it find the VxD and its DDB_Control_Proc. F' X2 W0 b# x
field.
  g4 r( G2 Z: X4 Y0 s% WIn fact, its purpose is not to load/unload VxDs but only to send a
3 }8 n! l% P4 j. ?1 m: CW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 L* F, C6 `3 _6 ~; u; r6 Q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" g  r* U8 d; G/ F8 jto load/unload a non-dynamically loadable driver such as SoftICE ;-)., v- h# G$ q) u
If the VxD is loaded, it will always clear eax and the Carry flag to allow- o* D* @2 v1 ~: D$ }) }
its handle to be opened and then, will be detected.8 z  U5 z# T7 {) n1 K2 E
You can check that simply by hooking Winice.exe control proc entry point  Y: Z9 }) A( e2 x& X2 ]
while running MeltICE.
/ o- v  Y" @3 i5 a8 Q+ l; u3 l4 w/ }! H
% U# k4 U/ n) x7 T
  00401067:  push      00402025    ; \\.\SICE
6 R; C# K$ [" ^. Z4 b  0040106C:  call      CreateFileA
, B; q2 ]% s* m7 J: H) B% G: b- N% j8 U  00401071:  cmp       eax,-0012 A0 y& O' _2 a
  00401074:  je        00401091
# P; O; y9 A4 t' Y: J& f
1 R1 v" B9 x  K( f9 s2 s. J/ F- o& y9 g) m5 j7 e# F5 E& q
There could be hundreds of BPX you could use to detect this trick.
+ d& c: d) f) h: q- @-The most classical one is:6 H& o" j5 y* h) e6 b' I1 {% m; ?
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' K9 J) w: z4 L% [
    *(esp-&gt;4+4)=='NTIC'
/ Q7 o- a- v# }0 X2 K3 \- \" a. r" k) x% N0 D/ K" p
-The most exotic ones (could be very slooooow :-(8 S' b& G" @% T) o
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 ~" H2 [/ j% e4 @. {     ;will break 3 times :-(7 t/ n( d: H- m) ~; k0 j  N
9 h! w0 ]8 v5 V7 M. u, y% ~5 h4 [2 A
-or (a bit) faster:
' Z4 E: M( c+ L  A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 X0 w; _2 ^( f, j) I. v( l  _) G/ |% n& F/ _9 n, J
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 o. K0 i' {: @     ;will break 3 times :-(
2 p5 }  ?& a! P& S$ _+ Y3 V, t- M" e3 [* Z
-Much faster:
' Z! q9 G" h2 f8 }/ Q" y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
8 W! [* R3 _* @8 S. K6 b* d; x/ ?
5 w( L; D3 g' E# M% H5 d4 bNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
& Y! x6 [9 T# o2 q$ Y, \function to do the same job:
1 l: H' F* k! {4 N" _
: @" U" g9 K: }, K7 y   push    00                        ; OF_READ8 K) I6 P3 P& m2 A& q! |
   mov     eax,[00656634]            ; '\\.\SICE',0
. P; k5 K* E! r! ?2 B% L8 B1 T   push    eax& S7 q* T: e  i" r
   call    KERNEL32!_lopen
0 b8 G# q1 i( M! |+ I1 q6 A" |   inc     eax6 F5 T3 k) E! O+ r7 x4 c: @) m
   jnz     00650589                  ; detected5 z  @: U% o' ~* Q2 F0 f
   push    00                        ; OF_READ+ f, A( k5 g" U+ u' e" \( w
   mov     eax,[00656638]            ; '\\.\SICE'
4 `# k" l5 n( u$ i   push    eax$ H8 c% x6 d+ V9 c& ?+ C1 v
   call    KERNEL32!_lopen# k( {7 C/ F" x5 z1 L$ i5 U
   inc     eax5 g& W8 j8 d6 S* P
   jz      006505ae                  ; not detected
- j2 y- Q& g5 O% `1 j* p( }# a: C
& Z6 q1 w- h* \! d" s( @1 F5 C
- k% n+ p' \8 D  Z__________________________________________________________________________3 G; E3 {$ e& p) Z7 j
& l* U1 c. F+ _7 b) O
Method 12  q/ r, n, H) C5 U
=========  T, A6 ], e8 Z, G* |: u' e
0 x; r6 y1 D0 s! |$ n: N/ N
This trick is similar to int41h/4fh Debugger installation check (code 05$ \. x/ r; C' j5 I. Z
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- ], D2 y0 C, [$ kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 ?$ p" l2 Y! g* O" y* a

5 o. u$ d4 z0 k1 s   push  0000004fh         ; function 4fh
; l  m: C6 b9 X9 i   push  002a002ah         ; high word specifies which VxD (VWIN32)
, h; G% a$ ~0 J% q/ l                           ; low word specifies which service& b. J' t+ {0 d! W7 x
                             (VWIN32_Int41Dispatch)8 `+ X, f, I  S# S" A
   call  Kernel32!ORD_001  ; VxdCall: G" E! v* h+ _; R
   cmp   ax, 0f386h        ; magic number returned by system debuggers1 x( V. S$ f, Y/ E' N3 C  [7 s
   jz    SoftICE_detected
: p1 ?: O( g' k/ }( ]# \9 H
$ b' x  C* q4 N8 r% L. B# v6 g! vHere again, several ways to detect it:
* ]* t2 g8 c% K, S4 |( ~( j4 a0 t" j- r
    BPINT 41 if ax==4f) @  c6 T4 C( i" s) z4 A
% y. R7 _0 H( b3 R6 a7 s. V6 S' W
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
( {" j( t. X$ ~2 ]/ c, K) n# s+ {& M4 e: W. O9 O  \
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! j% P; \3 ]- x! O5 y. L2 ]5 [

# ~# l+ [4 D) ]% Y% m9 l$ ]9 {0 \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' ]2 x+ `! a' Z* |8 A
) H- s! {+ l* i9 A__________________________________________________________________________
1 P6 g3 h7 N( ?4 a& L3 O+ d3 R1 G$ f. w; `5 {, _; K& ]3 i% w- r. b' t
Method 132 \/ |' A3 j2 ]1 }  \6 |& V
=========6 z  N/ [& d/ R9 |# R. A
1 i6 o  }3 E9 i4 t& }. X
Not a real method of detection, but a good way to know if SoftICE is  I  r* P/ c9 b/ m6 ^
installed on a computer and to locate its installation directory.
7 y2 s, I) k% d  LIt is used by few softs which access the following registry keys (usually #2) :" s  u, D/ r1 M/ ~7 t
0 c2 \! ~, s+ k: |0 {; |
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' a# J& _- i- \
\Uninstall\SoftICE
1 O7 M  G. |1 j+ M-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- l. X+ Z2 p8 X0 ?' S% L( z1 N+ v
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, |; I# S  U( |' z! _( p
\App Paths\Loader32.Exe  U) u: S! ~$ }( Q3 _4 v; a
! y1 |' l! k4 H

: W, `$ h: v! @6 n5 LNote that some nasty apps could then erase all files from SoftICE directory/ b: f  N0 x5 i
(I faced that once :-(
* M; [% I8 y$ l; @: o
7 O) f& ^$ R$ l3 |; ~# x0 AUseful breakpoint to detect it:. S! X( C, N/ v% X2 o2 f. x; ^1 i

# S3 D0 J7 K1 @# [! n4 E. f- [     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ q+ ]7 t( F! O! C* L+ W( X5 N' y( v7 d
3 w" L5 h' v! T, R__________________________________________________________________________% y3 t9 l* P5 \, e
- k5 R& x( D& j+ ?- r

2 J7 R7 U/ I. _! ^$ ]) {/ \Method 14
5 W1 Q" u3 U! T/ W& o=========
8 X& `( j/ Z, k# o( j, r. x
& @( Y/ `- X, @A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 l. Y. a  I# n" \6 e% @is to determines whether a debugger is running on your system (ring0 only).# ]$ Y/ x) m5 n% }, W
$ D# I3 \% v, J
   VMMCall Test_Debug_Installed
4 J8 ?' a# m) ?+ q8 l1 W3 E" e: T   je      not_installed
& l9 e* c3 h: E9 z+ x' q' t4 r# ~
This service just checks a flag.! T# l  g3 r! m2 F2 \
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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