-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion failure when PID 1 receives a zero-length message over notify socket #4234
Comments
|
it seems nothing breaks like this, at least on systemd v219. |
|
Nothing seems to break when I do the same on systemd v229. |
|
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:
|
|
replicated on 219 on CentOS 7 as well using the updated PoC above. |
|
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) |
|
On Ubuntu 16.04.1 with systemd 229-4ubuntu8 installed, as a non-root user: |
|
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) |
|
This seems to be denial of service issue crossing the user boundary, thus making it a security vulnerability. Please consider handling it as such. |
|
It triggers the bug for me, it says |
|
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. |
|
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 |
|
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. |
|
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. |
|
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. |
|
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 |
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org> (cherry picked from commit 531ac2b)
This includes the fix for the assertion failure in systemd/systemd#4234.
This includes the fix for the assertion failure in systemd/systemd#4234. (cherry picked from commit 8b09ba3)
systemd/systemd#4234 Reproducible in PLD with: while : ; do NOTIFY_SOCKET=/run/systemd/notify systemd-notify "" ; done Patch based on upstream commits: systemd/systemd@531ac2b systemd/systemd@9987750 systemd/systemd@8523bf7 systemd/systemd@a86b767 Release: 14
|
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. |
|
abaza@abaza-VirtualBox: There is no effect |
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org> (cherry picked from commit 531ac2b)
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org> (cherry picked from commit 531ac2b)
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org> Cherry-picked from: 531ac2b Resolves: #1380175
…4237) Fixes systemd#4234. Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
This includes the fix for the assertion failure in systemd/systemd#4234. (cherry picked from commit 8b09ba3)
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:
The text was updated successfully, but these errors were encountered: