Attacking Secondary Context
Secondary Context in Web Applications
Secondary context refers to the different ways a web application can handle and process requests indirectly related to the main content. This often involves proxies, back-end servers, and intermediate services that might introduce additional security risks.
Identify Some " Hidden " Reverse HTTP Proxies
The heuristic rules used are the following :
A
502status code is returned (RFC 2616, section 14.31)A
483status code is returned (RFC 3261, section 8.1.1.6)When using TRACE, the body contains the '
X-Forwarded-For' string'
Via' or 'X-Via' headers are detectedSome fields are different between hops :
HTTP status codes
'
Server' headers'
Content-Type' headers'
Via' headersHTML titles
HTML '
address' tags'
X-Forwarded-For' values in body
Using HTTP-Traceroute.py tool.
Identify Routing Of HTTP Request
Does
/Endpoint-To-Proxy/../Return Something Different Than/Does
/Endpoint-To-Proxy/../Return Headers Different Than/Try To Inject Encode , Double OR Triple URL Encoding In Parameters
e.g. https://www.company.com/api/path?id=%23
#
%23
?
%3F
&
%26
/
%2F
@
%40
Try To Inject Encode , Double OR Triple URL Encoding These Payloads After URL
..%2f%23..;/..%00/..%0d/..%5c..\..%ff/%2e%2e%2f.%2e/
e.g. https://www.company.com/api/..%00/
Using OPTIONS Method for endpoint discovery
Using
OPTIONSMethod to identify other endpoints
Check PUT Method
Try To Change Request Method To
PUTIf You Got201 CreatedThen There IsRCE
Try To Append
.jsonExtension To Your Endpointse.g. /endpoint-To-Proxy.jsonTo Get Sensitive Information -> Tweet
Smuggling via HTTP/2 Cleartext
Try To Figure Out Are There Endpoints Accept Establishing HTTP/2 Cleartext , If Yes Try To Smuggler It By Using Tool e.g. h2csmuggler
Smuggling WebSockets
Smuggler Websocket Endpoints
XSS
XSS in Referrer
If There Is Nginx As Reverse Proxy Try To Inject Blind XSS Payloads
Try To Inject XSS Payloads After Your Endpoints
Host Header Injection
Try To Change Routing Of The Request To Get SSRF
Blind XSS or Time-Based SQLi in X-Forwarded-For header
Blind XSS or QLI in User Agent
RCE in User Agent
Double Content-Type Header
Invalid Content-Type Header
Inject l5d-dtab Header
If There Is Linkerd Service Try To
Inject l5d-dtabHeadere.g. l5d-dtab: /$/inet/169.254.169.254/80To GetAWS metadata
Content-Length Header With Number And There Is Not Body Content To Expose Internal Information
Cache Poisoning and DOS
LFI
If There Is Nginx As Reverse Proxy AND Weblogic As Backend Try To Use /#/../ To Change Route Of Endpoints
RCE
Try To Change Method To POST And Add Body e.g. To Get RCE
RCE in Content-Type Header
SSTI
SQLi
CRLF
Paameter Manipulation
Assume Backend Endpoint Take Value Of One Parameter As Path So Inject Encode , Double OR Triple URL Encoding ;@me.com , @me.com OR :@me.com To Get SSRF
Assume Backend Endpoint Take Value Of One Parameter As Rewrite Configuration e.g.
rewrite ^.*$ $arg_parameter;So Inject e.g. LFI Payloads To Get e.g.LFI
RCE
SQL Injection
Blind XSS
XXE
If Body Of Request JSON Data , Try To Convert It XML With XXE Payloads
RealWorld Examples

References
Last updated
Was this helpful?