CVE-2024-22049
httparty Multipart/Form-Data Request Tampering Vulnerability
httparty before 0.21.0 is vulnerable to an assumed-immutable web parameter vulnerability. A remote and unauthenticated attacker can provide a crafted filename parameter during multipart/form-data uploads which could result in attacker controlled filenames being written.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
NVD Score used
5.3
httparty before 0.21.0 is vulnerable to an assumed-immutable web parameter vulnerability. A remote and unauthenticated attacker can provide a crafted filename parameter during multipart/form-data uploads which could result in attacker controlled filenames being written.
- Record
CVE-2024-22049- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N - Weakness
- CWE-472
- Updated
- 2026-11-02
CVE List
5.3
httparty Multipart/Form-Data Request Tampering Vulnerability
httparty before 0.21.0 is vulnerable to an assumed-immutable web parameter vulnerability. A remote and unauthenticated attacker can provide a crafted filename parameter during multipart/form-data uploads which could result in attacker controlled filenames being written.
- Record
CVE-2024-22049- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N - Weakness
- CWE-472
- Updated
- 2026-11-02
EUVDEUVD-2023-0342
5.3
httparty before 0.21.0 is vulnerable to an assumed-immutable web parameter vulnerability. A remote and unauthenticated attacker can provide a crafted filename parameter during multipart/form-data uploads which could result in attacker controlled filenames being written.
- Record
EUVD-2023-0342- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-5pq7-52mg-hr42
6.5
httparty has multipart/form-data request tampering vulnerability
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
By exploiting this problem, the following attacks are possible
- An attack that rewrites the "name" field according to the crafted file name, impersonating (overwriting) another field.
- Attacks that rewrite the filename extension at the time multipart/form-data is generated by tampering with the filename
For example, this vulnerability can be exploited to generate the following Content-Disposition.
Normal Request example: normal input filename:
abc.txtgenerated normal header in multipart/form-data
Content-Disposition: form-data; name="avatar"; filename="abc.txt"
Malicious Request example malicious input filename:
overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txtgenerated malicious header in multipart/form-data:
Content-Disposition: form-data; name="avatar"; filename="overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt"
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
- Spring (Java)
- Ktor (Kotlin)
- Ruby on Rails (Ruby)
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
For field names and filenames for file fields, the result of the encoding in the previous bullet point must be escaped by replacing any 0x0A (LF) bytes with the byte sequence
%0A, 0x0D (CR) with%0Dand 0x22 (") with%22. The user agent must not perform any other escapes.
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
For field names and filenames for file fields, the result of the encoding in the previous bullet point must be escaped by replacing any 0x0A (LF) bytes with the byte sequence
%0A, 0x0D (CR) with%0Dand 0x22 (") with%22. The user agent must not perform any other escapes.
Therefore, it is recommended that Content-Disposition be modified by either of the following
Before:
Content-Disposition: attachment;filename="malicious.sh";dummy=.txt
After:
Content-Disposition: attachment;filename="%22malicious.sh%22;dummy=.txt"
file_name.gsub('"', '%22')
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) .)
- Create Project
$ mkdir my-app
$ cd my-app
$ gem install httparty
- Create malicious file
$ touch 'overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt'
- Generate Vuln code
$ vi example.rb
require 'httparty'
filename = 'overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt'
HTTParty.post('http://localhost:12345/',
body: {
name: 'Foo Bar',
email: '[email protected]',
avatar: File.open(filename)
}
)
- Run Logging…
- Record
GHSA-5pq7-52mg-hr42- CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Weakness
- CWE-472
- Updated
- 2026-11-02
OSV
5.3
httparty Multipart/Form-Data Request Tampering Vulnerability
httparty before 0.21.0 is vulnerable to an assumed-immutable web parameter vulnerability. A remote and unauthenticated attacker can provide a crafted filename parameter during multipart/form-data uploads which could result in attacker controlled filenames being written.
- Record
CVE-2024-22049- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N - Weakness
- CWE-472
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2024-22049
5.3
httparty before 0.21.0 is vulnerable to an assumed-immutable web parameter vulnerability. A remote and unauthenticated attacker can provide a crafted filename parameter during multipart/form-data uploads which could result in attacker controlled filenames being written.
- Record
DEBIAN-CVE-2024-22049- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N - Updated
- 2026-11-02
OSVGHSA-5pq7-52mg-hr42
6.5
httparty has multipart/form-data request tampering vulnerability
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
By exploiting this problem, the following attacks are possible
- An attack that rewrites the "name" field according to the crafted file name, impersonating (overwriting) another field.
- Attacks that rewrite the filename extension at the time multipart/form-data is generated by tampering with the filename
For example, this vulnerability can be exploited to generate the following Content-Disposition.
Normal Request example: normal input filename:
abc.txtgenerated normal header in multipart/form-data
Content-Disposition: form-data; name="avatar"; filename="abc.txt"
Malicious Request example malicious input filename:
overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txtgenerated malicious header in multipart/form-data:
Content-Disposition: form-data; name="avatar"; filename="overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt"
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
- Spring (Java)
- Ktor (Kotlin)
- Ruby on Rails (Ruby)
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
For field names and filenames for file fields, the result of the encoding in the previous bullet point must be escaped by replacing any 0x0A (LF) bytes with the byte sequence
%0A, 0x0D (CR) with%0Dand 0x22 (") with%22. The user agent must not perform any other escapes.
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
For field names and filenames for file fields, the result of the encoding in the previous bullet point must be escaped by replacing any 0x0A (LF) bytes with the byte sequence
%0A, 0x0D (CR) with%0Dand 0x22 (") with%22. The user agent must not perform any other escapes.
Therefore, it is recommended that Content-Disposition be modified by either of the following
Before:
Content-Disposition: attachment;filename="malicious.sh";dummy=.txt
After:
Content-Disposition: attachment;filename="%22malicious.sh%22;dummy=.txt"
file_name.gsub('"', '%22')
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) .)
- Create Project
$ mkdir my-app
$ cd my-app
$ gem install httparty
- Create malicious file
$ touch 'overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt'
- Generate Vuln code
$ vi example.rb
require 'httparty'
filename = 'overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt'
HTTParty.post('http://localhost:12345/',
body: {
name: 'Foo Bar',
email: '[email protected]',
avatar: File.open(filename)
}
)
- Run Logging…
- Record
GHSA-5pq7-52mg-hr42- CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N - Weakness
- CWE-472
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2024-22049
5.3
httparty before 0.21.0 is vulnerable to an assumed-immutable web parameter vulnerability. A remote and unauthenticated attacker can provide a crafted filename parameter during multipart/form-data uploads which could result in attacker controlled filenames being written.
- Record
UBUNTU-CVE-2024-22049- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
httpartyRubyGems |
through 0.20.0 | 0.21.0 |
ruby-httpartyDebian:12 |
before 0.21.0-1 | 0.21.0-1 |
ruby-httpartyDebian:13 |
before 0.21.0-1 | 0.21.0-1 |
ruby-httpartyDebian:14 |
before 0.21.0-1 | 0.21.0-1 |
ruby-httpartyDebian:10 |
before 0.16.2+dfsg1-3+deb10u1, plus listed versions 0.16.2+dfsg1-3 |
0.16.2+dfsg1-3+deb10u1 |
ruby-httpartyDebian:11 |
before 0.18.1-2+deb11u1, plus listed versions 0.18.1-2 |
0.18.1-2+deb11u1 |
httpartyRubyGems |
before 0.21.0, plus listed versions 0.1.00.1.10.1.20.1.30.1.5 Show 45 moreShow less0.1.60.1.70.1.80.10.00.10.10.10.20.11.00.12.00.13.00.13.10.13.20.13.30.13.40.13.50.13.60.13.70.14.00.15.00.15.10.15.20.15.30.15.40.15.50.15.60.15.70.16.00.16.10.16.20.16.30.16.40.17.00.17.10.17.30.18.00.18.10.19.00.19.10.2.00.2.10.2.100.2.20.2.30.2.40.2.50.2.6 |
0.21.0 |
ruby-httpartyUbuntu:16.04:LTS |
All versions, plus listed versions 0.13.5-1 |
None known |
ruby-httpartyUbuntu:18.04:LTS |
All versions, plus listed versions 0.13.7-10.13.7-20.15.6-1 |
None known |
ruby-httpartyUbuntu:20.04:LTS |
All versions, plus listed versions 0.17.0-1 |
None known |
ruby-httpartyUbuntu:22.04:LTS |
All versions, plus listed versions 0.18.1-20.18.1-3 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2024-22049 is a medium vulnerability (CVSS 5.3) in Jnunemaker Httparty, published January 3, 2023. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.29%, the 70th percentile. Fixed in httparty 0.21.0.
References
github.com/jnunemaker/httparty/security/advisories/GHSA-5pq7-52mg-hr42
github.com/jnunemaker/httparty/commit/cdb45a678c43e44570b4e73f84b1abeb5ec22b8e
github.com/jnunemaker/httparty/blob/4416141d37fd71bdba4f37589ec265f55aa446ce/lib/httparty/request/body.rb
github.com/advisories/GHSA-5pq7-52mg-hr42
vulncheck.com/advisories/vc-advisory-GHSA-5pq7-52mg-hr42
lists.fedoraproject.org/archives/list/[email protected]/message/IOWECZPJY6JZIA5FSBJR77KCRDXWDZDA
Show 11 moreShow less
lists.fedoraproject.org/archives/list/[email protected]/message/4LDGAVPR4KB72V4GGQCWODEAI72QZI3V
lists.debian.org/debian-lts-announce/2024/01/msg00011.html
lists.debian.org/debian-lts-announce/2024/09/msg00043.html
nvd.nist.gov/vuln/detail/CVE-2024-22049
github.com/rubysec/ruby-advisory-db/blob/master/gems/httparty/CVE-2024-22049.yml
rubygems.org
github.com/CVEProject/cvelistV5/tree/main/cves/2024/22xxx/CVE-2024-22049.json
security-tracker.debian.org/tracker/CVE-2024-22049
github.com/jnunemaker/httparty
ubuntu.com/security/CVE-2024-22049
cve.org/CVERecord?id=CVE-2024-22049
Left out here: 29 versions and the rest of 2 source descriptions. The JSON record has them.