About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
: N- w: x9 W( W9 A<TBODY>) l$ `$ |1 `: R7 m
<TR>
% t# l8 N6 K0 E8 ~<TD><PRE>Method 01
3 z. ~3 s8 j5 M8 H4 u+ B=========
- P. |3 C8 U/ s9 X% p8 z5 y- }
9 H; y5 q. j1 `% y3 pThis method of detection of SoftICE (as well as the following one) is
! G) V: W8 O- \- C' y$ h5 sused by the majority of packers/encryptors found on Internet.
  Q2 C+ _+ u( VIt seeks the signature of BoundsChecker in SoftICE: t9 {. F7 L( n2 f1 S
; A/ {. i( r* t8 K
    mov     ebp, 04243484Bh        ; 'BCHK'1 F- b/ ?" q# X- Z8 S1 \" y. f: J
    mov     ax, 04h
8 w( r6 v9 U( [    int     3       6 g/ s) T  ]+ D6 ~% o- Q
    cmp     al,4
: Q: {0 o) ^' k. v# k    jnz     SoftICE_Detected
8 q1 A1 f  h7 r8 f1 k3 q
1 |- Y* W) F9 W6 ^___________________________________________________________________________
0 d. h" T6 x. s! Y' C; h* O5 ^2 p+ @7 u1 _8 J7 C
Method 02
0 @% N, U: Q4 u. C! Z9 Y: C=========
. `' ^) V* Y, q3 A2 R2 Z6 C) M" r
Still a method very much used (perhaps the most frequent one).  It is used
9 q! Q' \+ I+ l% O0 \4 m5 ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 M: R9 g# w" X0 @2 T
or execute SoftICE commands...
/ v+ k: F4 l! {$ OIt is also used to crash SoftICE and to force it to execute any commands8 k% F2 a4 ?) g! u6 f" v
(HBOOT...) :-((  ' e! J% B& i: ]! L( x

& r- I3 e* |0 r6 l$ P6 l3 v0 jHere is a quick description:/ g1 \+ B) l! y5 z1 P
-AX = 0910h   (Display string in SIce windows)
" \3 ?! z8 Y. {# A+ u3 {& \-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( z3 O( x6 V3 p& w4 D-AX = 0912h   (Get breakpoint infos)0 N, p, _4 K1 i( w3 [
-AX = 0913h   (Set Sice breakpoints)' l! V1 s& F) F$ g
-AX = 0914h   (Remove SIce breakoints)  Y1 j" C  r8 {  U; R8 ^: L. {
- T' V8 H2 F$ v% x8 |3 q
Each time you'll meet this trick, you'll see:6 S0 ^# z+ ^$ Y# i& ^
-SI = 4647h. ~% y3 a! f' M, O
-DI = 4A4Dh9 L0 b; b- }: {1 E/ J7 p
Which are the 'magic values' used by SoftIce.+ Z' R* n1 C4 U2 {
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.: I! P! i  s# H" q7 _: G
9 s; X) q# t, \) D0 m3 I5 O
Here is one example from the file "Haspinst.exe" which is the dongle HASP
# L; T6 {% w  E7 ~* EEnvelope utility use to protect DOS applications:
" ]$ @* S1 p, m( f7 q! q& u( r# m( M2 R- L

" c+ w) r$ g' _" G$ h1 m3 U. A; ]* D4C19:0095   MOV    AX,0911  ; execute command., [) r6 d9 g% g+ F& j) _) ?. v5 g" C
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  I: f# P6 }* x: u# r8 m4C19:009A   MOV    SI,4647  ; 1st magic value.
( J1 w/ A. {! E7 }; ~4 i4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
) M& J- t$ }6 @5 e% C4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! Z, A# D# C. }
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) K& K1 d. H- |* Q$ x6 P
4C19:00A4   INC    CX
3 z* F8 G6 x, A  e) [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 O" u7 ^+ c, C' F4C19:00A8   JB     0095     ; 6 different commands.- r7 x+ ?5 I$ P  k& W5 |9 F, @  K5 ^
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  c, }) N) B6 s, }
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# _6 g' Y* |" `4 ~; Y& s
- o) s/ a8 [. b" N' H
The program will execute 6 different SIce commands located at ds:dx, which
' C& z9 Y9 @2 _1 c; fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 f( j% J; w1 O! q7 F2 W. \

+ e2 U6 L3 F+ q- I7 H5 D% y* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- @8 I1 [' t" h( e# A% l
___________________________________________________________________________8 h0 J  z/ C7 [5 w
0 f& }( w7 O+ R# g; I

9 f0 {! S4 n6 Y+ D0 NMethod 037 U# i5 P5 C9 c
=========
2 \* W6 F# V* I0 l# S# ~# I/ P+ r3 u) T- g- v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" u0 s) u- c: X: a* [# L
(API Get entry point)3 ?4 d! H+ D9 ?3 X7 m! X
        
# i7 L1 j& E8 E, J6 u2 c& e) s7 ~8 r7 H+ M& q
    xor     di,di, o7 l# W# x0 x1 ]4 V
    mov     es,di3 ~) g+ _$ k0 o
    mov     ax, 1684h       6 V" d" n2 P( K! Y
    mov     bx, 0202h       ; VxD ID of winice9 z( J0 q$ _- i8 R
    int     2Fh
! T6 @3 E6 A/ ~0 X9 i4 ~! H3 G+ W    mov     ax, es          ; ES:DI -&gt; VxD API entry point% G! v3 A% |8 Z/ J
    add     ax, di
/ i, r$ z0 O! m& v, D    test    ax,ax
- [$ |6 a! f' L7 R4 D    jnz     SoftICE_Detected! M! e' x0 f$ v, r

1 `: z- w# b3 H% |: R+ L___________________________________________________________________________2 c/ A4 n3 t' z8 B* O
* O7 J: J% \/ h% V
Method 04
- }: Y! `6 e* F0 y& N=========$ M* ~: L) h. U7 F! L
' E' O6 E0 f  Q  K. y+ g
Method identical to the preceding one except that it seeks the ID of SoftICE
% m2 N" E1 k5 q) ~: }" ]# F6 qGFX VxD.
- t! t- y* n7 ?# T3 b' _
1 i% ]- x% y; Q) A, |* C. G    xor     di,di
5 D( c9 N& n* T0 w. V    mov     es,di$ N7 Q: i! i& D$ m4 R
    mov     ax, 1684h      
0 s5 J4 w' I+ `5 @, W) P    mov     bx, 7a5Fh       ; VxD ID of SIWVID% c: H) x. w$ v9 M$ V: M
    int     2fh4 j% e+ U$ S( e" a5 k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, i4 U( |- C' ~    add     ax, di6 [3 W+ j0 l. Y  x5 G% A
    test    ax,ax
" l% v# q. J  w) A    jnz     SoftICE_Detected
2 I0 s0 J' G8 h9 _9 z2 d: i: _# p- ^4 c9 `' X8 ~* V, n
__________________________________________________________________________$ `$ O9 t/ ~0 }6 @4 i+ B
1 w/ I+ M) k- C+ v

2 u' T" H( ^6 q6 r8 RMethod 05, c& I1 e$ g6 s4 @, }
=========( q' p1 I- J# P4 \
+ B8 O+ `1 X+ D5 P4 q5 e% q
Method seeking the 'magic number' 0F386h returned (in ax) by all system
& z$ |1 w, o1 [5 Idebugger. It calls the int 41h, function 4Fh.; l! ?+ a5 J! e4 B- N
There are several alternatives.  
4 z$ L. C* z9 C8 z  ?0 v8 _
& y* ]2 `1 {/ R# dThe following one is the simplest:/ y1 i" C" I" @: ~

3 u3 B' q2 Z& |( M7 }    mov     ax,4fh* P9 ?- z) S  u1 E
    int     41h/ ]( s% ~; S7 |# \- _5 L4 }
    cmp     ax, 0F386
8 q% n" ]1 @( i. z( |5 A* \, Y    jz      SoftICE_detected2 w2 _3 x7 y, A: L3 m/ G: D1 Q

8 i& Q( ~& O1 X4 r+ y" `9 B' \4 f$ z/ C- p1 O9 j/ a
Next method as well as the following one are 2 examples from Stone's
. J. j- }* F$ ?3 r6 D- f# \$ ["stn-wid.zip" (www.cracking.net):& f( B1 X" @3 l+ }, O! i
7 @% Z4 t) B; U/ R% J
    mov     bx, cs
% f6 h7 a; T( @    lea     dx, int41handler2: k# t4 J4 x# ^9 s) ]8 H
    xchg    dx, es:[41h*4]
- T* c; ^) k7 O0 T) H% B* B1 f    xchg    bx, es:[41h*4+2]- O8 \. r) l5 N3 y- [/ H6 u
    mov     ax,4fh: r" N/ a/ C3 U( R
    int     41h
- r. R; m# |9 `. ^0 w9 U- h/ o$ x    xchg    dx, es:[41h*4]
1 P/ t- E  _# S" Q( R    xchg    bx, es:[41h*4+2]
# D9 L- h& N8 a+ [6 j  E# x& p    cmp     ax, 0f386h8 c+ ~/ N8 z5 R0 S# @; Q
    jz      SoftICE_detected/ Q& F7 u. \% @! q0 m- D
  r8 D* D5 X: `7 Q
int41handler2 PROC
; [8 J3 `: ?6 m. V    iret" T' `& C6 D: P' }$ X0 n
int41handler2 ENDP
0 E5 @* T2 _, n  K' Y
0 l# y3 ~* ?3 e
. z4 g; `- ^' z! c; E_________________________________________________________________________
" [/ c5 o% p( M& i3 A. e0 q, G) r( X: S) l$ Q

. J( Q9 W" m# A; rMethod 065 p5 K  ]) l- B3 R" W/ _1 K7 x8 P4 [
=========) p/ a! U" N' |: I) I% }
# C9 |. h7 S8 ~0 X/ ^4 I
/ _$ m/ S" M9 P
2nd method similar to the preceding one but more difficult to detect:; d6 g7 B6 {! _/ G
2 |3 E# ~; _; @* I% y/ v7 m$ t
. D% v' K! s( Y4 S
int41handler PROC
3 l# f( w" ?7 h# R8 g    mov     cl,al7 \( S+ ^: K* x% w4 q8 ?5 m
    iret" u8 F% r  i( v+ p3 \$ `
int41handler ENDP2 w0 h: ]8 H' l5 ?
7 x0 e1 `1 m* p# B; G6 {  ]* v. d

. N3 |* o' Y& r& y    xor     ax,ax! Q1 s' _2 S1 N) E& A
    mov     es,ax
* A3 J9 q, T# G8 \    mov     bx, cs1 c4 ^2 y: S9 }/ E
    lea     dx, int41handler
' Q8 C+ E  M& e- e1 g    xchg    dx, es:[41h*4]
- w# l! j8 E1 c: z2 w5 V/ n    xchg    bx, es:[41h*4+2]2 P* p3 A( d( c, p; ?
    in      al, 40h' [. o3 H; G1 K4 M9 `+ B
    xor     cx,cx
' Y$ C' w! I6 T+ K* @  R3 c1 W    int     41h2 [2 }+ M+ K, o$ a" T
    xchg    dx, es:[41h*4]
; n+ u6 r2 V& w4 F; ]0 e; n  p+ w' k    xchg    bx, es:[41h*4+2], V7 \8 a9 F$ j1 V  H3 O
    cmp     cl,al% l' Y  x% W0 ^# c' L- k- b
    jnz     SoftICE_detected- b* F1 n8 L: P

% @8 ?8 ]# }  F% {  M& i_________________________________________________________________________) g4 c( v, P: P6 B* z+ {; G

1 Y: {, v9 |! ZMethod 075 R: Q+ m* E& L4 d$ ]: n. T& l. q7 m
=========
- K' a( Z7 O- k( D( }# y3 L1 K  T  W- U. u1 \  l# J
Method of detection of the WinICE handler in the int68h (V86)
; w6 p% [7 U8 [# a5 X" c3 H0 Z7 E" _- H5 B/ K0 l/ }
    mov     ah,43h0 z" j% D. D5 z
    int     68h
- }$ Y4 \8 x( ]  v& q/ v( U7 U4 z    cmp     ax,0F386h
. C6 k) Q& C& r( O& |    jz      SoftICE_Detected# {* c  D9 |7 D( L3 u2 C
8 l8 ]  H3 [7 @9 f  ?4 P- y
. E' O# E3 Y8 t4 o4 P5 h  j
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" z- k* o3 o( U& j- R6 \! J2 L   app like this:
! L; H7 z) y1 d, F+ g2 t, K
9 `# [. m4 C8 O6 y   BPX exec_int if ax==68
' a# S: J: U' _  j5 D   (function called is located at byte ptr [ebp+1Dh] and client eip is, N5 q) B# e+ B0 h7 ]
   located at [ebp+48h] for 32Bit apps)
2 G1 S1 r1 u" J9 N3 P__________________________________________________________________________
, M: d5 @) m' B9 ]( H
% C5 N4 O+ V$ q6 E. y# Y
5 R0 x. i2 p* t+ T1 fMethod 089 o5 b. q- `7 l6 L  X
=========
% P4 o( d* {8 N: B$ T
* t; y- v$ v: M+ [It is not a method of detection of SoftICE but a possibility to crash the
2 e6 m6 O+ c7 J+ c3 K4 B7 dsystem by intercepting int 01h and int 03h and redirecting them to another
+ _  P7 o: J& g" ^4 E4 t: B4 X+ V4 I; Froutine.. S; J1 h( b. X. u, E- b2 @, A
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 [+ e/ F5 B6 f  Y3 W5 H! v- R' H
to the new routine to execute (hangs computer...)
: P: k" J2 `. A$ {1 g! N( C
, v( ]4 O$ U* a    mov     ah, 25h
6 [, b6 R1 n$ J  v    mov     al, Int_Number (01h or 03h)  \& H0 J" h! X# O5 X
    mov     dx, offset New_Int_Routine( i, @7 [0 F& j- x
    int     21h
5 ]+ [8 b0 @+ \# x/ X% ?5 A5 n- ^8 ^9 B" b5 h
__________________________________________________________________________; `& t7 I1 S# P

! Q  f  A. c( nMethod 09
  u$ [2 h1 [+ v/ S+ E* B=========
) x( B1 v& R. p, m: Z8 d4 F; Y0 E$ x/ E# T! T9 v) v7 K$ P& \5 h
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( U% E+ M5 W* r5 c; U
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 m7 k! n* y! n; C# pThe Get_DDB service is used to determine whether or not a VxD is installed: G; L! v9 d' _( \# V( Y
for the specified device and returns a Device Description Block (in ecx) for
7 A' d" v+ h9 F* S3 Cthat device if it is installed.  g, `5 t% z& g! r( v

. l# m: ~9 Z1 E+ u/ A3 Y   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 G7 l) Y, _, I( L  ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 {4 E) u! i0 d6 H9 u' |& E   VMMCall Get_DDB4 L; R6 c, _' Y: a* z4 v
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* D* g0 v: O; o( h
" F2 x: M  Y% Q2 f2 @$ S
Note as well that you can easily detect this method with SoftICE:0 u8 P" J# ^5 J$ I
   bpx Get_DDB if ax==0202 || ax==7a5fh; V# S5 i4 j' ?5 G  I
) K( g  b* y8 d9 q! @
__________________________________________________________________________
! w; R8 i! X; B* D8 x5 Q
+ c' I9 K8 o* E/ ]Method 10$ A! e( S2 n/ k6 @  c5 B& A( d
=========/ Q: O# i' H3 }
0 z' C, ^3 D( q" _( `$ `; T
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ ?, y7 K, k8 q6 E
  SoftICE while the option is enable!!
: O4 L: f6 F0 t# ^9 Z& M9 d, S5 f6 X6 P: Q  m
This trick is very efficient:/ L$ H8 H$ M. \8 h  U
by checking the Debug Registers, you can detect if SoftICE is loaded2 Q4 l' Y, ^7 j9 L2 @9 x7 m: G+ Q- ~
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% u* N6 b" r7 n9 hthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 h0 m' u4 G  J1 _9 A1 z# O, x
value (in ring0 only). Values can be manipulated and or changed as well# a" B3 o4 D2 c* G, ]8 Y0 x7 s. T( m( i
(clearing BPMs for instance)5 v: w. R0 C* g8 |6 L) x4 `& e% Q  G

3 K5 |7 m. w( M/ A__________________________________________________________________________. V. Q: t; e4 P0 \+ a: b( P# L

9 z' S% e4 A! ]/ |4 _Method 113 N, B( `4 o; W7 _
=========
; I' p+ [5 N- h- m$ c0 j. S* x2 G. c! Z
This method is most known as 'MeltICE' because it has been freely distributed9 D. d: ?1 k5 E: y* |/ M
via www.winfiles.com. However it was first used by NuMega people to allow
4 b$ w3 \: g* u/ ?. HSymbol Loader to check if SoftICE was active or not (the code is located9 `; _0 B# S2 ^' w* \, s6 {
inside nmtrans.dll).: A& ?) I4 |9 f9 N

6 o2 k. Y3 f- d  EThe way it works is very simple:: p: j9 q2 N( j! Y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! ^0 w5 l/ b; q! O8 @$ r  C
WinNT) with the CreateFileA API.
8 c& G! y8 _( [; `9 |/ }$ {$ {. Z" c3 |$ x& ]7 X; z/ O
Here is a sample (checking for 'SICE'):
8 N# r' W, K3 s8 }( ?
: A+ J# \, p' A% m' w7 f! a! l2 _BOOL IsSoftIce95Loaded()
3 s5 I; b% ?9 Q5 x/ n, }' [# A. j* H{% o0 b8 A  ]; A5 ]; P1 Y
   HANDLE hFile;  # b6 d8 k/ m8 D1 y3 E
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 {% J" \9 N, H4 g: }3 l7 x                      FILE_SHARE_READ | FILE_SHARE_WRITE,  D: a4 ^- {$ ~1 k
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);5 {! |. H4 S8 E1 k  A' Z2 s
   if( hFile != INVALID_HANDLE_VALUE )' f% a# F: _: p( ^0 F+ |( X
   {0 A. [) e6 k: {5 F% A7 V
      CloseHandle(hFile);7 U; ]( Q+ }1 C7 H- `! F6 F( J1 M2 Z
      return TRUE;+ G& W1 b& t4 v" c# @
   }
4 t2 X9 V6 f3 M   return FALSE;5 x0 V+ K2 q5 R* o0 o# F* L
}
5 |8 F" b) l' _: h. p
% J7 \4 H7 s9 q& AAlthough this trick calls the CreateFileA function, don't even expect to be% C# W2 s  Q9 x/ c9 f0 q
able to intercept it by installing a IFS hook: it will not work, no way!& ]* ~+ Q. w$ N/ P6 ~
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
1 }8 [0 B% |. _, v4 }service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 ~0 a, V& V& T. c* S3 O
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
8 z; c4 ~8 ~  S: k+ f0 }! m' `8 Wfield.
9 n( f  g3 w6 Y% E; ^% p( U" jIn fact, its purpose is not to load/unload VxDs but only to send a 7 k3 d- M9 N0 u  O
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 C: @* M# p+ [5 M5 e7 o  }1 \to the VxD Control_Dispatch proc (how the hell a shareware soft could try
2 u, F# f5 U" f- ^# h1 Cto load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 @" w! l1 |# IIf the VxD is loaded, it will always clear eax and the Carry flag to allow$ e) v2 u. v0 l/ V0 t6 L' J
its handle to be opened and then, will be detected.
( Z# N# [8 [! a* l. b/ }4 FYou can check that simply by hooking Winice.exe control proc entry point' B  I" r1 @; s3 T
while running MeltICE.
& s1 f/ Z. {) x% H3 D5 n4 G9 U7 f5 k/ a

3 Q; \0 x0 O; E! @  o  00401067:  push      00402025    ; \\.\SICE
5 }: v6 Y9 g- Z* O  0040106C:  call      CreateFileA" z8 S- e& q/ m1 d( R
  00401071:  cmp       eax,-001
5 j& s8 [. Y  j  p  00401074:  je        004010916 f) N( T1 @8 e9 f, `. r2 E
# t3 R" p. f1 ^. M

" Y0 _% S) ?" ?: B1 \There could be hundreds of BPX you could use to detect this trick.% {% m$ [* c  t! ?
-The most classical one is:
( u3 L( d% U9 c+ R  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 F* |; y& v1 t
    *(esp-&gt;4+4)=='NTIC'
4 a6 n8 t4 T1 P% P1 e* [1 N8 L; N% f/ i" O$ q- X
-The most exotic ones (could be very slooooow :-(
, j* ]% x8 v- `; x& l   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 ~4 s+ x8 C7 x! W: S8 P1 w     ;will break 3 times :-(
5 ^% d6 Z, Y" r- D- [% }& Z8 Q8 x. x! q" U$ s- Q* @0 W" i4 T
-or (a bit) faster: : i" C1 i# ?8 [% f; p( Q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 g  @$ i8 _- Z9 P! ^' O% J9 i
; q: c: {, `5 ]5 y: ^. `) G5 r
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # J' B2 e7 j' i0 P! u; C; V
     ;will break 3 times :-(
& [. J' J* U2 k
% V4 a4 v( J5 `2 ~, X-Much faster:; t$ ]# P$ w: A! i+ w" _
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 `3 g) J$ s/ ~# s6 J  h6 a
: {- s" O; m. y0 E& j( f/ v; n. ]- P
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* `  d  e) c8 wfunction to do the same job:
" v5 |  h2 z6 E3 `# n4 P" W0 [* T& J, S# p; a
   push    00                        ; OF_READ
8 g' Y" U5 S9 h5 k9 P' d* A   mov     eax,[00656634]            ; '\\.\SICE',0
9 I: a! e8 A( y1 b) i! K$ r5 m   push    eax+ B$ E$ G  |2 l* U
   call    KERNEL32!_lopen# o4 u' M6 u, N
   inc     eax
/ \( R5 w$ C) [  A( x   jnz     00650589                  ; detected1 E  Z7 i* l& ]& {9 w; q
   push    00                        ; OF_READ
4 N  K3 g3 K  v2 K8 x   mov     eax,[00656638]            ; '\\.\SICE': W3 D& U1 O5 ]$ [# \+ ~
   push    eax
6 v/ Y# ^2 x& ]( S* {   call    KERNEL32!_lopen) L, l5 M( p" ]+ H
   inc     eax
3 N, w  [6 U) i! W7 F' O; y) z2 \* S/ n3 ~   jz      006505ae                  ; not detected
( Z8 g' a2 W: k1 O/ O8 I' [: Z! S: U: {8 Q" H3 |" Y
( f: M) J" V4 j5 E! S
__________________________________________________________________________
/ O: p" j* j6 d9 j3 x, C/ o0 d" [4 c, l
Method 121 s$ p6 @* n7 q: {: [
=========$ ^5 l8 S+ {' q4 n. e9 u

' @; d4 R: g$ x8 n0 iThis trick is similar to int41h/4fh Debugger installation check (code 05
8 w0 z9 O9 i2 m+ `&amp; 06) but very limited because it's only available for Win95/98 (not NT)
# Z9 \8 ^# p4 T' P  s  s/ ?/ Qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.' X: W4 Y# k# v1 h5 m' l2 Z
. P( D; V/ M. T5 z
   push  0000004fh         ; function 4fh( n; L4 u0 B" F% i; o. f
   push  002a002ah         ; high word specifies which VxD (VWIN32)
& c: K" X  E) ~/ `4 W& W$ s                           ; low word specifies which service
" E+ o7 g6 m. i  z3 {                             (VWIN32_Int41Dispatch), H2 C0 {! B9 t9 E6 d. f1 x7 h
   call  Kernel32!ORD_001  ; VxdCall
0 F) [( U. Q  A6 u  E   cmp   ax, 0f386h        ; magic number returned by system debuggers" {4 J) V4 [1 l/ c5 f
   jz    SoftICE_detected9 `5 A0 a2 x+ M0 m
) }/ i. ]  c' }
Here again, several ways to detect it:3 Q" R# D- H2 U2 v% w

% o/ q5 v. B( w" V! z9 g8 O    BPINT 41 if ax==4f$ W/ a, ~5 C* n* i
4 C4 o$ }  I; `3 o5 i& M  |
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 D. S6 P$ B6 \4 A/ r7 T! m4 X( o
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; D, d! `4 \* Y
) B; y- ^5 R7 Z( S5 q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 o/ p; m3 B. S
# B5 [9 r$ j2 k- G, R; a
__________________________________________________________________________
" @1 Y% c; v) `8 {0 y! o# H% A( b. Q' y
Method 137 D4 q$ X- m  L: ?( |0 Q
=========9 }4 V. {$ D/ g7 \$ s

! R$ @8 c* c% i- GNot a real method of detection, but a good way to know if SoftICE is8 y# L! R$ o, z. U8 r' ]
installed on a computer and to locate its installation directory.
4 w- V$ n+ ~! \, C9 RIt is used by few softs which access the following registry keys (usually #2) :
6 ^$ H9 y0 n+ j5 d' l% c- X  i" S, W& Q% H! B) A) C7 f" C
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 T# N" e) g1 [4 C\Uninstall\SoftICE  Q$ Y$ H. K# l& |7 J$ D- s
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ U5 C9 ]+ c1 j, ~( C
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. X6 ~' Z2 Y- A, {7 b\App Paths\Loader32.Exe8 I9 E  _& S4 O  K( f0 W9 ]
1 @$ |$ o1 M% \4 M5 r; T0 q% T

% O) J, I" e% i) e, oNote that some nasty apps could then erase all files from SoftICE directory- I4 _& i, i: y
(I faced that once :-(
4 W5 _' @& C  t; @) O3 I/ q7 @+ l. Y6 ]
Useful breakpoint to detect it:
7 G( T- ^" U4 S6 j3 A6 d3 K- _& X3 {. K7 y+ K+ g( I4 f# [6 N; P
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* T: v+ }( ~5 \$ V3 M) C% p  e% J0 s  T) j; B
__________________________________________________________________________
% ~7 ^: C( ?- m, o( ?+ A7 f6 R4 g8 m- D) ?/ c0 v
0 Z# }* u# |$ \4 V8 m/ d& A5 S
Method 14
- q# n& S1 d/ M2 c3 M* p=========
0 f, w4 N! D3 p& C( z, {- w- [# h) [) B
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 C/ O  ]5 J8 a1 D
is to determines whether a debugger is running on your system (ring0 only)./ I& g% d4 x3 |) g) k1 t. O
( K' h8 e3 o0 P/ N& i: q
   VMMCall Test_Debug_Installed
. Q' i/ k4 s6 g* Z5 w% K. F   je      not_installed
, K8 U; B2 v% t" W% \7 k$ X
8 f5 `* t+ j* J/ H- dThis service just checks a flag.# ]2 r- K9 C7 j9 `! ~# U3 `
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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