About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
. X3 K) x/ Y/ q% H<TBODY>" @1 n* [3 \9 \, o- A" f) w; z
<TR>" R: \2 |3 L" v* P
<TD><PRE>Method 01 , V& }) Z( G+ b1 I- P0 G4 V, N
=========
" w! e2 B" A' w! h; K8 A3 |; F0 J1 s8 a# E/ w
This method of detection of SoftICE (as well as the following one) is6 _! c, }' m% L7 T, x% I
used by the majority of packers/encryptors found on Internet.
7 {* b+ T- b% O/ |/ d2 NIt seeks the signature of BoundsChecker in SoftICE8 [! O$ I' ^1 K

+ p! f3 i- S$ X$ f: w! x    mov     ebp, 04243484Bh        ; 'BCHK'% m3 Z9 b: K4 H& k+ g1 |6 ?
    mov     ax, 04h
" E, S/ S5 s7 r/ r, m# h2 z$ ~    int     3       5 e' P. C+ e/ s2 v- b4 }
    cmp     al,4
; i0 ?9 z. Y# |' l/ p/ i! Y    jnz     SoftICE_Detected
$ ]. w) z" W4 p' e* Y
2 r: K6 H! N+ d& |- H8 f___________________________________________________________________________
% F( Z  [& {& A7 F/ t7 F
% j, S' Y* k0 x" k% n1 h4 YMethod 02  ^9 q' ?  E6 F1 q0 P! D
=========
% b- X+ b" x, e# S9 r- B) U' ^6 s' h1 u6 S$ l6 J3 ~
Still a method very much used (perhaps the most frequent one).  It is used
4 S4 z" w  J) d0 Tto get SoftICE 'Back Door commands' which gives infos on Breakpoints,$ [$ Q  B. W; _6 \/ A+ G
or execute SoftICE commands...' o& Q& P8 d, R5 x
It is also used to crash SoftICE and to force it to execute any commands; ~) L7 f' D2 z8 U2 h: C1 _. S
(HBOOT...) :-((  
, N# p, G+ ~+ `1 i6 i
- y; i' \/ x0 g/ Y9 n' @; X( S* _! ~Here is a quick description:
+ O0 O8 t7 Y- {# C  P-AX = 0910h   (Display string in SIce windows)8 n* k4 K! r# z) W7 F0 z- \
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  d, H( P- i' l2 T5 `
-AX = 0912h   (Get breakpoint infos)+ E# V/ c4 a9 p6 o7 l7 x
-AX = 0913h   (Set Sice breakpoints)
2 R" A7 f( d$ ]% N& s-AX = 0914h   (Remove SIce breakoints)
1 r* p; _4 i# I; x' R5 L5 ?% Y' O7 e; I
Each time you'll meet this trick, you'll see:; Z5 n+ t7 |1 _6 F" M7 r& C+ {
-SI = 4647h
& t6 t7 v( B3 Z9 ?! K/ n6 ?# Z-DI = 4A4Dh
! r! B# e7 t8 uWhich are the 'magic values' used by SoftIce.
9 S1 L. w6 J4 ]' J8 \; t3 l" N% J+ ?For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% I, I. L3 K$ T+ `$ _0 |' b
# y6 P4 C- ^. l* @0 I! W7 mHere is one example from the file "Haspinst.exe" which is the dongle HASP
& @) ]8 t$ X" Y6 {/ Z) @6 V) bEnvelope utility use to protect DOS applications:& ~1 E' N2 l3 H1 `  _3 C( P2 b

& r+ M$ L- q" W6 T; F, Y' n1 @( X  M1 B8 B, y
4C19:0095   MOV    AX,0911  ; execute command.+ b6 Y4 r$ e- a$ X3 Q( {
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! f8 n6 d) }' K( z9 T4C19:009A   MOV    SI,4647  ; 1st magic value.' T) p6 t  ]' ^8 t7 J8 }2 u2 i" E* u
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
1 t/ ~5 Q3 G; _6 U" m1 f" \9 o4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- E+ G# X) m- v2 ?* M' L8 K
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- H  H' g* N  x' Y% d4 h
4C19:00A4   INC    CX. z! }/ ]* A& Q; ?
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute  }4 @" t& o& N" Z6 U/ \7 f
4C19:00A8   JB     0095     ; 6 different commands." d5 s4 Z" a" Z( _- ]6 T
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) a5 I" R# I, A- x9 n' p' v( `( f
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" Y. M! j- k" S8 s: V

