CVE-2021-21354 (published 2021-03-08T19:15Z)

Pollbot is open source software which "frees its human masters from the toilsome task of polling for the state of things during the Firefox release process." In Pollbot before version 1.4.4 there is an open redirection vulnerability in the path of "https://pollbot.services.mozilla.com/". An attacker can redirect anyone to malicious sites. To Reproduce type in this URL: "https://pollbot.services.mozilla.com//evil.com/". Affected versions will redirect to that website when you inject a payload like "//evil.com/". This is fixed in version 1.4.4.

Severity: MEDIUM
CVSS v2 base score: 5.8 (AV:N/AC:M/Au:N/C:P/I:P/A:N)
CVSS v3 base score: 6.1, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-601
cwe_name: URL Redirection to Untrusted Site ('Open Redirect')
description: A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
extended_description: An http parameter may contain a URL value and could cause the web application to redirect the request to the specified URL. By modifying the URL value to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials. Because the server name in the modified link is identical to the original site, phishing attempts have a more trustworthy appearance. Whether this issue poses a vulnerability will be subject to the intended behavior of the application. For example, a search engine might intentionally provide redirects to arbitrary URLs.
         

Fix information:
repo_url: https://github.com/mozilla/PollBot
commit_details: repo_url: https://github.com/mozilla/PollBot
author: Mathieu Leplatre
author_date: 2021-02-26 11:26:06+01:00
msg: Remove leading slashes in 404 redirections

When reaching http://server//page/ the server should not redirect to ``/page`` instead of ``//page``.
repository: repo_url: https://github.com/mozilla/PollBot
repo_name: mozilla/PollBot
description: Robots for checking if things have been delivered
repo_language: Python
owner: mozilla
file_changes: filename: middlewares.py
change_type: ModificationType.MODIFY
diff: @@ -61,7 +61,7 @@ async def handle_any(request, response):
 async def handle_404(request, response):
     if 'json' not in response.headers['Content-Type']:
         if request.path.endswith('/'):
-            return web.HTTPFound(request.path.rstrip('/'))
+            return web.HTTPFound('/' + request.path.strip('/'))
         return web.json_response({
             "status": 404,
             "message": "Page '{}' not found".format(request.path)

programming_language: Python
filename: test_views.py
change_type: ModificationType.MODIFY
diff: @@ -61,6 +61,11 @@ async def test_redirects_trailing_slashes(cli):
     assert resp.headers['Location'] == "/v1/firefox/54.0"
 
 
+async def test_redirects_strip_leading_slashes(cli):
+    resp = await check_response(cli, "//page/", status=302, allow_redirects=False)
+    assert resp.headers['Location'] == "/page"
+
+
 async def check_yaml_resource(cli, url, filename, **kwargs):
     with open(os.path.join(HERE, "..", "pollbot", filename)) as stream:
         content = yaml.safe_load(stream)

programming_language: Python