GHSA-m4w9-hjfw-vwj4: http4k `HmacSha256.hash` (despite The `Hmac` Naming) Vulnerability

HIGH
CWE-345
Published
Advisory Summary

GHSA-m4w9-hjfw-vwj4 is a HIGH `hmacsha256.hash` (despite the `hmac` naming) vulnerability (CWE-345: Insufficient Verification of Data Authenticity) affecting http4k libraries in the Maven ecosystem. The issue involves `hmacsha256.hash` (despite the `hmac` naming) computed a plain unkeyed digest; clarified by deprecation in favour of `sha256.hash` / `sha256.hmac`. Remediation is available by upgrading affected packages to version 6.49.0.0.

GHSA-m4w9-hjfw-vwj4 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-m4w9-hjfw-vwj4
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-345: Insufficient Verification of Data Authenticity
Affected Product http4k
Package Ecosystem Maven
Published Date
Last Updated

How to Fix GHSA-m4w9-hjfw-vwj4

To remediate this vulnerability, upgrade all affected http4k dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.http4k:http4k-core fixed: 6.49.0.0
<dependency>
    <groupId>org.http4k</groupId>
    <artifactId>http4k-core</artifactId>
    <version>6.49.0.0</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.http4k

How to Check if You Are Affected

To determine whether your Java application is affected by GHSA-m4w9-hjfw-vwj4, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.http4k

Analyze the terminal output to locate any version of http4k in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.49.0.0), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.http4k command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-345: Insufficient Verification of Data Authenticity, where the product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data. In http4k, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact The `HmacSha256` class contained two functions: - `hash(payload)` — a plain unkeyed SHA-256 digest. The `Hmac` prefix in the class name was misleading; this function has no key parameter, so it could never have been an HMAC. - `hmacSHA256(key, data)` — a properly keyed HMAC-SHA256. A reader who didn't engage with the function signature could in principle have assumed `HmacSha256.hash(payload)` was somehow keyed, but the absence of any key parameter made that misuse unlikely in practice. **Who is affected:** any downstream caller who read the class name and used `HmacSha256.hash` as a message authentication code without noticing it takes no key. **Verified at v6.47.2.0: zero internal misuse in http4k itself.** Both production usages of `HmacSha256.hash` (AWS SigV4 canonical-request hashing in `AwsSignatureV4Signer.kt` and `x-amz-content-sha256` in `awsExtensions.kt`) are AWS-spec-correct uses of plain SHA-256; every keyed `hmacSHA256(key, data)` call passes a real key. The advisory exists so any downstream caller relying on the misleadingly-named API knows to migrate. ### Patches Upgrade to **6.49.0.0** or later. The fix introduces: - `Sha256.hash(input)` — unkeyed digest (the actual behaviour `HmacSha256.hash` provided). - `Sha256.hmac(key, input)` — keyed HMAC-SHA256 (the behaviour the name implied). `HmacSha256` is deprecated. Existing callers continue to work via deprecation shims; migrate to `Sha256.hash` or `Sha256.hmac` per intent. ### Workarounds If you cannot upgrade and you need a real HMAC-SHA256, use `javax.crypto.Mac.getInstance("HmacSHA256")` with a `SecretKeySpec`. For an unkeyed SHA-256 digest, use `java.security.MessageDigest.getInstance("SHA-256")`. The keyed `hmacSHA256(key, data)` was always correctly implemented and is safe to use as-is. ### References - Fix release: [v6.49.0.0](https://github.com/http4k/http4k/releases/tag/6.49.0.0) - Background: [RFC 2104 — HMAC: Keyed-Hashing for Message Authentication](https://datatracker.ietf.org/doc/html/rfc2104)

GHSA-m4w9-hjfw-vwj4 Affected http4k Versions

1 component(s)
Fixed Versions:
6.49.0.0
Product / Package Ecosystem Affected Versions Fixed Version
org.http4k:http4k-core
Maven
< 6.49.0.0
6.49.0.0

References

Frequently Asked Questions

