About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 |1 V3 D3 r6 Q7 d. Y# }+ @<TBODY>
# @, U' B. R2 J& h9 ^<TR>" a  }+ T: |" a, h. H4 K
<TD><PRE>Method 01
7 l4 W, w. o! a" \$ B; A=========6 Y) N8 p8 c7 Z3 m/ B" ]  e" ^# K

8 M+ w: r( K) T4 C, p" @9 dThis method of detection of SoftICE (as well as the following one) is1 M. P# }- |4 @, e( L7 B) p" e
used by the majority of packers/encryptors found on Internet.( W) l5 w* C' _) c# R9 _* t) t
It seeks the signature of BoundsChecker in SoftICE5 P& v4 m4 {% g5 p9 E3 w! f- K( D" o
+ M0 e" a1 o0 b
    mov     ebp, 04243484Bh        ; 'BCHK'
  c" Q  ~0 [7 r& k% j    mov     ax, 04h' X/ ]* \6 o% ]$ J/ H  o4 @) [
    int     3      
( P% q5 H; p  Q. Y/ p) r    cmp     al,4
1 t3 Y7 B) O" z, H3 G4 d    jnz     SoftICE_Detected' K! u/ D! I+ l8 f! }' }! k$ W/ j

% L8 _* Z" g) z9 F7 }___________________________________________________________________________2 H5 a( e) j5 N8 k2 b, P

6 T5 l: j' c' L5 V( R, v  UMethod 02: q8 S+ I5 O4 r
=========
/ J" z7 ~) U5 s' g3 I& {1 b+ u. l  f  j4 |+ e) ^" [5 `
Still a method very much used (perhaps the most frequent one).  It is used8 i! G& y. Y$ Z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: H$ u) K. r) K2 i  }or execute SoftICE commands...4 d- O% w( f; T; F9 u& ?1 y6 g
It is also used to crash SoftICE and to force it to execute any commands
+ a/ t& ^/ F0 X8 J5 ?0 ]; z2 M(HBOOT...) :-((  % n. r# ~' U5 E' w4 A% X4 K. I

  Z& w6 c( u3 v3 F' ~Here is a quick description:
% B- K* N) j- m( `-AX = 0910h   (Display string in SIce windows)
1 ]9 g" Y$ P7 f* Z* V3 @-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)1 i+ `6 x$ n  {0 Y
-AX = 0912h   (Get breakpoint infos)
! b, r) {4 v& O6 P/ p5 a2 A-AX = 0913h   (Set Sice breakpoints)- a4 l, I7 W* _+ o9 D0 y
-AX = 0914h   (Remove SIce breakoints)& M+ p6 {3 o0 V+ ~$ b  P

; ^% D/ x# |+ A, H# uEach time you'll meet this trick, you'll see:
4 {+ g- [7 }) F* U-SI = 4647h8 N' e( X  L  x4 b: B4 R
-DI = 4A4Dh
9 P* T, }* m' ^Which are the 'magic values' used by SoftIce.7 J9 Q8 i; I8 w2 M2 E9 c$ A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% b) r) [/ V# ~% w
( @4 T/ B; }5 o* }0 iHere is one example from the file "Haspinst.exe" which is the dongle HASP
, L5 a! W: o" D, |& GEnvelope utility use to protect DOS applications:6 N6 R  b$ d7 P# v1 ~3 a  C

( `6 G* A/ E. X  {, e( J; Y  t
) M9 C1 ~2 ]9 P& W) @4C19:0095   MOV    AX,0911  ; execute command.
- C$ o; E2 G- |& _/ u4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).3 ~( }( M2 V* G( y; w/ Q8 R3 ~
4C19:009A   MOV    SI,4647  ; 1st magic value.; X3 w# R/ d$ }* U
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, v4 N+ R: j* i8 Z$ k4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# Z2 x+ |$ I7 _, P8 z1 o
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 `0 h' w/ ?; N7 v+ Q0 O4C19:00A4   INC    CX
* ?7 m' Y+ w6 j' f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ c$ {2 g" b( z3 @; V$ o+ K# e
4C19:00A8   JB     0095     ; 6 different commands.
6 X& ]3 g4 o' X3 Q4 k4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, y5 ?: P: T+ X6 I. s8 O4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' R+ W0 W4 e0 [$ A

1 F- ^$ r9 c5 MThe program will execute 6 different SIce commands located at ds:dx, which
9 g/ ~3 C& d2 Z7 o" b; j) Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 q: o5 ?9 g# _# p9 ?) f, e/ l: N+ x6 g+ `
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 x" [. |  H4 Q! b' \8 w
___________________________________________________________________________
+ ~, o  I' T, }) N) Q2 s) t
7 @9 Q6 H' O8 \7 @) `7 B* F. ^
1 _+ h7 ^9 Q0 I& M3 r0 \4 vMethod 034 |6 {6 L7 v8 Y, N/ h9 z
=========
+ y' s: L; k& X) _; d9 r4 `! C- U: Q
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
" `* z$ w  [" W0 F) u3 D( m(API Get entry point)
2 z" w2 u6 T  I' ~        
; B/ o" v1 W! c, Z3 @
0 w  Q9 _, G3 O5 S; A! b: w    xor     di,di
3 V6 o4 ^$ m/ ?) A    mov     es,di
% g" v5 m4 x5 h0 ]; ]    mov     ax, 1684h       ; \) a8 D- }6 i. y8 s/ q: U
    mov     bx, 0202h       ; VxD ID of winice( H& K6 s+ K- U5 C. Q
    int     2Fh$ k9 J) L0 E0 ?" `* B1 M; X6 J
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# ]0 z* g+ {6 {& O$ _5 H    add     ax, di
! z& k9 k6 d( Y0 v    test    ax,ax
5 L# @6 I! l! l' Z5 h3 e    jnz     SoftICE_Detected
8 P, Y: Q5 w5 l: @; {  W+ I: Y
& z; @# L: s2 t1 d0 U- W7 y1 ____________________________________________________________________________! o2 ]0 R3 g: p* S: |- k) F+ |
% d# W5 r9 }6 E1 J1 U
Method 04
! D% g5 t2 b) u2 M9 a) c( x$ g=========7 n! A* w; ~4 Q1 j

, A7 {4 e& c9 W+ U5 E" XMethod identical to the preceding one except that it seeks the ID of SoftICE
+ `! F/ q+ }. p% {% \1 g: J7 GGFX VxD.
" L! q: B0 t3 H! F/ \" J' o4 L. n+ A
" f" h+ I6 C: j- U, r- ]9 P    xor     di,di0 T5 r# i# P0 U) l3 X
    mov     es,di
; Y7 i* H. Q, A+ q( F) @3 O    mov     ax, 1684h      
. c1 _% m! ~$ S0 U3 E- ?- \+ ]' j- j    mov     bx, 7a5Fh       ; VxD ID of SIWVID
$ ^! n( p$ T: |& g6 T% T    int     2fh
9 ~4 t% P; ~2 O; {. u( R    mov     ax, es          ; ES:DI -&gt; VxD API entry point; \7 c$ X5 y, N9 m" d6 ^
    add     ax, di
1 r$ p9 ]) Q$ h. O    test    ax,ax
' P# N6 K* ]4 v; h. ?    jnz     SoftICE_Detected+ R- H0 M8 D7 ?) Z0 e

3 s. W" n7 M5 M% g' T- b1 p__________________________________________________________________________
" M# m6 b8 d+ j
0 b+ s& K8 s$ R7 J( R% y9 X5 s# j& l8 d3 n. P) o) O3 I
Method 056 ]" w1 |2 Q) E* ?, D
=========& L, d$ m5 C& v( Z& S

# a6 f' D0 [/ h$ d% wMethod seeking the 'magic number' 0F386h returned (in ax) by all system$ K6 Q* g( p0 o( D5 L# X
debugger. It calls the int 41h, function 4Fh.
7 w7 P; K; E9 b' JThere are several alternatives.  
7 ~% i9 p  S2 R+ Q, p: A# y) s! x
  U$ l& a/ U6 ]) _. aThe following one is the simplest:) \% k! N# e$ N
- j% ?- j0 u9 u% u) \# p
    mov     ax,4fh0 K6 [/ g4 c& t) E
    int     41h& H$ j5 d' r8 _9 l. v; Y7 \5 X
    cmp     ax, 0F386
& @) I/ G& z6 n* p# X    jz      SoftICE_detected7 |; a4 R# {/ r& M0 R" }
( Z7 s/ f1 X, n) h2 Q8 \* V

: q$ h6 T+ I9 B, b, BNext method as well as the following one are 2 examples from Stone's
/ S9 }0 X, S2 f2 }' X4 X- P"stn-wid.zip" (www.cracking.net):
. r+ w5 Y6 J6 N$ s3 y2 p9 U* S( ?" p8 S. l( j7 d
    mov     bx, cs3 }: X7 s  B, K% u% A* ^
    lea     dx, int41handler2
* w8 o' n# i3 d; B    xchg    dx, es:[41h*4]8 @! j) w# Q" p0 T
    xchg    bx, es:[41h*4+2]
3 I5 u4 i  [3 ~: P2 q    mov     ax,4fh9 P' [" {4 V- G7 m9 }( e, [
    int     41h
& Y: S  ^) a5 Q- U    xchg    dx, es:[41h*4]9 g" R- h; X6 R/ R
    xchg    bx, es:[41h*4+2]! T' S/ V7 U; X; p% U0 R, U
    cmp     ax, 0f386h
7 r8 o9 i4 ]: R/ v# o! X    jz      SoftICE_detected
& ]1 O" \# U* I  j8 d8 S+ y, ~. m- c! \" o
int41handler2 PROC
6 |, A' o9 e7 {+ e0 c1 F    iret
3 P$ [. S5 |2 T" S7 rint41handler2 ENDP
3 c4 u+ \. z6 A6 A- a  k% Z: }
" I" W3 A6 c4 q
( {  e3 w- z0 t2 ~4 u5 p_________________________________________________________________________. L9 ?& A. ?% H1 k: D

/ [. K. r5 |; F5 U$ Y; {( u% S; M7 b& O$ k
Method 06
5 ^9 t, S; W: m  U5 s7 v+ A0 g5 A=========5 N3 T1 Z+ t* O, c' j0 O. @

3 |6 ^0 E4 ~+ u" N& A8 B- e  U: a$ S( q0 s4 A7 |% `
2nd method similar to the preceding one but more difficult to detect:# c6 k$ w2 u" g; c$ _
* A9 Q) }2 U3 V) k% W+ w1 i

. m+ D. f/ {; E( F& m3 }int41handler PROC7 [# N, S% V* y. w; M. [% }$ Z
    mov     cl,al
3 R3 k; ]0 ~) ^" z' S6 Q% i- {    iret) W/ |4 W/ o4 @1 Y
int41handler ENDP2 V. K7 J# u+ t0 Q, h
% ~5 Y; k' d5 N4 N7 V

1 W. V3 N# a7 h; q( R    xor     ax,ax9 u; c' I8 F+ u0 W
    mov     es,ax2 C- b0 `6 Q& l9 N6 d0 P
    mov     bx, cs. k8 |: H+ w, ^/ D% z
    lea     dx, int41handler
  K' F# G6 |. ^. i6 A  @/ j    xchg    dx, es:[41h*4]
1 `8 \6 G) T  f6 L    xchg    bx, es:[41h*4+2]2 Q* ]6 r+ `5 L# B( N
    in      al, 40h
8 c1 {3 f2 c% e, x; l6 T. b2 t: R    xor     cx,cx
. v/ G* m! [: W% X' N    int     41h2 c/ ]8 f% k2 r. M& K( j  ?
    xchg    dx, es:[41h*4]
$ Y3 z. h( N8 @" ^) x- R- _    xchg    bx, es:[41h*4+2]3 A$ @& G" S- l; n
    cmp     cl,al7 y9 }" w, G% Y+ H) d
    jnz     SoftICE_detected
- M# _+ U+ q$ f  b( ^4 n2 p6 L
( e1 A$ M/ g4 G) U0 k; O5 y_________________________________________________________________________
# j. j! j( E: r+ R$ T
) G8 W" e, h' m+ QMethod 074 s: y% _, r5 y9 B/ R/ d
=========
" I( K+ ^5 ^( n8 C' h$ t: g2 B) h% |# i. A- w' z8 x' I' ]
Method of detection of the WinICE handler in the int68h (V86)9 W! y4 b0 e8 ^4 z4 R
/ f6 v, u" _1 j- n! Z1 c9 k! o2 _* A
    mov     ah,43h, c( E/ Z: ~% q, m
    int     68h
+ C2 U( i" R9 c3 i: a- a' Q    cmp     ax,0F386h$ g* x/ T5 u- M/ {1 L4 a, N
    jz      SoftICE_Detected
: `! q: V& r$ J; S+ T, e# \* \: a" Z3 i" ~! i
0 j' ~4 Y6 C" }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 C  Z5 t+ t. n2 a, `  m& v   app like this:
/ m/ M5 w( X; i6 Z2 b% r% U* y* b
2 Z2 k- f% g0 A( l" s6 h   BPX exec_int if ax==68
8 Y# H3 O! T# x8 M5 k0 n2 m' n9 h   (function called is located at byte ptr [ebp+1Dh] and client eip is
# b& S0 f# h! x4 h+ o# c5 ?. u   located at [ebp+48h] for 32Bit apps)' Q# `+ p0 e$ s% T+ J1 `* W) s& O
__________________________________________________________________________
) y+ R  B8 i* i; s" v  z. K
1 n5 _* |# V  N' I. G" {. o. @, v
: H4 T5 f6 N& v& q& oMethod 08
0 [: q) A* k  h( ^: d/ |  p- H0 r4 p=========
8 y2 }: _4 g# x) [# E8 J4 D- J
It is not a method of detection of SoftICE but a possibility to crash the
9 ]* b5 ?7 ?& d$ bsystem by intercepting int 01h and int 03h and redirecting them to another
7 K  H8 ^  `" F8 Zroutine.
8 c7 r. |/ {' b4 [; g5 a& WIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 J- |) p% |; ~5 \to the new routine to execute (hangs computer...)2 K, [; x4 R! H1 F+ F
* s2 j, C1 s4 U" e; {: }+ x
    mov     ah, 25h
/ |4 T! c- U$ K% K7 B    mov     al, Int_Number (01h or 03h)& q0 Q" W; W+ q1 w8 ^4 Z3 f! I1 I
    mov     dx, offset New_Int_Routine6 I" T5 [$ u1 M4 W
    int     21h
4 `. a4 k. V, h8 h4 I5 d
( w( D+ S8 B% s! ~__________________________________________________________________________0 t/ X3 N5 `" q$ [* r5 Y

5 s( H* r% H/ h9 O! \Method 09
( A6 n. |: C9 e1 O1 n=========- v, _6 G- E# ?; W) N
: O: P. X+ m8 @0 |/ V
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
. ]0 N  c0 H' e9 f1 iperformed in ring0 (VxD or a ring3 app using the VxdCall).
& z- b4 y7 f6 f) I9 o8 G) J- vThe Get_DDB service is used to determine whether or not a VxD is installed7 i4 H& x: u. J0 f+ a5 ^
for the specified device and returns a Device Description Block (in ecx) for
5 e3 ~: O. _& {  I7 P" Ithat device if it is installed.9 A9 g& U( l7 [) Y1 Y# {
) _, E0 D# P% c% S- G( l
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 `: B: H& S* c
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): o6 H" \- v6 c
   VMMCall Get_DDB% y: }/ n* m4 R5 U2 _4 k8 h( w: x
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  j8 B3 _7 x- R$ @5 ]+ X. A8 z
# H/ W8 \% M5 s( m  I' j* Q
Note as well that you can easily detect this method with SoftICE:
. `% ]7 f( n# g$ H   bpx Get_DDB if ax==0202 || ax==7a5fh  r2 s- s' l, e. n

/ R' S5 y( t8 j% h$ \__________________________________________________________________________7 A0 I% \- i9 J: h+ L4 `$ u. N

