About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" ~* O. M- J$ S3 T! [; V1 c) t, p( ^
<TBODY>' Y- g, W+ }% r
<TR>8 j8 s6 a4 i- K+ g% @2 {3 s; F. \4 f
<TD><PRE>Method 01
: T8 _6 @. ?6 `, S7 B4 K- W=========8 E2 A! F7 ^: z1 _' F5 v2 Q% C

, F* G- S7 h0 g6 T4 NThis method of detection of SoftICE (as well as the following one) is, ~1 _5 n- z1 A% U8 R
used by the majority of packers/encryptors found on Internet.9 u/ d1 w( s! b. @
It seeks the signature of BoundsChecker in SoftICE
5 K9 O$ b  |) c
' I$ y. g2 Z2 |5 K! ]    mov     ebp, 04243484Bh        ; 'BCHK'
! }  }) |( p8 v. W( _* X" Z    mov     ax, 04h( v1 Y' m1 @- V' H, e: G" w; [
    int     3       ' t! I+ W' t5 T
    cmp     al,4
) W, ~6 D8 ~$ c7 ^    jnz     SoftICE_Detected
3 n' q+ B, `* n6 w
; p* k4 l5 C9 S* B___________________________________________________________________________2 v* T( r1 y, t! Z+ c- M/ T

+ ~5 G0 P- }$ BMethod 02
. m# u  m2 a8 S+ e# g. p=========
) Y/ ]% Z& }1 H4 u- @- R) A* J8 r/ w3 S- e9 O' y) \
Still a method very much used (perhaps the most frequent one).  It is used
3 k. m0 Y' N+ ^  X5 a6 c8 Mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,$ t% J  j, m- v4 G  `
or execute SoftICE commands...  \+ J  W4 n- e
It is also used to crash SoftICE and to force it to execute any commands
6 K. P7 c: R( L  P0 y(HBOOT...) :-((  
0 T( H) {9 [. u; s" b
3 d0 r# M: C6 YHere is a quick description:, H- Y3 l( X4 J9 u. n5 S
-AX = 0910h   (Display string in SIce windows)
( u+ y9 |5 E, v: `* @! j-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 }$ m1 t4 R. L7 e* c: E-AX = 0912h   (Get breakpoint infos)+ T4 y# z8 u  j/ o9 u
-AX = 0913h   (Set Sice breakpoints)2 T9 k0 }( u5 p: `0 x, V+ J
-AX = 0914h   (Remove SIce breakoints)
# ~' D3 W  o- I' D& h
6 c6 \: d) g$ z4 V$ T4 `Each time you'll meet this trick, you'll see:
& p3 u$ N( |& t, f8 y% n% _; ]8 P) A( O-SI = 4647h  g! ]# n2 G% ^( s( [# j- T( x
-DI = 4A4Dh
* R$ y5 E: s9 bWhich are the 'magic values' used by SoftIce./ N" N9 X5 p' ^1 n4 L5 T
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.$ K  Q! C( a$ T- F! Q4 z4 O- P
( M" n0 F/ g, u1 ]: d* O
Here is one example from the file "Haspinst.exe" which is the dongle HASP8 Y7 {! E# L! Q) H
Envelope utility use to protect DOS applications:9 w1 G% k) q- K! @' q! r; a$ I
" d9 ~- {" y5 c* s$ @$ U. ?9 X
: r3 I0 p& i! R# I" h% y# k
4C19:0095   MOV    AX,0911  ; execute command.# [0 y  n* b6 O; n: [% r
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 x, z7 \$ e0 k9 W& L- ?. L4C19:009A   MOV    SI,4647  ; 1st magic value.& K7 |' R- W" X
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 t  w7 r+ o' I2 u% h$ |5 x
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- g% W1 `, R1 B: C+ ^; P/ ]6 l4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& T$ n8 o( K9 ^2 z- U( x4C19:00A4   INC    CX. V. }) Q* Y& t8 p+ \2 k/ h' D
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute) j/ Y; x- Y' h6 Z$ R# ^
4C19:00A8   JB     0095     ; 6 different commands.
$ f6 x: w9 \" |; s* M- Q, M4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* b, ^* l. z$ f0 f4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! X( {* f& k, Z; S
* C# k7 q; w0 }; R8 q! E
The program will execute 6 different SIce commands located at ds:dx, which# R# p4 _8 D* W4 y0 A  `# e2 d6 F
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 S) B  l6 I1 m3 g9 m

6 m) Z7 [: P% t4 W( z( a/ L/ _0 G9 c* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ g# \4 ?# v" M2 f
___________________________________________________________________________% h! e2 s/ |: \9 G4 z' b

+ O1 ~# S' Y' d4 s; G3 Y% w7 v, X# q, _
Method 03
& Q3 X, T# M3 d=========
- I/ @) c! }$ \% u
7 e1 e' Z' j) n$ sLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 H: ~- J: A9 Q
(API Get entry point)
4 F3 A! N2 V$ {* ]3 Y8 k$ w' w( A        
0 f4 e. @0 U8 D: d1 A, ~' j; A- e8 u6 s3 c
    xor     di,di
$ Y" S. l* c$ }3 S    mov     es,di
4 r* l# o- d* O# f! u8 ]$ z* e, U# X    mov     ax, 1684h       ' r" f( }$ d' w' L
    mov     bx, 0202h       ; VxD ID of winice
" }# z( `7 T1 y, s, c    int     2Fh6 X" F  b# q  w: g' d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! @3 c" @. G; [0 P: Q    add     ax, di
: r9 A& \$ s' Q1 @    test    ax,ax
' U7 I! j* ^! L# W+ E/ f    jnz     SoftICE_Detected
8 O5 ]+ `& f9 @
' n9 y$ X8 A1 Q___________________________________________________________________________5 F# C; D0 ]  w; ]

$ ^9 J# B- x6 F' a) R8 ~Method 04
3 P) F" T5 P" ^! s=========
- ~* U& \) }1 [, H: `7 [3 U( R0 K/ ~$ p9 Y! p, d' k2 }
Method identical to the preceding one except that it seeks the ID of SoftICE  U  V: I2 j* j+ p3 u0 E+ H0 O" A
GFX VxD.5 n" K1 u( J+ b- z7 N3 Z

4 U6 L. G, r8 ~* n* L    xor     di,di
3 U+ K0 L. ~6 e, h* o    mov     es,di
  h2 D/ J' K* I6 |    mov     ax, 1684h       / I3 g1 ~  m! w+ a" v3 J) G
    mov     bx, 7a5Fh       ; VxD ID of SIWVID. b/ K; h- O5 c. x% o9 Y
    int     2fh
  o# v/ i+ N! Y7 l    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 z- x8 q9 a- H% U0 Y$ r! n9 y    add     ax, di1 Q4 a, O' H/ s" l' g- m
    test    ax,ax- Y# |/ v( f7 x
    jnz     SoftICE_Detected
6 N) z' X5 D9 \6 @  j% A% ?
6 ]. W/ q# G! I. ^% N5 k__________________________________________________________________________
, ]7 y# V: X3 s# S
6 ?6 W3 n$ `+ ]7 z/ _% w
# Y/ c0 O' c+ V% m5 qMethod 05& z1 Y: Q* k2 ?, v! k4 e% K
=========5 `6 y0 W& o' T0 e% o6 k

