Submitted URLs validated and checked against spam domain blocklist
Why it matters
Accepting unvalidated URLs in a directory creates two distinct attack surfaces: phishing (a listing points visitors to a credential-harvesting domain) and open redirect abuse (your platform lends credibility to malicious links). CWE-601 (Open Redirect) and CWE-20 (Improper Input Validation) under OWASP A03 both cover this. A blocklist is not optional — URL format validation alone accepts https://known-phishing-domain.com without complaint.
Severity rationale
Critical because accepted phishing URLs appear on your platform under your domain's authority, directly exposing visitors to credential theft and malware.
Remediation
Validate URL structure with the native URL constructor, then check the hostname against a blocklist. Reject client-submitted strings that fail either check:
const BLOCKED_DOMAINS = new Set(['bit.ly', 'tinyurl.com', 't.co'])
// Augment from a maintained feed (e.g., PhishTank, URLhaus)
function validateUrl(raw: string): { ok: boolean; error?: string } {
let parsed: URL
try { parsed = new URL(raw) } catch {
return { ok: false, error: 'Invalid URL format' }
}
if (!['http:', 'https:'].includes(parsed.protocol)) {
return { ok: false, error: 'Only HTTP/HTTPS URLs accepted' }
}
if (BLOCKED_DOMAINS.has(parsed.hostname)) {
return { ok: false, error: 'This domain is not permitted' }
}
return { ok: true }
}
Run this in app/api/listings/submit/route.ts before persisting — never defer URL checks to the moderation queue.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the User Submissions & Moderation Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-20 — Improper Input Validation
- cwe · CWE-601 — URL Redirection to Untrusted Site (Open Redirect)
- owasp:2021 · A03 — Injection
Taxons
History
- 2026-04-18·v1.0.0·Initial import from directory-submissions-moderation·automated