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

Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes #1867

Closed
2 of 11 tasks
teor2345 opened this issue Mar 9, 2021 · 4 comments · Fixed by #2392
Closed
2 of 11 tasks
Assignees
Labels
A-rust Area: Updates to Rust code C-bug Category: This is a bug C-security Category: Security issues I-invalid-data Zebra relies on invalid or untrusted data, or sends invalid data

Comments

@teor2345
Copy link
Contributor

teor2345 commented Mar 9, 2021

User Actions for the Changelog

Re-deploy all running Zebra nodes after fixing this bug. This bug fix allows the network to delete the unreachable peer addresses introduced by #2120, and kept alive by #1868.

Motivation

Zebra relays peer addresses to other nodes, even if it hasn't been able to contact those peers itself, and even if the untrusted_last_seen time gossiped by other nodes is a long way in the past.

Zebra is currently keeping unreachable addresses in its address book, and sending them to other peers, so this security fix is important and urgent.

Specification

"The typical presumption is that a node is likely to be active if it has been sending a message within the last three hours."

https://en.bitcoin.it/wiki/Protocol_documentation#getaddr

This time period is a network health / network view leakage design tradeoff.

Solution

This fix depends on #1849 and #1871.

Zebra should stop gossiping peers that haven't had a successful connection or sent a message for 3 hours.

To avoid sending old peers from other nodes, Zebra should stop gossiping peers where:

We can make these changes in the AddressBook::sanitized function.

Zebra should also:

  • provide an accessor method on MetaAddr to simplify the interface to the last_success_time and untrusted_last_seen_time
  • avoid updating timestamps based on new gossips from other peers (security fixes must maintain this constraint)

Property testing:

  • Generate some random MetaAddrs
  • Put them in an AddressBook
  • Sanitize the address book
  • Make sure that old last_success_times and untrusted_last_seen_times are handled correctly

Acceptance testing:

  • add a debug_gossip_max_peer_age config
  • add an acceptance test that sets it to 10 seconds
  • add a log when peers are skipped because they're too old, and check for that log

Alternatives

This is a serious security issue, so we must do something. If we find a simpler design that fixes this security issue, we should use it.

Context

zcashd and Zebra will check addresses for connectivity, then move on to other addresses. So this is not a critical security issue.

Follow-Up Tasks

We might want to do #1865 after this ticket - they modify the same code.

As a follow-up, we should review this design, and make sure that we're minimising network-based metadata leaks in Zebra.

@teor2345 teor2345 added C-bug Category: This is a bug A-rust Area: Updates to Rust code S-needs-triage Status: A bug report needs triage P-High C-security Category: Security issues I-invalid-data Zebra relies on invalid or untrusted data, or sends invalid data labels Mar 9, 2021
@mpguerra mpguerra removed the S-needs-triage Status: A bug report needs triage label Mar 10, 2021
@teor2345
Copy link
Contributor Author

zcashd and Zebra will check addresses for connectivity, then move on to other addresses. So this is not a critical security issue.

@teor2345
Copy link
Contributor Author

teor2345 commented May 7, 2021

Moving this to sprint 10, so Zebra can clear out the bad addresses created by the bug in #2120.

@teor2345 teor2345 changed the title Zebra should stop gossiping unreachable addresses to other nodes Security: Zebra should stop gossiping unreachable addresses to other nodes May 7, 2021
@mpguerra
Copy link
Contributor

mpguerra commented May 7, 2021

Moving this to sprint 10, so Zebra can clear out the bad addresses created by the bug in #2120.

I have this as blocked by #1871 though so if this is still the case, we should also move #1871 to sprint 10 and move the 2 previously planned security issues (#1850 and #1848 ) out to sprint 11

@teor2345
Copy link
Contributor Author

teor2345 commented Jun 8, 2021

This is larger now we've added proptests.

@teor2345 teor2345 changed the title Security: Zebra should stop gossiping unreachable addresses to other nodes Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-bug Category: This is a bug C-security Category: Security issues I-invalid-data Zebra relies on invalid or untrusted data, or sends invalid data
Projects
None yet
3 participants