About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 ]: v) P' z4 `# ?
<TBODY>
9 ^$ ?! \, _# E  n2 g" t3 S<TR>8 C, T3 N: p1 V; M& ~9 K
<TD><PRE>Method 01
2 w' J7 n$ `0 X( y% l=========
1 T! z& j) L' M1 d' E, i
  W5 a& Z1 {  B2 F% EThis method of detection of SoftICE (as well as the following one) is& p  Y& i( H' [
used by the majority of packers/encryptors found on Internet./ T: |, P& x" F0 Y! x
It seeks the signature of BoundsChecker in SoftICE
" c, D( i8 S1 Z) I4 p
4 G6 [) |& |4 h  u* p" G5 M1 i$ `/ J) p    mov     ebp, 04243484Bh        ; 'BCHK'
9 w6 k3 A4 I% m    mov     ax, 04h( _- h( Z# c; p3 H* u5 {7 a) r6 N
    int     3       0 t9 I$ }! w3 n( K6 Q
    cmp     al,4
" f' a7 b& `( b9 B( B4 n4 \    jnz     SoftICE_Detected9 I1 r+ M! o' j$ A2 g
( s7 y( _1 E  Z# R7 F2 Q, l4 I
___________________________________________________________________________) H! J/ @- N" u) e) J6 L6 }
( _4 J8 j% p9 i
Method 024 r9 }3 O; T* H9 `
=========) a3 w* r2 I4 f

2 r( D$ S! Y% F3 ~Still a method very much used (perhaps the most frequent one).  It is used
5 s7 x2 ^2 S( Y0 L( E8 lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 d' k; S! h5 l8 v3 n4 k" l# \, for execute SoftICE commands...
- x; a7 }' D; `# ^9 `$ W: ^It is also used to crash SoftICE and to force it to execute any commands2 D6 ?& K  n9 n" Q6 Q
(HBOOT...) :-((  2 d/ C4 g# v+ q/ d* R# S

; r& J( Q1 u: q: j# \/ hHere is a quick description:
, `( }2 [( X7 v. N-AX = 0910h   (Display string in SIce windows)+ I3 {/ Q- {: ~$ h( t3 }
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)/ C& q8 _. S1 h% {/ O" {1 _
-AX = 0912h   (Get breakpoint infos)
- @0 s' {. P; d0 b-AX = 0913h   (Set Sice breakpoints)4 t  C; J  P( F  p# _+ C7 z- x7 d! X( l( g
-AX = 0914h   (Remove SIce breakoints)
3 X+ c$ U/ x3 I' V" |& x0 j# P; z! r1 M9 ~* h& N
Each time you'll meet this trick, you'll see:3 ~8 Q( `! ^  P2 B% A- ~( [7 x
-SI = 4647h0 F0 A  S1 s0 J2 z# V
-DI = 4A4Dh1 i' |% m  {& O2 T6 ^1 K$ e9 f
Which are the 'magic values' used by SoftIce.
4 V8 o! V* u3 S# G4 S+ nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.) e- A1 R% i$ Z! w9 O

" u4 t  Z# Y$ s; OHere is one example from the file "Haspinst.exe" which is the dongle HASP( g* F- J4 t; N+ A) r0 T; E
Envelope utility use to protect DOS applications:. w* z5 K* v; n. ]
* [4 D9 i& [6 P4 N- }

# t% w: m% C9 n2 U4C19:0095   MOV    AX,0911  ; execute command.
- p5 m& a+ t5 G$ b+ G: l4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
& ?+ \' s5 M/ x! O4C19:009A   MOV    SI,4647  ; 1st magic value.
, q: u- ?8 A% k( s3 s2 X4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 s: u2 {" u) @  q$ C; r
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' M2 |% j1 k7 J( g( `/ J
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute3 l7 r' X: L' f/ y$ Q/ U
4C19:00A4   INC    CX
2 B9 F* {" y4 B5 [& o0 E: [% D$ x4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 P+ n7 v& L0 l& T! |' p" r. n4C19:00A8   JB     0095     ; 6 different commands.
/ G3 e4 `& d2 B; g, y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 B8 g2 |1 H5 G# x  o! {$ \
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, i3 |6 J* {9 w, j% C  A1 F$ n
% z- C! q& R# _0 _) w/ e2 Q/ c) n7 zThe program will execute 6 different SIce commands located at ds:dx, which
! K" |+ y5 r! _5 O  Z& ~9 gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.( X- I: D5 q: x7 I$ J

9 H, O* ^. g7 [* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ T( e8 h; n* b
___________________________________________________________________________- T* f( Q5 V$ H8 a$ K' H/ K
* B/ U1 f* K1 P3 B5 C! c1 O' w4 [

$ W4 [( R. \7 w9 ~9 s6 qMethod 032 Y& k) P" K! t4 i
=========
1 x6 n& B; V9 x) j+ P
0 ]" e8 N3 x! b( JLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 g0 t1 S, Q3 |4 H4 R. N! o
(API Get entry point)
  I# S9 S7 m/ ], D, |; k        0 h; L1 b6 W2 x& U( G

; o& L8 l, p- |4 x    xor     di,di
0 ?6 L0 P9 v# a* y+ V    mov     es,di+ V* t. M1 l5 E. x4 Y4 `& L7 K4 A8 ~% R
    mov     ax, 1684h       0 e+ s1 m; K* J' s  S* v  r  x4 T3 T
    mov     bx, 0202h       ; VxD ID of winice; K* _4 R( l, w  T" i
    int     2Fh' {* a7 t5 U# J0 p9 F5 F7 C+ @
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  y9 F3 B; E9 v( h1 e3 a, h/ l    add     ax, di
5 {4 D: r6 ?) Z$ \1 A1 \! x$ F  V5 U    test    ax,ax8 u9 ]# o4 _& W& c3 V/ c
    jnz     SoftICE_Detected
% X  D5 F# E( b4 O  m
% u1 z2 p: z, ]7 Q8 N. {; Z___________________________________________________________________________" R$ f5 y9 t( z
7 [1 B' d. ]7 p7 W
Method 048 x5 H' O) a' B' ?
=========
8 d/ k0 ]4 ]. W! I; g" `7 i$ B4 e7 q5 K. `* J
Method identical to the preceding one except that it seeks the ID of SoftICE3 c0 I: e- K& e1 G* }
GFX VxD.) n& T( h0 p7 c9 I! j/ z. ]8 Q
9 V) w: h& W9 P& Y) }
    xor     di,di
" t3 U% ~( G9 U1 ?3 d( e    mov     es,di1 u# Z" f  I0 [1 L3 r1 P5 C- _2 o
    mov     ax, 1684h      
* {, X% L. K6 s, W6 ~/ T& I- N    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) q* h% w. m+ j; H5 ]: B    int     2fh
' ^" m8 @& h+ @- t4 r9 E. D    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 \* Q1 m6 w- n1 f6 K
    add     ax, di
+ {! J) v7 I2 G% ^    test    ax,ax
5 a2 Z8 S! A/ H    jnz     SoftICE_Detected, E3 o5 t( |3 w- D& c2 \/ j  V7 P
- t  t9 I& a$ l0 r* n6 B  a
__________________________________________________________________________7 R* V1 ~& ^/ Z
2 a- @/ B" F$ A1 t" V7 n& L* k

5 j* A4 F# k" W. j  VMethod 05
' l% `* k; q" P+ n. p8 x=========
% J5 b0 M) S- V- N2 G) z0 r3 w+ L, O0 a9 m
Method seeking the 'magic number' 0F386h returned (in ax) by all system9 K5 i' L7 m2 o" |5 u: P
debugger. It calls the int 41h, function 4Fh.6 {" \$ I5 v9 O: v' x% ?" R
There are several alternatives.  % y; P2 S  m* Q, d) l# \( i1 e
( G# E1 E6 J0 L1 S, D3 I
The following one is the simplest:
" x% }  h& ^6 Y
4 j+ N' {; J. f+ ]    mov     ax,4fh  u5 I2 w7 ]. E
    int     41h
* g/ h* I7 N( G    cmp     ax, 0F386
) }6 \6 a% p, K' G. P    jz      SoftICE_detected7 y5 I, p# V  ^8 q3 ~5 ~0 H4 X. |! y
4 @0 E# {+ U" k2 l
7 P1 ?7 a- z0 h7 A/ J6 v' u& S
Next method as well as the following one are 2 examples from Stone's
# {1 ^$ M5 C( s6 [4 b& b"stn-wid.zip" (www.cracking.net):' y" p- m7 V! k: w$ t% \# Z

% j6 K: p/ l. X& x; i: T    mov     bx, cs+ g  E$ z, t1 |
    lea     dx, int41handler2) o. u7 x- B/ f3 d( W+ n* f
    xchg    dx, es:[41h*4]
: K; x' ?5 y$ I3 I    xchg    bx, es:[41h*4+2]9 l7 H" z2 H6 i9 J  C3 e
    mov     ax,4fh
) |, C+ a7 u+ |5 ^3 L9 Z    int     41h
6 n3 R6 b/ [1 `! R9 T& b6 V    xchg    dx, es:[41h*4]6 |8 ?9 r2 k% Y1 O
    xchg    bx, es:[41h*4+2]6 U, @! K% o! z: _5 K0 Z
    cmp     ax, 0f386h
5 N* X$ w: j9 p    jz      SoftICE_detected
- b. ^2 c7 z0 [+ l. K
: ~' v# M1 L+ Cint41handler2 PROC# q/ \1 O$ \, h
    iret
. v0 b" ~9 q5 |int41handler2 ENDP, t  R, R& ?0 Y- k

: i( f6 E1 r1 E+ P" t- D) f, B/ {9 ~9 f
_________________________________________________________________________2 K8 S$ D2 @: p0 Q6 G
, H' F; f1 \* g: K- R0 t) P4 y" t
$ P2 }& N0 g2 L
Method 06
1 Z3 m7 N; J$ d4 s3 C6 ?=========# {0 o% g& X# o
4 ?/ z3 x% c. o& ^7 c1 {) v1 N$ u
0 N  n/ l! Q& u. c5 w; h
2nd method similar to the preceding one but more difficult to detect:
8 v5 R) u) q* W2 I- R: V8 S: u' L7 z* g# Q3 F  S

6 W& u$ T' a% C' W, A7 Fint41handler PROC
* e( a/ @6 w( o! M: F/ _- m    mov     cl,al, y6 B+ E! H7 U
    iret' P: @; c0 Y" \6 l
int41handler ENDP
- }8 S) ~) w# U+ e0 b4 ^7 U1 }
! w* p/ Q; U; t' }% _6 A- k
1 c1 ?' K& A$ l. U    xor     ax,ax$ I5 R* E" z9 c, a, M4 Y8 O
    mov     es,ax% k% o+ ~4 t' |2 f& D5 d2 ~
    mov     bx, cs
5 W0 U7 e$ g3 P    lea     dx, int41handler
& J$ t. N  z6 u7 x, y" o    xchg    dx, es:[41h*4]4 l: Q6 G$ [' p, B, t7 a/ H* c
    xchg    bx, es:[41h*4+2]
" S/ Y& C4 l. M2 M2 M  o+ k( u    in      al, 40h$ V; h* V7 v" a$ m& t8 S
    xor     cx,cx
  i# v1 H) J8 h' B2 ^1 q    int     41h
, T% _* e2 g- ?+ M: f    xchg    dx, es:[41h*4]
- T& M1 Z8 J% Q; u5 F. b6 K    xchg    bx, es:[41h*4+2]
1 E; i8 m, ?0 g. b) Y7 j9 d5 m& p3 Q    cmp     cl,al1 {; r* k3 ~7 L: s+ y# C$ \; ?+ e
    jnz     SoftICE_detected1 P1 P0 G$ \* ~7 ]$ P. }, w4 {

* u" u) F6 a7 z5 g4 {/ `_________________________________________________________________________. L( Q% P& v9 ~/ u; {

- f# M' l: c5 Q6 {Method 07% ]% z" e, ~) |: H$ r) \
=========
& Z6 }: a" s+ I) ]( f( b: d" y2 T8 i& s1 i1 ?
Method of detection of the WinICE handler in the int68h (V86)
3 x! `  c; f; z5 N' u1 W# o5 R! M9 M* t- a' r
    mov     ah,43h0 Q+ n: ~( G' p, i
    int     68h
! G4 m4 |9 ~+ c* [6 O3 D; q    cmp     ax,0F386h  x2 s2 F1 k. ]
    jz      SoftICE_Detected4 J. Y0 n/ y: S" {' P; z" v
- P" t$ O& _. z0 R( L: y. J

% l* i  U: b4 w/ b=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 i% p  Z0 L2 Q, n
   app like this:
% P8 f1 B: T7 k8 F$ z( D. |- f1 U
0 c2 a2 g2 r# @% x" k! S   BPX exec_int if ax==68
; j8 u8 @$ ~7 J2 C2 K. P   (function called is located at byte ptr [ebp+1Dh] and client eip is( t( z$ b$ y! D" {
   located at [ebp+48h] for 32Bit apps)
5 ?* f" s* L; F# X( E__________________________________________________________________________# j4 w  \: r5 E9 q. X: O8 v
5 h- @! b5 j) o  |

  n' n- F2 c. R$ D  `& JMethod 083 Q- V( W) V  Z* W- ]& Q
=========0 q9 x9 L$ J8 E0 ]7 a

2 ]  z2 l+ f/ R5 ZIt is not a method of detection of SoftICE but a possibility to crash the- x$ ]  i. @3 l. A
system by intercepting int 01h and int 03h and redirecting them to another+ x; p" r, _, f& I6 ^- E4 w
routine.
- q  w& J; j. zIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- B- L3 S, [$ ^. I) A! ato the new routine to execute (hangs computer...)
1 d8 s- d$ ?  c# V: ]! ?% R1 |7 a5 i  Q+ z( [; f& K4 k( V
    mov     ah, 25h
' U( p5 }9 y, S, I# L( g; f- w    mov     al, Int_Number (01h or 03h)
: ]" w  u, \2 }    mov     dx, offset New_Int_Routine
; v( t$ [6 S4 T3 W9 [3 G( E2 W. Z    int     21h* }8 z, `# t& c9 l0 ]( k( I

  ]: c' v; H1 K$ E5 n) \% I" x2 x4 B__________________________________________________________________________
8 t' X/ w! y3 ]. R4 J6 \. ~7 x3 n: H2 Q- E' [
Method 095 V& `" w8 k- D2 E8 n6 q- V
=========
: m3 a; q. [5 G6 W9 g8 p+ a2 e: Z$ g, h. ?& d
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; k! ^% j; v: U( Tperformed in ring0 (VxD or a ring3 app using the VxdCall).
+ H1 [2 r" i. ]The Get_DDB service is used to determine whether or not a VxD is installed
; R  f8 [" j/ P6 x6 k5 wfor the specified device and returns a Device Description Block (in ecx) for" y& r7 b3 m: a$ X) y% Z
that device if it is installed.
) l+ ~+ f  S3 _+ D+ A, `( O, L
9 R! R5 G$ o4 G$ W   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 |! C" |: s6 R) M# V# |
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). z7 e8 q! j9 t+ S" h8 n/ \) |- n
   VMMCall Get_DDB
7 o; ^. t5 r: Q9 L   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 a8 V  h% t* \/ [2 j# @
+ {% ^% o" t9 I8 R, k! h' u: d: Y
Note as well that you can easily detect this method with SoftICE:
, Q# k- m) V6 n/ P  |- B   bpx Get_DDB if ax==0202 || ax==7a5fh2 K# _8 V, [/ b; ~: O, P
( c9 P* Q2 r6 R$ t9 F3 d& u
__________________________________________________________________________
: ]. }. u. Z5 Q) H
8 V2 W, ~7 s9 M& i9 Q# ^1 MMethod 10
( V" e. H3 E! x2 y=========
% Q( m7 ^. G3 x( H0 Y$ {! a  e, H) @! N2 Q" W' u
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" H. g7 E; |( N: ~+ a9 S
  SoftICE while the option is enable!!
0 f, b1 D. M& T' Y0 }. s7 b- D3 K: y1 S" j, f$ Q' i# g( c/ e
This trick is very efficient:
4 `: c$ A. x0 C9 B9 e/ a+ K+ p# r& Uby checking the Debug Registers, you can detect if SoftICE is loaded
% O9 C2 g: W/ E4 f, x5 Q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
; p" S4 n3 G/ a6 j! Q1 ^there are some memory breakpoints set (dr0 to dr3) simply by reading their0 p1 m& G+ U" }) n* `
value (in ring0 only). Values can be manipulated and or changed as well, c' x( x' @+ P1 D1 S6 E1 |
(clearing BPMs for instance)
4 Y, D% X8 g  T6 A* ^7 i8 Q0 L, y% Q$ _4 V' C  m
__________________________________________________________________________
; o( S5 D7 r% e0 y& W* |' i+ O8 S  B0 X0 S5 {. ~
Method 11
+ q) y6 H7 w6 j# H8 |/ ~* i9 |=========
8 o' N. g; |; ?: o" m* O
) |, ]" M; @' ]2 I, I7 z' g+ OThis method is most known as 'MeltICE' because it has been freely distributed9 l* b5 Q2 |0 S  c7 k1 Z5 ~
via www.winfiles.com. However it was first used by NuMega people to allow
% ~" g# L& w. f3 u% @. Z- ~. P3 ]Symbol Loader to check if SoftICE was active or not (the code is located
' e- b/ W1 Y0 i/ `* r& minside nmtrans.dll).
. n1 O& L" t! `- b  R& a1 L5 d4 f, n
The way it works is very simple:2 M3 Y& _6 Y: G3 C
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 Y0 M: ~: T, X* a$ i2 t" dWinNT) with the CreateFileA API.6 \) B* ^& o; R# n
1 n2 V; l+ u/ f5 H( x+ _+ _
Here is a sample (checking for 'SICE'):; x% J$ J6 G/ `. P6 e

. g- ~' o  ]# q" U* }1 wBOOL IsSoftIce95Loaded(): \& ]! X" [  h# d. p
{4 Q7 }( |2 o( @2 D& I. e, ^. w
   HANDLE hFile;  
# b. K/ {8 U0 L( b6 U( Q# P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# v8 D, g$ v# M2 D2 U4 T1 S) f                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 }( @+ _* i1 V
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 X' j8 @4 m7 Q* d5 S
   if( hFile != INVALID_HANDLE_VALUE )
. U6 Q( f7 P' F   {6 _& K, e/ F. {3 F3 s
      CloseHandle(hFile);  {% p( z$ T1 D
      return TRUE;* u! P4 r  k; g3 T
   }
; m7 N4 E, y# v1 h5 s   return FALSE;! b! |& f: E0 _3 p' c/ H; m
}$ U0 C7 B/ Z; \" v

) L/ w. ]+ }9 c% S' Z; WAlthough this trick calls the CreateFileA function, don't even expect to be2 f4 F4 p0 a0 H% R9 @2 l, J
able to intercept it by installing a IFS hook: it will not work, no way!
+ `2 X' x9 d# P; ?6 {In fact, after the call to CreateFileA it will get through VWIN32 0x001F# W  X4 R, H, Z  D: k
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ e, |3 {- o/ |7 w+ land then browse the DDB list until it find the VxD and its DDB_Control_Proc: X8 X; ], v% ]) k# {/ O" _7 G
field.0 d( G' l: l! c) c( i
In fact, its purpose is not to load/unload VxDs but only to send a ' D* u! R7 \  `: A; J2 t
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# |/ S8 W6 F. f  P6 ^2 i/ q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
% t4 _  Z, w" _& i3 `# Mto load/unload a non-dynamically loadable driver such as SoftICE ;-)." ^8 l' w, c7 e: }. z- L' l2 ~9 s
If the VxD is loaded, it will always clear eax and the Carry flag to allow# F- p' c5 V7 Z7 W1 ^3 U
its handle to be opened and then, will be detected.
' m; D( U. l3 W. P  `% h; NYou can check that simply by hooking Winice.exe control proc entry point  N% D( u( Q, D
while running MeltICE.  l% ?' j% V( ~/ O

: `+ B0 \6 L+ ]* X5 K
! i  c" M- u! q9 h( n7 h' ]  00401067:  push      00402025    ; \\.\SICE
5 j; w9 Z# z: r0 L/ i: j  0040106C:  call      CreateFileA9 `* d1 ]' i" F" l5 \& z
  00401071:  cmp       eax,-0018 U* ~5 b1 N( ?5 l4 t
  00401074:  je        004010917 \2 S' v$ W3 M6 Q- e
( `1 y6 ]0 s: K! d$ A8 c

$ p6 i- i+ ~# DThere could be hundreds of BPX you could use to detect this trick.! R: v, i1 t( O
-The most classical one is:
8 h1 j- [- ^  N. g1 J  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" [6 O( i( ^5 `4 U
    *(esp-&gt;4+4)=='NTIC'! Z0 b" v5 U, l) I
! x% |' |) }7 E9 l5 J$ ?1 W( k
-The most exotic ones (could be very slooooow :-(, s7 f$ G0 K! K$ N) N
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 R  {# }- X) V     ;will break 3 times :-(
: G- I" U$ }; ]; O. g. H' r/ n. O0 V+ V2 t; I1 f" U4 Q. J
-or (a bit) faster: # b9 W7 Q& Y% R8 A$ j& [' d
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 G6 ^4 b0 o$ _$ p) w
6 J# [3 \  E9 q" u' b' f& ?  j5 S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # R( X7 d' H6 x6 K
     ;will break 3 times :-(1 T. F+ D! q4 Q5 F& {
/ h# D( V  M+ {3 b, g8 C- T
-Much faster:
4 F5 b" E+ {  ]! q; M4 S0 P   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! U  z: p8 X( z, P
1 @* @" ]  s2 a, Q- D# INote also that some programs (like AZPR3.00) use de old 16-bit _lopen5 E% W) G# T$ G; }! ~
function to do the same job:
9 N, c) L* n% A. z; u2 Q3 ?+ J4 s2 D* x3 {( f; r
   push    00                        ; OF_READ* Q% d/ ]" Y- r! u" J5 h1 t
   mov     eax,[00656634]            ; '\\.\SICE',0* D4 e# e1 [8 \# B9 x
   push    eax
  D% Z6 S1 t1 }6 O' s; m   call    KERNEL32!_lopen
# f( M6 R7 ^# \   inc     eax
$ Y) ]9 o8 Y  t   jnz     00650589                  ; detected
9 E- h" p5 i6 ~/ d6 e   push    00                        ; OF_READ
9 Y- X* `% e% N, ^' a   mov     eax,[00656638]            ; '\\.\SICE', s- @4 L  M- ~5 l% @2 J+ p1 h
   push    eax9 F9 \7 h5 e9 W9 t5 @/ ]1 D) h" N, o
   call    KERNEL32!_lopen
% R& J$ T5 i, N; U   inc     eax
/ a6 f1 u8 u* Q( S   jz      006505ae                  ; not detected3 O+ |8 T5 D: C2 ?0 U, D
$ t* P* l2 l8 ~1 N( Y2 k. s
5 j0 h$ ]4 G  E
__________________________________________________________________________
3 r6 ^. s% W" j2 C# [4 F
4 U1 I! \. L8 \8 D( OMethod 12
8 ^& M$ g6 ^; v1 T: P=========* H/ z  y' P& Y# L  B

; |" c: W$ T! F; q& A& @6 uThis trick is similar to int41h/4fh Debugger installation check (code 055 t0 R: x# c" [
&amp; 06) but very limited because it's only available for Win95/98 (not NT)  q) n- z. W8 D. a+ K) l0 S
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  \  X% _. Q) a/ y" Y2 B8 I4 y+ J* E) `0 ^7 _: d
   push  0000004fh         ; function 4fh
7 ^5 |8 ~) A1 M" r2 T& F" x+ o   push  002a002ah         ; high word specifies which VxD (VWIN32)* ^2 t* p7 J& y( L1 d1 H4 r: e, S
                           ; low word specifies which service
. ^8 s# o7 t- @6 H) S                             (VWIN32_Int41Dispatch)
/ I$ T  \6 p& n. ], a5 _& l   call  Kernel32!ORD_001  ; VxdCall* X& U. ^1 |4 [5 f; ~+ N) f( ~
   cmp   ax, 0f386h        ; magic number returned by system debuggers8 {# X) }& L7 S  I; J0 j; O$ n/ @; H
   jz    SoftICE_detected
- i( k; ^+ b  u# _! c/ n- E6 @* L' U9 B* L6 i( t" c, K
Here again, several ways to detect it:
# Y8 y/ f' w. v3 S: y6 N- {$ t0 ]# X1 x3 ]9 e, w* S) P- f; u
    BPINT 41 if ax==4f+ P1 ^' B7 T4 G: x7 h

& F" g: P5 U: E+ r. U+ b: j( H    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% r! H+ k2 T, g) C' e. i4 g
4 l4 R( z: f2 M2 X
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 i5 R: O( j! V2 Q0 |/ ?

6 S6 d6 F) I! F/ o# H; c3 a# _    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 x/ A$ G/ G+ f: K
6 S( Q" ~0 K: l__________________________________________________________________________' L1 @5 P, q1 E0 G  N' I# h: Y, E

" G. y* o2 P/ a, x6 w2 x8 Z3 ~Method 13& x+ a9 \$ g1 X  w0 C6 C
=========$ g- Z6 n1 y2 Y7 ~9 F( j

! @9 f) X2 K& v4 gNot a real method of detection, but a good way to know if SoftICE is+ c* L8 V7 d9 ^; q/ R- N+ ]
installed on a computer and to locate its installation directory., F6 ]! W1 A+ W6 A: t! S9 I8 a
It is used by few softs which access the following registry keys (usually #2) :0 S: s  x, `0 v$ ~* K* |3 ?. q
) w  j( g  v( \' n
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- J, {% m  T: k9 ]% W- B  B\Uninstall\SoftICE. C& x* ?  T3 a2 i, I
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ g  |% L8 X4 c8 g+ V5 H-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 }  H% s. f8 U' N! C/ C
\App Paths\Loader32.Exe: G% c7 K& e2 z& o; O8 }

5 t; N7 F& C+ z6 g- m
7 \8 r" W9 F9 o6 X. g0 i. A/ uNote that some nasty apps could then erase all files from SoftICE directory3 K/ E# S' k, U! ~3 l) @
(I faced that once :-(
6 D6 V5 T. l& T) k! N' Y1 k. F7 d
6 s5 g$ c: a) b6 e4 ~- [1 KUseful breakpoint to detect it:% y8 `6 q# m' X; \

# D5 s( {) `$ B! L     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': K4 {& }2 z( ~4 g) Y4 l
& M; o7 t8 M2 P% C
__________________________________________________________________________
' X7 _3 F$ I, e, {, k9 u# V/ G6 y! g9 i5 z0 ?* ^  l6 f
0 l" H, L" D/ [- v
Method 14
6 v$ g, z2 n5 r6 P( h=========
/ w# u, L6 P- {5 H$ m
5 e/ f5 \6 y6 O/ J  r; ^A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 C7 @5 \" d; }7 fis to determines whether a debugger is running on your system (ring0 only).; o! J& t6 H( z9 I) G- a- W

+ R( Q* w7 p. T! A   VMMCall Test_Debug_Installed* S$ p9 D  r+ G% L7 W2 b
   je      not_installed
; V+ D6 I' ]  p! d8 ]$ c7 A, t' K# V4 [* l9 S
This service just checks a flag.2 c0 l/ b. [4 A$ x! J) S0 v  E
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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