|
|
Log in / Subscribe / Register

Security quote of the week

I commented on Lobsters that /tmp is usually a bad idea, which caused some surprise. I suppose /tmp security bugs were common in the 1990s when I was learning Unix, but they are pretty rare now so I can see why less grizzled hackers might not be familiar with the problems.

I guess that's some kind of success, but sadly the fixes have left behind a lot of scar tissue because they didn't address the underlying problem: /tmp should not exist.

It's a bad idea because it's shared global mutable state that crosses security boundaries. There's a ton of complexity at all levels of unix (filesystems, kernel APIs, libc, shell, admin scripts) that only exists as a workaround for the dangers caused by making /tmp shared.

— Tony Finch



to post comments

Debian 13 reinforces the unreliability of /tmp

Posted Oct 24, 2024 7:55 UTC (Thu) by koh (subscriber, #101482) [Link] (3 responses)

In related news, while all except one of the technical problems described in the author's more lengthy blog post 'against /tmp' have each been addressed (albeit by adding complexity, his main complaint), the only remaining unsolved problem on his list (periodic cleanup tasks) has recently been reintroduced to Debian by default (LWN covered it).

This recent change in system behaviour has been justified by referring to the bad old days when those /tmp cleanups introducing unreliability were more common, and by requiring even more complexity in terms of a systemd-specific opt-out mechanism via flock(2).

I don't understand why we consciously keep reinforcing the problems with /tmp.

Debian 13 reinforces the unreliability of /tmp

Posted Oct 24, 2024 12:02 UTC (Thu) by pizza (subscriber, #46) [Link]

> I don't understand why we consciously keep reinforcing the problems with /tmp.

Because users have unrealistic (and often fundamentally conflicting) expectations of it?

Debian 13 reinforces the unreliability of /tmp

Posted Oct 24, 2024 13:13 UTC (Thu) by farnz (subscriber, #17727) [Link]

Developers continue to get tunnel-vision, and I have to keep explaining that there's no scoping in /tmp, and certainly not to whatever scope you expect it to have.

I have yet to get through 12 months without having to explain to a colleague that /tmp is a filesystem, a filesystem is a shared resource, and any analysis that depends on filesystem behaviour has to bring all processes in the same security domain (often the entire system, unless you've done something clever with SELinux) into scope.

And the trouble is that if your analysis relies on only looking at the processes you're working on, and not everything running on the system (which gets extremely interesting on desktops, where you have a human running new things), then you're going to get caught out because something else running is sharing your data.

Debian 13 reinforces the unreliability of /tmp

Posted Oct 24, 2024 13:14 UTC (Thu) by nim-nim (subscriber, #34454) [Link]

Because the same things that make /tmp dangerous also make it extremely convenient.

Who has multiple users anymore?

Posted Oct 24, 2024 16:03 UTC (Thu) by smoogen (subscriber, #97) [Link]

Most of the software problems I remember from /tmp were because there were multiple users on the system which could 'deceive' another user into doing something because they had similar abilities in /tmp. There were others but the big ones usually were user id one breaking user-id two. I guess I am going towards https://xkcd.com/1200/ but with the added benefit that most systems also have the admin account without a password in sudo... so there is no difference between UID 0 and UID 1000 beyond a very small speed-hump.

I would think this is the major reason worrying about /tmp something further down the list than all the other footguns available to most developers.


Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds