All skills
sergiodxa avatar

/owasp-security-check

@40e21b4

Security audit guidelines for web applications and REST APIs based on OWASP Top 10 and web security best practices. Use when checking code for vulnerabilities, reviewing auth/authz, auditing APIs, or before production deployment.

Use this Skill: https://skilld.dev/gh/sergiodxa/agent-skills/owasp-security-check

This session only. Nothing lands on disk.

rulesssrf-attacks.md

≈678 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Server-Side Request Forgery (SSRF)

Check for unvalidated URLs that allow attackers to make requests to internal services or arbitrary external URLs.

Related: URL validation in redirects is covered in redirect-validation.md.

Why

  • Internal network access: Attackers reach internal services
  • Cloud metadata exposure: Access to AWS/GCP metadata endpoints
  • Port scanning: Map internal network
  • Bypass firewall: Access protected resources

What to Check

Vulnerability Indicators:

  • User-provided URLs passed to fetch/axios without validation
  • No allowlist for allowed domains
  • Missing checks for internal IP ranges
  • Webhook URLs not validated
  • URL redirects followed automatically

Bad Patterns

// Bad: Fetching user-provided URL
async function fetchUrl(req: Request): Promise<Response> {
  let { url } = await req.json();

  // SSRF: Can access internal services!
  let response = await fetch(url);
  let data = await response.text();

  return new Response(data);
}

// Bad: No validation on webhook URL
async function registerWebhook(req: Request): Promise<Response> {
  let { webhookUrl } = await req.json();

  await db.webhook.create({
    data: { url: webhookUrl },
  });

  // Later: fetch(webhookUrl) - could be internal
}

Good Patterns

// Good: Validate against allowlist
const ALLOWED_DOMAINS = ["api.example.com", "cdn.example.com"];

async function fetchUrl(req: Request): Promise<Response> {
  let { url } = await req.json();
  let parsedUrl = new URL(url);

  if (parsedUrl.protocol !== "https:") {
    return new Response("Only HTTPS allowed", { status: 400 });
  }

  if (!ALLOWED_DOMAINS.includes(parsedUrl.hostname)) {
    return new Response("Domain not allowed", { status: 400 });
  }

  if (isInternalIP(parsedUrl.hostname)) {
    return new Response("Internal IPs not allowed", { status: 400 });
  }

  let response = await fetch(url, { redirect: "manual" });
  return new Response(await response.text());
}

function isInternalIP(hostname: string): boolean {
  return [
    /^127\./,
    /^10\./,
    /^172\.(1[6-9]|2[0-9]|3[0-1])\./,
    /^192\.168\./,
    /^169\.254\./,
    /^localhost$/i,
  ].some((range) => range.test(hostname));
}

Rules

  1. Validate URLs against allowlist - Never trust user URLs
  2. Block internal IP ranges - 127.0.0.1, 10.x, 192.168.x, etc.
  3. Enforce HTTPS - No HTTP or other protocols
  4. Disable redirects - Or validate redirect targets
  5. Block cloud metadata - 169.254.169.254 (AWS/GCP/Azure)

Source: SKILL.md on GitHub

2 warnings15d5 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    The skill is a comprehensive security audit guide based on OWASP standards. It provides examples of vulnerable and secure code patterns for pedagogical use. The only identified risk is the inherent surface for indirect prompt injection when the agent processes untrusted user-provided code, although the skill lacks dangerous autonomous capabilities.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

  • Runlayer7mo

    21/21 files flagged

  • ZeroLeaks5mo

    3 findings · Score: 69/100

Signed by skilld at 40e21b4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago

README badge

README badge for sergiodxa/agent-skills/owasp-security-check