Security Issue: Setup keys are stored unencrypted in database table "setup_keys" #1351

Closed
opened 2025-11-20 05:28:51 -05:00 by saavagebueno · 5 comments
Owner

Originally created by @florian-obradovic on GitHub (Oct 20, 2024).

Describe the problem

The setup keys are stored unencrypted in the database (at least for sqlite3) which is very bad.
If the backend or storage (Cloud & Selfhosted) gets compromised, anyone can use the setup keys to provision new peers.

To Reproduce

  1. sudo sqlite3 /var/lib/docker/volumes/artifacts_netbird-mgmt/_data/store.db Adjust the path to your docker volume
  2. select * from setup_keys;

Expected behavior
Store the setup keys encrypted by using at least salted hashes (More infos: https://www.vaadata.com/blog/how-to-securely-store-passwords-in-database/)

Are you using NetBird Cloud?

Selfhsoted

NetBird version
0.30.2

Originally created by @florian-obradovic on GitHub (Oct 20, 2024). **Describe the problem** The setup keys are stored unencrypted in the database (at least for sqlite3) which is very bad. If the backend or storage (Cloud & Selfhosted) gets compromised, anyone can use the setup keys to provision new peers. **To Reproduce** 1. `sudo sqlite3 /var/lib/docker/volumes/artifacts_netbird-mgmt/_data/store.db` Adjust the path to your docker volume 2. `select * from setup_keys;` **Expected behavior** Store the setup keys encrypted by using at least salted hashes (More infos: https://www.vaadata.com/blog/how-to-securely-store-passwords-in-database/) **Are you using NetBird Cloud?** Selfhsoted **NetBird version** 0.30.2
saavagebueno added the serversecurity labels 2025-11-20 05:28:51 -05:00
Author
Owner

@sudomoke commented on GitHub (Oct 21, 2024):

Setup keys should be set to expire, or limit the number of usage.

If you're using setup keys without any limits you should verify your rules are "very notrusty"

@sudomoke commented on GitHub (Oct 21, 2024): Setup keys should be set to expire, or limit the number of usage. If you're using setup keys without any limits you should verify your rules are "very notrusty"
Author
Owner

@florian-obradovic commented on GitHub (Oct 21, 2024):

I generally agree, but there are use cases where you need keys with longer expiration dates (docker / kubernetes deployments, etc...).

On the other hand this discussing misses the point.
Unencrypted credentials in the database, especially high privileged credentials without second factor).

There is no good reason, why we should keep storing them unencrypted. No matter what short expiration time you choose.

@florian-obradovic commented on GitHub (Oct 21, 2024): I generally agree, but there are use cases where you need keys with longer expiration dates (docker / kubernetes deployments, etc...). On the other hand this discussing misses the point. Unencrypted credentials in the database, especially high privileged credentials without second factor). There is no good reason, why we should keep storing them unencrypted. No matter what short expiration time you choose.
Author
Owner

@mgarces commented on GitHub (Oct 22, 2024):

hi @florian-obradovic, thank you for opening this issue.
Like previously discussed on Slack, we are currently working on the migration for these secrets, in the next few weeks, this should remove this security impact you mention here.

@mgarces commented on GitHub (Oct 22, 2024): hi @florian-obradovic, thank you for opening this issue. Like previously discussed on Slack, we are currently working on the migration for these secrets, in the next few weeks, this should remove this security impact you mention here.
Author
Owner

@florian-obradovic commented on GitHub (Oct 22, 2024):

Thanks a lot!

@florian-obradovic commented on GitHub (Oct 22, 2024): Thanks a lot!
Author
Owner

@heisbrot commented on GitHub (Oct 29, 2024):

Merged, see PR: https://github.com/netbirdio/netbird/pull/2775

@heisbrot commented on GitHub (Oct 29, 2024): Merged, see PR: https://github.com/netbirdio/netbird/pull/2775
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#1351