VDB
Sign up
MEDIUM5.0

GHSA-f4p5-x4vc-mh4v

Improper use of metav1.Duration allows for Denial of Service

Quick fix

GHSA-f4p5-x4vc-mh4v — github.com/fluxcd/flux2: upgrade to the fixed version with the command below.

go get github.com/fluxcd/flux2@v0.35.0

Details

Flux controllers within the affected versions range are vulnerable to a denial of service attack. Users that have permissions to change Flux’s objects, either through a Flux source or directly within a cluster, can provide invalid data to fields `.spec.interval` or `.spec.timeout` (and structured variations of these fields), causing the entire object type to stop being processed.

The issue has two root causes: a) the Kubernetes type `metav1.Duration` not being fully compatible with the Go type `time.Duration` as explained on [upstream report](https://github.com/kubernetes/apimachinery/issues/131); b) lack of validation within Flux to restrict allowed values.

### Workarounds

Admission controllers can be employed to restrict the values that can be used for fields `.spec.interval` and `.spec.timeout`, however upgrading to the latest versions is still the recommended mitigation.

### Credits

This issue was reported by Alexander Block (@codablock) through the Flux security mailing list (as [recommended](https://fluxcd.io/security/#report-a-vulnerability)).

### For more information

If you have any questions or comments about this advisory:

- Open an issue in any of the affected repositories. - Contact us at the CNCF Flux channel.

### References

- https://github.com/kubernetes/apimachinery/issues/131

Are you affected?

Enter the version of the package you're using.

Affected packages

Go/github.com/fluxcd/flux2
Introduced in: 0.1.0Fixed in: 0.35.0
Fixgo get github.com/fluxcd/flux2@v0.35.0
Go/github.com/fluxcd/source-controller
Introduced in: 0.0.1-alpha-1Fixed in: 0.30.0
Fixgo get github.com/fluxcd/source-controller@v0.30.0
Go/github.com/fluxcd/kustomize-controller
Introduced in: 0.0.1-alpha-1Fixed in: 0.29.0
Fixgo get github.com/fluxcd/kustomize-controller@v0.29.0
Go/github.com/fluxcd/helm-controller
Introduced in: 0.0.1-alpha-1Fixed in: 0.24.0
Fixgo get github.com/fluxcd/helm-controller@v0.24.0
Go/github.com/fluxcd/notification-controller
Introduced in: 0.0.1-alpha-1Fixed in: 0.27.0
Fixgo get github.com/fluxcd/notification-controller@v0.27.0
Go/github.com/fluxcd/image-automation-controller
Introduced in: 0.1.0Fixed in: 0.26.0
Fixgo get github.com/fluxcd/image-automation-controller@v0.26.0
Go/github.com/fluxcd/image-reflector-controller
Introduced in: 0.1.0Fixed in: 0.22.0
Fixgo get github.com/fluxcd/image-reflector-controller@v0.22.0
Go/github.com/fluxcd/helm-controller/api
Introduced in: 0Fixed in: 0.26.0
Fixgo get github.com/fluxcd/helm-controller/api@v0.26.0
Go/github.com/fluxcd/image-automation-controller/api
Introduced in: 0Fixed in: 0.26.1
Fixgo get github.com/fluxcd/image-automation-controller/api@v0.26.1
Go/github.com/fluxcd/image-reflector-controller/api
Introduced in: 0Fixed in: 0.22.1
Fixgo get github.com/fluxcd/image-reflector-controller/api@v0.22.1
Go/github.com/fluxcd/kustomize-controller/api
Introduced in: 0Fixed in: 0.30.0
Fixgo get github.com/fluxcd/kustomize-controller/api@v0.30.0
Go/github.com/fluxcd/notification-controller/api
Introduced in: 0Fixed in: 0.28.0
Fixgo get github.com/fluxcd/notification-controller/api@v0.28.0
Go/github.com/fluxcd/source-controller/api
Introduced in: 0Fixed in: 0.30.0
Fixgo get github.com/fluxcd/source-controller/api@v0.30.0

References