Skip to content

fix(aztec-nr): reject infinity ephemeral key in message encryption - #24665

Merged
nventuro merged 1 commit into
merge-train/fairies-v5from
nchamo/f-799-aztec-packages-zeroinfinity-ephemeral-key-accepted-in
Jul 14, 2026
Merged

fix(aztec-nr): reject infinity ephemeral key in message encryption#24665
nventuro merged 1 commit into
merge-train/fairies-v5from
nchamo/f-799-aztec-packages-zeroinfinity-ephemeral-key-accepted-in

Conversation

@nchamo

@nchamo nchamo commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Problem

When encrypting a message, the ephemeral secret key comes from an unconstrained routine, so a malicious sender can substitute any value while proving. Substituting eph_sk = 0 yields the point at infinity as the ephemeral public key, which passed the y-sign check: its y-coordinate is 0, which counts as positive. Its x-coordinate (0) is then broadcast, but 0 is not a valid x-coordinate on the curve, so the recipient can never reconstruct the key and the message is permanently undecryptable. This breaks the constrained-delivery guarantee that a note delivered by an untrusted sender remains decryptable by the recipient.

Fix

generate_positive_ephemeral_key_pair now asserts the ephemeral public key is not the point at infinity, alongside the existing sign check. A test emulates the substitution by mocking the randomness oracle to return 0.

Fixes F-799

@nchamo nchamo self-assigned this Jul 13, 2026
@nchamo nchamo added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure labels Jul 13, 2026
@nchamo
nchamo marked this pull request as ready for review July 13, 2026 20:25
@nchamo
nchamo requested a review from nventuro as a code owner July 13, 2026 20:25
Comment on lines +42 to 43
assert(!eph_pk.is_infinite(), "Ephemeral public key is the point at infinity");
assert(get_sign_of_point(eph_pk), "Got an ephemeral public key with a negative y coordinate");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If infinite points will be more generally disallowed, perhaps we should eventually make fns like get_sign_of_point reject them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also validate as part of a type, thus making no infinite points an invariant of working with that type.

@nventuro
nventuro merged commit 47c30a1 into merge-train/fairies-v5 Jul 14, 2026
40 of 44 checks passed
@nventuro
nventuro deleted the nchamo/f-799-aztec-packages-zeroinfinity-ephemeral-key-accepted-in branch July 14, 2026 02:53
PhilWindle pushed a commit that referenced this pull request Jul 21, 2026
…24665)

## Problem

When encrypting a message, the ephemeral secret key comes from an
unconstrained routine, so a malicious sender can substitute any value
while proving. Substituting `eph_sk = 0` yields the point at infinity as
the ephemeral public key, which passed the y-sign check: its
y-coordinate is 0, which counts as positive. Its x-coordinate (0) is
then broadcast, but 0 is not a valid x-coordinate on the curve, so the
recipient can never reconstruct the key and the message is permanently
undecryptable. This breaks the constrained-delivery guarantee that a
note delivered by an untrusted sender remains decryptable by the
recipient.

## Fix

`generate_positive_ephemeral_key_pair` now asserts the ephemeral public
key is not the point at infinity, alongside the existing sign check. A
test emulates the substitution by mocking the randomness oracle to
return 0.

Fixes F-799

(cherry picked from commit 47c30a1)
PhilWindle pushed a commit that referenced this pull request Jul 21, 2026
…24665)

## Problem

When encrypting a message, the ephemeral secret key comes from an
unconstrained routine, so a malicious sender can substitute any value
while proving. Substituting `eph_sk = 0` yields the point at infinity as
the ephemeral public key, which passed the y-sign check: its
y-coordinate is 0, which counts as positive. Its x-coordinate (0) is
then broadcast, but 0 is not a valid x-coordinate on the curve, so the
recipient can never reconstruct the key and the message is permanently
undecryptable. This breaks the constrained-delivery guarantee that a
note delivered by an untrusted sender remains decryptable by the
recipient.

## Fix

`generate_positive_ephemeral_key_pair` now asserts the ephemeral public
key is not the point at infinity, alongside the existing sign check. A
test emulates the substitution by mocking the randomness oracle to
return 0.

Fixes F-799

(cherry picked from commit 47c30a1)
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
…ztecProtocol#24665)

## Problem

When encrypting a message, the ephemeral secret key comes from an
unconstrained routine, so a malicious sender can substitute any value
while proving. Substituting `eph_sk = 0` yields the point at infinity as
the ephemeral public key, which passed the y-sign check: its
y-coordinate is 0, which counts as positive. Its x-coordinate (0) is
then broadcast, but 0 is not a valid x-coordinate on the curve, so the
recipient can never reconstruct the key and the message is permanently
undecryptable. This breaks the constrained-delivery guarantee that a
note delivered by an untrusted sender remains decryptable by the
recipient.

## Fix

`generate_positive_ephemeral_key_pair` now asserts the ephemeral public
key is not the point at infinity, alongside the existing sign check. A
test emulates the substitution by mocking the randomness oracle to
return 0.

Fixes F-799

(cherry picked from commit 47c30a1)
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
…ztecProtocol#24931)

Forward-ports the **noir / aztec-nr / contracts** slice of the v5-next →
next backlog (work merged to `v5-next` after the ~2026-07-08 cut that
reshaped `next`).

## Applied (clean cherry-picks, chronological)
- fix: prevent reception of messages too far into the future (AztecProtocol#24645)
- fix(aztec-nr): reject infinity ephemeral key in message encryption
(AztecProtocol#24665)
- fix(aztec-nr): tolerate malformed partial-note completion logs
(AztecProtocol#24668)
- docs(aztec-nr): document partial note completion trust model (AztecProtocol#24816)
- refactor(aztec-nr): shared no-op sync handler for stateless contracts
(AztecProtocol#24844)
- fix: dont panic on note msgs on contracts with no notes (AztecProtocol#24852)
- docs(noir-contracts): document standard-contract re-pin consequences
(AztecProtocol#24890)

## ⚠️ Needs owner conflict-resolution (conflict against reshaped `next`;
not included here)
Cherry-pick onto this branch and resolve:
- [ ] `git cherry-pick -x 9f1167e` — feat!: make inbox secrets be
multiple fields (AztecProtocol#24599)
- [ ] `git cherry-pick -x 4490597` — fix(aztec-nr): prevent recipient
forging a colliding handshake (AztecProtocol#24403)
- [ ] `git cherry-pick -x 8b1903c` — feat!: forbid external note
validation checks (AztecProtocol#24644)
- [ ] `git cherry-pick -x 10e339a` — fix(aztec-nr)!: compute note
property selectors from the packed layout (AztecProtocol#24689)
- [ ] `git cherry-pick -x 15c7a1e` — chore: clarify scope of packable
impl detection (AztecProtocol#24820)
- [ ] `git cherry-pick -x f66808c` — fix: change init and single
claim nullif to incl owner address, add testing utilities (AztecProtocol#24892)

Part of the manual v5-next → next backlog sweep. Draft until conflicts
are resolved and CI is green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants