Closed jdabtieu closed 3 years ago
I've also noticed other admin-facing fields aren't sanitised.
I've also noticed other admin-facing fields aren't sanitised.
Apart from the markdown ones, which other fields aren't sanitized?
See #38 and #39, but also the editing/creating problems interface. Of course, if they aren't messing around on purpose they shouldn't run into the errors.
Ah, ok. I classified them as markdown-enabled fields, since they are markdown-enabled.
Although admins won't be messing around, an attacker who phishes their way into an admin account can potentially cause a DOS by injecting code that automatically redirects users to some other website upon page load. For example, inserting this into announcements would deny access to the home page:
<script>window.location.href="http://attacker.url"</script>
The fields haven't been sanitized yet, but I just pushed a bug fix that should fix the problem in your screenshot where the Markdown was polluting the rest of the page
Fixed in 2ca19ff. While admins can XSS themselves on the create/edit pages (but why would anyone do that), the HTML code that finally gets generated is sanitized.
Is your feature request related to a problem? Please describe.
Related to #31 Poorly formatted Markdown can destroy the entire page, as seen in Anthony's screenshot. Javascript should be BANNED, otherwise someone can take down the site by simple injecting
window.location.href="http://attacker.url"
, which would redirect people to http://attacker.url when the script executesDescribe the solution you'd like
External library to sanitize all Markdown-converted text: https://github.com/cure53/DOMPurify Making our own is a terrible idea
Describe alternatives you've considered
No
Additional context
Cookies cannot be stolen as they have the HttpOnly attribute.
However, a phising attack on an admin would allow an attacker to inject harmful code that can cause a DOS, among other exploits.