找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># w6 ?" }" w% X& D1 B* _
<TBODY>
% |. _- |* d' h( s, ?0 n; E$ J<TR>
1 o0 w) O: I- ^% e7 `5 x; Q7 |<TD><PRE>Method 01 8 g5 P2 o: h5 ?- ^# J0 D/ _( ?
=========: K8 ~$ e, U3 B

: G# j& p9 o7 D2 `- W' G1 r3 CThis method of detection of SoftICE (as well as the following one) is" R1 n, f- G* G6 c% E/ B
used by the majority of packers/encryptors found on Internet.
% T- c/ O# F; [1 k% N6 w+ AIt seeks the signature of BoundsChecker in SoftICE9 m4 l8 _9 @1 V3 n

# s  _% Z0 @% K/ I3 K" Q3 s8 a% ]    mov     ebp, 04243484Bh        ; 'BCHK'! z' e' U- C3 G% _
    mov     ax, 04h
7 |/ Q. l3 y& B4 k    int     3      
# M3 o, q2 `) G8 Z4 L" b    cmp     al,4
9 G9 d1 w5 r8 P6 f; ~' ~' o. d    jnz     SoftICE_Detected
- E2 U' f4 }; b' r) L2 _% j+ B
5 q* ~/ ]( Z" w( J7 ~4 Y- E___________________________________________________________________________1 c4 |2 H+ K9 `/ ~
/ ]' W' w' @7 p% w
Method 02
  P; F3 Q: d9 b% j=========
) ]/ b9 n2 s1 ^& _. x5 S* a2 W$ W5 v: h7 |
Still a method very much used (perhaps the most frequent one).  It is used
7 W3 a1 n+ v, }1 |4 Rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ |3 A; y0 f  E) sor execute SoftICE commands...
7 x! m; T& T7 h, |It is also used to crash SoftICE and to force it to execute any commands
  C+ w4 n0 O  x6 R3 t$ v(HBOOT...) :-((  
8 S1 a8 K( H8 f2 @  [, X8 R! J& {! ~
Here is a quick description:
$ M, b% Z: \6 H% ^/ G-AX = 0910h   (Display string in SIce windows)
9 Z" M  @! X% h. v+ Z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( W! b5 q! ~% B* K. @% c
-AX = 0912h   (Get breakpoint infos)8 M- Y6 e. ~9 Y( k. N9 B
-AX = 0913h   (Set Sice breakpoints)
) z0 `( N* h' {7 B6 s" h-AX = 0914h   (Remove SIce breakoints)
; }2 A7 N% n! \. i! X0 t0 m/ N8 Z) j
Each time you'll meet this trick, you'll see:
! `8 U: a/ F! i1 n-SI = 4647h
) k3 S+ C9 q$ u-DI = 4A4Dh
2 B# M2 p" y4 ~9 h* Z/ tWhich are the 'magic values' used by SoftIce.
. }' `/ C) r7 i8 P* {% k" z, uFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.; x9 d6 x5 Z; K, o/ s" q

5 B5 s7 P/ x* {4 d  FHere is one example from the file "Haspinst.exe" which is the dongle HASP8 [- t+ C8 G! M/ G
Envelope utility use to protect DOS applications:$ }7 f- Z+ |1 i. F& q% [3 x

7 ^9 F- C/ g8 w0 Y& R9 E, X, }6 R5 S3 h4 V
4C19:0095   MOV    AX,0911  ; execute command.) d; }" h5 L9 D8 @1 u1 s! i
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! A4 Z9 Q1 a8 O, b# J, c& X4C19:009A   MOV    SI,4647  ; 1st magic value.
6 e6 o/ E6 x- _3 q# E1 X4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 B( j3 A- Z8 N$ x
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), w' q7 g0 ?8 {5 ?7 g" w
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 f8 K- Y7 k, Q7 S0 ?7 K
4C19:00A4   INC    CX0 _+ ^' W9 P$ {6 X  b5 n' r
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; D  O0 e/ u- X+ Q8 v; C1 z& I4C19:00A8   JB     0095     ; 6 different commands.% y& z) z5 `9 E, U
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 N. n7 T/ M+ Q9 @; I
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% f, b$ S8 L, c4 `
% d/ m+ v& m9 y& e2 ZThe program will execute 6 different SIce commands located at ds:dx, which
  `, v; {9 Q  z9 x' Aare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- F5 u! Z$ r, a% S

2 E7 [0 H+ S" H, f* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
( Q8 W* A" s; t! g+ t$ s! ^* N___________________________________________________________________________
5 M( k: A# V5 M3 m
5 }. N! O$ o6 ~" k$ n# `6 q) e$ G
5 x, g# {9 ?& X! p- SMethod 03) Q9 Y: ~1 L  O: a& s# ?
=========& k: v2 @  R: l" `
( A( ]6 v0 O8 }' s4 [
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 r2 V0 S, S- P! s; |2 Z5 q% k9 D(API Get entry point)6 X# n+ O5 U8 Z$ c3 N0 o% d
        2 [$ I* V1 D' s! w1 k: b9 y- D

  @0 ?' c" {) \+ @; n5 Q5 [+ ?5 y    xor     di,di% B8 P$ _% ^' P4 m
    mov     es,di
" N5 ~% y: _4 ]- U    mov     ax, 1684h       ; M; K) H8 ~! V
    mov     bx, 0202h       ; VxD ID of winice
" O0 _" L, F7 y  F( F    int     2Fh, G4 g4 c- q" Z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 p4 t1 k$ s9 x' D# ^
    add     ax, di  B+ J/ e3 q$ |- \- Z5 k6 |% [4 \
    test    ax,ax* m1 m& y6 D8 ^: {$ J
    jnz     SoftICE_Detected
0 b( K  p, [! y! y
% R- t; }& Z" L) \- k1 V___________________________________________________________________________& |5 Z$ c7 r- O: l& Y# l9 F
6 s. R" _; @1 f3 p/ k" n
Method 04$ N+ w2 M# ^7 k2 K; t# s1 J7 h- m
=========/ r% D. m' k3 K

7 \, j% \3 w3 m0 L. hMethod identical to the preceding one except that it seeks the ID of SoftICE
" D7 N* M/ l/ u9 y5 l" h" AGFX VxD.
" x& n) w0 @" l! x
% D$ K8 [1 }2 o7 S    xor     di,di
- ?1 k/ N, [8 o* k! {    mov     es,di
8 {+ l9 [3 B1 `* m% Z6 C    mov     ax, 1684h      
1 v4 c5 N9 i- F0 N    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 Y/ V% u! B$ n% X. F
    int     2fh
$ s# E9 o, x8 I3 `8 y6 D- `9 {) A    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ b. ]" M" C8 Q  c' u
    add     ax, di
# x* S% r  e6 c3 l+ v    test    ax,ax
4 z* b5 H/ g" X$ i    jnz     SoftICE_Detected
  Y; P( R+ ^- n& o! _, Q
  r3 W* Y! u, [. E__________________________________________________________________________  @, N& R# l6 ], N- t$ j. f
; c6 j) b  S3 ]8 ^; m' s

9 |8 Y7 {3 E& G  s8 C1 t* I% c1 P6 MMethod 05$ {6 b: b, a$ x
=========
6 u+ A1 m$ g8 E& [4 N! w4 R  f0 Q8 P$ y* {
Method seeking the 'magic number' 0F386h returned (in ax) by all system! x1 v. e0 Y2 n, V
debugger. It calls the int 41h, function 4Fh.% K% s8 T' U% _4 G- b' @6 k
There are several alternatives.  
. P9 i' I: |0 S( a% h' `4 K
8 V0 ^+ y) Q. yThe following one is the simplest:
, O9 ^$ K; X6 ~* R; a+ C! s) W
8 A; f  n5 v% {7 Y! r3 E    mov     ax,4fh
+ g0 E* _2 R: k) l( p    int     41h
) X. s* ^4 A3 h: n: W, m, u% @    cmp     ax, 0F386
# H) w9 E0 b( J  o! [! M) i    jz      SoftICE_detected
, G" h# _' Z" k$ ~
7 J+ S( Z; P3 `  V* T  x9 a
8 {& }! V( c; J* q& R5 `6 Z6 Z8 cNext method as well as the following one are 2 examples from Stone's
# k- L4 a) y# |6 m9 c"stn-wid.zip" (www.cracking.net):
  J  U$ o; x' _4 }$ o
* v: O; o: a) s    mov     bx, cs5 X/ K# J2 f4 [9 l! N5 k" b; o1 N
    lea     dx, int41handler2
- u% @+ n+ e) y6 m    xchg    dx, es:[41h*4]
' t5 Q$ i9 {0 U( r; ]    xchg    bx, es:[41h*4+2]1 d8 h4 W% o& w, q: E
    mov     ax,4fh8 ?9 |% {1 ^4 b  G+ T+ t% ^$ R
    int     41h' k. J$ C0 Q6 X4 v4 H' U
    xchg    dx, es:[41h*4]
. A6 P8 r0 A  W# l* ?2 I( s( u9 T    xchg    bx, es:[41h*4+2]
% X3 I2 [$ h( ?# `    cmp     ax, 0f386h: l( t2 c, y4 |% ?/ G- |
    jz      SoftICE_detected! y$ R5 g$ E' ?- X/ i( J; f) H

! s, `& `4 A! Q1 L2 R2 y3 W& hint41handler2 PROC; f$ {& \* m7 b+ D5 h$ C' }9 c) Z
    iret
7 P" w5 K$ e' b+ m- Uint41handler2 ENDP$ L4 `* _, R9 m$ s

: Q3 X$ W: O; {) s; g) R3 u$ T( B; \: v- T; ~
_________________________________________________________________________
/ R; S; e( _; }
5 N! }5 W4 {4 i% D
1 H2 z( P4 O! M7 |. D' YMethod 064 N9 P' k6 Q& b. p% F& f
=========
( v) E& Q( i! m2 l6 q
& N5 C# j6 \# j6 g! {/ L
, S. p' @3 ~2 x/ Q; A/ X2nd method similar to the preceding one but more difficult to detect:
0 o. y* Q; @7 V3 E: P* L3 P# h8 V) U  M

+ v' n! N" D- v3 B% t* ]$ bint41handler PROC
7 [9 D4 j1 j" x9 @    mov     cl,al/ n- ]; K( L* f; k+ F
    iret
- D+ i9 I! H! V2 m6 ^  n% gint41handler ENDP
8 [/ c: U: q% W' d0 b6 W# |( ~
* ?+ P5 f4 \) w% J. a' x7 f, i0 R. y! X$ [: |
    xor     ax,ax( C! R' I" G* w
    mov     es,ax( d4 ~7 U9 ~* i$ B
    mov     bx, cs5 \# w( O- z3 h3 F
    lea     dx, int41handler
+ ^# P/ l1 p! U7 Q$ F( M( c    xchg    dx, es:[41h*4]% `4 F7 B1 Q4 i1 f# m( |8 z7 n* T6 c
    xchg    bx, es:[41h*4+2]
: N3 j% F, A) X8 B  O% `4 F. \1 q    in      al, 40h
1 O2 Y# p* x2 A    xor     cx,cx
9 J% h. {- }. M$ _! A    int     41h- ^8 v( L! k0 e% e% i
    xchg    dx, es:[41h*4]7 N8 D8 }8 j; P: K! f6 {. l
    xchg    bx, es:[41h*4+2]
' k8 m, g! \0 B4 f& |    cmp     cl,al
4 ^! N4 ^: c! D' w0 \$ z    jnz     SoftICE_detected8 E) ?/ V- U5 `' i
% ]5 s' D3 h0 N0 o4 X, M
_________________________________________________________________________
4 k8 m2 P' k3 D+ \- n
2 g( f' r# j4 Q; N# L/ v$ RMethod 07) |9 G; k% m' D: \  z! U
=========/ H* d1 X# F9 M) ^4 i$ p( ^
  }* p. o* w; l2 ^  f) J4 ~
Method of detection of the WinICE handler in the int68h (V86)" W7 U  e$ j  p4 N& U
/ ^% _/ f9 ~& k4 [/ H4 j) Q: Z: K7 E
    mov     ah,43h
6 w2 z  h3 r; A    int     68h  S2 a) n  C6 M/ D0 H4 V
    cmp     ax,0F386h
6 }- e; g6 f: h0 K    jz      SoftICE_Detected0 {* c: ~# d$ A
% ~8 _5 @* o, B6 R

. s& F5 m: ^- ]8 B. K2 y( u% E' k=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# ]/ ^1 o, }1 t! s0 |9 V5 Z! M* ^   app like this:
; a+ t  @2 @9 `+ h4 z$ T8 ~9 A! S$ R  P8 m9 D. F% g- ?# ~! s7 X$ ?
   BPX exec_int if ax==68# I0 y/ P" J. R5 d2 y% r5 t
   (function called is located at byte ptr [ebp+1Dh] and client eip is" b9 ~4 ^8 O. c
   located at [ebp+48h] for 32Bit apps)
  n4 e' F( l, T- ^) u__________________________________________________________________________
9 y; d. F" ^5 a/ x7 Y
' ]4 B( J2 f# f6 a; F) ]7 j
6 T: z# v9 ~0 Z9 J0 YMethod 08
# r' D  `1 v; v=========
3 H, l0 O, j. V4 p; j5 O( n
- [! p7 _: p4 Q! CIt is not a method of detection of SoftICE but a possibility to crash the' h1 P; D* o, w4 D+ @; Z( B
system by intercepting int 01h and int 03h and redirecting them to another
" @( E' q0 N% i7 lroutine.# U/ j1 m4 N+ i; m1 Q
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
. g, u- t  ]- N, @$ b, o9 jto the new routine to execute (hangs computer...)' ~5 f/ {0 B! C: S3 R4 ]

' f5 |% k+ [3 a) L, C; S    mov     ah, 25h
) t  U& B& k) G6 L3 S    mov     al, Int_Number (01h or 03h)
4 K% T0 I3 {1 Y. L- i    mov     dx, offset New_Int_Routine
2 e* W7 P5 \% E# T, @% g% K    int     21h
& T) a& Q& @, n* j& ~5 T
0 u! \/ b$ k/ P5 |' M__________________________________________________________________________
  ]  x  K0 c$ S$ `! {! a( s7 S2 K( r) S8 s/ j& w: |- ]
Method 092 n: l% U/ `; J) T* j% w8 ]
=========
1 C' [5 E7 u- l7 k. t4 q6 D
( _/ d+ B6 O- C# S3 sThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& i, B$ t( [/ \& n+ cperformed in ring0 (VxD or a ring3 app using the VxdCall).
) W3 m  }. r# i# f2 A- O' pThe Get_DDB service is used to determine whether or not a VxD is installed
; U5 c% p/ M1 u2 Dfor the specified device and returns a Device Description Block (in ecx) for* Z7 k# H/ n3 L
that device if it is installed.- H/ e$ a* }5 I# {9 W# Q

/ d& n1 k2 Z' f8 b; Q   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. U& V* G- e6 |! J; j6 ^4 B   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 h, \5 q6 w# m, ^; E% {* e/ i
   VMMCall Get_DDB
3 s3 S# E9 N& J; |( o2 [' a+ r3 |" }   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 Z0 L- O/ I" F" |1 {* y# d
3 e# O9 ^: b% v% WNote as well that you can easily detect this method with SoftICE:/ h8 E# h2 [! u" E
   bpx Get_DDB if ax==0202 || ax==7a5fh
( |* H7 S( \0 T' Z- P& O4 E
! ~  _. S) G6 x/ V5 D__________________________________________________________________________. ^4 q: t, c6 }6 o

) F; z! j2 D  U( hMethod 10( a0 x9 _  z7 y3 u; C, M
=========: p' _( C: f4 }( l+ z6 D2 f6 |8 v: M

1 b: w8 `* B5 o9 {3 [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with& M/ g, e! K7 z; c
  SoftICE while the option is enable!!
( _0 m; ~4 v, g7 B. M* b5 z
+ {  ?6 [) Y2 A/ i4 pThis trick is very efficient:
! j+ R+ W0 \' Z4 }/ j( yby checking the Debug Registers, you can detect if SoftICE is loaded
2 j0 C6 l8 h9 u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  Z0 Y  W1 y4 ythere are some memory breakpoints set (dr0 to dr3) simply by reading their
; k/ k% t, I1 d% c6 l7 h: U3 v  W. Pvalue (in ring0 only). Values can be manipulated and or changed as well
/ T/ g# D9 d1 `, i(clearing BPMs for instance)
5 _* x6 a3 X' \3 ?% N/ V! u4 J* ?. M6 [( l$ v
__________________________________________________________________________" C0 M  c7 i2 F
( t2 Z1 s4 s) H8 Z! ?2 A2 Y
Method 11
2 @# J# ?6 W9 E( D5 f3 `+ i8 L=========
. w8 f+ A- |* m6 h8 ]+ U! @& O, W  ?+ Y
This method is most known as 'MeltICE' because it has been freely distributed' f! x3 v1 k8 Y
via www.winfiles.com. However it was first used by NuMega people to allow
! }: t5 O' k: }# `8 M1 W$ G  pSymbol Loader to check if SoftICE was active or not (the code is located4 H  b/ _; U/ G9 p* E
inside nmtrans.dll).2 b- m7 |  s: O& K. [
* A+ V) [, W1 C7 ?( r
The way it works is very simple:% j- o, t  \6 s& s6 ?, o; C# T: Y: J
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
1 E  L5 B9 ~0 Y( f/ GWinNT) with the CreateFileA API.
! z. `# }$ K7 n  k6 ?& U' E( q! D1 ^
Here is a sample (checking for 'SICE'):
6 i$ u; J8 }: c& R6 K, i
% M8 ]" t( W5 G0 f. b, o# TBOOL IsSoftIce95Loaded()" m  v- Q0 ?' o, o. j- U# W
{
1 b! i9 Q! R  T' E$ h8 @3 V   HANDLE hFile;  
) ?3 t# g% f. P& O! ^   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 ]5 j+ j# H& |" D* q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 Q( M: J/ l) f; z4 L
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* |) M& A. p) D   if( hFile != INVALID_HANDLE_VALUE )
# F4 M/ f/ w+ v5 b5 {1 A   {
" v8 b' a8 E% E- Z2 ]      CloseHandle(hFile);
  X( \2 @& V5 |) {8 q      return TRUE;
9 b7 y1 r0 m2 d/ |   }. e* D# B5 k/ h
   return FALSE;* B5 L5 L! {, O5 R
}
+ _! f% l4 e% [. O+ ^; F/ f/ T1 j
1 \/ T: y8 Z3 m/ i: G# OAlthough this trick calls the CreateFileA function, don't even expect to be# G4 }5 ]6 ^9 f: R1 r/ E+ q) i
able to intercept it by installing a IFS hook: it will not work, no way!
3 D4 i) r2 ~3 D1 hIn fact, after the call to CreateFileA it will get through VWIN32 0x001F5 D% H, \' t# v! ]& O3 p) q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 a( B  K% E5 g9 q, d# k. c2 j& \) nand then browse the DDB list until it find the VxD and its DDB_Control_Proc; k* \! y* A3 [# f$ u' g% s
field.
/ v8 p1 A& o3 m$ U4 G3 dIn fact, its purpose is not to load/unload VxDs but only to send a
  N; Q5 T% `/ S! ]/ S' m8 iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 V9 ?, Q6 _# P; `! B$ Ato the VxD Control_Dispatch proc (how the hell a shareware soft could try0 \  {4 P$ |. U+ E6 I& f( A/ V
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 U+ _- \- j# C/ s4 ]: DIf the VxD is loaded, it will always clear eax and the Carry flag to allow5 L! `! b$ S! J4 @( N1 V
its handle to be opened and then, will be detected.
- V8 V) s% q8 D8 _1 }' U6 kYou can check that simply by hooking Winice.exe control proc entry point
4 I" r9 g; {0 f5 l" swhile running MeltICE.
6 y% q7 b% i  R# ^% }! @8 a4 I. c5 G" z  I$ x3 p8 A" y$ f

$ s3 _0 ~3 o/ T6 B5 O0 t  00401067:  push      00402025    ; \\.\SICE3 ~5 W: k! y; a0 C9 }6 |( O$ c
  0040106C:  call      CreateFileA3 h; \9 e. t) U3 t8 P& ]4 q
  00401071:  cmp       eax,-001
