<div dir="ltr"><div><div><div>Thank you for your response, and thank you for upstreaming this issue to libksba. <br><br></div>May I be granted a GNU bugtracker account, such that I may participate in the ticket thread? I would like to emphasize the security impact of this issue, as an attacker may very trivially mutate signatures without affecting validity. In addition to the CVEs previously mentioned, CVE-2019-14859 and BIP-66 also report on the same issue in other libraries. <br><br></div>Thanks again,</div>Jake<br><a href="https://jakegines.in">https://jakegines.in</a></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Jan 13, 2026 at 9:08 PM NIIBE Yutaka <<a href="mailto:gniibe@fsij.org">gniibe@fsij.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
Jake Ginesin wrote:<br>
> libgcrypt's ECDSA signatures are malleable, as the signature verifier<br>
> accepts malforned DER-encoded signatures.<br>
<br>
Thank you for your report.<br>
<br>
Let me explain my understandings.<br>
<br>
(1) For ECDSA (or public key crypto in general), libgcrypt uses data<br>
format with SEXP.  It's true that SEXP is a kind of relaxed format,<br>
which allows multiple representations.<br>
<br>
(2) An application may use different formats (like PGP, CMS, etc.).<br>
>From the viewpoint of libgcrypt, it's a responsibility of an application<br>
to validate data formats/values for its own representation(s).<br>
<br>
(3) GnuPG handles CMS by gpgsm with libksba.  Typically, it's libksba<br>
which processes the data to be used by libgcrypt.  It accesses data, and<br>
converts DER encoded value into SEXP so that it can be used by<br>
libgcrypt.<br>
<br>
> 1. Missing leading zero: per X.690 section 8.3.3, integers are two's<br>
> complement. A positive integer with high bit set requires a leading 0x00 to<br>
> avoid being interpreted as negative. libgcrypt accepts signatures missing<br>
> this byte.<br>
><br>
> 2. Extra leading zeros: per X.690 section 8.3.2, integer encoding must be<br>
> minimal. libgcrypt accepts r/s values with unnecessary leading zeros.<br>
><br>
> 3. BER long-form length: per X.690 section 10.1, DER requires the definite<br>
> length form encoded in the minimum number of octets. libgcrypt accepts<br>
> BER-style long-form encoding where short-form is required.<br>
<br>
Interpreting your words, I created a ticket for libksba.<br>
<br>
        <a href="https://dev.gnupg.org/T8032" rel="noreferrer" target="_blank">https://dev.gnupg.org/T8032</a><br>
<br>
(I checked gpgsm and libksba, and I can't find the input validation of<br>
DER encoded data/integer.)<br>
<br>
Please add your comments to the ticket or reply this email, for further<br>
discussion.<br>
-- <br>
</blockquote></div>