Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Monday July 03 2017, @10:12PM   Printer-friendly
from the it's-a-feature dept.

Submitted via IRC for TheMightyBuzzard

A bug in Linux's systemd init system causes root permissions to be given to services associated with invalid usernames, and while this could pose a security risk, exploitation is not an easy task.

A developer who uses the online moniker "mapleray" last week discovered a problem related to systemd unit files, the configuration files used to describe resources and their behavior. Mapleray noticed that a systemd unit file containing an invalid username – one that starts with a digit (e.g. "0day") – will initiate the targeted process with root privileges instead of regular user privileges.

Systemd is designed not to allow usernames that start with a numeric character, but Red Hat, CentOS and other Linux distributions do allow such usernames.

"It's systemd's parsing of the User= parameter that determines the naming doesn't follow a set of conventions, and decides to fall back to its default value, root," explained developer Mattias Geniar.

While this sounds like it could be leveraged to obtain root privileges on any Linux installation using systemd, exploiting the bug in an attack is not an easy task. Geniar pointed out that the attacker needs root privileges in the first place to edit the systemd unit file and use it.

[...] Systemd developers have classified this issue as "not-a-bug" and they apparently don't plan on fixing it. Linux users are divided on the matter – some believe this is a vulnerability that could pose a serious security risk, while others agree that a fix is not necessary.

See, this is why we can't have nice init systems.

Source: http://www.securityweek.com/linux-systemd-gives-root-privileges-invalid-usernames


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 4, Insightful) by Lagg on Tuesday July 04 2017, @05:52AM (3 children)

    by Lagg (105) on Tuesday July 04 2017, @05:52AM (#534692) Homepage Journal

    Every time shit like this comes up that Lennart or someone else that can't really deal with criticism calls "not a bug" and closes my love for the good parts of systemd decrements.

    Also I won't pretend to understand in what universe this could make root the fallback (attempt to deal with UID-passed values, var initialized to 0 pre-parse instead of null, not checked?) but this is why you don't assume things about input before you're done parsing.

    Seriously though I'm sick of Lennart's shit [github.com]. The excuse of the introvert being unfairly criticized only goes so far.

    By the way looks like my guess above was correct [github.com]. Fuckin nailed it breh. (see uint32_t uid initializer value)

    --
    http://lagg.me [lagg.me] 🗿
    Starting Score:    1  point
    Moderation   +2  
       Insightful=1, Interesting=1, Total=2
    Extra 'Insightful' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   4  
  • (Score: 0) by Anonymous Coward on Tuesday July 04 2017, @06:53AM

    by Anonymous Coward on Tuesday July 04 2017, @06:53AM (#534699)

    "--systemdLove" looks like a command line option.

    (see uint32_t uid initializer value)

    How ironic, UID_INVALID [github.com] is mentioned only 11 lines previous.

  • (Score: 2) by ledow on Tuesday July 04 2017, @08:21AM (1 child)

    by ledow (5567) on Tuesday July 04 2017, @08:21AM (#534729) Homepage

    Anyone with a brain would separate things out, though.

    "Did we see a valid username yet?" variable (literally binary).
    "What is the username that we saw" (string).

    Then, even if you parse through the whole file, you would test against the "Did we see a valid username" variable and error if you haven't (or fallback to a safe default).

    Using the string itself directly (i.e. is it NULL), is a very silly thing to do given the number of string-parsing problems you could encounter along the way, and using its default value (surely it should always be made NULL until otherwise initialised) directly would be pretty ludicrous (I don't expect that's what systemd actually does, by the way).

    The problem is that you can't fix design in hindsight - how many other syntax errors, string-parsing problems, or line-break issues or whatever could result in the username being obscured to the program to the extent that it just falls back to root? It's just stupid.

    • (Score: 2) by Jesus_666 on Tuesday July 04 2017, @05:42PM

      by Jesus_666 (3044) on Tuesday July 04 2017, @05:42PM (#534852)
      From what I've heard that's what they do - it's just that the default assumption (if no User= line is present) is that the unit runs as root. If they do have a User= line and don't like its contents, however, they seem to pretend it wasn't there in the first place instead of refusing to run the unit.