Project

General

Profile

Feature #14880

Set resource limits

Added by cypherpunks almost 2 years ago. Updated over 1 year ago.

Status:
Confirmed
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
10/26/2017
Due date:
% Done:

0%

Feature Branch:
Type of work:
Research
Blueprint:
Starter:
No
Affected tool:

Description

Currently, Tails does no resource limitation, even though it is supported by PAM through the /etc/security/limits.conf file. The rlimits primarily reduce the risk of DoS through, say, fork bombs, and it can reduce vulnerabilities. Some examples:

  • RLIMIT_STACK can mitigate various ASLR-exhaustion attacks.
  • RLIMIT_AS can mitigate some types of integer overflows (such as the RCE libotr had, or the large number of X11 extension vulnerabilities).
  • RLIMIT_NICE can make some side-channel attacks a bit harder.
  • RLIMIT_CORE can allow debugging crashes that were potentially caused by exploits.
  • RLIMIT_NPROC can mitigate many of the easiest forms of DoSes, as well as make side-channel attacks harder.
  • RLIMIT_CPU can make side-channel attacks and attacks like rowhammer harder, when used wisely.

Resource limits can be applied to users or groups, though the prlimit64() syscall can be used to set it for processes which are already running. I suggest limiting AS for all processes but the browser (as it is the most likely to have a legitimate need to eat up lots of memory) and similar bloated beasts, the number of processes for the amnesia user, and the stack size and niceness for all processes (setting it to even 8 MiB would be enough). The core limit should be lifted or made very liberal, and coredumps configured to log to journald. I assume coredumps logged there are not readable by unprivileged users (to prevent, say, sending SIGSEGV to a victim process in order to read potentially sensitive memory contents). Reducing other limits can be done as deemed safe. Individual sensitive users can be restricted more, such as the debian-tor user.

Please consider taking advantage of this simple but useful PAM feature.

History

#1 Updated by mercedes508 almost 2 years ago

  • Assignee set to emmapeel

#2 Updated by emmapeel over 1 year ago

  • Assignee changed from emmapeel to intrigeri

Ey intri can you please have a look at this idea?

#3 Updated by intrigeri over 1 year ago

  • Subject changed from Set resource limits using PAM to Set resource limits
  • Status changed from New to Confirmed
  • Assignee deleted (intrigeri)
  • Priority changed from Normal to Low
  • Type of work changed from Code to Research

I'm not fully convinced the cost/benefit ratio is interesting but if someone wants to research this seriously, find which specific limits would efficiently prevent attacks without harming UX, and propose a way to implement them, then I'll be happy to review it. I'd really like the implementation to be simple, easy to audit & maintain, and backed by good explanations. In many cases it would probably make sense to implement such things directly in upstream software or in the Debian packaging, instead of adding to the Tails delta we have to maintain.

Regarding how exactly to apply the limits, for anything that's run by systemd I recommend looking at the Limit*= directives, e.g. on my system I see a number of units that set LimitNPROC= to a low value.

#4 Updated by cypherpunks over 1 year ago

intrigeri wrote:

I'm not fully convinced the cost/benefit ratio is interesting but if someone wants to research this seriously, find which specific limits would efficiently prevent attacks without harming UX, and propose a way to implement them, then I'll be happy to review it. I'd really like the implementation to be simple, easy to audit & maintain, and backed by good explanations. In many cases it would probably make sense to implement such things directly in upstream software or in the Debian packaging, instead of adding to the Tails delta we have to maintain.

What is the cost, exactly? For any sane limits, there should be no UX issues at all. For example limiting the stack to 8 MiB should not interfere with any programs. Limiting the AS to under 2 GiB for most programs would mitigate real-life vulnerabilities (like that one libotr integer overflow bug from some time ago). Limiting niceness would not affect any existing programs and would make side-channel attacks harder, etc.

I am also curious to know how this would increase the Tails delta. Obviously the changes would be exclusively Tails-specific, so making them default in upstream would be silly. Debian provides us with configuration options to use for this very reason. It's not like we have to provide a program that applies all of these manually with prlimit64() or something. All it requires is editing /etc/pam.d/security or whatever systemd uses if it is systemd-specific.

Also available in: Atom PDF