getgrav / getgrav/grav-plugin-simplesearch
Mitigate XSS attacks
- Dominant language
- PHP
- Stars
- 46
- Forks
- 55
- Avg merge
- 5h 44m
- Merged PRs (30d)
- 1
Description
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:
```
Your search for {{ query}}
```
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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.