Vulnerabilities in pkg:pypi/invenio-rdm-records

PACKAGE
Advisory Identifier: GHSA-xr38-w74q-r8jv
Advisory Summary

CVE-2021-43781 is a MODERATE (CVSS 6.4) remote code execution vulnerability (CWE-862: Missing Authorization) affecting Invenio drafts resources libraries in the PyPI ecosystem. The issue involves permissions not properly checked in invenio-drafts-resources. Remediation is available by upgrading affected packages to version 0.13.7, 6.0.5, 0.32.6, 0.14.6, 0.33.10, 7.0.0.dev5.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/invenio-rdm-records

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/invenio-rdm-records. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-xr38-w74q-r8jv CVE-2021-43781 MODERATE Permissions not properly checked in Invenio-Drafts-Resources

CVE-2021-43781 at a Glance

CVE Identifier CVE-2021-43781
GHSA Identifier GHSA-xr38-w74q-r8jv
Severity MODERATE
CVSS v3.1 Base Score 6.4
CWE Classification CWE-862: Missing Authorization
Affected Product Invenio drafts resources
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.4

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

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

How to Fix CVE-2021-43781

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

invenio-drafts-resources fixed: 0.13.7
pip install invenio-drafts-resources>=0.13.7
invenio-app-rdm fixed: 6.0.5
pip install invenio-app-rdm>=6.0.5
invenio-rdm-records fixed: 0.32.6
pip install invenio-rdm-records>=0.32.6
invenio-drafts-resources fixed: 0.14.6
pip install invenio-drafts-resources>=0.14.6
invenio-rdm-records fixed: 0.33.10
pip install invenio-rdm-records>=0.33.10
invenio-app-rdm fixed: 7.0.0.dev5
pip install invenio-app-rdm>=7.0.0.dev5
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 invenio-drafts-resources

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2021-43781, inspect your installed packages using pip:

pip show invenio-drafts-resources

Analyze the terminal output to locate any version of Invenio drafts resources in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.13.7), your application is affected.

Note: The pip show invenio-drafts-resources command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-862: Missing Authorization, where the product does not perform an authorization check when an actor attempts to access a resource or perform an action. In Invenio drafts resources, 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 Invenio-Drafts-Resources does not properly check permissions when a record is published. The vulnerability is exploitable in a default installation of InvenioRDM. An authenticated user is able via REST API calls to publish draft records of other users if they know the record identifier and the draft validates (e.g. all require fields filled out). An attacker is not able to modify the data in the record, and thus e.g. *cannot* change a record from restricted to public. ### Details The service's ``publish()`` method contains the following permission check: ```python def publish(..): self.require_permission(identity, "publish") ``` However, the record should have been passed into the permission check so that the need generators have access to e.g. the record owner. ```python def publish(..): self.require_permission(identity, "publish", record=record) ``` The bug is activated in Invenio-RDM-Records which has a need generator called ``RecordOwners()``, which when no record is passed in defaults to allow any authenticated user: ```python class RecordOwners(Generator): def needs(self, record=None, **kwargs): if record is None: return [authenticated_user] # ... ``` ### Patches The problem is patched in Invenio-Drafts-Resources v0.13.7 and 0.14.6+, which is part of InvenioRDM v6.0.1 and InvenioRDM v7.0 respectively. You can verify the version installed of Invenio-Drafts-Resources via PIP: ```console cd ~/src/my-site pipenv run pip freeze | grep invenio-drafts-resources ``` ### References - [Security policy](https://invenio.readthedocs.io/en/latest/community/security-policy.html) ### For more information If you have any questions or comments about this advisory: * Chat with us on Discord: https://discord.gg/8qatqBC

CVE-2021-43781 Affected Invenio drafts resources Versions

6 component(s)
Fixed Versions:
0.13.76.0.50.32.60.14.60.33.107.0.0.dev5
Product / Package Ecosystem Affected Versions Fixed Version
invenio-drafts-resources
PyPI
< 0.13.7
0.13.7
invenio-app-rdm
PyPI
< 6.0.5
6.0.5
invenio-rdm-records
PyPI
< 0.32.6
0.32.6
invenio-drafts-resources
PyPI
≥ 0.14.0
< 0.14.6
0.14.6
invenio-rdm-records
PyPI
≥ 0.33.0
< 0.33.10
0.33.10
invenio-app-rdm
PyPI
≥ 7.0.0.dev0
< 7.0.0.dev5
7.0.0.dev5

References

Frequently Asked Questions

What is CVE-2021-43781?
CVE-2021-43781 is a security vulnerability in Invenio drafts resources involving Permissions not properly checked in Invenio-Drafts-Resources under CWE-862: Missing Authorization.
Which Invenio drafts resources versions are affected?
Affected versions include releases prior to 0.13.7, 6.0.5, 0.32.6, 0.14.6, 0.33.10, 7.0.0.dev5 across affected packages: invenio-drafts-resources, invenio-app-rdm, invenio-rdm-records.
What version fixes CVE-2021-43781?
Upgrading to 0.13.7, 6.0.5, 0.32.6, 0.14.6, 0.33.10, 7.0.0.dev5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is invenio-drafts-resources affected?
Yes, invenio-drafts-resources is affected in releases prior to 0.13.7, 0.14.6. Upgrade your dependency to 0.13.7, 0.14.6 or later.
Is invenio-app-rdm affected?
Yes, invenio-app-rdm is affected in releases prior to 6.0.5, 7.0.0.dev5. Upgrade your dependency to 6.0.5, 7.0.0.dev5 or later.
What is the CVSS score of CVE-2021-43781?
CVE-2021-43781 has a CVSS v3.1 base score of 6.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2021-43781?
CVE-2021-43781 is classified under CWE-862: Missing Authorization (The product does not perform an authorization check when an actor attempts to access a resource or perform an action.).
How can I check PyPI dependencies for CVE-2021-43781?
Run the dependency tree command: 'pip show invenio-drafts-resources'. 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-xr38-w74q-r8jv",
  "modified" : "2024-09-23T16:02:05Z",
  "published" : "2021-12-06T23:57:59Z",
  "aliases" : [ "CVE-2021-43781" ],
  "summary" : "Permissions not properly checked in Invenio-Drafts-Resources",
  "details" : "### Impact\n\nInvenio-Drafts-Resources does not properly check permissions when a record is published. The vulnerability is exploitable in a default installation of InvenioRDM. An authenticated user is able via REST API calls to publish draft records of other users if they know the record identifier and the draft validates (e.g. all require fields filled out). An attacker is not able to modify the data in the record, and thus e.g. *cannot* change a record from restricted to public.\n\n### Details\n\nThe service's ``publish()`` method contains the following permission check:\n\n```python\ndef publish(..):\n    self.require_permission(identity, \"publish\")\n```\nHowever, the record should have been passed into the permission check so that the need generators have access to e.g. the record owner.\n\n```python\ndef publish(..):\n    self.require_permission(identity, \"publish\", record=record)\n```\nThe bug is activated in Invenio-RDM-Records which has a need generator called ``RecordOwners()``, which when no record is passed in defaults to allow any authenticated user:\n\n```python\nclass RecordOwners(Generator):\n    def needs(self, record=None, **kwargs):\n        if record is None:\n            return [authenticated_user]\n    # ...\n```\n\n### Patches\n\nThe problem is patched in Invenio-Drafts-Resources v0.13.7 and 0.14.6+, which is part of InvenioRDM v6.0.1 and InvenioRDM v7.0 respectively.\n\nYou can verify the version installed of Invenio-Drafts-Resources via PIP:\n\n```console\ncd ~/src/my-site\npipenv run pip freeze | grep invenio-drafts-resources\n```\n\n### References\n\n- [Security policy](https://invenio.readthedocs.io/en/latest/community/security-policy.html)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Chat with us on Discord: https://discord.gg/8qatqBC\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "invenio-drafts-resources"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.13.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "invenio-app-rdm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.0.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "invenio-rdm-records"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.32.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "invenio-drafts-resources"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.14.0"
      }, {
        "fixed" : "0.14.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "invenio-rdm-records"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.33.0"
      }, {
        "fixed" : "0.33.10"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "invenio-app-rdm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0.dev0"
      }, {
        "fixed" : "7.0.0.dev5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/inveniosoftware/invenio-drafts-resources/security/advisories/GHSA-xr38-w74q-r8jv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43781"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/inveniosoftware/invenio-drafts-resources/commit/039b0cff1ad4b952000f4d8c3a93f347108b6626"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/invenio-app-rdm/PYSEC-2021-837.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/invenio-drafts-resources/PYSEC-2021-836.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-862", "CWE-863" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-06T22:15:02Z",
    "nvd_published_at" : "2021-12-06T18:15:00Z"
  }
}