Security Operations

A web app fetches a user-supplied URL to build image previews. A tester shows it can be made to return data from the cloud metadata service at a link-local address. Which control best mitigates this?

Show the answer

Correct answerD. Enforce an allow list of permitted destinations for server-side fetches

AWhy not this: Output encoding prevents script injection in displayed content; it does not stop the server fetching internal data.

BWhy not this: Client-side checks are bypassed by sending requests directly to the server.

CWhy not this: CSRF tokens address forged browser requests; they do not limit where the server sends its own requests.

DWhy this is right: Restricting destinations stops the server being used as a proxy to internal and metadata addresses.

This is server-side request forgery: the server fetches attacker-chosen destinations, including internal ones. An allow list of permitted destinations, with link-local and internal ranges denied, removes that reach. Client-side validation fails because the attacker controls the request sent to the server.