---
title: "HOST-SYSD-004 Service Programs in Writable Locations"
canonical: https://openvapt.com/checks/HOST-SYSD-004.html
html: https://openvapt.com/checks/HOST-SYSD-004.html
site: OpenVAPT, https://openvapt.com/
license: OpenVAPT Source-Available Licence 1.3, https://openvapt.com/legal/licence-text.html
modified: 2026-10-14
version: 0.1.0-alpha.6
---

# HOST-SYSD-004 Service Programs in Writable Locations

Checks whether a service starts a program from a temporary folder, or a program file that other users can replace.

- Domain: Server
- Severity: High
- Control category: Access Control
- Fix effort: low
- CVSS v3.1 vector: `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- CIS Controls v8: 3.3
- NIST CSF 2.0: PR.AA-05, PR.DS-01
- CWE: CWE-732, CWE-427
- NIST SP 800-53 Rev. 5: AC-3, CM-5
- Benchmark topic: Protect service executables (topic only, no benchmark text)

## Why It Matters

If the program a root service starts lives in /tmp or is writable by other users, any local user (or a compromised web application) can replace it and gain root the next time the service restarts.

## How It Detects

Takes the program path of each long-running service's ExecStart= line and flags paths under /tmp, /var/tmp or /dev/shm, program files that are world-writable, and, for services running as root, program files not owned by root.

## How to Fix

Install the program in a root-owned location (/usr/local/bin or /opt/<app>), chown root:root and chmod 755 it, point ExecStart= at it, then systemctl daemon-reload and restart the service.

## How to Verify

```
stat -c '%U %a %n' $(systemctl show -p ExecStart --value <unit> | awk '{print $2}' | sed 's/path=//;s/;//')
```

## Learn the Theory

- [P11 Service Hardening With systemd](https://openvapt.com/academy/p11.md)

## References

- [systemd.exec(5), execution environment configuration](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html)
- [MITRE ATT&CK T1574.010, Hijack Execution Flow: Services File Permissions Weakness](https://attack.mitre.org/techniques/T1574/010/)

## Source Code

https://github.com/OpenVAPT/openvapt/blob/574f7f3333c44b75a3c649e2d93a76d507f75adf/internal/checks/host/systemd.go

Run it: `openvapt scan --only HOST-SYSD-004`. Read it offline: `openvapt explain HOST-SYSD-004`.

---

OpenVAPT is academic, non-commercial, source-available and built by AI Cybersecurity Engineers (AI systems, not people). Free for your own use on machines you own or control, 100% at your own risk; not for sale and not for providing services. This page in HTML: https://openvapt.com/checks/HOST-SYSD-004.html. Part of OpenVAPT Check Catalogue. How to cite: https://openvapt.com/cite.html. Site summary for models: https://openvapt.com/llms.txt.
