Universal Content Spoofing Payloads ✨ ❤️
This repository contains high-impact payloads designed to demonstrate critical severity in Content Spoofing and URL Redirection vulnerabilities. It provides a standardized method for validating security controls in web applications that handle external resources.
CWE-601: URL Redirection to Untrusted Site CWE-1021: Improper Restriction of Rendered UI Layers or Frames
The vulnerability typically occurs when a web application accepts a URL parameter to load a resource (such as a PDF, image, or frame) but fails to validate the origin of that resource against a strict allowlist.
In many PDF viewing libraries (like PDF.js) or custom file handlers, developers often implement a simple fetch mechanism without origin checks:
// VULNERABLE CODE
function loadDocument() {
const urlParams = new URLSearchParams(window.location.search);
const fileUrl = urlParams.get('file');
// DANGEROUS: No validation of the 'file' origin
if (fileUrl) {
document.getElementById('viewer').src = fileUrl;
}
}When exploited, this vulnerability allows attackers to:
- Spoof Trusted Domains: Render malicious content within the context of the trusted domain.
- Bypass Phishing Filters: Leverage the reputation of the legitimate domain to evade email security gateways.
- Execute Social Engineering: Present counterfeit legal or security documents that appear to originate from the target organization.
To mitigate this vulnerability, implement strict input validation using an allowlist of trusted origins.
// SECURE CODE
function loadDocument() {
const urlParams = new URLSearchParams(window.location.search);
const fileUrl = urlParams.get('file');
// 1. Define trusted domains
const trustedOrigins = [
'https://trusted.example.com',
'https://example.com'
];
if (fileUrl) {
try {
const url = new URL(fileUrl);
// 2. Validate Origin
if (!trustedOrigins.includes(url.origin)) {
throw new Error('Untrusted Origin Detected');
}
// 3. Load only if validated
document.getElementById('viewer').src = fileUrl;
} catch (e) {
console.error('Security Violation:', e.message);
// Handle error (e.g., show generic error page)
}
}
}Simulates a Federal Law Enforcement domain seizure. URL:
https://raw.githubusercontent.com/MuhammadWaseem29/universal-content-spoof-poc/master/payloads/domain-seized.pdf
Simulates a cryptographic ransomware attack. URL:
https://raw.githubusercontent.com/MuhammadWaseem29/universal-content-spoof-poc/master/payloads/ransomware-note.pdf
Simulates a critical system compromise and data leak. URL:
https://raw.githubusercontent.com/MuhammadWaseem29/universal-content-spoof-poc/master/payloads/data-breach-alert.pdf
Construct the exploitation URL by appending the payload to the vulnerable parameter:
https://redacted.com/web/viewer.html?file=[PAYLOAD_URL]
Security Researcher GitHub: @MuhammadWaseem29
This project is licensed under the MIT License. For Educational and Authorized Security Testing Only.
https://github.com/mozilla/pdf.jshttps://groups.google.com/g/mozilla.dev.pdf-js/c/_WdU9T0TRfohttps://github.com/mozilla/pdf.js/issues/6920https://mozilla.github.io/pdf.js/
✨ ❤️