About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 b3 H9 w) K6 F" o
<TBODY>
8 F: R3 k( r0 l; v' K<TR>
# s) w2 \0 A% @0 O- X  M( N' f6 [<TD><PRE>Method 01
( R4 R' U; D$ ~& ?=========
# `& i; n2 V/ \& a# L# ^. D8 Q/ z' u4 `6 [: R4 B8 m
This method of detection of SoftICE (as well as the following one) is7 W, G2 ]% T& ~* R  G) v
used by the majority of packers/encryptors found on Internet./ o; x" Y, Z* }
It seeks the signature of BoundsChecker in SoftICE
- y3 a$ R1 V2 E/ a+ j' ^' ^4 _  }; o6 X3 s; i2 `9 l: ~
    mov     ebp, 04243484Bh        ; 'BCHK'
9 ~2 f# I5 S. a+ ^1 f/ v# O; I    mov     ax, 04h
- R+ [1 q, ]0 }    int     3       & [& e) X+ X, d' H+ I8 Q
    cmp     al,4
3 s; p1 |* J% @! p4 T* n    jnz     SoftICE_Detected
8 u4 y6 Q7 B, E% F/ v8 A& n$ j. p# e8 i5 E0 ~% _; ?
___________________________________________________________________________
) w$ o9 ~8 J. j' Y& K! }
' ^, f( s9 P9 f- s$ ^- {: ~Method 02
% J% e& I) b+ t. L( X  }=========
6 R) s6 H5 R1 u9 |& n9 J0 V& X+ L+ d) ?5 ~
Still a method very much used (perhaps the most frequent one).  It is used8 A, n" m+ J; C" p9 R% y( N$ t
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 W2 p) [# t% `7 u1 j0 f7 Dor execute SoftICE commands...
( s" P# C, z: j5 j' ?9 K0 w$ wIt is also used to crash SoftICE and to force it to execute any commands7 f- _  ?1 k! B# r
(HBOOT...) :-((  - V$ n# {+ n& O. t3 D. W" v
) `  j( W2 H' L* u- e; @
Here is a quick description:, y9 m& m# z& Q6 Y
-AX = 0910h   (Display string in SIce windows)5 q4 p' Q( U+ U( e  _
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* c" e/ U3 M: ]3 \1 |1 a2 F& x-AX = 0912h   (Get breakpoint infos)) l: o0 Y: s1 ?" L3 Z
-AX = 0913h   (Set Sice breakpoints)
7 }2 B; Q2 o5 X9 l2 o& p) F9 I-AX = 0914h   (Remove SIce breakoints)5 o8 w+ S3 t0 g/ k

, p2 f& s- [7 E9 @9 ~( a. R' iEach time you'll meet this trick, you'll see:& i: n* y1 @2 a1 Y$ c4 Z
-SI = 4647h; C! ~1 ?6 K% d) M; t$ E$ ^
-DI = 4A4Dh. N* b9 |2 [, [
Which are the 'magic values' used by SoftIce.
3 ~1 i: Y2 ^% E( Z5 s& h4 kFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.( k7 b# K# E6 A( ?& ?  M7 W
( E8 U7 `6 G* J4 D1 q
Here is one example from the file "Haspinst.exe" which is the dongle HASP3 h+ ~6 P2 A! P. v3 H
Envelope utility use to protect DOS applications:" N+ [" P# h$ C4 G4 B- c, N( Y0 I

' j+ d) K2 t: {1 e! E
" l$ J( @  O& J# C4C19:0095   MOV    AX,0911  ; execute command.  o; F% J: {7 L$ g3 g
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. s% m! u$ {) j8 d3 a. y! d4C19:009A   MOV    SI,4647  ; 1st magic value., s  ]: Y% V% v, w
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
/ w7 r& |6 i! f# j" ?6 ?5 J4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
. R! A4 [# l8 h  o6 a4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# `4 w7 `4 r# A/ P4 J+ |3 Q5 _
4C19:00A4   INC    CX
! a' X8 Q! w9 T% q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
/ k, v0 N- \# v7 k( u4C19:00A8   JB     0095     ; 6 different commands.) V9 k+ C) d5 O, }: L
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.! T* }7 ^; ]! z  K
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
) g. @  }* X  _, |. L: ^3 O& I6 g
The program will execute 6 different SIce commands located at ds:dx, which
( I6 d* u5 J0 l: x, T0 K' p* fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, u. i9 @/ g& t5 |. K% S+ I& n) k" c; Z" ~3 I0 D
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% I  {, y! q. Q% x___________________________________________________________________________
& r' f; N% g6 t
3 {; a8 b) X6 R9 K6 H. F; z7 p# ?! d2 Z$ k
Method 03, b5 N% C# F/ g, S
=========$ _# |9 S2 D3 C: C- s
9 ?$ X, w1 n3 n, W  V; B
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 x( S1 q, k3 L  ]2 ?0 _  F1 O  _
(API Get entry point)5 T& |2 R8 `5 T
        : }. m+ E6 E  U% T0 t
, _- t( i# g8 L0 m& ?0 \
    xor     di,di
9 p: j7 ~3 C9 c4 L. D% E, }    mov     es,di" {$ {" H/ A' v7 m! `
    mov     ax, 1684h       5 b3 y% x+ R& S, b/ G9 F% S
    mov     bx, 0202h       ; VxD ID of winice
+ o% A6 J/ k4 A: w    int     2Fh$ Q/ j  ]8 j( \  e& N7 n9 K8 `# I' d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# Q5 {3 ~+ z% f* N3 f: e
    add     ax, di
5 q( U" I3 g+ ^( \    test    ax,ax
, |% g' \" C2 f7 K+ H- l  B1 D    jnz     SoftICE_Detected
! h0 t! K: q) \/ D+ A3 _- f) u; ?$ G7 j" N& t$ s% n9 R) q- Z
___________________________________________________________________________
8 m  T; _) {4 ]! D4 R% G
" n: Z- ?1 B% Y/ r+ p9 c; k; B9 K: _Method 04) K! V5 u6 w* Y
=========( x7 k- v( a4 q
5 _! }: `/ S4 Y
Method identical to the preceding one except that it seeks the ID of SoftICE& j, ~: {3 ~* H. x' |8 s1 \& i
GFX VxD.4 T" t0 x. i0 D, u8 t" [* |
' D- `' H! d/ f' e
    xor     di,di# P/ @; L; z% `* p
    mov     es,di: y7 Q! q  B1 s  e
    mov     ax, 1684h      
3 U" M9 a2 F) C0 c0 W' ?    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 S" x+ q& {; J0 F( D! ]1 H    int     2fh! H9 t- E+ r4 F3 j" w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" O) @6 F' A/ V! a6 t. ^3 ~" n
    add     ax, di, V/ L% S! g, @: z
    test    ax,ax
3 {! v# `; A/ T, r    jnz     SoftICE_Detected
6 G; w5 J/ R3 O( l* t% a' W/ B; P+ K
6 e8 V7 }) N2 P6 S0 j' j' ?__________________________________________________________________________
6 K: I. I, }/ p. U1 o* d. A
) a3 |: d$ _: r) J: y2 H3 {
  I/ K: N$ E4 A: XMethod 055 S. z6 }, G' z( E2 l2 B
=========
9 B6 m* O( ~$ J9 J
& w5 r; i. f: d8 n4 IMethod seeking the 'magic number' 0F386h returned (in ax) by all system3 T( n) q( z; g; d( F# K* M3 z4 Q
debugger. It calls the int 41h, function 4Fh.3 P7 z/ J- _+ Y7 ~8 U0 U
There are several alternatives.  + t7 q2 [6 S; |/ R3 ~
4 z& Z4 F$ o8 N; p% D6 J
The following one is the simplest:1 U" U9 Z7 B& u4 {. Y. r
# X/ z& Q( `- {1 p
    mov     ax,4fh. K! L. R" O# U. k; z. n, u
    int     41h: Q# _3 f$ f% e  i( K
    cmp     ax, 0F386
, m( L. Q. Y- r% H4 f; }    jz      SoftICE_detected
, j* v" M1 p5 V$ I8 Q
. x5 w0 m, u8 R. \% ?( i4 c0 ]8 Q* P! B6 A
Next method as well as the following one are 2 examples from Stone's ' `4 f% Z  l- w% |, O) I
"stn-wid.zip" (www.cracking.net):
4 G1 ~2 D$ e7 q# I
4 x8 u/ D( k- h$ Q3 M5 E    mov     bx, cs
/ U8 P0 A% y0 \# `+ v' ~    lea     dx, int41handler20 o. f  a$ ^5 E2 N9 d8 I3 G5 a
    xchg    dx, es:[41h*4]1 i. m/ K) y3 B2 C! ]
    xchg    bx, es:[41h*4+2]$ C8 I0 H" |! G1 A) B4 U9 K. ~
    mov     ax,4fh. \) ^" n# U/ h* L! Q" i. o2 r4 Z
    int     41h
0 ?' d: ~6 N& k9 W1 e5 g    xchg    dx, es:[41h*4]
) w  k" J1 A! r5 h    xchg    bx, es:[41h*4+2]0 D8 [% y: x! s0 f/ d
    cmp     ax, 0f386h
: ~  e" j1 j; p* U    jz      SoftICE_detected
% |3 O( D+ A' y- q
& ?" `" R2 |5 v" X) Aint41handler2 PROC4 E8 x# Z  |, f: P1 d
    iret
1 u; K% R9 u; P" Q6 Z& |int41handler2 ENDP
) _6 j; d$ _/ s7 V
: m2 G2 n6 [2 f
# x1 \$ |7 `5 f! ^2 l$ v6 Q- n' q( X# I_________________________________________________________________________
& R5 w' B2 I0 C- R
7 d8 U: Z) E) ^3 j3 N0 c% B
1 ]5 x: s( x9 f& U4 I: Y% ~; ?Method 06+ M7 {( F! [9 M* O$ n0 o
=========1 B4 O7 e! O: B

) s% k' U+ Y, ^& x# y
1 x% V: l7 W( b2 c7 b# Y) W2nd method similar to the preceding one but more difficult to detect:/ y. l+ a7 D- v( _. z& M7 n
& T. ]6 A' ^5 H  J* ]

: y) {; W& _; t+ C/ t( Oint41handler PROC' O+ j- e$ J; K, R3 E
    mov     cl,al( [; P/ _7 h/ f" O( e) ~6 x
    iret7 O0 G/ f4 F4 a9 i8 s! }: R
int41handler ENDP
# Y# ?1 ]& [1 I- q( d7 e& J
+ r% t3 o1 ?3 N# {4 }0 d7 W2 q) S% x2 f5 S9 ?3 S
    xor     ax,ax# k: A- C' ~7 ~0 j& `
    mov     es,ax- ^( [1 s, \2 x9 C# y# @
    mov     bx, cs
5 [% j( h1 K" _5 p0 n    lea     dx, int41handler# m- Z3 F; b6 J* A
    xchg    dx, es:[41h*4]
; A+ E5 l* D9 Q' f    xchg    bx, es:[41h*4+2]
& `' B0 L) t. C! {1 h    in      al, 40h. ]4 D6 Y( y1 u$ X4 N& m' o
    xor     cx,cx
( f( r4 j7 q% {    int     41h
* C/ X9 f0 T; D! ^* \    xchg    dx, es:[41h*4]" T4 z4 c- ?% k* {# ^% s/ t/ y5 Y, O
    xchg    bx, es:[41h*4+2]! B8 _: Z/ Q" {6 e
    cmp     cl,al
( _: W. ^! ^: @2 R    jnz     SoftICE_detected! L( i. d# J' F; S, [8 Z, _

6 f& @6 t. A* k$ F1 H0 a+ Z4 K_________________________________________________________________________
! @( x% M5 T9 k9 }( R& ^, Q5 ~2 r. i8 ^. X& T( `5 J
Method 07
/ b: n: v& T! N0 o' V5 B0 S=========
) Y0 ~9 _! J% v" T: G
' T/ m2 E/ c9 f6 b6 FMethod of detection of the WinICE handler in the int68h (V86)
4 f! M3 F$ U' {2 L
$ H& z" }& u/ _) ?% ^$ K    mov     ah,43h7 y4 i! E- I! g! W/ u# E
    int     68h+ t2 s! S0 ^, X
    cmp     ax,0F386h
: E1 e1 c! A" N  R    jz      SoftICE_Detected
* C: \! P8 A& G. F5 Y+ i3 m' Z' ^1 |( D( O* t0 X
& h: M5 x& r0 W$ `$ D2 T& W& _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, \- g" F( D- F8 _
   app like this:* q* }2 B1 u" m1 I) L1 p3 z2 h
6 T6 v$ Y: h+ Z; |
   BPX exec_int if ax==68
! i& X" w0 o6 p$ s" H   (function called is located at byte ptr [ebp+1Dh] and client eip is. R- C, W! x: i/ ?* w! w$ k3 h- N
   located at [ebp+48h] for 32Bit apps)( f6 z: c% k1 ^, {6 ~0 k0 d
__________________________________________________________________________  N2 S: |" ], O' v1 M/ O
+ T/ y1 H6 e5 \- H8 z: W

& w; Z8 p$ v: o7 [. U- {Method 088 H. J- A) R! m) r, F  f
=========
3 J# M  Q) g' ~6 H2 {- ?
6 n( q  X3 q8 R& L/ B: X  i; EIt is not a method of detection of SoftICE but a possibility to crash the6 d; K1 S1 g+ y: H1 n
system by intercepting int 01h and int 03h and redirecting them to another
- \2 ?4 s& d- }% y4 Y# droutine.
5 ?  c, G9 @6 S: L9 S6 cIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ ]8 r( h) o* k. L& Bto the new routine to execute (hangs computer...)- Q% E7 K3 i( m5 Z* U  K; k0 B
/ I7 y! N8 b  }: ]. P: c0 E
    mov     ah, 25h) v, h5 T9 n. Y, @  y' a, [7 W
    mov     al, Int_Number (01h or 03h)
: m0 ^' _* y% q) F. ]6 ^    mov     dx, offset New_Int_Routine- @$ [2 Z7 t2 e3 P. P
    int     21h
* N' r6 S0 O; A; `. u$ \+ e( c3 L. `; F% o! e
__________________________________________________________________________
& K2 w5 a+ d% ?. ]" {# m
, ?. y( p# }* @/ UMethod 09$ J8 i; m6 Q& Y
=========
' G* S  H$ k* @+ K- N: ?" Y
# L, o  K) H. yThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ ?% [1 ^* [& k; O$ vperformed in ring0 (VxD or a ring3 app using the VxdCall).9 D9 h# L8 _7 c5 g+ D1 L( g
The Get_DDB service is used to determine whether or not a VxD is installed' t! x: x: V" d$ A$ W' ^
for the specified device and returns a Device Description Block (in ecx) for
! {. I- P" Q$ ^0 \that device if it is installed." P# t  k+ l+ ]" N/ _% f# c! y

8 Q: ?' z- r4 m- W$ {   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 V8 e. U8 w3 Z# Q$ V+ p, x   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( a+ W6 H& P/ i   VMMCall Get_DDB) t* `( ~1 X' b' ^& ~# g( J4 H
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  y' Q, i# |, D. D
7 k2 a0 Z2 f" ^7 T! y+ c! r5 @( o* ?Note as well that you can easily detect this method with SoftICE:7 ?9 Y6 _/ w1 F: D0 ^; j
   bpx Get_DDB if ax==0202 || ax==7a5fh3 l# i' X" k- j) h# J4 l3 K, p

' e# C+ B, t' j  @: m) O) z. I__________________________________________________________________________
7 a/ {) }7 s: U% }' |( N; E" h9 s9 l
Method 100 K8 l* }+ @) ]
=========* [1 R! J" _  @& t/ r

/ T  M) x6 l: N: R6 X=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 E3 K% G8 ^: X  v0 R( t" T; l
  SoftICE while the option is enable!!* m, F0 W. G6 a, \
+ B; M3 p$ q/ u9 v( Z2 E
This trick is very efficient:) ?8 g, p6 t9 A  u
by checking the Debug Registers, you can detect if SoftICE is loaded
0 x9 z1 u0 c6 m8 F# s+ C( y(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 {, X& G% A# M& V9 qthere are some memory breakpoints set (dr0 to dr3) simply by reading their; m3 X, ^6 G3 D5 e& {7 O
value (in ring0 only). Values can be manipulated and or changed as well
' C7 G! Q8 u0 N6 W) W  O(clearing BPMs for instance)
9 ]$ t8 ]' y  f6 [% P4 {  _$ e3 Q3 U. g: ^
__________________________________________________________________________
6 _0 ~( [, g; D
/ M( t" J4 q% mMethod 11
8 ]6 \# `- q; J+ C=========! o3 c' v% O6 `, g& a
1 ]( h3 }. V5 I* J/ C; [
This method is most known as 'MeltICE' because it has been freely distributed
' O# T7 i; Z6 e; C5 ?via www.winfiles.com. However it was first used by NuMega people to allow
; f4 @5 Z% O: s# p2 n0 C/ R0 X" GSymbol Loader to check if SoftICE was active or not (the code is located
$ D/ c+ g  [) D1 Linside nmtrans.dll).
9 i! {4 X% ^3 ]+ g; j- w3 r
3 W- ]; V: X4 U% e( O! N' s6 a' _The way it works is very simple:
, y! b% Y- h/ r/ eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
  D0 E7 P& U, ZWinNT) with the CreateFileA API.
; {6 C! i& g* d5 }: K+ E4 x: o" t. p
Here is a sample (checking for 'SICE'):* }1 r# X, I- y& O

* g8 r* u) k5 S7 b8 Y' x5 {$ T5 OBOOL IsSoftIce95Loaded()
* Q% a) X) J! n{7 J. e) T- w% }! Z+ _. Q5 M5 ?5 o6 H* d
   HANDLE hFile;  
