Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1qOGcyLTZmYzctcThmOM4AA1gY

Pyramid static view path traversal up one directory

Impact

This impacts users of Python 3.11 that are using a Pyramid static view with a full filesystem path and have a index.html file that is located exactly one directory above the location of the static view's file system path. No further path traversal exists, and the only file that could be disclosed accidentally is index.html.

Example:

config.add_static_view(name='static', path='/usr/src/app/static', cache_max_age=0)

And directory tree:

/usr/src/app \
              | - static \
                          | - file.css
                          | - index.html
                          | - ...
              | - index.html <-- (this file could be disclosed with this bug)

Patches

Pyramid now will reject any path that contains a null-byte out of caution. While valid in directory/file names, we would strongly consider it a mistake to use null-bytes in naming files/directories.

Secondly, Python 3.11, and 3.12 has fixed the underlying issue in os.path.normpath to no longer truncate on the first 0x00 found, returning the behavior to pre-3.11 Python, un an as of yet unreleased version, see:

At the time the following Python versions are not fixed:

Fixes will be available in: Python 3.12.0rc2 or 3.11.5.

Please note that release candidates of Python are not production ready and should not be used for production workloads.

Workarounds

Use a version of Python 3 that is not affected. Downgrade to Python 3.10 series temporarily, or wait till Python 3.11.5 is released and upgrade to the latest version of Python 3.11 series.

References

Thanks

Permalink: https://github.com/advisories/GHSA-j8g2-6fc7-q8f8
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qOGcyLTZmYzctcThmOM4AA1gY
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 9 months ago
Updated: 3 months ago


CVSS Score: 5.3
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Identifiers: GHSA-j8g2-6fc7-q8f8, CVE-2023-40587
References: Repository: https://github.com/Pylons/pyramid
Blast Radius: 19.2

Affected Packages

pypi:pyramid
Dependent packages: 163
Dependent repositories: 4,189
Downloads: 2,684,465 last month
Affected Version Ranges: >= 2.0.0, < 2.0.2
Fixed in: 2.0.2
All affected versions: 2.0.1
All unaffected versions: 1.0.1, 1.0.2, 1.1.1, 1.1.2, 1.1.3, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 2.0.2