VDB
Sign up
MEDIUM5.9

GHSA-vfvj-3m3g-m532

fieldpath's Paved.SetValue allows growing arrays up to arbitrary sizes in crossplane-runtime

Quick fix

GHSA-vfvj-3m3g-m532 — github.com/crossplane/crossplane-runtime: upgrade to the fixed version with the command below.

go get github.com/crossplane/crossplane-runtime@v0.19.2

Details

### Summary

Fuzz testing on `crossplane/crossplane`, by Ada Logics and sponsored by the CNCF, identified input to a function in the `fieldpath` package that can cause an out of memory panic. Applications that use the `Paved` type's `SetValue` method with user provided input without proper validation might use excessive amounts of memory and cause an out of memory panic.

### Details

In the `fieldpath` package, the `SetValue` method of the `Paved` type sets a value on the inner object according to the provided path, without validating it first. This allows setting values in slices at any specific index and the code will grow the target array up to the required size. The index is currently capped at max uint32 (4294967295) given how indexes are parsed, but that is still an unnecessarily large value.

### Workaround

Users can parse and validate the path before passing it to the `SetValue` method of the `Paved` type, constraining the index size as deemed appropriate.

### Credits

Disclosed by Ada Logics in a fuzzing audit sponsored by CNCF.

Are you affected?

Enter the version of the package you're using.

Affected packages

Go/github.com/crossplane/crossplane-runtime
Introduced in: 0.17.0Fixed in: 0.19.2
Fixgo get github.com/crossplane/crossplane-runtime@v0.19.2
Go/github.com/crossplane/crossplane-runtime
Introduced in: 0.6.0Fixed in: 0.16.1
Fixgo get github.com/crossplane/crossplane-runtime@v0.16.1

References