CVE-2021-43781: Invenio drafts resources Remote Code Execution Vulnerability
MODERATECVE-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.
CVE-2021-43781 at a Glance
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).
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.
pip install invenio-drafts-resources>=0.13.7
pip install invenio-app-rdm>=6.0.5
pip install invenio-rdm-records>=0.32.6
pip install invenio-drafts-resources>=0.14.6
pip install invenio-rdm-records>=0.33.10
pip install invenio-app-rdm>=7.0.0.dev5
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
CVE-2021-43781 Affected Invenio drafts resources Versions
6 component(s)| 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?
Which Invenio drafts resources versions are affected?
What version fixes CVE-2021-43781?
Is invenio-drafts-resources affected?
Is invenio-app-rdm affected?
What is the CVSS score of CVE-2021-43781?
What CWE is associated with CVE-2021-43781?
How can I check PyPI dependencies for CVE-2021-43781?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}