About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) b1 }( C: W9 J% W3 G3 \+ K<TBODY>! ]$ B9 a+ B6 h! ?! A) Q
<TR>
- S0 O( \9 @  L( a<TD><PRE>Method 01
8 I0 p" I# N* \, W/ ~=========9 I6 Y% J4 y$ U5 q) `

2 O: q, q. X# J$ hThis method of detection of SoftICE (as well as the following one) is% `8 A% \! U/ S' M: s
used by the majority of packers/encryptors found on Internet.
8 V' d* y8 h( IIt seeks the signature of BoundsChecker in SoftICE6 y8 n8 T' ?8 ?; F7 P. ?9 [

( R' [: v- |$ ~, ?% ]    mov     ebp, 04243484Bh        ; 'BCHK'
' |/ n% w* o- l8 C    mov     ax, 04h9 ]' f# {* P, b; K1 d
    int     3      
, w+ k/ r! `  c: [2 i' ~$ w    cmp     al,4" I) S% w% }: F: R4 Q+ ~% N* B
    jnz     SoftICE_Detected
) p+ a, ^" ^" e+ r3 |  G% {5 g, b
! F. M+ C4 |( Q+ k" m" \___________________________________________________________________________' X+ A0 N$ `' [& O! Z8 G! s

% C) {+ f4 M9 L1 O, D% x* k: L* E- CMethod 02
5 V; r& l9 E1 }( D1 Q2 Z=========5 j2 z4 y/ C  r( O; ?/ {  ~

1 d5 y5 Z3 a2 ?5 x. R7 WStill a method very much used (perhaps the most frequent one).  It is used' }# A) `, Y; ?& W, ~( `# {) ?; \
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ H# r. n7 Z7 P8 n7 `5 g; Y0 u
or execute SoftICE commands...; R  ]2 w" Z2 y' ]
It is also used to crash SoftICE and to force it to execute any commands
8 Q! H- r; x, D" D8 p5 B+ a# R(HBOOT...) :-((  
7 J' M1 f) ]8 ^% ~7 T# G- \* g0 f9 {0 P; x" f$ H0 \
Here is a quick description:* j( t; D/ n- |. @' O- R
-AX = 0910h   (Display string in SIce windows)6 j/ w. f  u7 h  Q  d" h# V
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 l7 L8 }) n6 v. M
-AX = 0912h   (Get breakpoint infos); _; a, Y+ d4 k
-AX = 0913h   (Set Sice breakpoints)0 F8 A$ k- ?. e3 K& ^
-AX = 0914h   (Remove SIce breakoints)
  G: S' D8 [2 D
" S$ F' v7 J8 p/ j1 b% r' iEach time you'll meet this trick, you'll see:
. V9 t9 ?5 i1 H) i0 l$ i5 e7 n-SI = 4647h
% [& s8 ^/ ?" e( E1 z/ B-DI = 4A4Dh1 h+ x; W2 R! k7 [2 m& b
Which are the 'magic values' used by SoftIce.
4 i5 E. k! g% x) v" [5 OFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
2 t, j6 _, C9 G5 n$ C
3 c; L9 P9 O2 L5 x# p- q% l+ HHere is one example from the file "Haspinst.exe" which is the dongle HASP* b9 r5 p' y) s
Envelope utility use to protect DOS applications:
* z  y3 b- l. d& d( T( T
. y( V. i+ X% j2 X: H# e
# K. S% o, \  E* ~4C19:0095   MOV    AX,0911  ; execute command.7 U( Z, D) Y! I& I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% `0 x7 |& e1 b0 T
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 ]8 Z8 c' b, h- `; {; ^4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! o: q$ _2 A2 j. U: C% B
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# c9 e/ U' z- v1 K/ y1 T
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute& K2 o1 D$ V4 r4 e& r$ e4 o8 c: f! J
4C19:00A4   INC    CX1 {5 J& \; T- a4 y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
9 Z, P, X  z  h2 ^! k! X- o4C19:00A8   JB     0095     ; 6 different commands.
% O/ n; i: ^. K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 C; {' p- K/ U$ Q
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 q8 H5 ^4 Y; X9 }% w/ D* u8 B: [
The program will execute 6 different SIce commands located at ds:dx, which& C  w/ p' L: \; A
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ C  S$ X$ w: V6 b7 d8 S

8 Y( e+ V0 ]) f* s: i* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- y0 g& m- F" X+ K% P) k
___________________________________________________________________________
1 j8 L( D" X8 E1 _7 d! n. L5 K! X+ G
1 ^$ f2 {$ |( F( v* z8 ]1 ^( j* M
1 s* Z+ `! h7 @0 `0 ~1 |  @8 @Method 03; x0 d1 ^/ j9 ^% ?
=========
4 y+ V4 ]* ]1 _$ V/ ]" G) f5 ]
# p, T$ S/ ^. ^$ H8 s4 XLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: a, S3 A+ M6 ]- }* K7 z(API Get entry point)
, e3 W# w1 u+ ~, P        / T) K, J: {) d2 Z2 |+ r$ W0 r4 n
& A0 A" L& M, N/ l" B6 y
    xor     di,di
) [% X  {3 {7 A( \" F& Y1 I    mov     es,di
$ p/ R8 T) J( W" m9 ^, U4 f* I    mov     ax, 1684h      
: |. D* x$ z, B- v    mov     bx, 0202h       ; VxD ID of winice1 Z5 H' K$ y: z8 U. a
    int     2Fh
1 e  f! u# z$ g5 f    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ w" I4 H, k' k$ l0 g" g- O& c
    add     ax, di
3 }: U- @6 \& @7 x' I* o    test    ax,ax
9 f4 e' X- b% P% s3 N, ]/ w0 ]    jnz     SoftICE_Detected
+ A3 ^" p+ e9 c% f9 |6 D) x. \' v7 v
___________________________________________________________________________/ T3 J! J9 D2 l9 q. L3 ^
& s4 P; i, \: A4 m$ w. H
Method 04% z* y2 K& u3 i9 v
=========2 k3 f4 h( m- d8 O/ ?
! V" ^* j; q9 a  F5 {& R0 d
Method identical to the preceding one except that it seeks the ID of SoftICE
8 r/ E# J+ i+ D0 E+ SGFX VxD.
1 B, ?1 ~; u0 R/ m& O7 ^# {6 X: H" l+ J) g" B
    xor     di,di
/ p: D0 l) E$ e" M- f! z7 I    mov     es,di
) X+ A) l6 ^9 X! y, b4 y; w    mov     ax, 1684h       ! Y( h! b& ^. o; L; _9 f4 q9 l+ {
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% ]/ a; t1 j  w    int     2fh
$ S3 \( ^7 H4 @" g5 ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point: ?6 S" v/ h- J) U( f6 W
    add     ax, di4 f0 w! V, e, @4 n4 g' y" ]
    test    ax,ax
1 n, h9 k' Q$ I% e7 H/ ?    jnz     SoftICE_Detected: r5 s  a! D, g2 O' z

' B5 e$ S$ [& G$ G: x8 Z  v__________________________________________________________________________
3 N+ {3 ?: L& v, @: x$ T7 H$ s: F3 J4 A
; w/ q$ P2 B: z8 i' L/ X  w- H6 s6 o2 N, a/ K* M  n
Method 05
6 x- c  J; y: r- ^2 s7 X- L* K=========
! z6 @& [  a# l" @+ J- ~
4 |, ^0 E& P4 K1 @# U  x2 r$ NMethod seeking the 'magic number' 0F386h returned (in ax) by all system
1 o  G5 @6 V  u" r: xdebugger. It calls the int 41h, function 4Fh., g5 ~* W; o& A9 ^: i6 X$ W3 s
There are several alternatives.  
- P9 e% r9 N0 [% @
' s- M9 Z  i3 h' [0 rThe following one is the simplest:, f5 D' m3 J5 E( [6 ]

+ a6 P( t5 Q, ~1 ^, a    mov     ax,4fh
, m1 B7 X4 t, a0 d+ Z1 o    int     41h2 ]! ?1 d0 ^1 A0 h5 w( e9 T3 ~8 N
    cmp     ax, 0F386* h" s5 U/ k& |
    jz      SoftICE_detected% R% U0 _% [: d& D" _' d
; P; U( h/ R" X7 M$ q

% X+ y: T5 ]( KNext method as well as the following one are 2 examples from Stone's
8 b* _% {6 H1 q( T+ |2 N"stn-wid.zip" (www.cracking.net):
6 H  K- o; F: A# u: o
# n2 q5 j( n/ s1 a8 v  _    mov     bx, cs
0 h' j. b. ^  E4 N" X8 a2 ~$ K    lea     dx, int41handler2+ E( m' q0 T$ p/ a
    xchg    dx, es:[41h*4]5 x8 ?& C1 A, O: G! M
    xchg    bx, es:[41h*4+2]
1 i. @: }6 o& h' D/ [. q0 g% x    mov     ax,4fh
. Q& J6 T2 P: A8 M( j    int     41h
0 ]4 p! G- ^% Q    xchg    dx, es:[41h*4]
! X# K4 h3 h" E    xchg    bx, es:[41h*4+2]
$ J# q) K8 N# Y    cmp     ax, 0f386h
8 x0 ]$ d4 g& T+ v- L8 w6 d    jz      SoftICE_detected
: A, y. ?; j& v7 P' G5 J9 c& l: _! \1 `
int41handler2 PROC
! f5 L9 d' V5 x3 [! t7 Y5 ]  f    iret
2 m6 ^+ ?! W. O0 Y9 ?* }int41handler2 ENDP* C) F9 u2 A: G2 `
" X" ?6 `  N7 h" g/ u* F5 ~6 ?9 s

$ H# {& K1 M  ]_________________________________________________________________________9 T7 H( Y! j) R# m  S

8 @/ v# y3 |! g! V1 m
3 a& L/ s) }, m, yMethod 06
! i" }, s- t, ?$ u4 V: z=========8 @9 _; y2 W* y, K& L! \. f! H; ~
! P/ i* v+ A( _5 _4 N2 D) F
8 R2 h( j1 g( C( t% q( t
2nd method similar to the preceding one but more difficult to detect:. V3 e: E9 m- U. k" f/ }2 ~
. u% w4 ^: u3 P$ ?% f8 f6 \+ P
, e7 ^: _6 N$ c( O( `
int41handler PROC- _0 ?( X9 A* Z) ^  t; b8 Z
    mov     cl,al- G  l5 z/ K7 f) e  a& @
    iret) D5 I% o% P3 t) _2 j: z8 m
int41handler ENDP
% }6 z6 w* ?) W' [9 H- u! ~- ?* O" K3 i- e# V- r8 u

/ B# x* X  r6 @/ l    xor     ax,ax
4 M3 o4 k5 {. J3 _    mov     es,ax% f4 l) C7 X- u- w- P
    mov     bx, cs0 V2 \* f& _" d7 V3 u
    lea     dx, int41handler
5 I6 B* v5 l( D' G' ]    xchg    dx, es:[41h*4]
* C' D; O4 b  t; m' v    xchg    bx, es:[41h*4+2]
/ z) `4 \6 E  v( Y; V* t    in      al, 40h2 U- u* U! @: F+ r
    xor     cx,cx6 b3 R3 O; T* F9 f9 x- {  L9 ]. V
    int     41h
* `% z. Q- [5 z* G3 `" O6 w    xchg    dx, es:[41h*4]
# M7 h. c: H2 M2 n. Y/ D/ `    xchg    bx, es:[41h*4+2]
  T9 p2 q3 a: }  V    cmp     cl,al+ Z% l0 ]9 C7 g& G: G& ~5 @
    jnz     SoftICE_detected+ |" p% ~$ |+ W- A# g
9 D# h9 _5 P/ ]# ?) ]8 }  w3 q
_________________________________________________________________________
3 U+ A8 a+ I# i0 t) z0 m) o- r* C" t' L" y: [9 m" J$ @) }
Method 07% n. H- u. \' M0 A2 P  v4 v
=========$ f7 r% B$ F/ d7 N7 o

% ?! J* e6 b* {: x: SMethod of detection of the WinICE handler in the int68h (V86)! s( l# [1 T! K

! G% H/ S3 b8 y    mov     ah,43h
, \9 b! r; ^$ O$ M    int     68h( W- ^3 T. _3 [
    cmp     ax,0F386h/ t8 z& N8 d, R" p+ h
    jz      SoftICE_Detected9 q- r; C/ H# f. ]( f% F& Y

, F& @/ d; E$ |5 H3 V: S" `8 a0 y! {3 v9 S' `$ I: G' Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: Z% U* E0 s7 N7 J3 T
   app like this:
. ]5 t' ]9 l7 K3 I9 y0 P5 {$ J7 r) ?$ V7 I  @
   BPX exec_int if ax==68
9 ?0 ~6 R8 L+ [/ ?; X- f   (function called is located at byte ptr [ebp+1Dh] and client eip is% X4 m+ ?  [9 d0 C3 t
   located at [ebp+48h] for 32Bit apps)
' G' y$ r" w  b& T__________________________________________________________________________
9 d2 d' ^7 O5 J4 W7 G; R/ h8 Y" M* j  {9 O. R2 f

0 q5 }7 n) A) o1 c" g3 TMethod 08
( V) F: f  w# c1 H& n" n8 ^' A=========
( B& ]( I; x% m0 o1 M/ ]7 @0 K; o  O; X  X2 g
It is not a method of detection of SoftICE but a possibility to crash the% ~0 e# Y( S* }* }  D7 i" B
system by intercepting int 01h and int 03h and redirecting them to another4 T) S8 u+ [( {4 x4 T
routine.. r. I; Q$ ?; R- e
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  w3 q" _3 y1 w) }5 U& X8 m. \) Ito the new routine to execute (hangs computer...)# d. |  {/ b7 e! U/ A

% J$ ^! C( t) P- r8 i2 h    mov     ah, 25h
" p+ [0 R$ Z9 V9 }    mov     al, Int_Number (01h or 03h)
- O# U* \0 v( {2 G    mov     dx, offset New_Int_Routine9 [2 j; w2 ~$ I
    int     21h( S; L) G3 f1 G. `2 J' m2 F
$ b/ L1 F5 l5 X1 ~7 p& }
__________________________________________________________________________9 k; \3 V9 f% w$ F- L
9 f# @  v6 m9 y# G" j/ T
Method 09
( s0 x4 @2 T; p, p=========
) \  I, x6 h/ u3 V" w# l. {# {; G# N: i, c
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, q1 X: m; Y5 {performed in ring0 (VxD or a ring3 app using the VxdCall).9 s4 [# l8 e) a
The Get_DDB service is used to determine whether or not a VxD is installed- B# ~8 e2 e8 f$ ?
for the specified device and returns a Device Description Block (in ecx) for
) C5 [" e2 \/ s9 _. ^" ethat device if it is installed.
0 {0 _, z; G" n! G  ]2 e
1 @3 N  m4 o6 _2 l! x   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 G$ @/ x) \6 D6 B: y! h( _% f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( \) w6 ]2 c3 P0 K, }   VMMCall Get_DDB
0 v7 Z  b- I) ~& l5 h8 @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
0 K2 u$ H6 v, R, a1 `; x1 L; W2 _/ {8 t) u: [' y
Note as well that you can easily detect this method with SoftICE:
9 O( U: p6 X7 D9 _6 Z9 H! P   bpx Get_DDB if ax==0202 || ax==7a5fh1 s8 P2 ^5 `. G% G$ h
9 t8 {# \5 W7 h# Z1 d3 |# \; P
__________________________________________________________________________0 k7 U* }& f" x! e, w8 }

# H# m( o* A  M, i5 x8 W0 mMethod 10
  U3 ^" b5 V. B4 B& S0 X0 A* N=========
1 M* J+ ?* N9 ^/ }. H: m
3 f7 H6 F8 c, x; J" y0 h=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# Q) {# e+ ]' ?. b5 S
  SoftICE while the option is enable!!+ P1 z6 e# U' R* L+ {
9 H" a' Y# {6 `, ?6 w: S0 @; _3 q
This trick is very efficient:; e2 X- N  J- ^: M% m
by checking the Debug Registers, you can detect if SoftICE is loaded
7 b9 x5 F! T' e+ `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# y% s, Z+ K3 ^3 R& Y& o  Dthere are some memory breakpoints set (dr0 to dr3) simply by reading their
. @: f7 G4 e* d1 D  y  p& \value (in ring0 only). Values can be manipulated and or changed as well
% i5 V# c  {7 H' o& i* H(clearing BPMs for instance)1 U: D, V  E, I, Z1 r, ~' b% p
/ T$ V* i8 g4 o3 A1 h* w! w2 A
__________________________________________________________________________
& N1 |) V9 b# c, a: Z5 V, p4 I0 ?+ d& v8 V2 d7 p' V7 W% b
Method 11
% ]( c  r, j. \( v* @2 t8 I=========) J1 B6 K9 x: L% M5 [5 z; Q8 R( _/ `

4 V+ Y8 ^& @1 c! E9 S! d( J8 _# v4 Q6 oThis method is most known as 'MeltICE' because it has been freely distributed
! Z7 ^  B! D( j7 o0 Avia www.winfiles.com. However it was first used by NuMega people to allow9 a* Z$ K2 v' L% i; S
Symbol Loader to check if SoftICE was active or not (the code is located
( |2 s% u" G# E( w) a7 winside nmtrans.dll).0 ^7 \- j  A' U% ?2 V& I1 A

, u6 d  {( e- _. o: |The way it works is very simple:
. N9 P2 g2 W! k+ o; C& [; xIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 _+ h1 E' T; {: ^# p" K. s1 B  c: x# KWinNT) with the CreateFileA API.
% O" ]. ^4 L9 o. p/ c$ E' L
8 _! d7 t: f1 x+ C8 XHere is a sample (checking for 'SICE'):& M# r. D: |  W, h
/ |& t$ o0 X3 O
BOOL IsSoftIce95Loaded(): q$ _9 P, C# m8 c6 E3 ~0 p& R
{
0 [& W1 e; ^+ w0 Y% ]- e5 {' v) C   HANDLE hFile;  % D: S3 @$ U( x/ {1 x2 ~8 S) C+ O
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
9 ^5 C: Y, b1 {, J2 C- r                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 c; [+ H' N9 D6 ^1 t0 |. t
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' y5 `; W+ K8 P6 \   if( hFile != INVALID_HANDLE_VALUE )
  y( p- ~# i( c5 N. |/ {   {. O- |/ e8 }) a0 @" ?. B8 }% {
      CloseHandle(hFile);
9 [- B# M, R- V      return TRUE;3 J) l+ X& H& M8 k* W  Z6 F" g
   }
+ c# P! `6 F$ `4 r- F) X" `   return FALSE;
/ h2 K: `: }3 f, u+ X. M}5 O) v# B5 E/ g! l; M6 l8 [  B

1 D3 A! G- y7 k0 B' X& p$ Z8 GAlthough this trick calls the CreateFileA function, don't even expect to be
( P. L  H: `9 k$ jable to intercept it by installing a IFS hook: it will not work, no way!4 @  O- {7 T( x' |
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 r' Y3 E# n" {2 L+ Z, `; B& mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 C8 Y$ ~9 t' \+ a7 B* h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc, l* W! z" x+ o: k( f5 }
field.& B, m' Q( o2 [: m+ o
In fact, its purpose is not to load/unload VxDs but only to send a 9 y* z: P( Q" p) ~
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: H) p  i/ p9 c* [* Bto the VxD Control_Dispatch proc (how the hell a shareware soft could try) C, d9 d, D( M
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
* z; e, @% }; m$ u5 g* SIf the VxD is loaded, it will always clear eax and the Carry flag to allow
; Y  V, ?7 L% J1 M. Dits handle to be opened and then, will be detected.
- L$ N" T; Z" |! yYou can check that simply by hooking Winice.exe control proc entry point1 J+ l8 S. Z0 E: z7 I
while running MeltICE.  _" q+ e# `" r5 g

! @) ~) |5 Q% P) Y. Y# W( V5 [3 T) d1 h
  00401067:  push      00402025    ; \\.\SICE
( `; H7 j2 d( Y3 I6 m8 c  0040106C:  call      CreateFileA
( t, A& g" S, C" L" [/ e# N  00401071:  cmp       eax,-001
+ A5 x: }- V* {6 w' E  00401074:  je        00401091: p% W3 V* E# y$ a) F( @% |$ R
5 u0 A4 ^( S; z( ^! X; K; ~0 T4 X

0 X3 L2 ?4 \" i. XThere could be hundreds of BPX you could use to detect this trick.
0 ~8 @0 y& @) A; U6 F-The most classical one is:" d/ v# h' i$ W5 d! ?) Z
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* b. V& k+ _; h' ^; C  G" k    *(esp-&gt;4+4)=='NTIC', j& V0 q, r# w1 F5 D

# ]$ I2 z0 |( B; X; g, V* \-The most exotic ones (could be very slooooow :-(
& |) @1 ~5 r/ G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 ]( U1 J% m7 w1 ^
     ;will break 3 times :-(
# k; m2 m1 [6 s+ O: D5 o
* ?% H" k/ B4 K-or (a bit) faster:
9 E# c- m9 y5 E+ E' ~, z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
: _4 e* {: J/ y5 ~& S& y/ i% `5 [: F. @  k# s
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! ?" S- G  M6 ?. T4 o) z
     ;will break 3 times :-() L+ k9 ?! q! }  H: k8 V

8 ]2 j" S/ U, Y$ x' G-Much faster:
- P9 M9 ^( w( l/ G. D- |0 U   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! j9 Q6 W1 l# x$ j* w4 h) i% D

  b5 U; x6 U) q. mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 l: t, X4 ~. n9 H6 o7 z
function to do the same job:0 e# R6 W" B' D; [
4 [( a% W6 U% N5 t) k2 W
   push    00                        ; OF_READ
1 M! h3 p) H( X* s! m2 {+ V   mov     eax,[00656634]            ; '\\.\SICE',0
# }! }& M" _# A, D5 _/ G   push    eax
0 ]# j6 Z, I6 Z' x/ `   call    KERNEL32!_lopen4 A* p' Q0 H) e7 i8 n  Z  m
   inc     eax
- F- f1 d1 m- [7 i/ t  R   jnz     00650589                  ; detected
7 Y/ `9 g8 G/ k, k# e2 ^   push    00                        ; OF_READ
. y- l: `1 a6 k9 o8 `   mov     eax,[00656638]            ; '\\.\SICE'9 J- ^- X  I5 G* u/ o$ f% V" _
   push    eax
/ n. k) q% Y. R5 H   call    KERNEL32!_lopen
. r  i' Y9 I1 N! p; E   inc     eax9 u9 E- x/ d% K- D" b9 r
   jz      006505ae                  ; not detected; V* V. f5 f/ C0 q! \4 m

. C# @+ d& H) j) Y; e1 W: ]7 T
; b7 u* `# E7 [& A: m4 P__________________________________________________________________________
4 B' D2 r( |( r3 X' @1 i- d1 r: W) T- D
Method 12
/ \% a7 Y  X+ F/ X3 C8 X2 ]9 Q=========  u' T* v" q9 V6 i/ L6 e
9 F  H. z1 I2 M( v8 L2 K
This trick is similar to int41h/4fh Debugger installation check (code 05' o. X  x/ B* c, i( \
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% ]& V; l, b# v$ ]+ G+ Eas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
2 F3 R; F6 C3 Y8 s5 H# L0 h  N. B% |! Y8 ?9 T: E
   push  0000004fh         ; function 4fh5 A5 z. F% o; ]5 J" r
   push  002a002ah         ; high word specifies which VxD (VWIN32)& H" A# }" [; G% t# M+ c. L/ `
                           ; low word specifies which service
7 _: x9 ]5 f# R  K& E' ?4 c7 l( I                             (VWIN32_Int41Dispatch). L- h8 }  v5 l( k- {. H& D: ^4 T4 S
   call  Kernel32!ORD_001  ; VxdCall
3 s) F$ z" e. r) m% p0 e$ H   cmp   ax, 0f386h        ; magic number returned by system debuggers- e% r* h: v: B& t( ], ?" s
   jz    SoftICE_detected* u5 ]8 l  p7 `: n5 }$ R

) y) o% E+ t2 H( I* A. F; O1 cHere again, several ways to detect it:6 m% J$ z# f5 Q# g3 @) M

- g4 O2 `9 T3 a    BPINT 41 if ax==4f
' q' |+ ]3 Q8 q6 f" G  I: E
$ Z) g* ~- r* I& O    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 O+ w7 E) z* R+ t# M( s
: V" ?4 r" w- m! {* Z! h4 w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- j- C; O. U, N9 l5 e% D5 C1 ~7 S, Y/ f! e, |# u5 Y+ ~
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!$ h6 i8 c! i# ]. A( s% b5 V  K1 r
3 L: y& }! P0 s/ T: O& k
__________________________________________________________________________- i8 n2 v5 W: B2 Y0 `3 L6 W

/ @1 k7 _) y) [; QMethod 13
5 F, U7 x; R& y* B* p1 v=========
' _. W0 X' B! F# F7 D* E$ ^  L; B5 {+ ]9 l4 X6 s
Not a real method of detection, but a good way to know if SoftICE is
% ]* t+ B) _; Q, ainstalled on a computer and to locate its installation directory.7 E. g" T: E  H/ U
It is used by few softs which access the following registry keys (usually #2) :
" O" s: r# m, i2 f. q2 W, j
" k( x6 B7 c! k-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" A, Q( ?4 c: a0 g\Uninstall\SoftICE8 z! b( B9 U3 W' A
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# l: F: m" @4 u: a$ l+ t2 W
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& j6 U, T* I1 @& ~# Y
\App Paths\Loader32.Exe
  W/ ?( t9 v7 Y- S, }$ K
3 ~. M. J2 [' C# h4 i) K' z) Q( A. T( t6 y) [, y4 E( r$ O. O1 g
Note that some nasty apps could then erase all files from SoftICE directory
- I/ b! y) ~2 K6 L(I faced that once :-(
- G: F5 P- @) e$ E
) I* q4 f1 ?" f" ZUseful breakpoint to detect it:
1 Y8 L" i6 W* Z1 Q- K$ z' u4 l; F; L1 \  J% w. v2 R
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 L' K! A5 `& S6 e# E! q! F  O2 e2 w) i# U8 m. N$ M
__________________________________________________________________________
- W; Z8 I, U  ?) u( M6 |3 E$ k: h$ i3 Y
& q* r& _; Y. B7 P, `9 m
Method 14 & y% t; i2 L. w  w
=========
8 S. ^: D# G: w$ ~: d" N9 m, ~7 b( K' Y( P& s. t# ~; ]! H7 J
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; k% I1 Y9 p* qis to determines whether a debugger is running on your system (ring0 only).; o. X/ n" \7 {7 D/ i& ^& u6 a" Y
, [+ A* `8 O3 Z% z& r4 V
   VMMCall Test_Debug_Installed& i, s. r3 U% \! i' p$ |
   je      not_installed
" T7 m4 W( \; x- e8 u9 Y% S( p
3 y( a0 b0 P* }* S0 v2 v" i1 AThis service just checks a flag.2 ?/ [- ~6 |: r8 D; b8 M* w& t) o
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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