+ [/ E5 H* c. q; {3 J1 A& T   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ H- P: p- m$ R8 `
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' Y9 R1 V& t5 v) _2 I* Y                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( ?0 o" V9 c4 r' q: ~   if( hFile != INVALID_HANDLE_VALUE ); N# q6 q0 {/ U% n
   {
  K' L; p  U0 ]! `# q% F3 a- _      CloseHandle(hFile);
/ l: S# ^1 S, y+ S; Q3 i& k      return TRUE;
+ E( v! |; G1 ]& m3 E3 d   }
9 z7 {$ {7 O; R2 ]1 x   return FALSE;
3 j+ B) }: F9 ^6 w4 o, X; c}( c: b0 l8 {+ D
5 d0 F8 U2 r: n9 ]8 y+ E' O# R
Although this trick calls the CreateFileA function, don't even expect to be
# t5 b7 q- C0 i5 j3 Q2 u3 `  aable to intercept it by installing a IFS hook: it will not work, no way!  p1 s5 {6 e! q2 p1 p9 c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F) u. T* P( t( X2 Z, V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 A9 q- f! @4 h# g* i% \9 Q+ E9 H
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 p* Y; J- e# Mfield.
: V9 S  E7 Q& a3 _# a5 QIn fact, its purpose is not to load/unload VxDs but only to send a
; A2 w. T' Y' M3 m$ v9 O7 L' ]+ CW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  l4 l0 o; g* j$ T' ?8 y
to the VxD Control_Dispatch proc (how the hell a shareware soft could try( L- _/ ]  M( g1 s+ a
to load/unload a non-dynamically loadable driver such as SoftICE ;-).; _8 B+ w7 h6 `0 ~1 {
If the VxD is loaded, it will always clear eax and the Carry flag to allow
- v, V7 w+ V1 Z* L3 [$ j4 }+ ?its handle to be opened and then, will be detected.
8 ]& f2 G$ M2 {1 U+ \& cYou can check that simply by hooking Winice.exe control proc entry point
8 r2 w1 u3 p( z4 p, Ywhile running MeltICE.
& T, [) Q5 a: A+ J
2 d* i! [* a6 T! k) Y& Q" }7 ]" \, W
  00401067:  push      00402025    ; \\.\SICE
: p* k1 v) j; ~$ ?. ^- h  0040106C:  call      CreateFileA
/ W/ _& L* p% t; G) y2 z9 u2 Q  00401071:  cmp       eax,-001
- p* Q# r+ X- W, b! |/ d& L  00401074:  je        00401091
$ T, ]7 [0 y! g# I3 m$ q: z; r, U% Q

# u4 }6 M6 H# z9 z" z7 {There could be hundreds of BPX you could use to detect this trick.. e4 f( N- x) u$ x0 c8 k% r
-The most classical one is:) K/ H- k$ K* T
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 V' C+ ?/ ]; \) E+ A) p6 W5 ]    *(esp-&gt;4+4)=='NTIC'
2 K6 U/ e( ]% C3 J  [! `) ~
1 r0 @( Z2 t+ q# }1 w-The most exotic ones (could be very slooooow :-(
/ h: i3 r1 y+ A; C% k! N   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  7 [; [4 x' N6 m- L& v# m+ A! {) _* v- R- \) t
     ;will break 3 times :-(
/ D2 c: H# Q# ?3 @+ G' y' _" ]+ a$ \$ `# Q2 n0 A# _% K
-or (a bit) faster: ) ]" `! |0 T2 y) `% W' r/ b. v& [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 P+ M0 C2 _7 r& _; T" ]# D
8 k- k2 S0 a0 F2 ^9 f9 }1 T5 r
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
2 Q4 P& R8 k) \     ;will break 3 times :-(" b. R" {) N3 ^% R3 Y  n$ G6 `

0 q3 {/ v) \) T$ _: i-Much faster:+ |7 C" ~+ x1 x0 N
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 O% o. G7 _* P4 m

( {$ e  w( b$ N2 ANote also that some programs (like AZPR3.00) use de old 16-bit _lopen& Z. n0 u8 A. |
function to do the same job:# f, \9 |7 H/ U5 `. S7 l

* N# r2 d1 V9 m' b0 I" W   push    00                        ; OF_READ
1 ?. N- i. [$ y: _8 H   mov     eax,[00656634]            ; '\\.\SICE',0
" U, [" A* [$ W1 O4 r$ h# q   push    eax# V0 Q; p7 I8 h8 b6 n3 D
   call    KERNEL32!_lopen
3 i1 b4 A$ o# L4 ~3 |) U& i/ l$ c   inc     eax
& P% e% @9 T( W6 k  X   jnz     00650589                  ; detected# t5 z4 T6 W7 W! p$ G
   push    00                        ; OF_READ
. e7 H5 o3 G7 n: ?' ]" v* \   mov     eax,[00656638]            ; '\\.\SICE'! z- q# x" A+ U: I& U
   push    eax2 X+ ?. R& t& h0 Z1 B
   call    KERNEL32!_lopen
0 S9 V$ ]! M% y   inc     eax
3 ^4 }- H) B% U+ p9 p( o   jz      006505ae                  ; not detected
- q$ X9 R" ]/ M# K
& G- a8 j' ?. Y
  _: S% s/ {  ?5 Q__________________________________________________________________________
- ]" }2 s2 U& \# F8 ~( k6 y4 @! V& ?3 r1 s- k  j; {! L
Method 12
4 V6 {+ N5 R2 `=========( _" @  N  ?+ u( n+ U7 I
8 z9 E2 n2 z9 U  a+ j
This trick is similar to int41h/4fh Debugger installation check (code 05
# u& u$ r, m8 E1 ]: }2 S0 I&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 \. T4 G% [1 f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& z( @8 W+ l2 O& y. |! y9 `8 p$ I% G! |4 `3 C$ G) |7 i1 }8 {
   push  0000004fh         ; function 4fh
, g6 i+ a. R" K3 Z   push  002a002ah         ; high word specifies which VxD (VWIN32)
9 `5 J% T- k0 @6 F                           ; low word specifies which service
: E* r+ e% L7 E4 B% N3 D                             (VWIN32_Int41Dispatch); o+ w- M9 K; F2 l1 F0 [
   call  Kernel32!ORD_001  ; VxdCall4 G- e9 {6 {$ ^% T8 x- h% {
   cmp   ax, 0f386h        ; magic number returned by system debuggers
* u) j1 g5 a1 @/ A) W# a% P  h6 h2 C   jz    SoftICE_detected0 b: ]9 ~7 A% C3 v. I6 s" c

  @5 k! k2 r, K2 H+ p( KHere again, several ways to detect it:
$ d6 C9 n7 v2 Z$ l, f5 o$ ~( @1 D/ y4 c
    BPINT 41 if ax==4f+ h" @8 M$ Y" E' \+ I
8 n: T6 ]- `" a( R4 G" D5 x
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 p" m# H- r+ D2 X

( _9 B' j+ V0 \* o* U/ m    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 A# }% S3 e6 L. f, i+ H4 ^, C  p9 ]9 d
9 `5 ~& A# J7 Y0 M# G8 V  p    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 b2 ]6 B# \( E9 Q( `; R/ t( H4 h

8 Q" c/ @1 x+ ~# D$ B+ N: C: s; u__________________________________________________________________________
# p2 ?, W0 b' _4 u; z" K: I) p; d4 T( j9 a. }' T0 z
Method 13% [: p" q' B/ V% E) ]6 t
=========
" X- Q* D# M8 x3 K+ D. h3 @
) o3 z2 x7 q2 N& J% L4 [Not a real method of detection, but a good way to know if SoftICE is
6 p$ X, I' R8 ~3 Z0 @; b* F4 }installed on a computer and to locate its installation directory.
! l1 P/ R  k$ Y6 z: VIt is used by few softs which access the following registry keys (usually #2) :/ G% M( a& `" M
' U. D1 c7 n8 f" \0 `
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 G2 s1 L; N+ K7 n) {$ ]\Uninstall\SoftICE0 S& ^: \! X6 r* e; n/ w# A
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ q" M; Z$ s0 T! w/ @-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, O5 Y3 w, j) ]$ o$ }5 k\App Paths\Loader32.Exe
- X1 v+ }7 V' r6 |/ K
5 c3 G1 J" B4 h
( o9 g- W0 l( J/ o. w% eNote that some nasty apps could then erase all files from SoftICE directory! ]' b9 |; Q) _# d) A1 c
(I faced that once :-(7 x8 J9 h5 b) y- [2 M/ h% i
) q9 t( _- c; J  p4 c9 M
Useful breakpoint to detect it:4 d% z" U# h( Q, e5 b2 K

9 f9 v) A7 S# M1 G  \2 t1 q+ N     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" ~6 u( j" X7 D! f' n' \# F3 J9 ?! m& g' T& T
__________________________________________________________________________
) f/ P: j! \( I  y7 a# x3 W: ~4 J- K4 v+ s6 p

" X" U# b" Q% D1 [6 x% f) WMethod 14
0 y+ M2 n$ s- C$ v, Y6 Z=========" m8 t( ^$ d4 D" E/ D( B- G/ Q( B
& Q2 }1 m% ~- y2 V8 g
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose; Y: r: _/ W/ P1 A
is to determines whether a debugger is running on your system (ring0 only).
  x+ X- J# B; m$ g  o1 J8 V6 b: V0 x8 O  Q5 m9 G; v& \
   VMMCall Test_Debug_Installed+ R3 l7 Z5 a, k$ L& B
   je      not_installed3 J8 R5 T# n3 \& ]
# k- L- g5 K$ E0 K% ~7 ~+ i( `
This service just checks a flag.
% O8 r5 N. u. N- s& g& S* Q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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