Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebFlux request id should not contain internal IPs #27885

Closed
psytester opened this issue Jan 4, 2022 · 3 comments
Closed

WebFlux request id should not contain internal IPs #27885

psytester opened this issue Jan 4, 2022 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@psytester
Copy link

psytester commented Jan 4, 2022

Affects: since Release v5.3.5 up to curent v5.3.14 via commit 1ef8cad of issue #26649

If for some reason the production system must be temporarily running at the DEBUG level, there might be a security issue.

If a gateway error occurs in that time while the gateway communicating with the backend server, the API response additionally contains the local IP and remote IP.
Thus we are exposing network details to the outside world, which should not be done.

{"timestamp":1641298126366,"path":"/api/endpoint","status":504,"error":"Gateway Timeout","requestId":"b35a8d76-10, L:/10.1.50.20:8080 - R:/10.1.50.10:45686"}

The extended log file information is fine for me, there I see the IPs.
It's just the API response with too much private details.

As an attacker I obtain details about two systems:
10.1.50.20 == internal gateway IP
10.1.50.10 == internal TLS-Endpoint IP in front of the gateway, not the public one
The attacker can now combine this info with other vulnerabilities (maybe in other components), e.g. some SSRF as he knows the internal IP infrastructure.
No up-to-date Apache httpd running? --> CVE-2021-40438
No up-to-date Keycloak running? --> CVE-2020-10770

My Mitigation:
My current work around is to set this one log channel to INFO level
Logback XML notation:

<logger name="org.springframework.http.server.reactive.ReactorServerHttpRequest" level="INFO" />

or in application.properties:

logging.level.org.springframework.http.server.reactive.ReactorServerHttpRequest=INFO

related code is that part:
https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java#L222-L224

To easily reproduce the problem, set up very small timeout values (1 ms) for the gateway as the client:
httpclient.connectionTimeout: 1
httpclient.receiveTimeout: 1

@psytester psytester changed the title Do not expose internal IPs on API error response Do not expose internal IPs on API error response while using debug logging Jan 4, 2022
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 4, 2022
@quaff
Copy link
Contributor

quaff commented Jan 5, 2022

I prefer to keep current behavior.

@alefq
Copy link

alefq commented Jan 6, 2022

I suggest you do not expose DEBUG level info with your outside clients.
If you only need debug level for specific scenarios, you can change log levels at runtime with Spring Boot Actuator.

@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jan 7, 2022
@rstoyanchev rstoyanchev added this to the Triage Queue milestone Jan 7, 2022
@rstoyanchev
Copy link
Contributor

Thanks for the report @psytester. I think we can make an improvement such that the logPrefix remains as it is currently, because it useful to log this at debug info, but the requestId should be more of an identifier and not include additional debugging info.

@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 11, 2022
@rstoyanchev rstoyanchev modified the milestones: Triage Queue, 5.3.15 Jan 11, 2022
@rstoyanchev rstoyanchev self-assigned this Jan 11, 2022
@rstoyanchev rstoyanchev changed the title Do not expose internal IPs on API error response while using debug logging WebFlux request id should not contain internal IPs Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants