CVE-2018-6954 in systemdinfo

Summary

by MITRE

systemd-tmpfiles in systemd through 237 mishandles symlinks present in non-terminal path components, which allows local users to obtain ownership of arbitrary files via vectors involving creation of a directory and a file under that directory, and later replacing that directory with a symlink. This occurs even if the fs.protected_symlinks sysctl is turned on.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 06/09/2025

The vulnerability identified as CVE-2018-6954 affects systemd-tmpfiles functionality within systemd versions up to and including 237, representing a significant local privilege escalation risk. This flaw specifically targets how systemd processes temporary file creation and management, particularly when handling symbolic links within directory paths that contain non-terminal components. The vulnerability stems from improper handling of symlink traversal during the temporary file creation process, creating a persistent security weakness that can be exploited by local attackers to gain unauthorized ownership of arbitrary system files.

The technical flaw manifests when systemd-tmpfiles encounters a scenario where a directory path contains symbolic links in non-terminal positions, meaning symlinks that appear earlier in the path structure rather than at the final component. During normal operation, the system creates directories and files following a specific sequence, but when a directory is created and subsequently replaced with a symbolic link pointing elsewhere, the system fails to properly validate or handle this transition. This mismanagement allows attackers to manipulate the file system state in ways that bypass normal access controls and ownership restrictions. The vulnerability is particularly insidious because it operates even when the fs.protected_symlinks sysctl parameter is enabled, which typically protects against symlink-based attacks by preventing traversal through symlinks in path resolution.

The operational impact of this vulnerability extends beyond simple file ownership manipulation, potentially enabling attackers to escalate privileges and gain unauthorized access to sensitive system resources. Local users can exploit this weakness to overwrite files with malicious content, manipulate system configuration, or establish persistent backdoors through carefully crafted symlink attacks. The vulnerability affects the core systemd temporary file management system, meaning any application or service that relies on systemd-tmpfiles for temporary file creation and cleanup becomes vulnerable. This creates a broad attack surface since systemd-tmpfiles is integral to many system operations, including package management, service initialization, and various automated maintenance tasks that require temporary file handling.

Mitigation strategies for CVE-2018-6954 primarily focus on updating to patched versions of systemd where the symlink handling logic has been corrected. System administrators should immediately upgrade to systemd version 238 or later, where the vulnerability has been addressed through improved path validation and symlink handling mechanisms. Additionally, organizations should implement monitoring for unusual temporary file creation patterns and directory manipulation activities that might indicate exploitation attempts. The fix implemented in patched versions addresses the root cause by ensuring proper validation of path components during file creation, preventing the substitution of directories with symbolic links that could alter the intended file system state. Security teams should also review existing system configurations to ensure that fs.protected_symlinks remains enabled and properly configured, though this alone is insufficient to prevent the vulnerability. Organizations should conduct comprehensive vulnerability assessments to identify any systems running affected systemd versions and prioritize remediation efforts based on the criticality of the affected services and the potential attack surface exposure.

Reservation

02/13/2018

Disclosure

02/13/2018

Moderation

accepted

CPE

ready

EPSS

0.00145

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!