diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc index 8082496a87714e..9de7e40d636d40 100644 --- a/src/crypto/crypto_x509.cc +++ b/src/crypto/crypto_x509.cc @@ -681,6 +681,12 @@ MaybeLocal GetPubKey(Environment* env, const ncrypto::Rsa& rsa) { } MaybeLocal GetModulusString(Environment* env, const BIGNUM* n) { + // FIX: Reject non-positive modulus (zero or negative) + // Addresses issue #63824 + if (n == nullptr || BN_is_zero(n) || BN_is_negative(n)) { + return Undefined(env->isolate()); + } + auto bio = BIOPointer::New(n); if (!bio) [[unlikely]] return {};