With just a mere 48 characters of code, Linux admin and SSLMate founder Andrew Ayer has figured out how to crash major Linux distributions by locally exploiting a flaw in systemd.
Ayer said the following command, when run as any user, will crash systemd: “NOTIFY_SOCKET=/run/systemd/notify systemd-notify”
Systemd is an essential part of the boot process for most Linux distributions. According to Ayer, in a blog post titled “How to Crash Systemd in One Tweet,” after running the command, the Linux processes identifier 1 (PID 1) is hung in the pause system call. This prevents a clean system reboot and results in system instability. “All of this can be caused by a command that’s short enough to fit in a Tweet,” Ayer writes. Ayer said the flaw was introduced about two years ago in systemd 209. “Despite the banality, the bug is serious, as it allows any local user to trivially perform a denial-of-service attack against a critical system component,” he wrote. “The above systemd-notify command sends a zero-length message to the world-accessible UNIX domain socket located at /run/systemd/notify. PID 1 receives the message and fails an assertion that the message length is greater than zero” creating the systemd failure, Ayer wrote. Since Ayer red-flagged the vulnerability, systemd has patched the denial-of-service bug, according to a David Timothy Strauss, CTO and co-founder of Pantheon. Strauss, via a blog post critical of Ayer, said the vulnerability is a “minor security issue.” “Not only is the current security issue among the lowest risk classes by being local-only and denial-of-service (versus information disclosure or privilege escalation), but most of Ayer’s claims are either wrong or misleading,” Strauss wrote. Strauss takes aim at Ayer’s assertion that the attack code “crashes” systemd, when in fact it makes it “feel generally unstable.” Strauss says that Ayer is being subjective. “There are some services that attempt to use systemd but will time out in 30 seconds (by default) if it is unavailable. These facilities are degrading gracefully, which is exactly what should happen,” he wrote. Strauss compares the flaw identified by Ayer as a needed Linux function. “Engineering crumple zones on cars isn’t evidence that they handle poorly. Likewise, improving coredump handling for systemd isn’t evidence that it crashes frequently,” he wrote. In further defense of systemd, Strauss wrote that Ayer is being overly critical of “one of the most powerful tools we have to harden the front lines against the real attacks.” Strauss wrote: “Many of the services systemd helps to harden don’t just have local attack vectors that might become remote ones. Many of them are network services, and they’re not just a foot in the door for other attacks but the keepers of data attackers want.” In Ayer’s latest blog post salvo in response Strauss, he fires back that Strauss “vastly overstates the value of these (systemd) features. “The best systemd can offer is whole application sandboxing. You can start a daemon as a non-root user, in a restricted filesystem namespace, with mandatory access control,” Ayer wrote. “Since sandboxing a whole application cannot protect one part of the application from a compromise of a different part, it is ineffective at securing benign-but-insecure software, which is the problem faced on servers.” Developer and author of the Linux library musl, Rich Felker, told Threatpost that the systemd bug found by Ayer was less a serious vulnerability and more an alarm bell for a “monoculture” surrounding systemd. “Systemd is not designed to be broken down into small parts that can safely fail and recover from both a security point of view and a robustness standpoint,” Felker said. “You’ve got one big monolithic process where if one thing breaks the whole thing goes down. That’s the big design problem Ayer is shedding light on. It’s not a big security flaw, it’s a system development design flaw.” Felker said development of systemd, to the exclusion of alternatives Upstart, Runit and s6, jeopardize a richer more diverse ecosystem of daemons from being developed that would make it harder for hackers to penetrate. Since Ayer’s original post, the Strauss-Ayer debate has heated up via blogs and Twitter attacks with little sign of relenting.