Skip to content

ahash feature can have surprising implications #23

Description

@nmathewson

tl;dr: If you need to resist hash-collision DoS attacks, and you are using weak-table, you should probably specify your BuildHasher explicitly.

There is a Cargo feature in weak-table called ahash, which changes the default hasher implementation to ahash. The ahash hash function is faster than the standard std::hash::RandomState, but is probably less secure against hash collision DoS attacks on systems without hardware AES.

The trouble arises in larger projects, where some crates may have security requirements for weak-table, and erroneously believe that they are secure because they have not enabled ahash. But the ahash feature may be enabled by some other crate -- or the user may have simply built with --all-features. In either of these cases, every crate will get ahash as its default hasher.

It would probably be better if the ahash feature did not change the default.

Edited: --all-features is not recursive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions