When this library is used to deserialize messagepack data from an untrusted source, there is a risk of a denial of service attack by an attacker that sends data contrived to produce hash collisions, leading to large CPU consumption disproportionate to the size of the data being deserialized.
This is similar to a prior advisory, which provided an inadequate fix for the hash collision part of the vulnerability.
Patches
The following steps are required to mitigate this risk.
Upgrade to a version of the library where a fix is available. If upgrading from v1, check out our migration guide.
Review the steps in this previous advisory to ensure you have your application configured for untrusted data.
Workarounds
If upgrading MessagePack to a patched version is not an option for you, you may apply a manual workaround as follows:
Declare a class that derives from MessagePackSecurity.
Override the GetHashCollisionResistantEqualityComparer<T> method to provide a collision-resistant hash function of your own and avoid calling base.GetHashCollisionResistantEqualityComparer<T>().
Configure a MessagePackSerializerOptions with an instance of your derived type by calling WithSecurity on an existing options object.
Use your custom options object for all deserialization operations. This may be by setting the MessagePackSerializer.DefaultOptions static property, if you call methods that rely on this default property, and/or by passing in the options object explicitly to any Deserialize method.
MessagePack-CSharp/MessagePack-CSharp (MessagePack)
### [`v2.5.187`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.187)
#### Changes:
- [#2014](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/issues/2014): Use a collision-resistant hash algorithm for untrusted data to address https://github.com/MessagePack-CSharp/MessagePack-CSharp/security/advisories/GHSA-4qm4-8hg2-g2xm
- [#2010](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/issues/2010): Update published security policy
This list of changes was [auto generated](https://dev.azure.com/ils0086/MessagePack-CSharp/\_build/results?buildId=2662\&view=logs).
### [`v2.5.172`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.172)
##### What's Changed
- Allow applying `[MessagePackFormatter]` on parameters and return values by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1901](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1901)
**Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.171...v2.5.172
### [`v2.5.171`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.171)
##### What's Changed
- Add .NET 8 target to mpc by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1832](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1832)
- Allow writing to init property setters of generic classes on .NET 6+ by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1879](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1879)
**Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.168...v2.5.171
### [`v2.5.168`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.168)
##### What's Changed
- fixing issue with backing field naming and serialization failing by [@epitka](https://redirect.github.com/epitka) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785)
- Feature/1804 locate formatters only if has elements inside by [@nmi-relewise](https://redirect.github.com/nmi-relewise) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805)
- Enable ignoring fields by using \[NonSerialized] by [@mookid8000](https://redirect.github.com/mookid8000) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808)
- Reduce nuget dependencies by [@thompson-tomo](https://redirect.github.com/thompson-tomo) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812)
- Raise perf tracking events when formatters are dynamically generated by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1829](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1829)
##### New Contributors
- [@epitka](https://redirect.github.com/epitka) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785)
- [@nmi-relewise](https://redirect.github.com/nmi-relewise) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805)
- [@mookid8000](https://redirect.github.com/mookid8000) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808)
- [@thompson-tomo](https://redirect.github.com/thompson-tomo) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812)
**Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.140...v2.5.168
### [`v2.5.140`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.140)
##### What's Changed
- Fix releases links in README text by [@KonH](https://redirect.github.com/KonH) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1688](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1688)
- Better constrain dictionary detection by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1687](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1687)
- Create FUNDING.yml by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1693](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1693)
- Workaround mono runtime bug by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1696](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1696)
- Add MESSAGEPACK_FORCE_AOT preprocessor directive by [@brwhelan-msft](https://redirect.github.com/brwhelan-msft) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701)
##### New Contributors
- [@brwhelan-msft](https://redirect.github.com/brwhelan-msft) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701)
**Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.129...v2.5.140
### [`v2.5.129`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.129)
##### What's Changed
- Remove `long` to `int` truncation of stream position by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1685](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1685)
**Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.124...v2.5.129
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» 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.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
2.5.124
->2.5.187
GitHub Vulnerability Alerts
CVE-2024-48924
Impact
When this library is used to deserialize messagepack data from an untrusted source, there is a risk of a denial of service attack by an attacker that sends data contrived to produce hash collisions, leading to large CPU consumption disproportionate to the size of the data being deserialized.
This is similar to a prior advisory, which provided an inadequate fix for the hash collision part of the vulnerability.
Patches
The following steps are required to mitigate this risk.
Workarounds
If upgrading MessagePack to a patched version is not an option for you, you may apply a manual workaround as follows:
MessagePackSecurity
.GetHashCollisionResistantEqualityComparer<T>
method to provide a collision-resistant hash function of your own and avoid callingbase.GetHashCollisionResistantEqualityComparer<T>()
.MessagePackSerializerOptions
with an instance of your derived type by callingWithSecurity
on an existing options object.MessagePackSerializer.DefaultOptions
static property, if you call methods that rely on this default property, and/or by passing in the options object explicitly to anyDeserialize
method.References
HashCode
struct (or in the pull request that merges this into the dotnet org).For more information
If you have any questions or comments about this advisory:
Release Notes
MessagePack-CSharp/MessagePack-CSharp (MessagePack)
### [`v2.5.187`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.187) #### Changes: - [#2014](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/issues/2014): Use a collision-resistant hash algorithm for untrusted data to address https://github.com/MessagePack-CSharp/MessagePack-CSharp/security/advisories/GHSA-4qm4-8hg2-g2xm - [#2010](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/issues/2010): Update published security policy This list of changes was [auto generated](https://dev.azure.com/ils0086/MessagePack-CSharp/\_build/results?buildId=2662\&view=logs). ### [`v2.5.172`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.172) ##### What's Changed - Allow applying `[MessagePackFormatter]` on parameters and return values by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1901](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1901) **Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.171...v2.5.172 ### [`v2.5.171`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.171) ##### What's Changed - Add .NET 8 target to mpc by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1832](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1832) - Allow writing to init property setters of generic classes on .NET 6+ by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1879](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1879) **Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.168...v2.5.171 ### [`v2.5.168`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.168) ##### What's Changed - fixing issue with backing field naming and serialization failing by [@epitka](https://redirect.github.com/epitka) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785) - Feature/1804 locate formatters only if has elements inside by [@nmi-relewise](https://redirect.github.com/nmi-relewise) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805) - Enable ignoring fields by using \[NonSerialized] by [@mookid8000](https://redirect.github.com/mookid8000) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808) - Reduce nuget dependencies by [@thompson-tomo](https://redirect.github.com/thompson-tomo) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812) - Raise perf tracking events when formatters are dynamically generated by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1829](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1829) ##### New Contributors - [@epitka](https://redirect.github.com/epitka) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1785) - [@nmi-relewise](https://redirect.github.com/nmi-relewise) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1805) - [@mookid8000](https://redirect.github.com/mookid8000) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1808) - [@thompson-tomo](https://redirect.github.com/thompson-tomo) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1812) **Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.140...v2.5.168 ### [`v2.5.140`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.140) ##### What's Changed - Fix releases links in README text by [@KonH](https://redirect.github.com/KonH) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1688](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1688) - Better constrain dictionary detection by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1687](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1687) - Create FUNDING.yml by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1693](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1693) - Workaround mono runtime bug by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1696](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1696) - Add MESSAGEPACK_FORCE_AOT preprocessor directive by [@brwhelan-msft](https://redirect.github.com/brwhelan-msft) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701) ##### New Contributors - [@brwhelan-msft](https://redirect.github.com/brwhelan-msft) made their first contribution in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1701) **Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.129...v2.5.140 ### [`v2.5.129`](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/releases/tag/v2.5.129) ##### What's Changed - Remove `long` to `int` truncation of stream position by [@AArnott](https://redirect.github.com/AArnott) in [https://github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1685](https://redirect.github.com/MessagePack-CSharp/MessagePack-CSharp/pull/1685) **Full Changelog**: https://github.com/MessagePack-CSharp/MessagePack-CSharp/compare/v2.5.124...v2.5.129Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» 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.