Every CVE Search/ Get API key

CVE-2024-22049

httparty Multipart/Form-Data Request Tampering Vulnerability

5.3 MediumFix available

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

1.29%Up 1.2 points since Jan 18, 2024
90%50%10%1%

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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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

https://github.com/jnunemaker/httparty/blob/4416141d37fd71bdba4f37589ec265f55aa446ce/lib/httparty/request/body.rb#L43

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.txt

generated 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=".txt

generated 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 %0D and 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 %0D and 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"

https://github.com/jnunemaker/httparty/blob/4416141d37fd71bdba4f37589ec265f55aa446ce/lib/httparty/request/body.rb#L43

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) .)

  1. Create Project
$ mkdir my-app
$ cd my-app
$ gem install httparty
  1. Create malicious file
$ touch 'overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt'
  1. 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)
  }
)
  1. Run Logging…
Record
GHSA-5pq7-52mg-hr42
CVSS 3.1
6.5 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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

https://github.com/jnunemaker/httparty/blob/4416141d37fd71bdba4f37589ec265f55aa446ce/lib/httparty/request/body.rb#L43

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.txt

generated 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=".txt

generated 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 %0D and 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 %0D and 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"

https://github.com/jnunemaker/httparty/blob/4416141d37fd71bdba4f37589ec265f55aa446ce/lib/httparty/request/body.rb#L43

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) .)

  1. Create Project
$ mkdir my-app
$ cd my-app
$ gem install httparty
  1. Create malicious file
$ touch 'overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt'
  1. 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)
  }
)
  1. Run Logging…
Record
GHSA-5pq7-52mg-hr42
CVSS 3.1
6.5 MediumCVSS: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 MediumCVSS: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

Affected packages
PackageAffectedFixed
httparty
RubyGems
through 0.20.0
0.21.0
ruby-httparty
Debian:12
before 0.21.0-1
0.21.0-1
ruby-httparty
Debian:13
before 0.21.0-1
0.21.0-1
ruby-httparty
Debian:14
before 0.21.0-1
0.21.0-1
ruby-httparty
Debian:10
before 0.16.2+dfsg1-3+deb10u1, plus listed versions
0.16.2+dfsg1-3
0.16.2+dfsg1-3+deb10u1
ruby-httparty
Debian:11
before 0.18.1-2+deb11u1, plus listed versions
0.18.1-2
0.18.1-2+deb11u1
httparty
RubyGems
before 0.21.0, plus listed versions
0.1.00.1.10.1.20.1.30.1.5
Show 45 moreShow less
0.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-httparty
Ubuntu:16.04:LTS
All versions, plus listed versions
0.13.5-1
None known
ruby-httparty
Ubuntu:18.04:LTS
All versions, plus listed versions
0.13.7-10.13.7-20.15.6-1
None known
ruby-httparty
Ubuntu:20.04:LTS
All versions, plus listed versions
0.17.0-1
None known
ruby-httparty
Ubuntu:22.04:LTS
All versions, plus listed versions
0.18.1-20.18.1-3
None known

History

History
RecordedChangedSources
first indexedCVE 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

Show 11 moreShow less
This page doesn't list everything

Left out here: 29 versions and the rest of 2 source descriptions. The JSON record has them.

MoveEnter Open