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: Files created by Zebra can be read by any user on the same machine #7807

Closed
2 of 4 tasks
Tracked by #8141 ...
teor2345 opened this issue Oct 24, 2023 · 0 comments
Closed
2 of 4 tasks
Tracked by #8141 ...
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-bug Category: This is a bug C-security Category: Security issues I-lose-funds Zebra loses user funds I-privacy Zebra discloses private information S-needs-triage Status: A bug report needs triage

Comments

@teor2345
Copy link
Contributor

teor2345 commented Oct 24, 2023

Scheduling

This is a blocker for securely implementing blockchain scanning. It needs to be fixed before the blockchain scanner creates any files on disk.

What happened?

I expected to see this happen:

Zebra creates files that are only readable by the user running Zebra.

Instead, this happened:

Zebra's database is readable by any user or service on the same machine. This is ok for now because that data is public. But any private data from the blockchain scanner should only be readable by that user.

The peer IP cache files are only readable by the running user, because we create them using a temp_file API.

What were you doing when the issue happened?

Running Zebra.

Zebra logs

This issue does not appear in the logs.

Zebra Version

zebrad 1.3.0

Which operating systems does the issue happen on?

  • Linux
  • macOS
  • Windows
  • Other OS

OS details

Any unix-based OS

Additional information

RocksDB does not have an API that changes file permissions. (There is an API, but it doesn't actually work.)
https://github.com/facebook/rocksdb/pull/3709/files
facebook/rocksdb#8109

We can change the permissions for all created files by calling set_umask() when we start Zebra, before we create any files:
https://docs.rs/file-mode/latest/file_mode/fn.set_umask.html

Previously created files will have world-readable permissions, or whatever custom permissions the operator set. Since this is not a security issue we should leave old permissions alone. (Resetting custom permissions is a breaking change.)

@teor2345 teor2345 added C-bug Category: This is a bug S-needs-triage Status: A bug report needs triage P-Medium ⚡ C-security Category: Security issues I-privacy Zebra discloses private information A-state Area: State / database changes I-lose-funds Zebra loses user funds labels Oct 24, 2023
@mpguerra mpguerra added this to Zebra Oct 24, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Zebra Oct 24, 2023
@oxarbitrage oxarbitrage added the A-blockchain-scanner Area: Blockchain scanner of shielded transactions label Nov 3, 2023
@teor2345 teor2345 changed the title bug: Files created by Zebra can be read by any user on the same machine - blockchain scanner security security: Files created by Zebra can be read by any user on the same machine Nov 7, 2023
@mpguerra mpguerra closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
@github-project-automation github-project-automation bot moved this from New to Done in Zebra Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions A-state Area: State / database changes C-bug Category: This is a bug C-security Category: Security issues I-lose-funds Zebra loses user funds I-privacy Zebra discloses private information S-needs-triage Status: A bug report needs triage
Projects
Status: Done
Development

No branches or pull requests

3 participants