chore(deps-dev): [security] bump aiohttp from 3.9.1 to 3.9.2
Bumps aiohttp from 3.9.1 to 3.9.2. This update includes security fixes.
Vulnerabilities fixed
aiohttp is vulnerable to directory traversal
Summary
Improperly configuring static resource resolution in aiohttp when used as a web server can result in the unauthorized reading of arbitrary files on the system.
Details
When using aiohttp as a web server and configuring static routes, it is necessary to specify the root path for static files. Additionally, the option 'follow_symlinks' can be used to determine whether to follow symbolic links outside the static root directory. When 'follow_symlinks' is set to True, there is no validation to check if a given file path is within the root directory.This can lead to directory traversal vulnerabilities, resulting in unauthorized access to arbitrary files on the system, even when symlinks are not present.
i.e. An application is only vulnerable with setup code like:
app.router.add_routes([ web.static("/static", "static/", follow_symlinks=True), # Remove follow_symlinks to avoid the vulnerability ])
Impact
This is a directory traversal vulnerability with CWE ID 22. When using aiohttp as a web server and enabling static resource resolution with
follow_symlinks
set to True, it can lead to this vulnerability. This vulnerability has been present since the introduction of thefollow_symlinks
parameter.Workaround
Even if upgrading to a patched version of aiohttp, we recommend following these steps regardless.
If using
follow_symlinks=True
outside of a restricted local development environment, disable the option immediately. This option is NOT needed to follow symlinks which point to a location within the static root directory, it is only intended to allow a symlink to break out of the static directory. Even with this CVE fixed, there is still a substantial risk of misconfiguration when using this option on a server that accepts requests from remote users.
... (truncated)
Patched versions: 3.9.2 Affected versions: >= 1.0.5, < 3.9.2
aiohttp's HTTP parser (the python one, not llhttp) still overly lenient about separators
Summary
Security-sensitive parts of the Python HTTP parser retained minor differences in allowable character sets, that must trigger error handling to robustly match frame boundaries of proxies in order to protect against injection of additional requests. Additionally, validation could trigger exceptions that were not handled consistently with processing of other malformed input.
Details
These problems are rooted in pattern matching protocol elements, previously improved by PR #3235 and GHSA-gfw2-4jvh-wgfg:
The expression
HTTP/(\d).(\d)
lacked another backslash to clarify that the separator should be a literal dot, not just any Unicode code point (result:HTTP/(\d)\.(\d)
).The HTTP version was permitting Unicode digits, where only ASCII digits are standards-compliant.
Distinct regular expressions for validating HTTP Method and Header field names were used - though both should (at least) apply the common restrictions of rfc9110
token
.PoC
GET / HTTP/1ö1
GET / HTTP/1.𝟙
GET/: HTTP/1.1
Content-Encoding?: chunked
Impact
Primarily concerns running an aiohttp server without llhttp:
... (truncated)
Patched versions: 3.9.2 Affected versions: < 3.9.2
Release notes
Sourced from aiohttp's releases.
3.9.2
Bug fixes
Fixed server-side websocket connection leak.
Related issues and pull requests on GitHub: #7978.
Fixed
web.FileResponse
doing blocking I/O in the event loop.Related issues and pull requests on GitHub: #8012.
Fixed double compress when compression enabled and compressed file exists in server file responses.
Related issues and pull requests on GitHub: #8014.
Added runtime type check for
ClientSession
timeout
parameter.Related issues and pull requests on GitHub: #8021.
Fixed an unhandled exception in the Python HTTP parser on header lines starting with a colon -- by :user:
pajod
.Invalid request lines with anything but a dot between the HTTP major and minor version are now rejected. Invalid header field names containing question mark or slash are now rejected. Such requests are incompatible with :rfc:
9110#section-5.6.2
and are not known to be of any legitimate use.Related issues and pull requests on GitHub: #8074.
Improved validation of paths for static resources requests to the server -- by :user:
bdraco
.
... (truncated)
Changelog
Sourced from aiohttp's changelog.
3.9.2 (2024-01-28)
Bug fixes
Fixed server-side websocket connection leak.
Related issues and pull requests on GitHub: :issue:
7978
.Fixed
web.FileResponse
doing blocking I/O in the event loop.Related issues and pull requests on GitHub: :issue:
8012
.Fixed double compress when compression enabled and compressed file exists in server file responses.
Related issues and pull requests on GitHub: :issue:
8014
.Added runtime type check for
ClientSession
timeout
parameter.Related issues and pull requests on GitHub: :issue:
8021
.Fixed an unhandled exception in the Python HTTP parser on header lines starting with a colon -- by :user:
pajod
.Invalid request lines with anything but a dot between the HTTP major and minor version are now rejected. Invalid header field names containing question mark or slash are now rejected. Such requests are incompatible with :rfc:
9110#section-5.6.2
and are not known to be of any legitimate use.Related issues and pull requests on GitHub: :issue:
8074
.
... (truncated)
Commits
-
24a6d64
Release v3.9.2 (#8082) -
9118a58
[PR #8079/1c335944 backport][3.9] Validate static paths (#8080) -
435ad46
[PR #3955/8960063e backport][3.9] Replace all tmpdir fixtures with tmp_path (... -
d33bc21
Improve validation in HTTP parser (#8074) (#8078) -
0d945d1
[PR #7916/822fbc74 backport][3.9] Add more information to contributing page (... -
3ec4fa1
[PR #8069/69bbe874 backport][3.9]📝 Only show changelog draft for non-release... -
419d715
[PR #8066/cba34699 backport][3.9]💅 📝 Restructure the changelog for clarity (#... -
a54dab3
[PR #8049/a379e634 backport][3.9] Set cause for ClientPayloadError (#8050) -
437ac47
[PR #7995/43a5bc50 backport][3.9] Fix examples offallback_charset_resolver
... -
034e5e3
[PR #8042/4b91b530 backport][3.9] Tightening the runtime type check for ssl (... - Additional commits viewable in compare view