GHSA-wqc8-x2pr-7jqh

Suggest an improvement
Source
https://github.com/advisories/GHSA-wqc8-x2pr-7jqh
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/07/GHSA-wqc8-x2pr-7jqh/GHSA-wqc8-x2pr-7jqh.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-wqc8-x2pr-7jqh
Aliases
Published
2023-07-10T21:53:22Z
Modified
2023-11-07T05:37:23.407820Z
Severity
  • 8.4 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L CVSS Calculator
Summary
RestrictedPython vulnerable to arbitrary code execution via stack frame sandbox escape
Details

Impact

RestrictedPython does not check access to stack frames and their attributes. Stack frames are accessible within at least generators and generator expressions, which are allowed inside RestrictedPython. An attacker with access to a RestrictedPython environment can write code that gets the current stack frame in a generator and then walk the stack all the way beyond the RestrictedPython invocation boundary, thus breaking out of the restricted scope allowing the call of unrestricted Python code and therefore potentially allowing arbitrary code execution in the Python interpreter.

All RestrictedPython deployments that allow untrusted users to write Python code in the RestrictedPython environment are at risk. In terms of Zope and Plone, this would mean deployments where the administrator allows untrusted users to create and/or edit objects of type Script (Python), DTML Method, DTML Document or Zope Page Template. This is a non-default configuration and likely to be extremely rare.

Patches

The problem has been fixed in releases 5.3 and 6.1.

Workarounds

There is no workaround available. If you cannot upgrade to the latest release you should ensure the RestrictedPython environment is only available for trusted users.

References

For more information

If you have any questions or comments about this advisory:

Credits

Thanks for analysing and reporting the go to: - Nakul Choudhary (Quasar0147 on GitHub) - despawningbone on GitHub - Robert Xiao (nneonneo on GitHub)

Database specific
{
    "nvd_published_at": "2023-07-11T18:15:20Z",
    "cwe_ids": [
        "CWE-913"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2023-07-10T21:53:22Z"
}
References

Affected packages

PyPI / restrictedpython

Package

Name
restrictedpython
View open source insights on deps.dev
Purl
pkg:pypi/restrictedpython

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.3

Affected versions

3.*

3.4.2
3.4.3
3.5.0
3.5.1
3.5.2
3.6.0a1
3.6.0

4.*

4.0a1
4.0a2
4.0a3
4.0b1
4.0b2
4.0b3
4.0b4
4.0b5
4.0b6
4.0b7
4.0b8
4.0

5.*

5.0
5.1
5.2a1.dev0
5.2
5.3a1.dev0

PyPI / restrictedpython

Package

Name
restrictedpython
View open source insights on deps.dev
Purl
pkg:pypi/restrictedpython

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.0a1.dev0
Fixed
6.1

Affected versions

6.*

6.0a1.dev0
6.0

PyPI / restrictedpython

Package

Name
restrictedpython
View open source insights on deps.dev
Purl
pkg:pypi/restrictedpython

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.3

Affected versions

3.*

3.4.2
3.4.3
3.5.0
3.5.1
3.5.2
3.6.0a1
3.6.0

4.*

4.0a1
4.0a2
4.0a3
4.0b1
4.0b2
4.0b3
4.0b4
4.0b5
4.0b6
4.0b7
4.0b8
4.0

5.*

5.0
5.1
5.2a1.dev0
5.2
5.3a1.dev0