mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-28 06:46:42 -04:00
security: add O_NOFOLLOW to native protocol lock file creation
File and Resource Handling: Medium The lock_socket() function opens the lock file without O_NOFOLLOW. If an attacker places a symlink at the lock file path, open() follows it and creates or truncates a file at the symlink target with the caller's privileges. While the lock path is typically in a user-owned runtime directory, adding O_NOFOLLOW is a low-cost defense-in-depth measure that prevents symlink attacks in case the directory permissions are misconfigured or the path is influenced by untrusted input. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
613b35eedf
commit
95ef466b9b
1 changed files with 1 additions and 1 deletions
|
|
@ -776,7 +776,7 @@ static int lock_socket(struct server *s)
|
||||||
|
|
||||||
snprintf(s->lock_addr, sizeof(s->lock_addr), "%s%s", s->addr.sun_path, LOCK_SUFFIX);
|
snprintf(s->lock_addr, sizeof(s->lock_addr), "%s%s", s->addr.sun_path, LOCK_SUFFIX);
|
||||||
|
|
||||||
s->fd_lock = open(s->lock_addr, O_CREAT | O_CLOEXEC,
|
s->fd_lock = open(s->lock_addr, O_CREAT | O_CLOEXEC | O_NOFOLLOW,
|
||||||
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
|
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
|
||||||
|
|
||||||
if (s->fd_lock < 0) {
|
if (s->fd_lock < 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue