About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 p7 q& A; y0 H1 f' V<TBODY>
! C, }) {/ Q* j, a: D: U) A0 l<TR>
  ]- H- d5 z1 j6 C" k<TD><PRE>Method 01
, J# {# K7 Y5 I) k% ^  P* V5 y' g=========
4 W5 X: F) p0 A1 f6 S  a3 _1 \1 f! W% y- W
This method of detection of SoftICE (as well as the following one) is
2 o; o; H5 [' b7 o; dused by the majority of packers/encryptors found on Internet.5 X0 n9 T2 _+ D' Y2 |
It seeks the signature of BoundsChecker in SoftICE- K) m; u5 f8 y1 L% X+ t& s9 O
4 L& e. u" Q8 {5 p: A9 Y0 R5 |
    mov     ebp, 04243484Bh        ; 'BCHK'
6 t; p" U) R9 Z( m8 l3 m) k    mov     ax, 04h7 }7 {. W) `0 c% D! ?: Q
    int     3      
& V: D5 u% }1 p! }6 Q& Q  v. v    cmp     al,4
0 B1 H1 g# Y- c    jnz     SoftICE_Detected: E( w7 V  ]  g% [" }1 k- L! O

7 n4 ^' L2 v9 K, ^& u___________________________________________________________________________
: U+ f+ U0 c8 @1 z
' b$ Q4 w# {- I5 x5 G+ CMethod 025 Y5 ?+ n9 m$ o) s+ |2 K
=========* K" |1 _, ?" \/ `

' s1 Y4 v% Z; G9 Q% l9 AStill a method very much used (perhaps the most frequent one).  It is used- ]7 ~6 W% P; D9 @, J+ ?; y$ d
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
' X. r$ a* S9 Dor execute SoftICE commands...% T5 n- p* X7 T
It is also used to crash SoftICE and to force it to execute any commands& m# i: F, }& I, z
(HBOOT...) :-((  
  A6 E, T8 C, l( _) U, q8 u5 t6 ~8 q5 y$ d5 k
Here is a quick description:
+ F, Z8 `  V3 Z- _) M% o3 o-AX = 0910h   (Display string in SIce windows)
% g% t# h9 T6 {  M8 v- c-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
% p/ `+ J9 Y5 g1 M-AX = 0912h   (Get breakpoint infos)& M- a8 g8 n' \! y- c- m' D" e
-AX = 0913h   (Set Sice breakpoints)
: D' j/ h8 f' I. ?1 M( e8 O-AX = 0914h   (Remove SIce breakoints)% j* F6 W, G' l0 U% Z! ?" H

7 f, w: q6 j( {4 @0 u, g: F! xEach time you'll meet this trick, you'll see:- P" q( s3 Y; b- D! n. q" P$ |
-SI = 4647h
& W) w* p9 W$ E! w* f1 B- K& ^-DI = 4A4Dh
. }4 T( Y9 n5 kWhich are the 'magic values' used by SoftIce.$ T) l% u! g4 o0 D' |- [# e
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.! d6 j4 y( Y7 |

" j$ J9 N+ Y( M% p' \Here is one example from the file "Haspinst.exe" which is the dongle HASP1 R' j* H: C7 n. q
Envelope utility use to protect DOS applications:! B# E: e; I7 `# z2 ?  Y
5 L( y- w4 F8 ]1 v+ X! |1 ]
& T3 P3 _; W/ I9 ?1 I" @* |# ~
4C19:0095   MOV    AX,0911  ; execute command.
; l3 b$ Y. P9 a/ s' i4 [/ z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
9 w6 [# L% {6 }- @- a1 |2 x4C19:009A   MOV    SI,4647  ; 1st magic value.
) P9 O8 ^' G: k1 h8 }: F! t4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. }6 j; C' O) e7 Y. p& c4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ l7 t7 D, C, W7 L4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! T0 d# |3 c6 W. f" l3 q
4C19:00A4   INC    CX4 s4 n; ]4 W0 D, R8 o' V: b3 U
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. _! a  s/ d8 s: M0 n
4C19:00A8   JB     0095     ; 6 different commands.
1 x- F1 p" w: |2 ?; t  b4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% a6 Y  K+ ^  G. q8 f" F$ G" Q
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# @) k9 R4 [+ y; M8 Z9 U, q
3 R* W' Y2 s, J7 a6 s& [
The program will execute 6 different SIce commands located at ds:dx, which
( n( R8 U# b6 lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% n- t) ?6 b( i. e6 M% B" f
/ X; @1 j0 c% ~& p1 G2 m- Y( }1 c* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' k* ~$ L  _2 D" _7 ^0 Y; `
___________________________________________________________________________! P# f5 ~6 p- L" |

9 H& C1 o0 k) @# |  P5 A9 j7 d# S4 @
Method 03& C* I6 f  }8 C9 Y2 |, F0 c
=========+ |! R1 F' x' o+ {: ~

6 H) T. a5 }) K" I8 Z2 u3 KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 R+ V& S7 P: ]) R: ~5 H
(API Get entry point)
3 ]) M3 E0 g, m2 t" S2 |* O        
8 q) {3 d& _2 A+ F
* m# ]* G1 M7 ~8 f: q) L1 L" w5 s    xor     di,di
) \; D, t- S: f1 Y7 k    mov     es,di9 v6 i* Q9 h& _9 @
    mov     ax, 1684h      
; C5 w' `9 h; Z- V    mov     bx, 0202h       ; VxD ID of winice
* q  @& z- Q! ~; T% z- H    int     2Fh# }# ]& O- N3 c; K) R- D
    mov     ax, es          ; ES:DI -&gt; VxD API entry point& \/ x4 ?% w0 v3 d5 X
    add     ax, di
! S  I: d8 U2 h    test    ax,ax
, V& Z, y* B( L  e    jnz     SoftICE_Detected0 D  t! j" x5 f0 a

3 e$ U- c3 R1 x  ?! E% L___________________________________________________________________________
/ ^) x# T2 u" A& @$ E% e, H) }& w: D' c7 P
Method 04
/ [% G3 ^, A6 O6 A3 [' A6 w( J7 c=========
, O2 V( T5 u6 V* I) L: s7 p
* T0 j+ K5 h. I$ A( f9 xMethod identical to the preceding one except that it seeks the ID of SoftICE
& Z2 Q9 g. x7 ~7 z5 d. f/ }GFX VxD.
, x% u7 L6 O& J- b! z
4 m$ n, D8 z$ S7 X/ y& i! S$ S    xor     di,di
" I2 K0 ?4 B3 j1 _0 S2 w2 g+ W: v6 ^( m    mov     es,di- \) |8 V  W5 S
    mov     ax, 1684h      
% r% L$ \( e( h    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 B6 G- C+ L. T7 ?( x) T4 m    int     2fh
7 o) v, g4 p* E/ ]. X5 W; K! m, n# C    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 e, c6 N) R1 o$ F6 U    add     ax, di9 J6 O5 i' |; T2 B
    test    ax,ax
; A; ^$ N. c& g4 y, l    jnz     SoftICE_Detected8 e- z4 T( B  r# ~: n3 i- }" e% A
( {1 V) F* i" e
__________________________________________________________________________7 E2 y, n- v2 X  X  a. [  D
' ~4 n* {2 A) Y1 Z" ]& u8 w! H# n

, ~& ]( ]% x1 v6 P, ~" i- P$ K- vMethod 05
: r( U: O- M9 m2 n, U/ V=========
& p. {' n1 O+ n4 f
) G$ c& J) n; G/ jMethod seeking the 'magic number' 0F386h returned (in ax) by all system7 l/ x9 L* a  E# c8 {/ W. x- G
debugger. It calls the int 41h, function 4Fh., t: Q& y6 C6 x" ?
There are several alternatives.  9 y3 M; W9 _' M

0 b  i: j; t  h4 d0 HThe following one is the simplest:
+ f6 f# k  C$ D5 u$ Y" j
; o; O8 N1 \9 e2 j  ^7 g    mov     ax,4fh% g& m$ y* V+ J
    int     41h- N8 b' K1 A' T& A2 P) t8 N
    cmp     ax, 0F3863 J' e5 j5 X' a- L: |9 {5 Z4 H8 D2 K
    jz      SoftICE_detected
7 N/ C6 l+ b# R4 f4 r
6 q8 n, X& M; M0 G  N$ [5 g8 d' h4 U* g2 s' _6 |/ `: J
Next method as well as the following one are 2 examples from Stone's
" p: ?; `; r; p) m/ r$ G"stn-wid.zip" (www.cracking.net):
0 G* Q1 k5 G6 Q& q
$ N3 t9 I# ]* Q9 [7 _' m9 y) t    mov     bx, cs
+ K9 [0 ~9 _! q. L+ I    lea     dx, int41handler2* u0 `$ l% _! ^, i# }
    xchg    dx, es:[41h*4]
! z9 e  b7 `! W5 b9 r$ Q) H& n1 ^    xchg    bx, es:[41h*4+2]+ n( L! O* X7 [! t
    mov     ax,4fh5 q/ d9 N/ p. }' w' z' d9 s; r
    int     41h  T4 N2 V, y/ z5 S
    xchg    dx, es:[41h*4]
4 b/ O* y& a, }    xchg    bx, es:[41h*4+2]7 s/ I# }- M& r7 b6 g9 D$ k) j: e
    cmp     ax, 0f386h% s1 [9 \6 @- @& w9 |0 a4 G
    jz      SoftICE_detected
% A' o: e* E& p2 ^: M6 o- b+ [3 K
int41handler2 PROC8 Y, Y- I4 G. t* U6 I  Y2 K
    iret
- t+ W" e/ c2 H  j7 J0 N5 S! yint41handler2 ENDP' h$ i% o5 J* A2 I& f/ F
7 ?1 H3 Q- x$ m# H
, @: I: I) D; u2 M
_________________________________________________________________________
7 a; K3 U) I1 N' j# ~$ Z) n( z. Q& d/ E5 o5 Q9 U- O

0 x$ \9 Z# F2 [, q+ d3 a4 h8 H$ g7 j& tMethod 06; p* ?: m; d- {% V8 y
=========. O% J; z/ y7 F) O7 Q& W
. F" |  W3 B& a, C9 E. M# D+ _0 _% y
# f1 y, H) H# y: L% d- Q
2nd method similar to the preceding one but more difficult to detect:
7 B/ F# \" F- u& I$ D: k0 b8 C$ j, S
7 Q4 [- \, N3 H( o0 c  j$ r# l- {+ o( s
int41handler PROC
/ m- D2 L3 t: u) m6 k  y- Y    mov     cl,al
# x" J* g7 @$ z) \  |! ~+ }) z8 r    iret
- z, E6 m  N2 s5 U- ~int41handler ENDP
5 Y1 |8 i4 Z$ k: O, g1 o- o3 I6 W3 d' Y$ N/ J/ S+ J$ |6 a

, o* |4 [  H" O; S' D    xor     ax,ax( i3 D$ o1 N5 ]( `
    mov     es,ax/ V2 z7 d1 l' _) V, f( G
    mov     bx, cs/ L% [5 ?! x, Y. Z! r- c4 O5 c, ]7 j
    lea     dx, int41handler
1 w! k" J1 M* M9 c2 T- D    xchg    dx, es:[41h*4]1 v6 @. |# B; A+ X2 ]2 o: Z' ]( P
    xchg    bx, es:[41h*4+2]: X! D% }1 q5 c, P2 q( z% ?+ x
    in      al, 40h$ r* L0 u8 k0 |
    xor     cx,cx
  M6 J9 q' w3 v8 g; o  l8 R    int     41h
; [5 |6 O) W3 v) p& w5 \0 z  `    xchg    dx, es:[41h*4]
& B+ ]1 ^. \( e2 c/ X# ]- y    xchg    bx, es:[41h*4+2]
+ t, @& T  q9 G2 U4 J- n; j. O# d6 l+ u    cmp     cl,al
& B4 H0 \1 C0 J    jnz     SoftICE_detected
5 L' R3 g2 p0 X' l6 N& Q: P6 a  h; a! M! V
_________________________________________________________________________2 a" a6 }$ V( Z0 Y

) g9 m" C8 f+ [% ]: h: R# R2 {Method 07' N: V9 a; n0 e  X3 h7 }; [
=========
+ ~; m& O# M+ A+ _3 V" ~& e# ^5 k8 k4 ]4 ]+ s. y* z
Method of detection of the WinICE handler in the int68h (V86)
' U; C  W& n& |& |5 |$ v8 |) |
: ]! a( L, J" e# a" P3 Q    mov     ah,43h
7 [3 i: [9 y2 n! k, a    int     68h
$ w" c" c9 }2 p5 P, g. r    cmp     ax,0F386h  j4 C/ i' P& c. c. _- z" i/ R
    jz      SoftICE_Detected8 b/ |- U- P6 O
, O  q* F/ h8 m

9 o. I5 x' Q5 S: L( _$ n. X' O=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. I2 h% l/ Y4 Q% N+ K/ D   app like this:
6 L" G7 j" Q( _8 K) y3 x
4 W1 K# F; ?% ~: [* `3 ?  P8 u4 x   BPX exec_int if ax==68
. B: @7 {. L/ E) T$ N5 \   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 T# p) y. G# M* m; T8 v   located at [ebp+48h] for 32Bit apps)# [& O& w' X* C( q8 x! E( Q& V
__________________________________________________________________________+ W% ~; G7 Y9 o0 D. D7 x7 x
8 ?% g* M2 O" z$ G- @
+ N: I4 `  x5 P7 d
Method 08( g% W% F0 ?. b* a1 U" N( H
=========
( f3 ?4 L6 s3 ~* \* G- I; I
8 s- g+ z7 w& ]- ?9 U' aIt is not a method of detection of SoftICE but a possibility to crash the/ h% ~( @6 R. U: i
system by intercepting int 01h and int 03h and redirecting them to another
$ ]& \* j+ R2 Sroutine.
) @* q+ Q5 f( F- z. h" ^  x. D" ?6 K8 EIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" P$ o( E) o/ l+ P+ Eto the new routine to execute (hangs computer...)
+ s' }! l3 |1 k
+ z4 X" o; _6 u4 f6 ]$ ~    mov     ah, 25h
1 Q& h5 v7 m* u    mov     al, Int_Number (01h or 03h)) g  g, h2 \4 w# m
    mov     dx, offset New_Int_Routine
# d: c' v: n2 N: I! d* Q6 v    int     21h3 e( I' q, e( l( i6 k4 d: M" c4 E

2 ?; w# @! {& t4 L9 y1 R6 V3 q* v$ x__________________________________________________________________________* c4 q  i' `. `' P( n( F2 u3 x- O5 [4 u

$ t6 V  _  o7 q- }. CMethod 09
2 U+ i7 O& H& T1 V, m=========
) z$ v4 k1 O3 ]) |. i% M1 x
; V  k4 U8 L: `3 V3 tThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 y& u; e- J) r
performed in ring0 (VxD or a ring3 app using the VxdCall).. K, O  Q: d) m3 n
The Get_DDB service is used to determine whether or not a VxD is installed
5 C# q5 q- [* m( @) O  a) Vfor the specified device and returns a Device Description Block (in ecx) for0 b5 g* Q. u8 {$ L, z
that device if it is installed.- I& a6 `( y) Y- a
0 m. S1 z* f/ a# a4 _, r, y- g
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID  V7 t. H% j5 }! o
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; ], s0 h* y) ^6 z* G   VMMCall Get_DDB0 r1 s0 r& Q: c" L
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed; j3 B! a$ l: `2 s+ D- H
9 D, o2 u/ o! D: ^; c
Note as well that you can easily detect this method with SoftICE:
3 q, e/ G9 A5 Q0 Z# R   bpx Get_DDB if ax==0202 || ax==7a5fh' o; H1 u. y" R9 S- c9 `

) I/ {+ W$ R, S0 A6 P3 A__________________________________________________________________________
4 |8 s: G1 W& U0 \- l
* C9 J- c/ U, F7 U" F7 Q5 M! WMethod 10
  u3 l0 q5 F9 R! g5 w( s3 W2 }=========
0 k7 p/ i/ _2 ?# M
/ {7 D5 s4 Y9 G=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 L! m2 g/ m" R3 Z* B5 N) m
  SoftICE while the option is enable!!
& w9 x( F( D5 Y
0 j+ I* U$ l; M; X) dThis trick is very efficient:; b9 Y) _" W( W  a, T. v
by checking the Debug Registers, you can detect if SoftICE is loaded( T  A  d' h! u) _0 F* H. o
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 o! p; r) {& cthere are some memory breakpoints set (dr0 to dr3) simply by reading their% Q) L  G+ d1 f& a
value (in ring0 only). Values can be manipulated and or changed as well
4 x  h1 h: _3 Q; Y$ D1 F! G6 l(clearing BPMs for instance)
/ w- p: T$ f5 L/ U3 @
" [8 _! ~" y0 h& z__________________________________________________________________________
- m7 r# A9 d; ^. Q4 a+ z* T3 O$ ]3 u( G, y
Method 11
( ]& o2 i" z, Q# ]=========
  a6 V$ Y0 y. p3 Z- C; \3 \. O7 B) R$ B- M2 l  w
This method is most known as 'MeltICE' because it has been freely distributed
/ ?' U# {2 L/ ]& c5 C  Uvia www.winfiles.com. However it was first used by NuMega people to allow
% Q4 g, j& ]/ n8 uSymbol Loader to check if SoftICE was active or not (the code is located
- }7 E! }+ |; l+ F1 Z) Pinside nmtrans.dll).
- p" W7 ?  q9 {0 M7 m
) \+ n# Q3 G, F, t* Q; OThe way it works is very simple:+ k) ~, q# g. l- S
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: A0 B, }. Y1 J/ E  f! \" g% N5 t, c
WinNT) with the CreateFileA API.
# i6 K8 w# ^8 t# n$ _
0 D8 t4 z( J7 \Here is a sample (checking for 'SICE'):
" A+ `' V8 A4 P+ ~0 g) f* X
+ }7 n* p- N  v6 G' l3 D0 _BOOL IsSoftIce95Loaded()
, p& U. ?8 \! a" O* W/ _{- q: g/ l# s2 a" \. D: w5 Q4 y" _
   HANDLE hFile;  
: J% V! l/ j$ l, |5 N/ L: Z   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ o  z* j7 q. C# ^                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# L8 K$ V1 g" ~" Z& S9 S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 R8 X' U6 H  s; Z7 ^$ E0 W. S
   if( hFile != INVALID_HANDLE_VALUE )
1 f8 o: q# L. Y9 ]   {
5 o: h7 Y# q: g      CloseHandle(hFile);6 h# M( u4 e4 f2 ^. ~# }
      return TRUE;
$ K6 E( h: C$ J, ]   }
8 D+ d1 ~3 Q0 M" Y   return FALSE;- x; n' W: B# s
}
0 C" l" }8 g2 \9 d
& ^. x- D3 H9 @% JAlthough this trick calls the CreateFileA function, don't even expect to be0 A- I/ |+ e4 y1 z7 [+ {% x( z+ n! ?
able to intercept it by installing a IFS hook: it will not work, no way!
% m. Y5 C) v1 n9 w! JIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 K3 Z0 Z7 O1 H6 d$ Q- U: y" Z" `service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) H4 {/ h  ~2 @" A% N$ ^and then browse the DDB list until it find the VxD and its DDB_Control_Proc
. @$ t7 j' ~; _) Q# ]2 ~- n+ Wfield.
. ^- ~( `1 K( y" EIn fact, its purpose is not to load/unload VxDs but only to send a 6 N: }$ S! T: M9 ]0 e- ~
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 e7 ~/ E6 [6 h  y2 bto the VxD Control_Dispatch proc (how the hell a shareware soft could try" |6 J) o, }) ?- c% Y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& n8 e8 [/ j. w& C/ U  O2 c% r9 yIf the VxD is loaded, it will always clear eax and the Carry flag to allow
4 Q& }( j2 n3 l" C2 p- bits handle to be opened and then, will be detected.
* s( b  t2 ~, CYou can check that simply by hooking Winice.exe control proc entry point4 I+ x" G- m1 v8 o9 c. Z
while running MeltICE.. e& R3 ^- S; ?/ ?$ Y3 B$ e+ Y
- ^$ R& f  S% _% P6 R7 S6 K4 l5 j

1 ?2 M, ^9 ]2 r0 s4 b3 d! p  00401067:  push      00402025    ; \\.\SICE
2 l% M% ^7 v; `  0040106C:  call      CreateFileA
' {5 p) _6 ~9 |- P# X0 u  00401071:  cmp       eax,-001
  n) s) q& [4 X6 H$ _1 E  00401074:  je        00401091
% b( _  L# i4 r5 o; t" e: ~
( w* A/ @$ Y% M" O- W1 }' X" [) q! S* @8 Z- `
There could be hundreds of BPX you could use to detect this trick.
; z- G% U3 O* Q0 l- O7 n/ m# z  k-The most classical one is:$ H2 r# j2 c& K8 Z" D2 r- a
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 v/ Z* t9 o  I2 S  w
    *(esp-&gt;4+4)=='NTIC'
3 b9 J0 _2 l- y' ?+ i) Z1 m
' ^0 `9 l1 C( S-The most exotic ones (could be very slooooow :-() n( Y9 i1 c. M
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; G) a' s' x' j: B% T% Q
     ;will break 3 times :-(
. V0 R- @2 P: [# a- U2 u! ^
9 F3 ~7 K& o" l1 h-or (a bit) faster: $ n# k5 i6 n% a8 I6 N( p
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- i9 T" E; F4 C( {. I
) L3 |* |5 Y- J) X
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ T0 R0 b: {; g1 F5 t
     ;will break 3 times :-(
4 B5 d, b7 v$ N, D4 r7 o% ]' g" _4 M/ j1 x* T
-Much faster:
  B  V, F' j$ T0 m   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 R. h, t! q+ g/ D/ d

0 n* T% _/ Y0 i& A# G8 fNote also that some programs (like AZPR3.00) use de old 16-bit _lopen6 W. I# o0 Y* ^7 @; R8 f
function to do the same job:
2 ?; ]0 k: c) q9 A% \/ p7 F* t8 R4 F4 A' h1 e
   push    00                        ; OF_READ/ q0 [+ _) t0 _+ y. a4 T
   mov     eax,[00656634]            ; '\\.\SICE',0* H  ~$ e" N! L' n& I$ M
   push    eax& |4 S) \$ I/ H6 a
   call    KERNEL32!_lopen
