Skip to content

Commit

Permalink
[http_splitting] Better reason message
Browse files Browse the repository at this point in the history
  • Loading branch information
buglloc committed Oct 10, 2017
1 parent ddd232a commit 05d4915
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions gixy/plugins/http_splitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class http_splitting(Plugin):

summary = 'Possible HTTP-Splitting vulnerability.'
severity = gixy.severity.HIGH
description = 'Using variables that can contain "\\n" may lead to http injection.'
description = 'Using variables that can contain "\\n" or "\\r" may lead to http injection.'
help_url = 'https://github.com/yandex/gixy/blob/master/docs/en/plugins/httpsplitting.md'
directives = ['rewrite', 'return', 'add_header', 'proxy_set_header', 'proxy_pass']

Expand All @@ -29,9 +29,14 @@ def audit(self, directive):
return

for var in compile_script(value):
if not var.can_contain('\n') and not var.can_contain('\r'):
char = ''
if var.can_contain('\n'):
char = '\\n'
elif var.can_contain('\r'):
char = '\\r'
else:
continue
reason = 'At least variable "${var}" can contain "\\n"'.format(var=var.name)
reason = 'At least variable "${var}" can contain "{char}"'.format(var=var.name, char=char)
self.add_issue(directive=[directive] + var.providers, reason=reason)


Expand Down

0 comments on commit 05d4915

Please sign in to comment.