cilium / tetragon

eBPF-based Security Observability and Runtime Enforcement
https://tetragon.io
Apache License 2.0
3.67k stars 370 forks source link

Add dynamic parameter extraction #3143

Open ScriptSathi opened 6 days ago

ScriptSathi commented 6 days ago

The discussion for this PR can be found here https://github.com/cilium/tetragon/issues/3142

This is currently a draft. I wanted to start the discussion before submitting the final code, as I think, it is a big enough PR.

Take this PR in the today state as a proof of concept for dynamic parameter extraction. I will continue to work on this PR until the below checks are done.

At the current state, the PR is able to

Description

This PR introduce the dynamic parameter extraction

Comments

Test the PR

You can use the following config

apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: "lsm"
spec:
  lsmhooks:
  - hook: "bprm_check_security"
    args:
      - index: 0
        type: "linux_binprm"
        extractParam: "file.f_path.dentry.d_name.name"
        overwriteType: "string"
    selectors:
      - matchArgs:
        - index: 0
          operator: "Postfix"
          values:
            - "ls"
            - "sh"
            - "bash"

If you want to test it with more arguments, you can use bprm_creds_from_file hook. It has struct linux_binprm and struct file which are supported.

netlify[bot] commented 5 days ago

Deploy Preview for tetragon ready!

Name Link
Latest commit 1fb7dbca69ced745a76f9f0ca36c5e39ff0dc4a3
Latest deploy log https://app.netlify.com/sites/tetragon/deploys/674216bc2d27200008186dd3
Deploy Preview https://deploy-preview-3143--tetragon.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.