Skip to content

Commit

Permalink
Merge pull request #225 from aman566/patch-9
Browse files Browse the repository at this point in the history
Improved X-XSS-Protection header codebase
  • Loading branch information
Ali Razmjoo committed Mar 16, 2020
2 parents ff0897a + 3b50710 commit 4fd34a5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/vuln/XSS_protection/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def conn(targ, port, timeout_sec, socks_proxy):

def xss_protection(target, port, timeout_sec, log_in_file, language, time_sleep,
thread_tmp_filename, socks_proxy, scan_id, scan_cmd):
regex = '1; report='+'https?:\/\/(www\.)?[-a-zA-Z0-9]{1,256}\.[-a-zA-Z0-9]{1,6}'
try:
s = conn(target, port, timeout_sec, socks_proxy)
if not s:
Expand All @@ -73,6 +74,10 @@ def xss_protection(target, port, timeout_sec, log_in_file, language, time_sleep,
try:
if req.headers['X-XSS-Protection'] == '1; mode=block':
return False
elif req.header['X-XSS-Protection'] == '1':
return False
elif re.match(regex, req.header['X-XSS-Protection']):
return False
else:
return True
except:
Expand Down

0 comments on commit 4fd34a5

Please sign in to comment.