CVE-2026-61794: Capsule: Malformed ForbiddenAnnotations.Regex can bypass Tenant validation and trigger namespace admission panic
Summary A validation bug in internal/webhook/tenant/validation/forbiddenannotationsregex.go allows an invalid ForbiddenAnnotations.Regex value to bypass Tenant admission on update. The webhook compiles ForbiddenLabels.Regex for both labels and annotations, so a malformed annotations regex can be persisted.
Published Sep 18, 2026
Affected packages
github.com/projectcapsule/capsule
- Ecosystem
- Go
- Affected
- >= 0.13.0, < 0.13.7
- Fixed in
- 0.13.7
- Check
go list -m github.com/projectcapsule/capsule
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
A validation bug in internal/webhook/tenant/validation/forbidden_annotations_regex.go allows an invalid ForbiddenAnnotations.Regex value to bypass Tenant admission on update. The webhook compiles ForbiddenLabels.Regex for both labels and annotations, so a malformed annotations regex can be persisted. Once stored, namespace admission later evaluates the bad regex through pkg/api/forbidden_list.go, where regexp.MustCompile can panic and cause admission failure.
Details
In internal/webhook/tenant/validation/forbidden_annotations_regex.go, OnUpdate validates the new Tenant object, but the loop compiles tnt.Spec.NamespaceOptions.ForbiddenLabels.Regex for both labels and annotations. That means an invalid ForbiddenAnnotations.Regex is never validated if ForbiddenLabels.Regex is valid.
Relevant paths:
internal/webhook/tenant/validation/forbidden_annotations_regex.gointernal/webhook/namespace/validation/user_metadata.gopkg/api/forbidden_list.go
Namespace admission later calls api.ValidateForbidden(...), and ForbiddenListSpec.RegexMatch() uses regexp.MustCompile(in.Regex). If the malformed regex is present in the Tenant spec, any namespace request that reaches this check can panic or fail hard, causing denial of service for namespace operations in the affected tenant.
PoC
- Update a Tenant so that:
spec.namespaceOptions.forbiddenLabels.regexis validspec.namespaceOptions.forbiddenAnnotations.regexis malformed, for example:[invalid-regex(- The Tenant update is accepted because the webhook compiles the labels regex for both fields.
- Create or update a Namespace that triggers forbidden metadata validation.
- The namespace admission path reaches
regexp.MustCompile(...)and panics.
package main
import (
"fmt"
"regexp"
)
type ForbiddenListSpec struct {
Regex string
}
type NamespaceOptions struct {
ForbiddenLabels ForbiddenListSpec
ForbiddenAnnotations ForbiddenListSpec
}
type Tenant struct {
NamespaceOptions *NamespaceOptions
}
func validateTenantUpdate(tnt *Tenant) error {
if tnt.NamespaceOptions == nil {
return nil
}
annotationsToCheck := map[string]string{
"labels": tnt.NamespaceOptions.ForbiddenLabels.Regex,
"annotations": tnt.NamespaceOptions.ForbiddenAnnotations.Regex,
}
for scope, annotation := range annotationsToCheck {
if _, err := regexp.Compile(tnt.NamespaceOptions.ForbiddenLabels.Regex); err != nil {
return fmt.Errorf("deny update: unable to compile %s regex for forbidden %s", annotation, scope)
}
}
return nil
}
func validateForbidden(metadata map[string]string, forbidden ForbiddenListSpec) error {
for key := range metadata {
if forbidden.Regex != "" {
if regexp.MustCompile(forbidden.Regex).MatchString(key) {
return fmt.Errorf("forbidden key matched: %s", key)
}
}
}
return nil
}
func main() {
oldTenant := &Tenant{
NamespaceOptions: &NamespaceOptions{
ForbiddenLabels: ForbiddenListSpec{Regex: `^[a-z0-9-]+$`},
ForbiddenAnnotations: ForbiddenListSpec{Regex: `^[a-z0-9-]+$`},
},
}
newTenant := &Tenant{
NamespaceOptions: &NamespaceOptions{
ForbiddenLabels: ForbiddenListSpec{Regex: `^[a-z0-9-]+$`},
ForbiddenAnnotations: ForbiddenListSpec{Regex: `[invalid-regex(`},
},
}
fmt.Println("=== Update step ===")
if err := validateTenantUpdate(newTenant); err != nil {
fmt.Printf("unexpected deny: %v\n", err)
} else {
fmt.Println("allowed: malformed ForbiddenAnnotations.Regex bypassed validation")
}
fmt.Println()
fmt.Println("=== Namespace step ===")
_ = oldTenant
defer func() {
if r := recover(); r != nil {
fmt.Printf("panic reproduced from ValidateForbidden: %v\n", r)
}
}()
_ = validateForbidden(map[string]string{"example": "value"}, ForbiddenListSpec{Regex: `[invalid-regex(`})
fmt.Println("no panic, unexpected")
}Expected output:
=== Update step ===
allowed: malformed ForbiddenAnnotations.Regex bypassed validation
=== Namespace step ===
panic reproduced from ValidateForbidden: regexp: Compile(`[invalid-regex(`): error parsing regexp: missing closing ]: `[invalid-regex(`Impact
An attacker who can update the Tenant configuration can persist a malformed ForbiddenAnnotations.Regex and cause namespace admission failures for the affected tenant. This can result in a tenant-scoped denial of service.
Credited to PhucQuan.
References
- https://github.com/projectcapsule/capsule/security/advisories/GHSA-gxjc-74v5-3vx3
- https://github.com/projectcapsule/capsule/pull/1983
- https://github.com/projectcapsule/capsule/commit/8d89d6865df6f41c7faa22fc9e807a57b01bfd0e
- https://github.com/projectcapsule/capsule/releases/tag/v0.13.7
- https://github.com/advisories/GHSA-gxjc-74v5-3vx3
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-61672
Capsule: Tenant owner bypasses Capsule's forbidden namespace/service/node label and annotation enforcement
high7.1Sep 18, 2026CVE-2026-61795
Capsule: hostnameRegexHandler.OnUpdate validates stale (old) Tenant regex, allowing invalid AllowedHostnames regex to bypass webhook validation
medium6.8Sep 18, 2026CVE-2026-65834
Capsule: CapsuleConfiguration NodeMetadata regex fields lack webhook validation, allowing MustCompile panic on all Node admission requests
medium6.8Jul 31, 2026CVE-2026-65835
Capsule has an incomplete fix of CVE-2026-22872: TenantResource RawItems and Generators still allow cluster-scoped resource creation (cross-tenant privilege escalation)
medium6.6Jul 31, 2026CVE-2026-55636
Capsule: Incomplete fix of CVE-2026-30963: singular/plural typo leaves namespaces/finalize unprotected
medium5.7Jun 17, 2026CVE-2026-22872
Capsule TenantResource RawItems Cluster-Scoped Resource Creation Vulnerability
medium6.9May 28, 2026
