Skip to content

Commit eaadb14

Browse files
committed
issue2550925 strip HTTP_PROXY environment variable
if deployed as CGI and client sends an http PROXY header, the tainted HTTP_PROXY environment variable is created. It can affect calls using requests package or curl. A roundup admin would have to write detectors/extensions that use these mechanisms. Not exploitable in default config. See: https://httpoxy.org/
1 parent fa90a5c commit eaadb14

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ Fixed:
186186
by John Rouillard.
187187
- issue2551066: IMAP mail handling wasn't working and produced a
188188
traceback.
189+
- issue2550925 if deployed as CGI and client sends an http PROXY
190+
header, the tainted HTTP_PROXY environment variable is created. It
191+
can affect calls using requests package or curl. A roundup admin
192+
would have to write detectors/extensions that use these mechanisms.
193+
Not exploitable in default config. (John Rouillard)
194+
189195

190196
2018-07-13 1.6.0
191197

roundup/cgi/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,14 @@ def setTranslator(self, translator=None):
466466
def main(self):
467467
""" Wrap the real main in a try/finally so we always close off the db.
468468
"""
469+
470+
# strip HTTP_PROXY issue2550925 in case
471+
# PROXY header is set.
472+
if 'HTTP_PROXY' in self.env:
473+
del(self.env['HTTP_PROXY'])
474+
if 'HTTP_PROXY' in os.environ:
475+
del(os.environ['HTTP_PROXY'])
476+
469477
xmlrpc_enabled = self.instance.config.WEB_ENABLE_XMLRPC
470478
rest_enabled = self.instance.config.WEB_ENABLE_REST
471479
try:

test/test_cgi.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,18 @@ def testXMLTemplate(self):
830830
out = pt.render(cl, 'issue', MockNull())
831831
self.assertEqual(out, '<?xml version="1.0" encoding="UTF-8"?><feed\n xmlns="http://www.w3.org/2005/Atom"/>\n')
832832

833+
def testHttpProxyStrip(self):
834+
os.environ['HTTP_PROXY'] = 'http://bad.news/here/'
835+
cl = self.setupClient({ }, 'issue',
836+
env_addon = {'HTTP_PROXY': 'http://bad.news/here/'})
837+
out = []
838+
def wh(s):
839+
out.append(s)
840+
cl.write_html = wh
841+
cl.main()
842+
self.assertFalse('HTTP_PROXY' in cl.env)
843+
self.assertFalse('HTTP_PROXY' in os.environ)
844+
833845
def testCsrfProtection(self):
834846
# need to set SENDMAILDEBUG to prevent
835847
# downstream issue when email is sent on successful

0 commit comments

Comments
 (0)