找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; Y: q6 d' \1 k! o<TBODY>' A; o- Y; U5 y5 Z8 [) l
<TR>* z) U; X* F% X! w" m3 X' t
<TD><PRE>Method 01   L3 H1 R2 ^$ X$ D2 C
=========
' X4 C6 _5 q. `# H5 O$ w) U& s" i1 q& n  F' T/ R( x0 g
This method of detection of SoftICE (as well as the following one) is
3 q' z7 ~& D* U) I$ ]$ l4 j  n! iused by the majority of packers/encryptors found on Internet.
6 {: r; {+ Q  o6 B9 jIt seeks the signature of BoundsChecker in SoftICE
' o( p: M; Z. E1 X% c+ A! ^2 U# C1 c; \$ a0 \0 Z
    mov     ebp, 04243484Bh        ; 'BCHK'
4 ~( c( V' Q# N5 Z& i$ f    mov     ax, 04h( v3 @9 q4 \- ?
    int     3      
) K! K; _8 a& y& r    cmp     al,49 Y6 Y. ~: q8 E& q5 X% Q
    jnz     SoftICE_Detected
& S% h8 J. ^2 n% j+ B
4 {- f$ c' ~' H. x' x___________________________________________________________________________9 n! N+ w4 K+ p1 b! i/ Q4 j
5 G$ C& _- a4 _  D4 C' X% l; A" L
Method 02
2 z! L, ?7 a7 K. a1 h" E9 D=========7 i. n) C# t  L6 g0 V
: i* H. t' S) |+ c# [0 L
Still a method very much used (perhaps the most frequent one).  It is used
( a9 G' W6 m! s# O4 ?  o- x  L! o# hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, c' T4 i. L5 j0 Y8 a" P; I" p" nor execute SoftICE commands...
$ ?) s) L' `/ ?/ G# B1 bIt is also used to crash SoftICE and to force it to execute any commands) [8 P) M: L; M; T
(HBOOT...) :-((  
/ o- G6 c: V- m5 V# H: R6 H8 g; v. t; P6 O1 F. `
Here is a quick description:
, v$ h) G. k+ [; y. W# q-AX = 0910h   (Display string in SIce windows)& J, S0 E  v! X. m
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- U% I$ V( Z3 J- r$ P5 H' g-AX = 0912h   (Get breakpoint infos)
5 v* P, D+ `- s- |0 \7 k-AX = 0913h   (Set Sice breakpoints)
8 K( E$ F- E5 b' J6 ?/ L' }2 K8 K-AX = 0914h   (Remove SIce breakoints)& s0 w" k; J2 g" D3 G" M0 [! r
3 l. T$ I) |" E
Each time you'll meet this trick, you'll see:8 R, t6 f$ _! n: X; c
-SI = 4647h
# A0 ?; Z) U+ _5 n-DI = 4A4Dh" H- y  A8 `; p* ~8 I/ N0 ?
Which are the 'magic values' used by SoftIce.- a) f% }9 ^# N% `6 O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ R" [4 h! Z  ?3 r  w7 e, r' }1 [& J3 S% f3 O
Here is one example from the file "Haspinst.exe" which is the dongle HASP
' i) v. Z* z1 \" E) p/ QEnvelope utility use to protect DOS applications:
& g" G5 j. q  B
# l* j" q2 S+ M. o- B; Q. x! y, T9 E1 v3 f' U+ i
4C19:0095   MOV    AX,0911  ; execute command.7 A! v" y9 @! A# Y: f
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: Z% a* K* c6 J! ?( L4C19:009A   MOV    SI,4647  ; 1st magic value.5 k* H& }/ P5 Y( x' H/ b$ A
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; s7 r  I9 {* G2 w2 E8 w: L. w
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) B) c6 }% d8 k; Y+ |! ~2 O8 Y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
' X' v0 ~# R! Q' R; n5 D4 U4C19:00A4   INC    CX
" n- V1 X" c! h; _4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- q5 D5 _% p' H1 x; c  U1 w+ s
4C19:00A8   JB     0095     ; 6 different commands.
: D# Y( G6 S% A4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- b6 _! `; |2 ?+ [* G3 p$ D9 O
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# `& x/ H  _- W+ K& G+ G* i0 \2 b  u
1 R0 f& e1 M' y# q3 `: sThe program will execute 6 different SIce commands located at ds:dx, which
& D% w; C8 u# T1 L: e+ W% ?" xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  X+ W1 ~9 x1 x# q. J
2 K* Y+ V  O) ~' T0 e* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.: p3 V8 i. h+ q5 @% _. u
___________________________________________________________________________
* \8 V; M' N. c# A6 A1 |
8 r; ~$ N' P; ~* Z1 _* H$ w. z. g- j1 T
Method 03$ ^5 D  q8 |$ v, {* ^8 {2 ?
=========
& \! o1 [0 S8 H6 u) z% x5 B; M* \7 Z. r/ s- P% v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h& f5 f# O7 E6 l8 @# c3 y3 i% u
(API Get entry point)
, Y; V+ V) N6 L% @        
3 h7 p1 e: ~% V0 D& e/ ~4 |
5 a0 v/ Z* u' b    xor     di,di4 B9 a. ~6 ?3 v6 B9 }0 g9 Q
    mov     es,di3 `4 [: A; Z0 M0 ^7 u' z
    mov     ax, 1684h       7 i& ^: D' ~: Q" F0 I
    mov     bx, 0202h       ; VxD ID of winice
) u' m1 I5 U0 T    int     2Fh4 U" r( }9 T; a- G9 @, \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# x0 V5 O+ d1 {! m- \. O: N0 f    add     ax, di
1 t! x8 k! q% m6 g' V9 h( i& B    test    ax,ax
) U( F2 L/ [$ [: X1 O, f    jnz     SoftICE_Detected
. U5 a) Y2 c2 u: U+ ?) D( i3 s5 |& x9 p, _$ c# k
___________________________________________________________________________
) U7 T* e3 D8 r: M3 U+ J' e- C! @: T. H; B& U+ l
Method 047 u, C" U2 ]( _  e
=========
; O( o" n1 h; o8 @: Z8 ^- v+ C/ @, v, u
Method identical to the preceding one except that it seeks the ID of SoftICE9 c$ U7 ]% g2 T+ w- p7 J. X
GFX VxD.( s, k/ m; }5 E0 i8 ?3 n
8 J9 p8 c5 c8 s! M" v
    xor     di,di
4 C) x8 `' ]% f  x: T. s8 P& _    mov     es,di/ b  `. n* R' m* r0 \
    mov     ax, 1684h      
( \( X8 ]3 |' j1 \9 U8 l    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 M8 j$ ?! i% u  I9 ?9 F    int     2fh
. Y. B8 a7 e  N1 F. r: U    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 D- {# [# Z4 ?: U
    add     ax, di3 m- o6 l+ |2 _8 ]% s) H$ C
    test    ax,ax# S% i7 u5 n1 y# N
    jnz     SoftICE_Detected* _% u$ c* }! j
9 b; I5 O! l' R0 B, _/ {
__________________________________________________________________________6 p: H* E9 E; J2 Y; I1 [

1 ]5 b- V0 {. Q
+ M9 ~; T8 }' y/ QMethod 05
2 N' P  Y3 D' }# [, T=========2 G% X8 D5 T! q& Z, N

) s, C3 n/ q# OMethod seeking the 'magic number' 0F386h returned (in ax) by all system% e) A) N4 X" l( o/ T# n4 G
debugger. It calls the int 41h, function 4Fh.
! p7 p/ C4 K0 Q- I: O. U2 YThere are several alternatives.  ' @# B% z' E( ~; N' ~
# `4 m- d' |8 v) Y# Z1 h& r
The following one is the simplest:
$ v, ]2 C+ A8 p- x; W1 O3 I, ]) `( S6 F; G! q
    mov     ax,4fh( n5 ]' v0 r( m+ q' t4 Q/ i
    int     41h
5 o! p" R3 l" \  A' ?0 I    cmp     ax, 0F386
4 N2 {9 n$ z) }    jz      SoftICE_detected8 P9 b! V8 P. f9 g
3 G  g1 Y, f' e1 X

1 {2 [# e( C& T: W! {$ r' CNext method as well as the following one are 2 examples from Stone's
4 ?8 @/ c; n+ u1 J"stn-wid.zip" (www.cracking.net):
& c' Q- O7 _; m$ b4 d
& Z+ z0 r- Z; H( R! @9 V    mov     bx, cs
- f2 e1 H" l: `8 f0 V    lea     dx, int41handler2
( F- Y/ |: M+ s: b; x    xchg    dx, es:[41h*4]* C* e, }" K9 ?' j9 u# Q
    xchg    bx, es:[41h*4+2]