, e2 \. `4 l) x2 M( E7 ZMethod seeking the 'magic number' 0F386h returned (in ax) by all system5 s5 f& u! ~$ R& F
debugger. It calls the int 41h, function 4Fh.
2 y8 L) C3 q" S* z% @There are several alternatives.  
. {  e7 }- d* Y! t' Y* G, ^$ d( u0 \" ?2 ?& r
The following one is the simplest:4 c( b0 G7 T( a' z4 I, i3 t
( {! W6 ]- `% ]! a0 i. q+ ?
    mov     ax,4fh, J& H5 t9 l* V' A
    int     41h
8 H, ?6 L# d; h! F; g6 o4 k2 X) G    cmp     ax, 0F386% E5 L0 a6 \' L' z, E  Y7 y0 l* A
    jz      SoftICE_detected
' O- V' T: j% z/ t. N9 N5 I  l; d$ P
7 H( p, _7 ^, C* X9 i
6 V. M- e/ I; m, h8 ]4 E3 kNext method as well as the following one are 2 examples from Stone's
% ~4 ~9 O4 a1 h9 U"stn-wid.zip" (www.cracking.net):7 Z9 Y' |: l  a6 [/ f

0 A9 C" h5 X7 w0 _: I/ S' E* p    mov     bx, cs
" a, t+ C8 T9 y    lea     dx, int41handler2
: @/ G3 _- _3 J  P2 y    xchg    dx, es:[41h*4]$ c7 v$ Z: K- O9 a4 t
    xchg    bx, es:[41h*4+2]
