About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" c& Q9 \8 e# V, y2 M7 m
<TBODY>5 p# T' X7 I; c% X* n  G: R
<TR>7 |# m0 t! Q1 V8 ~( B2 ^
<TD><PRE>Method 01 / d$ U8 r6 g7 W" y* p1 D
=========* F' R& J* f4 B$ ?% G8 z

) ~$ y  n+ t8 ?' H, D( T* `This method of detection of SoftICE (as well as the following one) is
% v$ M9 x7 ?; M9 \used by the majority of packers/encryptors found on Internet.- m( Q1 h/ z7 r% F( _, g
It seeks the signature of BoundsChecker in SoftICE) s) l# Y& D% D& W6 I
7 Q" V" }$ L, X$ K) O9 U8 e
    mov     ebp, 04243484Bh        ; 'BCHK'
! S. E$ C5 j. {$ G( h3 v    mov     ax, 04h
! Q8 F( o+ Z0 i+ X- E. t. d    int     3       % t% x% a% g5 S; D% @5 `+ a7 w
    cmp     al,4
2 E$ u7 ?0 M% m' t' r- v    jnz     SoftICE_Detected8 y8 L7 D/ G  k4 q/ Z; C
( w. ]! f& F5 y2 ]+ h9 G
___________________________________________________________________________. W6 ?0 h. F* o" }: J6 n6 M
  c! p2 I2 b1 [0 l; x: ]4 Q
Method 02! I+ H: F2 u  l* ^/ k$ i; m$ |
=========
. Q7 E  p4 i7 G+ T" _
# z; y+ |3 K4 X4 Z. U& G8 \% ~, ^Still a method very much used (perhaps the most frequent one).  It is used
  Z4 a$ f) Z+ `3 t  u) }to get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 ^# C& f2 K2 w* U
or execute SoftICE commands...# t; _2 F3 o# w& U! @
It is also used to crash SoftICE and to force it to execute any commands
' [/ J+ s" r5 [! H(HBOOT...) :-((  
( x; B: o4 w& U- ^$ q" ?/ }/ [( F5 w' }) w6 z
Here is a quick description:: R& ]: C& p! N- @" {
-AX = 0910h   (Display string in SIce windows)5 Y. w7 ~! m) r" v" N2 m8 L. A
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 F6 I* r3 Z; [: {
-AX = 0912h   (Get breakpoint infos)
2 h2 d% o, u# m( O# d: }8 ~-AX = 0913h   (Set Sice breakpoints)
3 V  k1 A8 ~! j/ r+ Y( _* G7 m& `3 i-AX = 0914h   (Remove SIce breakoints)
) P: T/ s% \4 b  m6 z3 [, P+ e& _* U' G2 ~$ n1 S
Each time you'll meet this trick, you'll see:4 |1 B# V. q  b+ [0 N. E; q4 g, |
-SI = 4647h1 R' L# x$ ?8 e* c
-DI = 4A4Dh9 J/ ^8 Y1 n8 {8 b( L
Which are the 'magic values' used by SoftIce.9 F. N* Z; ^' x; y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h./ C, A, a7 M% ?( l' V

* E8 S2 Z3 C, e7 IHere is one example from the file "Haspinst.exe" which is the dongle HASP- _4 |0 ~2 t" M( d! P; d3 c
Envelope utility use to protect DOS applications:
' N7 s2 ?- o1 v% g( N* \. w) m# w" l' f3 S2 E2 S

& v% `* N2 G4 w7 m4C19:0095   MOV    AX,0911  ; execute command.4 s5 i' R, U4 U8 k
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ g0 _  ^& _" D& X5 n& p3 M. ^
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 {% J, m( V2 v8 s  K+ ^5 k4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 c" L0 T: m+ O. ?6 [$ t! |7 Q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! J% b. E2 u2 _/ z% P- Q4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute2 A9 i( ^  M+ G& o8 @+ i. G; I
4C19:00A4   INC    CX! s- Q7 j# c9 C6 e$ ?
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 }, X! Y4 i" C5 |
4C19:00A8   JB     0095     ; 6 different commands.' W8 D$ H8 \: O9 s8 o5 ]' G, {. @
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; R" c2 z# T* w$ Y/ [4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 b. m* G: }& G. t, ?* `
7 m7 V" w9 x* o; qThe program will execute 6 different SIce commands located at ds:dx, which# S1 Y* {& t( c' e
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# O# w% R8 P: g
( n5 x+ D% Y& U3 A* z* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.4 O8 k6 Y* R0 G% o# e
___________________________________________________________________________
) d, Y/ Z$ A) J) e: E% z1 c
7 g3 {7 }9 ]8 m+ C6 C2 Q6 V0 a+ {1 P. a, W" [* g' \& U$ k
Method 034 J3 I) k4 Z2 K2 ]; ^
=========
0 T* l9 _" s, r3 d6 J9 j, Y0 v3 b! I6 ]; f2 D. Q; {5 v1 a
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  U  ]" j4 y( M7 n/ C- ~(API Get entry point)" @- T/ I2 v1 E5 Y3 N7 b. u
        
