Describe the feature
sealSession() and unsealSession() spread iron-webcrypto's defaults object without overriding the iteration count. The defaults specify iterations: 1 for both encryption and integrity key derivation.
When generateKey() is called with a string password, it performs PBKDF2-SHA1 key derivation using this iteration count. Current OWASP guidance (2023) recommends a minimum of 600,000 PBKDF2-SHA1 iterations for password-derived keys.
The sealed token format exposes the HMAC salt and digest, providing the material needed for offline brute-force of the session password. Benchmarked speeds show ~4,102 attempts/sec with iterations=1 vs ~5.27 attempts/sec with iterations=600000 — a ~677x difference.
Suggested change
Override iron-webcrypto's defaults in sealSession/unsealSession to use at minimum 600,000 PBKDF2 iterations, e.g.:
const sealDefaults = {
...ironDefaults,
encryption: { ...ironDefaults.encryption, iterations: 600_000 },
integrity: { ...ironDefaults.integrity, iterations: 600_000 },
}
Alternatively, consider switching to a stronger KDF like Argon2 or scrypt.
Workaround
Applications can explicitly configure higher iterations today via useSession() config:
useSession(event, {
password: 'my-secret',
seal: {
encryption: { iterations: 600_000 },
integrity: { iterations: 600_000 },
},
})
This option is currently undocumented.
Describe the feature
sealSession()andunsealSession()spread iron-webcrypto'sdefaultsobject without overriding the iteration count. The defaults specifyiterations: 1for both encryption and integrity key derivation.When
generateKey()is called with a string password, it performs PBKDF2-SHA1 key derivation using this iteration count. Current OWASP guidance (2023) recommends a minimum of 600,000 PBKDF2-SHA1 iterations for password-derived keys.The sealed token format exposes the HMAC salt and digest, providing the material needed for offline brute-force of the session password. Benchmarked speeds show ~4,102 attempts/sec with
iterations=1vs ~5.27 attempts/sec withiterations=600000— a ~677x difference.Suggested change
Override iron-webcrypto's defaults in
sealSession/unsealSessionto use at minimum 600,000 PBKDF2 iterations, e.g.:Alternatively, consider switching to a stronger KDF like Argon2 or scrypt.
Workaround
Applications can explicitly configure higher iterations today via
useSession()config:This option is currently undocumented.