Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zlint incorrectly requires TorServiceDescriptors if V3 onion and DNS name #677

Merged
merged 9 commits into from
Jun 5, 2022

Conversation

christopher-henderson
Copy link
Member

@christopher-henderson christopher-henderson commented May 21, 2022

This patch addresses #676 wherein the presence of a normal DNS entry would trigger a false return on IsOnionV3, resulting in the Onion V3 cert being checked as though it were V2.

I believe that the solution here is to change this from checking whether-or-not all names are V3 into checking whether-or-not at least one name is V2.

@mimi89999

@mimi89999
Copy link

Hmmm. I think that it might be better to write IsOnionV2 and IsOnionV3 that would check .onion names. They could be reused in another lint that would check if .onion names are valid.

@mimi89999
Copy link

@christopher-henderson
Copy link
Member Author

@mimi89999

I think that it might be better to write IsOnionV2 and IsOnionV3 that would check .onion names. They could be reused in another lint that would check if .onion names are valid.

Sure thing! Indeed, with our newfound access to generics in Go, I went ahead and added some utility functions that help fill the gap of Any and All which would help with this.

In https://github.com/zmap/zlint/blob/master/v3/lints/cabf_br/lint_san_dns_name_onion_invalid.go#L133 you only check the address length, but in https://github.com/zmap/zlint/blob/master/v3/util/onion.go#L25-L39 you check the length and the last byte.

Fair enough, although I think the only extra thing I can reasonably do here is check that it is lowercase base32 encoded. That is, V3 has a number of extra semantics to it, however a V2 address is nothing but a b32 encoded hash of length 16.

@christopher-henderson christopher-henderson merged commit ed6287a into master Jun 5, 2022
@christopher-henderson christopher-henderson deleted the onion_and_dns branch June 5, 2022 18:16
}
return isV3
if len(labels[0]) != 16 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the comment at the top of this function, this should check the second last label, which would be something like this:

address := labels[len(labels)-2]
if len(address) != 16 {

if len(labels[0]) != 16 {
return false
}
_, err := onionBase32Encoding.DecodeString(labels[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants