Skip to content
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

Mitigate XSS attacks #198

Open
rogeriocosta-mb opened this issue Jul 29, 2021 · 0 comments
Open

Mitigate XSS attacks #198

rogeriocosta-mb opened this issue Jul 29, 2021 · 0 comments

Comments

@rogeriocosta-mb
Copy link

rogeriocosta-mb commented Jul 29, 2021

I did notice that if I send a malicious payload on the query like: /search/query:%22ony=()%20onmouseover=prompt(document.location)%3E and query twig variable is printed on the page, it can be exploited, example:

<a href="/search/query:{{ query }}">Your search for {{ query}}</a> 

The anchor will be manipulated to add malicious javascript code. What about provide some extra security by use HTMLPutifier or htmLawed as an option to clean the query twig var?

Like this:

$twig->twig_vars['query']= htmLawed(implode(', ', $this->query), array('safe' =>1 ));

I did implement this on my side to mitigate a potencial XSS attack on the plugin since it is used site wide.

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant