Skip to content

RUSTSEC-2026-0486: xattr functions mark unwritten bytes as initialized when given a zero-length buffer #2067

Open

Description

@github-actions

xattr functions mark unwritten bytes as initialized when given a zero-length buffer

Details
Status unsound
Package rustix
Version 1.1.4
URL bytecodealliance/rustix@8e6aaa6
Date 2026-10-27

The extended-attribute functions in rustix::fs (getxattr, lgetxattr, fgetxattr, listxattr, llistxattr and flistxattr) write into a Buffer and then mark as many bytes initialized as the system call reported. When the buffer has zero length, the operating system treats the call as a size query: it writes nothing and returns the size of the attribute value or of the name list. rustix still marked that many bytes as initialized.

Passing a Vec whose length equals its capacity through spare_capacity gives such a zero-length buffer, and rustix then set the vector's length past its capacity over memory that was never written. This is undefined behavior reachable from safe code. With an empty &mut [MaybeUninit<u8>] the call panics instead.

From 1.1.6 these functions return an empty result for a zero-length buffer, and new getxattr_query, lgetxattr_query, fgetxattr_query, listxattr_query, llistxattr_query and flistxattr_query functions return the size. The 0.38 series did not have the Buffer API and is not affected.

See advisory page for additional details.

Activity

  1. added
    A-deps
    A-security
    C-bug
    S-needs-triage
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-depsA-securityC-bugS-needs-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions