-
Notifications
You must be signed in to change notification settings - Fork 376
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
tetragon: detect execve of anonymous binaries #499
Conversation
35a558f
to
e00a126
Compare
Other than comment about pid for map key. LGTM. |
79a754d
to
f93d878
Compare
Ok updated fixed all, but also removed that empty
|
21301ee
to
04e5c89
Compare
2542c08
to
d61d1f9
Compare
d61d1f9
to
25d52f2
Compare
Don't merge yet, I will convert it to follow base execve v6.0 kernel versions |
Moving to draft, then. Thanks! |
This pr introduces:
The info is meant to be generic type that includes extra fields about the process context, and it can be easily filtered out from output by However after some thinking and in context of integrity measurement, and also given how we correlate the process_exec to a container/pod by tracking pids<=>cgroups<=>container/pod , it seems we should include more information about the file system information inside the process_exec. Better plan this in a long term; so we can include in the process_exec:
|
25d52f2
to
2f26be8
Compare
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
After we have introduced the binary_properties let's use this to put the new "file" that's FileProperties and its inode information if the executed binary is anonymous. Update:
|
Reviving this |
pkg/sensors/exec/exec_test.go
Outdated
WithBinaryProperties(ec.NewBinaryPropertiesChecker(). | ||
WithFile(ec.NewFilePropertiesChecker(). | ||
WithInode(ec.NewInodeChecker(). | ||
WithLinks(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inode would be != 0 here, right? Does it make sense to check that as well? As we have an fd to that, a variant of stat should do that. I haven't tested it but I believe that it should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed makes sense ;-)
Thanks! I have added some comments. Nothing very difficult to change, but good to have these as well before merging. |
2f26be8
to
f63d488
Compare
@tpapagian much appreciated for the review ;-) ! all comments handled , let's see if green |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than a small comment, this LGTM. Thanks!
This will reference the kernel 'file'. We will use it for the proces_exec.binary_properties to report the executed file and its inode in case the binary is: 1. An anonymous shared memory file https://man7.org/linux/man-pages/man7/shm_overview.7.html. 2. An anonymous file obtained with memfd API https://man7.org/linux/man-pages/man2/memfd_create.2.html. 3. Or it was deleted from the file system. Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
We pass the binary inode information in case the binary is not linked or anonymous. Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
This is the case of: 1. An anonymous shared memory file https://man7.org/linux/man-pages/man7/shm_overview.7.html. 2. An anonymous file obtained with memfd API https://man7.org/linux/man-pages/man2/memfd_create.2.html. 3. Or it was deleted from the file system. Example event: "process_exec": { "process": { "binary_properties": { "file": { "inode": { "number": "182698", "links": 0 } } } } } Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
This tests if the execution of memfd is catched by binary_properties.file.inode.links = 0 Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
This detects execution of deleted binaries. Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
f63d488
to
00701c9
Compare
Detect execution of anonymous binaries, these are binaries that are not linked on a filesystem, where nlink is zero.
https://man7.org/linux/man-pages/man7/shm_overview.7.html.
https://man7.org/linux/man-pages/man2/memfd_create.2.html.