Uncontrolled external site redirect - Host Header Injection
Description
The server processes requests with the Host header set and redirects clients to any destination.
Impact
- Enumerate the internal network via trial and error.
- Perform a subset of Server Side Request Forgery attacks.
Recommendation
Configure server to prevent third party hosts redirection.
Threat
Unauthorized attacker from internet network.
Expected Remediation Time
⌚ 10 minutes.
Score
Default score using CVSS 3.1. It may change depending on the context of the vulnerability.
Base
- Attack vector: A
- Attack complexity: H
- Privileges required: L
- User interaction: R
- Scope: U
- Confidentiality: N
- Integrity: L
- Availability: N
Temporal
- Exploit code madurity: X
- Remediation level: U
- Report confidence: C
Result
- Vector string: CVSS:3.1/AV:A/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:N/E:X/RL:U/RC:C
- Score:
- Base: 2.3
- Temporal: 2.3
- Severity:
- Base: Low
- Temporal: Low
Code Examples
Compliant code
The server should validate and prevent third party redirections. For example, by setting the correct http headers
GET http://localhost/
Validate HOST from ALLOWED_HOSTS
Non compliant code
The server is wrongly configured to accept requests redirecting to other host
router.post("/", function (req, res, next) {
...code to handle the response not shown
//UNSAFE: Redirecting users to third party website
res.redirect("www.vulnerablehost.com")
});
module.exports = router;
Requirements
Search for vulnerabilities in your apps for free with our automated security testing! Start your 21-day free trial and discover the benefits of our Continuous Hacking Machine Plan. If you prefer a full service that includes the expertise of our ethical hackers, don't hesitate to contact us for our Continuous Hacking Squad Plan.