# C# @( [2 E5 v* j9 a! T6 h. WMethod 10" Q$ U, q, z( G
=========
5 l4 c4 n3 A7 ~% ~/ R! d/ R0 B+ u, h6 M  s, m" x5 ]. N; ?* N
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with* l  d7 m! g0 Z/ o9 @( A( D: M
  SoftICE while the option is enable!!
$ X& D4 z% p# i4 u+ P
( I& B: \' C' {8 N* }8 cThis trick is very efficient:' [5 O1 T: g9 z9 v
by checking the Debug Registers, you can detect if SoftICE is loaded
) K8 C3 Y/ b4 X/ H(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! h7 n: m  u- I: v) h
there are some memory breakpoints set (dr0 to dr3) simply by reading their% \8 B) |4 G: w$ m) Z
value (in ring0 only). Values can be manipulated and or changed as well
! I0 r; Z/ d" H, H& C) U  A(clearing BPMs for instance)
5 e* A# {4 M6 Z/ b$ K; l& {
. f) E/ w, q0 k. |: I__________________________________________________________________________) s- k+ P5 K+ l) _" g# q

3 k1 k. U# o3 CMethod 11
7 W; ~9 t0 S2 A* r: \=========
/ ?6 _6 z/ `) r0 [' u5 J* N
2 x4 A  Y2 @$ A# DThis method is most known as 'MeltICE' because it has been freely distributed4 S0 X5 `" J6 n' M  F- u* R
via www.winfiles.com. However it was first used by NuMega people to allow4 x  ?( r7 q6 j- D, Q: k
Symbol Loader to check if SoftICE was active or not (the code is located
  y2 S7 K- o/ v, A$ l. ginside nmtrans.dll).
( r: c  @7 _% C3 |  T& ?$ H# A' S
# i* a' t' E/ n' wThe way it works is very simple:4 K+ k7 @/ K/ u
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 |4 @8 b% e. }; oWinNT) with the CreateFileA API.) F' }$ a3 Q. I& u
6 o" t  X+ ~% _1 e1 n! b
Here is a sample (checking for 'SICE'):
* c$ a# V: C0 Q, i; y, u! o+ E: p6 R' C4 V
BOOL IsSoftIce95Loaded()
3 x! A( z) ]4 }{
8 D4 T* I2 b; g; ~# B   HANDLE hFile;  
( [. O- n+ f1 I/ D0 e1 N6 H   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) Z4 K8 x* x) S) x' g8 W, }1 m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ d7 o2 ~. `/ U
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% b. p3 w% h, u4 N: a
   if( hFile != INVALID_HANDLE_VALUE )+ c) z: U) V/ D" F! ]: `' a& Q) a
   {
( f! M6 m+ j; D4 ?- }5 N/ \& S      CloseHandle(hFile);, U$ b1 I0 ^; I1 C, T4 ^8 h* Q
      return TRUE;
% a5 w8 \5 \: N. v; D- r   }( W) m6 r6 E: {) x8 c( X6 z
   return FALSE;
' P; |" f% A" b}7 F" l: {- @2 r- I4 k/ k1 g! l: e
9 U$ G/ c! H& C( o  I
Although this trick calls the CreateFileA function, don't even expect to be
% q' _& D5 H/ Y8 a# cable to intercept it by installing a IFS hook: it will not work, no way!
; P$ R3 ^2 h2 D7 QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
- R# w: s  q" v* v6 [service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
% _0 H* C" J4 l( |8 C( A3 cand then browse the DDB list until it find the VxD and its DDB_Control_Proc( c0 Y# D* g: K6 |
field.
) B, m( A; b! SIn fact, its purpose is not to load/unload VxDs but only to send a 4 R; s* W. e) y3 r% V1 U
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- ^% S3 k9 W9 H/ o/ p$ m4 T7 mto the VxD Control_Dispatch proc (how the hell a shareware soft could try* T/ a: v- v0 e
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# N2 X* W) b# N: N2 v: `If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 |2 z/ i4 W. C4 k( E5 Eits handle to be opened and then, will be detected.
, B# e" [9 D4 R) |. HYou can check that simply by hooking Winice.exe control proc entry point4 N  E- e) V& X1 Q# x7 ]2 @- e# D
while running MeltICE.
, C- u6 F; y! k5 v3 n" R5 A* y" q5 i1 d
" W, @4 m& x5 z1 C9 I
  00401067:  push      00402025    ; \\.\SICE% C4 P- j) l& \; M0 k
  0040106C:  call      CreateFileA/ d6 E1 c8 z/ d  d) V
  00401071:  cmp       eax,-001
# Q1 r, ?- J5 P7 N7 K0 C( ]  00401074:  je        00401091
: R  F4 ]) Y/ S
, x& I  Z5 `- @( n& p( Z% v
' u8 N1 C  O+ x4 B, p! g$ t; D. CThere could be hundreds of BPX you could use to detect this trick.5 [0 _( F) p6 t* |/ _% F8 L, ~, f
-The most classical one is:
6 U7 S! N" c. i6 ^& }0 `  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! b* Z8 g: I. N6 P: F
    *(esp-&gt;4+4)=='NTIC'/ z2 |5 c* @2 {3 @* G
/ R. I8 q$ t3 R" A3 o% X
-The most exotic ones (could be very slooooow :-(
5 h; ^8 S4 i- Z2 v+ T, G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; u. B; T4 W9 a; E( o8 N9 K     ;will break 3 times :-(
$ e3 m" {- I' [' p6 K
8 n; k5 a0 `- H3 r+ _7 n-or (a bit) faster: . S# C6 J9 v, \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 z; K5 Z7 }) V/ l! I6 ?( D3 a& p" l5 U
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" M2 _# ]. H" Y9 ?     ;will break 3 times :-(  x& X" b+ h% i
* a4 R5 T6 n, t7 l) w6 z- b- _
-Much faster:7 w6 r: Z8 {& D' ?$ z
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'+ Y" ?" O3 r  N9 t
% p* {) M* Z5 W  C
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* T+ Z7 r% A9 ^0 d% tfunction to do the same job:3 \: t$ u5 _2 D4 F2 W' b2 z
; k7 |6 g% s5 N) D
   push    00                        ; OF_READ
; Z. P* s4 W$ C+ _& ~. u   mov     eax,[00656634]            ; '\\.\SICE',0
2 N! J9 e! ]* }" S$ D; y+ C1 F# b   push    eax/ Z- ~# U3 x1 K) Q% Z; g3 j- @
   call    KERNEL32!_lopen
1 r0 R  }- C% P   inc     eax; y' b) _$ S: Y( X/ _7 L/ ^
   jnz     00650589                  ; detected0 |% d& X* n9 ]0 E7 `
   push    00                        ; OF_READ+ U  D) }% B$ y7 H$ S! a  K
   mov     eax,[00656638]            ; '\\.\SICE'$ n8 u: E  h+ X6 i( e
   push    eax
0 u; n, E% Z' ~; _  Q- a   call    KERNEL32!_lopen) I" Q; f' m; m- d: O. \
   inc     eax5 I- N4 u8 N1 q  {  A$ L
   jz      006505ae                  ; not detected' R: W& Q! G. G. B" K, ^! E

# u7 M  b; q8 s: u6 a" `, Z. e. |" j: Q; X3 F- H! y
__________________________________________________________________________
, m6 D" s- S9 B) n
" z- S5 U, K" h9 A$ uMethod 12
$ m/ H/ |+ B, D! U5 `% O6 a=========! t/ o% f2 P* G6 m  t
" X3 l% H7 Z4 R6 n3 s) E( Y; A
This trick is similar to int41h/4fh Debugger installation check (code 05
8 a- |( C8 T$ j- G% j0 J/ ], R&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 ~! A5 e! Z0 e; |" H. N
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& d, b+ v8 n& _/ |
+ K  `. H: r' ]8 |   push  0000004fh         ; function 4fh
$ N5 J: S* h% N1 o9 Y* v   push  002a002ah         ; high word specifies which VxD (VWIN32)
. B8 V; ]" @. P8 R8 @                           ; low word specifies which service
+ Z- ?& m1 i" F                             (VWIN32_Int41Dispatch); P, V) L; Q  Q: u; A( ?. K/ I& D
   call  Kernel32!ORD_001  ; VxdCall: `$ Z. l1 Z+ i7 ]/ j) \8 i
   cmp   ax, 0f386h        ; magic number returned by system debuggers( W, P/ d( A! w( }- S1 R
   jz    SoftICE_detected
: {" l4 s8 k* ]4 B/ Z* ~! ]# f1 l
9 @, D; U9 J3 |! j. ~  O& d/ m2 wHere again, several ways to detect it:
  n* v$ Q* G6 w! K- n4 b7 T  w/ w2 S6 S9 m6 S
    BPINT 41 if ax==4f
4 K1 x5 p2 t, v7 P# V6 q9 `) c/ M6 V2 f$ l9 ~4 u+ M" O( E$ \
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, g' _4 ]6 `( Z6 J
5 J* v0 X9 g( z3 F
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( j6 N' u; ]7 A( b

/ d5 V7 }( f; N5 ]9 m3 h    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' m4 B" M, \4 T+ j' q$ D
' z# L9 F+ v2 `6 v) t: B* |7 H__________________________________________________________________________
0 p3 p) M8 P% Q  E
) n, {5 Z  z' dMethod 13# u( @2 o% O% V
=========
! M7 D+ P- v. Y: {/ t) [. x& W5 E2 [: w
Not a real method of detection, but a good way to know if SoftICE is( M) P8 J4 D* n( ?$ n# [  e
installed on a computer and to locate its installation directory.  v* S$ ]0 J+ ^, V* Q
It is used by few softs which access the following registry keys (usually #2) :' ]) E/ C& H( k3 l: t9 d
; P% S) R0 W" e# q0 z. I: U0 W% r5 q
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. p3 P0 ~& a8 q. s; n& I& `\Uninstall\SoftICE
2 X2 F1 g7 k: c3 M( e# V-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 Z( f; \" Q3 F
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 o$ h8 T* o" V- \" i/ e4 s
\App Paths\Loader32.Exe; g' V/ w. P/ E( I/ z
. E6 h* g1 F' E# s0 s( `& T1 Z

. v4 G7 Z/ b0 Y! W7 V" K6 ~Note that some nasty apps could then erase all files from SoftICE directory
; L: ?9 j( [, Z+ g9 p3 ~' ?(I faced that once :-($ M# M$ c9 f+ s) o

9 d7 A2 f" d& @* {Useful breakpoint to detect it:
( `4 U8 o9 r* \4 z1 w- t/ |3 v; P& H" ~% Y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 i( `4 n. f# [4 W- d+ |

3 |5 ]& j' v0 @. U9 j__________________________________________________________________________
1 p1 G4 |" g! J  ]1 H, |. ?
9 [) R# d! z5 j8 J2 \/ E4 o4 d! U
Method 14 1 u  n8 w7 f5 q$ y2 a
=========* E' N7 b0 r3 D

) r: `) x: y$ h$ dA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose  n6 b- ]$ D# ]% H5 O
is to determines whether a debugger is running on your system (ring0 only).* T* H+ E% T; u! V
8 ~2 i' Y9 }" \, r% }- q, R8 i
   VMMCall Test_Debug_Installed5 R1 a3 O( F, i* E/ B
   je      not_installed: }$ Y0 X2 g$ }+ D5 q7 u
% n- w8 w) K1 N. Y! C2 }# y
This service just checks a flag.0 \% r& h: {. ]3 {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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