$ Y! L1 f( ~& yThe program will execute 6 different SIce commands located at ds:dx, which
: z/ |9 J6 \, Iare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% ]6 |) y) C- o8 |% Z! Z
6 Z" e4 i0 q5 P
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 Y" \: w  r% ?8 C2 j2 r! O
___________________________________________________________________________
) C; @, F: l5 b2 S/ q2 g, |. O/ ~: q

/ r" U5 C; s0 {* U7 V# jMethod 03
( W% e9 V1 ^% \3 c6 k=========9 w. K# @3 L" I$ L0 Y
# H4 p9 D! y& X; L  I" j, x
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 d% C% T0 R" W$ e& Y
(API Get entry point)
* J( A9 M$ u& S0 _0 d. K" [        8 @+ [+ `% {: U# t! j$ ?
1 C4 M$ R% Y4 B+ y
    xor     di,di
/ B  _; R5 e) ]$ s5 F% y    mov     es,di! s! y; V# b: O) l  f
    mov     ax, 1684h      
8 \2 c: w9 P/ l$ z2 i( M; Y9 X    mov     bx, 0202h       ; VxD ID of winice5 a  a3 T3 [! c1 I9 L( n3 S9 B: ~
    int     2Fh3 ^$ e, u2 @1 G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 t8 ^+ W: O9 f: A1 }3 v/ O3 N' m
    add     ax, di
5 Q0 f# r' I% ]. \7 x    test    ax,ax' a8 K4 g* c: V; D! w
    jnz     SoftICE_Detected
, N& T5 \1 v: m) t; z" w0 z' `# I: R, h$ T9 |
___________________________________________________________________________1 s4 f7 c: @6 v# Q

7 o0 F/ r8 ^$ C0 Q) w0 X- ~Method 04
* z! f4 F/ U9 ]5 D5 D8 G=========) e0 J) I- N2 u% f8 t, g- ]: H
# D; ?% m3 e: y3 ~( [
Method identical to the preceding one except that it seeks the ID of SoftICE
) ~. T, {/ I2 t3 F( }GFX VxD., l- K1 S+ [! d  y; P* U- E! i
8 H( l/ _5 u& a( R+ x, _
    xor     di,di
% D) |" v: ]; U! B! M    mov     es,di
4 \2 g* k9 Y: z$ Q, O7 ?+ @& q5 G    mov     ax, 1684h      
2 d8 w. g  G( L$ g4 R    mov     bx, 7a5Fh       ; VxD ID of SIWVID# i# u9 D9 L. G/ X. R  Y6 r8 F
    int     2fh! r* i5 A# f7 o1 b! L5 E, y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point, ~! z2 a9 `" c. A! D
    add     ax, di
/ s6 H0 U) Y0 `& I  {# n    test    ax,ax
$ F/ o1 G" }( d- `    jnz     SoftICE_Detected4 k9 |5 o5 w6 \0 Z5 {1 D& Y

/ |5 J! R0 Y& h__________________________________________________________________________
6 K. i$ r# ]1 N' V. R* m. [) L; [3 |2 {% e
+ x4 p: s; V! s7 c5 r: J
Method 05/ m) c5 [: g( y- b
=========( H' }0 L4 h# R5 P

; A' Q. z! l" c$ c8 k( ?/ `Method seeking the 'magic number' 0F386h returned (in ax) by all system
6 @, K) l0 y$ I; h) x* d( K( Jdebugger. It calls the int 41h, function 4Fh.  S4 G" D3 d$ \6 h
There are several alternatives.  
8 N' B( x8 o9 Q3 l6 E+ ?, E# A4 x  e. \4 C3 G: }" s& a" b
The following one is the simplest:
0 |5 g3 u. ?' V5 t+ Y5 e" D+ L
: U" P8 _& Z  ^) r) F# |    mov     ax,4fh
. w+ U. `! G# @: f3 b2 R    int     41h
8 q2 }7 n! V6 u: z" {+ f    cmp     ax, 0F386
6 ~6 }+ d2 Q5 O5 h! p$ t+ ]! W) k    jz      SoftICE_detected& v! j- ~6 [$ z6 |# Y* g% x

! B% C" F7 S$ }4 T& @& }* j# X( Z5 e  e' E" e
Next method as well as the following one are 2 examples from Stone's ! D3 U! r. b( G. J+ X8 m
"stn-wid.zip" (www.cracking.net):8 _+ W2 e2 y$ l$ v7 ?
0 F5 q# G: U/ ~
    mov     bx, cs& a, F. k8 `: p( {: [& |
    lea     dx, int41handler2
8 X# W  d- B7 T) |! j. \4 d. q    xchg    dx, es:[41h*4]
0 e6 w0 O* g  S% j3 F* L* A    xchg    bx, es:[41h*4+2]3 ^; _2 s2 j% z0 }* U8 C9 M
    mov     ax,4fh
% Z; @* D3 ~# F    int     41h) l( P% Q8 Q$ M% M7 j/ }
    xchg    dx, es:[41h*4]' {6 n# l# o. f+ d2 ~9 A
    xchg    bx, es:[41h*4+2]( O' M, @' L7 K# o4 q$ e
    cmp     ax, 0f386h9 x3 h/ J+ r2 j' `$ z* Q
    jz      SoftICE_detected$ K) c0 o+ L. o# r- y/ j3 `* f
1 k4 ^7 ^- ^" q: q# Y
int41handler2 PROC
2 u/ B% r6 [5 B: [& t: G    iret
8 ^+ J! O( g. U# Y& ~+ V' Bint41handler2 ENDP. }! O9 z9 ]2 Y$ Q! C( B. D. v- I+ C

' E& F" v# p$ U/ \1 u8 ^- A3 m2 i/ W" K# K  W( n4 u4 K% ~
_________________________________________________________________________
. w( ?" Q% G6 ~5 }; r9 j5 x
7 I  Y' L4 _! R' s( M* x5 x$ w( [) t5 k" ~1 @
Method 06( u0 H1 q# _: ?0 F
=========, D) o8 p* A+ Q

9 K. |9 e, A! ~+ A" b9 W: m1 `
" {. L4 V7 Z- M3 j2nd method similar to the preceding one but more difficult to detect:
! P! K6 ~. y, J8 p- h  k" T) A
! S6 z- @. |7 x
. e( _6 @4 Q. Kint41handler PROC+ T' P8 I7 }" h9 u- j
    mov     cl,al
6 z& B( q, i( |    iret
( u+ c* I+ z% w9 P' F) lint41handler ENDP  `( B4 M+ B7 z7 I$ Z: `
/ a5 F7 f6 U5 @4 L

+ W; S/ U% x$ p9 _# G* H  ?    xor     ax,ax
0 T/ p8 N6 b5 g, ^; m    mov     es,ax0 f6 }* F8 @1 Y" A% `1 P. S
    mov     bx, cs  j0 g3 Y# ?, T  S$ J9 b
    lea     dx, int41handler2 D$ x8 j6 R. P( L
    xchg    dx, es:[41h*4]% j7 M& E& b$ a% ?( N' O& w) S+ W
    xchg    bx, es:[41h*4+2]" j1 C# S( Q5 I: j1 ~  H
    in      al, 40h, `' l. p/ o- l% f
    xor     cx,cx* v# m9 n3 @. a" L" N+ \. _
    int     41h
: w0 b! Y4 \- {    xchg    dx, es:[41h*4]" n$ t0 A# W! Q- }$ a- W% g! w
    xchg    bx, es:[41h*4+2]
2 Z1 [* W$ D* J6 u" _+ A7 I0 u    cmp     cl,al- H8 |; F& ]) r
    jnz     SoftICE_detected
  Q9 H3 j: T4 D; J! T: h' @- ~9 p0 v) ^0 M- z$ a, t, m: t; k
_________________________________________________________________________2 o# _8 p; h/ d: D5 c

: Z: o( ^6 c) Y2 _Method 078 P4 x1 G' b' w3 P. ?) W
=========# |4 T* p* A! i" e; C

2 c) M( O: @: _% g3 pMethod of detection of the WinICE handler in the int68h (V86)/ ^" l( M* ?% L* s" ]7 O9 a/ V
" Z8 ~" `5 D3 n0 S8 e
    mov     ah,43h7 x( N/ K, V) x
    int     68h1 Y% u5 i1 E% c$ E$ m0 U- t: o
    cmp     ax,0F386h
( W) p+ T( m. H& F) k/ j    jz      SoftICE_Detected6 r) Y9 I9 _5 L& ?6 B. B

# p/ q. t4 R& k4 L# B$ j% W" l, V9 T4 O9 ^
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
' T+ s2 y( @* J2 d   app like this:0 w1 {$ X& A5 k: N% ^/ \
! l, O# h$ _! k4 n
   BPX exec_int if ax==68
; @  j' A' x1 N6 H3 A( Y8 ~   (function called is located at byte ptr [ebp+1Dh] and client eip is
: Y& a6 |! J: P( ]5 ?/ o   located at [ebp+48h] for 32Bit apps)! C7 J( L. s7 m9 Y4 Q/ n
__________________________________________________________________________
9 ^" }% f$ E. b4 u6 y5 y4 U8 S0 s' D9 F  U  R- ~

% a$ D8 c, I1 z3 H- Z' Z! lMethod 08
4 }" [, k+ [. z3 q, D=========# a4 o# s8 d6 A
  n2 X6 b( o2 W& T9 ?% q
It is not a method of detection of SoftICE but a possibility to crash the
/ s# d' H0 u" U2 h& B+ F8 F- ksystem by intercepting int 01h and int 03h and redirecting them to another
- G, G6 R, F! R; Y% G9 o1 rroutine.
+ u) k2 {1 D) [, LIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
1 X9 u$ ?/ [- d3 ?to the new routine to execute (hangs computer...)
/ J# K* k) Q4 D% W* J2 \, f0 @/ ]/ C6 ^
0 P: m! b8 B  a% ~( a+ ~7 {8 m    mov     ah, 25h( X- D. X/ q8 U
    mov     al, Int_Number (01h or 03h)9 ^+ S4 B0 y+ @# q) P0 z
    mov     dx, offset New_Int_Routine4 u; _' v  I( X! f3 G
    int     21h
; E  |: s7 ?7 d0 ~+ I. K  y# _5 E% f& ~5 x; |
__________________________________________________________________________2 Z: {% D. `4 b0 q  {7 o. W/ E

1 c, j: M  m: J  |Method 09
! j/ P3 {" z; {* @5 p! F=========& t( T. X2 t, @- V  E' D) m
8 w. g' I& S0 h! k/ t
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ T6 T1 I0 M; B1 B: e& s& iperformed in ring0 (VxD or a ring3 app using the VxdCall).' T1 V# Y1 v; p3 z9 ?; Z
The Get_DDB service is used to determine whether or not a VxD is installed
" L+ L, ~$ [3 I, d7 u0 Sfor the specified device and returns a Device Description Block (in ecx) for
9 V3 g9 b4 g7 k8 Jthat device if it is installed.
+ I2 t8 l! Z& g5 w; r- p" w9 j8 V; a" H2 L2 `- ?; Q6 w  e
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID' m0 j+ k6 x2 F: S8 w6 V/ H
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)& X9 ^- `' c# P( [5 ^$ F7 t
   VMMCall Get_DDB
' P8 C4 i" V5 j# @7 R( v   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
" q9 L0 c3 \# g$ p  l" C
  k8 K/ Q; w  J/ e( I7 q) SNote as well that you can easily detect this method with SoftICE:2 A( v. n$ V$ ^1 j/ I1 y2 n2 _# i
   bpx Get_DDB if ax==0202 || ax==7a5fh
5 w) W% H! U. N5 g5 J' a
: r+ c, h" o8 |5 ]2 N__________________________________________________________________________+ G2 b* k8 F1 w$ @2 Q* u9 N! l
! B% a/ A# X6 E- V
Method 10! I. R6 h1 j4 [- A  ]
=========3 n8 {* S0 `0 n. D3 {6 R

' ^% i  O6 ^7 {' Q! Z, t=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 R  R0 }+ C  M, c5 I  j  SoftICE while the option is enable!!
) J( ~3 P7 k  {6 X2 K9 x" R3 }; h/ {! ?
This trick is very efficient:
, S7 }& N) k4 Q# R- u7 W" m  W% O* hby checking the Debug Registers, you can detect if SoftICE is loaded# p- n  ]% [: j# R
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, Z6 J0 `7 G( O9 x5 q6 n3 F
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" D/ H; g& w( ~$ uvalue (in ring0 only). Values can be manipulated and or changed as well* q7 t  V: R3 ~7 A
(clearing BPMs for instance)
$ v: c+ c7 s4 Y6 w  |" U9 J
6 z9 e5 o. q( a__________________________________________________________________________
. |5 q! L$ p& F3 t, d" b4 `
: Q2 c4 L3 c- d0 e0 @3 UMethod 117 f/ T8 w6 R% O$ f( r
=========
! X6 T2 m. l$ P" g
9 S/ O2 h3 |& s- D1 _This method is most known as 'MeltICE' because it has been freely distributed
( I+ }2 q2 k0 Evia www.winfiles.com. However it was first used by NuMega people to allow; C) u$ h9 Y: _8 `) {
Symbol Loader to check if SoftICE was active or not (the code is located
( Y2 u- @3 Z" ^2 Oinside nmtrans.dll).
0 K2 J# J, K6 k$ ]1 p8 I4 N
' j" Y" q% w+ ^' P* c4 |The way it works is very simple:
- \4 x; j7 o. f+ ^$ qIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: Q. U5 {1 q, p* @  \2 _6 n# w
WinNT) with the CreateFileA API.
$ q' X# x7 b0 p" [) H* a1 F6 E3 u- t6 j/ S# P" j' x& N
Here is a sample (checking for 'SICE'):
3 B8 o. j4 s4 ^8 [8 f# V5 P' `, E2 Z) A* {1 O0 `
BOOL IsSoftIce95Loaded()
0 M4 W0 Y" Q8 V$ s0 }9 Z{$ S$ x7 q. J7 x5 M% @. _. Y$ L  N5 }
   HANDLE hFile;  ! d2 J- j0 @  H+ y* ]1 n# f0 M; w
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,/ m3 F0 I" W" S
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
2 x. i0 D4 |9 p                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- _/ c2 B3 |, K2 H6 v6 P# ^   if( hFile != INVALID_HANDLE_VALUE )
( N4 E2 ^' x9 ?4 T1 G" \   {
! G9 |/ c( _; w      CloseHandle(hFile);; {, U! P) K4 l& d
      return TRUE;
; q0 X* _( L+ V  Q, }* I4 t. N   }
' M; E+ G6 @# _) w   return FALSE;- {& j# U8 @% |6 E& ~) x
}5 d3 ?# u+ [; I5 @

, I; i/ I/ X$ O3 v* e1 @Although this trick calls the CreateFileA function, don't even expect to be
* {8 G' x1 h+ w& Zable to intercept it by installing a IFS hook: it will not work, no way!9 D- U* Y$ _! c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
" h( l8 y0 X# G$ oservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- U4 I2 v- m/ @; A- k% e5 x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( V1 K+ L- K% B$ |
field.
8 R$ c! w  t6 T3 Q- _7 @In fact, its purpose is not to load/unload VxDs but only to send a . y  D7 Y/ s  E( E' a9 }
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 H: c+ O) `8 s4 H2 vto the VxD Control_Dispatch proc (how the hell a shareware soft could try0 @7 K3 j% d7 W9 _& x0 v! M( [
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
! F+ S! r7 ~3 P0 h: j; t$ m/ R* k1 wIf the VxD is loaded, it will always clear eax and the Carry flag to allow( L& {0 q4 n. T! a/ W- q: i1 Y
its handle to be opened and then, will be detected.
& ?! ?* ~! _. w$ U6 P6 B1 }$ jYou can check that simply by hooking Winice.exe control proc entry point
1 ]& f2 M- `; Ywhile running MeltICE.* x* p0 F9 b* e# v( K8 b
/ d; ?% O: S$ w
  ^  n6 }1 o; m
  00401067:  push      00402025    ; \\.\SICE
$ o, R. z1 R5 |9 J, f+ @  D9 L  0040106C:  call      CreateFileA
  N9 R2 H% w5 I1 y: g  v  00401071:  cmp       eax,-001- B* `% n. f/ r( K! _+ W
  00401074:  je        00401091
4 N0 s8 @. }% B) Z4 L* Z( d1 q$ n" K& @+ Y
0 ~9 |$ y( T. ^3 U, [$ ]
There could be hundreds of BPX you could use to detect this trick.8 X) v  I4 Y7 k- N0 K  k
-The most classical one is:
; }6 N. u+ Q: x0 r  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 }! D5 p1 A; l" g  C- U
    *(esp-&gt;4+4)=='NTIC'
5 E2 @  `, z' S6 e& m$ u. t# Z& |! X0 R/ T. B" n1 _
-The most exotic ones (could be very slooooow :-(
; j. N2 \, V: `6 i% m   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; I2 d0 V5 v2 N' L* u# l# F
     ;will break 3 times :-(& v/ ]( t  O( D# D1 _

( u9 \6 d( V% H, l* a-or (a bit) faster:
/ g% E; W( W. ]   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')1 Q% t. L6 r9 h; o8 r) U
0 h# z; E- o) z9 a! Y2 m
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% V9 j7 L5 q8 {# G' V7 A+ Q" G     ;will break 3 times :-(
6 l2 W% V1 z7 d) e1 u( O2 S8 a& g& }
6 C2 `( _2 Q( O4 v-Much faster:" [5 S4 C* m4 D# l" P& J/ ^6 Q& C
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' ?( a- g) x1 k$ k5 X
, P2 v- \" E% CNote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 f, }" ^/ h, a: R/ q
function to do the same job:
. e1 L9 ^# q# \: |8 J* Z$ T/ Q, g6 O) Q& V# m- x8 e1 @
   push    00                        ; OF_READ
6 W* t3 K5 z8 p" I: X3 t; r$ n   mov     eax,[00656634]            ; '\\.\SICE',0
+ p3 u8 E" E. q9 h' g) X* G   push    eax
1 s6 N/ Y, F4 k8 A# }# s* s1 G0 z- c   call    KERNEL32!_lopen  j- S* I7 l, |' `0 I1 J9 R
   inc     eax; |8 [% X1 _- ~1 p# E
   jnz     00650589                  ; detected
; ~/ U7 ^6 P0 E' N* j; `   push    00                        ; OF_READ, Y9 i, U2 B" N) C3 B4 D
   mov     eax,[00656638]            ; '\\.\SICE'% V& N& v+ T0 V- @- M1 R( U: S
   push    eax
4 {% D5 u$ s0 r& U. w   call    KERNEL32!_lopen
6 z+ G7 ?& w* I0 M   inc     eax, D5 C; _" A4 r. q) h9 x& f
   jz      006505ae                  ; not detected
% S+ k9 h' K! {! }; b! b0 m! h! m8 ^% Z: S+ p; w! A7 R

  L* ^2 h+ N: f6 b8 [__________________________________________________________________________
/ n" _& `* u9 {+ ]  O3 k# B. e: e/ p" `! U* V* g3 M: c
Method 12
) B- Z& s. u: A5 w=========
' I8 |6 C6 p" U: i0 W
" Q( i7 R/ T! W$ qThis trick is similar to int41h/4fh Debugger installation check (code 050 u2 B/ G& B( h2 _
&amp; 06) but very limited because it's only available for Win95/98 (not NT)  O4 @) i" \* h; o# q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo., R1 t! A7 Q7 i- E" ?/ @
7 @+ c6 J% X, ~
   push  0000004fh         ; function 4fh
9 V, c( h3 J- J9 ]$ G6 R7 l* Z   push  002a002ah         ; high word specifies which VxD (VWIN32)
& o/ ]& y4 [/ o9 W                           ; low word specifies which service
, e- A5 I" F8 ~                             (VWIN32_Int41Dispatch)
! ^" }/ C$ h# r" Q" R5 H2 A# E1 j2 _   call  Kernel32!ORD_001  ; VxdCall
% u4 f8 r% G- D; e1 z% k0 l   cmp   ax, 0f386h        ; magic number returned by system debuggers
5 J- n- t. \+ n) ?" ~& T/ t   jz    SoftICE_detected
( w3 b/ j& ]2 C: c: M0 ^9 y( j  o2 i* b+ h% b' s
Here again, several ways to detect it:
9 v) c' U% Q, a4 z# t5 y& x
! {. J7 K6 d3 [, L    BPINT 41 if ax==4f9 ^- C: D3 F1 {0 |& E

4 H; }; p. s9 r7 r6 e/ r    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* h* I  `7 Y7 W+ _. g8 N
3 t( C! A0 Z" d, N5 R    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" v! p1 L8 m" \4 B% b
! i7 h2 K$ O( |% F
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 `, v' ~: J& s* P; W5 n+ r& l

" A7 ~0 Y' ^& P' [__________________________________________________________________________( ?) r1 g6 v$ _8 p& m% w* K

6 e4 h4 K! H- _5 r1 n0 `. j, \; b% g% a- GMethod 13
: [+ T: C7 N, T- Z8 J=========
) X6 o9 y8 R1 e7 G: Y9 C0 r9 v1 x* n
Not a real method of detection, but a good way to know if SoftICE is' K# A# x9 w/ g# n. ], x
installed on a computer and to locate its installation directory.
7 p. g" A$ M2 p" P$ OIt is used by few softs which access the following registry keys (usually #2) :
$ b. \' Y' h9 _  E& W3 d6 Z9 ?4 o$ T8 c& x' J' L% b
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 P( p7 S4 p) q* v) {
\Uninstall\SoftICE
, v  @3 O% N+ y9 S. Y4 c1 y7 [  Y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
) T- c" P3 z" J0 v% X-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ z, k3 e( [0 O( f\App Paths\Loader32.Exe( |0 `& e+ X" Y2 h4 _" u6 K3 ]

! `1 w/ o- o0 _# a5 t0 D$ }8 \1 E4 R7 X
Note that some nasty apps could then erase all files from SoftICE directory
$ m/ \; [6 K: Z- k(I faced that once :-() c/ a# G5 N. v6 d+ c
. i2 N# g6 b9 ?" ^
Useful breakpoint to detect it:
+ f# O- y2 l# n5 G- ^+ Y+ o7 w7 c: G& |: Z& k" j5 V. f8 J
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'" H5 s5 S% y* n' K! L) R/ g

( T$ U7 P3 J* U3 c, J* o2 R__________________________________________________________________________
5 o7 V2 \9 u1 }& r( H
) r$ l+ ~' N3 W( B$ c' H" A" r/ l, C
6 H6 h+ I* Y6 J( L9 J' lMethod 14 + I2 _/ w3 Z9 y! d- w
=========
  Z+ E1 k" p8 J  J0 c$ ]) [( d
- F8 K7 N9 c% M8 w" pA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
' f2 N7 r! d, Q7 X" t8 I4 ^* jis to determines whether a debugger is running on your system (ring0 only).
/ F* g5 \3 i& z. ^" }: t+ ~% z0 j* w) I2 v5 o
   VMMCall Test_Debug_Installed: k8 l; }# z% {
   je      not_installed
) ?. P% ~6 _# J( E
1 c/ e  t3 T. _; l% tThis service just checks a flag.# Q8 ]% p: ]5 r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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