GHSA-VXF9-VWP6-2W43
Sequential-XOR last-stage cancellation bypasses KDF cost (memory-hard hashing defeated for --xor files)
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-VXF9-VWP6-2W43 divulgada · CVSS 6.2 (GitHub) | |
| Remediación | Parche 1.4.6 | openssl_encrypt · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Files encrypted in sequential XOR composition mode (`--xor` / `--use-xor-composition`, on-disk `format_version` 8 or 10) derive a key in which the last stage cancels out. The weakness is only security-relevant for a specific, non-default configuration (see Exploitability below). In that case the key derivation collapses to a single cheap `SHA256(password ‖ salt)`, completely bypassing the configured memory-hard KDF (e.g. Argon2) and allowing offline password guessing at plain-SHA256 speed.
Exploitability — preconditions (important)
The flaw cancels only the last stage of the derivation. It is exploitable only when BOTH of the following hold:
- Exactly one KDF is configured (e.g. Argon2 alone), and
- No prior hashing stage precedes it.
Only then does the cancellation remove the sole expensive stage, leaving just the initial `SHA256(pw‖salt)`.
Neither condition is the default — so default-configured files are NOT exploitable:
- The default uses 3 chained KDFs, and chained hash stages are also on by default.
- With multiple stages the cancellation drops only the *last* one; the surviving earlier KDF/hash snapshots remain XOR'd into the key, so the derivation stays memory-hard. The work factor is marginally reduced (one trailing stage removed), not bypassed.
A file is therefore only at real risk if it was deliberately encrypted with a single KDF and no preceding hash — both departures from the shipped defaults.
Affected configurations
- Affected (on-disk): files written in sequential XOR mode — `format_version ∈ {8, 10}`, produced by the `--xor` / `--use-xor-composition` option, and configured with a single KDF and no prior hashing.
- Not affected: the default sequential-XOR configuration (3 chained KDFs + chained hashes); the default `format_version 9`; Independent XOR (`v11`/`v13` with `xor_mode=independent`); streaming (`v12`); and any single-algorithm (non-XOR) configuration.
Root cause
In sequential XOR mode the key is the XOR of every stage's normalized output snapshot. The code additionally appended the chain's final value to that accumulator — but the final value is identical to the last stage's own snapshot already present in the accumulator, so the two XOR to zero and the last stage drops out of the key:
# xor_accumulator already contains the last stage's snapshot, then:
sequential_result = normalize(final_chain_value) # == last stage's snapshot
xor_accumulator.append(sequential_result) # XORs to 0 -> last stage cancelsImpact
The surviving key material is the initial hash snapshot `SHA256(plaintext-password ‖ original-salt)` — computed *before* the chain runs (not a derived/chained value) — XOR'd with any earlier non-final stage snapshots.
- Single KDF, no prior hash (worst case, non-default): the sole KDF is the last stage, so it cancels entirely. The key equals the cheap initial `SHA256(pw‖salt)`, independent of the configured KDF time/memory cost. Offline cracking proceeds at SHA-256 speed; the advertised memory-hardness provides no protection.
- Multiple stages (incl. the 3-KDF + hashes default): only the last stage cancels. Earlier KDF/hash snapshots survive in the XOR, so the key still depends on memory-hard derivation. The cost is at most marginally reduced (one trailing stage removed), not eliminated.
This is a confidentiality weakness of data at rest: it does not expose plaintext directly, but for the affected non-default configuration it drastically lowers the work factor protecting weak/medium-strength passwords. CWE-916 (Use of Password Hash With Insufficient Computational Effort).
Fix
Resolved by introducing `format_version 13`, which carries an explicit `xor_mode` field and omits the redundant final append so every stage contributes to the key. `--xor` now writes `v13` with `xor_mode=sequential`. Decrypt routing is keyed on the on-disk `xor_mode` field rather than the version number. The legacy v8/v10 derivation is intentionally preserved (append-only) so existing files still decrypt, but they remain weak until re-encrypted.
- 1.5.x fix: commit `fdf0c6fc`
- 1.4.x backport: commit `1c122790`
- Cross-line golden vector confirms v13-sequential keys match between the 1.4.x and 1.5.x implementations.
Mitigation / remediation
- Re-encrypt any `--xor` file that used a single KDF with no prior hashing — this is the only at-risk configuration. Re-encrypting with a patched build writes `v13`.
- Identify affected files with `openssl-encrypt info -i <file>.enc`: look for `xor_mode: sequential` with `format_version` 8/10 and a single-KDF / no-hash derivation config.
- Default-configured files (3 chained KDFs + chained hashes), the default mode, and independent XOR were never at risk and need no action.
- For genuinely affected files, treat the password as having had reduced protection and rotate it where the at-rest file may have been exposed to an adversary.
Discovery
Found during an internal review of the XOR composition modes; fixed before any third-party disclosure. See `SECURITY.md` (ADVISORY 2026-02) and `openssl_encrypt/docs/FORMAT.md` §7.3 / §15 for the format-level details.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypiopenssl_encrypt |
Corregida | 1.4.6 | 0 d | 1.4.9 no afectada |
1.4.6Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/jahlives/openssl_encrypt/security/advisories/GHSA-vxf9-vwp6-2w43Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