- W( \' _5 l# n8 D  00401074:  je        00401091& Q" {! q! _( H
5 s2 y5 J+ Y8 I4 A& v$ Y, L3 K

. B6 y3 ~. y0 WThere could be hundreds of BPX you could use to detect this trick.) U) i% s, O: _: o: P2 p; y
-The most classical one is:( \# O; c: y+ q: \; D- E! P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ ], _7 m' c: f# R. q# y5 m
    *(esp-&gt;4+4)=='NTIC'
$ l4 \) R" ]( H! h
( T- G. |1 w/ ?" ]& T- z-The most exotic ones (could be very slooooow :-(
. @! p& y$ m% _+ I& T   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  2 k; e5 r8 C. u! r6 J3 z
     ;will break 3 times :-(! C2 z1 {( c, Q$ z

( q, A: d  n4 x, v. h-or (a bit) faster:
2 L* _  O/ C# o' d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" V* F/ {9 F$ a9 U% h9 K( n9 U, X) B9 Y0 u) F( C5 S& V
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  - T9 L' v8 e  c9 C' }: }! M$ M
     ;will break 3 times :-(
! x$ R6 _% X! a4 E! P
5 X0 ^" C# b: O7 o* i  a0 V/ v! R2 I-Much faster:1 h, ^. [. z1 Y7 B: T; X
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# a  Z# ]0 A  X) A, D1 \1 ]$ R5 q6 ?$ k' j  l* G3 T$ S
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
- C7 g8 C" x4 w1 W* Q3 u$ zfunction to do the same job:
& t( P" L! B  R+ B. F4 w3 P% C" L) j6 K, M4 {! h- ~1 w+ P
   push    00                        ; OF_READ
9 _1 c% V4 t4 g, l6 \% D0 p   mov     eax,[00656634]            ; '\\.\SICE',0% r: V5 J& a8 x# J, R
   push    eax+ U1 z" C3 l$ K& o1 K
   call    KERNEL32!_lopen
9 x* S' }% w8 u( v4 S   inc     eax! i9 f" k, p$ W( ?$ v2 P. c
   jnz     00650589                  ; detected& X; L. S% _8 f! n4 t
   push    00                        ; OF_READ& I& l) {* Y$ P
   mov     eax,[00656638]            ; '\\.\SICE'
, _( G4 q) @- ~! J) h9 x% C   push    eax$ X9 B2 a7 Y: \7 ~- w0 e
   call    KERNEL32!_lopen, N# b% U3 t/ F; m) ]# x+ u* p
   inc     eax
" B3 p. o/ k1 B6 s7 Z' H) B   jz      006505ae                  ; not detected# Z' T5 n. u: Z# H) _3 d1 U

; }5 W( g9 t  i7 u/ L% ?3 {2 I: A. T% \  S3 F
__________________________________________________________________________8 B" B( c, e/ n: r% t, G/ n8 V( c

1 m& Z! f5 g6 O4 sMethod 12; l, L8 [# g- C
=========
2 Z$ B+ e: \+ ^
! H/ O( u0 j7 DThis trick is similar to int41h/4fh Debugger installation check (code 05. _9 d+ W3 L4 r$ I8 c: c! N5 r
&amp; 06) but very limited because it's only available for Win95/98 (not NT)' N# _% i( d, c1 I# }5 c
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; e. D: Q  k- L& X: K8 g- l
5 h( `8 b- w) b2 z: e4 Q9 b/ I
   push  0000004fh         ; function 4fh
9 v' M0 Z  @7 E. W' o1 I6 ]   push  002a002ah         ; high word specifies which VxD (VWIN32)
  A5 X/ S$ w( u! @                           ; low word specifies which service1 c1 z" a$ g5 y. P  F3 Z* ?
                             (VWIN32_Int41Dispatch)
$ C# G' Z) l6 |3 j& H# X   call  Kernel32!ORD_001  ; VxdCall/ ^* F/ L7 _" @  a" @5 a3 }
   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 }' O/ n% P  r$ X5 w8 b. i: a   jz    SoftICE_detected' B2 Z0 k; \; n1 M& Q0 D

1 O! w* j( t( tHere again, several ways to detect it:1 P$ H2 ]1 h( t3 f

) J3 w& d% w2 S( h' o' w    BPINT 41 if ax==4f
' {- F9 q" i; g% i3 u2 B! F& M3 q; W& W5 {( O# ^
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 z0 V; S- Y+ M% o: L) d4 H( ~: D4 S4 `+ B( {. n9 \4 u5 H; `
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: N( t; c. L7 z
) R! O( `4 j1 P. v9 z0 ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!* K. w, ?# m* g2 w- N
. J7 h( k% u$ u# m
__________________________________________________________________________
& N: c, G+ @  R! n7 n  c9 O& W2 ~- y" n( s! @
Method 13: i" v4 B4 f& {
=========
' W! `$ T- Y9 x- i* u
3 `& n0 z: N' `/ ANot a real method of detection, but a good way to know if SoftICE is8 P" B9 Z# e# s. f
installed on a computer and to locate its installation directory.
/ o$ m8 s0 m6 ~- v: j/ }# ]It is used by few softs which access the following registry keys (usually #2) :& C% }5 Q# h* U4 m( u
% A8 J5 C2 _6 ^3 U+ w
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ k9 ]* r  @) o4 i2 `  q9 n\Uninstall\SoftICE
, ?2 o! `" j9 ~: |-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. [/ L6 L2 ^5 n* S# N$ K1 t
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ ^" X" M+ ]% B: r\App Paths\Loader32.Exe8 B5 Y+ A6 a* k8 n# s2 H
! v8 Q2 B* {: ~' L( q, L5 _
! l6 Y6 B! o1 M2 j+ ]6 m5 W' J
Note that some nasty apps could then erase all files from SoftICE directory
4 N  D! p3 E0 w( K0 y" e% W(I faced that once :-(
% @* f6 @2 a  @5 x
- ~9 B  V4 ?7 ~+ S1 cUseful breakpoint to detect it:
8 \+ m5 o  [$ Q# B, H( n( p$ t. U3 k3 Y0 L) K
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) O2 f: k/ P8 G/ ~0 G' q4 ]; ?( D7 p  t- b6 {: U& y/ ^
__________________________________________________________________________" L# C) s$ m+ d3 l/ W

* Q% x" d5 e0 a9 E0 J+ e
- n( H7 F0 Y, b8 c% I6 a$ _Method 14 6 l- A. t& \! _- d* w  K7 u% W( }. w: K
=========' x# W% L' O* }, D# _. U/ @

. C" I0 w8 R  C! a- YA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, t9 H: v/ [0 u2 Q, I
is to determines whether a debugger is running on your system (ring0 only).) r- q  C: Z; q4 _$ E

5 `% o  f4 n: K" a+ f   VMMCall Test_Debug_Installed
. p: H% e2 [5 Q# Z   je      not_installed
/ ?( L6 X6 p+ u  G, F) i- s2 S" H/ F/ R6 C' z
This service just checks a flag.
. Z$ o6 W( U4 P9 ?6 ~3 l$ |3 x3 F</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-4 03:43

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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