About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; R8 ]0 N% p; k" [5 ~8 p( \4 V<TBODY>
! h/ ~" h' t/ Z( h<TR>6 b/ s3 D! C) D: S8 @6 a2 d
<TD><PRE>Method 01 5 Z5 `) A1 @2 Y8 A2 F' q8 @6 B
=========' v* D& N% e  ^! ?3 \' F
8 V, ?0 D* E, W8 C
This method of detection of SoftICE (as well as the following one) is
& k# z' n, p+ D, L! ?9 L  k$ Yused by the majority of packers/encryptors found on Internet., L) n/ t4 k0 q+ P; D8 F  {
It seeks the signature of BoundsChecker in SoftICE5 h2 j5 k0 g8 }* q2 J/ k) b1 l4 L
$ W4 d& @; ^6 `( V( @
    mov     ebp, 04243484Bh        ; 'BCHK'
5 H  s& C/ K. P    mov     ax, 04h
* \& {, w. i5 L, A9 Q    int     3      
3 H' V! F) h/ o; V9 V    cmp     al,4
8 T# B; p2 |6 H: B' Z1 E    jnz     SoftICE_Detected- C5 Q* ?( _! d7 n0 L. o3 w

9 `) W) o  F' y! ^" i* m, A___________________________________________________________________________3 d" `! L6 d4 {/ D7 x

5 g' l* w% I" G) ^/ p4 F: q4 Q4 S4 ^Method 02
3 N" Y( v/ g8 F) ?=========% y2 J' c$ ~0 X5 u2 M4 w
6 O$ e: a, N% }
Still a method very much used (perhaps the most frequent one).  It is used/ k4 s1 |9 I9 z( o' h
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, |7 |9 e( @! O( A& X  O; xor execute SoftICE commands...% ~& P3 W& S# m' q6 Z0 r
It is also used to crash SoftICE and to force it to execute any commands1 O3 p2 y3 J7 `; Q2 z1 n
(HBOOT...) :-((  # k, b) I1 W8 M9 I2 f

9 ~1 P: O) k: f( \& j& W& DHere is a quick description:5 Z- f/ j9 X* Z
-AX = 0910h   (Display string in SIce windows)7 I9 _, w7 Z" S" T
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- L3 t; l: d7 n" k" t* i
-AX = 0912h   (Get breakpoint infos)3 K3 u- \7 |9 F" s; q  G# W
-AX = 0913h   (Set Sice breakpoints)
8 V7 q* `' R, B2 a-AX = 0914h   (Remove SIce breakoints)4 t. ~4 }* S8 C8 {- s+ v' z1 c
* a/ [0 Z# u2 z( r: n
Each time you'll meet this trick, you'll see:8 N- M0 ~8 I# T; [+ N6 i3 k
-SI = 4647h" ], W1 L3 E3 O8 U7 Y+ C
-DI = 4A4Dh
! j3 B8 D2 c9 {. V7 k3 ^4 i: bWhich are the 'magic values' used by SoftIce.1 }% i  I1 M, D; B$ d( y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.) \+ ], V" p8 E" c; V
; v" ?: p5 w+ E3 h: s. z, ]0 p8 j; y
Here is one example from the file "Haspinst.exe" which is the dongle HASP2 v- }( V: B) O% |3 ]& |# X& E
Envelope utility use to protect DOS applications:
+ ?/ b& }+ H+ n7 i/ C. y5 l, C, P
: c- F7 {. Y( [7 I; k+ L
; @( z* E, O% B( O  H( ^( G8 y& R' L4C19:0095   MOV    AX,0911  ; execute command.$ _7 O. B# Y+ @7 |7 H) S0 `( q8 z, T
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
# q9 k: c9 I# N4C19:009A   MOV    SI,4647  ; 1st magic value.$ D! n+ t9 J- l) r. t
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 }/ T" [; J2 t) ^& t: s2 K" `5 D4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ ]7 b$ P# C. U1 ]8 v5 y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) g+ B1 ?2 d& f
4C19:00A4   INC    CX
0 s4 K% b1 `& [1 Y4 t3 F8 b& [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute0 g# S9 A2 _! Q! W% j
4C19:00A8   JB     0095     ; 6 different commands./ ~' Y9 e' I/ i  Q  k
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 h' ?" v9 b  ^: q! X4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; K' W( _6 x. @
' `+ Y* ?" o, u3 s: h. W+ t6 xThe program will execute 6 different SIce commands located at ds:dx, which
" N) Q9 {4 W: Sare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- c. [0 P% Z  b3 s6 x0 z
* \$ F+ H1 I* Z6 I/ N1 d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
) o4 e1 W9 E7 f! Q* \___________________________________________________________________________2 ^- ^8 N) X7 O9 E. f* F0 |
6 F* }) z% k# A' N
, `# [( Z- f1 q* n! U6 {& q% T
Method 035 L/ _( L6 I$ {+ y
=========
- m: T# R1 T: y3 _: Q
. d2 v1 y9 p, ~Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
$ u% W. x" n! c( V(API Get entry point)
/ d5 F& e5 `4 Q        & W2 ?; h% d5 h9 q1 J
. p6 G& v8 M' E; N; {: d8 I
    xor     di,di
- D- }  m8 @$ a& N1 R- x    mov     es,di9 N, y6 @5 J( Q: I/ `, [
    mov     ax, 1684h       , ?% ^0 J) n- n0 |
    mov     bx, 0202h       ; VxD ID of winice
: x8 F4 C3 A4 Z    int     2Fh
3 Z" m2 I* V0 p% J! }    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ b6 V( G8 U# s* w: j3 d    add     ax, di, K6 L: n! c/ Y7 q9 ^2 u
    test    ax,ax7 @& M" b  a6 h* w# u2 b4 Y
    jnz     SoftICE_Detected
# V7 _' B$ ]  j4 ]% O! x7 h# H. c0 E' _5 R- f+ E. B0 o
___________________________________________________________________________
0 X1 i; p* o5 l. X. ?& }: }0 B( d. _( \) m
Method 04/ I2 {3 F9 [. r% l
=========
7 o2 T  U3 r( N+ ^& m
: Q+ d; |. j6 [' b0 U. w7 kMethod identical to the preceding one except that it seeks the ID of SoftICE
  [2 w7 q# U6 d/ Y. pGFX VxD.  C& y& f9 F. y/ {# Q

; M* g& s8 S2 F0 [6 x    xor     di,di
* P; F( j# Q. f, f1 M    mov     es,di: X: o5 @( s3 [$ h4 ?( t
    mov     ax, 1684h       0 E, V& k- g% J  m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 _3 Y' ^, A  X% u    int     2fh3 L5 B5 q, L0 ~: e+ E' P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# x/ f0 C7 f, d5 w) q' n3 ]/ ^
    add     ax, di3 G. }3 S! P2 m& K
    test    ax,ax
9 b* V2 |. k# {- o% l5 ~: x1 c    jnz     SoftICE_Detected- t! [5 S- B# B
. H1 X- J- M: ]1 u
__________________________________________________________________________
$ r- y- c/ `3 N2 Z% U' w. w! k$ ~" G$ u9 p3 H! `3 \! ]

+ C: C: u8 n& u9 {3 qMethod 05
- s/ ?- n9 x. W8 ]/ b6 `! ~=========4 [8 Z3 r* a& l/ Y: s5 R
/ a4 x1 ^, N# p! b
Method seeking the 'magic number' 0F386h returned (in ax) by all system- i4 C0 p4 d: W4 P
debugger. It calls the int 41h, function 4Fh.& D  d* e1 W( t$ ~% O7 V
There are several alternatives.  " A: g" _6 ]4 B/ z/ D

- e" R- O- Q2 S& \* F& x1 ^The following one is the simplest:
. L) t# Z. U, ^# p* m3 s
+ r0 A* H7 Z, x1 {0 O6 n) S    mov     ax,4fh
7 N5 m5 H  N* `' c( F0 ?& S    int     41h9 |" Y6 H2 b9 }6 t0 u) [7 v5 b
    cmp     ax, 0F386
, u5 c& Z8 K- q/ T    jz      SoftICE_detected
8 T/ T3 Z/ \* [3 I% ^4 O$ R
) ]" h. ?& S) d! b3 y  e' l' _7 |8 J; q5 {
Next method as well as the following one are 2 examples from Stone's
/ P# I- R1 u1 ?6 V% }: i, s/ ]5 i"stn-wid.zip" (www.cracking.net):
6 I1 n: N9 p( C; q5 k6 {) a7 A5 s, O% ^0 X
    mov     bx, cs
) |* o' n' G5 Y" @6 x; x+ w( h    lea     dx, int41handler2
3 Y& W* X' }7 s* w$ N: a$ k    xchg    dx, es:[41h*4]9 L4 Y$ @9 p8 y" Z
    xchg    bx, es:[41h*4+2]4 a: z* n. ~$ e) F
    mov     ax,4fh
' L9 G, B" ]& q# V1 O    int     41h0 v4 K: s. p8 Z7 k; R
    xchg    dx, es:[41h*4]+ W. b- M" R- l6 G# Y
    xchg    bx, es:[41h*4+2]
4 A) b' Q7 d0 a! C& A    cmp     ax, 0f386h
4 j) r. v8 ?( n* I5 H: F, o    jz      SoftICE_detected
7 C/ C1 g1 a+ q( @8 \. i3 Z6 K3 t! ?) T- r. y
int41handler2 PROC8 u" L5 G7 E4 a4 `
    iret
/ y+ A. F8 {( C. V& U! g4 i2 aint41handler2 ENDP
3 w( \( ]: I3 w+ P" A5 q3 O+ @
  A9 s1 O$ G: Y- ], ~
# Y) m, K2 u+ i_________________________________________________________________________
9 y3 ^, s" P1 l% |% p( u3 s
/ d9 h8 M. S& c( U' z! c( k+ G7 v
' ?! y( q2 B5 Y: F" |, {( rMethod 06
1 f; k& j2 n* ^% Q=========1 `# n* W' ?. j, `7 ]7 b

4 g8 N( B3 Y: K7 f# U; I7 f- {: @7 `7 ]6 @' N! i5 |& v
2nd method similar to the preceding one but more difficult to detect:, n1 j9 n6 V/ F- k" v
# N7 }1 `0 C& C& A" p) c
+ M- t9 {; i4 D% k0 w; ~+ U" E
int41handler PROC; G0 n' A1 a! J4 g* |9 A
    mov     cl,al
/ i8 {" a3 D9 |& E, B( @    iret4 W. \2 P1 p! Y' G" q2 C( X
int41handler ENDP
( [- T. U5 f5 F! s+ Q+ N! u2 S* }# k: O3 Q% {: G
+ m1 w9 C; |# |* F7 b5 Z( c
    xor     ax,ax
& p, N3 C3 z- k    mov     es,ax
8 R" |3 q# |  s6 d* o2 w    mov     bx, cs
2 }6 M: ~' {0 x- t( _3 G- h    lea     dx, int41handler
  n# H! d8 Q# N    xchg    dx, es:[41h*4]
9 J( }8 D$ j  V) _; r. u0 t    xchg    bx, es:[41h*4+2]
7 I( A- y% W& P: g. i    in      al, 40h* s- q; ^! W( y9 m5 n1 R
    xor     cx,cx
8 m% D8 }. ^. T/ c& D5 T    int     41h+ z) A. b" \- }
    xchg    dx, es:[41h*4]
  A* t7 Z$ q3 d: s    xchg    bx, es:[41h*4+2]) x) s3 q4 n+ O& U7 k
    cmp     cl,al
% }6 n* f0 _2 I) R# l% ~    jnz     SoftICE_detected7 [3 ^; m- l' T' v. T
0 G! c8 {6 o! `
_________________________________________________________________________
. |% `$ s+ q' Q: ^; x  n5 E
0 }+ D: Y/ [2 F: wMethod 07
. T/ V2 A/ w  \* d! R. M=========+ D  ]# A( t0 S2 ?

9 [, \2 P  O6 y( RMethod of detection of the WinICE handler in the int68h (V86)4 u( V8 Z$ e. z* S9 T3 X1 U% @
3 g& m' l9 k) E. X" K5 q
    mov     ah,43h
* Z- D1 M  p: G* n    int     68h
& D( B0 Q7 d6 a5 {" ]    cmp     ax,0F386h
, K& a; [3 j: b9 I: e    jz      SoftICE_Detected
8 [% X/ s' E1 V2 {2 g7 @
  c2 Z, O+ U& }) w3 X7 C1 [
/ Z# C. \( V+ s5 c=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
$ U3 V  h+ u) x( R3 S3 g# ]& Z6 m0 Q! d   app like this:
: p: c/ Z* v6 z  e, r- C  {# ]2 \7 [% s  I( a4 P1 \
   BPX exec_int if ax==68
/ D7 d, ?) X. v) R, p   (function called is located at byte ptr [ebp+1Dh] and client eip is6 P% ~7 {8 ^1 L9 r
   located at [ebp+48h] for 32Bit apps)
) {$ D: s/ f8 W; G: h( p__________________________________________________________________________
& \+ ~' }2 o8 f3 ?7 C$ D, [& m: Y/ ?+ l$ m8 P+ n& f( V( k
3 M5 f* T, M% u. J+ N7 |! ^4 {
Method 08) Z" L6 d/ W: n* n3 d
=========  p# ~8 Y) _. K

2 e7 i3 `. O7 K2 ?- C5 LIt is not a method of detection of SoftICE but a possibility to crash the
5 U* N- W: D( j- I' w, P& {5 Zsystem by intercepting int 01h and int 03h and redirecting them to another
, Y0 x, y; Q! h# @2 i  mroutine." N1 U1 t4 }4 l) k- O! R! L7 _6 B
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 n( D: Y5 N: {8 V$ l
to the new routine to execute (hangs computer...). Y! ?! S' e3 @3 g& |; x

- ]  _5 b3 T+ ~    mov     ah, 25h* H% R. u6 [0 [1 ^! Y
    mov     al, Int_Number (01h or 03h)
8 _- Z/ S! m2 N    mov     dx, offset New_Int_Routine9 h0 X* e4 L( d1 _
    int     21h' \, a* d" C9 P) g* }  v6 w

3 L( H3 H1 F. Z. p* G__________________________________________________________________________( Y/ o# p6 g2 n9 {

/ U' u% p. a4 L4 K5 C5 {% H- fMethod 09' J" f$ V( K; ]
=========
5 X: }% m6 p! }$ k; u+ t- L. f) m: b8 @  [6 Y: v
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 e' T( X/ Y9 q5 C
performed in ring0 (VxD or a ring3 app using the VxdCall).
. x6 b  b; F. t% JThe Get_DDB service is used to determine whether or not a VxD is installed! |- G+ C5 d* g0 z  }. {3 [6 R
for the specified device and returns a Device Description Block (in ecx) for
. W& Y; j8 ^" U& H9 N9 q( Jthat device if it is installed.- b5 j. K, `0 i% P
2 |1 ^& ~7 H7 r, p- p' M/ W
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; V9 N/ D) l7 O' X& j) G0 V   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
7 v' ?4 o0 Y& O3 I   VMMCall Get_DDB
! y1 E) N1 F& b   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* \8 Q; l6 l. J6 l* \
& D1 \2 @+ a. A, ~; U& }: p" {0 P3 zNote as well that you can easily detect this method with SoftICE:
0 K" C8 V1 l) N) B+ I/ V( E   bpx Get_DDB if ax==0202 || ax==7a5fh4 z7 F; G0 w. f1 S' H

- M5 B( N  c  J' e3 j, a__________________________________________________________________________
& G- B* \: p) K# C' m
3 M; o9 e8 ~# L* [% O/ KMethod 10" y6 y* U' B# o4 c* l. @+ \
=========
0 t" ?6 M; P: v: a) `+ {, y% z( m7 l0 W8 W3 u$ \" W; r
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 M7 P( R2 L5 j- i3 X  K
  SoftICE while the option is enable!!4 Y6 \, Z2 E0 j6 S' @& i
( j# R) h4 i+ J
This trick is very efficient:
5 t  B. X2 G, e  S' H) B0 I1 Dby checking the Debug Registers, you can detect if SoftICE is loaded
! A, r$ K" y5 I) _* G8 w(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% O5 c+ \8 K* s& E* D: A! w  Q# u
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 j( Q4 _  i7 l; T& w
value (in ring0 only). Values can be manipulated and or changed as well; o( x; k( X' \0 X+ F( H: I2 O
(clearing BPMs for instance)0 y- `; a& b6 m
8 R  R8 f# G8 |$ f9 ]( t4 \5 V
__________________________________________________________________________( g9 Q7 [9 T1 s

- k& w8 H7 u# Z2 G$ t4 [, bMethod 11$ v; U4 M$ x  _  m7 j" e
=========
" L" @/ W. l6 u8 F; P
& L$ g6 c+ b5 w+ |This method is most known as 'MeltICE' because it has been freely distributed% v6 B3 H" k3 @3 q" h# d
via www.winfiles.com. However it was first used by NuMega people to allow
/ h) l. c" E7 B1 n, z% W$ HSymbol Loader to check if SoftICE was active or not (the code is located
* n7 o. o1 i" a' sinside nmtrans.dll).
  k& j# ^. H4 a  t) ^+ Y$ l4 h0 B6 e5 q. i
The way it works is very simple:
0 {8 c: b7 `" F1 t0 T/ yIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ e& i7 b% v) M7 G
WinNT) with the CreateFileA API.
) s' V' f8 F9 W
, r1 C* u. ]1 Z: }+ i" B% [Here is a sample (checking for 'SICE'):1 L2 H, @, P7 e, K+ d8 G1 l0 k

; s( H% s+ K5 c' P3 U2 DBOOL IsSoftIce95Loaded()
9 a* [! s  S; F. c$ H6 G$ d{
! j0 o* [5 {! ]- X/ ]   HANDLE hFile;  
/ \# K3 Y( @8 n& }   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 M, D$ c3 ?8 p) `
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ o0 L8 f5 t3 ~1 J& I
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. K- F6 X2 M1 p6 s( l3 q2 V
   if( hFile != INVALID_HANDLE_VALUE ): [, i& |4 o7 Z3 I. [
   {
4 X% ~. v+ G5 r9 R$ r      CloseHandle(hFile);! s; A4 s0 _/ ]
      return TRUE;
7 \+ B1 p  }3 Q9 d# ^, G6 `& W   }
, ]) N3 r. y1 m7 a, R% p& _   return FALSE;8 E. k1 q; f+ c; m' f
}% v% c0 Q) D9 H$ a( z
+ Q% J* d1 O8 Z- y
Although this trick calls the CreateFileA function, don't even expect to be$ [2 @/ E! p  p/ Z) I7 z
able to intercept it by installing a IFS hook: it will not work, no way!8 d6 W& X0 Z* I: w) ?, q8 J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 j" t$ P% o6 d0 W$ N" `& A" ]6 V. _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ E& M6 H3 H9 t* {
and then browse the DDB list until it find the VxD and its DDB_Control_Proc; ^* U2 B8 U9 B
field.! T& e& C- ]+ Z) Z% F7 c
In fact, its purpose is not to load/unload VxDs but only to send a
2 P, X8 [7 t8 p+ R, t$ k, Z4 G) JW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). l% W2 x8 D" o
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
' V  m# s0 ]1 d) h- z$ }! cto load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 Z) Z8 h2 ^" n3 i/ sIf the VxD is loaded, it will always clear eax and the Carry flag to allow
( A8 z( V" V- I( G0 X& T9 C/ g6 Bits handle to be opened and then, will be detected.
0 Y' c& @, x$ Q! ]; vYou can check that simply by hooking Winice.exe control proc entry point
8 W6 X, f. {+ G3 E" ^# @0 Vwhile running MeltICE.1 B- a( }9 C# k+ e  I

8 `9 u: M- X' I3 H- L
0 S9 |8 F. H( `  00401067:  push      00402025    ; \\.\SICE
  W/ Z; _( O1 N9 Z8 Z. Y  0040106C:  call      CreateFileA9 h. K) n6 h+ D3 ]( R* Y0 a' B
  00401071:  cmp       eax,-001& G' ?( i* R  ~4 `! _+ F: d
  00401074:  je        00401091
. g% w& k! ?# Q1 A6 h3 ~9 `2 N. u  n
+ Y* k. e; ~1 t( a' g& m! w. O% N+ p9 g% {/ I  H' ?/ l0 e
There could be hundreds of BPX you could use to detect this trick.
' J! v5 }4 `3 N( d( [$ @( ~-The most classical one is:
6 E4 g. E6 z! c/ a9 c4 y- [2 F  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" B* X8 \+ g. H1 [
    *(esp-&gt;4+4)=='NTIC'
4 f9 g' R+ g  ]6 j' C/ O! v: b% H2 |) m, r8 N4 X
-The most exotic ones (could be very slooooow :-() U. h! P4 [1 v9 t' `9 a
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + z. o' R( n: K
     ;will break 3 times :-(( Z# N: }2 Y4 f& C% \
% o* C. `. C) o6 _$ P; m7 ~9 X
-or (a bit) faster: / i& H/ A8 ^' ]; z/ B6 }
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ Y- b$ U9 f2 U+ A" k' J8 W
4 Y$ O/ `8 L2 L, l! q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 D4 s+ W4 C/ |7 @9 p     ;will break 3 times :-(! K4 |7 d, X2 I3 S' a8 \
& v% G; G  s, J: A, z
-Much faster:
8 O" \. E# r6 i* j0 ^   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'/ X0 R* L5 Z' P- E% v2 [, Y6 p

  x7 K+ J# ^, @9 u. ^9 i3 oNote also that some programs (like AZPR3.00) use de old 16-bit _lopen7 m) V& @3 h. N& E7 _2 m
function to do the same job:- j2 ?1 m% {4 e
1 Q. p, H. u3 H# d- y1 A7 y4 G
   push    00                        ; OF_READ0 G8 k- O# t+ e8 @" o4 B; N
   mov     eax,[00656634]            ; '\\.\SICE',0
0 O3 F, h- j# z$ J   push    eax) t% Q$ c* l6 }; S, \4 x7 |
   call    KERNEL32!_lopen) J1 b/ J, t8 u& R1 r
   inc     eax; C$ k) y' r# h$ d. v
   jnz     00650589                  ; detected3 ~  x2 x, F9 d
   push    00                        ; OF_READ
; I/ V, X8 r8 y0 }; c   mov     eax,[00656638]            ; '\\.\SICE'/ ?! w9 c1 I, E6 d; ~; r
   push    eax
$ r  B& W* p: \  f' L" q" I   call    KERNEL32!_lopen
5 |$ t* m7 N" c  c* F1 \* Z3 U2 c   inc     eax
) r0 b' A& N+ h" L; r' [   jz      006505ae                  ; not detected
" c# e2 l# ~1 u3 s3 P) P! w. S
' E8 p8 y  L5 L+ N: A
7 ~$ I. k' o8 g) q__________________________________________________________________________2 F0 e% ^8 d, Q

5 b; X, f& G8 E. S4 U; l( A' _( w; g0 x' aMethod 12
6 D. |7 y8 K# M+ [; s* _$ ^( a=========9 k! u9 ^( e  u4 _8 m+ w& s

# @* A; Z+ b5 {3 HThis trick is similar to int41h/4fh Debugger installation check (code 05& d( Q. y) P: _$ V% l6 l
&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 j. n' z5 P  i' D/ z- u. y& }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
4 W" A7 B) W+ [, Z' ?; g1 z5 L: z0 M
   push  0000004fh         ; function 4fh
1 L& o- z& ~9 \. h5 d( h   push  002a002ah         ; high word specifies which VxD (VWIN32)+ }0 o  a9 l7 i* }
                           ; low word specifies which service
& N$ q4 ^% g* ]3 V1 q. ~! @! ]8 f' ^                             (VWIN32_Int41Dispatch)% p" h. P2 E9 o7 f
   call  Kernel32!ORD_001  ; VxdCall, f) C  m# Z/ J' v3 Y7 _/ u; A
   cmp   ax, 0f386h        ; magic number returned by system debuggers
% c# w+ G; i3 n% Y% X   jz    SoftICE_detected
: l2 o# k* u' P, n! w9 }" B. J8 x' I& z: {9 a9 {
Here again, several ways to detect it:) M5 b7 G7 _% a

; b( ?& s" M1 B+ D. r" v1 }  `    BPINT 41 if ax==4f+ t. m) Y, a, k) L
, ?! P0 [$ Z& b2 k5 q; }5 p
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" I: B" W( L: `: c  [- T) q5 e

% ~% \0 ?* ~" P% |- @    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 X( @* [) u3 E3 T+ ?' a
  v/ c+ s, \# @) K/ i" q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 U6 ]& h: I: Y
: i5 D* o! v! r: T0 M8 o+ g) h# b
__________________________________________________________________________
! d8 k" P) ]4 p* c; S- T
, M* Q9 ^: M$ @6 `7 p( hMethod 13
. j! t$ x( n+ C7 W- h3 i% w=========
" L9 {( y$ X& \7 k5 D# K% A$ x' o  ^
Not a real method of detection, but a good way to know if SoftICE is
& Y2 J  \) F# ^' Y: a7 winstalled on a computer and to locate its installation directory.
- |# v3 y9 L8 S8 C8 U6 p2 v. wIt is used by few softs which access the following registry keys (usually #2) :
0 z- W, D+ ~  s- B/ r+ w: W/ l2 D
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) }; f( D0 D8 n7 `4 u* [! T. u\Uninstall\SoftICE! s* E) f  }; ?) a8 i. y5 A; u
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- e, q$ U. z( Q3 q3 K5 Y3 Y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ h# j! }. Q3 @
\App Paths\Loader32.Exe  c7 k& s/ Z# f& F* |

& y" `  _" B4 }( F- a; g4 T9 m7 D( L+ ^! M( ]' N* X7 M" U
Note that some nasty apps could then erase all files from SoftICE directory% b+ d% r8 x2 I
(I faced that once :-(; H% i/ p% \+ n8 z$ w5 @9 K2 Q

- r- b4 v/ I' V: z2 J& rUseful breakpoint to detect it:
. ~. b2 y5 O  U$ r) o5 d. l/ \9 N, r; C3 }3 A
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! i3 s" o% i. ~0 ]7 V

" r" P- X- J7 L# Z__________________________________________________________________________
" l5 c- X2 b8 D, a6 Q) [3 L2 q
/ f' W3 X. s8 d( s8 H' |; m" w
9 C; o8 \. Z8 ?Method 14
4 |" m0 Z2 m: f) ?$ ]% @=========
: F: V- Y0 ~1 V% J$ _
! D) M% z" i- @( ]' x, _5 KA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
- t* W2 Z, T4 P5 L0 _2 Wis to determines whether a debugger is running on your system (ring0 only)./ q' I: h, T" U4 L; ]
; q2 s# s& e. T/ z0 V7 S! {
   VMMCall Test_Debug_Installed: W( R. t; m9 U" _6 h
   je      not_installed1 }$ f3 }1 \( \' n" v

7 x( d. `# j% J3 h9 D" XThis service just checks a flag.& l0 P- }4 O# l: u  n& i
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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