Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Assertion failure when PID 1 receives a zero-length message over notify socket #4234
Comments
FlorianHeigl
commented
Sep 28, 2016
|
it seems nothing breaks like this, at least on systemd v219. |
twirrim
commented
Sep 28, 2016
|
Nothing seems to break when I do the same on systemd v229. |
twirrim
commented
Sep 28, 2016
•
|
Okay, I managed to trigger this on v229 by changing the PoC to the following:
While it threw the "Cannot find unit" messages for a bit, in less than 30 seconds that changed to:
|
nathwill
commented
Sep 28, 2016
|
replicated on 219 on CentOS 7 as well using the updated PoC above. |
Daviey
commented
Sep 28, 2016
|
Ubuntu, 16.04 (systemd v229), with the while loop PoC: Sep 28 22:21:36 odyssey systemd[1]: Cannot find unit for notify message of PID 21076. (However, no adverse effect on the running system) |
added a commit
to niedbalski/systemd
that referenced
this issue
Sep 28, 2016
atoponce
commented
Sep 28, 2016
|
On Ubuntu 16.04.1 with systemd 229-4ubuntu8 installed, as a non-root user:
|
niedbalski
referenced this issue
Sep 28, 2016
Closed
If the notification message length is 0, ignore the message. #4237
|
On Arch Linux with 231 (with the Sep 29 00:06:07 arch-64-glaukon systemd[1]: Assertion 'n > 0' failed at src/core/manager.c:1593, function manager_invoke_notify_message(). Aborting.
Sep 29 00:06:07 arch-64-glaukon systemd-coredump[9495]: Due to PID 1 having crashed coredump collection will now be turned off.
Sep 29 00:06:07 arch-64-glaukon systemd[1]: Caught <ABRT>, dumped core as pid 9494.
Sep 29 00:06:07 arch-64-glaukon systemd[1]: Freezing execution.
Sep 29 00:06:08 arch-64-glaukon systemd-coredump[9495]: Detected coredump of the journal daemon or PID 1, diverted to /var/lib/systemd/coredump/core.systemd.0.f9b64f9e7c164d80a53
user root by (uid=1000) |
added a commit
to niedbalski/systemd
that referenced
this issue
Sep 28, 2016
evverx
added
bug
pid1
labels
Sep 28, 2016
added a commit
to niedbalski/systemd
that referenced
this issue
Sep 28, 2016
mornau
commented
Sep 28, 2016
•
|
This seems to be denial of service issue crossing the user boundary, thus making it a security vulnerability. Please consider handling it as such. |
jcjordyn130
commented
Sep 29, 2016
•
|
It triggers the bug for me, it says |
samcv
commented
Sep 29, 2016
|
This patch (just one line), changing it from assert(n > 0) to assert(n >= 0) causes my system to not suffer from this bug. Hopefully somebody more knowledgeable about systemd will know whether or not more needs to be done than this to properly fix this issue. |
irregulator
commented
Sep 29, 2016
|
Hi, I tried to reproduce the PoC attack in a Debian Jessie 8.6 vm running 'systemd 215-17+deb8u5' by executing the systemd-notify in "while true" loop. For what it's worth to my understanding no complete crash occurred. systemd-journald.service and systemd-logind.servide did crash indeed. Nevertheless I was able to restart sshd via systemdctl and accept connections. The assert mentioned in 5ba6985#diff-ab78220e12703ee63fa1e6a2caa16bebR1325 seems to be present in the installed debian package https://sources.debian.net/src/systemd/215-17%2Bdeb8u5/src/core/manager.c/?hl=1567#L1487 |
guzaho
commented
Sep 29, 2016
•
|
I just ran the following command as a regular user on my Linux Mint 18 (Sarah), and got this: $ while true; do NOTIFY_SOCKET=/run/systemd/notify systemd-notify ""; done I also ran the same command as root and got the same result. I don't see any issues with my system after this. I am unable to replicate the bug. |
keszybz
closed this
in
531ac2b
Sep 29, 2016
|
Possibly this was the real cause of this bug? d875aa8 That's only in v219 which would explain why it doesn't crash on jessie which has v215 (I also couldn't make the POC work there). |
|
Older distros are affected differently I think: no assertion is triggered but manager_dispatch_notify_fd() still returns an error which has the bad side effect to disable the notification handler completely, see https://github.com/systemd/systemd/blob/v215/src/core/manager.c#L1398. All services using the Watchdog feature will silently fail to notify PID1. The latter will consider the service dead and will kill them. See #4240 for a possible fix. |
|
@fbuihuu I can confirm that finding. With v215 from Debian, logind and journald fail with watchdog errors. Other then that the system remained in a usable state. I could start/stop service, reboot in a controlled manner, etc. |
AdamBouhmad
commented
Sep 29, 2016
|
Reported the issue to Redhat just so they were aware, though I'm sure they already are. Reproduced on ubuntu 15.10, which has systemd on v225 so not quite sure if v219's update is the issue. Could this be the problem? 5ba6985#diff-ab78220e12703ee63fa1e6a2caa16bebR1325 Will take a look at this further tonight and see if I can help. |
bt0DotNinja
commented
Sep 29, 2016
•
|
Report the issue in Fedora 24 Desktop / systemd 229 [soul@RyujinJakka Sandbox]$ uname -a The calls to systemd based commands (systemd-nspaw, systemctl,reboot, etc) hangs and later shows a timeout message, no general system degradation (screenshots http://wp.me/p7FGzd-49) Hangs on Reboot and shutdown |
added a commit
to NixOS/systemd
that referenced
this issue
Sep 30, 2016
added a commit
to NixOS/nixpkgs
that referenced
this issue
Sep 30, 2016
added a commit
to NixOS/nixpkgs
that referenced
this issue
Sep 30, 2016
pushed a commit
to pld-linux/systemd
that referenced
this issue
Oct 1, 2016
added a commit
to peterhoeg/nixpkgs
that referenced
this issue
Oct 2, 2016
smarek
commented
Oct 2, 2016
|
Can reproduce on Debian stretch, with systemd 231-4
From syslog
And latter messages are, for example, these:
|
|
@smarek The Debian package was fixed in 231-9. It's currently in unstable and should reach testing in 2-3 days. The version in unstable, v215, is not directly affected by this crash. |
AbazaSeif
commented
Oct 4, 2016
|
abaza@abaza-VirtualBox: There is no effect |
AGWA commentedSep 28, 2016
systemd fails an assertion in manager_invoke_notify_message when a zero-length message is received over /run/systemd/notify. This allows a local user to perform a denial-of-service attack against PID 1.
Proof-of-concept: