Closed pkschweiger closed 3 years ago
Thanks for the report. I added a check function "testImage" to validate clientside https://github.com/cracker0dks/whiteboard/commit/5b57f134c6a63f94d0c9daccdc6b936fa148173b.
function testImage(url, callback, timeout) {
timeout = timeout || 5000;
var timedOut = false,
timer;
var img = new Image();
img.onerror = img.onabort = function () {
if (!timedOut) {
clearTimeout(timer);
callback(false);
}
};
img.onload = function () {
if (!timedOut) {
clearTimeout(timer);
callback(true);
}
};
img.src = url;
timer = setTimeout(function () {
timedOut = true;
// reset .src to invalid URL so it stops previous
// loading, but doesn't trigger new load
img.src = "//!!!!/test.jpg";
callback(false);
}, timeout);
}
You think this is sufficient?
Clever. I would have focused on the attribute injection myself. Believe you'll want a combination end. As it stands one could just move the exploit to the tuple and suffer from the string concatenation there:
socket.emit("drawToWhiteboard", {
"t": "addImgBG",
"d": [EXPLOIT,100,200,200]
});
The following is shooting from the hip, at a feature we knew we would disable from day 1, while sprinting to another project š¼. I didn't try to combine it with your preload - or so much as build it. The idea is:
url
src
attributeNaN(px|rad)
dimensions are better than XSS0001-Prevent-img-attribute-injection.patch.gz
I'm sending patches over creating PRs because I don't want to impose on your project with different paradigms. They're meant to pinpoint sore spots with some ideas not serve as prescriptive solutions. Wish I could offer more of my time. Thank you for yours! šāāļø
lol totally forgot about this one, sry. Merged it now. Thanks a lot!
similar to #110 - when driving socket directly using browser tools or script malicious
url
eventually embedded here or hereNo image support needed in our use case and are pretty swamped - so we just chuck
addImgBG
events both server and client side for the time being.