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

Add process.thread.capabilities #2245

Merged
merged 9 commits into from
Aug 9, 2023

Conversation

nicholasberlin
Copy link
Contributor

Being able to gather and track Linux capabilities for a process (thread) could allow us to detect and prevent various activities such as container escapes, privilege escalation and exploitation.

@nicholasberlin nicholasberlin requested a review from a team as a code owner July 27, 2023 14:39
description: >
This is a limiting superset for the effective capabilities that the
thread may assume.
example: "[\"CAP_BPF\", \"CAP_SYS_ADMIN\"]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the format we expect to use then I recommend adding a pattern so that automated validation can yield warnings when the format is not followed. I am thinking ^(CAP_[A-Z_]+|\d+)$ which allows software to insert the capability number if it is unaware the associated name.

example:

pattern: ^[A-F0-9]{2}(-[A-F0-9]{2}){5,}$

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super cool! @andrewkroh thanks for the suggestion

Copy link
Member

@ebeahan ebeahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field definitions and their descriptions look great.

@nicholasberlin Can you also make this change underneath the process object in schemas/subsets/main.yml, re-run make, and commit the changed files? Right now, the new fields aren't populating in all the expected places.

diff --git a/schemas/subsets/main.yml b/schemas/subsets/main.yml
index 50312f7b..0b953e32 100644
--- a/schemas/subsets/main.yml
+++ b/schemas/subsets/main.yml
@@ -309,6 +309,10 @@ fields:
             fields:
               id: {}
               name: {}
+              capabilities:
+                fields:
+                  effective: {}
+                  permitted: {}
           title: {}
           tty:
             fields:
@@ -443,6 +447,10 @@ fields:
         fields:
           id: {}
           name: {}
+          capabilities:
+            fields:
+              effective: {}
+              permitted: {}
       title: {}
       tty:
         fields: "*"

@norrietaylor
Copy link
Member

cc/ @DefSecSentinel and @imays11

Please review this ECS addition to ensure it matches your expectations.

@DefSecSentinel
Copy link

DefSecSentinel commented Aug 3, 2023

Looks good to me

Copy link

@DefSecSentinel DefSecSentinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@ebeahan ebeahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@imays11
Copy link

imays11 commented Aug 8, 2023

Looks great @norrietaylor

@nicholasberlin nicholasberlin merged commit b08a33c into main Aug 9, 2023
@nicholasberlin nicholasberlin deleted the nberlin/add_process_capabilities branch August 9, 2023 13:04
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.

6 participants