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

Are IPNS record signatures really validated? #3331

Closed
wigy-opensource-developer opened this issue Oct 26, 2016 · 4 comments
Closed

Are IPNS record signatures really validated? #3331

wigy-opensource-developer opened this issue Oct 26, 2016 · 4 comments

Comments

@wigy-opensource-developer
Copy link

wigy-opensource-developer commented Oct 26, 2016

Version information:

go-ipfs version: 0.4.3-
Repo version: 4
System version: amd64/linux
Golang version: go1.7

Type:

Bug

Priority:

P2

Description:

As I understand the current state of IPNS is alpha. Still, I do not see the code that prevents malicious nodes to poison the DHT recordstore with a record that has a higher sequence number, but invalid signature.

Some pointers to the code that record my journey of debugging the problem:

If the Author field of the IPRS records could be a public key, not the hash of the public key, the IPNS record could be a self-signed certificate of the author + the IPFS content hash and would not depend on the /pk/ IPRS schema. Is there any advantage of storing the Author field as an ID and keep the /pk/ record store to resolve it?

@wigy-opensource-developer
Copy link
Author

Bump. This is a security issue. Should I spend more time producing a fix, or should I give a demo defacing the site ipfs.io? 😘

@whyrusleeping
Copy link
Member

First off, IMPORTANT:
If you suspect you've found a security issue please disclose things responsibly as detailed in the readme.

Hey @wigy-opensource-developer, thanks for diving into this. The records are validated in the dht code here: /~https://github.com/libp2p/go-libp2p-kad-dht/blob/master/dht.go#L182
And also validates signature of records stored here: /~https://github.com/libp2p/go-libp2p-kad-dht/blob/master/handlers.go#L160

Is there any advantage of storing the Author field as an ID and keep the /pk/ record store to resolve it?

Other than reducing the size of records we're asking other nodes to store for us, no. Adding an extra 256 or 512 bytes to each ~100 byte record is a significant overhead in storage space for the network. When we look at migrating to ed25519 keys and implementing the actual iprs spec we may consider embedding keys into the record itself.

@wigy-opensource-developer
Copy link
Author

wigy-opensource-developer commented Oct 31, 2016

Hi Jeromy, thanks for the answer. I had a suspicion that it was an oversight on my side, because IPFS development seemed to be more serious than leaving such a gaping hole in there.

As for the future, I spent about 15 minutes reading about how to report a potential issue to go-ipfs. The issue template points to /~https://github.com/ipfs/community/blob/master/contributing.md#reporting-issues and /~https://github.com/ipfs/go-ipfs/blob/master/docs/github-issue-guide.md but those do not mention anything about security issues. Could you please either copy that paragraph from the /~https://github.com/ipfs/go-ipfs/blob/master/README.md#security-issues into either of that, or just mention this in the issue template?

And thanks for the pointers for the signature validation. Since it is done in the DHT implementation of a record store, it means it will need to be duplicated in the coming alternative implementations. But that is fine.

@whyrusleeping
Copy link
Member

@wigy-opensource-developer I will make sure to make a note of the security reporting info in the issue template, thanks!

Also, another place that verification happens is here: /~https://github.com/ipfs/go-ipfs/blob/master/namesys/routing.go#L181

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

No branches or pull requests

3 participants
@whyrusleeping @wigy-opensource-developer and others