About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; L' S, ], `4 b. E5 L1 F<TBODY>; N. `) r, [) X! W
<TR>4 j: [/ r3 ?* ~8 Q, W+ b4 A
<TD><PRE>Method 01 ' F$ H( \  L1 \% E: y
=========
/ a' b) B. T) z# `% E* J% D* R! g; \( t5 l$ ^6 j  W+ V
This method of detection of SoftICE (as well as the following one) is
% `4 h5 [' C; J+ S& I/ Qused by the majority of packers/encryptors found on Internet.- k% k$ f+ E3 h* M: D6 G2 }: g8 w* v" v
It seeks the signature of BoundsChecker in SoftICE5 y/ f) l* m- I$ g: O8 k% r( W
+ K7 t. E$ d9 J5 A
    mov     ebp, 04243484Bh        ; 'BCHK'  h1 X; M* t) Y( U& V
    mov     ax, 04h
" v* c: u* I8 [. X  o. w3 v$ g. l    int     3       * o: L% F$ o1 ]3 u* W
    cmp     al,4
' T8 s" J! K0 y  E+ E9 k  v    jnz     SoftICE_Detected
( M. W, [" U  `4 x$ N* c, V+ x8 b% z6 Q4 l/ ]* o# K* ~$ l" s) U
___________________________________________________________________________
8 r! c! U9 g- y' C* o+ m
9 h# G+ w0 f$ l, s7 IMethod 02
6 d9 l; n; m$ @: u( N/ _=========
& M3 \, v8 u1 D( t7 e
% [2 ~- x5 [3 m6 w" Y/ x3 lStill a method very much used (perhaps the most frequent one).  It is used
# ~/ c1 I7 b: P% {* Hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 Q* i! `# q. K$ L6 n9 ^& ?
or execute SoftICE commands...
: d% l* t1 [# t  v; dIt is also used to crash SoftICE and to force it to execute any commands  z# z! U: D9 E+ ?5 ?
(HBOOT...) :-((  
( M, h4 _8 Q) e" ~: v" Z% U3 h# L/ E" u: ?- u( s
Here is a quick description:
# U% ^, _# `# @  v-AX = 0910h   (Display string in SIce windows)' F4 ?1 o# W- v$ z% p
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 _9 ~5 u2 C3 ?% M0 c' W& Y-AX = 0912h   (Get breakpoint infos)6 z8 q: k7 [' O$ g
-AX = 0913h   (Set Sice breakpoints)
, B1 _! u: A" q* \& Y% e' X( {-AX = 0914h   (Remove SIce breakoints)
4 {, V, ?' L" a" p$ F' y
# ^) e1 S6 V7 `0 _' c1 sEach time you'll meet this trick, you'll see:
( B3 z- N/ [6 B* \0 r1 [4 i  Q-SI = 4647h
" Z& h; H! i6 Y& {/ @6 q, }+ |6 y+ I-DI = 4A4Dh
( C7 B, L, @2 A5 D! sWhich are the 'magic values' used by SoftIce.' y3 L# K% I$ g  k+ G
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 q" \; p  i- @7 j% x- W" u
+ m" ]5 b6 b, o: {7 p; b: S! y
Here is one example from the file "Haspinst.exe" which is the dongle HASP/ x3 o+ \- {5 `/ o  P
Envelope utility use to protect DOS applications:0 O3 J  P4 }7 P
- B" d2 X' W3 x' X  L

+ n+ q$ j+ R  i0 B! z  k2 d! ~4C19:0095   MOV    AX,0911  ; execute command.
) ?: \+ w3 m% [% h4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., c# o) D4 D9 a. M4 K
4C19:009A   MOV    SI,4647  ; 1st magic value.
' W5 B; ]; |( t* R* b4C19:009D   MOV    DI,4A4D  ; 2nd magic value.7 j' g- _: ~9 x6 }* `6 Y
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
$ V# z5 C7 ?4 _% q( u6 m2 N9 r4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 W2 E0 J( W0 e7 `" B' N3 D! `& l4C19:00A4   INC    CX2 n7 o* h0 i, V, W! v3 u
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute3 M$ K  ?/ p! m4 X9 b
4C19:00A8   JB     0095     ; 6 different commands.
! P# a  z  _) A  W- h4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 t: u" H: k  ]3 a! I7 v4 G4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 @- n7 F% `  B1 P* Y- o! Q7 S' q( v9 g& k
The program will execute 6 different SIce commands located at ds:dx, which0 S3 A* ~* w/ u
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 [8 F9 b4 A) v3 j: G5 r6 D: `' H$ C' {  U- R
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ b3 }3 L' G# I1 }___________________________________________________________________________# F0 K9 c8 V' m0 n/ d+ x: V
& Y3 I0 {  H! s
3 V! @2 r9 o/ W- d% Z# o, d3 @0 O( |
Method 03. W, d) N" H" f4 |* |7 e# x4 q
=========* G! y) D: }1 o1 e6 W

! V: I" C. E( K$ s  |! h! Y8 lLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ `: c  \& }6 A" _4 b8 C$ T9 B(API Get entry point)- a- E4 j6 I2 N
        
" ?$ c/ h% o! R, E
' o5 }: m' w  A( ?  t- f2 k0 O    xor     di,di8 z; _( D9 P! S3 O8 k2 k
    mov     es,di
: w8 X9 ^6 l: l6 ^    mov     ax, 1684h       , A$ `7 c' P# j; x7 N- ]- z
    mov     bx, 0202h       ; VxD ID of winice6 @- `1 Z6 |$ x3 s* h
    int     2Fh) C( @2 @" W8 z4 ~' {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( K3 E' A: Y# E. _! e
    add     ax, di
! Y4 R5 ]0 ?1 ?" R  v6 K    test    ax,ax
" p: d4 d$ C, H3 k  I% O    jnz     SoftICE_Detected
: C, z" z) X; {3 O
; M, K! D8 s% X6 _8 m3 m___________________________________________________________________________$ A+ c6 w/ G# z4 _/ b1 ^7 O

! _. s1 p. d. z; b3 v; w( u* C1 QMethod 04
- E- |# H1 {8 A# P5 I$ ?# ]8 K=========
4 n* @1 F. c  O$ c$ j# j1 Y* I$ f' `  q' R
Method identical to the preceding one except that it seeks the ID of SoftICE
7 E9 V8 F- Y2 N4 Q! s5 t. ~GFX VxD.% \8 s9 k; O* A4 x
5 o8 O' t4 b" T
    xor     di,di
/ @1 N' a+ R0 D2 K+ ~6 O% v. @    mov     es,di
2 O6 k& c) L* N3 C; F9 p& u4 |# D    mov     ax, 1684h      
& l! A% j- W; U" N4 y2 s    mov     bx, 7a5Fh       ; VxD ID of SIWVID
/ \* b0 ~) P! e    int     2fh
( r2 F: f" z2 {  u, `) t/ ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ e# A7 C; @7 l# @. U8 g& W    add     ax, di
3 r+ u/ a3 R: c7 ^4 E    test    ax,ax
# W7 R* n4 i+ y9 y+ x5 H% \2 `+ o    jnz     SoftICE_Detected
& P' q$ c% j& {* y7 I$ z* f
  u% q7 g& S2 R__________________________________________________________________________5 ~6 Q' F) R- n  A* r8 j

! E6 H" p0 K( I5 p1 @  `! n7 G+ x, D" D9 _9 A' I) {1 l& b
Method 057 r1 k5 G* X4 S
=========# Y7 H4 F+ c4 ~$ O
5 b/ k* S9 U3 y# e
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 e$ c# p! T2 U  n2 {
debugger. It calls the int 41h, function 4Fh.
" G# H, r# ~' K: K8 [% d5 nThere are several alternatives.  " J# o, C8 w5 F" q2 A
6 ^# ~) E8 N3 u( `" t' z
The following one is the simplest:+ Y2 H9 w. J5 G# S* X! \; E

1 h7 _  S6 v3 |4 K& {    mov     ax,4fh
: E" p% Q0 k4 b. [% Q# v3 b7 I    int     41h
! w4 C* j1 O, e1 V$ F/ a' z3 i. u$ a    cmp     ax, 0F386! b% u  w* [9 b
    jz      SoftICE_detected
: n+ ^3 U8 `: d
' M" Y% {8 ~# g6 z4 }' b3 \
" I7 j1 U; z/ Z! |* K5 [Next method as well as the following one are 2 examples from Stone's
6 [: I/ Z) _  D0 l"stn-wid.zip" (www.cracking.net):# m. h1 W8 ~$ N' T
# O( o' e# [4 x) C2 V3 ^
    mov     bx, cs
7 [$ [' ?3 k  A3 ^! u& y    lea     dx, int41handler2% ?5 U0 S# u' T) X% Z, Z1 n
    xchg    dx, es:[41h*4]
4 A1 W" O. U7 q) J$ O# g! h' }+ _$ g    xchg    bx, es:[41h*4+2]
, ?, \: P7 S  j; ^    mov     ax,4fh# z: r% _# i& R6 `* D
    int     41h
/ w: y; d9 l0 v/ W! u, ]& b- y    xchg    dx, es:[41h*4]  P) {: r, q$ o# L
    xchg    bx, es:[41h*4+2]7 M% z( W: e7 C* k
    cmp     ax, 0f386h9 J/ k- }3 g+ I* m4 X
    jz      SoftICE_detected: C5 E0 Z; Y, b# @- o

* m0 s* c: ^$ n7 ~: Jint41handler2 PROC
; I0 Q/ d! T/ F6 ]. o    iret$ l- u; b2 a. r- ?
int41handler2 ENDP9 ~; j& |6 y( d, k. f

* F) B) N6 E4 S9 Z- G* N
2 D4 I" C; G; p6 ?/ j2 O_________________________________________________________________________
4 l# `+ ?0 }' K0 F" D
( g* E' J9 C/ g( K: @
' r  ~& v/ A/ Q' w0 ?( }! PMethod 064 k: m4 R1 J( C5 n1 b0 s/ V: \
=========5 q! W* G& r, U5 Y2 ?+ ~4 U2 V# {

% A3 {/ N. W+ c) G7 Y( M
4 g2 }+ }3 U3 j3 n  s1 T2nd method similar to the preceding one but more difficult to detect:( m& R7 t& b: o& M
( H* Z1 ^+ i5 ^! L; H9 {% x; O
& s9 K4 t3 C6 m, w4 v8 h9 u+ a" d" q
int41handler PROC
7 H8 Y: f4 I! K    mov     cl,al5 p1 b2 b: o$ A5 ^
    iret
5 c7 w/ Z) z7 h' a; n; _int41handler ENDP
. }3 j6 w5 I& Z" k- n, D  N" ]1 s# T3 b7 v" D7 h. S
% N6 n6 B! S  o7 W3 o* Z
    xor     ax,ax; ]& f0 s4 M5 F  ^
    mov     es,ax
- ~# y0 M3 k0 w+ V    mov     bx, cs6 O4 P% Z+ e2 G
    lea     dx, int41handler
' }3 B6 `  g3 F' @1 I3 V0 h    xchg    dx, es:[41h*4]. C0 B( }' a# G  n" X- `
    xchg    bx, es:[41h*4+2]
/ I2 R6 X" b* q5 i3 U    in      al, 40h- E8 ^0 j9 E( U  s7 ?7 }2 O
    xor     cx,cx
7 @, c% m/ l* v# Z: R    int     41h
2 n5 ?! }2 H8 i    xchg    dx, es:[41h*4]% r7 O+ S' w5 r* j8 a# o: {
    xchg    bx, es:[41h*4+2]- g2 x1 t9 i, G* V& @* l
    cmp     cl,al1 S) Y3 D- U. t' ~2 z2 w
    jnz     SoftICE_detected
4 D: b7 z0 f! g+ v; i$ I
  ?9 n: F- F0 f- U" k_________________________________________________________________________
5 U! [0 C7 V9 Z7 ^( G$ d% g" ]* E0 K$ z5 g: |
Method 073 V8 c6 y! |& K$ H% S
=========2 d/ {" I8 e( `+ v- d
' g- r+ h  y/ v! P) p8 d
Method of detection of the WinICE handler in the int68h (V86)
% p  {' f' }9 z* J# e2 ^7 o, R9 R5 K4 S
    mov     ah,43h
1 O1 f# i  j0 N+ m    int     68h" t. l+ t% c: h6 L% t
    cmp     ax,0F386h' R& i) {( T. }& |
    jz      SoftICE_Detected
! E: E& m8 ^4 m7 V. W/ u- c5 ^. K. [% }) h4 S* T7 H# q! B
5 b1 F7 Z: _8 e: v9 o! f( o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. C  n. k% U1 m. q' q9 x6 G  E   app like this:
- N2 X& h9 a5 V0 N! q5 g9 m& B
' U  X2 q: x3 w  O1 K+ n   BPX exec_int if ax==68
. ^' U: y* M' S$ ~   (function called is located at byte ptr [ebp+1Dh] and client eip is0 T' X9 T- z$ G0 X7 `" R1 V
   located at [ebp+48h] for 32Bit apps)/ z2 \! F1 ^! f* n# h, S6 _
__________________________________________________________________________' |2 d+ }* P8 g6 y* }! I" i6 X
2 P5 @0 W% w1 y( `- k( _

  X1 n- k% t# W4 l3 R$ p5 eMethod 086 n% a3 D. D3 u- S" G( m5 r
=========
0 F  V3 A9 ~/ g# L0 g& N
" K8 {- w9 Q  D6 y, X; bIt is not a method of detection of SoftICE but a possibility to crash the
; S# q6 _) R5 J# ^. C' Q4 xsystem by intercepting int 01h and int 03h and redirecting them to another' R3 r% v/ f) u  C! X
routine.
" m( q3 S+ v$ aIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 G5 S/ M1 ^. f( L9 u0 J" bto the new routine to execute (hangs computer...)
3 J1 O3 ?; ?, R/ ^: q! V* W9 p0 ?: M4 C' Q" a8 E/ `9 X
    mov     ah, 25h
0 z5 M: A" Y& }+ f  D    mov     al, Int_Number (01h or 03h)
) |; w, p- Q+ P# y( r    mov     dx, offset New_Int_Routine
9 L' _/ |3 T5 f5 M: K( T    int     21h9 B0 n7 [$ |2 p  v

+ N$ o& b$ H- }9 L' \, A  R6 n7 h__________________________________________________________________________7 I* i" A5 u. g
/ ]' x% i, F7 N; `6 b
Method 09
* Y. n7 }5 E7 b* Q3 w+ y/ ^" ^=========
- t1 i/ G" E( n- B+ {9 p5 _6 l5 w3 O6 R( q- W. B2 k( F- m
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 ~7 R  ?4 w! I; R1 ^
performed in ring0 (VxD or a ring3 app using the VxdCall).
. n: W8 N# o" \; f( i! YThe Get_DDB service is used to determine whether or not a VxD is installed4 U0 t7 ?  p/ d$ E* C3 n
for the specified device and returns a Device Description Block (in ecx) for
( a& B4 a. i# w# F0 U, A0 {- Kthat device if it is installed.5 }% J( i% U# Z: l9 c7 W7 v3 R4 [( I
9 b4 N& j; A, N: x0 f
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! A: I1 ?& I4 V  p2 Y7 f: o/ K   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% X- A) O9 [5 y4 ?6 v2 C9 i
   VMMCall Get_DDB9 f3 B2 G+ c* S7 i( K' s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; T  S! b- H$ @, Y' V8 w; W0 e* I9 q% N+ [! L# L* g6 x( I& A
Note as well that you can easily detect this method with SoftICE:
, i2 U6 U2 K  x   bpx Get_DDB if ax==0202 || ax==7a5fh
' ]. _2 i. k  c4 [! r" c2 i& w! y! `7 n7 ^: Z7 s# K
__________________________________________________________________________
( R( B' \0 K- ?- D0 t8 A' V$ ^$ U; F1 F! C) _- u8 f/ K
Method 10
- Q) V5 y! Z- L1 J$ g9 c=========
; H, G( y3 V( r" Z  x/ b
; v9 U. F  p( \9 l" x0 `$ h+ U=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 H/ k( `& @8 x3 ~8 t9 D  SoftICE while the option is enable!!0 X+ {; e! n- R- `$ |
' O. a  g, w3 N* D
This trick is very efficient:
( V  ?9 v) Z* t2 c5 i" C' ]by checking the Debug Registers, you can detect if SoftICE is loaded1 Z2 R; o6 {8 Q8 m* b
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 k% h# S( z3 c- D3 {there are some memory breakpoints set (dr0 to dr3) simply by reading their9 v/ c' o" a8 W( _4 f4 Y* ^! S
value (in ring0 only). Values can be manipulated and or changed as well; L8 A) P4 V; [: ?% v9 C4 V: b
(clearing BPMs for instance)
7 Y" @1 I5 ^/ b% M# q
* n5 w* ?9 U: ~9 O__________________________________________________________________________
) }9 J3 ]6 W0 J* A, y8 v5 r
, B6 b7 i$ C+ I  K9 BMethod 111 e1 }# a7 a. t4 V! B! m/ b
=========
  P9 T  h( N7 m- j- A1 u" P. ?$ I$ w9 }* S$ I, ~
This method is most known as 'MeltICE' because it has been freely distributed
1 z  x: P3 k8 h" b$ w2 O  avia www.winfiles.com. However it was first used by NuMega people to allow- V& j4 r8 H3 H
Symbol Loader to check if SoftICE was active or not (the code is located
' r9 {) T- ^' P, ~9 i0 i6 einside nmtrans.dll).' w8 C0 y( Z. O1 ^- {. B/ E0 n

# F% E% b& T) B/ I9 PThe way it works is very simple:; t8 M& V! a" t8 ^5 f& w
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) |% d' l7 p2 z
WinNT) with the CreateFileA API.
" x8 Y1 R# k; r; Z5 f2 |3 k& Q7 j- e2 G& s# [; H+ p- U
Here is a sample (checking for 'SICE'):, z7 q  W6 M5 B5 g9 v
5 ?& r9 |5 s. a, o) L4 \
BOOL IsSoftIce95Loaded()
0 [% S- R. ]- E( s. I. I{! f& _( H* x% R7 b
   HANDLE hFile;  
6 ], s; Y$ g0 Z$ ]" z9 B: K   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 L1 |& ]8 O8 Y& {2 U% M: S
                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 H) ?$ n7 {& P, Q- {' Y8 }! t# c
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" B. s+ Y) J/ D/ H! b   if( hFile != INVALID_HANDLE_VALUE )
) X# _# x4 z, M   {
" u# `6 r& o- v) {# Z) e5 C& U7 J* K      CloseHandle(hFile);/ g' k' A* N2 i- C6 V
      return TRUE;6 c$ K* Q! G, e( v& E, }
   }" d" [6 N) V) e6 U9 C/ x) U9 w! A
   return FALSE;/ K5 C3 N2 h" i; j
}# S4 O5 ~+ {" ]6 \9 f3 z: X

8 D; N# f; z  Q/ XAlthough this trick calls the CreateFileA function, don't even expect to be. s3 Q* V" x+ }5 F: a# N
able to intercept it by installing a IFS hook: it will not work, no way!
& s+ m) [# I" Z6 p9 lIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
. V/ _7 x) ]9 o* T8 U' Kservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 N- n6 @, R$ i3 N( Q4 M7 pand then browse the DDB list until it find the VxD and its DDB_Control_Proc6 @  B' F1 `/ B6 {  t/ C
field.
/ c& d6 u  g# f2 i( H3 QIn fact, its purpose is not to load/unload VxDs but only to send a % ~, g, n4 N; s+ E6 ^  H
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 w# @9 y* X7 e4 w% yto the VxD Control_Dispatch proc (how the hell a shareware soft could try4 I+ m, t! B: b& ?5 S# w0 J: Q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 n. h* ^9 u* m. U7 ^
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 m! n  M7 k5 b+ ]) F6 U
its handle to be opened and then, will be detected.
9 H' i! d9 r' rYou can check that simply by hooking Winice.exe control proc entry point7 D" C  ^$ D  {
while running MeltICE.. Q- c6 c9 }1 x# B- R/ s0 X

4 i7 K9 W! J  n& v: ]4 U
5 S* a; E9 `7 k! x+ ^  00401067:  push      00402025    ; \\.\SICE
. b$ I7 w& P4 b+ D& w  0040106C:  call      CreateFileA6 [: r9 X6 A4 q% ~4 g% u
  00401071:  cmp       eax,-001
4 U$ i( J* a2 g7 t( y$ S) g  00401074:  je        00401091
1 B5 _: L1 g1 D, n9 D1 D* e9 f# ]8 F! z4 o; K! ]$ |- b
. |1 o+ N9 m% K1 r% V
There could be hundreds of BPX you could use to detect this trick.+ E7 c, a; K2 l9 R" ^, U6 A) u
-The most classical one is:
9 t0 R- o  n* {% _0 l+ c$ F  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. g8 b& d4 _, n. @2 S5 C% ?" \
    *(esp-&gt;4+4)=='NTIC'
0 B6 w. F* ^1 Q0 L8 W5 }  d7 X% k" C! w" v( s* A
-The most exotic ones (could be very slooooow :-(
$ d+ {9 q# A! z* O0 }: p( q" j   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( _* i  H9 T, i! S
     ;will break 3 times :-(
8 k: C# S# A* m5 \
7 l9 R3 r. ?" g- c% g' s-or (a bit) faster: ; k- }6 m8 d+ c8 [* o/ t. j% E( m  t
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# ~5 Q$ l" h7 p$ ~

- G/ s$ a' ]8 B6 T   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  " L5 Q* E4 u5 S4 s
     ;will break 3 times :-(
3 S0 V* r: y1 k  b) l
) z! l7 Y9 {) V  u9 k-Much faster:
% U: D" v$ [8 j$ X& d   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 S  R$ W" z  ?5 `( }: b' D
7 X" ~/ n- |& _1 s: L  k) ^9 v
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 S8 t1 l4 q$ U
function to do the same job:8 I3 K# V0 P7 w$ ^

4 r% W- |6 Y! V! j. q8 s   push    00                        ; OF_READ
, {& B1 K. [; `) @& @& a   mov     eax,[00656634]            ; '\\.\SICE',0- y$ u) C; @6 e7 ~# i8 C4 q- P
   push    eax
3 W! d& B7 V! t   call    KERNEL32!_lopen$ p1 Z; ^' a7 p
   inc     eax
. u. o# W, v8 r, N6 t   jnz     00650589                  ; detected3 A& o# K$ D, K: O" {* A( q
   push    00                        ; OF_READ9 _: o- f; n, ], a0 Z0 N
   mov     eax,[00656638]            ; '\\.\SICE'
( B, f; R* v+ h' h   push    eax
9 w4 K/ f% u. ~" p- ]* M0 v   call    KERNEL32!_lopen
) e. n* {: g# p3 Y& d' c! D   inc     eax
. r8 G- l. Z6 p9 T- f2 L: A   jz      006505ae                  ; not detected! a$ D: o5 @. @

5 l! E1 n9 A# `9 G7 v* G0 L
$ q) y  Z- W1 i  R7 W; x+ Z, @__________________________________________________________________________2 B9 a7 y1 V8 w. G

. d, o8 O( X/ E% B4 O& K" |; xMethod 12+ d# G7 [5 U2 U0 z! ~
=========
# q2 d9 p! J! \7 Y) Z$ z! \. W( _
1 a) u5 J+ p4 E8 Y$ I' I# n( ?This trick is similar to int41h/4fh Debugger installation check (code 051 n+ d% |# R& f# Y6 U6 o, z
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
7 I" l7 i5 H0 `& X' vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: C/ d# _6 K4 I- s- e) p* D
3 V" e7 C2 u& z/ i- j   push  0000004fh         ; function 4fh6 z: E) j+ h7 G9 O: B: U1 i
   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 _% p6 T" @  ]5 R% P/ _                           ; low word specifies which service
8 a9 I7 [" L$ ]& f                             (VWIN32_Int41Dispatch)
) v' R1 ]! R0 i5 f   call  Kernel32!ORD_001  ; VxdCall
- t& ^, d# A, |   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 s$ n& x7 C; i  L   jz    SoftICE_detected
( }9 |6 G' j( ]) L1 C8 P4 G9 w- d
Here again, several ways to detect it:
  i, F3 a$ a5 p7 F0 I
5 ]1 e) p2 y5 |6 |; K    BPINT 41 if ax==4f
) ]$ k" K+ h7 \" X* _. `0 D9 n6 y8 M% J6 F
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' v( P; \- Q8 p# A7 g1 z
. l, b& k- x9 W. l8 V; p    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. t7 o; H, V6 P

/ z: s9 P) I$ \6 U6 h  d. B" N4 X, S- |    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 u: f* k( U7 I* @; C
: q/ t% P$ T5 A; r
__________________________________________________________________________: M& h1 O+ }% W+ e
9 r' I$ j  j( d+ `9 B
Method 13& {: l. H8 K- f2 h: p/ H. R7 _
=========
$ Z9 e) P7 M! s0 M" e( ?! B* p) U4 u) `. `) ~
Not a real method of detection, but a good way to know if SoftICE is$ d: e9 E! Z- h6 p' m8 D
installed on a computer and to locate its installation directory.$ V. H- K. D% h; u; V& a& A9 i# D6 E+ s
It is used by few softs which access the following registry keys (usually #2) :
- ]/ \8 g" K/ o: u1 I% d* `! T  k5 K; Y' |1 B7 W
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 X# S- e( ~* b
\Uninstall\SoftICE
' _1 m8 Z% i8 k! m9 v. P6 q  E  z5 i-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE& I9 p. m$ P3 |) K' |7 p7 k
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 w8 X+ z) F( U' ?
\App Paths\Loader32.Exe
8 Q9 f; O6 U/ R: @: J. N5 E' I4 u
8 D- o: v! U4 C4 v  P
, e- S. y; C% Y+ [4 [* sNote that some nasty apps could then erase all files from SoftICE directory
6 I6 R# \8 I( |9 g6 y# a$ C+ e% {(I faced that once :-(
+ f% r% F2 L4 G' u6 M# F3 @7 X0 ~/ R# c. `- h; ?
Useful breakpoint to detect it:4 k; G- j. z2 R# i% y6 }
: h8 W) z" N4 {# u$ p+ j, U
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; s6 z* X3 k! d8 l: I

% M5 u8 x% y+ w- y- \__________________________________________________________________________) l7 K" z. B8 z% c. J
. Z  X; G2 |; b* ^& r4 X: U
" V7 V, N8 k3 I8 x( ?. i! l  L. K
Method 14 2 i! b' s# L& w: u
=========
9 D, |$ I+ G4 C+ P1 Z# B" p" W$ L- {' F
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ d6 d4 @  H( `1 g( E& e% d* O3 nis to determines whether a debugger is running on your system (ring0 only).9 l% D+ ^( E& I- B. d8 e+ ^8 E
( [" c! o2 M3 g( |# }! e' b
   VMMCall Test_Debug_Installed7 [0 w  G7 R! D) N6 ~" v
   je      not_installed
0 v# o/ W  o# B& C# O( [5 L  C
4 w2 y1 [1 t( c4 fThis service just checks a flag.  D, ~$ ?& ]& f, d8 q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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