About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>( U" I! R0 F# |' z. L9 a( |/ l
<TBODY>$ _3 P; K! K# i4 o  ~. R
<TR>& X3 ~7 i2 |% _4 h0 @
<TD><PRE>Method 01
1 u3 v: h- x5 p4 C8 u=========
" ]0 j2 O& U. U) d+ o* X% l4 |6 j0 n6 Z% L& b' S
This method of detection of SoftICE (as well as the following one) is
/ ~9 g5 T& g: s  ]3 i5 F8 ~used by the majority of packers/encryptors found on Internet.
1 y9 B8 d: ^0 ^: j# ZIt seeks the signature of BoundsChecker in SoftICE
1 C$ g1 z$ U! S7 L5 {2 z  B& l" O/ b0 l! O/ r1 @
    mov     ebp, 04243484Bh        ; 'BCHK'5 W; w0 g2 D4 l, s" L2 j& ]
    mov     ax, 04h& i5 E+ I7 ]' X/ m
    int     3       8 w, `" d" F% i4 r1 Q5 |
    cmp     al,4
4 ^# @  b0 D4 A7 o. ?, e    jnz     SoftICE_Detected
/ `/ h( [3 N, \9 x
. w  w4 G; z: P, [1 i: T$ U___________________________________________________________________________, Q# Q& Q( V8 ~  g: Q: r

# g( C% J6 v, f# K" F$ l- k- C3 OMethod 02
% I) D  m4 p  ^5 e) t0 r=========
6 U0 [/ g5 d1 h& G( ?# L$ b+ F% Y
Still a method very much used (perhaps the most frequent one).  It is used* ^8 S3 t- B8 t! _1 ?
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 C0 o7 [* ]2 N7 C" E
or execute SoftICE commands...
& A8 U7 v! g5 AIt is also used to crash SoftICE and to force it to execute any commands
9 s0 y6 |. @5 O$ M: _+ C(HBOOT...) :-((  
3 s2 L0 A( T$ h+ O- j3 A* T# m- P; J% u
Here is a quick description:$ U7 a+ J. @, @0 I! ~
-AX = 0910h   (Display string in SIce windows)$ F1 s- K; y* C; r0 L# Q- P" }
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)4 e. @8 l! }9 J; \- N8 }
-AX = 0912h   (Get breakpoint infos)8 ~- J" B$ l: }3 |
-AX = 0913h   (Set Sice breakpoints)
7 J4 N2 f0 N6 r) G' i-AX = 0914h   (Remove SIce breakoints)
' y  \; P. y' v: j  E$ ?) v% |4 a6 y% I7 ~! e4 @
Each time you'll meet this trick, you'll see:  s2 X% _, ?! S4 @) ]
-SI = 4647h
. H5 n2 [# m1 m, `. u1 q1 v+ h/ f! g: X4 J-DI = 4A4Dh7 V" I2 ^' Z# \
Which are the 'magic values' used by SoftIce.
+ o- s) K# T; A$ _' p. e, Y5 z1 Q" FFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.( V, J3 }7 J$ D) l& l, T4 m
$ X; s7 _& ^8 C$ ^5 a
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 l, C# o" b# v, ]/ ]- W
Envelope utility use to protect DOS applications:
" c, h% X7 X" j; W/ k
! [& q2 K/ K/ Y( n! a
) k; w' d# g, z( z! \4C19:0095   MOV    AX,0911  ; execute command.) Z. `( f" ^; @* n
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ a( @& q0 a# ?! V) x; I8 x8 A  ?3 g# d/ K
4C19:009A   MOV    SI,4647  ; 1st magic value.
/ U% S: X$ U4 I& I  A; h4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 N5 x. L  L! ^5 Z: V" [2 ^
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 j# R8 t! F* z' B0 F
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 O7 l3 ^1 \: j" G' |
4C19:00A4   INC    CX  C1 a3 [: w# \1 m9 j' y( h3 |, ^
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) w; _& L# P, f+ j6 L/ U4C19:00A8   JB     0095     ; 6 different commands./ B; K. ~. M+ h6 E) N/ c$ U
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 K! C3 O2 f. D4 }9 ]) Q) e
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)+ p$ F$ b9 n6 H* V

