FreeBSD Ports Security Advisory FreeBSD-SA-01:68.xsane

FreeBSD Security Advisories security-advisories at
Mon Dec 17 10:19:43 PST 2001


FreeBSD-SA-01:68                                            Security Advisory
                                                                FreeBSD, Inc.

Topic:          xsane port uses insecure temporary file handling

Category:       ports
Module:         xsane
Announced:      2001-12-17
Credits:        Tim Waugh <twaugh at>, michal at
Affects:        Ports collection prior to the correction date
Corrected:      2001-12-14 01:58:36 UTC
FreeBSD only:   NO

I.   Background

The XSane application is a gtk based X11 front-end to the SANE
(Scanner Access Now Easy) library used to interface with scanners.
XSane will acquire images using devices such as scanners and cameras.

II.  Problem Description

XSane creates temporary files in /tmp during the process of scanning
images and to communicate with SANE (the back-end application which
actually performs the scans) during image preview and save.

However XSane creates temporary files using mktemp(3), which can be
easily predicted (see the BUGS section of the mktemp(3) man page).
This makes XSane vulnerable to exploit, opening the opportunity for a
user's files to be overwritten through a race condition.

The xsane port is not installed by default, nor is it "part of
FreeBSD" as such: it is part of the FreeBSD ports collection, which
contains over 6000 third-party applications in a ready-to-install
format. The ports collection shipped with FreeBSD 4.4 contains this
problem since it was discovered after the release.

FreeBSD makes no claim about the security of these third-party
applications, although an effort is underway to provide a security
audit of the most security-critical ports.

III. Impact

A local user may be able to cause xsane (run by another user) to
overwrite any file for which the latter user has sufficient privilege.
While it is advisable to run XSane with a non-privileged user account,
many users run it using the root account, increasing the risk.

IV.  Workaround

1) Deinstall the xsane port/package if you have it installed.

V.   Solution

1) Upgrade your entire ports collection and rebuild the port.

2) Deinstall the old package and install a new package dated after the
correction date, obtained from the following directories:


Packages are not automatically generated for the alpha architecture at
this time due to lack of build resources.

NOTE: It may be several days before updated packages are available. Be
sure to check the file creation date on the package, because the
version number of the software has not changed.

3) Download a new port skeleton for the xsane port from:

and use it to rebuild the port.

4) Use the portcheckout utility to automate option (3) above. The
portcheckout port is available in /usr/ports/devel/portcheckout or the
package can be obtained from:

VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in the FreeBSD ports collection.

Path                                                             Revision
- -------------------------------------------------------------------------
ports/graphics/xsane/Makefile                                        1.30
ports/graphics/xsane/distinfo                                        1.20
ports/graphics/xsane/pkg-plist                                       1.18
- -------------------------------------------------------------------------


This is the moderated mailing list freebsd-announce.
The list contains announcements of new FreeBSD capabilities,
important events and project milestones.
See also the FreeBSD Web pages at

To Unsubscribe: send mail to majordomo at
with "unsubscribe freebsd-announce" in the body of the message

More information about the freebsd-announce mailing list