chore(deps): update dependency httparty to v0.21.0 [security] #231
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.18.1
->0.21.0
GitHub Vulnerability Alerts
CVE-2024-22049
Impact
I found "multipart/form-data request tampering vulnerability" caused by Content-Disposition "filename" lack of escaping in httparty.
httparty/lib/httparty/request
>body.rb
>def generate_multipart
https://github.com/jnunemaker/httparty/blob/4416141d37fd71bdba4f37589ec265f55aa446ce/lib/httparty/request/body.rb#L43
By exploiting this problem, the following attacks are possible
For example, this vulnerability can be exploited to generate the following Content-Disposition.
The Abused Header has multiple name (
avatar
&foo
) fields and the "filename" has been rewritten from*.txt
to*.sh
.These problems can result in successful or unsuccessful attacks, depending on the behavior of the parser receiving the request.
I have confirmed that the attack succeeds, at least in the following frameworks
The cause of this problem is the lack of escaping of the
"
(Double-Quote) character in Content-Disposition > filename.WhatWG's HTML spec has an escaping requirement.
https://html.spec.whatwg.org/#multipart-form-data
Patches
As noted at the beginning of this section, encoding must be done as described in the HTML Spec.
https://html.spec.whatwg.org/#multipart-form-data
Therefore, it is recommended that Content-Disposition be modified by either of the following
https://github.com/jnunemaker/httparty/blob/4416141d37fd71bdba4f37589ec265f55aa446ce/lib/httparty/request/body.rb#L43
Also, as for
\r
,\n
, URL Encode is not done, but it is not newlines, so it seemed to be OK.However, since there may be omissions, it is safer to URL encode these as well, if possible.
(
\r
to%0A
and\d
to%0D
)PoC
PoC Environment
OS: macOS Monterey(12.3)
Ruby ver: ruby 3.1.2p20
httparty ver: 0.20.0
(Python3 - HTTP Request Logging Server)
PoC procedure
(Linux or MacOS is required.
This is because Windows does not allow file names containing
"
(double-quote) .)I write Python code, but any method will work as long as you can see the HTTP Request Body.
(e.g. Debugger, HTTP Logging Server, Packet Capture)
$ vi logging.py
$ python logging.py
Return Request Header & Body:
Content-Disposition:
References
I also include a similar report that I previously reported to Firefox.
https://bugzilla.mozilla.org/show_bug.cgi?id=1556711
I will post some examples of frameworks that did not have problems as reference.
Golang
https://github.com/golang/go/blob/e0e0c8fe9881bbbfe689ad94ca5dddbb252e4233/src/mime/multipart/writer.go#L144
Spring
https://github.com/spring-projects/spring-framework/blob/4cc91e46b210b4e4e7ed182f93994511391b54ed/spring-web/src/main/java/org/springframework/http/ContentDisposition.java#L259-L267
Symphony
https://github.com/symfony/symfony/blob/123b1651c4a7e219ba59074441badfac65525efe/src/Symfony/Component/Mime/Header/ParameterizedHeader.php#L128-L133
For more information
If you have any questions or comments about this advisory:
Release Notes
jnunemaker/httparty (httparty)
v0.21.0
Compare Source
mime-types
withmini_mime
v0.20.0
Compare Source
Breaking changes
Fixes
Marshal.dump
fails on response objects when request option:logger
is set or:parser
is a proc:pem
option to toOpenSSL::PKey.read
to support other algorithmsv0.19.1
Compare Source
v0.19.0
Compare Source
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.