FreeBSD-SA-07:04.file

久々に FreeBSDSA出てます。あれ、FreeBSD announce-jp には流れてないですね?

Topic:          Heap overflow in file(1)

Category:       contrib
Module:         file
Announced:      2007-05-23
Affects:        All FreeBSD releases.

(省略)

I.   Background

The file(1) utility attempts to classify file system objects based on
filesystem, magic number and language tests.

The libmagic(3) library provides most of the functionality of file(1)
and may be used by other applications.

II.  Problem Description

When writing data into a buffer in the file_printf function, the length
of the unused portion of the buffer is not correctly tracked, resulting
in a buffer overflow when processing certain files.

III. Impact

An attacker who can cause file(1) to be run on a maliciously constructed
input can cause file(1) to crash.  It may be possible for such an attacker
to execute arbitrary code with the privileges of the user running file(1).

The above also applies to any other applications using the libmagic(3)
library.

IV.  Workaround

No workaround is available, but systems where file(1) and other
libmagic(3)-using applications are never run on untrusted input are not
vulnerable.

ということで、そそくさと対応するなら SA にあるように

  1. 5-STABLE/6-STABLE、または RELENG_6_2/RELENG_6_1/RELENG_5_5 セキュリティブランチへのアップグレード
  2. パッチを当てて部分再構築

です。