Security

A public key with no private key: gost-engine's missing subgroup check (GHSA-c92j-m65q-j326)

Artem Safonov
Artem Safonov , Threat Analyst
A public key with no private key: gost-engine's missing subgroup check (GHSA-c92j-m65q-j326)
Cover © Anonhaven

gost-engine, the open-source library that adds Russian GOST cryptography to OpenSSL, verified GOST R 34.10-2012 signatures without checking that the signer's public key belongs to the prime-order subgroup of its curve. On the two parameter sets whose cofactor is 4, a signature could pass verification with no assurance that a matching private key produced it, according to the advisory GHSA-c92j-m65q-j326. The advisory reports tests with raw signatures, CMS SignedData, X.509 certificate chains, PKCS#10 certificate requests and GOST-TLS server authentication, and it scores the flaw 7.5 (High) on CVSS 3.1. It also sets a limit on every consequence described below: "The practical impact depends on how the application imports public keys, establishes certificate trust, and uses the affected parameter sets."

An attacker needs no account and no privileges on the verifying system. The verifier has to accept a public key that the attacker supplies on one of the two parameter sets, for example inside a certificate or a certificate request. Every other parameter set that gost-engine defines has a cofactor of 1 and is not affected. The advisory does not mention exploitation and publishes no proof of concept, and its reproduction materials were shared with the maintainers privately. According to the reporter, a CVE number has been requested through GitHub, and none had been assigned as of November 27, 2026.

  • Affected: gost-engine releases 3.0.0 to 3.0.3, the openssl_1_1_1 branch and master builds made before the merge of October 22, 2026, when keys use id-tc26-gost-3410-2012-256-paramSetA or id-tc26-gost-3410-2012-512-paramSetC. The advisory metadata gives the range as 3.0.3 and earlier.
  • Fixed in: release v3.0.5, published on October 22, 2026. The project has no 3.0.4 release, and the openssl_1_1_1 branch has not received the fix.
  • Attack requires: a verifier that accepts an attacker-supplied public key on one of the two parameter sets. No credentials are needed, and the outcome depends on how the application imports keys and builds trust.
  • Exploitation: not mentioned in the advisory, which publishes no proof of concept.
  • Action: update to v3.0.5 and check distribution packages by their source, because several distributions ship a December 2025 master snapshot under a 3.0.3 version string.

What gost-engine is and where it runs

gost-engine is the open-source project that brings the Russian GOST algorithms to OpenSSL, and its repository describes it as a reference implementation of those algorithms. It loads into OpenSSL in two ways: as an engine, which is the older plug-in interface, and as a provider named gostprov for OpenSSL 3. An application calls OpenSSL as usual for certificates, CMS messages and TLS, and OpenSSL passes every GOST key and signature to the engine or the provider.

The repository has existed since August 2015 and had close to 500 stars and about 200 forks on November 27, 2026. Packages built from it ship in Debian, Ubuntu, Fedora, Gentoo, FreeBSD Ports and OpenWrt, according to Repology and the distributions' own package pages. Whether a given system is exposed still depends on whether its applications use the two affected parameter sets at all.

GOST R 34.10-2012 is the Russian federal standard for digital signatures, and RFC 7091 publishes it in English. The private key is an integer, the public key is a point on an elliptic curve, and a signature is a pair of integers r and s. Each named parameter set fixes one curve, and gost-engine ships sets for 256-bit and 512-bit keys.

Two parameter sets with a cofactor of 4

RFC 7091 describes a parameter set by a handful of numbers. Each set's curve has m points in total, and inside that group sits a cyclic subgroup of prime order q with a base point P that generates it. The ratio m/q is the cofactor. When the cofactor is 1 the subgroup is the whole curve. With a larger cofactor, the curve also holds points outside the subgroup, and among them are small-order points, whose multiples form only a handful of distinct points.

gost-engine keeps its curves in two tables in gost_params.c, and every entry carries the cofactor as a string. Nine of the eleven entries carry "1". The two twisted Edwards sets from RFC 7836, id-tc26-gost-3410-2012-256-paramSetA and id-tc26-gost-3410-2012-512-paramSetC, carry "4". Their object identifiers are 1.2.643.7.1.2.1.1.1 and 1.2.643.7.1.2.1.2.3.

We computed m/q from the values printed in RFC 7836 for both sets, and the result is exactly 4. These are the two sets that the advisory names as affected. Every set that the advisory lists as unaffected, namely CryptoPro A, B, C, XchA and XchB and the 512-bit sets A, B and Test, carries "1" in the same tables.

When gost-engine builds an OpenSSL group from a table entry, the function fill_GOST_EC_params hands the cofactor to OpenSSL together with the base point and the subgroup order:

    if (!BN_hex2bn(&x, params->x)
        || !BN_hex2bn(&y, params->y)
        || !EC_POINT_set_affine_coordinates(grp, P, x, y, ctx)
        || !BN_hex2bn(&q, params->q)) {
        GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_INTERNAL_ERROR);
        goto end;
    }

    if (!EC_GROUP_set_generator(grp, P, q, cofactor)) {
        GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_INTERNAL_ERROR);
        goto end;
    }

gost_ec_sign.c, lines 152 to 163, commit 509dcb4 (before the fix). The group is built with the cofactor taken from the parameter table.

The library therefore knew that the groups of these two sets are four times larger than their subgroups. Before the fix, neither the key import functions nor the signature verifier consulted that value.

Parameter sets and cofactors in gost-engine

Source: the tables in gost_params.c at release v3.0.5. The names id-tc26-gost-3410-2012-256-paramSetB, C and D have no entries of their own: the function gost_nid2params maps them to the CryptoPro A, B and C curves, whose cofactor is 1.

Parameter set Key size Cofactor Affected
id-GostR3410-2001-TestParamSet 256 bits 1 No
id-GostR3410-2001-CryptoPro-A-ParamSet 256 bits 1 No
id-GostR3410-2001-CryptoPro-B-ParamSet 256 bits 1 No
id-GostR3410-2001-CryptoPro-C-ParamSet 256 bits 1 No
id-GostR3410-2001-CryptoPro-XchA-ParamSet 256 bits 1 No
id-GostR3410-2001-CryptoPro-XchB-ParamSet 256 bits 1 No
id-tc26-gost-3410-2012-256-paramSetA 256 bits 4 Yes
id-tc26-gost-3410-2012-512-paramSetTest 512 bits 1 No
id-tc26-gost-3410-2012-512-paramSetA 512 bits 1 No
id-tc26-gost-3410-2012-512-paramSetB 512 bits 1 No
id-tc26-gost-3410-2012-512-paramSetC 512 bits 4 Yes

What the verification equation takes for granted

RFC 7091 defines the two keys in its section 5.2. The signature key is an integer d with 0 < d < q, and the verification key is the point Q = d·P. Every key built this way lies in the subgroup generated by P, so q·Q = O, where O is the identity point of the curve, called the zero point in the RFC and the point at infinity in OpenSSL. Section 6 then requires, in one sentence placed before the numbered steps, that every user's signature key and verification key satisfy the requirements of section 5.2.

The verification process itself consists of seven steps:

  1. Check that 0 < r < q and 0 < s < q, and reject the signature otherwise.
  2. Compute the hash of the received message.
  3. Read the hash as an integer alpha and compute e = alpha mod q, replacing e with 1 if the result is 0.
  4. Compute v = e^(-1) mod q.
  5. Compute z1 = s·v mod q and z2 = -r·v mod q.
  6. Compute the point C = z1·P + z2·Q and take R = x_C mod q, where x_C is the x coordinate of C.
  7. Accept the signature if R = r, and reject it otherwise.

None of the seven steps examines Q. The steps rely on the requirement stated before them, and for a legitimate key that reliance is justified. With Q = d·P, step 6 collapses to C = (z1 + z2·d)·P, which is a point of the subgroup, and whether R matches r depends on the secret d.

A point of small order changes what step 6 computes. The term z2·Q can then take only as many values as Q has multiples, and none of those values depends on a secret, because such a point is not a multiple of P. In the words of the first fix commit, these curves contain points of small order "for which no private key exists". The final comparison still runs, but it no longer tests knowledge of a private key, and that is the assurance the advisory describes as missing.

This article stops at that level of description. It gives no point, no signature values and no procedure for building a key or a certificate, and the advisory publishes none of these either.

gost_ec_verify before the fix: range checks only

One function in gost-engine evaluates the verification equation: gost_ec_verify in gost_ec_sign.c. The engine and the provider both end up there, as the call chain in the next section shows. Before the fix, the function fetched the public key from the key object, confirmed that the pointer was not null and moved straight on to the signature:

    pub_key = EC_KEY_get0_public_key(ec);
    if (!pub_key || !EC_GROUP_get_order(group, order, ctx)) {
        GOSTerr(GOST_F_GOST_EC_VERIFY, ERR_R_INTERNAL_ERROR);
        goto err;
    }

    ECDSA_SIG_get0(sig, &sig_r, &sig_s);

    if (BN_is_zero(sig_s) || BN_is_zero(sig_r) ||
        BN_is_negative(sig_s) || BN_is_negative(sig_r) ||
        BN_ucmp(sig_s, order) >= 0 || BN_ucmp(sig_r, order) >= 0) {
        GOSTerr(GOST_F_GOST_EC_VERIFY, GOST_R_SIGNATURE_PARTS_GREATER_THAN_Q);
        goto err;
    }

gost_ec_sign.c, lines 359 to 372, commit 509dcb4 (before the fix). The key is fetched, and only the two signature integers are range-checked.

The second condition is step 1 of the standard: both signature integers must be positive and below q. Nothing between the key fetch and the arithmetic asks which group the point in pub_key belongs to.

Steps 4 and 5 follow a few statements later, after the hash has been reduced modulo q:

    v = BN_mod_inverse(v, e, order, ctx);
    if (!v || !BN_mod_mul(z1, sig_s, v, order, ctx)
        || !BN_sub(tmp, order, sig_r)
        || !BN_mod_mul(z2, tmp, v, order, ctx)) {
        GOSTerr(GOST_F_GOST_EC_VERIFY, ERR_R_INTERNAL_ERROR);
        goto err;
    }

gost_ec_sign.c, lines 390 to 396, commit 509dcb4 (before the fix). Steps 4 and 5 of the verification process.

The call BN_sub(tmp, order, sig_r) produces q - r, which is how the code obtains the negative term of z2.

Step 6 is a single call that receives the unexamined key, and the statements after it take the x coordinate modulo q:

    if (!gost_ec_point_mul(group, C, z1, pub_key, z2, ctx)) {
        GOSTerr(GOST_F_GOST_EC_VERIFY, ERR_R_EC_LIB);
        goto err;
    }
    if (!EC_POINT_get_affine_coordinates(group, C, X, NULL, ctx)) {
        GOSTerr(GOST_F_GOST_EC_VERIFY, ERR_R_EC_LIB);
        goto err;
    }
    if (!BN_mod(R, X, order, ctx)) {
        GOSTerr(GOST_F_GOST_EC_VERIFY, ERR_R_INTERNAL_ERROR);
        goto err;
    }

gost_ec_sign.c, lines 410 to 421, commit 509dcb4 (before the fix). Step 6: the point C and the value R.

The function gost_ec_point_mul computes z1·P + z2·Q with pub_key in the role of Q. After that the verifier compares R with r through BN_cmp and reports GOST_R_SIGNATURE_MISMATCH when the two differ.

The code is a faithful transcription of the seven numbered steps, and that is the root of the flaw. RFC 7091 states one requirement outside the steps, that the verification key must satisfy section 5.2, and that requirement never became code in this function. The locations that the advisory gives for gost_ec_verify, internal_pub_decode_ec and gost_set_raw_pub_key match the master commit of October 15, 2026 on which the fix is based.

We compared gost_ec_sign.c across release v3.0.2, release v3.0.3, the December 2025 master commit that Debian packages, the revision the advisory tested and the commit on which the fix is based. All five copies are byte-identical. The advisory states that the gost_ec_verify implementation in v3.0.3 was byte-identical to the one in the revision it tested. Our comparison of the whole file confirms that for this pair and shows the same for the other three revisions.

How an unchecked key reached the verifier

A check inside the verifier would have been one line of defense, and a check at key import would have been another. Before the fix gost-engine had neither. Public keys from certificates and certificate requests arrive as an X.509 SubjectPublicKeyInfo structure, and internal_pub_decode_ec in gost_ameth.c turns the structure into a point:

    BUF_reverse(databuf, ASN1_STRING_get0_data(octet), octet_length);
    len = octet_length / 2;

    Y = BN_bin2bn(databuf, len, NULL);
    X = BN_bin2bn(databuf + len, len, NULL);
    if (!X || !Y) {
        GOSTerr(GOST_F_PUB_DECODE_GOST_EC, ERR_R_BN_LIB);
        goto ret;
    }
    pub_key = EC_POINT_new(group);
    if (!EC_POINT_set_affine_coordinates(group, pub_key, X, Y, NULL)) {
        GOSTerr(GOST_F_PUB_DECODE_GOST_EC, ERR_R_EC_LIB);
        goto ret;
    }

    retval = EC_KEY_set_public_key(ec, pub_key);

gost_ameth.c, lines 1127 to 1142, commit 509dcb4 (before the fix). The X.509 decoder builds the point and stores it.

The function reverses the byte order, splits the buffer into two halves and hands the two integers to OpenSSL. In OpenSSL 3.6.0 the call EC_POINT_set_affine_coordinates refuses a point that is not on the curve, and that was the only test an imported point met. The advisory makes the same observation: confirming curve membership alone does not address subgroup membership. Nor was the length of the buffer compared with the size that the parameter set requires.

A second import path is gost_set_raw_pub_key, which was merged in May 2025. The engine registers it as its raw public key setter and also calls it from the TLS control ASN1_PKEY_CTRL_SET1_TLS_ENCPT:

    half = len / 2;
    if ((X = BN_lebin2bn(pub, half, NULL)) == NULL
        || (Y = BN_lebin2bn(pub + half, half, NULL)) == NULL
        || (pub_key = EC_POINT_new(group)) == NULL) {
            goto end;
    }

    if (EC_POINT_set_affine_coordinates(group, pub_key, X, Y, NULL) != 1) {
        goto end;
    }

    if (EC_KEY_set_public_key(ec, pub_key) != 1) {
        goto end;
    }

gost_ameth.c, lines 439 to 452, commit 509dcb4 (before the fix). The raw key setter follows the same pattern.

The pattern is the same as in the decoder: two halves, a point on the curve, and the key is stored.

From a stored key the path to the verifier is short, and it is the same for both interfaces:

  1. The application asks OpenSSL to verify a signature made with a GOST key, for example on a certificate in a chain, on a CMS message or on a certificate request.
  2. OpenSSL calls the engine method pkey_gost_ec_cp_verify or, when the provider is loaded, signature_verify or signature_digest_verify_final in gost_prov_signature.c.
  3. All three functions call internal_pkey_ec_cp_verify in gost_pmeth.c.
  4. That function unpacks the signature with unpack_cp_signature and passes the two integers and the key to gost_ec_verify.

The provider documentation describes gostprov as a wrapper around the engine code, and the call chain bears that out. In the provider, the X.509 decoder calls the same internal_pub_decode_ec, so a key decoded through gostprov skipped the same check. The provider's signature, key management and decoder code entered master in August 2025 and appeared in no release before v3.0.5.

The engine does register a key check of its own. Its function pkey_gost_check delegates to OpenSSL's EC_KEY_check_key, and its comment describes it as the callback for EVP_PKEY_check() and EVP_PKEY_public_check. Neither the import functions nor the verifier call it.

What the advisory reports from testing

Everything in this section is the advisory's account, and none of it was reproduced for this article. The advisory says the tests used OpenSSL 3.6.5 with gost-engine built from master commit 4632029 of September 25, 2026. They ran through both the engine and the provider, with laboratory keys and a laboratory certificate authority. The advisory lists six results:

  • X.509 certificate chains: an invalid chain was accepted in the laboratory trust configuration, including with additional certificate-verification checks enabled.
  • Raw signatures: invalid signatures were accepted through both the engine and the provider verification paths.
  • PKCS#10 certificate requests: signature verification succeeded without establishing possession of a corresponding private key.
  • CMS SignedData: an invalid signature was accepted, while a control sample was rejected.
  • GOST-TLS: a handshake that used the invalid certificate chain completed, and the control case failed certificate-signature verification.
  • 512-bit keys: the finding was also reproduced with the 512-bit set paramSetC.

From these results the advisory derives four consequences for applications that use the affected implementation and parameter sets. A GOST-TLS client may accept an invalid server certificate chain, which the advisory describes as a risk of server impersonation and man-in-the-middle attacks. In the same way, a CMS verifier may accept a document signature that does not establish the signer's authenticity, X.509 chain validation may accept invalid signatures, and a PKCS#10 request may pass without proof of possession. The advisory attaches its caveat to all four: the outcome depends on how the application imports public keys, establishes certificate trust and uses the affected parameter sets.

The advisory adds that strict OpenSSL certificate-verification options did not prevent acceptance in its test environment. It does not describe the laboratory trust configuration in detail, and the materials that would show it were shared with the maintainers privately. It also says in one sentence that testing covered challenge-response scenarios, and it gives no separate result for them. For comparison, the advisory states that CryptoPro CSP 5.0.13800 and Bouncy Castle 1.78.1 rejected public keys outside the required subgroup during import in the same environment.

One part of the original advisory was wrong and has been removed. The published text included a section about Chromium-GOST, and on November 11, 2026 the maintainer of that browser objected in issue #549 that it has no GOST R 34.10 implementation of its own and routes GOST through msspi and CryptoPro CSP. The reporter re-checked, acknowledged the next day that the claim did not hold up and asked for the section to be removed, and a gost-engine maintainer removed it on November 12. In the same reply the reporter states that the gost-engine finding itself is unaffected by the correction.

The fix: a subgroup check at import and at verification

The fix consists of four commits that were merged into master on October 22, 2026, and the merge commit is the one tagged as release v3.0.5. That merge commit carries the message "Merge commit from fork", and GitHub lists no pull request for it or for any of the four commits. Both facts are consistent with the route that GitHub documents for security advisories, in which a fix is prepared in a temporary private fork and merged from the advisory. The first commit adds one helper function to gost_ec_sign.c:

    if (EC_POINT_is_at_infinity(group, pub_key))
        return 0;

    cofactor = EC_GROUP_get0_cofactor(group);
    if (cofactor && BN_is_one(cofactor))
        return 1;

    if (!(ctx = BN_CTX_new()))
        return 0;

    BN_CTX_start(ctx);
    order = BN_CTX_get(ctx);
    check = EC_POINT_new(group);
    if (order && check
        && EC_GROUP_get_order(group, order, ctx)
        && EC_POINT_mul(group, check, NULL, pub_key, order, ctx)
        && EC_POINT_is_at_infinity(group, check))
        ok = 1;

gost_ec_sign.c, lines 338 to 355, release v3.0.5 (the fix). The body of the helper gost_ec_pub_key_subgroup_check.

The helper rejects a key that is itself the point at infinity, returns early when the cofactor is 1 and otherwise multiplies the key by q and requires the product to be the point at infinity. That is the condition q·Q = O from the advisory, and the early return means that sets with a cofactor of 1 pay for no extra scalar multiplication.

The verifier now calls the helper immediately after it fetches the key and before it touches the signature:

@@ -362,6 +404,11 @@ int gost_ec_verify(const unsigned char *dgst, int dgst_len,
         goto err;
     }
 
+    if (!gost_ec_pub_key_subgroup_check(group, pub_key)) {
+        GOSTerr(GOST_F_GOST_EC_VERIFY, GOST_R_PUBLIC_KEY_NOT_IN_SUBGROUP);
+        goto err;
+    }
+
     ECDSA_SIG_get0(sig, &sig_r, &sig_s);
 
     if (BN_is_zero(sig_s) || BN_is_zero(sig_r) ||

gost_ec_sign.c, commit bc1b099 (the fix). The added check is at lines 407 to 410 of the file in release v3.0.5.

A key outside the subgroup now ends verification with the new reason code GOST_R_PUBLIC_KEY_NOT_IN_SUBGROUP, whose text is "public key not in subgroup".

The second commit puts the same call into the X.509 decoder, after the point is built and before it is stored in the key object:

@@ -1139,6 +1155,11 @@ int internal_pub_decode_ec(EC_KEY *ec, int *key_type, X509_ALGOR *palg,
         goto ret;
     }
 
+    if (!gost_ec_pub_key_subgroup_check(group, pub_key)) {
+        GOSTerr(GOST_F_PUB_DECODE_GOST_EC, GOST_R_PUBLIC_KEY_NOT_IN_SUBGROUP);
+        goto ret;
+    }
+
     retval = EC_KEY_set_public_key(ec, pub_key);
     if (!retval)
         GOSTerr(GOST_F_PUB_DECODE_GOST_EC, ERR_R_EC_LIB);

gost_ameth.c, commit 0ada842 (the fix). The added check is at lines 1158 to 1161 of the file in release v3.0.5.

The raw key setter gost_set_raw_pub_key receives the identical test with its own function code, so both import functions now refuse such a key before any signature is involved.

The fix does not lean on OpenSSL's generic key check, and the message of the second commit gives the reason: EC_KEY_check_key() is deliberately not used, because its subgroup check depends on the OpenSSL version and on the group flags. The advisory's first recommendation says the same. A regression test, test_subgroup.c, arrives with the fourth commit and has four cases whose names state their purpose: rejection of a small-order key by the verifier, rejection by the decoder, a legitimate round trip on a cofactor-4 set and exact signature length. Working code grew by about a hundred lines across six files, and the test accounts for the rest of the change.

The test calls gost_ec_verify, internal_pub_decode_ec and unpack_cp_signature directly. No test in the change goes through the provider interface or through gost_set_raw_pub_key, although the advisory's fourth recommendation asked for regression coverage through both interfaces. Of the four recommendations in the advisory, the release carries out the first and the second as written: validation in the two import functions with exact lengths, and the same validation repeated in the verifier. The third, which suggested disabling signature operations with the affected sets until validation was in place, was not applied, and both sets stay enabled in v3.0.5.

The release page does not announce any of this. Its notes for v3.0.5 list pull requests and mention neither a security fix nor the advisory, and the fix has no pull request of its own to appear in that list. Release v3.0.1 of May 2022, by comparison, was titled "CVE-2022-29242 fix".

We assess with high confidence that every signature verification in gost-engine now passes the subgroup check on both interfaces. In release v3.0.5 gost_ec_verify has a single caller, internal_pkey_ec_cp_verify, and that function is reached only from the engine method and from the two provider functions named in the call chain above.

The check stands in three functions and not in every place where a public key can enter or be examined. In release v3.0.5 and in master as of November 19, 2026, the provider's set_encoded_key in gost_prov_keymgmt.c builds a point from two coordinate halves and stores it without calling the helper. The provider's validation function gost_key_public_check tests that the point is not at infinity, that its coordinates are below the field prime and that it lies on the curve, and it does not multiply by q. On the engine side, pkey_gost_check still delegates to EC_KEY_check_key. A key that enters by these routes meets the subgroup check at the moment a signature is verified against it.

Exact lengths for keys and signatures

The advisory records a second observation about encoding and calls it distinct from the subgroup issue. Before the fix, unpack_cp_signature in gost_pmeth.c did not know how long a signature should be and divided whatever it received into two halves:

    s = BN_bin2bn(sigbuf, siglen / 2, NULL);
    r = BN_bin2bn(sigbuf + siglen / 2, siglen / 2, NULL);
    ECDSA_SIG_set0(sig, r, s);

gost_pmeth.c, lines 611 to 613, commit 509dcb4 (before the fix). The buffer is split in half whatever its length.

The message of the third fix commit describes the effect. A signature for a 256-bit key is 64 bytes long, yet a 65-byte buffer with a trailing byte and 66-byte or 128-byte buffers with zero-padded halves were accepted as valid. The advisory notes that this behavior differed from CryptoPro CSP.

The function now receives the expected length from its caller and refuses anything else:

@@ -598,11 +598,18 @@ int pkey_gost_ec_cp_sign(EVP_PKEY_CTX *ctx, unsigned char *sig,
 
 /* ------------------- verify callbacks --------------------------- */
 /* Unpack signature according to cryptopro rules  */
-ECDSA_SIG *unpack_cp_signature(const unsigned char *sigbuf, size_t siglen)
+ECDSA_SIG *unpack_cp_signature(const unsigned char *sigbuf, size_t siglen,
+                               size_t expected_len)
 {
     ECDSA_SIG *sig;
     BIGNUM *r = NULL, *s = NULL;
 
+    /* Reject anything but the exact signature size */
+    if (siglen != expected_len) {
+        GOSTerr(GOST_F_UNPACK_CP_SIGNATURE, GOST_R_INVALID_BUFFER_SIZE);
+        return NULL;
+    }
+

gost_pmeth.c, commit cfad5e3 (the fix). The added length test is at lines 607 to 611 of the file in release v3.0.5.

The caller, internal_pkey_ec_cp_verify, computes expected_len as twice the byte size of the subgroup order, which gives 64 bytes for 256-bit keys and 128 bytes for 512-bit keys.

The X.509 decoder gained the same strictness for the encoding of the public key:

@@ -1112,12 +1122,18 @@ int internal_pub_decode_ec(EC_KEY *ec, int *key_type, X509_ALGOR *palg,
 
     group = EC_KEY_get0_group(ec);
     octet = d2i_ASN1_OCTET_STRING(NULL, &pubkey_buf, pub_len);
+    order = BN_new();
 
-    if (!octet) {
+    if (!octet || !order) {
         GOSTerr(GOST_F_PUB_DECODE_GOST_EC, ERR_R_MALLOC_FAILURE);
         goto ret;
     }
     const int octet_length = ASN1_STRING_length(octet);
+    if (!EC_GROUP_get_order(group, order, NULL)
+        || octet_length != 2 * BN_num_bytes(order)) {
+        GOSTerr(GOST_F_PUB_DECODE_GOST_EC, GOST_R_ERROR_DECODING_PUBLIC_KEY);
+        goto ret;
+    }

gost_ameth.c, commit 0ada842 (the fix). The added length test is at lines 1132 to 1136 of the file in release v3.0.5.

The raw key setter applies the same length rule. A signature of any other size is now rejected before the arithmetic starts, and a public key of any other size fails to decode in these two functions.

How the Edwards curves entered an unchecked verifier

The verifier is older than the curves that expose it. Dated August 14, 2015, the first commit that brought the GOST 2012 algorithms into the repository already contains gost_ec_verify with the range check, the equation and no test of the key. Its parameter tables hold none of the twisted Edwards sets, and its group setup passes no cofactor to OpenSSL. In a group whose cofactor is 1 the missing test has little to catch, because the subgroup is then the whole group of points on the curve.

The two Edwards sets arrived in September 2018, two months after a commit that began to set the cofactor explicitly. In December 2018 issue #102 reported that both new sets carried m in the field meant for the subgroup order. The maintainer's reply on the same day described their status:

These parameters are completely untested in the engine so they can contain errors.

— Dmitry Belyavskiy, gost-engine maintainer, issue #102, December 27, 2018

Pull request #103 corrected the values the next day. The author of the commit that had added the sets remarked in its discussion that the choice of order had been unimportant, because the points were not used anywhere and were only validated in a test. In January 2019 a commit titled "Allow key creation using TC26 (2012) parameters" followed.

The cofactor did receive attention, but in a different operation. Pull request #265 in June 2020 carried the title "GOST key agreement cofactor fix" and added negative tests with a malicious public key for each of the two Edwards curves. In August 2021 pull request #342 moved the cofactor clearing of the VKO key agreement into the ECCKiila curve code, as its title says. RFC 7836 writes the factor m/q directly into its VKO formula, so an implementer of key agreement meets the cofactor on the page. No such factor appears in the verification steps of RFC 7091.

The last change to the verifier before the fix was a commit of May 2022 that tightened the range check and cited section 6.2 of the standard. It touched step 1 and nothing else.

We assess with moderate confidence that the missing check was an oversight inherited from the cofactor-1 era and not a design decision. The verifier predates the Edwards sets by three years, the standard states the key requirement outside its numbered steps, and the project's later cofactor fixes, in 2020 and 2021, concerned key agreement. This assessment rests on the code history alone, with no statement from the maintainers on the question, and that is why the confidence is not higher.

Affected versions and fixed builds

The advisory metadata lists versions up to 3.0.3 as affected and 3.0.5 as patched, and the code supports both ends of that range with two refinements. Releases 3.0.0, 3.0.1, 3.0.2 and 3.0.3 all define the two cofactor-4 sets and contain no subgroup check. Release v3.0.5 is the merge commit of the fix, and the repository has no 3.0.4 tag. The step between the two tags is much larger than the fix: GitHub's comparison of v3.0.3 with v3.0.5 counts 121 commits and 183 changed files.

Readers who audit a tagged release will find the same code under older names. In v3.0.3 the X.509 decoder is pub_decode_gost_ec, and the engine method pkey_gost_ec_cp_verify calls gost_ec_verify itself. The internal_ functions shown above appeared in master with the provider work, and v3.0.3 has no gost_set_raw_pub_key at all.

We assess with high confidence that in releases 3.0.0 to 3.0.3 the exposure is limited to the engine interface. The provider in those releases contains only cipher, digest and MAC code, and its signature, key management and decoder files were merged into master in August 2025. For that reason the advisory's provider result applies to master builds made between that merge and the fix, such as the revision it tested.

The first refinement concerns packages built from master. Debian testing and unstable ship version 3.0.3+git20251212.7f6d61a-2, a snapshot of master commit 7f6d61a of December 12, 2025. We compared that commit with the fix: it lies 73 commits before the first fix commit, its gost_ec_sign.c is byte-identical to the file before the fix, and it already includes the raw key import and the provider signature path.

We assess with high confidence that this Debian package verifies signatures without the subgroup check through the engine and the provider alike. The package source carries no patches directory, and its install list ships both the engine and the provider module. Repology and Launchpad showed the same snapshot on November 27, 2026 in Devuan unstable, Kali Linux Rolling, Raspbian testing and the proposed pocket of Ubuntu 27.04. The advisory's range of 3.0.3 and earlier does not describe these packages, because their version string names 3.0.3 plus a later snapshot while their code predates the fix.

Stable distribution releases mostly carry the tagged versions. Debian 12 has 3.0.1, Ubuntu 24.04 and 26.04 have 3.0.2, Fedora 43 and 44 have 3.0.3, OpenWrt 24.10 has 3.0.3, and Gentoo already offers 3.0.5. A version string shows the upstream base and not the patches a distribution may have added, so the reliable test is the source. Fixed builds contain the function gost_ec_pub_key_subgroup_check in gost_ec_sign.c and the error code GOST_R_PUBLIC_KEY_NOT_IN_SUBGROUP in e_gost_err.h.

The second refinement concerns the older branch. Users of OpenSSL 1.1.1 are directed by the project README to the openssl_1_1_1 branch, whose last commit dates from May 2022. That branch defines both cofactor-4 sets, has no subgroup check and has not received the fix, so the code confirms the advisory's listing of it as affected. GitHub's comparison places the branch 394 commits behind the fix and 29 commits ahead of it, and the project has published no release from it.

Release v1.1.0.3 of August 2018, in contrast, defines neither set. The advisory's phrase about versions "dating back to approximately 2018" therefore holds for code written after the Edwards sets were added in September of that year.

One sentence of the advisory has been overtaken by events. It says that the subgroup check was still absent from master as of October 15, 2026. That was accurate when the sentence was written: the fix commits are based on the master commit of that day, and the merge followed a week later, on October 22.

The advisory scores the flaw 7.5 on CVSS 3.1 with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N and classifies it as CWE-347, improper verification of a cryptographic signature. It notes that an assessment with changed scope yields 8.6. The advisory exists only in the gost-engine repository, and its record names no package ecosystem and no vulnerable functions. GitHub's global advisory database had no entry for it on November 27, 2026 and no CVE number had been assigned, so tools that match packages against those two sources have no record to match.

Versions and branches checked against the code

Source: the gost-engine repository at the listed tags and commits. The interface column names the interfaces that carry GOST signature code at that point.

Version or commit Date Cofactor-4 sets Subgroup check Signature interfaces
Release v1.1.0.3 August 21, 2018 Not defined No Engine
Branch openssl_1_1_1 at 739f957 May 20, 2022 Defined No Engine
Release v3.0.0 September 20, 2021 Defined No Engine
Release v3.0.1 May 23, 2022 Defined No Engine
Release v3.0.2 August 14, 2023 Defined No Engine
Release v3.0.3 November 17, 2023 Defined No Engine
master at 7f6d61a December 12, 2025 Defined No Engine and provider
master at 4632029 September 25, 2026 Defined No Engine and provider
master at 509dcb4 October 15, 2026 Defined No Engine and provider
Release v3.0.5 October 22, 2026 Defined Yes Engine and provider
master at 6d625ce November 19, 2026 Defined Yes Engine and provider

Distribution packages on November 27, 2026

Source: Repology, the Debian package tracker and source archive, Launchpad and the Fedora package index, as they stood on November 27, 2026. The table shows upstream base versions. It does not establish whether a distribution has added the fix as a patch, except for Debian testing and unstable, where the package source carries no patches.

Distribution Package version Upstream base
Debian 12 (bookworm) 3.0.1-2 Release before the fix
Debian testing and unstable 3.0.3+git20251212.7f6d61a-2 master snapshot before the fix, engine and provider
Devuan unstable, Kali Linux Rolling, Raspbian testing 3.0.3+git20251212.7f6d61a The same master snapshot
Ubuntu 27.04 (proposed) 3.0.3+git20251212.7f6d61a The same master snapshot
Ubuntu 26.04 3.0.2-1ubuntu2 Release before the fix
Ubuntu 25.04 and 25.10 3.0.2 Release before the fix
Ubuntu 24.04 3.0.2-1build2 Release before the fix
deepin 25 3.0.2 Release before the fix
Raspbian oldstable 3.0.1 Release before the fix
Fedora 44 3.0.3-11.fc44 Release before the fix
Fedora 43 3.0.3-10.fc43 Release before the fix
OpenWrt 24.10 3.0.3 Release before the fix
OpenWrt 23.05 3.0.1 Release before the fix
FreeBSD Ports g20250528 Snapshot dated May 28, 2025, which predates the fix
Gentoo 3.0.5 and 9999 Release with the fix and a live build
LiGurOS develop 3.0.5 Release with the fix
LiGurOS stable 3.0.3, 3.0.2, 3.0.1 Releases before the fix

Advisory record

Source: the advisory page and the GitHub API record of the advisory, the fix commits and the repository on November 27, 2026.

Field Value
Identifier GHSA-c92j-m65q-j326
Severity 7.5 (High), CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Weakness CWE-347, improper verification of cryptographic signature
CVE Requested through GitHub according to the reporter, not assigned as of November 27, 2026
Affected versions in the metadata 3.0.3 and earlier
Patched version in the metadata 3.0.5
Published October 22, 2026, by a gost-engine maintainer
Last updated November 12, 2026
Credit Ashinto (reporter)
Size of the fix Four commits, 333 lines added and 4 removed, of which 231 added lines are the regression test and its build entry
Repository 470 stars and 201 forks on November 27, 2026

What to do

  • Update to v3.0.5: install release v3.0.5 or a master build that includes merge commit 09fdd53, because these are the upstream builds in which the verifier and both import functions check subgroup membership.
  • Check packages by source: confirm that gost_ec_sign.c in your package contains gost_ec_pub_key_subgroup_check, because a version string such as 3.0.3+git20251212 names a master snapshot that predates the fix.
  • Find where the two sets are used: search certificates, trust stores, CMS workflows and TLS configurations for id-tc26-gost-3410-2012-256-paramSetA (OID 1.2.643.7.1.2.1.1.1) and id-tc26-gost-3410-2012-512-paramSetC (OID 1.2.643.7.1.2.1.2.3), because only keys on these two sets are affected and the other sets need no action. In key generation commands and scripts the engine's paramset option also accepts the short values TCA for the 256-bit set and C for the 512-bit set (for 256-bit keys the same letter C selects the CryptoPro C set, which has a cofactor of 1 and is not affected).
  • Restrict the two sets where an update must wait: refuse signature operations with them until a fixed build is in place, because this is the interim measure that the advisory itself recommends.
  • Treat the 1.1.1 branch as unfixed: move systems built from openssl_1_1_1 to a fixed build or apply the restriction above, because that branch defines both sets and has received no backport.
  • Verify earlier acceptances again: pass signatures, certificates and requests that were accepted with keys on these two sets through a fixed build, because a fixed build rejects a key outside the subgroup with the error "public key not in subgroup".

Timeline

This table lists events that have a public source, with times in UTC. The dates of the private report to the maintainers and of their reply are not public, and the table omits them for that reason.

Date (UTC) Event Source
August 14, 2015 The commit that introduces the GOST 2012 algorithms contains gost_ec_verify without a test of the public key Commit cba1694
July 12, 2018 The group setup begins to pass the cofactor to OpenSSL Commit 445a097
August 21, 2018 Release v1.1.0.3, which defines neither cofactor-4 set Release page
September 18, 2018 The two twisted Edwards parameter sets are added Commit 6f998d6
December 27, 2018, 09:17 Issue #102 reports that both sets carry m in the order field, and the maintainer answers within minutes Issue #102
December 28, 2018, 08:22 Pull request #103 with the corrected subgroup orders is merged Pull request #103
January 25, 2019 Commit "Allow key creation using TC26 (2012) parameters" Commit b2e0f8c
June 8, 2020 Pull request #265, "GOST key agreement cofactor fix", is merged Pull request #265
August 11, 2021 Pull request #342, "push VKO cofactor clearing into ECCKiila", is merged Pull request #342
September 20, 2021 Release v3.0.0 Release page
May 20, 2022 Last commit on the openssl_1_1_1 branch Branch history
May 23, 2022 Release v3.0.1 Release page
May 24, 2022 The range check of step 1 in gost_ec_verify is tightened Commit 021a2b6
August 14, 2023 Release v3.0.2 Release page
November 17, 2023 Release v3.0.3 Release page
May 28, 2025 Pull request #453 with raw public key import and export is merged Pull request #453
August 26, 2025 Pull request #482 with the provider's signature, key management and decoder code is merged Pull request #482
December 12, 2025, 15:40 master commit that Debian later packages as a snapshot Commit 7f6d61a
January 6 and 10, 2026 Debian accepts 3.0.3+git20251212.7f6d61a-1 and then -2 into unstable Debian package tracker
September 25, 2026, 16:21 master commit that the advisory names as the tested revision Commit 4632029
October 15, 2026, 17:20 master commit on which the fix commits are based Commit 509dcb4
October 21, 2026, 10:56 Commit date of the four fix commits Commits bc1b099, 0ada842, cfad5e3, 0b19640
October 22, 2026, 11:57 The fix is merged into master, and the tag v3.0.5 points to the merge Commit 09fdd53
October 22, 2026, 11:58 The advisory is published GHSA-c92j-m65q-j326
October 22, 2026, 12:05 Release v3.0.5 is published Release page
November 11, 2026, 14:02 Issue #549 disputes the Chromium-GOST section of the advisory Issue #549
November 12, 2026, 08:17 The reporter acknowledges the error and asks for the section to be removed Issue #549
November 12, 2026, 08:27 The advisory is updated without the Chromium-GOST section, and the issue is closed at 08:38 GHSA-c92j-m65q-j326, issue #549
November 27, 2026 A CVE number has been requested through GitHub and is not assigned The reporter

Conclusion

GHSA-c92j-m65q-j326 is a missing precondition and not a broken algorithm. gost-engine implemented the seven verification steps of GOST R 34.10-2012 exactly, and for nine of its eleven parameter sets that was sufficient. For the two twisted Edwards sets with a cofactor of 4, the standard's requirement that a verification key belong to the subgroup had to be enforced in code, and until October 22, 2026 it was not.

Release v3.0.5 enforces the requirement in the verifier and in both import functions, and it adds exact-length rules for keys and signatures. What remains open lies outside that release: the branch for OpenSSL 1.1.1 has no fix, several distributions ship a master snapshot from before the fix under a 3.0.3 version string, and no CVE number exists yet for inventories to match. How far any deployment was exposed depends, as the advisory says, on how its applications import keys and build trust, and each operator of the two parameter sets has to answer that for their own systems.

Sources

Table of Contents
  1. Contents are built when the page loads

Have a story? Become a contributor.

We work with independent researchers and cybersecurity professionals. Send us a tip or submit your article for editorial review.

Questions on the topic

Which gost-engine version fixes GHSA-c92j-m65q-j326?
Release v3.0.5, published on October 22, 2026, adds the subgroup check to the signature verifier and to both public key import functions. There is no 3.0.4 release, and the openssl_1_1_1 branch has not received the fix. Check distribution packages by their source, because some ship a December 2025 master snapshot under a 3.0.3 version string.
Which GOST parameter sets does the gost-engine subgroup check flaw affect?
Only id-tc26-gost-3410-2012-256-paramSetA and id-tc26-gost-3410-2012-512-paramSetC, the two twisted Edwards sets whose cofactor is 4. The other nine parameter sets that gost-engine defines have a cofactor of 1 and are not affected.
Is GHSA-c92j-m65q-j326 in gost-engine being exploited?
The advisory does not mention exploitation in the wild and publishes no proof of concept. Its reproduction materials were shared with the maintainers privately. The practical impact depends on how an application imports public keys and establishes certificate trust.