Skip to content

Server-side request forgery (SSRF) via Playwright

Description

If unverified user data can reach the `playwright` methods it can result in Server-Side Request Forgery vulnerabilities.

Examples

Insecure Code

javascript
const playwright = require('playwright');
const url = req.query.url;
const browser = await playwright.chromium.launch();
const page = await browser.newPage();
await page.goto(url);

Secure Code

javascript
const playwright = require('playwright');
const url = req.query.url;
if (validateUrl(url)) {
  const browser = await playwright.chromium.launch();
  const page = await browser.newPage();
  await page.goto(url);
} else {
  // Handle invalid URL
}

Remediation

Validate and sanitize user input before passing it to Playwright methods.

Rule Details

FieldValue
IDCODE-0412
CategoryInjection
SeverityCRITICAL
CWECWE-918
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
TagsSSRF, Server-side request forgery
OWASPA1:2017-Injection, A03:2021-Injection