# f( s/ X+ d# b4 v: Q: s+ ?; @    mov     ax,4fh
( q1 g( l0 j  V* P* P    int     41h9 J% c. T: w: T, ~
    xchg    dx, es:[41h*4]: Y, K* H, y) M0 N2 i0 b  ?/ ^/ B
    xchg    bx, es:[41h*4+2]
7 L" X0 G) N8 T; f3 k( u    cmp     ax, 0f386h
' _' ]* s" j6 L8 E' s, N; v2 S7 u    jz      SoftICE_detected
8 U6 Q/ e; J" l2 C9 A/ l9 e& P% d, q
int41handler2 PROC
2 s6 q2 R, [4 N( F    iret
! E8 F4 G; M. W. J) pint41handler2 ENDP
# A8 E, D* p# Z1 Q8 [4 G6 d+ ^
, d" j  ?, v7 \; C  j% F: F$ n- G! s# v2 Y$ \+ d3 v4 n+ h2 C
_________________________________________________________________________
! r4 Q3 C" U( X
2 y9 W: R* S! A3 K) H# ~, E) X* ~: ]! f/ ^+ f8 ~
Method 06: `2 T) `- U5 |5 u  u
=========
3 ~* c* \; l5 R2 k9 }- w( y7 R$ z
3 Q0 [8 g) {7 y
% p, v8 Y3 s- |9 `9 w2nd method similar to the preceding one but more difficult to detect:
! _6 M) z& Y/ N3 ~# O( s. v- \/ L. Y
. M" P1 H9 u7 g* u3 W+ ~7 M7 I: f$ I, k
int41handler PROC: {! Z: t8 `. Y+ S
    mov     cl,al
8 t1 F% t9 l/ O+ f( N    iret+ Z4 k# V8 @2 A: J* z
int41handler ENDP+ D9 J# K- k. b
" h4 I7 W9 w# P/ o. s
9 X8 H/ U+ D1 c7 {2 E$ [
    xor     ax,ax
" y" }  q( ?2 E/ H$ V    mov     es,ax
* M$ y6 a, J" P: X. b2 R9 T    mov     bx, cs6 A0 n1 \3 U6 K: t
    lea     dx, int41handler
) A# L: }9 `- E; n5 U    xchg    dx, es:[41h*4]
+ O8 q1 {0 Y2 Z: d    xchg    bx, es:[41h*4+2]7 g5 [, E8 P# s  c/ b8 J( E
    in      al, 40h
: T; `, }2 j& n) K2 z    xor     cx,cx
: ^( s7 o7 ^6 z4 x/ Y/ d2 T    int     41h4 y5 i2 i1 }0 D1 `2 c: ?
    xchg    dx, es:[41h*4]
- m& o# L. e. D' \4 u6 F5 w/ n    xchg    bx, es:[41h*4+2]
$ _( G# [; h/ |; C% x1 v, @    cmp     cl,al' V/ y( b8 E/ x1 _; L
    jnz     SoftICE_detected
$ ]+ U' o/ e: e  X6 B& j1 Q: h- k5 n7 L# g- \
_________________________________________________________________________
9 ?4 R* f0 k& f- \# v! ?0 F# U6 E7 M2 {
Method 07+ i6 P- |+ h* N
=========) _/ K: X1 E! t# A) |

$ t) v1 Q' \9 m9 H: k; dMethod of detection of the WinICE handler in the int68h (V86)- Y" C# I9 E4 m5 v% j( I1 R

/ n4 ^, U/ L0 `! U1 ~' U    mov     ah,43h
1 \9 G0 S  T6 w/ M$ N) e    int     68h6 Y( h" @- C# ]
    cmp     ax,0F386h
  R$ }. [( T6 M) ~    jz      SoftICE_Detected6 \1 T  n/ D; A/ m5 J
, X, |. T7 Q2 A, {: ]
8 @$ L' o7 J7 E, ~. G$ q
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) C7 Z; d3 H2 V) u/ z. r   app like this:3 g6 u8 j2 e. n: E

! {* A, c: f, l# o* ~3 U   BPX exec_int if ax==68
! J/ x% N" b) u: I   (function called is located at byte ptr [ebp+1Dh] and client eip is
7 n+ a6 D6 \7 g" u/ i, }8 v   located at [ebp+48h] for 32Bit apps)" ~% i. h( s% A4 a9 g  G, N1 |% k
__________________________________________________________________________
1 ^7 s% W( R% A8 R
" l$ M5 J2 \6 U/ K# s4 l+ V
) U* R9 R  P/ F) J7 oMethod 08- F# Y! G- v* G  G
=========- V/ j) \2 N1 k* \8 k0 ~! h* C
5 W& p/ ?* i  _
It is not a method of detection of SoftICE but a possibility to crash the
7 |4 A. `/ d5 F8 usystem by intercepting int 01h and int 03h and redirecting them to another
3 B0 o% q  |1 Y  f8 Y# B/ r2 qroutine.
" R) g2 F1 Z$ T; v+ vIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ }; |; n, g$ F4 H( u
to the new routine to execute (hangs computer...)
* ~, N. G+ w2 o# E
1 D% P# r+ q& y) x. p, V  Z    mov     ah, 25h
' V/ n# V* B9 S7 z0 e: {& Z    mov     al, Int_Number (01h or 03h), h/ b& a" d$ [/ i) l9 v/ R
    mov     dx, offset New_Int_Routine5 {# T9 `/ q/ z9 }5 R& e4 |$ F& r
    int     21h
( X& X6 a/ _- {* y
5 x+ Q+ ~. X' D& X& F1 g6 E9 q: X__________________________________________________________________________
- i& J% r- {* q9 n/ C
' P3 j7 K: M" h6 B! `2 VMethod 09
- ^0 f! O& z0 p=========$ _- x$ M  w# e. U
. z1 k; u6 c+ B
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* S! U1 T+ r# `* Y3 z. R8 V
performed in ring0 (VxD or a ring3 app using the VxdCall).& W, s+ K* E) d4 a
The Get_DDB service is used to determine whether or not a VxD is installed1 c1 I, k4 p$ P1 A# E- u
for the specified device and returns a Device Description Block (in ecx) for
9 [: `0 q; e; t9 d5 r* J: m8 X8 j; zthat device if it is installed.: q- |7 R' U6 D* z

" [* c" Q' z! E9 ]; ?/ z* p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 A- ^/ M# V) u( q- E6 H& t
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% R6 o3 z* N6 |& i$ E* I6 ]   VMMCall Get_DDB
# o$ l! q( @" ^3 R2 h) {   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ p( a  e' Q, W# f1 c0 x+ v! h
5 V3 j# ^& D9 q: K% T6 _7 Q5 kNote as well that you can easily detect this method with SoftICE:1 w# e. _9 a6 a9 K
   bpx Get_DDB if ax==0202 || ax==7a5fh
9 G5 _$ R1 Y7 y, z+ C% h7 e# k1 b! @! o: L
__________________________________________________________________________4 [3 B7 ^' G7 l

/ W: |9 r+ b4 Q9 }+ n1 AMethod 100 N8 }" W' _$ c& S/ N4 X
=========& k; G$ h1 u1 f7 ]; B9 S: v

6 d1 q8 V3 f$ o/ c=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" B& l1 T$ v: l5 o2 E8 K- P; c% y
  SoftICE while the option is enable!!1 u; P% ]; p4 F7 T4 p( A9 F5 Z* c

2 C' ?: F8 X6 Q! @$ a  hThis trick is very efficient:
8 W) M0 E) i0 Q; ~" q+ Rby checking the Debug Registers, you can detect if SoftICE is loaded
' s( h; h6 F) K! G/ y0 k/ \(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( D8 |6 F1 y; A8 t, E0 a5 @
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( q' T8 D3 v* t5 ]1 a: L2 uvalue (in ring0 only). Values can be manipulated and or changed as well. @) E: C* A# @9 a
(clearing BPMs for instance)
. u* q9 G7 H. ?2 a& L/ e+ i5 I' v1 F, o) g
__________________________________________________________________________
% H4 w7 }. e0 [; y1 y% \) H
4 J. O% @  P! oMethod 11
8 Z4 Y6 S( I7 h% ^=========
; J  y% }5 d) e* T* c' J* a
  o2 ?- @2 |+ E1 AThis method is most known as 'MeltICE' because it has been freely distributed. z0 g* ^: T; Q1 p! S5 Y
via www.winfiles.com. However it was first used by NuMega people to allow  h/ i9 Q- ?! c5 w# d* O1 o
Symbol Loader to check if SoftICE was active or not (the code is located
& W- I2 R/ [4 R7 F, d$ ]inside nmtrans.dll).
4 G* W2 G& Z) F  k& T/ b: O9 U1 l, b9 q7 R0 {( |
The way it works is very simple:( z5 V# Z' M0 P8 J# E8 U# _1 q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) _2 {$ f* n7 T7 l+ I# n
WinNT) with the CreateFileA API.
8 E. s# {% `9 {. x( M- _9 n# |7 u9 w' B4 E& [
Here is a sample (checking for 'SICE'):" K9 w8 |- ^' d
# P: K" j6 O& r; ]! P7 t  M
BOOL IsSoftIce95Loaded()
4 q1 `  e- \2 t! {4 ]# H+ a" m- _{
; h- {% L$ \% @" _0 G4 f   HANDLE hFile;  
& _( n3 G/ T  z/ Y9 K% b9 P2 V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% f+ H0 |3 A" B6 [9 e
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ E! @3 ]$ |" U9 N. [6 i9 u                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" l: E/ X& _8 `5 C   if( hFile != INVALID_HANDLE_VALUE )
& W" `- y/ c) c+ K   {
9 I/ n5 c- O/ p2 {5 H% T      CloseHandle(hFile);
( [0 M( a- S7 {: b1 ]& H      return TRUE;/ a) g3 X( w. e8 \% p
   }+ n( V( R4 m% e
   return FALSE;
1 j6 @5 ?$ ~/ A$ @" w7 t5 F4 {}6 I% {* U2 o! N) D# {

* I1 \6 v5 ]' V" h9 l/ p$ G/ _, EAlthough this trick calls the CreateFileA function, don't even expect to be2 Y& f3 k- J. d
able to intercept it by installing a IFS hook: it will not work, no way!3 d. F. m, |/ t0 v
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, A) e. |* i7 u5 H3 s& U
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
  l. \* a, z% O3 \( _$ q. c: ^and then browse the DDB list until it find the VxD and its DDB_Control_Proc, f( ?; @6 H  Q
field.
2 W+ w% ~: T1 o% u3 d8 j- DIn fact, its purpose is not to load/unload VxDs but only to send a ( F+ W- }2 Z  G0 r9 N6 v7 W( y( Z2 |: Y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) d; O% g9 E3 u, [: S- t% q( Rto the VxD Control_Dispatch proc (how the hell a shareware soft could try4 [+ T2 ^7 t. z0 \2 O
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
* Q/ c7 R5 o, u, LIf the VxD is loaded, it will always clear eax and the Carry flag to allow
+ |- ^5 t  o( m6 D" {, Xits handle to be opened and then, will be detected.
! @5 l% Z6 i/ r5 h9 NYou can check that simply by hooking Winice.exe control proc entry point+ @4 o# @$ v/ C# E! k) G
while running MeltICE.( T7 I- O8 _8 [! ~2 Y+ h

! S$ W8 K- e" J$ u4 g
/ C2 F- M+ D$ c  W0 W  00401067:  push      00402025    ; \\.\SICE' _% c6 a5 j- ^7 g
  0040106C:  call      CreateFileA
5 u+ v4 N" b/ V2 Q; C( H1 A+ J  00401071:  cmp       eax,-001' S7 B' N- m' D! ]7 g, |
  00401074:  je        00401091
( v, E, J) p& E0 e& z' W, h% J0 r5 y. G) i

( @+ ^: U/ H# hThere could be hundreds of BPX you could use to detect this trick./ g2 X" u! J. s, h$ \
-The most classical one is:  F2 j1 I: s2 k. y
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; y; L2 i+ ?( v# J9 F    *(esp-&gt;4+4)=='NTIC'
1 N* R( S& u  j2 n
8 W# y! k. q: }- Q8 S9 a. ]6 Y-The most exotic ones (could be very slooooow :-(
* L" p$ X/ [+ O* S3 m4 u  T6 F   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ }% Q1 f  k, E) n7 o$ ]     ;will break 3 times :-(
7 u5 G  L# b$ p: m# ~0 f  D
8 r' z" D6 p) t9 W  J8 }7 N7 s-or (a bit) faster:
& E1 R0 x8 L5 t' O4 V   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- u5 \' M3 o! }! \0 d; D
' [4 v: o7 u/ Y' C, ?9 Z+ c/ ^   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  * Q! ?$ s3 ]1 M6 f
     ;will break 3 times :-(
; C9 l4 I5 P+ S8 L8 u0 o2 h2 J+ T( D5 U
-Much faster:+ M; d& I7 j3 P5 r& q" `
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 Y5 I- y; [3 M8 I2 }# c& J
. g5 F; z* `; J* o# A
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen2 [: a1 b* q' V3 a& D. r# m! ]
function to do the same job:
( Y& f( @$ F  N! O8 d0 v  ]4 z2 _" X& w. }$ ]# _
   push    00                        ; OF_READ
8 E. _" ?) q- T   mov     eax,[00656634]            ; '\\.\SICE',0
* G& m' d9 @7 E& l, v( ^   push    eax6 Z+ B; w* U6 U) q
   call    KERNEL32!_lopen
! t/ \+ I! j$ k. h; V3 K. j( O   inc     eax) b' L: d( Z" L) Y+ O7 ]1 A
   jnz     00650589                  ; detected
- A. Z( W" j6 d6 |; G8 q& c   push    00                        ; OF_READ; g8 Z0 \5 @+ j' s# o3 @
   mov     eax,[00656638]            ; '\\.\SICE'; E( D2 [  U( x: R) d7 a5 z
   push    eax
$ d! {( o7 D7 l. F, n   call    KERNEL32!_lopen' y/ C8 W& X8 \, _' _
   inc     eax
- O3 n" P5 {9 S& q( J   jz      006505ae                  ; not detected; z+ K- h% v5 m9 ^. p8 K
* n2 O! E( ], i2 D8 H) q
2 Z( s* g7 r- o) j# g
__________________________________________________________________________5 q( w5 p, N. W
* w7 X+ W/ J; |" i. h, g* S
Method 12% }. g3 U- {- v4 x3 z7 s
=========
2 y6 s: W  I5 L6 a, p( G) U  K  L! ~4 Y! p- n3 `& N) m
This trick is similar to int41h/4fh Debugger installation check (code 052 h) F4 z( G. f' O0 s2 J
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
6 r( {2 u) ]) `4 ]6 Z9 oas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; q7 V+ A% D* e- Q6 I" w
4 |' L: A! U- `   push  0000004fh         ; function 4fh3 B+ \; s( x& _; x. X2 o0 C
   push  002a002ah         ; high word specifies which VxD (VWIN32)
& H% _4 P+ ^# y6 T- z4 k. l  A4 l1 T9 q                           ; low word specifies which service6 T7 t  j5 V# g! p% ]/ n
                             (VWIN32_Int41Dispatch)8 r+ m( D" X( [% |* \
   call  Kernel32!ORD_001  ; VxdCall
: v' A7 `5 V0 r* Q1 V8 z   cmp   ax, 0f386h        ; magic number returned by system debuggers
  g, P- G4 m( J' t   jz    SoftICE_detected  S/ ~, k: C1 _* e7 l; m

; e# i5 o7 @- B# @: Y- @/ u) e. n; u5 fHere again, several ways to detect it:4 p: V6 B- j. ^2 s8 R3 ^8 [9 T
) [' |" y5 Z5 G! [5 C. I
    BPINT 41 if ax==4f) G4 L5 @( d! e( b" n6 P
" `" \; T/ h; c+ F2 Y# d, u9 V4 s9 ~
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 F5 {- U/ o5 `) z. S5 q
" d8 |3 E- Y: y; g8 N4 p& o    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
( ]. }) E# w2 V0 r' O: ^. [  C. y5 {+ g/ t" O& L5 y; Q% u
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 w7 D+ @: S7 B2 h: ~. Y
) |  m& g. W" p" q2 B; ^5 ]' f
__________________________________________________________________________$ b; n) \5 W' E2 H- S
& F6 m6 x0 A2 i& `4 ]2 K/ ~
Method 13
5 F$ t$ e! a7 `; q! o# I$ s+ E: W/ h=========. X8 [1 F/ R1 q
, t" M& f, q. V9 `, Q
Not a real method of detection, but a good way to know if SoftICE is
$ H5 T( k) d4 Z& O/ ?9 xinstalled on a computer and to locate its installation directory.* y* G/ `5 w# c$ D/ f+ e
It is used by few softs which access the following registry keys (usually #2) :5 f+ |; I( ]! D0 h( U" n

( r, p- ^8 f5 c6 L$ @& y. u; R  |-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( S4 N$ y7 Z* n0 p
\Uninstall\SoftICE  p% V9 s9 ~- s- T. h, m' x( }
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ a" V" |& _- k
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 Y  v2 m1 X' `7 k1 K
\App Paths\Loader32.Exe
* W* X; I# z5 P" x3 ?" v9 w
. _2 Y9 `3 Y9 D! |4 Z
9 q5 ~( w/ P4 w& C7 x$ `4 T6 j5 K; LNote that some nasty apps could then erase all files from SoftICE directory3 M1 j1 P. V5 o. H& E" J
(I faced that once :-(& h% h" m4 [, ?! H
4 x2 K' Q% ~1 I
Useful breakpoint to detect it:, q" \1 G$ d1 O3 x6 T; k) S
  _# V& }* @% T. L
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# g+ F5 ^, _8 N
( s& u& `7 W2 `( d__________________________________________________________________________
# [, x+ r% w$ b  B2 H8 w3 P$ P

2 K1 N1 U' l4 @9 p4 J, UMethod 14 ! F/ R$ Y/ x, @# |8 W& _, @
=========1 l- p# i& h9 Z. {' k& D

" i/ x) B( k. t# ?7 qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) n0 H7 M& j( c+ p/ u, N
is to determines whether a debugger is running on your system (ring0 only).
" X# \9 ~  \, \6 _4 k
" h0 ^1 W6 C, g! ]! N   VMMCall Test_Debug_Installed
8 N1 a+ E9 d8 p   je      not_installed
  z6 h$ p- D, A  \* t! X
* i; I8 F9 @) ]+ g+ fThis service just checks a flag.
4 G: H5 I- x* U: K' C6 P% j# e</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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