About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ a6 _" q- R$ E2 @4 @  d% ]
<TBODY>' \1 {! `5 |: G' |+ O# G  d9 [
<TR>
& R9 l7 x  n3 l# H6 p- o8 V<TD><PRE>Method 01 * E0 O7 D4 D3 W! F2 p
=========1 J2 [5 J, @' x% h: d, Z1 G% h
. X# F( {8 K1 I! n8 q
This method of detection of SoftICE (as well as the following one) is
" y' z6 \# U5 V1 a; lused by the majority of packers/encryptors found on Internet.1 ~8 [$ B# h4 z; ^
It seeks the signature of BoundsChecker in SoftICE
  p( o; g" k, g6 Q( A* Z
# j: a: c0 P. v! b# x) ^9 ?    mov     ebp, 04243484Bh        ; 'BCHK'
( g( i8 T. m" S; T9 q! L    mov     ax, 04h
; |) S; H5 [1 d# d# }, K6 z    int     3       $ [9 a, W! A; w! f: i+ q# q8 a
    cmp     al,4
/ f& B# e+ Q# S5 S6 U. p    jnz     SoftICE_Detected( z% M# S: S* i* @& P6 J
3 U4 r3 |4 ?; U0 B2 X. f) ]
___________________________________________________________________________1 t, ~/ w9 T8 _; B: c

) r' V0 N% I$ Q% l$ cMethod 02- i2 Z0 ^; e5 e, X
=========
$ ^4 `) r: s; P+ e5 F& [4 B
3 s+ e; Q" N4 ~! VStill a method very much used (perhaps the most frequent one).  It is used
6 |* q  D# g/ N: S( L0 o$ uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,; ~* C2 Z* M. l2 {1 @* e/ H4 Y
or execute SoftICE commands...
' l2 g( P# C5 i0 mIt is also used to crash SoftICE and to force it to execute any commands; a9 w) L, V. I& D9 `
(HBOOT...) :-((  
* Q( O& O! {7 Z$ ?6 h- g) z4 S" D# B- F* ], X& [8 O
Here is a quick description:
/ a' N* x0 `& y0 ?$ A/ F/ K/ b-AX = 0910h   (Display string in SIce windows)
+ J1 F: T# c* {9 G2 n9 D7 ~) ~' v-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) H2 `- |; i9 ?) Y% z-AX = 0912h   (Get breakpoint infos)- |& {8 ^( X3 t" C- P
-AX = 0913h   (Set Sice breakpoints)
$ F. _9 g4 K5 l7 o6 c$ I/ B-AX = 0914h   (Remove SIce breakoints)
- A; P2 f% d- V6 @; R# ?' H# B8 r- v% N
Each time you'll meet this trick, you'll see:0 x. d/ j9 H- }- B" h$ n! e' h
-SI = 4647h
& w+ S5 F0 v8 r8 w+ c2 ~1 K! `-DI = 4A4Dh
$ u: ]$ ?+ m  o! _, nWhich are the 'magic values' used by SoftIce.
) x7 w2 n  S# S) R% VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 f- C! M* V/ u; G0 M
) F) C- D8 F- b) \
Here is one example from the file "Haspinst.exe" which is the dongle HASP
8 U6 Z8 [$ V8 h; mEnvelope utility use to protect DOS applications:
# ]! t6 X3 _  s" l! d5 z5 I$ a/ e7 H2 C0 I) ]3 i) L4 x9 Y: P
9 M; j" [) ]4 w6 S1 H4 B5 P9 ?0 _
4C19:0095   MOV    AX,0911  ; execute command.
& v6 }: }7 t1 a! V4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 u# d2 `% g1 Y; |) _
4C19:009A   MOV    SI,4647  ; 1st magic value.
7 q1 a' k, \( j$ u4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 w7 O0 X9 t, E, y0 Y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 q7 y8 y& G% K/ B  n5 d
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
8 [2 J9 o, C9 [7 X& o( r; u4C19:00A4   INC    CX
8 b) @  C# t% W6 R9 j4 X4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( F8 Y6 l' o5 J3 W0 F
4C19:00A8   JB     0095     ; 6 different commands.2 M6 w6 m, T% n
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% h' t: w. ^- `' `4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 }9 D  Z* D3 J1 m! G# z8 V$ i! N3 x3 K# ?6 j. p
The program will execute 6 different SIce commands located at ds:dx, which) f% G. ]- v/ g; g8 X$ Q
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) n$ w9 z, e; n" P  f4 |0 h. K+ `7 ?8 b+ p
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
( G: {/ [3 C& Y7 _/ @7 [___________________________________________________________________________# Q0 i3 ?4 C0 f) Q. |" W% z8 ~

4 H9 G* f4 a" m0 k+ k
) H- O; h% C) O' QMethod 03
+ P# l! i7 e; Q( _" d! f2 F6 d1 v=========
& `7 |# o8 L& G" O  }
  b- H! m! h) B: c# u3 g6 b8 e- BLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: ?: x: n' Z; ~* r9 P" K2 t
(API Get entry point)  C2 O& A) z9 t# M
        " H5 j3 z5 A  V; J  l, k* u* [* ]
4 G# k  [* N3 i) L  \
    xor     di,di* J2 ?- Y0 d/ c, F& }# n* M
    mov     es,di. R4 I9 n( N* k) p, v% J
    mov     ax, 1684h       # N4 T. {* U9 I, b3 c7 Y3 [2 }0 w
    mov     bx, 0202h       ; VxD ID of winice
% I+ j/ N9 f  _9 ?. ?- D    int     2Fh
& M* u/ v# w# h5 B) n    mov     ax, es          ; ES:DI -&gt; VxD API entry point; e; u6 v* Y+ K. c
    add     ax, di
9 x7 U9 E3 e3 ^5 a2 o    test    ax,ax' |: C) b0 ~9 e* C
    jnz     SoftICE_Detected! n: G. r8 h# B# i" j# h
& g9 i8 ?$ W  c1 v. W! p3 Z# a
___________________________________________________________________________
" I* A' W+ n! q! ~7 J" t5 b
" M) K+ @6 S9 |Method 04% h' M& ^) S2 u% V! U7 F
=========2 c6 n( E) I" H  w2 l4 u+ I7 w- C

8 `" I: w$ d& ^2 ]( h$ _Method identical to the preceding one except that it seeks the ID of SoftICE
( K% Y4 V5 N6 pGFX VxD.
# G/ [, D! P/ M; V! ?& D; h3 H7 @! ~# v1 g& Z3 k
    xor     di,di
( w) D/ w$ f. \' v+ P    mov     es,di
1 R* r4 F1 b; X    mov     ax, 1684h      
. C2 b) ?# I3 h3 W; V5 a% V    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 Y, s8 ]' P- w    int     2fh
8 f" n: G% {$ S9 n9 @* X, l    mov     ax, es          ; ES:DI -&gt; VxD API entry point: U3 \+ e4 b( B6 I5 t2 H! U
    add     ax, di
5 \7 i! i; z$ q    test    ax,ax! z2 q8 F  |! W0 `2 X, N% y3 n
    jnz     SoftICE_Detected. b1 i' @% a" W0 p0 F

: v5 T0 b& C: A, [9 e0 T# t__________________________________________________________________________+ }+ n# y- L( Z! D! |2 Z& Q: E) z
$ X! G: l5 @/ }
# d" F' g. Z# `7 ?
Method 05
0 L; A7 j8 ^$ N7 ^6 d1 u% n=========- ^7 j: X" b6 B, o" [/ _! Z

* p' s; w$ B5 i( \% P: G# AMethod seeking the 'magic number' 0F386h returned (in ax) by all system
% y9 I) T, ^# c1 z  Cdebugger. It calls the int 41h, function 4Fh.
2 u6 \. S  ^/ w, R" H8 E! |7 KThere are several alternatives.  
, @  r- D, j7 Q6 J4 R" X/ l  W1 V% V% R$ i: W
The following one is the simplest:! Q* C9 @3 v0 q9 C
" V" I) _$ k2 I1 ~6 P8 m
    mov     ax,4fh7 s0 E8 g8 C$ G7 z8 i/ e
    int     41h
) i( i' o( c3 u) b% i1 d    cmp     ax, 0F386, ?5 T/ e; |* W5 o! J
    jz      SoftICE_detected
/ G; L4 y( P6 _3 F7 M# s6 s' c  v, G! O+ p

$ {- {6 F: l7 j$ |Next method as well as the following one are 2 examples from Stone's
/ H) `( U' h# i2 }"stn-wid.zip" (www.cracking.net):! r4 `5 q, F  M4 ]  P- U5 L" O
, }: x8 z0 \" L+ r
    mov     bx, cs& y7 Q6 H; W+ ]
    lea     dx, int41handler22 j  t' `7 X0 J# {6 A3 V  {4 N
    xchg    dx, es:[41h*4]
# X  E% ^. Z5 c' d    xchg    bx, es:[41h*4+2]
, e3 ?) m3 t2 r0 ?4 Q) ?' p3 H    mov     ax,4fh
1 r: o) _: x/ V& k* ^1 Z9 `    int     41h; k; D# X" ^. _& _
    xchg    dx, es:[41h*4]: x' A% N& T% O( p4 I0 P
    xchg    bx, es:[41h*4+2]( z' Q( o2 g# |9 S
    cmp     ax, 0f386h
4 Q3 V2 E2 y0 ]5 R+ j7 m    jz      SoftICE_detected
* N0 @5 ?& e( h) F5 Y; o' P2 W1 Q8 C, |$ Z5 q' S1 H
int41handler2 PROC# e& G" o1 q  Q5 L. j
    iret6 d8 V; L) \2 z! ^* W
int41handler2 ENDP
- [; y$ e2 {6 }; v
9 x( u6 H& `& |3 ?: t; |, B
9 [" O7 n9 H! l" a3 W. [0 |3 p% B_________________________________________________________________________0 T' E' H5 O" t$ z+ v& ~) ]( v
- _3 n1 Z4 O; Q  \9 g
. B: d9 D& k, M. V( u5 `
Method 06! V# N/ k+ L" ~; S8 v! C
=========
! N- A2 G# Q. E' r7 \$ G: L& c! {! e4 w5 ?* k( M
3 v$ v+ j- B% x: X4 U/ f
2nd method similar to the preceding one but more difficult to detect:
  F, w8 {5 U# @  f4 A4 u2 j% v, C. s  N* `9 l( ?  K4 I

8 U+ t6 @* g; h# ?% Qint41handler PROC$ B) f" |% U5 O
    mov     cl,al
# _5 s) A& X5 b9 k1 D7 |    iret1 d% f& q  L( w' @
int41handler ENDP9 V2 f; J) _- a$ V/ U5 U  ^

8 q/ p( l% `  T* s6 r* b5 B$ n2 {) ^# C2 P) l+ `* J3 U! V
    xor     ax,ax
: R  o& j8 S% V8 J; t, x0 b, S    mov     es,ax  C% h7 G( R1 v- s6 b, I
    mov     bx, cs# ]3 z$ r; H9 v& k
    lea     dx, int41handler& t$ T- Z- w5 H' Q
    xchg    dx, es:[41h*4]
" B3 }" k9 K+ f    xchg    bx, es:[41h*4+2]
! c! ^) w7 u3 `- _7 s    in      al, 40h
5 y; u0 S* G2 A' {( d    xor     cx,cx. e, n1 F1 S; t
    int     41h& o5 B/ S* Q* w- d3 K
    xchg    dx, es:[41h*4]
( ~( o( w" {1 o- w* j9 L2 u1 ]2 [    xchg    bx, es:[41h*4+2]9 p5 ^8 f; e: l# B
    cmp     cl,al( I8 Z$ E0 z- j& |8 M7 m. c6 {
    jnz     SoftICE_detected
1 L" v8 V; h: f2 ^& _/ e3 I/ }4 }, f2 D( p# m: J
_________________________________________________________________________
, [# j8 I7 M" f
% |( N/ I7 C  l4 z* p" E8 MMethod 07
- V7 I$ o1 X* \1 ]$ A4 A* G" L=========
0 f. B0 ]# d8 f7 W+ e
! G, p5 O/ {4 ^+ ^9 @5 _& E  e" \9 [Method of detection of the WinICE handler in the int68h (V86)
3 x3 y3 e) |1 P; x. V/ t
( \0 B: V2 u2 P    mov     ah,43h
2 m, a7 h3 z: M6 q/ i: m    int     68h
( b# L+ G5 ~+ N- o9 N# X    cmp     ax,0F386h% M' d# b, o7 y" b
    jz      SoftICE_Detected3 \" ^' W9 w! E0 n" q7 f" t& S

( E- _' M, i" u4 q3 c% R
. u8 b* t( }( \# p& B- d=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# x3 P# B3 i: n  n, X" N   app like this:
- _; {8 v- J! i# g+ c# ~. c! O. k  v5 r) V0 l3 R6 s
   BPX exec_int if ax==684 K# H7 L8 ^7 ?* ]
   (function called is located at byte ptr [ebp+1Dh] and client eip is
- t6 y2 s# T2 k7 v: M   located at [ebp+48h] for 32Bit apps)+ {  K/ |$ X, p- |8 j/ b$ i
__________________________________________________________________________% o) J' T: V1 c! M( W8 n

& }9 o- i+ A& A4 [  M5 y1 l
! {2 f' ^# s1 FMethod 08. [1 h+ W' J* ~0 q2 Z. K# f
=========. o9 \" a6 n* A8 s7 R

( k& L0 S" l& EIt is not a method of detection of SoftICE but a possibility to crash the
+ ~& k, x5 Y9 ?+ b7 }! n% Usystem by intercepting int 01h and int 03h and redirecting them to another
% O6 C  [, [' r$ j' a3 Iroutine.# U" S  N, j& j3 m' o
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, K1 }0 q  C! U$ hto the new routine to execute (hangs computer...)
5 H# ?# D" R( G' H( i5 l/ R: I7 p  _& `: ?, q
    mov     ah, 25h
2 a5 s6 j. e3 ]    mov     al, Int_Number (01h or 03h)
( y2 J+ f# F3 R    mov     dx, offset New_Int_Routine
. j" D# t6 a7 Z4 n& O4 W! A    int     21h
; {2 l; }4 r0 @; F9 z/ k" e4 v( b/ l% U% f6 D: ]* x0 k
__________________________________________________________________________8 i5 ?7 B- q3 V% F4 s) b
4 D' w. g1 {* f& b7 Y, o) J
Method 098 D7 F# A2 H$ p! M# r5 X$ N
=========
8 D; ]3 |+ R# Z6 c2 I, G1 `( F7 d( d* @  x+ d
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% p! Y( |# j1 e& J  P- {
performed in ring0 (VxD or a ring3 app using the VxdCall).
: `- \; T& e* q* rThe Get_DDB service is used to determine whether or not a VxD is installed1 ]: Y3 z+ |3 W6 p" C" @1 G
for the specified device and returns a Device Description Block (in ecx) for
- X* T) U' }+ j2 e* n' f5 Athat device if it is installed.8 d9 D: {! Q+ ?0 M0 q, Q# X- [2 H

$ G- ^! m8 J4 K4 \   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& u  }6 q- ]3 p+ W6 c% b$ P2 Q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ _. D4 R1 y8 A; z7 _- m
   VMMCall Get_DDB
/ K  g  d! _  @1 n- n3 G   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: C; j. K3 M' e# |" ?/ M+ C8 N% ]
0 l" U- s# Z6 _" H. Q+ ?+ h/ T' UNote as well that you can easily detect this method with SoftICE:% o, b) K6 }: N# e+ ]9 K
   bpx Get_DDB if ax==0202 || ax==7a5fh$ G5 S3 ^; y) S, X& c6 [/ J; S
9 |6 n, M: s9 [0 W0 i% w7 @# r$ @
__________________________________________________________________________+ B4 f8 A$ n# K9 Z( U$ |  v
0 m! j; T& d! H7 Z
Method 10
" B: G  i5 W$ E=========& Y% B! B; i' Q$ L

1 }( r. R" U8 _3 z  s=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ M5 A  z6 x9 A
  SoftICE while the option is enable!!* s3 i5 O. c* e% a

8 I4 H) O0 t5 }This trick is very efficient:
0 }3 k! ~2 ~: k' Q" Wby checking the Debug Registers, you can detect if SoftICE is loaded* J1 g1 X* E( e" r& _, D1 z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if- Q" Y3 L$ w" ]( w
there are some memory breakpoints set (dr0 to dr3) simply by reading their
8 @  c# n" V. P2 {value (in ring0 only). Values can be manipulated and or changed as well$ L) c( \4 P/ S0 r2 v) F6 b3 I
(clearing BPMs for instance)! D! ~( K3 n% C7 b2 P* @! c

/ d. O# ]8 x2 C* D__________________________________________________________________________# U' [. p1 }: E  W8 E2 r! I

6 {: M' g& m0 s/ }$ w5 h& [Method 11+ @; u0 I0 V. R2 q  _4 L; u0 J
=========! L, C( P  K. Z* p) @0 V: C
1 g3 a9 D7 ?: i* {* v6 \+ n) v5 u
This method is most known as 'MeltICE' because it has been freely distributed( m' t- u  b1 u8 {# z
via www.winfiles.com. However it was first used by NuMega people to allow, q; y1 b' C; Q4 i* x
Symbol Loader to check if SoftICE was active or not (the code is located
% n& M7 a1 Q* A- ]+ c6 N. hinside nmtrans.dll).6 B  a) Y1 v( ~% _( X

2 t9 \7 v! [  @+ wThe way it works is very simple:: i$ B: k" K( y2 r
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for, ]# l; C! w  H: M
WinNT) with the CreateFileA API.' W5 D8 S7 ^* V" ]2 [

! ~) b, Z7 s$ \! \/ p3 q# KHere is a sample (checking for 'SICE'):, p' r" O; i# U2 I% G1 {+ a9 M
' Y8 M4 ]$ e2 o; c3 ~1 r# @
BOOL IsSoftIce95Loaded()
3 X7 ]* T* j' b4 U% g{
' _% p+ \9 \  B% l1 N% {1 J) p   HANDLE hFile;  + S/ U" D$ X3 W4 J, G) G1 O2 Q0 @
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,, v9 }* E! z, C/ G
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
3 T: ]" s6 ~& ?- w: o+ ^                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 M7 ]% c3 ?  S2 A% I
   if( hFile != INVALID_HANDLE_VALUE )4 C1 ?  @- Z: G
   {
6 ^2 M+ j8 _- o( B' [% }" d      CloseHandle(hFile);( h/ A* a: |9 h2 `# O
      return TRUE;! v( z  U0 B3 N, P
   }4 n. M* L+ `: I) ^$ |5 b
   return FALSE;
% M6 l" X  r% y9 K9 b+ [# S}5 q4 a4 c& `4 o" }% @
( n1 `1 B, T9 K( s% V4 }
Although this trick calls the CreateFileA function, don't even expect to be
2 p( d4 \* D0 H8 W4 iable to intercept it by installing a IFS hook: it will not work, no way!
2 I7 U  \* C6 t. r: g: D5 s4 EIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
, `8 U+ t9 l3 }. U( u- dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
1 R( l' Y& L$ V4 m3 O- L* ?4 band then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 X* G8 ]6 H) ^6 Hfield./ S: U4 E* C0 i9 N# D% x! i; ~1 T" Q
In fact, its purpose is not to load/unload VxDs but only to send a
, K& _5 C3 E. Q0 _$ K. i( NW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)5 e7 i" s( g' ]) j6 Q8 Q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try0 J: c7 g. z; B/ A3 M' ?8 w5 ?1 W7 W
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 q7 p3 U  I0 M6 T  X% XIf the VxD is loaded, it will always clear eax and the Carry flag to allow
- a1 |/ H3 F& U/ U! Mits handle to be opened and then, will be detected.1 V: J: ~! ~( [( S7 v
You can check that simply by hooking Winice.exe control proc entry point
" ?3 o, S: ~5 F' J) D4 A' Ewhile running MeltICE.
, u9 ~8 `7 @8 h+ ?( q# T$ K! N8 K
& ]' J/ z/ I- Y: G* n0 B, X
' p" H1 V0 O$ v  00401067:  push      00402025    ; \\.\SICE' B# b, P  o+ V. P" e- h
  0040106C:  call      CreateFileA, D) }" E# l; i$ T* j
  00401071:  cmp       eax,-001
# `+ C8 X- ~  ~( K% `3 d! ?0 V  00401074:  je        00401091
/ g# o* t1 t( j# E9 }3 t% m: a( p: g1 J8 i# r6 S

3 M2 k8 ?( `3 A+ K& GThere could be hundreds of BPX you could use to detect this trick.
! g7 J, b9 i8 ~  R. M8 d' C-The most classical one is:
' i3 \$ {* f& S+ y7 [9 k  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 }5 f( U9 l( m+ V' v6 i) `    *(esp-&gt;4+4)=='NTIC'
  w2 C/ H2 f& ^( x; e# y" [% E0 b1 q' J1 ?; [
-The most exotic ones (could be very slooooow :-(- p+ b3 @$ Z' H
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! I( z. Q* D; f* a% n3 V
     ;will break 3 times :-($ u9 p! U7 j( |& @: y  X
6 |/ F% ^8 N, F" i5 y
-or (a bit) faster:
7 d+ ^( D( \/ X7 I1 f   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 ]% E) ]. S7 h: O3 D* x5 n
- n% F# f" _0 c% P' T
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
$ o3 E  A% h2 C& M  [, [9 [- r6 |     ;will break 3 times :-(
, y# j4 Q9 j+ i$ j& s* S5 Q4 w
$ W1 ^. Q. I- J- S7 J-Much faster:
! @0 r" I" i  V   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
8 e, Z' c# {5 ]8 ~7 i3 a! Y; x, p3 G- Z, {9 n+ m1 Z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
# a/ c# ?: c7 f4 L4 o# lfunction to do the same job:
" Q: {! b; o9 y% p+ Z) I2 j  w- W. k6 X6 D! O4 k
   push    00                        ; OF_READ
5 z5 w' }/ r1 ?8 X8 T  _7 `   mov     eax,[00656634]            ; '\\.\SICE',0/ V8 Z; M2 ^$ }8 Z
   push    eax/ V  U8 X+ c* Z: ?: G$ G
   call    KERNEL32!_lopen
8 e+ k1 h! `$ V( b   inc     eax$ N1 Q  W3 r. G8 z8 h, w+ T
   jnz     00650589                  ; detected
0 C. E1 |: O; a; I   push    00                        ; OF_READ2 x& V# \5 T$ i5 Z+ L$ |7 |
   mov     eax,[00656638]            ; '\\.\SICE'
" c% ~  r4 _# p& y   push    eax: D! l. d* S) |! ]+ M1 e1 F" y1 E
   call    KERNEL32!_lopen
+ Z. M+ j; Q- r( r6 |& l   inc     eax
; j8 ^: X6 p8 D5 H   jz      006505ae                  ; not detected& G3 J# j0 z" e1 S0 L

  G( Z" f5 F4 r1 m8 g" m( @4 K5 k: H
__________________________________________________________________________" m9 e1 ^  v4 C3 |5 x/ v

6 G/ w! \5 |% Y' @# W" B: H: D  KMethod 127 o, ]! @2 `8 ~1 N/ {1 Q  c* l
=========$ W* v4 L6 _$ a. _2 N

) q* ]9 D& g0 f& B! MThis trick is similar to int41h/4fh Debugger installation check (code 05
3 |" q  A4 n) u( V. x" x. H7 d&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, e1 N7 m, n+ u2 B$ I. Y. D4 Was it uses the VxDCall backdoor. This detection was found in Bleem Demo." d- F8 b' H* f! z0 A# E) c* d6 h, t
3 I, `$ Z  x! n, M4 R! O/ o6 x6 O
   push  0000004fh         ; function 4fh
: b. |' F* s, l& ?  q   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 q9 j% [" Z* u: @                           ; low word specifies which service
' i3 d- |2 O& Q& f/ V* C                             (VWIN32_Int41Dispatch). H- ?9 Q0 w  C7 J) l
   call  Kernel32!ORD_001  ; VxdCall/ o& Q# a" K6 t$ }& k# V: b6 p3 _
   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 u0 g3 @0 R$ B' \% p0 N; O- |/ E* ]   jz    SoftICE_detected
' p5 M% h) z: v+ P' J; Q
, o* v# Z: [8 uHere again, several ways to detect it:
; S! S! ]; t8 E! P+ \1 i# Y
0 F8 i# p" \/ G9 M1 R' w# u: o    BPINT 41 if ax==4f, I' u4 m  Z4 z" B& U; J* s

3 h; e, m; t$ f9 r3 R. i    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) \* p5 ^0 D* L: {. F: q6 s5 _. F$ ?. q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
+ Q) A. Z% o1 g: r4 d0 l6 O) a2 H2 I) s* X2 @
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
! A8 g, [& p6 ?: u/ N8 X/ o* O  M9 X. ]; G. Q0 }
__________________________________________________________________________
; d7 b8 N' j4 G
: G0 m: P% c0 i' z* fMethod 13# A9 U, G8 d% Z6 N5 L" b0 X
=========
( |8 N# {/ V! A9 g! H, q% H/ ?2 p' @! a8 R- v5 N# S
Not a real method of detection, but a good way to know if SoftICE is+ E% m6 D' p; d' u2 N+ l" |
installed on a computer and to locate its installation directory.
% \+ g* V9 N; DIt is used by few softs which access the following registry keys (usually #2) :7 k& Z) b7 K! U# K/ ?& S# S+ w

5 t8 r- x! R+ Q$ n3 ~) d-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- z* Z) R. j4 s: e: X\Uninstall\SoftICE5 k" o6 k3 a) n$ @7 A! z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE/ }0 X& P0 k6 t
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# }  \) z3 N; j$ H\App Paths\Loader32.Exe. h+ H! D" R$ e) `6 ~% |/ l
/ y1 z  {0 N+ @9 a
+ Y, z5 O. ^0 k' K/ Q! S" m
Note that some nasty apps could then erase all files from SoftICE directory
8 r7 R0 W8 ^" {(I faced that once :-(! f% g) _- U! T8 O+ }; X. b% d5 N

4 ~7 {( E, Z0 [; m4 p) y: IUseful breakpoint to detect it:
7 {. j6 h9 T; j4 ], `2 U  Z- O( L7 t
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 b7 ?7 V3 |; @1 E4 k

( W5 j! ]; N5 Q4 y7 ]__________________________________________________________________________: R) W  ]: K* ^3 o, O

/ |5 v2 O8 U7 P2 v5 |
, q1 M4 u% p2 s* s" DMethod 14 0 j+ O! u* B) I( b  @5 X- l
=========
1 _$ C  [; w7 t9 _, }3 p* M, X7 @5 b, K( k  A  @/ G# d' t+ @
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; r0 ?, z: S) I5 o: Qis to determines whether a debugger is running on your system (ring0 only).
0 y% x9 n/ E. m% ^; o1 d/ v+ z- ^$ q0 k# F1 Z% M, v
   VMMCall Test_Debug_Installed
  V4 n+ K- }# M0 u   je      not_installed
) f2 j- e4 K, k* `/ C' S8 o
, G/ x* ^% r9 tThis service just checks a flag.
3 F0 V  {9 t  l1 B* b( W! q; g( B0 Q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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