About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>- c+ S. F1 U, q9 ?8 h# _
<TBODY>" h6 |+ D5 s+ D0 F/ ^3 n
<TR>) m: M( E) z( V  B4 S
<TD><PRE>Method 01
* n  M! H; t- \; t=========
0 v/ f% P) L* C. x0 K  G, d/ M, ]' `
2 x0 t: i) S7 Y. r/ eThis method of detection of SoftICE (as well as the following one) is1 P$ m% H- ^/ p, n! h
used by the majority of packers/encryptors found on Internet.9 b2 b  I% J9 r" ~+ h
It seeks the signature of BoundsChecker in SoftICE
1 J! A, B' u! s0 l5 k0 n# @. e6 g" Y  n) \  W' ~
    mov     ebp, 04243484Bh        ; 'BCHK'
6 \1 v1 d) k( ?: \% i    mov     ax, 04h4 Q4 f8 t: _- @" N" i' g5 {# i2 G& N
    int     3      
- Z) q1 ^" e: v+ Y    cmp     al,4
1 A6 N1 z& A, s8 k, s2 S" C    jnz     SoftICE_Detected
4 z5 d0 N* ]- S  p$ M
+ S1 l/ n- I$ z4 s8 y$ Y1 O___________________________________________________________________________; R3 a3 y2 r* D( y: f; P) J
8 U6 u6 t( |  H2 b
Method 02* H/ }; n* A) n- I1 B' K
=========' T: X7 X& e4 P$ _  ^/ V) X: s

& V5 N4 `: E% E: H6 TStill a method very much used (perhaps the most frequent one).  It is used7 d8 H2 N/ s4 \0 Q' N4 l$ X
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) O; d* E& v& e$ o# R, @7 W' tor execute SoftICE commands...1 Z! o/ A& l* {% w4 f& k/ c& e
It is also used to crash SoftICE and to force it to execute any commands
; p1 ^! O9 U: s, \' p& ?: d# a( h" K! N: s(HBOOT...) :-((  2 n: Z5 r+ |$ }; O- v

& x/ v- B; r! h0 DHere is a quick description:' P) d# E5 e& b7 u
-AX = 0910h   (Display string in SIce windows)
& {5 D- r. s8 Q2 b-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  V. |+ E! t& J- I( t1 j# ?-AX = 0912h   (Get breakpoint infos)
8 L: L7 {" O$ m/ h/ D-AX = 0913h   (Set Sice breakpoints)8 j0 ~1 T5 \2 ~8 ?# U' b/ ^
-AX = 0914h   (Remove SIce breakoints)
/ H1 U% I7 l, b# R
5 ~" n& g! C9 f3 T5 W/ Y4 h- @( GEach time you'll meet this trick, you'll see:
! k; v# K) L; L; s5 ]-SI = 4647h& t: d& L; Q# `& H0 G
-DI = 4A4Dh; B8 n2 g. p: ]* [  Q
Which are the 'magic values' used by SoftIce.5 X, @9 {% I4 \+ X+ M( o
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
+ M/ i# [- _9 v0 ^: ^' [- g2 N: p
Here is one example from the file "Haspinst.exe" which is the dongle HASP1 d5 D  ?9 V" q6 u
Envelope utility use to protect DOS applications:
) b- g. F, b2 t! q8 i2 B7 o/ [
& x3 u/ }8 v9 f( z5 D0 h' {9 M# ?5 e% Z2 e4 T% O+ a; j
4C19:0095   MOV    AX,0911  ; execute command.' t. z4 H0 m% K, ~- |7 s8 U
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
+ \  S% A$ e4 }0 W# x  D6 Y4C19:009A   MOV    SI,4647  ; 1st magic value.( L9 i6 d1 O- p" D
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- Z7 y" R7 G9 x% @) J+ s4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 i# `4 S3 f  ?/ Y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 W! Y0 V2 `$ \0 Z0 p; [9 J8 I4C19:00A4   INC    CX
. B( c; j# [# ^; q# }4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
7 [' c' t0 U6 z1 i) T4C19:00A8   JB     0095     ; 6 different commands.5 I; x( m" h4 R7 x
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 Z9 U. Q8 B) k2 L* M4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 j' N! H, [. z" d' w3 F+ j; n- M& P8 e' {. X$ k4 h/ @4 ~3 E
The program will execute 6 different SIce commands located at ds:dx, which2 M6 D5 P: l) b) B! C! H
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 a$ E$ x" ^( }! o- T4 K. k. r

( Z+ O1 L7 H1 K8 i8 ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 A3 e/ S% e/ w  M; J8 E! ~% A/ o
___________________________________________________________________________! j9 k: g( R% p# T; H) t
$ W& V3 R0 _: p0 O7 Q! z- w4 Q+ W8 l

4 g: J2 B! ]4 {" VMethod 03/ _8 h0 o& A7 o7 C$ V' u6 u) @4 X
=========. ?$ a$ k* @! ?5 [8 M/ i3 c! H

. R8 r* \! |! e# ~2 y7 kLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 E# R5 n6 i/ c. ]
(API Get entry point)- Q* V" c) A- _" z
        ) v' g8 u. e* e2 g% \$ T

+ r9 s) q9 U, b+ Z    xor     di,di! ?" j3 v' P5 J1 P# v
    mov     es,di
, N9 |$ g2 ~  M& a9 r7 O  j5 k) t    mov     ax, 1684h      
1 ~8 W! s' a, y. h. t, n, x; m    mov     bx, 0202h       ; VxD ID of winice" ?, C1 m, _  N* M, \2 B3 m
    int     2Fh
( ^9 x& c6 g+ A& n& ~: z+ C    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 o' Z9 z# M6 g& L, M    add     ax, di- v9 D: ~6 m; I! a4 Q5 X; i5 w5 V3 q
    test    ax,ax
% i8 [8 ~9 W  J' j) p9 n: W    jnz     SoftICE_Detected; Q' L) o" c1 \/ D& m1 y

+ h" W3 U7 E& e4 m. H4 C) A  [___________________________________________________________________________
+ r$ U( i; U- \
* V. O* {8 n( G) u9 zMethod 04. |+ i$ m; e* g  K: [! {3 W/ R& O
=========+ M- @. w! o% A- j" }$ Z& {

* h, @) p: I5 f7 f; y: RMethod identical to the preceding one except that it seeks the ID of SoftICE
  E  ]* K& F" Y1 T( o$ FGFX VxD.
$ {4 g5 U  _1 O. N8 k1 }1 d5 [
0 f, V1 S. Z. N' v" I6 q    xor     di,di, N% W* O, Y! |2 q& L/ U: b
    mov     es,di* Z, g' O4 L) g5 m' _( Q: b/ j
    mov     ax, 1684h       4 u4 k( n- ]9 |; L
    mov     bx, 7a5Fh       ; VxD ID of SIWVID! F6 p% h3 R+ f" M+ z
    int     2fh
* Y2 e, ~1 F& M' x; y' I    mov     ax, es          ; ES:DI -&gt; VxD API entry point# j; w& l- Z% O+ s" L7 c& j8 Z
    add     ax, di
8 D! T' `1 Y* K" E! |$ M3 f  D1 r    test    ax,ax& w9 x# D8 T# Z6 c2 H
    jnz     SoftICE_Detected7 L& Y( o5 O) C! x

0 k6 W# f; F! F9 N9 t__________________________________________________________________________9 U7 {$ w$ b! j0 o# I
  e- `) z% U. j5 A
& T3 L+ a- W. g9 h7 K* q! p0 x# I0 E
Method 05+ {' Q. ]" z- x$ \* V6 w- N
=========
: G0 A2 w* E# O; C
( Y; e4 W; E% v" w8 W" WMethod seeking the 'magic number' 0F386h returned (in ax) by all system
3 Z3 I3 y$ f  J5 ]debugger. It calls the int 41h, function 4Fh." k6 \7 @/ l/ W/ B4 U
There are several alternatives.  0 [3 S/ c+ n  Z' P
# B* O. b! d4 c
The following one is the simplest:
! u1 A. y# ~* M$ b' V6 m$ M- w; V4 D+ q  L5 S; ]6 h/ n
    mov     ax,4fh$ Q( E/ h) i7 a. i/ n
    int     41h6 w, B8 G4 N  y
    cmp     ax, 0F386
! a- O% L' N1 ]  S$ A% U    jz      SoftICE_detected
( ?& [& g- P! m" Q% [; |1 }% x3 T' j- Y/ {

4 f% n/ E4 t" [! z- ANext method as well as the following one are 2 examples from Stone's 8 `5 L" F' r, V- R9 s' v
"stn-wid.zip" (www.cracking.net):
4 B, {9 ]$ l) g$ R9 [
- X; I. q6 G1 M5 a$ Y    mov     bx, cs
2 h" T. s- \9 Y( Z( D$ m    lea     dx, int41handler20 p: L0 D) a' D- H5 C
    xchg    dx, es:[41h*4]" w/ u+ i* T0 i1 |8 Y8 z
    xchg    bx, es:[41h*4+2]) I! k, ?! v  n5 d: d* ]
    mov     ax,4fh/ r/ w) C0 ?, T% F5 `  m
    int     41h5 U7 P6 s9 R! L" O5 X
    xchg    dx, es:[41h*4]1 i- }3 W" f$ i1 J& Z3 i
    xchg    bx, es:[41h*4+2]
1 y3 x" u4 E3 m9 a. y9 \& W    cmp     ax, 0f386h- v0 t& x8 f" f! u
    jz      SoftICE_detected' e! d! w  D7 i  K( T5 s( y! K

8 z# M; v5 Q% \- Oint41handler2 PROC
; R7 u; u4 d& |/ b    iret$ a7 r& {( W' I
int41handler2 ENDP
0 h. ?: c/ a. s* T" L7 s+ @! C
& O( V$ n" @8 Z, f) S8 ?1 q7 ]* X1 }  O6 \* Y/ `$ G
_________________________________________________________________________
3 C# k# w6 b5 F$ H+ q
# h# A# }. I* G9 W9 d* f, s# T( ^
& Z5 @# w% @, p3 `  LMethod 06, D' x7 `, H* b. a  r- J
=========
$ L# V1 p  ^7 t) r/ e0 G
4 N( ~* B& E" x9 y' j. n% @1 U& f; q! i( S* y
2nd method similar to the preceding one but more difficult to detect:+ p$ M  h  w5 O/ A0 [2 c% g# f$ O
6 q, _4 g1 ^1 H7 |, x4 z; p5 e* \

/ j" J9 f  s& D; u, K2 q1 r) h- ~int41handler PROC* x3 ?9 t4 e3 b2 l6 K! m% ^
    mov     cl,al4 k3 k8 `" B7 A, [
    iret
; [" r, F" v4 q3 ?8 Nint41handler ENDP- P+ d6 x4 N4 L6 w
1 X% E% p6 v3 g

. K& [% |) B# z$ Q1 x7 A! Y    xor     ax,ax
0 D9 A) h/ X6 S9 F1 }    mov     es,ax! X4 G3 f7 k0 a8 u
    mov     bx, cs% U! @5 ~$ G/ w0 h7 P6 L
    lea     dx, int41handler: _! Z; h9 ~* |5 T
    xchg    dx, es:[41h*4]+ d6 `: N5 N7 {- F; R6 ?# I. D& w
    xchg    bx, es:[41h*4+2]4 r6 i5 v$ Y1 s2 K* w1 X" `
    in      al, 40h# K9 v! c9 d' Z! U6 v+ b
    xor     cx,cx
  E( d& O9 Z& _3 X    int     41h
4 ^4 M" g* O, `( ?" O( e. H) R    xchg    dx, es:[41h*4]; u( c. C- o/ u0 ~" J
    xchg    bx, es:[41h*4+2]
( W9 P* f2 x' n    cmp     cl,al& }* y; u; D$ F
    jnz     SoftICE_detected: H) I; M" z7 N# n
+ Z% v1 @! `& M" ?9 P4 a+ S
_________________________________________________________________________
9 J0 c% E- s; c6 f4 u% E: g+ x. `5 O6 n  `
Method 07( Q9 j/ V! U. ?$ V4 W6 t) z
=========6 }* o' A! X# f' x) Y

, J  {9 `! z3 }Method of detection of the WinICE handler in the int68h (V86)
7 H/ ~+ Q5 I/ i9 w# ]  o5 U2 C
$ A) r7 }$ y" S0 z% O* T    mov     ah,43h0 [4 \! Q" ~2 F$ h- |
    int     68h
! ^2 f, y" v* Q    cmp     ax,0F386h1 L5 b4 n0 j3 Z! l7 F! ]* E
    jz      SoftICE_Detected3 ]* J/ C5 F- o7 u) I# a2 R

" j# E+ I$ @3 y, `) O' X
) k: F4 W) [7 k3 i- @=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 X; ?# _: m3 P# [$ W
   app like this:
( o/ @# r2 Y* V( |, V8 X/ Q. @9 z, v5 S+ N7 y7 _8 z1 |
   BPX exec_int if ax==68! D1 f" {, c, Q
   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 |1 \0 v9 x" G9 Q) b   located at [ebp+48h] for 32Bit apps)6 u' g2 y6 k& z" H/ M4 m8 |
__________________________________________________________________________
3 _, _0 |4 ^6 E) }" `: U! i3 e" c) V1 [. `0 X

0 e7 J& c' H, _% U& @$ I. ]Method 08
# U- C. C5 A( D, ~% m# c  |=========
& P; o" S$ C' z7 Z7 |$ F
) h5 A4 [: J) YIt is not a method of detection of SoftICE but a possibility to crash the
4 f- f+ F4 i7 U: q' |2 M' Usystem by intercepting int 01h and int 03h and redirecting them to another
! C/ b+ q% |$ n) M7 T& F! }4 rroutine.
; S1 \) M8 \" R/ }It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ j! K* s7 O4 i. m/ q% q% u$ O
to the new routine to execute (hangs computer...)$ Y: |4 V  G2 q4 E$ x. K/ n+ ^; N
7 e2 X7 C# l5 m# K7 ?
    mov     ah, 25h: i& M1 J3 m, L6 Z6 }
    mov     al, Int_Number (01h or 03h)# W, T6 b9 R/ ^- g
    mov     dx, offset New_Int_Routine  `! E3 j  T) r/ _7 \9 G
    int     21h
