LearnBitcoin

Bitcoin Dev Archive 2014

Positive and negative feedback on certificate validation errors

10 messages, 1 to 3 Mar 2014. Started by Jeremy Spilman.

Jeremy Spilman (3), Mike Hearn (3), Drak (2), Wladimir J. van der Laan, Troy Benjegerdes

Permalink Original thread on gnusha.org

Jeremy Spilman permalink original

We currently have subtle positive feedback of a signed payment request in the form of the green background. Unsigned requests simply show up without the green background, as well as requests which provide a certificate but have a missing or invalid signature.

There's a open bug (#3628) and pull request (#3684) to provide negative feedback (yellow background) for a missing or invalid signature, but it seems like there's some debate on whether bitcoind should do that...

If an attacker can avoid the negative feedback by just stripping the signature and setting pki_type to none, then arguably there's no security benefit by singling out badly signed payment requests from unsigned payment requests.

So perhaps the root problem is that the positive feedback (green background) is not strong enough to make its absence highly conspicuous to the end user.

As an aside, how could we go about implementing the equivalent of HTTP Strict Transport Security for payment protocol to prevent this trivial signature stripping attack? Is this a possible extension field merchants are interested in?

Wladimir J. van der Laan in reply to Jeremy Spilman permalink original

On Sat, Mar 1, 2014 at 7:26 AM, Jeremy Spilman <jeremy@taplink•co> wrote:

Quoted text (4 lines)
> There's a open bug (#3628) and pull request (#3684) to provide negative
> feedback (yellow background) for a missing or invalid signature, but it
> seems like there's some debate on whether bitcoind should do that...
>

The consensus there is to treat invalid and unsigned payment requests the same (apart from debug error logging). After all, the cost to the attacker to remove the signature or corrupt it is exactly the same.

I do recommend testing that pull request (#3684) to see if it improves payment request reporting, and provide testing reports or suggestions in the github comments.

I've been very busy the last few weeks with integrating and testing other pre-0.9 changes so I have been unable to look at the visual side of payment request stuff much. We could use some help there.

If an attacker can avoid the negative feedback by just stripping the

Quoted text (4 lines)
> signature and setting pki_type to none, then arguably there's no security
> benefit by singling out badly signed payment requests from unsigned
> payment requests.
>

Exactly.

Quoted text (4 lines)
> So perhaps the root problem is that the positive feedback (green
> background) is not strong enough to make its absence highly conspicuous to
> the end user.
>

Well, ideas to make the difference more conspicuous are welcome. The green background is just to make a basic distinction.

If it involves any imagery or graphics we do need contributions (with the appropriate MIT license), no one of us is an artist.

Quoted text (5 lines)
> As an aside, how could we go about implementing the equivalent of HTTP
> Strict Transport Security for payment protocol to prevent this trivial
> signature stripping attack? Is this a possible extension field merchants
> are interested in?
>

Such a thing would be interesting for a future BIP standard. I see one problem here: for an unsigned payment request there isn't really an "origin". Browser URI handlers don't send the referrer either.

This rules out adding a field to the Bitcoin URI 'requests from us must be signed from now on' (there's no us).

The server that serves the payment requests *could* serve an HSTS-like header 'only accept signed payment requests from us from now on'. The client needs to remember this for this server. Then if someone has compromised that server (or hijacked DNS) to serve fake and unsigned payment requests, the client can block these.

Neither scenario will help in the case in which the server serving the Bitcoin URIs is compromised.

Wladimir

Jeremy Spilman in reply to Wladimir J. van der Laan permalink original

On Fri, 28 Feb 2014 23:26:57 -0800, Wladimir <laanwj@gmail•com> wrote:

Quoted text (3 lines)
> Such a thing would be interesting for a future BIP standard. I see one
> problem here: for an unsigned payment request there isn't really an
> "origin". >Browser URI handlers don't send the referrer either.

Yeah, good point. If you have a cert, we have the CN from the cert, which becomes the string displayed as 'Pay To' and alternatively 'Merchant'.

But if there's no cert then all you have is memo.

So the best way to differentiate signed requests is by prominently displaying that Merchant string. Really the green part should just be the 'Pay To' line, the rest is content. If it showed a BLANK 'Pay To' that would make the lack of certificate highly apparent.

Jeremy Spilman in reply to Jeremy Spilman permalink original

From BIP70:

   If pki_type is "x509+sha256", then the Payment message is hashed using
the
   SHA256 algorithm to produce the message digest that is signed. If
pki_type
   is "x509+sha1", then the SHA1 algorithm is used.

A couple minor comments;

  - I think it meant to say the field to be hashed is 'PaymentRequest' not
'Payment' message -- probably got renamed at some point and this is an old
reference calling it by its original name.
  - Could be a bit more explicit about the hashing, e.g. 'copy the
PaymentRequest, set the signature field to the empty string, serialize to
a byte[] and hash.
  - SHA1 is retiring, any particular reason to even have it in there at all?
  - Should there any way for the end-user to see details like the pki_type
and the certificate chain, like browser do?

Thanks, Jeremy

Mike Hearn in reply to Jeremy Spilman permalink original

SHA-1 support is there for PHP developers. Apparently it can't do SHA-2. On 2 Mar 2014 08:53, "Jeremy Spilman" <jeremy@taplink•co> wrote:

Quoted text (42 lines)
>  From BIP70:
>
>    If pki_type is "x509+sha256", then the Payment message is hashed using
> the
>    SHA256 algorithm to produce the message digest that is signed. If
> pki_type
>    is "x509+sha1", then the SHA1 algorithm is used.
>
> A couple minor comments;
>
>   - I think it meant to say the field to be hashed is 'PaymentRequest' not
> 'Payment' message -- probably got renamed at some point and this is an old
> reference calling it by its original name.
>
>   - Could be a bit more explicit about the hashing, e.g. 'copy the
> PaymentRequest, set the signature field to the empty string, serialize to
> a byte[] and hash.
>
>   - SHA1 is retiring, any particular reason to even have it in there at
> all?
>
>   - Should there any way for the end-user to see details like the pki_type
> and the certificate chain, like browser do?
>
>
> Thanks,
> Jeremy
>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
Drak in reply to Mike Hearn permalink original

Not true, PHP does support sha2

http://php.net/manual/en/mhash.constants.php http://php.net/manual/en/function.hash-algos.php#refsect1-function.hash-algos-examples On 2 Mar 2014 08:44, "Mike Hearn" <mike@plan99•net> wrote:

Quoted text (60 lines)
> SHA-1 support is there for PHP developers. Apparently it can't do SHA-2.
> On 2 Mar 2014 08:53, "Jeremy Spilman" <jeremy@taplink•co> wrote:
>
>>  From BIP70:
>>
>>    If pki_type is "x509+sha256", then the Payment message is hashed using
>> the
>>    SHA256 algorithm to produce the message digest that is signed. If
>> pki_type
>>    is "x509+sha1", then the SHA1 algorithm is used.
>>
>> A couple minor comments;
>>
>>   - I think it meant to say the field to be hashed is 'PaymentRequest' not
>> 'Payment' message -- probably got renamed at some point and this is an old
>> reference calling it by its original name.
>>
>>   - Could be a bit more explicit about the hashing, e.g. 'copy the
>> PaymentRequest, set the signature field to the empty string, serialize to
>> a byte[] and hash.
>>
>>   - SHA1 is retiring, any particular reason to even have it in there at
>> all?
>>
>>   - Should there any way for the end-user to see details like the pki_type
>> and the certificate chain, like browser do?
>>
>>
>> Thanks,
>> Jeremy
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Flow-based real-time traffic analytics software. Cisco certified tool.
>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> Customize your own dashboards, set traffic alerts and generate reports.
>> Network behavioral analysis & security monitoring. All-in-one tool.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Bitcoin-development mailing list
>> Bitcoin-development@lists•sourceforge•net
>> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
Mike Hearn in reply to Jeremy Spilman permalink original

I'm hoping I can convince Saivann to do a bit of graphics work for this at some point :-)

Something like a green stamp that appears (like a watermark) in the background, might be good.

On Sat, Mar 1, 2014 at 8:50 AM, Jeremy Spilman <jeremy@taplink•co> wrote:

Quoted text (33 lines)
>  On Fri, 28 Feb 2014 23:26:57 -0800, Wladimir <laanwj@gmail•com> wrote:
>
> Such a thing would be interesting for a future BIP standard. I see one
> problem here: for an unsigned payment request there isn't really an
> "origin". Browser URI handlers don't send the referrer either.
>
>
> Yeah, good point. If you have a cert, we have the CN from the cert, which
> becomes the string displayed as 'Pay To' and alternatively 'Merchant'.
>
> But if there's no cert then all you have is memo.
>
> So the best way to differentiate signed requests is by prominently
> displaying that Merchant string. Really the green part should just be the
> 'Pay To' line, the rest is content. If it showed a BLANK 'Pay To' that
> would make the lack of certificate highly apparent.
>
>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
Mike Hearn in reply to Drak permalink original

I'm just repeating the rationale Gavin gave me for adding this to the spec last year when he was implementing it. Perhaps it only applied to some versions of PHP or something like that.

Jeremy, good comments. A pull request to fix those would be good.

One issue I seem looming on the horizon is that we'll need a version of the payment protocol document that's living. Trying to reverse engineer the current spec by manually reading all the BIPs and layering them in your head is a non starter.

On Sun, Mar 2, 2014 at 9:52 AM, Drak <drak@zikula•org> wrote:

Quoted text (70 lines)
> Not true, PHP does support sha2
>
> http://php.net/manual/en/mhash.constants.php
>
> http://php.net/manual/en/function.hash-algos.php#refsect1-function.hash-algos-examples
> On 2 Mar 2014 08:44, "Mike Hearn" <mike@plan99•net> wrote:
>
>> SHA-1 support is there for PHP developers. Apparently it can't do SHA-2.
>> On 2 Mar 2014 08:53, "Jeremy Spilman" <jeremy@taplink•co> wrote:
>>
>>>  From BIP70:
>>>
>>>    If pki_type is "x509+sha256", then the Payment message is hashed using
>>> the
>>>    SHA256 algorithm to produce the message digest that is signed. If
>>> pki_type
>>>    is "x509+sha1", then the SHA1 algorithm is used.
>>>
>>> A couple minor comments;
>>>
>>>   - I think it meant to say the field to be hashed is 'PaymentRequest'
>>> not
>>> 'Payment' message -- probably got renamed at some point and this is an
>>> old
>>> reference calling it by its original name.
>>>
>>>   - Could be a bit more explicit about the hashing, e.g. 'copy the
>>> PaymentRequest, set the signature field to the empty string, serialize to
>>> a byte[] and hash.
>>>
>>>   - SHA1 is retiring, any particular reason to even have it in there at
>>> all?
>>>
>>>   - Should there any way for the end-user to see details like the
>>> pki_type
>>> and the certificate chain, like browser do?
>>>
>>>
>>> Thanks,
>>> Jeremy
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Flow-based real-time traffic analytics software. Cisco certified tool.
>>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>>> Customize your own dashboards, set traffic alerts and generate reports.
>>> Network behavioral analysis & security monitoring. All-in-one tool.
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Bitcoin-development mailing list
>>> Bitcoin-development@lists•sourceforge•net
>>> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Flow-based real-time traffic analytics software. Cisco certified tool.
>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> Customize your own dashboards, set traffic alerts and generate reports.
>> Network behavioral analysis & security monitoring. All-in-one tool.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Bitcoin-development mailing list
>> Bitcoin-development@lists•sourceforge•net
>> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>>
>>
Troy Benjegerdes in reply to Jeremy Spilman permalink original

On Fri, Feb 28, 2014 at 10:26:39PM -0800, Jeremy Spilman wrote:

Quoted text (4 lines)
> We currently have subtle positive feedback of a signed payment request in
> the form of the green background. Unsigned requests simply show up without
> the green background, as well as requests which provide a certificate but
> have a missing or invalid signature.

Are we talking a third-party 'root certificate'?

I don't quite see why a cryptographic currency that has the most widely deployed ECDSA public/private key infrastructure ever needs to use external certificates. That seems like a significant reduction in security to pretend that a 'signed' certificate is any good when it's pretty easy to buy a compromised cert, or just hack the server its on.

If it's 'signed' by the ECDSA private key that you are sending the payment to, by all means, make it bright green.

I mean if you want to make it expensive for small businesses to take secure payments, why don't you add a native 'signing fee' extension and have a (more) transparent market for the price of perceived security, or at least a compile time option so i can turn this nonsense off for my customers.

Drak in reply to Mike Hearn permalink original

On 2 March 2014 10:39, Mike Hearn <mike@plan99•net> wrote:

Quoted text (4 lines)
> I'm just repeating the rationale Gavin gave me for adding this to the spec
> last year when he was implementing it. Perhaps it only applied to some
> versions of PHP or something like that.
>

OK, but certainly now, SHA-2 is available as standard in PHP and has been since PHP 5.1.2 as part of the hash() function. You can see from usage stats that means practically every installation http://w3techs.com/technologies/details/pl-php/5/all is PHP 5.2 and above.

Unless there is some other compelling reason, I would suggest removing SHA-1 from the specification.

Drak