Error in Linux Filesystemen Endangers Postfix
Wietse Venema, the developer of Postfix, points in an advisory to a security problem in connection with the Linux and Solaris filesystems. As more recent versions of these operating systems no longer comply with the POSIX standard for links, local attackers may be able to attach files to other users' Postfix mailboxes.
The problem exists for all newer Linux and Solaris variants according to Venema, but not on BSD derivatives, AIX, Mac OS X, HP-UX, and other systems that either keep to the POSIX or X/Open standards.
Affected systems create hard links which in turn point to symlinks, not as hard links, but by creating a symbolic link without notifying the user of the fact. A local attacker can exploit this to attach data files for which the owner has not assigned write privileges, for example, the Postfix server mailbox.
Suse's Sebastian Krahmer discovered this behavior. It can be demonstrated on current Linux distributions (for example, Ubuntu 8.04 and Opensuse 11) with just a few steps:
$ PATH=/bin:/usr/bin:$PATH
$ mkdir test
$ cd test
$ touch src
$ ln -s src dst1
$ ln dst1 dst2
$ ls -l
Systems affected by the vulnerability create two symlinks in the directory despite entering Ln without the "-s" option:
$ ls -l
lrwxrwxrwx 2 user users 3 Mmm dd hh:mm dst1 -> src
lrwxrwxrwx 2 user users 3 Mmm dd hh:mm dst2 -> src
-rw-r--r-- 1 user users 0 Mmm dd hh:mm src
It would be correct, and POSIX-compliant to create a genuine hard link, says Venema:
$ ls -l
lrwxrwxrwx 2 user users 3 Mmm dd hh:mm dst1 -> src
-rw-r--r-- 2 user users 0 Mmm dd hh:mm dst2
-rw-r--r-- 1 user users 0 Mmm dd hh:mm src
In the case of the Postfix mail server, a local attacker could talk Postfix into attaching data to another user's file, including the mailbox, for example. If the server is running with root privileges, this might provide an attack vector for a local user independently of Postfix. If Postfix encounters a hard link on delivery, the mail server outputs an error message refuses to deliver; in contrast to this symlinks are permitted.
Users should thus apply the patch posted on the German Postfix page run by Patrick Koetter and Ralf Hildebrandt, and follow the instructions, especially if they use the Mailbox format with Local Delivery Agent, or Virtual Delivery Agent. Postfix mail servers running Maildir, or a local IMAP server like Cyrus or Dovecot, are not affected.
Venema uses a Perl script to ensure that the spooler directory is owned by root, and that each user already has a Mailbox file. As an alternative, mail server admins can patch the source code provided to their version of Postfix.
As a global countermeasure, which will work beyond the bounds of Postfix, Venema recommends preventing non-root users from creating hard links for other users' objects. This behavior is configurable on many systems.
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Endless OS 6 has Arrived
After more than a year since the last update, the latest release of Endless OS is now available for general usage.
-
Fedora Asahi 40 Remix Available for Macs with Apple Silicon
If you've been anticipating KDE's Plasma 6 for your Apple Silicon-powered Mac, then you're in luck.
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.