** Description changed:

+ [Impact]
+ 
+  *
+ 
+ [Test Plan]
+ 
+  *
+ 
+ [Where problems could occur]
+ 
+  *
+ 
+ [Other Info]
+ 
+  *
+ 
+ ---original---
  SUMMARY
  
  Since core24 revision 2124 (version 20260824, in latest/stable since 
2026-09-10), the base snap
  ships tar 1.35+dfsg-3ubuntu0.4. Its fix for CVE-2025-45582 
(debian/patches/CVE-2025-45582-*.patch,
  first added in 1.35+dfsg-3ubuntu0.2) extracts archive members through 
gnulib's openat2() wrapper
  with RESOLVE_BENEATH.
  
  snapd's seccomp template denies openat2 with EPERM
  (interfaces/seccomp/template.go):
  
      # Deny openat2 from being used as struct open_how is behind a pointer and 
it
      # may be used to pass suid/sgid mode.
      # openat2 <dirfd> <path> <how> <size>
      ~openat2
  
  gnulib only falls back to its openat()-based emulation when openat2 fails 
with ENOSYS
  (CVE-2025-45582-gnulib-1.patch, gnu/openat2.c):
  
      r = syscall (SYS_openat2, dfd, filename, how, howsize);
      if (! (r < 0 && errno == ENOSYS))
        return r;
  
  So under strict confinement tar can no longer extract any member below the 
top-level directory.
  It fails with "Cannot mkdir: Operation not permitted" / "Cannot open: 
Operation not permitted",
  or with "Permission denied" in devmode. This affects any strictly confined 
core24 snap that runs
  tar, including dpkg-source (dpkg-buildpackage -S for 3.0 (quilt) packages 
always extracts the
  orig tarball).
  
  
  STEPS TO REPRODUCE
  
  1. Use any strictly confined snap with base: core24 and the home plug
  (core24 rev 2124 installed).
  
  2. Create a tarball with a nested path:
  
      mkdir -p ~/t/src/a/b && echo x > ~/t/src/a/b/f && echo y > ~/t/src/top
      tar -C ~/t/src -cf ~/t/t.tar . && mkdir ~/t/out
  
  3. Extract it with core24's tar inside the snap:
  
      snap run --shell <snap> -c '/usr/bin/tar -xf ~/t/t.tar -C ~/t/out'
  
  Expected: extraction succeeds (it does with core24 rev 1643, tar
  1.35+dfsg-3build1).
  
  Actual:
  
      /usr/bin/tar: ./a/b: Cannot mkdir: Operation not permitted
      /usr/bin/tar: ./a/b/f: Cannot open: Operation not permitted
      /usr/bin/tar: Exiting with failure status due to previous errors
  
  Minimal syscall reproducer (static binary run inside the snap):
  
      struct open_how h = {.flags = O_WRONLY|O_CREAT, .mode = 0644, .resolve = 
RESOLVE_BENEATH};
      syscall(SYS_openat2, AT_FDCWD, "d/f", &h, sizeof h);
  
      host:        openat2 -> 3 (ok)
      inside snap: openat2 -> -1 (Operation not permitted)
                   openat  -> 3 (ok)
  
  
  IMPACT
  
  The main affected snap is flamenco (https://github.com/canonical/flamenco), a 
strictly confined
  core24 snap used to build Ubuntu .NET source packages. "flamenco pack" 
extracts the orig tarball
  with tar and then runs "dpkg-buildpackage -S", whose dpkg-source extracts the 
orig tarball again.
  Both now fail inside the snap.
  
  History:
  
  1. flamenco originally bundled its own tar via "stage-packages: tar". That 
tar, taken from the
     noble archive, failed inside the snap with the same "Cannot mkdir/open: 
Permission denied"
     errors.
  
  2. This was worked around in
     
https://github.com/canonical/flamenco/pull/9/changes/c28072bf358749629242c63b5f38b7291d52a4e9
     by removing the bundled tar and calling core24's /usr/bin/tar instead. At 
the time core24
     latest/stable was rev 1643, which ships tar 1.35+dfsg-3build1. That 
version predates the
     CVE-2025-45582 fix, never calls openat2, and extracted correctly under 
confinement.
  
  3. On 2026-09-10 core24 rev 2124 (20260824) was promoted to latest/stable. It 
ships
     tar 1.35+dfsg-3ubuntu0.4, which includes the CVE-2025-45582 fix and 
extracts through openat2.
     Machines picked it up through normal base snap auto-refresh, with no 
change to flamenco and no
     reinstall:
     - fresh CI runners got it immediately, and flamenco-based CI jobs have 
failed since 2026-09-11;
     - a developer machine was only offered the update on 2026-09-28 (snapd 
reported
       "no updates available" for core24 until then) and started failing right 
after the refresh.
  
     The same flamenco build therefore went from working to broken purely 
because the base snap
     changed underneath it. The flamenco-side fix from step 2 cannot help, 
because the tar that now
     calls openat2 is the one in the base snap.
  
  4. core24 20260928 (rev 2236, currently in beta/edge) ships the same tar
     (1.35+dfsg-3ubuntu0.4), so this will not go away with the next core24 
release.
  
  Current workaround in flamenco: an LD_PRELOAD shim that makes 
syscall(SYS_openat2, ...) return
  ENOSYS, so gnulib falls back to its openat()-based emulation. That emulation 
still enforces
  RESOLVE_BENEATH, so the CVE-2025-45582 protection is kept. The shim is only 
needed because
  snapd returns EPERM instead of ENOSYS.
  
  
  SUGGESTED FIX
  
  Return ENOSYS instead of EPERM for openat2 in the default seccomp template 
(for example with
  snapd's errno action syntax, if supported for this rule). Userspace written 
against newer kernels
  treats ENOSYS as "fall back to openat()". That keeps the original concern 
(suid/sgid modes hidden
  behind the open_how pointer) addressed without breaking tar, dpkg-source or 
other gnulib-based
  tools.
  
  
  ENVIRONMENT
  
  - snapd 2.76.3+ubuntu24.04 (snap rev 27738)
  - core24 20260824 (rev 2124), tar 1.35+dfsg-3ubuntu0.4
  - Ubuntu 24.04.5 LTS, kernel 7.0.0-34-generic
  - Also reproduced on GitHub Actions ubuntu-24.04 runners (kernel 
6.17.0-1022-azure)
  - Confinement: strict (EPERM) and devmode (EACCES)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2168888

Title:
  seccomp: denying openat2 with EPERM breaks GNU tar (CVE-2025-45582
  fix) in core24 snaps

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapd/+bug/2168888/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to