<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: preventing-server-side-request-forgery
description: >-
  Implement SSRF protections including URL validation, allowlisting, and network-level controls for outbound requests.
domain: cybersecurity
subdomain: secure-coding
tags:
  - ssrf
  - url-validation
  - allowlisting
  - outbound-requests
  - server-side
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1090"]
  cwe: ["CWE-918"]
  tools: ["semgrep", "burpsuite", "ssrf-sheriff"]
---

# Preventing Server Side Request Forgery

## Overview

Implement SSRF protections including URL validation, allowlisting, and network-level controls for outbound requests.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `semgrep` | Security tooling |
| `burpsuite` | Security tooling |
| `ssrf-sheriff` | Security tooling |
| Isolated lab environment for testing | Environment requirement |
| Authorization and signed Rules of Engagement (RoE) | Environment requirement |
| Relevant target samples or systems acquired through authorized channels | Environment requirement |

## Quick Reference

```bash
# Initialize working environment
mkdir -p /tmp/preventing-server-side-request-forgery/{output,logs,artifacts}

# Execute primary analysis with semgrep
echo "[*] Running Preventing Server Side Request Forgery with semgrep..."

# Validate results with burpsuite
echo "[*] Cross-validating with burpsuite..."

# Generate summary report
cat /tmp/preventing-server-side-request-forgery/output/report.json
```

## Workflow

### Step 1: Preparation and Reconnaissance

```bash
# Identify target and gather initial intelligence
file ./target_sample
semgrep --version 2>/dev/null || echo "Install semgrep"

# Set up working directory
mkdir -p /tmp/preventing-server-side-request-forgery/{output,logs,artifacts}
```

### Step 2: Primary Analysis

```bash
# Execute primary analysis with semgrep
# Refer to Quick Reference above for detailed commands
echo "[*] Running Preventing Server Side Request Forgery with semgrep..."

# Log all operations
script -q /tmp/preventing-server-side-request-forgery/logs/session.log
```

### Step 3: Deep Investigation

```bash
# Apply burpsuite for secondary analysis
echo "[*] Deep investigation with burpsuite..."

# Cross-reference findings
diff /tmp/preventing-server-side-request-forgery/output/primary.json /tmp/preventing-server-side-request-forgery/output/secondary.json
```

### Step 4: Documentation and Reporting

```bash
# Generate structured findings report
cat <<'EOF' > /tmp/preventing-server-side-request-forgery/output/report.json
{
  "technique": "preventing-server-side-request-forgery",
  "domain": "secure-coding",
  "tools_used": ["semgrep", "burpsuite"],
  "findings": [],
  "recommendations": []
}
EOF
```

## Detection

```yaml
title: Preventing Server Side Request Forgery Detection
id: 1b491363-54b3-4114-9873-4396bc78f0c5
status: experimental
description: Detects suspicious activity related to preventing server side request forgery techniques in secure coding context
logsource:
  category: application
  product: webserver
detection:
  selection:
    EventType: error
  condition: selection
level: medium
tags:
  - attack.t1090
  - attack.initial_access
falsepositives:
  - Static analysis tools scanning source code repositories
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| Preventing Server Side Request Forgery Detection | webserver/application | Sigma rule (medium) |
| ATT&CK Coverage | MITRE ATT&CK | T1090 |

## Verification

- [ ] Environment and tools verified and operational
- [ ] Target samples acquired through authorized channels
- [ ] Primary analysis completed with findings documented
- [ ] Secondary validation performed with independent tooling
- [ ] All artifacts preserved in structured output directory
- [ ] Detection opportunities documented for blue team

## References

- [MITRE ATT&CK T1090](https://attack.mitre.org/techniques/T1090) — Related technique
- [semgrep Documentation](https://semgrep.org/) — Primary tooling
- [burpsuite Reference](https://burpsuite.org/) — Secondary tooling