$ K& c) o  W. s3 y, N5 N    mov     ax,4fh
0 w* \6 @( t; e$ S* }9 f    int     41h, Y* S1 A* m# b4 E" z" O; l
    xchg    dx, es:[41h*4]
  O3 X1 R; l# ?0 Q+ P* n2 ~    xchg    bx, es:[41h*4+2]3 x' ]$ P) b% }+ W6 {
    cmp     ax, 0f386h
" H2 h0 O! Q/ y2 `- y& y! Y8 C    jz      SoftICE_detected) g6 y$ `5 i7 F' ?: d/ g

" ^& `. D5 K# l, [5 {int41handler2 PROC
2 x( s4 C# G8 i/ O    iret
# f. E( B1 o2 {- l; aint41handler2 ENDP
1 u  J% \, L7 Y" c+ h- \
5 f( L: f5 A2 ?5 j' L, |; U9 }0 m3 V2 x1 H, }
_________________________________________________________________________) m& f8 T* D9 Q
/ S: k! Z: U: i$ D! x

0 c/ R6 [, w9 U+ {* GMethod 06- R  b8 Q, z* V1 n+ P& m/ d! E
=========+ h  y4 |. m; C' r

6 x# O8 m# {1 ~6 n% z) P: r& Z, U- L# y6 W0 q- {
2nd method similar to the preceding one but more difficult to detect:( T2 `5 L/ V) f5 F& y7 p

: |  J% d7 Q) U  G
) B) I' s# E- `5 U; l/ f4 hint41handler PROC
! k9 z2 e1 H5 ^3 e, I    mov     cl,al
8 X; Z0 ~( |2 f: P7 V% w    iret$ v* ^  S/ ?1 s1 r
int41handler ENDP
4 K1 N& P/ d: {6 k6 I0 p0 e: X+ w) f1 v5 [

/ a6 S# [( b  ?* x/ P! W4 I    xor     ax,ax, f$ G/ [4 M0 |% C* a" o
    mov     es,ax
: @% e2 s0 Q9 L% I, {    mov     bx, cs. N" Y& O& m$ t7 D% E
    lea     dx, int41handler( u$ }' l' q3 g* M
    xchg    dx, es:[41h*4]
3 H6 T0 J: E' V    xchg    bx, es:[41h*4+2]( u+ \" |1 Y" d
    in      al, 40h% q: W5 _  S6 Z% X. b8 o
    xor     cx,cx& _) X0 c8 R4 x7 z. Q
    int     41h, u1 _0 |4 g; w6 i  |$ o# Q
    xchg    dx, es:[41h*4]' T5 ]; n7 ^* Y9 f) U
    xchg    bx, es:[41h*4+2]
: _7 Z) G7 g3 n/ \( w8 g    cmp     cl,al& T; L/ H. L- j( W3 i. c* \
    jnz     SoftICE_detected
0 S# K( B! [3 j1 {7 }1 j+ G/ @+ H: N+ G! ]& x" I: D4 S
_________________________________________________________________________6 K( J, E, I* _/ s4 B

0 a1 C$ K4 X3 R. bMethod 07
/ Q' A+ m! y# n  a=========" {# l1 N4 {1 r9 h
2 I1 V1 A% e/ H8 l, x
Method of detection of the WinICE handler in the int68h (V86)
+ ^, b' |# z. G. D; u  F0 |8 c6 D  E& c
    mov     ah,43h" I4 l2 w4 E2 b
    int     68h
3 M1 h) P# K" Q5 q- r- j    cmp     ax,0F386h
' \; Q9 Z( J/ j- y( }9 Z    jz      SoftICE_Detected
$ a8 R$ W2 E0 M9 @8 G
- W& f8 P# Y, e$ f& e% T6 F; T- ~. E
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ j  d+ D( L7 r# A   app like this:
7 Y! k; ~9 U& Z6 ?# F/ Y- [/ O5 E1 Q# q0 U3 K$ g
   BPX exec_int if ax==68
: e1 T! h9 ?6 I8 O* a% p' `   (function called is located at byte ptr [ebp+1Dh] and client eip is4 ~- @( p5 B) f, X/ y5 F
   located at [ebp+48h] for 32Bit apps)! U' S: W' ]1 q+ }
__________________________________________________________________________, y2 u7 A3 z7 n( [9 s
; S! g1 J; v! ?

; L5 k5 T9 X& o; N2 VMethod 08
" }! C, u+ u$ t% U6 `=========3 X6 G) b" S) i. r; X: n& u
% i9 m* m0 N2 J# p# h
It is not a method of detection of SoftICE but a possibility to crash the
% P1 P3 L3 s4 ]system by intercepting int 01h and int 03h and redirecting them to another$ m: E! k) V" r+ n
routine.
- B" U2 z: G. N5 ]9 RIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points- C5 a1 C) L( N" N% m6 `$ o
to the new routine to execute (hangs computer...)$ \) W; M* D9 O) k9 p* I: \' Z/ l

4 I" o- R+ s6 f2 D    mov     ah, 25h3 t' w4 Q( K- X* u$ r
    mov     al, Int_Number (01h or 03h)5 f' F9 Y, T/ W7 S3 A( @4 ]
    mov     dx, offset New_Int_Routine
1 J% N; L" ]# s8 u9 l. o    int     21h
+ X  _! m" q- q1 F
% P9 h. u1 U2 k2 c, f$ s__________________________________________________________________________
/ K& l) ]/ u' v) @+ T% ^3 F) w( p3 j& h
Method 096 F& M. y- v0 {" R
=========( w( T: v# _/ y

6 @" D$ V7 i$ I; B& C! _3 NThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 p  M( _! m- W& k- `; p9 uperformed in ring0 (VxD or a ring3 app using the VxdCall).
/ y+ C3 W( E! _+ v- D5 L6 _The Get_DDB service is used to determine whether or not a VxD is installed+ m* e- x/ ]  w+ \* X
for the specified device and returns a Device Description Block (in ecx) for8 L7 {; R4 \  V! C/ ~0 g4 p( o
that device if it is installed.2 U0 M$ w' P) J

& j! D3 j! F% K3 v# }5 `  d* u   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# E/ h* e, _0 z/ Y3 Z# f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% x+ ?4 j1 u5 K) r" T. W) l
   VMMCall Get_DDB
$ q! p# S2 F" l- O2 T3 @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# A% K- A1 W2 ~* {/ D9 f5 j2 l5 c5 m; O: e% L: o
Note as well that you can easily detect this method with SoftICE:
5 N% ]2 G# L; Y5 ]6 Z2 t# s   bpx Get_DDB if ax==0202 || ax==7a5fh& N( E% J1 r% C$ e2 k( j4 p
: [6 J, q" R3 o9 m# l$ z9 }
__________________________________________________________________________9 u; w2 a% m6 K- F1 W( l
6 b  n' B- z( O8 @
Method 10
: Y# z. v2 N8 T- w) W# {=========
9 ]1 d* z/ R! u# E! u
- d9 H: s( ]  z: q9 w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with  `- P8 i! [6 B# G- `
  SoftICE while the option is enable!!
  j  X$ H$ J4 Q& W
( u+ p# i0 U8 i, I; KThis trick is very efficient:
% d/ ~6 ~0 R6 m: W5 `7 h- _by checking the Debug Registers, you can detect if SoftICE is loaded1 G: z/ j+ t) g, K% |! N/ t
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ v+ `+ V3 @' [- u  p( cthere are some memory breakpoints set (dr0 to dr3) simply by reading their
- _6 o- M4 J0 k" [: ^value (in ring0 only). Values can be manipulated and or changed as well; b, M5 g, j) j9 s! X- \3 ?1 ^' R: ~
(clearing BPMs for instance)) G( d% {! r/ ~7 Y

7 H  O. X' ]4 s) ^* O4 C__________________________________________________________________________
: Y/ i% V! m! O! Y/ x  P9 e& m$ R
! ~" G/ i3 P! o' x: MMethod 11
+ u7 y" h3 N5 {# s=========9 |. k1 S3 {, e6 |. W, R
: w6 R; \$ C/ _& O& _6 v
This method is most known as 'MeltICE' because it has been freely distributed
- T1 ~: I; r9 j3 l1 ovia www.winfiles.com. However it was first used by NuMega people to allow
0 o% D4 Q  K0 b  s  l! rSymbol Loader to check if SoftICE was active or not (the code is located/ m# r1 Q* Q0 U& c% T! [5 [4 i" C% m- e
inside nmtrans.dll).
2 S0 V4 D+ C3 r  J1 o
. B$ ~4 K9 V8 iThe way it works is very simple:3 b3 _" e2 W( u4 f. F' {
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- l/ H9 r. B0 Y( VWinNT) with the CreateFileA API.
2 c" y# ]' _) T: F. R
: R  l: b) K+ u8 @7 D$ lHere is a sample (checking for 'SICE'):6 ~1 G1 l6 k( L) o2 B! o) Z9 }) _

* y: r; ?1 S2 B, W5 ]3 ^7 ]$ c% WBOOL IsSoftIce95Loaded()( I) n( |; ?( k$ U) v  X
{' O) R" p! Q- D+ P9 c7 r
   HANDLE hFile;  
$ R& F5 c8 ~1 `  v   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( ?. w2 E4 c  `0 d9 J                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 M2 Z1 z+ [) ^9 A2 \4 {
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- s! {. E9 y% ^4 ^: d5 W* Q   if( hFile != INVALID_HANDLE_VALUE )
# S8 Q8 `1 O; c; i& P: Z( |   {4 A  o& y7 p3 m! j2 b& s9 l
      CloseHandle(hFile);2 ?3 t" R. T5 i9 K0 `  ]
      return TRUE;& I  m/ ]" n3 H6 }% A
   }+ \4 B) G% O% W8 M
   return FALSE;
4 v! N# l) ~+ p( k}
0 v/ h4 X$ E( q, Q$ m3 a# l$ w& {5 a3 F% c
Although this trick calls the CreateFileA function, don't even expect to be& n# Q2 d$ k# l! K2 x0 E6 w
able to intercept it by installing a IFS hook: it will not work, no way!1 K2 U% A, ^! ?9 z$ i* N
In fact, after the call to CreateFileA it will get through VWIN32 0x001F2 X  o1 O3 r" ?: J$ t+ k
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
. r; T! v1 h$ [$ k* f3 yand then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ ~1 ^, c2 _7 c6 }  L2 x/ [field.
( N1 E: G2 G0 nIn fact, its purpose is not to load/unload VxDs but only to send a 3 A; a" d% d3 i
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; u$ \: I9 ]5 [+ }/ qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
  j5 Z- B0 V: S0 X8 ^& ~to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 `: Y; H$ z- S
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* s' G' @/ [4 vits handle to be opened and then, will be detected.
# Y& j$ I/ r7 ^: w3 c8 U0 h& ~; KYou can check that simply by hooking Winice.exe control proc entry point
  m+ A5 O2 J; cwhile running MeltICE.4 [; m1 A4 p( t( s8 X/ K- q4 x

* p' V- e! ^$ G6 a5 W  @. A; Q. |, [# @0 E7 I2 R! P/ \
  00401067:  push      00402025    ; \\.\SICE2 ]* F: X" `8 d. W2 A
  0040106C:  call      CreateFileA* E" B9 {$ A0 W2 R4 f/ m$ m; I
  00401071:  cmp       eax,-001
/ u8 }9 s* A" b; X! e; K  00401074:  je        00401091
: P/ m& E3 T6 d- D2 S0 d  p6 o9 j6 a8 q# s) I9 x- d: U/ A. k
/ k' p2 p/ o- I( ]
There could be hundreds of BPX you could use to detect this trick.0 i  S7 B. w2 L
-The most classical one is:
% F! h4 t8 ^4 M  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 e3 ^- c, x* g, N7 Q, r    *(esp-&gt;4+4)=='NTIC'
  E/ v3 O  s3 g! @8 H  u1 V* c; J4 Y% K+ F+ C! s( [
-The most exotic ones (could be very slooooow :-(& F! o7 ?2 y; D( @. s( N8 o$ T) L
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 z1 @( \! r/ Q) U" A* Q: b* d8 Z
     ;will break 3 times :-() u8 `* y, k5 }% T) p8 }
( H; C# ~5 |$ x3 P! w% q
-or (a bit) faster: + b8 [4 r1 X! D# [* ?- m" A
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 i' U7 l1 d; m' w
  u* n1 n  k( F6 ]+ T- D9 i   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 l0 a# r  N+ c( V; q% u
     ;will break 3 times :-(
; W6 h9 @9 ], V4 A3 H& b0 d) r# a2 a; F4 Z3 E! ]
-Much faster:
; L& E- ?% x  ]2 S   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# v. I& Q' q5 U

2 x' l7 ]- P' [" j) C* }( ANote also that some programs (like AZPR3.00) use de old 16-bit _lopen
" q, b) s2 G) [  l! c+ ifunction to do the same job:
- v. T" I( n( c6 B: A
8 l$ G# _) {8 F0 ~" N8 I   push    00                        ; OF_READ
- E8 B/ K* m2 `$ h. g$ I   mov     eax,[00656634]            ; '\\.\SICE',0
: w0 m7 f  P$ F7 g   push    eax
- C9 n( ]0 h7 ^5 o  X   call    KERNEL32!_lopen" ~+ z) B' U  k& N; V
   inc     eax
! j4 o+ U7 ^% z* N, r   jnz     00650589                  ; detected3 W( G% L2 }# M1 U
   push    00                        ; OF_READ
( T$ o" S" |) ^, [- @& D   mov     eax,[00656638]            ; '\\.\SICE'. h. T+ n: w+ F3 |! f
   push    eax% [( z- ~% v  n; U
   call    KERNEL32!_lopen% n6 Y5 C+ z9 ]( A; j) I% I
   inc     eax
# {% }7 F5 n2 E7 e, y4 X! |   jz      006505ae                  ; not detected
( w/ d; u! J( ^$ [7 h/ F  ^, w# W% V& d* m8 B: @

6 `( C9 T) J) I! Y: I, A* f__________________________________________________________________________
- k  k' V% R2 K! T+ K8 }) U/ S: X# q$ {, A: x( V5 p* u4 L
Method 12+ Y$ A# A& Z) ^6 r; d: w; Y' f6 c
=========
8 V: t+ o+ A& \/ }
5 v* b7 |" s5 _7 [7 YThis trick is similar to int41h/4fh Debugger installation check (code 05
! e: X8 x9 c+ M- M&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  S% D0 t: F  D# p9 B* `" qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( W7 Y4 T* |8 r3 z+ f; O" {' i) t/ _5 \3 D9 O
   push  0000004fh         ; function 4fh1 f# z' U8 @1 j, Y) @
   push  002a002ah         ; high word specifies which VxD (VWIN32); P. F, J+ U# D' d. o  d
                           ; low word specifies which service6 d6 L& W& C/ d7 x: l! Z
                             (VWIN32_Int41Dispatch)( [8 g6 x6 l  H: g9 L4 V" l& i
   call  Kernel32!ORD_001  ; VxdCall
& z  q9 S) W+ T' l, U   cmp   ax, 0f386h        ; magic number returned by system debuggers  r' K. D$ j  S  ]+ m
   jz    SoftICE_detected/ A/ l" s  S7 h. J( h* {# W
& `( F' r" h2 ~- W( n! W
Here again, several ways to detect it:
/ Q) ~; ~' Z. T' o% T3 C5 E6 G! d8 X9 W+ j5 Y, M- L
    BPINT 41 if ax==4f% u6 M: p2 `! A3 l  ]

) G3 _. Y! _4 `+ I5 J    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 R7 h! K( T% T: q
$ E0 c3 k& O$ o/ K9 o0 k    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ s3 c0 }/ ?! o/ e0 j2 Z( {0 g- {

2 Y% ]; {7 g8 U2 E) a    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ e: Z% ^3 L2 `# I/ D! Y
8 b# I1 @4 }4 p3 I# D9 w$ Z( k
__________________________________________________________________________
# @+ Y6 U5 i5 ^6 U; E1 M# B; T" E5 I5 @
Method 13  j) B3 `8 B' V9 D9 F2 j5 s9 u
=========
, I8 \- B4 H% X4 Y- g2 I3 \! ]% R! w9 s) G6 t/ U$ o7 J& J- H
Not a real method of detection, but a good way to know if SoftICE is0 c* W/ ^7 b6 S
installed on a computer and to locate its installation directory.
5 @+ i9 K9 ~6 d/ C8 @It is used by few softs which access the following registry keys (usually #2) :
  L- K: b( i: L0 `3 F0 z8 M4 {
1 ]" y) I0 [+ x% _6 E) V-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' A3 s# V# x. T% I: G\Uninstall\SoftICE0 h, }0 G" ?) x% M4 D# |
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE& Q6 o$ Q: G) ^% F1 a0 k; N1 t
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% _  m, s' b3 ~( Z& T, c
\App Paths\Loader32.Exe# W; w6 h* O1 ?1 D

1 T* {. G: O8 K( N8 ]  [
$ H( ^# R2 V' {1 c) x" hNote that some nasty apps could then erase all files from SoftICE directory9 N7 I2 F0 v% W$ P' E0 h) J; J
(I faced that once :-(& ^/ {& i8 q! W' [6 E) Q

& S: v% s/ r1 G  I: r( h& R, nUseful breakpoint to detect it:" Q# N1 b8 U3 E0 @
- @% K. E: d0 \+ A# A% k
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ W0 C! S: B$ R$ }

9 Z; k( a! {0 z9 n, {, J7 v; V__________________________________________________________________________
. F+ |" ~* w1 W8 }# V# D) t; _% Z$ }; g* U' [

8 v' f2 |4 {0 _9 p( I: }+ [Method 14 7 j( ~# b, \) O; x2 N
=========
- v* b6 y  X& V% @$ k' T# o/ \% t- b& @5 v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ F* h, [, f4 r8 w, P" n8 J$ Q
is to determines whether a debugger is running on your system (ring0 only).9 ?& r( f3 O  j  W5 m2 o" u

! [# O1 r# m6 o  e# M   VMMCall Test_Debug_Installed! Z( `- m# z8 y3 L. X
   je      not_installed7 X/ Z/ N+ ?4 p- L9 ]: b

0 N" b0 Z( C9 mThis service just checks a flag.
$ @' T  Q3 h6 G5 Y, z, C</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-3 03:14

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表