2 W3 L; d! J$ k# T6 gThe program will execute 6 different SIce commands located at ds:dx, which
- t% c# i$ e  W3 h; oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 G1 V2 g+ j+ F; i% K" ?, _; ~, X
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 }2 {' r% M4 U* x( {' W
___________________________________________________________________________; a8 R1 I% t0 z& y  j, _# i

. i  R+ W, @& q) M' }
" j! n8 J; c" r8 PMethod 03
' ]1 @, m1 T6 k=========! _- X- \) v# q. l7 d

" `8 l- l" J& _9 ?1 |; YLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 C9 i% n+ ?  f! ?1 G7 _2 v- _$ i(API Get entry point)3 T9 p2 Y# `4 l# y- K2 O0 K
          U8 _9 K. X0 o+ S) d. w

/ H4 t9 ?3 C6 r* v! S4 R; u    xor     di,di
1 u; \: h9 u3 M, m' G4 D2 X    mov     es,di
# p# B( y& s, Y" T4 L; B    mov     ax, 1684h      
! `8 _8 F; d5 S% ~% ]- S    mov     bx, 0202h       ; VxD ID of winice
) N" @" V0 u9 ?! |# z    int     2Fh
$ ^7 L4 ~# J# ~7 R. a& k    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 U  s( E. U6 O
    add     ax, di) z/ Y+ M% t+ r2 ^; x, k
    test    ax,ax" r+ L# H6 Y8 W" O
    jnz     SoftICE_Detected
" l- \1 x- I" B3 r+ r) B% ]
5 w! g! F2 j! }, l! n___________________________________________________________________________$ f5 e1 Y" K) @/ N( {

* i/ O: b( }6 {% w$ RMethod 04
+ H6 w/ D, O: B=========- m9 a" Z; w( |1 N8 y

* I1 x9 `" F2 g2 a- C( _Method identical to the preceding one except that it seeks the ID of SoftICE% W4 M# l2 g7 a' B5 ^; u! Q* w
GFX VxD.* q! X3 y9 B5 ~3 v5 y, T; z, Y
/ L4 H. _, b. _8 D# q' X& a  r
    xor     di,di
+ |6 N& c0 E9 `$ C$ Z3 o, m/ o: C    mov     es,di7 `6 P0 G4 }/ e# @3 d  @
    mov     ax, 1684h      
# i' J7 o5 I2 Z8 c3 `$ y, _    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 \7 E, o- u* _+ I* m/ H) f' K! j    int     2fh
8 n7 E' [5 G( L+ u4 C    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 J+ h: c2 E" p4 h* N- O
    add     ax, di
+ p/ y  f# i$ z5 @9 z5 _    test    ax,ax
: v! K0 @$ G2 J9 @2 ?    jnz     SoftICE_Detected
& L5 J3 b5 e$ B# t& L9 e& n$ x
7 i7 R6 a! Y% ^& [% G+ Z5 w" n__________________________________________________________________________
/ F9 c/ M: F1 Z) k: @5 ^' k. y6 r
. q' k+ o3 N1 ^2 @, r+ r
Method 05: K  k( i- b. e8 M
=========3 m/ U* S+ j; m1 p
( f! f9 o" W7 u$ B# g
Method seeking the 'magic number' 0F386h returned (in ax) by all system! @* K9 ]# N3 h) f
debugger. It calls the int 41h, function 4Fh.  {' M" X9 ?6 f8 L1 r
There are several alternatives.  . I) L# m7 N: ?( M$ V- T6 T
: e. R: h( @, r8 h- K
The following one is the simplest:" V% w9 V7 m: c) ^% J- |) P

2 p8 y$ F; w. u; V) S    mov     ax,4fh
  b$ n3 L1 y" C6 X    int     41h  [. R4 i. u  |3 H6 p
    cmp     ax, 0F386
% m  c- P; ]" I  p9 e7 Z' d( P8 ]    jz      SoftICE_detected
& G% z3 R) i2 K! G5 I3 o8 K! t/ `8 i& R2 c( s7 |1 X# `3 m% m. }, S" o
9 g2 j9 t  d* n6 P6 B" Y( v
Next method as well as the following one are 2 examples from Stone's
! I- ]  q# ?% D; U7 {# Y2 ["stn-wid.zip" (www.cracking.net):
8 o; a/ X3 ^7 @$ s+ @) ]! H6 @, o! X6 s! ?9 H, t
    mov     bx, cs
- d, x- v+ t6 A, B7 j4 c    lea     dx, int41handler2
' s. M/ u3 p0 ^+ I4 C( g4 n    xchg    dx, es:[41h*4]3 {! S- F2 n1 @( P' I" F
    xchg    bx, es:[41h*4+2]
- |9 P: m0 u7 e7 `1 F* y7 Q  _, A    mov     ax,4fh, E0 t4 ~6 j" L: y* {' F
    int     41h7 P5 e* e+ R* Z1 o' w
    xchg    dx, es:[41h*4]9 d8 p9 [& _4 r8 ?0 K1 b8 j5 ^8 n
    xchg    bx, es:[41h*4+2]
( e: Q  H4 w- @    cmp     ax, 0f386h
4 I/ v( I/ J9 M1 B$ @$ f$ E    jz      SoftICE_detected5 M( C" `; t$ ^+ ], [! T

4 R6 E  _/ a$ eint41handler2 PROC
) K, ]( |! l# S0 C, S    iret
* Y& S5 I) o3 T9 iint41handler2 ENDP
6 J) G5 |* o$ \* O7 z4 S
( e+ B( S& r4 g- b2 s. H! J5 i. _- O2 r: G) }' n
_________________________________________________________________________
/ M! M& u5 }9 P5 T6 [, M( ?+ L* G/ B' K+ Y0 k& o0 t5 Z

3 Z- e2 I# C7 B, FMethod 06
( T- r2 |/ b3 T# p: X=========
# ^1 y: g2 y/ O+ G& B4 j1 N7 B! p
- @) @6 A  t/ d8 R6 u9 c
1 z3 y) z5 Z2 S! r0 q% N8 |# C& D2nd method similar to the preceding one but more difficult to detect:
. |3 W) C3 O3 ?9 ]. k8 W/ b' w" t
- w+ T# \$ n+ f2 L% v+ O# H! w3 ~) w4 v2 ]. ]2 J
int41handler PROC  v9 R0 s$ X* G
    mov     cl,al
- Z$ h1 V. O/ F% L' `- Z7 B    iret! v: X% F, t5 w5 h/ q# f% Y- G
int41handler ENDP
* X0 a* J6 h5 [; Z; i1 j$ U" g+ A, {* M3 [$ c$ \1 Y

) R( `1 O" ^* o7 H5 s/ e3 x    xor     ax,ax$ k+ m9 m+ v0 S  S/ A
    mov     es,ax
  Q; b8 w1 W4 l4 z    mov     bx, cs
6 {3 t/ d& b- s7 N2 _    lea     dx, int41handler$ ^, ]+ P5 _+ w; j3 n
    xchg    dx, es:[41h*4]5 O9 G7 J$ t" j* N% j" M% {
    xchg    bx, es:[41h*4+2]
+ w& K, K* `/ ?$ m    in      al, 40h! X& [% [- p( ]; p( j4 B7 [! B
    xor     cx,cx
' X4 u( T# r6 _# Q& d    int     41h
* J3 N0 x$ D1 C  _& _    xchg    dx, es:[41h*4]
- @: x% K# D9 ^" i% I    xchg    bx, es:[41h*4+2]
$ a2 q& W7 P+ X  s6 T2 d, v    cmp     cl,al& x* M) a1 Q& ~1 |# ?- y
    jnz     SoftICE_detected. V7 D: {7 `! a: E9 G0 J2 R
7 @& j2 y. W4 r1 ^) l
_________________________________________________________________________7 t; F) L" d) `- m% E

2 W& ^: I8 ~: Q: U- w' IMethod 07
' `% X& g& `! `- a=========6 E: j; R6 V4 F9 u1 _- p; D

1 @" P! }. Z5 `Method of detection of the WinICE handler in the int68h (V86)
9 x# T5 O$ W& X3 n+ p/ m( x1 [; e$ r! e6 c$ H% u4 ?/ U
    mov     ah,43h- S- A& ~' s/ C! F% t# D" V8 b- u
    int     68h& G/ V% w' ?. R- ?7 h
    cmp     ax,0F386h
) e; [9 Y4 F% }$ G: ]. L7 m    jz      SoftICE_Detected
' i' [1 x( @6 I4 e- ?- r" m4 x& U6 E/ O8 {, W- v- `( a6 G
7 v9 P0 Z" n0 T. ?; M( o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- n) w1 u) O" }' X
   app like this:
+ S( M* d7 T2 ]5 ?
3 N% b) R8 y) P& D% ?: d1 {6 f* A   BPX exec_int if ax==68
- {+ B' Y& i0 c9 n% J9 g4 g   (function called is located at byte ptr [ebp+1Dh] and client eip is, A: [6 n# ?8 C) C4 r8 b2 B: G
   located at [ebp+48h] for 32Bit apps)
7 r& }  |% ]8 R# G+ B( @7 b__________________________________________________________________________& T" Y6 {; e! b  }6 w7 s! @# u2 A
0 `- Q5 _* U7 u9 D3 ]: f

: s- ^6 s) O+ R( |' @; }1 QMethod 08! j2 I+ c" x) {
=========
) q( \  c! i6 s8 R0 |
$ t7 b5 n' h, ]3 rIt is not a method of detection of SoftICE but a possibility to crash the% q- o, G9 ?$ A; D9 q* I, V! U
system by intercepting int 01h and int 03h and redirecting them to another; W2 C1 v: C  D; ?
routine.
$ m+ G! Z& e$ c" OIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# E- x, E  W- u" z" p  {
to the new routine to execute (hangs computer...)
/ Y" X, e; C0 x3 t: w0 i6 d# F( O% d
    mov     ah, 25h/ N+ r+ {& j8 H
    mov     al, Int_Number (01h or 03h)8 c5 e' Y2 ]/ }
    mov     dx, offset New_Int_Routine
, k0 m; z' Z9 V& p2 k/ b. h    int     21h# s- T! F8 C' X" f1 o
3 H2 \2 ?9 v& b* C# C
__________________________________________________________________________" j) g0 `) L- m" b

* C- y% ]8 \' q' u' DMethod 09& B# X3 R! R" m4 S3 p- h
=========0 j* w) a% {; y+ g; v
* W0 K" z# M0 d2 F2 E( b
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 q: B. S7 O+ z$ T+ `5 D. l' r
performed in ring0 (VxD or a ring3 app using the VxdCall).
2 l9 z) N0 ?6 yThe Get_DDB service is used to determine whether or not a VxD is installed" i7 g7 J9 P) [
for the specified device and returns a Device Description Block (in ecx) for
; \3 Z8 M& u) f. lthat device if it is installed.
& a. }6 K4 O8 G# b0 }; F
; r/ _  T& C7 b   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 J" ?- W9 t7 A( y, }6 J   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
/ |( L: C7 J; D   VMMCall Get_DDB6 X1 c: n& d. R9 G; s. g
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 h- E8 o8 K' l! d" N8 @  ~9 R' U
) Z8 ^4 R' |/ W1 E* Y. gNote as well that you can easily detect this method with SoftICE:& F2 [6 @; ~6 @, N/ o! n4 _5 ]6 s
   bpx Get_DDB if ax==0202 || ax==7a5fh
' ]3 k4 m4 L: S- [- r7 g  \4 M1 ]
8 Q7 Z6 ~$ Y* G__________________________________________________________________________
! l( }8 _% V6 F
( m; I- \, ?9 g, BMethod 10
' [8 V7 A: m* J8 w& _5 h=========
: {' A: r2 O$ a. C) x8 t' H2 x, r& r4 h1 J& [% c
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
1 [0 C, f  ]  E8 {2 _  SoftICE while the option is enable!!% Q9 ?5 w/ W! c* ~' o6 k

' l* u* ?7 e. Z0 q0 ]$ }$ WThis trick is very efficient:
- h$ ~! j# }* @& P$ l, Q- qby checking the Debug Registers, you can detect if SoftICE is loaded
, g" o# z5 s% }2 \' U. N: I; s(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, r4 E% H1 m) w, O0 Uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
5 @( ~5 X7 u4 N7 a- Jvalue (in ring0 only). Values can be manipulated and or changed as well
$ j1 ^3 l  B4 w7 R6 Z1 r+ }" r& C(clearing BPMs for instance)
; z" R; [4 H7 _; ?; U+ A# s! a" ?
( v  X4 e3 i" B: U- _: u- ]__________________________________________________________________________! Z# w( ~% a* B6 ^# K8 p
; Y4 x8 g; v$ F2 n4 ?
Method 11
& E1 `; B: l: l# m% Y8 Q=========7 n7 k. C( b6 s$ D8 z/ h
9 g, h% t- V4 m1 R- [6 q! ~
This method is most known as 'MeltICE' because it has been freely distributed9 M8 G1 G; f4 c
via www.winfiles.com. However it was first used by NuMega people to allow" j: U0 k$ k0 w5 `( k$ w
Symbol Loader to check if SoftICE was active or not (the code is located0 W. d8 g  v; W. j1 H4 C
inside nmtrans.dll)./ U& S: I6 G$ B9 F# k3 a' ~  t+ X2 m9 r

: x3 t  ~- d; Z. }The way it works is very simple:4 H: t0 O! y! m2 p' U& @0 ]7 D: \
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for* h5 l+ ^! d7 C- f
WinNT) with the CreateFileA API.
' e8 T: Y* F5 I, j3 t' n  s9 E$ _' r. Z
Here is a sample (checking for 'SICE'):
9 Z9 N; y0 a* a) w0 P% U" g; ^2 M5 k" M
BOOL IsSoftIce95Loaded()
7 n% m0 Q9 g0 J! t" f# \' _{, r3 P- f( y5 d* V% u! |, x
   HANDLE hFile;  - X/ Z& f0 u; y9 A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# c  d: p  i" X1 I                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: n8 B2 r; O; r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
, X8 k7 ?2 u# r   if( hFile != INVALID_HANDLE_VALUE )
$ R! `6 O: @! I) ]; V( Q" F   {
) M1 R. R. {4 U$ m4 w2 a      CloseHandle(hFile);
# J* u' o. Q' Y. L' `      return TRUE;
; V7 c7 C% U5 b' W9 ^9 D   }8 `$ ?5 E0 @. e" w- g
   return FALSE;: ?1 {' N. u$ {
}* M0 U6 R5 M0 ~' q
0 K$ G+ k2 E: J# C
Although this trick calls the CreateFileA function, don't even expect to be
6 ?2 X# B  L. N9 oable to intercept it by installing a IFS hook: it will not work, no way!
' H# f, v6 i# X; V. ZIn fact, after the call to CreateFileA it will get through VWIN32 0x001F$ T  J2 H8 C& A5 {+ k0 P8 g
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* T% p. G/ |. M7 `
and then browse the DDB list until it find the VxD and its DDB_Control_Proc4 l  A3 U5 [5 c+ p: f( m6 D( q$ S
field.
8 p1 r' `5 |4 E$ uIn fact, its purpose is not to load/unload VxDs but only to send a
$ \# l* ]. T4 u$ y7 V1 ]9 nW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" k8 e3 X  L6 j6 Q' J
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 r0 q5 v1 J; ~3 r# |to load/unload a non-dynamically loadable driver such as SoftICE ;-).: G2 u" w# X$ U' |
If the VxD is loaded, it will always clear eax and the Carry flag to allow* P* S' m* J5 D6 L4 [& h
its handle to be opened and then, will be detected.
, g9 B8 r) Q  ?& L$ xYou can check that simply by hooking Winice.exe control proc entry point5 Q. T9 U" V& K4 m" b1 M
while running MeltICE.
7 N/ C. k: T4 m' a6 t/ R2 d  K3 F+ n0 l( ]# ?

