About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. k  m; ^- L) T+ y$ l
<TBODY>
: u- z2 H0 z; K% R) v! T<TR>
4 t& P& S/ |2 t# M, o9 O' @<TD><PRE>Method 01 - ]* r  ]. X9 V: u1 \7 B0 z
=========
5 X+ R) B" p4 C5 ?0 L
3 @+ b  c! \$ A# PThis method of detection of SoftICE (as well as the following one) is
) \7 I5 S, k6 Nused by the majority of packers/encryptors found on Internet.5 w/ \; m# m# U- G9 W
It seeks the signature of BoundsChecker in SoftICE
( p% L4 [, V. w5 R6 T' ^
# c' t/ g( ]. c& _1 N    mov     ebp, 04243484Bh        ; 'BCHK'. s, t6 K& N- |& }' x
    mov     ax, 04h
  j- R8 L" [4 d" K# f) ?/ g    int     3       1 |6 B6 T" j. w/ i6 L7 v/ x6 ]! O* H
    cmp     al,4
! T; p5 F4 x3 Q2 Y. J9 \    jnz     SoftICE_Detected
2 K0 ]8 {0 Q7 d9 e, H3 m* F4 i8 u' Z/ G; ?4 D% g, P
___________________________________________________________________________
6 g% i: ~3 E8 E7 b! @
, D' m# L" `! g% d# z. w# t6 p+ sMethod 02
) f* h; D/ a( C' W# C=========1 Y5 M; U0 P% x

( o% i. A7 t3 k) kStill a method very much used (perhaps the most frequent one).  It is used
) d7 a8 i! [( S& lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; L' C& h' x, a* Z9 n3 P! \1 }; ~or execute SoftICE commands..." R: [# T1 z7 Y+ @' n
It is also used to crash SoftICE and to force it to execute any commands
5 k' Q1 r6 D) r1 E/ a8 {(HBOOT...) :-((  
1 b" @; b8 s% K; ^! S
, F' W* I. C& D% P) x6 X) ]- p- ~, mHere is a quick description:4 ?. A6 E' O8 i  Q' \3 d$ W* D- w
-AX = 0910h   (Display string in SIce windows)3 j& I0 }! v8 R9 ]0 ~
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 v. D5 u$ Y- T3 B/ ~-AX = 0912h   (Get breakpoint infos)
* ]2 C" E8 k: K-AX = 0913h   (Set Sice breakpoints)
1 {4 _: m* B) {) g9 R9 T) S-AX = 0914h   (Remove SIce breakoints)' s3 O3 q9 E* a0 K9 N4 }, @
3 S# W( O1 q1 I
Each time you'll meet this trick, you'll see:3 z& j( ?3 j  b! R
-SI = 4647h! |# N6 Q+ ~0 n6 o' y
-DI = 4A4Dh0 j0 o. o% j/ ~: J; ^
Which are the 'magic values' used by SoftIce.% X$ K4 k/ g7 D+ r# a5 M! {6 ]' J
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
  B. r3 q7 i4 |1 B) u1 u" j  k( f" z8 c! g+ @1 }! C
Here is one example from the file "Haspinst.exe" which is the dongle HASP% _% e. `4 ?" Y
Envelope utility use to protect DOS applications:7 ], h! Q& |5 x( b- Y+ P% k! ]

6 v1 @' _# s" A4 _0 H) j" U
$ B  m( l3 W( j# h$ G$ q% z  }3 z8 q* ?4C19:0095   MOV    AX,0911  ; execute command.+ \% v" g' C  O, C' }
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; q, d% p3 V' Z; ?* r
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 J( R' n2 w3 q  W5 |4C19:009D   MOV    DI,4A4D  ; 2nd magic value., i  B+ n* G! @: B' k3 w. t9 F: T
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 z4 B; P0 A4 Q! P  x  R
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& U9 B, u, n: }1 C6 g4C19:00A4   INC    CX  d+ o( B) ~7 n1 U' N0 M, w
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' w8 V+ Z) Y) y3 G, ]+ c- c0 |- z4C19:00A8   JB     0095     ; 6 different commands.
# p) B3 t5 U" M0 ]- o6 R+ f4C19:00AA   JMP    0002     ; Bad_Guy jmp back.; e* @4 a3 R( G4 l/ ~& Q+ ?
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& b/ Z) R+ T; [9 h' ^

# f$ n1 l1 _5 Y3 t$ a3 s4 D# F: I  bThe program will execute 6 different SIce commands located at ds:dx, which
3 k& M" _1 p* {0 O. T$ xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& Y$ m5 o4 P! G0 X& D4 K# l$ Y
" L- P  b* _, \0 e4 Y' K% `
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 Y! R, ~' T- N1 T  `___________________________________________________________________________) w, p7 _* k, e$ y# \) L1 k
  W+ }3 a+ N% ?$ N' L; z