# E9 e- b* G! u' \
4 n/ c; T" u0 X  L+ R5 n__________________________________________________________________________
, A  o: q' g9 |& ^, d$ i- u8 Q( u
: R+ p3 J/ h2 u) U5 Y5 _( BMethod 09% p) d) ~' A  G' c" K
=========7 `# w- f' m& v2 e( M. _  o1 a
- N0 B6 j; ]. J9 T" _1 H* C
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% A% a, k5 `0 N& Qperformed in ring0 (VxD or a ring3 app using the VxdCall).* |! j$ l$ i  m  i$ g/ I; f
The Get_DDB service is used to determine whether or not a VxD is installed* x* s% K' Y7 G6 F9 w4 Q4 U" ?* v
for the specified device and returns a Device Description Block (in ecx) for
: g: q1 i& F6 Z# N+ ithat device if it is installed.
) G% ~1 G1 A0 z3 ?  ^. _1 K  v% N% e& r' |- P
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& P; Y; G( q& I+ Q2 l4 N) @: E
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ T* s; W3 f7 u/ F
   VMMCall Get_DDB1 N) i. T5 m8 u0 ~* ]
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: E8 M" [' Y( U- n, D
3 p% |9 X: x  W( FNote as well that you can easily detect this method with SoftICE:
+ V8 X. j% Z" U" G   bpx Get_DDB if ax==0202 || ax==7a5fh
8 a( W0 a1 R0 F; h0 M: B
, W2 W: V6 V. N7 v4 p__________________________________________________________________________
" r6 z" f2 X3 J$ w. g/ ~9 r) c, d. w
Method 10
2 d5 E" J, `1 X=========) L8 k* y; z8 {+ j9 X' e

7 v# [  a/ W. L=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ Q3 I$ s) ~! X, |2 i  SoftICE while the option is enable!!
& `& `, `% k# C0 i' B% K$ X5 L. k5 ^% b7 v5 c4 Q) K. K4 A
This trick is very efficient:2 A# B& _7 b4 Z2 O6 _/ B2 {
by checking the Debug Registers, you can detect if SoftICE is loaded
  b5 X; {" R, S  z1 H& b! o2 a+ X5 @(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
! {$ H, c! j  V8 W. A* rthere are some memory breakpoints set (dr0 to dr3) simply by reading their- L, v5 G: J/ `$ o- x  w
value (in ring0 only). Values can be manipulated and or changed as well8 a; L9 I' ]7 t. |4 [1 a
(clearing BPMs for instance)
/ B  x( f! W, N# a1 X6 e7 _- F$ ^: G; U/ k( b4 Y; E1 {
__________________________________________________________________________
9 h3 _: q; }* \" ]# D$ c0 b
  z9 _( [* S" x" ?  L9 `8 K' @+ b1 QMethod 11
& V+ `4 A$ _! K7 e=========: v. Y# o0 @+ {* e
. u8 S$ Z; G* d. k. f1 L# c# g
This method is most known as 'MeltICE' because it has been freely distributed
$ j+ v7 h$ ?$ F5 }3 Xvia www.winfiles.com. However it was first used by NuMega people to allow. R" m2 z7 Z) y( \1 H) C4 i. j
Symbol Loader to check if SoftICE was active or not (the code is located6 H; ]; g( u$ S8 C# j
inside nmtrans.dll)." O$ v" @$ F! k

8 W' J: d! _# a' XThe way it works is very simple:
6 v# P* k+ r; r3 b$ i1 p( F# iIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 V. G: W9 q& L1 yWinNT) with the CreateFileA API.
; ]( Y2 p) P  m  U; I' e( c7 w: c" x2 {. I# o' t2 [/ O
Here is a sample (checking for 'SICE'):
  S- Z# t# ?7 i6 T# V% o3 P( J
1 P2 n9 ]5 G. [0 m# j2 @4 zBOOL IsSoftIce95Loaded()) L+ ]& }7 e, R8 o, z+ c
{
+ t/ F5 H( N$ ~# i) {   HANDLE hFile;  
$ a4 v. Z( v0 S1 C: W  Y# o   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' I; P2 t* F( N" k: d: Q% O
                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 c' U: w5 p$ T2 A
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 \6 w' i; ]2 s; M   if( hFile != INVALID_HANDLE_VALUE )
- B  [; z- |( s   {
' ~9 G9 [1 ?6 G3 W  K: F" |      CloseHandle(hFile);
4 p8 B/ ^- @+ [$ y. l2 ]      return TRUE;3 D- T: O- c* I) Q0 ^% }
   }! Y# K: \! z+ \; V
   return FALSE;
/ Z4 c1 g% q4 d, C}
1 I8 @, n, k; ~1 T* P. J; K
, {; Q7 L* G1 |$ _Although this trick calls the CreateFileA function, don't even expect to be2 j: ~+ J' F3 F3 \
able to intercept it by installing a IFS hook: it will not work, no way!: [* G4 a% |  m6 ~( Q# W6 l
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 t( R' f) O1 n$ Kservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( \- ^9 S- U9 ]  k  p. T0 H
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" Y6 D. W) e8 mfield.
% }- E! K" }) j- w2 {In fact, its purpose is not to load/unload VxDs but only to send a - c0 v% a/ ^# D' K2 Z& X
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). C- x( B( h( j6 b4 z+ Z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 S+ A% j  e' v; ~- Lto load/unload a non-dynamically loadable driver such as SoftICE ;-).- j2 t9 ^  G0 Y* ]
If the VxD is loaded, it will always clear eax and the Carry flag to allow  B0 m% }' x( X% b9 S8 c  I* @
its handle to be opened and then, will be detected.
' i; Q) `+ k; g1 O" XYou can check that simply by hooking Winice.exe control proc entry point* r7 \3 f+ W; V8 e4 A3 S2 L
while running MeltICE.
, s- f- C1 @. N) O. i( U* v0 y; N& _; A. w7 M0 [
% V1 V+ t' s, h. W  N; M! f
  00401067:  push      00402025    ; \\.\SICE0 \; o& v! U7 Y
  0040106C:  call      CreateFileA" u! J: F$ q! Y! `
  00401071:  cmp       eax,-001
- i4 L4 n7 k$ T2 w( t5 b. A! G7 E* \  00401074:  je        00401091% n: P# s+ D" w0 M: ~! p3 t; A
2 f8 k; w" u  r) X* w$ ?
" y0 j' o$ u- V+ m+ x' B
There could be hundreds of BPX you could use to detect this trick.: k8 m. P4 }2 q( ~  n
-The most classical one is:" P: X) R1 Q1 Q0 h' ^
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 O! h2 T5 ]' X" t' x+ k
    *(esp-&gt;4+4)=='NTIC'4 |) @$ X7 p* t6 N! n3 P! I# [* j
% \3 [( @6 Q9 j! T
-The most exotic ones (could be very slooooow :-(
7 Q, T$ r* a( k% _# s) j   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ G. n5 R3 r: [, j4 ?+ y     ;will break 3 times :-(. ~( P# e( s/ U. B% K
: O: {! o/ E+ @6 m$ X
-or (a bit) faster: - g; s9 ~1 P7 t2 X" v
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): }9 k9 R4 J; y8 q% u
' Y' W' |4 t/ y. ]. _
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( B3 p1 C' _$ j& ]5 o1 N# y' B
     ;will break 3 times :-(/ e8 h0 P- j7 z8 L
% s- U1 E' z. y0 ^& e5 a
-Much faster:+ ]% e3 T4 {$ U7 H6 P5 j
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ b) Y& y6 m) Q) l* c  u
* z! ?( x5 M5 n2 ?; m! f, WNote also that some programs (like AZPR3.00) use de old 16-bit _lopen& T* N, O$ W0 L% [7 D" V  m
function to do the same job:
) E5 |) w6 F0 i4 f! Q/ T
' g# k0 k' a+ h   push    00                        ; OF_READ+ d0 Q+ n) \% `2 k9 t
   mov     eax,[00656634]            ; '\\.\SICE',0
% U8 E8 k8 {  O* i% M% W   push    eax
1 s% N; y* w; b/ H' m3 J   call    KERNEL32!_lopen
+ ^8 Y; F3 i6 `" ^- p, @   inc     eax
4 O. S; I% E& i; u$ f6 [% |# I7 M   jnz     00650589                  ; detected
) n+ u2 m6 Q$ d5 p4 G! w( _1 j   push    00                        ; OF_READ
+ e& S) R+ _  O! r' K- z$ v1 d  }# F   mov     eax,[00656638]            ; '\\.\SICE'- p' y9 r) R& r" m9 C& F6 W
   push    eax
* Y& |8 s" R1 K& k/ t* I# _   call    KERNEL32!_lopen
2 Q/ I' p+ s- v6 a* u- K   inc     eax
7 \" F9 f* N; J) ^/ w) V& b2 ^& K   jz      006505ae                  ; not detected
" J5 |9 V. }+ t8 S, X1 b+ C. k
2 q; r8 S' J5 k/ q- b" H
/ ~+ ~$ K$ s8 R__________________________________________________________________________9 n% E1 t; F$ r% J: I

# x# s0 W9 ?3 V: T: f7 N" KMethod 12; |: |* Z( z; h+ C5 r% \  W
=========
. m# K( Q6 |! r* k  H7 `6 v. ^& |5 M% g9 q$ N0 m6 E2 t* ]. ^/ y
This trick is similar to int41h/4fh Debugger installation check (code 05
- B+ G* r% }% \2 P  C& t&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" o  R! j9 L" M; [# R8 e# @2 _. [as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) p% Q; P; j8 a# u0 L! ~( R
: }; m8 \+ ~3 z3 I/ W7 ^% f) l   push  0000004fh         ; function 4fh
& }" A8 Q' N) n; A% J, \, m- n* `   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ U; c; Y! k: d0 |                           ; low word specifies which service, O* \& c! I+ L
                             (VWIN32_Int41Dispatch)7 _5 D  J5 ?  x
   call  Kernel32!ORD_001  ; VxdCall, J5 _1 z! X0 `" k/ x/ H5 E
   cmp   ax, 0f386h        ; magic number returned by system debuggers
! K6 K. O1 `) U3 \4 g( j   jz    SoftICE_detected
2 T! i6 z9 Q6 ]# c
  S) C3 h, N/ K3 w  KHere again, several ways to detect it:
" Y) H* I- N6 F; e2 K4 }  e6 U5 {, w* c5 L4 l9 C( q
    BPINT 41 if ax==4f, F  `. X# l" P9 E- f& ]* @

! Y3 ?8 Y5 c$ N5 Z! _. _% k    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 n# ~- {8 U( Y( r7 ~: ?+ K3 s

1 g( q( f4 O0 o; v/ K& k" r+ k! s    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: S* H- m+ h; Z9 b' h. W; Y8 j& V; u- p8 S+ J. S3 i0 D
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" m4 b6 F$ M: i$ _. |" S% x% W, w' W0 Y+ `1 o6 y; Q
__________________________________________________________________________, Z& y1 @7 I, }9 [0 {- l; S% d7 q

8 ?7 G+ q1 M: ^( LMethod 137 i* i9 v, y8 X' }7 W$ ~  ^! f* w2 N
=========
( f! e( Z& U  x8 M  r4 f: P2 w' R' g) D4 R! t% Q1 [6 q
Not a real method of detection, but a good way to know if SoftICE is
+ P) O0 ~% {4 L# x9 R5 L: K3 ~4 G" yinstalled on a computer and to locate its installation directory.
. n7 ?( v6 ?0 AIt is used by few softs which access the following registry keys (usually #2) :
. ]4 ], _2 S8 a' k6 i9 z9 w
: M$ J+ n* E- F  R-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. `5 ^& Y. j! |' t. I
\Uninstall\SoftICE7 ^) ^$ P1 x; W1 ?- ~% L
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
9 V5 j* u8 E3 o. e$ ?- u" ?  E* j-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& O* o- @) a/ J\App Paths\Loader32.Exe" i) O5 j& O) _1 ]: s5 W

; i( {% I3 v- q
' p4 e  N4 c: gNote that some nasty apps could then erase all files from SoftICE directory
: J- ]2 w* |# [/ ^& I% `9 X(I faced that once :-(8 L. |/ P& V5 z. H8 M* w, K) N

2 r% m# j9 S* P" C- E. m6 {7 eUseful breakpoint to detect it:
$ }/ }$ a, P, j" G' b5 q5 p! c  @$ `- U* P; w2 Q: n
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': W5 j2 h' A4 P, ^, [
6 i- n& A1 w3 t5 r
__________________________________________________________________________
/ l. g! O& S6 Y+ m) }- ~, }2 q4 t2 i2 J( j1 g- |* L: c. S* M

0 r2 @$ |% F: i- T2 [( X( Y8 JMethod 14 % _- S/ |+ {0 o* M5 O; p2 T
=========
$ f5 O/ H$ V) ]2 X+ s+ A1 h9 K9 X! ?, y3 s
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ D! J: d9 L. O2 ]0 r7 M
is to determines whether a debugger is running on your system (ring0 only).
5 v& C  J: U# r0 B: c1 l% G# L
! E# E/ m5 x3 g& \   VMMCall Test_Debug_Installed9 Z* V2 Z  d6 T9 Q7 E+ [" R& S( f! U. @
   je      not_installed* V. c8 n7 M8 g- I" j1 P

" e5 d3 a- |& B+ G/ \3 ~3 n8 ^This service just checks a flag.
- c7 z9 z1 z' y- ?- z8 a</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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