0 p4 V5 `' P- g+ w4 w" a$ o; e  00401067:  push      00402025    ; \\.\SICE3 T7 l1 M0 Z& K6 r' Y' s
  0040106C:  call      CreateFileA; }' A/ A! p4 O- `- F) I
  00401071:  cmp       eax,-0016 c0 w. ~" R; \: W8 G) m( l7 \
  00401074:  je        00401091
. G# ^* D& o( \1 O3 D
( G6 s, p; i" B1 a7 h" p
/ ]" q4 C6 ~+ l1 \9 JThere could be hundreds of BPX you could use to detect this trick.$ q7 J/ q; Z; u9 B
-The most classical one is:: N: o- K; K" `6 o& d: @7 a
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' _; d8 \& S7 z4 u, Z' Z- v
    *(esp-&gt;4+4)=='NTIC'' q$ ~( D1 t+ V( _0 O, h) o  H

/ }& R! d. I2 W$ N-The most exotic ones (could be very slooooow :-(
: D0 O$ E* h% M! q. N( \5 W   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ {- J+ F( H$ k' ?1 F# [9 S     ;will break 3 times :-(. v: Z" f! t& O
* W+ _* P) d! z$ B
-or (a bit) faster:
9 ~* B* v1 \( E, r9 N, ~2 Z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; ^0 n( R$ @3 W! y' V# v
9 O% X3 v: v; D# q- ]   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
# u' x/ Y5 n; A9 g7 y, d4 d     ;will break 3 times :-(
0 B" T; ^! r2 v
7 T: s$ E+ K: |" d2 ~-Much faster:
* d* r1 d+ J5 z. d% p1 ^  e3 M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. M2 p4 L1 t) v$ t$ ]% V; Q7 U' r* [# k2 k. T+ ^% q7 O/ R, B
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen, T* M( C3 g6 o8 s! N
function to do the same job:) u1 C/ G/ O1 P' Q5 V; e
2 p5 k* |, p' F5 `& d# m
   push    00                        ; OF_READ3 s7 @. b4 u7 s9 z; }0 e5 ~
   mov     eax,[00656634]            ; '\\.\SICE',0
& R% Q" {- A" p8 r3 `   push    eax8 O" P! _' W' Z5 J/ z" a
   call    KERNEL32!_lopen
. [3 C$ j/ p. ~& z   inc     eax4 o2 `2 y( M7 S& {$ y' v( ~: V
   jnz     00650589                  ; detected5 N9 v5 U+ {- {* v2 |
   push    00                        ; OF_READ  A: V: L* f; ?5 V
   mov     eax,[00656638]            ; '\\.\SICE'
) p# G* ?, T. G9 o- i0 e   push    eax
) y, C: i$ s! {) {/ S$ _   call    KERNEL32!_lopen
( ?4 E! c$ D$ ~   inc     eax4 ]0 u7 o2 ]1 W- ]
   jz      006505ae                  ; not detected( _* m; v% A6 b1 u

2 d& M5 e' Q: R, D3 m, \6 S: ]3 L+ f! y3 t( |; L
__________________________________________________________________________
! \: I( |( P+ ]1 H4 m7 X) x* q; y/ y) H1 S' n% Z* |/ W2 Z0 }. F
Method 12
$ y; u5 K1 U' D/ K=========4 p  _; ?( r; d7 u# F# U
, C* U! F' l( `* }. _
This trick is similar to int41h/4fh Debugger installation check (code 05/ {$ o  a  K1 K$ m! j& \5 t8 E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  N" x+ E) Q- O2 ]' Zas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 ~# B' s( s& V5 U9 j, i2 G
; c% U  n3 W* `  Y   push  0000004fh         ; function 4fh
2 Y; ^. s' {. m, ?. L   push  002a002ah         ; high word specifies which VxD (VWIN32)3 w( w& J$ |5 G7 M. P2 H9 w
                           ; low word specifies which service
8 a( |. w  D! B* K, T                             (VWIN32_Int41Dispatch)  I* v" m; {5 m, g- ?% s
   call  Kernel32!ORD_001  ; VxdCall
8 N& i- R) m. _# Y+ x1 `  D. y   cmp   ax, 0f386h        ; magic number returned by system debuggers* C  `/ @4 g# |, G# q6 n3 H- D
   jz    SoftICE_detected
3 o8 K( p) G* F- a8 j7 H
% A& v3 A/ Q% ~6 ~) w$ H* }Here again, several ways to detect it:1 Q# Q0 L5 k& Z
* ~# d4 d( \, g- {5 ~8 O& X! P
    BPINT 41 if ax==4f
/ b3 V: q0 G; l" S. ^/ y* J
1 m1 M# e' Q4 `3 A/ p& Y( B    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 }: U$ y  Z1 x5 [: a7 V9 g
* _3 J3 n. Y6 x6 O% P6 ?9 n( Y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. Q5 \( }. b2 K- O* u1 @5 O" R3 w
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' k6 z$ N( ^7 `" y
) Y) E9 d8 r1 \: q% d' @3 S
__________________________________________________________________________; x; B; W9 A* M( u/ Z6 Y' u

, p& h  z% z. T1 W8 v5 _  SMethod 13
: J# A' _4 Z6 h, P=========. H- ~  e; ^( y2 C, a; A" ^
. ?4 M  u, E8 i/ v! N
Not a real method of detection, but a good way to know if SoftICE is. V5 R0 L* p, x: a, O. R/ S, U6 v% ^
installed on a computer and to locate its installation directory.
: I. d( _/ p' T8 W  a' E; t! y  n( dIt is used by few softs which access the following registry keys (usually #2) :0 F) @% u/ l0 f# \) T; e. ?0 t

' z' K( \; j# Y4 C-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ V8 t" [6 V) r; M9 ^6 Y( w1 J- Z
\Uninstall\SoftICE
- K3 u5 A" c/ r6 L$ |* c-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# \5 s* i( h& s8 H; v3 i* J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 p6 B) m4 s: U. O4 P\App Paths\Loader32.Exe, f4 W* y  x% E1 q* a8 v
1 q  ]: C8 H. t. {9 K( e
2 `' R' R/ J3 D$ C7 q5 X  `$ O" x
Note that some nasty apps could then erase all files from SoftICE directory; l  B( X% N. ^7 q& ?/ \" H& d
(I faced that once :-(" y# w' P" H) ~. _: R: m
( Q/ [0 {5 Z' B7 e( [) L
Useful breakpoint to detect it:
2 h5 u7 w  ?3 L, z0 d/ x2 x2 B0 z, ~8 M0 F
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ @8 l2 ?, p% ^8 u: A* \) y0 z2 @/ d

0 \' n1 [8 k( T' ?" }4 P9 k__________________________________________________________________________
$ r) z0 X& X, [( G3 y& _0 [3 K+ E) i# i+ C* w: y+ W
& `$ S/ Z$ l# c7 C$ j# l; k# q
Method 14 ' l9 l6 N* M' p0 p* s0 c  R
=========
3 s( f" ~' o1 ]
. ]1 U4 Y5 T4 L. d& b5 _, SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ n! I% I! f5 w( m* D0 Z* a' Uis to determines whether a debugger is running on your system (ring0 only).% P" ?/ r- l8 w' x5 O  ~3 h

0 r. Y1 D9 d- C1 Y  d   VMMCall Test_Debug_Installed6 ^" Z# j9 q3 ^, f: |/ {
   je      not_installed
: z6 j* o: p2 W" z1 f
/ T0 h3 [0 S1 j9 B5 i) _2 EThis service just checks a flag.4 J* I& w) z3 ^; ]/ _5 _% K. _
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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