fix: escape HTML output in scan result views (stored XSS) - #2027
Open
TrueFurina wants to merge 1 commit into
Open
fix: escape HTML output in scan result views (stored XSS)#2027TrueFurina wants to merge 1 commit into
TrueFurina wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Stored XSS (fix #2012): OSINT-collected data is rendered into
innerHTMLwithout escaping across all scan result views in
scaninfo.tmpl:browseEventData()event table —data[i][1]/data[i][2]viasf.replace_sfurltag(), plusdata[i][0]/data[i][3]/data[i][8]viewScanLog()—data[i][0..3](log lines can contain collected data)browseEventList()—data[i][1]as link textbrowseCorrelations()/toggleCorrelation()— correlation titles,tooltips, event data
browseEventDataunique mode) —data[i][0]/data[i][2]sf.replace_sfurltag()only converts<sfurl>markers; it does not escapeHTML, so
<script>/<img onerror=...>collected from a scanned targetexecute in the SpiderFoot web UI context.
Fix
sf.escapeHtml()(escapes& < > " ') tospiderfoot/static/js/spiderfoot.js.scaninfo.tmpl(23 calls)with
sf.escapeHtml(...); wheresfurllinks are intended, apply escapefirst, then
sf.replace_sfurltag(...)so links still render (theescaped
<sfurl>marker is handled by its existing first branch).(
id='cb_...',corrwell_tr_...) and theescape()-encoded value insidethe
onClickstring inbrowseEventList.Verification
node --check spiderfoot/static/js/spiderfoot.js→ OK<script>alert(1)</script>,"><img src=x onerror=alert(1)>,';alert(1);//,<b>bold</b>,normal & "quotes"→ all escaped;<sfurl>https://evil.example/p?a=1&b=2</sfurl>→ still renders as a linkgrepaudit: no baredata[i]concatenation remains inscaninfo.tmpl(only numeric id/attribute usages)
Files changed
spiderfoot/static/js/spiderfoot.js(+8:sf.escapeHtml)spiderfoot/templates/scaninfo.tmpl(all OSINT-data render points escaped)Fixes #2012