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

XSS vulnerability #10

Open
augustozanellato opened this issue May 20, 2022 · 2 comments
Open

XSS vulnerability #10

augustozanellato opened this issue May 20, 2022 · 2 comments

Comments

@augustozanellato
Copy link

Hi!
Both this extension and firefox-fastread (which is based on this one) are vulnerable to XSS due to a mishandling of HTML entities, specifically the extension inject part of an element's .innerText in some HTML without encoding certain characters as entities, so for example if there's a &lt;script&gt; it becomes <script> after the extension processes the page.

See https://augustozanellato.github.io/FastReadXSS/poc.html for a PoC

@johnkershaw
Copy link
Contributor

Set 'fraction of word to bold' to 0.3 to see this PoC in action (otherwise the onerror splits between o and n):

  • 0 1 1 2 0.3

@Cveinnt
Copy link
Contributor

Cveinnt commented May 29, 2022

Would a hackish solution, such as

function purify(unsafe_str) {
      return unsafe_str
        .replace(/&/g, "&amp;")
        .replace(/</g, "&lt;")
        .replace(/>/g, "&gt;")
        .replace(/\"/g, "&quot;")
        .replace(/\'/g, "&#39;")
        .replace(/\//g, "&#x2F;");
    }

prevent XSS attack of this kind?

I tested this with the latest commit, and it seems to be a quick way around it.

ahrm added a commit that referenced this issue May 30, 2022
Added basic XSS prevention measures that addresses #10
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

3 participants