CWE-918: Server-side request forgery (SSRF) | Codefreex Skip to content

Security weaknessCWE Top 25 · #22

CWE-918 Server-side request forgery (SSRF)

An attacker tricks your server into fetching addresses of their choosing, including systems only your server can reach.

  • Senior security engineers
  • 540+ projects delivered
  • Reply within one business day

Quick answer

What is CWE-918?

Server-Side Request Forgery: The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.

Business impact

What CWE-918 could cost your business

MITRE documents what this weakness can do. Here is what that means for a website, store or app.

Confidentiality

Private data exposed

Customer records, credentials, orders or internal files can be read by people who should never see them.

  • Read Application Data

Integrity

Data, pages or code changed

Prices, orders, content or the code your site runs can be altered without your approval.

  • Execute Unauthorized Code or Commands

Access Control

Accounts and admin areas exposed

Logins and permission checks can be bypassed, putting admin and customer accounts at risk.

  • Bypass Protection Mechanism

In plain English

What Server-side request forgery (SSRF) means for your business

  • 540+projects delivered
  • 9+years in business
  • 23+certified experts
Get a free security check

A senior engineer replies within one business day.

Many sites fetch things from other addresses on a user’s behalf. They import an image from a link, preview a web page, call a webhook or pull a product feed. Server-side request forgery, or SSRF, happens when the server makes that request without confirming the destination is one it should contact. The person supplying the address then decides where your server connects, not you.

This matters because your server sits inside your network and is trusted by systems the public cannot reach. A forged request can reach internal admin panels, databases or the cloud metadata service, which is an internal address that hands out access credentials to the server. The firewall does not help, because the request comes from inside. The result can be leaked data, stolen cloud keys or a path deeper into your systems.

Where it shows up

  • Features that import an image, avatar or file from a link the user pastes, such as profile pictures or product photos.
  • Link preview generators, PDF or screenshot services and website checkers that load whatever page address a visitor submits in a form.
  • Webhook settings and integration screens where users enter a callback address that your server later calls with no destination checks.
  • Product feed, RSS and XML importers in WordPress plugins or store apps that fetch remote files from addresses saved by any account holder.

Free security check

Is CWE-918 hiding in your site?

A senior engineer checks your site, store or app for this weakness and the rest of the CWE Top 25, then sends a prioritized fix plan within one business day. No obligation.

Official definition

How MITRE defines CWE-918

Server-Side Request Forgery

The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.

Also known as: XSPA, SSRF

Weakness ID
CWE-918
Type
Base
Status
Incomplete
Applies to
Web Based, AI/ML, Web Server
Introduced during
Architecture and Design, Implementation
2025 CWE Top 25
Rank 22

Fix it

How to fix Server-side request forgery (SSRF)

Practical steps in priority order. Share them with your developer or agency.

  1. Allowlist permitted destinations

    Where the set of valid targets is known, accept only those hostnames or domains and reject everything else. Better still, let users pick from predefined options instead of typing a full address.

  2. Block internal and reserved addresses

    When arbitrary addresses must be allowed, resolve the hostname first and refuse loopback, private, link-local and cloud metadata ranges. Connect to the address you validated, so a later DNS change cannot swap the destination.

  3. Restrict protocols and redirects

    Permit only HTTP and HTTPS on expected ports. Disable other URL schemes, such as file or FTP. Turn off automatic redirect following, or re-validate the destination on every redirect before continuing.

  4. Isolate the fetching service

    Run outbound fetches from a separate, low-privilege service or egress proxy with firewall rules that block internal networks. Segment the network so the web server cannot reach databases and admin tools it does not need.

  5. Harden metadata and response handling

    Turn on the stricter access mode your cloud provider offers for its metadata service, and give the server role minimal permissions. Do not return raw fetched responses or detailed fetch errors to the user.

Signs you may be affected

  • Your site accepts a full web address from users and the server fetches it.
  • Outbound traffic logs show your web server contacting internal addresses or unfamiliar hosts.
  • Your application server can reach databases, admin panels and cloud metadata with no outbound restrictions.

Questions to ask your developer

  • Which features make our server fetch an address supplied by a user?
  • Do we block requests to internal addresses and the cloud metadata service?
  • Can our web server reach internal systems it has no reason to contact?

Prevention

What MITRE recommends, phase by phase

Every mitigation from the CWE entry, in the order a project runs: plan, build, test, operate.

  1. 01

    Implementation

    • If there is a known list of applications, IP, hostname, and/or domains to which the product is allowed to communicate, then use allowlists to ensure that outgoing requests are restricted to these known entities. The allowlists could be in the application code or possibly enforced by firewalls or network segmentation [REF-1511].
    • If the product is expected to be able to connect to arbitrary IP addresses or domains, consider using a denylist that includes private network addresses, internal domain names, etc. The denylist could be in the application code or possibly enforced by firewalls or network segmentation [REF-1511].
    • Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of.

