interplane.Get Omega
Read in your language

open-humanity

Privacy-first peer assistance network for sovereign autonomous agents

Brought by drakestapleton

[CRYPTO-REUSE] Reject non-contributory X25519 results in both peer-encryption helpers

Closed · #30 · open 2026-10-23 10:53 UTC · closed 2026-11-05 23:32 UTC (reason completed)

Imported from GitHub aien-dev/open-humanity#30, by drakestapleton

drakestapleton wrote on 2026-10-23 10:53 UTC

Problem

At main b368ea8f7dcfbc4e7f21d4a9911e4c1c24409440, crates/beacon-core/src/crypto.rs::encrypt_to_peer and decrypt_from_peer use shared_secret.as_bytes() directly as a ChaCha20-Poly1305 key without checking was_contributory(). EphemeralKeyAgreement::agree already refuses non-contributory results and the live transport uses that checked helper.

Part of https://github.com/aien-dev/omega-mv/issues/639. Current evidence is a helper-level finding; searches found helper callers in tests, not a demonstrated live exploit.

Change

Apply the existing contributory-validation rule to both helper paths before constructing/using the cipher. Reuse a small common validation routine where helpful without changing the different secret lifetimes. Keep valid legacy messages interoperable in this fix.

Review direct raw-DH key use and public-key/context binding as a separate compatibility decision. Document the current KDF/AAD limitations and a versioned upgrade path if warranted; do not silently change existing ciphertext interpretation. RFC 7748 section 6.1/7 is the reference: https://www.rfc-editor.org/rfc/rfc7748.

Acceptance

  • Both helpers reject all-zero and other vetted low-order public-key vectors with a typed key-agreement error.
  • Decryption negative control constructs synthetic ciphertext under the predictable all-zero derived key and a low-order ephemeral public key. Current unchecked helper demonstrates the problem; corrected helper refuses at agreement.
  • Removing the check independently from either helper makes the corresponding regression fail for the intended reason.
  • Valid peer round trips and existing session handshake tests remain green.
  • Review caller reachability and any authentication expectations; encryption to a public key alone is not sender identity authentication.
  • No private keys or real payloads in logs/fixtures; source/dependency pins and reproducible local receipts supplied.

No crypto replacement or production key rotation is needed for the contributory-check fix.

No comments.

Sign in to comment