Skip to content

Commit 9974c54

Browse files
committed
Remove false positive in JSON
1 parent d91de8c commit 9974c54

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

w3af/plugins/audit/xss.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,17 @@ def _identify_trivial_xss(self, mutant):
124124
# Add data for the persistent xss checking
125125
if self._check_persistent_xss:
126126
self._xss_mutants.append((trivial_mutant, response.id))
127-
127+
128+
# This is something I've seen in as a false positive during my
129+
# assessments and is better explained in this stackoverflow question
130+
# https://goo.gl/BgXVJY
131+
ct_options, _ = response.get_headers().iget('X-Content-Type-Options')
132+
content_type, _ = response.get_headers().iget('Content-Type')
133+
134+
if content_type == 'application/json' and ct_options == 'nosniff':
135+
# No luck exploiting this JSON XSS
136+
return False
137+
128138
if payload in response.get_body().lower():
129139
self._report_vuln(mutant, response, payload)
130140
return True

0 commit comments

Comments
 (0)