fix(kubernetes-client): raw query values allow Kubernetes API option smuggling - #7946
Open
GrosQuildu wants to merge 2 commits into
Open
fix(kubernetes-client): raw query values allow Kubernetes API option smuggling#7946GrosQuildu wants to merge 2 commits into
GrosQuildu wants to merge 2 commits into
Conversation
GrosQuildu
marked this pull request as ready for review
June 26, 2026 12:57
GrosQuildu
requested review from
ash-thakur-rh,
manusa and
shawkins
as code owners
June 26, 2026 12:57
GrosQuildu
added a commit
to GrosQuildu/kubernetes-client
that referenced
this pull request
Jun 26, 2026
GrosQuildu
force-pushed
the
ptp-51-query-option-smuggling
branch
from
June 26, 2026 17:14
3ba7596 to
34839a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Several Fabric8 Kubernetes Client request builders splice caller-controlled values directly into URL query strings. Values that contain
&or=are then parsed by the Kubernetes or OpenShift API server as additional independent query parameters instead of as data inside one parameter value.The vulnerable call sites are:
OperationSupport.getResourceURLForPatchOperation, wherefieldManagercan inject patch options such asforce,dryRun, orfieldValidation.PodOperationContext.getLogParameters, wherecontainerIdcan inject pod-log options. This helper is reached directly throughPodOperationsImpland through controller log wrappers:JobOperationsImpl,RollableScalableResourceOperationsubclasses for Deployment, ReplicaSet, StatefulSet, ReplicationController, the legacy extensions variants, and OpenShiftDeploymentConfigOperationsImpl.BuildConfigOperationsImpl.getQueryParameters, where OpenShift binary-build metadata fields andasFilecan injectinstantiatebinaryoptions.Exploit Scenario
An internal log service fetches Kubernetes Job logs with a privileged Fabric8 client. The service lets a lower-trusted user choose only the container name:
The attacker supplies:
Fabric8 kubernetes-client sends:
The API server receives
previousandtailLinesas real log options. The wrapper intended to expose only container selection, but the caller changes log history and volume controls.This Java PoC can be added to
JobTest. It calls the Fabric8 mock-server client path and fails on the vulnerable implementation because the request is not encoded as onecontainervalue:Unpatched execution evidence:
Patched verification:
Threat Model
If the APIs are allowed to accept additional URL parameters, then threat model should make it clear that the APIs are not safe to use with untrusted inputs.
Otherwise, the APIs that take as inputs specific URL params should not accept inputs with param separators. The fix below ensures that.
Note that the "Raw API path segments allow request retargeting" finding is similar in nature to this one.
Fix
Use
URLUtils.URLBuilderfor every query value instead of concatenating query text. This keeps attacker-supplied&and=characters inside the intended value.Paweł Płatek from Trail of Bits in collaboration with OpenAI.