Description
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/next-js-forked-slktwp
To Reproduce
When start my application, my header is visible in the browser. This is causing the below vulnerability issue
This application allows user-controlled URLs to be passed directly to HTTP client libraries. This can result in Server-Side Request Forgery (SSRF). SSRF refers to an attack where the attacker can abuse functionality on the server to force it to make requests to other internal systems within your infrastructure that are not directly exposed to the internet. This allows the attacker to access internal resources they do not have direct access to.\nSome risks of SSRF are:\n- Access and manipulation of internal databases, APIs, or administrative panels - Ability to scan internal network architecture and services - Can be used to pivot attacks into the internal network - Circumvent network segregation and firewall rules\nTo avoid this, try using hardcoded HTTP request calls or a whitelisting object to check whether the user input is trying to access allowed resources or not.\nHere is an example: var whitelist = [\n "https://example.com", \n "https://example.com/sample"\n]\napp.get('/ssrf/node-ssrf/axios/safe/3', function (req, res) {\n if(whitelist.includes(req.query.url)){\n axios.get(url, {})\n .then(function (response) {\n console.log(response);\n })\n .catch(function (response) {\n console.log(response); \n })\n }\n});
For more information on SSRF see OWASP: https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html\n
Current vs. Expected behavior
Current behavior: vulnerability scan failed because of injection of headers in the URL
Expected behavior: Vulnerability scan should pass
Provide environment information
Operating system :Windows 11
Binaries :
Node : 20.11.1
npm : 10.2.4
Yarn : 1.22.19
Relevant packages
next : 14.2.7
eslint-config-next : 14.1.0
react :18
react-dom:18
typescript : 5
Which area(s) are affected? (Select all that apply)
Instrumentation, Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), Other (Deployed)
Additional context
Getting critical issue for this