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

fix the rule to detect the exec in EKS #563

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

Issif
Copy link
Member

@Issif Issif commented Jan 17, 2025

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area plugins

/area registry

/area build

/area documentation

What this PR does / why we need it:

I discovered the exec in pod in EKS are not firing alert with the current rules for k8s_audit sources.

It comes from the verb which is not correct in the current rule. The condition expects ka.verb = create but for EKS it's get. The issue might be there for other managed cluster.

Here's an example of audit log from EKS for example:

{
    "kind": "Event",
    "apiVersion": "audit.k8s.io/v1",
    "level": "Request",
    "auditID": "00c8decc-b988-4086-908b-fe8ec37b9380",
    "stage": "ResponseStarted",
    "requestURI": "/api/v1/namespaces/default/pods/cncf-76b565c64f-wpq4z/exec?command=sh&command=-c&command=command+-v+bash+%3E%2Fdev%2Fnull+%26%26+exec+bash+%7C%7C+exec+sh&container=cncf&stdin=true&stdout=true&tty=true",
    "verb": "get",
    "user": {
        "username": "kubernetes-admin",
        "uid": "aws-iam-authenticator:XXXXXX",
        "groups": [
            "system:masters",
            "system:authenticated"
        ],
        "extra": {}
    },
    "sourceIPs": [
        "X.X.X.X"
    ],
    "userAgent": "kubectl1.30.3/v1.30.3 (linux/amd64) kubernetes/6fc0a69",
    "objectRef": {
        "resource": "pods",
        "namespace": "default",
        "name": "cncf-76b565c64f-wpq4z",
        "apiVersion": "v1",
        "subresource": "exec"
    },
    "responseStatus": {
        "metadata": {},
        "code": 101
    },
    "requestReceivedTimestamp": "2025-01-17T17:13:06.287434Z",
    "stageTimestamp": "2025-01-17T17:13:06.296372Z",
    "annotations": {
        "authorization.k8s.io/decision": "allow",
        "authorization.k8s.io/reason": ""
    }
}

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Signed-off-by: Thomas Labarussias <[email protected]>
Copy link

Rules files suggestions

rules

Comparing c591757724cf31b7828024f19b882bfe95475d7e with latest tag plugins/k8saudit/v0.11.0

Patch changes:

  • Version dependency alternative to plugin k8saudit-ovh has added
  • Version dependency alternative to plugin k8saudit-ovh has added
  • Version dependency alternative to plugin k8saudit-ovh has added

@poiana
Copy link
Contributor

poiana commented Jan 22, 2025

LGTM label has been added.

Git tree hash: 353e3155672fe2b2741098d3a72a06a99b32128b

@poiana
Copy link
Contributor

poiana commented Jan 22, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Issif, LucaGuerra

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 42e49c7 into falcosecurity:main Jan 22, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants