The vulnerability allows an attacker to perform infinite encryptions because the cipher object in Deno's implementation of the node:crypto module was not being properly finalized. The analysis of the patch that fixes this vulnerability confirms this. The commit 0bc213b15b819597d935be6cb04cec03659d146b introduces a state-tracking mechanism to the Cipheriv and Decipheriv classes in ext/node/polyfills/internal/crypto/cipher.ts.
A new private field #finalized is added to both classes. This flag is set to true within the final() method of each class. Subsequently, both the update() and final() methods are modified to check the state of this #finalized flag at the beginning of their execution. If the flag is true, indicating that the cipher/decipher has already been finalized, the methods now throw an ERR_CRYPTO_INVALID_STATE error, preventing any further operations.
The vulnerable functions are the update and final methods of the Cipheriv and Decipheriv classes, as they were the ones that lacked the necessary state check, allowing them to be called on an already finalized object, which is the root cause of the vulnerability.