About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; {) G2 l0 r, v$ p) z/ Q
<TBODY>
, y% ^9 _  l9 @+ k<TR>* Q6 u9 b  S5 P9 d8 w
<TD><PRE>Method 01
  R4 O' v  G$ {4 V1 m" K6 B0 a=========! v- r# e$ J2 j% @( W! |2 B
) {( f4 f/ T* m0 m( S( A8 F
This method of detection of SoftICE (as well as the following one) is+ w. c: V' F* q9 N- n, P
used by the majority of packers/encryptors found on Internet.: f- {4 I0 N5 I% N) P( E
It seeks the signature of BoundsChecker in SoftICE8 d5 C# y8 B4 I, c3 Q9 [
( [& g8 `3 E; Y  `; }
    mov     ebp, 04243484Bh        ; 'BCHK'
) y/ c& G; _# g" I    mov     ax, 04h
$ \8 M) [) D/ f9 t. [% ?    int     3       * `' E- m- t) R+ k" W- ?4 ]$ Y6 X
    cmp     al,4
5 q7 L! {6 P+ t+ B& v& H  M7 H    jnz     SoftICE_Detected! `% V  h, `: T, [* k% J

. ~' G- u! U2 C5 Y. K' X7 R+ E___________________________________________________________________________/ |) B; g- }4 I  k$ u
6 u- [; r& {. [
Method 02: z% C" S7 Q3 t3 g# ~: Y
=========& t  X5 e# V' ?

4 a! l" \+ T# {2 r! z, j" G3 SStill a method very much used (perhaps the most frequent one).  It is used
, l% d( r: S; Z  z; j+ z+ H/ }to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 D" R2 F7 l( M; C+ a" ^- Z2 Hor execute SoftICE commands...
4 d: c' f: }3 F0 ?It is also used to crash SoftICE and to force it to execute any commands
2 f7 X0 I$ I& V$ ~! ^' A/ n  k6 ?(HBOOT...) :-((  ' |& f/ M8 d. K3 j& f6 r0 B! o2 `

# n! P- N# N3 `$ E: DHere is a quick description:0 O( }: B, |  v- j
-AX = 0910h   (Display string in SIce windows)1 o/ O1 D: N2 }; {) ]! b
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 _8 t; P9 m9 n: N+ p/ ~-AX = 0912h   (Get breakpoint infos)# b% p  |- E* \% i3 o' {' D0 v
-AX = 0913h   (Set Sice breakpoints)
; F9 j/ {" @- p3 c" x-AX = 0914h   (Remove SIce breakoints)
1 @; S8 f% l( ]+ G" @
2 Z8 c* x" r4 R5 g$ Y2 \2 E8 nEach time you'll meet this trick, you'll see:! Z8 ?% u- ?$ n. w( P; G8 `
-SI = 4647h' k- J) H% a# N9 g7 f
-DI = 4A4Dh
1 F/ D8 k! W5 T4 Z/ f. x- r) GWhich are the 'magic values' used by SoftIce.
" n0 {# V# |: q! f6 P! lFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 b5 p5 ]8 K& b6 \$ c3 U) ]
  B9 I+ m- F+ u3 ~0 x
Here is one example from the file "Haspinst.exe" which is the dongle HASP
% u; S, `1 ~0 F- m* [Envelope utility use to protect DOS applications:
3 e( t4 k9 H4 x0 S+ D# `2 {+ u# v( e; F
- N* P# Z9 O2 L8 m
4C19:0095   MOV    AX,0911  ; execute command.
& j/ l  L  }0 I% U! e4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 c7 {! |2 j6 c. E4C19:009A   MOV    SI,4647  ; 1st magic value.' N; [- H: g' v: E
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.# \5 X/ p( B" S# J: X
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
2 ]. P8 z$ q0 B6 g8 H9 d4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, V6 P0 Q* y3 O8 g4C19:00A4   INC    CX* \6 m' Y( I5 q0 F4 `) @
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; ^/ h: y8 x$ \$ B4 o
4C19:00A8   JB     0095     ; 6 different commands.+ N# Z0 I2 }# M6 [  s
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) F( H) o! _; g+ Y$ i
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 `; y; M$ U! g2 J% `
3 E1 O% J$ E- W. v* g
The program will execute 6 different SIce commands located at ds:dx, which
5 Z5 y$ d: z1 v! p" ^- }+ uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' e! D) c. x4 M
$ M; ^3 L1 R" }' g2 \- r* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 F/ D2 v  k% `
___________________________________________________________________________. S6 I/ N+ `3 q' k( X- k

5 v. n2 ]+ _1 w5 i" n# i4 ?0 P8 J% s7 l7 K# V2 {5 Q* {! A9 D
Method 03
5 E" N: d+ J, E1 F* F$ q1 P" g=========# m3 v1 m) A: ?) W
4 t/ b& R4 Q& M% j
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, ^$ [+ F: o2 I4 f( A& d6 K+ G(API Get entry point)$ f6 S4 M8 ^6 P! [: @$ f$ ^
        
6 g5 u6 ?$ i+ n. Z
5 z) K& i% q% a' `* O+ U: {    xor     di,di9 ^$ ?7 y5 h, A  U5 V* h) Z
    mov     es,di* u. F( p% h' i1 ]
    mov     ax, 1684h      
2 G# c8 U6 O; a' D  t0 }9 a    mov     bx, 0202h       ; VxD ID of winice# n* x% t+ {. B# M  Z, O
    int     2Fh
! x) @& t4 M' J7 K    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ [0 m6 ?, f9 r, w3 E$ ~4 p3 N6 b' ?    add     ax, di
; ~9 |6 C( \  F' X  M$ S% H    test    ax,ax
6 l! Z: M8 T0 @, O) V% N    jnz     SoftICE_Detected
" H+ l  V' R+ K
& ]" `3 P9 @. `2 }, y. `& _; p% ^___________________________________________________________________________7 `3 V: i  w, C, r- e3 g8 ]1 c
6 f# I: R4 o: L( V  f* [
Method 04- z6 u1 y$ A0 H3 T
=========' B4 v) F3 m1 b4 T/ o

2 I. Z( m- b( _7 @Method identical to the preceding one except that it seeks the ID of SoftICE
5 l/ T* R/ W; D) E9 cGFX VxD.- f/ h8 ^1 J# p& ?+ u

  v; S7 h7 v$ m: A( \  S' d    xor     di,di
( |( }# V  a  C    mov     es,di2 m' o3 V- t( b- D% \; M
    mov     ax, 1684h       5 P! s$ w6 {4 O  c0 ~* u" C. \
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 Q4 s( E" _: G5 }    int     2fh
. N/ B7 m5 G+ w4 g: e3 X- g( J    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 Z2 \7 G4 V  d/ |    add     ax, di; K  ?  v" U7 D1 ~2 ~
    test    ax,ax' W, q3 b: j  e8 z
    jnz     SoftICE_Detected
2 W  E0 p4 O3 Q3 {4 K! k% c3 ]. o# E7 E* r+ Z
__________________________________________________________________________
/ C* ?+ b( w5 M% u  q3 S% U1 {- \% E( E+ l

. n  l' U  J6 J5 W# D0 D) ]Method 058 k" Y, `( L* F5 M: N" {
=========
! T$ ]6 q& ~- M/ i# J
3 n7 K, l' B8 i  O4 j" XMethod seeking the 'magic number' 0F386h returned (in ax) by all system
  B4 g. ^( k6 y1 n0 n# D9 y( Ydebugger. It calls the int 41h, function 4Fh.- O0 |/ i7 [8 V# f( F
There are several alternatives.  7 K3 K, j) q6 P
: ?/ F) S4 M- K1 i+ K5 }4 M- [
The following one is the simplest:
+ q. y4 }( f- E: C& w# e2 q: R. C" P, o0 }2 K/ W+ q" D4 L
    mov     ax,4fh
9 i5 h. E+ G0 V# E% A! I- X% q! y    int     41h! w, v; c2 F$ w) W* ]1 `" I
    cmp     ax, 0F3865 b0 z( g3 m4 M
    jz      SoftICE_detected4 k1 \4 _/ F# d: y. S

) z/ M& c2 Q/ X3 L; K, r; C  L+ \( Y# g! j; R& f- P+ s
Next method as well as the following one are 2 examples from Stone's / ^) C" h, ?% v5 |0 U( S/ x0 e
"stn-wid.zip" (www.cracking.net):, F- }' s, ?( k

+ w, n2 A+ ?9 y3 V+ {; {2 a    mov     bx, cs" e* ^( c: R4 o! U' Z1 p1 b! b( v
    lea     dx, int41handler2
: B4 I; H5 Z: R8 M: K3 S& P' T    xchg    dx, es:[41h*4]
2 k" i- G. c( w: F, }( v4 m# C    xchg    bx, es:[41h*4+2]* K- e* d& e2 }$ H/ ~3 k
    mov     ax,4fh$ A1 C& P* e# b3 t7 T2 w8 [! B
    int     41h
# |; E4 L2 J$ v8 e  |3 C! s) l    xchg    dx, es:[41h*4]: g' s' Y: j: u9 G
    xchg    bx, es:[41h*4+2]
  d4 Y+ A' x2 F    cmp     ax, 0f386h
: U, S* `  d8 C7 a    jz      SoftICE_detected
  P4 p' h$ _  N2 Q5 a( i+ C2 A* M. X" _' g/ [; H0 `# h6 e: ?
int41handler2 PROC
% H1 n' p0 x1 o$ x7 u  z% u    iret
& `4 ^7 t' |! s8 c4 a. m6 c6 f. L; S  ~int41handler2 ENDP
$ P: @; M, _$ E* M. ^4 E  X  u! ~# k' `0 x

6 L+ l7 Z# M* h" o" H# h_________________________________________________________________________
1 r* z. X1 s8 C" s
! F& n) @0 f0 N) q* Z9 e  F0 R: @# s, t8 H' @; K
Method 067 M; w/ ]* f) h" W
=========8 }! u0 u  ?  |$ F1 a! R
5 h/ a2 {6 \' S: n+ ?* d9 A

. D- K/ \! [. N7 T6 S. O8 r2nd method similar to the preceding one but more difficult to detect:" q+ y- I# a9 Q0 X1 X2 l7 g! k
. ], B4 F- L0 B" b8 Q; w  @

$ v8 M( Q- q: y' V7 d2 c" ?5 zint41handler PROC- c% \; S8 q$ A( _  r3 e/ n+ B
    mov     cl,al
- m8 u$ x0 |/ F. h    iret- Q7 i: g9 v. ^; I7 j
int41handler ENDP- w- T! D0 C) x# L
9 t4 F0 A2 A/ ]

! x5 T- u& ~, O    xor     ax,ax
; n; X: T; H3 g+ W    mov     es,ax
+ E3 x" ~9 Z! P: k    mov     bx, cs
; s& L! }6 U; J' m/ U- N    lea     dx, int41handler$ }5 @1 F, E7 Z1 `4 z
    xchg    dx, es:[41h*4]) L5 M2 S  _. H0 F1 G
    xchg    bx, es:[41h*4+2]7 z8 C# ^7 |8 i2 W
    in      al, 40h+ \- g+ v; f7 L. H' V
    xor     cx,cx& f, f* N# U1 J- L
    int     41h
& l! b7 m( Q2 o4 S    xchg    dx, es:[41h*4]  `% _2 Z, e8 B% e# a% d# m. Z8 ]
    xchg    bx, es:[41h*4+2]1 b" l  X) G- L* y. {+ m* L
    cmp     cl,al: r+ I9 b, ~3 w3 }) b
    jnz     SoftICE_detected+ u9 i& E0 u% D# P. Y6 }$ q

5 ]. R  h' J- w! M4 P' j4 ^) r6 y_________________________________________________________________________, ?4 @8 I7 `4 P8 _6 x9 f! K& E  u# J
. |% Z% I( [) X. e4 i0 }
Method 07$ M) b2 l5 E. W/ ~0 @0 V/ {( ?
=========4 s! `. f( `+ ]3 c4 k6 ^

' L8 K* b; P1 ^Method of detection of the WinICE handler in the int68h (V86)6 [# g% o8 u/ j! H! \1 B" m( o: U

0 M; L$ F5 M* j1 k    mov     ah,43h9 Q* @  y2 e$ _! F; Z8 C4 e
    int     68h/ l7 y9 `. u' l' ]5 r
    cmp     ax,0F386h
0 C' J1 C4 d* c+ Y2 T9 o6 m    jz      SoftICE_Detected
) I* J7 ?( d& O1 a" Q8 X
4 x8 `$ i, T* D" T! v( \4 m9 f- O  P5 V. V) d. l6 {
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 i% ^6 D) M4 n3 }   app like this:
' W0 n% r& E# f9 \
, C0 S9 ~1 s% {7 T+ N   BPX exec_int if ax==68
4 U5 M# b+ L% x7 E" f. o" h. y: s   (function called is located at byte ptr [ebp+1Dh] and client eip is
; X. ^' e/ L* Z: R) t   located at [ebp+48h] for 32Bit apps)
" @$ L1 q* Q) ?) X. E7 F- n$ x% B__________________________________________________________________________
6 P/ ^0 B" ?. i, P$ U. G. _9 y- A3 w1 y; u8 p' Q* q5 \
+ Z1 m% Y4 X3 y; z% d9 \" g' A5 D
Method 08  e' s1 M! n! V0 d0 u) W
=========$ o' G! Z0 V; d, K* J' a

