pyca / pyca/pynacl

`generichash_blake2b_final()` aborts for a directly constructed state with digest size 65

Open
#964 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.2k
Forks
267
Avg merge
42m
Merged PRs (30d)
2

Description

Summary

nacl.bindings.crypto_generichash.generichash_blake2b_final() aborts the Python process when its Blake2State has a digest size of 65.
This requires constructing the state wrapper directly instead of using generichash_blake2b_init(), which validates the digest size.
I found this while fuzzing Python C extension modules.
This looks like a bug, but please let me know if handling directly constructed states is outside the intended behavior.

Versions

PyNaCl 1.6.2, CPython 3.12.3, Ubuntu 24.04.4 x86_64, glibc 2.39.

Reproducer
from nacl.bindings.crypto_generichash import Blake2State, generichash_blake2b_final

generichash_blake2b_final(Blake2State(65))

This process exited with SIGABRT.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Python reproducer for Blake2State(65), then inspect nacl.bindings.crypto_generichash.generichash_blake2b_final() and the Blake2State wrapper. Done means a directly constructed state with digest size 65 no longer aborts the Python process, with regression coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
cryptography, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.