! }+ G* e! V" Z5 X* Y9 RMethod 03) u* U/ i% U( j
=========
, J0 F- f# M4 D+ {
( D- @) ]/ {; l8 U2 b, N/ KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 g3 l# b- n' w7 b( D) b& o+ s
(API Get entry point)$ C2 T2 k; R. W$ f5 E8 ~  s
        
! ^8 X, u, ?  R6 P, N5 _3 U' k  s! W2 `8 {1 w# r9 l
    xor     di,di3 A5 T3 ]' k# X
    mov     es,di
1 d, }4 x0 t) }  e$ C9 H    mov     ax, 1684h      
; H/ q( Z. I& m9 J0 {6 w    mov     bx, 0202h       ; VxD ID of winice
' Y4 P( I9 p5 [/ P    int     2Fh! P& P- I0 G% y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 L7 X- ~: I, Y0 e    add     ax, di: q, n5 H8 p7 o( b; r2 N! F
    test    ax,ax
! V& I6 w) u& z/ q. k' r7 G- P    jnz     SoftICE_Detected
9 \+ \8 F1 h' K( ~: d- h
, p# X# T) e1 [___________________________________________________________________________1 O# J0 m" ?, z# n
1 f: K" A& ]- X0 s6 q
Method 04+ b; \4 R( z% F  P1 a2 ~& T" R
=========
9 o+ V+ ?5 w& `
/ V6 o8 l; H$ [' x' W# `Method identical to the preceding one except that it seeks the ID of SoftICE0 K' k0 A$ M0 u& l. g) w+ G
GFX VxD.+ i8 y* T0 Q. {  W+ }7 E

5 B% e5 x0 z" S4 |4 m    xor     di,di
8 w/ d: _% v$ Y9 E1 I1 E. Y    mov     es,di
' y/ F& K3 ^& {9 N    mov     ax, 1684h      
( }/ u* u" B. K" e$ B" \8 F    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) [; v' s2 O2 i    int     2fh
# n3 S7 a. `7 L& _  M; b. u    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 s' c+ l4 }9 C+ ~. t. y
    add     ax, di& z' t4 X, G" h- F
    test    ax,ax9 `' C) G: \& j! O/ r) {
    jnz     SoftICE_Detected3 o$ ]6 U- e' r7 p1 V( N
! h) N9 u7 v9 {: }" a7 g+ P% v0 k
__________________________________________________________________________
- f9 h% \3 e& ^0 ~! u7 I0 {( t: p5 ~
: I* T) L9 D1 ^0 R3 @$ U9 M
Method 05
; B" p" V$ L) c7 A; e5 n=========' B: t/ X  L* @( n$ {  Z7 F& d$ m
. z: M% p4 D+ B* G/ s! q# Y" F: t
Method seeking the 'magic number' 0F386h returned (in ax) by all system8 T2 O- m) G' Q$ t- {# b
debugger. It calls the int 41h, function 4Fh.8 ^3 D# u' v9 |
There are several alternatives.  
* ~4 u$ P8 n) p5 g; r2 _  P1 x5 i7 z4 W  r
The following one is the simplest:& G  ~* C) L9 ~

) I* M+ c8 r( ~  E( m% x! x    mov     ax,4fh* n* n" a7 T% M5 C8 k5 s
    int     41h
  U; G" C5 \* v6 z    cmp     ax, 0F386; ]* G2 |0 \6 `. Y+ F) L
    jz      SoftICE_detected
/ o( a! f9 w" G0 |3 p4 q- h1 I% u: k5 o- G5 w7 t
+ P! H) e( P5 F: U
Next method as well as the following one are 2 examples from Stone's
7 L; I& Q7 H! V. W$ |, {" m"stn-wid.zip" (www.cracking.net):( L3 }) x, N! Q
+ P3 O; v6 B: y& U& }! {2 j
    mov     bx, cs1 ?  k+ m8 w. Z' s
    lea     dx, int41handler22 D/ a& g: P) e- t  ~
    xchg    dx, es:[41h*4]
* R/ M+ w  }7 R" C    xchg    bx, es:[41h*4+2]& N9 I. ?! E/ w: `
    mov     ax,4fh' O, l8 h/ N( Z5 ^5 y
    int     41h
3 J3 o. o6 I* s& X/ B5 u5 V( b0 N    xchg    dx, es:[41h*4]/ Y1 V+ w5 n' j' X! d
    xchg    bx, es:[41h*4+2]6 i! Z( V7 Q; u2 U7 W$ T0 r9 w
    cmp     ax, 0f386h
9 b- }- A5 Y  q    jz      SoftICE_detected$ N6 r6 F4 B* |" A; k7 k! q( j2 T

/ T) l. E: j* ?- I* F8 J' u+ sint41handler2 PROC
8 W0 l" D0 N1 K  Q" U) S5 R3 I    iret; [  O4 v8 X) F  r; e% W; m
int41handler2 ENDP
/ [8 [5 ?$ _2 B, s
5 T# N, h% g1 C* ?+ j% h8 B7 s% I- @3 _7 T" Z$ U7 x6 v# n
_________________________________________________________________________2 \' n) _# j  j) }- U  j/ {) p

1 o- o% U1 _0 y" B3 m
0 [, X+ c; r+ b* P- w4 fMethod 068 l% }( d1 X  R1 X
=========# g/ S  h5 C: `3 I: a, L

' l6 ]2 i' L- n6 x! v% |! k" u3 _; B  y
2nd method similar to the preceding one but more difficult to detect:
8 H0 i, b* ?7 j2 y% H- T1 H
+ A/ y2 p8 F4 o. v  j6 G) s( i7 R/ e% E0 i# @# k
int41handler PROC7 ]: ^, L" d" ~" p2 q# _
    mov     cl,al# L2 L$ z8 Q7 H) X( Z
    iret
/ j8 G$ E! z  t0 J- t5 k- s' A5 Qint41handler ENDP
, j% b( F/ L( y- ?$ a& c! q. N
+ R7 c2 F2 T7 e& x% H# g& [
0 F3 I3 Y# B4 e* w1 c( m    xor     ax,ax
) e$ a3 r! G- w% m5 W2 j9 i% U5 n( Y    mov     es,ax* N& W3 F) `" k$ H0 s$ B/ F
    mov     bx, cs( Z/ H  `: O& c) H
    lea     dx, int41handler
9 v: z9 x6 w) ]9 N/ |* T/ e$ d    xchg    dx, es:[41h*4]: F2 N( ~2 ]- X
    xchg    bx, es:[41h*4+2]3 T7 E% h& e. ~0 x' \) W
    in      al, 40h
' M0 k" L& N2 q! K( \. P    xor     cx,cx) ?& p/ x: G, O; |8 K$ M
    int     41h( t8 z; K) m0 ~: K) O8 O1 x# X
    xchg    dx, es:[41h*4]7 u% u4 N; Q3 a3 V" {
    xchg    bx, es:[41h*4+2]4 h2 x$ [$ g% ]. i% I, Z
    cmp     cl,al
2 f5 Y% i4 o& r  `0 p, ]) H0 [3 E    jnz     SoftICE_detected/ E! H5 v# T3 A5 A
; j* F  u" ^0 w
_________________________________________________________________________
; Q) A  K$ L# A2 G
- |) n9 `. Y0 s! h7 N1 P  e6 R. RMethod 074 P$ |3 a7 ~$ \& s
=========
0 ~4 L% x& d" x5 G, T2 w# e& ^1 c* {4 B; E2 X. Q
Method of detection of the WinICE handler in the int68h (V86)
9 _1 u& P% U( F% w
  {& L5 _' r) M    mov     ah,43h
. _/ Z- v$ u: o    int     68h7 A* ]; ]8 Z2 {, }7 t
    cmp     ax,0F386h
$ `. Q' y/ s* J" G9 [$ |: r4 [    jz      SoftICE_Detected
  j+ `3 u. {% |3 ^+ a' Z. y& j& }/ s( W% K7 }% E, K

/ o# B6 Z$ I: w2 I$ h0 X$ H; S9 `3 l=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& B: w0 Y: y7 d; k9 a0 V   app like this:% \; n) ^6 q8 D

" r( k9 T5 H: a   BPX exec_int if ax==68
5 K, q. l4 p4 {; ]8 u( w* s   (function called is located at byte ptr [ebp+1Dh] and client eip is- p7 d# P# C1 g; z
   located at [ebp+48h] for 32Bit apps)+ ^" [( Z, c4 p! q' E! [# b8 G4 ?
__________________________________________________________________________
8 b. d' h/ v& i9 j9 j- E
$ l7 E0 X: K: N3 b5 ^% [5 z( r% ]6 h
, \8 x9 c! K; j5 O: K! iMethod 08& a" y+ e- u5 N1 j" Q& g
=========
6 J: e9 \0 `# W4 p( X1 d: s' c% |' R8 ^  M- d
It is not a method of detection of SoftICE but a possibility to crash the5 w5 Q2 a) e) w/ k# l" r
system by intercepting int 01h and int 03h and redirecting them to another
( r6 y6 E; H( c. h- c# Eroutine.
: e, N' W* n3 EIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ X9 N+ M: \! y5 Y3 U) Rto the new routine to execute (hangs computer...)
" m8 \  k' \2 y' Y$ O+ [* v+ M
3 L  I3 H3 }% r( \    mov     ah, 25h" s; }. G4 \) l+ T# i
    mov     al, Int_Number (01h or 03h): g+ D" Q4 V* O
    mov     dx, offset New_Int_Routine
2 o# M9 g! {% D    int     21h2 Z  L7 O/ Y' W: e) O/ Y, a

# ~6 [0 M. j/ J% e' {; H__________________________________________________________________________8 M6 V: |% j- r. d

8 n, s( |9 g( u- p, h- u9 m5 w7 g* JMethod 09
( ]; A% K+ e8 v9 Y=========
9 k; r) R7 O, M! }
2 h) {+ T% x- aThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 S6 ^  t# @5 D; C4 J& N' d& r
performed in ring0 (VxD or a ring3 app using the VxdCall).2 I" P- C' s3 M2 z) Y, F8 E3 d
The Get_DDB service is used to determine whether or not a VxD is installed5 ^; [* m0 }9 x" R5 M$ O& o
for the specified device and returns a Device Description Block (in ecx) for
3 V1 p4 w7 x1 f( O4 w* ethat device if it is installed.  y8 k9 i3 o' @) c) e

8 R) q) Y5 N) U   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 s. F, F9 s' D7 F# y% w9 C3 v
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- l$ K, @1 v2 L" F% z
   VMMCall Get_DDB
$ s' G# F. [1 s0 Z! T   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! W( Q, j/ _: }; ]& A7 \0 X: l9 ]6 c7 u5 u
Note as well that you can easily detect this method with SoftICE:
9 i( [; l: t* Z# c9 x5 S   bpx Get_DDB if ax==0202 || ax==7a5fh0 ^% B& K% s0 u. m3 F# A0 `) Z
9 R  G# d  M0 S3 G# Y; u
__________________________________________________________________________8 F3 [: C$ o1 E. u4 E  W$ @& p

, c2 X) G7 P( r3 E2 z% |8 ZMethod 10
; M3 q+ B# ]0 s7 t4 F; R8 y5 s3 S, l=========0 T8 v6 A3 z) T, w! S2 O( ?
4 D# b- f. Z" C6 e
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, L% S7 i  p3 t
  SoftICE while the option is enable!!. C2 L# S: _! O# A$ U
  _3 o5 X# f! R  N# S7 @
This trick is very efficient:
) Q' [& Z$ p  m7 W$ a1 rby checking the Debug Registers, you can detect if SoftICE is loaded# H" c9 d! G: T. u% R' m5 d' |: ?
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
0 i' E* d" w: @. f/ K; G0 k: @there are some memory breakpoints set (dr0 to dr3) simply by reading their
  u6 n: Q3 {5 d& ]6 J5 ?" fvalue (in ring0 only). Values can be manipulated and or changed as well# T4 J1 e* {9 F' H
(clearing BPMs for instance)7 A% m' _2 [& d: q3 Z
9 d" }) ]8 `. Y7 Y# A
__________________________________________________________________________' b/ r" f( X- K
* X! J" U: t% y8 R# Q
Method 11
/ v% U$ Y3 @0 w0 P. U* W1 N=========
  i* I2 Q$ q4 Q# _6 ~* C  r; b* {, o9 u
This method is most known as 'MeltICE' because it has been freely distributed8 Y5 h4 L4 d3 R; e0 Y
via www.winfiles.com. However it was first used by NuMega people to allow. W; ?1 a4 V1 r1 c* U: h
Symbol Loader to check if SoftICE was active or not (the code is located: P3 n. J9 C4 o7 w3 _, e
inside nmtrans.dll).
8 g' Y: {# {* t+ t9 Z1 e' Y$ z6 L0 T5 d% j+ f; {+ P: `- G9 p- t
The way it works is very simple:2 L' c8 ^9 |# N" H
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
$ f7 X8 J# L6 V, g& A6 DWinNT) with the CreateFileA API.
6 i- B. q* X* i6 ^% t& \! a3 a* T8 H: V# K0 m% m
Here is a sample (checking for 'SICE'):
: q( u, W0 J  c" ^% o4 r8 Z" J3 X
! ^- _# ]% {) z) l) W& Z9 tBOOL IsSoftIce95Loaded()# q, ]9 \8 L3 l7 w% Z% j
{4 p$ |- U6 P& N
   HANDLE hFile;  / T+ y$ V) y! l; x: ?
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 F! j  ~% U2 ?/ c* L" n( r1 p
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. Y: K* h9 m* o7 U                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! H- S! p0 H. n/ n9 H. w' e   if( hFile != INVALID_HANDLE_VALUE )! A" A+ j: }% f; y) m" k6 M' U: y
   {! ~, @- A. Y: h) D4 |
      CloseHandle(hFile);
) I" E7 M& P. e: ~      return TRUE;
: v5 w: r% I: p  D; Q8 U   }0 z8 [; `0 }3 j' o! K' n& h& x
   return FALSE;2 f' }8 _8 U/ H  n# g
}/ ~: H; E6 N$ {2 u$ J, q; n# ?
7 ?7 y- Q" t3 U
Although this trick calls the CreateFileA function, don't even expect to be2 ~+ P! x2 K2 g1 F' B: |
able to intercept it by installing a IFS hook: it will not work, no way!
$ ?& w) a1 G, S' n' ?! u4 ^In fact, after the call to CreateFileA it will get through VWIN32 0x001F
6 x! |; b2 Q2 s0 f- M+ n; O8 Uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 \' H2 H" }/ P( E1 _
and then browse the DDB list until it find the VxD and its DDB_Control_Proc: E* k5 w3 Q. K; I- g5 Y8 G
field.$ K+ B0 V( `$ ?$ z+ h: O
In fact, its purpose is not to load/unload VxDs but only to send a % z  q# F8 X7 _1 r; H
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)$ r6 N7 c! s) V! R
to the VxD Control_Dispatch proc (how the hell a shareware soft could try. G4 I( o) h- f% `- C/ }( D) w
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ s8 G" O3 d" _! T& ^  N( lIf the VxD is loaded, it will always clear eax and the Carry flag to allow( b* t0 z5 p) S8 i
its handle to be opened and then, will be detected.  w' ~! \- |$ K2 K8 a8 j4 A
You can check that simply by hooking Winice.exe control proc entry point: `3 q/ w7 M1 n) _, K
while running MeltICE.* s8 Y2 h& O7 r+ a

2 j# w6 S: ~7 S8 B3 |. s) ~# V5 Z, j. p  a
  00401067:  push      00402025    ; \\.\SICE
/ z9 G) F# t+ p3 t& `' e  0040106C:  call      CreateFileA
4 W- C9 w7 U& L2 q' m3 e) Z  00401071:  cmp       eax,-001
% w3 r; P. K/ ~( K  00401074:  je        004010916 Q, F: U' A/ f4 o- G: {2 L
: C+ J/ ~  c: R4 \. ~7 H

. q6 E3 a! {  PThere could be hundreds of BPX you could use to detect this trick.
9 r& Y- E8 h- G- X8 R1 f4 m, b-The most classical one is:
2 T# Z- z7 e3 ?: v0 Z, d  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( M& \8 I0 t/ _! I/ H" l5 v
    *(esp-&gt;4+4)=='NTIC'
5 |8 K" `( G+ G+ R4 r. s
, W5 v0 p+ I! r; d% x-The most exotic ones (could be very slooooow :-(% m9 s" \, u+ C
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" L! @3 Q4 V( J0 z6 C( s. E     ;will break 3 times :-(
8 \' {; [5 s, J9 E
& r* h: o* U2 o8 r-or (a bit) faster: ! u$ v4 c7 h: n8 D" R  w% N
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')7 I4 y& m2 s. q+ G; O  t
# J! a6 w' B1 M" G! Y, V
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 s4 w' t1 ]) R     ;will break 3 times :-(
6 ]$ X( W2 X8 ]" |5 C' O5 T3 z
) A3 d/ Q0 |& c6 n( l-Much faster:+ A1 B. B( {" u6 i. A; X0 x; @$ P$ A
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
* D5 v. y( y1 C; ?; a+ A% y" M1 L3 o  X3 c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# S' T8 s: w3 g
function to do the same job:; r) d: _4 B' c. l% [  Z9 K) O* m
/ b4 M' N  I. b2 [- p) O0 v
   push    00                        ; OF_READ) i; v* y5 {! t9 z
   mov     eax,[00656634]            ; '\\.\SICE',0# L- C# k' q( K- e
   push    eax
( b, S" A# U: ]5 m9 e! w% q3 J   call    KERNEL32!_lopen
1 ~  E2 y& _9 X7 g# u7 [   inc     eax
& v2 ?' D' B% ~7 y% }1 B+ n0 C4 G   jnz     00650589                  ; detected
: e9 c7 r! S* q   push    00                        ; OF_READ* @7 j( W& A/ I# _, d
   mov     eax,[00656638]            ; '\\.\SICE'* p. i* h0 ]% F( n7 J4 z
   push    eax$ z5 t% Q- [+ Q+ \7 U' E; x3 t
   call    KERNEL32!_lopen3 i6 c  t' l3 V" s! D1 m
   inc     eax
: |5 s. v3 q+ N) {# w) Q: z   jz      006505ae                  ; not detected
  i( G$ e$ W. l# a- ]
7 @0 x6 H  Z; X$ @
4 b. X6 a4 @/ I: b% P* z/ k__________________________________________________________________________
1 b1 e1 R$ j; B4 m; K3 F- j# ?; e) m3 G+ g5 i3 X
Method 12
1 l8 W- B6 p' r& X! s=========
* i) p+ f9 T& M7 j& B2 u5 y$ G" F5 H4 `9 Y, U2 J
This trick is similar to int41h/4fh Debugger installation check (code 056 j5 d/ M0 d7 B; F5 T
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" j! U, @2 P* x/ cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.% z2 D2 }5 t1 A
/ @/ t, t2 ^) b  Z" p
   push  0000004fh         ; function 4fh: m/ J: Y2 K, L: V, j+ O
   push  002a002ah         ; high word specifies which VxD (VWIN32)
, @& A/ j: S# w+ W) p/ s                           ; low word specifies which service* i8 f: Q& p/ ]% T9 i
                             (VWIN32_Int41Dispatch)
. \& H* O4 u6 f5 G3 K3 M   call  Kernel32!ORD_001  ; VxdCall
1 A+ `% H, P" q   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ p% w/ G6 |/ r% \   jz    SoftICE_detected
8 U1 J: z2 T/ S8 O
( v- j$ y/ n7 X6 V3 |Here again, several ways to detect it:
4 q& E# S/ y) H8 {7 `! P: I- N% ^9 R# v% `! O4 T$ }
    BPINT 41 if ax==4f3 F1 }* J. r, f* y* o/ _+ }3 N
1 l  c$ J4 Y: W% ?* E( i- b% o
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one: y! W9 B9 q5 q0 q+ }

+ \  g4 N: R, Q. q& x    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 z( f( ~8 O1 Y2 v7 R, N
5 c! l. B" g0 g3 j9 o
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% K9 U! S# d, c

- o& o) P* ?7 G* g__________________________________________________________________________$ j& z/ t" V# C' W* P' I6 _

  X2 U0 @/ t/ HMethod 13
' r& R' M/ h+ ^4 G' g4 R=========
7 ^; X) w1 @3 P) _5 V
. d$ |8 c$ L) CNot a real method of detection, but a good way to know if SoftICE is  I- d! l1 W7 Z
installed on a computer and to locate its installation directory.
4 |' w; u; L4 _0 h0 tIt is used by few softs which access the following registry keys (usually #2) :
5 a7 Q( V4 C9 r( Z0 y( c" d& K! X: r; N
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# I8 r& g+ m( F# W. ]* H
\Uninstall\SoftICE# r2 \6 ?* R# y9 K4 E
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* O' l5 u+ A3 o
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 u: r2 N4 z* ^" z1 a4 a
\App Paths\Loader32.Exe
- \) W) J0 i0 {. H, \2 V1 [1 M1 v% z8 w' x* `6 T, s8 u

2 w; n" D/ Z  g7 ]% h. \Note that some nasty apps could then erase all files from SoftICE directory) S4 m# C6 e4 g4 |
(I faced that once :-(
" H) N/ K2 r2 t- y$ c, Q. {# o6 p7 C9 W1 f
Useful breakpoint to detect it:+ R( G" C, ^7 q6 N* R7 R
! w9 o' F; H' n$ t+ H0 [+ d4 R
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'7 Q1 _* R6 \! [. |. P" m
' L1 ]7 ]; `. I5 T6 q$ `& `
__________________________________________________________________________
; j+ L3 ]) `5 v, G& F, U- S0 b
5 J/ B+ V% q9 C9 @1 h
9 u9 d6 ]& ^% H: L$ C0 oMethod 14 # d. T" `% C7 N, `+ L9 s
=========6 g, n( d0 p. K) C3 }
; s5 A. I5 T9 A2 [& B+ ~$ y6 {9 h
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
1 U: K0 l1 k; ]/ y1 F: z2 R! Sis to determines whether a debugger is running on your system (ring0 only).
8 b2 ]; I# K2 x4 q3 {$ {) Z9 g+ y, w, F
   VMMCall Test_Debug_Installed& V& W4 P: ?5 ~7 H+ W& m
   je      not_installed& ~& |/ ?5 \" b$ e4 O7 N$ p
/ K8 @7 W/ U8 p/ Q' |8 w, [
This service just checks a flag.
, Q1 e* k3 s, H# \/ u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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