! j, L3 [/ B, \. z* h- r2 k7 U1 MIt is not a method of detection of SoftICE but a possibility to crash the
% A- z" H" m: u. M8 A- S' t! v9 csystem by intercepting int 01h and int 03h and redirecting them to another% F  O! E& I. @, [1 C/ a7 J5 m
routine.
5 I( R9 T. c/ f$ C6 B- mIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. e: y/ y7 }+ P2 m+ ~0 g' O/ D
to the new routine to execute (hangs computer...)' E" ~+ \, G/ e! ^! y& \! U# c# h3 |
+ P8 V4 I0 C: c3 o8 g
    mov     ah, 25h7 L5 f. K6 s$ w4 i: v
    mov     al, Int_Number (01h or 03h)
6 }9 Q+ r; c5 Q1 N% R2 O    mov     dx, offset New_Int_Routine& @/ A5 H" R# Z
    int     21h
7 v; M. S9 j1 ^  x8 s+ d3 q6 ^
__________________________________________________________________________
2 P2 T, p+ e0 }9 {5 o8 _
! G3 j0 p% h* B; F0 bMethod 09
" Q" L- n, X( d+ F! H7 u! x% r=========1 B' b& W' r" U5 Z& z% J9 Q5 e
* Z& R$ w. i& w( {  A+ Y2 g; E! [' Y
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 [, Z' k6 ^" yperformed in ring0 (VxD or a ring3 app using the VxdCall).
% m: x% i) o/ @# v0 [& ]* aThe Get_DDB service is used to determine whether or not a VxD is installed  D3 ^0 r' s  L3 h8 k4 x( T
for the specified device and returns a Device Description Block (in ecx) for3 B3 I* v2 ?2 r. H0 o8 Q
that device if it is installed.& C( L9 [- V+ M! i: Q
% N9 L  o) Z; w6 c2 I& B! \7 B
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: E- T# d, P* I2 J   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)9 d5 g: p* |4 ]. O4 b
   VMMCall Get_DDB' u7 R* T5 e% W! m' }) k6 R# o- ^
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed& o/ O% R  M; B

9 `1 |; i9 S, m& pNote as well that you can easily detect this method with SoftICE:, ~' y, R% P+ q' j! k! y( C
   bpx Get_DDB if ax==0202 || ax==7a5fh
: A" d2 t1 k7 k6 S: j/ D/ J$ A2 ]
6 @) b7 U& Y5 ^# D__________________________________________________________________________0 N# O+ S( i* _. w

$ x* n: ^) H4 b! l! M# U9 @. XMethod 10
1 _* L2 ?$ q' @0 F# w' F# v7 }=========$ Q( p& ^7 n1 d% M

! p6 I) ]  h/ Z. S5 o=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 E4 ~1 |2 j- E8 I% c( a- P
  SoftICE while the option is enable!!
8 q; m( u* k. J8 ]5 M0 i
0 @/ n. W: i4 i0 v' q/ `" h/ DThis trick is very efficient:
' P' ^$ J: C3 {2 _0 q# I! x" ?by checking the Debug Registers, you can detect if SoftICE is loaded" p5 f2 N  k& r
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# u) n- s/ ^" B' @/ `) kthere are some memory breakpoints set (dr0 to dr3) simply by reading their. m8 l- ^$ ^. V( k. x+ x2 t. @  G
value (in ring0 only). Values can be manipulated and or changed as well2 E3 ~% o; n( D: c9 u' |
(clearing BPMs for instance)
' x( R7 B* J3 \$ E- g3 ]
" i' t9 m; @& l' n__________________________________________________________________________
8 r0 n9 R7 C7 w7 w8 o7 g) ?/ Z, x" |
Method 11
0 |0 l5 K9 C9 X( r=========' x) g9 J( q  i7 R% f  B
$ m$ d2 x. r! ~
This method is most known as 'MeltICE' because it has been freely distributed
4 w$ h  {% k5 T" wvia www.winfiles.com. However it was first used by NuMega people to allow  b5 H8 ]$ D+ j0 R2 q
Symbol Loader to check if SoftICE was active or not (the code is located
4 N" B5 c! x4 s6 kinside nmtrans.dll).4 L' o$ j0 z2 G' n. N
% K/ k- x! ]4 H9 O5 O
The way it works is very simple:
9 ?8 R" ?# U$ G5 z7 T" YIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 s2 k6 D2 {$ X4 C! P4 a) M% d) j
WinNT) with the CreateFileA API.
9 S! _$ n2 F$ K1 }3 A
. X- }7 |* _# P+ p/ d4 ?) SHere is a sample (checking for 'SICE'):( B6 X; s3 U1 Z) R( v
9 b# V/ t; D+ B1 ]
BOOL IsSoftIce95Loaded()* u# p2 |; y9 k+ O& ]6 e$ W2 n
{3 }: {, ?! w0 J! y8 Z
   HANDLE hFile;  + z3 B- J7 L" D3 p* a9 N( L
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% B7 w  e) D$ S! ?1 ~
                      FILE_SHARE_READ | FILE_SHARE_WRITE,! f# G9 B& d7 w
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. I  O- _* n4 U) P6 f/ x' H) w4 Y   if( hFile != INVALID_HANDLE_VALUE )
3 `6 ]1 K3 Z9 i+ R   {
7 K6 W4 f0 V; j; z5 }, s) D9 p8 e: b      CloseHandle(hFile);
$ _- v7 N4 Z; @; k6 m      return TRUE;7 z% A. ?: b, z" j: s9 Z+ I
   }  @/ }* [" g& o
   return FALSE;) G# A; A/ y$ q- q2 k- r$ Z
}+ N0 ?# R7 I7 t. h& Z

' C/ F0 L+ }6 h) _+ a0 \Although this trick calls the CreateFileA function, don't even expect to be
* _4 {1 e6 e2 q# R2 q) P( d) X; iable to intercept it by installing a IFS hook: it will not work, no way!, R3 m2 W/ \- k0 f4 @4 U
In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 E9 K$ E4 ^1 l9 C; {3 G4 a4 T
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" `% W" {6 a9 r" ?
and then browse the DDB list until it find the VxD and its DDB_Control_Proc, [: M) ^1 A; x
field.: x3 o9 x* C+ E" X
In fact, its purpose is not to load/unload VxDs but only to send a # H& U; a4 w! |! J3 @8 @
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 U/ o+ R  q5 H( }) A) Oto the VxD Control_Dispatch proc (how the hell a shareware soft could try. Z7 a5 }& X4 d# o
to load/unload a non-dynamically loadable driver such as SoftICE ;-).- |. ?5 [5 k/ R  u8 `
If the VxD is loaded, it will always clear eax and the Carry flag to allow. y0 }- V% |& W2 u& o
its handle to be opened and then, will be detected.
& P/ s8 b, j' x$ d4 Q, t" [You can check that simply by hooking Winice.exe control proc entry point0 p) S5 F# c" ]8 G8 M8 d' n
while running MeltICE.% [. ]4 B# b6 |- Q& }& k
# x6 ~8 |; z' L5 ^

2 }" i8 u) i- [  00401067:  push      00402025    ; \\.\SICE& f1 x& i3 a% Q6 S; o
  0040106C:  call      CreateFileA% W- n: K1 J- B. k$ s# E
  00401071:  cmp       eax,-0015 Y9 f1 G& U9 A! B+ W6 F" T& p
  00401074:  je        00401091
) `0 c1 {% _' O3 e
5 F( U3 V  A" u: F) j# j7 K( p2 T/ C9 N$ n  w2 H# h9 ]
There could be hundreds of BPX you could use to detect this trick.
/ }, W4 b" D$ G" \, c. H4 {-The most classical one is:
+ x! }9 e, m( M+ y9 i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ M0 R' ~7 i9 o. C0 E( S
    *(esp-&gt;4+4)=='NTIC'
, f6 Y0 `/ L. ]6 b2 h7 g/ n1 W1 w
$ E  _: N% H( Y-The most exotic ones (could be very slooooow :-(3 D# D5 k1 C. H* \& `% Q6 |: N
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" n, y8 w3 O  ]# R2 ?* b     ;will break 3 times :-(
5 V  d# \& Z& E  Z4 ^  g
: b0 v7 W1 i, {) X; |; s& g' W3 b' P-or (a bit) faster:
! K2 k+ V% c3 I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')* p  ^% p# Y( Z# `  v' {
3 o6 Z9 A* o0 _
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 [2 L9 y, L! L- v) f% S0 o6 G; e$ j     ;will break 3 times :-(' n7 a9 c( B( X: w! y
8 A" @5 q( t5 s1 l# p
-Much faster:( w* K/ Q) m6 M% ]9 P
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# c4 N+ X0 S7 J( E% d& G+ Q  V
# I' t$ r  s8 k$ @+ k2 @
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 w- J% s* d3 k
function to do the same job:
# o" d& E6 k4 Z4 ~, ~0 j* g+ \3 M$ ]
   push    00                        ; OF_READ
9 N$ q4 {- r6 V$ q8 ~, L4 c* C   mov     eax,[00656634]            ; '\\.\SICE',0$ e& n# \, l& B# H
   push    eax# E7 Q( I2 Q% J4 x; a' P# X
   call    KERNEL32!_lopen
: a! O0 `$ L3 \$ E   inc     eax
. m+ R  e6 E* C' h   jnz     00650589                  ; detected
6 x; I/ W1 s# f$ ]   push    00                        ; OF_READ
. p! m. `+ B# _% }   mov     eax,[00656638]            ; '\\.\SICE'
& e5 p" [) ^% @! D, L- f   push    eax. `# l# V4 d7 G* M; v
   call    KERNEL32!_lopen0 w1 q6 n- r2 M+ ?2 _# h) c
   inc     eax1 H9 V: S: ~7 l; r* ^1 _
   jz      006505ae                  ; not detected; }: G$ O* ?+ f+ c
0 O+ x1 }0 y3 z! m
' F$ ]# ?0 D+ l. e$ Z- p* b/ z
__________________________________________________________________________
- k0 O- D; j" G$ m7 ]' c# r. I9 ]' ^% E2 T
Method 12; _4 a% m1 y3 I+ D. X5 x2 [
=========3 i! A7 E- P7 i. V/ I) U' i% M

4 i) O* E/ N8 q1 J6 t$ v9 MThis trick is similar to int41h/4fh Debugger installation check (code 05" f$ }: r) ?3 v7 Y
&amp; 06) but very limited because it's only available for Win95/98 (not NT)0 E% Z6 b  _0 ]9 Q+ p. k! f! i9 }0 A' U
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 }4 N3 O( ^0 s8 D9 n5 y  W, C$ i9 S1 h' N* X
   push  0000004fh         ; function 4fh; E) E5 o( v3 f1 S0 K6 A; B& T- M
   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 ^6 ?6 J! w7 N; y                           ; low word specifies which service7 V/ P. n: c9 F
                             (VWIN32_Int41Dispatch)
) _2 c) A0 ]2 z, v& R5 I# U0 m   call  Kernel32!ORD_001  ; VxdCall  c  N7 o1 f& `( O3 G3 o! Q0 T# {$ e
   cmp   ax, 0f386h        ; magic number returned by system debuggers& m; B* b7 T1 l4 D2 A1 S& O
   jz    SoftICE_detected
