8000 Link onclick generation is buggy & (delightfully) exploitable · Issue #5 · increpare/tinychoice · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Link onclick generation is buggy & (delightfully) exploitable #5
Open
@jeremyredhead

Description

@jeremyredhead

The link generation code is buggy, as the section title is escaped & placed inside of single quotes,
but the escapeHtmlEntities only escapes double quotes, not single quotes.

str+='<a href="#" pl-c1">+escapeHtmlEntities(l[1])+'\');return false;">'+escapeHtmlEntities(l[0])+'</a><br>';

Thus, one possibility is someone e.g. including an apostrophe in a section title,
and then being confused when the link to that section doesn't work.
Perhaps unlikely, but annoying.

Another possibility is exploiting this bugginess to inject arbitrary JavaScript as I have demonstrated with this very silly proof of concept.
Very unlikely (and not a real security concern AFAICT), but very amusing. :P

The fix should be as simple as adding a .replace(/'/g, '&apos;') to escapeHtmlEntities,
or swapping the quotes around in goTo a little:

// this would also work I think (tho i didn't actually test it...)
str+='<a href="#" 'goTo("'+escapeHtmlEntities(l[1])+'");return false;\'>'+escapeHtmlEntities(l[0])+'</a><br>';

That is, of course, if you fix this at all — maybe It's A Feature Not A Bug ^^

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

      0