Skip to content

Fix non-zero IV usages for AES-CFB#2012

Merged
larabr merged 1 commit into
openpgpjs:mainfrom
larabr:fix/aes-cfb-zero-iv
Jun 2, 2026
Merged

Fix non-zero IV usages for AES-CFB#2012
larabr merged 1 commit into
openpgpjs:mainfrom
larabr:fix/aes-cfb-zero-iv

Conversation

@larabr

@larabr larabr commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

(This issue was introduced in OpenPGP.js v6; previous versions are not impacted).

AES-CFB initialization vectors (IVs) were always set to be all zeros, even in cases where a random value was expected.
This did not affect message body encryption or password-encrypted session keys (SKESK), where a zero IV is intentional per spec
(see https://www.rfc-editor.org/rfc/rfc9580.html#section-5.13.1-4 and https://www.rfc-editor.org/rfc/rfc9580.html#section-5.3.1-5).

It did affect password-encrypted keys, for which a random IV should be sampled.
However, there was no security impact.

This is because, while IV reuse is potentially problematic when paired with AES key reuse, that is not the case in this context (i.e. OpenPGP password-based encryption), since a reused password does not automatically produce the same AES input key, since non-legacy S2K ("string-to-key") modes also sample a random salt, meaning the derived key would change even on password reuse. (The random salt generation was performed properly.)

AES-CFB initialization vectors (IVs) were always set to be all zeros, even in
cases where a random value was expected.
This did not affect message body encryption or password-encrypted session keys (SKESK),
where a zero IV is intentional per spec
(see https://www.rfc-editor.org/rfc/rfc9580.html#section-5.13.1-4
and https://www.rfc-editor.org/rfc/rfc9580.html#section-5.3.1-5).

It did affect password-encrypted keys, for which a random IV should be sampled.
However, there was no security impact.

This is because, while IV reuse is potentially problematic when paired with AES
key reuse, that is not the case in this context (i.e. OpenPGP password-based
encryption), since a reused password does not automatically produce the same AES
input key, since non-legacy S2K ("string-to-key") modes also sample a random salt,
meaning the derived key would change even on password reuse.
(The random salt generation was performed properly.)
@larabr larabr merged commit dd9274e into openpgpjs:main Jun 2, 2026
15 checks passed
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