Detection and evidence

How CWE-918 is found, and where it has hit

The testing methods MITRE recommends, and real vulnerabilities this weakness has caused.

How it is detected

  • Automated Static AnalysisAutomated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then.

Real vulnerabilities it caused

  • CVE-2026-33626SSRF in LLM toolkit accesses arbitrary URLs for images, as exploited in the wild in April 2026 to conduct port scanning [REF-1519]
  • CVE-2024-3095SSRF in LLM application development framework because the URL retriever allows connections to local addresses using a crafted Location header
  • CVE-2023-32786Chain: LLM integration framework has prompt injection (CWE-1427) that allows an attacker to force the service to retrieve data from an arbitrary URL, essentially providing SSRF (CWE-918) and potentially injecting content.
  • CVE-2021-26855Server Side Request Forgery (SSRF) in mail server, as exploited in the wild per CISA KEV.
  • CVE-2021-21973Server Side Request Forgery in cloud platform, as exploited in the wild per CISA KEV.
  • CVE-2016-4029Chain: incorrect validation of intended decimal-based IP address format (CWE-1286) enables parsing of octal or hexadecimal formats (CWE-1389), allowing bypass of an SSRF protection mechanism (CWE-918).

How we fix it

From finding to fixed: how Codefreex closes CWE-918

  1. Scan and confirm

    We test your site, store or app for this weakness and the rest of the CWE Top 25 with automated scanning and manual review, and confirm what is actually exploitable.

  2. Fix at the source

    We change the code, configuration or dependency that causes it, not just the symptom, and plan the changes to avoid downtime.

  3. Verify the fix

    We retest every finding, check that nothing else broke and hand you a short report you can share with your team, client or auditor.

  4. Keep it fixed

    Updates, monitoring and maintenance so the weakness does not return with the next plugin, theme, app or code change.

FAQ

CWE-918: FAQs

Short answers for owners and developers. Not sure whether your site is affected? Ask us to check.

How serious is server-side request forgery?

It can be severe, especially on cloud hosting. A forged request may read internal services, and in the worst cases it exposes credentials that grant access to storage, databases or other cloud resources. The impact depends on what your server can reach. A server with tight outbound rules limits the damage; one with open internal access does not.

How do I prevent SSRF?

Avoid fetching user-supplied addresses where you can. Where you cannot, validate the destination against an allowlist, or block private and internal ranges after resolving the hostname. Limit protocols, handle redirects carefully and run fetches from an isolated service. Add network rules so that even a successful forged request has nowhere useful to go.

Does a firewall protect my site from SSRF?

A perimeter firewall alone does not, because it filters traffic coming in from outside. In an SSRF attack the request is sent by your own server, which is already inside the network and trusted. Protection comes from validating destinations in the application and from outbound, or egress, rules that restrict where the server itself may connect.

What is CWE-918?

CWE-918, “Server-Side Request Forgery”, is a software weakness catalogued by MITRE in the Common Weakness Enumeration. The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.

How serious is CWE-918?

It can affect confidentiality, integrity, access control, with impacts such as read application data, execute unauthorized code or commands, bypass protection mechanism. It ranks number 22 on the 2025 CWE Top 25 Most Dangerous Software Weaknesses. The real risk depends on where the weakness sits and what data or functions it exposes.

How do you prevent CWE-918?

If there is a known list of applications, IP, hostname, and/or domains to which the product is allowed to communicate, then use allowlists to ensure that outgoing requests are restricted to these known entities. The allowlists could be in the application code. If the product is expected to be able to connect to arbitrary IP addresses or domains, consider using a denylist that includes private network addresses, internal domain names, etc. The denylist could.

Can Codefreex check my site for CWE-918?

Yes. A senior engineer reviews your site, store or app for CWE-918 and the rest of the CWE Top 25, confirms what is exploitable and sends a prioritized fix plan within one business day. Start with the free security check form on this page.

Free security check

Find out if CWE-918 affects your site

Send your URL. A senior engineer checks for this weakness and the rest of the CWE Top 25, and replies within one business day with what to fix first.

  • A senior strategist reviews your request, not a sales bot
  • Clear scope, timeline and estimate within one business day
  • Free 30-minute discovery call, no obligation
  • NDA available on request

Weakness data from the Common Weakness Enumeration (CWE®) version 5.0, Copyright © 2006–2026, The MITRE Corporation. CWE is free to use by any organization or individual for any research, development, and/or commercial purposes under the CWE Terms of Use. CWE is a registered trademark of The MITRE Corporation. The business impact, risk profile and plain-English guidance on this page are written by Codefreex and are general information, not a security assessment of your system.