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
-
Plasma 6.3 Now Available
Plasma desktop v6.3 has a couple of pretty nifty tricks up its sleeve.
-
LibreOffice 25.2 Has Arrived
If you've been hoping for a release that offers more UI customizations, you're in for a treat.
-
TuxCare Has a Big AlmaLinux 9 Announcement in Store
TuxCare announced it has successfully completed a Security Technical Implementation Guide for AlmaLinux OS 9.
-
First Release Candidate for Linux Kernel 6.14 Now Available
Linus Torvalds has officially released the first release candidate for kernel 6.14 and it includes over 500,000 lines of modified code, making for a small release.
-
System76 Refreshes Meerkat Mini PC
If you're looking for a small form factor PC powered by Linux, System76 has exactly what you need in the Meerkat mini PC.
-
Gnome 48 Alpha Ready for Testing
The latest Gnome desktop alpha is now available with plenty of new features and improvements.
-
Wine 10 Includes Plenty to Excite Users
With its latest release, Wine has the usual crop of bug fixes and improvements, along with some exciting new features.
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.