public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/flatpak] f43: Fix CVE-2026-96808
@ 2026-10-23 22:25 Adrian Vovk
0 siblings, 0 replies; only message in thread
From: Adrian Vovk @ 2026-10-23 22:25 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/flatpak
Branch : f43
Commit : 66d1135c614222b9b831f4ebb38124e02231a15f
Author : Adrian Vovk <avovk@redhat.com>
Date : 2026-10-23T18:22:16-04:00
Stats : +544/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/flatpak/c/66d1135c614222b9b831f4ebb38124e02231a15f?branch=f43
Log:
Fix CVE-2026-96808
rhbz#2539622
---
diff --git a/CVE-2026-96808.patch b/CVE-2026-96808.patch
new file mode 100644
index 0000000..9a64fe2
--- /dev/null
+++ b/CVE-2026-96808.patch
@@ -0,0 +1,538 @@
+From 37fb84ec00005ce3e368f7a5afb9743aedea24a2 Mon Sep 17 00:00:00 2001
+From: Sebastian Wick <sebastian.wick@redhat.com>
+Date: Wed, 29 Jul 2026 21:10:32 +0200
+Subject: [PATCH] revokefs: Avoid symlink path traversal out of basefd in
+ simple cases
+
+Use glnx_chaseat to ensure that all the attacker-controlled paths end up
+inside the basefd directory.
+
+This requires some new helper functions, which will be used in more
+complicated syscalls' implementations in subsequent commits.
+
+[smcv: Separated from a larger commit for better reviewability]
+Co-authored-by: Simon McVittie <smcv@collabora.com>
+Helps: https://github.com/flatpak/flatpak/security/advisories/GHSA-qrwq-7qwx-q9rp
+---
+ revokefs/writer.c | 106 +++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 85 insertions(+), 21 deletions(-)
+
+diff --git a/revokefs/writer.c b/revokefs/writer.c
+index 2861487460..a380539479 100644
+--- a/revokefs/writer.c
++++ b/revokefs/writer.c
+@@ -198,6 +198,64 @@ request_path_path (int writer_socket, RevokefsOps op, const char *path1, const c
+ return request_path_data (writer_socket, op, path1, path2, strlen(path2), 0);
+ }
+
++/* Return an fd to the parent directory of path guaranteed to be under
++ * basefd, and set *out_name to the final path component. */
++static int
++chase_parent (guchar *data, size_t len, char **out_name)
++{
++ g_autofree char *path = g_strndup ((const char *) data, len);
++ g_autofree char *parent = NULL;
++ g_autofree char *name = NULL;
++ const char *last_slash;
++ int fd;
++
++ if (*path == '/' || *path == 0)
++ {
++ g_printerr ("Invalid path: %s\n", path);
++ exit (1);
++ }
++
++ last_slash = strrchr (path, '/');
++ if (last_slash)
++ {
++ parent = g_strndup (path, last_slash - path);
++ name = g_strdup (last_slash + 1);
++ }
++ else
++ {
++ parent = g_strdup (".");
++ name = g_strdup (path);
++ }
++
++ if (name[0] == 0 || strcmp (name, ".") == 0 || strcmp (name, "..") == 0)
++ {
++ g_printerr ("Invalid path: %s\n", path);
++ exit (1);
++ }
++
++ fd = glnx_chaseat (basefd, parent,
++ GLNX_CHASE_RESOLVE_BENEATH |
++ GLNX_CHASE_MUST_BE_DIRECTORY,
++ NULL);
++ if (fd < 0)
++ {
++ g_printerr ("Path escapes base directory: %s\n", path);
++ exit (1);
++ }
++
++ if (out_name != NULL)
++ *out_name = g_steal_pointer (&name);
++ return fd;
++}
++
++static int
++chase_request_path (RevokefsRequest *request,
++ gsize data_size,
++ char **out_name)
++{
++ return chase_parent (request->data, data_size, out_name);
++}
++
+ static gboolean
+ validate_path (char *path)
+ {
+@@ -282,10 +340,11 @@ handle_mkdir (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
+ int mode = request->arg1;
+
+- if (mkdirat (basefd, path, mask_mode (mode)) == -1)
++ if (mkdirat (parent_fd, name, mask_mode (mode)) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+@@ -304,9 +363,10 @@ handle_rmdir (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
+
+- if (unlinkat (basefd, path, AT_REMOVEDIR) == -1)
++ if (unlinkat (parent_fd, name, AT_REMOVEDIR) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+@@ -325,9 +385,10 @@ handle_unlink (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
+
+- if (unlinkat (basefd, path, 0) == -1)
++ if (unlinkat (parent_fd, name, 0) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+@@ -450,11 +511,12 @@ handle_chown (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
+ uid_t uid = request->arg1;
+ gid_t gid = request->arg2;
+
+- if (fchownat (basefd, path, uid, gid, AT_SYMLINK_NOFOLLOW) != 0)
++ if (fchownat (parent_fd, name, uid, gid, AT_SYMLINK_NOFOLLOW) != 0)
+ response->result = -errno;
+ else
+ response->result = 0;
+@@ -473,10 +535,12 @@ handle_truncate (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
+ off_t size = request->arg1;
++ glnx_autofd int fd = -1;
+
+- glnx_autofd int fd = openat (basefd, path, O_NOFOLLOW|O_WRONLY);
++ fd = openat (parent_fd, name, O_NOFOLLOW | O_WRONLY);
+ if (fd == -1)
+ response->result = -errno;
+ else
+@@ -501,7 +565,8 @@ handle_utimens (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = NULL;
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = -1;
+ struct timespec *tv;
+
+ if (request->arg1 + sizeof (struct timespec) * 2 != data_size)
+@@ -510,10 +575,10 @@ handle_utimens (RevokefsRequest *request,
+ exit (1);
+ }
+
+- path = get_valid_path (request->data, request->arg1);
++ parent_fd = chase_request_path (request, request->arg1, &name);
+ tv = (struct timespec *)(request->data + request->arg1);
+
+- if (utimensat (basefd, path, tv, AT_SYMLINK_NOFOLLOW) == -1)
++ if (utimensat (parent_fd, name, tv, AT_SYMLINK_NOFOLLOW) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+@@ -533,16 +598,14 @@ handle_open (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
+ int mode = request->arg1;
+ int flags = request->arg2;
+ int fd;
+
+-
+- /* We need to specially handle O_TRUNC. Also, Fuse should have already
+- * resolved symlinks, but use O_NOFOLLOW to be safe to avoid following
+- * symlinks to some other filesystem. */
+- fd = openat (basefd, path, (flags & ~O_TRUNC) | O_NOFOLLOW, mask_mode (mode));
++ /* We handle O_TRUNC separately, a bit later */
++ fd = openat (parent_fd, name, (flags & ~O_TRUNC) | O_NOFOLLOW, mask_mode (mode));
+ if (fd == -1)
+ response->result = -errno;
+ else
+@@ -747,14 +810,15 @@ handle_access (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
+ int mode = request->arg1;
+
+ /* Apparently at least GNU coreutils rm calls `faccessat(W_OK)`
+ * before trying to do an unlink. So...we'll just lie about
+ * writable access here.
+ */
+- if (faccessat (basefd, path, mode, AT_SYMLINK_NOFOLLOW) == -1)
++ if (faccessat (parent_fd, name, mode, AT_SYMLINK_NOFOLLOW) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+
+
+From 4d1eb212237069681b1f994e2b5b61e40015050f Mon Sep 17 00:00:00 2001
+From: Sebastian Wick <sebastian.wick@redhat.com>
+Date: Wed, 29 Jul 2026 21:10:32 +0200
+Subject: [PATCH] revokefs: Avoid symlink path traversal in link(), rename()
+
+Again, use glnx_chaseat to ensure that all the attacker-controlled paths
+end up inside the basefd directory. These two syscalls are a bit more
+complicated, and take two paths.
+
+[smcv: Separated from a larger commit for better reviewability]
+Co-authored-by: Simon McVittie <smcv@collabora.com>
+Helps: https://github.com/flatpak/flatpak/security/advisories/GHSA-qrwq-7qwx-q9rp
+---
+ revokefs/writer.c | 57 +++++++++++++++++++++++++++--------------------
+ 1 file changed, 33 insertions(+), 24 deletions(-)
+
+diff --git a/revokefs/writer.c b/revokefs/writer.c
+index a380539479..2f07f2d0ba 100644
+--- a/revokefs/writer.c
++++ b/revokefs/writer.c
+@@ -256,6 +256,23 @@ chase_request_path (RevokefsRequest *request,
+ return chase_parent (request->data, data_size, out_name);
+ }
+
++static void
++chase_request_2path (RevokefsRequest *request,
++ gsize data_size,
++ int *out_fd1, char **out_name1,
++ int *out_fd2, char **out_name2)
++{
++ if (request->arg1 >= data_size)
++ {
++ g_printerr ("Invalid path1 size\n");
++ exit (1);
++ }
++
++ *out_fd1 = chase_parent (request->data, request->arg1, out_name1);
++ *out_fd2 = chase_parent (request->data + request->arg1,
++ data_size - request->arg1, out_name2);
++}
++
+ static gboolean
+ validate_path (char *path)
+ {
+@@ -319,22 +336,6 @@ get_any_path_and_valid_path (RevokefsRequest *request,
+ *valid_path2 = get_valid_path (request->data + request->arg1, data_size - request->arg1);
+ }
+
+-static void
+-get_valid_2path (RevokefsRequest *request,
+- gsize data_size,
+- char **path1,
+- char **path2)
+-{
+- if (request->arg1 >= data_size)
+- {
+- g_printerr ("Invalid path1 size\n");
+- exit (1);
+- }
+-
+- *path1 = get_valid_path (request->data, request->arg1);
+- *path2 = get_valid_path (request->data + request->arg1, data_size - request->arg1);
+-}
+-
+ static ssize_t
+ handle_mkdir (RevokefsRequest *request,
+ gsize data_size,
+@@ -432,12 +433,16 @@ handle_link (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *from = NULL;
+- g_autofree char *to = NULL;
++ g_autofree char *from_name = NULL;
++ g_autofree char *to_name = NULL;
++ glnx_autofd int from_parent_fd = -1;
++ glnx_autofd int to_parent_fd = -1;
+
+- get_valid_2path (request, data_size, &from, &to);
++ chase_request_2path (request, data_size,
++ &from_parent_fd, &from_name,
++ &to_parent_fd, &to_name);
+
+- if (linkat (basefd, from, basefd, to, 0) == -1)
++ if (linkat (from_parent_fd, from_name, to_parent_fd, to_name, 0) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+@@ -456,14 +461,18 @@ handle_rename (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *from = NULL;
+- g_autofree char *to = NULL;
++ g_autofree char *from_name = NULL;
++ g_autofree char *to_name = NULL;
++ glnx_autofd int from_parent_fd = -1;
++ glnx_autofd int to_parent_fd = -1;
+ unsigned int flags;
+
+- get_valid_2path (request, data_size, &from, &to);
++ chase_request_2path (request, data_size,
++ &from_parent_fd, &from_name,
++ &to_parent_fd, &to_name);
+ flags = (unsigned int)request->arg2;
+
+- if (renameat2 (basefd, from, basefd, to, flags) == -1)
++ if (renameat2 (from_parent_fd, from_name, to_parent_fd, to_name, flags) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+
+
+From 076f77a4775490b2aef43f4e01eeee9aa965bd21 Mon Sep 17 00:00:00 2001
+From: Sebastian Wick <sebastian.wick@redhat.com>
+Date: Wed, 29 Jul 2026 21:10:32 +0200
+Subject: [PATCH] revokefs: Avoid symlink path traversal in symlink()
+
+Use glnx_chaseat to ensure that the attacker-controlled symlink name
+ends up inside the basefd directory. Note that the symlink *target* is
+also attacker-controlled, but it's OK for them to be able to set any
+target of their choice: that can't immediately cause traversal outside
+the base directory.
+
+[smcv: Separated from a larger commit for better reviewability]
+Co-authored-by: Simon McVittie <smcv@collabora.com>
+Helps: https://github.com/flatpak/flatpak/security/advisories/GHSA-qrwq-7qwx-q9rp
+---
+ revokefs/writer.c | 42 ++++++++++++++++++++++--------------------
+ 1 file changed, 22 insertions(+), 20 deletions(-)
+
+diff --git a/revokefs/writer.c b/revokefs/writer.c
+index 2f07f2d0ba..f312c2142d 100644
+--- a/revokefs/writer.c
++++ b/revokefs/writer.c
+@@ -273,6 +273,23 @@ chase_request_2path (RevokefsRequest *request,
+ data_size - request->arg1, out_name2);
+ }
+
++static void
++chase_request_any_and_path (RevokefsRequest *request,
++ gsize data_size,
++ char **out_any_path,
++ int *out_fd, char **out_name)
++{
++ if (request->arg1 >= data_size)
++ {
++ g_printerr ("Invalid path1 size\n");
++ exit (1);
++ }
++
++ *out_any_path = g_strndup ((const char *) request->data, request->arg1);
++ *out_fd = chase_parent (request->data + request->arg1,
++ data_size - request->arg1, out_name);
++}
++
+ static gboolean
+ validate_path (char *path)
+ {
+@@ -320,22 +337,6 @@ mask_mode (int mode)
+ return mode & ~S_ISUID & ~S_ISGID & ~(S_IWGRP | S_IWOTH);
+ }
+
+-static void
+-get_any_path_and_valid_path (RevokefsRequest *request,
+- gsize data_size,
+- char **any_path1,
+- char **valid_path2)
+-{
+- if (request->arg1 >= data_size)
+- {
+- g_printerr ("Invalid path1 size\n");
+- exit (1);
+- }
+-
+- *any_path1 = g_strndup ((const char *) request->data, request->arg1);
+- *valid_path2 = get_valid_path (request->data + request->arg1, data_size - request->arg1);
+-}
+-
+ static ssize_t
+ handle_mkdir (RevokefsRequest *request,
+ gsize data_size,
+@@ -409,12 +410,13 @@ handle_symlink (RevokefsRequest *request,
+ RevokefsResponse *response)
+ {
+ g_autofree char *from = NULL;
+- g_autofree char *to = NULL;
++ g_autofree char *to_name = NULL;
++ glnx_autofd int to_parent_fd = -1;
+
+- /* from doesn't have to be a valid path, it can be absolute or whatever */
+- get_any_path_and_valid_path (request, data_size, &from, &to);
++ chase_request_any_and_path (request, data_size,
++ &from, &to_parent_fd, &to_name);
+
+- if (symlinkat (from, basefd, to) == -1)
++ if (symlinkat (from, to_parent_fd, to_name) == -1)
+ response->result = -errno;
+ else
+ response->result = 0;
+
+
+From 769ad563bae82b948496a7edffa5eb3f71d0cc72 Mon Sep 17 00:00:00 2001
+From: Sebastian Wick <sebastian.wick@redhat.com>
+Date: Wed, 29 Jul 2026 21:10:32 +0200
+Subject: [PATCH] revokefs: Avoid symlink path traversal in chmod()
+
+Use glnx_chaseat to ensure that all the attacker-controlled paths end up
+inside the basefd directory, and then AT_SYMLINK_NOFOLLOW to make sure
+that the last path component won't escape from the basefd.
+
+On kernels >= 6.6 we can now use fchmodat() with AT_SYMLINK_NOFOLLOW,
+but on older kernels that didn't work, so if necessary fall back to
+opening the file with O_NOFOLLOW and then calling fchmod() on it.
+
+Because this is the last syscall that used the previous (flawed)
+validation mechanism, we can now remove the validation helpers and be
+sure that everything is using the glnx-chaseat()-based replacements.
+
+[smcv: Separated from a larger commit for better reviewability]
+Co-authored-by: Simon McVittie <smcv@collabora.com>
+Resolves: https://github.com/flatpak/flatpak/security/advisories/GHSA-qrwq-7qwx-q9rp
+---
+ revokefs/writer.c | 69 +++++++++++++++--------------------------------
+ 1 file changed, 21 insertions(+), 48 deletions(-)
+
+diff --git a/revokefs/writer.c b/revokefs/writer.c
+index f312c2142d..e30ade8331 100644
+--- a/revokefs/writer.c
++++ b/revokefs/writer.c
+@@ -290,46 +290,6 @@ chase_request_any_and_path (RevokefsRequest *request,
+ data_size - request->arg1, out_name);
+ }
+
+-static gboolean
+-validate_path (char *path)
+-{
+- char *end_segment;
+-
+- /* No absolute or empty paths */
+- if (*path == '/' || *path == 0)
+- return FALSE;
+-
+- while (*path != 0)
+- {
+- end_segment = strchr (path, '/');
+- if (end_segment == NULL)
+- end_segment = path + strlen (path);
+-
+- if (strncmp (path, "..", 2) == 0)
+- return FALSE;
+-
+- path = end_segment;
+- while (*path == '/')
+- path++;
+- }
+-
+- return TRUE;
+-}
+-
+-static char *
+-get_valid_path (guchar *data, size_t len)
+-{
+- char *path = g_strndup ((const char *) data, len);
+-
+- if (!validate_path (path))
+- {
+- g_printerr ("Invalid path argument %s\n", path);
+- exit (1);
+- }
+-
+- return path;
+-}
+-
+ static int
+ mask_mode (int mode)
+ {
+@@ -496,17 +456,30 @@ handle_chmod (RevokefsRequest *request,
+ gsize data_size,
+ RevokefsResponse *response)
+ {
+- g_autofree char *path = get_valid_path (request->data, data_size);
++ g_autofree char *name = NULL;
++ glnx_autofd int parent_fd = chase_request_path (request, data_size, &name);
++ glnx_autofd int fd = -1;
+ int mode = request->arg1;
+
+- /* Note we can't use AT_SYMLINK_NOFOLLOW yet;
+- * https://marc.info/?l=linux-kernel&m=148830147803162&w=2
+- * https://marc.info/?l=linux-fsdevel&m=149193779929561&w=2
+- */
+- if (fchmodat (basefd, path, mask_mode (mode), 0) != 0)
+- response->result = -errno;
++ if (fchmodat (parent_fd, name, mask_mode (mode), AT_SYMLINK_NOFOLLOW) == 0)
++ {
++ response->result = 0;
++ }
++ else if (errno == ENOTSUP)
++ {
++ /* Linux < 6.6 didn't implement fchmodat() with AT_SYMLINK_NOFOLLOW */
++ fd = openat (parent_fd, name, O_RDONLY | O_NOFOLLOW | O_NONBLOCK | O_CLOEXEC);
++ if (fd == -1)
++ response->result = -errno;
++ else if (fchmod (fd, mask_mode (mode)) != 0)
++ response->result = -errno;
++ else
++ response->result = 0;
++ }
+ else
+- response->result = 0;
++ {
++ response->result = -errno;
++ }
+
+ return 0;
+ }
diff --git a/flatpak.spec b/flatpak.spec
index 96c90f9..e5d0a96 100644
--- a/flatpak.spec
+++ b/flatpak.spec
@@ -12,7 +12,7 @@
Name: flatpak
Version: 1.16.6
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Application deployment framework for desktop apps
License: LGPL-2.1-or-later
@@ -24,6 +24,8 @@ Source0: https://github.com/flatpak/flatpak/releases/download/%{version}/
Source1: flatpak-add-fedora-repos.service
%endif
+Patch0: CVE-2026-96808.patch
+
# ostree not on i686 for RHEL 10
# https://github.com/containers/composefs/pull/229#issuecomment-1838735764
%if 0%{?rhel} >= 10
@@ -290,6 +292,9 @@ fi
%changelog
+* Fri Oct 23 2026 Adrian Vovk <avovk@redhat.com> - 1.16.6-2
+- Fix CVE-2026-96808
+
* Fri Apr 10 2026 Michael Catanzaro <mcatanzaro@redhat.com> - 1.16.6-1
- Update to 1.16.6
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-23 22:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 22:25 [rpms/flatpak] f43: Fix CVE-2026-96808 Adrian Vovk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox