NULLMINDS
Nullminds Venture • Independent Products

Server-Side Request Forgery (SSRF) Prevention & Outbound Egress Relays

Application Security & Egress Infrastructure • 8 min read • Architectural Reference

Threat Model

When web services perform outbound HTTP requests (e.g. webhooks, scraping, third-party API proxies), attackers manipulate request parameters to target internal IP ranges (127.0.0.1, 10.0.0.0/8, 169.254.169.254). Without a dedicated relay boundary, cloud IAM tokens and internal microservices become vulnerable to immediate exfiltration.

Architectural Solution

Backfire introduces an isolated, hardened relay layer between your application code and external networks. Outbound requests are validated, DNS is resolved on a hardened boundary to prevent DNS rebinding, and private CIDR ranges are categorically rejected at the socket layer.

Hardened Implementation

// Node.js implementation using Backfire relay client
import { BackfireRelay } from '@nullminds/backfire';

const relay = new BackfireRelay({
  relayEndpoint: 'https://relay.internal.nullminds.me',
  blockPrivateCIDR: true, // Blocks RFC 1918 & 169.254.169.254 (Cloud metadata)
  enforceTimeoutMs: 3000,
});

export async function sendSecureWebhook(targetUrl: string, payload: unknown) {
  // Backfire inspects targetUrl, locks DNS resolution, and inspects egress headers
  const response = await relay.dispatch({
    url: targetUrl,
    method: 'POST',
    json: payload,
    headers: { 'User-Agent': 'Nullminds-SecureRelay/1.0' },
  });

  return response.data;
}

Architecture Comparison

Feature Backfire Smokescreen Squid Proxy
DNS Rebinding Protection Enforced at Socket Level Configurable Requires Complex ACLs
Cloud Metadata Isolation Zero-config Default Block Manual IP config Manual IP config
Deployment Footprint Single Binary / Edge Worker Go Daemon Heavy C++ Daemon
Telemetry & Audit Logs Structured JSON Outbound Logs Syslog Squid Access Log

Security FAQ

Why is application-level regex URL validation insufficient for SSRF protection?
Attackers bypass regex using DNS rebinding, hex-encoded IP addresses (0x7f000001), octal notations, IPv6 mapped IPv4, and 302 redirect smuggling. Real protection requires validating the resolved IP address immediately prior to socket connection.
How does Backfire prevent cloud metadata service theft (169.254.169.254)?
Backfire rejects the link-local 169.254.0.0/16 range unconditionally on both direct connection attempts and redirects.