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

HOME-9310 test does not detect non-standard .bash_history files in user home directories due to maxdepth limitation #1582

Open
nawe1321 opened this issue Dec 3, 2024 · 0 comments · May be fixed by #1584

Comments

@nawe1321
Copy link

nawe1321 commented Dec 3, 2024

Describe the bug
The HOME-9310 test in Lynis, which checks for suspicious .bash_history files, uses -maxdepth 1 when scanning ${HOMEDIRS}. This limits the test to only the immediate contents of /home and does not include .bash_history files stored in subdirectories such as /home/Neo/.bash_history. As a result, the test cannot detect non-standard .bash_history files (e.g., named pipes or character devices) located within user home directories.

Version

  • Distribution: Ubuntu 22.04 LTS (running in Docker)
  • Lynis version: 3.1.3

Expected behavior
The HOME-9310 test should scan user home directories recursively (e.g., /home/Neo/.bash_history) and detect suspicious .bash_history files of non-standard types.

Output
The test only evaluates the immediate contents of /home, so .bash_history files stored in subdirectories are not scanned or flagged.
Neo@347f7d526c8a:/usr/bin/lynis$ sudo find /home -maxdepth 1 /home /home/Cypher /home/Neo /home/Dozer /home/Morpheus /home/Apoc /home/Trinity /home/Smith
Neo@347f7d526c8a:/usr/bin/lynis$ sudo find /home -maxdepth 2 /home /home/Cypher /home/Cypher/.bash_logout /home/Cypher/.bashrc /home/Cypher/.profile /home/Cypher/.bash_history /home/Neo /home/Neo/.bash_logout /home/Neo/.bashrc /home/Neo/.profile /home/Dozer /home/Dozer/.bash_logout /home/Dozer/.bashrc /home/Dozer/.profile /home/Dozer/.bash_history /home/Morpheus /home/Morpheus/.bash_logout /home/Morpheus/.bashrc /home/Morpheus/.profile /home/Morpheus/.bash_history /home/Apoc /home/Apoc/.bash_logout /home/Apoc/.bashrc /home/Apoc/.profile /home/Trinity /home/Trinity/.bash_logout /home/Trinity/.bashrc /home/Trinity/.profile /home/Smith /home/Smith/.bash_logout /home/Smith/.bashrc /home/Smith/.profile

Additional context
Consider modifying the HOME-9310 test to use -maxdepth 2 instead of -maxdepth 1 to include files in user home directories.

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 a pull request may close this issue.

1 participant