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

TOB-K8S-002: Seccomp is disabled by default #81115

Closed
cji opened this issue Aug 8, 2019 · 12 comments
Closed

TOB-K8S-002: Seccomp is disabled by default #81115

cji opened this issue Aug 8, 2019 · 12 comments
Assignees
Labels
area/security kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/node Categorizes an issue or PR as relevant to SIG Node. wg/security-audit Categorizes an issue or PR as relevant to WG Security Audit.

Comments

@cji
Copy link
Member

cji commented Aug 8, 2019

This issue was reported in the Kubernetes Security Audit Report

Description
Seccomp is disabled by default for containers configured by kubelet since 1.10.0. This allows configured containers to interact directly with the host kernel. Depending on container privileges, this could lead to extended access to the host beyond limited kernel access.

While there is a Pod security annotation to specify a particular seccomp profile, this does not apply a constrained profile by default. According to issue #20870 this is to avoid breaking backwards compatibility with previous Kubernetes versions, with the downside of exposing the underlying host.

Exploit Scenario
Alice schedules a Pod containing her web application to her Kubernetes cluster. Eve identifies a vulnerability in Alice’s web application and gains remote code execution within the container running Alice’s application. Unbeknownst to Alice, Eve is able to use a kernel exploit due to an unconfined seccomp profile of the container.

Recommendation
Short term, the default profile should be that of the underlying container runtime installation. While a constrained seccomp profile could break backwards compatibility, critical safety features should be opt-out, not opt-in.

Long term, migrate towards using a default profile. Perform validation across nodes to ensure consistent profile usage in a default state.

Anything else we need to know?:

See #81146 for current status of all issues created from these findings.

The vendor gave this issue an ID of TOB-K8S-002 and it was finding 7 of the report.

The vendor considers this issue Medium Severity.

To view the original finding, begin on page 32 of the Kubernetes Security Review Report

Environment:

  • Kubernetes version: 1.13.4
@cji cji added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 8, 2019
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Aug 8, 2019
@liggitt
Copy link
Member

liggitt commented Aug 8, 2019

/sig auth
/sig node
/assign @tallclair

@k8s-ci-robot k8s-ci-robot added sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 8, 2019
@liggitt liggitt added wg/security-audit Categorizes an issue or PR as relevant to WG Security Audit. area/security labels Aug 8, 2019
@liggitt liggitt changed the title Seccomp is disabled by default TOB-K8S-002: Seccomp is disabled by default Aug 8, 2019
@tallclair
Copy link
Member

Previous discussion: #39845

I would love to see this happen, but previous efforts to make this change have resulted in requests to:

  1. Make seccomp GA (KEP for promoting seccomp to GA enhancements#1148)
  2. Define the default profile in Kubernetes (requires profile representation in k8s)
  3. Implement a "complain mode" so issues can be detected before enabling

(1) is likely to happen in k8s 1.17. (2) Is a good follow up to that. (3) would be very useful, but also seems like the hardest change to make, and no one seems interested in investing significantly into seccomp right now.

@liggitt liggitt added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Aug 21, 2019
@pjbgf
Copy link
Member

pjbgf commented Sep 19, 2019

  1. Make seccomp GA (kubernetes/enhancements#1148)
  2. Define the default profile in Kubernetes (requires profile representation in k8s)
  3. Implement a "complain mode" so issues can be detected before enabling

@tallclair I would be keen to help us achieve that. Is there any of those 3 points that help is wanted?

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 18, 2019
@cji
Copy link
Member Author

cji commented Dec 18, 2019

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 18, 2019
@tallclair
Copy link
Member

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Jan 17, 2020
@pjbgf
Copy link
Member

pjbgf commented May 13, 2020

Linked two PRs that enable seccomp by default for pod sandbox.

@michelgokan
Copy link

how to completely disable seccomp? Asking for profiling scenarios with perf in non-production environments.

@tallclair
Copy link
Member

@michelgokan for a given pod / container? Or globally for the cluster? Or disabling for the kernel?

@michelgokan
Copy link

@michelgokan for a given pod / container? Or globally for the cluster? Or disabling for the kernel?

As a simple workaround, I used following dummy seccomp configuration to enable all syscalls:

{
  "defaultAction": "SCMP_ACT_ALLOW"
}

@enj enj added this to Backlog in SIG Auth Old Apr 9, 2021
@liggitt liggitt removed the sig/auth Categorizes an issue or PR as relevant to SIG Auth. label May 24, 2021
@cynepco3hahue
Copy link

@cji Does the PR #101943 is enough to fix the issue?

@cji
Copy link
Member Author

cji commented Jun 25, 2021

Fantastic! Yes I believe that does resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/node Categorizes an issue or PR as relevant to SIG Node. wg/security-audit Categorizes an issue or PR as relevant to WG Security Audit.
Projects
None yet
Development

No branches or pull requests

8 participants