Skip to content

Reject null bytes in sign in credentials - #5870

Open
simi wants to merge 1 commit into
heartcombo:mainfrom
simi:reject-null-byte-credentials
Open

simi wants to merge 1 commit into
heartcombo:mainfrom
simi:reject-null-byte-credentials

Conversation

@simi

@simi simi commented Oct 12, 2026 •

Copy link
Copy Markdown

Security scanners often send a null byte in login fields and report the resulting error as a security issue. In Devise this can raise ArgumentError in BCrypt, including the dummy hash in paranoid mode, and PostgreSQL rejects null bytes in the user lookup.

This rejects null bytes in the password and authentication keys early, as a normal failed login. Rejecting them at the input boundary is common practice. Django does it for all form fields (ticket #28201), and PHP's fix for CVE-2024-3096 recommends the same.

Fail authentication when the password or an authentication key contains a null byte, before any database lookup or BCrypt call.
@simi
simi marked this pull request as ready for review October 12, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant