Vulnerabilities in pkg:pypi/vng-api-common

PACKAGE
Advisory Summary

GHSA-c4cm-r9fh-jgj9 is a LOW commonground-api-common unexploitable privilege escalation vulnerability (General Security Weakness) affecting Commonground api common libraries in the PyPI ecosystem. The issue involves commonground-api-common unexploitable privilege escalation in jwt authentication middleware. Remediation is available in the latest vendor maintenance releases.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/vng-api-common

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/vng-api-common. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-c4cm-r9fh-jgj9 - LOW commonground-api-common unexploitable privilege escalation in JWT authentication middleware

GHSA-c4cm-r9fh-jgj9 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-c4cm-r9fh-jgj9
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Commonground api common
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-c4cm-r9fh-jgj9

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

commonground-api-common fixed: Latest secure release
pip install commonground-api-common>=Latest secure release
vng-api-common fixed: Latest secure release
pip install vng-api-common>=Latest secure release
vng-api-common-utrecht fixed: Latest secure release
pip install vng-api-common-utrecht>=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:

pip show commonground-api-common

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-c4cm-r9fh-jgj9, inspect your installed packages using pip:

pip show commonground-api-common

Analyze the terminal output to locate any version of Commonground api common 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: The pip show commonground-api-common command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Commonground api common, 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

### Impact This is a privilege escalation vulnerability. The impact is negligible and entirely theoretical. A non-exploitable weakness was found in how the client-supplied JWTs are verified. Because an explicit allow-list of known algorithms is used in the PyJWT library, user-supplied (invalid) algorithms are rejected. If this was not the case, then the client JWTs could be tampered with, resulting in privilege escalation which would allow the attacker to perform any operation as any client (impersonation) without leaving a trace of the real user/client. ### Patches Will be fixed in 1.12.2 ### Workarounds None needed. But be careful when updating PyJWT. Check that the used PyJWT has no algorithms specified with a name in "", "HS25", "HS2", "HS", "H", or that those algorithms are acceptable. ### Details The header and payload of JSON Web Tokens (JWTs) are cryptographically signed with an algorithm. A JWT has a header field `alg` that specifies the algorithm used in the signature. The `vng-api-common.middleware.AuthMiddleware` uses PyJWT to check the validity of JWT and indicates it should be "HS256", otherwise an attacker could construct a token with a cryptographically weak token. It should indicate this with a list of acceptable algorithms `["HS256"]`, but instead the string `"HS256"` is passed to PyJWT. PyJWT does not check the type of the argument and checks if the `alg` string in the header exists in the acceptable algorithms value with the `in` operator. Any substring of `"HS256"` passes this `in` check. It is not exploitable because there is no such substring in de set of algorithms PyJWT supports.

GHSA-c4cm-r9fh-jgj9 Affected Commonground api common Versions

3 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
commonground-api-common
PyPI
≤ 1.12.1
vng-api-common
PyPI
≤ 2.0.5
vng-api-common-utrecht
PyPI
≤ 1.3.2

References

Frequently Asked Questions

What is GHSA-c4cm-r9fh-jgj9?
GHSA-c4cm-r9fh-jgj9 is a security vulnerability in Commonground api common involving commonground-api-common unexploitable privilege escalation in JWT authentication middleware under General Security Weakness.
Which Commonground api common versions are affected?
Affected versions include releases prior to current release patches across affected packages: commonground-api-common, vng-api-common, vng-api-common-utrecht.
What version fixes GHSA-c4cm-r9fh-jgj9?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is commonground-api-common affected?
Yes, commonground-api-common is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
Is vng-api-common affected?
Yes, vng-api-common is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with GHSA-c4cm-r9fh-jgj9?
GHSA-c4cm-r9fh-jgj9 is classified under General Security Weakness.
How can I check PyPI dependencies for GHSA-c4cm-r9fh-jgj9?
Run the dependency tree command: 'pip show commonground-api-common'. 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-c4cm-r9fh-jgj9",
  "modified" : "2024-02-09T17:04:47Z",
  "published" : "2024-02-09T17:04:47Z",
  "aliases" : [ ],
  "summary" : "commonground-api-common unexploitable privilege escalation in JWT authentication middleware",
  "details" : "### Impact\n\nThis is a privilege escalation vulnerability. The impact is negligible and entirely theoretical.\n\nA non-exploitable weakness was found in how the client-supplied JWTs are verified. Because an explicit allow-list\nof known algorithms is used in the PyJWT library, user-supplied (invalid) algorithms are rejected.\n\nIf this was not the case, then the client JWTs could be tampered with, resulting in privilege escalation which\nwould allow the attacker to perform any operation as any client (impersonation) without leaving a trace of\nthe real user/client.\n\n\n### Patches\n\nWill be fixed in 1.12.2\n\n### Workarounds\n\nNone needed. But be careful when updating PyJWT. Check that the used PyJWT has no algorithms specified with a name in \"\", \"HS25\", \"HS2\", \"HS\", \"H\", or that those algorithms are acceptable.\n\n### Details\n\nThe header and payload of JSON Web Tokens (JWTs) are cryptographically signed with an algorithm. A JWT has a header field `alg` that specifies the algorithm used in the signature.\n\nThe `vng-api-common.middleware.AuthMiddleware` uses PyJWT to check the validity of JWT and indicates it should be \"HS256\", otherwise an attacker could construct a token with a cryptographically weak token. It should indicate this with a list of acceptable algorithms  `[\"HS256\"]`, but instead the string `\"HS256\"` is passed to PyJWT.  PyJWT does not check the type of the argument and checks if the `alg` string in the header exists in the acceptable algorithms value with the `in` operator. Any substring of `\"HS256\"` passes this `in` check. It is not exploitable because there is no such substring in de set of algorithms PyJWT supports.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "commonground-api-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.12.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "vng-api-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.0.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "vng-api-common-utrecht"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/maykinmedia/commonground-api-common/security/advisories/GHSA-c4cm-r9fh-jgj9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/maykinmedia/commonground-api-common/commit/20d9345a865338777839e8f02c21cd9d6f5a2cae"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-09T17:04:47Z",
    "nvd_published_at" : null
  }
}