News for hackers. Stuff that matters.
Re:Bug in Lynx's SSL certificate validation – leaks password... by opheliate on Saturday August 07, 2021 @01:40PM (#28100360)
I would think that this was introduced at the same time as SNI was enabled for Lynx (2009-04-26 from the changelog, but I haven’t checked if it was actually vulnerable at that time). I don’t know if I’d call any URL processing issue basic though, I can safely say that I’m never even going to attempt to write a URL parser, just because of the number of potential edge cases. You can imagine when you’re enabling a (fairly simple, compared to the rest of the TLS spec) extension, you might not be thinking about all the different quirks of the URL spec which could occur and mess up what seems like a basic change.
Re:Bug in Lynx's SSL certificate validation – leaks password... by nly on Saturday August 07, 2021 @07:43PM (#28102904)
URIs have a generic grammar defined in RFC 3986.

However, this doesn't cover DNS name validation for the hostname:

"This specification does not mandate a particular registered name lookup technology and therefore does not restrict the syntax of reg-name beyond what is necessary for interoperability"

It also doesn't constrain the userinfo ("username:password") part described in this vulnerability.

So yeah, it's non-trivial.

Re:Bug in Lynx's SSL certificate validation – leaks password... by tialaramex on Saturday August 07, 2021 @10:23PM (#28103745)
I don't see what's "non-trivial" about the decomposition:

  authority   = [ userinfo "@" ] host [ ":" port ]
described in section 3.2 of that specification. Looks pretty trivial to me.
Re:Bug in Lynx's SSL certificate validation – leaks password... by nly on Sunday August 08, 2021 @10:42AM (#28107064)
It's non-trivial because the userinfo part is not structured in the grammar, but is instead just constrained to a particular character set.

The RFC reads:

> Use of the format "user:password" in the userinfo field is deprecated.

In the real world, for HTTP use cases, you can't just ignore this because it's deprecated.

Re:Bug in Lynx's SSL certificate validation – leaks password... by tialaramex on Sunday August 08, 2021 @05:15PM (#28110179)
> the userinfo part is not structured in the grammar, but is instead just constrained to a particular character set.

Yes. So, a correct implementation can't use this document to destructure it, but that's OK because it doesn't need to do so. It can however easily distinguish the userinfo from the rest of the authority.

Unless, like this code, it simply doesn't bother to try.

> In the real world, for HTTP use cases, you can't just ignore this because it's deprecated.

Then I guess you'll need to write code to further parse the userinfo. Seems pretty easy, but this document doesn't explain how because it's deprecated. No impact on whether you can find the host name in the authority since that's a separate field from userinfo.

Assuming, of course, that you bother to separate userinfo from the domain name in the authority, which Lynx did not.

Re:Bug in Lynx's SSL certificate validation – leaks password... by admax88q on Saturday August 07, 2021 @11:02PM (#28103893)
You don't need to validate the hostnamez you can safely leave that for name resolution libraries. You just need to properly separate the user info from the host name and port. Which is pretty simply defined in the grammar.
Re:Bug in Lynx's SSL certificate validation – leaks password... by nly on Sunday August 08, 2021 @10:39AM (#28107039)
That depends on your use case. If you're trying to check the hostname against some sort of whitelist or blacklist you're going to want to normalize it. Then you have all kinds of fun like IDN to deal with.