This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📊 Metadata *
Fixed Cross-site scripting vulnerability
Bounty URL: https://www.huntr.dev/bounties/1-npm-hexo-admin
⚙️ Description *
A Cross-site scripting vulnerability exists on
hexo-admin
plugin's create-post functionality.Issue: jaredly#185
Since the code uses the user-input data without any sanitizing, users could inject javascript code to perform XSS. Hence validating the user-input could resolve the issue.
💻 Technical Description *
I used the DOM-Purify library to escape the unsanitized code. The fix for a different functionality was already implemented on the same package (#1). This fix is an extension to it.
🐛 Proof of Concept (PoC) *
Open http://localhost:4000/admin/, click on create new post and provide this payload:
"><img src=x onerror=alert("XSS")>
PoC from issue: https://github.com/jaredly/hexo-admin/files/3077011/PLUGIN.Hexo-admin-XSS-PoC.zip
🔥 Proof of Fix (PoF) *
the input will be sanitized after passing through DOMPurity function, and no XSS will be triggered.