Skip to content

Fix BigInteger.modInverse DoS in shipped bundles#653

Open
Kr0emer wants to merge 1 commit intokjur:masterfrom
Kr0emer:fix/modinverse-dos
Open

Fix BigInteger.modInverse DoS in shipped bundles#653
Kr0emer wants to merge 1 commit intokjur:masterfrom
Kr0emer:fix/modinverse-dos

Conversation

@Kr0emer
Copy link
Contributor

@Kr0emer Kr0emer commented Mar 18, 2026

Summary

Fix a denial-of-service issue in the shipped jsrsasign bundles where BigInteger.modInverse(0, odd_modulus) could enter an infinite loop.

What changed

  • Synced bundled bnModInverse implementations with the normalized safe logic already present in source
  • Updated the generated browser and npm bundles affected by the source/bundle desync
  • Added a regression test covering modInverse(0, 9) through the npm entrypoint

Validation

  • Reproduced the hang locally against npm/lib/jsrsasign.js with a timeout-based PoC before the fix
  • Verified the fixed bundle now returns 0 instead of hanging
  • Added and executed a regression test locally with a lightweight harness

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.

1 participant