Original flaw
Earlier flawFission pod specifications allowed dangerous Linux capabilities.
Sink: Fission podspec_safety.go dangerousMergeContainerCapabilities
Originally written by Vishal
How AI contributed: Incomplete remediationPublished Jul 28, 2026 in
fission/fissionAll 3 findings in this repository
Fission v1.24.0 added PodSpec safety validation for tenant-facing Environment and Function CRDs (ValidatePodSpecSafety / ValidateContainerSafety admission webhook + sanitizeContainerSecurityContext executor merge layer), but the capability check was implemented as a fixed denylist of six Linux capabilities (SYS_ADMIN, NET_ADMIN, SYS_PTRACE, SYS_MODULE, DAC_READ_SEARCH, DAC_OVERRIDE). The denylist omitted CAP_SYS_TIME, among others. As a result, a tenant who could create a Function or Environment CRD could request securityContext.capabilities.add: ["SYS_TIME"], pass Fission's admission validation and merge-layer sanitization, and run attacker-controlled code with CAP_SYS_TIME in the resulting function or runtime container. Demonstrated consequence: cross-tenant node integrity damage via CAP_SYS_TIME. The Linux real-time clock is not namespaced — time namespaces virtualize only MONOTONIC and BOOTTIME, never REALTIME — so a tenant container holding CAP_SYS_TIME could call clock_settime(CLOCK_REALTIME) and rewrite the shared node wall clock. That corrupts TLS / certificate validity windows, Kubernetes lease renewal, token expiry, scheduling, and time-series for every workload on the node. The denylist also omitted SYS_RAWIO, BPF, SYS_RESOURCE, and MAC_ADMIN. Those are documented as evidence that the denylist is structurally incomplete (their practical impact is kernel-, LSM-, or device-cgroup-dependent and is not exercised in this report). The deeper structural problem: a denylist on capabilities.add cannot constrain capabilities the OCI runtime grants by default — DAC_OVERRIDE is in the OCI default cap set and reaches the container regardless of any add check, partially mooting the denylist for its own entries. A capability allowlist (with drop:["ALL"] to remove the default set) is the only model that addresses both problems. Affected · Project: github.com/fission/fission · Versions: <= 1.24.0 · Audited commits: v1.24.0 tag (ce617120) and current HEAD at audit time · Component: pkg/apis/core/v1/podspec_safety.go (dangerousCapabilities) and pkg/executor/util/merge.go (dangerousMergeContainerCapabilities) · Pre-condition: cluster does not enforce a restrictive Pod Security Admission (PSA) profile on the function-pod namespace. With PSA restricted in force the API server's PodSecurity admission rejects the pod at creation and this finding does not apply. Fission added its own PodSpec validation precisely because it cannot assume PSA enforcement. Fix section (paste into the Fix / Patches field) Fixed in v1.25.0 by: · PR #3465 (commit 2569b42b) — replace the denylist with a PSA-restricted allowlist (NET_BIND_SERVICE only) at both enforcement layers: · pkg/apis/core/v1/podspec_safety.go — ValidateContainerSafety now rejects any capabilities.add entry not in allowedCapabilities. The container check is invoked from ValidatePodSpecSafety for every PodSpec container / init-container and from Environment.validateForAdmission for the bare Runtime.Container / Builder.Container. · pkg/executor/util/merge.go — sanitizeContainerSecurityContext filters capabilities.add through the same allowlist at every merge site (poolmgr / newdeploy / container executor / builder). · The same PR adds 21 bounded CEL XValidation rules covering the cheap pod-level invariants (hostNetwork / hostPID / hostIPC / serviceAccountName / serviceAccount override) on FunctionSpec, Runtime, and Builder, plus the bare-Container SecurityContext checks (privileged != true, allowPrivilegeEscalation != true, capabilities.add ⊆ {NET_BIND_SERVICE}) on Runtime and Builder. The API server now short-circuits those attack vectors per CRD apply before the webhook is invoked. Per-container PodSpec iteration stays in the webhook because it exceeds the API server's CEL cost budget. · The same PR also adds two forward-compat regression guards in pkg/apis/core/v1/podspec_safety_test.go: · TestAllTenantContainerSurfacesAreValidated walks every CRD root type via reflection and fails if any reachable *apiv1.PodSpec or *apiv1.Container field is missing from the hand-maintained known-covered set. · TestTenantContainerSurfaces_RejectSysAdmin end-to-end exercises each covered surface and asserts ValidateForAdmission rejects a SYS_ADMIN injection at that exact path. Not addressed in v1.25.0 The advisory's structural recommendation to force capabilities.drop: ["ALL"] at the merge layer is not part of this fix. Fission's own sidecar containers (fission-fetcher, builder) were authored against the OCI default capability set and need a per-container cap audit before drop:["ALL"] can be applied uniformly. The allowlist on capabilities.add closes the demonstrated CAP_SYS_TIME impact; the OCI-default-cap concern (which the advisory itself marks as conditional / not demonstrated) is tracked separately.
Count first-party GHSA-qf5v only as AI_INCOMPLETE_REMEDIATION of the six-capability denylist (SYS_ADMIN, NET_ADMIN, SYS_PTRACE, SYS_MODULE, DAC_READ_SEARCH, DAC_OVERRIDE) that omits SYS_TIME. The counted atomic commit is the Claude-marked GitHub squash e484df84 of PR 3391, which first-parent-introduces pkg/apis/core/v1/podspec_safety.go and pkg/executor/util/merge.go dangerousMergeContainerCapabilities. Do not count unreleased PR member 2db76f65. Do not count pre-validator HostNetwork/privileged/SYS_ADMIN. Do not merge with GHSA-M63V.
Case facts
Only the highlighted steps are this advisory. The first step is the earlier flaw the AI tried, and failed, to close.
Original flaw
Earlier flawSink: Fission podspec_safety.go dangerousMergeContainerCapabilities
Originally written by Vishal
This advisoryCVE-2026-50570 (GHSA-QF5V-M7P4-95RP)
AI tried to fix this
The AI-assisted change was a real security patch, but it left the same advisory reachable.
Missed: Omitted SYS_TIME from the denylist.
Incomplete AI-assisted fix · Claude
Fixed again
This is the patch that actually stops the same attack path.
AI-assisted fix: Claude Code · Sanket Sudake
@@ -0,0 +1,111 @@+/*+Copyright 2026 The Fission Authors.++Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++Unless required by applicable law or agreed to in writing, software+distributed under the License is distributed on an "AS IS" BASIS,+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+See the License for the specific language governing permissions and+limitations under the License.+*/++package v1++import (+ "errors"+ "fmt"++ apiv1 "k8s.io/api/core/v1"+)++// dangerousCapabilities lists Linux capabilities that effectively grant root+// or break the container sandbox. Tenants that can write to Environment or+// Function PodSpec must not be able to add these via securityContext.+var dangerousCapabilities = map[apiv1.Capability]struct{}{+ "SYS_ADMIN": {},+ "NET_ADMIN": {},+ "SYS_PTRACE": {},+ "SYS_MODULE": {},+ "DAC_READ_SEARCH": {},+ "DAC_OVERRIDE": {},+}++// ValidatePodSpecSafety rejects PodSpec fields that would let a low-privilege+// tenant escalate to host or cluster level when the executor or buildermgr+// schedules a pod from a user-supplied podspec.+//+// The fission-executor and fission-builder service accounts have the+// authority to create Deployments and Pods, so any field that crosses+// the container sandbox boundary (host namespaces, privileged contexts,+// hostPath mounts, alternate service accounts, dangerous capabilities)+// would let a Function- or Environment-CRUD tenant escape the boundary+// of their own RBAC and reach node-level state.+//+// Closes GHSA-gx55-f84r-v3r7, GHSA-wmgg-3p4h-48x7, GHSA-v455-mv2v-5g92.+//+// The fieldPath argument is used as a prefix in error messages so the+// caller can identify which podspec failed (e.g.+// "Environment.spec.runtime.podspec" / "Function.spec.podspec").+func ValidatePodSpecSafety(fieldPath string, ps *apiv1.PodSpec) error {+ if ps == nil {+ return nil+ }+ var errs error++ if ps.HostNetwork {+ errs = errors.Join(errs, fmt.Errorf("%s.hostNetwork is not allowed", fieldPath))+ }+ if ps.HostPID {+ errs = errors.Join(errs, fmt.Errorf("%s.hostPID is not allowed", fieldPath))+ }+ if ps.HostIPC {+ errs = errors.Join(errs, fmt.Errorf("%s.hostIPC is not allowed", fieldPath))+ }+ if ps.ServiceAccountName != "" {+ errs = errors.Join(errs, fmt.Errorf("%s.serviceAccountName override is not allowed", fieldPath))+ }+ for i, v := range ps.Volumes {+ if v.HostPath != nil {+ errs = errors.Join(errs, fmt.Errorf("%s.volumes[%d].hostPath (%q) is not allowed", fieldPath, i, v.Name))+ }+ }++ checkContainer := func(group string, c apiv1.Container) error {+ var cerrs error+ sc := c.SecurityContext+ if sc == nil {+ return nil+ }+ if sc.Privileged != nil && *sc.Privileged {+ cerrs = errors.Join(cerrs, fmt.Errorf(+ "%s.%s[%s].securityContext.privileged=true is not allowed", fieldPath, group, c.Name))+ }+ if sc.AllowPrivilegeEscalation != nil && *sc.AllowPrivilegeEscalation {+ cerrs = errors.Join(cerrs, fmt.Errorf(@@ -14,6 +14,7 @@ import ( "strings" "testing" + apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "github.com/fission/fission/pkg/apis/core/v1"@@ -117,3 +118,63 @@ func TestFunctionWebhook_Validate_CrossNamespacePackage(t *testing.T) { }) } }++// TestFunctionWebhook_Validate_RejectsDangerousPodSpec exercises the+// container-executor PodSpec safety check. Closes GHSA-v455-mv2v-5g92.+func TestFunctionWebhook_Validate_RejectsDangerousPodSpec(t *testing.T) {+ on := true+ cases := []struct {+ name string+ ps *apiv1.PodSpec+ wantInErr string+ }{+ {+ name: "hostNetwork",+ ps: &apiv1.PodSpec{HostNetwork: true},+ wantInErr: "hostNetwork",+ },+ {+ name: "hostPath volume",+ ps: &apiv1.PodSpec{+ Volumes: []apiv1.Volume{{+ Name: "host-root",+ VolumeSource: apiv1.VolumeSource{+ HostPath: &apiv1.HostPathVolumeSource{Path: "/"},+ },+ }},+ },+ wantInErr: "hostPath",+ },+ {+ name: "privileged container",+ ps: &apiv1.PodSpec{+ Containers: []apiv1.Container{{+ Name: "user",+ SecurityContext: &apiv1.SecurityContext{Privileged: &on},+ }},+ },+ wantInErr: "privileged",+ },+ {+ name: "serviceAccountName override",+ ps: &apiv1.PodSpec{ServiceAccountName: "cluster-admin"},+ wantInErr: "serviceAccountName",+ },+ }++ r := &Function{}+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ fn := makeValidFunction("default", "default", "default")+ fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType = v1.ExecutorTypeContainer+ fn.Spec.PodSpec = tc.ps+ err := r.Validate(fn)+ if err == nil {+ t.Fatalf("expected rejection for %s, got nil", tc.name)+ }+ if !strings.Contains(err.Error(), tc.wantInErr) {+ t.Fatalf("error must mention %q, got: %v", tc.wantInErr, err)+ }+ })+ }+}@@ -0,0 +1,191 @@+/*+Copyright 2026 The Fission Authors.++Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0+*/++package v1++import (+ "strings"+ "testing"++ apiv1 "k8s.io/api/core/v1"+)++func TestValidatePodSpecSafety_Nil(t *testing.T) {+ if err := ValidatePodSpecSafety("Function.spec.podspec", nil); err != nil {+ t.Fatalf("nil podspec must be accepted, got: %v", err)+ }+}++func TestValidatePodSpecSafety_Benign(t *testing.T) {+ allow := false+ ps := &apiv1.PodSpec{+ Containers: []apiv1.Container{{+ Name: "user",+ Image: "alpine:3.19",+ Command: []string{"/bin/sh", "-c", "echo hi"},+ Env: []apiv1.EnvVar{{Name: "FOO", Value: "bar"}},+ SecurityContext: &apiv1.SecurityContext{+ AllowPrivilegeEscalation: &allow,+ Capabilities: &apiv1.Capabilities{+ Add: []apiv1.Capability{"NET_BIND_SERVICE"},+ },+ },+ }},+ Volumes: []apiv1.Volume{{+ Name: "cm",+ VolumeSource: apiv1.VolumeSource{+ ConfigMap: &apiv1.ConfigMapVolumeSource{+ LocalObjectReference: apiv1.LocalObjectReference{Name: "my-cm"},+ },+ },+ }},+ NodeSelector: map[string]string{"role": "fn"},+ }+ if err := ValidatePodSpecSafety("Function.spec.podspec", ps); err != nil {+ t.Fatalf("benign podspec must be accepted, got: %v", err)+ }+}++func TestValidatePodSpecSafety_DangerousFields(t *testing.T) {+ on := true+ cases := []struct {+ name string+ mutate func(*apiv1.PodSpec)+ wantInErr string+ }{+ {+ name: "hostNetwork",+ mutate: func(ps *apiv1.PodSpec) { ps.HostNetwork = true },+ wantInErr: "hostNetwork",+ },+ {+ name: "hostPID",+ mutate: func(ps *apiv1.PodSpec) { ps.HostPID = true },+ wantInErr: "hostPID",+ },+ {+ name: "hostIPC",+ mutate: func(ps *apiv1.PodSpec) { ps.HostIPC = true },+ wantInErr: "hostIPC",+ },+ {+ name: "serviceAccountName override",+ mutate: func(ps *apiv1.PodSpec) { ps.ServiceAccountName = "cluster-admin" },+ wantInErr: "serviceAccountName",+ },+ {+ name: "hostPath volume",+ mutate: func(ps *apiv1.PodSpec) {+ ps.Volumes = []apiv1.Volume{{+ Name: "host-root",+ VolumeSource: apiv1.VolumeSource{+ HostPath: &apiv1.HostPathVolumeSource{Path: "/"},@@ -11,16 +11,20 @@ import ( apiv1 "k8s.io/api/core/v1" ) -// dangerousCapabilities lists Linux capabilities that effectively grant root-// or break the container sandbox. Tenants that can write to Environment or-// Function PodSpec must not be able to add these via securityContext.-var dangerousCapabilities = map[apiv1.Capability]struct{}{- "SYS_ADMIN": {},- "NET_ADMIN": {},- "SYS_PTRACE": {},- "SYS_MODULE": {},- "DAC_READ_SEARCH": {},- "DAC_OVERRIDE": {},+// allowedCapabilities is the strict allowlist of Linux capabilities a tenant+// may request via `securityContext.capabilities.add` on Environment- or+// Function-supplied (init)containers. It matches Kubernetes Pod Security+// Admission's "restricted" profile (only NET_BIND_SERVICE may be added on top+// of the forced drop: ["ALL"] applied at the executor merge layer).+//+// Replaces the previous fixed denylist of six capabilities (SYS_ADMIN,+// NET_ADMIN, SYS_PTRACE, SYS_MODULE, DAC_READ_SEARCH, DAC_OVERRIDE). The+// denylist was structurally incomplete: it omitted at least SYS_TIME (which+// lets a tenant rewrite the shared node wall clock), and could never constrain+// the capabilities the OCI runtime grants by default (the merge layer addresses+// those via drop: ["ALL"]). Closes GHSA-qf5v-m7p4-95rp.+var allowedCapabilities = map[apiv1.Capability]struct{}{+ "NET_BIND_SERVICE": {}, } // ValidatePodSpecSafety rejects PodSpec fields that would let a low-privilege@@ -117,9 +121,10 @@ func ValidateContainerSafety(fieldPath string, c *apiv1.Container) error { } if sc.Capabilities != nil { for _, cap := range sc.Capabilities.Add {- if _, bad := dangerousCapabilities[cap]; bad {+ if _, ok := allowedCapabilities[cap]; !ok { errs = errors.Join(errs, fmt.Errorf(- "%s.securityContext.capabilities.add[%q] is not allowed", fieldPath, cap))+ "%s.securityContext.capabilities.add[%q] is not in the allowlist (only NET_BIND_SERVICE may be added)",+ fieldPath, cap)) } } }@@ -333,30 +333,34 @@ func stripHostPathVolumes(vols []apiv1.Volume) []apiv1.Volume { return out } -// dangerousMergeContainerCapabilities lists the Linux capabilities that-// effectively bypass the container sandbox. Kept in sync with the-// authoritative denylist in pkg/apis/core/v1/podspec_safety.go — the-// admission webhook is the primary defence; this is the merge-layer-// belt-and-braces for webhook-bypass clusters.-var dangerousMergeContainerCapabilities = map[apiv1.Capability]struct{}{- "SYS_ADMIN": {},- "NET_ADMIN": {},- "SYS_PTRACE": {},- "SYS_MODULE": {},- "DAC_READ_SEARCH": {},- "DAC_OVERRIDE": {},+// allowedMergeContainerCapabilities is the strict allowlist of Linux+// capabilities a tenant-supplied container may carry through the merge layer+// via `securityContext.capabilities.add`. Kept in sync with allowedCapabilities+// in pkg/apis/core/v1/podspec_safety.go (the admission gate). The OCI default+// capability set is removed by the forced drop: ["ALL"] below.+var allowedMergeContainerCapabilities = map[apiv1.Capability]struct{}{+ "NET_BIND_SERVICE": {}, } -// sanitizeContainerSecurityContext zeroes out the privilege-escalation bits-// of a container's SecurityContext after a MergePodSpec call. The merge-// path uses mergo.WithOverride and unconditionally copies SecurityContext-// fields from the target container, so a tenant-supplied podspec with-// privileged=true / allowPrivilegeEscalation=true / Capabilities.Add =-// [SYS_ADMIN, ...] would otherwise reach the running pod on-// webhook-bypass clusters (failurePolicy=Ignore or stale objects from a-// pre-webhook upgrade). The webhook is the primary defence; this is-// defence in depth. Closes GHSA-gx55-f84r-v3r7 / GHSA-wmgg-3p4h-48x7 /-// GHSA-v455-mv2v-5g92.+// sanitizeContainerSecurityContext enforces the container-sandbox invariants+// on a merged container's SecurityContext: privileged=false,+// allowPrivilegeEscalation=false, and capabilities.add filtered to+// allowedMergeContainerCapabilities. The admission webhook is the primary+// defence; this is the merge-layer belt-and-braces for webhook-bypass+// clusters (failurePolicy=Ignore or stale objects from a pre-webhook+// upgrade).+//+// Closes GHSA-gx55-f84r-v3r7 / GHSA-wmgg-3p4h-48x7 / GHSA-v455-mv2v-5g92 and+// the follow-up GHSA-qf5v-m7p4-95rp (the prior denylist on capabilities.add+// could not enumerate every dangerous capability — the allowlist closes the+// demonstrated CAP_SYS_TIME bypass and every other non-allowlisted add).+//+// Not addressed here: the OCI runtime's ~14 default capabilities (MKNOD,+// SETFCAP, DAC_OVERRIDE, NET_RAW, ...) still reach the container. Forcing+// capabilities.drop=["ALL"] is the structural fix the qf5v advisory+// recommends, but Fission's own sidecar containers (fetcher, builder) were+// authored against the OCI default cap set and need to be audited before+// drop:["ALL"] can be applied uniformly. Tracked separately. func sanitizeContainerSecurityContext(c *apiv1.Container) { if c.SecurityContext == nil { return@@ -379,7 +383,7 @@ func sanitizeContainerSecurityContext(c *apiv1.Container) { if sc.Capabilities != nil && len(sc.Capabilities.Add) > 0 { filtered := make([]apiv1.Capability, 0, len(sc.Capabilities.Add)) for _, cap := range sc.Capabilities.Add {- if _, bad := dangerousMergeContainerCapabilities[cap]; bad {+ if _, ok := allowedMergeContainerCapabilities[cap]; !ok { continue } filtered = append(filtered, cap)AI-assisted change 3630ebb8b03cd1bf4171e94e9999c3371ccb0086884591366f453fbcba24c888 · Fix e183cf08acabab918de585e2cbe849cbfbf3627469aecd5cd5534bc120eab6b7