4 |+ E9 r" n, v* r/ G( n. {. y4 N2 ?. }
    xor     di,di
9 A5 G' _- k8 d9 @5 m% H9 l    mov     es,di& A7 W2 t/ c0 i0 D
    mov     ax, 1684h       , c1 q/ q' u1 B, z  g8 X( x0 }
    mov     bx, 0202h       ; VxD ID of winice
, W/ S+ t& h3 y; y    int     2Fh
( {/ J$ U( I6 |- m# n    mov     ax, es          ; ES:DI -&gt; VxD API entry point. |; r3 A( S! ~7 r
    add     ax, di
4 V! b4 `. _" {# ^    test    ax,ax
" @9 N  Z8 M# K; A    jnz     SoftICE_Detected
* N; [3 t0 ?: e. h3 P4 @# b- U7 G5 B4 b& U
___________________________________________________________________________
3 \+ E1 I" B/ u. L
% J3 I0 d3 L$ yMethod 04* w4 G1 E1 _5 Q- r; @1 o* k$ Y# _8 h
=========& N" U3 k. b" h& }: S
" c9 b/ ?2 j& X
Method identical to the preceding one except that it seeks the ID of SoftICE
; Y& j- P* U' ~9 h$ m# l" HGFX VxD.
3 e( D! O5 e! z( d3 I$ z
, p3 {- M( F: `2 J6 U  [& U& _    xor     di,di5 L% {, D# W% o6 ^
    mov     es,di; K8 N) }# B9 U
    mov     ax, 1684h      
- A% A1 ]% d2 \- Z; F) ~    mov     bx, 7a5Fh       ; VxD ID of SIWVID
' k- b$ u% a8 j+ C1 I    int     2fh) T! v! J; u+ J5 ]8 ~! ^4 p& b' q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ k& Q9 P" Y- e' |0 n+ f( S    add     ax, di
4 }2 H1 [1 T- Q    test    ax,ax
2 f# p# h0 ]6 b7 C# t6 H    jnz     SoftICE_Detected+ ^+ K. _* H0 A$ N3 F% S% V' a

0 G- h" `# |4 M* n$ q0 P5 k__________________________________________________________________________% V& r2 n+ u, I" V8 b( F( ]+ O3 ^
, w* Q- e5 E  |" O( N$ E
/ t8 u5 U; d" Q  o
Method 052 `: _* S! M6 h! J
=========
$ _7 ?# v8 ?9 @* G6 i. P
6 Y0 J' L+ Y+ E/ c& s( Y; r4 Z8 LMethod seeking the 'magic number' 0F386h returned (in ax) by all system
# T  E% n8 V/ d9 odebugger. It calls the int 41h, function 4Fh.6 T- o, s+ _% U+ Z# Y* f9 z9 g4 H# i5 X
There are several alternatives.  7 y) G' q  z$ O7 A+ \/ {6 p

) r7 Z, o- P  W6 s- x7 p9 bThe following one is the simplest:2 ?- p0 x3 N  h& q. y5 I8 y
  ?9 ^4 E: x& k1 f
    mov     ax,4fh
8 X; g+ r& c! v+ b* [( V    int     41h
; J1 x% R7 H; F+ l; j    cmp     ax, 0F386
* X2 q. p0 J1 T- d' ]    jz      SoftICE_detected
! o6 F6 t" [- @9 F( J8 j. s% S/ y" f) M

! N6 U. S' |$ T0 o: BNext method as well as the following one are 2 examples from Stone's 6 N8 S5 O3 s5 P$ `- j* @
"stn-wid.zip" (www.cracking.net):
% w5 U. |9 m/ W9 Y! v
$ J" z* p  E. S' l! r$ G    mov     bx, cs
9 J2 {! f0 X' _# ~3 S: U& z    lea     dx, int41handler2* ~5 R0 F' @+ u& q# L0 d
    xchg    dx, es:[41h*4]' t; @; S! R9 i% ?0 N, c
    xchg    bx, es:[41h*4+2]
4 z' e7 y4 s+ M- c    mov     ax,4fh
9 W! G! D1 Z+ H- z6 Y) \    int     41h
' M6 W5 i9 t6 U! ?; l    xchg    dx, es:[41h*4]. Q* \( _; {2 H3 z
    xchg    bx, es:[41h*4+2]
8 U: q( M: _( ~! R0 t- C    cmp     ax, 0f386h
. \8 r3 }( o5 J! f    jz      SoftICE_detected6 _6 `8 ~2 q7 E

( ?. B# p6 x8 M8 p; k, V1 ]4 E8 _, e) Nint41handler2 PROC
/ e3 Z3 k* n$ p    iret& E4 O1 h+ f  p
int41handler2 ENDP. O: C2 d, s* p

! m1 y  R6 N: E* ?/ w: y0 a
- f# p1 ?6 |" q& L- M5 Q% |& ?# U0 }_________________________________________________________________________6 P. h$ N# n9 }. x. w) |

, @# r% m9 G0 X& A, r) t4 K6 a( k+ N/ `: H. ^! T/ n. Q- x6 T
Method 06) f/ w, l; Y2 {
=========' i( n7 V5 w$ _3 k

: j1 z- q6 z7 `" ]) [; `; |0 w) O5 U5 y2 @0 N( r* {( ~
2nd method similar to the preceding one but more difficult to detect:8 v; A/ s4 w( Z9 k% v0 A2 r( D

6 C% o  b5 @9 T) Y. @# I1 j  q% T0 Y
int41handler PROC7 C5 ~* Q& {* \4 W; V  g
    mov     cl,al  j# h  r- y' ^
    iret3 r# m: j. z( _; P' h' `
int41handler ENDP
& O6 r' y  Z* G' C8 h! {- Q# T" }  ~5 P, R" v" d7 K% s
! B2 S3 ?' {5 @8 d
    xor     ax,ax
& y1 O( p' ?" V0 P    mov     es,ax
& X' \& z# n  B    mov     bx, cs
+ R) n, v1 |8 E; d9 M    lea     dx, int41handler. Y0 {4 d" t. U* N
    xchg    dx, es:[41h*4]* j* f0 O# b# q* U6 V
    xchg    bx, es:[41h*4+2]/ k% y' L" l" `0 k/ T8 o
    in      al, 40h
, b/ q& r  P: f: s1 J: `    xor     cx,cx; a3 o' @& M& _5 `+ T
    int     41h
" K9 p0 S) ?0 n% [8 D& m    xchg    dx, es:[41h*4], o* o$ J- F1 M/ M' Q, ?1 l
    xchg    bx, es:[41h*4+2]- C" ^3 c' M0 N8 \) x3 c
    cmp     cl,al" m) [& e9 Z) N# G0 P; n  `$ T
    jnz     SoftICE_detected
2 z, ]; q9 n( K$ D: D$ m0 }
/ T( B3 C. Z7 p2 U$ t_________________________________________________________________________
  p8 b' J7 m' U/ `* e% C3 h! C- g* l
Method 07% f1 K( p2 R+ w( f( \
=========( E$ I% O0 a& ]+ \2 C( V4 X+ e

. t7 \9 B/ z1 P7 w# \* p2 OMethod of detection of the WinICE handler in the int68h (V86)7 j1 a5 Y$ g2 }! C" U6 U8 e

- m. A% b% r( H5 @    mov     ah,43h* }) G! D1 t' }6 O  ^% l: j! q0 q. R
    int     68h
& R0 ^; a9 W% l6 f& ^- @$ o    cmp     ax,0F386h
1 P# ?; J  x7 c7 c! a! V    jz      SoftICE_Detected
" X5 S4 G4 a, Q2 K4 i3 T2 H  A) V. `) n
  Q) v7 |: b7 W( V6 D4 r" |0 |6 T& q) W) j) u& _' N! l) H& n
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: N8 D* G: l) ^6 X   app like this:
# B; _( ^6 T) {; q2 ^1 o$ b& g: W" g  x- L
   BPX exec_int if ax==68( ~4 K! a+ M7 E$ W
   (function called is located at byte ptr [ebp+1Dh] and client eip is
1 K8 V8 v$ C8 h8 F; e   located at [ebp+48h] for 32Bit apps)
# O9 ^1 ^, [% U__________________________________________________________________________" Z" g6 P! X. O0 v  ^
4 i" H  l3 a7 S2 d; C1 w1 O

/ Y' c% I. S5 m( j' z3 B& e4 PMethod 08$ `; i3 s( Z: m: Y" h8 D' E
=========& c6 q0 [1 W4 n3 {: {: [) }7 S
. w" U' [0 D; }+ |& b* {! w* m
It is not a method of detection of SoftICE but a possibility to crash the& P* B+ Z# y2 w* I* \
system by intercepting int 01h and int 03h and redirecting them to another9 K' s1 R) a1 P' G
routine.9 `& p& T+ e/ I' M" I# L
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) Y5 S- V4 \6 k. j. g) M* Y* ^
to the new routine to execute (hangs computer...)! u- |& ~7 B; x. V
( M6 \6 r) i3 J- W# T: c+ O8 H6 T
    mov     ah, 25h. F& G$ B6 m( t+ _, r+ F
    mov     al, Int_Number (01h or 03h)' p9 r6 S) w3 \# I8 E
    mov     dx, offset New_Int_Routine! }/ x8 s% P% L/ j0 P
    int     21h
- |, L6 v" D- e5 ]& I6 h; f* q. l% H/ ?; S: p8 f6 c
__________________________________________________________________________8 B0 a2 K# Q- A  _  x! r

' R4 a# H# s3 _2 f7 n7 \Method 09
6 w- F; S7 s/ C2 M. a3 w=========2 n2 Q" v/ I# y* |: r5 [& |

5 q0 J4 P; d; y- a3 g' D( ]This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; w4 [* i" @+ p
performed in ring0 (VxD or a ring3 app using the VxdCall)." f) M+ _9 H* x+ V6 @
The Get_DDB service is used to determine whether or not a VxD is installed
4 t0 x. ~' e' u' m9 }for the specified device and returns a Device Description Block (in ecx) for# u! Q/ |4 e5 w* J! P
that device if it is installed.* O' j+ U9 [! c9 B
$ _! V3 J0 m' ^  G" s
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 L! b0 s  b% N6 I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" _8 J& V9 Q) x8 A0 g2 T
   VMMCall Get_DDB
; Q! {$ e; g  b  |* H( R) ~* _; ~   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( |* ]7 _: ^( j; M1 x; b3 ]7 [4 D
Note as well that you can easily detect this method with SoftICE:/ M& B' _; ~( e% y" }9 V
   bpx Get_DDB if ax==0202 || ax==7a5fh
' {1 Q" T1 {9 d4 n8 `/ ]. G$ j' Z
__________________________________________________________________________
( T* k5 _+ X4 {
$ }  z' Q) H  q) i% t- n& GMethod 10
6 p. z0 z7 N8 U( D* f6 i' |=========* B1 J! e  ?: K( k- H

& G) S& h; I+ k$ X% E) K0 ~) A9 w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. K; x. r! d) Y, x& f  SoftICE while the option is enable!!8 r8 Q, l/ W4 [" q( H' m

1 {% |, M. J8 c) q7 d/ m3 F# mThis trick is very efficient:, n! X: A! t6 p
by checking the Debug Registers, you can detect if SoftICE is loaded
* y* R8 {# q6 V7 W4 J; u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
3 I, N# ?8 i# k9 C& D5 p" f) ^there are some memory breakpoints set (dr0 to dr3) simply by reading their; r- Z" j# |8 n3 T1 J
value (in ring0 only). Values can be manipulated and or changed as well
  ?$ V  i% i% K3 _3 Y" D8 H(clearing BPMs for instance)8 Z" J/ X5 T" W7 D. d

6 t. E- j6 x  v/ H__________________________________________________________________________0 |+ O6 B4 _$ c4 L0 r. `4 D
& P0 e  T3 x1 ~$ F; g8 L
Method 11; w: Q7 b+ }, H$ J& K3 B% q' [4 e
=========
7 E0 S7 _/ K, B$ L8 u' J6 O% j% q
This method is most known as 'MeltICE' because it has been freely distributed8 e* r  L! {' t  e! T& ~$ b) x
via www.winfiles.com. However it was first used by NuMega people to allow
; N, Q  i+ p9 A: {2 U* B4 o+ pSymbol Loader to check if SoftICE was active or not (the code is located
0 I9 {, q6 t. T' _inside nmtrans.dll).
; K" K, J% K" c. d7 |
7 g0 o7 |  ?8 m3 W4 U  L/ `3 XThe way it works is very simple:7 H. i( u0 K! Z# _
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 j1 v; B# b/ q& s8 c3 a2 ~1 {  I
WinNT) with the CreateFileA API.$ f# e7 W# [, f
3 w3 p1 V9 Y5 O1 U( S% C8 V
Here is a sample (checking for 'SICE'):  o) D! v' V0 Y3 Y) \$ U; p* c

- O. J4 A4 U' }1 q* K- UBOOL IsSoftIce95Loaded()
- L" p9 y: b; P* a& X{9 V0 N+ I0 a" h4 W$ r
   HANDLE hFile;  
& f5 x5 {6 G& Z( _   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" e! x* Y1 i; h& v                      FILE_SHARE_READ | FILE_SHARE_WRITE,% c* s. g/ A2 R8 n( h6 e1 P# l" `7 s
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, g7 O# e" q+ f2 e/ O
   if( hFile != INVALID_HANDLE_VALUE )
8 @: g& C! H: ]" ?; c, J   {6 V. k+ d6 d" p" s; @0 F' X
      CloseHandle(hFile);7 l+ Z* l$ n3 A6 A. o/ S
      return TRUE;5 s; l4 d# Y- ?
   }$ ]3 r: e+ L3 S: P) J1 m
   return FALSE;  O2 ]5 {6 W1 S+ j
}2 y2 k* d* ^/ H1 S0 z: L8 R4 v4 g

! ^7 v% w) Y/ u, z) j! j, d7 hAlthough this trick calls the CreateFileA function, don't even expect to be
( ~3 x" _- n  e" S  p( ^- Fable to intercept it by installing a IFS hook: it will not work, no way!
! H# V# w0 f2 @" i1 @# B9 ?In fact, after the call to CreateFileA it will get through VWIN32 0x001F  w% ?+ Y" f: Y2 f9 Z. |* m: K
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)! Q4 t) ]- q/ L1 }7 l
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 G" g2 K5 }3 e" i
field.
* u8 f  V8 E1 |& U  i. @7 c, C8 p" EIn fact, its purpose is not to load/unload VxDs but only to send a
& Q+ ]5 A3 K$ tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
9 l2 N( l. M/ y. V+ f2 pto the VxD Control_Dispatch proc (how the hell a shareware soft could try3 @( {; h- X: ]
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 Q* e4 F0 R8 @3 Y8 ?: FIf the VxD is loaded, it will always clear eax and the Carry flag to allow7 Z3 k* W. X$ J) a, n( f! ?/ e
its handle to be opened and then, will be detected.
/ t8 N0 r& Y  p; X# RYou can check that simply by hooking Winice.exe control proc entry point
4 m( _7 K4 a- v: @8 _6 K( ~2 zwhile running MeltICE.# n3 t) x/ L- M" p, a, F$ F2 O  i
8 U5 T" X" Q9 B

# f% c! u9 P7 i) ^% x) a, T9 E  00401067:  push      00402025    ; \\.\SICE0 D# I( y0 U2 G% _2 y7 T
  0040106C:  call      CreateFileA
7 q& ~, ^# Z6 b- Y- G9 [  00401071:  cmp       eax,-001# s* \. w; v9 T% s& E/ H
  00401074:  je        00401091
. k( ^( t, m# u* H  Y" l  b+ E1 v6 [/ B, k6 w  b, F% u8 ]

1 i2 F' e' U/ U! Y9 S- JThere could be hundreds of BPX you could use to detect this trick.
% ?4 Y9 ~- n+ i) Y! k! s-The most classical one is:
, |: r4 o$ _2 C: H( ?" a' e% H  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||# k3 ?% A3 |8 ]. {6 x
    *(esp-&gt;4+4)=='NTIC'$ Z0 o$ w% x" @/ f, R4 V
* k4 ]/ E5 `/ C& r
-The most exotic ones (could be very slooooow :-(  X! v5 Z) h) p+ k6 L1 i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 y* f# ?/ l  ]( O& T7 B
     ;will break 3 times :-() v+ z& K. L* H( x% k& x# i3 E

) Z) P  N+ R  }( F, u1 M-or (a bit) faster:   o" z1 p6 u/ L' o6 w" {4 F: j
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 }  s% D; U* `
) J1 R! J- K, p7 ^* G
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! p* H1 E& h  F4 w, t: E3 T; ~     ;will break 3 times :-(
  l' w- f/ ?7 t3 d/ |. W2 n% g, Z& p, r
-Much faster:
) V6 e3 V4 M! v3 D' e( t   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 `/ x& w; D# D9 {' M

9 |9 e+ W& C1 }7 |0 C" kNote also that some programs (like AZPR3.00) use de old 16-bit _lopen+ b: q+ B5 h2 ^5 p# R+ v! V
function to do the same job:: g* K4 x' K& l& i2 J, V5 Z; s! i) v
5 r8 f: |( a  l+ p! [0 K
   push    00                        ; OF_READ
; W# L7 R7 z/ z5 |. r7 w$ O   mov     eax,[00656634]            ; '\\.\SICE',03 S- H# L7 X/ G* N. [
   push    eax
; k9 A/ ~5 w1 _3 g3 J   call    KERNEL32!_lopen. x8 ]' Y8 K" F6 v% y
   inc     eax
; r& H+ C4 {; z4 e  @! r6 s   jnz     00650589                  ; detected
' s3 o/ y! _: L$ x8 O7 D   push    00                        ; OF_READ
3 O' F& }) T$ ^$ `& W7 ], ?   mov     eax,[00656638]            ; '\\.\SICE'
/ q* ^5 w6 H( F6 \! b+ v   push    eax6 Y9 H0 }" z" q. d1 m: k: ]5 B
   call    KERNEL32!_lopen
9 x. |* g7 @- [( l% a   inc     eax
, }+ f; i: d: V' j- H6 |8 `   jz      006505ae                  ; not detected* p. ^) @* p( s, z* _6 ?% H
& d" S# K' G$ q" M  B8 p7 Q- m& ]

$ z8 s1 a( ?) ]" t, I* F3 S__________________________________________________________________________
& @! A& t! }% r% M- Z+ H/ U2 C1 U+ p. F# l% @
Method 12
* L+ C6 e! w) O: ^=========
$ [$ k$ O& p; C( w- g) m- K+ O) Y1 e# J, I; p
This trick is similar to int41h/4fh Debugger installation check (code 05
7 q  U- [6 e6 j, N) A" w&amp; 06) but very limited because it's only available for Win95/98 (not NT)& ?) b/ X( ?9 |5 P- G+ ^' r
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.) ]) y5 {9 p& w

6 ^+ W& s3 H% z9 S5 N   push  0000004fh         ; function 4fh
8 `5 a* H9 b7 Z0 t   push  002a002ah         ; high word specifies which VxD (VWIN32)
  e) z/ X8 |% g, h  H9 J  ]                           ; low word specifies which service
: t; G$ p$ _3 b* [+ r                             (VWIN32_Int41Dispatch)
( f5 Z0 f9 @" L4 y. U2 S   call  Kernel32!ORD_001  ; VxdCall! F% C9 m2 M8 v; n* W- w4 y
   cmp   ax, 0f386h        ; magic number returned by system debuggers3 t5 A1 q! q, o0 K' e" v5 B; N
   jz    SoftICE_detected
3 e5 Z2 Y/ g& z$ S! r* j7 p, h# h# K
Here again, several ways to detect it:
  X5 v5 w' O9 P5 G3 A$ ?- F. ]. l3 t! y
    BPINT 41 if ax==4f
" ?) k" L1 v* H* D8 j- z
8 J' |: Q7 V" h$ x' q7 h- O    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 @) m! o6 [# O% j6 r8 h4 q
* E0 ?2 J6 R0 j4 n( n    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- O/ }6 E- r  J4 V0 h, N: s8 r& v. i
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 C& W  J* c0 e. j' [- W

- W1 s' {( D6 b& V! \' T__________________________________________________________________________
. f9 C7 {5 C+ r' g6 C* c. a5 V8 b9 ^+ _5 S" V. I
Method 13! z2 c7 [" T2 g4 W
=========1 `* ?4 ]  J, G! a( X* o, @
4 ^$ [6 }$ ]8 @. K* |
Not a real method of detection, but a good way to know if SoftICE is5 G+ w; M1 ]% [1 V: s: K: N
installed on a computer and to locate its installation directory.3 ^" h" C2 I! i
It is used by few softs which access the following registry keys (usually #2) :0 f) G( h5 }2 a$ s$ H: K

% F5 t" J/ b' M" m-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ G9 y. {$ z- g: w: B
\Uninstall\SoftICE
( O  W- N0 A( ~, [9 d' X-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE" {9 h% T" }8 y3 F, o- C2 b
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, q( w4 W2 x) J' L$ G  o4 \
\App Paths\Loader32.Exe  u" G( a: X" ?. ?8 `
3 ^+ i7 c9 b' }4 t7 P
/ s( k% d" U* N  ?
Note that some nasty apps could then erase all files from SoftICE directory
" ?8 |$ j% v# X5 s5 _(I faced that once :-(
" T3 H' S$ t1 P2 E! P( A3 \* |9 D' u( M+ I# Y& Y
Useful breakpoint to detect it:
' j  m$ W; w5 }8 K& X$ Q: O5 [
! Q: s: T+ f8 S/ [7 s; I, _     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 g1 m: A7 h0 [9 D, m3 z* p0 j4 n- Z1 k" N# b- }9 u4 B
__________________________________________________________________________+ x4 [1 y2 ?: M0 `" m3 D/ i, \: J

' c& G" ?+ C  f; R: Z4 G. D4 n+ G1 W( o/ U
Method 14
0 L5 l, f* i# N+ a8 C/ R=========* q5 }% m+ c6 ?$ X

, o2 l( i7 j8 N- W( T7 G' H, vA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( x3 t, h3 D& e1 V8 N1 Y1 H( G/ Eis to determines whether a debugger is running on your system (ring0 only).
4 i  g1 b. ^# I. k4 h& U: q
4 }/ U( o  u- h4 x: b   VMMCall Test_Debug_Installed
: R; Q4 H$ A% K2 w! u2 Q- V   je      not_installed$ o+ H! q# o% g* z9 U8 l4 F
, X* `$ n! `$ o- A9 U1 h/ V# b0 {
This service just checks a flag.( N3 t: x" U+ Y7 X
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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