About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 O, D$ R/ x" P' M' E* w<TBODY>
4 s3 M4 `* j) y" @5 ^; k<TR>6 |, q/ [9 l9 J6 Y* d$ [9 T0 C; Q
<TD><PRE>Method 01 3 ?$ _* g" X2 S
=========
9 {8 ~5 H  m5 P: Z
" o: d7 d0 }* d5 y% A" i1 uThis method of detection of SoftICE (as well as the following one) is
) C- Q* R3 b2 kused by the majority of packers/encryptors found on Internet.' P& E5 A4 N& z6 G' }" j, E
It seeks the signature of BoundsChecker in SoftICE
; j. C5 M7 d8 Q* f' p
9 B' h6 \9 D9 g1 }' Q1 K# T; a    mov     ebp, 04243484Bh        ; 'BCHK'# A9 w* @4 E8 p% [
    mov     ax, 04h
; U8 w9 B* n7 Z7 L6 M( v    int     3       6 `5 V# K& c, i
    cmp     al,4
$ g$ Z6 y6 O! p2 q! g0 t    jnz     SoftICE_Detected
" R2 E# t4 t' _) A  g8 [& r$ j( z, c% h" Q6 G6 E" Q
___________________________________________________________________________
! H8 O; E  v  c6 j5 \* F* L
) n. N/ D+ j, X" R* ?( zMethod 02  Q. Z% I/ y; J" {3 T. ?9 D
=========
9 k6 \& E/ S3 C! W$ n
! P- m* c' C+ H; D8 q- X+ d5 QStill a method very much used (perhaps the most frequent one).  It is used
- i2 Q2 \( g) B0 C5 L9 F9 r- mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 p+ v$ E9 N! {, U4 Uor execute SoftICE commands...
! p. S- K8 j, w, j. [It is also used to crash SoftICE and to force it to execute any commands
' Z, G. \8 b8 A8 J(HBOOT...) :-((  
2 m  D7 G# [  a- j4 P% J* L0 w
7 I: j  B% G) K' T5 g/ Y% ]8 G/ fHere is a quick description:
( j3 E  t6 r: I# N$ v) u# [$ H, M6 h# X-AX = 0910h   (Display string in SIce windows)
  W- s% z  u. ?. O3 L  ]-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
$ u0 p3 ^  h5 |2 v-AX = 0912h   (Get breakpoint infos)0 H+ j: {; m" Q. L9 l# D
-AX = 0913h   (Set Sice breakpoints)
( s! \( b; L' M: `8 @-AX = 0914h   (Remove SIce breakoints)0 O3 E3 d7 B  Q+ [, y4 U
! K# R2 p) Y* T* a4 t7 `
Each time you'll meet this trick, you'll see:
& L' g* R! X, r# j/ u. u' Q/ j-SI = 4647h
9 ~1 _( ^; t+ x-DI = 4A4Dh
" w6 z0 R7 i8 f, OWhich are the 'magic values' used by SoftIce.
( b" C+ R" \) U  PFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.8 W" d" e# G; z: `
! P$ F5 B# m7 o6 C$ O
Here is one example from the file "Haspinst.exe" which is the dongle HASP
% Z8 X3 z3 q3 xEnvelope utility use to protect DOS applications:
" V9 R+ {# `6 O: d& i% K$ ?. _2 z* u6 m- r6 w' I

# j. ]! O. t' ~3 {4 d4 n  x. K4C19:0095   MOV    AX,0911  ; execute command.
( o, Z8 c: p* F* H; x+ R4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  ?: u; H8 a0 X, ~
4C19:009A   MOV    SI,4647  ; 1st magic value.+ `5 P5 w3 g6 r: i7 J8 ?
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 j& Z3 v4 f! i0 Y" E: ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
* I" u: Q5 ^( [4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" w' L( r7 I: N
4C19:00A4   INC    CX
% q! X3 I7 [& v8 s! k4 C4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 M- u! ?! W( c. Z4C19:00A8   JB     0095     ; 6 different commands./ Z! w9 _2 w) f# e3 L, T  j+ f
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 {& y- K% y' X# v2 H2 m, S4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ b9 k/ H6 E( [/ x. a
6 h8 i9 g' p2 F/ H; I+ j  r; r
The program will execute 6 different SIce commands located at ds:dx, which
  S/ l; [" w4 s+ Kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 f5 C/ {: U9 l4 I" I. {, e1 f/ b1 z; D5 E/ ~8 g1 P7 q: B
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 v" }9 M4 P. _/ y; j' L
___________________________________________________________________________
" u# Z. ?! `, a  r) q
6 g* D* x. K  f6 V& k. o+ L; R; F" V' U
Method 031 p( \0 K: f- H4 J; L1 n0 m9 A
=========6 d3 ?# B$ @2 Q3 ?' H5 Q

% h( q0 s3 V+ s! C# t0 k* y7 ]# m% PLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 f  t. O: ~0 `& Q3 {( Z/ H) b
(API Get entry point)
4 A0 }9 v& f0 k- m+ n        
! }& ?* O% U$ b) e. i
: S; `. k1 {" d    xor     di,di* K$ _4 T- ?& o. J& F
    mov     es,di- C. o6 z& C( C  F; H
    mov     ax, 1684h      
. e) {& S, e1 E* h. ?0 w+ b    mov     bx, 0202h       ; VxD ID of winice; p5 `" K" U+ }
    int     2Fh4 X) Q+ p- }- t
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 w( V- g3 t) a" W& [1 j' b
    add     ax, di& U3 Q8 w$ I8 ~* H6 v# W+ D. c% z
    test    ax,ax9 z, @: D/ S% l  O
    jnz     SoftICE_Detected
" B6 |2 x- h# I- X" e- k; D5 S1 S, o9 I! y8 O
___________________________________________________________________________
$ l+ o& g' e2 {0 {4 |& R
1 n! a  B+ t6 _( A( OMethod 048 _6 m3 ^) O* f& c0 K! t
=========) L  i7 i  x( H/ {7 _* k
' B% X/ H1 {; R( l. B( F  c
Method identical to the preceding one except that it seeks the ID of SoftICE
" u4 @* R, J8 S6 G. f& eGFX VxD.
5 ^* N# {* _/ H) A
8 D; D! Y! G+ L9 r    xor     di,di
" V0 E. Q/ O% A, I1 s0 [$ \3 G    mov     es,di
! V; Q7 L2 k: a+ [+ Y    mov     ax, 1684h      
" n7 F7 B% \" |    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 h2 V" M' W# ^
    int     2fh
. O7 S% q  f3 {    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( D- F" ]; e: F- S9 f    add     ax, di+ k$ h( W; F9 O" Q: f
    test    ax,ax; F+ |. _- K4 l& D8 w
    jnz     SoftICE_Detected
! q# e  }+ r+ ?2 ~7 }; {) G' \
0 `' i- P  f( f* \6 ^& P! f__________________________________________________________________________# I( d: K4 W$ I. N5 s/ q

9 e  {* t0 k8 w+ x. L0 p, h; @
! t5 I& l# L, `! Y+ k3 X) XMethod 05
9 \9 B; B& s. ^3 N# w=========
9 c9 ]$ R" l5 S8 T0 A: o2 c1 F8 q: ~0 Z: Z! j, J5 N: j
Method seeking the 'magic number' 0F386h returned (in ax) by all system) T2 s* Q; }- h" `, D, g' a
debugger. It calls the int 41h, function 4Fh.
( h, T" n7 D% o0 cThere are several alternatives.  ! g% q( r! r6 m1 [' @
1 i1 e/ t/ O! ^5 x! U8 X6 R" |- T
The following one is the simplest:
/ T" T% F8 L, _: v& q
" ]9 r5 o$ Q8 Z- @; C* {2 Q    mov     ax,4fh
: a4 J3 ?$ P+ Q( l    int     41h  a  u# H0 X# |( x
    cmp     ax, 0F386. w- Q5 p5 J6 F7 K( [" Y8 ?4 S
    jz      SoftICE_detected& N) S, @. X$ h, \. _

; F9 P+ Z& |) ], B4 \+ _( |) h
7 O% O& P9 R8 t5 G. R0 jNext method as well as the following one are 2 examples from Stone's
9 {( b+ a& K) k" Y6 e"stn-wid.zip" (www.cracking.net):
8 _$ E8 l6 r7 ~* R
6 x, |: q$ I8 z6 C3 ]* v    mov     bx, cs8 D/ g0 t3 ^! s; }( Z
    lea     dx, int41handler28 H+ T& Q+ g$ I) h# n3 M
    xchg    dx, es:[41h*4]# r9 C6 r4 z; Y
    xchg    bx, es:[41h*4+2]
; |' y) x: U! g4 k9 {9 X    mov     ax,4fh
( y2 @( n" i' M2 }  _% a  H5 G& _    int     41h
& d) ~' H" D% V; n2 ?- m    xchg    dx, es:[41h*4]
! n7 x$ c4 H& Q( Q1 Y    xchg    bx, es:[41h*4+2]6 X) R& R4 l$ B3 I: u4 W( z
    cmp     ax, 0f386h
$ H  M! y# u$ S  t; n/ a    jz      SoftICE_detected% X4 G; u- O) q

7 J. D/ p" J+ |0 w/ R5 Iint41handler2 PROC
  R6 _# w" x! V6 q. H' g5 e; Y" T8 l    iret
) }- `! k% [% ^; _4 b/ x/ pint41handler2 ENDP
/ Q4 K2 a5 q) y
  {' ~( D9 D8 e) a7 {0 r" E
1 M9 v/ @+ S3 P; z; c" @# n3 j_________________________________________________________________________4 o+ E9 Y3 E  w) v) b, C# X

8 W9 u# W/ |9 ~, e/ i. N4 E$ D; K; M5 u+ L5 Y
Method 06* |, U9 w1 j& {7 b: a9 W! T
=========. J3 C* j6 U; {) r

$ S: j5 B8 @7 s  u1 P* h. l4 X7 w; G5 z! }- Y
2nd method similar to the preceding one but more difficult to detect:
' E2 A; `: z2 x; ?7 [! A+ `2 d& M2 Y7 q( N5 h5 H% @! M5 F
  n+ o3 _% C1 H6 V
int41handler PROC
6 ~+ t& z' W: v& z! u  G4 s1 Q7 z    mov     cl,al( Y( C; D/ u- `
    iret7 N" e) Y8 P9 [' u5 F3 J( F' X3 u; g
int41handler ENDP
5 h# `& h" {/ \. _1 z) [3 S" l% {: M0 q( o2 B: ~. g7 w; N9 ~# W
  P' a2 ^0 \" o3 |" I5 l
    xor     ax,ax1 t8 k" K1 ?6 B
    mov     es,ax
' C" Z6 [. j( a% o3 P    mov     bx, cs- Z( r& R9 a/ W7 W6 h
    lea     dx, int41handler! R, F4 S1 h; b% _5 N/ q" n+ O2 G( g
    xchg    dx, es:[41h*4]! U. ?( M0 h7 e4 S! c
    xchg    bx, es:[41h*4+2]5 I: C1 q) ]: c1 I$ d& L
    in      al, 40h
' G# ?! a3 F, |! h. R; [; @; q- G    xor     cx,cx% k8 ^3 L0 v) L0 Z5 I/ z* v! |2 r
    int     41h9 R1 o4 O4 w- i# _- ]* m
    xchg    dx, es:[41h*4]
2 ^+ N8 V0 I) }& |; ?- o    xchg    bx, es:[41h*4+2]$ D) ^$ n! B* g' s) _
    cmp     cl,al/ E" f" I! n- T  H
    jnz     SoftICE_detected* N- Q) R5 Y' H. N3 s& W) K3 G

( W" \4 Z# X5 A4 p" o8 |8 G( x% q_________________________________________________________________________! l. @3 X  L0 X1 U3 ^4 X( s
! s$ x# S8 u' p6 u: _7 g
Method 07" K" f/ q8 o: G  B8 c- _
=========2 Z  D2 K  R2 B5 H# }/ B1 w; Y
9 s* l6 ^% M& W  t4 p$ \9 Z
Method of detection of the WinICE handler in the int68h (V86)! [9 @5 Z' b9 h3 r

" z9 r* b& W: [4 Y    mov     ah,43h
2 S" H5 r, T, N0 Y( D5 s" Q  J    int     68h7 d* Y' d" Q! e* U
    cmp     ax,0F386h
0 }: S2 a2 W2 m% C( |    jz      SoftICE_Detected
2 T9 c) b- h* X5 X% {" p/ I- a

$ S0 O+ r; N# t& Z6 A/ f=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 W: g6 u4 f1 g3 }" j7 ~
   app like this:
; Z& L2 @) G& p2 ?
7 @& n' n9 {+ Y/ Q! c: m   BPX exec_int if ax==68& g  Z* r0 N5 ^
   (function called is located at byte ptr [ebp+1Dh] and client eip is( N6 K* J$ f5 T
   located at [ebp+48h] for 32Bit apps)
9 ]' j  r( M  f( X% ?* P__________________________________________________________________________
0 I8 x% i% q8 |9 ^' w9 s0 k- L  o4 z, Z6 ?1 D0 R

# l, N' U7 i" S1 g; w9 \$ M' u7 _/ BMethod 08
' X+ R* g  c- w4 t- c=========+ {+ Y( K* d# `0 {

  \& s# o0 o7 `6 u6 ]/ i3 iIt is not a method of detection of SoftICE but a possibility to crash the
6 M* B) ?1 ^$ M% d9 i) Gsystem by intercepting int 01h and int 03h and redirecting them to another
4 P9 e1 c; E. V4 y' r5 W& Qroutine.2 \# B' w" ]( E' o& U4 g& I* r. W4 e
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( J% e4 o1 z9 B' Z7 }# L  Z0 s
to the new routine to execute (hangs computer...)8 G/ c% \) h7 ?) h: k* U7 k

& P* N) d) z" ^4 J, E    mov     ah, 25h! H# \0 O- D7 c8 f% \4 [' a2 a
    mov     al, Int_Number (01h or 03h)
: j, ]! V- Y2 ~$ r. t; l2 k7 A" ]2 _" l    mov     dx, offset New_Int_Routine2 ]" u$ r' l6 Y' O& m4 [3 x
    int     21h
: a: \' a. T: C2 i' y; l" Y* z# r3 X- u8 H4 a3 L: O. s
__________________________________________________________________________
- K# l) E& A# K9 O. m
* z: @1 \4 T/ {' t  w! |Method 09
& `- A6 A; a) }& P3 T=========$ z. [% k6 a, [' M
% a& Z  M1 ?) g$ ?0 o( `; r2 r, J7 }
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
. h1 g: j& H# v( {9 pperformed in ring0 (VxD or a ring3 app using the VxdCall).
' z1 _. O0 p* @The Get_DDB service is used to determine whether or not a VxD is installed
4 }& l" Z1 w$ E$ ^4 tfor the specified device and returns a Device Description Block (in ecx) for
" `7 z6 b& P% [8 Z" Othat device if it is installed.2 c3 a( P( M8 A9 p& I7 Y: Y

9 ?" _% q) ?1 I" X6 v# Z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) I. w3 F2 R2 B
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& M7 g: @2 Z5 x   VMMCall Get_DDB
0 D4 C. l& P* @) s   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- ^* |0 b" ~  `
3 P: M5 g; E% ]* I/ U% `Note as well that you can easily detect this method with SoftICE:9 i, q5 Q1 X7 L) V2 J! f
   bpx Get_DDB if ax==0202 || ax==7a5fh% g9 m7 m- S/ A- @# K% O' w& G

+ l1 t& K. H' m6 C6 W__________________________________________________________________________
0 E- ^8 h# F; |, @
; F! _: {* a2 j' N6 z5 z# LMethod 10+ l2 v' _8 g0 u& M
=========
0 n- Y4 _! P; W6 g. q0 F0 f8 V
* [0 @. j# O5 ~: T* v5 o) b=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 x7 c7 d0 c* q% |7 l$ b$ N
  SoftICE while the option is enable!!6 _4 m. z' O- C" O$ c7 S
; N! l- @  O2 ?6 b) b6 ?/ x* A
This trick is very efficient:
5 N) Q7 [* P( ~' z7 h, I  [by checking the Debug Registers, you can detect if SoftICE is loaded2 U+ t3 t, T& A. M3 R
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 ^: k& d/ \. I- ?
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 J5 M/ m7 X. `) e6 \value (in ring0 only). Values can be manipulated and or changed as well
  h- n9 e) O" q- v4 N(clearing BPMs for instance)
1 O' u8 ]( n( r  }* N. b! @2 \" \% Z6 [& L6 D5 L
__________________________________________________________________________$ Q: P) \; h/ C( c8 t  k
( S; C' r/ c9 {* O2 ^
Method 111 F4 n8 y/ |0 X. W6 W" B& i
=========, {! ^& x& m1 u# M! r3 S1 E
) o) j. v1 c/ P2 C# x: P
This method is most known as 'MeltICE' because it has been freely distributed
0 P0 [; ?) Z# X/ k9 g% ^2 yvia www.winfiles.com. However it was first used by NuMega people to allow
5 ^$ T" R  X- @) ZSymbol Loader to check if SoftICE was active or not (the code is located
! c3 Y9 _4 Z& k7 |8 pinside nmtrans.dll).0 W! M* V6 Z' M$ T3 X8 H$ F
- g0 F" s0 O, E
The way it works is very simple:
) P8 y2 p8 u9 p2 c: NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
' U& n6 l/ J/ t9 dWinNT) with the CreateFileA API.1 y: W6 c! G9 i2 a# a
' V% ~! e* T/ _2 l6 k
Here is a sample (checking for 'SICE'):8 e8 l4 K& Z; }* U
1 d3 ]' J% s; ~, c9 }( [- \1 @( [
BOOL IsSoftIce95Loaded()
$ b& U( @+ i. u" i$ q9 O5 W+ j9 A{" c- K$ q7 d1 B3 u% h; N% c! j
   HANDLE hFile;  
( Q6 E5 b; p, S# E- b   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,6 t# O% Q8 u  T1 `; f% G; J1 b
                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 X9 Q9 Z% j$ C% a; O0 Y( T
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 m$ J2 j: D+ H4 t8 A' }5 A   if( hFile != INVALID_HANDLE_VALUE )1 t# `! q0 R1 v" L9 {% _
   {1 `5 }1 a. i% k* N5 c) j
      CloseHandle(hFile);- [: R  [) J2 b4 f- o" ]
      return TRUE;$ K# o! `% n, h: G& l! Y
   }
5 k3 d5 c8 Z/ V; b. a% T5 q   return FALSE;' P: E  f& s$ I6 |5 s6 v
}
9 f  B) {- L  P; N4 t. \1 l. ?3 r9 d
Although this trick calls the CreateFileA function, don't even expect to be5 G; G, A; Y, R- x6 k
able to intercept it by installing a IFS hook: it will not work, no way!
& N8 p) h5 Z9 Q; J, z7 T* F" Y/ ~In fact, after the call to CreateFileA it will get through VWIN32 0x001F* H0 j2 t8 Q: v% v9 J4 E
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* w! h7 {: @+ }3 B2 j
and then browse the DDB list until it find the VxD and its DDB_Control_Proc" H$ |9 o3 h$ x/ ]
field.) x6 H; Z4 p  Z  W, i) ]
In fact, its purpose is not to load/unload VxDs but only to send a " i: D! A( A8 O& p+ ^
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* Q! C+ x; j$ n2 k# ?0 f* nto the VxD Control_Dispatch proc (how the hell a shareware soft could try
& Z4 ?  r2 O& ]5 Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).  S+ L2 P% [. u# o& s) ~7 J) o
If the VxD is loaded, it will always clear eax and the Carry flag to allow
' j( j% r/ P0 D/ B3 f3 ?) Mits handle to be opened and then, will be detected." B/ G. E- Y+ ?' Y; Z; m* i# j2 q0 X
You can check that simply by hooking Winice.exe control proc entry point
$ z1 B: i; U* [. `3 h# K* h5 k! W& `while running MeltICE.
% w9 S. ~6 d  Z- a" x: y+ H5 B$ v

; O. o! Q- h9 T4 t! w8 F; Q3 G  00401067:  push      00402025    ; \\.\SICE6 ^. F! n' `8 V' X7 Q5 T, m
  0040106C:  call      CreateFileA9 O3 [% h! |& m0 ~! n- m
  00401071:  cmp       eax,-001
/ _' ?. v& `* K3 h$ W, J5 B) s  00401074:  je        00401091
" ~! C3 f: J0 k$ E. ~; L1 J# x; l# B" C1 G, M2 ]4 R0 H' ]
' z  b" a5 \( M
There could be hundreds of BPX you could use to detect this trick.
) q0 A: c2 K6 j# ^7 g6 Y0 F. x. S-The most classical one is:! O* r8 U! ]* S; L! Y' [
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ |+ O, G) S3 Q  }+ m* o% M- g    *(esp-&gt;4+4)=='NTIC'. K1 I8 u* o  H- ^

; ~9 R" O6 V, ~* w5 V/ X-The most exotic ones (could be very slooooow :-(7 q/ R( N: V+ ?
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' r! {- F, F, z8 {' v
     ;will break 3 times :-(
0 S2 x+ |3 q, I( V9 z
6 j' U. p& s, k5 }9 q3 S' e-or (a bit) faster: . Q4 C) v7 w. {: x0 \. {  i+ c
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( E- n. |+ c- ]4 x' f0 s# w. e! H
' u- W& e+ k. }
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  4 d% o0 a4 W' P( p. c4 g
     ;will break 3 times :-(  p9 r% \/ F0 S9 Y
$ Y( A3 f( B  e! G
-Much faster:4 o$ o5 H/ W5 A8 b% P+ H: e/ ~( [
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 t! A% K. h$ P( Y
$ W- U. I" x% M1 s
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
5 M9 g+ _5 m0 ^9 w/ T; jfunction to do the same job:
$ z5 e4 q& R% w6 Q$ k6 C- {, w
6 E) h. C8 {0 C9 e, f  v   push    00                        ; OF_READ' S: D2 T1 q; M: ^! L+ k
   mov     eax,[00656634]            ; '\\.\SICE',0
5 ~" ]# D2 D' @% m1 T   push    eax
% O7 I0 k( `" i: s3 p. z8 f   call    KERNEL32!_lopen0 M+ s$ l: a3 @( z# ]5 L
   inc     eax
8 J" P- U0 ]) G7 t5 o; x   jnz     00650589                  ; detected
6 E3 G) l- |1 O, g) T  y   push    00                        ; OF_READ
7 [7 P' u: i7 S) q& d* F  G   mov     eax,[00656638]            ; '\\.\SICE'
2 I0 o, o6 Q% }   push    eax; C9 @3 r& r" ?
   call    KERNEL32!_lopen
8 H2 o& {3 s2 Z   inc     eax  e% K* R( k  X' q% s/ ~! h
   jz      006505ae                  ; not detected$ v/ a# Q( |0 o- B% }  R6 x. w5 }

0 R" q" O& f, |5 s& h5 I. E1 j. N  F( Y- ~9 L5 z; ~" f
__________________________________________________________________________
) x/ j* s: s5 B; \
7 B% i0 a( B0 Z; ?) s' ?5 I( kMethod 123 C1 F/ y) J0 A7 f
=========
% y" B1 d- t6 Z+ L" A. d7 c  \2 ^; m# j
This trick is similar to int41h/4fh Debugger installation check (code 05
1 h, x& h2 N+ C/ P  o; X- c6 s" B&amp; 06) but very limited because it's only available for Win95/98 (not NT): Y" E2 A2 }$ k
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.  V/ p' w/ f. q* j% D0 V- o

6 Y6 O$ e; X5 q8 V; I   push  0000004fh         ; function 4fh2 ?$ [7 z, z% q( A- l
   push  002a002ah         ; high word specifies which VxD (VWIN32)! W' l5 K$ Z* Q, _4 h$ D  ?
                           ; low word specifies which service# D1 [# y" o" M/ l
                             (VWIN32_Int41Dispatch)
4 [0 v' G- R( K; L9 v$ B! b   call  Kernel32!ORD_001  ; VxdCall8 m7 B: {: i! u  O
   cmp   ax, 0f386h        ; magic number returned by system debuggers
/ h. w- @( u4 ]& l' x6 x# {3 E2 o   jz    SoftICE_detected! ~4 L- M5 d( b" _- A% M
. Y" k; Q! z2 m7 t) i, }
Here again, several ways to detect it:
0 G/ o2 [  [8 i1 W) _) L# V& I
7 ?0 e  d7 F0 y    BPINT 41 if ax==4f4 E. u% X! V6 V, y' t( k$ y5 m
) p, u: `. N+ L  N  p) B: @
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one$ F$ f( A' ?6 r, ]: k
+ l+ {( w; w  t8 _
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 U# R* i4 L: x: i
( A1 C- ^1 X7 w! }9 w+ m& W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) C7 o5 N3 H1 g: c2 Q- o
  |, l* m# b2 K. J' v9 F__________________________________________________________________________5 e. [- V; l  w( Q2 |9 ?! A: I3 y
1 D: G4 W, t9 K& C; M! w
Method 13/ S0 k. i6 @( |8 ^0 x3 N
=========/ Z4 f3 C1 o7 I/ _9 W6 B/ g, K& T

8 i/ D7 ~5 k. J4 U3 n9 BNot a real method of detection, but a good way to know if SoftICE is
. p7 Q- J/ j. e1 f! S; M8 ~" hinstalled on a computer and to locate its installation directory.. `% o) i3 T: W$ _4 P6 R
It is used by few softs which access the following registry keys (usually #2) :. w! H8 n4 z  O" [7 [. ^; n, W
- g9 s! O7 p4 u) J$ F
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 G) i2 E) ?* c  m+ {" b
\Uninstall\SoftICE
1 k# J1 X/ K% S! a+ k3 A7 ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* b5 ?) m3 u, \0 Y3 M) W' r8 M) P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* a2 y7 q* t! P8 k: J& \\App Paths\Loader32.Exe5 i6 m# I! b+ Q3 o- l: x8 V3 Z
& B2 y- d- C: n2 m

2 A/ M# x6 t" S  X- p, bNote that some nasty apps could then erase all files from SoftICE directory
4 K, N1 f6 R" r( U0 ~0 `(I faced that once :-(
$ U3 i0 D- }5 ]; b2 o" `3 i4 m$ s6 E! s; Y
Useful breakpoint to detect it:
% y* @( u" c7 _8 }: v
6 k" A7 k! x9 }0 n1 t# I4 S     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& U! _/ H9 l, p9 P6 Q! Z, G: ?( }+ J; |+ ~( G# D9 N5 o
__________________________________________________________________________
1 o4 D: v1 q% B. q2 j/ k9 x" r9 U6 A) L5 q& s+ A

6 y' J6 p# j: z+ PMethod 14
% ~- h) ~/ E, e5 h7 R  }9 L=========; Y* _. n) d: O# f% F
" v" R% f6 f9 b- @' H
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ B5 k5 d- `& W4 D) N8 E/ G5 y0 _is to determines whether a debugger is running on your system (ring0 only).7 q& M$ k2 m" G; d( j4 E$ ~

) {( G- m6 s3 s7 m2 V   VMMCall Test_Debug_Installed/ d! `4 |% l/ I  h8 B! x
   je      not_installed
( d7 a( ~( i; h% C+ j- @) z
) Y! c7 [0 N2 m, _9 c8 Z" t6 I3 DThis service just checks a flag.. ~) `% u: J3 f! w0 }3 ?4 L
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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