Open
fix: CVE-2023-30571 umask race (issue #16) #176
fix: CVE-2023-30571 umask race (issue #16) #176
Open
huijing_zhangAdd on 3 days ago
huijing_zhang
huijing_zhang
3 days ago

Background

issue #16 reported CVE-2023-30571 affects libarchive 3.8.9 in openEuler-26.09.

Analysis

The vulnerable code in archive_write_disk_posix.c:

  • L649 _archive_write_disk_header and L2018 archive_write_disk_new both use umask(a->user_umask = umask(0))
  • This briefly sets the process umask to 0. In a multithreaded process, other threads creating files during this window create them with 0777 permissions.

Upstream never shipped the fix in a release: 3.7.1/3.7.2/3.8.0/3.8.9 all carry the vulnerable form (upstream issue #1876 still open). Fixes only exist on master:

  • 70d36b909ab2 unify helper to read current umask
  • 065488cd453a read umask from /proc/self/status on Linux
  • 8266767d50a2 HAVE_SYS_SINGLE_THREADED_H fast path

Fix

Backport the three upstream master commits as one patch (backport-CVE-2023-30571.patch):

  • new libarchive/archive_umask.c + archive_umask_private.h
  • replaces the 2 process-global umask(0) calls in archive_write_disk_posix.c and 2 in archive_write_disk_windows.c with __archive_get_umask()
  • build system updates (Makefile.am / CMakeLists.txt)

Issue: #16

Verification

  • patch applies cleanly to pristine 3.8.9 tarball (%autosetup -p1)
  • full build via rpmbuild -ba OK (all 8 subpackages)
  • make check: only pre-existing env-related failure (test_extract_tar_absolute_paths fails identically on pristine 3.8.9 as root; passes as non-root; unaffected by this patch)
  • functional check: __archive_get_umask() returns current umask without altering process umask
likedislike
Merge blocked
huijing_zhanghuijing_zhang
3 days ago Created pull request, commit 3121a1de
huijing_zhanghuijing_zhang
3 days ago Associated issue: CVE-2023-30571
openeuler-ci-botopeneuler-ci-botCollaborators
3 days ago Set licihua,dillon_chen,overweight,zhujianwei001,xujing99,shenyangyang as approver
openeuler-ci-botopeneuler-ci-botCollaborators
3 days ago Added label: sig/Base-service
openeuler-ci-bot
openeuler-ci-botCollaborators
3 days ago Comments:

Welcome To openEuler Community

Hey @huijing_zhang , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: Base-service ,
and any of the maintainers: @dillon_chen, @licihua, @overweight, @shenyangyang, @xujing99, @zhujianwei001 ,
and any of the committers: @robert-xingwang, @yanan-rock .

likedislike
openeuler-ci-bot
openeuler-ci-botCollaborators
3 days ago Comments:

当前仓库存在以下 保护分支 :

Protected Branch Version Release
master 3.8.11 1
openEuler-24.03-LTS-SP4 3.7.1 14
openEuler-24.03-LTS-SP3 3.7.1 14
openEuler-24.03-LTS-SP1 3.7.1 14
openEuler-22.03-LTS-SP4 3.5.2 16
openEuler-24.03-LTS-Next 3.7.1 14
openEuler-20.03-LTS-SP4 3.4.3 17
openEuler-26.09 3.8.9 1
openEuler-26.09-DevStation 3.8.9 1
openEuler1.0-base 3.4.1 1
openEuler1.0 3.4.1 1

评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作

注意:

  1. /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
  2. 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭
likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
3 days ago Added label: openeuler-cla/yes
openeuler-bot
openeuler-botCollaborators
3 days ago Comments:

门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/src-openeuler/trigger/libarchive/84

likedislike
openeuler-botopeneuler-botCollaborators
3 days ago Added label: ci_processing
openeuler-bot
openeuler-botCollaborators
3 days ago Comments:

x86_64架构构建及构建后检查:multiarch/src-openeuler/x86-64/libarchive/84

likedislike
openeuler-bot
openeuler-botCollaborators
3 days ago Comments:

aarch64架构构建及构建后检查:multiarch/src-openeuler/aarch64/libarchive/84

likedislike
openeuler-botopeneuler-botCollaborators
3 days ago Removed label: ci_processing
openeuler-bot
openeuler-botCollaborators
3 days ago Comments:
Check Name Build Result 详情 Build Details
check_binary_file ✅SUCCESS #84
check_lfsconfig ☑EXCLUDE
check_package_yaml_file ✅SUCCESS
check_repo_in_maintain ✅SUCCESS
check_consistency ✅SUCCESS
check_spec_file ✅SUCCESS
x86_64 check_build ✅SUCCESS #84
check_install ✅SUCCESS
check_license ✅SUCCESS
aarch64 check_build ✅SUCCESS #84
check_install ✅SUCCESS
check_license ✅SUCCESS
likedislike
openeuler-botopeneuler-botCollaborators
3 days ago Added label: ci_successful
openeuler-bot
openeuler-botCollaborators
3 days ago Comments:

如下为接口变更检查结果,目标分支为openEuler-26.09,请PR提交者check差异信息

Arch Name Check Items Rpm Name Check Result Build Details
compare_package(x86_64) add_rpms ✅SUCCESS #84
delete_rpms ✅SUCCESS
rpm_abi ✅SUCCESS
rpm_cmd ✅SUCCESS
rpm_files ✅SUCCESS
rpm_header ✅SUCCESS
rpm_lib ✅SUCCESS
rpm_provides ✅SUCCESS
rpm_requires ✅SUCCESS
rpm_symbol ✅SUCCESS
compare_package(aarch64) add_rpms ✅SUCCESS #84
delete_rpms ✅SUCCESS
rpm_abi ✅SUCCESS
rpm_cmd ✅SUCCESS
rpm_files ✅SUCCESS
rpm_header ✅SUCCESS
rpm_lib ✅SUCCESS
rpm_provides ✅SUCCESS
rpm_requires ✅SUCCESS
rpm_symbol ✅SUCCESS
likedislike
openeuler-bot
openeuler-botCollaborators
3 days ago Comments:
likedislike
ultra_planet2 days agoStart code review1
backport-CVE-2023-30571.patch
@@ -0,0 +1,0 @@
1+--- a/libarchive/archive_umask.c
ultra_planet2 days agoComments:

保留上游补丁文件头、作者信息,保持原本3个补丁不要合并

likedislike
huijing_zhanghuijing_zhang
1 day ago Pre merge succeeded (commit_id: 1d9707656bc048bdb8ad953f2a7812621fea137c)
huijing_zhanghuijing_zhang
1 day ago Pushed 1 commits:731e67d6-libarchive: add upstream commit reference header to backport-CVE-2023-30571.patch
huijing_zhanghuijing_zhang
1 day ago Pre merge succeeded (commit_id: 9bc80b74c99b137fd559ee20354eddb8829df463)
openeuler-ci-botopeneuler-ci-botCollaborators
1 day ago Added label: stat/needs-squash
openeuler-ci-botopeneuler-ci-botCollaborators
1 day ago Removed label: openeuler-cla/yes
openeuler-ci-botopeneuler-ci-botCollaborators
1 day ago Removed label: ci_successful
openeuler-ci-bot
openeuler-ci-botCollaborators
1 day ago Comments:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci_successful.

likedislike
openeuler-ci-botopeneuler-ci-botCollaborators
1 day ago Added label: openeuler-cla/no
openeuler-bot
openeuler-botCollaborators
1 day ago Comments:

门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/src-openeuler/trigger/libarchive/85

likedislike
openeuler-botopeneuler-botCollaborators
1 day ago Added label: ci_processing
openeuler-bot
openeuler-botCollaborators
1 day ago Comments:

x86_64架构构建及构建后检查:multiarch/src-openeuler/x86-64/libarchive/85

likedislike
openeuler-bot
openeuler-botCollaborators
1 day ago Comments:

aarch64架构构建及构建后检查:multiarch/src-openeuler/aarch64/libarchive/85

likedislike
openeuler-botopeneuler-botCollaborators
1 day ago Removed label: ci_processing
openeuler-bot
openeuler-botCollaborators
1 day ago Comments:
Check Name Build Result 详情 Build Details
check_binary_file ✅SUCCESS #85
check_lfsconfig ☑EXCLUDE
check_package_yaml_file ✅SUCCESS
check_repo_in_maintain ✅SUCCESS
check_consistency ✅SUCCESS
check_spec_file ❌FAILED • libarchive.spec: 本次PR未更新changelog,每次提交都需要添加changelog条目
x86_64 check_build ✅SUCCESS #85
check_install ✅SUCCESS
check_license ✅SUCCESS
aarch64 check_build ✅SUCCESS #85
check_install ✅SUCCESS
check_license ✅SUCCESS
likedislike
openeuler-botopeneuler-botCollaborators
1 day ago Added label: ci_failed
openeuler-bot
openeuler-botCollaborators
1 day ago Comments:

如下为接口变更检查结果,目标分支为openEuler-26.09,请PR提交者check差异信息

Arch Name Check Items Rpm Name Check Result Build Details
compare_package(x86_64) add_rpms ✅SUCCESS #85
delete_rpms ✅SUCCESS
rpm_abi ✅SUCCESS
rpm_cmd ✅SUCCESS
rpm_files ✅SUCCESS
rpm_header ✅SUCCESS
rpm_lib ✅SUCCESS
rpm_provides ✅SUCCESS
rpm_requires ✅SUCCESS
rpm_symbol ✅SUCCESS
compare_package(aarch64) add_rpms ✅SUCCESS #85
delete_rpms ✅SUCCESS
rpm_abi ✅SUCCESS
rpm_cmd ✅SUCCESS
rpm_files ✅SUCCESS
rpm_header ✅SUCCESS
rpm_lib ✅SUCCESS
rpm_provides ✅SUCCESS
rpm_requires ✅SUCCESS
rpm_symbol ✅SUCCESS
likedislike
openeuler-bot
openeuler-botCollaborators
1 day ago Comments:
likedislike
huijing_zhanghuijing_zhang
20 hours ago Pre merge succeeded (commit_id: 5a90a6ee6d8ae62301076df92adc0fa25089b126)
huijing_zhanghuijing_zhang
20 hours ago Force-pushed 1 commits:33bd01b7-libarchive: add upstream commit reference header to backport-CVE-2023-30571.patch
huijing_zhanghuijing_zhang
20 hours ago Pre merge succeeded (commit_id: 5a90a6ee6d8ae62301076df92adc0fa25089b126)
openeuler-ci-botopeneuler-ci-botCollaborators
20 hours ago Removed label: openeuler-cla/no
openeuler-ci-botopeneuler-ci-botCollaborators
20 hours ago Added label: openeuler-cla/yes
openeuler-ci-bot
openeuler-ci-botCollaborators
20 hours ago Comments:

CLA Signature Pass

huijing_zhang, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
openeuler-bot
openeuler-botCollaborators
20 hours ago Comments:

门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/src-openeuler/trigger/libarchive/86

likedislike
openeuler-botopeneuler-botCollaborators
20 hours ago Removed label: ci_failed
openeuler-botopeneuler-botCollaborators
20 hours ago Added label: ci_processing
openeuler-bot
openeuler-botCollaborators
20 hours ago Comments:

x86_64架构构建及构建后检查:multiarch/src-openeuler/x86-64/libarchive/86

likedislike
openeuler-bot
openeuler-botCollaborators
20 hours ago Comments:

aarch64架构构建及构建后检查:multiarch/src-openeuler/aarch64/libarchive/86

likedislike
openeuler-botopeneuler-botCollaborators
20 hours ago Removed label: ci_processing
openeuler-bot
openeuler-botCollaborators
20 hours ago Comments:
Check Name Build Result 详情 Build Details
check_binary_file ✅SUCCESS #86
check_lfsconfig ☑EXCLUDE
check_package_yaml_file ✅SUCCESS
check_repo_in_maintain ✅SUCCESS
check_consistency ✅SUCCESS
check_spec_file ❌FAILED • libarchive.spec: 本次PR未更新changelog,每次提交都需要添加changelog条目
x86_64 check_build ✅SUCCESS #86
check_install ✅SUCCESS
check_license ✅SUCCESS
aarch64 check_build ✅SUCCESS #86
check_install ✅SUCCESS
check_license ✅SUCCESS
likedislike
openeuler-botopeneuler-botCollaborators
20 hours ago Added label: ci_failed
openeuler-bot
openeuler-botCollaborators
20 hours ago Comments:

如下为接口变更检查结果,目标分支为openEuler-26.09,请PR提交者check差异信息

Arch Name Check Items Rpm Name Check Result Build Details
compare_package(x86_64) add_rpms ✅SUCCESS #86
delete_rpms ✅SUCCESS
rpm_abi ✅SUCCESS
rpm_cmd ✅SUCCESS
rpm_files ✅SUCCESS
rpm_header ✅SUCCESS
rpm_lib ✅SUCCESS
rpm_provides ✅SUCCESS
rpm_requires ✅SUCCESS
rpm_symbol ✅SUCCESS
compare_package(aarch64) add_rpms ✅SUCCESS #86
delete_rpms ✅SUCCESS
rpm_abi ✅SUCCESS
rpm_cmd ✅SUCCESS
rpm_files ✅SUCCESS
rpm_header ✅SUCCESS
rpm_lib ✅SUCCESS
rpm_provides ✅SUCCESS
rpm_requires ✅SUCCESS
rpm_symbol ✅SUCCESS
likedislike
openeuler-bot
openeuler-botCollaborators
20 hours ago Comments:
likedislike