About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 O/ L2 Z6 h6 h; e<TBODY>3 p* F* I4 W8 s; {. i* S' r  ^5 C
<TR>
' f+ b# v( H" k7 a% B& a' a3 v<TD><PRE>Method 01 " y' G  @# X& E1 v0 K* O
=========' x0 C5 }/ j! C+ c

' ~1 E6 H1 M# O0 qThis method of detection of SoftICE (as well as the following one) is& E+ m" O# y, U- r  w5 w* n+ {
used by the majority of packers/encryptors found on Internet.
4 K2 S1 Q% q9 ?9 H8 LIt seeks the signature of BoundsChecker in SoftICE
. @! \1 x% e( c( M5 v, |1 t8 h
' Q+ i1 h: y& A9 W0 W- G8 N. P    mov     ebp, 04243484Bh        ; 'BCHK'
' H! {0 C) E' X    mov     ax, 04h
9 E9 |# r4 L. K" r) h6 ]    int     3       7 B/ L, m$ s$ J- I4 R
    cmp     al,4$ u2 r) k4 V* v/ ?  z
    jnz     SoftICE_Detected- Z  K  i* K' Z

+ A3 f6 Q% r6 m$ G$ h+ @/ F___________________________________________________________________________6 }( u% B  z; h2 I

( Y# a) `4 s6 o) B7 A% A- n) X0 R1 \Method 02* y& ]* I; z9 j* H4 O. S3 [9 m) w" C
=========! \' L7 G% D& |( {; E0 R

# i5 F. l1 P# i  n3 G# Z2 W. j, XStill a method very much used (perhaps the most frequent one).  It is used
0 Z) Q( |% z. z1 c* Bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 N) M( u" m) X* P; w9 C2 }0 M
or execute SoftICE commands...
) u& X) j( L& Y& WIt is also used to crash SoftICE and to force it to execute any commands
" d4 R# L) }4 Z- K9 h4 E+ _8 [(HBOOT...) :-((  
. ]4 }; ]) Y& V1 d" J5 f8 `3 F# x, O- w! V! a1 P  T
Here is a quick description:! H7 ?/ j) V( C2 Z9 Q/ S  u: \
-AX = 0910h   (Display string in SIce windows)
* k! ~* F* H$ M: C3 P5 [9 r1 r-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)6 J6 l, C' }4 k5 W
-AX = 0912h   (Get breakpoint infos)
/ [; M7 h2 Q' s-AX = 0913h   (Set Sice breakpoints)9 I1 [1 E% a) f6 r% }
-AX = 0914h   (Remove SIce breakoints)
. x' S1 c0 o( @, _& _
/ H% X& j6 W6 P( ^/ HEach time you'll meet this trick, you'll see:$ a" V' ?  y1 Z
-SI = 4647h; [4 s, Y: U, J! [/ }9 W6 i
-DI = 4A4Dh
9 ?2 P9 P3 K$ y1 [7 f7 x& IWhich are the 'magic values' used by SoftIce.
# q! a" w6 z: I6 D& F  bFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.  z# z! a3 O5 C) L: C

8 W- E4 C: K% @" Y8 Z! v4 r# a+ LHere is one example from the file "Haspinst.exe" which is the dongle HASP
/ W3 J1 W$ E6 G( ZEnvelope utility use to protect DOS applications:
4 d! I6 [. k9 T: a/ S8 y
. |! H- ?. U/ {) m7 V4 X7 Z$ G  |# s
4C19:0095   MOV    AX,0911  ; execute command.! A5 w, ?9 \8 T# ~& B% a7 _+ N
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 P- ^* d: _! H9 w; f3 y8 A
4C19:009A   MOV    SI,4647  ; 1st magic value.
* m0 P: T9 G7 v# L4C19:009D   MOV    DI,4A4D  ; 2nd magic value.2 f" |  _9 K: _
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)( r2 A6 M0 F5 A! O# j" p
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ a: C; ]/ }& I+ _4 f1 Q; I+ S
4C19:00A4   INC    CX: l! g. [& ^3 {% ^
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. f" b1 ^! N+ U
4C19:00A8   JB     0095     ; 6 different commands.
  o* H* a9 a: v1 x7 i4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& r, _2 A4 W$ x5 n
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 [3 ?- b" L- `- x7 E

3 Q1 T0 q) x+ M( V0 h0 Q6 VThe program will execute 6 different SIce commands located at ds:dx, which% J  J3 Y2 F$ Q' o/ ~4 Q
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
: E& K8 J: E8 i# y& R4 ^! @* w
/ B1 ^- {0 i5 }6 u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 |4 j! O$ j  c, Y1 @6 q) k___________________________________________________________________________) H2 q8 K# k$ T1 j/ m; A

+ m- B! |9 J8 ]+ q
7 w; |! n, N! x9 KMethod 03
. R7 A* M2 K8 Z# F=========1 G' c2 R. Q- m

7 \. i. r* P6 r0 L: ]& L5 y2 ULess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
$ [6 Q- Q: p- s: j3 ]! G(API Get entry point)
" u9 k, [7 h* V5 C& g        
& U! A: O; g0 Q- X( O' V( E+ \
8 I6 z$ c! l+ p' `  K( s    xor     di,di
& h6 ]2 o, ?, k8 l& n% N7 H! p    mov     es,di
" e0 `' l1 w* K$ F+ U+ h    mov     ax, 1684h      
* N: ^3 [( o9 f    mov     bx, 0202h       ; VxD ID of winice) [) X9 ~; e2 I
    int     2Fh. t7 g& V8 q, w) F
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- C; G; q% H7 I3 t4 J! u1 \' q
    add     ax, di3 q& j9 y9 f6 ?
    test    ax,ax
  P5 P$ n! A( k7 G: d$ B, v( _# F    jnz     SoftICE_Detected1 H2 E. U4 @9 O) f
8 Q1 [* o! F6 Y9 ^
___________________________________________________________________________
/ S" M, X" e: G% p1 R
' u$ C* w/ B7 Z# ]$ u) G1 YMethod 04
8 M2 L: }6 u  E, w/ @=========
, ?7 b4 |  c( z6 E4 @6 ^+ W& r+ Y- U1 @) K3 l: |
Method identical to the preceding one except that it seeks the ID of SoftICE: }! A/ i0 `+ Q/ ]  f& B& `
GFX VxD.4 L; A0 [7 d4 _# ^
& W. S3 o+ l: r! e" c# q
    xor     di,di
8 `0 b1 o' H6 L3 |1 c: B+ E( ~, Y    mov     es,di4 O: `+ p7 ?) y. A6 ?
    mov     ax, 1684h      
, K- D- H7 U; b0 J9 [$ E    mov     bx, 7a5Fh       ; VxD ID of SIWVID. X8 w  ?2 B0 S; b' H
    int     2fh
7 F! Y! q# g# }1 a0 u' b    mov     ax, es          ; ES:DI -&gt; VxD API entry point& U# j$ o% ^* Z# k- Q' v
    add     ax, di
& L& j' G: q  a2 w- w    test    ax,ax" @  Z9 w2 t% k' ?4 u
    jnz     SoftICE_Detected
4 K* k0 [) u3 B( G+ `5 n  Y1 C# L$ Z( x! M2 x. u+ @
__________________________________________________________________________
9 \# M( p) ?3 Z: z' E# y" \( f+ p* B" J5 u4 c* g
2 j9 ^0 e' V2 G" S2 |! |
Method 051 ^3 M8 v1 T( |$ h
=========
# [, o, E8 R, y2 l7 U( a. I' N8 ]8 z3 S0 ?
Method seeking the 'magic number' 0F386h returned (in ax) by all system
6 U  L' K6 S) r1 `% r4 u- ^debugger. It calls the int 41h, function 4Fh.
* R/ O0 }4 o, }$ t* i* uThere are several alternatives.  
* R: \0 }2 Q! Z
; d1 o( q$ o# |  Z. eThe following one is the simplest:: y4 c. k6 F: ?6 J5 M$ J

: D$ |! o) Z) ?# [- {/ ?    mov     ax,4fh
' x4 k+ }4 y) S    int     41h
0 C$ J' o8 \: S' V4 R    cmp     ax, 0F3867 \, Y6 M: y( k0 q
    jz      SoftICE_detected
$ C' B" n, ^, L; B, o: R2 {
6 e8 _+ P& y6 W( [5 h6 j
, J( x+ S3 W% j7 |- w6 M. FNext method as well as the following one are 2 examples from Stone's
1 x4 [; j0 Y8 c/ H) R"stn-wid.zip" (www.cracking.net):7 R6 w6 o, L; e# w

# t1 x3 K( X, m% m" K    mov     bx, cs5 i3 S5 Z: ~3 a8 }
    lea     dx, int41handler2, Q# |# |' s* w4 ^6 v' Z6 i, B
    xchg    dx, es:[41h*4]
. O! K* p6 Y3 i/ v7 K    xchg    bx, es:[41h*4+2]
1 {1 X( i1 d$ O8 i3 t3 W    mov     ax,4fh
$ M4 ~/ Y# p9 j/ f, o0 v# z# T    int     41h  e% Y8 ]2 ~/ Q6 r; g6 p
    xchg    dx, es:[41h*4]- @0 {  F7 m/ o8 a7 {; k
    xchg    bx, es:[41h*4+2]
- ?7 Q( C* d: y# g+ \, s    cmp     ax, 0f386h
; n& u" q/ w' Y! M3 d, }8 |% ~    jz      SoftICE_detected
) G! i. k8 N0 Q, Q. d1 p1 Z. ^! T$ o1 l8 R4 a* x* E
int41handler2 PROC
# b/ Z) e8 R; m- T    iret0 N! \3 K0 m" q0 l" O
int41handler2 ENDP
! G7 e! e9 M% f8 n% b, @1 e0 ~8 u9 o8 b: s) u, v  b1 f1 U
: B& b% L/ ^2 L# M7 O3 N" z7 D
_________________________________________________________________________6 u4 K" R& S1 X$ o: I( l0 w$ Q

$ s' X3 V- @# A* t, ?# \
. ~8 x+ e# {6 e2 z( P! [1 qMethod 06
, a, e  u6 L1 x=========" T6 n. R  v3 H9 F! ~
( V  H, o0 V8 H' K$ h# d( @
4 ]$ j- k: t0 G6 [
2nd method similar to the preceding one but more difficult to detect:- j# |! e( @- p5 i
7 y8 D( F+ ^2 A3 Q$ Y
2 g, x; E+ J: x/ `! J0 g
int41handler PROC: d8 {  X6 o! e3 v
    mov     cl,al$ [- ?* ?$ `- K/ x0 f
    iret
' u! U  q# l6 x! j1 ]8 v$ `int41handler ENDP
$ \5 C4 `; [  C# M& w
0 z; o' Y! X& b. T) g3 S
  Z4 e$ @: S1 r% C' i    xor     ax,ax6 q* i! J# d# Y
    mov     es,ax
" [& E- r8 K) }+ `- M6 b    mov     bx, cs
' y0 X$ s( I& l% z2 p    lea     dx, int41handler3 _, n- `; m, |2 o: l* @
    xchg    dx, es:[41h*4]
  ?. ^# _" v# H8 I7 o0 e3 S9 W    xchg    bx, es:[41h*4+2]
. f3 Z: d+ ~& F5 s2 P    in      al, 40h  ^* C: F/ [: R. x1 Y, J
    xor     cx,cx# g4 |% \" M0 `
    int     41h; D2 d/ M* c: J. \; Z
    xchg    dx, es:[41h*4]
/ z# J- n4 H9 {. v) L    xchg    bx, es:[41h*4+2]7 B2 \) V7 e% o1 L% G( Q" T4 |
    cmp     cl,al
- |. Q8 {5 V$ Q" ~/ Q    jnz     SoftICE_detected
8 @) V' B4 o% k+ ]' E2 L+ g: |2 A* T' S5 X
_________________________________________________________________________: L, k4 x& K$ t& c. o6 Z1 C
2 i1 K. i, e% q5 P1 v
Method 07# m* `% T8 Q: I8 b
=========6 f* F7 O& Z0 ~' p& c- ?
+ m5 r( B# L8 N& g, I% Z
Method of detection of the WinICE handler in the int68h (V86)
; ~% u2 c7 ~; z- S. c) G7 D
  K. z0 b: |% W& {1 F    mov     ah,43h5 P0 i; R' w; Z9 y+ E7 t+ K$ v, Z3 Y: G
    int     68h- m7 w9 Z; j9 I. j
    cmp     ax,0F386h8 w" h! Y1 v( G
    jz      SoftICE_Detected6 U, X/ j0 I1 E" C7 U, E) ]

$ }0 s4 E$ @5 m
/ h. |/ T6 N; x5 X  ^0 v- d5 o) J=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" H" ~8 z3 w* T. [- Z
   app like this:; p  l  k; N# ~9 L/ w
% U& i) a. e/ l; `) O( B
   BPX exec_int if ax==688 C3 I0 O( g( ~: L" Q+ f$ G
   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 e3 p  x7 w0 @- H   located at [ebp+48h] for 32Bit apps)
+ A1 f( B$ b7 N1 ^__________________________________________________________________________' R: `4 P4 R4 S6 }
9 x1 q" S9 \7 L$ A. X- U4 Y# Y! J

! y6 L; g" p* q9 h: T! KMethod 08/ C- w4 d5 c1 K7 e( z
=========
& b5 G$ d4 b3 K$ v, x$ j
' |: d$ _. y* PIt is not a method of detection of SoftICE but a possibility to crash the
  \# z8 @1 X- _) B* ?system by intercepting int 01h and int 03h and redirecting them to another7 U' a% T$ Y  h& H" i
routine.
7 C9 i: B/ M) aIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% @9 A" c4 ]& u/ x# m! b, ato the new routine to execute (hangs computer...)
% c5 G; o. N6 m2 m( ?$ b! C) e% o# F1 ^
    mov     ah, 25h
3 c7 t% t; T" q: E) i    mov     al, Int_Number (01h or 03h)5 O1 W3 I3 d0 f9 o8 ?* r  Y
    mov     dx, offset New_Int_Routine- Y' w4 l) V* ~/ e
    int     21h  j: `' P0 w; B$ M( b, s; U
& J5 V- B+ ?- r! B! T1 W
__________________________________________________________________________7 e; Q' }, C( F; G: p1 a9 M* l

& L" F! y9 d6 E! l2 \Method 09
" p4 K3 I; Y6 _; r- f5 A3 W=========
! I; f' z  ]" Y9 S& N9 j: Z( G, n5 @: m: m, n; U
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) y. ^$ C0 [$ C# [$ ?performed in ring0 (VxD or a ring3 app using the VxdCall)./ b" G- A' E: L5 |/ H' Z9 v( q
The Get_DDB service is used to determine whether or not a VxD is installed- @1 H2 q$ f6 Y3 C( [  R8 f; a
for the specified device and returns a Device Description Block (in ecx) for
. R) W5 g0 t5 j* t+ Sthat device if it is installed.3 l$ s5 F0 F) s  Q0 ^+ \1 @* h
4 n1 F4 y* t! `( {$ p8 V+ K5 N
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 I" D* y% n7 R) i6 F  g: H9 b
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ g$ I4 Y3 C7 E* y, ]8 v
   VMMCall Get_DDB
% n* v9 L  |. }3 P! x% y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 O% j. D0 T2 N0 G9 T# x
3 w$ k- u! f2 h1 k7 U) ~
Note as well that you can easily detect this method with SoftICE:& P" |1 \2 ]3 [) w$ x3 ?9 E
   bpx Get_DDB if ax==0202 || ax==7a5fh4 W" j" X. x7 I5 F
; v' ]! C; p4 a. r7 q- q
__________________________________________________________________________
( A, T. p8 D) S! S3 K  |- K, N6 n
Method 10
6 Q+ }  A9 D6 T) s+ [=========! M8 n' S4 I4 P- K* t2 ^& B* H
+ a' I% j2 ]" Z6 r  Q  M
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 e# W; U2 I9 S. I& A  SoftICE while the option is enable!!
) P* e0 s8 d9 r7 n; A1 J7 ~2 v- f% @
This trick is very efficient:
) k3 K, \8 ]$ g+ z1 Pby checking the Debug Registers, you can detect if SoftICE is loaded
! C% O1 C# A$ j1 [(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! [3 O" a+ e8 X1 S3 p
there are some memory breakpoints set (dr0 to dr3) simply by reading their& N# g: ]+ J4 j- r3 k
value (in ring0 only). Values can be manipulated and or changed as well1 z) j; X9 b/ [# W& @
(clearing BPMs for instance)8 I9 ]+ I/ v# H2 z8 |1 u
7 o  F' _2 `; w6 ~) N/ ^0 _! a
__________________________________________________________________________& k$ n7 H5 w4 k: Q

% a+ @7 R& L& B- h  \Method 11, H: V; A$ C% h
=========
; g5 t+ f0 _: J% R8 M/ r" F
" o5 C) u- z* K0 o) xThis method is most known as 'MeltICE' because it has been freely distributed/ v& q+ k0 [3 ^% `/ H
via www.winfiles.com. However it was first used by NuMega people to allow
! _( y6 A  {/ K  F! z- f0 z3 USymbol Loader to check if SoftICE was active or not (the code is located
" N7 o3 x! G; \: h' g2 q8 S- p% cinside nmtrans.dll).& S7 _1 {- _8 I8 F  c! j0 K
4 F9 F, t: y' a. s! i
The way it works is very simple:) L% v+ d0 i0 {  Q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 w: n# L; N) J1 P+ l; r
WinNT) with the CreateFileA API.9 e8 x: O  E0 i  ]* E2 S& a3 c
2 s7 g5 A; z. [+ y# d- @3 S
Here is a sample (checking for 'SICE'):
" m0 G9 p' O$ o% Y) t$ D" `5 ?" ^: t, n+ v
BOOL IsSoftIce95Loaded()+ a" ^" r$ e8 G6 E
{% A, l$ g8 x# U* z
   HANDLE hFile;  
9 |% c& H+ l3 [7 t" x, s5 ]# {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
* a6 I, I- z+ Q; \( _# f# a9 A$ n                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 O. y3 p& g4 r9 D* n( s! ^( _                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) _; P/ [, b: N0 p! i3 I: _
   if( hFile != INVALID_HANDLE_VALUE )
6 ^7 y! Y1 C( g! O4 E0 y   {
7 C9 e& u0 ?3 `: y; Z      CloseHandle(hFile);9 [* }7 M* ~+ d! o) P
      return TRUE;
9 _, S+ F6 K2 m/ s/ A) d' R7 }   }
% ?3 y& J5 w* z7 V   return FALSE;
/ L7 z5 }/ o3 v2 C: u8 i% h( p  _5 i}
( w6 c8 h/ \/ P7 f2 n: e- p- Q
( Y, _! H, _' O3 |Although this trick calls the CreateFileA function, don't even expect to be
' Q# `$ B3 Y8 U6 R) \3 f! _: Pable to intercept it by installing a IFS hook: it will not work, no way!
* j/ C" r4 ?9 r' W0 l, A! ?In fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ |$ O* G3 H  C! [* C) D, ?# cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
  \- r4 k! g# Q2 p+ Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc
  |! J& O. d6 N. [2 Vfield.
- m0 N) c& k4 NIn fact, its purpose is not to load/unload VxDs but only to send a   _% A7 K3 C% l5 b( P+ e8 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 [6 v2 I/ y- \" Yto the VxD Control_Dispatch proc (how the hell a shareware soft could try3 O3 J  u6 g# z0 C* }$ P
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" `4 ?$ T; i! U, t2 ]/ lIf the VxD is loaded, it will always clear eax and the Carry flag to allow1 k1 k1 [0 s: a& J7 C  O* P3 [( ]1 H
its handle to be opened and then, will be detected.
/ I2 P2 w% F' E" k# aYou can check that simply by hooking Winice.exe control proc entry point
. w7 o# m8 [( v, }" ]) Cwhile running MeltICE.3 O6 W& }4 I6 X4 q9 t. B
/ |; @7 q; D) d2 Y, \& m) ~

3 N& G3 ]1 K5 A" w) N6 W  00401067:  push      00402025    ; \\.\SICE5 O# E$ x8 E2 C# ^+ I& H' t' d
  0040106C:  call      CreateFileA
: d/ }6 \/ L9 m6 [1 b7 e  C  00401071:  cmp       eax,-001- b2 d* @: F/ S; y7 D
  00401074:  je        00401091( Q9 n4 t9 r  g
* @8 A6 }0 A5 a& M) l

8 `+ H0 r" ?6 Q  \9 yThere could be hundreds of BPX you could use to detect this trick.* a$ a8 Z  ?3 ]( z1 l; ?) _' o4 w
-The most classical one is:
8 c! \# u+ p8 x/ i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% `4 L% e  E) V0 D3 D! g    *(esp-&gt;4+4)=='NTIC'
- Q. `8 V9 m: H+ H! E7 a0 |% p2 s# |+ a
-The most exotic ones (could be very slooooow :-(
& E3 P' t/ S% S! b4 ~   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ) n; T9 q! _- h0 q& v- }: z) {
     ;will break 3 times :-(0 c  j6 w) f1 a3 G3 `! G5 P

8 \0 q1 c5 A6 j/ \-or (a bit) faster: ) s) i: J5 P# U& V- b$ t. e- W1 U; J
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; M3 n. {1 \0 ]; l, e% n
8 m1 a) }: k4 I7 T3 \0 P   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 p; g8 a# C4 {* k& u; o- T0 A% I     ;will break 3 times :-(
5 [  l. D% c9 t' N: J8 E/ b1 G, T4 {0 S: ]+ N, U
-Much faster:
, g/ M: C0 ~! q9 _6 f+ U$ f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( m3 |) l. i$ j" M9 U4 c) r

2 |: M9 i- ], Z  t% g  K! T4 ^( mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
% }4 b. d% Q$ t4 }6 Bfunction to do the same job:
" W7 \( t& S" i6 D- D. y$ f
/ ?5 k/ q' p) W, e& V   push    00                        ; OF_READ
* i7 [3 E* ~. E8 n! U# ?0 j   mov     eax,[00656634]            ; '\\.\SICE',0/ I- h- B* I9 a  k2 X
   push    eax
4 [% {! m. q" \   call    KERNEL32!_lopen1 x5 q! r  ]6 Q" R: l2 Y
   inc     eax' {9 c% x( s6 J( v) A6 y2 ~
   jnz     00650589                  ; detected
4 V8 l0 n/ Y, `  h, u   push    00                        ; OF_READ" Y+ |% v; `+ e" k( `) D
   mov     eax,[00656638]            ; '\\.\SICE'
4 b+ y7 L, s7 n4 ^   push    eax
' W% E* g# X& I# ]; A% H5 V" Z   call    KERNEL32!_lopen1 a1 U6 G; t. Z
   inc     eax
4 K6 o8 A( |- _0 h0 I# N- j- h   jz      006505ae                  ; not detected4 n1 @. d  _- _

' h' H. [) a! e0 Z3 V+ h( U4 f* l$ }
__________________________________________________________________________
: W; V  v5 X( R; K! n4 F  ?* V! H
Method 12
' |# E% H, E  g! ]# D' c=========! H9 T" v* M' K& [+ B# j4 X8 Z

% f* o4 g3 i' q. e8 ~This trick is similar to int41h/4fh Debugger installation check (code 052 `( p/ u6 R# V
&amp; 06) but very limited because it's only available for Win95/98 (not NT)' ~. B4 ^* z6 [1 U
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 c. V# h$ D- a. C- c# C! Q1 T. P, H# M& H
   push  0000004fh         ; function 4fh* O: k2 |" U# Q8 _
   push  002a002ah         ; high word specifies which VxD (VWIN32)8 c- q( Q9 i4 T
                           ; low word specifies which service' X7 ]2 x$ K8 i8 _
                             (VWIN32_Int41Dispatch)
  n+ ^6 n! F$ h   call  Kernel32!ORD_001  ; VxdCall
; D0 p( d. F' f! I% E1 \   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 f' }* M. g% K, s   jz    SoftICE_detected; O$ l$ P( V% k; Y& E1 ?
- Q& w  P9 g- E. l6 T! H$ C
Here again, several ways to detect it:
5 M& K# X' M) O. Z% Y0 m3 ?
! M' N# v: u% V% f# l    BPINT 41 if ax==4f
1 O- G- M2 y% m
3 b3 m3 d  Z# e9 z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 R+ s4 r, t& o5 N( u

. J1 i; V- H7 v5 F0 o! c" d+ f    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
( \4 h0 a/ x9 J7 d3 R! q, V2 h9 R& p" S& Q6 \
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) u& w' L0 _0 l0 M: S
* @1 Z, ?5 L9 W1 W' a: r
__________________________________________________________________________& f( }' {9 `3 U! f9 [. Y( E2 a5 p
& x# x& @: M$ D
Method 13
) N7 C+ ?1 z' {  ~$ h- J& f=========
  T7 [: c3 e# k1 [# X; n7 Q4 r0 M4 T* r; y
Not a real method of detection, but a good way to know if SoftICE is
/ Z' Z/ T- L) uinstalled on a computer and to locate its installation directory.7 C# X& w& [( D
It is used by few softs which access the following registry keys (usually #2) :
$ M7 Z  V& k8 N5 n
( l; m7 l2 Y4 a, ^-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 K  B! ]( ^: N8 c0 t% \# k: {
\Uninstall\SoftICE1 D" i# [  h+ X6 h' }' K+ I
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% M) J' C; I- K1 o5 x/ A2 ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" e0 U9 {6 \( }2 u
\App Paths\Loader32.Exe2 M1 o" _) L* Q4 G
( R' i4 R5 B- N" P) ?
. m. N( Z! p+ z- O- D% S
Note that some nasty apps could then erase all files from SoftICE directory
% l3 A1 \0 N6 r$ p(I faced that once :-(6 C/ J8 z# B' F
  ^$ Y, N8 h+ N+ U+ B. V
Useful breakpoint to detect it:
8 v4 U0 v2 j0 w6 ~! t7 T' m; s2 _
1 w- n+ ?8 p+ ~  N1 Z- Q9 _' G7 B     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* c6 t% I- r* ~% q- T1 Y

3 t  W6 m9 E. d$ Q) `% t__________________________________________________________________________
1 b; T! z& z+ M
! R- R& L7 o; w" c& c+ I% C1 i, p, F  E4 ~
Method 14
' {) s6 S1 I) |( r# R: P4 M: a=========; U# P% m- H% z; {  D# h! K: t! J
& H% N7 w! Y. p4 ?
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* x$ t, \' t7 h* g# L+ Ais to determines whether a debugger is running on your system (ring0 only).; i! H6 ]7 Y" B( g' w; S
9 s6 X1 i: D: R  r. z9 p7 [
   VMMCall Test_Debug_Installed  B/ d: n$ g0 D
   je      not_installed1 J; o8 t1 m* t% J, D
& G4 l* ^( c! K  J; t
This service just checks a flag.
& e  N7 F. n3 b/ Q' W1 o1 T! }</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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