What is GHSA-m4w9-hjfw-vwj4?
GHSA-m4w9-hjfw-vwj4 is a security vulnerability in http4k involving `HmacSha256.hash` (despite the `Hmac` naming) computed a plain unkeyed digest; clarified by deprecation in favour of `Sha256.hash` / `Sha256.hmac` under CWE-345: Insufficient Verification of Data Authenticity.
Which http4k versions are affected?
Affected versions include releases prior to 6.49.0.0 across affected packages: org.http4k:http4k-core.
What version fixes GHSA-m4w9-hjfw-vwj4?
Upgrading to 6.49.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is http4k-core affected?
Yes, org.http4k:http4k-core is affected in releases prior to 6.49.0.0. Upgrade your dependency to 6.49.0.0 or later.
What CWE is associated with GHSA-m4w9-hjfw-vwj4?
GHSA-m4w9-hjfw-vwj4 is classified under CWE-345: Insufficient Verification of Data Authenticity (The product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.).
How can I check Maven dependencies for GHSA-m4w9-hjfw-vwj4?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.http4k'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m4w9-hjfw-vwj4",
  "modified" : "2026-06-19T21:16:03Z",
  "published" : "2026-06-19T21:16:03Z",
  "aliases" : [ ],
  "summary" : "http4k: `HmacSha256.hash` (despite the `Hmac` naming) computed a plain unkeyed digest; clarified by deprecation in favour of `Sha256.hash` / `Sha256.hmac`",
  "details" : "### Impact\n\nThe `HmacSha256` class contained two functions:\n- `hash(payload)` — a plain unkeyed SHA-256 digest. The `Hmac` prefix in the class name was misleading; this function has no key parameter, so it could never have been an HMAC.\n- `hmacSHA256(key, data)` — a properly keyed HMAC-SHA256.\n\nA reader who didn't engage with the function signature could in principle have assumed `HmacSha256.hash(payload)` was somehow keyed, but the absence of any key parameter made that misuse unlikely in practice.\n\n**Who is affected:** any downstream caller who read the class name and used `HmacSha256.hash` as a message authentication code without noticing it takes no key. **Verified at v6.47.2.0: zero internal misuse in http4k itself.** Both production usages of `HmacSha256.hash` (AWS SigV4 canonical-request hashing in `AwsSignatureV4Signer.kt` and `x-amz-content-sha256` in `awsExtensions.kt`) are AWS-spec-correct uses of plain SHA-256; every keyed `hmacSHA256(key, data)` call passes a real key. The advisory exists so any downstream caller relying on the misleadingly-named API knows to migrate.\n\n### Patches\n\nUpgrade to **6.49.0.0** or later. The fix introduces:\n- `Sha256.hash(input)` — unkeyed digest (the actual behaviour `HmacSha256.hash` provided).\n- `Sha256.hmac(key, input)` — keyed HMAC-SHA256 (the behaviour the name implied).\n\n`HmacSha256` is deprecated. Existing callers continue to work via deprecation shims; migrate to `Sha256.hash` or `Sha256.hmac` per intent.\n\n### Workarounds\n\nIf you cannot upgrade and you need a real HMAC-SHA256, use `javax.crypto.Mac.getInstance(\"HmacSHA256\")` with a `SecretKeySpec`. For an unkeyed SHA-256 digest, use `java.security.MessageDigest.getInstance(\"SHA-256\")`. The keyed `hmacSHA256(key, data)` was always correctly implemented and is safe to use as-is.\n\n### References\n\n- Fix release: [v6.49.0.0](https://github.com/http4k/http4k/releases/tag/6.49.0.0)\n- Background: [RFC 2104 — HMAC: Keyed-Hashing for Message Authentication](https://datatracker.ietf.org/doc/html/rfc2104)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.http4k:http4k-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.49.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/http4k/http4k/security/advisories/GHSA-m4w9-hjfw-vwj4"
  }, {
    "type" : "WEB",
    "url" : "https://datatracker.ietf.org/doc/html/rfc2104"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/http4k/http4k"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/http4k/http4k/releases/tag/6.49.0.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-345" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-19T21:16:03Z",
    "nvd_published_at" : null
  }
}