Bug 15997 (CVE-2026-2340) - [SECURITY] CVE-2026-2340 vfs_worm does not block file overwrite
Summary: [SECURITY] CVE-2026-2340 vfs_worm does not block file overwrite
Status: RESOLVED FIXED
Alias: CVE-2026-2340
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks: 16018
  Show dependency treegraph
 
Reported: 2026-02-11 02:43 UTC by Douglas Bagnall
Modified: 2026-05-26 14:12 UTC (History)
3 users (show)

See Also:


Attachments
Patch suggested by Pavel (1.41 KB, patch)
2026-02-11 02:45 UTC, Douglas Bagnall
no flags Details
patch v2 from Pavel Kohout (1.74 KB, patch)
2026-02-13 02:55 UTC, Douglas Bagnall
no flags Details
patch from Pavel Kohout (v3) (1.75 KB, patch)
2026-02-13 03:10 UTC, Douglas Bagnall
vl: review+
Details
patch v4, with a test (5.01 KB, patch)
2026-02-19 04:26 UTC, Douglas Bagnall
vl: review+
Details
advisory v1 (2.82 KB, text/plain)
2026-02-20 01:44 UTC, Douglas Bagnall
vl: review+
Details
patch for 4.24 (5.01 KB, patch)
2026-02-22 23:36 UTC, Douglas Bagnall
vl: review+
Details
patch for 4.23 (5.41 KB, patch)
2026-02-22 23:37 UTC, Douglas Bagnall
vl: review+
Details
patch for 4.22 (5.41 KB, patch)
2026-02-22 23:37 UTC, Douglas Bagnall
vl: review+
Details
patch for 4.21 (5.51 KB, patch)
2026-02-23 20:14 UTC, Douglas Bagnall
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Bagnall 2026-02-11 02:43:53 UTC
From Pavel Kohout at Aisle Security:


We believe we have identified a flaw in the vfs_worm module that allows overwriting or deleting WORM-protected files via SMB rename with ReplaceIfExists=1, bypassing the intended immutability guarantee after the grace period.

The rename hook only checks the source path; it never validates the destination’s WORM status. A younger file can be renamed over an older, immutable file, effectively deleting/replacing it.

Impact: Integrity breach of WORM-protected data on shares using the worm VFS module with elapsed grace periods. Default installs not using vfs objects = worm are unaffected.

CVSS v3.1 (est.): 5.3 (AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N). Network reachable, low complexity, low privs needed (rename rights), integrity impact high; confidentiality and availability unaffected.
Comment 1 Douglas Bagnall 2026-02-11 02:45:04 UTC
Created attachment 18842 [details]
Patch suggested by Pavel
Comment 2 Douglas Bagnall 2026-02-13 02:55:24 UTC
Created attachment 18843 [details]
patch v2 from Pavel Kohout
Comment 3 Douglas Bagnall 2026-02-13 03:10:08 UTC
Created attachment 18844 [details]
patch from Pavel Kohout (v3)
Comment 4 Douglas Bagnall 2026-02-18 04:22:30 UTC
I had a go with the CVSS 3.1 calculator and came up with 

  CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N  6.5

This is exactly the same string ("AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N") that Aisle report, but they give it a 5.3. 

5.3 is what you'd get by setting the "attack complexity" to high, which doesn't seem right to me. 

I would be more inclined to adjust the integrity impact to low (giving 4.3), given the underlying access controls are unaffected.
Comment 5 disclosure 2026-02-18 10:12:35 UTC
Hi Douglas. Great, looks good to me.
Comment 6 Douglas Bagnall 2026-02-19 04:26:29 UTC
Created attachment 18855 [details]
patch v4, with a test

I added a test.

The fix is not changed.
Comment 7 Douglas Bagnall 2026-02-20 01:44:52 UTC
Created attachment 18858 [details]
advisory v1
Comment 8 Douglas Bagnall 2026-02-22 23:36:26 UTC
Created attachment 18860 [details]
patch for 4.24
Comment 9 Douglas Bagnall 2026-02-22 23:37:12 UTC
Created attachment 18861 [details]
patch for 4.23
Comment 10 Douglas Bagnall 2026-02-22 23:37:43 UTC
Created attachment 18862 [details]
patch for 4.22
Comment 11 Douglas Bagnall 2026-02-22 23:38:32 UTC
I think this is ready for release.
Comment 12 Volker Lendecke 2026-02-23 08:03:54 UTC
What about 4.21? Patch is probably 100% the same though.
Comment 13 Douglas Bagnall 2026-02-23 20:14:18 UTC
Created attachment 18864 [details]
patch for 4.21

Patch for 4.21 will work for 4.20, but not before that (in 4.19 vfs_worm was known to be broken).
Comment 14 Douglas Bagnall 2026-03-05 03:32:15 UTC
Advisory names 4.23.6, which is now out; should be 4.23.7.
Comment 15 Björn Jacke 2026-04-08 16:35:09 UTC
the security release that was scheduled for tomorrow, will be postponed due to
new problems that have been identified with one of the fixes.

We will announce a new release date as soon as possible after the remaining
issues have been ruled out.
Comment 16 Björn Jacke 2026-05-15 13:01:12 UTC
Scheduled release date is now 2026-05-26.
Comment 17 Stefan Metzmacher 2026-05-26 09:15:52 UTC
I plan to upload the releases in about 3 hours from now...
Comment 18 Samba QA Contact 2026-05-26 12:35:23 UTC
This bug was referenced in samba v4-24-stable (Release samba-4.24.3):

4737e7362bf5dbdf4e6969cc958b3142eb5dc2c7
1271956aa97b0d5d7694c7bc80bf1628877beae3
Comment 19 Samba QA Contact 2026-05-26 12:36:11 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.8):

2531119024986bbc18f92d27c47b2d5c8a3b77ce
7962e74737f43749fd3c49ad9eb048dfd0b6d778
Comment 20 Samba QA Contact 2026-05-26 12:36:40 UTC
This bug was referenced in samba v4-22-stable (Release samba-4.22.10):

97f86ccf7d26ea3600739e9de16eb68be64162c3
76d10f4480d981ddef237e447ea48beef430da84
Comment 21 Samba QA Contact 2026-05-26 12:38:44 UTC
This bug was referenced in samba v4-24-test (Release samba-4.24.3):

4737e7362bf5dbdf4e6969cc958b3142eb5dc2c7
1271956aa97b0d5d7694c7bc80bf1628877beae3
Comment 22 Samba QA Contact 2026-05-26 12:39:34 UTC
This bug was referenced in samba v4-23-test (Release samba-4.23.8):

2531119024986bbc18f92d27c47b2d5c8a3b77ce
7962e74737f43749fd3c49ad9eb048dfd0b6d778
Comment 23 Samba QA Contact 2026-05-26 12:40:27 UTC
This bug was referenced in samba v4-22-test (Release samba-4.22.10):

97f86ccf7d26ea3600739e9de16eb68be64162c3
76d10f4480d981ddef237e447ea48beef430da84
Comment 24 Samba QA Contact 2026-05-26 13:55:13 UTC
This bug was referenced in samba master:

39535250fa55eeae9e7bad9c9a2a93d592ad4f79
44b199a35222e1b11d6ee987c4e8046a894484ca