BUG: Non-fatal permissions errors for files in /etc when Trivy container is run as non-root #4233
Replies: 5 comments
-
This issue is stale because it has been labeled with inactivity. |
Beta Was this translation helpful? Give feedback.
-
/remove-lifecycle stale |
Beta Was this translation helpful? Give feedback.
-
This issue is stale because it has been labeled with inactivity. |
Beta Was this translation helpful? Give feedback.
-
/remove-lifecycle stale |
Beta Was this translation helpful? Give feedback.
-
This issue is stale because it has been labeled with inactivity. |
Beta Was this translation helpful? Give feedback.
-
Description
When running Trivy as a non-root user with the --debug flag, in our non-root Trivy container, I found that some files in /etc are causing permissions errors in the output. This is not a fatal error, as the scan completes properly, however I believe when the container is run normally (as root), these files are being opened in write mode instead of read mode, which can potentially be a security risk for anyone running image published in dockerhub.
In case there is a vulnerability found in Trivy in the future, wherein Trivy is able to execute arbitrary code, the opening of the below 3 files in write mode could allow for data in them to be manipulated. These files are meant to be readonly and owned by root, however root can bypass the permissions and write to readonly files anyway. So the fact that Trivy is opening them in write mode is an error that simply doesn't appear under normal circumstances because of root being able to open the files in write mode without any issue.
What did you expect to happen?
There should not be the below 3 lines in the output above:
What happened instead?
The 3 lines above appears
Output of run with
-debug
:See above
Output of
trivy -v
:Additional details (base image name, container registry info...):
Beta Was this translation helpful? Give feedback.
All reactions