Skip to content

Custom Link Names Can Be Used To Inject HTML #15

@Gido-T

Description

@Gido-T

Preface:
I don't think that this is too big of a problem it's just something that I noticed and just felt that there was a better way of doing this.

How to reproduce:

  1. Go to settings of Canvas+
  2. Add a custom link by pressing new.
  3. In the name type your HTML
    Examples:
    1. <h 1>foobar</h 1>
    2. <img src=x onerror=alert('Injected!')>
  4. Now the course should have a link which uses the HTML as the name.

What I think is the cause of the problem:
My guess on why this happens is that on line 21 of ./js/custom-link.js, the name for the link is set using innerHTML instead of using textContent. Here's an article from GeeksForGeeks which helped explain to me the difference https://www.geeksforgeeks.org/why-is-it-better-to-use-textcontent-instead-of-innerhtml/. There is some HTML before injecting the link name though so maybe just inject it as textContent after that line?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions