About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
* I7 G' _* f8 O! j* [/ ?; x<TBODY>
, K' X! K9 q" D8 a# Q* }4 s& m1 t" \* N+ \<TR>
$ x& q. h" y4 N; \% n1 }! m+ J<TD><PRE>Method 01 7 _4 v" x+ v, n/ N5 z# G# D. d; i7 ^
=========" q6 e  C# U+ w: W

( L+ s6 D1 ]2 R, {This method of detection of SoftICE (as well as the following one) is- u) u6 m* E" ]6 t% C
used by the majority of packers/encryptors found on Internet.* S) i" ?0 m/ L+ Y4 W5 B
It seeks the signature of BoundsChecker in SoftICE
* L7 d- W. b; i3 P. c/ t1 Q1 _3 W2 N& G3 F* y" L
    mov     ebp, 04243484Bh        ; 'BCHK'1 N# R9 k! m  W
    mov     ax, 04h$ ^! T+ n  t" Z, E/ x
    int     3      
1 a4 u. S2 R* d* z    cmp     al,4
; I2 A: s  h2 I* y    jnz     SoftICE_Detected4 y: _; l- |* K% T$ U
4 Q, j' G* Z; E: V# O. L/ u
___________________________________________________________________________
& z7 @- v# j% v) P. g
% W6 e5 P# G" ~& q$ g9 K' aMethod 02
- C% G: ?; ~1 A% V=========
- `4 g, M9 E. `& Q
* o2 z  O/ F" S( E; _+ dStill a method very much used (perhaps the most frequent one).  It is used
( e( Z1 A& v% G# vto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% T6 Z0 O( i" ?; Z, `or execute SoftICE commands...* E; S5 D% R. b7 H
It is also used to crash SoftICE and to force it to execute any commands+ m8 `& j" Q* L2 S
(HBOOT...) :-((  % L/ r) ^  g& c

; A& E* ?7 e! rHere is a quick description:
1 c2 f6 `& H! d& T! _. O  I0 x-AX = 0910h   (Display string in SIce windows); N3 c: M6 R3 D
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
, y- x4 Y  I7 ?8 n! E6 d9 f-AX = 0912h   (Get breakpoint infos)8 C9 J4 a& D; y- l2 Q
-AX = 0913h   (Set Sice breakpoints)
* s7 |3 n/ I$ u9 d8 V; X-AX = 0914h   (Remove SIce breakoints)
6 Z3 U/ _, X4 @" ^# i5 q# C% [4 {4 P1 W0 x
Each time you'll meet this trick, you'll see:
1 c. z' i9 T% [% W# t4 x-SI = 4647h2 ^6 g! m' C& c; w( R( z
-DI = 4A4Dh
! x$ N9 v9 @$ K' }Which are the 'magic values' used by SoftIce.
1 W/ E- s3 y4 a7 D9 ~% AFor more informations, see "Ralf Brown Interrupt list" chapter int 03h./ l2 R- Z8 G( G/ Z4 ?
% Z. }; n3 `$ I$ [5 X8 B' [
Here is one example from the file "Haspinst.exe" which is the dongle HASP% P; L5 D. r! H8 J, d  j
Envelope utility use to protect DOS applications:
/ ]* ^2 O4 a9 w% b3 l/ E
. s! o! \7 Z5 ~2 e0 `
0 T  `9 M6 ~9 b) e3 C4C19:0095   MOV    AX,0911  ; execute command.
3 u1 e4 G4 x/ r9 Z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 ?* H- W; Q1 s* \9 m
4C19:009A   MOV    SI,4647  ; 1st magic value." z! f$ _* ?1 J/ T8 o0 O- |
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 t+ r: i$ w3 P1 Z* T" U) I. \
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% I2 C& J! G! r9 ~4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ H$ W2 |4 h. L, `# ?
4C19:00A4   INC    CX
  j: K# D+ d. {5 F; P* t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 s0 u4 }6 b) f5 j' k
4C19:00A8   JB     0095     ; 6 different commands.- s. b0 {  y" _& P9 O+ L
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 d( h8 V' `5 |. H$ Q5 A: `, o  H
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 x# }8 {' U1 ~* @0 A5 G( r
; C% z* B1 d4 P, vThe program will execute 6 different SIce commands located at ds:dx, which
6 m! p6 [- J5 _& Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ [- g5 w7 Y0 k6 F
9 ^8 E! h( P2 p0 N; X# ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
. h2 ]9 v, r; |9 ~# s8 h7 {. b___________________________________________________________________________' g* I0 T1 H( S; ?' q) j
+ Q$ v1 T7 s8 S: ~! O$ L( k& ]
+ Z) r: Z6 n3 c
Method 035 v, u9 N3 R8 E2 k( b
=========: k5 w1 j3 a9 ~# j+ ?
( o$ `+ \9 R* N4 X% E4 `
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' {- u- T7 G% j' q
(API Get entry point)6 h+ |( q+ O) }8 D$ w
        / |4 y6 Q% _& l5 ^

% f3 I, V# i% H3 G1 x0 `    xor     di,di
+ K# h1 `6 ~" [3 I* d' }& M1 r& J    mov     es,di& l: T; o. l* K0 h5 v& Y
    mov     ax, 1684h       2 Y8 ^4 ]9 h9 y" q$ s8 @
    mov     bx, 0202h       ; VxD ID of winice& p5 ^( X" r3 A# G: {
    int     2Fh8 V' E! C: ?" h- b& {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: k7 X# f9 o7 f
    add     ax, di
) r- [0 l6 N* O  W6 H    test    ax,ax: O5 C" _3 D- t
    jnz     SoftICE_Detected
% C7 A, a+ F; F# z
" R+ Z. A! Q: V___________________________________________________________________________' N7 `+ B6 C! |+ {
# H) A$ k, K8 n3 w
Method 04+ T! q  M( M, k8 h
=========7 q$ g( P( f: W9 s  P

9 }8 F3 x& U4 D+ {# z6 qMethod identical to the preceding one except that it seeks the ID of SoftICE4 n" d! W3 m$ U
GFX VxD.% y5 Y; n! m" g' v. [
" p1 h8 f% L' V* T* r# Y/ o: J
    xor     di,di5 C8 ]5 x" ~% u0 f2 Z
    mov     es,di
# t) d) C$ C# w; B& ^( z    mov     ax, 1684h       5 k  e. E7 `1 h6 [+ I( K% b
    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ V$ e, i' t5 g9 m$ p% ?
    int     2fh( j* Q" Z& W& W/ w1 o4 W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 ~* d  C$ ?& C+ j: g    add     ax, di
. h9 R2 d0 V  `$ f' _8 a4 P    test    ax,ax
4 ^6 G5 C( `! K: B1 B# q    jnz     SoftICE_Detected8 z/ i3 g/ D5 m* F. t4 p

+ R3 R. l1 a6 w. N__________________________________________________________________________
* x8 w8 Q$ ]+ _, C: o* w+ E& H9 K( n; U5 _4 V  C4 i: v7 T
$ f2 J4 ?2 |4 e0 \0 l& N
Method 05
+ q% l. ^1 n* x9 f$ A- N7 L$ F=========
" m: p2 D9 s; R  o1 b; s
& D5 n9 n# T6 l- v% V6 k2 CMethod seeking the 'magic number' 0F386h returned (in ax) by all system. @4 C, J9 P/ I- _" p/ i5 p
debugger. It calls the int 41h, function 4Fh.
0 f, z1 O. Z9 FThere are several alternatives.  
: z$ o' d+ U5 |+ b! D( h3 \* s' L$ z; Y6 W: _3 F- D- u
The following one is the simplest:
& _( v4 z) t6 n( h; ]5 ~
8 k9 Y5 A% P* l0 @! m4 ^    mov     ax,4fh9 [3 X, H% }) t: P% e( O' i
    int     41h# i! ^- a/ f; |0 O9 B) A+ Z
    cmp     ax, 0F386- t" _! X) H/ f2 B
    jz      SoftICE_detected
; Y+ V  ?# H, L6 O% K9 L  W0 H! B1 r5 i7 O' I9 e# l+ f: e

  K: V: v& k- ]  U% fNext method as well as the following one are 2 examples from Stone's
9 r8 u$ r9 K, l0 U" i"stn-wid.zip" (www.cracking.net):9 `: D/ v" b; g) r4 l: n
5 Q  c- {. I1 q
    mov     bx, cs
/ o& y1 c1 y& y0 z    lea     dx, int41handler2& M1 X6 W8 B$ n6 x$ e% A& d
    xchg    dx, es:[41h*4], c' p4 Q: R/ \! ?4 v% p) s  i4 |
    xchg    bx, es:[41h*4+2]( E+ K7 m7 M8 x$ o6 w
    mov     ax,4fh
2 n% W/ s9 c- J7 L! W6 J( A. `3 V    int     41h% `# q8 w0 y4 ]3 |, H
    xchg    dx, es:[41h*4]
) y. q& m4 D- C) N! n    xchg    bx, es:[41h*4+2]( Z! J( u5 U6 C
    cmp     ax, 0f386h
4 ]8 C& E- n2 d5 O' B* b    jz      SoftICE_detected
2 L  @9 W2 i6 |0 ~& {7 N0 b& d7 Z; K' R/ @1 O+ r* k
int41handler2 PROC/ `' m0 h5 ^# m& Q
    iret
3 r$ o- M1 K) x/ V, ^' F( E: Qint41handler2 ENDP
4 I/ L% t. p; w; f, e0 F2 X$ l; U. Y5 X  W! l
& l$ x2 u- {6 z; I4 m
_________________________________________________________________________
0 `; m/ X3 @& q  b9 Z: w% z8 n  h% U

7 Y0 @" m8 I9 q' q7 MMethod 06
" R8 V5 t+ c8 N+ k; r2 s! I: \=========, Y& d1 t4 U1 }; K

1 O) [+ L/ O) Q' n! h
6 }# `1 m* `8 ~/ A- v6 u2nd method similar to the preceding one but more difficult to detect:( O# W2 J( k$ h' Q2 E" k0 C) l3 X

- Q- k% ?$ |, u7 Q$ \0 l) O  Z& w) _  {: V3 \
int41handler PROC! _" ]2 Y) E% r3 v& r9 _" B% _
    mov     cl,al
' [0 z. G' X9 c( q    iret
4 \, b; J. R5 L% q0 N4 I& Oint41handler ENDP# F1 `9 _: g; v7 ?$ l3 E

7 b9 G. t9 @/ [% M$ {" J5 k$ x7 N, H
    xor     ax,ax
8 [/ `7 J2 n( \* A    mov     es,ax
' i' z% o; c( r% @& h    mov     bx, cs* ^# X4 K# d: y  ?( h
    lea     dx, int41handler0 w: \, c( D9 d2 O  \5 Q* z
    xchg    dx, es:[41h*4]
) l6 Y+ ~4 N: m' D' U. @    xchg    bx, es:[41h*4+2]9 S4 y( t) M) s2 r
    in      al, 40h
0 Z2 z$ b) {( i9 d( {! L    xor     cx,cx" d: T5 q- Q6 w: a; G5 D
    int     41h0 w6 O$ C1 [& D1 j6 ?# J- v) L
    xchg    dx, es:[41h*4]
) d$ n! l) ^/ n- ]1 l! p; ]    xchg    bx, es:[41h*4+2]
- ~. z: T  B  S! d8 ?    cmp     cl,al' }; ~, e1 H6 U4 _) Q, ~: t/ x
    jnz     SoftICE_detected
" ]( w: x* i4 D8 i
8 N. s, X$ i, W3 P, i$ k+ G_________________________________________________________________________; Q1 {' m0 M" W
' q& S/ F3 K9 n# y- m
Method 07
9 s( v/ M4 ]1 z: q' K- ~; c9 ~=========& s6 Q8 s9 W' c1 A# s1 u! ~

/ R/ C% X; e% m! [Method of detection of the WinICE handler in the int68h (V86)
* C: }' f9 p4 A7 H) u! E9 F! L" z: @
" K- K: e! ~0 k2 E5 X    mov     ah,43h+ I5 e" y( p* H) `; s. k- c
    int     68h
3 |# r! T6 g) R    cmp     ax,0F386h
8 _* s+ y8 s6 C% ]    jz      SoftICE_Detected
9 U1 j  C# e' S0 k: p4 _, q( l
& n* P* s6 [# D/ j+ J7 j3 S: o( C& m0 @
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: s% r  e9 ]3 Q6 x3 u' a$ X
   app like this:! |0 {4 {( F7 h

- u4 _. D: @3 [4 U$ j6 m   BPX exec_int if ax==684 r% o: \1 {$ X3 y: N- d' r0 u
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 v. q6 \9 _* R8 B8 k
   located at [ebp+48h] for 32Bit apps)7 `) g3 V: a% j. m
__________________________________________________________________________8 d0 T2 k' z. G/ ?2 J1 G: D

! p7 U2 q: a# {+ `7 R5 R( B# U  O# |' J* R/ x  n4 K
Method 08: f- F$ w5 B* J6 o2 G7 }* }
=========
3 w  |$ D5 k' G8 u% r( \1 L8 |9 A) Q
It is not a method of detection of SoftICE but a possibility to crash the
5 g+ N) U5 L9 rsystem by intercepting int 01h and int 03h and redirecting them to another1 K# U. i# A) U
routine.
' {% R* v" `  {2 H1 q5 e) RIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 ~+ r7 c/ W; I4 w$ n* Dto the new routine to execute (hangs computer...)
6 V9 r$ r/ S* d, K+ W& x
2 ^  u  K$ ~: }/ r) ^( `4 O! O    mov     ah, 25h6 n7 f9 `8 f6 ^- B+ B- P- ?& @
    mov     al, Int_Number (01h or 03h)
! F& f5 P6 j  }0 a6 i4 S5 _: ]    mov     dx, offset New_Int_Routine- i. K! K& t. |* l9 v* {+ t- }- N
    int     21h% G+ q  {& j5 T2 w  L) ^) ~
7 G5 s9 N0 |5 Y2 y
__________________________________________________________________________
( `8 d/ u% x5 t3 y5 k6 l2 P3 I2 c3 q8 R: D
Method 09
3 V& l% ?! [& i. r7 C& O=========
, G- v( o; y, d( \% n# c, o6 Y. _; m$ H# y5 @4 n0 a% Z* E$ f+ _3 g* K
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; w1 T6 q! E1 b2 I! v
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 z4 }2 N. H8 t0 y6 f5 N& A5 A% T6 [7 KThe Get_DDB service is used to determine whether or not a VxD is installed
# a- Q4 U* x" e) N- W3 B$ vfor the specified device and returns a Device Description Block (in ecx) for* V. ^: ^- t$ }- s+ s$ ^4 {8 Y% f
that device if it is installed.0 C) r1 U( t7 O/ j

  [9 k/ H9 s7 F% Y- b( l: B   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 z7 A  m: K; i2 |) Q: {' O
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% a( X. m/ i  q% x0 e   VMMCall Get_DDB, M4 |9 x# `) m6 @' c3 C- |9 E2 i
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( F6 F5 x* l5 k; P8 D
8 ~: k8 R5 c. x; q" ^/ [$ f. C
Note as well that you can easily detect this method with SoftICE:
' A: ?3 _! D5 M$ J  d   bpx Get_DDB if ax==0202 || ax==7a5fh* h! g) k7 O- N2 Y* B2 c* Z3 W, K! Q
2 u: l) w4 f0 T! p% v
__________________________________________________________________________; @. S  E* ^. E. z- V

0 M, H7 e& @7 v6 V6 t7 X* KMethod 10- Y! J, `4 m2 c# ~& H% r5 z" [; j/ p
=========& x) d2 _" A. |2 c- l7 O0 e
$ P; E8 W$ w4 j# t4 v' M  C& [/ S$ F
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 y2 {- @7 g, z" A  E; [+ a
  SoftICE while the option is enable!!
" S" i( S" r, A  {9 k. l& N; N
4 J) \& G! `% \# z# N3 }) S9 PThis trick is very efficient:
" X/ T/ @  n+ v6 x! lby checking the Debug Registers, you can detect if SoftICE is loaded
- n" x% p/ w' j% @(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
) A1 T& \5 M; ?) p7 T- p5 gthere are some memory breakpoints set (dr0 to dr3) simply by reading their# k  D% J4 {4 W% Z5 K2 @7 l" X% L
value (in ring0 only). Values can be manipulated and or changed as well0 ?/ k1 Q# Q# ~5 D: w
(clearing BPMs for instance)3 R. \+ G) a' V& u1 k# D
; _" u8 I5 p/ x+ A8 P( i; q
__________________________________________________________________________7 K- c' E) Q% f' f2 V9 e; v

3 O* c: H" @: s+ iMethod 11
8 W! Y, m$ b( `' {=========
+ K& z% i: I( J6 L1 N2 y# V( [# A9 x- [  w1 Z
This method is most known as 'MeltICE' because it has been freely distributed) P' _& l4 ?% b% S) ?' z: `
via www.winfiles.com. However it was first used by NuMega people to allow0 b3 q3 H6 {" {- P* m
Symbol Loader to check if SoftICE was active or not (the code is located- P8 b; p  _2 F$ b
inside nmtrans.dll).# M' Y( `2 s  ^# v0 ^' G  b  [

- C* ~( H% q0 s1 a$ X( GThe way it works is very simple:
' L# \* A% d) uIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* f( i- H) U' t: [/ E3 L6 tWinNT) with the CreateFileA API.* n8 f( A$ t. z- ~& u
& {* K6 u& k& C4 n, C
Here is a sample (checking for 'SICE'):
; H3 a9 \8 o! S; F, ^5 l9 p6 e
+ K, N) m- k5 q1 M- j% {BOOL IsSoftIce95Loaded()
; `8 E- t* ^! |5 J/ M{
( A# L" `$ z, ~, l$ g   HANDLE hFile;  $ G0 O% o% D$ g& A8 \6 ]) N+ H
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: A1 q6 o* I2 }/ ?! y1 f
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) @% i- i$ t* R9 K5 O                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);3 g$ I2 C9 q" f1 S! F6 C2 b* K+ `
   if( hFile != INVALID_HANDLE_VALUE )3 R) V; Y, O% z' t8 x9 P
   {
5 e- e+ R& p4 x. D* Y1 C0 f' {      CloseHandle(hFile);  s9 D& m, A+ L$ S. ?& v
      return TRUE;5 I6 n6 h3 G2 t) o4 B
   }
3 m$ y+ P: z2 D* v   return FALSE;
3 m0 @+ I4 l4 {, c# C}
& m: K2 [# c- K% ~9 N% _  k2 v
5 g5 S1 }. G" U8 \& QAlthough this trick calls the CreateFileA function, don't even expect to be9 _  p, K5 S4 g* e3 s- b$ O
able to intercept it by installing a IFS hook: it will not work, no way!
4 y. W8 _6 h1 O& C4 KIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ {+ ~0 h: q+ V7 c: Wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) d& N3 A0 E: a9 q$ y2 Q
and then browse the DDB list until it find the VxD and its DDB_Control_Proc7 S3 u" v; J' B
field.5 G3 [4 L: {+ r+ w# Y! {
In fact, its purpose is not to load/unload VxDs but only to send a
  e7 U5 Q2 e* D" z+ r& bW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 O$ @: I. O/ n0 t) e6 z% l
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
2 |1 N1 @, Q& p: Z+ ito load/unload a non-dynamically loadable driver such as SoftICE ;-).
& O) J; k! K/ P. P, PIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 S/ X+ w* a2 t6 \) i  `2 n3 hits handle to be opened and then, will be detected.
) o( h9 u( ?; n( e: g, l% fYou can check that simply by hooking Winice.exe control proc entry point
/ E% q- ^& l* |9 a7 R. m" uwhile running MeltICE.. Q6 `7 p. g2 P6 _6 P) `
7 W0 q4 f, t, Y' V1 s/ U3 O- K3 u4 ^

- g8 z# ], t+ G7 Q  00401067:  push      00402025    ; \\.\SICE' ~2 v' L5 H7 V( {" M
  0040106C:  call      CreateFileA
& s. ~5 w9 I* z+ R; _0 b; H: |" Y: {  00401071:  cmp       eax,-001
4 f2 J2 D6 ]5 w1 z, G6 p3 _  00401074:  je        00401091
; y% e- b7 h+ q2 _0 }( q( z/ ^! X4 N4 b$ U6 j
4 @* `# d/ S1 V% Z
There could be hundreds of BPX you could use to detect this trick.
$ X+ l- A$ _3 c! f* J-The most classical one is:
8 X9 j' |* E6 d: x$ g4 W  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 e8 {9 I$ W! E6 J$ X. w    *(esp-&gt;4+4)=='NTIC'7 p# B# \. o; Q1 S# J7 d

5 D2 O& b7 x; p( z5 U( X( y4 Y1 G: i-The most exotic ones (could be very slooooow :-(
2 Z) K2 N, ^+ [3 n- ^+ _2 `' ~   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
2 L$ b2 Z" H4 ^$ _     ;will break 3 times :-(& @' _3 Q# h0 {4 a4 @
6 j; a" o+ O' @
-or (a bit) faster: ) e! }4 `5 d, F+ \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')1 `+ E: ]9 J, H( l4 \3 t0 i
& b* a* w0 l1 c- ^& N
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( \- w" X4 z5 v0 b; b     ;will break 3 times :-(
) U& L) O  E& L' W: {& u  |$ r6 r3 g9 f7 r+ [* q
-Much faster:
, k2 D6 Q+ N3 h: ^- X3 `0 {- J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& o! b, R& ]. ~. Y) t" ^

& {/ b' O" \, S$ K. U/ {Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 a- M, @6 f+ u3 j, R
function to do the same job:
$ y7 o! L; R4 p
) v+ F" z4 x+ v' Y   push    00                        ; OF_READ
; J+ [: ~8 q6 X* S   mov     eax,[00656634]            ; '\\.\SICE',0' q0 d2 |- V7 e
   push    eax
' B9 M) [) n0 c5 M   call    KERNEL32!_lopen
1 u- i- j- g5 I4 k- ]4 H   inc     eax) I) \0 Q3 `: d7 M9 l
   jnz     00650589                  ; detected
' h5 z: `9 s% @7 D8 Q0 t1 u/ f   push    00                        ; OF_READ
! t) c8 [# |, \, U9 v9 B   mov     eax,[00656638]            ; '\\.\SICE'
- \( D2 m; d7 v" ?5 [2 k0 l   push    eax
1 S! w4 N6 k8 @0 `   call    KERNEL32!_lopen4 o" m  B* a. t$ T
   inc     eax4 A4 e& x! c# X3 a3 G/ @- k" R6 l
   jz      006505ae                  ; not detected2 A' P4 B- U' L3 H5 F& Z
* K' M4 v( e: I, U& \
4 O9 {4 U( d# q% ~
__________________________________________________________________________
/ V. y. _4 N7 ~/ ]
9 C9 p, _' g# P  Y, YMethod 12- _  i, j) K3 [0 Q9 V
=========8 b7 |+ y. Q) E7 ^. u
3 S9 W' l0 h# z1 `, Y
This trick is similar to int41h/4fh Debugger installation check (code 05  o: H& D# ~$ t
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ b# _: ?) O# t/ {5 I$ V1 Das it uses the VxDCall backdoor. This detection was found in Bleem Demo.
5 G: Y/ A6 T# U2 ?, d
. x! N( L+ @$ O5 n, W   push  0000004fh         ; function 4fh! f& p2 c  f0 t* [
   push  002a002ah         ; high word specifies which VxD (VWIN32)8 d5 L+ e0 X# T4 r9 p# x
                           ; low word specifies which service
* [1 [6 f! U5 w0 t" k- ^                             (VWIN32_Int41Dispatch)+ [! [9 a! J9 ~) F4 W2 b8 a- S$ D
   call  Kernel32!ORD_001  ; VxdCall( R; C( C9 c+ C  S. Q1 w. N  |
   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ u. b9 [( t3 m- W   jz    SoftICE_detected
' J  c/ I! L1 N% ^) @/ J' S$ X: k% T4 ^' R* S
Here again, several ways to detect it:" ^( y& _: P. A

8 Y& F( K: d2 I" g3 E' S; ?' P3 r    BPINT 41 if ax==4f% p: [) @6 R7 v( ]( \" \4 S4 P

4 F, r0 x0 z8 ~: `' k, \    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 n2 u5 w* v. p: z) y7 H0 C2 w5 `* i/ z6 }3 E5 Q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ m4 C: D' V* i" \, W5 z7 f: U' ?
9 v: u' ^- [$ ^* h' D
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! g- E/ c. _: ], ]& z& m% a) R

7 c$ ?- ]' p8 l__________________________________________________________________________3 q( i# w3 t3 j* l4 {8 ?

; @' S8 P7 Y. |9 j  |: d3 ZMethod 13( q5 k+ T2 F$ c% P: ^0 E6 w8 K* l2 U
=========
- a$ [5 r* I) n% r
7 \; \! h7 n; }Not a real method of detection, but a good way to know if SoftICE is, ?) A- V4 V4 X+ B3 q4 H( W& i
installed on a computer and to locate its installation directory.7 u7 E' o( I+ Q. X# Z" g* a
It is used by few softs which access the following registry keys (usually #2) :) t' z! j  W6 r5 A# L; y

8 W& A6 c4 }% u% S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" ^* c! {) l* {9 b: u+ n3 f  H. I\Uninstall\SoftICE
& ~5 |: W' M: R' r0 A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% q8 C5 C! S$ f+ x9 ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. b. y5 [* G2 w\App Paths\Loader32.Exe
: x0 a! w8 Y0 n; H. d8 n! i+ @1 i4 d8 f, z4 V
1 X* I- _+ u/ K' Z& w2 v! X+ v
Note that some nasty apps could then erase all files from SoftICE directory  a* }0 ~0 r  K1 Y
(I faced that once :-(# r- |- r& a  e7 I
% j, A% V* ~3 ~1 t" S, o
Useful breakpoint to detect it:
" P( [7 t7 p2 a4 Z5 b% h, G7 V; [! p' {: G2 Q7 ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, I' a  [. r) b2 h) B" o7 P! F) U8 `8 S1 j7 v$ m
__________________________________________________________________________3 l  P) G9 t! m6 _: H! s$ X
$ b/ u: b; ^( X1 G; a1 ], f- ]

& Z$ K( W: B. j! q1 AMethod 14 ) _, Y9 f- z% z3 N; I8 `
=========0 a; w9 {" j# G# \! \7 A3 R2 ^, p# f: R
% J2 ]9 p7 k2 G# x/ t  }8 p2 _
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose' I$ W) @) N7 h) s2 j1 K0 g7 m
is to determines whether a debugger is running on your system (ring0 only)." k4 y- ^; L+ ?) w" l
% q+ B- Y0 O  Y& k& b! o
   VMMCall Test_Debug_Installed) h9 j! U* r* Z8 G( _, X; Q# F
   je      not_installed$ o# E0 N7 y+ d6 o" S- K

) a9 M+ i+ B2 k' E% s$ F8 zThis service just checks a flag." T: o5 Y  P4 ?6 F' I
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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