About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 W+ k2 s; Y; _! V6 [0 f$ g<TBODY>* R3 E  M- M$ a2 [: Z
<TR>
) T) y3 U: L& V2 V1 ~<TD><PRE>Method 01
9 T- @. t4 ]. }; F=========" Q! J! x) _; j* Y
3 u5 {. Q! c5 j  E
This method of detection of SoftICE (as well as the following one) is# `; L' r7 E# a  L9 C% O( @4 X
used by the majority of packers/encryptors found on Internet.
8 `0 ^2 C$ H/ t; sIt seeks the signature of BoundsChecker in SoftICE2 f/ _' M6 @) y+ j7 f( [

; E2 P9 I/ K' y) [! V5 i. m7 X    mov     ebp, 04243484Bh        ; 'BCHK'. D1 f0 s0 I1 E
    mov     ax, 04h+ V5 \) h% O9 i8 F& ^* N9 d
    int     3       # q2 b4 X8 ]9 n. m3 h4 C- J4 P
    cmp     al,4
$ c2 X; X  g  B0 x. |$ B    jnz     SoftICE_Detected( ?, D" _5 U3 S% k

; ?/ z9 g4 I8 W& T+ J+ t0 W___________________________________________________________________________6 H0 r) a& H' d+ p

- z* D9 n2 R* G; _! t5 iMethod 029 ]' y5 g  N2 K4 V
=========
7 e& g. r$ Z) l7 H  u- F) V
  u/ o" q# b3 yStill a method very much used (perhaps the most frequent one).  It is used
7 j* |: C3 \" [2 m3 Uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 @# c7 v( o( }# bor execute SoftICE commands...
! B' f) S/ z1 i/ b: M" AIt is also used to crash SoftICE and to force it to execute any commands
* Z/ d7 ~2 J8 k5 c(HBOOT...) :-((  0 h/ l+ ]1 ?: w! P  D

  w* q8 x" v* {# C& VHere is a quick description:: h" D' b/ ~# ?+ F* A
-AX = 0910h   (Display string in SIce windows)0 I# t) Y1 A% l2 B7 }2 u6 k
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 O- {0 o4 ?( L4 Y1 M-AX = 0912h   (Get breakpoint infos)
; H' z4 F  D; M& s- [4 f' x-AX = 0913h   (Set Sice breakpoints)
  Q, J% e3 V# V* {; |5 Q6 e' [# `-AX = 0914h   (Remove SIce breakoints)1 k$ M+ M7 n. F8 m7 j' S1 O# s* }
/ @( N( n2 ^7 j3 P6 W
Each time you'll meet this trick, you'll see:$ k' ^, c( R  Z5 ^
-SI = 4647h
4 t- X& K5 V( |  e7 J! y( A-DI = 4A4Dh, {; }' \* h$ `: r. M
Which are the 'magic values' used by SoftIce.
3 T0 i  [2 k: a+ ~* b5 v- fFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.) a5 X% Q6 i2 D; O$ E1 o

# T# S! H. o" n- A* V: XHere is one example from the file "Haspinst.exe" which is the dongle HASP
* w3 p# T( O  Y4 T& j9 Y' `/ l# [4 GEnvelope utility use to protect DOS applications:
  ^4 `- _) H% [
2 I7 `3 @0 C$ j) A+ J( F" N8 x; i0 ^, |% {6 Z0 m& s# U0 p
4C19:0095   MOV    AX,0911  ; execute command.% C8 E( o7 {; R, ]+ Y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ G7 M, D% l; ?4 L: F
4C19:009A   MOV    SI,4647  ; 1st magic value.
! u0 R3 {* I' s6 ^; j0 Y) K4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 {) z: t( j4 U8 B, a( I4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& _* j* ~7 F# a! |5 n) z! w4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( {$ y) x: h3 W# R( h
4C19:00A4   INC    CX
8 B* G! y% s% ]9 i9 |# d* R4 _2 {4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' y( t9 ~1 e' l4C19:00A8   JB     0095     ; 6 different commands.
0 j- q# w( T" }0 X$ H! \# U8 H5 Z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 q) n; q9 ^5 j# D% ^" @& i+ i4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 E& E& E: b- A8 A/ p
' K2 t# N$ I) u" G' @& F
The program will execute 6 different SIce commands located at ds:dx, which
4 L* @6 ]' M& x% Kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 K8 @+ W2 e" G. W, h! y7 y; [9 g+ o
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- J- ]  S: a7 O- K0 w
___________________________________________________________________________; w9 |- L) ?. i" a3 t
6 M$ u3 L5 r! J/ q! Y
/ a+ Y( g) }) V! ?
Method 03& p4 D5 M# l' V$ n  \
=========
: p) G  @* S/ Z& k5 X& p' ~! f2 y+ p  l4 W' Z! Y( E. a' J+ K4 t% ]
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 m5 J' I' f4 v( L9 V' F5 [2 p
(API Get entry point)
- I7 A$ j% x4 {5 {; C0 r        
: L% j; k* f7 e! L5 F8 q2 P. O$ U
    xor     di,di# U5 J% q" Y& P& }) `8 k' a
    mov     es,di
1 i- z" U/ J* u9 ~7 d2 L    mov     ax, 1684h       1 T% [7 ~  {4 a, b- f: M
    mov     bx, 0202h       ; VxD ID of winice
% \! |# h2 w) V" @% }% W) @    int     2Fh$ V/ Z* x7 O: r) v2 ^
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" E: O. K  d& ]% ]. Q9 ^; Y" u5 ]9 j
    add     ax, di
9 W) M* I- l! W    test    ax,ax
" L' U8 X7 |4 j' k    jnz     SoftICE_Detected
3 \2 F2 u# Z  ?7 l* b# S7 C
! L" t+ H' Q5 Z7 Y, G: j___________________________________________________________________________) r& T) j) @9 r. l9 s

% c" c2 N7 w! m3 [, N% a0 _Method 041 F6 g. v6 L+ ]
=========
: k0 m1 B, `6 n! f* X
9 i7 T9 O6 L* P8 z6 RMethod identical to the preceding one except that it seeks the ID of SoftICE' {9 k7 |( G: |& T4 Q
GFX VxD.
8 T9 \" K+ |4 F7 H8 c# K' F; a8 e- j+ m! v3 t7 ^+ J5 {+ t
    xor     di,di
1 ^% }. X5 u4 d* j& p- F5 z8 M    mov     es,di
" N6 R2 P: Q- ~% |    mov     ax, 1684h       * s* V4 @* [1 D
    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ S4 L! `% ]# S  R. Y8 H; _1 Y5 F
    int     2fh& }0 E4 d5 [$ y5 I8 Z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 R5 k: D6 C9 Z" I7 Q8 O
    add     ax, di4 L, B& a' x7 b4 G. p
    test    ax,ax2 }% h% }" e( U0 g& z4 p3 x
    jnz     SoftICE_Detected; A- d& a  _' c: `. a
