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

Encrypt cached sudo password #1740

Merged
merged 4 commits into from
Sep 3, 2024
Merged

Encrypt cached sudo password #1740

merged 4 commits into from
Sep 3, 2024

Conversation

TheTechromancer
Copy link
Collaborator

@TheTechromancer TheTechromancer commented Sep 2, 2024

When not running as root, and when a password is required to sudo, bbot will cache the password so you don't have to repeatedly enter it during the scan. Whenever a process is executed that needs sudo privileges, the sudo password is inserted into its isolated environment, which is then passed to sudo using a custom askpass script.

This worked well but wasn't super secure, since it introduced the opportunity for a subprocess to snag your sudo password (accidentally or as part of telemetry collection, etc.).

For extra security, this PR encrypts the password using a randomly-generated 32-byte key which is discarded at the end of the scan.

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 48 lines in your changes missing coverage. Please review.

Project coverage is 93%. Comparing base (bac9442) to head (b991724).
Report is 30 commits behind head on dev.

Files with missing lines Patch % Lines
bbot/core/helpers/depsinstaller/sudo_askpass.py 0% 29 Missing ⚠️
bbot/core/helpers/depsinstaller/installer.py 55% 19 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             dev   #1740   +/-   ##
=====================================
- Coverage     93%     93%   -0%     
=====================================
  Files        343     343           
  Lines      26177   26228   +51     
=====================================
+ Hits       24122   24136   +14     
- Misses      2055    2092   +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheTechromancer TheTechromancer merged commit 8a600f3 into dev Sep 3, 2024
8 checks passed
@TheTechromancer TheTechromancer deleted the encrypt-cached-pass branch September 30, 2024 14:01
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.

2 participants