! f: Y6 p; Z5 |   inc     eax
- n/ L8 u8 @4 u3 F; {   jnz     00650589                  ; detected+ r7 R; g) z" {5 W$ u% J
   push    00                        ; OF_READ
7 k% `: ~3 F" s   mov     eax,[00656638]            ; '\\.\SICE'
* z/ X9 d' `# H" h8 n- D+ i   push    eax9 l8 g, [9 y; i! Q! V$ @
   call    KERNEL32!_lopen
$ G' Z% X) B1 _8 U8 W: W9 L8 V   inc     eax/ {$ H. C3 o" e2 |: W; _' v
   jz      006505ae                  ; not detected! `* ^. Q( \2 T: b0 W4 Z* c
7 ]% i7 h0 b, H* G3 [

# [3 X! F9 u# ]( S9 ^3 ^__________________________________________________________________________1 L$ X& U) V; ~1 L+ D- B' {2 }
* j  z5 K7 `) a8 c/ Y5 R8 f
Method 12
% s, ]5 L8 b3 ~6 e( Y=========  |3 o2 H* u% i# ?6 t0 R

6 ^  F$ h0 b+ K4 v! i: [This trick is similar to int41h/4fh Debugger installation check (code 05/ A+ k2 Z6 w; V5 d( N3 h2 U
&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 e( d3 {; u  L7 M1 ~
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.( ~+ T" n* e, J7 P9 r5 z
6 P- |3 b6 T& l8 l4 q, s
   push  0000004fh         ; function 4fh
' h1 @& f  n% E% o; `' x  p! A   push  002a002ah         ; high word specifies which VxD (VWIN32)
$ ~8 I; m+ ^- T% ^0 e1 X                           ; low word specifies which service% ~1 u4 i) `- \9 u
                             (VWIN32_Int41Dispatch)( B" r7 q5 J; N! L- L/ x
   call  Kernel32!ORD_001  ; VxdCall- t3 x" p. _! {! K1 Z$ m- \+ t2 g
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 ]0 {( j4 w- u   jz    SoftICE_detected5 V' ^) Z0 N9 I6 d  H, T: B
7 A  b. d8 E7 W) D
Here again, several ways to detect it:
* F8 k4 `/ A, J, l$ a
2 o8 V: R4 x0 M5 K* A5 ]( U    BPINT 41 if ax==4f5 L: ^  n2 s" A. |/ D% k: e0 ^# x

; n2 G4 e6 s+ t1 l& S2 L    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one# g1 p) m' `% o% V+ m- C* g" ]  j
4 f5 _! k4 q# i# ]  u* {( I: x
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 J* _- @. e/ R7 f/ `3 f$ B& H" ]4 L, u7 P' A
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 S/ Q  x* G% B2 L* j
% b! V1 ^, A7 K! D2 T
__________________________________________________________________________
4 D$ e  [* O6 B
$ g' W6 U$ d  u$ M- q+ q4 W4 @2 @Method 13
7 ]; n" }- y( t0 j5 W7 i% r=========6 @# I3 [; j; p% V6 R5 _# I9 C  \: l

) Z2 w) H+ O  X% b' zNot a real method of detection, but a good way to know if SoftICE is! a) K/ _# _! x& Z  b4 W
installed on a computer and to locate its installation directory.$ K& Q$ z6 D$ t" _, b( L6 v
It is used by few softs which access the following registry keys (usually #2) :
8 G4 K: \# V+ R* S/ C' S7 G; I2 O4 u0 u& r- V7 s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 ?3 d8 l9 Z2 Q& B1 T+ [8 M! m
\Uninstall\SoftICE! ^5 U) I" @! `1 b2 \
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 _( Q$ A$ S, c-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: f8 y$ C& l1 e1 d( u4 p3 f
\App Paths\Loader32.Exe' s- z1 S; _$ B+ x# e9 H- P+ E1 V
+ [5 m* a( n% w" D

" d$ ?' i6 G; S  ~) U5 _Note that some nasty apps could then erase all files from SoftICE directory0 h3 J; P! u" z; U
(I faced that once :-(
( R8 r7 p! i( O! C) e: C
  ]2 M; u3 I) y, L* x" R) Q+ yUseful breakpoint to detect it:% h3 }2 p* F7 O2 g4 ~5 o  {
+ A5 S- j  [8 L3 |* B: E+ C* J: _
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'0 e: }. R4 j+ s

6 i( a0 W0 r3 `/ m__________________________________________________________________________
$ c' H; O+ d: q: e4 _; H# A
& F+ G. b- N" j8 j  {  y
2 k" _% I1 p9 g/ IMethod 14 ' W; L6 z8 A5 s7 F$ p" k
=========
2 s8 h6 ]. @( f  M- H3 l7 q: d. Q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 _( c! L, B$ h+ ^8 L
is to determines whether a debugger is running on your system (ring0 only).- |9 {2 @  N. `7 |

2 t6 K0 M* P$ ^" _9 ], [  n   VMMCall Test_Debug_Installed
. k! o6 f4 w5 P* c( C% D7 x   je      not_installed# L7 e! H; q- x! u- N8 T1 p: n8 x7 R' W
- g) }! l/ Z% y, M8 z
This service just checks a flag.0 H& A% r; @4 Q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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