Skip to content

Unsoundness in nalgebra's serde Deserialize implementation #880

@Andlon

Description

@Andlon

We recently discovered a soundness issue related to the Deserialize implementation of nalgebra::VecStorage, which is the backing storage for any dynamically sized matrix/vector. nalgebra relies on a certain invariant so that it's sound to avoid some bounds checks in unsafe code. This is at the very least a soundness issue, but I believe it is possible for a malicious attacker to exploit this if an application is using serde to deserialize matrices/vectors from an untrusted source (for example, one can imagine a game or application using serde serialization over the network). By manipulating the input it is possible to induce unsound out-of-bounds reads and writes. As far as I know, this would apply to a wide range of nalgebra versions going back a long time.

Unfortunately I'm strapped for time and not able to file a formal advisory. I hope nonetheless that this issue is useful and adheres to the spirit of this project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions