Advisory

GHSA-7723-35v7-qcxw

Details, part 2 of 2. The advisory

Details

Impact
Due to this issue, any user can cause the server to send GET requests with controlled path and port in an attempt to query services running on the instance’s host, and attempt to execute a Blind-SSRF gadget in hope of targeting a known vulnerable local service running on the victim’s machine.

Fix Suggestion
Modify the domain validation mechanism and implement the following checks:

  1. Resolve the domain and validate it is not using any invalid IP address (internal, or cloud metadata IPs) using regexes of both IPv4 and IPv6 addresses.

For Implementation example of a good SSRF prevention practice you can review a similiar project such as “Fedify” (https://github.com/dahlia/fedify/blob/main/src/runtime/url.ts) which handles external URL resource correctly.
Note that it is still needed to remove unwanted characters from the URL.

  1. Filter the user’s input for any unwanted characters that should not be present on a domain name, such as #,?,/, etc.
  2. Perform checks that make sure the desired request path is the executed path with the same port.
  3. Disable automatic HTTP redirect follows on the implemented client, as redirects can be used for security mechanisms circumvention.

Sources & licences