GHSA-346h-749j-r28w: Mdanter/ecc PHPECC Vulnerable To Multiple Cryptographic Vulnerability

CRITICAL
CVSS 9.1
CWE-203 CWE-354
Published
Advisory Summary

GHSA-346h-749j-r28w is a CRITICAL (CVSS 9.1) phpecc vulnerable to multiple cryptographic vulnerability (CWE-203: Observable Discrepancy) affecting Mdanter/ecc libraries in the Packagist ecosystem. The issue involves phpecc vulnerable to multiple cryptographic side-channel attacks. Remediation is available in the latest vendor maintenance releases.

GHSA-346h-749j-r28w at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-346h-749j-r28w
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-203: Observable Discrepancy
Affected Product Mdanter/ecc
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-346h-749j-r28w

To remediate this vulnerability, upgrade all affected Mdanter/ecc dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mdanter/ecc fixed: Latest secure release
Upgrade mdanter/ecc to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for mdanter/ecc

How to Check if You Are Affected

To determine whether your application is affected by GHSA-346h-749j-r28w, inspect your project dependencies for Mdanter/ecc:

inspect dependencies for mdanter/ecc

Analyze the terminal output to locate any version of Mdanter/ecc in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-203: Observable Discrepancy, where the product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor. In Mdanter/ecc, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### ECDSA Canonicalization PHPECC is vulnerable to malleable ECDSA signature attacks. ### Constant-Time Signer When generating a new ECDSA signature, the GMPMath adapter was used. This class wraps the GNU Multiple Precision arithmetic library (GMP), which does not aim to provide constant-time implementations of algorithms. An attacker capable of triggering many signatures and studying the time it takes to perform each operation would be able to leak the secret number, `k`, and thereby learn the private key. ### EcDH Timing Leaks When calculating a shared secret using the `EcDH` class, the scalar-point multiplication is based on the arithmetic defined by the `Point` class. Even though the library implements a Montgomery ladder, the `add()`, `mul()`, and `getDouble()` methods on the `Point` class are not constant-time. This means that your ECDH private keys are leaking information about each bit of your private key through a timing side-channel.

GHSA-346h-749j-r28w Affected Mdanter/ecc Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
mdanter/ecc
Packagist
≤ 1.0.0

References

Frequently Asked Questions

What is GHSA-346h-749j-r28w?
GHSA-346h-749j-r28w is a security vulnerability in Mdanter/ecc involving PHPECC vulnerable to multiple cryptographic side-channel attacks under CWE-203: Observable Discrepancy.
Which Mdanter/ecc versions are affected?
Affected versions include releases prior to current release patches across affected packages: mdanter/ecc.
What version fixes GHSA-346h-749j-r28w?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is mdanter/ecc affected?
Yes, mdanter/ecc is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of GHSA-346h-749j-r28w?
GHSA-346h-749j-r28w has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with GHSA-346h-749j-r28w?
GHSA-346h-749j-r28w is classified under CWE-203: Observable Discrepancy (The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor.).
How can I check Packagist dependencies for GHSA-346h-749j-r28w?
Run the dependency tree command: 'inspect dependencies for mdanter/ecc'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-346h-749j-r28w",
  "modified" : "2024-04-25T18:31:58Z",
  "published" : "2024-04-25T18:31:58Z",
  "aliases" : [ ],
  "summary" : "PHPECC vulnerable to multiple cryptographic side-channel attacks",
  "details" : "### ECDSA Canonicalization\n\nPHPECC is vulnerable to malleable ECDSA signature attacks. \n\n### Constant-Time Signer\n\nWhen generating a new ECDSA signature, the GMPMath adapter was used. This class wraps the GNU Multiple Precision arithmetic library (GMP), which does not aim to provide constant-time implementations of algorithms.\n\nAn attacker capable of triggering many signatures and studying the time it takes to perform each operation would be able to leak the secret number, `k`, and thereby learn the private key.\n\n### EcDH Timing Leaks\n\nWhen calculating a shared secret using the `EcDH` class, the scalar-point multiplication is based on the arithmetic defined by the `Point` class.\n\nEven though the library implements a Montgomery ladder, the `add()`, `mul()`, and `getDouble()` methods on the `Point` class are not constant-time. This means that your ECDH private keys are leaking information about each bit of your private key through a timing side-channel.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "mdanter/ecc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/mdanter/ecc/2024-04-24.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/paragonie/phpecc/releases/tag/v2.0.0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/phpecc/phpecc"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-203", "CWE-354" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-25T18:31:58Z",
    "nvd_published_at" : null
  }
}