CVE-2026-35340
Description
A flaw in the ChownExecutor used by uutils coreutils chown and chgrp causes the utilities to return an incorrect exit code during recursive operations. The final exit code is determined only by the last file processed. If the last operation succeeds, the command returns 0 even if earlier ownership or group changes failed due to permission errors. This can lead to security misconfigurations where administrative scripts incorrectly assume that ownership has been successfully transferred across a directory tree.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
coreutilscrates.io | < 0.6.0 | 0.6.0 |
Affected products
2Patches
1ebc08af9c341Chgrp correct exit code (#10035)
2 files changed · +25 −2
src/uucore/src/lib/features/perms.rs+2 −2 modified@@ -619,7 +619,6 @@ impl ChownExecutor { ); continue; } - ret = match wrap_chown( path, &meta, @@ -632,7 +631,8 @@ impl ChownExecutor { if !n.is_empty() { show_error!("{n}"); } - 0 + // retain previous errors + ret.max(0) } Err(e) => { if self.verbosity.level != VerbosityLevel::Silent {
tests/by-util/test_chgrp.rs+23 −0 modified@@ -640,3 +640,26 @@ fn test_chgrp_recursive_on_file() { current_gid ); } + +#[test] +fn test_chgrp_exit_code_not_being_overwritten_by_last_file() { + use std::os::unix::prelude::PermissionsExt; + + let current_gid = getegid(); + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("dir"); + at.mkdir("dir/a"); + at.mkdir("dir/b"); + at.touch("dir/b/file"); + at.touch("dir/a/file"); + std::fs::set_permissions(at.plus("dir/a"), PermissionsExt::from_mode(0o0000)).unwrap(); + + // chgrp walks the dir alphabetically. Dir a does not have permissions so it fails, dir b does have + // permissions so it succeeds. We check that the overall command does fail although the + // last step succeeded. + + ucmd.arg("-R") + .arg(current_gid.to_string()) + .arg("dir") + .fails(); +}
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/uutils/coreutils/pull/10035nvdIssue TrackingPatchWEB
- github.com/advisories/GHSA-88ch-q68x-36v7ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-35340ghsaADVISORY
- github.com/uutils/coreutils/commit/ebc08af9c34138f474b32ea0ef34bed3b086a3edghsaWEB
- github.com/uutils/coreutils/releases/tag/0.6.0nvdRelease NotesWEB
News mentions
0No linked articles in our index yet.