' ^; Q! ?9 w# ]8 J
__________________________________________________________________________4 c' h* E$ ~! }

' ?: \; r3 I& m4 [4 O; \! p, C& r" v, f# C1 P7 r
Method 05
5 m9 r' B( W3 Y/ K9 m=========0 i) P+ g+ h% M. c' T  A# X

( ]* S3 G  ]: k1 bMethod seeking the 'magic number' 0F386h returned (in ax) by all system$ z' Y; E% q0 f: E5 X! A
debugger. It calls the int 41h, function 4Fh.6 Q# n2 A+ s1 Z6 p6 n
There are several alternatives.  3 Y+ z; _0 D. F: w3 ~# _, A
6 V0 d: R3 @4 q6 V+ \3 n
The following one is the simplest:- y2 V& c1 f+ u% H
+ T7 E0 |$ k8 ?/ A) W, Z( F+ Z3 o
    mov     ax,4fh; }2 w4 P& ?' P: E" o2 T
    int     41h
6 q% B* I2 @! n, {5 C" k    cmp     ax, 0F3863 L! z$ y1 t0 F8 X7 }; _6 t
    jz      SoftICE_detected& I* o- I* K9 N5 T6 T: X

! _* U5 y# K. x; q1 s5 l- }7 }& y' N+ ]" @/ }2 s7 E
Next method as well as the following one are 2 examples from Stone's 9 _4 ?8 _% G) y4 z8 B
"stn-wid.zip" (www.cracking.net):% o+ H0 E& l! z; U  v* J5 p( @1 @
, i3 _* Y+ M  h$ V4 `% C8 `1 w# u
    mov     bx, cs: A9 f0 r' n# J. `; P
    lea     dx, int41handler2
! N/ G. n. V# ?    xchg    dx, es:[41h*4]) h/ M6 R( s" I5 Q7 s1 r) s
    xchg    bx, es:[41h*4+2]3 @% x5 R9 ~/ U  w* H
    mov     ax,4fh; B1 J2 Q9 a( h  w, @. k4 a
    int     41h
/ a; J8 V1 b! g7 \  X    xchg    dx, es:[41h*4]
% Z& b$ k& f# r" {' S    xchg    bx, es:[41h*4+2]
- T# w% u6 D5 @3 j( C    cmp     ax, 0f386h
* z! G9 D+ e3 j0 @" |$ _# y( B; b    jz      SoftICE_detected
7 }" `6 i" f. E$ n) r3 t/ x0 h; L0 y0 \$ F% }; B, |& {1 t; ^, y
int41handler2 PROC
* B- P, ]- X( ]% r. w! [% n    iret
4 q1 g3 o$ Z7 d0 k7 P4 v: jint41handler2 ENDP
+ q5 m" i( A1 W( z
7 B- c- G$ @! ]. w( G* n6 u9 w( f" _
_________________________________________________________________________* F- x# W( z, f6 d. z2 u
, i6 N7 t# G  h. s. G, s6 T

' c4 H. y! Z; j/ e' b% FMethod 06) t+ |  `0 k, z# Z
=========% E; Z. j# c9 }( K  E7 T

! ^) f% S/ C" Y/ o  q% ^0 A& i) m8 o
" |8 U* J- |* Y/ P2nd method similar to the preceding one but more difficult to detect:
3 o7 _+ |0 k7 V- A
0 ^% {* F! R, t, }9 O9 A) p* w1 w, a( E; {
int41handler PROC
9 e1 y0 {- k4 j" G" L% W    mov     cl,al
. M4 L4 ^& V( e9 G/ y$ v    iret
: v& T; e! c5 I1 Z5 Z2 Y% ]int41handler ENDP& ^' D& [, C  ?$ l" x- h

) \( x4 h9 ~1 c, ]( t: b  y3 h; l
4 Z/ Q* v1 b: U" I3 G* C; j    xor     ax,ax
1 @* z( ^, }2 {3 r    mov     es,ax- W1 Q: v% v( b
    mov     bx, cs8 n' I4 U7 `1 B( q0 U) K5 G% U+ N
    lea     dx, int41handler
% q; O( z7 I# E8 `( p    xchg    dx, es:[41h*4]
8 F: I$ o( J$ R! `8 d7 Y    xchg    bx, es:[41h*4+2]! `8 B& U4 S7 W
    in      al, 40h' r/ ?; K* A# r$ s
    xor     cx,cx
' O- P1 V3 J. {    int     41h
3 i, p3 p) ]& m& N* R8 ?: v. _% R    xchg    dx, es:[41h*4]
0 H" O6 F" _. c, I7 ?    xchg    bx, es:[41h*4+2]: |) K0 s- r' |' I3 y
    cmp     cl,al% B3 J; D+ v3 x" v/ H2 \% l
    jnz     SoftICE_detected$ R/ t0 j+ L* t1 U
3 \5 ]7 L+ W7 Z! M# z
_________________________________________________________________________1 k$ X$ s. C# ~$ C9 j0 V" C) O

2 K  s' ?- z  e* K& aMethod 07
3 M/ w, ~$ k3 t3 ]5 ^2 d7 f=========
- ]; R! T' e. E  \( j8 }6 p" p, z3 X" n; O0 r
Method of detection of the WinICE handler in the int68h (V86)
# \5 c4 A4 Y5 [
& c4 i" P0 W8 J4 b2 o7 k    mov     ah,43h, Q  L1 O! F" s* y( n8 e
    int     68h& |7 d2 d: x- H, b0 y
    cmp     ax,0F386h4 N' d3 C  H9 E9 W: ~
    jz      SoftICE_Detected7 G3 c9 V% j& b. Q) d
0 Y" m" G7 U3 R0 z) q$ I
/ U" z# C- N( }' H( u4 j$ V  w
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ A+ l4 X5 n5 W1 u! Z' X0 p   app like this:+ g' V4 N3 g* [/ n' Y( U" S

0 `$ x' `8 h  N7 ?   BPX exec_int if ax==68
! k1 Q* h( z' |  E   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 V" [* ^/ N3 W2 b; M) b. G   located at [ebp+48h] for 32Bit apps)
# l* O( Q: O( g! G) p1 I__________________________________________________________________________# B, e! g% i% P& g) r
+ Y) P% X7 a% n
0 O4 I7 V) N1 ~0 y9 e6 [
Method 089 N) h! Z! G- J1 W. g# x
=========+ e/ s: ?5 a2 T7 i2 ^/ V* j

( M2 `9 b/ g& G& u! i  N# O8 iIt is not a method of detection of SoftICE but a possibility to crash the+ n" `5 i% B# j- E3 R: y
system by intercepting int 01h and int 03h and redirecting them to another
4 f  Q- T0 d1 q" H0 P$ kroutine.
! ~8 h3 y& i4 N& d. r! z; lIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( y5 p7 A# b$ K3 R4 u8 a/ q# @
to the new routine to execute (hangs computer...)3 q) [( B; Z0 S' L0 Y  B" G" u* _7 H

; w. @* S) h( y, t* c) E) _    mov     ah, 25h
6 Q; @7 {* Q$ o6 ]- j1 C    mov     al, Int_Number (01h or 03h)
8 o$ l8 e$ W( v    mov     dx, offset New_Int_Routine, y7 w, F6 P" M2 b! H9 k5 P
    int     21h, W6 v/ x" G8 Q

# Y" n$ j1 f( Q3 [6 a' G; M; V__________________________________________________________________________
! Y$ G7 ]9 Q7 {# [4 h3 X0 ]( L2 f) R1 r$ E8 x
Method 09
  Q5 w" M, D( ^4 H- Q=========
* W8 T0 s! A! j7 }! @) `6 O8 U$ O
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: \; L4 T! y0 m1 f0 d, Nperformed in ring0 (VxD or a ring3 app using the VxdCall).1 [( N5 v- P! ^; |) m" J, m: C
The Get_DDB service is used to determine whether or not a VxD is installed
2 ^$ R6 [& O1 q4 S4 ^for the specified device and returns a Device Description Block (in ecx) for
7 S4 ?- V0 \! U. I- \that device if it is installed., {1 n0 X( L' \' K

* ]3 ^: B/ Q& N/ w   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 ?: y/ q# s* ]
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)' b" W% b7 ^3 o1 u& }
   VMMCall Get_DDB
: r* d9 X% j! N7 q1 j7 ^   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed) n! p/ K3 }% W' S, `, }) S
0 l  g" O& Z0 F/ Q! Y* A+ I' L- l! `
Note as well that you can easily detect this method with SoftICE:& Z$ B& E8 T- d
   bpx Get_DDB if ax==0202 || ax==7a5fh
1 r( l1 ^7 g3 n8 P" W* d& v! K6 ?5 h; E3 e0 R  @. V6 {
__________________________________________________________________________
4 v  s1 F9 m- K; e1 L5 l. N) x% \9 I) k5 q% Y7 h
Method 10
" @% ?7 k% R% [=========
( L4 ]3 j" [; d6 G7 o/ d0 z! ^
2 S; U7 L; p/ c% u- y. U  u' P=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
: E. S4 f* v& m: Z! T. H  SoftICE while the option is enable!!
! s9 C0 c  \: C5 Z& J  d
+ l+ |% S* Z2 [5 O8 X5 _2 t, ^This trick is very efficient:8 ]- X" R* \" h) B: m
by checking the Debug Registers, you can detect if SoftICE is loaded
2 j" v# k6 U2 X(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( j) `; \: ?  b/ S: S
there are some memory breakpoints set (dr0 to dr3) simply by reading their6 F. x) G, h) x% ?: @# ?3 ?
value (in ring0 only). Values can be manipulated and or changed as well+ U# a; a: B7 h: D3 \* V, @+ K$ x* h
(clearing BPMs for instance)
' Q- l! r1 r" V8 _# ~: a8 x4 M
3 A$ L! t& C- T/ R' {6 A, e. |__________________________________________________________________________! k! T4 S  v, K6 P% f
. a- m/ @& ^3 b
Method 11
$ X, s3 z2 a+ }=========3 E0 @4 {) h' V; T5 j
. ~; x' h5 ^/ t4 ]& V9 n" D
This method is most known as 'MeltICE' because it has been freely distributed  {( a7 l1 P, D- @
via www.winfiles.com. However it was first used by NuMega people to allow& w3 c/ _: B- N2 _
Symbol Loader to check if SoftICE was active or not (the code is located! R6 Q! q* F, ^" b+ _7 i
inside nmtrans.dll).
- ]2 s2 z# O  Y' h
" U5 L# }9 Z) J; a/ E- `6 {# UThe way it works is very simple:' ~3 ?% K1 U  t) p+ T
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) Z! e% n! f8 m0 `/ m8 k/ kWinNT) with the CreateFileA API.
$ [! c( A1 B- ^) E$ t* Y2 a* r
8 L0 P  W' K6 M+ ]3 hHere is a sample (checking for 'SICE'):9 c3 `  Z0 @, k" e3 \

6 i4 I; r5 T# G2 OBOOL IsSoftIce95Loaded(): f% ]3 \1 E% `9 E" Q5 ], U4 p; K
{' [, _4 h" N: z& B4 _
   HANDLE hFile;  
4 n5 B6 _) g0 X   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 l6 Q1 Z1 D2 h5 W                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) ?4 A9 I4 o" p' g. P                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 D' B) R& B- K, l   if( hFile != INVALID_HANDLE_VALUE )5 o( N1 j; l8 e6 l- q  M- a
   {
) e1 g! q! _, j* Y3 l      CloseHandle(hFile);
4 M, B' \3 g" Q. G4 ]3 n. N* p      return TRUE;% T! G( }: P- N/ j& y1 R& K0 x2 G
   }
