Closed loadletter closed 10 years ago
this must be a regression, I have seen people try this and it not working. I guess as a rule all user input should be sanitized server-side before sending updates to clients
I've seen these attempts fail before too, but looks like they work now
I think user submitted usernames might be getting passed straight through at https://github.com/emoose/openhotel/blob/master/app.js#L784
Perhaps running usernames (and other user submitted strings) through something like
function escapeString(s)
{
// Quotes
return s.replace(/\"/g, '"')
.replace(/\'/g, ''')
.replace(/\`/g, '`')
// Symbols
.replace(/\&/g, '&')
.replace(/\,/g, ',')
.replace(/\;/g, ';')
.replace(/\^/g, '^')
.replace(/\*/g, '*')
.replace(/\!/g, '!')
.replace(/\?/g, '?')
.replace(/\@/g, '@')
.replace(/\$/g, '$')
.replace(/\%/g, '%')
.replace(/\=/g, '=')
.replace(/\+/g, '+')
.replace(/\-/g, '-')
.replace(/\\/g, '\')
.replace(/\//g, '/')
.replace(/\|/g, '|')
.replace(/\ /g, ' ') // Space character
// Brackets
.replace(/\</g, '<')
.replace(/\>/g, '>')
.replace(/\{/g, '{')
.replace(/\}/g, '}')
.replace(/\[/g, '[')
.replace(/\]/g, ']')
.replace(/\(/g, '(')
.replace(/\)/g, ')');
}
could do the trick? (might want to double check everything, I think I got the escape codes correct)
I recall before that user strings used to be whitelisted to only alphanumerics, not sure what happened to that.
87dc73cb4d11275c87d8bf608ac0ab2ee8278aef seems to have fixed it
Yeah it seems fixed for now, not sure if the way we're doing it is the best though, I'm sure I had problems with it before...
Well I'll close this since the vuln mentioned in OP is fixed, if anyone spots any other XSS problems just make a new issue
Putting
in the namefield causes it to be executed