About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ A2 M' U4 d# q- f7 e<TBODY>" [# k6 J0 [1 [, b8 s
<TR>( p4 W: k! h- o& H9 h; V) \
<TD><PRE>Method 01 , s0 q. R. X: ^1 |  D$ o0 q) L
=========
; k1 D7 Y0 c( A# p( ^; b. L" D8 b6 _- A. |4 a9 b6 _; _' j
This method of detection of SoftICE (as well as the following one) is( Q- V; ?) _7 Y9 ]4 V# @
used by the majority of packers/encryptors found on Internet.6 `1 e1 O3 V5 v  y9 p3 p
It seeks the signature of BoundsChecker in SoftICE
% o8 ]6 b) }# s' P( U4 u
* o' }" i" c$ b- Y+ R    mov     ebp, 04243484Bh        ; 'BCHK'
; Y2 d. ]) C' r% r2 T    mov     ax, 04h
6 M0 C" K# V7 g# ^+ q    int     3       ! P' x8 c4 x" P* m+ q* ]. C. H# F
    cmp     al,4  D: j# R; r1 Q# p- p
    jnz     SoftICE_Detected
2 U! o1 i8 r$ I( m
* a8 N0 ~" J+ z0 p  E" Y___________________________________________________________________________* F- b- O4 u( R1 }: o$ i
) v$ p8 _, E7 a, w$ Y
Method 02
( V, \$ P2 D4 ?& l5 Q) I9 [=========
* i/ x  {! j( ^6 P* W, u
; M1 E) u" P7 J  hStill a method very much used (perhaps the most frequent one).  It is used/ K/ {" v7 B; T& S+ ^2 [8 _
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
7 y7 F, f/ {* z- x# {or execute SoftICE commands...- S! r, I8 _2 k" ^) L
It is also used to crash SoftICE and to force it to execute any commands5 P, z. r" D! C5 n
(HBOOT...) :-((  
% q4 Y$ ~+ s; |
) Z  u! l: \' W8 ~+ P0 BHere is a quick description:
4 z% ?$ J. t3 u* p, Y-AX = 0910h   (Display string in SIce windows)
) D: j7 O0 t; D, e-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- A9 k2 o) {5 r4 |( m/ [-AX = 0912h   (Get breakpoint infos)
, i6 P% |# P4 h: x% G-AX = 0913h   (Set Sice breakpoints)
9 E( i; j7 {0 y7 o& s( R-AX = 0914h   (Remove SIce breakoints)7 E: s6 M! B$ E# p4 Z- g* R3 ~% F3 c
, h: Q! t% j6 [
Each time you'll meet this trick, you'll see:4 e2 C+ n- q' z* X+ A
-SI = 4647h
) K. i$ e/ v- y  B" n, k4 h- V-DI = 4A4Dh
0 n+ J3 p( @' O/ E% QWhich are the 'magic values' used by SoftIce.: l* y& ?, g, J
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 X( h8 J- S! K7 s

: B8 d* W$ L' h" u! e4 z2 eHere is one example from the file "Haspinst.exe" which is the dongle HASP1 f: V' A* \8 _
Envelope utility use to protect DOS applications:
6 l* I( g$ e4 D
9 a3 |! d9 E! L( I! d! L3 }
: n( W6 m' T. c; W4C19:0095   MOV    AX,0911  ; execute command.+ j. H3 D- ]' Q; E1 u
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 f4 C  Z% m5 |, x) q7 J8 a# B4C19:009A   MOV    SI,4647  ; 1st magic value.: l) z8 p9 y" P5 o
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 J" n; c& F( O% w) i- i4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: h. V1 Q; |& c, [( n7 e# P1 H9 U4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( D/ q1 @, N$ `4 @( }! j( K7 A
4C19:00A4   INC    CX
$ {. o$ m! y; |2 Q* r; }9 i& V4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
! S& Z! M. J+ n4C19:00A8   JB     0095     ; 6 different commands.
8 G& R! y4 @/ j& h% m4C19:00AA   JMP    0002     ; Bad_Guy jmp back.! ~# T+ N4 M1 G# ~; D
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  S* E+ y/ V! e4 W! s: E/ b
9 L) d, ^+ ^, e
The program will execute 6 different SIce commands located at ds:dx, which  y& H2 b0 T( F) e3 |
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) P9 l7 U" D7 }
6 s6 s: r, D3 [- ?9 d7 r; ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  D0 g9 B% c: ]) B+ O, V: s___________________________________________________________________________8 F. l" ~3 a2 q  M, Q9 @$ Q
( |5 b* _. ^# m
( j2 Q+ N6 H/ N
Method 03  W0 z8 ?# h( ?
=========
3 Q! c, u. s2 A) Q4 b2 g" h; Y9 z8 C
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 V6 z; D1 N! t! t0 h6 T/ m(API Get entry point)
) J3 M6 W$ x6 k4 ^2 O% u) l' ?        
1 V5 i$ c3 d: q! R) m
8 @/ \# ^( X0 V3 t' `# ^' D- U    xor     di,di
9 O1 X6 s8 E, Y2 }4 x    mov     es,di8 X* O6 a* V8 j- H
    mov     ax, 1684h      
: J# s+ V) {% V' A    mov     bx, 0202h       ; VxD ID of winice
: D, q2 j; ]0 r) b! L    int     2Fh
" p) X. s+ t  l; a& z* l    mov     ax, es          ; ES:DI -&gt; VxD API entry point; r8 Q! S: I* H+ C0 x  {7 Y, ^: S
    add     ax, di1 F0 M- N; r; M$ p0 j. Y
    test    ax,ax- o1 `9 X  X! k& g
    jnz     SoftICE_Detected
% J. I/ ~% X7 P1 U; `
: [4 M/ [& \1 b; \$ g___________________________________________________________________________5 n& q, @9 P* m" z! ^; v0 e0 N+ y; _

9 o" f  a% @1 N$ G2 y' U3 mMethod 04
, ]; ^% H' q  m=========; Y+ D8 y1 F: E3 O4 \) h# i
% n( ^' t5 [/ N1 K/ }
Method identical to the preceding one except that it seeks the ID of SoftICE
- {( G6 S! {: I9 q, ~* GGFX VxD.
' N! k$ U+ W" s. u; ]. ~
  v; p  N7 k5 Z    xor     di,di
1 g4 k# d; l+ J2 i/ G2 K    mov     es,di
* I2 |2 {9 w" R+ x+ [( {. l- w    mov     ax, 1684h      
9 s7 ?, g6 e7 S( H  u    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% d, y8 V+ }$ |0 y7 ?1 X1 U    int     2fh# c7 T$ f( N0 n' V9 W3 s
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! A, X, B0 y# v& B9 Q    add     ax, di
! Y- ~, E0 i0 {( F4 X& E    test    ax,ax
( g0 [3 p% ~$ J6 R    jnz     SoftICE_Detected
$ W0 _0 [0 b2 M9 Y* G
: Z7 X" [( }( Z0 l. i5 @' `' U__________________________________________________________________________
& [6 t8 ]3 d* ?' N7 c9 O) ~! q8 B% @9 I; r
# V) J  s# t" p" O; N5 n! W
Method 05
0 I2 H; c5 S+ _=========. O' r$ f' i, I* |# v  a7 \" n; }
# ]$ f2 b7 R3 @8 Q. E* y
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- f+ z$ ?* A9 _) {9 p) edebugger. It calls the int 41h, function 4Fh.' D* _, z4 W1 q* X: @* y! z
There are several alternatives.  & m, K9 S8 [2 _; b
" o. `7 v; x$ i4 u; _
The following one is the simplest:. X1 s" a2 _1 Y- e
2 U  y2 s2 i) m- s! }
    mov     ax,4fh
7 r" U& B+ K( |! o3 M" t    int     41h- a* c: X) Q1 A
    cmp     ax, 0F386  N% Z* r# I0 e8 |' E  h; u1 r6 q
    jz      SoftICE_detected
% h; a! `  J1 z4 ^& P" Q; @+ v
# a  W1 ~8 @4 F1 Q4 u' G4 R& M2 }$ Y# x( k; _
Next method as well as the following one are 2 examples from Stone's 2 T/ Z: R1 I0 i) Q
"stn-wid.zip" (www.cracking.net):
9 i& k* @' r8 ?1 P1 N  z: n' j& R) Q. v' C
    mov     bx, cs  h& p% j8 j  B8 W9 R4 z
    lea     dx, int41handler2
" p0 G; Z, j" r7 ^: m    xchg    dx, es:[41h*4]5 ?& i- F' I2 H% m' \( r3 y- i7 k9 B
    xchg    bx, es:[41h*4+2]
: w5 f8 j% z. A. K    mov     ax,4fh2 e+ r1 ?' a& m5 t7 R" y0 E& K2 X
    int     41h! S( l; ^6 v' S( m7 Z
    xchg    dx, es:[41h*4]. u. Z) W6 n/ i% y$ ]$ c$ }
    xchg    bx, es:[41h*4+2]* Q9 p2 C# B0 |3 r- p
    cmp     ax, 0f386h
1 |: Z! g& i8 s0 B0 p, ?- M    jz      SoftICE_detected
( E/ [' h+ X* J4 o( @* Q3 Q1 V0 ~0 {7 ^$ m- T5 ]' r% R
int41handler2 PROC
, s. k: x. E" N% C1 F/ p5 D4 W    iret/ R$ c0 y5 A" j9 }; P
int41handler2 ENDP; K- ]+ U* i  `/ G9 T" E' \& h

. W6 I6 A( j( K2 z5 o) j- `! `9 R, z5 Q6 s( v/ _- h
_________________________________________________________________________( t% c1 \2 L# X, }3 ?

9 ~2 ^, B2 d: ]8 ^8 j/ a( W% v- \7 x' G% U
Method 06
, R! J+ a: P- E3 l, E=========
9 ~1 l/ M( p2 m& Z3 @) c2 e
' F  ~2 {$ O$ p/ q2 j, Q9 p/ Y' v* ^( l  o" `. R4 f
2nd method similar to the preceding one but more difficult to detect:
6 |% Q' S$ S1 M$ W) G9 i0 p  `! t+ u3 f  f$ s$ C! U
9 p4 D+ U4 h0 x/ N& ^
int41handler PROC1 e7 J2 h' b/ o( Z  n& F) G$ i
    mov     cl,al/ T7 l9 A- F# Q% a/ P) G0 ]- `; U5 k
    iret2 c6 _9 j% D, h) m# O- I
int41handler ENDP
; V. I$ h& G1 b" P, j  e1 B# i3 X$ p9 {+ }7 l  n

( f; X0 t- W6 e; N/ p    xor     ax,ax0 ^$ X' G- ]! M8 n3 T/ Y, l
    mov     es,ax! c% J8 B9 `, \% K" }
    mov     bx, cs# F" o  o6 R; t' m# `! c  @4 H
    lea     dx, int41handler# e5 c6 t. Z. X0 y3 @$ P
    xchg    dx, es:[41h*4]
% H6 I8 H7 J# k& @& v" Y    xchg    bx, es:[41h*4+2]$ Q3 q9 p' E" @7 S; g$ B* U
    in      al, 40h
7 O5 }' v3 k9 D3 o$ Q' F    xor     cx,cx
" U. d$ d  ~9 B1 @* M    int     41h
7 G2 @* B+ Z2 T: w, b    xchg    dx, es:[41h*4]
* k  S; C5 a+ D2 G2 b7 a    xchg    bx, es:[41h*4+2]. Q! [2 n; b$ J  X" f4 o* z
    cmp     cl,al! I* Q- K2 Z6 `, }  g0 B
    jnz     SoftICE_detected
- u4 b- N' u* w4 e7 p0 E; }! n  d/ [
_________________________________________________________________________$ y( B) Z8 g6 E  N, C

' g9 n. ^& x4 m, k; d. S- E/ B+ RMethod 07/ U8 P8 [% B* e+ E2 D. c
=========0 B' ]8 v4 w1 Y; l  m

% x. @  G- v& E! t- ]  f8 a6 GMethod of detection of the WinICE handler in the int68h (V86)
- ?" ^% d& A- `, |
; x( b8 l" j; s    mov     ah,43h  C9 M! [; `; h
    int     68h
3 P6 a( z- n0 _( B* d$ b! b% C. o    cmp     ax,0F386h
  Q. H0 \( F3 M1 c' l! r) U7 B9 a( y+ {    jz      SoftICE_Detected; N8 K- F! y" j0 ?, ]0 o4 {
$ s+ C! u8 C% N, L( w+ B/ H

; v- I* n0 C! {=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ w! x/ f1 j" P; s   app like this:
& h$ I4 _) E# o4 A0 N  o6 `
( _9 T2 k/ r, N5 }   BPX exec_int if ax==68
. R# i  d" B' K0 O% w" L. @8 q   (function called is located at byte ptr [ebp+1Dh] and client eip is5 b% k& D. l" O6 [0 Z
   located at [ebp+48h] for 32Bit apps)
+ Z& ]8 W0 X0 J! x__________________________________________________________________________2 ~* ^& F6 J% E$ i/ k- p9 O

+ S0 I5 [/ V* M* w' F+ l
3 y5 C1 X3 m7 u0 q* JMethod 08
! |+ {1 m# N0 `+ n; o$ P=========
1 L5 t: o4 o, `* j2 ?6 D; Q$ @, ]8 ?  \' W+ z( L- V1 P' F
It is not a method of detection of SoftICE but a possibility to crash the
- ?9 L! l5 m4 |" F3 a6 Csystem by intercepting int 01h and int 03h and redirecting them to another5 z1 G, X$ i; L4 P! A9 a
routine.
+ d( V3 K% b+ `  U  Q9 s0 zIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 n8 q# n$ s8 z- O& Z
to the new routine to execute (hangs computer...)
0 n, H( q) A/ n% G& c) d/ Z4 n$ h4 N# U5 K7 l1 B, C& t* k
    mov     ah, 25h
! n4 R& q$ f. E! @8 a    mov     al, Int_Number (01h or 03h)! D) P8 ^- |+ {8 }5 C
    mov     dx, offset New_Int_Routine" A# f; v  [- r) j/ L
    int     21h
7 u& F1 o# o$ {5 n- n- i7 W3 e& W1 V3 \) u" I- z% H
__________________________________________________________________________
' c# _+ e' t( W
1 |' b! e" }' U: O' b5 QMethod 093 c8 X. w) j, e* L  H! N' ^
=========8 M; J9 D" ^& A/ `! w0 h0 V

  g" x5 L3 @* C) |  TThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 |; |, F1 ^9 b0 Operformed in ring0 (VxD or a ring3 app using the VxdCall).) |- K: G* E8 t  A
The Get_DDB service is used to determine whether or not a VxD is installed
/ K# a" h# K8 t- M+ W9 B! ]2 qfor the specified device and returns a Device Description Block (in ecx) for. L  ?6 g$ @) ]4 [) F& a' S* ^
that device if it is installed.
: h8 \6 F/ [0 J0 N. L. P% q# l4 G8 t5 l8 ]. `# c
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) D3 b$ d9 S% @: r4 f) z. d
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- H2 L5 ]$ c6 [+ {0 e+ H   VMMCall Get_DDB
9 ]4 `9 s+ T8 k/ I; ]/ u; _   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; O0 j; E9 f. [0 E% t3 P0 g' A+ H6 B3 e  U
Note as well that you can easily detect this method with SoftICE:
) y% [) `7 q2 H   bpx Get_DDB if ax==0202 || ax==7a5fh: M% b6 w$ L! f# x+ |3 d$ h$ q  C

% ^: \; P. U8 j5 X__________________________________________________________________________) @" N2 F+ `/ U1 R5 {
  y, Q7 b- k$ R; V6 {/ O% U- S
Method 10) A/ p3 W; j7 h& l2 l
=========
$ o9 ]+ H  K, A7 }
1 Q7 |3 }6 X: r5 Y7 ~5 N$ r0 I* u=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 y( s# ]! D" o1 x/ U
  SoftICE while the option is enable!!& U$ Y. E9 |4 M- w- Y0 ~3 b

# n9 u5 C" @8 X6 ~- a% K" WThis trick is very efficient:
1 N/ D. k) L) Gby checking the Debug Registers, you can detect if SoftICE is loaded# E9 W  O$ R1 m) S% n
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! Q9 Y4 m. m+ Z4 @- y9 G# ]& f
there are some memory breakpoints set (dr0 to dr3) simply by reading their" B' f! O. P/ v
value (in ring0 only). Values can be manipulated and or changed as well5 D: H1 d" H0 n: H' x* f6 T( Z% b  q
(clearing BPMs for instance)
3 q3 B7 K* `8 K* H- Y" ~* c
" t3 ~& @2 D( x, v__________________________________________________________________________7 r! L6 O; ^% Y) L: k! q+ D3 A& J
/ \/ i% n5 F3 m, A+ y
Method 11; C3 r* f' W' u
=========
# j' Q2 q1 q- _& I* ]4 D, s" [
This method is most known as 'MeltICE' because it has been freely distributed
1 w5 ?: l7 a; Nvia www.winfiles.com. However it was first used by NuMega people to allow$ M3 G( Z/ O# S9 G" J! F* W: |8 m; w
Symbol Loader to check if SoftICE was active or not (the code is located  r* E: t: C/ p; i& V
inside nmtrans.dll).1 o0 t/ B( f1 d( H4 H

  \# a0 G2 z6 T) t* Q1 i& S$ dThe way it works is very simple:: n. @0 L: D- ^9 F7 k0 C* i
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for/ g  C/ I9 i/ w$ {
WinNT) with the CreateFileA API.
; N4 B, b; \# N
  ?  B# V/ V% Q9 P. U2 JHere is a sample (checking for 'SICE'):, S5 K% R/ A* u

; o- S/ U; c1 b( c4 g8 E  [BOOL IsSoftIce95Loaded()
) U, c4 c8 v, D( A) \2 f{
: L! F; o4 w1 ^+ {   HANDLE hFile;  5 n( J5 F! z  {0 g* I0 \3 s
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
3 t; h% j$ ^, }$ M                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( l2 H4 O, [+ C4 V- C. i                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 G  ^+ p1 h' R0 J7 L$ K+ g& z
   if( hFile != INVALID_HANDLE_VALUE )" c' {: Y! _- y% B# S1 H; s" a
   {
& j; W9 U9 x7 J" V! L* a* f      CloseHandle(hFile);
# z1 @0 R3 e, O% E( r      return TRUE;4 F# o: U7 G4 d
   }
8 R5 [3 z2 P- X3 |+ j5 N1 c   return FALSE;; z9 v; I2 m" d/ x
}
/ v5 p/ v6 a7 t* o/ R$ k& v9 |6 ^/ n
Although this trick calls the CreateFileA function, don't even expect to be) V# T+ Z$ |) x( x) Q& v+ O9 w6 ?
able to intercept it by installing a IFS hook: it will not work, no way!# T7 q7 m$ c1 E: e
In fact, after the call to CreateFileA it will get through VWIN32 0x001F& |5 Z/ D2 I/ X: H) {; X6 o
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# Q& b" @4 f4 A0 w. f8 G+ ^
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
, S  D# }/ A8 ^, R1 V7 c/ Y1 Hfield.
- t* E+ @- v  y# t& t% cIn fact, its purpose is not to load/unload VxDs but only to send a
( U$ s: Y" Z. T* n% }0 |. xW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' J0 x! S" B! d4 k# g3 r8 G! nto the VxD Control_Dispatch proc (how the hell a shareware soft could try: I- ^6 _4 H4 l& L
to load/unload a non-dynamically loadable driver such as SoftICE ;-).. N. S, D- R( @5 T2 H
If the VxD is loaded, it will always clear eax and the Carry flag to allow! j0 z$ g7 ]; V  F' U. g
its handle to be opened and then, will be detected.
0 c+ J% O8 w- XYou can check that simply by hooking Winice.exe control proc entry point2 D6 h% ?  _( d- X- y
while running MeltICE.
$ j9 k+ v3 a' u; l& y2 t7 p
: F$ c1 W+ k8 H+ I+ S' H
: d+ g( \( z: {  00401067:  push      00402025    ; \\.\SICE
+ j. w$ a4 p0 q3 K( r  0040106C:  call      CreateFileA8 `- Q' d9 N' b$ i: i% h* l
  00401071:  cmp       eax,-001
# F9 h  }5 f1 B3 m0 n3 r. G2 q+ P  00401074:  je        004010919 Q% {! p& S$ v, S" Z. G6 B

5 u. J/ g0 k+ w* D' s" |5 [
( A2 z! y8 ?0 L4 bThere could be hundreds of BPX you could use to detect this trick.8 E7 s; u5 c3 [/ B0 z( ^
-The most classical one is:) b0 ?; y8 q* S! R! ^: z. ?( F, T% t* M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 g% }0 V, a9 u- C& q5 F8 K
    *(esp-&gt;4+4)=='NTIC'' \* r6 D- M; Y+ J5 h0 V+ V
4 }* u7 e8 d  @1 [# w. A$ k
-The most exotic ones (could be very slooooow :-(; V* p) `, Y, y3 ^: s: u2 z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - [: a+ l1 e7 S. I+ K& U. E' k
     ;will break 3 times :-(
! K% e( R  A, P3 W! Y
# L" T  i; ~* E- _4 m3 @-or (a bit) faster:
. |( }/ W/ Q3 y+ Y) M6 `   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& G/ Q3 [. P- s( ?2 ?3 k) X! t5 R" [% j
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 N7 x$ ^# `0 A1 h
     ;will break 3 times :-(
- g* K2 `) i9 ~6 @* \# l
. [+ S6 e: z: _  ]) z2 }, j-Much faster:
2 t. K( T6 Q. J' _9 F* m  G   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, [7 i& T) m" {% J1 x
$ o% X2 q8 V' H7 P' m: KNote also that some programs (like AZPR3.00) use de old 16-bit _lopen( V& p+ A5 t7 x
function to do the same job:, b% K$ ~& [, B1 G1 E  M5 R

$ }1 W* ?) A. t2 _   push    00                        ; OF_READ% u4 E& F0 D6 M& L" e: o
   mov     eax,[00656634]            ; '\\.\SICE',0
, x4 i" ^% F7 c2 Q, k   push    eax
$ T9 @' o; ~! k0 M2 c# k   call    KERNEL32!_lopen
2 r/ T* `9 v9 H; b: V   inc     eax, g! A5 \" C" Y# g
   jnz     00650589                  ; detected. K/ P9 }( Z  |' A/ i. k
   push    00                        ; OF_READ
) A* p2 {" `3 ?" V% C0 A- S8 u   mov     eax,[00656638]            ; '\\.\SICE'
- A" R2 M  N  V) f   push    eax, C" k- k7 @9 y% }
   call    KERNEL32!_lopen; Z( t: b+ J+ |# O( C8 n. U/ o
   inc     eax
* q2 P# s% A3 }0 X& r* v; B   jz      006505ae                  ; not detected
; `5 }4 E; |/ u: D4 y* k, ]) Y* [  y1 e+ }& i2 O) p& ^( W
! [5 `7 q7 c% v+ D9 p* k$ I& z5 k
__________________________________________________________________________3 B& t7 a/ e2 l. n+ P
7 X4 \* M# P0 j
Method 123 ~8 @& s1 L3 I& C# ?4 A
=========
( t; h6 V  g0 N; @4 J' Z3 F, E8 H
" I" k! J/ R0 U  T! j6 G& e" LThis trick is similar to int41h/4fh Debugger installation check (code 05
7 P  _! n: W- z$ v, J* M. g&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. k( w* I3 z0 u6 e4 d3 Nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, f7 E4 X/ m2 _4 b: e8 O4 v# ^4 n% D
   push  0000004fh         ; function 4fh
& c* D4 D" r( G. T$ W   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 k+ R- S; f4 A6 e% v8 A                           ; low word specifies which service5 f4 ?- l/ E# T- a" [
                             (VWIN32_Int41Dispatch)
: H8 d0 w- Y/ _* a8 Y7 t' v   call  Kernel32!ORD_001  ; VxdCall
- m. M9 F) o( r. G6 B   cmp   ax, 0f386h        ; magic number returned by system debuggers) v6 r  m6 t9 C# i  H4 N# ^
   jz    SoftICE_detected
$ z0 V5 C# E3 A/ h) s5 X& G
3 s2 [% K5 K9 H3 a  G# s: [Here again, several ways to detect it:
- {& L" }6 L# q5 M0 x1 J7 v2 {3 f7 ^3 z4 R7 q
    BPINT 41 if ax==4f
* r. D+ s6 a- c' X+ @' F6 \+ l
$ h, i4 F# }  X/ Z; p    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
+ v  i  R0 P+ _# y! K; m! m# R2 P8 G9 S7 K
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: G" o# n2 {2 Y7 H3 H

4 g& f- T/ z" q! b6 W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# I+ I3 j! g! _7 ~) P3 Y* D( i
2 n% G0 J) M  o- a8 U/ c( Z
__________________________________________________________________________
9 ^5 j2 w5 l& z# `3 t6 d8 `; |
6 q; x) t7 A8 J. fMethod 136 D9 V: ]  |( L. Q
=========, W- ~1 I& I* S( d0 E7 T$ g- Z

7 [& k& H) `9 d$ `) C% n/ HNot a real method of detection, but a good way to know if SoftICE is  ?5 z" C, j! N/ A& U
installed on a computer and to locate its installation directory.+ O# V" C- Y6 e+ U4 f& p2 P5 S
It is used by few softs which access the following registry keys (usually #2) :/ E+ Y2 @. t  E

6 n) T% X0 K9 D! t0 T-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" A# y4 c7 V$ ?# h& ]( ]* ^6 b' O\Uninstall\SoftICE: q0 l' ~* R" Z: m# Z5 Y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ [: S; {/ y+ C4 V
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! t- Q6 k, e6 B( `$ d6 b
\App Paths\Loader32.Exe
# k) s: J4 u8 {. p) q2 {# s4 H; \' ^3 [6 h

. `' Z5 V" [* m2 r) pNote that some nasty apps could then erase all files from SoftICE directory5 a% C7 D: W8 `
(I faced that once :-(
6 H3 n; e; D! ~+ P7 n
+ l+ V' Z) p: S& A6 _" cUseful breakpoint to detect it:
+ M) O' _" z# v) V2 p
; Z/ e4 J2 t( u( ?3 e     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. j* q/ I6 C# \& N8 f

  w) b+ ^: C# Q/ x0 k5 P& V__________________________________________________________________________1 B' @" ^) {9 p4 d4 a

! u+ E# }/ G& t" L, J$ d. u: ~+ B- k: [  A( b
Method 14
$ Q6 b# \  b1 S( r=========
4 T& S! G8 r4 E8 R+ H% q' i
4 B8 f7 ]9 j( t' g/ @4 B, yA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 E8 [- J, ~+ t4 `
is to determines whether a debugger is running on your system (ring0 only).
# G7 X1 s9 T4 s. ^3 w. D9 [
- T* F; F% k0 K6 p! `   VMMCall Test_Debug_Installed
5 c* z5 C) @8 m$ g: R9 X   je      not_installed" B( C' \6 f: U) E" N
5 |. @0 t- w/ q: f) i5 V
This service just checks a flag.
4 U) X, |6 y/ r9 K! U3 n+ e</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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