Repository navigation
Client DCR: Trusted Hosts can be faked when relying in X-Forwarded-For #41939
Unanswered
achetronic
asked this question in
Q&A
Replies: 1 comment 8 replies
|
See https://www.keycloak.org/server/reverseproxy#_trusted_proxies - requests coming from an untrusted client won't have their header values used. |
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Before reporting an issue
Area
core
Describe the bug
Hello there,
I have a Keycloak deployed in production, relying in X-Forwarded-For instead of Forwarded headers due to I have a GLB and an Istio gateway in front. Moreover, due to problems with CORS in Keycloak, I have an additional Istio sidecar fixing it. No problem about this, the issue is the following:
Keycloak rely on faked IPs in dynamic client registration feature. When one of the IPs is set in the X-Forwarded-For by another actor from another source, Keycloak is allowing the registration
I understand that for Keycloak is nearly impossible to calculate the real IP because it can not know the number of hops until reaching Keycloak to calculate the potential IP inside XFF header
By the moment we have it mitigated restricting entrance for those IPs using an AuthorizationPolicy in Istio, that is getting the real client-ip properly (saying this just in case others falling in the same bug)
Version
26.3.1
Regression
Expected behavior
One or several of the following:
Be able to configure the number of hops before Keycloak, to discard from right to left the trusted proxies in front of the system when using in X-Forwarded-For header
Be able to trust in a custom header, where we can set directly the real-client-ip using different methods. For example, I have a proxy-wasm plugin that I place in the GLB or in Istio, that calculates really well the IP and is able to set it in a custom header
Actual behavior
For faked origins in the header, it allows Dynamic Client Registration
How to Reproduce?
Anything else?
No response
All reactions