Closed jhonnymoreira closed 7 years ago
I would be glad to help on the issue and send a patch to solve this problem. While reviewing the code I saw a piece of code that I'm almost sure is causing the security breach:
// /src/scripts/cf/ui/UserInputs.ts
// Lines: 102 to 104
public getInputValue():string{
return this.inputElement.value;
}
const poc = value => value;
poc( (() => { console.log('XSS Vulnerability' })() );
@jhonnymoreira nice! You are more than welcome to make a PR with a fix.
Hey, @felixnielsen, today I wasnt able to work on the patch, tomorrow I'll have a free time to fix this, ok?
Thanks @jhonnymoreira just ping me if any questions.
Description
The image below shows the result when trying to execute some code through the input. The message was:
<img src="x" onerror="alert('XSS Vulnerability')">
. Since there isn't an image with name 'x', it causes to trigger theonerror
function, which means the input value isn't getting sanitized and it is opening a security breach.How to solve?
Whenever dealing with user input, sanitize the input with a
safeString
method, otherwise, the vulnerability will persist.How to simulate the problem
<img src="x" onerror="document.location = 'https://twitter.com'">