5 }1 E' a* L# }0 ]) S; e( w$ U2 M' Y( a
Here again, several ways to detect it:
" K- M) ]1 ]: b4 b& K3 U. Y& r' h. z6 b+ _7 t/ ]0 ]! v
    BPINT 41 if ax==4f/ Y9 _; \7 D/ |6 k7 U2 i
4 |2 Z4 y2 J9 b. e
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( w' m, x  r# B+ p' K6 e$ L  Q

+ A  q0 p' s6 \    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 p% `3 M% a6 K5 i, O& N, K
8 m4 K0 n0 a% x6 j  [0 z# }* ^, O    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! Y  g$ E) B6 D% @$ o- Z: y
3 W% I3 H1 }1 E+ ^! ?
__________________________________________________________________________
. Z/ c1 {# m# F0 O  q% Y
+ ^) E% B8 R4 B: N( W( j( GMethod 135 Z* |# _, [" `+ X
=========
- o  }& |% F: [8 i1 N* _/ m! h3 Q$ Y
Not a real method of detection, but a good way to know if SoftICE is
! @! a' Z4 x9 c& R, [4 _installed on a computer and to locate its installation directory.: n. `9 m1 U2 h: T% y
It is used by few softs which access the following registry keys (usually #2) :
: c7 y9 t! M0 S; O% z1 V1 C& M. T9 T, v+ W1 A
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; o0 ^  f' g& q3 _4 p8 e
\Uninstall\SoftICE
0 F! h) {0 z7 u1 c/ n4 d) y2 }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( |! N; g) c) K" e  Q" n9 Q* ]+ j-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; u) T, X! b+ p
\App Paths\Loader32.Exe
. E6 R6 V9 c+ p
: L& V5 c, ]4 o' j5 ?$ c
; H  n' s1 e9 V: {  c* P4 ?1 Y* }Note that some nasty apps could then erase all files from SoftICE directory
" y! e' u* P% C; D9 x+ a7 I! e  I9 l(I faced that once :-(
( U% Q( j1 u. ^% }7 x! n" V1 D4 u. m$ a2 Q: o1 V9 G
Useful breakpoint to detect it:
" g. m  P: @" u9 S5 G4 {, ^
! s! y; T" f% E6 s+ ?$ ^     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' v3 j' q6 x, i! D3 J% q8 D2 d1 F4 F# W. C0 ?; T
__________________________________________________________________________7 w  X7 Q' G, _4 N# C6 }5 U' l0 x
0 S9 l! a; B9 u( Z
6 \$ o6 F$ t5 B! y
Method 14 , b( w0 B. R" G5 m" V: ^7 G% ~
=========
9 w4 s- }, O; Y' ], H$ C0 T# ?7 s# D  Z8 {
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, m  r# {9 S9 V/ J0 \5 _7 G1 ]is to determines whether a debugger is running on your system (ring0 only).6 ^5 ^6 ^# ^8 n4 k+ b

+ N( h( g/ z& m, S   VMMCall Test_Debug_Installed2 _/ D* V& Y. M/ D+ ^; r& L
   je      not_installed
9 t+ [# |! P' H- x+ [+ _7 J/ s
$ U( l' a) d; _8 R! TThis service just checks a flag.. i- M5 t. s( a4 O$ _1 s3 v/ }* M  d
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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