About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ J3 {5 q  x' G# A<TBODY>
1 F" N* P4 P$ _' z& Z( c<TR>2 f0 v2 f5 G- V
<TD><PRE>Method 01
3 c' ?, K/ }+ Y) z=========
9 ?5 f" C5 F( n$ D( N5 Z; G( v/ g2 g0 p
This method of detection of SoftICE (as well as the following one) is/ n' F* v% y! b" h- ?; q
used by the majority of packers/encryptors found on Internet.
8 j& \1 c# r$ a3 s0 d. f8 C6 ~It seeks the signature of BoundsChecker in SoftICE
0 E9 W" b; c' D4 z: R( b2 }1 C. o
$ n- F& z2 I7 q- w5 o    mov     ebp, 04243484Bh        ; 'BCHK'5 I; f8 s$ O: [; ]' }" w: E* S
    mov     ax, 04h
" O$ }4 C( I% X* i4 K1 ^; H, k    int     3       - h& @( Y% p( ]
    cmp     al,4
% ^7 W; g/ n; V9 u0 O: }+ A0 G    jnz     SoftICE_Detected
9 b7 W2 f% z% b: c7 {1 w. q
1 j6 K  g1 v. X___________________________________________________________________________$ c$ u! O+ x) j
* X8 [6 p4 x( f, q
Method 02& \; k" D+ h) u; o$ T2 j2 Q
=========4 z8 S( R$ Y" z  t) L
! F5 U. P& g, F: s
Still a method very much used (perhaps the most frequent one).  It is used  {/ h; a2 K( ^) I5 o
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 P) m; Y$ c: y% }; x, g
or execute SoftICE commands...8 C, R) z1 M: }0 \( P/ j, w4 g
It is also used to crash SoftICE and to force it to execute any commands% N) l* ]' v0 V: z. j, Q, w
(HBOOT...) :-((  
& {2 d& A% _5 z( }. V9 o
- U$ d; i( |( b8 d9 \. \Here is a quick description:
5 w5 y5 M; b& o8 @-AX = 0910h   (Display string in SIce windows)4 y9 L+ ^$ ?1 t! O% f  E: K. M7 j$ h
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 O  ^1 A% {7 c' _) R-AX = 0912h   (Get breakpoint infos)
& B7 b$ J/ K% ?! P9 s1 e-AX = 0913h   (Set Sice breakpoints)8 J* O& I) V  f, ]. `7 r- D& z
-AX = 0914h   (Remove SIce breakoints)& w. d1 k* x* L+ k: I2 t, U. k

; U- _, x( `' \# E( v. {% cEach time you'll meet this trick, you'll see:
  J/ j; ~; t- i* F$ ]9 a; w( S-SI = 4647h% R& |4 C: _; o$ h( b* g/ J% w
-DI = 4A4Dh, t% [4 [/ Y: [( Y
Which are the 'magic values' used by SoftIce.
5 G: J% Y+ H( m% BFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# S* O( H7 W7 \% D9 q: Z) q7 T) e4 d: w3 A
Here is one example from the file "Haspinst.exe" which is the dongle HASP
* R7 m, M( U- U6 JEnvelope utility use to protect DOS applications:
4 O5 d& T# I9 A3 C4 m8 J) }# t8 ~2 `! L, X
$ L2 n, E) G% d- |& \) k  P; R
4C19:0095   MOV    AX,0911  ; execute command.
  U0 y9 X  G$ c$ _4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).1 {; r  Q( W9 A5 y
4C19:009A   MOV    SI,4647  ; 1st magic value.
$ _& Y# U' u' l+ |/ m  ]4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 t) n. D* V* I8 |0 A' i1 K
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! B+ g' @- N2 S3 }  s4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 I  w6 E1 L; M0 |$ E
4C19:00A4   INC    CX% S: U' V1 V4 v; N& o, P7 z5 a# `
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 h" ]3 g3 U1 g. B+ n
4C19:00A8   JB     0095     ; 6 different commands.
% l$ g; x% X4 z1 n$ l0 U2 v4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* m; |" ]9 Z+ b: b4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! s1 {9 n* }- K
; H3 A, W; V) Y6 |, H7 l5 [6 D3 v
The program will execute 6 different SIce commands located at ds:dx, which
6 b# ]; T' T, B( ~are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.* K1 ~0 L9 ]6 p* X* z! ^. |
$ d/ C3 l, \7 N" c) B# b9 p
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 u+ b3 U5 {( F" R
___________________________________________________________________________: a; Y) o/ I) m/ h* J5 A* b0 d

) ]4 t" p' {* ]1 C& V% d6 G! v5 O# N# N& H) N
Method 03. s+ y9 f4 s2 L) m% G+ G
=========
1 K7 b# k8 f  j6 U2 u+ l! |
! G  I9 U5 Z5 m; q: ELess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* E2 e0 n3 `4 r4 ]# H4 L- g8 T(API Get entry point)
* ~: L/ _7 R7 t3 J1 H( S        
) N# e+ l; x+ M" |8 e9 D2 ^
* v9 Z5 C! C, M, N& U# J) \    xor     di,di
; g! O7 ]* d5 v; ?    mov     es,di. Q- ?+ S, [: H
    mov     ax, 1684h       : u. i; Q9 Q0 }' ]: i
    mov     bx, 0202h       ; VxD ID of winice4 N0 a. L4 b% L8 P! m3 ?% d  K
    int     2Fh' W2 g% ]: m! L& _) W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! `4 ]& e0 x4 b1 T. F" A: }& L    add     ax, di. e& N- F2 E4 n$ f! ~& {
    test    ax,ax: c- d6 J) K1 P1 R
    jnz     SoftICE_Detected; M4 `4 n' l3 e' ]0 h

: [. }" v8 P/ Z+ a___________________________________________________________________________: Z. J1 ^" R1 s1 X: [% s0 S4 P3 r

5 ?2 {! m% M! g, b  Y! R5 HMethod 04
6 H- U, e' T5 X( M# r# W=========6 D2 Z" T: V+ r! l+ T" h
5 g; Z# L/ y/ N. O
Method identical to the preceding one except that it seeks the ID of SoftICE# b+ I+ F) I8 n0 A
GFX VxD.
  [' o% ]' \6 I/ u" }6 U) ]$ \( j3 W5 C2 X' q7 D
    xor     di,di
! z9 R0 L' I& {$ |( @' ]8 c    mov     es,di
2 X# G, q! h" r( E) F/ D4 j    mov     ax, 1684h         z1 Q6 S- ^, F  a/ K+ J. B' N0 x
    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ V: Z# }) R3 @5 [8 P
    int     2fh
4 y" z: c/ H, l. L    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 T5 P8 ^0 q  s; u) a% l! ?
    add     ax, di
( s7 s, j0 T: T" m" ~    test    ax,ax6 O/ U0 }: m( q  F2 W, m4 t/ l
    jnz     SoftICE_Detected: p" a4 a2 {2 U' f& M
6 N* O9 g& E: M4 g
__________________________________________________________________________0 t3 d8 t* G: {9 G5 y+ O& ^

! N( e$ E! S3 H& s: Z0 f% d& t
Method 053 ^* u" T$ O% _, J; S# }
=========
: R+ m8 h, d" b7 D% u* B4 Z  p* H: [( m# z
Method seeking the 'magic number' 0F386h returned (in ax) by all system. Y6 v$ B- m9 S1 o1 Y
debugger. It calls the int 41h, function 4Fh.
7 W4 J- z- O' J$ s6 Y! mThere are several alternatives.  
! R6 p- {# N! U5 r$ h% C6 |+ v( Q- r* t5 a  I. `4 v
The following one is the simplest:6 v2 n  a5 ?: p1 S% F

2 b" [! r9 U9 F% k0 @7 ?$ v* \    mov     ax,4fh
1 \' L, W8 H4 V    int     41h7 b- @; w: `" {; n4 F0 y1 U
    cmp     ax, 0F386, }- A! h( x8 E# B" O
    jz      SoftICE_detected
) u# j9 ^0 j4 E- e4 A' e
0 j! T) u. T, z( r$ k' P) H
* c* C. |+ u9 F2 B: e# b& LNext method as well as the following one are 2 examples from Stone's 8 R, j# U) v7 ]. Y( y
"stn-wid.zip" (www.cracking.net):
! b* ]! Q! i. N2 A; i
9 E1 U; a( D/ ?+ R/ }) \    mov     bx, cs0 S$ }# c3 C" r% h1 s  ~" j
    lea     dx, int41handler2$ s6 L  f- U. h  t$ P3 j
    xchg    dx, es:[41h*4]3 V! o/ s# D2 ~" Q6 |" {- d7 G, @+ @
    xchg    bx, es:[41h*4+2]
  m9 J9 \" y. }6 T5 h    mov     ax,4fh" B9 n& P4 v; J; r
    int     41h
% D* r- n( b+ z6 W- G    xchg    dx, es:[41h*4]
. ]1 a/ \' j7 @" h& E% j. m    xchg    bx, es:[41h*4+2]0 G% d8 R' n! M' S  X7 K$ L! ^
    cmp     ax, 0f386h- c( _8 s( B9 v1 w2 B
    jz      SoftICE_detected3 a5 o6 i! a' V: Y

. g" X2 s- l8 gint41handler2 PROC9 j' j  Y0 B7 z" u
    iret
% p& i1 o- ~8 a9 eint41handler2 ENDP
% Z3 h! F: {, O& c4 B. K/ R5 E3 g* ?
2 Y8 S2 V( P  v0 r1 f7 D8 A
_________________________________________________________________________
3 x$ y, j, R8 ]
: R. K* X3 Y2 X7 P' a) W
+ t; j5 T& {  H6 n6 |. U, jMethod 06
) Z+ e# b9 b; S4 Z0 @: g=========
* I7 m& B  K( `- s; E4 T
7 o! M3 r% ?9 \2 Y' J* U0 Y
3 @+ A  u, f! ?4 G& g( t* K2nd method similar to the preceding one but more difficult to detect:
, e6 B8 _- H( \! h% I, G8 t+ J( G  q8 c# u
* Z+ g- t5 z0 C* V( U% \& a+ l
int41handler PROC
8 u3 O3 ^# ~* y: n) p$ i    mov     cl,al' d) i; v: ?4 P
    iret
' ]6 p: Q# [) F6 K6 G% U8 Yint41handler ENDP
4 w) h1 @' v8 N. K/ [4 U& Q6 C2 |' F% X; }3 [
& u  \8 p: r- L
    xor     ax,ax
; @! u- \% C% P7 F/ i    mov     es,ax; z4 ]: H0 a8 }5 c" @
    mov     bx, cs3 C) i1 @0 `) l$ R1 y
    lea     dx, int41handler
0 |, s! }7 [, V    xchg    dx, es:[41h*4]2 F* b% ]! K2 h0 W) k( |- s. V
    xchg    bx, es:[41h*4+2]
7 E( ]; I# h7 U2 d5 `. U7 J$ @    in      al, 40h
' z% M1 g9 X* [* M    xor     cx,cx1 m8 H5 E5 q5 M" {- u( o
    int     41h
, P, _0 r6 O. x1 f    xchg    dx, es:[41h*4]# o0 N* c. c: o7 U7 Q5 o
    xchg    bx, es:[41h*4+2]
3 Z/ K. p  y) K: i3 d7 e4 V- O    cmp     cl,al
; @9 b4 u! {, G0 _5 M& p* ?    jnz     SoftICE_detected' e  c# ~' H0 C

: G9 ?- t0 u" n! Z( O_________________________________________________________________________$ s; e' }+ N0 _( K
  F8 C4 h* F( a& A" N4 N3 h1 ?
Method 07' X( ?7 h. H6 h; t* Y
=========
4 c/ w1 h+ Y! y% C4 \0 B. G7 _% H- e5 D7 a1 P& l% B
Method of detection of the WinICE handler in the int68h (V86)
7 o+ E1 ?6 R2 y" i; u
6 D  v0 {3 `; T1 ~' A8 y    mov     ah,43h& m) ^' [$ O& b! M- O
    int     68h
) Z. e+ ]; {9 m8 t& S    cmp     ax,0F386h2 s0 [9 F1 h% l( r' i
    jz      SoftICE_Detected/ o& H) o+ U" q% y
+ ]  G0 e1 _% x3 w
. \7 a! X$ n" [: y2 f& H( z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# h* t1 |, V" x% q* u7 n
   app like this:% `! C& g8 ^2 q

: e$ m6 V1 p, y0 @2 i3 o   BPX exec_int if ax==68/ b- e# t* k  T( o8 u. q3 k
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& }! m  l  j* W1 V% {7 j   located at [ebp+48h] for 32Bit apps)% v% Z4 ?$ I/ B
__________________________________________________________________________# j8 [, A$ B$ ^

+ K( o# x9 ^: r* ~- F
  J6 E# c0 W* i" @* EMethod 083 t; _8 O! T& M* {8 K
=========
& r" T3 f: f, ~: V: d) C( m3 T
' K. i* N- Y. [' X6 j" G- dIt is not a method of detection of SoftICE but a possibility to crash the+ h1 n, |1 b. }' J! S( l
system by intercepting int 01h and int 03h and redirecting them to another. K/ w1 e3 K5 R" d% v
routine.
$ V# M! p- ~2 k/ o) `. E! vIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points2 L/ Y( @+ [8 R3 g& J+ ]/ H/ z
to the new routine to execute (hangs computer...)
. `3 v/ X1 `. d9 H/ ?6 m9 p; h+ ~9 |  g- J' |5 P
    mov     ah, 25h' `  `) a# S% h+ N% a
    mov     al, Int_Number (01h or 03h)
. }0 n: e5 n% d7 K    mov     dx, offset New_Int_Routine
( p# Y8 O  M& t& l    int     21h
; R5 [" y: a. U3 d! D+ M2 ^* H  n2 `! w8 o
__________________________________________________________________________
9 j* J$ f# o+ @$ c, Q2 Y( y% U) \+ ?4 l
Method 093 e$ J2 u1 b4 ]3 a7 f" S! u7 `0 n
=========- h" |/ E! D0 T0 H) t& v
; k% S# a8 `. @' m
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  Q! ]$ @5 F+ y2 S2 `$ ]3 o
performed in ring0 (VxD or a ring3 app using the VxdCall).
: C8 R; a. f+ p! L% Y8 \The Get_DDB service is used to determine whether or not a VxD is installed
/ ^+ c0 |+ c) M" j4 H, y6 Mfor the specified device and returns a Device Description Block (in ecx) for7 O, s$ @5 b: a& F) q% C
that device if it is installed.
" Q- t' S! R# h$ ~0 e, U/ l) d; I. T$ n) Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 W+ U; t6 ?% L% `, G0 P" D0 T
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)& \" c' Z& P3 S1 T
   VMMCall Get_DDB
1 T" @% O1 \2 L/ @: G   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 S2 y" P! r* o1 P' B
' T: m% p. w, c3 qNote as well that you can easily detect this method with SoftICE:
. V7 ]: i5 C* c$ L* h   bpx Get_DDB if ax==0202 || ax==7a5fh
- b8 j7 @8 g' }" d7 w( \4 C- Q* a) C: D7 t6 X8 q3 Z7 ~: V7 A
__________________________________________________________________________4 G  M; ~# E% P3 W$ o% w& A5 l1 R

' |* A5 H; T* S& {9 ?Method 10
/ n$ D3 {4 @0 u=========
* a: W" ^/ u/ n3 }! ]( S& `! c3 p
8 {& D* x. F2 a. }# f=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 c7 @& j/ [$ H9 X/ [  SoftICE while the option is enable!!
7 S) a! e3 n1 c- [* C) V$ ^3 T3 n8 w' ~" G
This trick is very efficient:
2 \5 R+ G1 Q; Fby checking the Debug Registers, you can detect if SoftICE is loaded
; V" [5 O. R! `7 N' s7 Q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! U' y  X7 R0 {4 q+ i' t
there are some memory breakpoints set (dr0 to dr3) simply by reading their$ d5 W! I$ G1 b2 t2 v' r% J( W
value (in ring0 only). Values can be manipulated and or changed as well
$ ?1 c8 y1 U8 l(clearing BPMs for instance)8 q  V' @1 {$ B! l2 }" `' S
$ w* T0 I2 x6 ?& N+ k( E) f7 L$ N  E+ m
__________________________________________________________________________
$ v8 o7 ?$ J- ^3 f' O1 G# ]$ r0 h$ m( F! _  b
Method 11
+ r$ P* E/ R* D=========
* y( H* r7 b8 l! k/ R. A! H, s4 }* p5 K0 p: u5 T7 C
This method is most known as 'MeltICE' because it has been freely distributed4 w/ B4 ?% l3 Y
via www.winfiles.com. However it was first used by NuMega people to allow
  F( F$ F. u; o9 @4 f7 _! sSymbol Loader to check if SoftICE was active or not (the code is located' `# N7 K- y0 L- p
inside nmtrans.dll).& d. c1 ]. E$ K
% i8 `& \% n* E- a+ d4 e8 j7 Q
The way it works is very simple:
& y% N& K. f! U, s- J5 }) l! c, ^It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 E0 @3 q9 `* A3 D1 T, y# }WinNT) with the CreateFileA API.3 K* f3 v9 m) o9 _- [/ T# T

3 |  K. W! c0 [: u4 N  }Here is a sample (checking for 'SICE'):4 c6 E/ b1 \( r$ d3 q3 I

' x' l2 G; n. YBOOL IsSoftIce95Loaded()2 N. X8 a# g% H$ T4 n; Y9 ]
{
# M/ o4 c1 D/ G4 A- k. r* J   HANDLE hFile;  
; H7 c' J) P2 X1 {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 q% m5 N1 x+ N9 g* _0 r                      FILE_SHARE_READ | FILE_SHARE_WRITE,' h! E  e& J. f; l# l0 }, H1 {1 |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 b7 z' q- e0 K- T4 ]! \
   if( hFile != INVALID_HANDLE_VALUE )
5 b8 _' x/ P+ E  C/ E   {! q! I7 i: Q0 e# \. U2 m2 W% g
      CloseHandle(hFile);9 a! I6 I# E- m+ }* H3 Q) q
      return TRUE;( G) g% `4 N8 W4 l- b, P- U
   }4 }" P3 Y( G. c6 u" S" @1 T( K( ^! b
   return FALSE;
6 b- L& t; M/ E}
1 A# Z% }5 J8 o
; Y4 |& L1 C6 t- MAlthough this trick calls the CreateFileA function, don't even expect to be
' t( V$ u  X* D) }0 q: ]able to intercept it by installing a IFS hook: it will not work, no way!0 k( {8 n8 l" X- S7 ?- E$ R
In fact, after the call to CreateFileA it will get through VWIN32 0x001F" h1 J/ R% h% W
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! \* c' L$ j: P" u0 Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc' c' P+ R4 m# i; k! D" d, x- N
field.- ~7 u# M+ d! ~. H+ i/ O( e
In fact, its purpose is not to load/unload VxDs but only to send a
+ ^# |& l6 ]' uW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 a$ F6 J. Y; r* D7 [. `to the VxD Control_Dispatch proc (how the hell a shareware soft could try  z4 M3 u  D* v; V: m
to load/unload a non-dynamically loadable driver such as SoftICE ;-).3 N& q* ]0 g) Z5 X# T4 m  u
If the VxD is loaded, it will always clear eax and the Carry flag to allow8 Y( D* z. l+ A, A3 M
its handle to be opened and then, will be detected.; I+ }& f5 i5 M1 g* \- \$ m
You can check that simply by hooking Winice.exe control proc entry point
( B! @6 `& K7 J  S- awhile running MeltICE.
) {( x& e4 p3 o. U4 H$ P! x8 {& A) p( [( Q1 T7 I) ]$ [

9 V* i6 ~! C- F# E; R) J  00401067:  push      00402025    ; \\.\SICE3 s2 D4 l- J3 k6 o, P9 d
  0040106C:  call      CreateFileA
* L- T! I1 j  h) f- F  00401071:  cmp       eax,-0015 j$ G/ ^" l+ [& W$ V9 c
  00401074:  je        00401091
3 n. w* W6 V/ v3 Z* u# |8 f6 b, G) q& r/ e$ F

# ?: [) W: d( ?- d7 N8 tThere could be hundreds of BPX you could use to detect this trick.; h% L6 T# t  u
-The most classical one is:2 w6 V9 q. G) M0 _6 [( W" g
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 G7 f4 s. [  `- M9 c    *(esp-&gt;4+4)=='NTIC'  J3 v$ ?. G2 R$ \( E
7 p! q+ D; V' i2 ^* F4 E
-The most exotic ones (could be very slooooow :-(
% H" s% E/ H" K% j5 o: C9 |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; d/ m: q7 e& o; S
     ;will break 3 times :-(
& I- G* [. A) u) ]7 T) n) i+ v
; M( T( J& J9 N-or (a bit) faster:
. k3 g7 x4 T, D/ }$ }1 v   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ q  C' _9 @% D) [4 R$ d8 s: n. E6 L
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
+ Z5 l5 k* W% z     ;will break 3 times :-(7 P8 C# k& `3 k% T- G3 F# }

* X8 j6 B* s9 S( c9 l-Much faster:- K0 R2 w! @5 p, v1 L" A% T
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; _- h' S# V* }, W+ g8 \! Q

" q1 R; u& G3 y0 r8 @Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 H" }% u0 t: H* i+ C3 q# [function to do the same job:& p# F1 h5 U9 N+ H

( J; c$ J/ a- Y. J  \   push    00                        ; OF_READ
$ X/ v% k9 M+ M: r' R  X   mov     eax,[00656634]            ; '\\.\SICE',0
( a& Y- i, F2 f& Q   push    eax* j, P) M5 ]; w  M; L& q
   call    KERNEL32!_lopen
. @/ ^1 P" y; q, Y( V. O) ^   inc     eax
7 H6 r6 ~9 A! l8 ?. C   jnz     00650589                  ; detected5 K7 K  J2 X% @: L7 o1 Q' p% ]
   push    00                        ; OF_READ* x9 a5 O. r+ |" ~6 X/ K, t
   mov     eax,[00656638]            ; '\\.\SICE'0 @4 g- \& U; f
   push    eax
1 d/ K1 S0 d! Y; w   call    KERNEL32!_lopen  D  m3 h, H: ?0 S' W
   inc     eax8 v) ^2 j6 c! t' j8 j% k
   jz      006505ae                  ; not detected
3 _4 v- ~: t4 b9 u3 V1 P1 k
0 t4 N/ I* x( n
! P& _' C; J) q2 Y__________________________________________________________________________0 [; ~! P0 d( S7 P

6 O. z9 Q$ t- q* S$ xMethod 12. d8 N* A+ ]% Z3 D# d. z0 Y4 k
=========
; X/ c6 f6 G( u8 {; v' n5 O. C
. \7 N$ l  {) E+ j" F8 [+ OThis trick is similar to int41h/4fh Debugger installation check (code 05' k/ q$ C5 u3 m7 O# k
&amp; 06) but very limited because it's only available for Win95/98 (not NT)) T; i6 e0 b& q; G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 \3 C0 Z& G9 S8 x5 K
$ J7 E4 D# y' }+ ~5 x6 F- t8 b- b   push  0000004fh         ; function 4fh& V& m; ^4 K7 _+ \  M
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 ~7 v$ S1 ?# H! T6 _
                           ; low word specifies which service
. x4 v. v) O; v. D% k7 n0 k) `                             (VWIN32_Int41Dispatch)
2 E* ~  e- B2 H, V, ?   call  Kernel32!ORD_001  ; VxdCall& x' b. t$ y' E
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 l8 R( \' P# X; F
   jz    SoftICE_detected
3 u5 v  D: R: Q, `6 _0 g5 g1 X' T- Q9 q; Z- y) F
Here again, several ways to detect it:
0 q, e: f  ?* |1 [4 a6 q
* a4 \4 o" c$ j8 i" H5 E) f5 M, e    BPINT 41 if ax==4f+ ?& _8 k* y- I% h$ C: W+ y0 p
& N/ t: X! x# T! T
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, n' n2 A- Y$ {# `' I! w; U2 a$ {2 ?% Z2 Q; b/ g2 G
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* C& v4 b* S( z- f/ O5 i
6 ^5 Z/ A% p6 m
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" w6 E" a- j8 ~7 w/ U/ l0 m, y! r
__________________________________________________________________________% `# U, \5 G: Y2 P/ o# i

# s# Y+ X4 \# EMethod 131 @' x6 r+ o8 C2 n( r
=========* U9 u  y9 R8 ~- ^4 I0 S
) g  q- I$ \) X; l" Q+ r5 H
Not a real method of detection, but a good way to know if SoftICE is
8 i2 y, k* I# `, n% z$ j9 winstalled on a computer and to locate its installation directory.6 z* L  S2 X2 J4 p- c. @, l% j
It is used by few softs which access the following registry keys (usually #2) :
% E8 j* q: V# w* _3 d5 J& J  `& R6 ?3 Y
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 Q1 ?) E0 `- O0 [$ `! v\Uninstall\SoftICE2 B+ s0 A9 V' Z- F& Y* [) T
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 J3 F# a+ Q; s7 P, n-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 f! M2 Q* Z9 o* U( ^( k\App Paths\Loader32.Exe
; p6 J( w( H) E7 t9 F# c6 s  T9 \; a
4 h8 ~7 w# j- M( c% q4 v* y) H( y6 `8 w+ N# G7 \& Z4 a% L
Note that some nasty apps could then erase all files from SoftICE directory6 `$ s; N+ c. {( \
(I faced that once :-(
+ t: k0 j$ M; m/ B9 V8 {! Z1 S, ]/ V% q) t3 j& @
Useful breakpoint to detect it:, j0 i+ Y& I& e9 t5 t

* w5 X+ I6 G* k! ^3 x2 i& u  w! }     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; u9 Y! k* J4 y
3 h+ ]9 \+ k3 i" o6 p9 K
__________________________________________________________________________- o- o6 j5 g4 y6 `! a2 e2 |
1 Z& [$ S2 C' {! e# _, c

" |  y9 @; u) P- _Method 14 8 E. C- _0 g6 e9 b: Q# t
=========
$ c' }/ |$ l/ H/ \& O8 E5 _' B+ i" t: e, {# `0 M
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% [: K; h  @+ S* L
is to determines whether a debugger is running on your system (ring0 only).8 M! _# Y2 }3 v! V5 X# z

0 g4 A4 C; U& S1 ?1 O* }( T6 a0 u0 c   VMMCall Test_Debug_Installed
5 H+ M7 L7 w: B   je      not_installed
9 g: A2 `& H+ G5 [
- B6 ]8 w" u+ L( ^5 l0 G7 E4 NThis service just checks a flag.1 X& S8 a% ~. Z7 T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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