: q& N$ p* [" }' _! y% E   return FALSE;; v% i+ w# ]+ f1 b
}2 \+ q7 s1 |4 e! ?
% M" d1 }3 x2 Z( t; a1 t4 B
Although this trick calls the CreateFileA function, don't even expect to be
2 i: @- u. @' e( d" bable to intercept it by installing a IFS hook: it will not work, no way!
7 Y# [$ f$ z5 M/ z: _3 \- LIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
7 y6 ]& O: p$ u9 L. }service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ b! I  T9 [3 v( e
and then browse the DDB list until it find the VxD and its DDB_Control_Proc7 U2 T3 X$ T/ S# R( O& Q+ R* j$ D
field.
9 @6 q/ `5 s' r, M$ ?* GIn fact, its purpose is not to load/unload VxDs but only to send a 4 P6 w, J% `$ o0 N9 Z& L+ S/ t$ z8 w. W
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)& X0 ?8 ^8 S; ^/ T- O
to the VxD Control_Dispatch proc (how the hell a shareware soft could try$ [- q+ Q- f; Z3 S' i( G' ~( x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
( C. O' M4 ~0 {: w" ~If the VxD is loaded, it will always clear eax and the Carry flag to allow
; K( l+ E& n  j1 {! C6 F+ gits handle to be opened and then, will be detected.6 o) U" t( {% O% h0 D2 L' O
You can check that simply by hooking Winice.exe control proc entry point
6 @, j. {% c' Q$ ^' {while running MeltICE.
( Y+ f% c' [4 O: O+ Z) ^1 f: }* A1 v% @) Z# x

+ h& z5 ^3 U9 U% e) s( N  00401067:  push      00402025    ; \\.\SICE
9 \7 W  f) Q2 C! [8 P& S+ Q3 [  0040106C:  call      CreateFileA
6 Q( z. [( y6 j! z+ w( @  00401071:  cmp       eax,-001
/ C6 E) N+ {- G) ^; ?; y2 j( h  00401074:  je        00401091
3 R% G7 w$ e) e! X; y2 o1 g- W% O8 q; O& W$ X% o

' A) c' X. t/ Y  p2 s! U0 }There could be hundreds of BPX you could use to detect this trick.1 C: u- M( B$ v0 c" @5 q4 I" F6 G' A
-The most classical one is:* [( R* |3 p2 q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- o! e2 S6 K' `; Q0 o) g* h    *(esp-&gt;4+4)=='NTIC'3 s* N( V( V8 `7 B+ W6 G
8 n/ A5 J6 `/ F) l0 z! y6 P
-The most exotic ones (could be very slooooow :-(* i7 {2 |6 H5 t" ?' W- T" F. L. k
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ K0 q8 j; o* j) C4 k7 h* v
     ;will break 3 times :-(" j. O  j+ \. K; J7 X+ [

/ U& \0 N' C7 I5 x5 u! A-or (a bit) faster:
1 f6 N: Q+ }0 f: h   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! @5 D8 }) r' `% m
* T2 Z1 h2 E9 m0 u
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" W" ~' }1 J+ q& r2 S8 S: c5 R     ;will break 3 times :-(" G% `/ \  R' x8 q, S8 ]  t' F
- a3 y7 u: G$ K. {$ ?
-Much faster:
. u6 n' v# v& n% [# k   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
- {3 m- D: @/ U( A8 C- |: J$ a4 ?( z! g, `# j  i
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen+ O% L. R2 r2 z, B: h
function to do the same job:3 B  m8 g/ c" i# d5 U! E  u2 S

% B, m8 R: o/ }; G. s6 y+ V   push    00                        ; OF_READ
% q  l/ u0 t* x0 z/ b" x& U   mov     eax,[00656634]            ; '\\.\SICE',0
  H) q' U8 b8 f1 u1 ^   push    eax
2 E# T3 w  e4 O( X& C$ \   call    KERNEL32!_lopen' H& b2 o6 s3 R) z* v$ ?" q
   inc     eax
% o. v8 H/ r( b! h( z   jnz     00650589                  ; detected
" W; i" k' @' b$ ?6 E1 m   push    00                        ; OF_READ" p$ A, K0 h5 D' Q+ @
   mov     eax,[00656638]            ; '\\.\SICE'8 [7 F7 S' ]# I4 Y1 E  U
   push    eax9 M( h5 T1 g3 A; [" v
   call    KERNEL32!_lopen
7 [% h) O* x: V4 n  D+ ^   inc     eax
: M* s8 C- B4 t  I1 i7 J& w   jz      006505ae                  ; not detected
! l" _4 ^- e' S7 }7 v+ g* J  z( G( S2 a3 x# q1 I' J
% N, G% z& a7 q- @& x: y
__________________________________________________________________________
6 o0 Y* j3 m5 h: T; e7 z- J, f6 `7 y9 R! M  w9 a* L2 a
Method 127 ^1 n9 g- k; O6 N" i
=========
# @( o% K. G' }2 n6 [$ e3 |  e! z
# X3 N. L' P6 n4 tThis trick is similar to int41h/4fh Debugger installation check (code 05
$ T) k; C) R1 r8 F) N: w& T&amp; 06) but very limited because it's only available for Win95/98 (not NT)! S. s8 Q0 b- u& V) Q" }. ~( s. _4 M
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 c1 q- V2 K7 L7 m) j. P- l# h7 A( T# v) o. }7 l6 f- O
   push  0000004fh         ; function 4fh
& V5 f. `  {& D$ h   push  002a002ah         ; high word specifies which VxD (VWIN32)
; s5 H1 j. d8 w0 ]3 `* j                           ; low word specifies which service2 w0 n2 m4 A1 X5 F* N  [( ^
                             (VWIN32_Int41Dispatch)- }+ W6 z9 L- X- _0 k
   call  Kernel32!ORD_001  ; VxdCall
: s$ p: @5 [5 {8 f. u" y/ ?   cmp   ax, 0f386h        ; magic number returned by system debuggers7 c; I; o( x, W  g: y3 G! q1 ?! Z
   jz    SoftICE_detected- B9 G$ J* y, C; S  q

: ^% j  K- ?) Z$ c% n- p( ?& x; lHere again, several ways to detect it:' J4 r" g0 x) W5 |9 f6 O

+ O' t: [  Z8 M+ v    BPINT 41 if ax==4f: `- l4 g4 v5 i5 A7 t% x* [* l
) H2 ?$ X0 a1 S0 L% N; }, s, u2 v" d
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" {  I% h3 c( s3 x  C; y! V

# l6 K3 X% a4 o( c    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: \% x- @$ B) d2 G6 |3 K
  ^8 C; [: T& ^# B6 C
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, E6 ^2 n7 E6 T! ~! T

$ l& L1 e, q# r) A4 ]( E__________________________________________________________________________
- N( x' \/ P! [& m+ I; u
6 _, T, u- K- R# q$ a. ^( S( TMethod 13( j5 {8 @' a1 w0 S$ G3 ?! |
=========0 ^$ `2 V2 h; r+ C& ~  @
+ p3 i; s0 `* [; j1 G' z/ I
Not a real method of detection, but a good way to know if SoftICE is
: @$ d1 s2 n4 Q! Z( x/ Tinstalled on a computer and to locate its installation directory.
( ]" d. X+ n9 ~5 |$ kIt is used by few softs which access the following registry keys (usually #2) :. T* `% j& F2 T5 y0 z
7 J; W. g4 ^$ [1 z* k- Z. G
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- G; N$ V" T3 b! l
\Uninstall\SoftICE. k1 X' a4 \: e" X* x$ @- h
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  h! z. t; r7 _/ z" g2 a& R
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! @9 k3 U; I( C
\App Paths\Loader32.Exe5 r; U  ?7 o/ Q( k

! m6 v4 v& l/ B. H1 y, D3 L5 P. ~, g/ H! v
Note that some nasty apps could then erase all files from SoftICE directory
9 q! S( I! ^; H! H' }- m8 H( Q(I faced that once :-(/ \3 y9 V  _+ d1 ?4 X$ _# [

" M4 M$ j( g; ~* p; [3 KUseful breakpoint to detect it:) s8 n; f( Q5 g$ H$ p# W" c

5 i+ D. [8 P: G8 {1 u     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* e# u0 D; H$ C& [. i; ]/ t

) T' `9 X$ e% }__________________________________________________________________________
3 J  A! N1 l, T$ E/ T1 n
: F* A9 u; a8 J$ J2 \* d6 ?( X6 T  [- x) j  r
Method 14 / k5 L$ k; ~- ~( H: R: M7 I
=========
- b' w& p6 s0 J' C! X) O% j8 k2 B; P, l# z- {
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 W/ x- f( A9 i- _6 h' b4 ]7 kis to determines whether a debugger is running on your system (ring0 only).
  ~) B' D4 c9 ^/ U" D+ x9 Q* Y2 d1 o+ o. o
   VMMCall Test_Debug_Installed
/ G* g$ ]6 R+ v# {   je      not_installed: m; a- C. F& _, l: J
3 b, i: V4 B! j- J$ t/ {( j
This service just checks a flag.
# i, D+ p& {  X: r</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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