systemd version the issue has been seen with
systemd-253.2-1.fc38
Used distribution
Fedora 38
Linux kernel version used
6.2.14-300.fc38.x86_64
CPU architectures issue was seen on
x86_64
Component
systemd
Expected behaviour you didn't see
We are able to use SystemCallFilter=~ execve.
It may not be possible to completely restrict execve as systemd need to launch the command specified in ExecStart.
|
int fexecve_or_execve(int executable_fd, const char *executable, char *const argv[], char *const envp[]) { |
At least the service should not be able to execve any other command than the one speficied in the ExecStart directive.
This, coupled with MemoryDenyWriteExecute=yes, is a powerful way to prevent an attacker from running any new code for every service that don't need to launch new process (of which they are many).
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#MemoryDenyWriteExecute=
Unexpected behaviour you saw
Job for test.service failed because a fatal signal was delivered causing the control process to dump core. See "systemctl status test.service" and "journalctl -xeu test.service" for details.
Steps to reproduce the problem
Add to /etc/systemd/system/test.service:
[Unit]
Description=test
[Service]
Type=oneshot
ExecStart=/usr/bin/echo Success
SystemCallFilter=~ execve
systemctl daemon-reload
systemctl start test
Additional program output to the terminal or log subsystem illustrating the issue
No response
systemd version the issue has been seen with
systemd-253.2-1.fc38
Used distribution
Fedora 38
Linux kernel version used
6.2.14-300.fc38.x86_64
CPU architectures issue was seen on
x86_64
Component
systemd
Expected behaviour you didn't see
We are able to use
SystemCallFilter=~ execve.It may not be possible to completely restrict
execveas systemd need to launch the command specified inExecStart.systemd/src/shared/exec-util.c
Line 488 in 8521338
At least the service should not be able to
execveany other command than the one speficied in theExecStartdirective.This, coupled with
MemoryDenyWriteExecute=yes, is a powerful way to prevent an attacker from running any new code for every service that don't need to launch new process (of which they are many).https://www.freedesktop.org/software/systemd/man/systemd.exec.html#MemoryDenyWriteExecute=
Unexpected behaviour you saw
Job for test.service failed because a fatal signal was delivered causing the control process to dump core. See "systemctl status test.service" and "journalctl -xeu test.service" for details.Steps to reproduce the problem
Add to
/etc/systemd/system/test.service:systemctl daemon-reloadsystemctl start testAdditional program output to the terminal or log subsystem illustrating the issue
No response