Advisory

GHSA-q97c-8qh3-fpc6

Details, part 2 of 2. The advisory

Details

  • We did not build a co-resident spy. Per-step observations in the PoC come from a small hrtime() hook inside Montgomery::multiplyPoint (one file differs from the pinned tree; Math/PrimeField/Integer.php, which carries the leak, is byte-identical). This models an observer with intra-call resolution; it is not itself an attacker capability. We note that the requisite primitives are present on ordinary hardware — on our test host clflush and rdtscp work, with 187–312 cycle cached/flushed separation — but building and validating a spy is separate work we have not done.
  • Perfect step segmentation is assumed. A real observer must recover step boundaries and separate the ladder from the surrounding modular inversion.
  • A single host and configuration. All timing figures are from one 2-vCPU shared VM (PHP 8.3.6, GMP 6.3.0). A noisier host needs more observations; recovery holds within roughly 25–30% additional noise beyond this host's residual.
  • We have not identified an affected deployed caller.

Accordingly we report this as a hardening issue and demonstrated side channel, not as a completed remote exploit.

8. Suggested remediation

  1. Constant-time, fixed-width field arithmetic, or delegate to a vetted native provider. This is the actual fix. Removing the ladder's bit branch is *not* sufficient while Integer.php:189 and :207 remain operand-dependent.
  2. Gate `MontgomeryPrivate.php:66` the way `PKCS8.php:194–200` already is. That is a one-block change and it closes the only entry point that is un-gated in every configuration. Keep the $curve instanceof Curve25519 guard — MontgomeryPrivate also accepts Curve448 keys.
  3. Consider an OpenSSL arm alongside the sodium arm in `PKCS8::loadECDH`, or fail closed, so stacks without ext-sodium do not fall through to the ladder.
  4. Separately, and unrelated to this channel: the pure-PHP path returns an all-zero 32-byte shared secret for low-order peer inputs. Rejecting the full canonicalised low-order set and adding a constant-time all-zero check is correct hygiene for contributory behaviour — but it does not mitigate the timing channel, since recovery works with u = 9.

Contact
George Stergiopoulos
Assistant Professor of cybersecurity
Athens University of Economics and Business, Greece
E: [email protected] | s: https://www.aueb.gr/en/faculty_page/stergiopoulos-georgios

Sources & licences