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

[False Positive] Fileless Execution Alert for runc 1.1.15+ memfd on Bottlerocket 1.30.0 #3444

Open
ytsssun opened this issue Jan 10, 2025 · 2 comments
Labels

Comments

@ytsssun
Copy link

ytsssun commented Jan 10, 2025

Describe the bug

Falco is generating false positive Critical Fileless execution via memfd_create alerts for legitimate runc operations when running on Bottlerocket OS 1.30.0. This occurs because runc 1.1.15 (included in Bottlerocket 1.30.0) now uses memfd cloning instead of bind mounts for performance optimization, which triggers Falco's fileless execution detection. The change was introduced in runc 1.1.15 to address namespace_sem lock contention issues during high container churn. This is a known behavior change that has already affected other security tools - AWS GuardDuty encountered a similar issue (see bottlerocket-os/bottlerocket#4352).

For more details about the memfd cloning in runc, see the CHANGELOG in 1.1.15 and the relevant PR #4392.

How to reproduce it

  1. Use eksctl to create an EKS cluster with Bottlerocket AMI (you can get the AMI ID using aws ssm get-parameter --name /aws/service/bottlerocket/aws-k8s-1.29/x86_64/1.30.0/image_id --region us-west-2 --query 'Parameter.Value' --output text):
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: my-cluster
  region: us-west-2
  version: '1.29'
nodeGroups:
  - name: my-ng-bottlerocket
    instanceType: m5.large
    minSize: 0
    desiredCapacity: 1
    maxSize: 2
    amiFamily: Bottlerocket
    ami: ami-0ddad9af8c29ade8b
  1. Install Falco:
helm repo add falcosecurity https://falcosecurity.github.io/charts
helm repo update
helm install --replace falco --namespace falco --create-namespace --set tty=true falcosecurity/falco
  1. Deploy any pod (example using nginx):
apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
  labels:
    app: nginx
spec:
  containers:
  - name: nginx
    image: nginx:latest
    ports:
    - containerPort: 80
  1. Check Falco logs:
kubectl logs -n falco <falco-pod-name>

Expected behaviour

No alerts should be generated for legitimate runc operations using memfd_create.

Screenshots

Example of the false positive alert:

03:45:21.111017749: Critical Fileless execution via memfd_create (container_start_ts=<NA> proc_cwd=/run/containerd/io.containerd.runtime.v2.task/k8s.io/2d19dce0c83a5ad67674fea28f51dcf4bd343bac30f7fc357394b4fb34d25edf/rootfs/ evt_res=SUCCESS proc_sname=containerd gparent=oci-add-hooks evt_type=execve user=root user_uid=0 user_loginuid=-1 process=5 proc_exepath=memfd:runc_cloned:/proc/self/exe parent=runc command=5 init terminal=0 exe_flags=EXE_WRITABLE|EXE_FROM_MEMFD container_id=host container_image=<NA> container_image_tag=<NA> container_name=host k8s_ns=<NA> k8s_pod_name=<NA>)

Environment

  • Falco version: 0.39.2
  • System info: Linux version 6.1.119 (builder@buildkitsandbox) (x86_64-bottlerocket-linux-gnu-gcc (Buildroot 2024.02.8) 11.4.0, GNU ld (GNU Binutils) 2.41) #1 SMP PREEMPT_DYNAMIC Fri Dec 20 22:32:32 UTC 2024
  • Cloud provider: AWS EKS
  • OS: Bottlerocket OS 1.30.0
  • Kernel: 6.1.119
  • Installation method: Helm chart

Additional context

This issue affects all users of runc 1.1.15+ where Falco is deployed for security monitoring, not just Bottlerocket users. However, Bottlerocket 1.30.0's inclusion of runc 1.1.15 makes this particularly relevant for AWS EKS users.

The issue can be temporarily mitigated by adding runc to the known_memfd_execution_binaries list:

customRules:
  rules-allow-runc-memfd.yaml: |-
    - list: known_memfd_execution_binaries
      items: [runc]
      override:
        items: append

Apply using:

helm upgrade falco falcosecurity/falco -f custom-rules.yaml -n falco

Consider adding runc to the default known_memfd_execution_binaries list in Falco's default ruleset, as this is now expected behavior for runc 1.1.15 and possibly newer versions.

@Alwin-Stockinger
Copy link

Alwin-Stockinger commented Jan 10, 2025

The issue can be temporarily mitigated by adding runc to the known_memfd_execution_binaries list:

customRules:
  rules-allow-runc-memfd.yaml: |-
    - list: known_memfd_execution_binaries
      items: [runc]
      override:
        items: append

This did not work for me, the proc.name is "5" or "6" for me so I had to add:

customRules:
  rules-allow-runc-memfd.yaml: |-
    - list: known_memfd_execution_binaries
      items: ["5", "6"]
      override:
        items: append

@ytsssun
Copy link
Author

ytsssun commented Jan 10, 2025

This did not work for me, the proc.name is "5" or "6" for me so I had to add:

customRules:
  rules-allow-runc-memfd.yaml: |-
    - list: known_memfd_execution_binaries
      items: ["5", "6"]
      override:
        items: append

@Alwin-Stockinger Can you share your alert output? You may be able to cover that by overwriting the known_memfd_execution_processes macro by checking the proc.exepath against memfd:runc_cloned:/proc/self/exe.

customRules:
  rules-allow-runc-memfd.yaml: |-
    # Add runc to known binaries
    - list: known_memfd_execution_binaries
      items: [runc]
      override:
        items: append

    # Add specific path conditions to existing macro
    - macro: known_memfd_execution_processes
      condition: or (proc.exepath = "memfd:runc_cloned:/proc/self/exe") or (proc.exe = "memfd:runc_cloned:/proc/self/exe")
      override:
        condition: append

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants