News for hackers. Stuff that matters.
Re:The Bitcoin Piñata by hannesm on Tuesday February 10, 2015 @12:12PM (#9028427)
This is about the DigestInfo -- which we generate and compare here: https://github.com/mirleft/ocaml-tls/blob/master/lib/handsha...

The unpad does RSA unpadding... or am I completely mistaken?

Re:The Bitcoin Piñata by ctz on Tuesday February 10, 2015 @01:12PM (#9028798)
I was reading the X509 certificate verification code, rather than the TLS code:

https://github.com/mirleft/ocaml-x509/blob/master/lib/certif...

Re:The Bitcoin Piñata by pqwy on Tuesday February 10, 2015 @02:13PM (#9029223)
Why do you think this creates malleability?

PKCS1.5 stripping takes away the leading 0x00 0x01 0xff ... 0x00 -- if this prefix is not present, it fails.

The rest goes through the RSA tranform, and is parsed as PKCS1 DigestInfo, an ASN.1 structure. All ASN parsing checks for presence of trailing bytes, on top and in CONSTRUCTED nodes.

The presence of suffix-checking prevents malleability in my mind. Am I missing something?

Re:The Bitcoin Piñata by ctz on Wednesday February 11, 2015 @04:59AM (#9032164)
ASN parsing code, in general, does not check for presence of trailing bytes (see Bleichenbacher's original signature forgery attack, and CVEs passim). Should they? Yes. Do they? No, it is a frequent implementation error.

In NSS, they did check for trailing bytes, but allowed one part of the ASN1 structure to have an arbitrary value (to work around flaws in other implementations).

To be abundantly clear: I am not saying that any of the presented code has an exploitable flaw. I am saying that the way the code is written has frequently been found to be faulty in the past.

Re:The Bitcoin Piñata by hannesm on Wednesday February 11, 2015 @09:12AM (#9032893)
"ASN parsing code, in general"... this sounds like you're a bit stuck in ad-hoc ASN.1 parsers written in C...

We actually use combinators for doing that - this explains our ASN.1 library in more depth: http://openmirage.org/blog/introducing-asn1