Skip to content

security: enforce structural validation in RNS deserialization#59

Open
mausamrijal wants to merge 1 commit intogoogle:masterfrom
mausamrijal:fix-des-vulern
Open

security: enforce structural validation in RNS deserialization#59
mausamrijal wants to merge 1 commit intogoogle:masterfrom
mausamrijal:fix-des-vulern

Conversation

@mausamrijal
Copy link
Copy Markdown

This PR implements defensive validation checks during the deserialization of RNS cryptographic objects.
Changes:
RnsRlweCiphertext: Added check to ensure components is not empty, preventing null-pointer/OOB access in LogN().
RnsGaloisKey: Added dimension validation against the gadget parameters to prevent OOB access during key-switching loops.
RnsPolynomial: Added range validation for log_n to prevent undefined behavior from unsafe bit-shifts.
These patches ensure the library returns absl::InvalidArgumentError instead of crashing when encountering malformed serialized inputs. Verified with the included Python PoC.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 19, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@mausamrijal mausamrijal marked this pull request as draft April 19, 2026 14:48
@mausamrijal mausamrijal marked this pull request as ready for review April 19, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants