Reverse proxy bypass techniques
1. The %2f bypass technique
%2f bypass techniqueThe string %2f translates to a slash character (/) when interpreted as an URL-encoded string. It presents a classic path normalization attack, which exploits the way different layers of a web stack (eg. reverse proxy and backend server) interprets the same URL.
Case study
Without bypass
Request
Response:
This is likely because the reverse proxy sees
swagger-init.js, either recognises it as a matched sensitive file, or sees the trailing.jsextensionAutomatically redirects to a route that serves a static file (
index.html)
With bypass
Request
Response:
The reverse proxy sees the value
swagger-init.js%2f, and interprets it as a plain string valueSince it does not match any known sensitive
.jsfiles, it passes it on to the API backend serverThe backend server URL-decodes:
/api/services/swagger-ui/swagger-init.js%2f->/api/services/swagger-ui/swagger-init.js//api/services/swagger-ui/swagger-init.js/does not exist as a directory -> returns the static file instead:/api/services/swagger-ui/swagger-init.js
Hence, we have managed to bypass the reverse proxy security verifications
Summary
Feature
Normal request
%2f bypass request
Status code
301/302 (redirect)
200 OK
Source of file
Frontend static server
API backend server (not sanitized)
Security risk
Minimal (public accessible files)
High (potentially protected files)
Further enumeration
-
Eg. Test for path traversal (%2f..%2f)
Last updated