Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 820641 (CVE-2021-30833) - <app-arch/xar-1.8.0.0.487.100.1: Unsafe extraction (CVE-2021-30833)
Summary: <app-arch/xar-1.8.0.0.487.100.1: Unsafe extraction (CVE-2021-30833)
Status: IN_PROGRESS
Alias: CVE-2021-30833
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Security
URL: https://research.nccgroup.com/2021/10...
Whiteboard: B2 [glsa]
Keywords:
Depends on: 865131
Blocks:
  Show dependency tree
 
Reported: 2021-10-29 03:45 UTC by Sam James
Modified: 2024-03-29 12:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-10-29 03:45:27 UTC
This is an interesting one...

https://research.nccgroup.com/2021/10/28/technical-advisory-apple-xar-arbitrary-file-write-cve-2021-30833/

"The XAR archive format supports archiving and extraction of symlinks for both files and directories. When extracting an archive which contains both a directory symlink and a file within a directory named the same as the directory symlink, xar will overwrite the directory symlink with a real directory. This protects against maliciously crafted archives where a symlink directory is unarchived and a file is unarchived into it."

Apparently fixed in latest macOS.
Comment 1 Fabian Groffen gentoo-dev 2021-10-31 15:43:36 UTC
I think the relevant quote for the actual vulnerability is this:

... xar allows for a forward-slash separated path to be specified in the file name property, e.g. <name>x/foo</name> – as long as it doesn’t traverse upwards, and the path exists within the current directory. This means an attacker can create a .xar file which contains both a directory symlink, and a file with a name property which points into the extracted symlink directory. By abusing symlink directories in this manner, an attacker can write arbitrary files to any directory on the filesystem – providing the user has permissions to write to it. ...

Apple didn't release any sources (yet) for macOS 12, let alone 12.0.1 in which this is presumably fixed.
Comment 2 Larry the Git Cow gentoo-dev 2022-07-16 19:35:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f61a854bf04077812644f5a7d1b1ef508bb43d70

commit f61a854bf04077812644f5a7d1b1ef508bb43d70
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2022-07-16 19:34:13 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2022-07-16 19:35:23 +0000

    app-arch/xar-1.8.0.0.487.100.1: version bump, security fix #820641
    
    xar version from macOS 12.3 and up
    
    Bug: https://bugs.gentoo.org/820641
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 app-arch/xar/Manifest                              |  1 +
 .../xar/files/xar-1.8.0.0.487-non-darwin.patch     | 12 +++
 .../xar-1.8.0.0.487-variable-sized-object.patch    | 18 +++++
 app-arch/xar/xar-1.8.0.0.487.100.1.ebuild          | 88 ++++++++++++++++++++++
 4 files changed, 119 insertions(+)
Comment 3 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-07-16 20:36:17 UTC
Please stable when ready
Comment 4 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-08-17 16:00:01 UTC
Please cleanup
Comment 5 Larry the Git Cow gentoo-dev 2022-08-17 19:23:16 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fdfabd0c138da863d6430b3058e98929535f47c1

commit fdfabd0c138da863d6430b3058e98929535f47c1
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2022-08-17 19:22:53 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2022-08-17 19:22:53 +0000

    app-arch/xar: cleanup old/vulnerable
    
    Bug: https://bugs.gentoo.org/820641
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 app-arch/xar/Manifest               |  3 --
 app-arch/xar/xar-1.8-r2.ebuild      | 55 ------------------------
 app-arch/xar/xar-1.8-r4.ebuild      | 81 -----------------------------------
 app-arch/xar/xar-1.8.0.0.452.ebuild | 84 -------------------------------------
 4 files changed, 223 deletions(-)